mirror of
https://github.com/servo/servo.git
synced 2025-09-29 16:19:14 +01:00
Delay frames for canavs
This commit is contained in:
parent
1555d4f50a
commit
87106931cd
1 changed files with 36 additions and 30 deletions
|
@ -652,11 +652,13 @@ impl IOCompositor {
|
||||||
},
|
},
|
||||||
|
|
||||||
CompositorMsg::GenerateFrame => {
|
CompositorMsg::GenerateFrame => {
|
||||||
self.prepare_screenshot_requests_for_render();
|
|
||||||
|
|
||||||
let mut global = self.global.borrow_mut();
|
let mut global = self.global.borrow_mut();
|
||||||
global.frame_delayer.set_pending_frame(true);
|
global.frame_delayer.set_pending_frame(true);
|
||||||
if global.frame_delayer.needs_new_frame() {
|
|
||||||
|
if !global.frame_delayer.needs_new_frame() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let mut transaction = Transaction::new();
|
let mut transaction = Transaction::new();
|
||||||
self.generate_frame(&mut transaction, RenderReasons::SCENE);
|
self.generate_frame(&mut transaction, RenderReasons::SCENE);
|
||||||
global.send_transaction(transaction);
|
global.send_transaction(transaction);
|
||||||
|
@ -668,7 +670,8 @@ impl IOCompositor {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
global.frame_delayer.set_pending_frame(false);
|
global.frame_delayer.set_pending_frame(false);
|
||||||
}
|
|
||||||
|
self.prepare_screenshot_requests_for_render(&mut global);
|
||||||
},
|
},
|
||||||
|
|
||||||
CompositorMsg::GenerateImageKey(sender) => {
|
CompositorMsg::GenerateImageKey(sender) => {
|
||||||
|
@ -718,6 +721,7 @@ impl IOCompositor {
|
||||||
waiting_pipelines,
|
waiting_pipelines,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
self.prepare_screenshot_requests_for_render(&mut *global);
|
||||||
}
|
}
|
||||||
|
|
||||||
global.send_transaction(txn);
|
global.send_transaction(txn);
|
||||||
|
@ -1578,6 +1582,10 @@ impl IOCompositor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn has_pending_frames(&self) -> bool {
|
||||||
|
self.pending_frames.get() != 0 || self.global.borrow().frame_delayer.pending_frame
|
||||||
|
}
|
||||||
|
|
||||||
pub fn request_screenshot(
|
pub fn request_screenshot(
|
||||||
&self,
|
&self,
|
||||||
webview_id: WebViewId,
|
webview_id: WebViewId,
|
||||||
|
@ -1599,7 +1607,6 @@ impl IOCompositor {
|
||||||
webview_id: WebViewId,
|
webview_id: WebViewId,
|
||||||
expected_epochs: FxHashMap<PipelineId, Epoch>,
|
expected_epochs: FxHashMap<PipelineId, Epoch>,
|
||||||
) {
|
) {
|
||||||
{
|
|
||||||
let mut global = self.global.borrow_mut();
|
let mut global = self.global.borrow_mut();
|
||||||
let expected_epochs = Rc::new(expected_epochs);
|
let expected_epochs = Rc::new(expected_epochs);
|
||||||
|
|
||||||
|
@ -1612,17 +1619,15 @@ impl IOCompositor {
|
||||||
screenshot_request.state =
|
screenshot_request.state =
|
||||||
ScreenshotRequestState::WaitingOnPipelines(expected_epochs.clone());
|
ScreenshotRequestState::WaitingOnPipelines(expected_epochs.clone());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if self.prepare_screenshot_requests_for_render() {
|
if self.prepare_screenshot_requests_for_render(&mut global) {
|
||||||
let mut transaction = Transaction::new();
|
let mut transaction = Transaction::new();
|
||||||
self.generate_frame(&mut transaction, RenderReasons::APZ);
|
self.generate_frame(&mut transaction, RenderReasons::APZ);
|
||||||
self.global.borrow_mut().send_transaction(transaction);
|
global.send_transaction(transaction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_screenshot_requests_for_render(&self) -> bool {
|
fn prepare_screenshot_requests_for_render(&self, global: &mut ServoRenderer) -> bool {
|
||||||
let mut global = self.global.borrow_mut();
|
|
||||||
let mut any_became_ready = false;
|
let mut any_became_ready = false;
|
||||||
|
|
||||||
for screenshot_request in global.screenshot_requests.iter_mut() {
|
for screenshot_request in global.screenshot_requests.iter_mut() {
|
||||||
|
@ -1655,9 +1660,10 @@ impl IOCompositor {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn maybe_trigger_paint_for_screenshot(&self) {
|
fn maybe_trigger_paint_for_screenshot(&self) {
|
||||||
if self.pending_frames.get() != 0 {
|
if self.has_pending_frames() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if self
|
if self
|
||||||
.global
|
.global
|
||||||
.borrow()
|
.borrow()
|
||||||
|
@ -1670,7 +1676,7 @@ impl IOCompositor {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn maybe_take_screenshots(&self) {
|
fn maybe_take_screenshots(&self) {
|
||||||
if self.pending_frames.get() != 0 {
|
if self.has_pending_frames() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue