Help needed: State of graphics stack on linux for Gaming (OPTIMUS laptop)

vort3@lemmy.ml to Linux@lemmy.ml – 33 points –

This probably was asked countless times already, but given the amount of possible combinations of all the hardware and software, this is probably not surprising.

So, I do have some experience with linux. I ssh into my ubuntu server a lot, I do many bash/terminal tricks, so can't really call myself a newbie in Linux. However, for gaming I would use Windows for as long as I remember myself. With the release of KDE Plasma 6 and Vulkan support getting better, I was thinking about giving it a go, but I'm stuck.

When launching a game that natively supports linux (Dota 2) from Steam, pretty much nothing happens. I see in terminal that there are some errors, but archwiki states that this is normal:

Wrong ELF class

If you see this message in Steam's console output

ERROR: ld.so: object '~/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.

you can safely ignore it. It is not really any error: Steam includes both 64- and 32-bit versions of some libraries and only one version will load successfully. This "error" is displayed even when Steam (and the in-game overlay) is working perfectly.

Other than that I see no errors or anything.

I'm running Arch linux with KDE Plasma 6.0.1, with default Wayland session. My laptop is an Acer Nitro 5 with NVIDIA GPU and I guess also Intel integrated video card. Here are the details:

::: spoiler spoiler

Operating System: Arch Linux 
KDE Plasma Version: 6.0.1
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.7.9-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × 12th Gen Intel® Core™ i5-12500H
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Manufacturer: Acer
Product Name: Nitro AN515-58
System Version: V1.13

:::

I have no idea honestly about which driver I have installed, but I did install nvidia package. I'm not sure if it's being used. I also don't know anything about Mesa. Also, this is from my Info Center:

::: spoiler spoiler

KWin Support Information:
The following information should be used when requesting support on e.g. https://discuss.kde.org.
It provides information about the currently running instance, which options are used,
what OpenGL driver and which effects are running.
Please post the information provided underneath this introductory text to a paste bin service
like https://paste.kde.org instead of pasting into support threads.

==========================

Version
=======
KWin version: 6.0.1
Qt Version: 6.6.2
Qt compile version: 6.6.2
XCB compile version: 1.16.1

Operation Mode: Xwayland

Build Options
=============
KWIN_BUILD_DECORATIONS: yes
KWIN_BUILD_TABBOX: yes
KWIN_BUILD_ACTIVITIES: yes
HAVE_X11_XCB: yes
HAVE_GLX: yes

X11
===
Vendor: The X.Org Foundation
Vendor Release: 12302004
Protocol Version/Revision: 11/0
SHAPE: yes; Version: 0x11
RANDR: yes; Version: 0x14
DAMAGE: yes; Version: 0x11
Composite: yes; Version: 0x4
RENDER: yes; Version: 0xb
XFIXES: yes; Version: 0x50
SYNC: yes; Version: 0x31
GLX: yes; Version: 0x0

Decoration
==========
Plugin: org.kde.breeze
Theme: 
Plugin recommends border size: None
onAllDesktopsAvailable: true
alphaChannelSupported: true
closeOnDoubleClickOnMenu: false
decorationButtonsLeft: 0, 9, 2, 6
decorationButtonsRight: 1, 3, 4, 5
borderSize: 0
gridUnit: 10
font: Noto Sans,10,-1,0,400,0,0,0,0,0,0,0,0,0,0,1
smallSpacing: 2
largeSpacing: 10

Output backend
==============
Name: DRM
Atomic Mode Setting on GPU 0: true

:::

I don't even know what is Xwayland and why I have it installed, probably some dependency of KDE.

At this point I'm not even sure what I'm using (is it pure wayland, or x11, or some hybrid of using both), if I have correct GPU drivers (do I have correct drivers for just one of the two video cards, for both, or none at all), if my NVIDIA GPU is even working, if it's being used to run a game or not, and if I have all necessary packages to run Vulkan.

At this point, how do I troubleshoot all of this mess?

24

First, enable the multilib repo as per the other comment.

Then, to get Vulkan working properly on Optimus, install the following packages:

