Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ff6f5a8f40079145a1b55600de630a342712db2b
      
https://github.com/WebKit/WebKit/commit/ff6f5a8f40079145a1b55600de630a342712db2b
  Author: Said Abou-Hallawa <[email protected]>
  Date:   2026-04-30 (Thu, 30 Apr 2026)

  Changed paths:
    M Source/WebCore/Configurations/AllowedSPI.toml
    M Source/WebCore/Headers.cmake
    M Source/WebCore/PAL/pal/spi/cg/ImageIOSPI.h
    M Source/WebCore/SourcesCocoa.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/platform/graphics/GainMap.h
    M Source/WebCore/platform/graphics/NativeImage.cpp
    M Source/WebCore/platform/graphics/NativeImage.h
    M Source/WebCore/platform/graphics/ShareableBitmap.cpp
    M Source/WebCore/platform/graphics/ShareableBitmap.h
    M Source/WebCore/platform/graphics/cairo/ShareableBitmapCairo.cpp
    M Source/WebCore/platform/graphics/cg/NativeImageCG.cpp
    M Source/WebCore/platform/graphics/cg/ShareableBitmapCG.mm
    M Source/WebCore/platform/graphics/cocoa/CVPixelBufferUtilities.cpp
    M Source/WebCore/platform/graphics/cocoa/CVPixelBufferUtilities.h
    A Source/WebCore/platform/graphics/cocoa/ShareableGainMap.cpp
    A Source/WebCore/platform/graphics/cocoa/ShareableGainMap.h
    M Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp
    M Source/WebCore/platform/graphics/skia/ShareableBitmapSkia.cpp
    M Source/WebKit/Scripts/webkit/opaque_ipc_types.tracking.in
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/WebProcess/GPU/graphics/RemoteNativeImageProxy.cpp

  Log Message:
  -----------
  [HDR] Introduce GainMap and ShareableGainMap
https://bugs.webkit.org/show_bug.cgi?id=312933
rdar://175284361

Reviewed by Cameron McCormack.

`GainMap` is where the HDR gain-map data will be stored. It will be serialized
to GPU process through `ShareableGainMap`. The members of `GainMap` are:
a `CVPixelBuffer` for the gain-map image, image-metadata and colorSpace.
`ShareableGainMap` will be responsible for generating the HDR image from the
base image and the `GainMap`.

`NativeImage` will hold `std::optional<GainMap>`. In this PR, it is never set.
In future patches, `ImageDecoder` will be asked to retrieve the frame's 
`GainMap`.

`ShareableBitmap` will store a `GainMap` as `std::optional<ShareableGainMap>` in
its `ShareableBitmapConfiguration`. IPC decoder will serialize 
`ShareableGainMap`
as a member of `ShareableBitmapConfiguration` through serializing 
`ShareableBitmap`.

`ShareableBitmap::createPlatformImage()` will be renamed 
`createBasePlatformImage()`.
A new method called `ShareableBitmap::createPlatformImage()` will be added which
will `createBasePlatformImage` from its `SharedMemory` then (2) decides  whether
to apply the `GainMap` to generate an HDR image. Or just return 
basePlatformImage.
All the existing callers to `createPlatformImage()` will not change their calls.

* Source/WebCore/Configurations/AllowedSPI.toml:
* Source/WebCore/Headers.cmake:
* Source/WebCore/PAL/pal/spi/cg/ImageIOSPI.h:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/graphics/GainMap.h: Added.
* Source/WebCore/platform/graphics/NativeImage.cpp:
(WebCore::NativeImage::create):
(WebCore::NativeImage::createTransient):
(WebCore::NativeImage::NativeImage):
(WebCore::NativeImage::gainMap const):
(WebCore::NativeImage::replacePlatformImage const):
* Source/WebCore/platform/graphics/NativeImage.h:
* Source/WebCore/platform/graphics/ShareableBitmap.cpp:
(WebCore::ShareableBitmapConfiguration::ShareableBitmapConfiguration):
(WebCore::ShareableBitmap::ShareableBitmap):
* Source/WebCore/platform/graphics/ShareableBitmap.h:
(WebCore::ShareableBitmapConfiguration::shareableGainMap const):
* Source/WebCore/platform/graphics/cairo/ShareableBitmapCairo.cpp:
(WebCore::ShareableBitmap::createBasePlatformImage):
(WebCore::ShareableBitmap::createPlatformImage):
* Source/WebCore/platform/graphics/cg/NativeImageCG.cpp:
(WebCore::NativeImage::create):
* Source/WebCore/platform/graphics/cg/ShareableBitmapCG.mm:
(WebCore::ShareableBitmapConfiguration::ShareableBitmapConfiguration):
(WebCore::ShareableBitmap::createBasePlatformImage):
(WebCore::ShareableBitmap::createPlatformImage):
* Source/WebCore/platform/graphics/cocoa/CVPixelBufferUtilities.cpp:
(WebCore::createScratchMetalCompatibleCVPixelBuffer):
(WebCore::createMetalCompatibleCVPixelBufferFromImage):
* Source/WebCore/platform/graphics/cocoa/CVPixelBufferUtilities.h:
* Source/WebCore/platform/graphics/cocoa/ShareableGainMap.cpp: Added.
(WebCore::ShareableGainMap::create):
(WebCore::ShareableGainMap::ShareableGainMap):
(WebCore::ShareableGainMap::applyGainMapToBaseImage const):
* Source/WebCore/platform/graphics/cocoa/ShareableGainMap.h: Added.
* Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp:
(WebCore::NativeImage::create):
(WebCore::NativeImage::createTransient):
(WebCore::NativeImage::NativeImage):
* Source/WebCore/platform/graphics/skia/ShareableBitmapSkia.cpp:
(WebCore::ShareableBitmap::createBasePlatformImage):
(WebCore::ShareableBitmap::createPlatformImage):
* Source/WebKit/Scripts/webkit/opaque_ipc_types.tracking.in:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/GPU/graphics/RemoteNativeImageProxy.cpp:
(WebKit::RemoteNativeImageProxy::RemoteNativeImageProxy):

Canonical link: https://commits.webkit.org/312341@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to