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

David Zhang dingchen.zhang at amd.com
Wed Apr 6 20:28:28 UTC 2022


[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



More information about the igt-dev mailing list