0

[//cc] Expand TransferableResource::MakeSoftware() to variants

Expands callsites to explicitly invoke MakeSoftwareSharedImage() or
MakeSoftwareSharedBitmap() based on what they are passing.

Bug: 337538024
Change-Id: I7d61c9decfc6df2052bdce05e71780f8d0dfb37a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5498365
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1295308}
This commit is contained in:
Colin Blundell
2024-05-02 08:19:50 +00:00
committed by Chromium LUCI CQ
parent 1717b17fc0
commit bd67aa45b7
4 changed files with 14 additions and 11 deletions

@ -343,13 +343,16 @@ bool ResourcePool::PrepareForExport(
viz::TransferableResource::SynchronizationType::kGpuCommandsCompleted;
} else {
SoftwareBacking* software_backing = resource->software_backing();
const gpu::Mailbox& mailbox =
transferable =
software_backing->shared_image
? software_backing->shared_image->mailbox()
: software_backing->shared_bitmap_id;
transferable = viz::TransferableResource::MakeSoftware(
mailbox, software_backing->mailbox_sync_token, resource->size(),
resource->format(), resource_source);
? viz::TransferableResource::MakeSoftwareSharedImage(
software_backing->shared_image,
software_backing->mailbox_sync_token, resource->size(),
resource->format(), resource_source)
: viz::TransferableResource::MakeSoftwareSharedBitmap(
software_backing->shared_bitmap_id,
software_backing->mailbox_sync_token, resource->size(),
resource->format(), resource_source);
}
transferable.color_space = resource->color_space();
resource->set_resource_id(resource_provider_->ImportResource(

@ -246,7 +246,7 @@ viz::ResourceId PixelTest::AllocateAndFillSoftwareResource(
source.readPixels(info, mapping.memory(), info.minRowBytes(), 0, 0);
return child_resource_provider_->ImportResource(
viz::TransferableResource::MakeSoftware(
viz::TransferableResource::MakeSoftwareSharedBitmap(
shared_bitmap_id, gpu::SyncToken(), size,
viz::SinglePlaneFormat::kRGBA_8888),
base::DoNothing());

@ -4800,13 +4800,13 @@ void LayerTreeHostImpl::CreateUIResource(UIResourceId uid,
} else if (use_shared_image_software) {
auto sii = layer_tree_frame_sink_->shared_image_interface();
gpu::SyncToken sync_token = sii->GenVerifiedSyncToken();
transferable = viz::TransferableResource::MakeSoftware(
client_shared_image->mailbox(), sync_token, upload_size, format,
transferable = viz::TransferableResource::MakeSoftwareSharedImage(
client_shared_image, sync_token, upload_size, format,
viz::TransferableResource::ResourceSource::kUI);
} else {
layer_tree_frame_sink_->DidAllocateSharedBitmap(std::move(shm.region),
shared_bitmap_id);
transferable = viz::TransferableResource::MakeSoftware(
transferable = viz::TransferableResource::MakeSoftwareSharedBitmap(
shared_bitmap_id, gpu::SyncToken(), upload_size, format,
viz::TransferableResource::ResourceSource::kUI);
}

@ -10789,7 +10789,7 @@ class BlendStateCheckLayer : public LayerImpl {
quad_rect_(5, 5, 5, 5),
quad_visible_rect_(5, 5, 5, 5) {
resource_id_ = resource_provider_->ImportResource(
viz::TransferableResource::MakeSoftware(
viz::TransferableResource::MakeSoftwareSharedBitmap(
viz::SharedBitmap::GenerateId(), gpu::SyncToken(), gfx::Size(1, 1),
viz::SinglePlaneFormat::kRGBA_8888),
base::DoNothing());