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 V2] tests/kms: s/i915_frequency_info/i915_cdclk_info/
Date: Fri, 14 Apr 2023 10:38:30 +0530	[thread overview]
Message-ID: <20230414050830.1176272-1-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20230412103448.826946-1-bhanuprakash.modem@intel.com>

Read display specific clock frequency info from debugfs
"i915_cdclk_info".

V2: - For older Kernels, readback from i915_frequency_info

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/i915/kms_cdclk.c   | 10 +++++++++-
 tests/kms_invalid_mode.c | 23 +++++++++++++++++++----
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/tests/i915/kms_cdclk.c b/tests/i915/kms_cdclk.c
index 23d9d3b02e2..bb003680229 100644
--- a/tests/i915/kms_cdclk.c
+++ b/tests/i915/kms_cdclk.c
@@ -61,8 +61,16 @@ static int get_current_cdclk_freq(int debugfs_fd)
 	char *start_loc;
 	int res;
 
-	res = igt_debugfs_simple_read(debugfs_fd, "i915_frequency_info",
+	/*
+	 * 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.
+	 */
+	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, "Current CD clock frequency: "));
diff --git a/tests/kms_invalid_mode.c b/tests/kms_invalid_mode.c
index 86f529e88b1..6ef36d3cc98 100644
--- a/tests/kms_invalid_mode.c
+++ b/tests/kms_invalid_mode.c
@@ -217,14 +217,29 @@ static int i915_max_dotclock(data_t *data)
 {
 	char buf[4096];
 	char *s;
-	int max_dotclock = 0;
+	int dir, res, max_dotclock = 0;
 
 	if (!is_i915_device(data->drm_fd))
 		return 0;
 
-	igt_debugfs_read(data->drm_fd, "i915_frequency_info", buf);
-	s = strstr(buf, "Max pixel clock frequency:");
-	igt_assert(s);
+	dir = igt_debugfs_dir(data->drm_fd);
+	igt_require(dir);
+
+	/*
+	 * 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.
+	 */
+	res = igt_debugfs_simple_read(dir, "i915_cdclk_info",
+				      buf, sizeof(buf));
+	if (res <= 0)
+		res = igt_debugfs_simple_read(dir, "i915_frequency_info",
+					      buf, sizeof(buf));
+	close(dir);
+
+	igt_require(res > 0);
+
+	igt_assert(s = strstr(buf, "Max pixel clock frequency:"));
 	igt_assert_eq(sscanf(s, "Max pixel clock frequency: %d kHz", &max_dotclock), 1);
 
 	/* 100 Mhz to 5 GHz seem like reasonable values to expect */
-- 
2.40.0

  parent reply	other threads:[~2023-04-14  5:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12 10:34 [igt-dev] [i-g-t] tests/kms: s/i915_frequency_info/i915_cdclk_info/ Bhanuprakash Modem
2023-04-12 11:48 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2023-04-14  5:08 ` Bhanuprakash Modem [this message]
2023-04-14  7:47   ` [igt-dev] [i-g-t V2] " Thasleem, Mohammed
2023-04-14 11:16 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms: s/i915_frequency_info/i915_cdclk_info/ (rev2) Patchwork
2023-04-14 12:23 ` [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=20230414050830.1176272-1-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