I cant Change my integrated gpu to optimus/dedicated (Wayland)

I’m using fedora 40 (Wayland)

previously I was using x11 and my GPU driver was fine, but after moving to wayland, my GPU driver really didn’t work.

when I checked using “glxinfo | egrep ‘OpenGL vendor|OpenGL renderer’ it turns out I’m using an integrated gpu, I’ve looked for many ways but haven’t managed to replace it.
image

I already install nvidia driver + cuda

On another recent thread I read about creating or modifying a file that should solve this problem.

In that thread (I don’t have the link) they mentioned creating or modifying the file /etc/environment with this content.

QT_QPA_PLATFORMTHEME="wayland;xcb"
GBM_BACKEND=nvidia-drm
__GLX_VENDOR_LIBRARY_NAME=nvidia
ENABLE_VKBASALT=1
LIBVA_DRIVER_NAME=nvidia
WLR_NO_HARDWARE_CURSORS=1

I just tested that on my laptop with intel + nvidia and I got this in wayland

$ glxinfo | egrep "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1660 Ti/PCIe/SSE2


$ inxi -Gxx
Graphics:
  Device-1: Intel CoffeeLake-H GT2 [UHD Graphics 630] vendor: ASUSTeK
    driver: i915 v: kernel arch: Gen-9.5 ports: active: eDP-1 empty: none
    bus-ID: 00:02.0 chip-ID: 8086:3e9b
  Device-2: NVIDIA TU116M [GeForce GTX 1660 Ti Mobile] vendor: ASUSTeK
    driver: nvidia v: 550.78 arch: Turing pcie: speed: 2.5 GT/s lanes: 8 ports:
    active: none off: HDMI-A-1 empty: DP-1 bus-ID: 01:00.0 chip-ID: 10de:2191
  Display: wayland server: X.org v: 1.20.14 with: Xwayland v: 24.1.0
    compositor: gnome-shell v: 46.2 driver: X: loaded: modesetting,nvidia
    unloaded: fbdev,nouveau,vesa alternate: nv dri: iris
    gpu: i915,nvidia,nvidia-nvswitch display-ID: 0
  Monitor-1: HDMI-A-1 model: Acer G277HL res: 1920x1080 dpi: 82
    diag: 686mm (27")
  Monitor-2: eDP-1 model: AU Optronics 0x409d res: 1920x1080 dpi: 128
    diag: 438mm (17.3")
  API: OpenGL v: 4.6.0 vendor: nvidia v: 550.78 glx-v: 1.4
    direct-render: yes renderer: NVIDIA GeForce GTX 1660 Ti/PCIe/SSE2
    display-ID: :0.0
  API: EGL Message: EGL data requires eglinfo. Check --recommends.


$ nvidia-smi
Sat Jun  1 11:12:41 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.78                 Driver Version: 550.78         CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1660 Ti     Off |   00000000:01:00.0  On |                  N/A |
| N/A   48C    P8              9W /   80W |      52MiB /   6144MiB |      7%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A      2608      G   /usr/bin/gnome-shell                           41MiB |
+-----------------------------------------------------------------------------------------+

Hope this helps.

Thanks, at least my gpu now can work and detect a running process