fix: rgbaf16 shared texture remove keyed mutex. (#49798)

* fix: rgbaf16 shared texture remove keyed mutex.

* fix: rgbaf16 patch.

* 更新 shared-texture-handle.md

Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>

---------

Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>
This commit is contained in:
reito 2026-02-20 00:28:53 +08:00 committed by GitHub
commit 491fa0442b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -1,6 +1,6 @@
# SharedTextureHandle Object
* `ntHandle` Buffer (optional) _Windows_ - NT HANDLE holds the shared texture. Note that this NT HANDLE is local to current process.
* `ntHandle` Buffer (optional) _Windows_ - NT HANDLE holds the shared texture. Note that this NT HANDLE is local to current process. Output textures of `rgba`, `bgra`, `rgbaf16` formats don't have a keyed mutex on the texture handle, but `nv12` format texture handles do have a keyed mutex.
* `ioSurface` Buffer (optional) _macOS_ - IOSurfaceRef holds the shared texture. Note that this IOSurface is local to current process (not global).
* `nativePixmap` Object (optional) _Linux_ - Structure contains planes of shared texture.
* `planes` Object[] _Linux_ - Each plane's info of the shared texture.

View file

@ -36,10 +36,10 @@ index 660a50670db25c48bdb7ab9facd8efbe944844f1..904ae1ef29aae9a28b555acc71928450
Microsoft::WRL::ComPtr<ID3D11Texture2D> d3d11_texture;
diff --git a/media/video/renderable_mappable_shared_image_video_frame_pool.cc b/media/video/renderable_mappable_shared_image_video_frame_pool.cc
index 36ed797edc58a6cf094a0b720bf949b3f6379890..950b839a67fc190f9c0d73bcc102b547178216bb 100644
index 36ed797edc58a6cf094a0b720bf949b3f6379890..36a4a080da38cddad645d42e5c53c840e211105e 100644
--- a/media/video/renderable_mappable_shared_image_video_frame_pool.cc
+++ b/media/video/renderable_mappable_shared_image_video_frame_pool.cc
@@ -211,6 +211,23 @@ bool FrameResources::Initialize(VideoPixelFormat format,
@@ -211,6 +211,24 @@ bool FrameResources::Initialize(VideoPixelFormat format,
const gfx::Size coded_size =
GetCodedSizeForVideoPixelFormat(format, visible_size_);
@ -49,7 +49,8 @@ index 36ed797edc58a6cf094a0b720bf949b3f6379890..950b839a67fc190f9c0d73bcc102b547
+ // 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.
+ if (format == PIXEL_FORMAT_ARGB || format == PIXEL_FORMAT_ABGR) {
+ if (format == PIXEL_FORMAT_ARGB || format == PIXEL_FORMAT_ABGR ||
+ format == PIXEL_FORMAT_RGBAF16) {
+ // 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