primus_vk vulkan-tools vulkan-icd-loader lib32-vulkan-icd-loader nvidia-utils lib32-nvidia-utils

After that, run vulkaninfo - if you see info about your graphics card, you will know that Vulkan is working correctly. vkcube is another app you can run to test Vulkan.

Also, according to ProtonDB, you'll need to set the following launch options in Steam for DotA 2:

gamemoderun %command% -novid -high -vconsole

When I run vulkaninfo or vkcube, first line of output is:

Can't open bumblebee display.

Is this normal?

Not too sure about that, have installed primus_vk and do you see the cube?

Yes I do see the cube, also I see GPU utilization go up in nvidia-settings. I uninstalled bumblebee and now I see no bumblebee error (obviously).

I don't even know what is Xwayland and why I have it installed, probably some dependency of KDE.

It's what allows you to run programs that don't have Wayland support.

Wayland + Nvidia proprietary drivers are not a good combo, you'll probably have less issues with x11.

if I have correct GPU drivers (do I have correct drivers for just one of the two video cards, for both, or none at all)

Trying running nvidia-settings. It will open if you've got proprietary drivers, and you can check the GPU utilisation to see if it's being used.

You might need to use a command like prime-run steam to force steam to use the Nvidia GPU.

Check the arch wiki, it'll help you out the most.

Ok, thanks.

prime-run steam doesn't solve the issue, unfortunately.

nvidia-settings exists, I can launch it, and it shows my GPU model. GPU utilization is at 0%, I guess this is normal, because I don't need GPU to run my DE and browser. I'll see if this number changes when I try to launch any of my games.

Do I need xwayland to run steam and my steam games, or does steam work with wayland natively? Is it possible that I'm having the issues with xwayland?

No clue, I don't use Wayland. Try running steam in x11, that'll tell you more.

Trying to use X11 made no difference, so I guess it's not a Wayland issue.

I think with the '32' in your error message, the issue is probably running old 32bit software on a modern 64bit system?

Have you enabled multilib?

There is a bit more info on that on the Steam page in the arch wiki.

I'm pretty sure it's not me using 32 bit software, but anyway, I do have multilib enabled.

I'll check out the link for Steam later, thanks.

Start with the basics, do you see your Nvidia GPU pop up when using vulkaninfo --summary?

If it doesn't pop up, verify that you have the correct vulkan ICD files in: $ ls /usr/share/vulkan/icd.d/

There you should have nvidia_icd.json, nvidia_layers.json. If that's missing, you're missing the nvidia-utils part of the driver.

If they are there, but it still don't show in your vulkaninfo sumary, you could try to load the nvidia driver manually; modprobe nvidia, also check the kernel logs journalctl -k or dmesg and search for nvidia to see whether the driver got loaded correctly?

Yes, I do see it listed as GPU0 (PHYSICAL_DEVICE_TYPE_DISCRETE_GPU type, NVIDIA GeForce RTX 3050 Ti Laptop GPU).

::: spoiler spoiler

Devices:
========
GPU0:
        apiVersion         = 1.3.277
        driverVersion      = 550.54.14.0
        vendorID           = 0x10de
        deviceID           = 0x25a0
        deviceType         = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
        deviceName         = NVIDIA GeForce RTX 3050 Ti Laptop GPU
        driverID           = DRIVER_ID_NVIDIA_PROPRIETARY
        driverName         = NVIDIA
        driverInfo         = 550.54.14
        conformanceVersion = 1.3.7.2
        deviceUUID         = 6264a345-da87-f0ca-ad1d-6f9b21211ff9
        driverUUID         = 456948bf-c303-5719-a9cb-4a29c09ec32b
GPU1:
        apiVersion         = 1.3.274
        driverVersion      = 24.0.2
        vendorID           = 0x8086
        deviceID           = 0x46a6
        deviceType         = PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU
        deviceName         = Intel(R) Graphics (ADL GT2)
        driverID           = DRIVER_ID_INTEL_OPEN_SOURCE_MESA
        driverName         = Intel open-source Mesa driver
        driverInfo         = Mesa 24.0.2-arch1.2
        conformanceVersion = 1.3.6.0
        deviceUUID         = 8680a646-0c00-0000-0002-000000000000
        driverUUID         = edc104ee-9b99-4c39-8f0a-df779ff80dd0
