From: "Michał Winiarski" <michal.winiarski@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [CI 3/8] tests/i915_pm_rps: Use sysfs helpers
Date: Tue, 19 Mar 2019 11:15:11 +0100 [thread overview]
Message-ID: <20190319101516.11020-3-michal.winiarski@intel.com> (raw)
In-Reply-To: <20190319101516.11020-1-michal.winiarski@intel.com>
Doing this lets us avoid drm_get_card, which we plan to remove
eventually.
v2: We were extermally unlikely to find rps knobs in current dir.
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
tests/i915/i915_pm_rps.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tests/i915/i915_pm_rps.c b/tests/i915/i915_pm_rps.c
index d20cd2d8..ed146045 100644
--- a/tests/i915/i915_pm_rps.c
+++ b/tests/i915/i915_pm_rps.c
@@ -38,12 +38,12 @@
#include "igt.h"
#include "igt_dummyload.h"
+#include "igt_sysfs.h"
IGT_TEST_DESCRIPTION("Render P-States tests - verify GPU frequency changes");
static int drm_fd;
-static const char sysfs_base_path[] = "/sys/class/drm/card%d/gt_%s_freq_mhz";
enum {
CUR,
MIN,
@@ -629,20 +629,23 @@ igt_main
igt_skip_on_simulation();
igt_fixture {
- const int device = drm_get_card();
struct sysfs_file *sysfs_file = sysfs_files;
+ char sysfs_path[80];
int ret;
/* Use drm_open_driver to verify device existence */
drm_fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(drm_fd);
igt_require(gem_can_store_dword(drm_fd, 0));
+ igt_assert(igt_sysfs_path(drm_fd, sysfs_path,
+ sizeof(sysfs_path), NULL));
do {
int val = -1;
char *path;
- ret = asprintf(&path, sysfs_base_path, device, sysfs_file->name);
+ ret = asprintf(&path, "%s/gt_%s_freq_mhz",
+ sysfs_path, sysfs_file->name);
igt_assert(ret != -1);
sysfs_file->filp = fopen(path, sysfs_file->mode);
igt_require(sysfs_file->filp);
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-03-19 10:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-19 10:15 [igt-dev] [CI 1/8] tests/gem_exec_blt: Drop benchmark mode, use igt_sysfs Michał Winiarski
2019-03-19 10:15 ` [igt-dev] [CI 2/8] tests/perf: Simplify generic read/write, use sysfs helpers Michał Winiarski
2019-03-19 10:15 ` Michał Winiarski [this message]
2019-03-19 10:15 ` [igt-dev] [CI 4/8] lib/igt_device: Introduce igt_device_get_card_index Michał Winiarski
2019-03-19 10:15 ` [igt-dev] [CI 5/8] lib: Kill drm_get_card() Michał Winiarski
2019-03-19 10:15 ` [igt-dev] [CI 6/8] lib/igt_sysfs: Remove idx from sysfs_open Michał Winiarski
2019-03-19 10:15 ` [igt-dev] [CI 7/8] lib/igt_sysfs: Simplify obtaining sysfs path Michał Winiarski
2019-03-19 10:15 ` [igt-dev] [CI 8/8] lib/igt_device: Move intel_get_pci_device under igt_device Michał Winiarski
2019-03-19 11:31 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [CI,1/8] tests/gem_exec_blt: Drop benchmark mode, use igt_sysfs Patchwork
2019-03-19 18:47 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2019-03-14 12:50 [igt-dev] [CI 1/8] " Michał Winiarski
2019-03-14 12:50 ` [igt-dev] [CI 3/8] tests/i915_pm_rps: Use sysfs helpers Michał Winiarski
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=20190319101516.11020-3-michal.winiarski@intel.com \
--to=michal.winiarski@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