[go: nahoru, domu]

Put unpremultiply/dither low bit depth tiles behind runtime flag

After discussion with mariakhomenko@, we decided to leave this feature
enabled despite some expected regressions. This change will allow us
to disable this feature via Finch if any unexpected results appear
as this rolls to stable.

Bug: 825589
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I46506aa8807e1c10f0833e414253d1df11cf1382
Reviewed-on: https://chromium-review.googlesource.com/1014285
Reviewed-by: enne <enne@chromium.org>
Commit-Queue: Eric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551095}
diff --git a/cc/raster/gpu_raster_buffer_provider.cc b/cc/raster/gpu_raster_buffer_provider.cc
index 5a4c95c5..9803cfa 100644
--- a/cc/raster/gpu_raster_buffer_provider.cc
+++ b/cc/raster/gpu_raster_buffer_provider.cc
@@ -247,15 +247,6 @@
   ri->DeleteTextures(1, &texture_id);
 }
 
-bool ShouldUnpremultiplyAndDitherResource(viz::ResourceFormat format) {
-  switch (format) {
-    case viz::RGBA_4444:
-      return true;
-    default:
-      return false;
-  }
-}
-
 }  // namespace
 
 // Subclass for InUsePoolResource that holds ownership of a gpu-rastered backing
@@ -351,6 +342,7 @@
     int gpu_rasterization_msaa_sample_count,
     viz::ResourceFormat preferred_tile_format,
     const gfx::Size& max_tile_size,
+    bool unpremultiply_and_dither_low_bit_depth_tiles,
     bool enable_oop_rasterization)
     : compositor_context_provider_(compositor_context_provider),
       worker_context_provider_(worker_context_provider),
@@ -359,6 +351,8 @@
       msaa_sample_count_(gpu_rasterization_msaa_sample_count),
       preferred_tile_format_(preferred_tile_format),
       max_tile_size_(max_tile_size),
+      unpremultiply_and_dither_low_bit_depth_tiles_(
+          unpremultiply_and_dither_low_bit_depth_tiles),
       enable_oop_rasterization_(enable_oop_rasterization) {
   DCHECK(compositor_context_provider);
   DCHECK(worker_context_provider);
@@ -552,4 +546,14 @@
   return LayerTreeResourceProvider::GenerateSyncTokenHelper(ri);
 }
 
+bool GpuRasterBufferProvider::ShouldUnpremultiplyAndDitherResource(
+    viz::ResourceFormat format) const {
+  switch (format) {
+    case viz::RGBA_4444:
+      return unpremultiply_and_dither_low_bit_depth_tiles_;
+    default:
+      return false;
+  }
+}
+
 }  // namespace cc