Date: Tue, 14 Mar 2017 14:46:10 +0000 (UTC) From: Matthew Rezny <rezny@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r436156 - in head/graphics/libdrm: . files Message-ID: <201703141446.v2EEkAxc086678@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rezny Date: Tue Mar 14 14:46:10 2017 New Revision: 436156 URL: https://svnweb.freebsd.org/changeset/ports/436156 Log: Don't check device major ID, it's not always zero. Fixes Mesa 13 on drm-next Submitted by: hselasky Reported by: sbruno, hselasky, xmj Reviewed by: hselasky Approved by: swills (mentor) Differential Revision: https://reviews.freebsd.org/D10000 Modified: head/graphics/libdrm/Makefile head/graphics/libdrm/files/patch-xf86drm.c Modified: head/graphics/libdrm/Makefile ============================================================================== --- head/graphics/libdrm/Makefile Tue Mar 14 14:37:20 2017 (r436155) +++ head/graphics/libdrm/Makefile Tue Mar 14 14:46:10 2017 (r436156) @@ -4,7 +4,7 @@ PORTNAME= libdrm PORTVERSION= 2.4.75 PORTEPOCH= 1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= graphics x11 MASTER_SITES= http://dri.freedesktop.org/libdrm/ Modified: head/graphics/libdrm/files/patch-xf86drm.c ============================================================================== --- head/graphics/libdrm/files/patch-xf86drm.c Tue Mar 14 14:37:20 2017 (r436155) +++ head/graphics/libdrm/files/patch-xf86drm.c Tue Mar 14 14:46:10 2017 (r436156) @@ -30,7 +30,7 @@ } } -+#if !defined(__FreeBSD__) && !defined(__DragonFly__) ++#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && !defined(__DragonFly__) static const char *drmGetMinorName(int type) { switch (type) { @@ -42,11 +42,20 @@ /** * Open the device by bus ID. +@@ -2734,7 +2744,7 @@ int drmGetNodeTypeFromFd(int fd) + maj = major(sbuf.st_rdev); + min = minor(sbuf.st_rdev); + +- if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) { ++ if (DRM_MAJOR && maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) { + errno = EINVAL; + return -1; + } @@ -2833,6 +2843,15 @@ static char *drmGetMinorNameForFD(int fd out_close_dir: closedir(sysdir); -+#elif defined(__FreeBSD__) || defined(__DragonFly__) ++#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) + struct stat buf; + char name[64]; + @@ -63,7 +72,7 @@ return -EINVAL; -#elif defined(__OpenBSD__) -+#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) ++#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) return DRM_BUS_PCI; #else #warning "Missing implementation of drmParseSubsystemType" @@ -71,7 +80,7 @@ #endif } -+#if defined(__FreeBSD__) || defined(__DragonFly__) ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +/* + * XXX temporary workaround, because FreeBSD doesn't provide + * pcibus device sysctl trees for renderD and controlD nodes (yet) @@ -133,7 +142,7 @@ #endif } -+#if defined(__FreeBSD__) || defined(__DragonFly__) ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +static int drmParsePciDeviceInfoBSD(const char *path, + drmPciDeviceInfoPtr device, + uint32_t flags) @@ -170,7 +179,7 @@ dev->businfo.pci = (drmPciBusInfoPtr)addr; -+#if defined(__FreeBSD__) || defined(__DragonFly__) ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) + ret = drmParsePciBusInfoBSD(node, dev->businfo.pci); +#else ret = drmParsePciBusInfo(maj, min, dev->businfo.pci); @@ -183,7 +192,7 @@ addr += sizeof(drmPciBusInfo); dev->deviceinfo.pci = (drmPciDeviceInfoPtr)addr; - -+#if defined(__FreeBSD__) || defined(__DragonFly__) ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) + ret = drmParsePciDeviceInfoBSD(node, dev->deviceinfo.pci, flags); +#else ret = drmParsePciDeviceInfo(maj, min, dev->deviceinfo.pci, flags); @@ -191,3 +200,39 @@ if (ret) goto free_device; } +@@ -3786,7 +3897,7 @@ int drmGetDevice2(int fd, uint32_t flags + maj = major(sbuf.st_rdev); + min = minor(sbuf.st_rdev); + +- if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) ++ if (DRM_MAJOR && maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + return -EINVAL; + + subsystem_type = drmParseSubsystemType(maj, min); +@@ -3814,7 +3925,7 @@ int drmGetDevice2(int fd, uint32_t flags + maj = major(sbuf.st_rdev); + min = minor(sbuf.st_rdev); + +- if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) ++ if (DRM_MAJOR && maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + continue; + + if (drmParseSubsystemType(maj, min) != subsystem_type) +@@ -3964,7 +4075,7 @@ int drmGetDevices2(uint32_t flags, drmDe + maj = major(sbuf.st_rdev); + min = minor(sbuf.st_rdev); + +- if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) ++ if (DRM_MAJOR && maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + continue; + + subsystem_type = drmParseSubsystemType(maj, min); +@@ -4108,7 +4219,7 @@ char *drmGetDeviceNameFromFd2(int fd) + maj = major(sbuf.st_rdev); + min = minor(sbuf.st_rdev); + +- if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) ++ if (DRM_MAJOR && maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + return NULL; + + node_type = drmGetMinorType(min);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703141446.v2EEkAxc086678>