# Xorg NVIDIA weirdness



## Catzilla4 (Feb 1, 2015)

This is my first time I have posted on the forum so please correct me if I made any mistakes in making this post.

I am running FreeBSD on my laptop, an MSI GP60.
When I had Xorg perform its configure routine, it had the  "Number of created screens does not match number of detected devices" error.  
However, because I was not paying attention, I continued the xorg.conf test and copied it to the its spot anyway, and it worked except for the screen flashing sometimes (such as during the start up of KDE and anytime I open a video from YouTube), and the graphics being sluggish (which I found out was because OpenGL was not working).  
I then realized the NVIDIA driver was not in my /boot/loader.conf, so I put it in and the screen would remain black.  I went through a cycle of making slightly different settings and getting similar results (although sometimes KDE would boot just be unable to see anything for long periods of time).  These settings included switching between the ports driver and the official driver, different orders of using `Xorg -configure`, `nvidia -xconfig`, and deleting the xorg.conf, different modification of the xorg.conf (that I am almost sure I did not do right) and whether the NVIDIA driver was being loaded on boot.  
The best one with a driver loaded, (the official one with just the Xorg going from blank), got the retro test to work, but when I booted FreeBSD with KDE, it would produce a black screen with the default cursor that I could move around, but nothing else.

Notes: 
I tried to reduce the number of screens by editing the xorg.conf, but that did little.
I tried the `nvidia-xconfig` and that yielded a black unusable screen regardless of whether I used the ports driver or the official driver.
I have attached the generated xorg.conf, which is the one I am currently using.

~Catzilla4


----------



## SirDice (Feb 2, 2015)

This looks like it's an Optimus system. That's going to be difficult to get working correctly. See if you can turn this off in the BIOS, not all laptops allow this though.


----------



## hukadan (Feb 2, 2015)

If it is an Optimus related problem and you cannot turn it off in your BIOS, it seems there is still hope according to this thread : Thread getting-x-to-work-with-nvidia-intel-configuration.49670. I haven't tried this solution yet though.


----------



## Catzilla4 (Feb 3, 2015)

SirDice The BIOS has nothing related to the graphics card in it.
getopt I tried that first and it failed.  The x11/nvidia-xconfig only seemed to make it worse with both the ports driver and the official driver.
hukadan I tried a similar editing of the xorg.conf file, but the exact solution described in your link likely would not work as this laptop has a Haswell integrated graphics processor, so I would have to wait until the FreeBSD mainlines that driver for it to work.  Deleting all but the NVidia device causes a blank screen on boot up.
Thanks for the replies everyone!
~Catzilla4


----------



## kkaos (Feb 24, 2015)

I was getting that error message not too long ago on my FreeBSD 10 PC because my kernel security level was enabled. If `sysctl kern.securelevel` returns a number greater than -1, then you need to disable your system's kernel security level because it prevents x11/xorg from accessing the necessary device files.


----------



## protocelt (Feb 25, 2015)

While I don't know how to fix this problem, the following link and Problem Report may be of interest and something to keep an eye on:
https://wiki.freebsd.org/OptimusVideoSupport
PR 192617


----------



## Catzilla4 (Feb 27, 2015)

kkaos the `sysctl kern.securelevel` returned -1 so that's not the cause.  Thanks for the suggestion though.

protocelt It's too bad that pull request has not been ready to merge sooner.  Let's hope this port actually gets merged in soon.


----------

