From 8b0d34ef4b51ae2ddb790b6a2958ee67e3876077 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Mon, 13 Apr 2020 15:56:14 +0000 Subject: [PATCH] Bug 1628901 - Fix panic caused by calling BeginDraw with empty dirty rect. r=sotaro Previously, it was possible for a tile that had a valid scroll root to have an empty valid (and dirty) rect due to the picture cache clip rect, in some situations. This could result in the tile not being tagged as off-screen, which means it is added to the queue of tiles to be updated. On most platforms this is benign, but the BeginDraw method of DirectComposition fails if the dirty rect is empty. This patch fixes the logic so that tiles that meet these conditions are correctly tagged as not visible, and skipped from update queue. Differential Revision: https://phabricator.services.mozilla.com/D70616 [ghsync] From https://hg.mozilla.org/mozilla-central/rev/73632227ba00df584e8f6fcc1191e6dfa13fc5fd --- webrender/src/picture.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/webrender/src/picture.rs b/webrender/src/picture.rs index 167bf72cf2..771453f5ce 100644 --- a/webrender/src/picture.rs +++ b/webrender/src/picture.rs @@ -5060,8 +5060,7 @@ impl PicturePrimitive { for tile in tile_cache.tiles.values_mut() { - // Only check for occlusion on visible tiles that are fixed position. - if tile.is_visible && tile_cache.spatial_node_index == ROOT_SPATIAL_NODE_INDEX { + if tile.is_visible { // Get the world space rect that this tile will actually occupy on screem let device_draw_rect = device_clip_rect.intersection(&tile.device_valid_rect); @@ -5071,7 +5070,9 @@ impl PicturePrimitive { // code below. match device_draw_rect { Some(device_draw_rect) => { - if frame_state.composite_state.is_tile_occluded(tile.z_id, device_draw_rect) { + // Only check for occlusion on visible tiles that are fixed position. + if tile_cache.spatial_node_index == ROOT_SPATIAL_NODE_INDEX && + frame_state.composite_state.is_tile_occluded(tile.z_id, device_draw_rect) { // If this tile has an allocated native surface, free it, since it's completely // occluded. We will need to re-allocate this surface if it becomes visible, // but that's likely to be rare (e.g. when there is no content display list