[client] egl: correct CAS processing for HDR

Convert HDR scRGB input to normalized linear Rec.2020 before CAS, then
convert the filtered result back to scRGB. Use the content metadata to
select an appropriate normalization peak while leaving SDR unchanged.

This follows AMD's documented recommendation for applying CAS to HDR
content and prevents HDR highlights from being clamped and dimmed.
This commit is contained in:
Geoffrey McRae
2026-07-19 20:13:42 +10:00
parent 0333bf0261
commit e18925f436
6 changed files with 52 additions and 9 deletions

View File

@@ -876,7 +876,8 @@ static bool configureChain(EGL_PostProcess * this, EGL_PixelFormat pixFmt,
bool egl_postProcessRun(EGL_PostProcess * this, EGL_Texture * tex,
EGL_DesktopRects * rects, int desktopWidth, int desktopHeight,
unsigned int targetX, unsigned int targetY, bool useDMA, bool hdrPQ)
unsigned int targetX, unsigned int targetY, bool useDMA, bool hdrPQ,
float hdrPeak)
{
if (targetX == 0 && targetY == 0)
DEBUG_FATAL("targetX || targetY == 0");
@@ -918,10 +919,11 @@ bool egl_postProcessRun(EGL_PostProcess * this, EGL_Texture * tex,
}
EGL_FilterRects filterRects = {
.rects = rects,
.matrix = this->matrix,
.width = desktopWidth,
.height = desktopHeight,
.rects = rects,
.matrix = this->matrix,
.width = desktopWidth,
.height = desktopHeight,
.hdrPeak = hdrPeak,
};
EGL_Texture * texture = tex;