Use dgpu for the browser


I would like to know how to tell a program to use the dgpu, e.g. this would be good for the browser because roll20 and foundryvtt drive the internal gpu to 100%.

Here is a link for roll20 via chromium, but I have not managed to insert “DRI_PRIME=1” so that it is always executed with the dgpu.

#!/usr/bin/env xdg-open

[Desktop Entry]
Exec=flatpak 'run' '--command=/app/bin/chromium' 'io.github.ungoogled_software.ungoogled_chromium' '--profile-directory=Default' '--app-id=cnhepppjoegbjkgoffpapimkbjglngbf'
  Kernel: 6.8.8-300.fc40.x86_64 arch: x86_64 bits: 64 compiler: gcc
    v: 2.41-34.fc40
  Desktop: GNOME v: 46.1 Distro: Fedora Linux 40.20240509.0 (Silverblue)
  Type: Laptop System: Framework product: Laptop 16 (AMD Ryzen 7040 Series)
    v: AG serial: <superuser required>
  Mobo: Framework model: FRANMZCP07 v: A7 serial: <superuser required>
    UEFI: INSYDE v: 03.03 date: 03/27/2024
  ID-1: BAT1 charge: 87.3 Wh (100.0%) condition: 87.3/85.1 Wh (102.5%)
    volts: 17.7 min: 15.5 model: NVT FRANDBA status: not charging
  Device-1: hid-18:7e:b9:67:f4:86-battery model: Tealk-Magic Trackpad 2
    charge: N/A status: discharging
  Info: 8-core model: AMD Ryzen 7 7840HS w/ Radeon 780M Graphics bits: 64
    type: MT MCP arch: Zen 4 rev: 1 cache: L1: 512 KiB L2: 8 MiB L3: 16 MiB
  Speed (MHz): avg: 715 high: 2750
    min/max: 400/5137:5293:5449:6080:5764:5924:5608 cores: 1: 400 2: 1298 3: 400
    4: 400 5: 1298 6: 400 7: 2750 8: 400 9: 400 10: 400 11: 400 12: 400
    13: 400 14: 400 15: 400 16: 1308 bogomips: 121373
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Device-1: AMD Navi 33 [Radeon RX 7700S/7600/7600S/7600M XT/PRO W7600]
    vendor: Framework driver: amdgpu v: kernel arch: RDNA-3 bus-ID: 03:00.0
  Device-2: AMD Phoenix1 vendor: Framework driver: amdgpu v: kernel
    arch: RDNA-3 bus-ID: c4:00.0 temp: 46.0 C
  Device-3: Logitech C920 PRO HD Webcam driver: snd-usb-audio,uvcvideo
    type: USB bus-ID: 5-
  Display: wayland server: X.Org v: 23.2.6 with: Xwayland v: 23.2.6
    compositor: gnome-shell driver: dri: radeonsi gpu: amdgpu resolution:
    1: 3440x1440~100Hz 2: 2048x1280~165Hz
  API: OpenGL v: 4.6 vendor: amd mesa v: 24.0.6 glx-v: 1.4
    direct-render: yes renderer: AMD Radeon Graphics (radeonsi gfx1103_r1 LLVM
    18.1.1 DRM 3.57 6.8.8-300.fc40.x86_64)
  API: EGL Message: EGL data requires eglinfo. Check --recommends.
  Device-1: AMD Navi 31 HDMI/DP Audio vendor: Framework driver: snd_hda_intel
    v: kernel bus-ID: 03:00.1
  Device-2: AMD Rembrandt Radeon High Definition Audio vendor: Framework
    driver: snd_hda_intel v: kernel bus-ID: c4:00.1
  Device-3: AMD ACP/ACP3X/ACP6x Audio Coprocessor vendor: Framework
    driver: snd_pci_ps v: kernel bus-ID: c4:00.5
  Device-4: AMD Family 17h/19h HD Audio vendor: Framework
    driver: snd_hda_intel v: kernel bus-ID: c4:00.6
  Device-5: Logitech C920 PRO HD Webcam driver: snd-usb-audio,uvcvideo
    type: USB bus-ID: 5-
  Device-6: Beyerdynamic FOX driver: hid-generic,snd-usb-audio,usbhid
    type: USB bus-ID: 5-
  API: ALSA v: k6.8.8-300.fc40.x86_64 status: kernel-api
  Server-1: PipeWire v: 1.0.5 status: active
  Device-1: MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter
    driver: mt7921e v: kernel bus-ID: 04:00.0
  IF: wlp4s0 state: up mac: <filter>
  Device-1: MediaTek Wireless_Device driver: btusb v: 0.8 type: USB
    bus-ID: 1-5:7
  Report: btmgmt ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 5.2
    lmp-v: 11
  Local Storage: total: 1.82 TiB used: 120.39 GiB (6.5%)
  ID-1: /dev/nvme0n1 vendor: Western Digital model: WD BLACK SN770 1TB
    size: 931.51 GiB temp: 40.9 C
  ID-2: /dev/sda vendor: Seagate model: UltraTouch SSD size: 931.51 GiB
    type: USB
  ID-1: /boot size: 973.4 MiB used: 148 MiB (15.2%) fs: ext4
    dev: /dev/nvme0n1p2
  ID-2: /boot/efi size: 598.8 MiB used: 12.4 MiB (2.1%) fs: vfat
    dev: /dev/nvme0n1p1
  ID-3: /var size: 929.91 GiB used: 72.8 GiB (7.8%) fs: btrfs dev: /dev/dm-0
    mapped: luks-91874fa2-dc37-4bd0-aee8-c4a03dee90d0
  ID-1: swap-1 type: zram size: 8 GiB used: 0 KiB (0.0%) dev: /dev/zram0
  System Temperatures: cpu: 52.0 C mobo: N/A
  Fan Speeds (rpm): N/A
  GPU: device: amdgpu temp: 41.0 C fan: 0 device: amdgpu temp: N/A
  Memory: total: 32 GiB note: est. available: 30.65 GiB used: 8.01 GiB (26.1%)
  Processes: 476 Uptime: 48m Init: systemd target: graphical (5)
  Packages: 69 Compilers: N/A Shell: Bash v: 5.2.26 inxi: 3.3.34

I use prime-run [command] to launch stuff onto my eGPU, which is just a handy wrapper around DRI_PRIME and some other env variables.

so you have create an alias?

No, it’s an nvidia tool. See section 2.2:

Have found a solution, adding --env=DRI_PRIME=1

Exec=flatpak 'run' '--env=DRI_PRIME=1' '--command=/app/bin/chromium' 'io.github.ungoogled_software.ungoogled_chromium' '--profile-directory=Default' '--app-id=lfdfkfapnccpcbhkddgibegcbhhbdekf'