[webkit-changes] [WebKit/WebKit] 8c53cb: [Cocoa] Initial support for HDR images

Said Abou-Hallawa noreply at github.com
Thu Oct 3 10:14:45 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8c53cb365a2d5aec99483ae9d855472c8a720941
      https://github.com/WebKit/WebKit/commit/8c53cb365a2d5aec99483ae9d855472c8a720941
  Author: Said Abou-Hallawa <said at apple.com>
  Date:   2024-10-03 (Thu, 03 Oct 2024)

  Changed paths:
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WTF/wtf/PlatformHave.h
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/css/query/MediaQueryFeatures.cpp
    M Source/WebCore/page/PageOverlayController.cpp
    M Source/WebCore/platform/PlatformScreen.h
    M Source/WebCore/platform/ScreenProperties.h
    M Source/WebCore/platform/graphics/BitmapImage.cpp
    M Source/WebCore/platform/graphics/BitmapImage.h
    M Source/WebCore/platform/graphics/BitmapImageSource.cpp
    M Source/WebCore/platform/graphics/BitmapImageSource.h
    A Source/WebCore/platform/graphics/ContentsFormat.cpp
    A Source/WebCore/platform/graphics/ContentsFormat.h
    M Source/WebCore/platform/graphics/GraphicsLayer.h
    M Source/WebCore/platform/graphics/GraphicsLayerClient.h
    M Source/WebCore/platform/graphics/ImageBufferPixelFormat.h
    M Source/WebCore/platform/graphics/ImageFrame.h
    M Source/WebCore/platform/graphics/ImagePaintingOptions.h
    M Source/WebCore/platform/graphics/ImageSource.h
    M Source/WebCore/platform/graphics/ImageTypes.h
    M Source/WebCore/platform/graphics/LayerTreeAsTextOptions.h
    M Source/WebCore/platform/graphics/NativeImage.cpp
    M Source/WebCore/platform/graphics/NativeImage.h
    M Source/WebCore/platform/graphics/PixelBuffer.cpp
    M Source/WebCore/platform/graphics/PixelBufferConversion.cpp
    M Source/WebCore/platform/graphics/PixelFormat.cpp
    M Source/WebCore/platform/graphics/PixelFormat.h
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
    M Source/WebCore/platform/graphics/ca/PlatformCALayer.h
    M Source/WebCore/platform/graphics/ca/PlatformCALayer.mm
    M Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h
    M Source/WebCore/platform/graphics/ca/TileController.cpp
    M Source/WebCore/platform/graphics/ca/TileController.h
    M Source/WebCore/platform/graphics/ca/TileGrid.cpp
    A Source/WebCore/platform/graphics/ca/cocoa/ContentsFormatCocoa.h
    M Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h
    M Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
    M Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.h
    M Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.mm
    M Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp
    M Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
    M Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp
    M Source/WebCore/platform/graphics/cg/NativeImageCG.cpp
    M Source/WebCore/platform/graphics/cocoa/IOSurface.h
    M Source/WebCore/platform/graphics/cocoa/IOSurface.mm
    M Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp
    M Source/WebCore/platform/ios/LegacyTileGridTile.mm
    M Source/WebCore/platform/ios/PlatformScreenIOS.mm
    M Source/WebCore/platform/mac/PlatformScreenMac.mm
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderLayerBacking.h
    M Source/WebCore/rendering/RenderLayerCompositor.cpp
    M Source/WebCore/rendering/RenderLayerCompositor.h
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl
    M Source/WebKit/Shared/RemoteLayerTree/LayerProperties.h
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTree.serialization.in
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerWithRemoteRenderingBackingStore.mm
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Source/WebKit/WebProcess/GPU/graphics/RemoteNativeImageBackendProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteNativeImageBackendProxy.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.mm
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.mm
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.cpp
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm
    M Tools/DumpRenderTree/ios/PixelDumpSupportIOS.mm

  Log Message:
  -----------
  [Cocoa] Initial support for HDR images
https://bugs.webkit.org/show_bug.cgi?id=280583
rdar://136926899

Reviewed by Mike Wyrzykowski.

A conditional compilation directive flag named `HAVE_HDR_SUPPORT` is added.

An internal feature flag named `HDRForImagesEnabled` is added.

A new option named Headroom is added to ImagePaintingOptions.

When rendering to a CABackingStore, the layer.contentsFormat needs to be set to
float 16 bit format.

When creating an IOSurface this IOSurface will be rendered via layer.contents,
the color space of this IOSurface has to be CGColorSpaceUsesExtendedRange(). The
pixel format of this IOSurface has to be float 16 bit format.

