diff options
author | José Roberto de Souza <jose.souza@intel.com> | 2022-03-08 11:19:39 -0800 |
---|---|---|
committer | José Roberto de Souza <jose.souza@intel.com> | 2022-03-28 11:27:05 -0700 |
commit | e0746d25f9d913e1235cda992690f7aebc83cccc (patch) | |
tree | 1f939ebb4030e0d86c776b1fd70258fd00c5d6b2 /lib | |
parent | 37ec3b8ffd2c36e5a4c9d2c0d22577920212dc42 (diff) |
tests: Add a new test to stress PSR
This tests is intended to reproduce a issue found in real world but
the software enviroment to reproduce it was not easy to duplicate, so
this test was written to make it easy to reproduce it, debug and fix.
To make sure we don't regress it in the future here the test.
It mixes page flips and frontbuffer writes in primary and overlay
planes and expects that PSR stays active after each subtest without
any warnings or underruns.
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Jouni Högander <jouni.hogander@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_psr.c | 29 | ||||
-rw-r--r-- | lib/igt_psr.h | 2 |
2 files changed, 31 insertions, 0 deletions
diff --git a/lib/igt_psr.c b/lib/igt_psr.c index 2b73e809..a2d88031 100644 --- a/lib/igt_psr.c +++ b/lib/igt_psr.c @@ -330,3 +330,32 @@ void i915_psr2_sel_fetch_restore(int drm_fd) psr_set(drm_fd, debugfs_fd, PSR_MODE_2_SEL_FETCH); close(debugfs_fd); } + +/** + * psr_get_mode + * + * Return the current PSR mode. + */ +enum psr_mode psr_get_mode(int debugfs_fd) +{ + char buf[PSR_STATUS_MAX_LEN]; + int ret; + + + ret = igt_debugfs_simple_read(debugfs_fd, "i915_edp_psr_status", buf, + sizeof(buf)); + if (ret < 0) { + igt_info("Could not read i915_edp_psr_status: %s\n", + strerror(-ret)); + return PSR_DISABLED; + } + + if (strstr(buf, "PSR2 selective fetch: enabled")) + return PSR_MODE_2_SEL_FETCH; + else if (strstr(buf, "PSR2 enabled")) + return PSR_MODE_2; + else if (strstr(buf, "PSR1 enabled")) + return PSR_MODE_1; + + return PSR_DISABLED; +} diff --git a/lib/igt_psr.h b/lib/igt_psr.h index 76cd26c6..12ffc9d6 100644 --- a/lib/igt_psr.h +++ b/lib/igt_psr.h @@ -34,6 +34,7 @@ enum psr_mode { PSR_MODE_1, PSR_MODE_2, PSR_MODE_2_SEL_FETCH, + PSR_DISABLED, }; bool psr_disabled_check(int debugfs_fd); @@ -46,6 +47,7 @@ bool psr_disable(int device, int debugfs_fd); bool psr_sink_support(int device, int debugfs_fd, enum psr_mode mode); bool psr2_wait_su(int debugfs_fd, uint16_t *num_su_blocks); void psr_print_debugfs(int debugfs_fd); +enum psr_mode psr_get_mode(int debugfs_fd); bool i915_psr2_selective_fetch_check(int drm_fd); |