[Mesa-dev] Mesa Querying Devices Filter

Emil Velikov emil.l.velikov at gmail.com
Sat Nov 13 00:21:04 UTC 2021


Hi Stephen,

I don't have any time to spend on Mesa these days, so a bit of a late answer.

On Wed, 27 Oct 2021 at 08:46, Stephen Crowell
<stephen.crowell at kitware.com> wrote:
>
> To whom it may concern,
>
> I am attempting to use Mesa with EGL for a project and I have run into an issue when initializing a device. My setup uses a surfaceless platform with swrast as the gallium driver.
>
> When I query for devices to initialize (using eglQueryDevices), the first device listed is the driver for my GPU (nouveau) and the other devices are the devices I want to initialize (swrast, swr, etc). My project currently loops through all possible devices and initializes each one. Once one is initialized properly, the program continues.
>
Note that you cannot distinguish between classic swrast, gallium
swrast (with either of softpipe, llvmpipe and swr) at the EGL device
level. You can switch between the gallium swrast drivers via -
GALLIUM_DRIVER=swr.

> I was wondering if there is a way to filter out devices (like drivers for GPU). This would make the output of my program more readable and also save time by not initializing devices that will not work.
>
With EGL devices there's the concept of device extensions - the
software one will have "EGL_MESA_device_software",  DRM ones have
"EGL_EXT_device_drm" - you get the idea.

> Also as a side note, why does Mesa query for my GPU drivers in the first place? The only driver I specify to use is swrast and I am not sure why my GPU driver is being found.
>
That's how the spec was designed - gives you up-to the requested
amount of EGL devices. Traditionally only GPU-backed ones, with the
extension mentioned above - you can get software one as well.

One important note: do _not_ use LIBGL_ALWAYS_SOFTWARE=1 when trying
to use EGL devices. It may or may not work and is not something we
want to support if we can avoid it.

HTH
-Emil


More information about the mesa-dev mailing list