[Intel-gfx] [PATCH igt 1/2] lib: Skip unsupported suspend-test modes
Chris Wilson
chris at chris-wilson.co.uk
Mon Oct 16 11:02:31 UTC 2017
Read the available set of suspend pm_tests and skip the suspend request
if the test mode is not available.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
lib/igt_aux.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index ee53559c..1f934ba9 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -841,6 +841,28 @@ static uint32_t get_supported_suspend_states(int power_dir)
return state_mask;
}
+static uint32_t get_supported_suspend_tests(int power_dir)
+{
+ uint32_t supported = 0;
+ char *tests;
+
+ tests = igt_sysfs_get(power_dir, "pm_test");
+ igt_assert(tests);
+
+ for (enum igt_suspend_test t = SUSPEND_TEST_NONE;
+ t < SUSPEND_TEST_NUM;
+ t++) {
+ if (strstr(tests, suspend_test_name[t])) {
+ supported |= 1 << t;
+ break;
+ }
+ }
+
+ free(tests);
+
+ return supported;
+}
+
/**
* igt_system_suspend_autoresume:
* @state: an #igt_suspend_state, the target suspend state
@@ -876,7 +898,7 @@ void igt_system_suspend_autoresume(enum igt_suspend_state state,
igt_require((power_dir = open("/sys/power", O_RDONLY)) >= 0);
igt_require(get_supported_suspend_states(power_dir) & (1 << state));
igt_require(test == SUSPEND_TEST_NONE ||
- faccessat(power_dir, "pm_test", R_OK | W_OK, 0) == 0);
+ get_supported_suspend_tests(power_dir) & (1 << test));
orig_test = get_suspend_test(power_dir);
set_suspend_test(power_dir, test);
--
2.15.0.rc0
More information about the Intel-gfx
mailing list