aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_thread
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-10-09 10:30:24 -0700
committerGitHub <noreply@github.com>2024-10-09 17:30:24 +0000
commit9195344b75b4e5fd1cd86671b10df46a956f0fea (patch)
tree20ef541e886032195be6ae57403e4c05ff438c26 /components/layout_thread
parent30cbf01280dc3aa03caeaba11f55808f7ba59cf3 (diff)
downloadservo-9195344b75b4e5fd1cd86671b10df46a956f0fea.tar.gz
servo-9195344b75b4e5fd1cd86671b10df46a956f0fea.zip
compositor: Create a single cross-process compositor API (#33619) (#33660)
Instead of exposing many different kinds of messages to the compositor that are routed through the constellation, expose a single message type which can be sent across IPC channels. In addition, this IPC channel and the route to the crossbeam channel with the compositor is created along with the `CompositorProxy`, simplifying what needs to be passed around during pipeline initialization. Previously, some image updates (from video) were sent over IPC with a special serialization routine and some were sent via crossbeam channels (canvas). Now all updates go over the IPC channel `IpcSharedMemory` is used to avoid serialization penalties. This should improve performance and reduce copies for video, but add a memory copy overhead for canvas. This will improve in the future when canvas renders directly into a texture. All-in-all this is a simplification which opens the path toward having a standard compositor API and reduces the number of duplicate messages and proxying that had to happen in libservo. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/layout_thread')
-rw-r--r--components/layout_thread/lib.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 3f7abcb9c2b..7a6ad0ae7a8 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -105,7 +105,7 @@ use style_traits::{CSSPixel, DevicePixel, SpeculativePainter};
use time_03::Duration;
use url::Url;
use webrender_api::{units, ColorF, HitTestFlags};
-use webrender_traits::WebRenderScriptApi;
+use webrender_traits::CrossProcessCompositorApi;
/// Information needed by layout.
pub struct LayoutThread {
@@ -170,8 +170,8 @@ pub struct LayoutThread {
/// The executors for paint worklets.
registered_painters: RegisteredPaintersImpl,
- /// Webrender interface.
- webrender_api: WebRenderScriptApi,
+ /// Cross-process access to the compositor API.
+ compositor_api: CrossProcessCompositorApi,
/// Paint time metrics.
paint_time_metrics: PaintTimeMetrics,
@@ -201,7 +201,7 @@ impl LayoutFactory for LayoutFactoryImpl {
config.resource_threads,
config.system_font_service,
config.time_profiler_chan,
- config.webrender_api_sender,
+ config.compositor_api,
config.paint_time_metrics,
config.window_size,
))
@@ -249,7 +249,7 @@ impl Drop for LayoutThread {
let (keys, instance_keys) = self
.font_context
.collect_unused_webrender_resources(true /* all */);
- self.webrender_api
+ self.compositor_api
.remove_unused_font_resources(keys, instance_keys)
}
}
@@ -359,7 +359,7 @@ impl Layout for LayoutThread {
let client_point = units::DevicePoint::from_untyped(point);
let results = self
- .webrender_api
+ .compositor_api
.hit_test(Some(self.id.into()), client_point, flags);
results.iter().map(|result| result.node.into()).collect()
@@ -563,12 +563,12 @@ impl LayoutThread {
resource_threads: ResourceThreads,
system_font_service: Arc<SystemFontServiceProxy>,
time_profiler_chan: profile_time::ProfilerChan,
- webrender_api: WebRenderScriptApi,
+ compositor_api: CrossProcessCompositorApi,
paint_time_metrics: PaintTimeMetrics,
window_size: WindowSizeData,
) -> LayoutThread {
// Let webrender know about this pipeline by sending an empty display list.
- webrender_api.send_initial_transaction(id.into());
+ compositor_api.send_initial_transaction(id.into());
let mut font = Font::initial_values();
let default_font_size = pref!(fonts.default_size);
@@ -580,7 +580,7 @@ impl LayoutThread {
let font_context = Arc::new(FontContext::new(
system_font_service,
- webrender_api.clone(),
+ compositor_api.clone(),
resource_threads,
));
let device = Device::new(
@@ -612,7 +612,7 @@ impl LayoutThread {
Au::from_f32_px(window_size.initial_viewport.width),
Au::from_f32_px(window_size.initial_viewport.height),
),
- webrender_api,
+ compositor_api,
stylist: Stylist::new(device, QuirksMode::NoQuirks),
display_list: Default::default(),
indexable_text: Default::default(),
@@ -937,13 +937,13 @@ impl LayoutThread {
self.paint_time_metrics
.maybe_observe_paint_time(self, epoch, is_contentful.0);
- self.webrender_api
+ self.compositor_api
.send_display_list(compositor_info, builder.end().1);
let (keys, instance_keys) = self
.font_context
.collect_unused_webrender_resources(false /* all */);
- self.webrender_api
+ self.compositor_api
.remove_unused_font_resources(keys, instance_keys)
},
);
@@ -1186,7 +1186,7 @@ impl LayoutThread {
.insert(state.scroll_id, state.scroll_offset);
let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y);
- self.webrender_api.send_scroll_node(
+ self.compositor_api.send_scroll_node(
self.id.into(),
units::LayoutPoint::from_untyped(point),
state.scroll_id,