Bug 1747857 - Invalidate partial dirty rects when surface counts change. r=aosmond, a=RyanVM

This is a sufficient fix to handle this case, we should definitely
invalidate the dirty rect validity if the compositor surface count
has changed.

There are likely other cases where the surface count remains the same
but we also need to invalidate dirty rect validity (we can handle
these as follow ups and/or as we encounter other cases).

Differential Revision: https://phabricator.services.mozilla.com/D135462
This commit is contained in:
Glenn Watson 2022-01-10 20:10:20 +00:00
parent abe696e78b
commit b7a587021e
2 changed files with 23 additions and 1 deletions

View File

@ -790,6 +790,22 @@ impl CompositeState {
}
}
/// Compare this state vs. a previous frame state, and invalidate dirty rects if
/// the surface count has changed
pub fn update_dirty_rect_validity(
&mut self,
old_descriptor: &CompositeDescriptor,
) {
// TODO(gw): Make this more robust in other cases - there are other situations where
// the surface count may be the same but we still need to invalidate the
// dirty rects (e.g. if the surface ordering changed, or the external
// surface itself is animated?)
if old_descriptor.surfaces.len() != self.descriptor.surfaces.len() {
self.dirty_rects_are_valid = false;
}
}
fn compute_external_surface_dependencies(
&mut self,
external_surface: &ExternalSurfaceDescriptor,

View File

@ -1469,7 +1469,7 @@ impl RenderBackend {
*frame_counter += 1;
// borrow ck hack for profile_counters
let (pending_update, rendered_document) = {
let (pending_update, mut rendered_document) = {
let frame_build_start_time = precise_time_ns();
let frame_stats = doc.frame_stats.take();
@ -1495,6 +1495,12 @@ impl RenderBackend {
(pending_update, rendered_document)
};
// Invalidate dirty rects if the compositing config has changed significantly
rendered_document
.frame
.composite_state
.update_dirty_rect_validity(&doc.prev_composite_descriptor);
// Build a small struct that represents the state of the tiles to be composited.
let composite_descriptor = rendered_document
.frame