From bb882e97f1893583b89c622eee640f34cfeed85c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Poisot?= Date: Sat, 27 Dec 2025 15:45:25 +0000 Subject: [PATCH] color_management_v1: use 64bit image description identities ref https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/385 --- include/wlr/types/wlr_color_management_v1.h | 2 +- types/wlr_color_management_v1.c | 26 +++++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/include/wlr/types/wlr_color_management_v1.h b/include/wlr/types/wlr_color_management_v1.h index 8caa61c6a..2fc46d5ea 100644 --- a/include/wlr/types/wlr_color_management_v1.h +++ b/include/wlr/types/wlr_color_management_v1.h @@ -78,7 +78,7 @@ struct wlr_color_manager_v1 { struct wl_list outputs; // wlr_color_management_output_v1.link struct wl_list surface_feedbacks; // wlr_color_management_surface_feedback_v1.link - uint32_t last_image_desc_identity; + uint64_t last_image_desc_identity; struct wl_listener display_destroy; } WLR_PRIVATE; diff --git a/types/wlr_color_management_v1.c b/types/wlr_color_management_v1.c index bc59f5309..d3aae0464 100644 --- a/types/wlr_color_management_v1.c +++ b/types/wlr_color_management_v1.c @@ -179,8 +179,16 @@ static void image_desc_create_ready(struct wlr_color_manager_v1 *manager, image_desc, image_desc_handle_resource_destroy); // TODO: de-duplicate identity - uint32_t identity = ++manager->last_image_desc_identity; - wp_image_description_v1_send_ready(image_desc->resource, identity); + uint64_t identity = ++manager->last_image_desc_identity; + uint32_t identity_hi = identity >> 32; + uint32_t identity_lo = (uint32_t)identity; + + uint32_t version = wl_resource_get_version(image_desc->resource); + if (version >= WP_IMAGE_DESCRIPTION_V1_READY2_SINCE_VERSION) { + wp_image_description_v1_send_ready2(image_desc->resource, identity_hi, identity_lo); + } else { + wp_image_description_v1_send_ready(image_desc->resource, identity_lo); + } } static void image_desc_create_failed(struct wl_resource *parent_resource, uint32_t id, @@ -975,14 +983,22 @@ void wlr_color_manager_v1_set_surface_preferred_image_description( struct wlr_color_manager_v1 *manager, struct wlr_surface *surface, const struct wlr_image_description_v1_data *data) { // TODO: de-duplicate identity - uint32_t identity = ++manager->last_image_desc_identity; + uint64_t identity = ++manager->last_image_desc_identity; + uint32_t identity_hi = identity >> 32; + uint32_t identity_lo = (uint32_t)identity; struct wlr_color_management_surface_feedback_v1 *surface_feedback; wl_list_for_each(surface_feedback, &manager->surface_feedbacks, link) { if (surface_feedback->surface == surface) { surface_feedback->data = *data; - wp_color_management_surface_feedback_v1_send_preferred_changed( - surface_feedback->resource, identity); + uint32_t version = wl_resource_get_version(surface_feedback->resource); + if (version >= WP_COLOR_MANAGEMENT_SURFACE_FEEDBACK_V1_PREFERRED_CHANGED2_SINCE_VERSION) { + wp_color_management_surface_feedback_v1_send_preferred_changed2( + surface_feedback->resource, identity_hi, identity_lo); + } else { + wp_color_management_surface_feedback_v1_send_preferred_changed( + surface_feedback->resource, identity_lo); + } } } }