Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1cfbc06323c83c1436ab9208965a2665fc93ff73
      
https://github.com/WebKit/WebKit/commit/1cfbc06323c83c1436ab9208965a2665fc93ff73
  Author: Said Abou-Hallawa <[email protected]>
  Date:   2025-06-05 (Thu, 05 Jun 2025)

  Changed paths:
    M LayoutTests/fast/images/hdr-background-image.html
    M LayoutTests/fast/images/hdr-basic-image-dynamic-range-limit.html
    M LayoutTests/fast/images/hdr-basic-image.html
    M LayoutTests/fast/images/hdr-border-image.html
    M LayoutTests/fast/images/hdr-image-layer-sdr-dynamic-range-limit.html
    M LayoutTests/fast/images/hdr-pseudo-before-image.html
    M LayoutTests/fast/images/hdr-svg-inline-image.html
    M 
LayoutTests/platform/ios/compositing/hdr/hdr-basic-image-dynamic-range-limit-expected.txt
    M 
LayoutTests/platform/mac-wk2/compositing/hdr/hdr-basic-image-dynamic-range-limit-expected.txt
    M Source/WebCore/platform/graphics/DestinationColorSpace.cpp
    M Source/WebCore/platform/graphics/DestinationColorSpace.h
    M Source/WebCore/platform/graphics/ShareableBitmap.cpp
    M Source/WebCore/platform/graphics/ShareableBitmap.h
    M Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
    M Source/WebCore/platform/graphics/cg/NativeImageCG.cpp
    M Source/WebCore/platform/graphics/cg/ShareableBitmapCG.mm
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.mm

  Log Message:
  -----------
  [HDR] Avoid colorSpace transformation and double caching when sharing an 
image with GPUProcess
https://bugs.webkit.org/show_bug.cgi?id=293450
rdar://151876825

Reviewed by Simon Fraser.

Currently ShareableBitmap shares an image with GPUProcess by drawing it to a
SharedMemory only if its colorSpace is not sRGB. Otherwise it uses the data
provider to copy the pixels to a SharedMemory. In addition to the SharedMemory,
the image metadata which is stored in ShareableBitmapConfiguration, GPUProcess
can construct the original image.

Also NativeImage::draw() does the tone-mapping to SDR in WebProcess before
sharing the image with GPUProcess. It does this by drawing the image to an SDR
unaccelerated ImageBuffer. But this forces RemoteResourceCacheProxy to double
cache the image: one copy for the SDR and the other copy for the HDR.

These two steps can be avoided if
(1) the data provider approach is used for any colorSpace.
(2) the system tone-mapping APIs are used to tone-map the HDR image to SDR.
(3) the extended display ColorSpace is used for HDR layers.

* LayoutTests/fast/images/hdr-background-image.html:
* LayoutTests/fast/images/hdr-basic-image-dynamic-range-limit.html:
* LayoutTests/fast/images/hdr-basic-image.html:
* LayoutTests/fast/images/hdr-border-image.html:
* LayoutTests/fast/images/hdr-image-layer-sdr-dynamic-range-limit.html:
* LayoutTests/fast/images/hdr-pseudo-before-image.html:
* LayoutTests/fast/images/hdr-svg-inline-image.html:
The pixel tolerance in the ref test has to be increased due to using the
extended display ColorSpace for HDR layers. This should be revisited if
the system behavior changes.

* 
LayoutTests/platform/ios/compositing/hdr/hdr-basic-image-dynamic-range-limit-expected.txt:
* 
LayoutTests/platform/mac-wk2/compositing/hdr/hdr-basic-image-dynamic-range-limit-expected.txt:
HDR images with "dynamic-range-limit: standard;" have to be drawn to
HDR layers. Tone-mapping functions will be used to get the SDR images.

* Source/WebCore/platform/graphics/DestinationColorSpace.cpp:
(WebCore::DestinationColorSpace::asExtended const):
* Source/WebCore/platform/graphics/DestinationColorSpace.h:
* Source/WebCore/platform/graphics/ShareableBitmap.cpp:
(WebCore::ShareableBitmapConfiguration::ShareableBitmapConfiguration):
* Source/WebCore/platform/graphics/ShareableBitmap.h:
(WebCore::ShareableBitmapConfiguration::headroom const):
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::setCGDynamicRangeLimitForImage):
(WebCore::GraphicsContextCG::drawNativeImageInternal):
* Source/WebCore/platform/graphics/cg/NativeImageCG.cpp:
(WebCore::NativeImage::draw):
* Source/WebCore/platform/graphics/cg/ShareableBitmapCG.mm:
(WebCore::ShareableBitmapConfiguration::ShareableBitmapConfiguration):
(WebCore::ShareableBitmap::createFromImagePixels):
(WebCore::ShareableBitmap::createCGImage const):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::recordNativeImageUse):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.mm:
(WebKit::PlatformCALayerRemote::displayColorSpace const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to