Bug 1546126 - Fix the max blob tile limit logic. r=kats
authorNicolas Silva <nsilva@mozilla.com>
Fri, 26 Apr 2019 15:38:54 +0000
changeset 530357 d9a0cc432b2e898d3fc74a2183c931018237c668
parent 530356 76dd4019ac47807e8f2bcbe4be2ed61221fa8ec8
child 530358 e8c59393c80952adfffd0be0de34c3ae7e48e36a
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)
reviewerskats
bugs1546126
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 1546126 - Fix the max blob tile limit logic. r=kats Differential Revision: https://phabricator.services.mozilla.com/D28991
gfx/wr/webrender/src/resource_cache.rs
--- a/gfx/wr/webrender/src/resource_cache.rs
+++ b/gfx/wr/webrender/src/resource_cache.rs
@@ -1211,24 +1211,26 @@ impl ResourceCache {
                 const MAX_TILES_PER_REQUEST: i32 = 512;
                 // For truly nonsensical requests, we might run into overflow
                 // when computing width * height, so we first check each extent
                 // individually.
                 while !tiles.size.is_empty_or_negative()
                     && (tiles.size.width > MAX_TILES_PER_REQUEST
                         || tiles.size.height > MAX_TILES_PER_REQUEST
                         || tiles.size.width * tiles.size.height > MAX_TILES_PER_REQUEST) {
-                    let diff = tiles.size.width * tiles.size.height - MAX_TILES_PER_REQUEST;
+                    let w = tiles.size.width;
+                    let h = tiles.size.height;
+                    let diff = w * h - MAX_TILES_PER_REQUEST;
                     // Remove tiles in the largest dimension.
                     if tiles.size.width > tiles.size.height {
-                        tiles.size.width -= diff / tiles.size.height + 1;
-                        tiles.origin.x += diff / (2 * tiles.size.height);
+                        tiles.size.width -= diff / h + 1;
+                        tiles.origin.x += diff / (2 * h);
                     } else {
-                        tiles.size.height -= diff / tiles.size.width + 1;
-                        tiles.origin.y += diff / (2 * tiles.size.height);
+                        tiles.size.height -= diff / w + 1;
+                        tiles.origin.y += diff / (2 * w);
                     }
                 }
 
                 // When originally requested tile range exceeds MAX_TILES_PER_REQUEST,
                 // some tiles are not rasterized by AsyncBlobImageRasterizer.
                 // They need to be cleared.
                 if original_tile_range != tiles {
                     let clear_params = BlobImageClearParams {