Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Hung <alex.hung@amd.com>
To: Harry Wentland <harry.wentland@amd.com>, igt-dev@lists.freedesktop.org
Subject: Re: [PATCH v3 04/12] tests/kms_colorop_helper: Add helpers to get encoding/range from FIXED_MATRIX name
Date: Sat, 25 Jul 2026 01:04:10 -0600	[thread overview]
Message-ID: <bd708653-c058-4b1f-a67f-d457b5166796@amd.com> (raw)
In-Reply-To: <20260623175737.171142-5-harry.wentland@amd.com>



On 6/23/26 11:57, Harry Wentland wrote:
> Add fixed_matrix_type_to_encoding_range() to map a FIXED_MATRIX colorop's
> DRM enum string name (e.g. "YCbCr 709 Limited to RGB") to the matching
> igt_color_encoding and igt_color_range. This lets the tests derive the
> encoding/range needed for the software reference CSC directly from the
> colorop the hardware advertises.
> 
> Assisted-by: Claude:claude-opus-4-6
> Signed-off-by: Harry Wentland <harry.wentland@amd.com>
> ---
>   tests/kms_colorop_helper.c | 30 ++++++++++++++++++++++++++++++
>   tests/kms_colorop_helper.h |  4 ++++
>   2 files changed, 34 insertions(+)
> 
> diff --git a/tests/kms_colorop_helper.c b/tests/kms_colorop_helper.c
> index d12584c9adb1..e589fa5c99a9 100644
> --- a/tests/kms_colorop_helper.c
> +++ b/tests/kms_colorop_helper.c
> @@ -473,3 +473,33 @@ void reset_colorops(kms_colorop_t *colorops[])
>   	for(i = 0; colorops[i]; i++)
>   		reset_colorop(colorops[i]);
>   }
> +
> +static const struct {
> +	const char *name;
> +	enum igt_color_encoding encoding;
> +	enum igt_color_range range;
> +} fixed_matrix_type_map[] = {
> +	{ "YCbCr 601 Full to RGB",		IGT_COLOR_YCBCR_BT601,  IGT_COLOR_YCBCR_FULL_RANGE },
> +	{ "YCbCr 709 Full to RGB",		IGT_COLOR_YCBCR_BT709,  IGT_COLOR_YCBCR_FULL_RANGE },
> +	{ "YCbCr 2020 Full to RGB NC",	IGT_COLOR_YCBCR_BT2020, IGT_COLOR_YCBCR_FULL_RANGE },
> +	{ "YCbCr 601 Limited to RGB",	IGT_COLOR_YCBCR_BT601,  IGT_COLOR_YCBCR_LIMITED_RANGE },
> +	{ "YCbCr 709 Limited to RGB",	IGT_COLOR_YCBCR_BT709,  IGT_COLOR_YCBCR_LIMITED_RANGE },
> +	{ "YCbCr 2020 Limited to RGB NC",	IGT_COLOR_YCBCR_BT2020, IGT_COLOR_YCBCR_LIMITED_RANGE },
> +};
> +
> +void fixed_matrix_type_to_encoding_range(const char *fixed_matrix_type_name,
> +				   enum igt_color_encoding *encoding,
> +				   enum igt_color_range *range)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(fixed_matrix_type_map); i++) {
> +		if (!strcmp(fixed_matrix_type_name, fixed_matrix_type_map[i].name)) {
> +			*encoding = fixed_matrix_type_map[i].encoding;
> +			*range = fixed_matrix_type_map[i].range;
> +			return;
> +		}
> +	}
> +
> +	igt_assert_f(false, "Unknown Fixed Matrix type: %s\n", fixed_matrix_type_name);
> +}

Can "igt_color_encoding encoding" and "igt_color_range range" be 
included in kms_colorop_fixed_matrix_info_t like below?

typedef struct kms_colorop_fixed_matrix_info {
	const char *fixed_matrix_type_name;
+	enum igt_color_encoding encoding;
+	enum igt_color_range range;
} kms_colorop_fixed_matrix_info_t;


and

