[go: nahoru, domu]

cc: Compute |visible_rect| for tiled mask layers to limit raster

For single tile mask layers |visible_rect| is only used as bool to
check for non empty. For tiled mask layers correct |visible_rect| is
needed to limit the amount of resource we generated for raster the
tiled masks. This bug was discovered when we have a tiled mask layer
with big scale and we try to create tiles to covered enlarged space
and eventually OOM.

Compute |visible_rect| correctly results in breaking the assumption
that tiled mask layer's |to_target| is only a scale. This changes the
computation in |RenderSurfaceImpl| of how to convert tile quads into
tiled mask render pass quads.

This CL is aimed to fix release blocking bug and thus has limited
scoped. There are two potential follow-ups: check for scale of tiled
mask layer, and adjust render surface rect.

For scale check: ideally tiled mask layer should be in the same
space as the render surface, this should simplify computation when
converting from tiled quads to render pass quads.

For render surface rect: it does not make sense for render surface to
have different size than the mask layer's visible rect. Right now
render surfaces are unclipped and bounded by maxium texture size, while
tiled mask visible size is clipped. To make these two sizes match there
needs more investigation into whether unit tests still make sense, and
should be in another CL.


R=danakj

Bug: 820727
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I62c7c992d99088c1f8cdbe4ffbac520b0a7d1a53
Reviewed-on: https://chromium-review.googlesource.com/1037629
Commit-Queue: weiliangc <weiliangc@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557985}
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 26c8c56..2fe4917 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -678,6 +678,7 @@
     "trees/layer_tree_host_unittest_context.cc",
     "trees/layer_tree_host_unittest_copyrequest.cc",
     "trees/layer_tree_host_unittest_damage.cc",
+    "trees/layer_tree_host_unittest_masks.cc",
     "trees/layer_tree_host_unittest_occlusion.cc",
     "trees/layer_tree_host_unittest_picture.cc",
     "trees/layer_tree_host_unittest_proxy.cc",