public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Harry Wentland <harry.wentland@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: Harry Wentland <harry.wentland@amd.com>
Subject: [RFC PATCH v2 02/11] lib/igt_kms, tests/kms_colorop_helper: Add CSC FF colorop infrastructure
Date: Mon, 30 Mar 2026 11:35:09 -0400	[thread overview]
Message-ID: <20260330153518.99898-3-harry.wentland@amd.com> (raw)
In-Reply-To: <20260330153518.99898-1-harry.wentland@amd.com>

Add support for CSC Fixed-Function colorops:
- Add IGT_COLOROP_CSC_FF_TYPE property to the colorop property enum
  and names array in igt_kms
- Add KMS_COLOROP_CSC_FF type to the test colorop type enum
- Add kms_colorop_csc_ff_info_t struct carrying the DRM enum string
  name plus encoding/range for software reference transforms
- Add can_use_colorop() handling: matches DRM_COLOROP_CSC_FF type and
  verifies the specific CSC_FF_TYPE enum value is supported
- Add set_colorop() handling: sets CSC_FF_TYPE via single enum property
- Define four CSC FF colorop instances: BT.709 limited/full, BT.601
  limited, and BT.2020 limited

Assisted-by: Claude:claude-opus-4-6
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
---
 lib/igt_kms.c              |  1 +
 lib/igt_kms.h              |  1 +
 tests/kms_colorop_helper.c | 45 ++++++++++++++++++++++++++++++++++++++
 tests/kms_colorop_helper.h | 12 +++++++++-
 4 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 57f5e099a313..1defb9a0ef3a 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -716,6 +716,7 @@ const char * const igt_colorop_prop_names[IGT_NUM_COLOROP_PROPS] = {
 	[IGT_COLOROP_MULTIPLIER] = "MULTIPLIER",
 	[IGT_COLOROP_LUT3D_INTERPOLATION] = "LUT3D_INTERPOLATION",
 	[IGT_COLOROP_NEXT] = "NEXT",
+	[IGT_COLOROP_CSC_FF_TYPE] = "CSC_FF_TYPE",
 };
 
 const char * const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 0bb2734ea3d7..2ce6a94cf93f 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -359,6 +359,7 @@ enum igt_atomic_colorop_properties {
 	IGT_COLOROP_MULTIPLIER,
 	IGT_COLOROP_LUT3D_INTERPOLATION,
 	IGT_COLOROP_NEXT,
+	IGT_COLOROP_CSC_FF_TYPE,
 	IGT_NUM_COLOROP_PROPS
 };
 
diff --git a/tests/kms_colorop_helper.c b/tests/kms_colorop_helper.c
index aaee4e567ef6..4832c0f4eb23 100644
--- a/tests/kms_colorop_helper.c
+++ b/tests/kms_colorop_helper.c
@@ -200,6 +200,42 @@ kms_colorop_t kms_colorop_3dlut_17_12_rgb = {
 	.transform = &igt_color_3dlut_17_12_rgb,
 };
 
