Skip to content

Extend DRI_PRIME / MESA_VK_DEVICE_SELECT

Pierre-Eric Pelloux-Prayer requested to merge pepp/mesa:dri_prime_extend into main

Multiple changes:

  • add support for DRI_PRIME_DEBUG for GL
$ DRI_PRIME_DEBUG=1 DRI_PRIME=1 glxgears 
DRI_PRIME: 2 devices
  0: pci-0000_05_00_0 1002:15dd /dev/dri/renderD129 [default]
  1: pci-0000_03_00_0 1002:73ff /dev/dri/renderD128
DRI_PRIME: device 0 skipped (default device)
DRI_PRIME: device 1  -> selected (/dev/dri/renderD128)
  • extend DRI_PRIME from =1 to =N. Useful when more than 2 GPUs are available.
  • add a shortcut for MESA_VK_DEVICE_SELECT_FORCE_DEFAULT_DEVICE: appending "!" to DRI_PRIME or MESA_VK_DEVICE_SELECT will have the same effect as using MESA_VK_DEVICE_SELECT_FORCE_DEFAULT_DEVICE=1: only 1 GPU will be exposed to the app.

eg with vkcube which always pick a dGPU if available:

$ DRI_PRIME=1002:15dd vkcube
Selected GPU 1: AMD Radeon RX 6600S (RADV NAVI23), type: 2
^C⏎
$ DRI_PRIME=1002:15dd! vkcube
Selected GPU 0: AMD Radeon Vega 10 Graphics (RADV RAVEN), type: 1

Merge request reports