[igt-dev] [PATCH i-g-t 30/31] tools/perf: Choose the right card

Umesh Nerlige Ramappa umesh.nerlige.ramappa at intel.com
Wed Feb 15 00:46:47 UTC 2023


Choose the right dri card to open for perf recorder.

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
---
 tools/i915-perf/i915_perf_recorder.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/tools/i915-perf/i915_perf_recorder.c b/tools/i915-perf/i915_perf_recorder.c
index ee8a288d..9337da12 100644
--- a/tools/i915-perf/i915_perf_recorder.c
+++ b/tools/i915-perf/i915_perf_recorder.c
@@ -241,10 +241,10 @@ read_device_param(const char *stem, int id, const char *param)
 }
 
 static int
-find_intel_render_node(void)
+find_intel_card_node(void)
 {
-	for (int i = 128; i < (128 + 16); i++) {
-		if (read_device_param("renderD", i, "vendor") == 0x8086)
+	for (int i = 0; i < 128; i++) {
+		if (read_device_param("card", i, "vendor") == 0x8086)
 			return i;
 	}
 
@@ -273,20 +273,18 @@ open_render_node(uint32_t *devid, int card)
 	char *name;
 	int ret;
 	int fd;
-	int render;
 
 	if (card < 0) {
-		render = find_intel_render_node();
-		if (render < 0)
+		card = find_intel_card_node();
+
+		if (card < 0)
 			return -1;
-	} else {
-		render = 128 + card;
 	}
 
-	ret = asprintf(&name, "/dev/dri/renderD%u", render);
+	ret = asprintf(&name, "/dev/dri/card%u", card);
 	assert(ret != -1);
 
-	*devid = read_device_param("renderD", render, "device");
+	*devid = read_device_param("card", card, "device");
 
 	fd = open(name, O_RDWR);
 	free(name);
-- 
2.36.1



More information about the igt-dev mailing list