When displaying CGImage, its headroom has to be set to the context by calling
CGContextSetEDRTargetHeadroom().

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WTF/wtf/PlatformHave.h:
* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/css/query/MediaQueryFeatures.cpp:
(WebCore::MQ::Features::colorGamut):
* Source/WebCore/page/PageOverlayController.cpp:
(WebCore::PageOverlayController::updateSettingsForLayer):
* Source/WebCore/platform/PlatformScreen.h:
* Source/WebCore/platform/ScreenProperties.h:
* Source/WebCore/platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::draw):
* Source/WebCore/platform/graphics/BitmapImage.h:
* Source/WebCore/platform/graphics/BitmapImageSource.cpp:
(WebCore::BitmapImageSource::frameHeadroomAtIndex const):
* Source/WebCore/platform/graphics/BitmapImageSource.h:
* Source/WebCore/platform/graphics/ContentsFormat.cpp: Copied from Source/WebKit/WebProcess/GPU/graphics/RemoteNativeImageBackendProxy.h.
(WebCore::contentsFormatExtendedColorSpace):
(WebCore::operator<<):
* Source/WebCore/platform/graphics/ContentsFormat.h: Copied from Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.h.
(WebCore::contentsFormatBytesPerPixel):
* Source/WebCore/platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::setHDRForImagesEnabled):
(WebCore::GraphicsLayer::hdrForImagesEnabled const):
* Source/WebCore/platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::hdrForImagesEnabled const):
* Source/WebCore/platform/graphics/ImageBufferPixelFormat.h:
(WebCore::convertToPixelFormat):
(WebCore::convertToIOSurfaceFormat):
* Source/WebCore/platform/graphics/ImageFrame.h:
(WebCore::ImageFrame::setHeadroom):
(WebCore::ImageFrame::headroom const):
* Source/WebCore/platform/graphics/ImagePaintingOptions.h:
(WebCore::ImagePaintingOptions::allowImageSubsampling const):
(WebCore::ImagePaintingOptions::showDebugBackground const):
(WebCore::ImagePaintingOptions::headroom const):
(WebCore::ImagePaintingOptions::setOption):
* Source/WebCore/platform/graphics/ImageSource.h:
(WebCore::ImageSource::frameHeadroomAtIndex const):
* Source/WebCore/platform/graphics/ImageTypes.h:
(WebCore::Headroom::Headroom):
(WebCore::Headroom::operator float const):
* Source/WebCore/platform/graphics/LayerTreeAsTextOptions.h:
* Source/WebCore/platform/graphics/NativeImage.cpp:
(WebCore::NativeImage::headroom const):
* Source/WebCore/platform/graphics/NativeImage.h:
* Source/WebCore/platform/graphics/PixelBuffer.cpp:
(WebCore::PixelBuffer::supportedPixelFormat):
* Source/WebCore/platform/graphics/PixelBufferConversion.cpp:
(WebCore::makeVImageCGImageFormat):
* Source/WebCore/platform/graphics/PixelFormat.cpp:
(WebCore::operator<<):
* Source/WebCore/platform/graphics/PixelFormat.h:
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::createPlatformCALayer):
(WebCore::GraphicsLayerCA::dumpAdditionalProperties const):
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:
* Source/WebCore/platform/graphics/ca/PlatformCALayer.h:
* Source/WebCore/platform/graphics/ca/PlatformCALayer.mm:
(WebCore::PlatformCALayer::drawRepaintIndicator):
* Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h:
(WebCore::PlatformCALayerClient::hdrForImagesEnabled const):
* Source/WebCore/platform/graphics/ca/TileController.cpp:
(WebCore::TileController::setContentsFormat):
(WebCore::TileController::createTileLayer):
(WebCore::TileController::setWantsDeepColorBackingStore): Deleted.
* Source/WebCore/platform/graphics/ca/TileController.h:
* Source/WebCore/platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::updateTileLayerProperties):
* Source/WebCore/platform/graphics/ca/cocoa/ContentsFormatCocoa.h: Copied from Source/WebCore/platform/graphics/ImageBufferPixelFormat.h.
(WebCore::convertToIOSurfaceFormat):
(WebCore::contentsFormatString):
(WebCore::contentsFormatWantsExtendedDynamicRangeContent):
(WebCore::contentsFormatWantsToneMapMode):
* Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayerCocoa::commonInit):
(WebCore::PlatformCALayerCocoa::contentsFormat const):
(WebCore::PlatformCALayerCocoa::setContentsFormat):
(WebCore::PlatformCALayerCocoa::updateContentsFormat):
(WebCore::PlatformCALayerCocoa::backingStoreBytesPerPixel const):
(WebCore::PlatformCALayerCocoa::wantsDeepColorBackingStore const): Deleted.
(WebCore::PlatformCALayerCocoa::setWantsDeepColorBackingStore): Deleted.
(WebCore::layerContentsFormat): Deleted.
* Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
* Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
(-[WebTiledBackingLayer setContentsFormat:]):
(-[WebTiledBackingLayer contentsFormat]):
(-[WebTiledBackingLayer setWantsDeepColorBackingStore:]): Deleted.
(-[WebTiledBackingLayer wantsDeepColorBackingStore]): Deleted.
* Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp:
(WebCore::PlatformImageNativeImageBackend::headroom const):
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::drawNativeImageInternal):
* Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::createImageSourceOptions):
(WebCore::ImageDecoderCG::fetchFrameMetaDataAtIndex const):
* Source/WebCore/platform/graphics/cg/NativeImageCG.cpp:
(WebCore::PlatformImageNativeImageBackend::headroom const):
(WebCore::NativeImage::draw):
* Source/WebCore/platform/graphics/cocoa/IOSurface.h:
* Source/WebCore/platform/graphics/cocoa/IOSurface.mm:
(WebCore::optionsForSurface):
(WebCore::optionsFor32BitSurface):
(WebCore::optionsFor64BitSurface):
(WebCore::IOSurface::IOSurface):
(WebCore::formatFromSurface):
(WebCore::IOSurface::bitmapConfiguration const):
(WebCore::operator<<):
* Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp:
(WebCore::PlatformImageNativeImageBackend::headroom const):
* Source/WebCore/platform/ios/LegacyTileGridTile.mm:
(WebCore::LegacyTileGridTile::LegacyTileGridTile):
* Source/WebCore/platform/ios/PlatformScreenIOS.mm:
(WebCore::screenContentsFormat):
(WebCore::screenColorSpace):
(WebCore::collectScreenProperties):
(WebCore::screenSupportsExtendedColor): Deleted.
* Source/WebCore/platform/mac/PlatformScreenMac.mm:
(WebCore::screenContentsFormat):
(WebCore::collectScreenProperties):
(WebCore::screenSupportsExtendedColor): Deleted.
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::hdrForImagesEnabled const):
* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::hdrForImagesEnabled const):
* Source/WebCore/rendering/RenderLayerCompositor.h:
* Source/WebCore/testing/Internals.cpp:
(WebCore::toLayerTreeAsTextOptions):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
* Source/WebKit/Shared/RemoteLayerTree/LayerProperties.h:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
(WebKit::RemoteLayerBackingStore::contentsFormat const):
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::pixelFormat const):
(WebKit::RemoteLayerBackingStore::bytesPerPixel const):
(WebKit::RemoteLayerBackingStore::usesDeepColorBackingStore const): Deleted.
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTree.serialization.in:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::dumpChangedLayers):
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerWithRemoteRenderingBackingStore.mm:
(WebKit::RemoteLayerWithRemoteRenderingBackingStore::ensureBackingStore):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _takeViewSnapshot]):
* Source/WebKit/WebProcess/GPU/graphics/RemoteNativeImageBackendProxy.cpp:
(WebKit::RemoteNativeImageBackendProxy::headroom const):
* Source/WebKit/WebProcess/GPU/graphics/RemoteNativeImageBackendProxy.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.mm:
(WebKit::GraphicsLayerCARemote::createPlatformCALayer):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.mm:
(WebKit::PlatformCALayerRemote::displayColorSpace const):
(WebKit::PlatformCALayerRemote::updateBackingStore):
(WebKit::PlatformCALayerRemote::contentsFormat const):
(WebKit::PlatformCALayerRemote::setContentsFormat):
(WebKit::PlatformCALayerRemote::wantsDeepColorBackingStore const): Deleted.
(WebKit::PlatformCALayerRemote::setWantsDeepColorBackingStore): Deleted.
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.cpp:
(WebKit::PlatformCALayerRemoteTiledBacking::contentsFormat const):
(WebKit::PlatformCALayerRemoteTiledBacking::setContentsFormat):
(WebKit::PlatformCALayerRemoteTiledBacking::wantsDeepColorBackingStore const): Deleted.
(WebKit::PlatformCALayerRemoteTiledBacking::setWantsDeepColorBackingStore): Deleted.
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::hdrForImagesEnabled const):
* Tools/DumpRenderTree/ios/PixelDumpSupportIOS.mm:
(createBitmapContextFromWebView):

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



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


More information about the webkit-changes mailing list