Subject: NVidia drivers: preliminary LKM version
To: None <port-i386@netbsd.org>
From: Quentin Garnier <netbsd-port-i386@quatriemek.com>
List: current-users
Date: 06/21/2003 21:37:19
Hi all,

I've finally made a LKM version of the driver. There are a few requisites
and my usual warnings about stability.

Note that there is no new feature nor bugfix (like console blanking,
OpenGL-induced later kernel panic or Linux binaries compatibility). Report
to archives and http://cubidou.nerim.net/ for a list of known issues.

This release is very rough and mostly meant to test the installation
procedure. If you've never used the driver before, keep a backup of
/usr/X11R6 nearby.

You will need a -current system, but the code itself should be quite
backward compatible, with the following caveats:

 o the AGP card will not be found by the code if there also is a PCI one
   in 1.6<=O. Additionnaly, AGP4X is not available in these kernels. Both
   those issues were fixed on Feb 24, 2003.

 o OpenGL code will immediately lead to a segfault in 1.6<=R. A fix was
   committed on Apr 9, 2003.

 o XFree86 4.2 and 4.3 need some patching, see http://cubidou.nerim.net
   for the details. Note that a 4.3 compiled from a very recent xsrc won't
   need any patch (see tech-x11 archives).

xdelta is needed to patch binaries (it is available in the devel category
of pkgsrc).

You can download the code at (but please read the rest of this mail before
doing anything with it):

    http://cubidou.nerim.net/NVIDIA_NetBSD-1.0-3203-0.tgz

The tarball expands to several directories:

 o mmr: it contains a LKM that emulates FreeBSD /dev/mem MTRR operations.
        The major number is dynamic and I don't provide a script to
        recreate the device node at load time, so beware of keeping a node
        in sync with the LKM.

 o nvidia: it contains the LKM that links against NVidia's binary kernel
           module. The major numbers are hard-coded (180 and 181), and the
           device nodes may be created using the 'postinstall' target in
           the 'driver' directory.

Those two directories use bsd.kmod.mk, and should install the resulting
LKMs in /usr/lkm.

 o libNvGLcompat: it contains a small shared library that exports an empty
                  and weak sched_yield so that applications that are not
                  linked against libpthread can use libGL. It uses
                  bsd.lib.mk and installs stuff into /usr/lib.

 o binaries: it contains binaries as shipped by NVidia. Some of them need
             to be patched to be used with NetBSD.

 o patches: it contains xdelta patchfiles against NVidia binaries.

 o driver: it contains a Makefile that patches and installs the relevant
           the XFree86 binary driver (nvidia_drv.o). The 'postinstall'
           target creates device nodes for up to two cards (my setup, I
           doubt that many people have more than two in a single
           computer...).

 o glx: it contains a Makefile that patches and installs the relevant
        files to use OpenGL with the driver. Note that a simple 'make &&
        make install' in the top directory will simply remove files that
        prevent the use of the driver. There's a 'backup' target that can
        be used though.

There is a Makefile at the root, so if you type 'make && make install', it
should compile and install the LKMs and the XFree86 driver. By default,
OpenGL stuff is not installed (the content of the Makefile is pretty
straightforward).

To avoid any library issue, add the following lines to /etc/ld.so.conf:

libGL.so.1      machdep.fpu_present     1:libNvGLcompat.so.0,libGL.so.1

If you're willing to test XvMCNVIDIA (please let me know if you do, I
can't do it myself since I don't own any GF4-based card), you may want to
add a similar line for libXvMCNVIDIA.so.1.

I'm waiting for feedback of errors and incompatibilities with some
components or versions. I plan on making a real release soon (I'd like to
do that tomorrow) along with a pkgsrc version.

-- 
Quentin Garnier - cube@cubidou.net
"Feels like I'm fiddling while Rome is burning down.
Should I lay my fiddle down and take a rifle from the ground ?"
Leigh Nash/Sixpence None The Richer, Paralyzed, Divine Discontents, 2002.