mirror of
https://github.com/servo/servo.git
synced 2025-06-18 13:24:29 +00:00
This patch fixes a couple of issues in the compositor: 1) Remove the delayed composition code. Previously, this would schedule a composite for 12ms in the future. This doesn't really make any sense with WR. There's no point in doing a composite unless WR has provided a new frame to be drawn. This fixes issues in several benchmarks where we were doing multiple composite / renders per rAF, which is a waste of CPU time. This *does* make the framerate slower in some cases (such as a slow rAF callback) but it's more correct - otherwise we were just compositing the same frame multiple times for no real benefit. 2) Inform the window of the current animation state of the compositor. Specifically, if an animation (or rAF) is currently active, the window system switches to use event polling, and does not block on the OS-level event loop. In the case of active animation, we just assume that we want to be running as the vsync interval and not blocking. This means the compositor thread only sleeps on vsync during animation, which reduces OS scheduling and results in much smoother animation.
54 lines
1.5 KiB
Rust
54 lines
1.5 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#![deny(unsafe_code)]
|
|
#![feature(box_syntax)]
|
|
|
|
extern crate euclid;
|
|
extern crate gfx_traits;
|
|
extern crate gleam;
|
|
extern crate image;
|
|
extern crate ipc_channel;
|
|
#[macro_use]
|
|
extern crate log;
|
|
extern crate msg;
|
|
extern crate net_traits;
|
|
extern crate profile_traits;
|
|
extern crate script_traits;
|
|
extern crate servo_config;
|
|
extern crate servo_geometry;
|
|
extern crate servo_url;
|
|
extern crate style_traits;
|
|
extern crate time;
|
|
extern crate webrender;
|
|
extern crate webrender_traits;
|
|
|
|
pub use compositor_thread::CompositorProxy;
|
|
pub use compositor::IOCompositor;
|
|
use euclid::TypedSize2D;
|
|
use ipc_channel::ipc::IpcSender;
|
|
use msg::constellation_msg::PipelineId;
|
|
use msg::constellation_msg::TopLevelBrowsingContextId;
|
|
use script_traits::{ConstellationControlMsg, LayoutControlMsg};
|
|
use style_traits::CSSPixel;
|
|
|
|
mod compositor;
|
|
pub mod compositor_thread;
|
|
mod touch;
|
|
pub mod windowing;
|
|
|
|
pub struct SendableFrameTree {
|
|
pub pipeline: CompositionPipeline,
|
|
pub size: Option<TypedSize2D<f32, CSSPixel>>,
|
|
pub children: Vec<SendableFrameTree>,
|
|
}
|
|
|
|
/// The subset of the pipeline that is needed for layer composition.
|
|
#[derive(Clone)]
|
|
pub struct CompositionPipeline {
|
|
pub id: PipelineId,
|
|
pub top_level_browsing_context_id: TopLevelBrowsingContextId,
|
|
pub script_chan: IpcSender<ConstellationControlMsg>,
|
|
pub layout_chan: IpcSender<LayoutControlMsg>,
|
|
}
|