libweston: add weston_output::color_profile

Add API to set an output's color profile. This new function can also be
called while the output is enabled. This allows changing the output
color profile even at runtime if desired.

color-noop has no way of creating weston_color_profile objects, so it
just asserts that no color profile is set.

color-lcms does not yet implement taking the output color profile into
account, so for now it just fails everything if a profile is set.

weston_surface_color_transform_fini() was previously used only prior to
freeing the struct, but now it is used also to just clear the struct,
hence it needs to reset the fields.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen
2021-06-08 14:17:44 +03:00
committed by Pekka Paalanen
parent 9a0aa37edd
commit 9a9e6ced1b
5 changed files with 79 additions and 4 deletions
+17
View File
@@ -57,6 +57,10 @@ cmlcms_get_surface_color_transform(struct weston_color_manager *cm_base,
};
struct cmlcms_color_transform *xform;
/* TODO: use output color profile */
if (output->color_profile)
return false;
xform = cmlcms_color_transform_get(cm, &param);
if (!xform)
return false;
@@ -82,6 +86,10 @@ cmlcms_get_output_color_transform(struct weston_color_manager *cm_base,
};
struct cmlcms_color_transform *xform;
/* TODO: use output color profile */
if (output->color_profile)
return false;
xform = cmlcms_color_transform_get(cm, &param);
if (!xform)
return false;
@@ -96,6 +104,11 @@ cmlcms_get_sRGB_to_output_color_transform(struct weston_color_manager *cm_base,
struct weston_color_transform **xform_out)
{
/* Assumes output color space is sRGB SDR */
/* TODO: use output color profile */
if (output->color_profile)
return false;
/* Identity transform */
*xform_out = NULL;
@@ -114,6 +127,10 @@ cmlcms_get_sRGB_to_blend_color_transform(struct weston_color_manager *cm_base,
};
struct cmlcms_color_transform *xform;
/* TODO: use output color profile */
if (output->color_profile)
return false;
xform = cmlcms_color_transform_get(cm, &param);
if (!xform)
return false;