[//cc] Convert a couple sites from creating ResourceFormat to SIF
This CL converts two sites in //cc from creating ResourceFormat to
creating SharedImageFormat as followup to
https://chromium-review.googlesource.com/c/chromium/src/+/4240739. This
avoids needing conversions at the point of calling
SII::CreateSharedImage(). There are some conversions *back* to
ResourceFormat that are required, but presumably those themselves will
be converted to use SIF in the fullness of time.
Bug: 1414192
Change-Id: Idba25aae7eef5096f736edb173e1d04ea5dfb691
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4248619
Reviewed-by: ccameron chromium <ccameron@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1105539}
diff --git a/cc/slim/frame_sink_impl.cc b/cc/slim/frame_sink_impl.cc
index 9b58249ca..fb8e04c 100644
--- a/cc/slim/frame_sink_impl.cc
+++ b/cc/slim/frame_sink_impl.cc
@@ -114,16 +114,16 @@
LOG(ERROR) << "Size exceeds max texture size";
return;
}
- viz::ResourceFormat format = viz::ResourceFormat::RGBA_8888;
+ viz::SharedImageFormat format = viz::SinglePlaneFormat::kRGBA_8888;
switch (resource_bitmap.GetFormat()) {
case cc::UIResourceBitmap::RGBA8:
- format = viz::PlatformColor::BestSupportedTextureResourceFormat(caps);
+ format = viz::PlatformColor::BestSupportedTextureFormat(caps);
break;
case cc::UIResourceBitmap::ALPHA_8:
- format = viz::ALPHA_8;
+ format = viz::SinglePlaneFormat::kALPHA_8;
break;
case cc::UIResourceBitmap::ETC1:
- format = viz::ETC1;
+ format = viz::SinglePlaneFormat::kETC1;
break;
}
@@ -132,15 +132,14 @@
constexpr gfx::ColorSpace color_space = gfx::ColorSpace::CreateSRGB();
uint32_t shared_image_usage = gpu::SHARED_IMAGE_USAGE_DISPLAY_READ;
uploaded_resource.mailbox = sii->CreateSharedImage(
- viz::SharedImageFormat::SinglePlane(format), resource_bitmap.GetSize(),
- color_space, kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType,
- shared_image_usage,
+ format, resource_bitmap.GetSize(), color_space, kTopLeft_GrSurfaceOrigin,
+ kPremul_SkAlphaType, shared_image_usage,
base::span<const uint8_t>(resource_bitmap.GetPixels(),
resource_bitmap.SizeInBytes()));
gpu::SyncToken sync_token = sii->GenUnverifiedSyncToken();
GLenum texture_target = gpu::GetBufferTextureTarget(
- gfx::BufferUsage::SCANOUT, BufferFormat(format), caps);
+ gfx::BufferUsage::SCANOUT, BufferFormat(format.resource_format()), caps);
uploaded_resource.viz_resource_id = resource_provider_.ImportResource(
viz::TransferableResource::MakeGpu(
uploaded_resource.mailbox, GL_LINEAR, texture_target, sync_token,