From 23305aefa2d3dcf57b898000849cdb92510700fa Mon Sep 17 00:00:00 2001 From: Steve Williams Date: Sat, 31 Jan 2026 15:11:14 +0400 Subject: [PATCH] color-representation: add support for identity+full --- types/wlr_color_representation_v1.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/types/wlr_color_representation_v1.c b/types/wlr_color_representation_v1.c index 55ad98e6c..45ae781a9 100644 --- a/types/wlr_color_representation_v1.c +++ b/types/wlr_color_representation_v1.c @@ -247,13 +247,25 @@ static void surface_synced_commit(struct wlr_surface_synced *synced) { } bool is_unset = color_repr->current.coefficients == 0 && color_repr->current.range == 0; + bool is_identity_full = color_repr->current.coefficients == WP_COLOR_REPRESENTATION_SURFACE_V1_COEFFICIENTS_IDENTITY && color_repr->current.range == WP_COLOR_REPRESENTATION_SURFACE_V1_RANGE_FULL; + bool is_ycbcr = pixel_format_is_ycbcr(dmabuf.format); if (is_ycbcr) { if (is_unset) { color_repr->current.coefficients = WP_COLOR_REPRESENTATION_SURFACE_V1_COEFFICIENTS_BT601; color_repr->current.range = WP_COLOR_REPRESENTATION_SURFACE_V1_RANGE_LIMITED; } + else if(is_identity_full) { + wl_resource_post_error(color_repr->resource, + WP_COLOR_REPRESENTATION_SURFACE_V1_ERROR_PIXEL_FORMAT, + "unexpected encoding/range for yuv"); + } } else /* rgb */ { + if(is_identity_full) { + color_repr->current.coefficients = 0; + color_repr->current.range = 0; + is_unset = true; + } if (!is_unset) { wl_resource_post_error(color_repr->resource, WP_COLOR_REPRESENTATION_SURFACE_V1_ERROR_PIXEL_FORMAT, @@ -461,6 +473,10 @@ struct wlr_color_representation_manager_v1 *wlr_color_representation_manager_v1_ struct wlr_color_representation_v1_coeffs_and_range coeffs_and_ranges[COEFFICIENTS_LEN * RANGES_LEN]; size_t coeffs_and_ranges_len = 0; + coeffs_and_ranges[coeffs_and_ranges_len++] = (struct wlr_color_representation_v1_coeffs_and_range){ + .coeffs = WP_COLOR_REPRESENTATION_SURFACE_V1_COEFFICIENTS_IDENTITY, + .range = WP_COLOR_REPRESENTATION_SURFACE_V1_RANGE_FULL, + }; for (size_t i = 0; i < COEFFICIENTS_LEN; i++) { enum wp_color_representation_surface_v1_coefficients coeffs = coefficients[i]; enum wlr_color_encoding enc = wlr_color_representation_v1_color_encoding_to_wlr(coeffs);