Blank screen unresponsive cursor on laptop while external display is fine for NVIDIA with Optimus, Xorg

My laptop is an Optimus capable and there is no way to disable Intel graphics from the BIOS (I am also willing to use both whenever suits). I followed the handbook and also tried all relevant posts for this issue with NVIDIA, but nothing worked. I was only able to reach to a blank screen with a white unresponsive cursor when I used nvidia-xconfig and that is all. The generated /etc/X11/xorg.conf is as follows,
Code:
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 525.116.04

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/sysmouse"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "keyboard"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BusID          "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Any help would be highly appreciated. Thank you.

Update: Intel graphics also did not work until I added the following to /etc/X11/xorg.conf.d/i915.conf,
Code:
Section "Device"
        Identifier  "Card0"
        Driver      "modesetting"
        BusID       "PCI:0:2:0"

        Option      "AccelMethod" "glamor"
EndSection

Section "Module"
       Load "dri2"
       Load "glamoregl"
EndSection
So, Is there some modules also needs to be loaded with NVIDIA?
 

Attachments

  • xorg-log.txt
    20.2 KB · Views: 71
Just a note. I think it works anyway but it should be /usr/local/etc/X11.

EDIT:

Yes, I mean /usr/local is the convention, but other paths can be used.
xorg.conf() - See Description.

I'm sorry. I don't want to add more noise.

Is "PCI:1:0:0" the true nvidia?

 
In theory all you should need is a "snippet" file pointing at the nvidia card. Basically, all you should need is the Device section from what you posted. I've had mixed results over the years with the nvidia-xconfig it may not add all the right sections that normally get autodetected. By creating /etc/X11/xorg.conf I think you override all the autodetect things.

You say the laptop has Intel and Nvidia Optimus. Is the Nvidia tied to driving an external monitor or can it drive the internal display?
What nvidia drivers do you have loaded/installed? if you do pkg search nvidia you get a bunch of things, one is nvidia-hybrid-graphics-390-0.5 th at specifically says "Optimus Technology support".
I would start by not using that xorg.conf (you can rename it), then in /usr/local/etc/X11/xorg.conf.d create a snippet file, call it something like driver-nvidia.conf with the following:
Code:
Section "Device"
#    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BusID          "PCI:1:0:0"
EndSection

Then provide the output of kldlist, pkg info | grep -i nvidia Someone may also want to look at the Xorg.log file.
 
Just a note. I think it works anyway but it should be /usr/local/etc/X11.

EDIT:

Yes, I mean /usr/local is the convention, but other paths can be used.
xorg.conf() - See Description.

I'm sorry. I don't want to add more noise.

Is "PCI:1:0:0" the true nvidia?

Thank you for the reply. I can see /etc/X11/xorg.conf listed there. I think the BusID is correct, as you can see,
Code:
# pciconf -lv|grep -B4 VGA
vgapci1@pci0:0:2:0:     class=0x030000 rev=0x05 hdr=0x00 vendor=0x8086 device=0x9bc4 subvendor=0x1458 subdevice=0x86b6
    vendor     = 'Intel Corporation'
    device     = 'CometLake-H GT2 [UHD Graphics]'
    class      = display
    subclass   = VGA
--
vgapci0@pci0:1:0:0:     class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x2191 subvendor=0x1458 subdevice=0x86b6
    vendor     = 'NVIDIA Corporation'
    device     = 'TU116M [GeForce GTX 1660 Ti Mobile]'
    class      = display
    subclass   = VGA
The tutorial is obsoleted by a new official FreeBSD port, as mentioned in the article.
 
Optimus models are a mess. I use my Dell Optimus for Windows/AutoCAD.
Even when I got the video working the fan ran 100%.
 
Thank you, mer, for the reply.
Is the Nvidia tied to driving an external monitor or can it drive the internal display?
No, it is tied to a laptop LCD with no external display attached.
What nvidia drivers do you have loaded/installed?
I have installed the latest driver using pkg install nvidia-driver which is 525.116.03.
one is nvidia-hybrid-graphics-390-0.5 th at specifically says "Optimus Technology support".
Unfortunately, my card GTX 1660 Ti is not listed under supported device list. However, I tried anyway, but didn't work.
output of kldlist
kld_list="nvidia-modeset"
pkg info | grep -i nvidia Someone may also want to look at the Xorg.log file.
nvidia-driver-525.116.03 NVidia graphics card binary drivers for hardware OpenGL rendering

I've updated the parent post and xorg log is attached, collected after following your instructions and a reboot.
 
It is auto detecting the modes and loading at low resolution. Try specifying the "modes" within the Display subsection. I don't have time to review the rest now.
 
kldstat | grep nvidia
are both nvidia-modeset.ko and nvidia.ko loaded?