kms_colorop_t kms_colorop_bt709_full_ycbcr_to_rgb = {
	.type = KMS_COLOROP_FIXED_MATRIX,
	.fixed_matrix_info = {
		.fixed_matrix_type_name = "YCbCr 709 Full to RGB",
+		.encoding = IGT_COLOR_YCBCR_BT709,
+		.range = IGT_COLOR_YCBCR_FULL_RANGE,

	},
	.name = "YCbCr BT.709 Full Range to RGB",
	.transform = NULL,
};

then we don't need fixed_matrix_type_to_encoding_range()

> diff --git a/tests/kms_colorop_helper.h b/tests/kms_colorop_helper.h
> index 68ae1dd05c6f..539067b5a494 100644
> --- a/tests/kms_colorop_helper.h
> +++ b/tests/kms_colorop_helper.h
> @@ -115,4 +115,8 @@ void set_color_pipeline(igt_display_t *display,
>   void set_color_pipeline_bypass(igt_plane_t *plane);
>   void reset_colorops(kms_colorop_t *colorops[]);
>   
> +void fixed_matrix_type_to_encoding_range(const char *fixed_matrix_type_name,
> +				  enum igt_color_encoding *encoding,
> +				  enum igt_color_range *range);
> +
>   #endif /* __KMS_COLOROP_HELPER_H__ */


  reply	other threads:[~2026-07-25  7:04 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23 17:57 [PATCH v3 00/12] YUV Conversion Colorop tests Harry Wentland
2026-06-23 17:57 ` [PATCH v3 01/12] include/drm-uapi: Add DRM_COLOROP_FIXED_MATRIX Harry Wentland
2026-07-25  6:52   ` Alex Hung
2026-06-23 17:57 ` [PATCH v3 02/12] lib/igt_kms: Add IGT_COLOROP_FIXED_MATRIX property Harry Wentland
2026-07-25  6:56   ` Alex Hung
2026-06-23 17:57 ` [PATCH v3 03/12] tests/kms_colorop_helper: Add Fixed Matrix colorop infrastructure Harry Wentland
2026-07-25  6:56   ` Alex Hung
2026-06-23 17:57 ` [PATCH v3 04/12] tests/kms_colorop_helper: Add helpers to get encoding/range from FIXED_MATRIX name Harry Wentland
2026-07-25  7:04   ` Alex Hung [this message]
2026-06-23 17:57 ` [PATCH v3 05/12] lib/igt_fb: Add YUV color pattern framebuffer support Harry Wentland
2026-07-25  7:05   ` Alex Hung
2026-06-23 17:57 ` [PATCH v3 06/12] lib/igt_color_encoding: Add XRGB2101010 format support Harry Wentland
2026-07-25  7:05   ` Alex Hung
2026-06-23 17:57 ` [PATCH v3 07/12] lib/igt_color: Add YUV pixel reading support Harry Wentland
2026-07-25  7:10   ` Alex Hung
2026-06-23 17:57 ` [PATCH v3 08/12] lib/igt_color: Refactor transform_pixels for input/output FBs and CSC Harry Wentland
2026-06-23 17:57 ` [PATCH v3 09/12] tests/kms_colorop: Add FIXED_MATRIX colorop tests Harry Wentland
2026-07-25  7:15   ` Alex Hung
2026-06-23 17:57 ` [PATCH v3 10/12] tests/kms_colorop: Keep CRTC active between YUV tests with temp FB Harry Wentland
2026-07-25  7:19   ` Alex Hung
2026-06-23 17:57 ` [PATCH v3 11/12] tests/kms_colorop: Add bypass transition tests Harry Wentland
2026-07-25  7:25   ` Alex Hung
2026-06-23 17:57 ` [PATCH v3 12/12] tests/kms_colorop: Increase VKMS bracket to 3 up Harry Wentland
2026-07-25  7:24   ` Alex Hung
2026-06-23 18:55 ` ✓ Xe.CI.BAT: success for YUV Conversion Colorop tests (rev2) Patchwork
2026-06-23 19:19 ` ✓ i915.CI.BAT: " Patchwork
2026-06-24  1:27 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-06-24  5:44 ` ✗ 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=bd708653-c058-4b1f-a67f-d457b5166796@amd.com \
    --to=alex.hung@amd.com \
    --cc=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