PrismLauncher / PrismLauncher

A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once (Fork of MultiMC)
https://prismlauncher.org
GNU General Public License v3.0
5.86k stars 657 forks source link

Prism launcher can't utilize the dedicated GPU #1035

Open Sikeen opened 1 year ago

Sikeen commented 1 year ago

Operating System

Linux

Version of Prism Launcher

Prism Launcher 6.3

Version of Qt

Qt 5.15.9

Description of bug

Prism launcher does not utilize the discrete (AMD) GPU, instead using the integrated (AMD)GPU even when setting use discrete GPU. i have also:

Put my PC in discrete GPU only mode from my OEM's hardware utilization software, and continued to have the setting on through the other experiments

I have used the official arch Minecraft launcher, which did use the discrete GPU.

Also played with the exact same mods and settings on windows, which DID use the dedicated gpu

Launched the launcher from Lutris and setting Lutris to also only use the discrete GPU in the settings(this usually works).

Set Prism to use feral gamemode and all native libraries.

I've also checked Flatseal for a setting to use the GPU.

Edited the .sh script in /var/lib/flatpak/app/org.prismlauncher.PrismLauncher/current/active/export/bin/ to launch Prism with the default or none default GPU. using the command PrefersNonDefaultGPU=true and PrefersNonDefaultGPU=false

inxi:

System:
  Host: simon-m-zephyrusg14-ga402rkga402rk Kernel: 6.1.25-1-MANJARO
    arch: x86_64 bits: 64 Desktop: KDE Plasma v: 5.27.4 Distro: Manjaro Linux

Machine:
  Type: Laptop System: ASUSTeK product: ROG Zephyrus G14 GA402RK_GA402RK
    v: 1.0 serial: <superuser required>
  Mobo: ASUSTeK model: GA402RK v: 1.0 serial: <superuser required>
    UEFI: American Megatrends LLC. v: GA402RK.318 date: 03/09/2023

CPU:
  Info: 8-core model: AMD Ryzen 9 6900HS with Radeon Graphics bits: 64
    type: MT MCP cache: L2: 4 MiB
  Speed (MHz): avg: 3061 min/max: 1600/4934 cores: 1: 3300 2: 3300 3: 1391
    4: 3300 5: 3300 6: 3300 7: 3300 8: 3300 9: 3300 10: 3300 11: 1392 12: 3300
    13: 3300 14: 3300 15: 3300 16: 3300

Graphics:
  Device-1: AMD Navi 23 [Radeon RX 6650 XT / 6700S 6800S] driver: amdgpu
    v: kernel
  Device-2: AMD Rembrandt [Radeon 680M] driver: amdgpu v: kernel
  Device-3: Quanta USB2.0 HD UVC WebCam type: USB driver: uvcvideo
  Display: wayland server: X.org v: 1.21.1.8 with: Xwayland v: 23.1.1
    compositor: kwin_wayland driver: X: loaded: amdgpu
    unloaded: modesetting,radeon dri: radeonsi gpu: amdgpu,amdgpu
    resolution: 1707x1067
  API: OpenGL v: 4.6 Mesa 23.0.2 renderer: AMD Radeon RX 6800S (navi23 LLVM
    15.0.7 DRM 3.49 6.1.25-1-MANJARO)

Audio:
  Device-1: AMD Navi 21/23 HDMI/DP Audio driver: snd_hda_intel
  Device-2: AMD Rembrandt Radeon High Definition Audio driver: snd_hda_intel
  Device-3: AMD ACP/ACP3X/ACP6x Audio Coprocessor driver: snd_pci_acp6x
  Device-4: AMD Family 17h/19h HD Audio driver: snd_hda_intel
  API: ALSA v: k6.1.25-1-MANJARO status: kernel-api
  Server-1: PulseAudio v: 16.1 status: active

Drives:
  Local Storage: total: 1.86 TiB used: 157.06 GiB (8.2%)
  ID-1: /dev/nvme0n1 vendor: Toshiba model: N/A size: 1.86 TiB

Partition:
  ID-1: / size: 891.53 GiB used: 77.6 GiB (8.7%) fs: ext4 dev: /dev/nvme0n1p5
  ID-2: /boot/efi size: 256 MiB used: 67.8 MiB (26.5%) fs: vfat
    dev: /dev/nvme0n1p1
  ID-3: /home size: 93.13 GiB used: 79.4 GiB (85.2%) fs: ntfs
    dev: /dev/nvme0n1p6

Swap:
  Alert: No swap data was found.

Sensors:
  System Temperatures: cpu: 62.2 C mobo: N/A
  Fan Speeds (RPM): cpu: 2000
  GPU: device: amdgpu temp: 57.0 C fan: 0 device: amdgpu temp: 56.0 C

Info:
  Processes: 380 Uptime: 22m Memory: 30.59 GiB used: 6.41 GiB (20.9%)
  Shell: Zsh inxi: 3.3.26

Steps to reproduce

Steps to check whether or not Prism Launcher is using the dedicated GPU:

