Re: [PATCH v4 06/11] drm/amd/display: Add fixed matrix colorop to color pipeline
Robert Mader <[email protected]> Tue, 28 Jul 2026 18:00:10 +0200
| Newsgroups | org.freedesktop.lists.amd-gfx,org.freedesktop.lists.dri-devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Harry, I tested this on my laptop using my Weston branch at [1] with color-management being disabled, meaning the new implementation is used as a drop-in replacement for the legacy properties - no further color-ops being used. The results between offloading to plane and GL-renderer where visually indistinguishable. Thus Tested-by: Robert Mader <[email protected]> 1: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/2157 On 22.07.26 15:46, Harry Wentland wrote: > Insert a fixed matrix colorop as the first operation in the > amdgpu color pipeline, before the existing DEGAM 1D curve. This > allows userspace to select YUV-to-RGB conversion via the color > pipeline for YCbCr framebuffers. > > The fixed matrix colorop advertises support for all six YUV-to-RGB > conversion presets: > - YUV601/709/2020 full-range to RGB > - YUV601/709/2020 limited-range to RGB > > Assisted-by: Claude:claude-opus-4.6 > Signed-off-by: Harry Wentland <[email protected]> > Reviewed-by: Alex Hung <[email protected]> > --- > .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 27 ++++++++++++++++++- > .../amd/display/amdgpu_dm/amdgpu_dm_colorop.h | 1 + > 2 files changed, 27 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c > index 056a76b88f43..1ed12cdce317 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c > @@ -55,6 +55,14 @@ const u64 amdgpu_dm_supported_blnd_tfs = > BIT(DRM_COLOROP_1D_CURVE_GAMMA22); > EXPORT_IF_KUNIT(amdgpu_dm_supported_blnd_tfs); > > +const u64 amdgpu_dm_supported_fm = > + BIT(DRM_COLOROP_FM_YCBCR601_FULL_RGB) | > + BIT(DRM_COLOROP_FM_YCBCR601_LIMITED_RGB) | > + BIT(DRM_COLOROP_FM_YCBCR709_FULL_RGB) | > + BIT(DRM_COLOROP_FM_YCBCR709_LIMITED_RGB) | > + BIT(DRM_COLOROP_FM_YCBCR2020_NC_FULL_RGB) | > + BIT(DRM_COLOROP_FM_YCBCR2020_NC_LIMITED_RGB); > + > #define MAX_COLOR_PIPELINE_OPS 10 > > #define LUT3D_SIZE 17 > @@ -73,6 +81,23 @@ amdgpu_dm_build_default_pipeline(struct drm_device *dev, struct drm_plane *plane > > memset(ops, 0, sizeof(ops)); > > + /* Fixed Matrix (YUV to RGB) */ > + ops[i] = kzalloc_obj(*ops[0]); > + if (!ops[i]) { > + ret = -ENOMEM; > + goto cleanup; > + } > + > + ret = drm_plane_colorop_fixed_matrix_init(dev, ops[i], plane, &dm_colorop_funcs, > + amdgpu_dm_supported_fm, > + DRM_COLOROP_FLAG_ALLOW_BYPASS); > + if (ret) > + goto cleanup; > + > + list->type = ops[i]->base.id; > + > + i++; > + > /* 1D curve - DEGAM TF */ > ops[i] = kzalloc_obj(*ops[0]); > if (!ops[i]) { > @@ -86,7 +111,7 @@ amdgpu_dm_build_default_pipeline(struct drm_device *dev, struct drm_plane *plane > if (ret) > goto cleanup; > > - list->type = ops[i]->base.id; > + drm_colorop_set_next_property(ops[i - 1], ops[i]); > > i++; > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h > index 77364d954d3b..7802efa5312d 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h > @@ -30,6 +30,7 @@ > extern const u64 amdgpu_dm_supported_degam_tfs; > extern const u64 amdgpu_dm_supported_shaper_tfs; > extern const u64 amdgpu_dm_supported_blnd_tfs; > +extern const u64 amdgpu_dm_supported_fm; > > int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_prop_enum_list *list); > -- Robert Mader Consultant Software Developer Collabora Ltd. Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK Registered in England & Wales, no. 5513718