Subject: One step farther with NVidia drivers
To: None <netbsd-users@netbsd.org>
From: Quentin Garnier <netbsd@quatriemek.com>
List: netbsd-users
Date: 03/01/2003 00:49:01
Tonight, I've been able to run glxgears.

I'll update my page tomorrow to explain how I managed to do this. It needs
a little update of the kernel.

Speaking of which, I'd like the opinion of a UVM specialist (I must say
I'm quite clueless on the issue). To make glxinfo run (it seems to choke
later on my second video card, but it's another story) I had to apply the
following patch to uvm/uvm_map.c :

diff -u -r1.1.1.3 -r1.2
--- uvm_map.c	2003/02/28 13:29:29	1.1.1.3
+++ uvm_map.c	2003/02/28 23:36:05	1.2
@@ -2894,7 +2894,7 @@
 
 		offset = current->offset + (start - current->start);
 		size = MIN(end, current->end) - start;
-		if (uobj != NULL) {
+		if (uobj != NULL && uobj->pgops->pgo_put != NULL) {
 			simple_lock(&uobj->vmobjlock);
 			error = (uobj->pgops->pgo_put)(uobj, offset,
 			    offset + size, flags | PGO_CLEANIT);

When the NVidia driver calls msync, it is about memory which, I presume,
belongs to the device and thus the uvm_object if a device one, for which
the pgo_get and pgo_put operations are NULL.

I hope someone could explain why such a thing is happenning, and what are
the risks of avoiding the segfault (as I understand the problem, the msync
call probably doesn't do what the XFree86 driver expects it to do, so
ultimately there will be a crash after that).

Now, for the ELF issues, I have to introduce a new library to have
libGL.so linked, to resolve the symbol __error (as I said in a previous
update, it's a FreeBSD pthread symbol not present in Nathan's
libpthread.so).

Is there a way I can either add the symbol (it's just {return (&errno);})
to the binary libGL.so (remember we don't have the source), or produces a
lib that will magically load the real libGL.so without linker or a
LD_PRELOAD trick ?

What's next on the TODO list is Linux compatibility and NvAGP. And of
course, wider testing, hopefully :)

-- 
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.