1From 75ac1c5aad1ceec6d373390cfcfd473da6656786 Mon Sep 17 00:00:00 2001 2From: Jeffy Chen <jeffy.chen@rock-chips.com> 3Date: Wed, 12 Jan 2022 11:42:19 +0800 4Subject: [PATCH 5/5] HACK: Bypass 5 drm{GetBusid,drmAuthMagic,SetInterfaceVersion} by default 6 7A few versions of Mali GBM winsys would try to call those APIs. 8 9Set env "DRM_ALLOW_GET_BUSID" "DRM_ALLOW_AUTH_MAGIC" and 10"DRM_ALLOW_SET_VERSION" to enable them. 11 12Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 13--- 14 xf86drm.c | 9 +++++++++ 15 1 file changed, 9 insertions(+) 16 17diff --git a/xf86drm.c b/xf86drm.c 18index e44b926..ac9fd85 100644 19--- a/xf86drm.c 20+++ b/xf86drm.c 21@@ -1439,6 +1439,9 @@ drm_public char *drmGetBusid(int fd) 22 { 23 drm_unique_t u; 24 25+ if (!getenv("DRM_ALLOW_GET_BUSID")) 26+ return strdup(""); 27+ 28 memclear(u); 29 30 if (drmIoctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) 31@@ -1497,6 +1500,9 @@ drm_public int drmAuthMagic(int fd, drm_magic_t magic) 32 { 33 drm_auth_t auth; 34 35+ if (!getenv("DRM_ALLOW_AUTH_MAGIC")) 36+ return 0; 37+ 38 memclear(auth); 39 auth.magic = magic; 40 if (drmIoctl(fd, DRM_IOCTL_AUTH_MAGIC, &auth)) 41@@ -2995,6 +3001,9 @@ drm_public int drmSetInterfaceVersion(int fd, drmSetVersion *version) 42 int retcode = 0; 43 drm_set_version_t sv; 44 45+ if (!getenv("DRM_ALLOW_SET_VERSION")) 46+ return 0; 47+ 48 memclear(sv); 49 sv.drm_di_major = version->drm_di_major; 50 sv.drm_di_minor = version->drm_di_minor; 51-- 522.20.1 53 54