backends/drm: rewrite the color pipeline matching algorithm to support 3D LUTs

The most challenging part of supporting 3D LUTs is to avoid without losing too much precision - current generation AMD hardware for example only has 17 steps in every direction of the 3D LUT, so its resolution is very limited.

Because of that limited resolution, the 3D LUT very strongly benefits from being applied in non-linear space, so that the little resolution we have is applied in parts of the luminance range the user can see most.

To handle those issues, the implemented drm color pipeline matching algorithm

  • has a preference for each color op, instead of a boolean (not) supported flag
  • has additional checks for the color space types a color operation can use for as input or output (to enforce nonlinear RGB for 3D LUTs)
  • recursively searches for the best match
  • allows drm color ops to apply only part of a color operation, leaving the rest up to later stages
  • adds a 1D shaper LUT using the PQ transfer function before and after every 3D LUT

The result is that without tone mapping, the image looks pretty much identical on AMD hardware, and even with tonemapping, the visible difference is small enough for it not to be too noticeable.

Commit 2 also adds support for named 1D curves

Edit: The user visible impact of this is explained in !6600 (merged); only difference is that this uses the hardware better and makes it work with tone mapping.

Edited by Xaver Hugl

Merge request reports

Loading