+kms_colorop_t kms_colorop_csc_bt709_limited = {
+	.type = KMS_COLOROP_CSC_FF,
+	.csc_ff_info = {
+		.csc_ff_type_name = "YUV709 Limited to RGB709",
+	},
+	.name = "CSC BT.709 Limited Range to RGB",
+	.transform = NULL,
+};
+
+kms_colorop_t kms_colorop_csc_bt709_full = {
+	.type = KMS_COLOROP_CSC_FF,
+	.csc_ff_info = {
+		.csc_ff_type_name = "YUV709 to RGB709",
+	},
+	.name = "CSC BT.709 Full Range to RGB",
+	.transform = NULL,
+};
+
+kms_colorop_t kms_colorop_csc_bt601_limited = {
+	.type = KMS_COLOROP_CSC_FF,
+	.csc_ff_info = {
+		.csc_ff_type_name = "YUV601 Limited to RGB601",
+	},
+	.name = "CSC BT.601 Limited Range to RGB",
+	.transform = NULL,
+};
+
+kms_colorop_t kms_colorop_csc_bt2020_limited = {
+	.type = KMS_COLOROP_CSC_FF,
+	.csc_ff_info = {
+		.csc_ff_type_name = "YUV2020 Limited to RGB2020",
+	},
+	.name = "CSC BT.2020 Limited Range to RGB",
+	.transform = NULL,
+};
+
 static bool can_use_colorop(igt_display_t *display, igt_colorop_t *colorop, kms_colorop_t *desired)
 {
 	switch (desired->type) {
@@ -218,6 +254,11 @@ static bool can_use_colorop(igt_display_t *display, igt_colorop_t *colorop, kms_
 		return (igt_colorop_get_prop(display, colorop, IGT_COLOROP_TYPE) == DRM_COLOROP_MULTIPLIER);
 	case KMS_COLOROP_LUT3D:
 		return (igt_colorop_get_prop(display, colorop, IGT_COLOROP_TYPE) == DRM_COLOROP_3D_LUT);
+	case KMS_COLOROP_CSC_FF:
+		if (igt_colorop_get_prop(display, colorop, IGT_COLOROP_TYPE) == DRM_COLOROP_CSC_FF &&
+		    igt_colorop_try_prop_enum(colorop, IGT_COLOROP_CSC_FF_TYPE, desired->csc_ff_info.csc_ff_type_name))
+			return true;
+		return false;
 	default:
 		return false;
 	}
@@ -362,6 +403,10 @@ static void set_colorop(igt_display_t *display, kms_colorop_t *colorop)
 
 		configure_3dlut(display, colorop, lut_size);
 		break;
+	case KMS_COLOROP_CSC_FF:
+		igt_colorop_set_prop_enum(colorop->colorop, IGT_COLOROP_CSC_FF_TYPE,
+					  colorop->csc_ff_info.csc_ff_type_name);
+		break;
 	default:
 		igt_fail(IGT_EXIT_FAILURE);
 	}
diff --git a/tests/kms_colorop_helper.h b/tests/kms_colorop_helper.h
index a081fa02db8e..6e8843b7b651 100644
--- a/tests/kms_colorop_helper.h
+++ b/tests/kms_colorop_helper.h
@@ -22,7 +22,8 @@ typedef enum kms_colorop_type {
 	KMS_COLOROP_CUSTOM_LUT1D,
 	KMS_COLOROP_CTM_3X4,
 	KMS_COLOROP_MULTIPLIER,
-	KMS_COLOROP_LUT3D
+	KMS_COLOROP_LUT3D,
+	KMS_COLOROP_CSC_FF
 } kms_colorop_type_t;
 
 typedef enum kms_colorop_lut1d_tf {
@@ -50,8 +51,13 @@ typedef struct kms_colorop_lut3d_info {
 	enum drm_colorop_lut3d_interpolation_type interpolation;
 } kms_colorop_lut3d_info_t;
 
+typedef struct kms_colorop_csc_ff_info {
+	const char *csc_ff_type_name;
+} kms_colorop_csc_ff_info_t;
+
 typedef struct kms_colorop {
 	kms_colorop_type_t type;
+	kms_colorop_csc_ff_info_t csc_ff_info;
 
 	union {
 		kms_colorop_enumerated_lut1d_info_t enumerated_lut1d_info;
@@ -94,6 +100,10 @@ extern kms_colorop_t kms_colorop_ctm_3x4_bt709_dec;
 extern kms_colorop_t kms_colorop_multiply_125;
 extern kms_colorop_t kms_colorop_multiply_inv_125;
 extern kms_colorop_t kms_colorop_3dlut_17_12_rgb;
+extern kms_colorop_t kms_colorop_csc_bt709_limited;
+extern kms_colorop_t kms_colorop_csc_bt709_full;
+extern kms_colorop_t kms_colorop_csc_bt601_limited;
+extern kms_colorop_t kms_colorop_csc_bt2020_limited;
 
 igt_colorop_t *get_color_pipeline(igt_display_t *display,
 			          igt_plane_t *plane,
-- 
2.53.0


  parent reply	other threads:[~2026-03-30 15:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30 15:35 [RFC PATCH v2 00/11] YUV Conversion Colorop tests Harry Wentland
2026-03-30 15:35 ` [RFC PATCH v2 01/11] include/drm-uapi: Add DRM_COLOROP_CSC_FF and drm_colorop_csc_ff_type Harry Wentland
2026-03-30 15:35 ` Harry Wentland [this message]
2026-03-30 15:35 ` [RFC PATCH v2 03/11] tests/kms_colorop_helper: Add helpers to get encoding/range from CSC FF name Harry Wentland
2026-03-30 15:35 ` [RFC PATCH v2 04/11] lib/igt_fb: Add YUV color pattern framebuffer support Harry Wentland
2026-03-30 15:35 ` [RFC PATCH v2 05/11] lib/igt_color_encoding: Add XRGB2101010 format support Harry Wentland
2026-03-30 15:35 ` [RFC PATCH v2 06/11] lib/igt_color: Add YUV pixel reading support Harry Wentland
2026-03-30 15:35 ` [RFC PATCH v2 07/11] lib/igt_color: Refactor transform_pixels for input/output FBs and CSC Harry Wentland
2026-03-30 15:35 ` [RFC PATCH v2 08/11] tests/kms_colorop: Add CSC FF colorop tests Harry Wentland
2026-03-30 15:35 ` [RFC PATCH v2 09/11] tests/kms_colorop: Keep CRTC active between YUV tests with temp FB Harry Wentland
2026-03-30 15:35 ` [RFC PATCH v2 10/11] tests/kms_colorop: Add bypass transition tests Harry Wentland
2026-03-30 15:35 ` [RFC PATCH v2 11/11] tests/kms_colorop: Increase VKMS bracket to 3 up Harry Wentland
2026-03-31  3:38 ` ✓ Xe.CI.BAT: success for YUV Conversion Colorop tests Patchwork
2026-03-31  3:57 ` ✓ i915.CI.BAT: " Patchwork
2026-03-31 13:21 ` ✓ i915.CI.Full: " Patchwork

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=20260330153518.99898-3-harry.wentland@amd.com \
    --to=harry.wentland@amd.com \
    --cc=igt-dev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox