[client] wayland: implement HDR support

This commit is contained in:
Geoffrey McRae
2026-07-15 19:48:31 +10:00
committed by Geoffrey McRae
parent 28973ac4b1
commit 364485ded8
16 changed files with 623 additions and 30 deletions

View File

@@ -641,6 +641,25 @@ int main_frameThread(void * unused)
lgrFormat.hdr = frame->flags & FRAME_FLAG_HDR;
lgrFormat.hdrPQ = frame->flags & FRAME_FLAG_HDR_PQ;
if (lgrFormat.hdr)
{
memcpy(lgrFormat.hdrDisplayPrimary, frame->hdrDisplayPrimary, sizeof(lgrFormat.hdrDisplayPrimary));
memcpy(lgrFormat.hdrWhitePoint , frame->hdrWhitePoint , sizeof(lgrFormat.hdrWhitePoint ));
lgrFormat.hdrMaxDisplayLuminance = frame->hdrMaxDisplayLuminance;
lgrFormat.hdrMinDisplayLuminance = frame->hdrMinDisplayLuminance;
lgrFormat.hdrMaxContentLightLevel = frame->hdrMaxContentLightLevel;
lgrFormat.hdrMaxFrameAverageLightLevel = frame->hdrMaxFrameAverageLightLevel;
}
else
{
memset(lgrFormat.hdrDisplayPrimary, 0, sizeof(lgrFormat.hdrDisplayPrimary));
memset(lgrFormat.hdrWhitePoint , 0, sizeof(lgrFormat.hdrWhitePoint ));
lgrFormat.hdrMaxDisplayLuminance = 0;
lgrFormat.hdrMinDisplayLuminance = 0;
lgrFormat.hdrMaxContentLightLevel = 0;
lgrFormat.hdrMaxFrameAverageLightLevel = 0;
}
if (frame->flags & FRAME_FLAG_TRUNCATED)
{
const float needed =
@@ -728,6 +747,17 @@ int main_frameThread(void * unused)
}
LG_UNLOCK(g_state.lgrLock);
if (g_state.ds->setHDRImageDescription)
{
if (!g_state.ds->setHDRImageDescription(&lgrFormat))
{
DEBUG_WARN("Display server failed to apply HDR image description");
atomic_store(&g_state.hdrDescFailed, true);
}
else
atomic_store(&g_state.hdrDescFailed, false);
}
g_state.srcSize.x = lgrFormat.screenWidth;
g_state.srcSize.y = lgrFormat.screenHeight;
g_state.haveSrcSize = true;