# Help With Nvidia, Xorg, and FreeBSD



## RedPhoenix (May 23, 2017)

Well hello everybody..... :3 I saw the Admin edited my one post for clarity..... I hope this new post is easy enough to read.....  Anywho, I currently run FreeBSD with Xorg, Slim, and XFCE4..... Xorg is laggy, to the point that EVERYTHING lags..... :\

So when I install the nvidia-driver Package through pkg install, and run the nvidia-xconfig Command, it creates a file that is supposed to start Xorg, with the Graphics functioning smoothly..... :3 Well, it generates the .conf File ok, but Xorg won't start..... Something about there being "No Screens Found"..... :\ I run FreeBSD on a Dell Inspiron 15 7559, with an Nvidia Geforce GTX 960M Card..... 

Basically, I was wondering if someone could help me with two or three things..... :3


How to get Xorg working with Nvidia (TrueOS seems to do so just FINE)
If I can't get Nvidia working together with Xorg, then maybe there is some way to set the Refresh Rate (the XFCE4 Display Application shows that the only Refresh Rate is 0)
Maybe, perhaps, there is an alternative to Xorg..... :3

I'll post my current xorg.conf Settings File, as well as the Nvidia-generated one..... 

Thank you for any help guys..... :3  Oh, and I'm typing this from FreeBSD with XFCE4 and Xorg.....  Have a good day, ok.....? :3

My `X -configure`'d xorg.conf Settings:


```
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
ModulePath "/usr/local/lib/xorg/modules"
FontPath "/usr/local/share/fonts/misc/"
FontPath "/usr/local/share/fonts/TTF/"
FontPath "/usr/local/share/fonts/OTF/"
FontPath "/usr/local/share/fonts/Type1/"
FontPath "/usr/local/share/fonts/100dpi/"
FontPath "/usr/local/share/fonts/75dpi/"
EndSection

Section "Module"
Load "glx"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/sysmouse"
Option "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"

EndSection

Section "Monitor"
Identifier "Monitor1"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection

Section "Device"
Identifier "Card0"
Driver "nvidia"
BusID "PCI:2:0:0"
EndSection

Section "Device"
### Available Driver options are:-
### Values: : integer, : float, : "True"/"False",
### : "String", : " Hz/kHz/MHz",
### : "%"
### [arg]: arg optional
#Option "ShadowFB" # []
#Option "DefaultRefresh" # []
#Option "ModeSetClearScreen" # []
Identifier "Card1"
Driver "vesa"
BusID "PCI:0:2:0"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection

Section "Screen"
Identifier "Screen1"
Device "Card1"
Monitor "Monitor1"
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection
```

And my `nvidia-xconfigure`'d Settings (I can, of course, still run Xorg with these Settings, until I restart Xorg):



```
nvidia-xconfig: X configuration file generated by nvidia-xconfig
nvidia-xconfig: version 375.66 (buildmeister@swio-display-x86-rhel47-05) Mon May 1 15:00:53 PDT 2017
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
ModulePath "/usr/local/lib/xorg/modules"
FontPath "/usr/local/share/fonts/misc/"
FontPath "/usr/local/share/fonts/TTF/"
FontPath "/usr/local/share/fonts/OTF/"
FontPath "/usr/local/share/fonts/Type1/"
FontPath "/usr/local/share/fonts/100dpi/"
FontPath "/usr/local/share/fonts/75dpi/"
EndSection

Section "Module"
Load "glx"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/sysmouse"
Option "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
Option "DPMS"
EndSection

Section "Monitor"
Identifier "Monitor1"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection

Section "Device"
Identifier "Card0"
Driver "nvidia"
BusID "PCI:2:0:0"
EndSection

Section "Device"

   ### Available Driver options are:-
    ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
    ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
    ### <percent>: "<f>%"
    ### [arg]: arg optional
    #Option     "ShadowFB"               # [<bool>]
    #Option     "DefaultRefresh"         # [<bool>]
    #Option     "ModeSetClearScreen"     # [<bool>]
Identifier     "Card1"
Driver         "nvidia"
BusID          "PCI:0:2:0"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection

Section "Screen"
Identifier "Screen1"
Device "Card1"
Monitor "Monitor1"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection
```


----------



## phoenix (May 23, 2017)

Can you post the /var/log/Xorg.0.log files generated by starting Xorg when using the non-nvidia driver, and when using the nvidia driver?  Most likely, the information needed to make this work will be listed in those.


----------



## RedPhoenix (May 23, 2017)

Well hello there.....   :3   Give me ONE sec.....   :3


----------



## RedPhoenix (May 23, 2017)

Here's the first one:


----------



## RedPhoenix (May 23, 2017)

And the second one, after running nvidia-xconfig:


----------



## phoenix (May 24, 2017)

Do you have any settings for loading the nvidia kernel modules in /boot/loader.conf? From the logs you posted, X is complaining about not finding the kernel module, and not being able to load the nvidia GL libraries.

Make sure you have the nvidia.ko (and nvidia-modesetting.ko if using a new-ish version) kernel modules loaded, then try running X again with the nvidia driver.


----------



## RedPhoenix (May 24, 2017)

phoenix said:


> Do you have any settings for loading the nvidia kernel modules in /boot/loader.conf? From the logs you posted, X is complaining about not finding the kernel module, and not being able to load the nvidia GL libraries.
> 
> Make sure you have the nvidia.ko (and nvidia-modesetting.ko if using a new-ish version) kernel modules loaded, then try running X again with the nvidia driver.


'K.....   :3   I'll give it a shot!.....   ^^   BRB!.....   ^^


----------



## RedPhoenix (May 24, 2017)

phoenix said:


> Do you have any settings for loading the nvidia kernel modules in /boot/loader.conf? From the logs you posted, X is complaining about not finding the kernel module, and not being able to load the nvidia GL libraries.
> 
> Make sure you have the nvidia.ko (and nvidia-modesetting.ko if using a new-ish version) kernel modules loaded, then try running X again with the nvidia driver.


Ok, so I made some headway.....   :3   I loaded nvidia, and nvidia-modesetting using kldload, and I got X to START, but.....   :\   There was only the Cursor, and that white Text Cursor that appears before X fully initializes.....      Any ideas.....?   :3   Thank you for your help so far, good sir or madam!.....   ^^


----------



## Phishfry (May 24, 2017)

You have to use the Linux Compatibility Layer as well with this driver. Did you set that up?

/etc/rc.conf

```
kld_list="nvidia-modeset"
```

/boot/loader.conf

```
linux_load="YES"
nvidia_load="YES"
```


----------



## aikizen (May 24, 2017)

hi,
i follow this, but no load automatically nvidia module

i have an *quadro K2000M *graphic card.
when i use kldload, the module work good.



Phishfry said:


> You have to use the Linux Compatibility Layer as well with this driver. Did you set that up?
> 
> /etc/rc.conf
> 
> ...


----------



## RedPhoenix (May 24, 2017)

Phishfry said:


> You have to use the Linux Compatibility Layer as well with this driver. Did you set that up?
> 
> /etc/rc.conf
> 
> ...


Yeah.....      I have that in my rc.conf File.....      But for some reason, I have to load nvidia by hand.....   :\   Maybe I need to do that with the Linux.ko File too.....?   

EDIT: It turns out that the nvidia option WASN'T in my rc.conf File like I thought!.....   ^^   I'm Rebooting now, and I'll let you know how everything goes!.....   :3


----------



## RedPhoenix (May 24, 2017)

aikizen said:


> hi,
> i follow this, but no load automatically nvidia module
> 
> i have an *quadro K2000M *graphic card.
> when i use kldload, the module work good.


Well hello there, good sir. I see you have that same problem too. Lets hope you and I get this resolved soon!


----------



## RedPhoenix (May 24, 2017)

Phishfry said:


> You have to use the Linux Compatibility Layer as well with this driver. Did you set that up?
> 
> /etc/rc.conf
> 
> ...


Well hello there. So far, no Luck.  I did everything you said to do, but unless I load nvidia.ko by hand, I don't even get to that black screen with the cursor and the text cursor.


----------



## SirDice (May 24, 2017)

Please post your Xorg.0.log on Pastebin or a similar service.


----------



## RedPhoenix (May 24, 2017)

SirDice said:


> Please post your Xorg.0.log on Pastebin or a similar service.


Here you go!   https://pastebin.com/d85MWA8c


----------



## SirDice (May 24, 2017)

Remove /etc/X11/xorg.conf, you don't need it. Create /usr/local/etc/X11/xorg.conf.d/driver-nvidia.conf:

```
Section "Device"
        Identifier  "Card0"
        Driver      "nvidia"
EndSection
```

Make sure /boot/loader.conf has:

```
nvidia-modeset_load="YES"
```

No other configuration is required.


----------



## RedPhoenix (May 24, 2017)

Well hello there, good sir.      I did as you suggested, but it didn't work.      I'm getting the hang of this.      Here's the Xorg Log File:   https://pastebin.com/ZwYucipu


----------



## Phishfry (May 24, 2017)

I did not see where you added Linux Compatibility? It is required to work.

/boot/loader.conf


Phishfry said:


> linux_load="YES"



It can't find the driver.
*Failed to initialize GLX extension (Compatible NVIDIA X driver not found)
*
The linux compatiblity layer is named linux_base-c6 and can be installed via pkg:
`pkg install linux_base-c6`


----------



## RedPhoenix (May 25, 2017)

Phishfry said:


> I did not see where you added Linux Compatibility? It is required to work.
> 
> /boot/loader.conf
> 
> ...





Phishfry said:


> I did not see where you added Linux Compatibility? It is required to work.
> 
> /boot/loader.conf
> 
> ...


Hello there good sir.....   :3   I was away for a day because my Laptop was in for repairs.....      Anywho, I'll give it a go!


----------



## RedPhoenix (May 25, 2017)

Phishfry said:


> I did not see where you added Linux Compatibility? It is required to work.
> 
> /boot/loader.conf
> 
> ...


Nah, everything is there.   :\   That's weird...   It also says that that linux_base-c6 is already installed.   :\   I wonder.....   :3


----------



## MarcoB (May 25, 2017)

Linux compatibility is an option for the driver, it's not required for a working driver.


----------



## RedPhoenix (May 26, 2017)

MarcoB said:


> Linux compatibility is an option for the driver, it's not required for a working driver.


Well hello there.....      I see what you mean...      But I wonder how I could solve this issue.....


----------

