From: Harry Wentland <harry.wentland@amd.com>
To: <dri-devel@lists.freedesktop.org>, <amd-gfx@lists.freedesktop.org>
Cc: Harry Wentland <harry.wentland@amd.com>
Subject: [RFC PATCH v2 3/9] drm/vkms: Add CSC FF colorop to color pipeline
Date: Mon, 30 Mar 2026 11:34:45 -0400 [thread overview]
Message-ID: <20260330153451.99472-4-harry.wentland@amd.com> (raw)
In-Reply-To: <20260330153451.99472-1-harry.wentland@amd.com>
Insert a CSC Fixed-Function colorop as the first operation in the
VKMS color pipeline, before the existing 1D curve. This allows
userspace to select YUV-to-RGB conversion via the color pipeline
for YCbCr framebuffers.
The CSC FF 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
Bump MAX_COLOR_PIPELINE_OPS from 4 to 5 to accommodate the new op.
Assisted-by Claude:claude-opus-4.6
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
---
drivers/gpu/drm/vkms/vkms_colorop.c | 66 ++++++++++++++++++++---------
1 file changed, 46 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_colorop.c b/drivers/gpu/drm/vkms/vkms_colorop.c
index 071f3a8d2e7c..fa78ac7be36e 100644
--- a/drivers/gpu/drm/vkms/vkms_colorop.c
+++ b/drivers/gpu/drm/vkms/vkms_colorop.c
@@ -12,11 +12,19 @@ static const u64 supported_tfs =
BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
BIT(DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF);
+static const u64 supported_csc_ff =
+ BIT(DRM_COLOROP_CSC_FF_YUV601_RGB601) |
+ BIT(DRM_COLOROP_CSC_FF_YUV601_LIMITED_RGB601) |
+ BIT(DRM_COLOROP_CSC_FF_YUV709_RGB709) |
+ BIT(DRM_COLOROP_CSC_FF_YUV709_LIMITED_RGB709) |
+ BIT(DRM_COLOROP_CSC_FF_YUV2020_RGB2020) |
+ BIT(DRM_COLOROP_CSC_FF_YUV2020_LIMITED_RGB2020);
+
static const struct drm_colorop_funcs vkms_colorop_funcs = {
.destroy = drm_colorop_destroy,
};
-#define MAX_COLOR_PIPELINE_OPS 4
+#define MAX_COLOR_PIPELINE_OPS 5
static int vkms_initialize_color_pipeline(struct drm_plane *plane, struct drm_prop_enum_list *list)
{
@@ -27,7 +35,25 @@ static int vkms_initialize_color_pipeline(struct drm_plane *plane, struct drm_pr
memset(ops, 0, sizeof(ops));
- /* 1st op: 1d curve */
+ /* 1st op: CSC Fixed-Function (YUV to RGB) */
+ ops[i] = kzalloc_obj(*ops[i]);
+ if (!ops[i]) {
+ drm_err(dev, "KMS: Failed to allocate colorop\n");
+ ret = -ENOMEM;
+ goto cleanup;
+ }
+
+ ret = drm_plane_colorop_csc_ff_init(dev, ops[i], plane, &vkms_colorop_funcs,
+ supported_csc_ff,
+ DRM_COLOROP_FLAG_ALLOW_BYPASS);
+ if (ret)
+ goto cleanup;
+
+ list->type = ops[i]->base.id;
+
+ i++;
+
+ /* 2nd op: 1d curve */
ops[i] = kzalloc_obj(*ops[i]);
if (!ops[i]) {
drm_err(dev, "KMS: Failed to allocate colorop\n");
@@ -41,23 +67,6 @@ static int vkms_initialize_color_pipeline(struct drm_plane *plane, struct drm_pr
if (ret)
goto cleanup;
- list->type = ops[i]->base.id;
-
- i++;
-
- /* 2nd op: 3x4 matrix */
- ops[i] = kzalloc_obj(*ops[i]);
- if (!ops[i]) {
- drm_err(dev, "KMS: Failed to allocate colorop\n");
- ret = -ENOMEM;
- goto cleanup;
- }
-
- ret = drm_plane_colorop_ctm_3x4_init(dev, ops[i], plane, &vkms_colorop_funcs,
- DRM_COLOROP_FLAG_ALLOW_BYPASS);
- if (ret)
- goto cleanup;
-
drm_colorop_set_next_property(ops[i - 1], ops[i]);
i++;
@@ -79,7 +88,24 @@ static int vkms_initialize_color_pipeline(struct drm_plane *plane, struct drm_pr
i++;
- /* 4th op: 1d curve */
+ /* 4th op: 3x4 matrix */
+ ops[i] = kzalloc_obj(*ops[i]);
+ if (!ops[i]) {
+ drm_err(dev, "KMS: Failed to allocate colorop\n");
+ ret = -ENOMEM;
+ goto cleanup;
+ }
+
+ ret = drm_plane_colorop_ctm_3x4_init(dev, ops[i], plane, &vkms_colorop_funcs,
+ DRM_COLOROP_FLAG_ALLOW_BYPASS);
+ if (ret)
+ goto cleanup;
+
+ drm_colorop_set_next_property(ops[i - 1], ops[i]);
+
+ i++;
+
+ /* 5th op: 1d curve */
ops[i] = kzalloc_obj(*ops[i]);
if (!ops[i]) {
drm_err(dev, "KMS: Failed to allocate colorop\n");
--
2.53.0
next prev parent reply other threads:[~2026-03-30 15:35 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 15:34 [RFC PATCH v2 0/9] YUV conversion colorop with amdgpu and VKMS Harry Wentland
2026-03-30 15:34 ` [RFC PATCH v2 1/9] drm/colorop: Add DRM_COLOROP_CSC_FF Harry Wentland
2026-04-08 11:31 ` Borah, Chaitanya Kumar
2026-03-30 15:34 ` [RFC PATCH v2 2/9] drm/colorop: Add limited-range YUV-to-RGB CSC FF enum values Harry Wentland
2026-04-21 21:22 ` Alex Hung
2026-04-23 9:34 ` Borah, Chaitanya Kumar
2026-04-30 18:19 ` Harry Wentland
2026-05-05 10:17 ` Borah, Chaitanya Kumar
2026-03-30 15:34 ` Harry Wentland [this message]
2026-04-21 21:21 ` [RFC PATCH v2 3/9] drm/vkms: Add CSC FF colorop to color pipeline Alex Hung
2026-03-30 15:34 ` [RFC PATCH v2 4/9] drm/vkms: Add atomic check and matrix handling for CSC FF colorop Harry Wentland
2026-04-21 21:20 ` Alex Hung
2026-03-30 15:34 ` [RFC PATCH v2 5/9] drm/amd/display: Add CSC FF colorop to color pipeline Harry Wentland
2026-04-21 21:14 ` Alex Hung
2026-03-30 15:34 ` [RFC PATCH v2 6/9] drm/amd/display: Implement CSC FF colorop color space mapping Harry Wentland
2026-04-21 21:13 ` Alex Hung
2026-03-30 15:34 ` [RFC PATCH v2 7/9] drm/amd/display: Use GAMCOR for first TF if CSC is used Harry Wentland
2026-04-21 21:08 ` Alex Hung
2026-04-30 20:43 ` Harry Wentland
2026-04-24 14:48 ` Melissa Wen
2026-03-30 15:34 ` [RFC PATCH v2 8/9] drm/amd/display: Check actual state during commit_tail Harry Wentland
2026-04-21 21:12 ` Alex Hung
2026-05-01 16:03 ` Harry Wentland
2026-03-30 15:34 ` [RFC PATCH v2 9/9] drm/amd/display: Set color_space to plane_infos Harry Wentland
2026-04-21 21:23 ` Alex Hung
2026-04-22 21:40 ` [RFC PATCH v2 0/9] YUV conversion colorop with amdgpu and VKMS Melissa Wen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260330153451.99472-4-harry.wentland@amd.com \
--to=harry.wentland@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.