Skip to content

Commit

Permalink
Refactor CreateSharedImage() to use ClientSharedImage
Browse files Browse the repository at this point in the history
This CL continues the effort of introducing ClientSharedImage by
refactoring one overloaded version of CreateSharedImage() and letting
the function returns a pointer to ClientSharedImage.

Bug: 1494911
Change-Id: Ifa6621ac29207849051b4e65fe4d11450d87a405
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4980046
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Mingjing Zhang <mjzhang@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1217170}
  • Loading branch information
Mingjing Zhang authored and Chromium LUCI CQ committed Oct 30, 2023
1 parent 534653a commit 0245356
Show file tree
Hide file tree
Showing 38 changed files with 162 additions and 79 deletions.
5 changes: 4 additions & 1 deletion ash/fast_ink/fast_ink_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "cc/base/math_util.h"
#include "components/viz/common/quads/compositor_frame.h"
#include "components/viz/common/quads/texture_draw_quad.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "ui/aura/env.h"
#include "ui/aura/window_tree_host.h"
Expand Down Expand Up @@ -147,11 +148,13 @@ void FastInkHost::InitializeFastInkBuffer(aura::Window* host_window) {
gpu::SHARED_IMAGE_USAGE_CONCURRENT_READ_WRITE |
gpu::SHARED_IMAGE_USAGE_SCANOUT;

mailbox_ = sii->CreateSharedImage(
auto client_shared_image = sii->CreateSharedImage(
fast_ink_internal::kFastInkSharedImageFormat,
gpu_memory_buffer_->GetSize(), gfx::ColorSpace(),
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, usage,
"FastInkHostUIResource", gpu_memory_buffer_->CloneHandle());
CHECK(client_shared_image);
mailbox_ = client_shared_image->mailbox();
sync_token_ = sii->GenVerifiedSyncToken();
}

Expand Down
5 changes: 4 additions & 1 deletion ash/fast_ink/fast_ink_host_frame_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "components/viz/common/quads/compositor_frame.h"
#include "components/viz/common/quads/texture_draw_quad.h"
#include "components/viz/common/resources/resource_id.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
Expand Down Expand Up @@ -151,10 +152,12 @@ std::unique_ptr<UiResource> CreateUiResource(
usage |= gpu::SHARED_IMAGE_USAGE_SCANOUT;
}

resource->mailbox = sii->CreateSharedImage(
auto client_shared_image = sii->CreateSharedImage(
kFastInkSharedImageFormat, gpu_memory_buffer->GetSize(),
gfx::ColorSpace(), kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, usage,
"FastInkHostUIResource", gpu_memory_buffer->CloneHandle());
CHECK(client_shared_image);
resource->mailbox = client_shared_image->mailbox();
resource->sync_token = sii->GenVerifiedSyncToken();
} else {
// This UiResource is operating on a shared SharedImage.
Expand Down
4 changes: 3 additions & 1 deletion ash/fast_ink/view_tree_host_root_view_frame_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ ViewTreeHostRootViewFrameFactory::CreateUiResource(
}
resource->mailbox = client_shared_image->mailbox();
} else {
resource->mailbox = sii->CreateSharedImage(
auto client_shared_image = sii->CreateSharedImage(
format, size, gfx::ColorSpace(), kTopLeft_GrSurfaceOrigin,
kPremul_SkAlphaType, usage, "FastInkRootViewFrame",
resource->gpu_memory_buffer->CloneHandle());
CHECK(client_shared_image);
resource->mailbox = client_shared_image->mailbox();
}

resource->sync_token = sii->GenVerifiedSyncToken();
Expand Down
4 changes: 3 additions & 1 deletion ash/rounded_display/rounded_display_frame_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,12 @@ RoundedDisplayFrameFactory::CreateUiResource(const gfx::Size& size,
}
resource->mailbox = client_shared_image->mailbox();
} else {
resource->mailbox = sii->CreateSharedImage(
auto client_shared_image = sii->CreateSharedImage(
format, size, gfx::ColorSpace(), kTopLeft_GrSurfaceOrigin,
kPremul_SkAlphaType, usage, "RoundedDisplayFrameUi",
resource->gpu_memory_buffer->CloneHandle());
CHECK(client_shared_image);
resource->mailbox = client_shared_image->mailbox();
}

resource->sync_token = sii->GenVerifiedSyncToken();
Expand Down
5 changes: 4 additions & 1 deletion cc/raster/bitmap_raster_buffer_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "cc/trees/layer_tree_frame_sink.h"
#include "components/viz/common/resources/bitmap_allocation.h"
#include "components/viz/common/resources/shared_image_format.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/color_space.h"
Expand Down Expand Up @@ -166,12 +167,14 @@ BitmapRasterBufferProvider::AcquireBufferForRaster(
size.width(), gfx::BufferFormat::RGBA_8888, 0));
handle.region = backing->unsafe_region.Duplicate();

backing->shared_bitmap_id =
auto client_shared_image =
frame_sink_->shared_image_interface()->CreateSharedImage(
viz::SinglePlaneFormat::kRGBA_8888, size, color_space,
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType,
gpu::SHARED_IMAGE_USAGE_CPU_WRITE, kDebugLabel,
std::move(handle));
CHECK(client_shared_image);
backing->shared_bitmap_id = client_shared_image->mailbox();

} else {
backing->shared_bitmap_id = viz::SharedBitmap::GenerateId();
Expand Down
4 changes: 3 additions & 1 deletion cc/raster/one_copy_raster_buffer_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,12 @@ gpu::SyncToken OneCopyRasterBufferProvider::CopyOnWorkerThread(
// Create staging shared image.
if (staging_buffer->mailbox.IsZero()) {
const uint32_t usage = gpu::SHARED_IMAGE_USAGE_CPU_WRITE;
staging_buffer->mailbox = sii->CreateSharedImage(
auto client_shared_image = sii->CreateSharedImage(
format, resource_size, color_space, kTopLeft_GrSurfaceOrigin,
kPremul_SkAlphaType, usage, "OneCopyRasterStaging",
staging_buffer->gpu_memory_buffer.get()->CloneHandle());
CHECK(client_shared_image);
staging_buffer->mailbox = client_shared_image->mailbox();
} else {
sii->UpdateSharedImage(staging_buffer->sync_token, staging_buffer->mailbox);
}
Expand Down
4 changes: 3 additions & 1 deletion cc/raster/zero_copy_raster_buffer_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,12 @@ class ZeroCopyRasterBufferImpl : public RasterBuffer {
gpu::SHARED_IMAGE_USAGE_SCANOUT;
// Make a mailbox for export of the GpuMemoryBuffer to the display
// compositor.
backing_->mailbox = sii->CreateSharedImage(
auto client_shared_image = sii->CreateSharedImage(
format_, resource_size_, resource_color_space_,
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, usage,
"ZeroCopyRasterTile", gpu_memory_buffer_->CloneHandle());
CHECK(client_shared_image);
backing_->mailbox = client_shared_image->mailbox();
} else {
sii->UpdateSharedImage(backing_->returned_sync_token, backing_->mailbox);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/desktop_media_id.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/client/raster_interface.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
Expand Down Expand Up @@ -221,11 +222,13 @@ void ArcScreenCaptureSession::SetOutputBuffer(
viz::GetSinglePlaneSharedImageFormat(buffer_format);
CHECK(!si_format.IsLegacyMultiplanar());

gpu::Mailbox mailbox = sii->CreateSharedImage(
auto client_shared_image = sii->CreateSharedImage(
si_format, size_, gfx::ColorSpace(), kTopLeft_GrSurfaceOrigin,
kPremul_SkAlphaType,
gpu::SHARED_IMAGE_USAGE_RASTER | gpu::SHARED_IMAGE_USAGE_GLES2,
"ArcScreenCapture", std::move(handle));
CHECK(client_shared_image);
gpu::Mailbox mailbox = client_shared_image->mailbox();
ri->WaitSyncTokenCHROMIUM(sii->GenUnverifiedSyncToken().GetConstData());

std::unique_ptr<PendingBuffer> pending_buffer =
Expand Down
5 changes: 4 additions & 1 deletion chrome/browser/vr/win/graphics_delegate_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "content/public/browser/gpu_utils.h"
#include "content/public/common/gpu_stream_constants.h"
#include "device/vr/public/mojom/vr_service.mojom.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/client/gles2_lib.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
Expand Down Expand Up @@ -154,12 +155,14 @@ bool GraphicsDelegateWin::EnsureMemoryBuffer() {

last_size_ = buffer_size;

mailbox_ = sii_->CreateSharedImage(
auto client_shared_image = sii_->CreateSharedImage(
format, buffer_size, gfx::ColorSpace(), kTopLeft_GrSurfaceOrigin,
kPremul_SkAlphaType,
gpu::SHARED_IMAGE_USAGE_GLES2 |
gpu::SHARED_IMAGE_USAGE_GLES2_FRAMEBUFFER_HINT,
"VRGraphicsDelegate", buffer_handle_.Clone());
CHECK(client_shared_image);
mailbox_ = client_shared_image->mailbox();

gl_->WaitSyncTokenCHROMIUM(sii_->GenUnverifiedSyncToken().GetConstData());
return true;
Expand Down
1 change: 1 addition & 0 deletions components/capture_mode/DEPS
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include_rules = [
"+components/viz/common/gpu",
"+gpu/command_buffer/client/client_shared_image.h",
"+gpu/command_buffer/client/gpu_memory_buffer_manager.h",
"+gpu/command_buffer/client/shared_image_interface.h",
"+gpu/command_buffer/common/context_result.h",
Expand Down
5 changes: 4 additions & 1 deletion components/capture_mode/camera_video_frame_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "base/system/sys_info.h"
#include "components/viz/common/gpu/context_lost_observer.h"
#include "components/viz/common/gpu/context_provider.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/common/context_result.h"
Expand Down Expand Up @@ -368,10 +369,12 @@ class GpuMemoryBufferHandleHolder : public BufferHandleHolder,
}
#endif
CHECK_EQ(buffer_planes_.size(), 1u);
mailboxes_[0] = shared_image_interface->CreateSharedImage(
auto client_shared_image = shared_image_interface->CreateSharedImage(
format, gmb->GetSize(), frame_info->color_space,
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, kSharedImageUsage,
"CameraVideoFrame", gmb->CloneHandle());
CHECK(client_shared_image);
mailboxes_[0] = client_shared_image->mailbox();
} else {
gpu::GpuMemoryBufferManager* gmb_manager =
context_factory_->GetGpuMemoryBufferManager();
Expand Down
11 changes: 7 additions & 4 deletions components/exo/buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "components/viz/common/resources/shared_image_format.h"
#include "components/viz/common/resources/shared_image_format_utils.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/client/raster_interface.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
Expand Down Expand Up @@ -266,10 +267,12 @@ Buffer::Texture::Texture(

if (media::IsMultiPlaneFormatForHardwareVideoEnabled()) {
auto si_format = GetSharedImageFormat(gpu_memory_buffer_->GetFormat());
mailbox_ = sii->CreateSharedImage(si_format, gpu_memory_buffer_->GetSize(),
color_space, kTopLeft_GrSurfaceOrigin,
kPremul_SkAlphaType, usage, "ExoTexture",
gpu_memory_buffer_->CloneHandle());
auto client_shared_image = sii->CreateSharedImage(
si_format, gpu_memory_buffer_->GetSize(), color_space,
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, usage, "ExoTexture",
gpu_memory_buffer_->CloneHandle());
CHECK(client_shared_image);
mailbox_ = client_shared_image->mailbox();
} else {
mailbox_ = sii->CreateSharedImage(
gpu_memory_buffer_, gpu_memory_buffer_manager,
Expand Down
1 change: 1 addition & 0 deletions components/viz/service/frame_sinks/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include_rules = [
"+components/viz/service/performance_hint",
"+components/viz/service/surfaces",
"+components/viz/service/transitions",
"+gpu/command_buffer/client/client_shared_image.h",
"+gpu/command_buffer/service/shared_context_state.h",
"+gpu/ipc/common",
"+gpu/command_buffer/service/scheduler_sequence.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "base/task/sequenced_task_runner.h"
#include "components/viz/service/display_embedder/in_process_gpu_memory_buffer_manager.h"
#include "components/viz/service/gl/gpu_service_impl.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/service/scheduler_sequence.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/command_buffer/service/shared_image_interface_in_process.h"
Expand Down Expand Up @@ -82,10 +83,12 @@ class GmbVideoFramePoolContext
uint32_t usage,
gpu::Mailbox& mailbox,
gpu::SyncToken& sync_token) override {
mailbox = sii_in_process_->CreateSharedImage(
auto client_shared_image = sii_in_process_->CreateSharedImage(
si_format, gpu_memory_buffer->GetSize(), color_space, surface_origin,
alpha_type, usage, "VizGmbVideoFramePool",
gpu_memory_buffer->CloneHandle());
CHECK(client_shared_image);
mailbox = client_shared_image->mailbox();
sync_token = sii_in_process_->GenVerifiedSyncToken();
}

Expand Down
5 changes: 3 additions & 2 deletions components/viz/test/test_context_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ TestSharedImageInterface::CreateSharedImage(SharedImageFormat format,
return base::MakeRefCounted<gpu::ClientSharedImage>(mailbox);
}

gpu::Mailbox TestSharedImageInterface::CreateSharedImage(
scoped_refptr<gpu::ClientSharedImage>
TestSharedImageInterface::CreateSharedImage(
SharedImageFormat format,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
Expand All @@ -227,7 +228,7 @@ gpu::Mailbox TestSharedImageInterface::CreateSharedImage(
auto mailbox = gpu::Mailbox::GenerateForSharedImage();
shared_images_.insert(mailbox);
most_recent_size_ = size;
return mailbox;
return base::MakeRefCounted<gpu::ClientSharedImage>(mailbox);
}

gpu::Mailbox TestSharedImageInterface::CreateSharedImage(
Expand Down
2 changes: 1 addition & 1 deletion components/viz/test/test_context_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class TestSharedImageInterface : public gpu::SharedImageInterface {
gpu::SurfaceHandle surface_handle,
gfx::BufferUsage buffer_usage) override;

gpu::Mailbox CreateSharedImage(
scoped_refptr<gpu::ClientSharedImage> CreateSharedImage(
SharedImageFormat format,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
Expand Down
5 changes: 4 additions & 1 deletion components/webxr/mailbox_to_surface_bridge_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
Expand Down Expand Up @@ -349,10 +350,12 @@ gpu::MailboxHolder MailboxToSurfaceBridgeImpl::CreateSharedImage(

gpu::MailboxHolder mailbox_holder;
CHECK_EQ(buffer->GetFormat(), gfx::BufferFormat::RGBA_8888);
mailbox_holder.mailbox = sii->CreateSharedImage(
auto client_shared_image = sii->CreateSharedImage(
viz::SinglePlaneFormat::kRGBA_8888, buffer->GetSize(), color_space,
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, usage,
"WebXrMailboxToSurfaceBridge", buffer->CloneHandle());
CHECK(client_shared_image);
mailbox_holder.mailbox = client_shared_image->mailbox();
mailbox_holder.sync_token = sii->GenVerifiedSyncToken();
DCHECK(!gpu::NativeBufferNeedsPlatformSpecificTextureTarget(
buffer->GetFormat()));
Expand Down
5 changes: 4 additions & 1 deletion content/renderer/media/win/dcomp_texture_wrapper_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "base/task/sequenced_task_runner.h"
#include "cc/layers/video_frame_provider.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/ipc/common/gpu_memory_buffer_impl_dxgi.h"
Expand Down Expand Up @@ -217,10 +218,12 @@ void DCOMPTextureWrapperImpl::CreateVideoFrame(
// still need to provide the video frame creation with a 4 array mailbox
// holder.
gpu::MailboxHolder holder[media::VideoFrame::kMaxPlanes];
gpu::Mailbox mailbox = sii->CreateSharedImage(
auto client_shared_image = sii->CreateSharedImage(
viz::SinglePlaneFormat::kBGRA_8888, natural_size, gfx::ColorSpace(),
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, usage,
"DCOMPTextureWrapperImpl", gmb->CloneHandle());
CHECK(client_shared_image);
gpu::Mailbox mailbox = client_shared_image->mailbox();
gpu::SyncToken sync_token = sii->GenVerifiedSyncToken();
holder[0] = gpu::MailboxHolder(mailbox, sync_token, GL_TEXTURE_2D);

Expand Down
20 changes: 11 additions & 9 deletions content/renderer/media/win/dcomp_texture_wrapper_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "base/test/task_environment.h"
#include "content/renderer/media/win/dcomp_texture_factory.h"
#include "content/renderer/media/win/dcomp_texture_wrapper_impl.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/ipc/client/client_shared_image_interface.h"
#include "gpu/ipc/client/gpu_channel_host.h"
#include "media/base/mock_filters.h"
Expand All @@ -29,15 +30,16 @@ class StubClientSharedImageInterface : public gpu::ClientSharedImageInterface {
StubClientSharedImageInterface() : gpu::ClientSharedImageInterface(nullptr) {}
gpu::SyncToken GenVerifiedSyncToken() override { return gpu::SyncToken(); }

gpu::Mailbox CreateSharedImage(viz::SharedImageFormat format,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
GrSurfaceOrigin surface_origin,
SkAlphaType alpha_type,
uint32_t usage,
base::StringPiece debug_label,
gfx::GpuMemoryBufferHandle handle) override {
return gpu::Mailbox();
scoped_refptr<gpu::ClientSharedImage> CreateSharedImage(
viz::SharedImageFormat format,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
GrSurfaceOrigin surface_origin,
SkAlphaType alpha_type,
uint32_t usage,
base::StringPiece debug_label,
gfx::GpuMemoryBufferHandle handle) override {
return base::MakeRefCounted<gpu::ClientSharedImage>(gpu::Mailbox());
}
};

Expand Down
1 change: 1 addition & 0 deletions device/vr/openxr/DEPS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include_rules = [
"+components/viz/common/gpu/context_lost_observer.h",
"+components/viz/common/gpu/context_provider.h",
"+gpu/command_buffer/client/client_shared_image.h",
"+gpu/command_buffer/client/context_support.h",
"+gpu/command_buffer/client/gles2_interface.h",
"+gpu/command_buffer/client/shared_image_interface.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "device/vr/openxr/openxr_api_wrapper.h"
#include "device/vr/openxr/openxr_platform.h"
#include "device/vr/openxr/openxr_util.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
Expand Down Expand Up @@ -236,11 +237,13 @@ void OpenXrGraphicsBindingOpenGLES::ResizeSharedBuffer(
gpu::SHARED_IMAGE_USAGE_DISPLAY_READ |
gpu::SHARED_IMAGE_USAGE_GLES2;

swap_chain_info.mailbox_holder.mailbox = sii->CreateSharedImage(
auto client_shared_image = sii->CreateSharedImage(
viz::SinglePlaneFormat::kRGBA_8888, swap_chain_info.gmb->GetSize(),
gfx::ColorSpace(), kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType,
shared_image_usage, "OpenXrGraphicsBinding",
swap_chain_info.gmb->CloneHandle());
CHECK(client_shared_image);
swap_chain_info.mailbox_holder.mailbox = client_shared_image->mailbox();
swap_chain_info.mailbox_holder.sync_token = sii->GenVerifiedSyncToken();
DCHECK(!gpu::NativeBufferNeedsPlatformSpecificTextureTarget(
swap_chain_info.gmb->GetFormat()));
Expand Down

0 comments on commit 0245356

Please sign in to comment.