From: Swati Sharma <swati2.sharma@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: ankit.k.nautiyal@intel.com, Swati Sharma <swati2.sharma@intel.com>
Subject: [PATCH i-g-t 3/5] tests/intel/kms_cdclk: Add conditions to filter valid outputs
Date: Tue, 18 Feb 2025 03:05:29 +0530 [thread overview]
Message-ID: <20250217213531.402162-4-swati2.sharma@intel.com> (raw)
In-Reply-To: <20250217213531.402162-1-swati2.sharma@intel.com>
Add vrefresh as an additional parameter to check if highest and
lowest refresh rates are identical.
Skip the test, if highres and lowres are the same, as no cdclk
transition will occur.
Store highres and lowres of valid outputs in an array for reuse later.
v2:-fixed description (Ankit)
-highres lowres stored in previous loop (Ankit)
-removed comments (Ankit)
v3:-use i iterator (Ankit)
-use func() for skip
Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
tests/intel/kms_cdclk.c | 51 ++++++++++++++++++++++++++++-------------
1 file changed, 35 insertions(+), 16 deletions(-)
diff --git a/tests/intel/kms_cdclk.c b/tests/intel/kms_cdclk.c
index 64c95043a..a4355baf2 100644
--- a/tests/intel/kms_cdclk.c
+++ b/tests/intel/kms_cdclk.c
@@ -87,6 +87,13 @@ static bool is_4k(drmModeModeInfo mode)
mode.vrefresh >= VREFRESH);
}
+static bool is_equal(drmModeModeInfo mode_hi, drmModeModeInfo mode_lo)
+{
+ return (mode_hi.hdisplay == mode_lo.hdisplay &&
+ mode_hi.vdisplay == mode_lo.vdisplay &&
+ mode_hi.vrefresh == mode_lo.vrefresh);
+}
+
static drmModeModeInfo *get_lowres_mode(igt_output_t *output)
{
drmModeModeInfo *lowest_mode = NULL;
@@ -196,8 +203,7 @@ static void test_mode_transition(data_t *data, enum pipe pipe, igt_output_t *out
igt_require_f(is_4k(mode_hi), "Mode >= 4K not found on output %s\n",
igt_output_name(output));
- igt_skip_on_f(mode_hi.hdisplay == mode_lo.hdisplay && mode_hi.vdisplay == mode_lo.vdisplay,
- "Highest and lowest mode resolutions are same; no transition\n");
+ igt_skip_on_f(is_equal(mode_hi, mode_lo), "Highest and lowest mode resolutions are same; no transition\n");
primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
@@ -233,8 +239,10 @@ static void test_mode_transition_on_all_outputs(data_t *data)
{
igt_display_t *display = &data->display;
drmModeModeInfo *mode, mode_hi, mode_lo;
+ drmModeModeInfo mode_highres[IGT_MAX_PIPES] = {0}, mode_lowres[IGT_MAX_PIPES] = {0};
+ igt_output_t *valid_outputs[IGT_MAX_PIPES] = {NULL};
igt_output_t *output;
- int valid_outputs = 0;
+ int count = 0;
int cdclk_ref, cdclk_new;
uint16_t width = 0, height = 0;
struct igt_fb fb;
@@ -245,27 +253,38 @@ static void test_mode_transition_on_all_outputs(data_t *data)
do_cleanup_display(display);
igt_display_reset(display);
- for_each_connected_output(&data->display, output)
- valid_outputs++;
-
- i = 0;
for_each_connected_output(display, output) {
- mode = igt_output_get_mode(output);
+ mode_highres[count] = *igt_output_get_highres_mode(output);
+ igt_require_f(is_4k(mode_highres[count]), "Mode >= 4K not found on output %s.\n",
+ igt_output_name(output));
+
+ mode_lowres[count] = *get_lowres_mode(output);
+
+ if (is_equal(mode_highres[count], mode_lowres[count])) {
+ igt_info("Highest and lowest mode resolutions are same on output %s; no transition will occur, skipping\n",
+ igt_output_name(output));
+ continue;
+ }
+
+ valid_outputs[count] = output;
+ count++;
+ }
+
+ igt_skip_on_f(count < 2,
+ "Number of valid outputs (%d) must be greater than or equal to 2\n", count);
+
+ for (int i = 0; i < count; i++) {
+ mode = igt_output_get_mode(valid_outputs[i]);
igt_assert(mode);
width = max(width, mode->hdisplay);
height = max(height, mode->vdisplay);
- mode_hi = *igt_output_get_highres_mode(output);
- igt_require_f(is_4k(mode_hi), "Mode >= 4K not found on output %s\n",
- igt_output_name(output));
-
- igt_output_set_pipe(output, i);
- igt_output_override_mode(output, &mode_hi);
- i++;
+ igt_output_set_pipe(valid_outputs[i], i);
+ igt_output_override_mode(valid_outputs[i], &mode_highres[i]);
}
+
igt_require(intel_pipe_output_combo_valid(display));
- igt_display_reset(display);
igt_create_pattern_fb(data->drm_fd, width, height, DRM_FORMAT_XRGB8888,
DRM_FORMAT_MOD_LINEAR, &fb);
--
2.25.1
next prev parent reply other threads:[~2025-02-17 21:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 21:35 [PATCH i-g-t 0/5] tests/intel/kms_cdclk: Refactor mode setting and CD clock verification Swati Sharma
2025-02-17 21:35 ` [PATCH i-g-t 1/5] lib/igt_kms: Add func() to read and parse cdclk debugfs Swati Sharma
2025-02-23 12:01 ` Nautiyal, Ankit K
2025-02-17 21:35 ` [PATCH i-g-t 2/5] lib/igt_kms: Add highres() and lowres() func Swati Sharma
2025-02-17 21:35 ` Swati Sharma [this message]
2025-02-17 21:35 ` [PATCH i-g-t 4/5] tests/intel/kms_cdclk: Introduce set_mode() Swati Sharma
2025-02-17 21:35 ` [PATCH i-g-t 5/5] tests/intel/kms_cdclk: Use igt_get_max_cdclk() Swati Sharma
2025-02-18 0:06 ` ✓ Xe.CI.BAT: success for tests/intel/kms_cdclk: Refactor mode setting and CD clock verification (rev4) Patchwork
2025-02-18 0:23 ` ✗ i915.CI.BAT: failure " Patchwork
2025-02-18 18:10 ` ✗ Xe.CI.Full: " Patchwork
2025-02-23 12:11 ` [PATCH i-g-t 0/5] tests/intel/kms_cdclk: Refactor mode setting and CD clock verification Nautiyal, Ankit K
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=20250217213531.402162-4-swati2.sharma@intel.com \
--to=swati2.sharma@intel.com \
--cc=ankit.k.nautiyal@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