# Working Nvidia driver 367.35 on FreeBSD 11 (Short step-for-step How-to)



## Snurg (Aug 18, 2016)

Yes I know there are packaged nvidia drivers in the FreeBSD repo.
But they are old and do not support current Nvidia cards.
So I had to find out how manual installation of the driver is done.
As I didn't find solutions in the forums, I like to contribute my solution:

1. Download the driver from nvidia.com, unpack the file.
2. Make will croak first where the OS version is checked, complaining about an #ifdef that you need to change. Modify the version check so that it compiles.
3. Do a grep and find the about a dozen occurrences of "d_thread_t" in 4 files. These are deprecated now and have to be changed to "struct thread". After that compiling and installing will succeed.
4. Finally some configuration file editing:
As nvidia-settings will croak due to a missing library you can either use the version from the old package or just ignore this and take a standard template nvidia xorg.conf.
(A temporary solution could be packaging the old nvidia-settings version together with the new drivers, btw)
There is only one thing that apparently *must* be configured additionally.
You may have to explicitly add a modeline with your preferred resolution as DPMS seems to fail for some reason and the Xserver hangs in 640x480 else. Like this:
Modes  "1920x1200"

In /etc/rc.conf linux_enable="YES" must be set.

Finally, in addition to the usual nvidia_load in /boot/loader.conf with the new drivers an additional modeset module must be loaded:
nvidia_load="YES"
nvidia-modeset_load="YES"

If you use the console and X concurrently, you might want to use sc, as vt still has a few nasty bugs.
After all these steps, the nvidia driver should probably run smoothly.
Hope this helps!


----------



## SirDice (Aug 18, 2016)

Snurg said:


> Yes I know there are packaged nvidia drivers in the FreeBSD repo.
> But they are old and do not support current Nvidia cards.


They are not old. The x11/nvidia-driver port currently has version 346.96, which is only slightly behind.


Snurg said:


> So I had to find out how manual installation of the driver is done.


`cd /usr/ports/x11/nvidia-driver && make install`

If you find the driver version lagging behind, submit patches to have it updated.


----------



## tobik@ (Aug 18, 2016)

You could also help test the update in PR 201340.


----------



## Snurg (Aug 19, 2016)

*Information update:*
Some research and testing revealed that the "options VESA" that are in the default GENERIC kernel must be removed to make S3 suspend/resume work correctly.
With the VESA option active, the console display is black and unusable after resuming, only the X display gets restored.

Thus I had to build a custom kernel to make S3 work in both display modes.

[Edit: When I revisited my kernel config file, I also removed "options  SC_PIXEL_MODE" to strip sc from its unused graphical console code. I don't think that this is relevant for working resume. But I am too lazy to test/verify this assumption now as it is late night. Just FYI...]

(Maybe part of the issues the vt console devs are battling with are actually caused by the VESA driver?)

Hardware used: HP Z800, BIOS 03.57, Quadro 2000



SirDice said:


> They are not old. [...]
> If you find the driver version lagging behind, submit patches to have it updated.


FreshPorts showed me a version 304 (legacy) and a version 340 (one year behind)... maybe I confused the older one for the "current" one and wondered why my graphics card was not supported. I apologize!
Could you point me to a How-To for correctly submitting patches, please?



tobik said:


> You could also help test the update in PR 201340.


Good idea, I'll chime in and offer my assistance.


----------



## ondra_knezour (Aug 19, 2016)

Snurg said:


> Could you point me to a How-To for correctly submitting patches



https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/port-upgrading.html#svn-diff

https://www.freebsd.org/doc/en_US.ISO8859-1/articles/problem-reports/pr-writing.html


----------



## tobik@ (Aug 29, 2016)

The driver in the ports tree has been updated to 367.35: x11/nvidia-driver


----------

