[RESPONDED] DRI_PRIME not correctly using the dGPU in some games

Did you also try DRI_PRIME=1! ? (note the exclamation mark after the device number!) According to the docs that should force the use of a certain device.
DXVK might check for some capability which is provided by the virtual llvmpipe “gpu” but not the dGPU driver.
In the end, it might also be a completely different problem though.

1 Like

If I’m not mistaken, Rise of the Tomb Raider has a native Linux version. Are you certain that you’re running the Windows version via Proton? Because DXVK_FILTER_DEVICE_NAME wouldn’t work for the native Linux version. Additionally, if you are indeed using the Proton version, wouldn’t the native Linux version work better?

This is correct. Some games will have their own preference. Some games also have their own config setup tool that sets the graphics from a GUI, Marvel’s Guardians of the Galaxy for example.

When in doubt, this is correct.

1 Like

This was the key! Thank you for being patient @John_Obscurant , I definitely missed the bang ! operator in the first post. This allows both Remnant II and Rise of the Tomb Raider to run correctly.

As a side note, does this verify that dxvk wasn’t prefering the dGPU at all, and instead the game was just trying to rely on the iGPU? Since the games didn’t run correctly without DRI_PRIME with the forcing flag, that makes it seem like it wasn’t attempting to leverage the dGPU at all. It also seems that because the forcing flag worked, it wasn’t swapping the primary/secondary GPU indexes either.

I do wonder if the Framework DRI_PRIME documentation should mention the forcing ! flag? I don’t understand why my setup would require anything special, as I didn’t deviate from the setup instructions at all.

Thanks for the help all!

2 Likes

I’m having issues getting minecraft to use the dgpu on ubuntu.

1 Like

A bug has been reported at https://bugs.mojang.com/browse/MCL-10738, so I’m not sure if this solution will work, but you can give it a try:

1.Create a file with the following content:

#! /bin/sh
DRI_PRIME=1 exec java "$@"
  1. Save it as something.sh
  2. Make it executable. There should be an option for this in the file properties.
  3. In the minecraft launcher settings there will be a path to java. Replace it with the path to something.sh that you created.
1 Like

I would need to test using ! before including it or at least see a screenshot of its placement. Was this done in Steam, game properties, command box?

Yup! The “Launch Options” box. The prefix is DRI_PRIME=1!, no spaces.

1 Like

Appreciate it.

Did some digging. Technically, ! does nothing. My best guess, DRI_PRIME=1 didn’t take the first time.

It does appear that ! passes along seamlessly, but it doesn’t actually have a function with DRI_PRIME.

In digging into this title, it appears this is what is needed:

sudo dnf install vulkan-tools -y && vulkaninfo | grep "GPU[0123]" -A 10

Looking at GPU1, AMD Radeon RX 7700S (RADV NAVI33)
So I would put this in.

DRI_PRIME=1 DXVK_FILTER_DEVICE_NAME="AMD Radeon RX 7700S (RADV NAVI33)" %command%

This should be what gets us going with this title.

One of the things I am doing today is testing with this title, so I will grab a copy and do a quick launch test and verify the parameters works. If successfully, I will update the docs to reflect that same games may need the parameters above.

3 Likes

The documentation states the following: In the case of Vulkan it is possible to connect !, in this case only the selected GPU will be made available to the application (e.g.: DRI_PRIME=1!).

DXVK_FILTER_DEVICE_NAME only works on games run via proton. So it doesn’t work for native Linux versions of games. DRI_PRIME=1! should theoretically work for any Vulkan game.

2 Likes

I think this is in line with my experience. The bang ! operator definitely seems to be doing something, as I just tried both Shadow of the Tomb Raider and Remnant II with and without it. Without the operator, it only leverages the iGPU. With it, it correctly leverages the dGPU in both games.

Additionally, this explains why the DXVK_FILTER_DEVICE_NAME works for a game that runs using Proton (Remnant II), but didn’t work for a native game (Shadow of the Tomb Raider).

Fair, fair. Wild, I cannot figure out what bang would be doing. But, if something is working, it’s working. I cannot disagree with that.

Truth - with the prevalence of Windows games pushing proton, I forget about native games - and I do have a few! Yeah, DRI_PRIME=1 %command% would be what I would use.

@Mario_Limonciello I need a sanity check.

Can you think of any universe where DRI_PRIME=1! (bang) would be used? DRI_PRIME=1 (sans the bang) I understand.

To my best knowledge and my own extensive digging, I cannot finding anywhere where a bang would be used for DRI_PRIME. I’d appreciate your insights. :pray:

If the game is doing it’s own detection and does it wrong maybe?

2 Likes

The docs say that for Vulkan applications, DRI_PRIME=n simply moves device n up to be the first device in the list, while DRI_PRIME=n! hides all other devices and thus forces to use device n.

A Vulkan application usually selects a device by certain capabilities, how exactly the selection process works is up to the programmer. There might e.g. be something about the advertised memory types or color formats or … that the applications prefers about the iGPU (or maybe even llvmpipe). For dxvk, someone might actually look up the responsible code in their github repo. I did try, but the code was far too complex for me …

