Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] tests/kms_psr: Try all modes on the connector
Date: Mon, 27 Mar 2023 15:36:17 +0300	[thread overview]
Message-ID: <20230327123617.24000-1-ville.syrjala@linux.intel.com> (raw)

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Certain panels have a preferred mode with a vblank that is
too short for the PSR setup time, but also expose an alternate
lower refresh rate mode where PSR is actually possible.
Go through all the modes until one is found where PSR works.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/i915/kms_psr.c | 37 +++++++++++++++++++++++++++----------
 1 file changed, 27 insertions(+), 10 deletions(-)

diff --git a/tests/i915/kms_psr.c b/tests/i915/kms_psr.c
index c92902343ea3..3efe1faec8e7 100644
--- a/tests/i915/kms_psr.c
+++ b/tests/i915/kms_psr.c
@@ -109,7 +109,6 @@ static void setup_output(data_t *data)
 
 		data->crtc_id = output->config.crtc->crtc_id;
 		data->output = output;
-		data->mode = igt_output_get_mode(output);
 
 		return;
 	}
@@ -369,6 +368,8 @@ static void test_cleanup(data_t *data)
 {
 	igt_plane_t *primary;
 
+	igt_output_override_mode(data->output, NULL);
+
 	primary = igt_output_get_plane_type(data->output,
 					    DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(primary, NULL);
@@ -440,17 +441,33 @@ static void setup_test_plane(data_t *data, int test_plane)
 
 static void test_setup(data_t *data)
 {
+	drmModeConnectorPtr connector;
+	bool psr_entered = false;
+
 	igt_require_f(data->output,
 		      "No available output found\n");
-	igt_require_f(data->mode,
-		      "No available mode found on %s\n",
-		      data->output->name);
-	if (data->op_psr_mode == PSR_MODE_2)
-		igt_require(data->supports_psr2);
-
-	psr_enable_if_enabled(data);
-	setup_test_plane(data, data->test_plane_id);
-	igt_assert(psr_wait_entry_if_enabled(data));
+
+	connector = data->output->config.connector;
+
+	for (int i = 0; i < connector->count_modes; i++) {
+		data->mode = &connector->modes[i];
+		igt_info("Testing mode:\n");
+		kmstest_dump_mode(data->mode);
+
+		igt_output_override_mode(data->output, data->mode);
+
+		if (data->op_psr_mode == PSR_MODE_2)
+			igt_require(data->supports_psr2);
+
+		psr_enable_if_enabled(data);
+		setup_test_plane(data, data->test_plane_id);
+		if (psr_wait_entry_if_enabled(data)) {
+			psr_entered = true;
+			break;
+		}
+	}
+
+	igt_assert(psr_entered);
 }
 
 static void dpms_off_on(data_t *data)
-- 
2.39.2

             reply	other threads:[~2023-03-27 12:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 12:36 Ville Syrjala [this message]
2023-03-27 15:50 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_psr: Try all modes on the connector Patchwork
2023-03-27 21:26 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-03-31 14:11 ` [igt-dev] [PATCH i-g-t] " Sharma, Swati2

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=20230327123617.24000-1-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.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