egl: correct ImGui overlay luminance in HDR

Render ImGui to an intermediate SDR framebuffer and map it into the
native PQ or scRGB output using the Wayland surface reference white.
Preserve premultiplied alpha during conversion and limit composition to
damaged overlay regions.
This commit is contained in:
Geoffrey McRae
2026-07-18 03:02:19 +10:00
parent 37d7f0e48f
commit acb5c06794
10 changed files with 394 additions and 3 deletions

View File

@@ -108,7 +108,12 @@ static bool getCompositor(char * dst, size_t size)
static bool waylandInit(const LG_DSInitParams params)
{
memset(&wlWm, 0, sizeof(wlWm));
wlWm.desktop = WL_Desktops[0];
wlWm.desktop = WL_Desktops[0];
wlWm.hdrWhiteLevels = (LG_DSHDRWhiteLevels)
{
.pq = 203,
.scRGB = 80,
};
wlWm.display = wl_display_connect(NULL);
if (!wlWm.display)
@@ -215,6 +220,12 @@ static bool waylandGetProp(LG_DSProperty prop, void * ret)
return true;
}
if (prop == LG_DS_HDR_WHITE_LEVELS)
{
*(LG_DSHDRWhiteLevels *)ret = wlWm.hdrWhiteLevels;
return true;
}
return false;
}