[Mesa-dev] [PATCH 8/8] egldevice: implement eglQueryDisplayAttribEXT

Emil Velikov emil.l.velikov at gmail.com
Thu Jul 21 14:11:58 UTC 2016


On 21 July 2016 at 14:57, Adam Jackson <ajax at redhat.com> wrote:
> On Fri, 2015-07-24 at 16:20 +0200, Jonny Lamb wrote:
>> This adds a new vfunc to _EGLDriver, QueryDeviceName, which should
>> return a const string of the device name (usually in the format
>> '/dev/dri/cardN').
>>
>> The EGLDevice could perhaps be cached in the EGLDisplay but there
>> usually aren't loads of devices and this lookup isn't particularly
>> costly so leave it as is for now.
>>
>> Right now this only works with the egl_dri2 driver.
>
> Ancient thread I know, but this doesn't work, at least in my wayland
> session.
>
>>  static EGLBoolean
>> +_eglQueryDeviceFromDisplay(_EGLDeviceInfo *info,
>> +                           _EGLDriver *drv,
>> +                           _EGLDisplay *disp,
>> +                           EGLAttrib *value)
>> +{
>> +#ifdef HAVE_LIBUDEV
>> +   const char *device_name = NULL;
>> +   _EGLDevice *dev;
>> +   UDEV_SYMBOL(const char *, udev_device_get_property_value,
>> +               (struct udev_device *, const char *));
>> +
>> +   if (dlsym_failed)
>> +      return EGL_FALSE;
>> +
>> +   if (!drv->QueryDeviceName)
>> +      return EGL_FALSE;
>> +
>> +   device_name = drv->QueryDeviceName(disp);
>
> This is /dev/dri/renderD128...
>
>> +   mtx_lock(_eglGlobal.Mutex);
>> +
>> +   assert(info->got_devices);
>> +
>> +   for (dev = info->devices; dev; dev = dev->Next) {
>> +      const char *devname = udev_device_get_property_value(
>> +         dev->Info, "DEVNAME");
>
> And this is /dev/dri/card0, so querying the display will always fail.
>
> Obviously I can paper over this when there's only one device in the
> list, but the whole reason I want this is to make multi-GPU work
> better. Any ideas on a better approach here?
>
I'd suggest opting for the drmDevice libdrm API. It can provide a list
of devices with all the nodes and other misc info. Thus we could use
the render/card/other node as any point as needed.

-Emil


More information about the mesa-dev mailing list