aboutsummaryrefslogtreecommitdiffstats
path: root/components/servo/lib.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2020-02-21 11:54:44 -0500
committerGitHub <noreply@github.com>2020-02-21 11:54:44 -0500
commitbe4ecb9233b06c88e1a7a6f64b4f286afb16bfdc (patch)
tree9ab74b969ae7aea757732001a6abb1f02765f49e /components/servo/lib.rs
parentafb1faf80f3efbdd2611adad74a125b37df25f61 (diff)
parentc21574623ffb3417e81aaa0c778a26be7d7483d7 (diff)
downloadservo-be4ecb9233b06c88e1a7a6f64b4f286afb16bfdc.tar.gz
servo-be4ecb9233b06c88e1a7a6f64b4f286afb16bfdc.zip
Auto merge of #25822 - jdm:delay-reftest-async-render, r=emilio
Delay reftest screenshot while WR frame is rendering This PR addresses the theory that #24726 occurs when WR is performing an async frame render and the reftest screenshot decides it's time to synchronously read the framebuffer. If there have not been any completed frames rendered yet, that would yield the page background colour. The changes in this PR introduce an additional layer of synchronization - the compositor stores an AtomicBool value that indicates whether we know that a WR frame has started rendering, which is set to true when an IPC request from layout that submits a new display list is received. This bool is set to false when WR notifies us that a frame has been rendered. The screenshot code refuses to take a screenshot if the bool is true, causing us to delay taking a screenshot until there is no frame pending.
Diffstat (limited to 'components/servo/lib.rs')
-rw-r--r--components/servo/lib.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index f9d3b91ae82..bb408eaa2b5 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -115,6 +115,7 @@ use std::borrow::Cow;
use std::cmp::max;
use std::path::PathBuf;
use std::rc::Rc;
+use std::sync::atomic::AtomicBool;
use std::sync::{Arc, Mutex};
#[cfg(not(target_os = "windows"))]
use surfman::platform::default::device::Device as HWDevice;
@@ -505,6 +506,8 @@ where
device_pixel_ratio: Scale::new(device_pixel_ratio),
};
+ let pending_wr_frame = Arc::new(AtomicBool::new(false));
+
// Create the constellation, which maintains the engine
// pipelines, including the script and layout threads, as well
// as the navigation context.
@@ -527,6 +530,7 @@ where
glplayer_threads,
event_loop_waker,
window_size,
+ pending_wr_frame.clone(),
);
// Send the constellation's swmanager sender to service worker manager thread
@@ -553,6 +557,7 @@ where
webrender_api,
webvr_heartbeats,
webxr_main_thread,
+ pending_wr_frame,
},
opts.output_file.clone(),
opts.is_running_problem_test,
@@ -865,6 +870,7 @@ fn create_constellation(
glplayer_threads: Option<GLPlayerThreads>,
event_loop_waker: Option<Box<dyn EventLoopWaker>>,
initial_window_size: WindowSizeData,
+ pending_wr_frame: Arc<AtomicBool>,
) -> (Sender<ConstellationMsg>, SWManagerSenders) {
// Global configuration options, parsed from the command line.
let opts = opts::get();
@@ -907,6 +913,7 @@ fn create_constellation(
glplayer_threads,
player_context,
event_loop_waker,
+ pending_wr_frame,
};
let (canvas_chan, ipc_canvas_chan) = canvas::canvas_paint_thread::CanvasPaintThread::start();