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>
This commit is contained in:
Pekka Paalanen 2024-03-04 14:02:03 +02:00 committed by Pekka Paalanen
parent b0224c4752
commit aef9404b1d
4 changed files with 7 additions and 0 deletions

View file

@ -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;

View file

@ -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);
}

View file

@ -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;

View file

@ -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) {