summaryrefslogtreecommitdiff
path: root/tests/kms_psr_sink_crc.c
diff options
context:
space:
mode:
authorRodrigo Vivi <rodrigo.vivi@intel.com>2016-01-08 07:40:45 -0800
committerRodrigo Vivi <rodrigo.vivi@intel.com>2016-01-08 16:00:13 -0800
commit05ac611358e61f914d99e00e1738f2ff9cfb05d4 (patch)
treedcaebc63a71fdf9329cb10cd6d7d884aa506dc6f /tests/kms_psr_sink_crc.c
parentf1bb20eb7c4fa5f8b98bfd9876adc69c250e9bea (diff)
kms_psr_sink_crc: Simplify debugfs reading.
Let's start using igt_debugfs_read helper so we can change the debugfs interface at anytime. Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'tests/kms_psr_sink_crc.c')
-rw-r--r--tests/kms_psr_sink_crc.c57
1 files changed, 8 insertions, 49 deletions
diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 5fad9b52..b18e4263 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -199,63 +199,22 @@ static void fill_render(data_t *data, uint32_t handle, unsigned char color)
static bool psr_possible(data_t *data)
{
- FILE *file;
- char buf[4096];
- int ret;
-
- if (running_with_psr_disabled)
- return true;
-
- file = igt_debugfs_fopen("i915_edp_psr_status", "r");
- igt_require(file);
-
- /* First dump the entire file into the debug log for later analysis
- * if required.
- */
- ret = fread(buf, 1, 4095, file);
- igt_require(ret > 0);
- buf[ret] = '\0';
- igt_debug("i915_edp_psr_status:\n%s", buf);
- fseek(file, 0, SEEK_SET);
+ char buf[512];
- /* Now check that we have all the preconditions required for PSR */
- ret = fscanf(file, "Sink_Support: %s\n", buf);
- igt_require_f(ret == 1 && strcmp(buf, "yes") == 0,
- "Sink_Support: %s\n", buf);
+ igt_debugfs_read("i915_edp_psr_status", buf);
- fclose(file);
- return true;
+ return running_with_psr_disabled ||
+ strstr(buf, "Sink_Support: yes\n");
}
static bool psr_active(data_t *data)
{
- int ret;
- FILE *file;
- char str[4];
+ char buf[512];
- if (running_with_psr_disabled)
- return true;
+ igt_debugfs_read("i915_edp_psr_status", buf);
- file = igt_debugfs_fopen("i915_edp_psr_status", "r");
- igt_require(file);
-
- ret = fscanf(file, "Sink_Support: %s\n", str);
- igt_assert_neq(ret, 0);
- ret = fscanf(file, "Source_OK: %s\n", str);
- igt_assert_neq(ret, 0);
- ret = fscanf(file, "Enabled: %s\n", str);
- igt_assert_neq(ret, 0);
- ret = fscanf(file, "Active: %s\n", str);
- igt_assert_neq(ret, 0);
- ret = fscanf(file, "Busy frontbuffer bits: %s\n", str);
- igt_assert_neq(ret, 0);
- ret = fscanf(file, "Re-enable work scheduled: %s\n", str);
- igt_assert_neq(ret, 0);
- ret = fscanf(file, "HW Enabled & Active bit: %s\n", str);
- igt_assert_neq(ret, 0);
-
- fclose(file);
- return strcmp(str, "yes") == 0;
+ return running_with_psr_disabled ||
+ strstr(buf, "HW Enabled & Active bit: yes\n");
}
static bool wait_psr_entry(data_t *data)