[PATCH i-g-t] lib/igt_drm_fdinfo: Handle (somewhat) amdgpu memory stats
Tvrtko Ursulin
tursulin at igalia.com
Wed Sep 4 15:59:19 UTC 2024
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-resident-<region>.
With this added gputop starts showing resident memory usage for amdgpu.
v2:
* Semantics of amdgpu drm-memory- are like resident, not total.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
Cc: Alex Deucher <alexander.deucher at amd.com>
Cc: Christian König <christian.koenig at amd.com>
Cc: Rob Clark <robdclark at chromium.org>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com> # v1
---
lib/igt_drm_fdinfo.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/igt_drm_fdinfo.c b/lib/igt_drm_fdinfo.c
index 539d15056117..74a90c437880 100644
--- a/lib/igt_drm_fdinfo.c
+++ b/lib/igt_drm_fdinfo.c
@@ -281,6 +281,11 @@ __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
idx = parse_region(l + keylen, info,
region_map, region_entries, &val);
UPDATE_REGION(idx, resident, val);
+ } else if (strstartswith(l, "drm-memory-", &keylen)) {
+ /* amdgpu legacy key */
+ idx = parse_region(l + keylen, info,
+ region_map, region_entries, &val);
+ UPDATE_REGION(idx, resident, val);
} else if (strstartswith(l, "drm-purgeable-", &keylen)) {
idx = parse_region(l + keylen, info,
region_map, region_entries, &val);
--
2.44.0
More information about the igt-dev
mailing list