You are not logged in.

#1 2023-11-21 10:51:29

daigennki
Member
Registered: 2020-10-23
Posts: 33

[SOLVED] OpenGL and Vulkan games fail on startup with PRIME

I have a laptop with a Ryzen 7 5800H and NVIDIA RTX 3060, and while everything works perfectly fine with the integrated GPU, nothing seems to work on the NVIDIA discrete GPU. Both OpenGL and Vulkan games run with "prime-run", as well as Steam games run through Proton (DXVK), either crash immediately or exit with some sort of error. One game (Railbound) immediately exited with the error "Screen: DX11 could not switch resolution (2560x1440 fs=1 hz=0)". I also happen to be developing my own game engine using Vulkan, and it exits with the error "VK_ERROR_OUT_OF_DEVICE_MEMORY" upon attempting to create a swapchain.

"prime-run glxinfo" exits with this:

$ prime-run glxinfo
name of display: :0
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  0
  Current serial number in output stream:  31

"prime-run glxgears" immediately exits with the same "BadAlloc (insufficient resources for operation)" error as well.

I think this started happening ever since I reinstalled Linux, so I may have screwed up some sort of configuration. I've tried everything (as far as I can tell) on the wiki though, and I'm not sure what I'm doing wrong... What am I doing wrong?

Kernel is 6.1.63-1-lts with the nvidia-lts driver, and yes, I:

  • installed nvidia-utils

  • removed kms from HOOKS

  • made sure all the kernel modules are loaded (nvidia_drm, nvidia_modeset, nvidia_uvm, nvidia)

  • set "nvidia-drm.modesetting=1" in the kernel parameters

  • even tried the non-LTS kernel and NVIDIA driver

and it still happens.

Last edited by daigennki (2023-11-21 15:11:28)

Offline

#2 2023-11-21 11:22:33

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 22,863

Re: [SOLVED] OpenGL and Vulkan games fail on startup with PRIME

Are you using xf86-video-amdgpu and/or nvidia-open? Trade the first for modesetting (just remove it) and the latter for nvidia (nvidia-open is still alpha quality for consumer GPUs)

Also make sure you don't have custom xorg confs setup that would adjust what the xorg server would load.

Last edited by V1del (2023-11-21 11:23:29)

Offline

#3 2023-11-21 11:42:23

daigennki
Member
Registered: 2020-10-23
Posts: 33

Re: [SOLVED] OpenGL and Vulkan games fail on startup with PRIME

I'm using xf86-video-amdgpu for the integrated GPU, but I'm not using nvidia-open at all. I removed the xf86-video-amdgpu package and now I just get a black screen when I start up the machine, although I'm able to Ctrl+Alt+F2 into a TTY just fine.

Offline

#4 2023-11-21 12:06:41

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,801

Re: [SOLVED] OpenGL and Vulkan games fail on startup with PRIME

Add amdgpu to the start of the modules= line to ensure the amd integrated card starts initialising before the nvidia card.

Post full journal output from current boot (ran with root rights), also xorg log.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2023-11-21 12:33:02

daigennki
Member
Registered: 2020-10-23
Posts: 33

Re: [SOLVED] OpenGL and Vulkan games fail on startup with PRIME

My apologies, I forgot I had a config file in /etc/X11/xorg.conf.d/ to enable variable refresh rate for amdgpu. I commented out everything in that file and now I'm able to log into the desktop.

Games trying to use the NVIDIA GPU work now, but doesn't not using xf86-video-amdgpu mean that hardware acceleration will be unavailable for certain things? VRR is now unavailable because of it too, no?

Offline

#6 2023-11-21 13:56:25

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 22,863

Re: [SOLVED] OpenGL and Vulkan games fail on startup with PRIME

modesetting supports VRR as well: https://man.archlinux.org/man/modesetting.4#Option~7  PRIME in general is much better tested with the modesetting driver. The majority of other stuff is still going to work properly, i.e. this has no direct bearing on OpenGL/Vulkan or video HW acceleration in browsers.

Most of the HW specific xorg ddx drivers are basically unmaintained at this point.

Last edited by V1del (2023-11-21 13:57:37)

Offline

#7 2023-11-21 14:39:07

daigennki
Member
Registered: 2020-10-23
Posts: 33

Re: [SOLVED] OpenGL and Vulkan games fail on startup with PRIME

I see. I didn't know that VRR works with modesetting too, because the wiki page doesn't mention anything about it.

That being said, I'm still having the same issues with games. They worked for a moment, so suspecting that the config file I put in might have something to do with it, I commented it out and what do you know, the games work now. Weird.

Here's the "20-modesetting.conf" file that I put in /etc/X11/xorg.conf.d/. No other files are in xorg.conf.d.

Section "Device"
	Identifier "KMS"
	Driver "modesetting"
	Option "VariableRefresh" "true"
EndSection

The "VariableRefresh" line being there doesn't seem to matter; the issues occur as long as there's a Device section with the identifier and driver. It works fine if everything is commented out, except for the fact that VRR isn't enabled. Did I write something incorrectly?

Offline

#8 2023-11-21 14:54:11

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 22,863

Re: [SOLVED] OpenGL and Vulkan games fail on startup with PRIME

Yes, a "Device" section will lead to xorg ignoring the nvidia card and thus the nvidia card not knowing it should providing offloading to a running xorg server.

The correct minimal way to do that is

Section "OutputClass"
	Identifier "KMS"
	Driver "modesetting"
        #Will load this section for devices handled by the kernel driver "amdgpu"
        MatchDriver "amdgpu"
	Option "VariableRefresh" "true"
EndSection

I'm assuming this was likely the same underlying problem on the amdgpu DDX

Offline

#9 2023-11-21 15:07:44

daigennki
Member
Registered: 2020-10-23
Posts: 33

Re: [SOLVED] OpenGL and Vulkan games fail on startup with PRIME

Ah, whoops. That fixed the problem alright. Thank you!

Offline

Board footer

Powered by FluxBB