hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
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
From 601b1b459d937aa219e671bb99734a04d55bc553 Mon Sep 17 00:00:00 2001
From: Jeffy Chen <jeffy.chen@rock-chips.com>
Date: Wed, 12 Jan 2022 11:42:19 +0800
Subject: [PATCH 5/5] HACK: Bypass drmGetBusid and drmAuthMagic by default
 
A few versions of Mali GBM winsys would try to call those APIs.
 
Set env "DRM_ALLOW_GET_BUSID" and "DRM_ALLOW_AUTH_MAGIC" to enable them.
 
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
 xf86drm.c | 6 ++++++
 1 file changed, 6 insertions(+)
 
diff --git a/xf86drm.c b/xf86drm.c
index c681da4..de8a678 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -1440,6 +1440,9 @@ drm_public char *drmGetBusid(int fd)
 {
     drm_unique_t u;
 
+    if (!getenv("DRM_ALLOW_GET_BUSID"))
+        return strdup("");
+
     memclear(u);
 
     if (drmIoctl(fd, DRM_IOCTL_GET_UNIQUE, &u))
@@ -1498,6 +1501,9 @@ drm_public int drmAuthMagic(int fd, drm_magic_t magic)
 {
     drm_auth_t auth;
 
+    if (!getenv("DRM_ALLOW_AUTH_MAGIC"))
+        return 0;
+
     memclear(auth);
     auth.magic = magic;
     if (drmIoctl(fd, DRM_IOCTL_AUTH_MAGIC, &auth))
-- 
2.20.1