You are not logged in.

#1 2020-03-14 00:24:53

madcabbit
Member
Registered: 2020-03-13
Posts: 5

[Solved] Xorg with nvidia prime

I currently have an Alienware m17 R1 set up, multi boot with Windows, Mint, and Arch.  I had thought that nvidia was set up on both, since I've been using them both for several months on this laptop until I tried to run Steam using proton on a game.

Mint shows nvidia working with glxinfo, dri devices showing up as such in /dev/dri/by-path:

lrwxrwxrwx 1 root root   8 Mar 13 19:44 pci-0000:00:02.0-card -> ../card0
lrwxrwxrwx 1 root root  13 Mar 13 19:44 pci-0000:00:02.0-render -> ../renderD128
lrwxrwxrwx 1 root root   8 Mar 13 19:44 pci-0000:01:00.0-card -> ../card1
lrwxrwxrwx 1 root root  13 Mar 13 19:44 pci-0000:01:00.0-render -> ../renderD129

The Xorg.0.log from mint is here, and the lsmod is here

In arch, glxinfo -B shows Intel:

name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel Open Source Technology Center (0x8086)
    Device: Mesa DRI Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)  (0x3e9b)
    Version: 19.3.4
    Accelerated: yes
    Video memory: 3072MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2) 
OpenGL core profile version string: 4.6 (Core Profile) Mesa 19.3.4
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 3.0 Mesa 19.3.4
OpenGL shading language version string: 1.30
OpenGL context flags: (none)

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 19.3.4
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

lspci output for the two devices:

00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Mobile)
01:00.0 VGA compatible controller: NVIDIA Corporation TU106M [GeForce RTX 2060 Mobile] (rev a1)

Only the device for the intel card is showing in /dev/dri/by-path:

lrwxrwxrwx 1 root root   8 Mar 13 19:50 pci-0000:00:02.0-card -> ../card0
lrwxrwxrwx 1 root root  13 Mar 13 19:50 pci-0000:00:02.0-render -> ../renderD128

lsmod for Arch is here.

I had no xorg.conf, and I tried creating one with this per another post:

Section "Device"
  Identifier "iGPU"
  Driver "modesetting"
EndSection

Section "Screen"
  Identifier "iGPU"
  Device "iGPU"
EndSection

Section "Device"
  Identifier "dGPU"
  Driver "nvidia"
EndSection

But it didn't help.

My most current Xorg.0.log is here.

Edit:  I forgot to list my current nvidia packages:

pacman -Ss nvidia | grep installed
\extra/libvdpau 1.3-1 [installed]
extra/libxnvctrl 440.64-1 [installed]
extra/nvidia 440.64-2 [installed]
extra/nvidia-prime 1.0-1 [installed]
extra/nvidia-settings 440.64-1 [installed]
extra/nvidia-utils 440.64-2 [installed]
extra/opencl-nvidia 440.64-2 [installed]
community/bumblebee 3.2.1-20 [installed]
multilib/lib32-libvdpau 1.3-1 [installed]
multilib/lib32-nvidia-utils 440.64-1 [installed]
multilib/lib32-opencl-nvidia 440.64-1 [installed]

I installed bumblebee and can get some games working in steam with it, but I'd rather X just load the nvidia driver with prime directly like Mint does.

Last edited by madcabbit (2020-03-15 07:39:47)

Offline

#2 2020-03-14 00:55:40

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,743

Re: [Solved] Xorg with nvidia prime

You need to run stuff you want on the nvidia card with prime-run if you intend to use nvidia's real prime offloading  support.

If you really want to do like mint, remove bumblebee (remove that anyway, it might break prime-run), nvidia-prime and your xorg.conf and follow: https://wiki.archlinux.org/index.php/NV … phics_only

Offline

#3 2020-03-14 01:07:53

madcabbit
Member
Registered: 2020-03-13
Posts: 5

Re: [Solved] Xorg with nvidia prime

The reason I was even trying bumblebee is because prime-run wasn't working at all.  optirun was running steam and some apps, but trying to use prime-run on steam just hangs:

prime-run steam
Running Steam on arch rolling 64-bit
STEAM_RUNTIME is enabled automatically
Pins up-to-date!
/home/believe/.local/share/Steam/ubuntu12_32/steam
Installing breakpad exception handler for appid(steam)/version(1581460722)

Also, runninb glxinfo on prime-run gives an error (I think optirun also gave the same error):

prime-run glxinfo -B
name of display: :0
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  39
  Current serial number in output stream:  40

There's also some sort of issue with my vulkan install, I was trying to clear up the nvidia issue to see if it would help with that, since regardless if I run vulkaninfo with prime-run or not, I get the same error:

 
prime-run vulkaninfo
/build/vulkan-tools/src/Vulkan-Tools-sdk-1.2.131.1/vulkaninfo/vulkaninfo.h:477: failed with ERROR_INITIALIZATION_FAILED

I was looking into bumblebee since it gives a different error so it seemed like at least it was trying to do something with the nvidia drivers:

optirun vulkaninfo
X Error of failed request:  BadLength (poly request too large or internal Xlib length error)
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  7 (X_GLXQueryVersion)
  Serial number of failed request:  9
  Current serial number in output stream:  9

Last edited by madcabbit (2020-03-14 01:16:27)

Offline

#4 2020-03-14 01:51:27

madcabbit
Member
Registered: 2020-03-13
Posts: 5

Re: [Solved] Xorg with nvidia prime

