summaryrefslogtreecommitdiff
path: root/sysutils/libdrm/patches/patch-xf86drm_c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2023-07-07 10:32:06 +0200
committerMatthieu Herrb <matthieu@herrb.eu>2023-07-07 10:32:06 +0200
commite998b3a732e585b1a7a5d99840aec651bbddc2bd (patch)
tree7134112410db836f7ada777de98db6656d21cec0 /sysutils/libdrm/patches/patch-xf86drm_c
parent197624e53bf0fd56adcef8171de08ee3017e4566 (diff)
sysutils/libdrm: fix drmGetMinorNameForFD(). tweaks and ok jsg@.
For the gpu n, the main device node is /dev/dri/card<n> and the render device node is /dev/dri/renderD<n+drmGetMinorBase()> not /dev/dri/renderD<n> and miod@ checked that no port should be affected.
Diffstat (limited to 'sysutils/libdrm/patches/patch-xf86drm_c')
-rw-r--r--sysutils/libdrm/patches/patch-xf86drm_c25
1 files 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;