Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [i-g-t 4/6] tests/kms_vrr: Fix bigjoiner constraint
Date: Wed, 29 Nov 2023 19:16:55 +0530	[thread overview]
Message-ID: <20231129134657.2826744-5-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20231129134657.2826744-1-bhanuprakash.modem@intel.com>

Before starting the subtest, we are checking the selected pipe/output
combo validity with default mode, but inside the subtest we are using
the mode with highest resolution.

Few panels exposing 4K as a default mode even though it supports 8K,
in this scenario test may misbehave due to the bigjoiner involvement.

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_vrr.c | 67 +++++++++++++++++++++++++++++++------------------
 1 file changed, 42 insertions(+), 25 deletions(-)

diff --git a/tests/kms_vrr.c b/tests/kms_vrr.c
index 09b97862e..363649294 100644
--- a/tests/kms_vrr.c
+++ b/tests/kms_vrr.c
@@ -230,37 +230,21 @@ static void set_vrr_on_pipe(data_t *data, enum pipe pipe, bool enabled)
 /* Prepare the display for testing on the given pipe. */
 static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe)
 {
-	drmModeModeInfo mode;
 	cairo_t *cr;
-
-	/* Reset output */
-	igt_display_reset(&data->display);
-	igt_output_set_pipe(output, pipe);
-
-	/* Capture VRR range */
-	data->range = get_vrr_range(data, output);
-
-	/* Override mode with max vrefresh.
-	 *   - vrr_min range should be less than the override mode vrefresh.
-	 *   - Limit the vrr_max range with the override mode vrefresh.
-	 */
-	mode = output_mode_with_maxrate(output, data->range.max);
-	igt_require(mode.vrefresh > data->range.min);
-	data->range.max = mode.vrefresh;
-	igt_output_override_mode(output, &mode);
+	drmModeModeInfo *mode = igt_output_get_mode(output);
 
 	/* Prepare resources */
-	igt_create_color_fb(data->drm_fd, mode.hdisplay, mode.vdisplay,
+	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
 			    DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR,
 			    0.50, 0.50, 0.50, &data->fb0);
 
-	igt_create_color_fb(data->drm_fd, mode.hdisplay, mode.vdisplay,
+	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
 			    DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR,
 			    0.50, 0.50, 0.50, &data->fb1);
 
 	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb0);
 
-	igt_paint_color(cr, 0, 0, mode.hdisplay / 10, mode.vdisplay / 10,
+	igt_paint_color(cr, 0, 0, mode->hdisplay / 10, mode->vdisplay / 10,
 			1.00, 0.00, 0.00);
 
 	igt_put_cairo_ctx(cr);
@@ -483,7 +467,36 @@ static void test_cleanup(data_t *data, enum pipe pipe, igt_output_t *output)
 	igt_remove_fb(data->drm_fd, &data->fb0);
 }
 
-static bool config_constraint(igt_output_t *output, uint32_t flags)
+static bool output_constraint(data_t *data, igt_output_t *output)
+{
+	drmModeModeInfo mode;
+
+	/* Reset output */
+	igt_display_reset(&data->display);
+
+	/* Capture VRR range */
+	data->range = get_vrr_range(data, output);
+
+	/*
+	 * Override mode with max vrefresh.
+	 *   - vrr_min range should be less than the override mode vrefresh.
+	 *   - Limit the vrr_max range with the override mode vrefresh.
+	 */
+	mode = output_mode_with_maxrate(output, data->range.max);
+	if (mode.vrefresh < data->range.min)
+		return false;
+
+	data->range.max = mode.vrefresh;
+
+	igt_info("Override Mode: ");
+	kmstest_dump_mode(&mode);
+
+	igt_output_override_mode(output, &mode);
+
+	return true;
+}
+
+static bool config_constraint(data_t *data, igt_output_t *output, uint32_t flags)
 {
 	if (!has_vrr(output))
 		return false;
@@ -495,6 +508,9 @@ static bool config_constraint(igt_output_t *output, uint32_t flags)
 	if (!(flags & TEST_NEGATIVE) && !vrr_capable(output))
 		return false;
 
+	if (!output_constraint(data, output))
+		return false;
+
 	return true;
 }
 
@@ -507,16 +523,17 @@ run_vrr_test(data_t *data, test_t test, uint32_t flags)
 	for_each_connected_output(&data->display, output) {
 		enum pipe pipe;
 
-		if (!config_constraint(output, flags))
+		if (!config_constraint(data, output, flags))
 			continue;
 
 		for_each_pipe(&data->display, pipe) {
 			if (igt_pipe_connector_valid(pipe, output)) {
-				igt_display_reset(&data->display);
-
 				igt_output_set_pipe(output, pipe);
-				if (!intel_pipe_output_combo_valid(&data->display))
+
+				if (!intel_pipe_output_combo_valid(&data->display)) {
+					igt_output_set_pipe(output, PIPE_NONE);
 					continue;
+				}
 
 				igt_dynamic_f("pipe-%s-%s",
 					      kmstest_pipe_name(pipe), output->name)
-- 
2.40.0

  parent reply	other threads:[~2023-11-29 14:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 13:46 [igt-dev] [i-g-t 0/6] tests/kms_vrr: Add new subtest to switch RR without modeset Bhanuprakash Modem
2023-11-29 13:46 ` [igt-dev] [i-g-t 1/6] tests/kms_vrr: Use lib helper to print connector modes Bhanuprakash Modem
2023-11-29 13:46 ` [igt-dev] [i-g-t 2/6] tests/kms_vrr: Clear VRR before exit Bhanuprakash Modem
2023-11-29 13:46 ` [igt-dev] [i-g-t 3/6] tests/kms_vrr: Move all config constaints to new function Bhanuprakash Modem
2023-11-29 13:46 ` Bhanuprakash Modem [this message]
2023-11-29 13:46 ` [igt-dev] [i-g-t 5/6] tests/kms_vrr: Add new subtest to switch RR without modeset Bhanuprakash Modem
2023-11-29 13:46 ` [igt-dev] [i-g-t 6/6] HAX: Add seamless-rr-switch subtest to BAT Bhanuprakash Modem
2023-11-29 15:34   ` Bhanuprakash Modem
2023-11-29 15:14 ` [igt-dev] ✗ Fi.CI.BUILD: failure for tests/kms_vrr: Add new subtest to switch RR without modeset Patchwork
2023-11-29 20:02 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_vrr: Add new subtest to switch RR without modeset (rev2) Patchwork
2023-11-29 21:10 ` [igt-dev] ✗ CI.xeBAT: failure " Patchwork
2023-11-30 15:20 ` [igt-dev] ✗ Fi.CI.IGT: " 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=20231129134657.2826744-5-bhanuprakash.modem@intel.com \
    --to=bhanuprakash.modem@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