summaryrefslogtreecommitdiff
path: root/recipes-graphics/wayland/files/0004-use-name-based-detection-of-display-and-render-nodes.patch
blob: a5969ab3a8f2f19bd5acc3889c0a32cea4f8f374 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
From 6c8d3da72fabd2a915e18dbf9fb65b7c1134d65d Mon Sep 17 00:00:00 2001
From: Alexandre Courbot <acourbot@nvidia.com>
Date: Fri, 9 Sep 2016 15:06:27 +0900
Subject: [PATCH 4/6] use name-based detection of display and render nodes

The previous detection scheme assumed that the graphics nodes were under
"soc0". This is no longer true for Jetson TX1. Instead, assume that
card0 is the display node, and card1 the render one.
---
 src/compositor-drm.c | 39 ++++++++-------------------------------
 1 file changed, 8 insertions(+), 31 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 17ba640..214fc41 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -2871,7 +2871,7 @@ find_primary_gpu(struct drm_backend *b, const char *seat)
 	struct udev_enumerate *e;
 	struct udev_list_entry *entry;
 	const char *path, *device_seat, *id;
-	struct udev_device *device, *drm_device, *pci, *soc = NULL;
+	struct udev_device *device, *drm_device, *pci;
 
 	e = udev_enumerate_new(b->udev);
 	udev_enumerate_add_match_subsystem(e, "drm");
@@ -2904,37 +2904,14 @@ find_primary_gpu(struct drm_backend *b, const char *seat)
 				break;
 			}
 		} else {
-			soc = udev_device_get_parent_with_subsystem_devtype(
-									device,
-									"soc",
-									NULL);
-			if (soc) {
-				id = udev_device_get_sysattr_value(soc,
-								"family");
-				if (id && !strcmp(id, "Tegra")) {
-					if (drm_device) {
-						/* Previously have found the
-						 * drm device, use this device
-						 * as the GBM device
-						 */
-						if (udev_device_get_devnode(
-								device)) {
-							b->gbm.filename = strdup(
-								udev_device_get_devnode(device));
-							break;
-						}
-						continue;
-					}
-					drm_device = device;
-					continue;
-				}
-			}
+			id = udev_device_get_sysname(device);
+			if (!strcmp(id, "card0"))
+				drm_device = device;
+			else if (!strcmp(id, "card1"))
+				b->gbm.filename = strdup(udev_device_get_devnode(device));
+			else
+				udev_device_unref(device);
 		}
-
-		if (!drm_device)
-			drm_device = device;
-		else
-			udev_device_unref(device);
 	}
 
 	udev_enumerate_unref(e);
-- 
2.9.3