[client] wayland: implement HDR support

This commit is contained in:
Geoffrey McRae
2026-07-15 19:48:31 +10:00
parent 92d0383fd7
commit e2f6de77e7
16 changed files with 623 additions and 30 deletions

View File

@@ -28,6 +28,7 @@
#include "common/debug.h"
#include "common/option.h"
#include "interface/renderer.h"
#include "dynamic/wayland_desktops.h"
@@ -143,6 +144,9 @@ static bool waylandInit(const LG_DSInitParams params)
if (!waylandRegistryInit())
return false;
if (!waylandColorMgmtInit())
return false;
if (!waylandActivationInit())
return false;
@@ -189,6 +193,7 @@ static void waylandFree(void)
waylandPresentationFree();
waylandInputFree();
waylandOutputFree();
waylandColorMgmtFree();
waylandRegistryFree();
waylandCursorFree();
wl_display_disconnect(wlWm.display);
@@ -202,6 +207,12 @@ static bool waylandGetProp(LG_DSProperty prop, void * ret)
return true;
}
if (prop == LG_DS_NATIVE_HDR)
{
*(bool *)ret = wlWm.cmCanDoHDR;
return true;
}
return false;
}
@@ -227,6 +238,22 @@ static void waylandMinimize(void)
wlWm.desktop->minimize();
}
static bool waylandHDRCallback(const void * rendererFormat)
{
if (!wlWm.colorManager)
return false;
const LG_RendererFormat * format = (const LG_RendererFormat *)rendererFormat;
if (format->hdr)
return waylandRequestHDR(format->hdrDisplayPrimary, format->hdrWhitePoint,
format->hdrMaxDisplayLuminance, format->hdrMinDisplayLuminance,
format->hdrMaxContentLightLevel, format->hdrMaxFrameAverageLightLevel,
format->hdrPQ);
else
waylandRequestClearHDR();
return true;
}
struct LG_DisplayServerOps LGDS_Wayland =
{
.name = "Wayland",
@@ -276,6 +303,8 @@ struct LG_DisplayServerOps LGDS_Wayland =
.getFullscreen = waylandGetFullscreen,
.minimize = waylandMinimize,
.setHDRImageDescription = waylandHDRCallback,
.cbInit = waylandCBInit,
.cbNotice = waylandCBNotice,
.cbRelease = waylandCBRelease,