[igt-dev] [PATCH i-g-t 4/4] test/i915/i915_suspend: Use SUSPEND_STATE_S3 to enforce S3.

Anshuman Gupta anshuman.gupta at intel.com
Mon Jul 18 07:09:30 UTC 2022


On 2022-07-13 at 11:52:33 -0400, Rodrigo Vivi wrote:
> Now that we have the ability to enforce the S3, let's use it
> and avoid the extra check in the test.
> 
> Cc: Riana Tauro <riana.tauro at intel.com>
> Cc: Anshuman Gupta <anshuman.gupta at intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
LGTM.
Reviewed-by: Anshuman Gupta <anshuman.gupta at intel.com>
> ---
>  lib/igt_aux.c             | 14 +++-----------
>  lib/igt_aux.h             |  2 --
>  tests/i915/i915_suspend.c |  5 +----
>  3 files changed, 4 insertions(+), 17 deletions(-)
> 
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index 69ae9b58..268bad7c 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -841,15 +841,7 @@ static uint32_t get_supported_suspend_states(int power_dir)
>  	return state_mask;
>  }
>  
> -/**
> - * igt_get_memsleep_state
> - *
> - * Reads the value of /sys/power/mem_sleep and
> - * returns the current suspend state associated with 'mem'.
> - *
> - * Returns : an #igt_mem_sleep state, current suspend state associated with 'mem'.
> - */
> -int igt_get_memsleep_state(void)
> +static int get_mem_sleep(void)
>  {
>  	char *mem_sleep_states;
>  	char *mem_sleep_state;
> @@ -938,9 +930,9 @@ void igt_system_suspend_autoresume(enum igt_suspend_state state,
>  	orig_test = get_suspend_test(power_dir);
>  
>  	if (state == SUSPEND_STATE_S3) {
> -		orig_mem_sleep = igt_get_memsleep_state();
> +		orig_mem_sleep = get_mem_sleep();
>  		set_mem_sleep(power_dir, MEM_SLEEP_DEEP);
> -		igt_skip_on_f(igt_get_memsleep_state() != MEM_SLEEP_DEEP,
> +		igt_skip_on_f(get_mem_sleep() != MEM_SLEEP_DEEP,
>  			      "S3 not possible in this system.\n");
>  	}
>  
> diff --git a/lib/igt_aux.h b/lib/igt_aux.h
> index b1e48b0f..89437a90 100644
> --- a/lib/igt_aux.h
> +++ b/lib/igt_aux.h
> @@ -216,8 +216,6 @@ void igt_system_suspend_autoresume(enum igt_suspend_state state,
>  void igt_set_autoresume_delay(int delay_secs);
>  int igt_get_autoresume_delay(enum igt_suspend_state state);
>  
> -int igt_get_memsleep_state(void);
> -
>  /* dropping priviledges */
>  void igt_drop_root(void);
>  
> diff --git a/tests/i915/i915_suspend.c b/tests/i915/i915_suspend.c
> index 222a8e4a..94935595 100644
> --- a/tests/i915/i915_suspend.c
> +++ b/tests/i915/i915_suspend.c
> @@ -209,9 +209,6 @@ test_suspend_without_i915(int state)
>  	igt_kmsg(KMSG_INFO "Unloading i915\n");
>  	igt_assert_eq(igt_i915_driver_unload(),0);
>  
> -	igt_skip_on_f(igt_get_memsleep_state() == MEM_SLEEP_S2IDLE &&
> -		      state == SUSPEND_STATE_MEM,
> -		      "S3 not possible: platform default mem_sleep state is s2idle\n");
>  	igt_system_suspend_autoresume(state, SUSPEND_TEST_NONE);
>  
>  	igt_kmsg(KMSG_INFO "Re-loading i915 \n");
> @@ -228,7 +225,7 @@ igt_main
>  
>  	igt_describe("Validate S3 without i915 module");
>  	igt_subtest("basic-s3-without-i915")
> -		test_suspend_without_i915(SUSPEND_STATE_MEM);
> +		test_suspend_without_i915(SUSPEND_STATE_S3);
>  
>  	igt_fixture
>  		fd = drm_open_driver(DRIVER_INTEL);
> -- 
> 2.35.3
> 


More information about the igt-dev mailing list