nvidia-xconfig doesnt do what i want it to, nor does nvidia-settings

Hi!

I have a similar config and do not know how to get HDMI working.

I have an Asus TUF FX505 with NVidia 1650 and an integrated Vega (Ryzen7 cpu)
I am running arch linux and have a setup in which I am running the amd gpu normally and able to run apps with the nvidia GPU using “'prime-run”. I have checked this and it surely works. What came as bad news to me is that now hooking up an external monitor for development xrandr does not show the external display (not even the HDMI output as a possibility):

[prenex@magosit-laptop ~]$ xrandr -q
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
   1920x1080    120.04*+  48.01  
   1680x1050    120.04  
   1280x1024    120.04  
   1440x900     120.04  
   1280x800     120.04  
   1280x720     120.04  
   1024x768     120.04  
   800x600      120.04  
   640x480      120.04  
[prenex@magosit-laptop ~]$

This is the current internal display - hdmi monitor is plugged in. Also:

[prenex@magosit-laptop ~]$ xrandr --listmonitors
Monitors: 1
 0: +*eDP-1 1920/344x1080/194+0+0  eDP-1

This is my setup (it shows both providers):

[prenex@magosit-laptop ~]$ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x44 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 4 outputs: 1 associated providers: 0 name:modesetting
Provider 1: id: 0x1f7 cap: 0x0 crtcs: 0 outputs: 0 associated providers: 0 name:NVIDIA-G0

Provider 0 has 1 outputs though and provider 1 (which is the nvidia) does not seam to have?

This of course works currently:

[prenex@magosit-laptop ~]$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep vendor
server glx vendor string: NVIDIA Corporation
client glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation
[prenex@magosit-laptop ~]$

Also the result is the very same if I use prime-run glxinfo | grep “vendor” instead.

These are what I have for manual config:

[prenex@magosit-laptop ~]$ ls -lat /usr/share/X11/xorg.conf.d/
összesen 24
drwxr-xr-x 2 root root 4096 máj    8 13.28 .
drwxr-xr-x 6 root root 4096 máj    8 11.48 ..
-rw-r--r-- 1 root root 1350 máj    5 07.08 10-quirks.conf
-rw-r--r-- 1 root root   93 ápr   24 15.46 20-nvidia-prime.conf
-rw-r--r-- 1 root root  227 ápr    7 17.23 10-nvidia-drm-outputclass.conf
-rw-r--r-- 1 root root 1429 márc  21 11.09 40-libinput.conf
[prenex@magosit-laptop ~]$

nvidia-prime.conf contents:

Section "ServerLayout"
    Identifier "layout"
    Option "AllowNVIDIAGPUScreens"
EndSection

nvidia-drm-outputclass.conf contents:

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection

The other configs I think are unrelated. As you can see there is no file for amdgpu and defaults seem to be good there. I get proper 3D support from both the integrated and normal GPU, but I prefer only using the NVIDIA for godot developing, games and 3D development while others should spare battery by default so I did not set nvidia as the primary GPU (I guess that is why the list shows them in this order?)

Even though I am using your propriately driver I stumbled upon the “reverse prime” concept here:

https://wiki.freedesktop.org/nouveau/Optimus/

It advises to try rendering with the built-in GPU and then let the nvidia display it - in case if there are no multiplexer for GPU change and maybe only nvidia having real connection to hdmi. My preferred way of doing things would be to let nvidia kick-in only if I want to (to preserve battery), but me being able to channel through the inbuilt GPU to the external monitor port that nvidia likely has only ability to reach (is this true??? Woudl be nice if not) without reboot or anything.

This is what I try but to no avail (see: Using outputs on discrete GPU from my link):

xrandr --setprovideroutputsource modesetting NVIDIA-G0; xrandr --auto
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  35 (RRSetProviderOutputSource)
  Value in failed request:  0x1f7
  Serial number of failed request:  16
  Current serial number in output stream:  17
[prenex@magosit-laptop ~]$ 

As you can see this just cannot work.

It would be nice if we could understand the architecture a bit better too: Is the NVIDIA card the only one on this laptop / configuration that can access the external hdmi output and if we render with the integrated it cannot come out, or it should be able to do so without what I am trying?

I am also open to other klind of solutions. Maybe will try to enable the NVIDIA as primary GPU and make some scripts to change between the used GPU before I do startx? (I do startx manually anyways). It looks like a passable solution too, but I am also not sure if hdmi will work that case.

Primary minimal needs are that I can have a setup that is battery saving for mobile usage (but I can run nvidia when needed for specific apps) and a setup where hdmi works when used as a stationary workstation with external monitor, keyboard and mouse.

Any help? Should I open a new thread or it is fine / better here?