summaryrefslogtreecommitdiff
path: root/tests/amdgpu
diff options
context:
space:
mode:
authorDavid Zhang <dingchen.zhang@amd.com>2022-04-06 15:14:59 -0400
committerRodrigo Siqueira <Rodrigo.Siqueira@amd.com>2022-04-06 17:25:50 -0400
commit7a1456b87a3f089e1c211974ce9e9fdd5172f3ac (patch)
tree27178031b84eb6ab6578a14c993ecbe85b938837 /tests/amdgpu
parentb4d8d30a4ec8dae5c1c403f41348c073a9591d9f (diff)
lib/igt_amd: return negative if PSR state debugfs open fails
[why & how] The PSR state read helper should return an integer which is not the same as PSR state enumeration item for the case of debugfs interface opening fail. Currently it return false which is casted to 0 that is the same as PSR_STATE0, this is incorrect. Instead of returning 0, a negative (e.g. -1) value is returned when debugfs interface of PSR state opening fails. And adding the check of such negative value in amd_psr test case as well. Cc: Rodrigo Siqueira <rodrigo.siqueira@amd.com> Cc: Harry Wentland <harry.wentland@amd.com> Cc: Leo Li <sunpeng.li@amd.com> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com> Cc: Wayne Lin <wayne.lin@amd.com> Signed-off-by: David Zhang <dingchen.zhang@amd.com> Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Diffstat (limited to 'tests/amdgpu')
-rw-r--r--tests/amdgpu/amd_psr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/amdgpu/amd_psr.c b/tests/amdgpu/amd_psr.c
index b9d8a53b..d21d41e3 100644
--- a/tests/amdgpu/amd_psr.c
+++ b/tests/amdgpu/amd_psr.c
@@ -179,6 +179,7 @@ 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 "
@@ -295,6 +296,7 @@ static void run_check_psr_su_mpo(data_t *data)
/* check PSR state */
if (i > PSR_SETTLE_DELAY * frame_rate) {
psr_state = igt_amd_read_psr_state(data->fd, data->output->name);
+ igt_fail_on_f(psr_state < 0, "Open PSR state debugfs failed\n");
igt_fail_on_f(psr_state == PSR_STATE0,
"PSR was not enabled for connector %s\n", data->output->name);
igt_fail_on_f(psr_state == PSR_STATE_INVALID,