Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 95a3f2348f1ec9bad7da70883ac740a2c12c3d15
https://github.com/WebKit/WebKit/commit/95a3f2348f1ec9bad7da70883ac740a2c12c3d15
Author: Said Abou-Hallawa <[email protected]>
Date: 2026-04-22 (Wed, 22 Apr 2026)
Changed paths:
M Source/WebCore/SourcesCocoa.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp
M Source/WebCore/platform/cocoa/CoreVideoSoftLink.h
A Source/WebCore/platform/graphics/cocoa/CVPixelBufferUtilities.cpp
A Source/WebCore/platform/graphics/cocoa/CVPixelBufferUtilities.h
A Source/WebCore/platform/graphics/cocoa/ShareableCVPixelBuffer.cpp
A Source/WebCore/platform/graphics/cocoa/ShareableCVPixelBuffer.h
A Source/WebCore/platform/graphics/cocoa/ShareableCVPixelFormat.cpp
A Source/WebCore/platform/graphics/cocoa/ShareableCVPixelFormat.h
M Source/WebKit/Scripts/webkit/opaque_ipc_types.tracking.in
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
Log Message:
-----------
[HDR] Introduce ShareableCVPixelBuffer
https://bugs.webkit.org/show_bug.cgi?id=312198
rdar://174689652
Reviewed by Cameron McCormack.
Applying the gain-map in the WebContent process is expensive and blocks the main
thread. But applying the gain-map in the GPU process is fast since it uses the
accelerated backing stores.
CGImageApplyHDRGainMap() requires all its three inputs to be CVPixelBuffers. The
gain-map is retrieved as CVPixelBuffer from CGImageSource.
ShareableCVPixelBuffer
will be used to share the gain-map CVPixelBuffer between WebContent process and
GPUProcess.
CVPixelBuffer can contain more than one plane. If it is planar, it will be
shared
through ShareableCVPixelBufferWithPlanarBytes otherwise it will be shared
through
ShareableCVPixelBufferWithBytes. In both cases, the ShareableCVPixelBuffer will
have one or more of ShareableCVPixelBufferBytes which will have a SharedMemoy in
addition to ShareableCVPixelBufferBytesConfiguration.
ShareableCVPixelBuffer will be created from CVPixelBufferRef in WebContent
process.
And it will be created from ShareableCVPixelBufferBytes in GPUProcess.
CVPixelBufferCreate() takes an argument for type OSType as the `pixelFormat`. To
validate ShareableCVPixelBufferConfiguration::m_pixelFormat by the IPC, an new
enum type will be introduced which defines ShareableCVPixelFormat. Two
functions
will be added to convert from ShareableCVPixelFormat to OSType and vice versa.
For now, the GPUProcess will create only metal compatible CVPixelBuffer which
gain
map images need. For generic CVPixelBuffer sharing, the creation dictionary
needs
to be serialized but this can be addressed in a future patch.
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp:
* Source/WebCore/platform/cocoa/CoreVideoSoftLink.h:
* Source/WebCore/platform/graphics/cocoa/CVPixelBufferUtilities.cpp: Added.
(WebCore::createScratchCVPixelBuffer):
(WebCore::createScratchMetalCompatibleCVPixelBuffer):
(WebCore::CVPixelBufferDumpToFile):
* Source/WebCore/platform/graphics/cocoa/CVPixelBufferUtilities.h: Added.
* Source/WebCore/platform/graphics/cocoa/ShareableCVPixelBuffer.cpp: Added.
(WebCore::ShareableCVPixelBufferConfiguration::ShareableCVPixelBufferConfiguration):
(WebCore::ShareableCVPixelBufferBytesConfiguration::ShareableCVPixelBufferBytesConfiguration):
(WebCore::ShareableCVPixelBufferBytesHandle::ShareableCVPixelBufferBytesHandle):
(WebCore::ShareableCVPixelBufferBytes::create):
(WebCore::ShareableCVPixelBufferBytes::createReadOnly):
(WebCore::ShareableCVPixelBufferBytes::ShareableCVPixelBufferBytes):
(WebCore::ShareableCVPixelBufferBytes::createReadOnlyHandle const):
(WebCore::ShareableCVPixelBufferBytes::copyPixels):
(WebCore::ShareableCVPixelBuffer::create):
(WebCore::ShareableCVPixelBuffer::ShareableCVPixelBuffer):
(WebCore::ShareableCVPixelBufferWithBytes::create):
(WebCore::ShareableCVPixelBufferWithBytes::ShareableCVPixelBufferWithBytes):
(WebCore::ShareableCVPixelBufferWithBytes::createMetalCompatibleCVPixelBuffer
const):
(WebCore::ShareableCVPixelBufferWithPlanarBytes::create):
(WebCore::ShareableCVPixelBufferWithPlanarBytes::ShareableCVPixelBufferWithPlanarBytes):
(WebCore::ShareableCVPixelBufferWithPlanarBytes::createMetalCompatibleCVPixelBuffer
const):
* Source/WebCore/platform/graphics/cocoa/ShareableCVPixelBuffer.h: Added.
(WebCore::ShareableCVPixelBufferConfiguration::width const):
(WebCore::ShareableCVPixelBufferConfiguration::height const):
(WebCore::ShareableCVPixelBufferConfiguration::bytesPerRow const):
(WebCore::ShareableCVPixelBufferConfiguration::pixelFormat const):
(WebCore::ShareableCVPixelBufferBytesConfiguration::width const):
(WebCore::ShareableCVPixelBufferBytesConfiguration::height const):
(WebCore::ShareableCVPixelBufferBytesConfiguration::bytesPerRow const):
(WebCore::ShareableCVPixelBufferBytesConfiguration::sizeInBytes const):
(WebCore::ShareableCVPixelBuffer::isPlanar const):
(WebCore::ShareableCVPixelBuffer::configuration const):
(isType):
* Source/WebCore/platform/graphics/cocoa/ShareableCVPixelFormat.cpp: Added.
(WebCore::fromCVPixelFormat):
(WebCore::toCVPixelFormat):
* Source/WebCore/platform/graphics/cocoa/ShareableCVPixelFormat.h: Added.
* Source/WebKit/Scripts/webkit/opaque_ipc_types.tracking.in:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
Canonical link: https://commits.webkit.org/311810@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications