Commit b91b915c authored by Dhinakaran Pandiyan's avatar Dhinakaran Pandiyan

tests/psr: Wait for PSR exit

PSR appears to not exit immediately after the test commits a page flip,
give some leeway for PSR to idle. Let's set the timeout at 40 ms with a
5 ms interval between each status read.
Signed-off-by: Dhinakaran Pandiyan's avatarDhinakaran Pandiyan <>
Reviewed-by: José Roberto de Souza's avatarJosé Roberto de Souza <>
parent bdc89893
......@@ -25,7 +25,7 @@
#include "igt_sysfs.h"
#include <errno.h>
bool psr_active(int debugfs_fd, bool check_active)
static bool psr_active(int debugfs_fd, bool check_active)
bool active;
char buf[512];
......@@ -42,6 +42,11 @@ bool psr_wait_entry(int debugfs_fd)
return igt_wait(psr_active(debugfs_fd, true), 500, 1);
bool psr_wait_exit(int debugfs_fd)
return igt_wait(psr_active(debugfs_fd, false), 40, 10);
static ssize_t psr_write(int debugfs_fd, const char *buf)
return igt_sysfs_write(debugfs_fd, "i915_edp_psr_debug", buf,
......@@ -29,7 +29,7 @@
#include "igt_aux.h"
bool psr_wait_entry(int debugfs_fd);
bool psr_active(int debugfs_fd, bool check_active);
bool psr_wait_exit(int debugfs_fd);
bool psr_enable(int debugfs_fd);
bool psr_disable(int debugfs_fd);
......@@ -1634,8 +1634,7 @@ static void do_status_assertions(int flags)
"PSR still disabled\n");
else if (flags & ASSERT_PSR_DISABLED)
igt_assert_f(psr_active(drm.debugfs, false),
"PSR still enabled\n");
igt_assert_f(psr_wait_exit(drm.debugfs), "PSR still enabled\n");
static void __do_assertions(const struct test_mode *t, int flags,
......@@ -294,7 +294,7 @@ static void run_test(data_t *data)
expected = "screen GREEN";
igt_assert(psr_active(data->debugfs_fd, false));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment