зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1591754 - Fix incorrect surface deletions when frames are skipped. r=nical
If the render backend is producing frames too quickly for the renderer thread to consume, old frames are dropped in favor of the most recent frame. When this occurs, we need to ensure that any native surface updates from the skipped frame are also applied. Otherwise, the state of the native surfaces list can get out of sync between the renderer and render backend threads. Differential Revision: https://phabricator.services.mozilla.com/D53122 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c5d9f3067b
Коммит
994cd39af1
|
@ -2490,7 +2490,16 @@ impl Renderer {
|
|||
let device_size = self.device_size;
|
||||
self.render_impl(device_size).ok();
|
||||
}
|
||||
self.active_documents[pos].1 = doc;
|
||||
|
||||
let mut old_doc = mem::replace(
|
||||
&mut self.active_documents[pos].1,
|
||||
doc,
|
||||
);
|
||||
|
||||
// If the document we are overwriting has any pending
|
||||
// native surface updates, ensure they are flushed
|
||||
// before replacing with the new document.
|
||||
self.update_native_surfaces(&mut old_doc.frame.composite_state);
|
||||
}
|
||||
None => self.active_documents.push((document_id, doc)),
|
||||
}
|
||||
|
@ -5008,11 +5017,11 @@ impl Renderer {
|
|||
|
||||
fn update_native_surfaces(
|
||||
&mut self,
|
||||
composite_state: &CompositeState,
|
||||
composite_state: &mut CompositeState,
|
||||
) {
|
||||
match self.compositor_config {
|
||||
CompositorConfig::Native { ref mut compositor, .. } => {
|
||||
for op in &composite_state.native_surface_updates {
|
||||
for op in composite_state.native_surface_updates.drain(..) {
|
||||
match op.details {
|
||||
NativeSurfaceOperationDetails::CreateSurface { size, is_opaque } => {
|
||||
let _inserted = self.allocated_native_surfaces.insert(op.id);
|
||||
|
@ -5065,7 +5074,7 @@ impl Renderer {
|
|||
self.device.disable_stencil();
|
||||
|
||||
self.bind_frame_data(frame);
|
||||
self.update_native_surfaces(&frame.composite_state);
|
||||
self.update_native_surfaces(&mut frame.composite_state);
|
||||
|
||||
for (_pass_index, pass) in frame.passes.iter_mut().enumerate() {
|
||||
#[cfg(not(target_os = "android"))]
|
||||
|
|
Загрузка…
Ссылка в новой задаче