[PATCH i-g-t] lib/igt_drm_fdinfo: Handle amdgpu memory stats

Tvrtko Ursulin tvrtko.ursulin at igalia.com
Fri May 3 12:40:31 UTC 2024


[Correcting Christian's email]

On 03/05/2024 13:37, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
> 
> Code so far only handles the clients using the common DRM helper.
> 
> Handle the amdgpu driver which uses a slightly different set of keys. More
> specifically, outputs drm-memory-<region> instead of drm-total-<region>.
> 
> With this added gputop starts showing total memory usage for amdgpu.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Cc: Christian König <christian.keonig at amd.com>

Mea culpa, I copied the mistake from 
77d17c4cd0bf52eacfad88e63e8932eb45d643c5. :)

Regards,

Tvrtko

> Cc: Rob Clark <robdclark at chromium.org>
> Cc: Lucas De Marchi <lucas.demarchi at intel.com>
> ---
>   lib/igt_drm_fdinfo.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/lib/igt_drm_fdinfo.c b/lib/igt_drm_fdinfo.c
> index cab677df29a9..89992f1477ec 100644
> --- a/lib/igt_drm_fdinfo.c
> +++ b/lib/igt_drm_fdinfo.c
> @@ -262,6 +262,10 @@ __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
>   			idx = parse_region(l, info, strlen("drm-total-"),
>   					   region_map, region_entries, &val);
>   			UPDATE_REGION(idx, total, val);
> +		} else if (!strncmp(l, "drm-memory-", 11)) {
> +			idx = parse_region(l, info, strlen("drm-memory-"),
> +					   region_map, region_entries, &val);
> +			UPDATE_REGION(idx, total, val);
>   		} else if (!strncmp(l, "drm-shared-", 11)) {
>   			idx = parse_region(l, info, strlen("drm-shared-"),
>   					   region_map, region_entries, &val);


More information about the igt-dev mailing list