0

[//cc] Pass RasterCaps params explicitly to OneCopyRasterBufferProvider

Rather than passing RasterCaps into ZeroCopyRBP and having it obtain the
format/overlay candidature from there, pass in these params explicitly.
Followup work will do this for all other providers and then have the
RasterBufferProvider base class take in these params and eliminate
RasterBufferProvider::GetFormat() being virtual.

Bug: 403372453
Change-Id: Id1c0069a0abeb6d8dd8433d4d9318470ab9522a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6433926
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1442709}
This commit is contained in:
Colin Blundell
2025-04-04 07:45:56 -07:00
committed by Chromium LUCI CQ
parent 944de1047e
commit da01ebf6fb
6 changed files with 14 additions and 9 deletions

@ -127,7 +127,8 @@ OneCopyRasterBufferProvider::OneCopyRasterBufferProvider(
int max_copy_texture_chromium_size,
bool use_partial_raster,
int max_staging_buffer_usage_in_bytes,
const RasterCapabilities& raster_caps)
const viz::SharedImageFormat& format,
bool is_overlay_candidate)
: compositor_context_provider_(compositor_context_provider),
worker_context_provider_(worker_context_provider),
max_bytes_per_copy_operation_(
@ -137,8 +138,8 @@ OneCopyRasterBufferProvider::OneCopyRasterBufferProvider(
: kMaxBytesPerCopyOperation),
use_partial_raster_(use_partial_raster),
bytes_scheduled_since_last_flush_(0),
tile_format_(raster_caps.tile_format),
tile_overlay_candidate_(raster_caps.tile_overlay_candidate),
tile_format_(format),
tile_overlay_candidate_(is_overlay_candidate),
staging_pool_(std::move(task_runner),
worker_context_provider,
use_partial_raster,

@ -15,7 +15,6 @@
#include "cc/raster/raster_buffer.h"
#include "cc/raster/raster_buffer_provider.h"
#include "cc/raster/staging_buffer_pool.h"
#include "cc/trees/raster_capabilities.h"
#include "components/viz/client/client_resource_provider.h"
#include "gpu/command_buffer/common/sync_token.h"
@ -38,7 +37,8 @@ class CC_EXPORT OneCopyRasterBufferProvider : public RasterBufferProvider {
int max_copy_texture_chromium_size,
bool use_partial_raster,
int max_staging_buffer_usage_in_bytes,
const RasterCapabilities& raster_caps);
const viz::SharedImageFormat& format,
bool is_overlay_candidate);
OneCopyRasterBufferProvider(const OneCopyRasterBufferProvider&) = delete;
~OneCopyRasterBufferProvider() override;

@ -384,7 +384,8 @@ class RasterBufferProviderPerfTest
raster_buffer_provider_ = std::make_unique<OneCopyRasterBufferProvider>(
task_runner_.get(), compositor_context_provider_.get(),
worker_context_provider_.get(), std::numeric_limits<int>::max(),
false, std::numeric_limits<int>::max(), raster_caps);
false, std::numeric_limits<int>::max(), raster_caps.tile_format,
raster_caps.tile_overlay_candidate);
break;
case RASTER_BUFFER_PROVIDER_TYPE_GPU:
Create3dResourceProvider();

@ -192,7 +192,8 @@ class RasterBufferProviderTest
raster_buffer_provider_ = std::make_unique<OneCopyRasterBufferProvider>(
base::SingleThreadTaskRunner::GetCurrentDefault().get(),
context_provider_.get(), worker_context_provider_.get(),
kMaxBytesPerCopyOperation, false, kMaxStagingBuffers, raster_caps);
kMaxBytesPerCopyOperation, false, kMaxStagingBuffers,
raster_caps.tile_format, raster_caps.tile_overlay_candidate);
break;
case RASTER_BUFFER_PROVIDER_TYPE_GPU:
Create3dResourceProvider();

@ -105,7 +105,8 @@ LayerTreeHostPixelResourceTest::CreateRasterBufferProvider(
return std::make_unique<OneCopyRasterBufferProvider>(
task_runner, compositor_context_provider, worker_context_provider,
max_bytes_per_copy_operation, false,
max_staging_buffer_usage_in_bytes, raster_caps);
max_staging_buffer_usage_in_bytes, raster_caps.tile_format,
raster_caps.tile_overlay_candidate);
}
}

@ -4268,7 +4268,8 @@ LayerTreeHostImpl::CreateRasterBufferProvider() {
return std::make_unique<OneCopyRasterBufferProvider>(
GetTaskRunner(), compositor_context_provider, worker_context_provider,
max_copy_texture_chromium_size, settings_.use_partial_raster,
settings_.max_staging_buffer_usage_in_bytes, raster_caps_);
settings_.max_staging_buffer_usage_in_bytes, raster_caps_.tile_format,
raster_caps_.tile_overlay_candidate);
}
void LayerTreeHostImpl::SetLayerTreeMutator(