From e998b3a732e585b1a7a5d99840aec651bbddc2bd Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Fri, 7 Jul 2023 10:32:06 +0200 Subject: sysutils/libdrm: fix drmGetMinorNameForFD(). tweaks and ok jsg@. For the gpu n, the main device node is /dev/dri/card and the render device node is /dev/dri/renderD not /dev/dri/renderD and miod@ checked that no port should be affected. --- sysutils/libdrm/patches/patch-xf86drm_c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/sysutils/libdrm/patches/patch-xf86drm_c b/sysutils/libdrm/patches/patch-xf86drm_c index e70ebc5..db61b47 100644 --- a/sysutils/libdrm/patches/patch-xf86drm_c +++ b/sysutils/libdrm/patches/patch-xf86drm_c @@ -94,7 +94,28 @@ Index: xf86drm.c return -errno; } -@@ -4514,53 +4541,6 @@ drm_device_has_rdev(drmDevicePtr device, dev_t find_rd +@@ -3438,7 +3465,11 @@ static char *drmGetMinorNameForFD(int fd, int type) + const char *dev_name = drmGetDeviceName(type); + unsigned int maj, min; + int n; ++ int base = drmGetMinorBase(type); + ++ if (base < 0) ++ return NULL; ++ + if (fstat(fd, &sbuf)) + return NULL; + +@@ -3451,7 +3482,7 @@ static char *drmGetMinorNameForFD(int fd, int type) + if (!dev_name) + return NULL; + +- n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, min); ++ n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, base + min); + if (n == -1 || n >= sizeof(buf)) + return NULL; + +@@ -4514,53 +4545,6 @@ drm_device_has_rdev(drmDevicePtr device, dev_t find_rd */ drm_public int drmGetDeviceFromDevId(dev_t find_rdev, uint32_t flags, drmDevicePtr *device) { @@ -148,7 +169,7 @@ Index: xf86drm.c drmDevicePtr local_devices[MAX_DRM_NODES]; drmDevicePtr d; DIR *sysdir; -@@ -4624,7 +4604,6 @@ drm_public int drmGetDeviceFromDevId(dev_t find_rdev, +@@ -4624,7 +4608,6 @@ drm_public int drmGetDeviceFromDevId(dev_t find_rdev, if (*device == NULL) return -ENODEV; return 0; -- cgit v1.2.3