2024-03-08 13:44:56 +01:00
|
|
|
diff --git gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc
|
2024-11-14 23:07:03 +01:00
|
|
|
index a7742298af440..a7dab9f4f770b 100644
|
2024-03-08 13:44:56 +01:00
|
|
|
--- gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc
|
|
|
|
+++ gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc
|
2024-11-14 23:07:03 +01:00
|
|
|
@@ -178,7 +178,8 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryDXGI::CreateGpuMemoryBuffer(
|
2024-03-08 13:44:56 +01:00
|
|
|
// so make sure that the usage is one that we support.
|
|
|
|
DCHECK(usage == gfx::BufferUsage::GPU_READ ||
|
|
|
|
usage == gfx::BufferUsage::SCANOUT ||
|
|
|
|
- usage == gfx::BufferUsage::SCANOUT_CPU_READ_WRITE)
|
|
|
|
+ usage == gfx::BufferUsage::SCANOUT_CPU_READ_WRITE ||
|
|
|
|
+ usage == gfx::BufferUsage::SCANOUT_VEA_CPU_READ)
|
|
|
|
<< "Incorrect usage, usage=" << gfx::BufferUsageToString(usage);
|
|
|
|
|
|
|
|
D3D11_TEXTURE2D_DESC desc = {
|
2024-11-14 23:07:03 +01:00
|
|
|
@@ -192,7 +193,9 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryDXGI::CreateGpuMemoryBuffer(
|
2024-03-08 13:44:56 +01:00
|
|
|
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET,
|
|
|
|
0,
|
|
|
|
D3D11_RESOURCE_MISC_SHARED_NTHANDLE |
|
|
|
|
- D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX};
|
|
|
|
+ static_cast<UINT>(usage == gfx::BufferUsage::SCANOUT_VEA_CPU_READ
|
|
|
|
+ ? D3D11_RESOURCE_MISC_SHARED
|
|
|
|
+ : D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX)};
|
|
|
|
|
|
|
|
Microsoft::WRL::ComPtr<ID3D11Texture2D> d3d11_texture;
|
|
|
|
|
|
|
|
diff --git media/video/renderable_gpu_memory_buffer_video_frame_pool.cc media/video/renderable_gpu_memory_buffer_video_frame_pool.cc
|
2024-11-14 23:07:03 +01:00
|
|
|
index b27bcf13d3a5f..df1b2d697f7cc 100644
|
2024-03-08 13:44:56 +01:00
|
|
|
--- media/video/renderable_gpu_memory_buffer_video_frame_pool.cc
|
|
|
|
+++ media/video/renderable_gpu_memory_buffer_video_frame_pool.cc
|
2024-11-14 23:07:03 +01:00
|
|
|
@@ -193,7 +193,7 @@ gfx::Size GetBufferSizeInPixelsForVideoPixelFormat(
|
2024-03-08 13:44:56 +01:00
|
|
|
bool FrameResources::Initialize() {
|
|
|
|
auto* context = pool_->GetContext();
|
|
|
|
|
|
|
|
- constexpr gfx::BufferUsage kBufferUsage =
|
|
|
|
+ gfx::BufferUsage buffer_usage =
|
|
|
|
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
|
|
|
|
gfx::BufferUsage::SCANOUT_VEA_CPU_READ
|
|
|
|
#else
|
2024-11-14 23:07:03 +01:00
|
|
|
@@ -207,6 +207,23 @@ bool FrameResources::Initialize() {
|
2024-03-08 13:44:56 +01:00
|
|
|
const gfx::Size buffer_size_in_pixels =
|
|
|
|
GetBufferSizeInPixelsForVideoPixelFormat(format_, coded_size_);
|
|
|
|
|
|
|
|
+#if BUILDFLAG(IS_WIN)
|
|
|
|
+ // For CEF OSR feature, currently there's no other place in chromium use RGBA.
|
|
|
|
+ // If the format is RGBA, currently CEF do not write to the texture anymore
|
|
|
|
+ // once the GMB is returned from CopyRequest. So there will be no race
|
|
|
|
+ // condition on that texture. We can request a GMB without a keyed mutex to
|
|
|
|
+ // accelerate and probably prevent some driver deadlock.
|
2024-04-29 16:58:26 +02:00
|
|
|
+ if (format_ == PIXEL_FORMAT_ARGB || format_ == PIXEL_FORMAT_ABGR) {
|
2024-03-08 13:44:56 +01:00
|
|
|
+ // This value is 'borrowed', SCANOUT_VEA_CPU_READ is probably invalid
|
|
|
|
+ // cause there's no real SCANOUT on Windows. We simply use this enum as a
|
|
|
|
+ // flag to disable mutex in the GMBFactoryDXGI because this enum is also
|
|
|
|
+ // used above in macOS and CrOS for similar usage (claim no other one will
|
|
|
|
+ // concurrently use the resource).
|
|
|
|
+ // https://chromium-review.googlesource.com/c/chromium/src/+/5302103
|
|
|
|
+ buffer_usage = gfx::BufferUsage::SCANOUT_VEA_CPU_READ;
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+
|
2024-11-14 23:07:03 +01:00
|
|
|
constexpr gpu::SharedImageUsageSet kSharedImageUsage =
|
2024-08-26 14:44:25 +02:00
|
|
|
#if BUILDFLAG(IS_MAC)
|
2024-11-14 23:07:03 +01:00
|
|
|
gpu::SHARED_IMAGE_USAGE_MACOS_VIDEO_TOOLBOX |
|
|
|
|
@@ -231,7 +248,7 @@ bool FrameResources::Initialize() {
|
|
|
|
viz::GetSharedImageFormat(buffer_format);
|
2024-08-26 14:44:25 +02:00
|
|
|
|
2024-11-14 23:07:03 +01:00
|
|
|
shared_image_ = context->CreateSharedImage(
|
|
|
|
- buffer_size_in_pixels, kBufferUsage, si_format, color_space_,
|
|
|
|
+ buffer_size_in_pixels, buffer_usage, si_format, color_space_,
|
|
|
|
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, kSharedImageUsage,
|
|
|
|
sync_token_);
|
|
|
|
if (!shared_image_) {
|