Suspected cause

Prism launcher not detecting the GPU

yeah that's pretty much all i could think of being the case, I've tried everything else

This issue is unique

Sikeen commented 1 year ago

I have also tested the following versions:

and still with no success

Jan200101 commented 1 year ago

PrefersNonDefaultGPU is not advised as its behavior is poorly implemented across the board.

Prism behaves the same as Lutris and sets the right environment variables https://github.com/PrismLauncher/PrismLauncher/blob/ce5bb29c442cee3654c5f4287a999d5d6593032f/launcher/minecraft/MinecraftInstance.cpp#L520-L524

I've tested this on Prism 6.3 on my Laptop with a discrete Nvidia RTX GPU, and it works without a problem.

Sikeen commented 1 year ago

PrefersNonDefaultGPU is not advised as its behavior is poorly implemented across the board.

i was aware, but as i was trying many different methods and options to try and solve this issue i did it anyway.

body20002 commented 1 year ago

I have the same issue, I use prism flatpak what's weird is when I set the global settings to use discrete GPU the game do not launch and crash and if I only changed the instance settings the game launches but not with discrete GPU

here are the logs https://pastebin.com/XjiKQN4i

cfazilleau commented 1 year ago

Same issue here

lichenaut commented 1 year ago

What worked for me when I had a similar issue was creating my own prime-run:

alias prime-run='__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia'

then:

prime-run /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=prismlauncher org.prismlauncher.PrismLauncher

EDIT: now I just 'prime-run prismlauncher'

ghost commented 1 year ago

Or you can add javaw.exe to (Windows > Setting > Gaming > Game Mode > Graphics) and set High performance preference to it

SpiderUnderUrBed commented 7 months ago

image

^ this worked for me

Lyapsus commented 6 months ago

There is simply no “use dedicated gpu” option

mm12 commented 6 months ago

Or you can add javaw.exe to (Windows > Setting > Gaming > Game Mode > Graphics) and set High performance preference to it

This is a band-aid solution that works. Adding to the AMD software does not seem to work.

[image] ^ this worked for me

There is no "performance" tab at all on my launcher - I am on Windows

binarydigitz01 commented 5 months ago

What worked for me when I had a similar issue was creating my own prime-run:

alias prime-run='__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia'

then:

prime-run /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=prismlauncher org.prismlauncher.PrismLauncher

EDIT: now I just 'prime-run prismlauncher'

I have the same Problem, and this worked for me.

S-h-i-n-r-a commented 1 month ago

PrefersNonDefaultGPU is not advised as its behavior is poorly implemented across the board.

Prism behaves the same as Lutris and sets the right environment variables

https://github.com/PrismLauncher/PrismLauncher/blob/ce5bb29c442cee3654c5f4287a999d5d6593032f/launcher/minecraft/MinecraftInstance.cpp#L520-L524

I've tested this on Prism 6.3 on my Laptop with a discrete Nvidia RTX GPU, and it works without a problem.

I notice you're setting the DRI_PRIME env var to 1, this in the case of my system is the integrated graphics with the dedicated GPU being 0, presumably this - in my case - is caused by switching from a CPU without integrated graphics to one that does have it. This may also be the case for OP.

A solution inf this is the case would be to:

image

(EDIT: looking at OP's inxi this is a me issue)

Trial97 commented 1 month ago

you can already set any env variables you want inside the Environment variables tab inside either instance settings( see photo) or the main settings image

So for your case just copy the env from the file and change the values in that setting tab. The Use dedicated GPU turn it off

S-h-i-n-r-a commented 1 month ago

After some testing neither DRI_PRIME=0 nor DRI_PRIME=1 ended up running the game with discrete graphics*, I disabled integrated graphics in the BIOS to resolve the issue.

*: F3 menu showed the integrated graphics in both cases

Jan200101 commented 1 month ago

I notice you're setting the DRI_PRIME env var to 1, this in the case of my system is the integrated graphics with the dedicated GPU being 0, presumably this - in my case - is caused by switching from a CPU without integrated graphics to one that does have it.

the issue is that Mesa is naive and DRI_PRIME=1 means nothing more than "use the second GPU" regardless of that GPU is actually discrete or not.

I'm currently working on changing the implementation to use switcheroo-control instead and expose a list of all available GPUs to choose from.

OwenD30 commented 2 weeks ago

I'm currently working on changing the implementation to use switcheroo-control instead and expose a list of all available GPUs to choose from.

Any progress on this?

Jan200101 commented 2 weeks ago

Any progress on this?

Currently waiting on my current GPU PR to get reviewed and merged

andrpetim commented 4 days ago

Alright, maybe im not on the theme and im windows user, but can i do something to enable Perfomance tab in setting? I just dont have it and i think minecraft using integrated Intel card, though i have Nvidia card I think so because Nvidium mod doesnt have any effect visually

Trial97 commented 4 days ago

@andrpetim the Performance Tab is useless on Windows. Please refer to https://github.com/PrismLauncher/PrismLauncher/issues/2832