Skip to content

YUV conversion colorop with amdgpu and VKMS

Harry Wentland amd-gfx dri-devel stable 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest10 patches 4 repliesIn review
  2. v510 patches 4 repliesSuperseded
  3. v411 patches 28 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v311 patches11 repliesSuperseded
v2 RFC9 patches16 repliesSuperseded

Changes in v6 from the cover letter

- Fix fill_plane_color_attributes build failure in Patch 8 when building with KUNIT (Robert)

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10drm/colorop: Add DRM_COLOROP_FIXED_MATRIXdrivers/gpu/drm/drm_atomic.c drivers/gpu/drm/drm_atomic_uapi.c drivers/gpu/drm/drm_colorop.c +2 more+257 -00 replies
2/10drm/vkms: Fix limited-range YCbCr to RGB conversion scalingdrivers/gpu/drm/vkms/tests/gen_yuv_conversion.py drivers/gpu/drm/vkms/tests/vkms_format_test.c drivers/gpu/drm/vkms/vkms_formats.c+144 -361 reply
3/10drm/vkms: Add fixed matrix colorop to color pipelinedrivers/gpu/drm/vkms/vkms_colorop.c+46 -200 replies
4/10drm/vkms: Add atomic check and matrix handling for fixed matrix coloropdrivers/gpu/drm/vkms/tests/vkms_format_test.c drivers/gpu/drm/vkms/vkms_composer.c drivers/gpu/drm/vkms/vkms_formats.c +2 more+71 -30 replies
5/10drm/amd/display: Add fixed matrix colorop to color pipelinedrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h+27 -10 replies
6/10drm/amd/display: Implement fixed matrix colorop color space mappingdrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c+67 -10 replies
7/10drm/amd/display: Use GAMCOR for first TF if YUV conversion is neededdrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c+16 -10 replies
8/10drm/amd/display: Check actual state during commit_taildrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c+19 -160 replies
9/10drm/amd/display: Set color_space to plane_infosdrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+2 -00 replies
10/10drm/amd/display: Force GAMCOR for subsampled surfaces with PQ/Gamma22/HLGdrivers/gpu/drm/amd/display/modules/color/color_gamma.c+2 -10 replies

Reviews trailers per patch

All 10 patches have a Reviewed-by or Acked-by.

PatchAlex HungRobert MaderMelissa WenHarry WentlandPekka Paalanen
1/10R-b R-b R-b R-b R-b
2/10R-b T-b
3/10R-b R-b
4/10R-b R-b
5/10R-b T-b
6/10R-b T-b
7/10R-b T-b
8/10R-b T-b
9/10R-b T-b
10/10R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v6 thread

Cover letter [PATCH v6 00/10] YUV conversion colorop with amdgpu and VKMS

When we merged the drm_plane color pipeline API the major gap that existed was the lack of a YUV to RGB conversion colorop. We deprecated any legacy drm_plane color properties, which means that the COLOR_RANGE and COLOR_ENCODING properties can't be used with the COLOR_PIPELINE property on a drm_plane. In practice this means that we can't use a COLOR_PIPELINE on YCbCr encoded framebuffers.

This patchset expands on the Fixed Matrix colorop proposed by Chaitanya and adds limited range variants of the YCbCr to RGB conversions.

His full patchset can be found at
https://patchwork.freedesktop.org/patch/709860

This code has been tested with IGT and an experimental KWin branch.

All patches are now reviewed and tested. We have a Weston and KWin implementation. IGT patches are missing one review. I deem these patches ready to merge once the last IGT patch review comes in.

IGT branch:
https://gitlab.freedesktop.org/hwentland/igt-gpu-tools/-/tree/yuv-fm-colorop

KWin branch used for testing:
https://invent.kde.org/hwentlan/kwin/-/tree/yuv-fm-colorop

The kernel branch containing these changes, based on drm-misc-next can be found at:
https://gitlab.freedesktop.org/hwentland/linux/-/tree/yuv-fm-colorop

Further background on this work can be found at:
https://hwentland.github.io/2026/03/10/plane-color-pipeline-csc-3d-lut-kwin.html

v6:
- Fix fill_plane_color_attributes build failure in Patch 8 when building with KUNIT (Robert)

v5:
- Drop new VKMS kunit tests for conversion matrices
- Added script to show how VKMS kunit test values are computed (Pekka)
- Removed fixed-matrix enums for "YCbCr limtied to full" and "RGB709 to RGB2020" as they're currently unused by userspace (Robert)

v4:
- Specify matrix entries in docs (Pekka)
- Squash limited-range enums into "Add FM" patch (Robert)
- Don't reject RGB planes with fixed matrix in VKMS as we don't want or need to make a colorop dependent on the framebuffer's pixel format. (Robert)
- Fix conversion matrices in VKMS and implement kunit tests (discovered while documenting the matrices)

v3:
- base on Chaitanya's updated patch and rename code accordingly to Fixed_Matrix instead of CSC Fixed-Function

v2:
- use Chaitanya's CSC_FF block for named matrices

Cc Alex Hung <[email protected]>
Cc Daniel Stone <[email protected]>
Cc Chaitanya Kumar Borah <[email protected]>
Cc Uma Shankar <[email protected]>
Cc Louis Chauvet <[email protected]>
Cc Melissa Wen <[email protected]>
Cc Simon Ser <[email protected]>
Cc Robert Mader <[email protected]>

Chaitanya Kumar Borah (1):
drm/colorop: Add DRM_COLOROP_FIXED_MATRIX

Harry Wentland (9):
drm/vkms: Fix limited-range YCbCr to RGB conversion scaling drm/vkms: Add fixed matrix colorop to color pipeline drm/vkms: Add atomic check and matrix handling for fixed matrix
colorop
drm/amd/display: Add fixed matrix colorop to color pipeline drm/amd/display: Implement fixed matrix colorop color space mapping drm/amd/display: Use GAMCOR for first TF if YUV conversion is needed drm/amd/display: Check actual state during commit_tail drm/amd/display: Set color_space to plane_infos drm/amd/display: Force GAMCOR for subsampled surfaces with

    PQ/Gamma22/HLG
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  14 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   7 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   |  85 +++++++++++-
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c |  27 +++-
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.h |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  |  16 +--
 .../amd/display/modules/color/color_gamma.c   |   3 +-
 drivers/gpu/drm/drm_atomic.c                  |   4 +
 drivers/gpu/drm/drm_atomic_uapi.c             |   7 +
 drivers/gpu/drm/drm_colorop.c                 | 107 +++++++++++++++
 .../gpu/drm/vkms/tests/gen_yuv_conversion.py  |  87 ++++++++++++
 drivers/gpu/drm/vkms/tests/vkms_format_test.c |  40 +++---
 drivers/gpu/drm/vkms/vkms_colorop.c           |  66 ++++++---
 drivers/gpu/drm/vkms/vkms_composer.c          |   6 +
 drivers/gpu/drm/vkms/vkms_formats.c           |  64 ++++++---
 drivers/gpu/drm/vkms/vkms_formats.h           |   2 +-
 drivers/gpu/drm/vkms/vkms_plane.c             |  55 +++++++-
 include/drm/drm_colorop.h                     | 127 ++++++++++++++++++
 include/uapi/drm/drm_mode.h                   |  12 ++
 19 files changed, 651 insertions(+), 79 deletions(-)
 create mode 100755 drivers/gpu/drm/vkms/tests/gen_yuv_conversion.py

--
2.55.0