Seeking help with setting up X w/ hybrid graphics laptop (Nvidia dGPU/AMD iGPU)

Hello all! Apologies for making yet another nvidia driver issue post to add to the forums collection, but I am not sure what is going wrong and I have been at this for awhile now.

I don't believe the handbook covers my machine too well given my GPU situation, so I'd really appreciate the help.

Specs:
Laptop: ASUS Rog Zephyrus G14 GA401
Discrete GPU: NVIDIA 3060 RTX Mobile Max Q
Integrated GPU: AMD Ryzen 9 5900HS with Radeon Vega graphics
FreeBSD Kerne version: FreeBSD 14.0 Release

Drivers I have tried (AMD + Nvidia):

x11/nvidia-hybrid-graphics (currently using this)
nvidia-drivers
nvidia-drm-kmod
drm-kmod


"Driver" xorg options I have tried for the nvidia card [20-nvidia.conf]:
nvidia-modeset
nvidia

"Driver" xorg options for the amd iGPU [20-amdgpu.conf]:
amdgpu

Xorg config dirs:

[ 2637.579] (==) Using config directory: "/usr/local/etc/X11/xorg.conf.d"
[ 2637.579] (==) Using system config directory "/usr/local/share/X11/xorg.conf.d"

Things I have tried:
- I've run nvidia xconfig, however that did not seem to have any positive effect. Xorg wasn't even loading ANY config aside from the system config directory for awhile after.
- In my rc.conf, I have tried "nvidia-modeset nvidia amdgpu" & "nvidia-modeset amdpu" && "nivdia amdgpu"
- desktop-installer only produces a configuration which makes use of the internal monitor
- fully nuked and reinstalled the OS

Generally having a hard time getting xorg to load the drivers I think it needs: amdgpu.ko for the iGPU, nvidia-modeset.ko or nvidia.ko for the dGPU
I was at one point able to get xorg to load nvidia.ko, yet the external monitor on, yet fully blank. after authenticating through xddm.

Checking through loaded kernel modules, I can see nvidia-modeset.ko, nvidia.ko, and amdgpu.ko (plus a bunch more amd modules) are sucessfully loaded in just fine, yet making Xorg make use of them
has been the difficult part.

One tidbit that is not in the current xorg log, is the following error which had appeared prior:
"freebsd vga arbiter cannot open kernel arbiter no multi-card support"

Any advisement is apperciated, still very fresh to the *BSD world.
Thank you all in advance for any advice you may have.
 

Attachments

After a better read of this post regarding hybrid graphics, I see I have misunderstood exactly how the nvidia_xorg works. There are two X servers, one driven by intended to be driven as a secondary and used when needed via the nvrun-gl command.

I have corrected my config so there is ONLY 20-amdgpu.conf in xorg.conf.d and ONLY 20-nvidia.conf in xorg-nvidia-headless.conf.d.
/var/log/Xorg.8.log shows the nvidia_xorg server starts up just fine.

My dGPU is connected to my single HDMI port, and I have two USB-C ports which can be for display as well- they can only make use of the iGPU.

Going to see what I can come up with now that I at least sorta think I know how this works.
 
All seemed to be well with setting up according to this blog.

however my internal monitor is black becuase xrandr --setprovideroutputsource modesetting NVIDIA-0 returns "X Error of failed request: BadValue".

Not sure where to go from here exactly. Will post more info on on current conf files and etc soon.
 
I am pretty sure that you can simply use nvidia-drm for that (you need to only load nvidia-drm, not the other ones since it may failed due to the order).
The easiest solution would be to use the usb-c port for output, and just use the dgpu either with vulkan (which should default to the dgpu in most cases) or with
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia yourOpenglApplication.
This also works on Wayland (sway with the WLR_NO_HARDWARE_CURSORS=1 env variables).
I tested this with a Ryzen 5 4600G and an rtx 2080 (on a desktop), it worked with all output to the dgpu and all the output on the igpu.
 
Back
Top