mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 04:40:07 +01:00
frontend,color: print details of the set color profile
It is nice to see the numbers of a parametric color profile when created from CTA or EDID or just to cross-check with weston.ini. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
daec4a0994
commit
d7030571c5
5 changed files with 57 additions and 0 deletions
|
|
@ -1340,6 +1340,19 @@ wet_output_set_transform(struct weston_output *output,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
weston_log_indent_multiline(int indent, const char *multiline)
|
||||
{
|
||||
const char *delim = multiline;
|
||||
|
||||
while (*delim) {
|
||||
delim = strchrnul(multiline, '\n');
|
||||
weston_log_continue(STAMP_SPACE "%*s%.*s\n",
|
||||
indent, "", (int)(delim - multiline), multiline);
|
||||
multiline = delim + 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
wet_output_set_vrr_mode(struct weston_output *output,
|
||||
struct weston_config_section *section)
|
||||
|
|
@ -1434,6 +1447,7 @@ wet_output_set_color_profile(struct weston_output *output,
|
|||
struct wet_compositor *compositor = to_wet_compositor(output->compositor);
|
||||
struct weston_color_profile *cprof;
|
||||
char *icc_file = NULL;
|
||||
char *details;
|
||||
bool ok;
|
||||
|
||||
if (!compositor->use_color_manager)
|
||||
|
|
@ -1460,6 +1474,11 @@ wet_output_set_color_profile(struct weston_output *output,
|
|||
output->name);
|
||||
}
|
||||
|
||||
weston_log("Output '%s' set to color profile:\n", output->name);
|
||||
details = weston_color_profile_get_details(cprof);
|
||||
weston_log_indent_multiline(0, details);
|
||||
free(details);
|
||||
|
||||
weston_color_profile_unref(cprof);
|
||||
return ok ? 0 : -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -312,6 +312,9 @@ weston_color_profile_unref(struct weston_color_profile *cprof);
|
|||
const char *
|
||||
weston_color_profile_get_description(struct weston_color_profile *cprof);
|
||||
|
||||
char *
|
||||
weston_color_profile_get_details(struct weston_color_profile *cprof);
|
||||
|
||||
struct weston_color_profile *
|
||||
weston_compositor_load_icc_file(struct weston_compositor *compositor,
|
||||
const char *path);
|
||||
|
|
|
|||
|
|
@ -368,6 +368,15 @@ profiles_scope_new_sub(struct weston_log_subscription *subs, void *data)
|
|||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
cmlcms_print_color_profile_details(const struct weston_color_profile *cprof_base)
|
||||
{
|
||||
const struct cmlcms_color_profile *prof =
|
||||
container_of(cprof_base, const struct cmlcms_color_profile, base);
|
||||
|
||||
return cmlcms_color_profile_print(prof);
|
||||
}
|
||||
|
||||
static void
|
||||
lcms_error_logger(cmsContext context_id,
|
||||
cmsUInt32Number error_code,
|
||||
|
|
@ -495,6 +504,7 @@ weston_color_manager_create(struct weston_compositor *compositor)
|
|||
cm->base.init = cmlcms_init;
|
||||
cm->base.destroy = cmlcms_destroy;
|
||||
cm->base.destroy_color_profile = cmlcms_destroy_color_profile;
|
||||
cm->base.print_color_profile_details = cmlcms_print_color_profile_details;
|
||||
cm->base.ref_stock_sRGB_color_profile = cmlcms_ref_stock_sRGB_color_profile;
|
||||
cm->base.get_color_profile_from_icc = cmlcms_get_color_profile_from_icc;
|
||||
cm->base.get_color_profile_from_params = cmlcms_get_color_profile_from_params;
|
||||
|
|
|
|||
|
|
@ -106,6 +106,27 @@ weston_color_profile_get_description(struct weston_color_profile *cprof)
|
|||
return "(untagged)";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get color profile detailed description
|
||||
*
|
||||
* A detailed, multi-line description of the profile is meant for
|
||||
* human readable logs.
|
||||
*
|
||||
* \param cprof The color profile, NULL is accepted too.
|
||||
* \returns The detailed description. Must be free()'d.
|
||||
*/
|
||||
WL_EXPORT char *
|
||||
weston_color_profile_get_details(struct weston_color_profile *cprof)
|
||||
{
|
||||
if (!cprof)
|
||||
return xstrdup("NULL profile.\n");
|
||||
|
||||
if (cprof->cm->print_color_profile_details)
|
||||
return cprof->cm->print_color_profile_details(cprof);
|
||||
else
|
||||
return xstrdup("No details.\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a newly allocated color profile object
|
||||
*
|
||||
|
|
|
|||
|
|
@ -522,6 +522,10 @@ struct weston_color_manager {
|
|||
void
|
||||
(*destroy_color_profile)(struct weston_color_profile *cprof);
|
||||
|
||||
/** Print detailed description of the color profile */
|
||||
char *
|
||||
(*print_color_profile_details)(const struct weston_color_profile *cprof);
|
||||
|
||||
/** Gets a new reference to the stock sRGB color profile
|
||||
*
|
||||
* \param cm The color manager.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue