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 /lib | |
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 'lib')
-rw-r--r-- | lib/igt_amd.c | 100 |
1 files changed, 5 insertions, 95 deletions
diff --git a/lib/igt_amd.c b/lib/igt_amd.c index 59e503a2..888da44a 100644 --- a/lib/igt_amd.c +++ b/lib/igt_amd.c @@ -289,25 +289,7 @@ static bool igt_amd_output_has_debugfs(int drm_fd, char *connector_name, const c */ static bool igt_amd_output_has_dsc(int drm_fd, char *connector_name) { - int fd; - int res; - struct stat stat; - - fd = igt_debugfs_connector_dir(drm_fd, connector_name, O_RDONLY); - if (fd < 0) { - igt_info("output %s: debugfs not found\n", connector_name); - return false; - } - - res = fstatat(fd, DEBUGFS_DSC_CLOCK_EN , &stat, 0); - if (res != 0) { - igt_info("%s debugfs not supported\n", DEBUGFS_DSC_CLOCK_EN); - close(fd); - return false; - } - - close(fd); - return true; + return igt_amd_output_has_debugfs(drm_fd, connector_name, DEBUGFS_DSC_CLOCK_EN); } /** @@ -739,25 +721,7 @@ int igt_amd_read_dsc_param_slice_bpg(int drm_fd, char *connector_name) */ static bool igt_amd_output_has_hpd(int drm_fd, char *connector_name) { - int fd; - int res; - struct stat stat; - - fd = igt_debugfs_connector_dir(drm_fd, connector_name, O_RDONLY); - if (fd < 0) { - igt_info("output %s: debugfs not found\n", connector_name); - return false; - } - - res = fstatat(fd, DEBUGFS_HPD_TRIGGER, &stat, 0); - if (res != 0) { - igt_info("%s debugfs not supported\n", DEBUGFS_HPD_TRIGGER); - close(fd); - return false; - } - - close(fd); - return true; + return igt_amd_output_has_debugfs(drm_fd, connector_name, DEBUGFS_HPD_TRIGGER); } /** @@ -904,25 +868,7 @@ void igt_amd_write_link_settings( */ bool igt_amd_output_has_link_settings(int drm_fd, char *connector_name) { - int fd; - int res; - struct stat stat; - - fd = igt_debugfs_connector_dir(drm_fd, connector_name, O_RDONLY); - if (fd < 0) { - igt_info("output %s: debugfs not found\n", connector_name); - return false; - } - - res = fstatat(fd, DEBUGFS_DP_LINK_SETTINGS, &stat, 0); - if (res != 0) { - igt_info("output %s: %s debugfs not supported\n", connector_name, DEBUGFS_DP_LINK_SETTINGS); - close(fd); - return false; - } - - close(fd); - return true; + return igt_amd_output_has_debugfs(drm_fd, connector_name, DEBUGFS_DP_LINK_SETTINGS); } /* @@ -1016,25 +962,7 @@ void igt_amd_write_ilr_setting( */ bool igt_amd_output_has_ilr_setting(int drm_fd, char *connector_name) { - int fd; - int res; - struct stat stat; - - fd = igt_debugfs_connector_dir(drm_fd, connector_name, O_RDONLY); - if (fd < 0) { - igt_info("output %s: debugfs not found\n", connector_name); - return false; - } - - res = fstatat(fd, DEBUGFS_EDP_ILR_SETTING, &stat, 0); - if (res != 0) { - igt_info("output %s: %s debugfs not supported\n", connector_name, DEBUGFS_EDP_ILR_SETTING); - close(fd); - return false; - } - - close(fd); - return true; + return igt_amd_output_has_debugfs(drm_fd, connector_name, DEBUGFS_EDP_ILR_SETTING); } /** @@ -1044,25 +972,7 @@ bool igt_amd_output_has_ilr_setting(int drm_fd, char *connector_name) */ bool igt_amd_output_has_psr_cap(int drm_fd, char *connector_name) { - int fd; - int res; - struct stat stat; - - fd = igt_debugfs_connector_dir(drm_fd, connector_name, O_RDONLY); - if (fd < 0) { - igt_info("output %s: debugfs not found\n", connector_name); - return false; - } - - res = fstatat(fd, DEBUGFS_EDP_PSR_CAP, &stat, 0); - if (res != 0) { - igt_info("output %s: %s debugfs not supported\n", connector_name, DEBUGFS_EDP_PSR_CAP); - close(fd); - return false; - } - - close(fd); - return true; + return igt_amd_output_has_debugfs(drm_fd, connector_name, DEBUGFS_EDP_PSR_CAP); } /** |