summaryrefslogtreecommitdiff
path: root/lib/igt_aux.c
diff options
context:
space:
mode:
authorRiana Tauro <riana.tauro@intel.com>2022-08-10 15:10:27 +0530
committerRodrigo Vivi <rodrigo.vivi@intel.com>2022-08-15 12:38:34 -0400
commit13148eb3271d717c8d58b52339a24a398c4ebf59 (patch)
tree1c0a38364e94aa750442b5d8626ab7c0ec6c1a28 /lib/igt_aux.c
parentd47beef9b01595f721c584070940c95be1cf11e8 (diff)
lib/igt_aux : Skip SUSPEND_STATE_S3 if mem_sleep deep state is not supported
Forcing s3 by setting mem_sleep to deep fails if s3 is not supported by platform Skip the test by checking if s3 is not one of the supported mem_sleep states Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6531 Signed-off-by: Riana Tauro <riana.tauro@intel.com> Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'lib/igt_aux.c')
-rw-r--r--lib/igt_aux.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index d80a19350..edb53425d 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -882,6 +882,23 @@ static void set_mem_sleep(int power_dir, enum igt_mem_sleep sleep)
mem_sleep_name[sleep]));
}
+static bool is_mem_sleep_state_supported(int power_dir, enum igt_mem_sleep state)
+{
+ const char *str;
+ char *mem_sleep_states;
+
+ igt_assert((mem_sleep_states = igt_sysfs_get(power_dir, "mem_sleep")));
+
+ str = strstr(mem_sleep_states, mem_sleep_name[state]);
+
+ if (!str)
+ igt_info("mem_sleep state %s not supported.\nSupported mem_sleep states: %s\n",
+ mem_sleep_name[state], mem_sleep_states);
+
+ free(mem_sleep_states);
+ return str;
+}
+
/**
* igt_system_suspend_autoresume:
* @state: an #igt_suspend_state, the target suspend state
@@ -923,6 +940,8 @@ void igt_system_suspend_autoresume(enum igt_suspend_state state,
if (state == SUSPEND_STATE_S3) {
orig_mem_sleep = get_mem_sleep();
+ igt_skip_on_f(!is_mem_sleep_state_supported(power_dir, MEM_SLEEP_DEEP),
+ "S3 not supported in this system.\n");
set_mem_sleep(power_dir, MEM_SLEEP_DEEP);
igt_skip_on_f(get_mem_sleep() != MEM_SLEEP_DEEP,
"S3 not possible in this system.\n");