ac171ae
From efa4f2ebc1e788c3f1cfcf3842058cf838171653 Mon Sep 17 00:00:00 2001
ac171ae
From: Hans de Goede <hdegoede@redhat.com>
ac171ae
Date: Mon, 20 Mar 2017 08:41:26 +0100
ac171ae
Subject: [PATCH] glxglvnddispatch: Add missing dispatch for GetDriverConfig
ac171ae
ac171ae
Together with some fixes to xdriinfo this fixes xdriinfo not working
ac171ae
with glvnd.
ac171ae
ac171ae
Since apps (xdriinfo) expect GetDriverConfig to work without going to
ac171ae
need through the dance to setup a glxcontext (which is a reasonable
ac171ae
expectation IMHO), the dispatch for this ends up significantly different
ac171ae
then any other dispatch function.
ac171ae
ac171ae
This patch gets the job done, but I'm not really happy with how this
ac171ae
patch turned out, suggestions for a better fix are welcome.
ac171ae
ac171ae
Cc: Kyle Brenneman <kbrenneman@nvidia.com>
ac171ae
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ac171ae
---
ac171ae
 src/glx/g_glxglvnddispatchfuncs.c   | 18 ++++++++++++++++++
ac171ae
 src/glx/g_glxglvnddispatchindices.h |  1 +
ac171ae
 2 files changed, 19 insertions(+)
ac171ae
ac171ae
diff --git a/src/glx/g_glxglvnddispatchfuncs.c b/src/glx/g_glxglvnddispatchfuncs.c
ac171ae
index b5e3398..040cdf8 100644
ac171ae
--- a/src/glx/g_glxglvnddispatchfuncs.c
ac171ae
+++ b/src/glx/g_glxglvnddispatchfuncs.c
ac171ae
@@ -4,6 +4,7 @@
ac171ae
  */
ac171ae
 #include <stdlib.h>
ac171ae
 
ac171ae
+#include "glxclient.h"
ac171ae
 #include "glxglvnd.h"
ac171ae
 #include "glxglvnddispatchfuncs.h"
ac171ae
 #include "g_glxglvnddispatchindices.h"
ac171ae
@@ -50,6 +51,7 @@ const char * const __glXDispatchTableStrings[DI_LAST_INDEX] = {
ac171ae
     __ATTRIB(GetCurrentDisplayEXT),
ac171ae
     // glXGetCurrentDrawable implemented by libglvnd
ac171ae
     // glXGetCurrentReadDrawable implemented by libglvnd
ac171ae
+    __ATTRIB(GetDriverConfig),
ac171ae
     // glXGetFBConfigAttrib implemented by libglvnd
ac171ae
     __ATTRIB(GetFBConfigAttribSGIX),
ac171ae
     __ATTRIB(GetFBConfigFromVisualSGIX),
ac171ae
@@ -334,6 +336,21 @@ static Display *dispatch_GetCurrentDisplayEXT(void)
ac171ae
 
ac171ae
 
ac171ae
 
ac171ae
+static const char *dispatch_GetDriverConfig(const char *driverName)
ac171ae
+{
ac171ae
+    /*
ac171ae
+     * The options are constant for a given driverName, so we do not need
ac171ae
+     * a context (and apps expect to be able to call this without one).
ac171ae
+     */
ac171ae
+#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
ac171ae
+    return glXGetDriverConfig(driverName);
ac171ae
+#else
ac171ae
+    return NULL;
ac171ae
+#endif
ac171ae
+}
ac171ae
+
ac171ae
+
ac171ae
+
ac171ae
 static int dispatch_GetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config,
ac171ae
                                           int attribute, int *value_return)
ac171ae
 {
ac171ae
@@ -939,6 +956,7 @@ const void * const __glXDispatchFunctions[DI_LAST_INDEX + 1] = {
ac171ae
     __ATTRIB(DestroyGLXPbufferSGIX),
ac171ae
     __ATTRIB(GetContextIDEXT),
ac171ae
     __ATTRIB(GetCurrentDisplayEXT),
ac171ae
+    __ATTRIB(GetDriverConfig),
ac171ae
     __ATTRIB(GetFBConfigAttribSGIX),
ac171ae
     __ATTRIB(GetFBConfigFromVisualSGIX),
ac171ae
     __ATTRIB(GetMscRateOML),
ac171ae
diff --git a/src/glx/g_glxglvnddispatchindices.h b/src/glx/g_glxglvnddispatchindices.h
ac171ae
index 05a2c8c..3ba50a7 100644
ac171ae
--- a/src/glx/g_glxglvnddispatchindices.h
ac171ae
+++ b/src/glx/g_glxglvnddispatchindices.h
ac171ae
@@ -39,6 +39,7 @@ typedef enum __GLXdispatchIndex {
ac171ae
     DI_GetCurrentDisplayEXT,
ac171ae
     // GetCurrentDrawable implemented by libglvnd
ac171ae
     // GetCurrentReadDrawable implemented by libglvnd
ac171ae
+    DI_GetDriverConfig,
ac171ae
     // GetFBConfigAttrib implemented by libglvnd
ac171ae
     DI_GetFBConfigAttribSGIX,
ac171ae
     DI_GetFBConfigFromVisualSGIX,
ac171ae
-- 
ac171ae
2.9.3
ac171ae