public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: swati2.sharma@intel.com, chaitanya.kumar.borah@intel.com
Subject: [PATCH i-g-t v2 4/4] tests/kms_color_pipeline: collect reference CRC once per pipe
Date: Thu, 19 Feb 2026 14:35:45 +0530	[thread overview]
Message-ID: <20260219090545.340383-4-chaitanya.kumar.borah@intel.com> (raw)
In-Reply-To: <20260219090545.340383-1-chaitanya.kumar.borah@intel.com>

The reference (software-equivalent) CRC is being recomputed
for every plane even though it is identical across planes for
a given test configuration. Refactor the test to collect the
reference CRC once per pipe and reuse it for all planes.

v2:
 - Rebase
 - s/test_grab_crc/capture_ref_crc (Swati)
 - Use DRM_PLANE_TYPE_PRIMARY (Swati)
 - s/igt_skip_on/igt_assert/ (Swati)
 - Add a comment explaining why CRC capture on the
   primary plane is sufficient (Swati)
 - Wait for vblank before CRC collection (Swati)
 - s/reference_crc/ref_crc (Swati)

Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
---
 tests/kms_color_pipeline.c | 66 +++++++++++++++++++++++++++++---------
 1 file changed, 50 insertions(+), 16 deletions(-)

diff --git a/tests/kms_color_pipeline.c b/tests/kms_color_pipeline.c
index 4ba4ea605..7da78b2a5 100644
--- a/tests/kms_color_pipeline.c
+++ b/tests/kms_color_pipeline.c
@@ -87,16 +87,58 @@ static bool ctm_colorop_only(kms_colorop_t *colorops[])
 	return true;
 }
 
+static void
+capture_ref_crc(data_t *data, igt_output_t *output,
+		const color_t *fb_color, igt_crc_t *crc /* out */)
+{
+	struct igt_fb fb;
+	drmModeModeInfo *mode;
+	igt_plane_t *primary;
+	char *crc_str;
+	int ret;
+
+	/*
+	 * Since CRC is collected at Pipe level,
+	 * collecting crc for primary plane
+	 * is enough for reference.
+	 */
+	primary = igt_output_get_plane(output, DRM_PLANE_TYPE_PRIMARY);
+
+	mode = igt_output_get_mode(output);
+	igt_assert_fd(igt_create_fb(data->drm_fd,
+				    mode->hdisplay, mode->vdisplay,
+				    DRM_FORMAT_XRGB8888,
+				    DRM_FORMAT_MOD_LINEAR,
+				    &fb));
+
+	paint_rectangles(data, mode, fb_color, &fb);
+	igt_plane_set_fb(primary, &fb);
+	ret = igt_display_try_commit_atomic(&data->display, 0, NULL);
+	igt_assert(!ret);
+
+	igt_wait_for_vblank(primary->crtc);
+	igt_pipe_crc_collect_crc(data->pipe_crc, crc);
+
+	igt_plane_set_fb(primary, NULL);
+	igt_display_commit_atomic(&data->display, 0, NULL);
+
+	igt_remove_fb(data->drm_fd, &fb);
+
+	crc_str = igt_crc_to_string(crc);
+	igt_debug("CRC for reference fb: %s\n", crc_str);
+	free(crc_str);
+}
+
 static void _test_plane_colorops(data_t *data,
 				 igt_plane_t *plane,
 				 const color_t *fb_colors,
-				 const color_t *exp_colors,
+				 igt_crc_t *crc_ref,
 				 kms_colorop_t *colorops[])
 {
 	igt_display_t *display = &data->display;
 	drmModeModeInfo *mode = data->mode;
 	igt_colorop_t *color_pipeline;
-	igt_crc_t crc_ref, crc_pipe;
+	igt_crc_t crc_pipe;
 	struct igt_fb fb;
 
 	color_pipeline = get_color_pipeline(display, plane, colorops);
@@ -109,18 +151,6 @@ static void _test_plane_colorops(data_t *data,
 				 DRM_FORMAT_XRGB8888,
 				 DRM_FORMAT_MOD_LINEAR,
 				 &fb));
-	igt_plane_set_fb(plane, &fb);
-
-	igt_display_commit_atomic(&data->display, 0, NULL);
-
-	/* Reference (software-equivalent) CRC */
-	set_color_pipeline_bypass(plane);
-	paint_rectangles(data, mode, exp_colors, &fb);
-
-	igt_plane_set_fb(plane, &fb);
-	igt_display_commit_atomic(&data->display, 0, NULL);
-	igt_wait_for_vblank(plane->crtc);
-	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_ref);
 
 	/* Hardware pipeline CRC */
 	set_color_pipeline(display, plane, colorops, color_pipeline);
@@ -138,7 +168,7 @@ static void _test_plane_colorops(data_t *data,
 	igt_wait_for_vblank(plane->crtc);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_pipe);
 
-	igt_assert_crc_equal(&crc_ref, &crc_pipe);
+	igt_assert_crc_equal(crc_ref, &crc_pipe);
 
 	/* Cleanup per-test state */
 	set_color_pipeline_bypass(plane);
@@ -157,6 +187,9 @@ static void test_plane_colorops(data_t *data, igt_crtc_t *crtc,
 	int n_planes = crtc->n_planes;
 	igt_output_t *output = data->output;
 	igt_plane_t *plane;
+	igt_crc_t ref_crc;
+
+	capture_ref_crc(data, output, exp_colors, &ref_crc);
 
 	for (int plane_id = 0; plane_id < n_planes; plane_id++) {
 		plane = igt_output_get_plane(output, plane_id);
@@ -165,7 +198,8 @@ static void test_plane_colorops(data_t *data, igt_crtc_t *crtc,
 			continue;
 
 		igt_dynamic_f("pipe-%s-plane-%u", kmstest_pipe_name(crtc->pipe), plane_id)
-			_test_plane_colorops(data, plane, fb_colors, exp_colors, colorops);
+			_test_plane_colorops(data, plane, fb_colors,
+					     &ref_crc, colorops);
 	}
 }
 
-- 
2.25.1


  parent reply	other threads:[~2026-02-19  9:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-19  9:05 [PATCH i-g-t v2 1/4] tests/kms_color_pipeline: use atomic commit helper consistently Chaitanya Kumar Borah
2026-02-19  9:05 ` [PATCH i-g-t v2 2/4] tests/kms_color_pipeline: Run tests on all supported planes Chaitanya Kumar Borah
2026-02-20 11:12   ` Sharma, Swati2
2026-02-19  9:05 ` [PATCH i-g-t v2 3/4] tests/kms_color_pipeline: Disable pipe color properties in test setup Chaitanya Kumar Borah
2026-02-19  9:05 ` Chaitanya Kumar Borah [this message]
2026-02-20 11:13   ` [PATCH i-g-t v2 4/4] tests/kms_color_pipeline: collect reference CRC once per pipe Sharma, Swati2
2026-02-19 11:52 ` ✓ Xe.CI.BAT: success for series starting with [i-g-t,v2,1/4] tests/kms_color_pipeline: use atomic commit helper consistently Patchwork
2026-02-19 12:02 ` ✓ i915.CI.BAT: " Patchwork
2026-02-19 15:11 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-02-19 16:16 ` ✗ i915.CI.Full: " Patchwork
2026-02-23  7:40 ` ✓ i915.CI.Full: success " 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=20260219090545.340383-4-chaitanya.kumar.borah@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox