0

[//cc] Have GpuRBP::RasterBufferImpl use state from Backing directly

GpuRBP::RasterBufferImpl adds state to ResourcePool::Backing when
constructing it and also stores that state directly. This CL changes it
to just use the state from the backing directly. This is a step toward
having the Backing create its SharedImage internally.

Note: InUsePoolResource's values for this state as well as for the
backing itself ultimately come from PoolResource via its `resource_`
field. PoolResource does not change the value of this state
post-construction [1] and GpuRBP::RasterBufferImpl never resets the
value of the backing post its initial installation in [2], so the values
for the state as returned by InUsePoolResource are guaranteed to be the
same as the values returned from the backing.

[1] https://source.chromium.org/chromium/chromium/src/+/main:cc/resources/resource_pool.h;l=361-363?q=PoolResource&ss=chromium
[2]
https://source.chromium.org/chromium/chromium/src/+/main:cc/raster/gpu_raster_buffer_provider.cc;l=67;drc=304476fc888332d14c19ecc697414b5d29a55d97;bpv=1;bpt=1

Bug: 40064122
Change-Id: I6f1ae5df1456b38c614465553cde9347c084513c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6329478
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1429354}
This commit is contained in:
Colin Blundell
2025-03-06 23:54:55 -08:00
committed by Chromium LUCI CQ
parent ea2e759141
commit c76fe2e0a4
2 changed files with 6 additions and 12 deletions

@ -51,9 +51,6 @@ GpuRasterBufferProvider::RasterBufferImpl::RasterBufferImpl(
bool depends_on_hardware_accelerated_jpeg_candidates,
bool depends_on_hardware_accelerated_webp_candidates)
: client_(client),
resource_size_(in_use_resource.size()),
shared_image_format_(in_use_resource.format()),
color_space_(in_use_resource.color_space()),
resource_has_previous_content_(resource_has_previous_content),
depends_on_at_raster_decodes_(depends_on_at_raster_decodes),
depends_on_hardware_accelerated_jpeg_candidates_(
@ -352,10 +349,10 @@ void GpuRasterBufferProvider::RasterBufferImpl::RasterizeSource(
} else if (client_->is_using_raw_draw_) {
flags |= gpu::SHARED_IMAGE_USAGE_RAW_DRAW;
}
backing_->set_shared_image(
sii->CreateSharedImage({shared_image_format_, resource_size_,
color_space_, flags, "GpuRasterTile"},
gpu::kNullSurfaceHandle));
backing_->set_shared_image(sii->CreateSharedImage(
{backing_->format(), backing_->size(), backing_->color_space(), flags,
"GpuRasterTile"},
gpu::kNullSurfaceHandle));
CHECK(backing_->shared_image());
mailbox_needs_clear = true;
ri->WaitSyncTokenCHROMIUM(sii->GenUnverifiedSyncToken().GetConstData());
@ -387,8 +384,8 @@ void GpuRasterBufferProvider::RasterBufferImpl::RasterizeSource(
ri->BeginRasterCHROMIUM(
raster_source->background_color(), mailbox_needs_clear,
playback_settings.msaa_sample_count, msaa_mode, use_lcd_text,
playback_settings.visible, color_space_, playback_settings.hdr_headroom,
backing_->shared_image()->mailbox().name);
playback_settings.visible, backing_->color_space(),
playback_settings.hdr_headroom, backing_->shared_image()->mailbox().name);
gfx::Vector2dF recording_to_raster_scale = transform.scale();
recording_to_raster_scale.InvScale(raster_source->recording_scale_factor());

@ -128,9 +128,6 @@ class CC_EXPORT GpuRasterBufferProvider : public RasterBufferProvider {
raw_ptr<ResourcePool::Backing> backing_;
// These fields are for use on the worker thread.
const gfx::Size resource_size_;
const viz::SharedImageFormat shared_image_format_;
const gfx::ColorSpace color_space_;
const bool resource_has_previous_content_;
const bool depends_on_at_raster_decodes_;
const bool depends_on_hardware_accelerated_jpeg_candidates_;