From: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
To: Swati Sharma <swati2.sharma@intel.com>, <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t 6/6] tests/kms_chamelium_color_pipeline: Add FIXED_MATRIX colorop tests
Date: Thu, 13 Aug 2026 19:30:45 +0530 [thread overview]
Message-ID: <8cddfa89-58d6-4a96-87f2-6acd3b5b0c75@intel.com> (raw)
In-Reply-To: <20260806120345.19406-7-swati2.sharma@intel.com>
On 8/6/2026 5:33 PM, Swati Sharma wrote:
> Add Chamelium frame-capture equivalents of the FIXED_MATRIX colorop
> tests from kms_color_pipeline. Unlike the pipe-CRC variant, these
> validate the output using chamelium_frame_match_or_dump() with analog
> frame comparison, whose tolerance accommodates the small differences
> between the software color model and the hardware fixed-point matrix
> that a bit-exact pipe CRC cannot.
>
> The SW reference framebuffer is computed by converting the YUV input
> through igt_fb_convert(), which internally applies igt_ycbcr_to_rgb_matrix(),
> matching the reference computation used in the pipe-CRC variant.
>
> New subtests:
> - plane-fixed-matrix-yuv-rgb-bt601
> - plane-fixed-matrix-yuv-rgb-bt709
> - plane-fixed-matrix-yuv-rgb-bt2020
> - plane-fixed-matrix-yuv-rgb-bt601-lim
> - plane-fixed-matrix-yuv-rgb-bt709-lim
> - plane-fixed-matrix-yuv-rgb-bt2020-lim
> - plane-fixed-matrix-yuv-rgb-bt601-lut1d
> - plane-fixed-matrix-yuv-rgb-bt709-lut1d
> - plane-fixed-matrix-yuv-rgb-bt2020-lut1d
> - plane-fixed-matrix-yuv-rgb-bt601-lim-lut1d
> - plane-fixed-matrix-yuv-rgb-bt709-lim-lut1d
> - plane-fixed-matrix-yuv-rgb-bt2020-lim-lut1d
>
> v2: -Naming changes (CSC_FF -> FIXED_MATRIX)
> v3: -Drop YCbCr limited to full and RGB709 to RGB2020 matrices
> until we have non-IGT userspace that shows their use
> -Rename subtests to yuv-rgb-btXXX with limited range variants
>
> Assisted-by: Claude Opus 4.6
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> ---
> .../chamelium/kms_chamelium_color_pipeline.c | 307 ++++++++++++++++++
> 1 file changed, 307 insertions(+)
>
> diff --git a/tests/chamelium/kms_chamelium_color_pipeline.c b/tests/chamelium/kms_chamelium_color_pipeline.c
> index db6107221..63c5a3a3c 100644
> --- a/tests/chamelium/kms_chamelium_color_pipeline.c
> +++ b/tests/chamelium/kms_chamelium_color_pipeline.c
> @@ -34,6 +34,26 @@
> * @lut3d-green-only: 3D LUT
> */
>
> +/**
> + * SUBTEST: plane-fixed-matrix-%s
> + * Description: Test FIXED_MATRIX colorop for color space conversion: %arg[1].
> + *
> + * arg[1]:
> + *
> + * @yuv-rgb-bt601: YUV BT.601 full range to RGB BT.601
> + * @yuv-rgb-bt709: YUV BT.709 full range to RGB BT.709
> + * @yuv-rgb-bt2020: YUV BT.2020 full range to RGB BT.2020
> + * @yuv-rgb-bt601-lim: YUV BT.601 limited range to RGB BT.601
> + * @yuv-rgb-bt709-lim: YUV BT.709 limited range to RGB BT.709
> + * @yuv-rgb-bt2020-lim: YUV BT.2020 limited range to RGB BT.2020
> + * @yuv-rgb-bt601-lut1d: YUV BT.601 full range to RGB BT.601, then 1D LUT
> + * @yuv-rgb-bt709-lut1d: YUV BT.709 full range to RGB BT.709, then 1D LUT
> + * @yuv-rgb-bt2020-lut1d: YUV BT.2020 full range to RGB BT.2020, then 1D LUT
> + * @yuv-rgb-bt601-lim-lut1d: YUV BT.601 limited range to RGB BT.601, then 1D LUT
> + * @yuv-rgb-bt709-lim-lut1d: YUV BT.709 limited range to RGB BT.709, then 1D LUT
> + * @yuv-rgb-bt2020-lim-lut1d: YUV BT.2020 limited range to RGB BT.2020, then 1D LUT
> + */
> +
> IGT_TEST_DESCRIPTION("Test to validate DRM plane color pipeline using Chamelium frame capture instead of pipe CRC");
>
> static void test_cleanup(data_t *data)
> @@ -345,6 +365,290 @@ run_tests_for_plane(data_t *data)
> }
> }
>
> +static void
> +_test_plane_fixed_matrix_colorops(data_t *data,
> + igt_plane_t *plane,
> + const color_t *fb_colors,
> + kms_colorop_t *colorops[],
> + uint32_t input_format,
> + enum igt_color_encoding encoding,
> + enum igt_color_range range,
> + struct chamelium_port *port)
> +{
> + igt_display_t *display = &data->display;
> + drmModeModeInfo *mode = data->mode;
> + igt_colorop_t *color_pipeline;
> + struct igt_fb fb, fbref;
> + struct chamelium_frame_dump *frame;
> + bool ret;
> +
> + color_pipeline = get_color_pipeline(display, plane, colorops);
> + igt_skip_on(!color_pipeline);
> +
> + /* Create HW input framebuffer (YUV or RGB) */
> + igt_assert(igt_create_fb_with_bo_size(data->drm_fd,
> + mode->hdisplay,
> + mode->vdisplay,
> + input_format,
> + DRM_FORMAT_MOD_LINEAR,
> + encoding, range,
> + &fb, 0, 0));
> +
> + /* Paint the input fb with test colors */
> + paint_rectangles(data, mode, fb_colors, &fb);
> +
> + /*
> + * Software reference: convert the input fb through igt_fb_convert()
> + * which internally applies igt_ycbcr_to_rgb_matrix(). This matches
> + * what the HW FIXED_MATRIX colorop should produce.
> + * Chamelium analog comparison tolerates HW vs SW rounding differences.
> + */
> + igt_fb_convert(&fbref, &fb, DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR);
Can we re-use the pattern of collecting SW reference just once per pipe?
> +
> + /* Hardware path */
> + set_color_pipeline(display, plane, colorops, color_pipeline);
> +
> + igt_plane_set_fb(plane, &fb);
> + igt_display_commit_atomic(&data->display, 0, NULL);
> +
> + chamelium_port_wait_video_input_stable(data->chamelium, port, 5);
> + chamelium_capture(data->chamelium, port, 0, 0, 0, 0, 1);
> +
> + frame = chamelium_read_captured_frame(data->chamelium, 0);
> +
> + ret = chamelium_frame_match_or_dump(data->chamelium, port, frame,
> + &fbref, CHAMELIUM_CHECK_ANALOG);
> + igt_assert(ret);
> +
assert is a problem here too. In here it will also lead to the frame
dump leaking.
> + chamelium_destroy_frame_dump(frame);
> +
> + /* Cleanup */
> + set_color_pipeline_bypass(plane);
> + reset_colorops(colorops);
> + igt_plane_set_fb(plane, NULL);
> + igt_display_commit_atomic(&data->display, 0, NULL);
> +
> + igt_remove_fb(data->drm_fd, &fb);
> + igt_remove_fb(data->drm_fd, &fbref);
> +}
> +
> +static void
> +test_plane_fixed_matrix_colorops(data_t *data, igt_crtc_t *crtc,
> + const color_t *fb_colors,
> + kms_colorop_t *colorops[],
> + uint32_t input_format,
> + enum igt_color_encoding encoding,
> + enum igt_color_range range,
> + int port_idx)
> +{
> + int n_planes = crtc->n_planes;
> + igt_output_t *output = data->output;
> + igt_plane_t *plane;
> +
> + for (int plane_id = 0; plane_id < n_planes; plane_id++) {
> + plane = igt_output_get_plane(output, plane_id);
> +
> + if (!igt_plane_has_prop(plane, IGT_PLANE_COLOR_PIPELINE))
> + continue;
> +
> + igt_dynamic_f("pipe-%s-plane-%u", kmstest_pipe_name(crtc->pipe), plane_id)
> + _test_plane_fixed_matrix_colorops(data, plane,
> + fb_colors,
> + colorops, input_format,
> + encoding, range,
> + data->ports[port_idx]);
> + }
> +}
> +
> +static void
> +run_tests_for_fixed_matrix(data_t *data)
> +{
> + igt_crtc_t *crtc;
> + igt_output_t *output = NULL;
> + int port_idx = 0;
> + static const color_t colors_rgb[] = {
> + { 1.0, 0.0, 0.0 },
> + { 0.0, 1.0, 0.0 },
> + { 0.0, 0.0, 1.0 },
> + };
> + kms_colorop_t lut1d_linear = {
> + .type = KMS_COLOROP_CUSTOM_LUT1D,
> + .name = "1D LUT (linear)",
> + .lut1d = &igt_1dlut_linear,
> + .transform = &igt_color_linear,
> + };
> + kms_colorop_t fixed_matrix_yuv601_rgb601 = {
> + .type = KMS_COLOROP_FIXED_MATRIX,
> + .name = "FIXED_MATRIX YUV601 to RGB601",
> + .fixed_matrix_info = { .fixed_matrix = KMS_COLOROP_FIXED_MATRIX_YCBCR601_FULL_RGB },
> + };
> + kms_colorop_t fixed_matrix_yuv709_rgb709 = {
> + .type = KMS_COLOROP_FIXED_MATRIX,
> + .name = "FIXED_MATRIX YUV709 to RGB709",
> + .fixed_matrix_info = { .fixed_matrix = KMS_COLOROP_FIXED_MATRIX_YCBCR709_FULL_RGB },
> + };
> + kms_colorop_t fixed_matrix_yuv2020_rgb2020 = {
> + .type = KMS_COLOROP_FIXED_MATRIX,
> + .name = "FIXED_MATRIX YUV2020 to RGB2020",
> + .fixed_matrix_info = { .fixed_matrix = KMS_COLOROP_FIXED_MATRIX_YCBCR2020_NC_FULL_RGB },
> + };
> + kms_colorop_t fixed_matrix_yuv601_rgb601_lim = {
> + .type = KMS_COLOROP_FIXED_MATRIX,
> + .name = "FIXED_MATRIX YUV601 limited to RGB601",
> + .fixed_matrix_info = { .fixed_matrix = KMS_COLOROP_FIXED_MATRIX_YCBCR601_LIMITED_RGB },
> + };
> + kms_colorop_t fixed_matrix_yuv709_rgb709_lim = {
> + .type = KMS_COLOROP_FIXED_MATRIX,
> + .name = "FIXED_MATRIX YUV709 limited to RGB709",
> + .fixed_matrix_info = { .fixed_matrix = KMS_COLOROP_FIXED_MATRIX_YCBCR709_LIMITED_RGB },
> + };
> + kms_colorop_t fixed_matrix_yuv2020_rgb2020_lim = {
> + .type = KMS_COLOROP_FIXED_MATRIX,
> + .name = "FIXED_MATRIX YUV2020 limited to RGB2020",
> + .fixed_matrix_info = { .fixed_matrix = KMS_COLOROP_FIXED_MATRIX_YCBCR2020_NC_LIMITED_RGB },
> + };
> +
> + struct {
> + const char *name;
> + const char *subtest_prefix;
> + const color_t *fb_colors;
> + kms_colorop_t *colorops[MAX_COLOROPS];
> + uint32_t input_format;
> + enum igt_color_encoding encoding;
> + enum igt_color_range range;
> + } fixed_matrix_tests[] = {
> + { .name = "yuv-rgb-bt601",
> + .subtest_prefix = "plane-fixed-matrix",
> + .fb_colors = colors_rgb,
> + .colorops = { &fixed_matrix_yuv601_rgb601, NULL },
> + .input_format = DRM_FORMAT_YUYV,
> + .encoding = IGT_COLOR_YCBCR_BT601,
> + .range = IGT_COLOR_YCBCR_FULL_RANGE,
> + },
> + { .name = "yuv-rgb-bt709",
> + .subtest_prefix = "plane-fixed-matrix",
> + .fb_colors = colors_rgb,
> + .colorops = { &fixed_matrix_yuv709_rgb709, NULL },
> + .input_format = DRM_FORMAT_YUYV,
> + .encoding = IGT_COLOR_YCBCR_BT709,
> + .range = IGT_COLOR_YCBCR_FULL_RANGE,
> + },
> + { .name = "yuv-rgb-bt2020",
> + .subtest_prefix = "plane-fixed-matrix",
> + .fb_colors = colors_rgb,
> + .colorops = { &fixed_matrix_yuv2020_rgb2020, NULL },
> + .input_format = DRM_FORMAT_YUYV,
> + .encoding = IGT_COLOR_YCBCR_BT2020,
> + .range = IGT_COLOR_YCBCR_FULL_RANGE,
> + },
> + { .name = "yuv-rgb-bt601-lim",
> + .subtest_prefix = "plane-fixed-matrix",
> + .fb_colors = colors_rgb,
> + .colorops = { &fixed_matrix_yuv601_rgb601_lim, NULL },
> + .input_format = DRM_FORMAT_YUYV,
> + .encoding = IGT_COLOR_YCBCR_BT601,
> + .range = IGT_COLOR_YCBCR_LIMITED_RANGE,
> + },
> + { .name = "yuv-rgb-bt709-lim",
> + .subtest_prefix = "plane-fixed-matrix",
> + .fb_colors = colors_rgb,
> + .colorops = { &fixed_matrix_yuv709_rgb709_lim, NULL },
> + .input_format = DRM_FORMAT_YUYV,
> + .encoding = IGT_COLOR_YCBCR_BT709,
> + .range = IGT_COLOR_YCBCR_LIMITED_RANGE,
> + },
> + { .name = "yuv-rgb-bt2020-lim",
> + .subtest_prefix = "plane-fixed-matrix",
> + .fb_colors = colors_rgb,
> + .colorops = { &fixed_matrix_yuv2020_rgb2020_lim, NULL },
> + .input_format = DRM_FORMAT_YUYV,
> + .encoding = IGT_COLOR_YCBCR_BT2020,
> + .range = IGT_COLOR_YCBCR_LIMITED_RANGE,
> + },
> + { .name = "yuv-rgb-bt601-lut1d",
> + .subtest_prefix = "plane-fixed-matrix",
> + .fb_colors = colors_rgb,
> + .colorops = { &fixed_matrix_yuv601_rgb601, &lut1d_linear, NULL },
> + .input_format = DRM_FORMAT_YUYV,
> + .encoding = IGT_COLOR_YCBCR_BT601,
> + .range = IGT_COLOR_YCBCR_FULL_RANGE,
> + },
> + { .name = "yuv-rgb-bt709-lut1d",
> + .subtest_prefix = "plane-fixed-matrix",
> + .fb_colors = colors_rgb,
> + .colorops = { &fixed_matrix_yuv709_rgb709, &lut1d_linear, NULL },
> + .input_format = DRM_FORMAT_YUYV,
> + .encoding = IGT_COLOR_YCBCR_BT709,
> + .range = IGT_COLOR_YCBCR_FULL_RANGE,
> + },
> + { .name = "yuv-rgb-bt2020-lut1d",
> + .subtest_prefix = "plane-fixed-matrix",
> + .fb_colors = colors_rgb,
> + .colorops = { &fixed_matrix_yuv2020_rgb2020, &lut1d_linear, NULL },
> + .input_format = DRM_FORMAT_YUYV,
> + .encoding = IGT_COLOR_YCBCR_BT2020,
> + .range = IGT_COLOR_YCBCR_FULL_RANGE,
> + },
> + { .name = "yuv-rgb-bt601-lim-lut1d",
> + .subtest_prefix = "plane-fixed-matrix",
> + .fb_colors = colors_rgb,
> + .colorops = { &fixed_matrix_yuv601_rgb601_lim, &lut1d_linear, NULL },
> + .input_format = DRM_FORMAT_YUYV,
> + .encoding = IGT_COLOR_YCBCR_BT601,
> + .range = IGT_COLOR_YCBCR_LIMITED_RANGE,
> + },
> + { .name = "yuv-rgb-bt709-lim-lut1d",
> + .subtest_prefix = "plane-fixed-matrix",
> + .fb_colors = colors_rgb,
> + .colorops = { &fixed_matrix_yuv709_rgb709_lim, &lut1d_linear, NULL },
> + .input_format = DRM_FORMAT_YUYV,
> + .encoding = IGT_COLOR_YCBCR_BT709,
> + .range = IGT_COLOR_YCBCR_LIMITED_RANGE,
> + },
> + { .name = "yuv-rgb-bt2020-lim-lut1d",
> + .subtest_prefix = "plane-fixed-matrix",
> + .fb_colors = colors_rgb,
> + .colorops = { &fixed_matrix_yuv2020_rgb2020_lim, &lut1d_linear, NULL },
> + .input_format = DRM_FORMAT_YUYV,
> + .encoding = IGT_COLOR_YCBCR_BT2020,
> + .range = IGT_COLOR_YCBCR_LIMITED_RANGE,
> + },
> + };
> +
> + for (int i = 0; i < ARRAY_SIZE(fixed_matrix_tests); i++) {
> + igt_describe_f("Test FIXED_MATRIX pipeline: %s-%s",
> + fixed_matrix_tests[i].subtest_prefix,
> + fixed_matrix_tests[i].name);
> + igt_subtest_with_dynamic_f("%s-%s",
> + fixed_matrix_tests[i].subtest_prefix,
> + fixed_matrix_tests[i].name) {
> + for_each_crtc_with_single_output(&data->display, crtc,
> + output) {
> + data->output = output;
> +
> + if (!crtc_output_combo_valid(data, crtc))
> + continue;
> +
> + port_idx = test_setup(data, crtc);
> + if (port_idx < 0) {
> + test_cleanup(data);
> + continue;
> + }
> +
> + test_plane_fixed_matrix_colorops(data, crtc,
> + fixed_matrix_tests[i].fb_colors,
> + fixed_matrix_tests[i].colorops,
> + fixed_matrix_tests[i].input_format,
> + fixed_matrix_tests[i].encoding,
> + fixed_matrix_tests[i].range,
> + port_idx);
> +
> + test_cleanup(data);
> + }
> + }
> + }
> +}
> +
> int igt_main()
> {
> int i;
> @@ -404,6 +708,9 @@ int igt_main()
> igt_subtest_group()
> run_tests_for_plane(&data);
>
> + igt_subtest_group()
> + run_tests_for_fixed_matrix(&data);
> +
> igt_fixture() {
> igt_display_fini(&data.display);
> drm_close_driver(data.drm_fd);
next prev parent reply other threads:[~2026-08-13 14:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 12:03 [PATCH i-g-t v3 0/6] Add FIXED_MATRIX colorop tests Swati Sharma
2026-08-06 12:03 ` [PATCH i-g-t 1/6] include/drm-uapi: Add DRM_COLOROP_FIXED_MATRIX definition Swati Sharma
2026-08-13 13:57 ` Borah, Chaitanya Kumar
2026-08-06 12:03 ` [PATCH i-g-t 2/6] lib/igt_kms: Add FIXED_MATRIX_TYPE colorop property Swati Sharma
2026-08-13 13:57 ` Borah, Chaitanya Kumar
2026-08-06 12:03 ` [PATCH i-g-t 3/6] tests/kms_colorop_helper: Add FIXED_MATRIX colorop support Swati Sharma
2026-08-13 13:58 ` Borah, Chaitanya Kumar
2026-08-06 12:03 ` [PATCH i-g-t 4/6] tests/kms_color_pipeline: Add FIXED_MATRIX colorop tests Swati Sharma
2026-08-13 14:00 ` Borah, Chaitanya Kumar
2026-08-06 12:03 ` [PATCH i-g-t 5/6] tests/kms_color_pipeline: Remove unused color_depth and drm_format Swati Sharma
2026-08-13 14:00 ` Borah, Chaitanya Kumar
2026-08-06 12:03 ` [PATCH i-g-t 6/6] tests/kms_chamelium_color_pipeline: Add FIXED_MATRIX colorop tests Swati Sharma
2026-08-06 15:02 ` Jani Nikula
2026-08-13 14:00 ` Borah, Chaitanya Kumar [this message]
2026-08-07 0:28 ` ✓ Xe.CI.BAT: success for Add FIXED_MATRIX colorop tests (rev3) Patchwork
2026-08-07 0:30 ` ✓ i915.CI.BAT: " Patchwork
2026-08-07 8:57 ` ✗ i915.CI.Full: failure " Patchwork
2026-08-07 14:19 ` ✓ Xe.CI.FULL: success " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2026-07-27 18:55 [PATCH i-g-t 0/6] Add FIXED_MATRIX colorop tests Swati Sharma
2026-07-27 18:55 ` [PATCH i-g-t 6/6] tests/kms_chamelium_color_pipeline: " Swati Sharma
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=8cddfa89-58d6-4a96-87f2-6acd3b5b0c75@intel.com \
--to=chaitanya.kumar.borah@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=swati2.sharma@intel.com \
/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.