Subject: Nouveau (Open Source 3D acceleration for nVidia cards) on NetBSD.
To: None <tech-kern@netbsd.org, tech-x11@netbsd.org>
From: Jean-Baptiste Campesato <camjelemon@gmail.com>
List: tech-x11
Date: 04/25/2007 18:50:42
Hello,
I ported the current drm part of the nouveau project
(http://nouveau.freedesktop.org/) to NetBSD.

Nouveau is a free project which aims at producing an open-source 3D
acceleration support for nvidia cards.
For the moment the material 3D rendering is only working with NV40
chipset (GeForce 6x00 and 7x00). Can someone try nouveau on NetBSD
with a NV40 chips ? Thanks.

How to use it under NetBSD:
I) Prepare the kernel:
Apply the patch (see below).
Compile your kernel with "nouveau*        at vga?" in your config file.
Note: Do you want to rename nouveau to nouveaudrm ?

II) Prepare X:
You will need to use modular-xorg (look at
http://mail-index.netbsd.org/pkgsrc-users/2007/04/12/0007.html).
Don't forget to put "X11_TYPE=modular" in your /etc/mk.conf
X.Org needs glx support to use nouveau. So you will have to use "dri"
option when compiling modular-xorg-server: use "make
PKG_OPTIONS.xorg-server=dri" or put "PKG_OPTIONS.xorg-server=dri" in
your /etc/mk.conf
Configure your /etc/xorg.conf as usually but with:
Driver "nouveau" in your "Device" section.
Uncomment Load "glx" and Load "dri"
Add at the bottom of your xorg.conf:
Section "ServerFlags"
    Option  "AIGLX" "off"
EndSection

III) Compile xf86-video-nouveau/ (nouveau driver for xorg)
Get the sources: git clone
git://anongit.freedesktop.org/git/nouveau/xf86-video-nouveau/
( I don't have succeeds in making work git, so I used an archive... If
someone can make a current archive of sources ? )
Copy nouveau_drm.h if necessary: cp
[/usr/src/]sys/dev/pci/drm/nouveau_drm.h xf86-video-nouveau/src/
Compile: cd xf86-video-nouveau/ && ./autogen.sh && make
Copy the driver: cp src/.libs/nouveau_drv.so /usr/pkg/lib/xorg/modules/drivers/

I hope I forgot nothing.

Here is a screenshot of modular-xorg working with nouveau. I have a
GeForce 2, so there is no material 3D support for the moment... But
nouveau is working:
http://zulzul.free.fr/camje/screenshot.png

When using nouveau I got some drm errors in dmesg... but it's working well...

You can find the kernel patch at:
http://zulzul.free.fr/camje/nouveau-netbsd.diff

Added files: (MIT Licence ?..)
(from http://gitweb.freedesktop.org/?p=mesa/drm.git;a=tree;f=linux-core
. I modified some of these files to get them working under NetBSD).
(You may want to add $NetBSD $ tags).
sys/dev/pci/drm/nouveau_drm.h
sys/dev/pci/drm/nouveau_drv.c
sys/dev/pci/drm/nouveau_drv.h
sys/dev/pci/drm/nouveau_fifo.c
sys/dev/pci/drm/nouveau_irq.c
sys/dev/pci/drm/nouveau_mem.c
sys/dev/pci/drm/nouveau_object.c
sys/dev/pci/drm/nouveau_reg.h
sys/dev/pci/drm/nouveau_state.c
sys/dev/pci/drm/nv04_fb.c
sys/dev/pci/drm/nv04_graph.c
sys/dev/pci/drm/nv04_mc.c
sys/dev/pci/drm/nv04_timer.c
sys/dev/pci/drm/nv10_fb.c
sys/dev/pci/drm/nv10_graph.c
sys/dev/pci/drm/nv20_graph.c
sys/dev/pci/drm/nv30_graph.c
sys/dev/pci/drm/nv40_fb.c
sys/dev/pci/drm/nv40_graph.c
sys/dev/pci/drm/nv40_mc.c

Modified files:
sys/dev/pci/drm/files.pcidrm
sys/dev/pci/drm/drm_pciids.h XXX: note a "}," error... from the
drm_pciids.txt database...

--
Thanks,
Jean-Baptiste Campesato