summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.com>2024-03-04 14:02:03 +0200
committerPekka Paalanen <pq@iki.fi>2024-03-20 12:58:12 +0000
commitaef9404b1d71c873a5ee9241d1a5c04ba4d6f889 (patch)
tree1b303a51b0c7bf9b2a804197175591594a1dc695
parentb0224c4752491b731e91e7f29a3e18f10e9339b7 (diff)
color: generate id for color transformations
Just like with color profiles, generate an ID for color transformations as well. This is not needed by protocol or anything, it is just for debugging purposes. A small ID is easier for humans than a long pointer value. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
-rw-r--r--include/libweston/libweston.h1
-rw-r--r--libweston/color.c3
-rw-r--r--libweston/color.h1
-rw-r--r--libweston/compositor.c2
4 files changed, 7 insertions, 0 deletions
diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h
index 423d8a65..3570d21c 100644
--- a/include/libweston/libweston.h
+++ b/include/libweston/libweston.h
@@ -1448,6 +1448,7 @@ struct weston_compositor {
struct weston_color_manager *color_manager;
struct weston_idalloc *color_profile_id_generator;
+ struct weston_idalloc *color_transform_id_generator;
struct weston_renderer *renderer;
const struct pixel_format_info *read_format;
diff --git a/libweston/color.c b/libweston/color.c
index 7c9c3e4b..df403333 100644
--- a/libweston/color.c
+++ b/libweston/color.c
@@ -150,6 +150,8 @@ weston_color_transform_unref(struct weston_color_transform *xform)
return;
wl_signal_emit(&xform->destroy_signal, xform);
+ weston_idalloc_put_id(xform->cm->compositor->color_transform_id_generator,
+ xform->id);
xform->cm->destroy_color_transform(xform);
}
@@ -168,6 +170,7 @@ weston_color_transform_init(struct weston_color_transform *xform,
{
xform->cm = cm;
xform->ref_count = 1;
+ xform->id = weston_idalloc_get_id(cm->compositor->color_transform_id_generator);
wl_signal_init(&xform->destroy_signal);
}
diff --git a/libweston/color.h b/libweston/color.h
index 1ac2a4e0..e0a40f5e 100644
--- a/libweston/color.h
+++ b/libweston/color.h
@@ -199,6 +199,7 @@ struct weston_color_mapping {
struct weston_color_transform {
struct weston_color_manager *cm;
int ref_count;
+ uint32_t id; /* For debug */
/* for renderer or backend to attach their own cached objects */
struct wl_signal destroy_signal;
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 5745af27..bb29b83b 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -9247,6 +9247,7 @@ weston_compositor_create(struct wl_display *display,
weston_compositor_install_capture_protocol(ec);
ec->color_profile_id_generator = weston_idalloc_create(ec);
+ ec->color_transform_id_generator = weston_idalloc_create(ec);
wl_list_init(&ec->view_list);
wl_list_init(&ec->plane_list);
@@ -9775,6 +9776,7 @@ weston_compositor_destroy(struct weston_compositor *compositor)
weston_log_scope_destroy(compositor->libseat_debug);
compositor->libseat_debug = NULL;
+ weston_idalloc_destroy(compositor->color_transform_id_generator);
weston_idalloc_destroy(compositor->color_profile_id_generator);
if (compositor->default_dmabuf_feedback) {