Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Mar 2013 07:34:54 -0800
From:      David Wolfskill <david@catwhisker.org>
To:        freebsd-ports@freebsd.org
Cc:        danfe@FreeBSD.org
Subject:   [PATCH] x11/nvidia-driver fails on head @r248084
Message-ID:  <20130309153454.GS13861@albert.catwhisker.org>

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

--4StcSGwj0FoelDaN
Content-Type: multipart/mixed; boundary="WZgDvI3PL8w3LDGC"
Content-Disposition: inline


--WZgDvI3PL8w3LDGC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

During my daily update of the head slice on my laptop, I found that
changes made in r248084 broke x11/nvidia-driver.

The attached patch worked for me.  Caveats:

* I'm a hacker, not a developer.  Don't assume I know what I'm doing.

* I may have got the OSVERSION number wrong (or at least "not optimal").

* I use read-only local private mirrors of the SVN repos, so I was
  unable to use "svn diff" to generate the diff and still get the added
  files (AFAIK).  So I used "diff -ruN", then edited the result to
  resemble the output of "svn diff" -- at least enough that "patch -C"
  says it would apply to a pristine copy of x11/nvidia-driver properly.

* My ports working copy is @r313705; src is @248035.

Resulting uname output after successful build:

FreeBSD g1-235.catwhisker.org 10.0-CURRENT FreeBSD 10.0-CURRENT #832  r2480=
33M/248035: Fri Mar  8 07:36:04 PST 2013     root@localhost:/usr/obj/usr/sr=
c/sys/CANARY  i386

Peace,
david
--=20
David H. Wolfskill				david@catwhisker.org
Taliban: Evil men with guns afraid of truth from a 14-year old girl.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.

--WZgDvI3PL8w3LDGC
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="nvidia-driver.patch"
Content-Transfer-Encoding: quoted-printable

Index: x11/nvidia-driver/Makefile
--- x11/nvidia-driver/Makefile	2013-03-09 07:11:03.000000000 -0800
+++ x11/nvidia-driver/Makefile	2013-03-09 06:48:18.000000000 -0800
@@ -86,6 +86,10 @@
=20
 PLIST_SUB+=3D	LINUXBASE=3D${LINUXBASE} SHLIB_VERSION=3D${PORTVERSION} \
 		MODULESDIR=3D${MODULESDIR}
+. if ${OSVERSION} > 1000028
+EXTRA_PATCHES+=3D	${FILESDIR}/r248084-patch-src-nv-freebsd.h
+EXTRA_PATCHES+=3D	${FILESDIR}/r248084-patch-src-nvidia_subr.c
+. endif
=20
 .if ${PORT_OPTIONS:MLINUX}
 CONFLICTS=3D	linux[-_]dri-[0-9]* linux-f10-dri-[0-9]*
Index: x11/nvidia-driver/files/r248084-patch-src-nv-freebsd.h
--- x11/nvidia-driver/files/r248084-patch-src-nv-freebsd.h	1969-12-31 16:00=
:00.000000000 -0800
+++ x11/nvidia-driver/files/r248084-patch-src-nv-freebsd.h	2013-03-09 06:39=
:54.000000000 -0800
@@ -0,0 +1,10 @@
+--- 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>
+=20
Index: x11/nvidia-driver/files/r248084-patch-src-nvidia_subr.c
--- x11/nvidia-driver/files/r248084-patch-src-nvidia_subr.c	1969-12-31 16:0=
0:00.000000000 -0800
+++ x11/nvidia-driver/files/r248084-patch-src-nvidia_subr.c	2013-03-09 06:4=
8:53.000000000 -0800
@@ -0,0 +1,56 @@
+--- 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;
+=20
+-            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]);
+         }
+     }
+=20
+@@ -541,9 +541,9 @@
+                 goto failed;
+             }
+=20
+-            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);
+         }
+=20
+         nv->flags |=3D NV_FLAG_OPEN;
+@@ -965,9 +965,9 @@
+         goto failed;
+     }
+=20
+-    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);
+=20
+     *private =3D at;
+     SLIST_INSERT_HEAD(&sc->alloc_list, at, list);
+@@ -1108,9 +1108,9 @@
+         goto failed;
+     }
+=20
+-    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);
+=20
+     *private =3D at;
+     SLIST_INSERT_HEAD(&sc->alloc_list, at, list);

--WZgDvI3PL8w3LDGC--

--4StcSGwj0FoelDaN
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iEYEARECAAYFAlE7Vp0ACgkQmprOCmdXAD0nAACfR8pZ5SfNVfNy5wGPLavFZXdP
y4QAn08TsyH4fsO6QdN6aF+tcEyek16f
=Jorv
-----END PGP SIGNATURE-----

--4StcSGwj0FoelDaN--



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