Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1c03de58be74573fcb24eab420ea8ba5c2c585e2
https://github.com/WebKit/WebKit/commit/1c03de58be74573fcb24eab420ea8ba5c2c585e2
Author: Carlos Bentzen <[email protected]>
Date: 2025-11-07 (Fri, 07 Nov 2025)
Changed paths:
M Source/WebCore/platform/graphics/gbm/DMABufBuffer.h
M Source/WebCore/platform/graphics/texmap/TextureMapper.cpp
M Source/WebCore/platform/graphics/texmap/TextureMapper.h
M Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp
M Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h
M
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayerBufferDMABuf.cpp
M
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayerBufferVideo.cpp
M
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayerBufferYUV.cpp
M
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayerBufferYUV.h
Log Message:
-----------
[GStreamer][GL] HDR10 tone mapping missing
https://bugs.webkit.org/show_bug.cgi?id=301850
Reviewed by Carlos Garcia Campos.
At the moment, we only support sRGB rendering in ports where
GStreamer is used as multimedia backend, so direct HDR rendering is not
easily feasible unless hole-punching is used, but we can at least
tone-map correctly to achieve better results with HDR10 content. This patch
implements tone-mapping of HDR10 (BT2100-PQ) to SDR (sRGB) through an
extra step in the texture mapper when such conversion is deemed necessary.
When we detect that the video info colorimetry is
GST_VIDEO_COLORIMETRY_BT2100_PQ, which wasn't in place before, we set the
colorspace
to BT.2020 and we set a newly added enum for the PQ transfer function.
The extra step in the texture mapper fragment shader program is called
`applyToneMapPQ`,
and is compiled only when we have detected a PQ transfer function in the
video info. It will perform the tone-mapping from BT.2100 PQ (HDR) to sRGB (SDR)
by applying these steps:
1. Reference PQ EOTF (ITU-R BT.2100)
2. Normalize using HDR reference white (ITU-R BT.2408)
3. Tone-map using a simplified maxRGB-based Reinhard (based on
Chromium's implementation)
4. Convert from BT.2020 to BT.709 primaries
5. Apply inverse EOTF for sRGB gamma encoding (IEC 61966-2)
With these changes, we can get better HDR10 representation and fix the
previously-seen washed out colors
with the "Life Untouched" sample, as shown in the screenshots attached to the
bug.
The output looks much more like what's seen with Chromium, MPV and VLC.
Driving-By: Fix casing of Colorspace enums in modified classes.
TODO: implement HLG tone-mapping.
* Source/WebCore/platform/graphics/gbm/DMABufBuffer.h:
* Source/WebCore/platform/graphics/texmap/TextureMapper.cpp:
(WebCore::TextureMapper::drawTexturePlanarYUV):
(WebCore::TextureMapper::drawTextureSemiPlanarYUV):
(WebCore::TextureMapper::drawTexturePackedYUV):
* Source/WebCore/platform/graphics/texmap/TextureMapper.h:
* Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp:
(WebCore::TextureMapperShaderProgram::create):
* Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h:
*
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayerBufferDMABuf.cpp:
(WebCore::CoordinatedPlatformLayerBufferDMABuf::importYUV const):
*
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayerBufferVideo.cpp:
(WebCore::CoordinatedPlatformLayerBufferVideo::createBufferFromDMABufMemory):
(WebCore::CoordinatedPlatformLayerBufferVideo::createBufferFromGLMemory):
*
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayerBufferYUV.cpp:
(WebCore::CoordinatedPlatformLayerBufferYUV::create):
(WebCore::CoordinatedPlatformLayerBufferYUV::CoordinatedPlatformLayerBufferYUV):
(WebCore::CoordinatedPlatformLayerBufferYUV::paintToTextureMapper):
*
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayerBufferYUV.h:
Canonical link: https://commits.webkit.org/302751@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications