Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Mar 2013 01:10:19 GMT
From:      "b.f." <bf@FreeBSD.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/177459: [PATCH] x11/nvidia-driver: fix slave port builds on -CURRENT
Message-ID:  <201303290110.r2T1AJMx084953@red.freebsd.org>
Resent-Message-ID: <201303290120.r2T1K0jD016843@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         177459
>Category:       ports
>Synopsis:       [PATCH] x11/nvidia-driver: fix slave port builds on -CURRENT
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 29 01:20:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     b.f.
>Release:        10.0-CURRENT, i386 and amd64
>Organization:
-
>Environment:
>Description:
In adding patches for recent changes in the linux headers and VM system, we overlooked the fact that patches in x11/nvidia-driver/files are often applied against the slave ports as well as the master port. As a result, some of the slave ports are now broken, either because the patches don't apply to their slightly different source files, or because the slave ports have additional occurrences of obsolete VM constructs that are not fixed by the patches devised for the master port.  Fix this by replacing the patches by sed(1) invocations that work for all the ports, with correct OSVERSION checks.  While here, append to rather than make a late assignment to LIB_DEPENDS, and adjust some of the other VM locking that wasn't needed and is now broken after FreeBSD src r242941.

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: x11/nvidia-driver/Makefile
===================================================================
--- x11/nvidia-driver/Makefile	(revision 315504)
+++ x11/nvidia-driver/Makefile	(working copy)
@@ -86,18 +86,11 @@
 
 PLIST_SUB+=	LINUXBASE=${LINUXBASE} SHLIB_VERSION=${PORTVERSION} \
 		MODULESDIR=${MODULESDIR}
-. if ${OSVERSION} > 1000028
-EXTRA_PATCHES+=	${FILESDIR}/r248084-patch-src-nv-freebsd.h
-EXTRA_PATCHES+=	${FILESDIR}/r248084-patch-src-nvidia_subr.c
-. endif
 
 .if ${PORT_OPTIONS:MLINUX}
 CONFLICTS=	linux[-_]dri-[0-9]* linux-f10-dri-[0-9]*
 USE_LINUX=	yes
 PLIST_SUB+=	LINUX=""
-. if ${OSVERSION} > 1000026
-EXTRA_PATCHES+=	${FILESDIR}/r246085-patch-src-nvidia_linux.c
-. endif
 .else
 PLIST_SUB+=	LINUX="@comment "
 # Propagate WITHOUT_LINUX variable down to inner Makefiles
@@ -109,24 +102,48 @@
 .endif
 
 .if ${NVVERSION} < 1952200
-LIB_DEPENDS=	m.3:${PORTSDIR}/misc/compat5x
+LIB_DEPENDS+=	m.3:${PORTSDIR}/misc/compat5x
 .endif
 
 post-patch: .SILENT
 # We should support -CURRENT: kill the check
 	${REINPLACE_CMD} -e '24,26d' ${WRKSRC}/src/nv-freebsd.h
-# Adjust legacy drivers for updated d_mmap() since early 9.X
+# Adjust legacy drivers for updated d_mmap() since FreeBSD src SVN r201223
 .if ${OSVERSION} > 900005 && ${NVVERSION} < 1952200
 	${REINPLACE_CMD} -e 's/vm_offset_t offset/vm_ooffset_t offset/ ; \
 		s/vm_offset_t \*address/vm_paddr_t *address/ ; \
 		s/int nprot/&, vm_memattr_t *memattr/' \
 			${WRKSRC}/src/nvidia_dev.c
 .endif
+# In the legacy drivers: remove paqe queue locking and add page locking
+# around vm_page_(un)wire after FreeBSD src SVN r207410, r207617, and
+# r207644 ; remove paqe queue locking around vm_page_wakeup after
+# FreeBSD src SVN 163622
+.if ${OSVERSION} > 900011 && ${NVVERSION} < 3046400
+	${REINPLACE_CMD} -E '/vm_page_(un)?lock_queues\(\);/d ; \
+	s/(vm_page_(un)?wire\()([^,]+)(, 0)?(\);)/vm_page_lock(\3); & vm_page_unlock(\3);/' \
+		${WRKSRC}/src/nvidia_subr.c
+.endif
 # Catch up legacy drivers with FreeBSD src SVN r225617
 .if ${OSVERSION} > 900043 && ${NVVERSION} < 1952200
 	${REINPLACE_CMD} -e '/return/s/ioctl/sys_&/' \
 		${WRKSRC}/src/nvidia_linux.c
 .endif
+# Adjust linux header inclusions after FreeBSD src SVN r246085
+.if ${OSVERSION} > 1000027 && ${NVVERSION} >= 964323
+	${REINPLACE_CMD} -E \
+	'/#include "machine\/\.\.\/linux(32)?\/linux.h"/ \
+	{x;s/.*/#include "machine\/..\/..\/compat\/linux\/linux_ioctl.h"/;H;x;}' \
+		${WRKSRC}/src/nvidia_linux.c
+.endif
+# Adjust vm_object locking after FreeBSD src SVN r248084
+.if ${OSVERSION} > 1000029
+	${REINPLACE_CMD} -e \
+	'/#include <vm\/vm_object.h>/{x;s/.*/#include <sys\/rwlock.h>/;G;}' \
+		${WRKSRC}/src/nv-freebsd.h
+	${REINPLACE_CMD} -E 's/(VM_OBJECT_)(UN)?(LOCK)/\1W\2\3/' \
+		${WRKSRC}/src/nvidia_subr.c
+.endif
 # Process OPTIONS
 .if ${PORT_OPTIONS:MFREEBSD_AGP}
 	${REINPLACE_CMD} -E 's/undef (NV_SUPPORT_OS_AGP)/define \1/' \
Index: x11/nvidia-driver/files/r246085-patch-src-nvidia_linux.c
===================================================================
--- x11/nvidia-driver/files/r246085-patch-src-nvidia_linux.c	(revision 315504)
+++ x11/nvidia-driver/files/r246085-patch-src-nvidia_linux.c	(working copy)
@@ -1,14 +0,0 @@
---- src/nvidia_linux.c.orig	2012-10-30 13:54:06.000000000 -0400
-+++ src/nvidia_linux.c	2013-02-13 19:48:17.000000000 -0500
-@@ -21,9 +21,11 @@
- #if defined(NVCPU_X86)
- #include "machine/../linux/linux.h"
- #include "machine/../linux/linux_proto.h"
-+#include "machine/../../compat/linux/linux_ioctl.h"
- #elif defined(NVCPU_X86_64)
- #include "machine/../linux32/linux.h"
- #include "machine/../linux32/linux32_proto.h"
-+#include "machine/../../compat/linux/linux_ioctl.h"
- #endif
- 
- int linux_ioctl_nvidia(d_thread_t *, struct linux_ioctl_args *);
Index: x11/nvidia-driver/files/r248084-patch-src-nv-freebsd.h
===================================================================
--- x11/nvidia-driver/files/r248084-patch-src-nv-freebsd.h	(revision 315504)
+++ x11/nvidia-driver/files/r248084-patch-src-nv-freebsd.h	(working copy)
@@ -1,10 +0,0 @@
---- src/nv-freebsd.h.orig	2013-01-14 14:38:44.000000000 -0800
-+++ src/nv-freebsd.h	2013-03-09 06:36:23.000000000 -0800
-@@ -77,6 +77,7 @@
- #include <vm/vm_object.h>
- #include <vm/pmap.h>
- #include <vm/vm_map.h>
-+#include <sys/rwlock.h>
- #include <vm/vm_pager.h>
- #include <vm/uma.h>
- 
Index: x11/nvidia-driver/files/r248084-patch-src-nvidia_subr.c
===================================================================
--- x11/nvidia-driver/files/r248084-patch-src-nvidia_subr.c	(revision 315504)
+++ x11/nvidia-driver/files/r248084-patch-src-nvidia_subr.c	(working copy)
@@ -1,56 +0,0 @@
---- src/nvidia_subr.c.orig	2013-01-14 14:38:44.000000000 -0800
-+++ src/nvidia_subr.c	2013-03-09 06:47:05.000000000 -0800
-@@ -83,7 +83,7 @@
-             if (!sc->BAR_objects[i])
-                 goto failed;
- 
--            VM_OBJECT_LOCK(sc->BAR_objects[i]);
-+            VM_OBJECT_WLOCK(sc->BAR_objects[i]);
-             switch (i) {
-                 case NV_GPU_BAR_INDEX_FB:
-                     vm_object_set_memattr(sc->BAR_objects[i],
-@@ -95,7 +95,7 @@
-                             VM_MEMATTR_UNCACHEABLE);
-                     break;
-             }
--            VM_OBJECT_UNLOCK(sc->BAR_objects[i]);
-+            VM_OBJECT_WUNLOCK(sc->BAR_objects[i]);
-         }
-     }
- 
-@@ -541,9 +541,9 @@
-                 goto failed;
-             }
- 
--            VM_OBJECT_LOCK(sc->UD_object);
-+            VM_OBJECT_WLOCK(sc->UD_object);
-             vm_object_set_memattr(sc->UD_object, VM_MEMATTR_UNCACHEABLE);
--            VM_OBJECT_UNLOCK(sc->UD_object);
-+            VM_OBJECT_WUNLOCK(sc->UD_object);
-         }
- 
-         nv->flags |= NV_FLAG_OPEN;
-@@ -965,9 +965,9 @@
-         goto failed;
-     }
- 
--    VM_OBJECT_LOCK(at->object);
-+    VM_OBJECT_WLOCK(at->object);
-     vm_object_set_memattr(at->object, attr);
--    VM_OBJECT_UNLOCK(at->object);
-+    VM_OBJECT_WUNLOCK(at->object);
- 
-     *private = at;
-     SLIST_INSERT_HEAD(&sc->alloc_list, at, list);
-@@ -1108,9 +1108,9 @@
-         goto failed;
-     }
- 
--    VM_OBJECT_LOCK(at->object);
-+    VM_OBJECT_WLOCK(at->object);
-     vm_object_set_memattr(at->object, attr);
--    VM_OBJECT_UNLOCK(at->object);
-+    VM_OBJECT_WUNLOCK(at->object);
- 
-     *private = at;
-     SLIST_INSERT_HEAD(&sc->alloc_list, at, list);
Index: x11/nvidia-driver-173/Makefile
===================================================================
--- x11/nvidia-driver-173/Makefile	(revision 315504)
+++ x11/nvidia-driver-173/Makefile	(working copy)
@@ -3,7 +3,7 @@
 
 DISTVERSION=	173.14.35
 # Explicitly set PORTREVISION as it can be overridden by the master port
