From: Alex Hung <alex.hung@amd.com>
To: Aurabindo Pillai <aurabindo.pillai@amd.com>,
igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH v3 1/2] lib/amdgpu: Add helper functions to return MALL support
Date: Tue, 8 Aug 2023 14:33:19 -0600 [thread overview]
Message-ID: <7d6c8d73-cc6b-baa9-2100-e374c0f68fbc@amd.com> (raw)
In-Reply-To: <20230808152419.1454608-1-aurabindo.pillai@amd.com>
Reviewed-by: Alex Hung <alex.hung@amd.com>
On 2023-08-08 09:24, Aurabindo Pillai wrote:
> Reads the debugfs file exposed by AMDGPU DM that can be used to find out
> whether the hardware supports certain features, like MALL (Memory access
> at last level)
>
> Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
> ---
> lib/igt_amd.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++
> lib/igt_amd.h | 3 +++
> 2 files changed, 55 insertions(+)
>
> diff --git a/lib/igt_amd.c b/lib/igt_amd.c
> index 8da405649..a4dba6bad 100644
> --- a/lib/igt_amd.c
> +++ b/lib/igt_amd.c
> @@ -1144,6 +1144,57 @@ void igt_amd_allow_edp_hotplug_detect(int drm_fd, char *connector_name, bool ena
> close(hpd_fd);
> }
>
> +static bool get_dm_capabilites(int drm_fd, char *buf, size_t size) {
> + int ret, fd;
> + bool has_capablities = amd_has_debugfs(drm_fd, DEBUGFS_DM_CAPABILITIES);
> +
> + if (!has_capablities)
> + return false;
> +
> + fd = igt_debugfs_dir(drm_fd);
> + if (fd < 0) {
> + igt_warn("Couldn't open debugfs directory\n");
> + return -1;
> + }
> +
> + ret = igt_debugfs_simple_read(fd, DEBUGFS_DM_CAPABILITIES, buf, (int) size);
> + igt_assert_f(ret >= 0, "Reading %s failed.\n", DEBUGFS_DM_CAPABILITIES);
> +
> + close(fd);
> +
> + if (ret < 0)
> + return false;
> +
> + return true;
> +}
> +
> +/**
> + * @brief check if AMDGPU mall_capable interface entry exist and defined
> + *
> + * @param drm_fd DRM file descriptor
> + * @return true if mall_capable debugfs interface exists and defined
> + * @return false otherwise
> + */
> +bool igt_amd_is_mall_capable(int drm_fd)
> +{
> + char buf[1024], mall_read[10];
> + char *mall_loc;
> +
> + if (!get_dm_capabilites(drm_fd, buf, 1024))
> + return false;
> +
> + mall_loc = strstr(buf,"mall: ");
> + if (!mall_loc)
> + return false;
> +
> + sscanf(mall_loc, "mall: %s", mall_read);
> +
> + if (!strcmp(mall_read, "yes"))
> + return true;
> +
> + return false;
> +}
> +
> /**
> * @brief check if AMDGPU DM visual confirm debugfs interface entry exist and defined
> *
> @@ -1156,6 +1207,7 @@ bool igt_amd_has_visual_confirm(int drm_fd)
> return amd_has_debugfs(drm_fd, DEBUGFS_DM_VISUAL_CONFIRM);
> }
>
> +
> /**
> * @brief Read amdgpu DM visual confirm debugfs interface
> *
> diff --git a/lib/igt_amd.h b/lib/igt_amd.h
> index d57390405..6f538a195 100644
> --- a/lib/igt_amd.h
> +++ b/lib/igt_amd.h
> @@ -52,6 +52,7 @@
>
> /* amdgpu DM interface entries */
> #define DEBUGFS_DM_VISUAL_CONFIRM "amdgpu_dm_visual_confirm"
> +#define DEBUGFS_DM_CAPABILITIES "amdgpu_dm_capabilities"
>
> enum amd_dsc_clock_force {
> DSC_AUTOMATIC = 0,
> @@ -194,4 +195,6 @@ void igt_amd_allow_edp_hotplug_detect(int drm_fd, char *connector_name, bool ena
> bool igt_amd_has_visual_confirm(int drm_fd);
> int igt_amd_get_visual_confirm(int drm_fd);
> bool igt_amd_set_visual_confirm(int drm_fd, enum amdgpu_debug_visual_confirm option);
> +
> +bool igt_amd_is_mall_capable(int drm_fd);
> #endif /* IGT_AMD_H */
next prev parent reply other threads:[~2023-08-08 20:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-08 15:24 [igt-dev] [PATCH v3 1/2] lib/amdgpu: Add helper functions to return MALL support Aurabindo Pillai
2023-08-08 15:24 ` [igt-dev] [PATCH v3 2/2] tests/amdgpu: Add test for MALL static screen cache scanout Aurabindo Pillai
2023-08-08 20:34 ` Alex Hung
2023-08-08 17:42 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [v3,1/2] lib/amdgpu: Add helper functions to return MALL support Patchwork
2023-08-08 20:33 ` Alex Hung [this message]
2023-08-08 22:20 ` [igt-dev] ○ CI.xeBAT: info " Patchwork
2023-08-09 3:41 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7d6c8d73-cc6b-baa9-2100-e374c0f68fbc@amd.com \
--to=alex.hung@amd.com \
--cc=aurabindo.pillai@amd.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox