Switch graphics card used by X11

I have an integrated graphics card (Intel) and a discrete card (Nvidia). When booting, the nvidia card is automatically selected by X. I want X to use the intel card and want to reserve the nvidia card for computational tasks.

I have tried to change the 90-nvidia.conf in /etc/X11/xorg.conf.d to use the intel card instead. However, the directory seems to be recreated on boot on automatically falls back to the previous setting.

Section "ServerLayout"
    Identifier "layout"
    Screen "nvidia"
    Inactive "intel"
    Inactive "modesetting"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

Section "Device"
    Identifier "intel"
    Driver "intel"
EndSection

Section "Screen"
    Identifier "modesetting"
    Device "modesetting"
EndSection

Section "Device"
    Identifier "modesetting"
    Driver "modesetting"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
    Option "DPI" "96 x 96"
    Option "AllowEmptyInitialConfiguration"
    Option "AllowExternalGpus"
EndSection
inxi -Gxz
Graphics:
  Device-1: Intel AlderLake-S GT1 vendor: Dell driver: i915 v: kernel
    bus-ID: 00:02.0
  Device-2: NVIDIA GA104 [GeForce RTX 3070 Lite Hash Rate] vendor: Dell
    driver: nvidia v: 545.29.06 arch: Ampere bus-ID: 01:00.0
  Device-3: Microdia Webcam Vitade AF driver: snd-usb-audio,uvcvideo
    type: USB bus-ID: 1-10:3
  Display: x11 server: X.Org v: 21.1.11 with: Xwayland v: 23.2.4 driver: X:
    loaded: modesetting,nvidia dri: iris gpu: i915 resolution: 1: 1920x1200~60Hz
    2: 1200x1920~60Hz
  API: EGL v: 1.5 drivers: iris,nvidia,swrast platforms:
    active: gbm,x11,surfaceless,device inactive: wayland,device-2
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 545.29.06
    glx-v: 1.4 direct-render: yes renderer: NVIDIA GeForce RTX 3070/PCIe/SSE2
  API: Vulkan v: 1.3.275 drivers: N/A surfaces: xcb,xlib devices: 2

1 Like

@sboehringer Hi, get rid of any xorg.conf file it’s not needed, make sure suse-prime (this is the likely culprit of the re-creating) and bbswitch stuff is removed and locked. Make sure nvidia_drm.modeset=1 or maybe nosimplefb=0 is in your grub options (test at boot by adding to grub options first).

Install switcheroo-control package and run systemctl enable --now switcheroo-control.service then (you don’t say which DE in use) you can use switcherooctl <some app>to use the Nvidia gpu. The likes of Libreoffice will use automatically as compute, which can be visible via the likes of nvidia-smi or nvtop.

For example;

switcherooctl list
Device: 0
  Name:        Intel Corporation DG2 [Arc A380]
  Default:     yes
  Environment: DRI_PRIME=pci-0000_03_00_0

Device: 1
  Name:        Intel® HD Graphics P4000
  Default:     no
  Environment: DRI_PRIME=pci-0000_00_02_0

Device: 2
  Name:        NVIDIA Corporation GM107GL [Quadro K620]
  Default:     no
  Environment: __GLX_VENDOR_LIBRARY_NAME=nvidia __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only

switcherooctl launch -g 2 glxinfo | grep "OpenGL render"
OpenGL renderer string: Quadro K620/PCIe/SSE2

switcherooctl launch -g 1 glxinfo | grep "OpenGL render"
OpenGL renderer string: Mesa Intel(R) HD Graphics P4000 (IVB GT2)

switcherooctl launch -g 0 glxinfo | grep "OpenGL render"
OpenGL renderer string: Mesa Intel(R) Arc(tm) A380 Graphics (DG2)

The is no xorg conf present on the above, it is a desktop though.

2 Likes

hi , how can i tell Device 1 To be used for desktop

elias@weedbox:~> switcherooctl list
Device: 0
  Name:        NVIDIA Corporation AD102 [GeForce RTX 4090]
  Default:     yes
  Environment: __GLX_VENDOR_LIBRARY_NAME=nvidia __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only

Device: 1
  Name:        Intel Corporation Raptor Lake-S GT1 [UHD Graphics 770]
  Default:     no
  Environment: DRI_PRIME=pci-0000_00_02_0

as Nvidia seems to be the primary device .
thanks

@OupsBeserk A BIOS setting perhaps? Generally it’s better to start a new thread :wink:

ok thanks , msi has a weird bios , would take a better look , thanks for the advice .

Thank you, this solved my problem. I now actually use suse-prime to switch the graphics cards. At the moment, I do not get desktop effects on the intel card, but that is forgivable. I have already issued prime-select intel2 as an alternative to prime-select intel and will wait for the next logout/login cycle to see whether desktop effects return.

BTW the naming is really bad and should better indicate what the tool is doing. I did search for packages around x11/graphics/intel/nvidia with zypper but suse-prime did not turn up.

Maybe you give prime-select a try (package is suse-prime).

prime-select intel or
prime-select intel2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.