GPU2:
        apiVersion         = 1.3.274
        driverVersion      = 0.0.1
        vendorID           = 0x10005
        deviceID           = 0x0000
        deviceType         = PHYSICAL_DEVICE_TYPE_CPU
        deviceName         = llvmpipe (LLVM 17.0.6, 256 bits)
        driverID           = DRIVER_ID_MESA_LLVMPIPE
        driverName         = llvmpipe
        driverInfo         = Mesa 24.0.2-arch1.2 (LLVM 17.0.6)
        conformanceVersion = 1.3.1.1
        deviceUUID         = 6d657361-3234-2e30-2e32-2d6172636800
        driverUUID         = 6c6c766d-7069-7065-5555-494400000000

:::

Nice, then you should be able to run vkcube to verify whether your GPU is activated properly.

You can do several "iterations" here as well.

  1. Install Mangohud so you can visibly see if your GPU is activated correctly
  2. Run mangohud vkcube-wayland - Does it use your Nvidia GPU?
  3. Run mangohud vkcube - Does it use your Nvidia GPU?

If Step 2 nor 3 shows your Nvidia GPU you can try and force it with: mangohud vkcube-wayland --gpu_number 0

mangohud vkcube shows my GPU:

[2024-03-13 18:44:07.448] [MANGOHUD] [error] [overlay_params.cpp:1003] Failed to read presets file: '/home/vort3/.config/MangoHud/presets.conf'
Selected GPU 0: NVIDIA GeForce RTX 3050 Ti Laptop GPU, type: DiscreteGpu
Authorization required, but no authorization protocol specified

[2024-03-13 18:44:07.553] [MANGOHUD] [error] [nvctrl.cpp:56] XNVCtrl didn't find the correct display

mangohud vkcube-wayland throws this error:

[2024-03-13 18:44:32.996] [MANGOHUD] [error] [overlay_params.cpp:1003] Failed to read presets file: '/home/vort3/.config/MangoHud/presets.conf'
Selected GPU 0: NVIDIA GeForce RTX 3050 Ti Laptop GPU, type: DiscreteGpu
Segmentation fault (core dumped)

Anyway, games run on my laptop now after I changed my partition type to ext4.

NVIDIA proprietary driver doesn't play nice with Wayland. To check if the proprietary driver is loaded you can use lsmod | grep nvidia if there's output it means the driver is loaded. Since it's an OPTIMUS laptop things will run in general on your integrated board, e.g. glxinfo | grep vendor will show you MESA information instead of NVIDIA. Technically prime-run glxinfo | grep vendor should show NVIDIA, however I'm not entirely sure that works on Wayland.

Everything you said is correct. The problem with running games on my end wasn't Wayland or NVIDIA drivers, it was wrong partition type.

Try forcing it to use Proton (game properties in Steam).

I might try this as a last resort, but why would I use some emulation shenanigans for running something that is native to my platform? It would be easier to just reboot into windows and run dota 2 there instead.

I have read on more than one occasion that Wine is becoming the "Linux Gaming ABI." It's no longer just about Windows. With the huge variety presented by distros, Wine is simply a nice stable target that never moves.

This is an interesting thought, but I'll try to have it working natively first.

I think Dota doesn't run on proton, i had no problems running the native linux version with my laptop intel i7 + nvidia 1050ti, but it was on X11, u can probably choose that on login screen.

What i think you need from a fresh install (i don't remember exactly what i did at the time):

  • enable multilib
  • install nvidia package or nvidia-lts depending on which kernel you're using, or nvidia-dkms plus headers of your kernel
  • install nvidia-settings nvidia-utils lib32-nvidia-utils nvidia-prime (never used bumblebee i just use prime-run)
  • install steam or steam-native-runtime
  • install game on steam, change launch command to prime-run %command%

I have all of this (nvidia, steam, nvidia-settings nvidia-utils lib32-nvidia-utils nvidia-prime) and nothing works yet. I'm still trying to figure out what I can do.