My laptop is a normal, uninteresting machine with two standard, unmultiplexed GPUs and an ordinary Debian stretch installation. The secondary GPU (a Radeon) is usually powered down but I can activate and use it by (for example) DRI_PRIME=1 glxgears. Mesa's source file src/loader/loader.c manages it.

Is DRI_PRIME undocumented?

I wish to read the documentation but cannot find it. Oddly, it isn't here. Moreover, Google cannot locate it. If you know where the documentation is, would you tell?

Switching GPUs is a fairly important system function. One would think that the mechanism that does it would be thoroughly documented, but all I can find are a few oblique changelog entries and some online lore like this.


You won't need Debian to answer my question. Any Linux should do.

In case a reader who wishes to start to learn about GPU switching stumbles in here, he can try sudo cat /sys/kernel/debug/vgaswitcheroo/switch and then read html/newstyle/gpu/vga-switcheroo.html in the Linux kernel source. Also, man 8 lspci. It took me two hours to figure out that much, so I mention it here to save the reader time.

Meanwhile, where is the proper documentation of Mesa environment variables like DRI_PRIME, please?

  • 2
    See Here Commented Dec 3, 2018 at 1:23
  • @RubberStamp: Aha! Excellent. That is what I wanted. If you have time to make your comment an answer, then I would like to upvote it.
    – thb
    Commented Dec 4, 2018 at 2:02
  • 1
    That link isn't the full story. It appears to be possible to specify exactly which GPU you want to use via DRI_PRIME=pci-0000_00_02_0 or similar which isn't mentioned on the FDO wiki...
    – Sam Morris
    Commented Feb 22, 2022 at 12:43

1 Answer 1


I wrote up some notes at https://robots.org.uk/LinuxMultiGPUDeviceSelection - these are not complete but could be used as the basis for a more complete answer if someone wants to write one. :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .