Skip to content

backends/drm: add support for post-blending color pipelines

Xaver Hugl requested to merge work/zamundaaa/color-pipeline-post-blending into master

Instead of using degamma, ctm and gamma only for night light, the properties can be used to apply color transforms to fullscreen content, enabling direct scanout of SDR content on HDR monitors and HDR content on SDR monitors, as well as enabling direct scanout when night light is active or the brightness setting is below 100%.

To do that, this MR

  1. adds a color pipeline class, to have a generic and optimized way to represent color operations. It automatically removes operations that are no-ops (like identity matrix or multiplying by one) and combines operations that can be combined (matrix+matrix, multiplier+multiplier, matrix+multiplier, EOTF + inverse EOTF, relative EOTF + multiplier) for better efficiency and easier KMS offloading
  2. implements support for the degamma, ctm and gamma properties, and wraps them in a generic abstraction for color pipeline operations, which can be trivially extended to make use of AMD and NVidia's driver specific color management properties and of course the upstream color pipeline proposal. In this commit it's only used for night light
  3. uses the generic abstraction when the cursor isn't visible to do direct scanout of fullscreen content that needs colorspace conversions

The same color pipeline infrastructure could be used with shaders as well (so both shader and KMS color operations can be programmed in one central place), but I wanted to do one step at a time. This is already a big and messy enough MR in its current state.

Merge request reports