[PATCH xserver 12/13] glx: Compute the GLX extension string from __glXScreenInit

Adam Jackson ajax at redhat.com
Wed Mar 23 22:46:54 UTC 2016


Now that the enable bits are in the screen base class we can compute
this in one place, rather than making every backend do it.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 glx/glxdri2.c            | 12 ------------
 glx/glxdriswrast.c       | 12 ------------
 glx/glxscreens.c         |  8 ++++++++
 hw/xquartz/GL/indirect.c | 14 --------------
 hw/xwin/glx/indirect.c   | 11 -----------
 5 files changed, 8 insertions(+), 49 deletions(-)

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index fa93da1..15253d1 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -939,7 +939,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 {
     const char *driverName, *deviceName;
     __GLXDRIscreen *screen;
-    size_t buffer_size;
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
 
     screen = calloc(1, sizeof *screen);
@@ -988,17 +987,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 
     __glXScreenInit(&screen->base, pScreen);
 
-    /* The first call simply determines the length of the extension string.
-     * This allows us to allocate some memory to hold the extension string,
-     * but it requires that we call __glXGetExtensionString a second time.
-     */
-    buffer_size = __glXGetExtensionString(screen->base.glx_enable_bits, NULL);
-    if (buffer_size > 0) {
-        screen->base.GLXextensions = xnfalloc(buffer_size);
-        (void) __glXGetExtensionString(screen->base.glx_enable_bits,
-                                       screen->base.GLXextensions);
-    }
-
     screen->enterVT = pScrn->EnterVT;
     pScrn->EnterVT = glxDRIEnterVT;
     screen->leaveVT = pScrn->LeaveVT;
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 27c98ed..0b5122f 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -448,7 +448,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 {
     const char *driverName = "swrast";
     __GLXDRIscreen *screen;
-    size_t buffer_size;
 
     screen = calloc(1, sizeof *screen);
     if (screen == NULL)
@@ -490,17 +489,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 
     __glXScreenInit(&screen->base, pScreen);
 
-    /* The first call simply determines the length of the extension string.
-     * This allows us to allocate some memory to hold the extension string,
-     * but it requires that we call __glXGetExtensionString a second time.
-     */
-    buffer_size = __glXGetExtensionString(screen->base.glx_enable_bits, NULL);
-    if (buffer_size > 0) {
-        screen->base.GLXextensions = xnfalloc(buffer_size);
-        (void) __glXGetExtensionString(screen->base.glx_enable_bits,
-                                       screen->base.GLXextensions);
-    }
-
     __glXsetGetProcAddress(glXGetProcAddressARB);
 
     LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", driverName);
diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 61b8a52..7e083cf 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -383,6 +383,14 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
     }
 
     dixSetPrivate(&pScreen->devPrivates, glxScreenPrivateKey, pGlxScreen);
+
+    i = __glXGetExtensionString(pGlxScreen->glx_enable_bits, NULL);
+    if (i > 0) {
+        pGlxScreen->GLXextensions = xnfalloc(i);
+        (void) __glXGetExtensionString(pGlxScreen->glx_enable_bits,
+                                       pGlxScreen->GLXextensions);
+    }
+
 }
 
 void
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 9eaeb94..2d88ef2 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -542,20 +542,6 @@ __glXAquaScreenProbe(ScreenPtr pScreen)
     __glXInitExtensionEnableBits(screen->base.glx_enable_bits);
     __glXScreenInit(&screen->base, pScreen);
 
-    //__glXEnableExtension(screen->base.glx_enable_bits, "GLX_ARB_create_context");
-    //__glXEnableExtension(screen->base.glx_enable_bits, "GLX_ARB_create_context_profile");
-
-    // Generate the GLX extensions string (overrides that set by __glXScreenInit())
-    {
-        unsigned int buffer_size =
-            __glXGetExtensionString(screen->base.glx_enable_bits, NULL);
-        if (buffer_size > 0) {
-            screen->base.GLXextensions = xnfalloc(buffer_size);
-            __glXGetExtensionString(screen->base.glx_enable_bits,
-                                    screen->base.GLXextensions);
-        }
-    }
-
     return &screen->base;
 }
 
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index 5e491c5..a3c19fb 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -700,17 +700,6 @@ glxWinScreenProbe(ScreenPtr pScreen)
         screen->base.numVisuals = 0;
 
         __glXScreenInit(&screen->base, pScreen);
-
-        // Generate the GLX extensions string (overrides that set by __glXScreenInit())
-        {
-            unsigned int buffer_size =
-                __glXGetExtensionString(screen->base.glx_enable_bits, NULL);
-            if (buffer_size > 0) {
-                screen->base.GLXextensions = xnfalloc(buffer_size);
-                __glXGetExtensionString(screen->base.glx_enable_bits,
-                                        screen->base.GLXextensions);
-            }
-        }
     }
 
     wglMakeCurrent(NULL, NULL);
-- 
2.5.0



More information about the xorg-devel mailing list