[go: nahoru, domu]

Move tile caps to RasterCapabilities

Compute the tile texture target and if tiles are overlay candidates once
when computing the other raster related capabilities. These values never
change so no need to recompute for each tile allocation.

Bug: 1442970
Change-Id: If5bb2cd12316cb7cd359120b72d82ad5bd7ae449
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4633621
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Kyle Charbonneau <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1168958}
diff --git a/cc/raster/zero_copy_raster_buffer_provider.cc b/cc/raster/zero_copy_raster_buffer_provider.cc
index f9e8afb0..43ae472 100644
--- a/cc/raster/zero_copy_raster_buffer_provider.cc
+++ b/cc/raster/zero_copy_raster_buffer_provider.cc
@@ -175,7 +175,8 @@
     const RasterCapabilities& raster_caps)
     : gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
       compositor_context_provider_(compositor_context_provider),
-      tile_format_(raster_caps.tile_format) {}
+      tile_format_(raster_caps.tile_format),
+      tile_texture_target_(raster_caps.tile_texture_target) {}
 
 ZeroCopyRasterBufferProvider::~ZeroCopyRasterBufferProvider() = default;
 
@@ -189,13 +190,8 @@
     bool depends_on_hardware_accelerated_webp_candidates) {
   if (!resource.gpu_backing()) {
     auto backing = std::make_unique<ZeroCopyGpuBacking>();
-    const gpu::Capabilities& caps =
-        compositor_context_provider_->ContextCapabilities();
-    backing->texture_target = gpu::GetBufferTextureTarget(
-        kBufferUsage,
-        viz::SinglePlaneSharedImageFormatToBufferFormat(resource.format()),
-        caps);
     backing->overlay_candidate = true;
+    backing->texture_target = tile_texture_target_;
     // This RasterBufferProvider will modify the resource outside of the
     // GL command stream. So resources should not become available for reuse
     // until they are not in use by the gpu anymore, which a fence is used