Skip to content

Simplify color manager API with struct weston_output_color_outcome

Pekka Paalanen requested to merge pq/weston:mr/colorapi into main

This is a small refactoring series that attempts to improve readability.

The commit message of the second patch describes it best:

I am going to need to add yet another output property to be set by a color manager: HDR Static Metadata Type 1. With the old color manager API design, I would have needed to add the fourth function pointer to be called always in the same group as the previous three. This seemed more convoluted than it needs to be.

Therefore collapse the three existing function pointers in the API into just one that is resposible for setting up all three things.

To make it obvious which things of the huge collection of fields in weston_output need to be set, we have struct weston_output_color_outcome: all fields of this struct are the responsibility of the color manager in this new API function.

The name weston_output_color_outcome was a result of long pondering and coming up with nothing obviously better. It is a structure intended to hold derived color information specific to the output: the various color transformations that are derived from the output color profile, and the HDR metadata derived from, well, everything. These are all things the color manager will decide based on what has been set on the output: the color profile, the basic color characteristics, the EOTF mode, etc.

Perhaps slightly off-topic, the final commit "color-lcms: refactor away setup_seach_param()" cleans up the callee side of the said function pointer.

None of this changes behavior.

Edited by Pekka Paalanen

Merge request reports