[Mesa-dev] [PATCH] EGL/mesa: Initial write up fot MESA_query_driver

Veluri Mithun velurimithun38 at gmail.com
Sun Dec 23 07:56:23 UTC 2018


- Try to retrieve driver name from dri2_egl_display

Signed-off-by: Veluri Mithun <velurimithun38 at gmail.com>
---
 docs/specs/EGL_MESA_query_driver.txt | 54 ++++++++++++++++++++++++++++
 src/egl/main/eglapi.c                | 13 +++++++
 src/egl/main/egldriver.c             |  8 +++++
 src/egl/main/egldriver.h             |  3 ++
 src/egl/main/eglentrypoint.h         |  1 +
 5 files changed, 79 insertions(+)
 create mode 100644 docs/specs/EGL_MESA_query_driver.txt

diff --git a/docs/specs/EGL_MESA_query_driver.txt
b/docs/specs/EGL_MESA_query_driver.txt
new file mode 100644
index 0000000000..bec7d4a15d
--- /dev/null
+++ b/docs/specs/EGL_MESA_query_driver.txt
@@ -0,0 +1,54 @@
+Name
+
+    MESA_query_driver
+
+Name Strings
+
+    EGL_MESA_query_driver
+
+Contact
+
+    Rob Clark      <robdclark 'at' gmail.com>
+    Nicolai Hähnle <Nicolai.Haehnle 'at' amd.com>
+
+Contibutors
+
+    Veluri Mithun <velurimithun38 'at' gmail.com>
+
+Status
+
+    XXX - Not complete yet!!! (draft)
+
+Version
+
+    Version 1, 2018-11-05
+
+Number
+
+    EGL Extension ###
+
+Dependencies
+
+    EGL 1.4 is required.
+
+Overview
+
+    When an application has to query the name of a DRI driver and for
+    obtaining driver's option list (UTF-8 encoded XML) of a DRI
+    driver the below functions are useful.
+
+New Procedures and Functions
+
+    const char* eglGetDriverConfig(EGLDisplay *disp, EGLDeviceEXT device,
+                                   const char *driverName);
+    const char* eglGetDisplayDriverName(EGLDisplay *disp);
+
+New Tokens
+
+    No new tokens
+
+Issues
+
+
+
+Revision History
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 3afdfd40e4..93d69127e7 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -2647,6 +2647,19 @@ eglQueryDisplayAttribEXT(EGLDisplay dpy,
    RETURN_EGL_SUCCESS(disp, EGL_TRUE);
 }

+static const char * EGLAPIENTRY
+eglGetDisplayDriverName(EGLDisplay dpy)
+{
+    _EGLDisplay *disp = _eglLockDisplay(dpy);
+    _EGLDriver *drv;
+
+    _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_FALSE);
+    _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
+
+    assert(disp->Initialized);
+    RETURN_EGL_EVAL(disp, _eglGetDriverName(disp));
+}
+
 __eglMustCastToProperFunctionPointerType EGLAPIENTRY
 eglGetProcAddress(const char *procname)
 {
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index b20652ed8c..a8b7d7dc94 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -45,6 +45,7 @@
 #include "egllog.h"

 #include "util/debug.h"
+#include "egl_dri2.h"

 static mtx_t _eglModuleMutex = _MTX_INITIALIZER_NP;
 static _EGLDriver *_eglDriver;
@@ -125,3 +126,10 @@ _eglUnloadDrivers(void)
    free(_eglDriver);
    _eglDriver = NULL;
 }
+
+const char *
+_eglGetDriverName(_EGLDisplay *disp)
+{
+    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+    return dri2_dpy->driver_name;
+}
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index 5695fc06ff..c5b330b6cb 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -78,6 +78,9 @@ struct _egl_driver
    _EGLAPI API;  /**< EGL API dispatch table */
 };

+extern const char *
+_eglGetDriverName(_EGLDisplay *disp);
+

 extern void
 _eglInitDriver(_EGLDriver *driver);
diff --git a/src/egl/main/eglentrypoint.h b/src/egl/main/eglentrypoint.h
index 69a6c1bf4c..5621b45d91 100644
--- a/src/egl/main/eglentrypoint.h
+++ b/src/egl/main/eglentrypoint.h
@@ -42,6 +42,7 @@ EGL_ENTRYPOINT(eglGetCurrentContext)
 EGL_ENTRYPOINT(eglGetCurrentDisplay)
 EGL_ENTRYPOINT(eglGetCurrentSurface)
 EGL_ENTRYPOINT(eglGetDisplay)
+EGL_ENTRYPOINT(eglGetDisplayDriverName)
 EGL_ENTRYPOINT(eglGetError)
 EGL_ENTRYPOINT(eglGetPlatformDisplay)
 EGL_ENTRYPOINT(eglGetPlatformDisplayEXT)
-- 
2.18.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181223/8cba60ca/attachment.html>


More information about the mesa-dev mailing list