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
|
diff --git a/render/egl.c b/render/egl.c
index 8a1e6dae..d0e6adb6 100644
--- a/render/egl.c
+++ b/render/egl.c
@@ -508,8 +508,43 @@ static int open_render_node(int drm_fd) {
}
wlr_log(WLR_DEBUG, "DRM device '%s' has no render node, "
"falling back to primary node", render_name);
+
+ drmVersion *render_version = drmGetVersion(drm_fd);
+ if (render_version != NULL && render_version->name != NULL) {
+ wlr_log(WLR_DEBUG, "DRM device version.name '%s'", render_version->name);
+ if (strcmp(render_version->name, "evdi") == 0) {
+ free(render_name);
+
+ uint32_t flags = 0;
+ const int devices_len = drmGetDevices2(flags, NULL, 0);
+ if (devices_len < 0) {
+ wlr_log(WLR_ERROR, "drmGetDevices2 failed: %s", strerror(-devices_len));
+ return -1;
+ }
+
+ const char *render_devices[] = {
+ "/dev/dri/card0",
+ "/dev/dri/card1",
+ "/dev/dri/card2",
+ "/dev/dri/card3",
+ "/dev/dri/card4",
+ "/dev/dri/card5",
+ "/dev/dri/card6",
+ "/dev/dri/card7",
+ "/dev/dri/card8",
+ "/dev/dri/card9",
+ NULL
+ };
+
+ render_name = malloc(sizeof(char)*15);
+ render_name = strcpy(render_name, render_devices[env_parse_switch("WLR_EVDI_RENDER_DEVICE", render_devices)]);
+ }
+ drmFreeVersion(render_version);
+ }
}
+ wlr_log(WLR_DEBUG, "open_render_node() DRM device '%s'", render_name);
+
int render_fd = open(render_name, O_RDWR | O_CLOEXEC);
if (render_fd < 0) {
wlr_log_errno(WLR_ERROR, "Failed to open DRM node '%s'", render_name);
|