public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Sowmiya S <sowmiya.s@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: swati2.sharma@intel.com, kunal1.joshi@intel.com,
	Sowmiya S <sowmiya.s@intel.com>
Subject: [PATCH i-g-t v1 2/2] tests/kms_plane_multiple: Fix 2-display test for MST shared-link BW
Date: Tue, 21 Apr 2026 11:41:14 +0530	[thread overview]
Message-ID: <20260421061114.2262809-3-sowmiya.s@intel.com> (raw)
In-Reply-To: <20260421061114.2262809-1-sowmiya.s@intel.com>

Perform joint CRC capture with BW-fitting
Ensure fitted modes are applied before reference capture
so driver-accepted BW-constrained commit matches the test.

Signed-off-by: Sowmiya S <sowmiya.s@intel.com>
---
 tests/kms_plane_multiple.c | 87 ++++++++++++++++++++++++++++++++------
 1 file changed, 73 insertions(+), 14 deletions(-)

diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index 0d338eeb5..9afadb3e9 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -473,6 +473,62 @@ static void test_fini_2_display(data_t *data)
 	igt_display_reset(&data->display);
 }
 
+/*
+ * get_reference_crc_2_display:
+ * Capture reference CRCs for both outputs in a single joint commit so that
+ * the kernel negotiates the same bpp/dithering settings as the actual test
+ * commit.  On shared-link configurations (e.g. two MST streams on one DP
+ * connection) the per-pipe bpp is reduced when both streams are active
+ * simultaneously (e.g. 24bpp -> 18bpp with dithering), which changes the
+ * scanout CRC.  Capturing refs one pipe at a time would use unconstrained
+ * bpp and produce a mismatching reference.
+ */
+static void get_reference_crc_2_display(data_t *data,
+					igt_output_t *output1, igt_output_t *output2,
+					color_t *color, uint64_t modifier)
+{
+	drmModeModeInfo *mode1, *mode2;
+	igt_plane_t *primary1, *primary2;
+	int ret;
+
+	/*
+	 * Display reset, CRTC assignment and igt_fit_modes_in_bw() are done
+	 * by the caller before this function is invoked so the fitted modes
+	 * are already set on the outputs.
+	 */
+	mode1 = igt_output_get_mode(output1);
+	mode2 = igt_output_get_mode(output2);
+
+	primary1 = igt_output_get_plane_type(output1, DRM_PLANE_TYPE_PRIMARY);
+	primary2 = igt_output_get_plane_type(output2, DRM_PLANE_TYPE_PRIMARY);
+
+	data->plane1[primary1->index] = primary1;
+	data->plane2[primary2->index] = primary2;
+
+	igt_create_color_fb(data->drm_fd, mode1->hdisplay, mode1->vdisplay,
+			    DRM_FORMAT_XRGB8888, modifier,
+			    color->red, color->green, color->blue,
+			    &data->fb1[primary1->index]);
+	igt_create_color_fb(data->drm_fd, mode2->hdisplay, mode2->vdisplay,
+			    DRM_FORMAT_XRGB8888, modifier,
+			    color->red, color->green, color->blue,
+			    &data->fb2[primary2->index]);
+
+	igt_plane_set_fb(primary1, &data->fb1[primary1->index]);
+	igt_plane_set_fb(primary2, &data->fb2[primary2->index]);
+
+	ret = igt_display_try_commit2(&data->display, COMMIT_ATOMIC);
+	igt_skip_on(ret != 0);
+
+	igt_pipe_crc_collect_crc(data->pipe_crc1, &data->ref_crc1);
+	igt_pipe_crc_collect_crc(data->pipe_crc2, &data->ref_crc2);
+
+	igt_plane_set_fb(primary1, NULL);
+	igt_plane_set_fb(primary2, NULL);
+	igt_remove_fb(data->drm_fd, &data->fb1[primary1->index]);
+	igt_remove_fb(data->drm_fd, &data->fb2[primary2->index]);
+}
+
 static void test_plane_position_2_display(data_t *data, igt_crtc_t *crtc1,
 					  igt_crtc_t *crtc2,
 					  igt_output_t *output1, igt_output_t *output2,
@@ -486,23 +542,25 @@ static void test_plane_position_2_display(data_t *data, igt_crtc_t *crtc1,
 	if (!opt.all_planes)
 		n_planes = min(n_planes, DEFAULT_N_PLANES);
 
+	test_init_2_display(data, crtc1, crtc2, n_planes);
+
 	/*
-	 * Note: We could use the dynamic way of calculating the maximum planes here
-	 * like we've on single display subtest but this consumes a lot of extra time
-	 * with the number of dynamic subtests in this case. So keeping n_planes to the
-	 * default value. This might need to be tweaked if we see any bw related failures.
+	 * Reset the display, assign CRTCs and compute the fitted modes before
+	 * the reference CRC capture.  igt_fit_modes_in_bw() selects modes that
+	 * satisfy shared-link bandwidth constraints (e.g. two MST streams on
+	 * one DP connection).  Doing this here means get_reference_crc_2_display()
+	 * needs no internal reset, so the chosen modes stay in place for the
+	 * entire test without having to be saved and re-applied afterwards.
 	 */
+	igt_display_reset(&data->display);
+	igt_output_set_crtc(output1, crtc1);
+	igt_output_set_crtc(output2, crtc2);
+	igt_skip_on_f(!igt_fit_modes_in_bw(&data->display),
+		      "No simultaneous mode combination fits link BW for %s + %s\n",
+		      output1->name, output2->name);
 
-	test_init_2_display(data, crtc1,
-			    crtc2, n_planes);
-	get_reference_crc(data, output1,
-			  crtc1,
-			  data->pipe_crc1, &blue,
-			  data->plane1, DRM_FORMAT_MOD_LINEAR, &data->ref_crc1);
-	get_reference_crc(data, output2,
-			  crtc2,
-			  data->pipe_crc2, &blue,
-			  data->plane2, DRM_FORMAT_MOD_LINEAR, &data->ref_crc2);
+	get_reference_crc_2_display(data, output1, output2,
+				    &blue, DRM_FORMAT_MOD_LINEAR);
 
 	prepare_planes(data, crtc1, &blue,
 		       data->plane1,
@@ -512,6 +570,7 @@ static void test_plane_position_2_display(data_t *data, igt_crtc_t *crtc1,
 		       modifier, 2, output2, data->fb2);
 
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+
 	igt_pipe_crc_start(data->pipe_crc1);
 	igt_pipe_crc_start(data->pipe_crc2);
 
-- 
2.43.0


  parent reply	other threads:[~2026-04-21  5:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21  6:11 [PATCH i-g-t v1 0/2] Fix 2-display test for MST shared-link BW Sowmiya S
2026-04-21  6:11 ` [PATCH i-g-t v1 1/2] lib/igt_kms: Add MST bandwidth-fitting support and helpers Sowmiya S
2026-04-21 12:09   ` Jani Nikula
2026-04-27  9:03     ` S, Sowmiya
2026-04-21  6:11 ` Sowmiya S [this message]
2026-04-21 21:03 ` ✓ i915.CI.BAT: success for Fix 2-display test for MST shared-link BW Patchwork
2026-04-21 21:55 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-22  2:02 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-22  4:34 ` ✗ 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=20260421061114.2262809-3-sowmiya.s@intel.com \
    --to=sowmiya.s@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kunal1.joshi@intel.com \
    --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