[igt-dev] [PATCH 1/2] tests/amdgpu/amd_psr: use PSR state enum replace the integer

Pillai, Aurabindo Aurabindo.Pillai at amd.com
Wed Apr 6 20:38:12 UTC 2022


[AMD Official Use Only]

Reviewed-by: Aurabindo Pillai <aurabindo.pillai at amd.com>

--

Regards,
Jay
________________________________
From: Zhang, Dingchen (David) <Dingchen.Zhang at amd.com>
Sent: Wednesday, April 6, 2022 4:28 PM
To: igt-dev at lists.freedesktop.org <igt-dev at lists.freedesktop.org>
Cc: Siqueira, Rodrigo <Rodrigo.Siqueira at amd.com>; Wentland, Harry <Harry.Wentland at amd.com>; Li, Sun peng (Leo) <Sunpeng.Li at amd.com>; Pillai, Aurabindo <Aurabindo.Pillai at amd.com>; Lin, Wayne <Wayne.Lin at amd.com>
Subject: [PATCH 1/2] tests/amdgpu/amd_psr: use PSR state enum replace the integer

[why & how]
The enum of AMDGPU PSR STATE may update along the time and should
be aligned to the code base of upstream. Instead of using hard-
coded integer, replace them with enum PSR_STATE would be preferred
and we only need to update the PSR_STATE enum if needed in the
future.

Cc: Rodrigo Siqueira <rodrigo.siqueira at amd.com>
Cc: Harry Wentland <harry.wentland at amd.com>
Cc: Leo Li <sunpeng.li at amd.com>
Cc: Jay Pillai <aurabindo.pillai at amd.com>
Cc: Wayne Lin <wayne.lin at amd.com>

Signed-off-by: David Zhang <dingchen.zhang at amd.com>
---
 tests/amdgpu/amd_psr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/amdgpu/amd_psr.c b/tests/amdgpu/amd_psr.c
index d21d41e3..83e44c4e 100644
--- a/tests/amdgpu/amd_psr.c
+++ b/tests/amdgpu/amd_psr.c
@@ -179,10 +179,10 @@ static void run_check_psr(data_t *data, bool test_null_crtc) {
                         continue;

                 psr_state =  igt_amd_read_psr_state(data->fd, output->name);
-               igt_fail_on_f(psr_state < 0, "Open PSR state debugfs failed\n");
-               igt_fail_on_f(psr_state < 1, "PSR was not enabled for connector %s\n", output->name);
-               igt_fail_on_f(psr_state == 0xff, "PSR is invalid for connector %s\n", output->name);
-               igt_fail_on_f(psr_state != 5, "PSR state is expected to be at 5 on a "
+               igt_fail_on_f(psr_state < PSR_STATE0, "Open PSR state debugfs failed\n");
+               igt_fail_on_f(psr_state < PSR_STATE1, "PSR was not enabled for connector %s\n", output->name);
+               igt_fail_on_f(psr_state == PSR_STATE_INVALID, "PSR is invalid for connector %s\n", output->name);
+               igt_fail_on_f(psr_state != PSR_STATE3, "PSR state is expected to be at PSR_STATE3 (Active) on a "
                               "static screen for connector %s\n", output->name);
         }

--
2.25.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20220406/4f50a3ba/attachment-0001.htm>


More information about the igt-dev mailing list