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: ankit.k.nautiyal@intel.com, santhosh.reddy.guddati@intel.com,
	Swati Sharma <swati2.sharma@intel.com>
Subject: [PATCH i-g-t 6/6] tests/intel/kms_cdclk: Add get_max_cdclk_freq()
Date: Tue, 31 Dec 2024 00:33:15 +0530	[thread overview]
Message-ID: <20241230190315.48821-7-swati2.sharma@intel.com> (raw)
In-Reply-To: <20241230190315.48821-1-swati2.sharma@intel.com>

Replace hardcoded max cdclk freq with one computed from debugfs.
Also, add same condition for all_outputs subtest.

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
 tests/intel/kms_cdclk.c | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/tests/intel/kms_cdclk.c b/tests/intel/kms_cdclk.c
index fcbfa3f37..2ea805b94 100644
--- a/tests/intel/kms_cdclk.c
+++ b/tests/intel/kms_cdclk.c
@@ -53,7 +53,6 @@ IGT_TEST_DESCRIPTION("Test cdclk features : crawling and squashing");
 #define HDISPLAY_4K	3840
 #define VDISPLAY_4K	2160
 #define VREFRESH	60
-#define MAX_CDCLK_4K	307200
 
 /* Test flags */
 enum {
@@ -104,6 +103,34 @@ static int get_current_cdclk_freq(int debugfs_fd)
 	return cdclk_freq_current;
 }
 
+static int get_max_cdclk_freq(int debugfs_fd)
+{
+	int cdclk_freq_max;
+	char buf[1024];
+	char *start_loc;
+	int res;
+
+	/*
+	 * Display specific clock frequency info is moved to i915_cdclk_info,
+	 * On older kernels if this debugfs is not found, fallback to read from
+	 * i915_frequency_info.
+	 *
+	 * FIXME: As of now, XE debugfs is still using i915 namespace, once the
+	 * Kernel changes are landed, update this to use the XE specific debugfs.
+	 */
+	res = igt_debugfs_simple_read(debugfs_fd, "i915_cdclk_info",
+				      buf, sizeof(buf));
+	if (res <= 0)
+		res = igt_debugfs_simple_read(debugfs_fd, "i915_frequency_info",
+					      buf, sizeof(buf));
+	igt_require(res > 0);
+
+	igt_assert(start_loc = strstr(buf, "Max CD clock frequency: "));
+	igt_assert_eq(sscanf(start_loc, "Max CD clock frequency: %d", &cdclk_freq_max), 1);
+
+	return cdclk_freq_max;
+}
+
 static __u64 get_mode_data_rate(drmModeModeInfo *mode)
 {
 	__u64 data_rate = (__u64)mode->hdisplay * (__u64)mode->vdisplay * (__u64)mode->vrefresh;
@@ -250,7 +277,7 @@ static void test_mode_transition(data_t *data, enum pipe pipe, igt_output_t *out
 	igt_info("CD clock frequency %d -> %d\n", cdclk_ref, cdclk_new);
 
 	/* cdclk should bump */
-	if (cdclk_new != MAX_CDCLK_4K)
+	if (cdclk_new != get_max_cdclk_freq(debugfs_fd))
 		igt_assert_lt(cdclk_ref, cdclk_new);
 
 	/* cleanup */
@@ -348,7 +375,8 @@ static void test_mode_transition_on_all_outputs(data_t *data)
 	igt_info("CD clock frequency %d -> %d\n", cdclk_ref, cdclk_new);
 
 	/* cdclk should bump */
-	igt_assert_lt(cdclk_ref, cdclk_new);
+	if (cdclk_new != get_max_cdclk_freq(debugfs_fd))
+		igt_assert_lt(cdclk_ref, cdclk_new);
 
 	do_cleanup_display(display);
 	igt_remove_fb(data->drm_fd, &fb);
-- 
2.25.1


  parent reply	other threads:[~2024-12-30 18:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-30 19:03 [PATCH i-g-t 0/6] tests/intel/kms_cdclk: Refactor mode setting and CD clock verification Swati Sharma
2024-12-30 19:03 ` [PATCH i-g-t 1/6] lib/igt_kms: Add highres() and lowres() func Swati Sharma
2025-01-27 11:32   ` Reddy Guddati, Santhosh
2025-01-28  5:51     ` Reddy Guddati, Santhosh
2025-02-03 13:47   ` Nautiyal, Ankit K
2024-12-30 19:03 ` [PATCH i-g-t 2/6] tests/intel/kms_cdclk: Modify highest resolution restriction Swati Sharma
2024-12-30 19:03 ` [PATCH i-g-t 3/6] tests/intel/kms_cdclk: Add conditions to filter valid outputs Swati Sharma
2025-02-03 14:05   ` Nautiyal, Ankit K
2024-12-30 19:03 ` [PATCH i-g-t 4/6] tests/intel/kms_cdclk: Introduce set_mode() Swati Sharma
2025-02-03 14:11   ` Nautiyal, Ankit K
2024-12-30 19:03 ` [PATCH i-g-t 5/6] tests/intel/kms_cdclk.c: Modify skip condition Swati Sharma
2025-02-03 14:12   ` Nautiyal, Ankit K
2024-12-30 19:03 ` Swati Sharma [this message]
2024-12-30 19:43 ` ✓ i915.CI.BAT: success for tests/intel/kms_cdclk: Refactor mode setting and CD clock verification (rev2) Patchwork
2024-12-30 19:47 ` ✓ Xe.CI.BAT: " Patchwork
2024-12-30 21:56 ` ✗ i915.CI.Full: failure " Patchwork
2024-12-30 22:20 ` ✗ Xe.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=20241230190315.48821-7-swati2.sharma@intel.com \
    --to=swati2.sharma@intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=santhosh.reddy.guddati@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