Commits on Source (5)
-
Roughly speaking, a color profile describes the color space of content or an output. Under the hood, the description includes one or more ways to map colors between the profile space and some standard profile connecting space (PCS). This object is not called a color space. A color space has a unique definition, while a color profile may contain multiple different mappings depending on render intent. Some of these mappings may be subjective, with an artistic touch. When a source color profile and a destination color profile are combined under a specific render intent, they produce a color transformation. Color transformations are already preresented by weston_color_transform. This patch adds the basic API for color profile objects. Everything worthwhile of these objects is implemented in the color managers: color-noop never creates these, and in color-lcms they are basically a container for cmsHPROFILE, the Little CMS object for color profiles. Color profile objects will not be interpreted outside of the color managers, unlike color transformations. For a start, the color manager API has one function to create color profiles: from ICC profile data. More creation functions for other sources will be added later. The API has errmsg return parameter for error messages. These are not simply weston_log()'d, because CM&HDR protocol will allow clients to trigger errors and the protocol handles that gracefully. Therefore instead of flooding the compositor logs, the error messages will probably need to be relayed back to clients. Color-lcms is expected to create a cmsHPROFILE for all kinds of color profiles, not just for those created from ICC profile data. Hence, color-lcms will fingerprint color profiles by the MD5 hash which Little CMS computes for us. The fingerprint is used for de-duplication: instead of creating copies, reference existing color profiles. This code is very much based on Sebastian Wick's earlier work on Weston color management, but structured and named differently. Co-authored-by: Sebastian Wick <sebastian@sebastianwick.net> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
aa6346f2 -
This function will be useful for Weston to load output ICC profiles from weston.ini. Co-authored-by: Sebastian Wick <sebastian@sebastianwick.net> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
f45d5762 -
Move the code into a new function that either succeeds in setting all the color transformations or does not change anything. This will be useful when implementing output color profiles changes while the output is enabled. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
9a0aa37e -
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>
9a9e6ced -
This adds "icc_profile" key support in [output] sections for backends headless, x11, wayland, and drm, and also for remoted and pipewire outputs FWIW. On the other hand, RDP-backend does not use output sections from weston.ini, and fbdev-backend does not deserve anything new (it wouldn't support color management anyway due to no GL-renderer). This allows one to configure an ICC v2 or v4 file to be used as an output profile. However, color-lcms does not actually use output profiles yet, so trying this will fail until support is implemented. The parent_winsys_profile argument is reserved for using the color profile from a parent window system where applicable, if nothing else is set in weston.ini. None of the nested backends provide an output color profile yet. It is more of a reminder of a missing feature than a serious implementation. Note: cms-static Weston plugin uses the exact same weston.ini key for loading VCGT from ICC profiles. If "color-management" option is set to false, this new use of "icc_profile" is disabled and the old behavior with cms-static is kept. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
a8827940
libweston/color-lcms/color-profile.c
0 → 100644