Using NVIDIA's driver without an xorg.conf

tobik@

Developer
Here is something for people who compile their own packages and like experimenting with stuff. I've been running Xorg with the following patch applied for a while now.

Currently if you want to use NVIDIA's driver you have to at least create a minimal xorg.conf as per Thread 52311. With the patch applied I don't need to do that anymore. The only thing I have to do to setup Xorg is pkg install nvidia-driver and sysrc kld_list+=nvidia.

Create /usr/ports/x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86pciBus.c with
Code:
--- hw/xfree86/common/xf86pciBus.c.orig	2016-07-19 15:37:53.698794484 +0200
+++ hw/xfree86/common/xf86pciBus.c	2016-07-19 15:37:26.000000000 +0200
@@ -1192,6 +1192,7 @@
 #ifdef __linux__
         driverList[idx++] = "nouveau";
 #endif
+        driverList[idx++] = "nvidia";
         driverList[idx++] = "nv";
         break;
     }
or use this link to download the file. It adds NVIDIA's driver to Xorg's builtin configuration in preference to the old x11-drivers/xf86-video-nv driver. It should be safe to use even on systems with no NVIDIA GPU.

Recompile and reinstall x11-server/xorg-server with make -C /usr/ports/x11-server/xorg-server clean reinstall and remove your xorg.conf, 10-nvidia.conf or whatever you have. See if your X setup still works.

