<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/en-route-to-a-robust-gpu-device-selection-in-gl-lpz8mw8xf" -->

---
title: En route to a robust GPU device selection in GL | daily.dev
description: GPU device selection in OpenGL/EGL has historically been limited, with Mesa's DRI_PRIME environment variable serving as a workaround for dual-GPU systems. This...
canonical: https://daily.dev/posts/en-route-to-a-robust-gpu-device-selection-in-gl-lpz8mw8xf
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: En route to a robust GPU device selection in GL | daily.dev
og:description: GPU device selection in OpenGL/EGL has historically been limited, with Mesa's DRI_PRIME environment variable serving as a workaround for dual-GPU systems. This...
og:url: https://daily.dev/posts/en-route-to-a-robust-gpu-device-selection-in-gl-lpz8mw8xf
og:image: https://api.daily.dev/og/posts/lPZ8mW8xF.png
og:image:alt: En route to a robust GPU device selection in GL
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# En route to a robust GPU device selection in GL

**[Collabora Blog](https://daily.dev/sources/collabora)** · 5 min read · 0 upvotes · 0 comments

## Summary

GPU device selection in OpenGL/EGL has historically been limited, with Mesa's DRI_PRIME environment variable serving as a workaround for dual-GPU systems. This post covers the motivation and implementation of the Khronos EGLDevice extension family in Mesa, including EGL_EXT_device_base, EGL_EXT_device_drm, EGL_MESA_device_software, and EGL_EXT_platform_device. These extensions enable explicit GPU selection without requiring windowing system awareness, opening use cases like multi-GPU testing, headless rendering, and heterogeneous compute. Patches for Mesa and the Piglit testing suite were submitted, with Piglit patches merged and Mesa patches under review. Future work includes ratifying EGL_MESA_device_software through Khronos, resolving EGL_EXT_explicit_device spec questions, drafting GLX equivalents, and designing a user-friendly Waffle API for device selection.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.collabora.com/news-and-blog/blog/2018/08/21/en-route-to-a-robust-gpu-device-selection-in-gl>

## Questions this post answers

### How does DRI_PRIME work for selecting a GPU in Mesa on Linux?

DRI_PRIME is an environment variable in Mesa that, when set to 1 before launching an application, causes the GL stack to query the X server and use the secondary GPU on the system. For systems with more than two GPUs, it can be set to a device's ID_PATH_TAG value (as provided by udev) to select a specific device by path rather than just toggling to the 'other' GPU.

_Developers targeting multi-GPU Linux setups track Mesa driver developments like this on daily.dev._

### What EGL extensions enable explicit GPU device selection without a windowing system in Mesa?

EGL_EXT_device_base (comprising EGL_EXT_device_enumeration and EGL_EXT_device_query) defines the EGLDevice concept and enumeration. EGL_EXT_device_drm and EGL_MESA_device_software expose DRM and software devices respectively. EGL_EXT_platform_device allows creating a context without explicit windowing system awareness. EGL_EXT_explicit_device (proposed) adds simultaneous device and platform selection, covering headless and multi-GPU use cases.

_Graphics developers choosing between GPU selection approaches for EGL find the tradeoffs covered on daily.dev._

## Similar posts on daily.dev

- [Imagination Talks Up Their Open-Source Vulkan Driver, Volcanic Architecture Plans](https://daily.dev/posts/imagination-talks-up-their-open-source-vulkan-driver-volcanic-architecture-plans-4jp2nhfyg) · Phoronix · 0 upvotes · 0 comments
- [Valve/RADV Developers Look At More Per-Game Tuning/Optimizations For Mesa Drivers](https://daily.dev/posts/valve-radv-developers-look-at-more-per-game-tuning-optimizations-for-mesa-drivers-bjqqjmcia) · Phoronix · 0 upvotes · 0 comments

---

Tags: [#mesa](https://daily.dev/tags/mesa), [#opengl](https://daily.dev/tags/opengl)

[View this post on daily.dev](https://daily.dev/posts/en-route-to-a-robust-gpu-device-selection-in-gl-lpz8mw8xf)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"En route to a robust GPU device selection in GL","url":"https://daily.dev/posts/en-route-to-a-robust-gpu-device-selection-in-gl-lpz8mw8xf","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/en-route-to-a-robust-gpu-device-selection-in-gl-lpz8mw8xf"},"datePublished":"2026-08-11T08:56:18.211Z","dateModified":"2026-10-14T02:22:46.684Z","description":"GPU device selection in OpenGL/EGL has historically been limited, with Mesa's DRI_PRIME environment variable serving as a workaround for dual-GPU systems. This...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/55b5fb47f93693ceb87d4fe8aaa4a63b?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/55b5fb47f93693ceb87d4fe8aaa4a63b?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Collabora Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Collabora Blog","logo":"https://media.daily.dev/image/upload/s--ZGZ0FjqS--/f_auto,q_auto/v1786438306/logos/collabora?_a=BAMAMicg0","url":"https://daily.dev/sources/collabora"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/en-route-to-a-robust-gpu-device-selection-in-gl-lpz8mw8xf","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"mesa,opengl","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Collabora Blog","item":"https://daily.dev/sources/collabora"},{"@type":"ListItem","position":3,"name":"En route to a robust GPU device selection in GL"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/en-route-to-a-robust-gpu-device-selection-in-gl-lpz8mw8xf#faq","mainEntity":[{"@type":"Question","name":"How does DRI_PRIME work for selecting a GPU in Mesa on Linux?","acceptedAnswer":{"@type":"Answer","text":"DRI_PRIME is an environment variable in Mesa that, when set to 1 before launching an application, causes the GL stack to query the X server and use the secondary GPU on the system. For systems with more than two GPUs, it can be set to a device's ID_PATH_TAG value (as provided by udev) to select a specific device by path rather than just toggling to the 'other' GPU. Developers targeting multi-GPU Linux setups track Mesa driver developments like this on daily.dev."}},{"@type":"Question","name":"What EGL extensions enable explicit GPU device selection without a windowing system in Mesa?","acceptedAnswer":{"@type":"Answer","text":"EGL_EXT_device_base (comprising EGL_EXT_device_enumeration and EGL_EXT_device_query) defines the EGLDevice concept and enumeration. EGL_EXT_device_drm and EGL_MESA_device_software expose DRM and software devices respectively. EGL_EXT_platform_device allows creating a context without explicit windowing system awareness. EGL_EXT_explicit_device (proposed) adds simultaneous device and platform selection, covering headless and multi-GPU use cases. Graphics developers choosing between GPU selection approaches for EGL find the tradeoffs covered on daily.dev."}}]}
```