Following the guide you linked to load the Nvidia driver instead, plus modesetting, and not only are glxinfo and vulkaninfo displaying properly, but I was able to load NieR:Automata that has failed every time I tried to load it with prime-run and optirun.  For whatever reason, nvidia-prime just won't seem to work for me, but at least it's working as well as it does in Mint.  The only problem being that I forgot that nvidia modeset breaks ttys, leaving me with black screens if something happens in X and I try to switch out.

Last edited by madcabbit (2020-03-14 02:10:41)

Offline

#5 2020-03-14 12:01:13

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,743

Re: [Solved] Xorg with nvidia prime

To fix breaking of TTYs enable the nvidia-drm.modeset=1 on your kernel parameters (though it might still break, as switching to a TTY will implicitly switch to intel as the display entity again).

For prime-run you should ensure that you do not have bumblebee installed at the same time (and remove that xorg.conf you created now)  because those will be inherently conflicting with the prime-run setup. (The xorg log from that run should include the information that the nvidia driver is using the "AllowNVIDIAGPUScreens" xorg option)

However if you are happy with just using the old offloading method that I linked please mark as [SOLVED] by editing the title in your first post.

Offline

#6 2020-03-14 12:05:47

madcabbit
Member
Registered: 2020-03-13
Posts: 5

Re: [Solved] Xorg with nvidia prime

Okay, now it's broken again.  I removed bumblebee and the xorg.conf, and I'm trying to revert and see if I can get prime-run working, but I keep getting this:

prime-run glxinfo   
name of display: :1
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  39
  Current serial number in output stream:  40

Current Xorg.0.log is here.  It shows NVIDIA(G0), but it's no longer showing up under xrandr --listproviders:

Providers: number : 1
Provider 0: id: 0x47 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 5 associated providers: 0 name:modesetting

After all else failed, I set up this xorg.conf to try and make sure it gets the devices by the proper BusID:

Section "Files"
    ModulePath "/usr/lib/xorg/modules"
    ModulePath "/usr/lib/nvidia/xorg"
EndSection

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "iGPU"
    Option "AllowNVIDIAGPUScreens"
EndSection

Section "Device"
    Identifier "iGPU"
    Driver "modesetting"
    BusID "PCI:0:2:0"
EndSection

Section "Screen"
    Identifier "iGPU"
    Device "iGPU"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
EndSection

I have MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm) set in /etc/mkinitcpio.conf, set nvidia-drm.modeset=1 as a kernel option and rebuilt the initrd, and I'm still getting the BadValue error in glxinfo.

Offline

#7 2020-03-14 16:47:58

seth
Member
Registered: 2012-09-03
Posts: 51,309

Re: [Solved] Xorg with nvidia prime

name of display: :1

?

The log is for :0 and also says

[     9.357] (==) Log file: "/var/log/Xorg.0.log", Time: Sat Mar 14 07:49:45 2020

and your hostname suggests that you're from Italy (so this isn't just a TZ skew)

Offline

#8 2020-03-14 21:11:32

madcabbit
Member
Registered: 2020-03-13
Posts: 5

Re: [Solved] Xorg with nvidia prime

Huh, I didn't even notice that :1 was showing up.  I just started the laptop after having it down for hours, and it appears gdm is starting a log on 0, and another under my user group:

-rw-r--r--   1 root gdm              60415 Mar 14 15:54 Xorg.0.log
-rw-r--r--   1 root gdm             112531 Mar 14 08:07 Xorg.0.log.old
-rw-r--r--   1 root believe          57572 Mar 14 15:52 Xorg.1.log
-rw-r--r--   1 root believe          63899 Mar 14 08:07 Xorg.1.log.old

I'm not sure what's causing two screens to start like this.  gdm/X is starting on two ttys:

gdm          677  0.0  0.4 758284 79192 tty1     Sl+  16:48   0:00 /usr/lib/Xorg vt1 -displayfd 3 -auth /run/user/120/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -verbose 3
believe      978  3.4  1.5 1038132 243296 tty2   Sl+  16:48   0:42 /usr/lib/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -verbose 3

For the record, I'm in the eastern US, not Italy (hostname is actually based on a Billy Joel song, which is the theme I use for my PC names).

I disabled gdm and enabled sddm, and while it's also running on two ttys for some reason, prime-run is working.  Since I'm using gdm-plymouth from the aur, I updated and rebuilt the packages and it seems to be working now.   While glxinfo shows Intel when run normally and nvidia when run with prime-run, Steam still seems to run on the NVIDIA card regardless, since I see no performance loss whether I launch steam with prime-run or not.
Still, unless X using two ttys is something new and normal for the configuration I'm using right now, I'd like to find out why X is spawning twice.

Last edited by madcabbit (2020-03-14 21:13:34)

Offline

#9 2020-03-14 21:40:22

seth
Member
Registered: 2012-09-03
Posts: 51,309

Re: [Solved] Xorg with nvidia prime

GDM launches a second server for the session, that's normal behavior (for the particular DM) - the only problem with that is that the posted log did not reflect the server you struggled  to "prime-run glxinfo" from.

Reg. steam, it can probably display the renderer - in doubt some game might be able to.

Offline

#10 2021-01-06 09:00:07

TheGreatKingFox
Member
Registered: 2021-01-06
Posts: 3

Re: [Solved] Xorg with nvidia prime

See that the Identifiers of the Devices are the same, your device name is 'Nvidia' but your are setting 'dGPU' on the xorg.conf

Offline

#11 2021-01-06 09:19:07

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,743

Re: [Solved] Xorg with nvidia prime

Not really. Identifiers are in the majority of cases for xorg internal namings and can be named whatever you want (notable exception monitor sections but those aren't the case here). In the posted configs the BusId is the "device-identifying" option. And the thread is marked as [SOLVED] so the config must have worked.

Offline

Board footer

Powered by FluxBB