Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 75fb0f2929ea8df1f8984abb911e172a16eca764
https://github.com/WebKit/WebKit/commit/75fb0f2929ea8df1f8984abb911e172a16eca764
Author: Matt Woodrow <[email protected]>
Date: 2025-06-17 (Tue, 17 Jun 2025)
Changed paths:
M Source/WTF/wtf/spi/cocoa/IOSurfaceSPI.h
M Source/WebCore/PAL/pal/cocoa/QuartzCoreSoftLink.h
M Source/WebCore/PAL/pal/cocoa/QuartzCoreSoftLink.mm
M Source/WebCore/loader/cache/CachedImage.cpp
M Source/WebCore/loader/cache/CachedImage.h
M Source/WebCore/page/Page.cpp
M Source/WebCore/page/Page.h
M Source/WebCore/platform/Logging.h
M Source/WebCore/platform/PlatformScreen.h
M Source/WebCore/platform/ScreenProperties.h
M Source/WebCore/platform/graphics/BitmapImage.h
M Source/WebCore/platform/graphics/GraphicsContext.h
M Source/WebCore/platform/graphics/GraphicsLayer.cpp
M Source/WebCore/platform/graphics/GraphicsLayer.h
M Source/WebCore/platform/graphics/GraphicsLayerClient.h
M Source/WebCore/platform/graphics/Image.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/TileController.cpp
M Source/WebCore/platform/graphics/ca/TileController.h
M Source/WebCore/platform/graphics/ca/TileGrid.cpp
M Source/WebCore/platform/graphics/ca/TileGrid.h
M Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
M Source/WebCore/platform/graphics/cg/GraphicsContextCG.h
M Source/WebCore/platform/graphics/cocoa/IOSurface.h
M Source/WebCore/platform/graphics/cocoa/IOSurface.mm
M Source/WebCore/platform/ios/PlatformScreenIOS.mm
M Source/WebCore/platform/mac/PlatformScreenMac.mm
M Source/WebCore/rendering/RenderElement.cpp
M Source/WebCore/rendering/RenderElement.h
M Source/WebCore/rendering/RenderLayerBacking.cpp
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/RemoteLayerWithRemoteRenderingBackingStore.mm
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h
M
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeDrawingAreaProxyIOS.mm
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/WebProcessPool.h
M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
M Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp
M Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h
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
Log Message:
-----------
Painted images don't get tone mapped down to the level supported by the
display.
https://bugs.webkit.org/show_bug.cgi?id=294419
<rdar://152695267>
Reviewed by Mike Wyrzykowski.
Add support for getting the currently available EDR headroom to PlatformScreen,
and synchronize it to all processes. Use
NSApplicationDidChangeScreenParametersNotification to detect change on macos,
use a poll on every displaylink update on iOS.
When painting via RemoteDisplayListRecorderProxy, clamp image headroom to the
maximum currently available on the display, and keep track of what the highest
painted value was (and if it was clamped). Theses values get stored on the
RemoteLayerBackingStore.
When display headroom changes, trigger a compositing update for all layers. Adds
a new function 'setNeedsDisplayIfHeadroomExceeds' to GraphicsLayer (and layers
below it) that conditionally mark repaint if the new display headroom would
apply different clamping to what is currently painted into the layer.
Some of this is a bit awkward since we don't really know what is painted into a
layer in advance, so using the recorded to track what HDR painting occurred and
keep it available for the next paint.
This approach lets us track headroom per-tile, and only repaint affected tiles
when the display headroom. The downside is that a content change to remove an
HDR image won't drop the max headroom for tiles that it was previouly drawn to,
so those will get repainted again if the display headroom changes (once, and
then the cached headroom will be correct).
We also serialize the resulting headroom of the layer to the UI process via
RemoteLayerBackingStoreProperties. We use CAIOSurface to cache a CoreAnimation
wrapper around an IOSurface, and we need to recreate these if the IOSurface
headroom metadata has changed.
* Source/WebCore/PAL/pal/cocoa/QuartzCoreSoftLink.h:
* Source/WebCore/PAL/pal/cocoa/QuartzCoreSoftLink.mm:
* Source/WebCore/loader/cache/CachedImage.cpp:
(WebCore::CachedImage::currentFrameHeadroom const):
* Source/WebCore/loader/cache/CachedImage.h:
* Source/WebCore/page/Page.cpp:
(WebCore::m_presentingApplicationBundleIdentifier):
(WebCore::Page::screenPropertiesDidChange):
(WebCore::Page::updateDisplayEDRHeadroom):
* Source/WebCore/page/Page.h:
(WebCore::Page::displayEDRHeadroom const):
* Source/WebCore/platform/Logging.h:
* Source/WebCore/platform/PlatformScreen.h:
* Source/WebCore/platform/ScreenProperties.h:
* Source/WebCore/platform/graphics/BitmapImage.h:
* Source/WebCore/platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::setMaxEDRHeadroom):
(WebCore::GraphicsContext::maxPaintedHeadroom const):
(WebCore::GraphicsContext::paintingClampedHeadroom const):
(WebCore::GraphicsContext::clearMaxPaintedHeadroom):
* Source/WebCore/platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::setNeedsDisplayIfHeadroomExceeds):
* Source/WebCore/platform/graphics/GraphicsLayer.h:
* Source/WebCore/platform/graphics/GraphicsLayerClient.h:
* Source/WebCore/platform/graphics/Image.h:
(WebCore::Image::currentFrameHeadroom const):
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setNeedsDisplayIfHeadroomExceeds):
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:
* Source/WebCore/platform/graphics/ca/PlatformCALayer.h:
* Source/WebCore/platform/graphics/ca/PlatformCALayer.mm:
(WebCore::PlatformCALayer::setNeedsDisplayIfHeadroomExceeds):
* Source/WebCore/platform/graphics/ca/TileController.cpp:
(WebCore::TileController::setNeedsDisplayIfHeadroomExceeds):
* Source/WebCore/platform/graphics/ca/TileController.h:
* Source/WebCore/platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::setNeedsDisplayIfHeadroomExceeds):
* Source/WebCore/platform/graphics/ca/TileGrid.h:
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::drawNativeImageInternal):
(WebCore::GraphicsContextCG::setMaxEDRHeadroom):
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.h:
* Source/WebCore/platform/graphics/cocoa/IOSurface.h:
* Source/WebCore/platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::asCAIOSurfaceLayerContents const):
(WebCore::IOSurface::setContentEDRHeadroom):
(WebCore::IOSurface::contentEDRHeadroom const):
* Source/WebCore/platform/ios/PlatformScreenIOS.mm:
(WebCore::currentEDRHeadroomForDisplay):
(WebCore::maxEDRHeadroomForDisplay):
(WebCore::collectScreenProperties):
* Source/WebCore/platform/mac/PlatformScreenMac.mm:
(WebCore::collectScreenProperties):
(WebCore::currentEDRHeadroomForDisplay):
(WebCore::maxEDRHeadroomForDisplay):
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::RenderElement):
* Source/WebCore/rendering/RenderElement.h:
(WebCore::RenderElement::hasHDRImages const):
(WebCore::RenderElement::setHasHDRImages):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateDrawsContent):
(WebCore::RenderLayerBacking::paintContents):
* Source/WebKit/Shared/RemoteLayerTree/LayerProperties.h:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::encode const):
(WebKit::RemoteLayerBackingStoreProperties::dump const):
(WebKit::RemoteLayerBackingStore::setNeedsDisplay):
(WebKit::RemoteLayerBackingStore::setNeedsDisplayIfHeadroomExceeds):
(WebKit::RemoteLayerBackingStore::supportsPartialRepaint const):
(WebKit::RemoteLayerBackingStore::drawInContext):
(WebKit::RemoteLayerBackingStoreProperties::updateCachedBuffers):
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTree.serialization.in:
*
Source/WebKit/Shared/RemoteLayerTree/RemoteLayerWithRemoteRenderingBackingStore.mm:
(WebKit::RemoteLayerWithRemoteRenderingBackingStore::dump const):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::registerNotificationObservers):
(WebKit::WebProcessPool::unregisterNotificationObservers):
(WebKit::WebProcessPool::willRefreshDisplay):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
*
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeDrawingAreaProxyIOS.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxyIOS::didRefreshDisplay):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebProcessPool.h:
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::willRefreshDisplay):
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::drawNativeImageInternal):
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:
(WebKit::RemoteDisplayListRecorderProxy::paintingClampedHeadroom const):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.mm:
(WebKit::PlatformCALayerRemote::setNeedsDisplayIfHeadroomExceeds):
*
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.cpp:
(WebKit::PlatformCALayerRemoteTiledBacking::setNeedsDisplayIfHeadroomExceeds):
*
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.h:
Canonical link: https://commits.webkit.org/296360@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