[PATCH V10 43/46] drm/amd/display: add 3D LUT colorop
Nícolas F. R. A. Prado
nfraprado at collabora.com
Mon Aug 4 19:51:16 UTC 2025
On Mon, 2025-06-16 at 22:17 -0600, Alex Hung wrote:
> This adds support for a 3D LUT.
>
> The color pipeline now consists of the following colorops:
> 1. 1D curve colorop
> 2. Multiplier
> 3. 3x4 CTM
> 4. 1D curve colorop
> 5. 1D LUT
> 6. 3D LUT
> 7. 1D curve colorop
> 8. 1D LUT
>
> Signed-off-by: Alex Hung <alex.hung at amd.com>
> Reviewed-by: Daniel Stone <daniels at collabora.com>
> ---
[..]
> +/* __set_colorop_3dlut - set DRM 3D LUT to DC stream
> + * @drm_lut3d: user 3D LUT
> + * @drm_lut3d_size: size of 3D LUT
> + * @lut3d: DC 3D LUT
> + *
> + * Map user 3D LUT data to DC 3D LUT and all necessary bits to
> program it
> + * on DCN accordingly.
> + */
> +static void __set_colorop_3dlut(const struct drm_color_lut_32
> *drm_lut3d,
> + uint32_t drm_lut3d_size,
> + struct dc_3dlut *lut)
> +{
> + if (!drm_lut3d_size) {
> + lut->state.bits.initialized = 0;
> + return;
> + }
IIUC this means that setting a 3D LUT colorop with BYPASS=0 but not
passing in a DATA property will result in the 3D LUT being bypassed.
Meanwhile, in __set_dm_plane_colorop_3x4_matrix() in patch 36
"drm/amd/display: add 3x4 matrix colorop", when DATA is not set, an
error code will be bubbled up to atomic_check.
Given that this API is aimed at being prescriptive, I would expect the
second case, bubbling up an error to atomic_check, to happen whenever a
required DATA property is omitted, for all of the colorop types.
This makes me think it would be good to have a colorop validator helper
function that could be called from the driver's atomic_check to easily
do all such checks, such as that DATA is supplied when expected, not
only to remove the burden on every driver to check this, but also to
ensure consistency across them all.
--
Thanks,
Nícolas
> +
> + /* Only supports 17x17x17 3D LUT (12-bit) now */
> + lut->lut_3d.use_12bits = true;
> + lut->lut_3d.use_tetrahedral_9 = false;
> +
> + lut->state.bits.initialized = 1;
> + __drm_3dlut_32_to_dc_3dlut(drm_lut3d, drm_lut3d_size, &lut-
> >lut_3d,
> + lut->lut_3d.use_tetrahedral_9,
> 12);
> +
> +}
[..]
More information about the amd-gfx
mailing list