3 Likes

Matt, if you do a simple text search on the docs available at the link that John Obscurant posted above for an “!” exclamation point (no quotes) you’ll find what you’re looking for. It’s easy to miss.
Apparently, specifying the PRIME=1 just puts that card first in a list that is supplied to the .exe. The exe is still free to pick LLVM_PIPE and run at 1 FPS if it feels like it. Or there’s another bug at play.
By the way, if you’re running a game at, like, 1 FPS, you’re probably on the LLVM_PIPE software emulation. The iGPU is no slouch; it can run a modern game at ~medium settings and medium frame rates.
ETA: The “!” forces the list supplied to the exe to contain only the card you specify. So, no list.
EETA: Just realized I repeated half of what John said in the last post. Imma gonna go take the dog for a walk and get some air.

3 Likes

Yeah, this was my thought as well, but when I force the usage of the iGPU only with DRI_PRIME=0! (after verifying GPU0 is the iGPU), Remnant II still runs with 1FPS. I think this is something specific to this game, as it seems poorly optimized in general. I’m not too worried about it, but would be curious if anyone has further explanation on this.

Hat tip @John_Obscurant. Was able to locate a clear, defined definition here. Same link, but included the page link this time.

TIL. :slight_smile: I’ll add the link into the docs as a FYI for those interested or needing it.

4 Likes

Hey gang, I’m still having trouble here. I just got my FW 16 from batch 4, and it looks like NVTOP reports the iGPU is working at 100% while the dGPU reports minimal usage when I play games with DRI_PRIME=1 or DRI_PRIME=1!.

My screen shot is taken after I closed a Steam game called Crab Champions, which showed the iGPU at 100% while the dGPU was low. The process names both Graphic and Compute on the GPU in position 0, but it should be 1. This is the command line I’m running from Steam for this game: DRI_PRIME=1! DXVK_FILTER_DEVICE_NAME="AMD Radeon RX 7700S (RADV NAVI33)" mangohud %command%

Additional info would be here:

            -```````````                   bhibb@bframework
          `-+/------------.`               ----------------
       .---:mNo---------------.            OS: Solus resilience 4.5 x86_64
     .-----yMMMy:---------------.          Host: Laptop 16 (AMD Ryzen 7040 Series) (AJ)
   `------oMMMMMm/----------------`        Kernel: 6.6.21-280.current
  .------/MMMMMMMN+----------------.       Uptime: 4 hours, 55 mins
 .------/NMMMMMMMMm-+/--------------.      Packages: 1341 (eopkg), 47 (flatpak)
`------/NMMMMMMMMMN-:mh/-------------`     Shell: fish 3.7.0
.-----/NMMMMMMMMMMM:-+MMd//oso/:-----.     Display (eDP-2): 2560x1600 @ 60Hz
-----/NMMMMMMMMMMMM+--mMMMh::smMmyo:--     DE: KDE Plasma 5.27.10
----+NMMMMMMMMMMMMMo--yMMMMNo-:yMMMMd/.    WM: KWin (Wayland)
.--oMMMMMMMMMMMMMMMy--yMMMMMMh:-yMMMy-`    WM Theme: Breeze
`-sMMMMMMMMMMMMMMMMh--dMMMMMMMd:/Ny+y.     Theme: Breeze (SolusDark) [QT], Breeze [GTK2/3]
`-/+osyhhdmmNNMMMMMm-/MMMMMMMmh+/ohm+      Icons: breeze-dark [QT], breeze-dark [GTK2/3/4]
  .------------:://+-/++++++oshddys:       Font: Noto Sans (10pt) [QT], Noto Sans (10pt) [GTK2/3/4]
   -hhhhyyyyyyyyyyyhhhhddddhysssso-        Cursor: breeze (24px)
    `:ossssssyysssssssssssssssso:`         Terminal: konsole 23.8.5
      `:+ssssssssssssssssssss+-            Terminal Font: Hack (12pt)
         `-/+ssssssssssso+/-`              CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics (16) @ 6.23 GHz
              `.-----..`                   GPU 1: AMD Radeon RX 7700S
                                           GPU 2: AMD Phoenix1
                                           Memory: 8.88 GiB / 27.11 GiB (33%)
                                           Swap: 9.00 MiB / 41.61 GiB (0%)
                                           Disk (/): 954.03 GiB / 1.76 TiB (53%) - ext4
                                           Local IP (wlp4s0): 192.168.68.65/22 *
                                           Battery: 60% [Charging]
                                           Locale: en_US.UTF-8

Any help would be appreciated.

First of all @Bryson , love the terminal background.

Could you paste the output of the following command?
vulkaninfo | grep "GPU[0123]" -A 10
Remember, these lists are 0 based, so if it lists the DGPU 7700S first in the list with index 0, you may want to try DRI_PRIME=0! instead.

I think you may have already tried this, but wanted to double check.