If you try this and it works (or doesn't) please leave a comment here.
 
Good timing with this post. I just came from this thread with a Nvidia GTX960 related issue. I'm not really FreeBSD savvy so I have a few questions.

My way of doing things so far is to first # portsnap fetch extract update, install ports-mgmt/portmaster, then do # portmaster x11/xorg, then finally # portmaster x11/nvidia-driver (then all the code added to all the needed .conf files)

So my first question is...why does Freshports say "A package is not available for ports marked as: Forbidden / Broken / Ignore / Restricted" if you are still able to do pkg install nvidia-driver?

Second question: Is the pkg install method better? Portmaster gives you the option to disable a Linux emulation option or what not that helps not break anything, does the pkg install method allow this to?

Third question: Do you apply this patch after or before you install a full x11/xorg port (assuming you install with portmaster)? If before, do I simply do fetch https://gist.githubusercontent.com/t6/723dcbc594c435435fb7a04b8c7f4f4f/raw/45be3a873bca011660008a3dec721a3747843035/patch-hw_xfree86_common_xf86pciBus.c
then do a cp command to the path you specified at /usr/ports/x11-servers/xorg-server/files/? Then run # portmaster x11/xorg and the patch is compiled and built automatically just like that?

If the patch is applied after x11/xorg or the minimal xorg approach, either way, do I still do make -C /usr/ports/x11-server/xorg-server clean reinstall? Or if you use portmaster to do things, you can't "reinstall" that port using that command?

And, after Xorg is all said and done and installed and patched, then you do pkg install nvidia-driver and sysrc kld_list+=nvidia and according to your post, it should all work? I don't even need to add
Code:
nvidia_load="YES"
to /boot/loader.conf? I'm guessing the "kld_list+=nvidia" replaces the nvidia_load="YES" method?
 
I'm not really FreeBSD savvy so I have a few questions.
This might not be something you want to do then, but I can't stop you of course. :)
So my first question is...why does Freshports say "A package is not available for ports marked as: Forbidden / Broken / Ignore / Restricted" if you are still able to do pkg install nvidia-driver?
FreshPorts marks packages as IGNORE when they require kernel sources for compilation as is the case for x11/nvidia-driver. Packages are still available for this port.
Portmaster gives you the option to disable a Linux emulation option or what not that helps not break anything, does the pkg install method allow this to?
I compile my own packages so yes. If you use the default package repository no. You can use portmaster to install the driver. pkg install nvidia-driver was just an example showing how easy it could be.
If before, do I simply do fetch https://gist.githubusercontent.com/...47843035/patch-hw_xfree86_common_xf86pciBus.c
then do a cp command to the path you specified at /usr/ports/x11-servers/xorg-server/files/?
Yes, before and like this.
Then run # portmaster x11/xorg and the patch is compiled and built just like that?
You want to force recompilation and reinstallation of x11-server/xorg-server if you've already compiled it. This is necessary because we did not bump the PORTREVISION (for good reason since this is an experiment) and there is no way for portmaster to know that the port has changed. If you never installed it before and this is a fresh installation your way should work fine.
If the patch is applied after x11/xorg or the minimal xorg approach, either way, do I still do make -C /usr/ports/x11-server/xorg-server clean reinstall? Or if you use portmaster to do things, you can't "reinstall" that port using that command?
The command I posted will still work even if you use portmaster.
And, after Xorg is all said and done and installed and patched, then you do pkg install nvidia-driver and sysrc kld_list+=nvidia and according to your post, it should all work?
Yeah, that's the idea. You can also add nvidia_load="YES" to /boot/loader.conf if you want to. That's your choice.
 
This might not be something you want to do then, but I can't stop you of course. :)

If I don't try, I don't learn. As far as I'm concerned if your method works, it might as well be official. I have one last question for you. When you installed your nvidia-driver, which version did you get/install? Last time I tried it pulled version 346.96 yet on Nvidia's website the latest FreeBSD x64 drivers are 367.35.
 
Last time I tried it pulled version 346.96 yet on Nvidia's website the latest FreeBSD x64 drivers are 367.35.
Yes, 346.96 is the latest version in the ports tree and that's the one I use. The ports version is patched, installs files in the correct locations, and is the only way to have a smooth upgrade path when an update to the port is eventually made: PR 201340. If your read the comments on the PR you can see why it wasn't updated yet.

A list of supported GPUs by 346.96 can be found here: http://us.download.nvidia.com/XFree86/FreeBSD-x86_64/346.96/README/supportedchips.html
 
Portmaster gives you the option to disable a Linux emulation option or what not that helps not break anything, does the pkg install method allow this to?
With portmaster you build and only then install packages, so you can change build options. With pkg ins you install pre-build packages from repository. You can view repository packages build options (but you cannot change them) with [url=https://www.freebsd.org/cgi/man.cgi?query=pkg&sektion=8&manpath=freebsd-release-ports][u]pkg[/u][/url] search -f, for example pkg sea -f nvidia-driver-340 :
Code:
nvidia-driver-340-340.93
Name           : nvidia-driver-340
Version        : 340.93
Origin         : x11/nvidia-driver-340
Architecture   : freebsd:10:x86:64
Prefix         : /usr/local
Repository     : FreeBSD [pkg+http://pkg.FreeBSD.org/FreeBSD:10:amd64/quarterly]
Categories     : x11 kld
Licenses       : NVIDIA
Maintainer     : danfe@FreeBSD.org
WWW            : http://www.nvidia.com/object/unix.html
Comment        : NVidia graphics card binary drivers for hardware OpenGL rendering
[b]Options        :
	ACPI_PM        : off
	DOCS           : on
	LINUX          : on
	WBINVD         : off[/b]
Shared Libs required:
	libXext.so.6
	libX11.so.6
Shared Libs provided:
	libnvidia-eglcore.so.1
	libGL.so.1
	libvdpau_nvidia.so.1
	libnvidia-glsi.so.1
	libnvidia-cfg.so.1
	libGLESv1_CM.so.1
	libEGL.so.1
	libGLESv2.so.2
	libnvidia-glcore.so.1
	libnvidia-tls.so.1
Annotations    :
Flat size      : 209MiB
Pkg size       : 37.5MiB
Description    :
These are the official NVidia binary drivers for hardware OpenGL rendering
in X11, using the GLX extensions.

WWW: http://www.nvidia.com/object/unix.html



BTW I didn't get it, what "profit" :) this patch gives? It just disable necessity of xorg.conf? (Where to save "FontPath"?)
Personally I never had any problems with my nvidia configuration on FreeBSD. I always use x11/nvidia-xconfig to create new xorg.conf and it works very fine for me (with this little fix). On the other hand this patch can be useful for new users, if one day it will appear in nvidia-driver build options.
 
Back
Top