[Mesa-dev] [PATCH 6/8] egldevice: implement eglQueryDeviceStringEXT

Jonny Lamb jonny.lamb at collabora.co.uk
Fri Jul 24 07:20:00 PDT 2015


EGL_EXT_platform_query only defines one value for <name> at the
moment, so just implement that.

Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
---
 src/egl/main/eglapi.c    |  9 ++++++++-
 src/egl/main/egldevice.c | 30 ++++++++++++++++++++++++++++++
 src/egl/main/egldevice.h |  4 ++++
 3 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 0b826d4..17ecd8a 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1839,7 +1839,14 @@ static const char * EGLAPIENTRY
 eglQueryDeviceStringEXT(EGLDeviceEXT device,
                         EGLint name)
 {
-   RETURN_EGL_SUCCESS(NULL, "eglQueryDeviceStringEXT");
+   _EGLDevice *dev;
+   const char *ret;
+
+   _EGL_CHECK_DEVICE(device, NULL, dev);
+
+   ret = _eglQueryDeviceStringEXT(dev, name);
+
+   RETURN_EGL_SUCCESS(NULL, ret);
 }
 
 static EGLBoolean EGLAPIENTRY
diff --git a/src/egl/main/egldevice.c b/src/egl/main/egldevice.c
index 5fb3a1a..cf83847 100644
--- a/src/egl/main/egldevice.c
+++ b/src/egl/main/egldevice.c
@@ -46,6 +46,8 @@ typedef struct {
    _EGLDevice *devices;
    EGLBoolean got_devices;
 
+   const char *extensions;
+
 #ifdef HAVE_LIBUDEV
    struct udev *udev;
 #endif
@@ -71,6 +73,10 @@ _eglEnsureDeviceInfo(EGLBoolean get_devices)
       info->devices = NULL;
       info->got_devices = EGL_FALSE;
 
+      /* update this string like in eglglobals.c to add support for a device
+       * extension */
+      info->extensions = "";
+
 #ifdef HAVE_LIBUDEV
       info->udev = NULL;
 #endif
@@ -206,6 +212,30 @@ _eglFiniDeviceInfo(void)
    _eglGlobal.DeviceInfo = NULL;
 }
 
+/**
+ * Get string about a specific device.
+ */
+const char *
+_eglQueryDeviceStringEXT(_EGLDevice *device, EGLint name)
+{
+   _EGLDeviceInfo *info;
+
+   info =_eglEnsureDeviceInfo(EGL_FALSE);
+   if (!info) {
+      _eglError(EGL_BAD_ALLOC, "eglQueryDeviceStringEXT");
+      return NULL;
+   }
+
+   switch (name) {
+   case EGL_EXTENSIONS:
+      return info->extensions;
+
+   default:
+      _eglError(EGL_BAD_PARAMETER, "eglQueryDeviceStringEXT");
+      return NULL;
+   };
+}
+
 static EGLBoolean
 _eglFillDeviceList(_EGLDeviceInfo *info)
 {
diff --git a/src/egl/main/egldevice.h b/src/egl/main/egldevice.h
index 5ea2df8..51c6066 100644
--- a/src/egl/main/egldevice.h
+++ b/src/egl/main/egldevice.h
@@ -48,6 +48,10 @@ _EGLDevice *
 _eglLookupDevice(EGLDeviceEXT device);
 
 
+const char *
+_eglQueryDeviceStringEXT(_EGLDevice *device, EGLint name);
+
+
 EGLBoolean
 _eglQueryDevicesEXT(EGLint max_devices, _EGLDevice **devices,
                     EGLint *num_devices);
-- 
2.4.6



More information about the mesa-dev mailing list