diff options
author | David Zhang <dingchen.zhang@amd.com> | 2022-03-12 00:29:09 -0500 |
---|---|---|
committer | Aurabindo Pillai <aurabindo.pillai@amd.com> | 2022-03-16 15:49:16 -0400 |
commit | bc1be26e0f31e4da9e897ed05693b9cea7e1ae83 (patch) | |
tree | befa8c0a1a15ef629905f67b362ebb84be8e455e /tests/amdgpu | |
parent | 893fc8f76bc755e1598032f11b006595bb64fc84 (diff) |
lib/igt_amd: refactor checker of debugfs interface existence
[why]
The existed amdgpu debugfs helpers to check existance/support of
connector's debugfs entry have a bunch of code redundant. Since
the generic debugfs interface checker is defined, we'd refactor
to avoid code redundancy.
[how]
- call generic helper igt_amd_output_has_debugfs() for debugfs
interface existence check for DSC, HPD, LINK SETTING, PSR CAP
etc.
- call psr state check helper for existed basic PSR test case.
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: Aurabindo Pillai <aurabindo.pillai@amd.com>
Diffstat (limited to 'tests/amdgpu')
-rw-r--r-- | tests/amdgpu/amd_psr.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/tests/amdgpu/amd_psr.c b/tests/amdgpu/amd_psr.c index 865511d0..94cafd22 100644 --- a/tests/amdgpu/amd_psr.c +++ b/tests/amdgpu/amd_psr.c @@ -35,7 +35,6 @@ */ IGT_TEST_DESCRIPTION("Basic test for enabling Panel Self Refresh for eDP displays"); -#define DEBUGFS_PSR_STATE "psr_state" /* After a full update, a few fast updates are necessary for PSR to be enabled */ #define N_FLIPS 6 /* DMCUB takes some time to actually enable PSR. Worst case delay is 4 seconds */ @@ -109,8 +108,6 @@ static int check_conn_type(data_t *data, uint32_t type) { } static void run_check_psr(data_t *data, bool test_null_crtc) { - char buf[8]; - char *connector_name; int fd, edp_idx, dp_idx, ret, i, psr_state; igt_fb_t ref_fb, ref_fb2; igt_fb_t *flip_fb; @@ -158,14 +155,7 @@ static void run_check_psr(data_t *data, bool test_null_crtc) { if (output->config.connector->connector_type != DRM_MODE_CONNECTOR_eDP) continue; - connector_name = output->name; - fd = igt_debugfs_connector_dir(data->fd, connector_name, O_RDONLY); - igt_assert(fd >= 0); - - ret = igt_debugfs_simple_read(fd, DEBUGFS_PSR_STATE, buf, sizeof(buf)); - igt_require(ret > 0); - - psr_state = (int) strtol(buf, NULL, 10); + psr_state = igt_amd_read_psr_state(data->fd, output->name); 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 " |