mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-07-16 04:12:03 +00:00
[client] wayland: implement HDR support
This commit is contained in:
committed by
Geoffrey McRae
parent
28973ac4b1
commit
364485ded8
@@ -618,6 +618,11 @@ bool app_getProp(LG_DSProperty prop, void * ret)
|
||||
return g_state.ds->getProp(prop, ret);
|
||||
}
|
||||
|
||||
bool app_getHDRDescFailed(void)
|
||||
{
|
||||
return atomic_load(&g_state.hdrDescFailed);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_EGL
|
||||
EGLDisplay app_getEGLDisplay(void)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -154,6 +154,11 @@ struct AppState
|
||||
enum MicDefaultState micDefaultState;
|
||||
|
||||
int spiceHotX, spiceHotY;
|
||||
|
||||
// Set to true when setHDRImageDescription() returns false, indicating
|
||||
// the display server could not apply the HDR image description.
|
||||
// Checked by the renderer to fall back to software tone-mapping.
|
||||
_Atomic(bool) hdrDescFailed;
|
||||
};
|
||||
|
||||
struct AppParams
|
||||
|
||||
Reference in New Issue
Block a user