[client] wayland: harden native HDR colour state

Serialize asynchronous image-description state and publish compositor
capabilities safely across the Wayland and render threads.

Use the predefined Windows-scRGB description, query each output image
description for its configured reference white, and reapply HDR when the
surface moves to an output with different colour settings.
This commit is contained in:
Geoffrey McRae
2026-07-19 04:42:46 +10:00
parent 0e14e9c357
commit 4c7b5b2531
6 changed files with 391 additions and 39 deletions

View File

@@ -76,6 +76,7 @@ static void wlSurfaceEnterHandler(void * data, struct wl_surface * surface, stru
node->output = output;
wl_list_insert(&wlWm.surfaceOutputs, &node->link);
waylandWindowUpdateScale();
waylandOutputUpdateHDRWhiteLevel();
}
static void wlSurfaceLeaveHandler(void * data, struct wl_surface * surface, struct wl_output * output)
@@ -85,9 +86,11 @@ static void wlSurfaceLeaveHandler(void * data, struct wl_surface * surface, stru
if (node->output == output)
{
wl_list_remove(&node->link);
free(node);
break;
}
waylandWindowUpdateScale();
waylandOutputUpdateHDRWhiteLevel();
}
static const struct wl_surface_listener wlSurfaceListener = {
@@ -169,6 +172,14 @@ bool waylandWindowInit(const char * title, const char * appId, bool fullscreen,
void waylandWindowFree(void)
{
struct SurfaceOutput * output;
struct SurfaceOutput * temp;
wl_list_for_each_safe(output, temp, &wlWm.surfaceOutputs, link)
{
wl_list_remove(&output->link);
free(output);
}
if (wlWm.fractionalScaleInterface)
wp_fractional_scale_v1_destroy(wlWm.fractionalScaleInterface);
if (wlWm.contentType)