public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: [igt-dev] [PATCH i-g-t 4/8] lib/igt_drm_clients: Support multiple DRM cards
Date: Tue, 31 Jan 2023 11:32:33 +0000	[thread overview]
Message-ID: <20230131113237.3707217-5-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20230131113237.3707217-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Require DRM minor match during client lookup.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 lib/igt_drm_clients.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/igt_drm_clients.c b/lib/igt_drm_clients.c
index c23a3fae9793..e11c8b18188f 100644
--- a/lib/igt_drm_clients.c
+++ b/lib/igt_drm_clients.c
@@ -49,7 +49,7 @@ struct igt_drm_clients *igt_drm_clients_init(void *private_data)
 static struct igt_drm_client *
 igt_drm_clients_find(struct igt_drm_clients *clients,
 		     enum igt_drm_client_status status,
-		     unsigned int id)
+		     unsigned int drm_minor, unsigned int id)
 {
 	unsigned int start, num;
 	struct igt_drm_client *c;
@@ -61,7 +61,8 @@ igt_drm_clients_find(struct igt_drm_clients *clients,
 		if (status != c->status)
 			continue;
 
-		if (status == IGT_DRM_CLIENT_FREE || c->id == id)
+		if (status == IGT_DRM_CLIENT_FREE ||
+		    (drm_minor == c->drm_minor && c->id == id))
 			return c;
 	}
 
@@ -119,9 +120,10 @@ igt_drm_client_add(struct igt_drm_clients *clients,
 {
 	struct igt_drm_client *c;
 
-	assert(!igt_drm_clients_find(clients, IGT_DRM_CLIENT_ALIVE, info->id));
+	assert(!igt_drm_clients_find(clients, IGT_DRM_CLIENT_ALIVE,
+				     drm_minor, info->id));
 
-	c = igt_drm_clients_find(clients, IGT_DRM_CLIENT_FREE, 0);
+	c = igt_drm_clients_find(clients, IGT_DRM_CLIENT_FREE, 0, 0);
 	if (!c) {
 		unsigned int idx = clients->num_clients;
 
@@ -411,11 +413,11 @@ igt_drm_clients_scan(struct igt_drm_clients *clients,
 				continue;
 
 			if (igt_drm_clients_find(clients, IGT_DRM_CLIENT_ALIVE,
-						info.id))
+						 minor, info.id))
 				continue; /* Skip duplicate fds. */
 
 			c = igt_drm_clients_find(clients, IGT_DRM_CLIENT_PROBE,
-						info.id);
+						 minor, info.id);
 			if (!c)
 				igt_drm_client_add(clients, &info, client_pid,
 						   client_name, minor);
-- 
2.34.1

  parent reply	other threads:[~2023-01-31 11:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31 11:32 [igt-dev] [PATCH i-g-t v3 0/8] Vendor agnostic gputop Tvrtko Ursulin
2023-01-31 11:32 ` [igt-dev] [PATCH i-g-t 1/8] lib: Extract igt_drm_clients from intel_gpu_top Tvrtko Ursulin
2023-01-31 11:32 ` [igt-dev] [PATCH i-g-t 2/8] lib: Allow specifying custom engine map Tvrtko Ursulin
2023-01-31 11:32 ` [igt-dev] [PATCH i-g-t 3/8] lib/igt_drm_clients: Record client drm minor Tvrtko Ursulin
2023-01-31 11:32 ` Tvrtko Ursulin [this message]
2023-01-31 11:32 ` [igt-dev] [PATCH i-g-t 5/8] lib/igt_drm_fdinfo: Track largest engine index Tvrtko Ursulin
2023-01-31 11:32 ` [igt-dev] [PATCH i-g-t 6/8] lib/igt_drm_clients: Decouple hardcoded engine assumptions Tvrtko Ursulin
2023-01-31 11:32 ` [igt-dev] [PATCH i-g-t 7/8] lib/igt_drm_clients: Enforce client status sort order in the library Tvrtko Ursulin
2023-01-31 11:32 ` [igt-dev] [PATCH i-g-t 8/8] gputop: Basic vendor agnostic GPU top tool Tvrtko Ursulin
2023-02-03 16:42   ` Kamil Konieczny
2023-02-06  9:19     ` Tvrtko Ursulin
2023-02-06 14:04       ` Kamil Konieczny
2023-04-05 17:57   ` Rob Clark
2023-04-06 11:08     ` Tvrtko Ursulin
2023-04-06 14:21       ` Rob Clark
2023-04-06 14:31         ` Tvrtko Ursulin
2023-05-12 14:18           ` Rob Clark
2023-05-15 11:10             ` Tvrtko Ursulin
2023-01-31 12:14 ` [igt-dev] ✓ Fi.CI.BAT: success for Vendor agnostic gputop (rev5) Patchwork
2023-01-31 15:55 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-04-06 14:15 [igt-dev] [PATCH i-g-t v4 0/8] Vendor agnostic gputop Tvrtko Ursulin
2023-04-06 14:15 ` [igt-dev] [PATCH i-g-t 4/8] lib/igt_drm_clients: Support multiple DRM cards Tvrtko Ursulin
2023-04-17 10:57 [igt-dev] [PATCH i-g-t v5 0/8] Vendor agnostic gputop Tvrtko Ursulin
2023-04-17 10:57 ` [igt-dev] [PATCH i-g-t 4/8] lib/igt_drm_clients: Support multiple DRM cards Tvrtko Ursulin

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=20230131113237.3707217-5-tvrtko.ursulin@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=tvrtko.ursulin@intel.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