DragonFly submit List (threaded) for 2003-10
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: binary nvidia driver kld patch and help needed
Emiel Kollof wrote:
> Hi,
>
> I spent a rainy afternoon trying to get the binary nvidia drivers to work
> on DragonFly. Of course, the thing wouldn't compile out of the box, so I
> tried hacking it so it would compile and hopefully work. It doesn't work
> _yet_, but at least the damn thing loads and detects my nvidia card. X
> can't do diddly squat with it though, which might be my bad.
Success! I managed to get my GeForce 4 MX to wok with the binary nvidia
drivers and the patch attached to this post. So far it works stable-ish, X
works, and the xscreensaver opengl hacks have been running all night
without crashes.
So please, test this if you have a nvidia GeForce type card and please
report success to me.
I also saw that the drm stuff from current was already included in
dragonfly. Silly me :)
Anyway, people with nvidia cards can have their OpenGL cake and eat it too
now.
Cheers,
Emiel
diff -urN ../NVIDIA-FreeBSD-x86-1.0-4365/module/Makefile ./module/Makefile
--- ../NVIDIA-FreeBSD-x86-1.0-4365/module/Makefile Wed May 28 18:51:52 2003
+++ ./module/Makefile Fri Oct 10 13:09:27 2003
@@ -6,7 +6,7 @@
KMOD= nvidia
SRCS= nvidia_ctl.c nvidia_dev.c nvidia_linux.c nvidia_os.c nvidia_os_pci.c nvidia_os_registry.c nvidia_pci.c nvidia_subr.c nvidia_sysctl.c
SRCS+= device_if.h bus_if.h pci_if.h vnode_if.h
-CFLAGS+= -I${NVIDIA_ROOT}/src -D__KERNEL__ -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4365 -DNVCPU_X86 -DNV_BSD -DNV_INT64_OK -DNV_UNIX
+CFLAGS+= -I${NVIDIA_ROOT}/src -D__KERNEL__ -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4365 -DNVCPU_X86 -DNV_BSD -DNV_INT64_OK -DNV_UNIX -DDRAGONFLY
NVOBJ= ${NVIDIA_ROOT}/obj/nv-kernel.o
OBJS+= NVIDIA.o
NOOBJ= true
diff -urN ../NVIDIA-FreeBSD-x86-1.0-4365/src/nv-freebsd.h ./src/nv-freebsd.h
--- ../NVIDIA-FreeBSD-x86-1.0-4365/src/nv-freebsd.h Wed Oct 8 18:22:17 2003
+++ ./src/nv-freebsd.h Fri Oct 10 13:26:26 2003
@@ -75,12 +75,12 @@
#include <vm/pmap.h>
#include <vm/vm_map.h>
-#include <pci/agpvar.h>
+#include <dev/agp/agpvar.h>
#include <sys/agpio.h>
#include "net/if.h"
-#include "machine/../linux/linux.h"
-#include "compat/linux/linux_ioctl.h"
+#include "emulation/linux/i386/linux.h"
+#include "emulation/linux/linux_ioctl.h"
#if __FreeBSD_version >= 500000
#include <sys/mutex.h>
@@ -102,8 +102,8 @@
#else
#include <machine/smp.h>
-#include <pci/pcireg.h>
-#include <pci/pcivar.h>
+#include <bus/pci/pcireg.h>
+#include <bus/pci/pcivar.h>
#define vm_page_lock_queues()
#define vm_page_unlock_queues()
@@ -116,8 +116,8 @@
* on FreeBSD, due to its thread-aware reference counting.
*/
-#define __TD_FDT(td) ((td)->p_fd)
-#define __TD_FDT_CNT(td) ((td)->p_fd->fd_refcnt)
+#define __TD_FDT(td) ((td)->td_proc->p_fd)
+#define __TD_FDT_CNT(td) ((td)->td_proc->p_fd->fd_refcnt)
#endif
diff -urN ../NVIDIA-FreeBSD-x86-1.0-4365/src/nvidia_ctl.c ./src/nvidia_ctl.c
--- ../NVIDIA-FreeBSD-x86-1.0-4365/src/nvidia_ctl.c Wed Oct 8 18:22:17 2003
+++ ./src/nvidia_ctl.c Fri Oct 10 13:27:59 2003
@@ -20,6 +20,12 @@
static struct cdevsw nvidia_ctl_cdevsw = {
#if __FreeBSD_version < 500105
+ /* name */ "nvidiactl",
+ /* maj */ CDEV_MAJOR,
+ /* flags */ D_TRACKCLOSE,
+ /* port */ NULL,
+ /* autoq */ 0,
+
/* open */ nvidia_ctl_open,
/* close */ nvidia_ctl_close,
/* read */ noread,
@@ -28,15 +34,8 @@
/* poll */ nvidia_ctl_poll,
/* mmap */ nommap,
/* strategy */ nostrategy,
- /* name */ "nvidiactl",
- /* maj */ CDEV_MAJOR,
/* dump */ nodump,
- /* psize */ nopsize,
- /* flags */ D_TRACKCLOSE,
-#if __FreeBSD_version < 500000
- /* bmaj */ -1,
-#endif
- /* kqfilter */ NULL,
+ /* psize */ nopsize
#else
.d_open = nvidia_ctl_open,
.d_close = nvidia_ctl_close,
@@ -218,7 +217,7 @@
mtx_init(&sc->mtx_api, "ctl.mtx_api", NULL, MTX_DEF);
mtx_init(&sc->mtx_rm, "ctl.mtx_rm", NULL, MTX_SPIN);
#else
- lockinit(&sc->api_lock, PZERO, "ctl.api_lock", 0, 0);
+ lockinit(&sc->api_lock, 0, "ctl.api_lock", 0, 0);
#endif
}
@@ -243,7 +242,7 @@
mtx_destroy(&sc->mtx_rm);
mtx_destroy(&sc->mtx_api);
#else
- lockmgr(&sc->api_lock, LK_DRAIN, 0, curproc);
+ lockmgr(&sc->api_lock, LK_DRAIN, 0, curthread);
#endif
destroy_dev(nvidia_ctl_cdev);
}
diff -urN ../NVIDIA-FreeBSD-x86-1.0-4365/src/nvidia_dev.c ./src/nvidia_dev.c
--- ../NVIDIA-FreeBSD-x86-1.0-4365/src/nvidia_dev.c Wed Oct 8 18:22:17 2003
+++ ./src/nvidia_dev.c Fri Oct 10 13:19:08 2003
@@ -21,6 +21,12 @@
static struct cdevsw nvidia_dev_cdevsw = {
#if __FreeBSD_version < 500105
+ /* name */ "nvidia",
+ /* maj */ CDEV_MAJOR,
+ /* flags */ D_MEM|D_TRACKCLOSE,
+ /* port */ NULL,
+ /* autoq */ 0,
+
/* open */ nvidia_dev_open,
/* close */ nvidia_dev_close,
/* read */ noread,
@@ -29,15 +35,8 @@
/* poll */ nvidia_dev_poll,
/* mmap */ nvidia_dev_mmap,
/* strategy */ nostrategy,
- /* name */ "nvidia",
- /* maj */ CDEV_MAJOR,
/* dump */ nodump,
- /* psize */ nopsize,
- /* flags */ D_MEM|D_TRACKCLOSE,
-#if __FreeBSD_version < 500000
- /* bmaj */ -1,
-#endif
- /* kqfilter */ NULL,
+ /* psize */ nopsize
#else
.d_open = nvidia_dev_open,
.d_close = nvidia_dev_close,
diff -urN ../NVIDIA-FreeBSD-x86-1.0-4365/src/nvidia_linux.c ./src/nvidia_linux.c
--- ../NVIDIA-FreeBSD-x86-1.0-4365/src/nvidia_linux.c Wed May 28 18:51:52 2003
+++ ./src/nvidia_linux.c Fri Oct 10 13:19:26 2003
@@ -33,7 +33,7 @@
* copy the user data in/out correctly.
*/
- return (ioctl(td, (struct ioctl_args *) args));
+ return (ioctl((struct ioctl_args *) args));
}
struct linux_ioctl_handler nvidia_handler = {
diff -urN ../NVIDIA-FreeBSD-x86-1.0-4365/src/nvidia_os.c ./src/nvidia_os.c
--- ../NVIDIA-FreeBSD-x86-1.0-4365/src/nvidia_os.c Wed Oct 8 18:22:17 2003
+++ ./src/nvidia_os.c Fri Oct 10 13:22:20 2003
@@ -164,11 +164,7 @@
BOOL os_is_administrator(PHWINFO pDev)
{
-#if __FreeBSD_version < 500000
- return suser(curproc);
-#else
return suser(curthread);
-#endif
}
U008 os_io_read_byte(
diff -urN ../NVIDIA-FreeBSD-x86-1.0-4365/src/nvidia_pci.c ./src/nvidia_pci.c
--- ../NVIDIA-FreeBSD-x86-1.0-4365/src/nvidia_pci.c Wed Oct 8 18:22:17 2003
+++ ./src/nvidia_pci.c Fri Oct 10 13:20:24 2003
@@ -96,7 +96,7 @@
mtx_init(&sc->mtx_api, "dev.mtx_api", NULL, MTX_DEF);
mtx_init(&sc->mtx_rm, "dev.mtx_rm", NULL, MTX_SPIN);
#else
- lockinit(&sc->api_lock, PZERO, "dev.api_lock", 0, 0);
+ lockinit(&sc->api_lock, 0, "dev.api_lock", 0, 0);
#endif
return 0;
@@ -115,7 +115,7 @@
mtx_destroy(&sc->mtx_rm);
mtx_destroy(&sc->mtx_api);
#else
- lockmgr(&sc->api_lock, LK_DRAIN, 0, curproc);
+ lockmgr(&sc->api_lock, LK_DRAIN, 0, curthread);
#endif
status = nvidia_detach(dev);
diff -urN ../NVIDIA-FreeBSD-x86-1.0-4365/src/nvidia_subr.c ./src/nvidia_subr.c
--- ../NVIDIA-FreeBSD-x86-1.0-4365/src/nvidia_subr.c Wed Oct 8 18:22:17 2003
+++ ./src/nvidia_subr.c Fri Oct 10 13:27:19 2003
@@ -297,7 +297,7 @@
u_long cmd,
caddr_t data,
int fflag,
- d_thread_t *td
+ struct thread *td
)
{
struct nvidia_softc *sc;
@@ -338,7 +338,7 @@
int nvidia_close_ctl(
dev_t dev,
- d_thread_t *td
+ struct thread *td
)
{
nv_state_t *nv = &nvidia_ctl_state;
@@ -391,7 +391,7 @@
int nvidia_close_dev(
struct nvidia_softc *sc,
dev_t dev,
- d_thread_t *td
+ struct thread *td
)
{
nv_state_t *nv = sc->nv_state;
@@ -762,7 +762,7 @@
* of our system calls at a time.
*/
struct nvidia_softc *sc = nv->os_state;
- lockmgr(&sc->api_lock, LK_EXCLUSIVE, 0, curproc);
+ lockmgr(&sc->api_lock, LK_EXCLUSIVE, 0, curthread);
#endif
}
@@ -781,7 +781,7 @@
* its system call.
*/
struct nvidia_softc *sc = nv->os_state;
- lockmgr(&sc->api_lock, LK_RELEASE, 0, curproc);
+ lockmgr(&sc->api_lock, LK_RELEASE, 0, curthread);
#endif
}
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]