[igt-dev] [PATCH i-g-t 3/4] tests/kms_psr_sink_crc: Test PSR source HW status before PSR entry.
Rodrigo Vivi
rodrigo.vivi at intel.com
Thu Jul 12 23:20:45 UTC 2018
On Thu, Jul 12, 2018 at 01:09:42AM -0700, Dhinakaran Pandiyan wrote:
> Wait for PSR HW status to show active before starting an PSR exit action.
>
> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
> ---
> tests/kms_psr_sink_crc.c | 27 +++++++++------------------
> 1 file changed, 9 insertions(+), 18 deletions(-)
>
> diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
> index 4a18609a..4eca51da 100644
> --- a/tests/kms_psr_sink_crc.c
> +++ b/tests/kms_psr_sink_crc.c
> @@ -197,33 +197,24 @@ static bool sink_support(data_t *data)
> strstr(buf, "Sink_Support: yes\n");
> }
>
> -static bool psr_enabled(data_t *data)
> +static bool psr_active(data_t *data, bool check_active)
> {
> + bool active;
> char buf[512];
>
> igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf);
>
> - return data->with_psr_disabled ||
> - strstr(buf, "HW Enabled & Active bit: yes\n");
> + active = strstr(buf, "HW Enabled & Active bit: yes\n") &&
> + (strstr(buf, "SRDENT") || strstr(buf, "SLEEP"));
> + return check_active ? active : !active;
> }
>
> static bool wait_psr_entry(data_t *data)
> {
> - int timeout = 5;
> - while (timeout--) {
> - if (psr_enabled(data))
> - return true;
> - sleep(1);
> - }
> - return false;
> -}
> + if (data->with_psr_disabled)
> + return true;
>
> -static bool psr_inactive(data_t *data)
> -{
> - char buf[512];
> -
> - igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf);
> - return !(strstr(buf, "SRDENT") || strstr("SLEEP"));
> + return igt_wait((psr_active(data, true)), 500, 1);
> }
>
> static inline void manual(const char *expected)
> @@ -312,7 +303,7 @@ static void run_test(data_t *data)
> expected = "screen GREEN";
> break;
> }
> - assert(psr_inactive(data));
> + igt_assert(psr_active(data, false));
> manual(expected);
> }
>
> --
> 2.14.1
>
More information about the igt-dev
mailing list