linuxOS_AP05/buildroot/package/libdrm/0005-HACK-Bypass-drmGetBusid-and-drmAuthMagic-by-default.patch

42 lines
1.1 KiB
Diff
Raw Normal View History

2025-06-02 05:59:07 +00:00
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