Date: Fri, 14 Dec 2018 16:24:02 +0000 (UTC) From: Tijl Coosemans <tijl@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r487446 - in head/x11: nvidia-driver nvidia-driver-304 nvidia-driver-340 nvidia-driver/files Message-ID: <201812141624.wBEGO2df054326@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tijl Date: Fri Dec 14 16:24:02 2018 New Revision: 487446 URL: https://svnweb.freebsd.org/changeset/ports/487446 Log: Install both 32 bit and 64 bit Linux libraries from the official Linux driver distribution instead of the ones bundled with the FreeBSD driver which are incomplete and 32 bit only. This makes amd64 Linux OpenGL programs work on FreeBSD 12.0 and recent 11-STABLE. This does not enable CUDA. - Initialise DISTFILES so a file can be added by the LINUX option. - Set EXTRACT_ONLY because the file added by the LINUX option is a self-extracting archive handled in post-extract. - The patches for <355.06 and >=355.06 are identical except for the path. Keep only one set (listed in SUB_PATCHES) because more patches have been added. Modify their path in pre-patch. The patches have been renamed from extra-patch-* to extra-patch-*.in. - Set OPTIONS_SUB and use option helpers for the LINUX option. - Define LINUX_ARCH_SUFX like ARCH_SUFX because LINUX_ARCH can be i386 on amd64. - Set LINUX_LIBDIR to the main lib directory: (/compat/linux)/usr/lib on i386 and (/compat/linux)/usr/lib64 on amd64. (The compat32 directory is (/compat/linux)/usr/lib.) - Define LINUX_LIBS, LINUX_LINKS, LINUX32_LIBS, LINUX32_LINKS, LINUX_PROGS, LINUX_MANS, and LINUX_DATA for all driver versions from 304.137 to 390.87. LINUX_LIBS and LINUX32_LIBS contain main libraries (i386/amd64) and compat32 libraries respectively. These are installed with INSTALL_LIB in post-install. LINUX_LINKS and LINUX32_LINKS contain symbolic link sources and their target. LINUX_PROGS are binaries installed with INSTALL_PROGRAM. LINUX_MANS are manuals installed with INSTALL_MAN. LINUX_DATA are data files and their destination, installed with INSTALL_DATA. The .if blocks for the different versions are sorted alphabetically on the first file. - Define PLIST_RE for all versions. These are sed commands applied to TMPPLIST in post-install. - Include bsd.port.pre.mk instead of bsd.port.options.mk to obtain LINUX_ARCH. - Adjust post-patch to disable installation of Linux libraries bundled with the FreeBSD driver. - Add post-patch-LINUX-on to setup nvidia_icd.json like nvidia-installer does on Linux. - Adjust existing post-install TMPPLIST edits to apply only to non-Linux files. - Add post-install-LINUX-on to install the Linux files. - Add files/extra-patch-src-nvidia_ctl.c.in and extra-patch-src-nvidia_dev.c.in. These patches make Linux stat(2) return the right major and minor number for /dev/nvidiactl and /dev/nvidia[0-9]+. Recent versions of the Linux libraries verify these. [1] Define the struct passed to linux_device_register_handler on the stack in nvidia_*_attach instead of as a global variable in case multiple graphics cards are attached in parallel. - Add files/extra-patch-src-nvidia_linux.c.in. It rewrites the Linux ioctl handler. The current implementation does not copyin arguments leading to kernel panics on FreeBSD 12 on machines that support Supervisor Mode Access Prevention (SMAP). - Add files/extra-patch-src-nvidia_pci.c.in. It adds a dependency on the linux_common kernel module for linux_device_register_handler. - Modify files/extra-patch-src_nvidia-modeset_nvidia-modeset-freebsd.c to add major/minor numbers (global struct here, because it is constant), rewrite ioctl, and add a dependency on linux_common for /dev/nvidia-modeset. PR: 217901 Analysed by: Alex S <iwtcex@gmail.com> [1] Tested by: Hannes Hauswedell <h2+fbsdports@fsfe.org> (390.87) Tested by: tijl (304.137) Approved by: maintainer timeout (15 days) Added: head/x11/nvidia-driver/files/extra-patch-src-Makefile.in - copied, changed from r487445, head/x11/nvidia-driver/files/extra-patch-src-Makefile head/x11/nvidia-driver/files/extra-patch-src-nv-freebsd.h.in - copied, changed from r487445, head/x11/nvidia-driver/files/extra-patch-src-nv-freebsd.h head/x11/nvidia-driver/files/extra-patch-src-nv-misc.h.in - copied, changed from r487445, head/x11/nvidia-driver/files/extra-patch-src-nv-misc.h head/x11/nvidia-driver/files/extra-patch-src-nvidia_ctl.c.in (contents, props changed) head/x11/nvidia-driver/files/extra-patch-src-nvidia_dev.c.in (contents, props changed) head/x11/nvidia-driver/files/extra-patch-src-nvidia_linux.c.in (contents, props changed) head/x11/nvidia-driver/files/extra-patch-src-nvidia_pci.c.in (contents, props changed) Deleted: head/x11/nvidia-driver/files/extra-patch-src-Makefile head/x11/nvidia-driver/files/extra-patch-src-nv-freebsd.h head/x11/nvidia-driver/files/extra-patch-src-nv-misc.h head/x11/nvidia-driver/files/extra-patch-src_nvidia_Makefile head/x11/nvidia-driver/files/extra-patch-src_nvidia_nv-freebsd.h head/x11/nvidia-driver/files/extra-patch-src_nvidia_nv-misc.h Modified: head/x11/nvidia-driver-304/Makefile head/x11/nvidia-driver-340/Makefile head/x11/nvidia-driver/Makefile head/x11/nvidia-driver/distinfo head/x11/nvidia-driver/files/extra-patch-src_nvidia-modeset_nvidia-modeset-freebsd.c head/x11/nvidia-driver/pkg-plist Modified: head/x11/nvidia-driver-304/Makefile ============================================================================== --- head/x11/nvidia-driver-304/Makefile Fri Dec 14 16:18:16 2018 (r487445) +++ head/x11/nvidia-driver-304/Makefile Fri Dec 14 16:24:02 2018 (r487446) @@ -3,7 +3,7 @@ DISTVERSION= 304.137 # Explicitly set PORTREVISION as it can be overridden by the master port -PORTREVISION= 1 +PORTREVISION= 2 MASTERDIR= ${.CURDIR}/../nvidia-driver PKGNAMESUFFIX= -304 Modified: head/x11/nvidia-driver-340/Makefile ============================================================================== --- head/x11/nvidia-driver-340/Makefile Fri Dec 14 16:18:16 2018 (r487445) +++ head/x11/nvidia-driver-340/Makefile Fri Dec 14 16:24:02 2018 (r487446) @@ -3,7 +3,7 @@ DISTVERSION= 340.107 # Explicitly set PORTREVISION as it can be overridden by the master port -PORTREVISION= 1 +PORTREVISION= 2 MASTERDIR= ${.CURDIR}/../nvidia-driver PKGNAMESUFFIX= -340 Modified: head/x11/nvidia-driver/Makefile ============================================================================== --- head/x11/nvidia-driver/Makefile Fri Dec 14 16:18:16 2018 (r487445) +++ head/x11/nvidia-driver/Makefile Fri Dec 14 16:24:02 2018 (r487446) @@ -12,10 +12,12 @@ PORTNAME= nvidia-driver DISTVERSION?= 390.87 # Always try to set PORTREVISION as it can be overridden by the slave ports -PORTREVISION?= 0 +PORTREVISION?= 1 CATEGORIES= x11 MASTER_SITES= NVIDIA/XFree86/FreeBSD-${ARCH_SUFX}/${DISTVERSION} DISTNAME= NVIDIA-FreeBSD-${ARCH_SUFX}-${DISTVERSION} +DISTFILES= ${DISTNAME}${EXTRACT_SUFX} +EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} MAINTAINER= danfe@FreeBSD.org COMMENT= NVidia graphics card binary drivers for hardware OpenGL rendering @@ -40,7 +42,15 @@ USE_LDCONFIG= yes # hack below to universally set NVIDIA_ROOT. Also provide X11BASE value # since it is still used by legacy drivers. MAKE_ENV= NVIDIA_ROOT=${WRKSRC} X11BASE=${LOCALBASE} +PLIST_RE= # empty SUB_FILES= pkg-deinstall pkg-install pkg-message nvidia.conf +SUB_PATCHES= extra-patch-src-Makefile \ + extra-patch-src-nv-freebsd.h \ + extra-patch-src-nv-misc.h \ + extra-patch-src-nvidia_ctl.c \ + extra-patch-src-nvidia_dev.c \ + extra-patch-src-nvidia_linux.c \ + extra-patch-src-nvidia_pci.c DOCSDIR= ${PREFIX}/share/doc/NVIDIA_GLX-1.0 MODULESDIR= lib/xorg/modules PORTDOCS= * @@ -64,14 +74,8 @@ SUB_LIST+= NVGL="\# " .endif .if ${NVVERSION} < 355.006 -EXTRA_PATCHES= ${FILESDIR}/extra-patch-src-Makefile \ - ${FILESDIR}/extra-patch-src-nv-freebsd.h \ - ${FILESDIR}/extra-patch-src-nv-misc.h NVSRC= . .else -EXTRA_PATCHES= ${FILESDIR}/extra-patch-src_nvidia_Makefile \ - ${FILESDIR}/extra-patch-src_nvidia_nv-freebsd.h \ - ${FILESDIR}/extra-patch-src_nvidia_nv-misc.h NVSRC= nvidia .endif @@ -85,6 +89,7 @@ EXTRA_PATCHES+= ${FILESDIR}/extra-patch-src_nvidia-mod OPTIONS_DEFINE= ACPI_PM LINUX WBINVD DOCS OPTIONS_DEFINE_i386= PAE OPTIONS_DEFAULT= LINUX +OPTIONS_SUB= yes ACPI_PM_DESC= ACPI Power Management support LINUX_DESC= Linux compatibility support @@ -96,22 +101,315 @@ OPTIONS_DEFINE+= FREEBSD_AGP FREEBSD_AGP_DESC= Use FreeBSD AGP GART driver .endif -PLIST_SUB+= LINUXBASE=${LINUXBASE} SHLIB_VERSION=${PORTVERSION} \ +LINUX_MASTER_SITES=NVIDIA/XFree86/Linux-${LINUX_ARCH_SUFX}/${DISTVERSION}/:linux +LINUX_DISTFILES=NVIDIA-Linux-${LINUX_ARCH_SUFX}-${DISTVERSION}.run:linux +LINUX_USES= linux +LINUX_USE= LINUX=xorglibs + +LINUX_ARCH_SUFX=${LINUX_ARCH:S/i386/x86/} +LINUX_LIBDIR= /usr/lib${LINUX_ARCH:S/i386//:S/x86_64/64/} +LINUX_WRKSRC= ${WRKDIR}/NVIDIA-Linux-${LINUX_ARCH_SUFX}-${DISTVERSION} + +LINUX_LIBS= libcuda.so.${PORTVERSION} \ + libnvcuvid.so.${PORTVERSION} \ + libnvidia-cfg.so.${PORTVERSION} \ + libnvidia-compiler.so.${PORTVERSION} \ + libnvidia-glcore.so.${PORTVERSION} \ + libnvidia-ml.so.${PORTVERSION} \ + libnvidia-opencl.so.${PORTVERSION} \ + libnvidia-tls.so.${PORTVERSION} \ + libvdpau_nvidia.so.${PORTVERSION} \ + tls/libnvidia-tls.so.${PORTVERSION} +LINUX_LINKS= libcuda.so.${PORTVERSION} libcuda.so.1 \ + libcuda.so.${PORTVERSION} libcuda.so \ + libnvcuvid.so.${PORTVERSION} libnvcuvid.so.1 \ + libnvcuvid.so.${PORTVERSION} libnvcuvid.so \ + libnvidia-cfg.so.${PORTVERSION} libnvidia-cfg.so.1 \ + libnvidia-cfg.so.${PORTVERSION} libnvidia-cfg.so \ + libnvidia-ml.so.${PORTVERSION} libnvidia-ml.so.1 \ + libnvidia-ml.so.${PORTVERSION} libnvidia-ml.so \ + libnvidia-opencl.so.${PORTVERSION} libnvidia-opencl.so.1 \ + libvdpau_nvidia.so.${PORTVERSION} vdpau/libvdpau_nvidia.so.1 +LINUX32_LIBS= libcuda.so.${PORTVERSION} \ + libnvidia-compiler.so.${PORTVERSION} \ + libnvidia-glcore.so.${PORTVERSION} \ + libnvidia-ml.so.${PORTVERSION} \ + libnvidia-opencl.so.${PORTVERSION} \ + libnvidia-tls.so.${PORTVERSION} \ + libvdpau_nvidia.so.${PORTVERSION} \ + tls/libnvidia-tls.so.${PORTVERSION} +LINUX32_LINKS= libcuda.so.${PORTVERSION} libcuda.so.1 \ + libcuda.so.${PORTVERSION} libcuda.so \ + libnvidia-ml.so.${PORTVERSION} libnvidia-ml.so.1 \ + libnvidia-ml.so.${PORTVERSION} libnvidia-ml.so \ + libnvidia-opencl.so.${PORTVERSION} libnvidia-opencl.so.1 \ + libvdpau_nvidia.so.${PORTVERSION} vdpau/libvdpau_nvidia.so.1 +LINUX_PROGS= nvidia-debugdump nvidia-settings nvidia-smi nvidia-xconfig +LINUX_MANS= nvidia-settings nvidia-smi nvidia-xconfig +LINUX_DATA= nvidia.icd /etc/OpenCL/vendors +.if ${NVVERSION} >= 375.010 +LINUX_DATA+= 10_nvidia.json /usr/share/glvnd/egl_vendor.d +.else +PLIST_RE+= '\,${LINUXBASE}/usr/share/glvnd,d' +.endif +.if ${NVVERSION} >= 378.009 +LINUX_DATA+= 10_nvidia_wayland.json /usr/share/egl/egl_external_platform.d +.else +PLIST_RE+= '\,${LINUXBASE}/usr/share/egl,d' +.endif +.if ${NVVERSION} >= 390.042 +LINUX_LIBS+= libEGL.so.1.1.0 +LINUX_LINKS+= libEGL.so.1.1.0 libEGL.so.1 +LINUX32_LIBS+= libEGL.so.1.1.0 +LINUX32_LINKS+= libEGL.so.1.1.0 libEGL.so.1 +PLIST_RE+= '\,${LINUXBASE},s/(libEGL\.so)\.X/\1.1.1.0/' +.elif ${NVVERSION} >= 355.006 +LINUX_LIBS+= libEGL.so.1 +LINUX32_LIBS+= libEGL.so.1 +PLIST_RE+= '\,${LINUXBASE}.*libEGL\.so\.X,d' +.elif ${NVVERSION} >= 331.013 +LINUX_LIBS+= libEGL.so.${PORTVERSION} +LINUX_LINKS+= libEGL.so.${PORTVERSION} libEGL.so.1 +LINUX32_LIBS+= libEGL.so.${PORTVERSION} +LINUX32_LINKS+= libEGL.so.${PORTVERSION} libEGL.so.1 +PLIST_RE+= '\,${LINUXBASE},s/(libEGL\.so)\.X/\1.${PORTVERSION}/' +.else +PLIST_RE+= '\,${LINUXBASE}.*libEGL\.so,d' +.endif +.if ${NVVERSION} >= 361.016 +LINUX_LIBS+= libEGL_nvidia.so.${PORTVERSION} +LINUX_LINKS+= libEGL_nvidia.so.${PORTVERSION} libEGL_nvidia.so.0 +LINUX32_LIBS+= libEGL_nvidia.so.${PORTVERSION} +LINUX32_LINKS+= libEGL_nvidia.so.${PORTVERSION} libEGL_nvidia.so.0 +.elif ${NVVERSION} >= 355.006 +LINUX_LIBS+= libEGL_nvidia.so.0 +PLIST_RE+= '\,${LINUXBASE}.*libEGL_nvidia\.so\.${PORTVERSION},d' +.else +PLIST_RE+= '\,${LINUXBASE}.*libEGL_nvidia\.so,d' +.endif +.if ${NVVERSION} >= 390.042 +LINUX_LIBS+= libGL.so.1.7.0 +LINUX_LINKS+= libGL.so.1.7.0 libGL.so.1 +LINUX32_LIBS+= libGL.so.1.7.0 +LINUX32_LINKS+= libGL.so.1.7.0 libGL.so.1 +PLIST_RE+= '\,${LINUXBASE},s/(libGL\.so)\.X/\1.1.7.0/' +.elif ${NVVERSION} >= 361.028 +LINUX_LIBS+= libGL.so.1.0.0 +LINUX_LINKS+= libGL.so.1.0.0 libGL.so.1 +LINUX32_LIBS+= libGL.so.1.0.0 +LINUX32_LINKS+= libGL.so.1.0.0 libGL.so.1 +PLIST_RE+= '\,${LINUXBASE},s/(libGL\.so)\.X/\1.1.0.0/' +.elif ${NVVERSION} >= 361.016 +LINUX_LIBS+= libGL.so.1 +LINUX32_LIBS+= libGL.so.1 +PLIST_RE+= '\,${LINUXBASE}.*libGL\.so\.X,d' +.else +LINUX_LIBS+= libGL.so.${PORTVERSION} +LINUX_LINKS+= libGL.so.${PORTVERSION} libGL.so.1 +LINUX32_LIBS+= libGL.so.${PORTVERSION} +LINUX32_LINKS+= libGL.so.${PORTVERSION} libGL.so.1 +PLIST_RE+= '\,${LINUXBASE},s/(libGL\.so)\.X/\1.${PORTVERSION}/' +.endif +.if ${NVVERSION} >= 390.042 +LINUX_LIBS+= libGLESv1_CM.so.1.2.0 \ + libGLESv2.so.2.1.0 +LINUX_LINKS+= libGLESv1_CM.so.1.2.0 libGLESv1_CM.so.1 \ + libGLESv2.so.2.1.0 libGLESv2.so.2 +LINUX32_LIBS+= libGLESv1_CM.so.1.2.0 \ + libGLESv2.so.2.1.0 +LINUX32_LINKS+= libGLESv1_CM.so.1.2.0 libGLESv1_CM.so.1 \ + libGLESv2.so.2.1.0 libGLESv2.so.2 +PLIST_RE+= '\,${LINUXBASE},s/(libGLESv1_CM\.so)\.X/\1.1.2.0/' \ + '\,${LINUXBASE},s/(libGLESv2\.so)\.X/\1.2.1.0/' +.elif ${NVVERSION} >= 361.016 +LINUX_LIBS+= libGLESv1_CM.so.1 \ + libGLESv2.so.2 +LINUX32_LIBS+= libGLESv1_CM.so.1 \ + libGLESv2.so.2 +PLIST_RE+= '\,${LINUXBASE}.*GLESv(1_CM|2)\.so\.X,d' +.elif ${NVVERSION} >= 331.013 +LINUX_LIBS+= libGLESv1_CM.so.${PORTVERSION} \ + libGLESv2.so.${PORTVERSION} +LINUX_LINKS+= libGLESv1_CM.so.${PORTVERSION} libGLESv1_CM.so.1 \ + libGLESv2.so.${PORTVERSION} libGLESv2.so.2 +LINUX32_LIBS+= libGLESv1_CM.so.${PORTVERSION} \ + libGLESv2.so.${PORTVERSION} +LINUX32_LINKS+= libGLESv1_CM.so.${PORTVERSION} libGLESv1_CM.so.1 \ + libGLESv2.so.${PORTVERSION} libGLESv2.so.2 +PLIST_RE+= '\,${LINUXBASE},s/(libGLESv(1_CM|2)\.so)\.X/\1.${PORTVERSION}/' +.else +PLIST_RE+= '\,${LINUXBASE}.*libGLESv(1_CM|2)\.so,d' +.endif +.if ${NVVERSION} >= 361.016 +LINUX_LIBS+= libGLESv1_CM_nvidia.so.${PORTVERSION} \ + libGLESv2_nvidia.so.${PORTVERSION} \ + libGLX.so.0 \ + libGLX_nvidia.so.${PORTVERSION} \ + libnvidia-fatbinaryloader.so.${PORTVERSION} \ + libnvidia-ptxjitcompiler.so.${PORTVERSION} +LINUX_LINKS+= libGLESv1_CM_nvidia.so.${PORTVERSION} libGLESv1_CM_nvidia.so.1 \ + libGLESv2_nvidia.so.${PORTVERSION} libGLESv2_nvidia.so.2 \ + libGLX.so.0 libGLX.so \ + libGLX_nvidia.so.${PORTVERSION} libGLX_nvidia.so.0 \ + libGLX_nvidia.so.${PORTVERSION} libGLX_indirect.so.0 \ + libnvidia-ptxjitcompiler.so.${PORTVERSION} libnvidia-ptxjitcompiler.so.1 \ + libnvidia-ptxjitcompiler.so.${PORTVERSION} libnvidia-ptxjitcompiler.so +LINUX32_LIBS+= libGLESv1_CM_nvidia.so.${PORTVERSION} \ + libGLESv2_nvidia.so.${PORTVERSION} \ + libGLX.so.0 \ + libGLX_nvidia.so.${PORTVERSION} \ + libnvidia-fatbinaryloader.so.${PORTVERSION} \ + libnvidia-ptxjitcompiler.so.${PORTVERSION} +LINUX32_LINKS+= libGLESv1_CM_nvidia.so.${PORTVERSION} libGLESv1_CM_nvidia.so.1 \ + libGLESv2_nvidia.so.${PORTVERSION} libGLESv2_nvidia.so.2 \ + libGLX.so.0 libGLX.so \ + libGLX_nvidia.so.${PORTVERSION} libGLX_nvidia.so.0 \ + libGLX_nvidia.so.${PORTVERSION} libGLX_indirect.so.0 \ + libnvidia-ptxjitcompiler.so.${PORTVERSION} libnvidia-ptxjitcompiler.so.1 \ + libnvidia-ptxjitcompiler.so.${PORTVERSION} libnvidia-ptxjitcompiler.so +.else +PLIST_RE+= '\,${LINUXBASE}.*libGLESv(1_CM|2)_nvidia\.so,d' \ + '\,${LINUXBASE}.*libGLX(_nvidia|_indirect)?\.so,d' \ + '\,${LINUXBASE}.*libnvidia-fatbinaryloader\.so,d' \ + '\,${LINUXBASE}.*libnvidia-ptxjitcompiler\.so,d' +.endif +.if ${NVVERSION} >= 355.006 +LINUX_LIBS+= libGLdispatch.so.0 \ + libOpenGL.so.0 +LINUX_LINKS+= libOpenGL.so.0 libOpenGL.so +LINUX32_LIBS+= libGLdispatch.so.0 \ + libOpenGL.so.0 +LINUX32_LINKS+= libOpenGL.so.0 libOpenGL.so +.else +PLIST_RE+= '\,${LINUXBASE}.*libGLdispatch\.so,d' \ + '\,${LINUXBASE}.*libOpenGL\.so,d' +.endif +.if ${NVVERSION} >= 387.012 +LINUX_LIBS+= libnvidia-egl-wayland.so.1.0.2 +LINUX_LINKS+= libnvidia-egl-wayland.so.1.0.2 libnvidia-egl-wayland.so.1 +PLIST_RE+= '\,${LINUXBASE},s/(libnvidia-egl-wayland\.so)\.X/\1.1.0.2/' +.elif ${NVVERSION} >= 378.013 +LINUX_LIBS+= libnvidia-egl-wayland.so.1.0.1 +LINUX_LINKS+= libnvidia-egl-wayland.so.1.0.1 libnvidia-egl-wayland.so.1 +PLIST_RE+= '\,${LINUXBASE},s/(libnvidia-egl-wayland\.so)\.X/\1.1.0.1/' +.elif ${NVVERSION} >= 378.009 +LINUX_LIBS+= libnvidia-egl-wayland.so.1.0.0 +LINUX_LINKS+= libnvidia-egl-wayland.so.1.0.0 libnvidia-egl-wayland.so.1 +PLIST_RE+= '\,${LINUXBASE},s/(libnvidia-egl-wayland\.so)\.X/\1.1.0.0/' +.elif ${NVVERSION} >= 364.012 +LINUX_LIBS+= libnvidia-egl-wayland.so.${PORTVERSION} +LINUX_LINKS+= libnvidia-egl-wayland.so.${PORTVERSION} libnvidia-egl-wayland.so.1 +PLIST_RE+= '\,${LINUXBASE},s/(libnvidia-egl-wayland\.so)\.X/\1.${PORTVERSION}/' +.else +PLIST_RE+= '\,${LINUXBASE}.*libnvidia-egl-wayland\.so,d' +.endif +.if ${NVVERSION} >= 331.013 +LINUX_LIBS+= libnvidia-eglcore.so.${PORTVERSION} \ + libnvidia-fbc.so.${PORTVERSION} \ + libnvidia-glsi.so.${PORTVERSION} \ + libnvidia-ifr.so.${PORTVERSION} +LINUX_LINKS+= libnvidia-fbc.so.${PORTVERSION} libnvidia-fbc.so.1 \ + libnvidia-fbc.so.${PORTVERSION} libnvidia-fbc.so \ + libnvidia-ifr.so.${PORTVERSION} libnvidia-ifr.so.1 \ + libnvidia-ifr.so.${PORTVERSION} libnvidia-ifr.so +LINUX32_LIBS+= libnvidia-eglcore.so.${PORTVERSION} \ + libnvidia-fbc.so.${PORTVERSION} \ + libnvidia-glsi.so.${PORTVERSION} \ + libnvidia-ifr.so.${PORTVERSION} +LINUX32_LINKS+= libnvidia-fbc.so.${PORTVERSION} libnvidia-fbc.so.1 \ + libnvidia-fbc.so.${PORTVERSION} libnvidia-fbc.so \ + libnvidia-ifr.so.${PORTVERSION} libnvidia-ifr.so.1 \ + libnvidia-ifr.so.${PORTVERSION} libnvidia-ifr.so +.else +PLIST_RE+= '\,${LINUXBASE}.*libnvidia-(eglcore|fbc|glsi|ifr),d' +.endif +.if ${NVVERSION} >= 310.014 +LINUX_LIBS+= libnvidia-encode.so.${PORTVERSION} +LINUX_LINKS+= libnvidia-encode.so.${PORTVERSION} libnvidia-encode.so.1 \ + libnvidia-encode.so.${PORTVERSION} libnvidia-encode.so +LINUX32_LIBS+= libnvidia-encode.so.${PORTVERSION} +LINUX32_LINKS+= libnvidia-encode.so.${PORTVERSION} libnvidia-encode.so.1 \ + libnvidia-encode.so.${PORTVERSION} libnvidia-encode.so +PLIST_RE+= '\,${LINUXBASE}.*libXvMCNVIDIA,d' +.else +LINUX_LIBS+= libXvMCNVIDIA.so.${PORTVERSION} +LINUX_LINKS+= libXvMCNVIDIA.so.${PORTVERSION} libXvMCNVIDIA_dynamic.so.1 \ + libXvMCNVIDIA.so.${PORTVERSION} libXvMCNVIDIA_dynamic.so +PLIST_RE+= '\,${LINUXBASE}.*libnvidia-encode,d' +.endif +.if ${NVVERSION} >= 346.016 +LINUX_LIBS+= libnvidia-gtk2.so.${PORTVERSION} \ + libnvidia-gtk3.so.${PORTVERSION} +.else +PLIST_RE+= '\,${LINUXBASE}.*libnvidia-gtk(2|3)\.so,d' +.endif +.if ${NVVERSION} >= 331.049 && ${NVVERSION} < 352.009 +LINUX_DATA+= monitoring.conf /usr/share/nvidia \ + ${WRKSRC}/pci.ids /usr/share/nvidia +.else +PLIST_RE+= '\,${LINUXBASE}.*monitoring\.conf,d' \ + '\,${LINUXBASE}.*pci\.ids,d' +.endif +.if ${NVVERSION} >= 334.016 +LINUX_DATA+= nvidia-application-profiles-${PORTVERSION}-key-documentation /usr/share/nvidia +.else +PLIST_RE+= '\,${LINUXBASE}.*application-profiles-${PORTVERSION}-key-documentation,d' +.endif +.if ${NVVERSION} >= 319.012 +LINUX_DATA+= nvidia-application-profiles-${PORTVERSION}-rc /usr/share/nvidia +.else +PLIST_RE+= '\,${LINUXBASE}.*share/nvidia,d' +.endif +.if ${NVVERSION} >= 319.017 +LINUX_PROGS+= nvidia-cuda-mps-control nvidia-cuda-mps-server \ + nvidia-persistenced +LINUX_MANS+= nvidia-cuda-mps-control nvidia-persistenced +.else +LINUX_PROGS+= nvidia-cuda-proxy-control nvidia-cuda-proxy-server +LINUX_MANS+= nvidia-cuda-proxy-control +PLIST_RE+= '\,${LINUXBASE},s/cuda-mps/cuda-proxy/' \ + '\,${LINUXBASE}.*nvidia-persistenced,d' +.endif +.if ${NVVERSION} >= 364.012 +LINUX_DATA+= nvidia_icd.json /etc/vulkan/icd.d +.else +PLIST_RE+= '\,${LINUXBASE}/etc/vulkan,d' +.endif + +PLIST_SUB+= LINUXBASE=${LINUXBASE} \ + LINUX_LIBDIR=${LINUX_LIBDIR} \ + SHLIB_VERSION=${PORTVERSION} \ MODULESDIR=${MODULESDIR} -.include <bsd.port.options.mk> +.include <bsd.port.pre.mk> -.if ${PORT_OPTIONS:MLINUX} -CONFLICTS_INSTALL= linux[-_]dri-[0-9]* linux-f10-dri-[0-9]* -USES+= linux -USE_LINUX= base:build,run xorglibs -PLIST_SUB+= LINUX="" +.if ${NVVERSION} >= 310.014 +LINUX32_LIBS+= libnvcuvid.so.${PORTVERSION} +LINUX32_LINKS+= libnvcuvid.so.${PORTVERSION} libnvcuvid.so.1 \ + libnvcuvid.so.${PORTVERSION} libnvcuvid.so +.elif "${LINUX_ARCH}" == "x86_64" +PLIST_RE+= '\,${LINUXBASE}/usr/lib/libnvcuvid\.so,d' +.endif + +.if "${LINUX_ARCH}" == "x86_64" +PLIST_SUB+= LINUX32="" .else -PLIST_SUB+= LINUX="@comment " -# Propagate WITHOUT_LINUX variable down to inner Makefiles -MAKE_ENV+= WITHOUT_LINUX=yes +PLIST_SUB+= LINUX32="@comment " .endif +post-extract-LINUX-on: + @(cd ${WRKDIR} && ${SH} \ + ${DISTDIR}/NVIDIA-Linux-${LINUX_ARCH_SUFX}-${DISTVERSION}.run \ + --extract-only > /dev/null) + +pre-patch: +.for p in ${SUB_PATCHES} + @${SED} 's/%%NVSRC%%/${NVSRC}/g' ${PATCHDIR}/${p}.in > ${WRKDIR}/${p} +.endfor +.for p in ${SUB_PATCHES} +EXTRA_PATCHES+= ${WRKDIR}/${p} +.endfor + post-patch: .SILENT # We should support -CURRENT: kill the check ${REINPLACE_CMD} -e '24,26d' ${WRKSRC}/src/${NVSRC}/nv-freebsd.h @@ -136,8 +434,8 @@ post-patch: .SILENT -e 's/kmem_free(kmem_arena, /kmem_free(/' \ ${WRKSRC}/src/${NVSRC}/nvidia_subr.c .endif -# Respect WITHOUT_LINUX setting - ${REINPLACE_CMD} -e 's/exists(\/.*/& \&\& !defined(WITHOUT_LINUX)/' \ +# Disable installation of Linux libraries + ${REINPLACE_CMD} -e 's/exists(\/.*/& \&\& 0/' \ ${WRKSRC}/lib/Makefile # Do not install VDPAU libraries which are provided by `multimedia/libvdpau' # port for a while now @@ -197,6 +495,13 @@ post-patch: .SILENT ${REINPLACE_CMD} -E 's/(x11).*/\1/ ; /doc/d' ${WRKSRC}/Makefile .endif +post-patch-LINUX-on: +.if ${NVVERSION} >= 384.047 + @${SED} 's/__NV_VK_ICD__/libGLX_nvidia.so.0/' \ + ${LINUX_WRKSRC}/nvidia_icd.json.template > \ + ${LINUX_WRKSRC}/nvidia_icd.json +.endif + pre-install: @${MKDIR} ${STAGEDIR}${PREFIX}/${MODULESDIR}/drivers \ ${STAGEDIR}${PREFIX}/${MODULESDIR}/extensions @@ -206,37 +511,41 @@ post-install: .SILENT ${STAGEDIR}${PREFIX}/bin # pkg-plist is already overbloated, so use these hacks instead of PLIST_SUB's .if ${NVVERSION} >= 304.128 && ${NVVERSION} < 310.019 || ${NVVERSION} >= 361.016 - ${REINPLACE_CMD} -E '/libvdpau(_trace)?\.so/d' ${TMPPLIST} + ${REINPLACE_CMD} -E '\,${LINUXBASE},!{/libvdpau(_trace)?\.so/d;}' \ + ${TMPPLIST} .endif .if ${NVVERSION} >= 310.019 - ${REINPLACE_CMD} -e '/libXvMCNVIDIA/d' ${TMPPLIST} + ${REINPLACE_CMD} -e '\,${LINUXBASE},!{/libXvMCNVIDIA/d;}' ${TMPPLIST} .else # some applications need this symlink (see PR ports/72877) ${LN} -sf libXvMCNVIDIA.so.1 \ ${STAGEDIR}${PREFIX}/lib/libXvMCNVIDIA_dynamic.so.1 .endif .if ${NVVERSION} < 331.013 || ${ARCH} == amd64 && ${NVVERSION} < 334.016 - ${REINPLACE_CMD} -E '/lib(nvidia-)?(EGL|eglcore|GLESv|glsi)/d' \ + ${REINPLACE_CMD} -E '\,${LINUXBASE},!{/lib(nvidia-)?(EGL|eglcore|GLESv|glsi)/d;}' \ ${TMPPLIST} .endif .if ${NVVERSION} < 352.009 - ${REINPLACE_CMD} -E '/(lib)?nvidia-(debugdump|smi|ml)/d' ${TMPPLIST} + ${REINPLACE_CMD} -E '\,${LINUXBASE},!{/(lib)?nvidia-(debugdump|smi|ml)/d;}' \ + ${TMPPLIST} .endif .if ${NVVERSION} < 355.006 - ${REINPLACE_CMD} -E '/(libEGL_nvidia|GLdispatch|OpenGL)/d' ${TMPPLIST} + ${REINPLACE_CMD} -E '\,${LINUXBASE},!{/(libEGL_nvidia|GLdispatch|OpenGL)/d;}' \ + ${TMPPLIST} .else - ${REINPLACE_CMD} 's/libEGL\.so\.${PORTVERSION}/libEGL.so/' \ + ${REINPLACE_CMD} '\,${LINUXBASE},!s/libEGL\.so\.${PORTVERSION}/libEGL.so/' \ ${TMPPLIST} .endif .if ${NVVERSION} < 358.009 ${REINPLACE_CMD} '/nvidia-modeset.ko/d' ${TMPPLIST} .endif .if ${NVVERSION} >= 361.028 - ${REINPLACE_CMD} -E '/(EGL_nvidia\.so|GLESv[12](_CM)?(\.so\.[0-9]+\.[0-9]+))$$/d' \ + ${REINPLACE_CMD} -E '\,${LINUXBASE},!{/(EGL_nvidia\.so|GLESv[12](_CM)?(\.so\.[0-9]+\.[0-9]+))$$/d;}' \ ${TMPPLIST} .else - ${REINPLACE_CMD} -E '/\/lib\/libGLESv[12](_CM)?(\.so)?(_nvidia.so(\.[0-9]|\.[0-9]+\.[0-9]+)?)?$$/d ; \ - /libEGL_nvidia\.so\.${PORTVERSION}/d' ${TMPPLIST} + ${REINPLACE_CMD} -E '\,${LINUXBASE},!{/\/lib\/libGLESv[12](_CM)?(\.so)?(_nvidia.so(\.[0-9]|\.[0-9]+\.[0-9]+)?)?$$/d ; \ + /libEGL_nvidia\.so\.${PORTVERSION}/d;}' ${TMPPLIST} .endif + ${REINPLACE_CMD} -E ${PLIST_RE:S/^/-e /} ${TMPPLIST} # rename libGL.so, libEGL.so and libGLESv2.so ${MV} -f ${STAGEDIR}${PREFIX}/lib/libGL.so \ ${STAGEDIR}${PREFIX}/lib/libGL-NVIDIA.so @@ -256,6 +565,45 @@ post-install: .SILENT ${INSTALL_DATA} ${WRKDIR}/nvidia.conf \ ${STAGEDIR}${PREFIX}/etc/libmap.d/ +post-install-LINUX-on: +.for f d in ${LINUX_DATA} + ${MKDIR} ${STAGEDIR}${LINUXBASE}${d} + ${INSTALL_DATA} ${LINUX_WRKSRC}/${f} ${STAGEDIR}${LINUXBASE}${d} +.endfor + ${MKDIR} ${STAGEDIR}${LINUXBASE}/usr/bin + ${INSTALL_SCRIPT} ${LINUX_WRKSRC}/nvidia-bug-report.sh \ + ${STAGEDIR}${LINUXBASE}/usr/bin +.for p in ${LINUX_PROGS} + ${INSTALL_PROGRAM} ${LINUX_WRKSRC}/${p} ${STAGEDIR}${LINUXBASE}/usr/bin +.endfor + ${MKDIR} ${STAGEDIR}${LINUXBASE}/usr/share/man/man1 +.for m in ${LINUX_MANS} + ${INSTALL_MAN} ${LINUX_WRKSRC}/${m}.1.gz \ + ${STAGEDIR}${LINUXBASE}/usr/share/man/man1 +.endfor + ${MKDIR} ${STAGEDIR}${LINUXBASE}${LINUX_LIBDIR}/tls + ${MKDIR} ${STAGEDIR}${LINUXBASE}${LINUX_LIBDIR}/vdpau +.for l in ${LINUX_LIBS} + ${INSTALL_LIB} ${LINUX_WRKSRC}/${l} \ + ${STAGEDIR}${LINUXBASE}${LINUX_LIBDIR}/${l} +.endfor +.for s t in ${LINUX_LINKS} + ${RLN} ${STAGEDIR}${LINUXBASE}${LINUX_LIBDIR}/${s} \ + ${STAGEDIR}${LINUXBASE}${LINUX_LIBDIR}/${t} +.endfor +.if "${LINUX_ARCH}" == "x86_64" + ${MKDIR} ${STAGEDIR}${LINUXBASE}/usr/lib/tls + ${MKDIR} ${STAGEDIR}${LINUXBASE}/usr/lib/vdpau +.for l in ${LINUX32_LIBS} + ${INSTALL_LIB} ${LINUX_WRKSRC}/32/${l} \ + ${STAGEDIR}${LINUXBASE}/usr/lib/${l} +.endfor +.for s t in ${LINUX32_LINKS} + ${RLN} ${STAGEDIR}${LINUXBASE}/usr/lib/${s} \ + ${STAGEDIR}${LINUXBASE}/usr/lib/${t} +.endfor +.endif + # Target below can be used instead of standard `makesum' to correctly # update distinfo (i.e., keeping other driver version entries intact) .if ${.TARGETS:Mupdate-distinfo} @@ -269,4 +617,4 @@ update-distinfo: makesum .SILENT ${MASTERDIR}/distinfo ${RM} ${DISTINFO_FILE} ${MASTERDIR}/distinfo.bak -.include <bsd.port.mk> +.include <bsd.port.post.mk> Modified: head/x11/nvidia-driver/distinfo ============================================================================== --- head/x11/nvidia-driver/distinfo Fri Dec 14 16:18:16 2018 (r487445) +++ head/x11/nvidia-driver/distinfo Fri Dec 14 16:24:02 2018 (r487446) @@ -1,13 +1,25 @@ TIMESTAMP = 1482026038 SHA256 (NVIDIA-FreeBSD-x86_64-390.87.tar.gz) = 221c80982378a333f541646d5d2030c72311c491f5a0f98b93fdd95cd5be11fc SIZE (NVIDIA-FreeBSD-x86_64-390.87.tar.gz) = 63648591 +SHA256 (NVIDIA-Linux-x86_64-390.87.run) = 38290a0b19e86037112f22397e02be9cdd6bcd677dd926b2977bbd49119e611e +SIZE (NVIDIA-Linux-x86_64-390.87.run) = 82690871 SHA256 (NVIDIA-FreeBSD-x86-390.87.tar.gz) = a2e61b0c541aa9bdcde7de43cd88a7ce5ff3de9fdafe60fa7d6e10942186d7d4 SIZE (NVIDIA-FreeBSD-x86-390.87.tar.gz) = 64326801 +SHA256 (NVIDIA-Linux-x86-390.87.run) = 5c29c5f9d80a07ea71219c6323fe5fc9b7577847b970f23161685d4b890b9966 +SIZE (NVIDIA-Linux-x86-390.87.run) = 47959124 SHA256 (NVIDIA-FreeBSD-x86_64-340.107.tar.gz) = 047efae28cc81e4d56c64d2a0c15d9b7ff07f09bba22696464de8276334a4df7 SIZE (NVIDIA-FreeBSD-x86_64-340.107.tar.gz) = 61179967 +SHA256 (NVIDIA-Linux-x86_64-340.107.run) = e3e359964ed568008584c4fb2dbcb76b76a848591d1456a783e94dd0c7f6695f +SIZE (NVIDIA-Linux-x86_64-340.107.run) = 70233686 SHA256 (NVIDIA-FreeBSD-x86-340.107.tar.gz) = 1978ae48512d8a693979b153463c76954d2aec91a6b2a568b3aa1198e5b3d199 SIZE (NVIDIA-FreeBSD-x86-340.107.tar.gz) = 60305952 +SHA256 (NVIDIA-Linux-x86-340.107.run) = 8d8bd2b04019eaa55d848534e2dbdc460be918e7731ecd8da87199ef9c1a0856 +SIZE (NVIDIA-Linux-x86-340.107.run) = 39016798 SHA256 (NVIDIA-FreeBSD-x86_64-304.137.tar.gz) = 231693189e1bdf5c1dd02315cde5ef9ed6c0854564314438f2f40f9788a34120 SIZE (NVIDIA-FreeBSD-x86_64-304.137.tar.gz) = 36474676 +SHA256 (NVIDIA-Linux-x86_64-304.137.run) = eb1f56db3a2bea13e3ccde7b5ae14abe8cd6c6dbe69af4c71c68a623cc96e3e2 +SIZE (NVIDIA-Linux-x86_64-304.137.run) = 70087133 SHA256 (NVIDIA-FreeBSD-x86-304.137.tar.gz) = 5f874133853eacc5b9a10311cec22d3c4898db7f75b92bb6c12d5be5126516fb SIZE (NVIDIA-FreeBSD-x86-304.137.tar.gz) = 35399011 +SHA256 (NVIDIA-Linux-x86-304.137.run) = ca98379fc2090bdfe8b74113d6ac7bcc7eadbd86a489c3c4ec4cd5ba9f6064f8 +SIZE (NVIDIA-Linux-x86-304.137.run) = 41504115 Copied and modified: head/x11/nvidia-driver/files/extra-patch-src-Makefile.in (from r487445, head/x11/nvidia-driver/files/extra-patch-src-Makefile) ============================================================================== --- head/x11/nvidia-driver/files/extra-patch-src-Makefile Fri Dec 14 16:18:16 2018 (r487445, copy source) +++ head/x11/nvidia-driver/files/extra-patch-src-Makefile.in Fri Dec 14 16:24:02 2018 (r487446) @@ -1,6 +1,6 @@ ---- src/Makefile.orig 2014-04-04 23:24:59.000000000 +0200 -+++ src/Makefile 2014-05-06 14:31:07.000000000 +0200 -@@ -24,6 +24,15 @@ +--- src/%%NVSRC%%/Makefile.orig 2017-09-14 20:46:30 UTC ++++ src/%%NVSRC%%/Makefile +@@ -30,6 +30,15 @@ NOOBJ= true stdarg.h: @ln -s machine/stdarg.h stdarg.h Copied and modified: head/x11/nvidia-driver/files/extra-patch-src-nv-freebsd.h.in (from r487445, head/x11/nvidia-driver/files/extra-patch-src-nv-freebsd.h) ============================================================================== --- head/x11/nvidia-driver/files/extra-patch-src-nv-freebsd.h Fri Dec 14 16:18:16 2018 (r487445, copy source) +++ head/x11/nvidia-driver/files/extra-patch-src-nv-freebsd.h.in Fri Dec 14 16:24:02 2018 (r487446) @@ -1,6 +1,6 @@ ---- src/nv-freebsd.h.orig 2014-02-13 05:07:44.000000000 +0100 -+++ src/nv-freebsd.h 2014-05-05 18:38:59.000000000 +0200 -@@ -143,6 +143,11 @@ +--- src/%%NVSRC%%/nv-freebsd.h.orig 2017-09-14 20:46:30 UTC ++++ src/%%NVSRC%%/nv-freebsd.h +@@ -157,6 +157,11 @@ MALLOC_DECLARE(M_NVIDIA); #define NV_SUPPORT_ACPI_PM /* Copied and modified: head/x11/nvidia-driver/files/extra-patch-src-nv-misc.h.in (from r487445, head/x11/nvidia-driver/files/extra-patch-src-nv-misc.h) ============================================================================== --- head/x11/nvidia-driver/files/extra-patch-src-nv-misc.h Fri Dec 14 16:18:16 2018 (r487445, copy source) +++ head/x11/nvidia-driver/files/extra-patch-src-nv-misc.h.in Fri Dec 14 16:24:02 2018 (r487446) @@ -1,5 +1,5 @@ ---- src/nv-misc.h.orig 2014-02-13 05:07:44.000000000 +0100 -+++ src/nv-misc.h 2014-05-05 18:45:44.000000000 +0200 +--- src/%%NVSRC%%/nv-misc.h.orig 2017-09-14 20:46:30 UTC ++++ src/%%NVSRC%%/nv-misc.h @@ -11,6 +11,8 @@ #ifndef _NV_MISC_H_ #define _NV_MISC_H_ Added: head/x11/nvidia-driver/files/extra-patch-src-nvidia_ctl.c.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/x11/nvidia-driver/files/extra-patch-src-nvidia_ctl.c.in Fri Dec 14 16:24:02 2018 (r487446) @@ -0,0 +1,75 @@ +--- src/%%NVSRC%%/nvidia_ctl.c.orig 2017-09-14 20:46:30 UTC ++++ src/%%NVSRC%%/nvidia_ctl.c +@@ -13,6 +13,12 @@ + #include "nv.h" + #include "nv-freebsd.h" + ++#ifdef NV_SUPPORT_LINUX_COMPAT /* (COMPAT_LINUX || COMPAT_LINUX32) */ ++#include <compat/linux/linux_util.h> ++ ++const char nvidia_driver_name[] = "nvidia"; ++#endif ++ + static d_open_t nvidia_ctl_open; + static void nvidia_ctl_dtor(void *arg); + static d_ioctl_t nvidia_ctl_ioctl; +@@ -138,6 +144,18 @@ static int nvidia_ctl_poll( + + int nvidia_ctl_attach(void) + { ++#ifdef NV_SUPPORT_LINUX_COMPAT ++ struct linux_device_handler nvidia_ctl_linux_handler = { ++ .bsd_driver_name = __DECONST(char *, nvidia_driver_name), ++ .linux_driver_name = __DECONST(char *, nvidia_driver_name), ++ .bsd_device_name = __DECONST(char *, nvidia_ctl_cdevsw.d_name), ++ .linux_device_name = __DECONST(char *, nvidia_ctl_cdevsw.d_name), ++ .linux_major = NV_MAJOR_DEVICE_NUMBER, ++ .linux_minor = 255, ++ .linux_char_device = 1 ++ }; ++#endif ++ + if (nvidia_count == 0) { + nvidia_ctl_cdev = make_dev(&nvidia_ctl_cdevsw, + CDEV_CTL_MINOR, +@@ -145,6 +163,10 @@ int nvidia_ctl_attach(void) + "%s", nvidia_ctl_cdevsw.d_name); + if (nvidia_ctl_cdev == NULL) + return ENOMEM; ++ ++#ifdef NV_SUPPORT_LINUX_COMPAT ++ (void)linux_device_register_handler(&nvidia_ctl_linux_handler); ++#endif + } + + nvidia_count++; +@@ -153,13 +175,28 @@ int nvidia_ctl_attach(void) + + int nvidia_ctl_detach(void) + { ++#ifdef NV_SUPPORT_LINUX_COMPAT ++ struct linux_device_handler nvidia_ctl_linux_handler = { ++ .bsd_driver_name = __DECONST(char *, nvidia_driver_name), ++ .linux_driver_name = __DECONST(char *, nvidia_driver_name), ++ .bsd_device_name = __DECONST(char *, nvidia_ctl_cdevsw.d_name), ++ .linux_device_name = __DECONST(char *, nvidia_ctl_cdevsw.d_name), ++ .linux_major = NV_MAJOR_DEVICE_NUMBER, ++ .linux_minor = 255, ++ .linux_char_device = 1 ++ }; ++#endif + struct nvidia_softc *sc; + + sc = &nvidia_ctl_sc; + nvidia_count--; + +- if (nvidia_count == 0) ++ if (nvidia_count == 0) { ++#ifdef NV_SUPPORT_LINUX_COMPAT ++ (void)linux_device_unregister_handler(&nvidia_ctl_linux_handler); ++#endif + destroy_dev(nvidia_ctl_cdev); ++ } + + return 0; + } Added: head/x11/nvidia-driver/files/extra-patch-src-nvidia_dev.c.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/x11/nvidia-driver/files/extra-patch-src-nvidia_dev.c.in Fri Dec 14 16:24:02 2018 (r487446) @@ -0,0 +1,66 @@ +--- src/%%NVSRC%%/nvidia_dev.c.orig 2017-09-14 20:46:30 UTC ++++ src/%%NVSRC%%/nvidia_dev.c +@@ -13,6 +13,12 @@ + #include "nv.h" + #include "nv-freebsd.h" + ++#ifdef NV_SUPPORT_LINUX_COMPAT /* (COMPAT_LINUX || COMPAT_LINUX32) */ ++#include <compat/linux/linux_util.h> ++ ++extern const char nvidia_driver_name[]; ++#endif ++ + static d_open_t nvidia_dev_open; + static void nvidia_dev_dtor(void *arg); + static d_ioctl_t nvidia_dev_ioctl; +@@ -162,6 +168,18 @@ static int nvidia_dev_mmap_single( + + int nvidia_dev_attach(struct nvidia_softc *sc) + { ++#ifdef NV_SUPPORT_LINUX_COMPAT ++ struct linux_device_handler nvidia_dev_linux_handler = { ++ .bsd_driver_name = __DECONST(char *, nvidia_driver_name), ++ .linux_driver_name = __DECONST(char *, nvidia_driver_name), ++ .bsd_device_name = NULL, ++ .linux_device_name = NULL, ++ .linux_major = NV_MAJOR_DEVICE_NUMBER, ++ .linux_minor = device_get_unit(sc->dev), ++ .linux_char_device = 1 ++ }; ++#endif ++ + sc->cdev = make_dev(&nvidia_dev_cdevsw, + device_get_unit(sc->dev), + UID_ROOT, GID_WHEEL, 0666, +@@ -172,11 +190,31 @@ int nvidia_dev_attach(struct nvidia_softc *sc) + + sc->cdev->si_drv1 = sc; + ++#ifdef NV_SUPPORT_LINUX_COMPAT ++ nvidia_dev_linux_handler.bsd_device_name = sc->cdev->si_name; ++ nvidia_dev_linux_handler.linux_device_name = sc->cdev->si_name; ++ (void)linux_device_register_handler(&nvidia_dev_linux_handler); ++#endif ++ + return 0; + } + + int nvidia_dev_detach(struct nvidia_softc *sc) + { ++#ifdef NV_SUPPORT_LINUX_COMPAT ++ struct linux_device_handler nvidia_dev_linux_handler = { ++ .bsd_driver_name = __DECONST(char *, nvidia_driver_name), ++ .linux_driver_name = __DECONST(char *, nvidia_driver_name), ++ .bsd_device_name = sc->cdev->si_name, ++ .linux_device_name = sc->cdev->si_name, ++ .linux_major = NV_MAJOR_DEVICE_NUMBER, ++ .linux_minor = device_get_unit(sc->dev), ++ .linux_char_device = 1 ++ }; ++ ++ (void)linux_device_unregister_handler(&nvidia_dev_linux_handler); ++#endif ++ + destroy_dev(sc->cdev); + return 0; + } Added: head/x11/nvidia-driver/files/extra-patch-src-nvidia_linux.c.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/x11/nvidia-driver/files/extra-patch-src-nvidia_linux.c.in Fri Dec 14 16:24:02 2018 (r487446) @@ -0,0 +1,35 @@ +--- src/%%NVSRC%%/nvidia_linux.c.orig 2017-09-14 20:46:30 UTC ++++ src/%%NVSRC%%/nvidia_linux.c +@@ -35,23 +35,16 @@ int linux_ioctl_nvidia( + struct linux_ioctl_args *args + ) + { +- struct file *fp; +- int error; +-#if __FreeBSD_version >= 1000053 +- cap_rights_t rights; +-#endif +- u_long cmd; ++ static const uint32_t dir[4] = { IOC_VOID, IOC_IN, IOC_OUT, IOC_INOUT }; + +- error = fget(td, args->fd, cap_rights_init(&rights, CAP_IOCTL), &fp); +- if (error != 0) +- return error; +- +- cmd = args->cmd; +- +- error = fo_ioctl(fp, cmd, (caddr_t)args->arg, td->td_ucred, td); +- fdrop(fp, td); +- +- return error; ++ if ((args->cmd & (1<<29)) != 0) { ++ /* FreeBSD has only 13 bits to encode the size. */ ++ printf("nvidia: pid %d (%s): ioctl cmd=0x%x size too large\n", ++ (int)td->td_proc->p_pid, td->td_proc->p_comm, args->cmd); ++ return (EINVAL); ++ } ++ args->cmd = (args->cmd & ~IOC_DIRMASK) | dir[args->cmd >> 30]; ++ return (sys_ioctl(td, (struct ioctl_args *)args)); + } + + struct linux_ioctl_handler nvidia_handler = { Added: head/x11/nvidia-driver/files/extra-patch-src-nvidia_pci.c.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/x11/nvidia-driver/files/extra-patch-src-nvidia_pci.c.in Fri Dec 14 16:24:02 2018 (r487446) @@ -0,0 +1,10 @@ +--- src/%%NVSRC%%/nvidia_pci.c.orig 2017-09-14 20:46:30 UTC ++++ src/%%NVSRC%%/nvidia_pci.c +@@ -405,4 +405,7 @@ MODULE_DEPEND(nvidia, agp, 1, 1, 1); + + #ifdef NV_SUPPORT_LINUX_COMPAT /* (COMPAT_LINUX || COMPAT_LINUX32) */ + MODULE_DEPEND(nvidia, linux, 1, 1, 1); ++#if defined(NVCPU_X86_64) ++MODULE_DEPEND(nvidia, linux_common, 1, 1, 1); ++#endif + #endif Modified: head/x11/nvidia-driver/files/extra-patch-src_nvidia-modeset_nvidia-modeset-freebsd.c ============================================================================== --- head/x11/nvidia-driver/files/extra-patch-src_nvidia-modeset_nvidia-modeset-freebsd.c Fri Dec 14 16:18:16 2018 (r487445) +++ head/x11/nvidia-driver/files/extra-patch-src_nvidia-modeset_nvidia-modeset-freebsd.c Fri Dec 14 16:24:02 2018 (r487446) @@ -1,7 +1,23 @@ ---- src/nvidia-modeset/nvidia-modeset-freebsd.c.orig 2016-05-28 15:44:11 UTC +--- src/nvidia-modeset/nvidia-modeset-freebsd.c.orig 2018-08-21 23:09:28 UTC +++ src/nvidia-modeset/nvidia-modeset-freebsd.c -@@ -245,7 +245,7 @@ struct nvkms_ref_ptr { +@@ -25,6 +25,7 @@ + #include <sys/poll.h> + #include <sys/file.h> + #include <sys/proc.h> ++#include <sys/sysproto.h> + #include "nvkms-ioctl.h" + #include "nvidia-modeset-os-interface.h" +@@ -48,6 +49,7 @@ + #include "machine/../linux32/linux32_proto.h" + #endif + #include <compat/linux/linux_ioctl.h> ++ #include <compat/linux/linux_util.h> + #endif + + +@@ -250,7 +252,7 @@ struct nvkms_ref_ptr { + struct nvkms_ref_ptr* NVKMS_API_CALL nvkms_alloc_ref_ptr(void *ptr) { - struct nvkms_ref_ptr *ref_ptr = nvkms_alloc(sizeof(*ref_ptr), NV_FALSE); @@ -9,3 +25,80 @@ if (ref_ptr) { mtx_init(&ref_ptr->lock, "nvkms-ref-ptr-lock", NULL, MTX_SPIN); // The ref_ptr owner counts as a reference on the ref_ptr itself. +@@ -867,33 +869,31 @@ static int nvkms_poll( + *************************************************************************/ + + #if defined(NVKMS_SUPPORT_LINUX_COMPAT) ++static struct linux_device_handler nvkms_linux_device_handler = { ++ .bsd_driver_name = "nvidia-modeset", ++ .linux_driver_name = "nvidia-modeset", ++ .bsd_device_name = "nvidia-modeset", ++ .linux_device_name = "nvidia-modeset", ++ .linux_major = 195, ++ .linux_minor = 254, ++ .linux_char_device = 1 ++}; + + static int nvkms_linux_ioctl_function( + struct thread *td, + struct linux_ioctl_args *args + ) + { +- struct file *fp; +- int status; +- u_long cmd; ++ static const uint32_t dir[4] = { IOC_VOID, IOC_IN, IOC_OUT, IOC_INOUT }; + +-#if NV_FGET_HAS_CAP_RIGHTS_T_ARG +- cap_rights_t rights; +- status = fget(td, args->fd, cap_rights_init(&rights, CAP_IOCTL), &fp); +-#else +- status = fget(td, args->fd, &fp); +-#endif +- +- if (status != 0) { +- return status; ++ if ((args->cmd & (1<<29)) != 0) { ++ /* FreeBSD has only 13 bits to encode the size. */ ++ printf("nvidia: pid %d (%s): ioctl cmd=0x%x size too large\n", ++ (int)td->td_proc->p_pid, td->td_proc->p_comm, args->cmd); ++ return (EINVAL); + } +- +- cmd = args->cmd; +- +- status = fo_ioctl(fp, cmd, (caddr_t)args->arg, td->td_ucred, td); +- fdrop(fp, td); +- +- return status; ++ args->cmd = (args->cmd & ~IOC_DIRMASK) | dir[args->cmd >> 30]; ++ return (sys_ioctl(td, (struct ioctl_args *)args)); + } + + #define NVKMS_LINUX_IOCTL_MIN _IOC(0, NVKMS_IOCTL_MAGIC, NVKMS_IOCTL_CMD, 0) +@@ -909,6 +909,7 @@ static struct linux_ioctl_handler nvkms_linux_ioctl_ha + static void nvkms_linux_compat_load(void) + { + #if defined(NVKMS_SUPPORT_LINUX_COMPAT) ++ linux_device_register_handler(&nvkms_linux_device_handler); + linux_ioctl_register_handler(&nvkms_linux_ioctl_handler); + #endif + } +@@ -917,6 +918,7 @@ static void nvkms_linux_compat_unload(void) + { + #if defined(NVKMS_SUPPORT_LINUX_COMPAT) + linux_ioctl_unregister_handler(&nvkms_linux_ioctl_handler); ++ linux_device_unregister_handler(&nvkms_linux_device_handler); + #endif + } + +@@ -1100,4 +1102,9 @@ MODULE_DEPEND(nvidia_modeset, /* module + MODULE_DEPEND(nvidia_modeset, /* module name */ + linux, /* prerequisite module */ + 1, 1, 1); /* vmin, vpref, vmax */ ++#if defined(NVCPU_X86_64) ++MODULE_DEPEND(nvidia_modeset, /* module name */ ++ linux_common, /* prerequisite module */ ++ 1, 1, 1); /* vmin, vpref, vmax */ ++#endif + #endif Modified: head/x11/nvidia-driver/pkg-plist ============================================================================== --- head/x11/nvidia-driver/pkg-plist Fri Dec 14 16:18:16 2018 (r487445) +++ head/x11/nvidia-driver/pkg-plist Fri Dec 14 16:24:02 2018 (r487446) @@ -34,47 +34,171 @@ man/man1/nvidia-smi.1.gz %%MODULESDIR%%/extensions/.nvidia/libglx.so.1 /%%KMODDIR%%/nvidia.ko /%%KMODDIR%%/nvidia-modeset.ko -%%LINUX%%%%LINUXBASE%%/usr/lib/libEGL.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/libEGL.so.1 -%%LINUX%%@postunexec [ ! -e %%LINUXBASE%%/usr/lib/libEGL.so.1.0.0 ] || ln -sf libEGL.so.1.0.0 %%LINUXBASE%%/usr/lib/libEGL.so.1 -%%LINUX%%%%LINUXBASE%%/usr/lib/libEGL_nvidia.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/libEGL_nvidia.so.0 -%%LINUX%%%%LINUXBASE%%/usr/lib/libEGL_nvidia.so -%%LINUX%%%%LINUXBASE%%/usr/lib/libGL.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/libGL.so.1 -%%LINUX%%@postunexec [ ! -e %%LINUXBASE%%/usr/lib/libGL.so.1.2.0 ] || ln -sf libGL.so.1.2.0 %%LINUXBASE%%/usr/lib/libGL.so.1 -%%LINUX%%%%LINUXBASE%%/usr/lib/libGLESv1_CM.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/libGLESv1_CM.so.1 -%%LINUX%%%%LINUXBASE%%/usr/lib/libGLESv1_CM.so -%%LINUX%%%%LINUXBASE%%/usr/lib/libGLESv1_CM_nvidia.so.1 -%%LINUX%%%%LINUXBASE%%/usr/lib/libGLESv1_CM_nvidia.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/libGLESv2.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/libGLESv2.so.2 -%%LINUX%%%%LINUXBASE%%/usr/lib/libGLESv2.so -%%LINUX%%%%LINUXBASE%%/usr/lib/libGLESv2_nvidia.so.2 -%%LINUX%%%%LINUXBASE%%/usr/lib/libGLESv2_nvidia.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/libGLdispatch.so -%%LINUX%%%%LINUXBASE%%/usr/lib/libGLdispatch.so.0 -%%LINUX%%%%LINUXBASE%%/usr/lib/libOpenGL.so -%%LINUX%%%%LINUXBASE%%/usr/lib/libOpenGL.so.0 -%%LINUX%%%%LINUXBASE%%/usr/lib/libcuda.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/libcuda.so.1 -%%LINUX%%%%LINUXBASE%%/usr/lib/libnvidia-eglcore.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/libnvidia-glcore.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/libnvidia-glsi.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/libnvidia-tls.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/libvdpau.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/libvdpau.so.1 -%%LINUX%%%%LINUXBASE%%/usr/lib/libvdpau_nvidia.so -%%LINUX%%%%LINUXBASE%%/usr/lib/libvdpau_trace.so -%%LINUX%%%%LINUXBASE%%/usr/lib/vdpau/libvdpau_nvidia.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/vdpau/libvdpau_nvidia.so.1 -%%LINUX%%%%LINUXBASE%%/usr/lib/vdpau/libvdpau_trace.so.%%SHLIB_VERSION%% -%%LINUX%%%%LINUXBASE%%/usr/lib/vdpau/libvdpau_trace.so.1 -%%LINUX%%@postexec %%LINUXBASE%%/sbin/ldconfig -r %%LINUXBASE%% -%%LINUX%%@postunexec %%LINUXBASE%%/sbin/ldconfig -r %%LINUXBASE%% -%%LINUX%%@dir %%LINUXBASE%%/usr/lib/vdpau -%%LINUX%%@dir %%LINUXBASE%%/usr/lib +%%LINUX%%%%LINUXBASE%%/etc/OpenCL/vendors/nvidia.icd +%%LINUX%%%%LINUXBASE%%/etc/vulkan/icd.d/nvidia_icd.json +%%LINUX%%%%LINUXBASE%%/usr/bin/nvidia-bug-report.sh +%%LINUX%%%%LINUXBASE%%/usr/bin/nvidia-cuda-mps-control +%%LINUX%%%%LINUXBASE%%/usr/bin/nvidia-cuda-mps-server +%%LINUX%%%%LINUXBASE%%/usr/bin/nvidia-debugdump +%%LINUX%%%%LINUXBASE%%/usr/bin/nvidia-persistenced +%%LINUX%%%%LINUXBASE%%/usr/bin/nvidia-settings +%%LINUX%%%%LINUXBASE%%/usr/bin/nvidia-smi +%%LINUX%%%%LINUXBASE%%/usr/bin/nvidia-xconfig +%%LINUX32%%%%LINUXBASE%%/usr/lib/libEGL.so.1 +%%LINUX32%%@postunexec [ ! -e %%LINUXBASE%%/usr/lib/libEGL.so.1.0.0 ] || ln -sf libEGL.so.1.0.0 %%LINUXBASE%%/usr/lib/libEGL.so.1 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libEGL.so.X +%%LINUX32%%%%LINUXBASE%%/usr/lib/libEGL_nvidia.so.0 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libEGL_nvidia.so.%%SHLIB_VERSION%% +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGL.so.1 +%%LINUX32%%@postunexec [ ! -e %%LINUXBASE%%/usr/lib/libGL.so.1.2.0 ] || ln -sf libGL.so.1.2.0 %%LINUXBASE%%/usr/lib/libGL.so.1 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGL.so.X +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLdispatch.so.0 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLESv1_CM.so.1 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLESv1_CM.so.X +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLESv1_CM_nvidia.so.1 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLESv1_CM_nvidia.so.%%SHLIB_VERSION%% +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLESv2.so.2 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLESv2.so.X +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLESv2_nvidia.so.2 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLESv2_nvidia.so.%%SHLIB_VERSION%% +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLX.so +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLX.so.0 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLX_indirect.so.0 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLX_nvidia.so.0 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libGLX_nvidia.so.%%SHLIB_VERSION%% +%%LINUX32%%%%LINUXBASE%%/usr/lib/libOpenGL.so +%%LINUX32%%%%LINUXBASE%%/usr/lib/libOpenGL.so.0 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libcuda.so +%%LINUX32%%%%LINUXBASE%%/usr/lib/libcuda.so.1 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libcuda.so.%%SHLIB_VERSION%% +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvcuvid.so +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvcuvid.so.1 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvcuvid.so.%%SHLIB_VERSION%% +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-compiler.so.%%SHLIB_VERSION%% +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-eglcore.so.%%SHLIB_VERSION%% +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-encode.so +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-encode.so.1 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-encode.so.%%SHLIB_VERSION%% +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-fatbinaryloader.so.%%SHLIB_VERSION%% +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-fbc.so +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-fbc.so.1 +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-fbc.so.%%SHLIB_VERSION%% +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-glcore.so.%%SHLIB_VERSION%% +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-glsi.so.%%SHLIB_VERSION%% +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-ifr.so +%%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-ifr.so.1 *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812141624.wBEGO2df054326>