diff options
author | José Roberto de Souza <jose.souza@intel.com> | 2021-11-23 08:34:10 -0800 |
---|---|---|
committer | José Roberto de Souza <jose.souza@intel.com> | 2021-11-25 06:06:25 -0800 |
commit | 2edbba08875fc6348ec1cad59dfc0d91012cdeba (patch) | |
tree | 4dd36b36d690dd20f01cecf5da4772c2f0f9531a /lib/igt_psr.c | |
parent | 04f17901d1a64e5ddc15f2f3873c04b756b1727d (diff) |
tests/kms_cursor_legacy: Disable Intel's PSR2 selective fetch in this test
When doing a primary or sprite plane flip, PSR2 selective fetch code
also adds all the planes including cursor that overlaps with the
area being updated, so this causes legacy cursor API calls to
wait for a pending atomic commit to finish causing tests that do
checks with vblank counters.
So here when running in an Intel platform that has PSR2 selective
fetch enabled, it will switch to PSR1 before executing the subtests.
Because what this whole test mostly wants to do, is check if userspace
can do asynchronous cursors updates.
v2:
- rename functions and add documentation
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2346
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Jouni Hogander <jouni.hogander@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Diffstat (limited to 'lib/igt_psr.c')
-rw-r--r-- | lib/igt_psr.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/igt_psr.c b/lib/igt_psr.c index 8fa8b192..98eb28b4 100644 --- a/lib/igt_psr.c +++ b/lib/igt_psr.c @@ -280,3 +280,47 @@ bool i915_psr2_selective_fetch_check(int drm_fd) return ret; } + +/** + * i915_psr2_sel_fetch_to_psr1 + * + * Check if PSR2 selective fetch is enabled, if yes switch to PSR1 and returns + * true otherwise returns false. + * This function should be called from tests that are not compatible with PSR2 + * selective fetch. + * + * Returns: + * True if PSR mode changed to PSR1, false otherwise. + */ +bool i915_psr2_sel_fetch_to_psr1(int drm_fd) +{ + int debugfs_fd; + bool ret = false; + + if (!is_i915_device(drm_fd)) + return ret; + + debugfs_fd = igt_debugfs_dir(drm_fd); + if (psr2_selective_fetch_check(debugfs_fd)) { + psr_set(drm_fd, debugfs_fd, PSR_MODE_1); + ret = true; + } + + close(debugfs_fd); + return ret; +} + +/** + * i915_psr2_sel_fetch_restore + * + * Restore PSR2 selective fetch after tests were executed, this function should + * only be called if i915_psr2_sel_fetch_to_psr1() returned true. + */ +void i915_psr2_sel_fetch_restore(int drm_fd) +{ + int debugfs_fd; + + debugfs_fd = igt_debugfs_dir(drm_fd); + psr_set(drm_fd, debugfs_fd, PSR_MODE_2_SEL_FETCH); + close(debugfs_fd); +} |