diff options
| author | Jeff McGee <jeff.mcgee@intel.com> | 2014-01-31 10:13:50 -0600 |
|---|---|---|
| committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-02-06 07:47:10 +0100 |
| commit | 2d16e0aad7a31a0964ae35fa07c70f4c2fb513b0 (patch) | |
| tree | 1c2b74250a6ae08edea6c910a5b9e35b9a2b56d1 /tests | |
| parent | 2cbb0fbf5f3dc839a11d23a970948cb91718594e (diff) | |
pm_rps: Add stop rings injection utility
Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/pm_rps.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/pm_rps.c b/tests/pm_rps.c index 709e3413..a6807d27 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -32,10 +32,12 @@ #include <string.h> #include <unistd.h> #include <getopt.h> +#include <fcntl.h> #include "drmtest.h" #include "intel_gpu_tools.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" +#include "igt_debugfs.h" static bool verbose = false; @@ -62,6 +64,8 @@ struct junk { { "cur", "r", NULL }, { "min", "rb+", NULL }, { "max", "rb+", NULL }, { "RP0", "r", NULL }, { "RP1", "r", NULL }, { "RPn", "r", NULL }, { NULL, NULL, NULL } }; +static igt_debugfs_t dfs; + static int readval(FILE *filp) { int val; @@ -267,6 +271,37 @@ static void load_helper_deinit(void) drm_intel_bufmgr_destroy(lh.bufmgr); } +static void stop_rings(void) +{ + int fd; + static const char data[] = "0xf"; + + fd = igt_debugfs_open(&dfs, "i915_ring_stop", O_WRONLY); + igt_assert(fd >= 0); + + log("injecting ring stop\n"); + igt_assert(write(fd, data, sizeof(data)) == sizeof(data)); + + close(fd); +} + +static bool rings_stopped(void) +{ + int fd; + static char buf[128]; + unsigned long long val; + + fd = igt_debugfs_open(&dfs, "i915_ring_stop", O_RDONLY); + igt_assert(fd >= 0); + + igt_assert(read(fd, buf, sizeof(buf)) > 0); + close(fd); + + sscanf(buf, "%llx", &val); + + return (bool)val; +} + static void min_max_config(void (*check)(void)) { int fmid = (origfreqs[RPn] + origfreqs[RP0]) / 2; @@ -471,6 +506,8 @@ int main(int argc, char **argv) igt_install_exit_handler(pm_rps_exit_handler); load_helper_init(); + + igt_debugfs_init(&dfs); } igt_subtest("basic-api") |
