0

Set WebGPU usage in SI for GpuMemoryBufferVideoFramePool on Mac

A Dawn representation of the SI MediaGmbVideoFramePoolMappableSI can
be created for zero-copy import via WebGPU. This should be reflected
in the SharedImageUsage specified for the SI.

This should have no practical effect other than avoiding a
DumpWithoutCrashing when producing the Dawn representation:
- On Mac, SharedImageCapabilities::supports_scanout_shared_images
  is always true. As a result, GpuMemoryBufferVideoFrameBool always
  requests SCANOUT usage for the SharedImage.
- The only SharedImageBacking that supports SCANOUT on Mac is the
  IOSurfaceImageBacking, which also supports WEBGPU_READ usage.

Bug: 368085619
Change-Id: Ide3e7c5205be814a88481126282adb1589a7aa19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5963741
Commit-Queue: Jan Keitel <jkeitel@google.com>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1374272}
This commit is contained in:
Jan Keitel
2024-10-26 08:37:44 +00:00
committed by Chromium LUCI CQ
parent 5f676d9b4d
commit 2f14aa042e

@ -1229,7 +1229,7 @@ GpuMemoryBufferVideoFramePool::PoolImpl::GetOrCreateFrameResource(
si_usage |= gpu::SHARED_IMAGE_USAGE_SCANOUT;
}
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
// TODO(crbug.com/40194712): Always add the flag once the
// OzoneImageBacking is by default turned on.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
@ -1237,6 +1237,9 @@ GpuMemoryBufferVideoFramePool::PoolImpl::GetOrCreateFrameResource(
// This SharedImage may be used for zero-copy import into WebGPU.
si_usage |= gpu::SHARED_IMAGE_USAGE_WEBGPU_READ;
}
#elif BUILDFLAG(IS_MAC)
// This SharedImage may be used for zero-copy import into WebGPU.
si_usage |= gpu::SHARED_IMAGE_USAGE_WEBGPU_READ;
#endif
// Create a Mappable shared image.
frame_resource->shared_image =