It looks like xorg can't find any display devices on the nvidia.
Code:
[    19.455] (--) NVIDIA(0): Valid display device(s) on GPU-0 at PCI:1:0:0
[    19.455] (--) NVIDIA(0):     DFP-0
[    19.455] (--) NVIDIA(0):     DFP-1
[    19.455] (--) NVIDIA(0):     DFP-2
[    19.455] (WW) NVIDIA: No DRM device: No direct render devices found.
[    19.456] (II) NVIDIA(0): NVIDIA GPU NVIDIA GeForce GTX 1660 Ti (TU116-A) at PCI:1:0:0
[    19.456] (II) NVIDIA(0):     (GPU-0)
[    19.456] (--) NVIDIA(0): Memory: 6291456 kBytes
[    19.456] (--) NVIDIA(0): VideoBIOS: 90.16.4a.00.5e
[    19.456] (II) NVIDIA(0): Detected PCI Express Link width: 16X
[    19.457] (--) NVIDIA(GPU-0): DFP-0: disconnected
[    19.457] (--) NVIDIA(GPU-0): DFP-0: Internal TMDS
[    19.457] (--) NVIDIA(GPU-0): DFP-0: 165.0 MHz maximum pixel clock
[    19.457] (--) NVIDIA(GPU-0):
[    19.457] (--) NVIDIA(GPU-0): DFP-1: disconnected
[    19.457] (--) NVIDIA(GPU-0): DFP-1: Internal DisplayPort
[    19.457] (--) NVIDIA(GPU-0): DFP-1: 2660.0 MHz maximum pixel clock
[    19.457] (--) NVIDIA(GPU-0):
[    19.458] (--) NVIDIA(GPU-0): DFP-2: disconnected
[    19.458] (--) NVIDIA(GPU-0): DFP-2: Internal TMDS
[    19.458] (--) NVIDIA(GPU-0): DFP-2: 165.0 MHz maximum pixel clock
[    19.458] (--) NVIDIA(GPU-0):

If the laptop has a connection for an external monitor and you have one handy, try attaching it and see if anything changes.
 
kldstat | grep nvidia
Code:
 5    1 0xffffffff826e5000   10f2f0 nvidia-modeset.ko
 6    1 0xffffffff82800000  33aa138 nvidia.ko
external monitor and you have one handy, try attaching it
You are right, it is working perfectly with external display. So what could I do to set the right display then? I have also attached the new xorg log.
 

Attachments

  • Xorg.0.log.txt
    21.5 KB · Views: 74
You are right, it is working perfectly with external display. So what could I do to set the right display then? I have also attached the new xorg log.
Ahh this is good/interesting.
I think this tells me "by default the nvidia graphics is looking at/hooked up to the external display".
Now the question becomes "can we/how do we connect the internal LCD to the nvidia card?"

And my answer to that is "I don't know".
Back up in #2, CuatroTorres linked to something about Nvidia Optimus. I took a quick look earlier and there was something about running an executable that would "enable/link the Nvidia hardware". Not sure if that is relevant to your situation.

Bottom line, my opinion:
By default your hardware uses the Intel for the internal LCD, the Nvidia for driving an external display.
So loading drm_kmod, i915kms and creating a snippet file to load modesetting on the busid for the Intel should let you use the Intel for the internal LCD and the Nvidia for the external monitor.
 
Bottom line, my opinion:
By default your hardware uses the Intel for the internal LCD, the Nvidia for driving an external display.
So loading drm_kmod, i915kms and creating a snippet file to load modesetting on the busid for the Intel should let you use the Intel for the internal LCD and the Nvidia for the external monitor.
That's exactly what it's about. You don't want high battery consumption using your dedicated graphics card daily. You'll want to use it for specific jobs: gaming, video editing...
There are several utilities, in Linux you have switchers like switcheroo or optimus-manager.
On FreeBSD you have x11/nvidia-hybrid-graphics. It involves you calling applications through an nvrun-vgl launcher.
I think you should try to work without xorg.conf and run nvidia when you need it. But if you use a xorg.conf you should specify the two cards with the modes.
I have a 1660Ti + Radeon and it worked in the past without xorg.conf. I can't test it right now, I need another OS.

FYI:


NVIDIA Accelerated FreeBSD Graphics Driver README and Installation Guide
 
  • Like
Reactions: mer
Ahh this is good/interesting.
I think this tells me "by default the nvidia graphics is looking at/hooked up to the external display".
Now the question becomes "can we/how do we connect the internal LCD to the nvidia card?"
freebsd_user, to exlplore further if your laptop screen is indeed "unreachable" for your nvidia GPU, when the nvidia driver is driving your external display, does x11/nvidia-settings show (or not) your laptop screen as well?
 
Hello freebsd_user,
I use Nvidia Optimus drivers, maybe my post will help you:
 
Thanks for the explanation. I think I am ok with something like prime render offload.
I use Nvidia Optimus drivers, maybe my post will help you:
Is there performance penalty using Virtual GL? Is it the same as running prime render offload on Linux? Did anyone try this driver? Although, it creates panics on kldunload and the contributor has no intention to fix it.

Update: serjsk8 and CuatroTorres I have just tried hybrid graphics drivers again with clean installation but when I run nvrun-vgl I get following errors,
Code:
$ nvrun-vgl bomber
[ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted (1)
Although nvrun glxinfo -B is showing,
Code:
$ nvrun glxinfo -B
name of display: :8
display: :8  screen: 0
direct rendering: Yes
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 6144 MB
    Total available memory: 6144 MB
    Currently available dedicated video memory: 5926 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1660 Ti/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 525.116.03
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6.0 NVIDIA 525.116.03
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)

OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 525.116.03
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
 
Last edited:
Is there performance penalty using Virtual GL? Is it the same as running prime render offload on Linux? Did anyone try this driver? Although, it creates panics on kldunload and the contributor has no intention to fix it.
Mmm... i don't know if have some performance penalty... I suspect so.
No I didn't try amshafer/nvidia-driver from github.

$ nvrun-vgl bomber [ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted (1)
If I understand correctly this has something to do with OpenAL 3D audio, right?
 
Back
Top