Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gyeyoung Baek <gye976@gmail.com>
To: igt-dev@lists.freedesktop.org
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Subject: [PATCH i-g-t 2/3] lib/igt_drm_clients: Also scan accel device nodes
Date: Sat, 21 Nov 2026 18:41:56 +0900	[thread overview]
Message-ID: <20261121094225.628262-3-gye976@gmail.com> (raw)
In-Reply-To: <20261121094225.628262-1-gye976@gmail.com>

Scan accel nodes (major 261) for clients in addition to DRM nodes
(major 226).

Accel drivers print the same drm-usage-stats fdinfo through
drm_show_fdinfo() in the DRM core, so the existing fdinfo parsing works
as is.

Signed-off-by: Gyeyoung Baek <gye976@gmail.com>
---
 lib/igt_drm_clients.c | 15 ++++++++++-----
 lib/igt_drm_clients.h |  2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/lib/igt_drm_clients.c b/lib/igt_drm_clients.c
index 0b515c5aa..4ab49a6b5 100644
--- a/lib/igt_drm_clients.c
+++ b/lib/igt_drm_clients.c
@@ -428,15 +428,20 @@ static bool is_drm_fd(int fd_dir, const char *name, dev_t *rdev)
 	int ret;
 
 	ret = fstatat(fd_dir, name, &stat, 0);
+	if (ret)
+		return false;
 
-	if (ret == 0 &&
-	    (stat.st_mode & S_IFMT) == S_IFCHR &&
-	    major(stat.st_rdev) == 226) {
+	if ((stat.st_mode & S_IFMT) != S_IFCHR)
+		return false;
+
+	switch (major(stat.st_rdev)) {
+	case 226: /* DRM */
+	case 261: /* accel */
 		*rdev = stat.st_rdev;
 		return true;
+	default:
+		return false;
 	}
-
-	return false;
 }
 
 static void clients_update_max_lengths(struct igt_drm_clients *clients)
diff --git a/lib/igt_drm_clients.h b/lib/igt_drm_clients.h
index 288f58b89..f2a7bab97 100644
--- a/lib/igt_drm_clients.h
+++ b/lib/igt_drm_clients.h
@@ -64,7 +64,7 @@ struct igt_drm_client {
 	struct igt_drm_client_regions *regions; /* Memory regions present in this client, to map with memory usage. */
 	struct igt_drm_client_engines *engines; /* Engines used by this client, to map with busynees data. */
 	unsigned long id; /* DRM client id from fdinfo. */
-	dev_t rdev; /* Device number of the DRM node this client fd refers to. */
+	dev_t rdev; /* Device number of the DRM or accel node this client fd refers to. */
 	unsigned int pid; /* PID which has this DRM fd open. */
 	char pid_str[10]; /* Cached PID representation. */
 	char name[24]; /* Process name of the owning PID. */
-- 
2.43.0


  parent reply	other threads:[~2026-11-21  9:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21  9:41 [PATCH i-g-t 0/3] gputop: Support accel devices Gyeyoung Baek
2026-11-21  9:41 ` [PATCH i-g-t 1/3] lib/igt_drm_clients: Track clients by dev_t instead of DRM minor Gyeyoung Baek
2026-11-21  9:41 ` Gyeyoung Baek [this message]
2026-11-21  9:41 ` [PATCH i-g-t 3/3] tools/gputop: Show device node and driver name in client header Gyeyoung Baek

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=20261121094225.628262-3-gye976@gmail.com \
    --to=gye976@gmail.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --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