From 39c98fb81b5d10d58c2fd375c3f5279f2fb684bf Mon Sep 17 00:00:00 2001 From: Ben Hoff Date: Thu, 7 Nov 2024 15:57:17 -0500 Subject: [PATCH] drop master on /dev/dri/card0 by default to avoid becoming the drm master --- osal/allocator/allocator_drm.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osal/allocator/allocator_drm.c b/osal/allocator/allocator_drm.c index 415dc9bb..ef30b2d5 100644 --- a/osal/allocator/allocator_drm.c +++ b/osal/allocator/allocator_drm.c @@ -183,8 +183,17 @@ static MPP_RET os_allocator_drm_open(void **ctx, size_t alignment, MppAllocFlagT for (i = 0; i < (RK_S32)MPP_ARRAY_ELEMS(dev_drm); i++) { fd = open(dev_drm[i], O_RDWR | O_CLOEXEC); - if (fd > 0) + if (fd > 0) { + + if (strcmp(dev_drm[i], "/dev/dri/card0") == 0) { + int ret = drm_ioctl(fd, DRM_IOCTL_DROP_MASTER, 0); + if (ret < 0) { + mpp_err_f("Drop master on %s failed!\n", dev_drm[i]); + } + } + break; + } } if (fd < 0) {