From 188a3ebd5e329fae54adde1216af6da8d28cbfce Mon Sep 17 00:00:00 2001 From: Leandro Ribeiro Date: Tue, 21 Nov 2023 17:18:15 -0300 Subject: [PATCH] libweston: expose color management support In this patch we enable the color-management protocol support, as long as the color-manager plugin in use supports it. Signed-off-by: Leandro Ribeiro --- libweston/color-lcms/color-lcms.c | 7 +++++-- libweston/color-noop.c | 1 - libweston/color.h | 3 --- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libweston/color-lcms/color-lcms.c b/libweston/color-lcms/color-lcms.c index b20603a7..992b87d6 100644 --- a/libweston/color-lcms/color-lcms.c +++ b/libweston/color-lcms/color-lcms.c @@ -32,7 +32,7 @@ #include "color.h" #include "color-lcms.h" -#include "color-properties.h" +#include "color-management.h" #include "shared/helpers.h" #include "shared/xalloc.h" #include "shared/weston-assert.h" @@ -470,7 +470,6 @@ weston_color_manager_create(struct weston_compositor *compositor) cm->base.name = "work-in-progress"; cm->base.compositor = compositor; - cm->base.supports_client_protocol = true; cm->base.init = cmlcms_init; cm->base.destroy = cmlcms_destroy; cm->base.destroy_color_profile = cmlcms_destroy_color_profile; @@ -481,6 +480,10 @@ weston_color_manager_create(struct weston_compositor *compositor) cm->base.get_surface_color_transform = cmlcms_get_surface_color_transform; cm->base.create_output_color_outcome = cmlcms_create_output_color_outcome; + /* We support the CM&HDR protocol extension when using LittleCMS. */ + if (weston_compositor_enable_color_management_protocol(compositor) < 0) + goto err; + /* We still do not support creating parametric color profiles. */ cm->base.supported_color_features = (1 << WESTON_COLOR_FEATURE_ICC); diff --git a/libweston/color-noop.c b/libweston/color-noop.c index c784eab9..99b4e727 100644 --- a/libweston/color-noop.c +++ b/libweston/color-noop.c @@ -243,7 +243,6 @@ weston_color_manager_noop_create(struct weston_compositor *compositor) cm->base.name = "no-op"; cm->base.compositor = compositor; - cm->base.supports_client_protocol = false; cm->base.init = cmnoop_init; cm->base.destroy = cmnoop_destroy; cm->base.destroy_color_profile = cmnoop_destroy_color_profile; diff --git a/libweston/color.h b/libweston/color.h index aeb61f9d..cb24fbdc 100644 --- a/libweston/color.h +++ b/libweston/color.h @@ -252,9 +252,6 @@ struct weston_color_manager { /** This compositor instance */ struct weston_compositor *compositor; - /** Supports the Wayland CM&HDR protocol extension? */ - bool supports_client_protocol; - /** * Supported color features from Wayland CM&HDR protocol extension. *