Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Swati Sharma <swati2.sharma@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Swati Sharma <swati2.sharma@intel.com>
Subject: [PATCH i-g-t 2/3] tests/chamelium/kms_chamelium_color: Fix ctm-limited-range subtest
Date: Mon, 24 Mar 2025 14:39:48 +0530	[thread overview]
Message-ID: <20250324090949.614233-3-swati2.sharma@intel.com> (raw)
In-Reply-To: <20250324090949.614233-1-swati2.sharma@intel.com>

Test is fixed, now we take chamelium capture after setting output
to full and limited range and then compare frame dumps.

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
 tests/chamelium/kms_chamelium_color.c | 50 +++++++++++++++------------
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/tests/chamelium/kms_chamelium_color.c b/tests/chamelium/kms_chamelium_color.c
index 68611ec6a..355047ed6 100644
--- a/tests/chamelium/kms_chamelium_color.c
+++ b/tests/chamelium/kms_chamelium_color.c
@@ -352,9 +352,10 @@ static bool test_pipe_limited_range_ctm(data_t *data,
 	gamma_lut_t *degamma_linear, *gamma_linear;
 	igt_output_t *output = data->output;
 	drmModeModeInfo *mode = data->mode;
-	struct igt_fb fb_modeset, fb, fbref;
-	struct chamelium_frame_dump *frame_limited;
-	int fb_id, fb_modeset_id, fbref_id;
+	struct igt_fb fb_modeset, fb;
+	struct chamelium_frame_dump *frame_limited, *frame_full;
+	int fb_id, fb_modeset_id;
+	igt_crc_t *reference_crc;
 	bool ret = false;
 
 	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM));
@@ -380,21 +381,13 @@ static bool test_pipe_limited_range_ctm(data_t *data,
 				      DRM_FORMAT_MOD_LINEAR,
 				      &fb_modeset);
 	igt_assert(fb_modeset_id);
-
-	fbref_id = igt_create_fb(data->drm_fd,
-				 mode->hdisplay,
-				 mode->vdisplay,
-				 DRM_FORMAT_XRGB8888,
-				 DRM_FORMAT_MOD_LINEAR,
-				 &fbref);
-	igt_assert(fbref_id);
-
 	igt_plane_set_fb(primary, &fb_modeset);
 
 	set_degamma(data, primary->pipe, degamma_linear);
 	set_gamma(data, primary->pipe, gamma_linear);
 	set_ctm(primary->pipe, ctm);
 
+	/* Set the output into full range. */
 	igt_output_set_prop_value(output,
 				  IGT_CONNECTOR_BROADCAST_RGB,
 				  BROADCAST_RGB_FULL);
@@ -402,11 +395,28 @@ static bool test_pipe_limited_range_ctm(data_t *data,
 	igt_plane_set_fb(primary, &fb);
 	igt_display_commit(&data->display);
 
+	chamelium_capture(data->chamelium, port, 0, 0, 0, 0, 1);
+	frame_full =
+		chamelium_read_captured_frame(data->chamelium, 0);
+
+	/* Chamelium calculates the CRC for the most recent
+	 * captured frame; that's why CRC of the reference frame
+	 * is captured here.
+	 */
+	reference_crc = chamelium_get_crc_for_area(data->chamelium, port, 0, 0, 0, 0);
+	igt_assert(reference_crc);
+
 	/* Set the output into limited range. */
 	igt_output_set_prop_value(output,
 				  IGT_CONNECTOR_BROADCAST_RGB,
 				  BROADCAST_RGB_16_235);
 	paint_rectangles(data, mode, red_green_blue_full, &fb);
+	igt_plane_set_fb(primary, &fb);
+	igt_display_commit(&data->display);
+
+	chamelium_capture(data->chamelium, port, 0, 0, 0, 0, 1);
+	frame_limited =
+		chamelium_read_captured_frame(data->chamelium, 0);
 
 	/* And reset.. */
 	igt_output_set_prop_value(output,
@@ -414,18 +424,12 @@ static bool test_pipe_limited_range_ctm(data_t *data,
 				  BROADCAST_RGB_FULL);
 	igt_plane_set_fb(primary, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	chamelium_capture(data->chamelium, port, 0, 0, 0, 0, 1);
-	frame_limited =
-		chamelium_read_captured_frame(data->chamelium, 0);
-
 
-	/* Verify that the framebuffer reference of the software
-	 * computed output is equal to the frame dump of the CTM
-	 * matrix transformation output.
-	 */
-	ret = chamelium_frame_match_or_dump(data->chamelium, port,
-					    frame_limited, &fbref,
-					    CHAMELIUM_CHECK_ANALOG);
+	/* Verify frame dumps are equal. */
+	ret = chamelium_frame_match_or_dump_frame_pair(data->chamelium, port,
+						       frame_full, frame_limited,
+						       reference_crc,
+						       CHAMELIUM_CHECK_ANALOG);
 
 	free_lut(gamma_linear);
 	free_lut(degamma_linear);
-- 
2.25.1


  parent reply	other threads:[~2025-03-24  9:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-24  9:09 [PATCH i-g-t 0/3] Fix ctm-limited subtest Swati Sharma
2025-03-24  9:09 ` [PATCH i-g-t 1/3] lib/igt_chamelium: Add chamelium_frame_match_or_dump_frame_pair() Swati Sharma
2025-03-26 12:23   ` Borah, Chaitanya Kumar
2025-03-27  5:56     ` Sharma, Swati2
2025-03-24  9:09 ` Swati Sharma [this message]
2025-03-27  5:27   ` [PATCH i-g-t 2/3] tests/chamelium/kms_chamelium_color: Fix ctm-limited-range subtest Borah, Chaitanya Kumar
2025-03-27  6:02     ` Sharma, Swati2
2025-03-24  9:09 ` [PATCH i-g-t 3/3] tests/chamelium/kms_chamelium_color: Set rgb_full to 1.0 Swati Sharma
2025-03-27  5:30   ` Borah, Chaitanya Kumar
2025-03-24 13:27 ` ✓ Xe.CI.BAT: success for Fix ctm-limited subtest Patchwork
2025-03-24 13:27 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-03-24 13:43 ` ✗ i915.CI.BAT: " Patchwork
2025-03-24 15:18 ` ✓ Xe.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=20250324090949.614233-3-swati2.sharma@intel.com \
    --to=swati2.sharma@intel.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