color-lcms: print transformation id instead of pointer

Pointer values are hard to track for humans, being long numbers. Now
that we have unique id for each color transformation, print that instead
of the pointer. It is a small number easy to track for humans.

Transformation id numbers do get re-used aggressively, so you have to
keep track of what is being destroyed and created over time when reading
logs. Pointers had the same caveat, just a lot more random.

The prefix 't' indicates "transformation".

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2024-03-04 13:46:33 +02:00 committed by Pekka Paalanen
parent aef9404b1d
commit efec55cf62
2 changed files with 5 additions and 4 deletions

View File

@ -327,7 +327,7 @@ transforms_scope_new_sub(struct weston_log_subscription *subs, void *data)
weston_log_subscription_printf(subs, "Existent:\n");
wl_list_for_each(xform, &cm->color_transform_list, link) {
weston_log_subscription_printf(subs, "Color transformation %p:\n", xform);
weston_log_subscription_printf(subs, "Color transformation t%u:\n", xform->base.id);
str = cmlcms_color_transform_search_param_string(&xform->search_key);
weston_log_subscription_printf(subs, "%s", str);

View File

@ -171,7 +171,7 @@ cmlcms_color_transform_destroy(struct cmlcms_color_transform *xform)
unref_cprof(xform->search_key.output_profile);
weston_log_scope_printf(cm->transforms_scope,
"Destroyed color transformation %p.\n", xform);
"Destroyed color transformation t%u.\n", xform->base.id);
free(xform);
}
@ -841,8 +841,9 @@ lcms_xform_error_logger(cmsContext context_id,
in = xform->search_key.input_profile;
out = xform->search_key.output_profile;
weston_log("LittleCMS error with color transformation from "
weston_log("LittleCMS error with color transformation t%u from "
"'%s' (p%u) to '%s' (p%u), %s: %s\n",
xform->base.id,
in ? in->base.description : "(none)",
in ? in->base.id : 0,
out ? out->base.description : "(none)",
@ -1007,7 +1008,7 @@ cmlcms_color_transform_create(struct weston_color_manager_lcms *cm,
xform->search_key.output_profile = ref_cprof(search_param->output_profile);
weston_log_scope_printf(cm->transforms_scope,
"New color transformation: %p\n", xform);
"New color transformation: t%u\n", xform->base.id);
str = cmlcms_color_transform_search_param_string(&xform->search_key);
weston_log_scope_printf(cm->transforms_scope, "%s", str);
free(str);