From 75ac1c5aad1ceec6d373390cfcfd473da6656786 Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Wed, 12 Jan 2022 11:42:19 +0800 Subject: [PATCH 5/5] HACK: Bypass drm{GetBusid,drmAuthMagic,SetInterfaceVersion} by default A few versions of Mali GBM winsys would try to call those APIs. Set env "DRM_ALLOW_GET_BUSID" "DRM_ALLOW_AUTH_MAGIC" and "DRM_ALLOW_SET_VERSION" to enable them. Signed-off-by: Jeffy Chen --- xf86drm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xf86drm.c b/xf86drm.c index e44b926..ac9fd85 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -1439,6 +1439,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)) @@ -1497,6 +1500,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)) @@ -2995,6 +3001,9 @@ drm_public int drmSetInterfaceVersion(int fd, drmSetVersion *version) int retcode = 0; drm_set_version_t sv; + if (!getenv("DRM_ALLOW_SET_VERSION")) + return 0; + memclear(sv); sv.drm_di_major = version->drm_di_major; sv.drm_di_minor = version->drm_di_minor; -- 2.20.1