color-lcms: add debug scope for color profiles
It prints the existent color profiles for new subscribers. Also prints any creation/destruction of color profiles. Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
parent
d827bdd5d4
commit
a28e0c26e1
@ -389,6 +389,7 @@ cmlcms_destroy(struct weston_color_manager *cm_base)
|
|||||||
cmsDeleteContext(cm->lcms_ctx);
|
cmsDeleteContext(cm->lcms_ctx);
|
||||||
|
|
||||||
weston_log_scope_destroy(cm->transforms_scope);
|
weston_log_scope_destroy(cm->transforms_scope);
|
||||||
|
weston_log_scope_destroy(cm->profiles_scope);
|
||||||
|
|
||||||
free(cm);
|
free(cm);
|
||||||
}
|
}
|
||||||
@ -417,6 +418,26 @@ transforms_scope_new_sub(struct weston_log_subscription *subs, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
profiles_scope_new_sub(struct weston_log_subscription *subs, void *data)
|
||||||
|
{
|
||||||
|
struct weston_color_manager_lcms *cm = data;
|
||||||
|
struct cmlcms_color_profile *cprof;
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
if (wl_list_empty(&cm->color_profile_list))
|
||||||
|
return;
|
||||||
|
|
||||||
|
weston_log_subscription_printf(subs, "Existent:\n");
|
||||||
|
wl_list_for_each(cprof, &cm->color_profile_list, link) {
|
||||||
|
weston_log_subscription_printf(subs, "Color profile %p:\n", cprof);
|
||||||
|
|
||||||
|
str = cmlcms_color_profile_print(cprof);
|
||||||
|
weston_log_subscription_printf(subs, "%s", str);
|
||||||
|
free(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WL_EXPORT struct weston_color_manager *
|
WL_EXPORT struct weston_color_manager *
|
||||||
weston_color_manager_create(struct weston_compositor *compositor)
|
weston_color_manager_create(struct weston_compositor *compositor)
|
||||||
{
|
{
|
||||||
@ -444,12 +465,19 @@ weston_color_manager_create(struct weston_compositor *compositor)
|
|||||||
weston_compositor_add_log_scope(compositor, "color-lcms-transformations",
|
weston_compositor_add_log_scope(compositor, "color-lcms-transformations",
|
||||||
"Color transformation creation and destruction.\n",
|
"Color transformation creation and destruction.\n",
|
||||||
transforms_scope_new_sub, NULL, cm);
|
transforms_scope_new_sub, NULL, cm);
|
||||||
if (!cm->transforms_scope)
|
cm->profiles_scope =
|
||||||
|
weston_compositor_add_log_scope(compositor, "color-lcms-profiles",
|
||||||
|
"Color profile creation and destruction.\n",
|
||||||
|
profiles_scope_new_sub, NULL, cm);
|
||||||
|
|
||||||
|
if (!cm->profiles_scope || !cm->transforms_scope)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
return &cm->base;
|
return &cm->base;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
weston_log_scope_destroy(cm->transforms_scope);
|
||||||
|
weston_log_scope_destroy(cm->profiles_scope);
|
||||||
free(cm);
|
free(cm);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
struct weston_color_manager_lcms {
|
struct weston_color_manager_lcms {
|
||||||
struct weston_color_manager base;
|
struct weston_color_manager base;
|
||||||
|
struct weston_log_scope *profiles_scope;
|
||||||
struct weston_log_scope *transforms_scope;
|
struct weston_log_scope *transforms_scope;
|
||||||
cmsContext lcms_ctx;
|
cmsContext lcms_ctx;
|
||||||
|
|
||||||
@ -222,6 +223,9 @@ cmlcms_create_stock_profile(struct weston_color_manager_lcms *cm);
|
|||||||
void
|
void
|
||||||
cmlcms_color_profile_destroy(struct cmlcms_color_profile *cprof);
|
cmlcms_color_profile_destroy(struct cmlcms_color_profile *cprof);
|
||||||
|
|
||||||
|
char *
|
||||||
|
cmlcms_color_profile_print(const struct cmlcms_color_profile *cprof);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
retrieve_eotf_and_output_inv_eotf(cmsContext lcms_ctx,
|
retrieve_eotf_and_output_inv_eotf(cmsContext lcms_ctx,
|
||||||
cmsHPROFILE hProfile,
|
cmsHPROFILE hProfile,
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "color-lcms.h"
|
#include "color-lcms.h"
|
||||||
#include "shared/helpers.h"
|
#include "shared/helpers.h"
|
||||||
#include "shared/string-helpers.h"
|
#include "shared/string-helpers.h"
|
||||||
|
#include "shared/xalloc.h"
|
||||||
|
|
||||||
struct xyz_arr_flt {
|
struct xyz_arr_flt {
|
||||||
float v[3];
|
float v[3];
|
||||||
@ -298,6 +299,17 @@ cmlcms_find_color_profile_by_md5(const struct weston_color_manager_lcms *cm,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
cmlcms_color_profile_print(const struct cmlcms_color_profile *cprof)
|
||||||
|
{
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
str_printf(&str, " description: %s\n", cprof->base.description);
|
||||||
|
abort_oom_if_null(str);
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
static struct cmlcms_color_profile *
|
static struct cmlcms_color_profile *
|
||||||
cmlcms_color_profile_create(struct weston_color_manager_lcms *cm,
|
cmlcms_color_profile_create(struct weston_color_manager_lcms *cm,
|
||||||
cmsHPROFILE profile,
|
cmsHPROFILE profile,
|
||||||
@ -305,6 +317,7 @@ cmlcms_color_profile_create(struct weston_color_manager_lcms *cm,
|
|||||||
char **errmsg)
|
char **errmsg)
|
||||||
{
|
{
|
||||||
struct cmlcms_color_profile *cprof;
|
struct cmlcms_color_profile *cprof;
|
||||||
|
char *str;
|
||||||
|
|
||||||
cprof = zalloc(sizeof *cprof);
|
cprof = zalloc(sizeof *cprof);
|
||||||
if (!cprof)
|
if (!cprof)
|
||||||
@ -316,17 +329,30 @@ cmlcms_color_profile_create(struct weston_color_manager_lcms *cm,
|
|||||||
cmsGetHeaderProfileID(profile, cprof->md5sum.bytes);
|
cmsGetHeaderProfileID(profile, cprof->md5sum.bytes);
|
||||||
wl_list_insert(&cm->color_profile_list, &cprof->link);
|
wl_list_insert(&cm->color_profile_list, &cprof->link);
|
||||||
|
|
||||||
|
weston_log_scope_printf(cm->profiles_scope,
|
||||||
|
"New color profile: %p\n", cprof);
|
||||||
|
|
||||||
|
str = cmlcms_color_profile_print(cprof);
|
||||||
|
weston_log_scope_printf(cm->profiles_scope, "%s", str);
|
||||||
|
free(str);
|
||||||
|
|
||||||
return cprof;
|
return cprof;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cmlcms_color_profile_destroy(struct cmlcms_color_profile *cprof)
|
cmlcms_color_profile_destroy(struct cmlcms_color_profile *cprof)
|
||||||
{
|
{
|
||||||
|
struct weston_color_manager_lcms *cm = get_cmlcms(cprof->base.cm);
|
||||||
|
|
||||||
wl_list_remove(&cprof->link);
|
wl_list_remove(&cprof->link);
|
||||||
cmsFreeToneCurveTriple(cprof->vcgt);
|
cmsFreeToneCurveTriple(cprof->vcgt);
|
||||||
cmsFreeToneCurveTriple(cprof->eotf);
|
cmsFreeToneCurveTriple(cprof->eotf);
|
||||||
cmsFreeToneCurveTriple(cprof->output_inv_eotf_vcgt);
|
cmsFreeToneCurveTriple(cprof->output_inv_eotf_vcgt);
|
||||||
cmsCloseProfile(cprof->profile);
|
cmsCloseProfile(cprof->profile);
|
||||||
|
|
||||||
|
weston_log_scope_printf(cm->profiles_scope, "Destroyed color profile %p. " \
|
||||||
|
"Description: %s\n", cprof, cprof->base.description);
|
||||||
|
|
||||||
free(cprof->base.description);
|
free(cprof->base.description);
|
||||||
free(cprof);
|
free(cprof);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user