Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tursulin@igalia.com>
To: igt-dev@lists.freedesktop.org
Cc: "Tvrtko Ursulin" <tvrtko.ursulin@igalia.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.keonig@amd.com>,
	"Rob Clark" <robdclark@chromium.org>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t] lib/igt_drm_fdinfo: Handle amdgpu memory stats
Date: Fri,  3 May 2024 13:37:31 +0100	[thread overview]
Message-ID: <20240503123731.9509-1-tursulin@igalia.com> (raw)

From: Tvrtko Ursulin <tvrtko.ursulin@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@igalia.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.keonig@amd.com>
Cc: Rob Clark <robdclark@chromium.org>
Cc: Lucas De Marchi <lucas.demarchi@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);
-- 
2.44.0


             reply	other threads:[~2024-05-03 12:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-03 12:37 Tvrtko Ursulin [this message]
2024-05-03 12:40 ` [PATCH i-g-t] lib/igt_drm_fdinfo: Handle amdgpu memory stats Tvrtko Ursulin
2024-05-03 13:32 ` Lucas De Marchi
2024-05-03 13:53   ` Tvrtko Ursulin
2024-05-03 13:59     ` Lucas De Marchi
2024-05-03 15:54 ` ✓ Fi.CI.BAT: success for " Patchwork
2024-05-03 16:29 ` ✓ CI.xeBAT: " Patchwork
2024-05-03 19:14 ` ✗ CI.xeFULL: failure " Patchwork
2024-05-04  3:00 ` ✗ Fi.CI.IGT: " 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=20240503123731.9509-1-tursulin@igalia.com \
    --to=tursulin@igalia.com \
    --cc=alexander.deucher@amd.com \
    --cc=christian.keonig@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=robdclark@chromium.org \
    --cc=tvrtko.ursulin@igalia.com \
    /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