Bug 1538540 - Respect texture_cache rebuild reqs even if doc has no pixels r=kvark
authorDoug Thayer <dothayer@mozilla.com>
Fri, 03 May 2019 20:30:46 +0000
changeset 531428 ee580278f872fc2b68631da034d80a3dbf4eed2a
parent 531427 1b3ddfeda3ba7c39df47f2d21f9bc3416d9d340f
child 531429 4dabc47dec1223930955d6e7eeb09d7fb5a61661
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskvark
bugs1538540
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1538540 - Respect texture_cache rebuild reqs even if doc has no pixels r=kvark If a document has an empty rect for whatever reason (in the case observed, this was due to running a full screen video in the content document, which occludes the chrome document), then we still want to ensure that we build a frame if the texture cache has performed a clear, as otherwise we may try to access stale items from the texture resolver in render_impl. Differential Revision: https://phabricator.services.mozilla.com/D29848
gfx/wr/webrender/src/render_backend.rs
--- a/gfx/wr/webrender/src/render_backend.rs
+++ b/gfx/wr/webrender/src/render_backend.rs
@@ -1410,29 +1410,32 @@ impl RenderBackend {
         if !doc.can_render() {
             // TODO: this happens if we are building the first scene asynchronously and
             // scroll at the same time. we should keep track of the fact that we skipped
             // composition here and do it as soon as we receive the scene.
             render_frame = false;
         }
 
         // Avoid re-building the frame if the current built frame is still valid.
-        let build_frame = (render_frame && !doc.frame_is_valid) ||
-            self.resource_cache.requires_frame_build() &&
-            doc.frame_builder.is_some();
+        // However, if the resource_cache requires a frame build, _always_ do that, unless
+        // doc.can_render() is false, as in that case a frame build can't happen anyway.
+        // We want to ensure we do this because even if the doc doesn't have pixels it
+        // can still try to access stale texture cache items.
+        let build_frame = (render_frame && !doc.frame_is_valid && doc.has_pixels()) ||
+            (self.resource_cache.requires_frame_build() && doc.can_render());
 
         // Request composite is true when we want to composite frame even when
         // there is no frame update. This happens when video frame is updated under
         // external image with NativeTexture or when platform requested to composite frame.
         if invalidate_rendered_frame {
             doc.rendered_frame_is_valid = false;
         }
 
         let mut frame_build_time = None;
-        if build_frame && doc.has_pixels() {
+        if build_frame {
             profile_scope!("generate frame");
 
             *frame_counter += 1;
             doc.rendered_frame_is_valid = false;
 
             // borrow ck hack for profile_counters
             let (pending_update, rendered_document) = {
                 let _timer = profile_counters.total_time.timer();