-PORTREVISION=	1
+PORTREVISION=	2
 
 MASTERDIR=	${.CURDIR}/../nvidia-driver
 NO_LATEST_LINK=	yes
Index: x11/nvidia-driver-71/Makefile
===================================================================
--- x11/nvidia-driver-71/Makefile	(revision 315504)
+++ x11/nvidia-driver-71/Makefile	(working copy)
@@ -3,7 +3,7 @@
 
 DISTVERSION=	71.86.15
 # Explicitly set PORTREVISION as it can be overridden by the master port
-PORTREVISION=	2
+PORTREVISION=	3
 
 MASTERDIR=	${.CURDIR}/../nvidia-driver
 NO_LATEST_LINK=	yes
Index: x11/nvidia-driver-96/Makefile
===================================================================
--- x11/nvidia-driver-96/Makefile	(revision 315504)
+++ x11/nvidia-driver-96/Makefile	(working copy)
@@ -3,7 +3,7 @@
 
 DISTVERSION=	96.43.23
 # Explicitly set PORTREVISION as it can be overridden by the master port
-PORTREVISION=	0
+PORTREVISION=	1
 
 MASTERDIR=	${.CURDIR}/../nvidia-driver
 NO_LATEST_LINK=	yes


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303290110.r2T1AJMx084953>