Bug 1522017 - Clip picture caching debug display to avoid overflowing the browser chrome. r=gw
authorBobby Holley <bobbyholley@gmail.com>
Wed, 23 Jan 2019 14:10:07 -0800
changeset 515323 44febac9160b71d7b9317d09e7ff7a3f4bc8c46f
parent 515322 7ba7f98526f43fff32e7dfced3917400b1eb14eb
child 515324 21462a8e201840d0d529b313ef44df1236ffe529
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw
bugs1522017
milestone66.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 1522017 - Clip picture caching debug display to avoid overflowing the browser chrome. r=gw Differential Revision: https://phabricator.services.mozilla.com/D17436
gfx/wr/webrender/src/picture.rs
--- a/gfx/wr/webrender/src/picture.rs
+++ b/gfx/wr/webrender/src/picture.rs
@@ -1293,17 +1293,17 @@ impl TileCache {
     /// Apply any updates after prim dependency updates. This applies
     /// any late tile invalidations, and sets up the dirty rect and
     /// set of tile blits.
     pub fn post_update(
         &mut self,
         resource_cache: &mut ResourceCache,
         gpu_cache: &mut GpuCache,
         frame_context: &FrameVisibilityContext,
-        _scratch: &mut PrimitiveScratchBuffer,
+        scratch: &mut PrimitiveScratchBuffer,
     ) -> LayoutRect {
         self.dirty_region.clear();
         self.pending_blits.clear();
 
         let descriptor = ImageDescriptor::new(
             TILE_SIZE_WIDTH,
             TILE_SIZE_HEIGHT,
             ImageFormat::BGRA8,
@@ -1394,40 +1394,48 @@ impl TileCache {
 
             // Decide how to handle this tile when drawing this frame.
             if tile.is_valid {
                 // No need to include this is any dirty rect calculations.
                 tile.consider_for_dirty_rect = false;
                 self.tiles_to_draw.push(TileIndex(i));
 
                 if frame_context.debug_flags.contains(DebugFlags::PICTURE_CACHING_DBG) {
-                    let tile_device_rect = tile.world_rect * frame_context.device_pixel_scale;
-                    let mut label_pos = tile_device_rect.origin + DeviceVector2D::new(20.0, 30.0);
-                    _scratch.push_debug_rect(
-                        tile_device_rect,
-                        debug_colors::GREEN,
-                    );
-                    _scratch.push_debug_string(
-                        label_pos,
-                        debug_colors::RED,
-                        format!("{:?} {:?} {:?}", tile.id, tile.handle, tile.world_rect),
-                    );
-                    label_pos.y += 20.0;
-                    _scratch.push_debug_string(
-                        label_pos,
-                        debug_colors::RED,
-                        format!("same: {} frames", tile.same_frames),
-                    );
+                    if let Some(world_rect) = tile.world_rect.intersection(&self.world_bounding_rect) {
+                        let tile_device_rect = world_rect * frame_context.device_pixel_scale;
+                        let mut label_offset = DeviceVector2D::new(20.0, 30.0);
+                        scratch.push_debug_rect(
+                            tile_device_rect,
+                            debug_colors::GREEN,
+                        );
+                        if tile_device_rect.size.height >= label_offset.y {
+                            scratch.push_debug_string(
+                                tile_device_rect.origin + label_offset,
+                                debug_colors::RED,
+                                format!("{:?} {:?} {:?}", tile.id, tile.handle, tile.world_rect),
+                            );
+                        }
+                        label_offset.y += 20.0;
+                        if tile_device_rect.size.height >= label_offset.y {
+                            scratch.push_debug_string(
+                                tile_device_rect.origin + label_offset,
+                                debug_colors::RED,
+                                format!("same: {} frames", tile.same_frames),
+                            );
+                        }
+                    }
                 }
             } else {
                 if frame_context.debug_flags.contains(DebugFlags::PICTURE_CACHING_DBG) {
-                    _scratch.push_debug_rect(
-                        visible_rect * frame_context.device_pixel_scale,
-                        debug_colors::RED,
-                    );
+                    if let Some(world_rect) = visible_rect.intersection(&self.world_bounding_rect) {
+                        scratch.push_debug_rect(
+                            world_rect * frame_context.device_pixel_scale,
+                            debug_colors::RED,
+                        );
+                    }
                 }
 
                 // Only cache tiles that have had the same content for at least two
                 // frames. This skips caching on pages / benchmarks that are changing
                 // every frame, which is wasteful.
                 if tile.same_frames > FRAMES_BEFORE_CACHING {
                     // Ensure that this texture is allocated.
                     resource_cache.texture_cache.update(