[PATCH xserver 09/12] glx: Remove some indirection around EXT_texture_from_pixmap

Adam Jackson ajax at redhat.com
Fri Jun 16 19:44:49 UTC 2017


Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 glx/glxcmds.c          |  9 ++++-----
 glx/glxcontext.h       | 14 +++++---------
 glx/glxdri2.c          |  8 ++------
 glx/glxdriswrast.c     |  8 ++------
 hw/xwin/glx/indirect.c |  8 ++------
 5 files changed, 15 insertions(+), 32 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 508815b9d..ac21136b1 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1807,10 +1807,10 @@ __glXDisp_BindTexImageEXT(__GLXclientState * cl, GLbyte * pc)
                           DixReadAccess, &pGlxDraw, &error))
         return error;
 
-    if (!context->textureFromPixmap)
+    if (!context->bindTexImage)
         return __glXError(GLXUnsupportedPrivateRequest);
 
-    return context->textureFromPixmap->bindTexImage(context, buffer, pGlxDraw);
+    return context->bindTexImage(context, buffer, pGlxDraw);
 }
 
 int
@@ -1839,11 +1839,10 @@ __glXDisp_ReleaseTexImageEXT(__GLXclientState * cl, GLbyte * pc)
                           DixReadAccess, &pGlxDraw, &error))
         return error;
 
-    if (!context->textureFromPixmap)
+    if (!context->releaseTexImage)
         return __glXError(GLXUnsupportedPrivateRequest);
 
-    return context->textureFromPixmap->releaseTexImage(context,
-                                                       buffer, pGlxDraw);
+    return context->releaseTexImage(context, buffer, pGlxDraw);
 }
 
 int
diff --git a/glx/glxcontext.h b/glx/glxcontext.h
index edbd491ff..19d347fdb 100644
--- a/glx/glxcontext.h
+++ b/glx/glxcontext.h
@@ -35,14 +35,6 @@
  * Silicon Graphics, Inc.
  */
 
-typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;
-struct __GLXtextureFromPixmap {
-    int (*bindTexImage) (__GLXcontext * baseContext,
-                         int buffer, __GLXdrawable * pixmap);
-    int (*releaseTexImage) (__GLXcontext * baseContext,
-                            int buffer, __GLXdrawable * pixmap);
-};
-
 struct __GLXcontext {
     void (*destroy) (__GLXcontext * context);
     int (*makeCurrent) (__GLXcontext * context);
@@ -50,7 +42,11 @@ struct __GLXcontext {
     int (*copy) (__GLXcontext * dst, __GLXcontext * src, unsigned long mask);
     Bool (*wait) (__GLXcontext * context, __GLXclientState * cl, int *error);
 
-    __GLXtextureFromPixmap *textureFromPixmap;
+    /* EXT_texture_from_pixmap */
+    int (*bindTexImage) (__GLXcontext * baseContext,
+                         int buffer, __GLXdrawable * pixmap);
+    int (*releaseTexImage) (__GLXcontext * baseContext,
+                            int buffer, __GLXdrawable * pixmap);
 
     /*
      ** list of context structs
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 484b4aeab..eae3748a9 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -335,11 +335,6 @@ __glXDRIreleaseTexImage(__GLXcontext * baseContext,
     return Success;
 }
 
-static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
-    __glXDRIbindTexImage,
-    __glXDRIreleaseTexImage
-};
-
 static Bool
 dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs,
                          const uint32_t *attribs,
@@ -561,7 +556,8 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
     context->base.makeCurrent = __glXDRIcontextMakeCurrent;
     context->base.loseCurrent = __glXDRIcontextLoseCurrent;
     context->base.copy = __glXDRIcontextCopy;
-    context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
+    context->base.bindTexImage = __glXDRIbindTexImage;
+    context->base.releaseTexImage = __glXDRIreleaseTexImage;
     context->base.wait = __glXDRIcontextWait;
 
     create_driver_context(context, screen, config, driShare, num_attribs,
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index ed0469fd6..d7d64b3d9 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -208,11 +208,6 @@ __glXDRIreleaseTexImage(__GLXcontext * baseContext,
     return Success;
 }
 
-static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
-    __glXDRIbindTexImage,
-    __glXDRIreleaseTexImage
-};
-
 static __GLXcontext *
 __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
                             __GLXconfig * glxConfig,
@@ -248,7 +243,8 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
     context->base.makeCurrent = __glXDRIcontextMakeCurrent;
     context->base.loseCurrent = __glXDRIcontextLoseCurrent;
     context->base.copy = __glXDRIcontextCopy;
-    context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
+    context->base.bindTexImage = __glXDRIbindTexImage;
+    context->base.releaseTexImage = __glXDRIreleaseTexImage;
 
     context->driContext =
         (*core->createNewContext) (screen->driScreen,
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index 239327ed4..ad79d249d 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -1522,11 +1522,6 @@ glxWinCreateContext(__GLXscreen * screen,
     __GLXWinContext *context;
     __GLXWinContext *shareContext = (__GLXWinContext *) baseShareContext;
 
-    static __GLXtextureFromPixmap glxWinTextureFromPixmap = {
-        glxWinBindTexImage,
-        glxWinReleaseTexImage
-    };
-
     context = calloc(1, sizeof(__GLXWinContext));
 
     if (!context)
@@ -1537,7 +1532,8 @@ glxWinCreateContext(__GLXscreen * screen,
     context->base.makeCurrent = glxWinContextMakeCurrent;
     context->base.loseCurrent = glxWinContextLoseCurrent;
     context->base.copy = glxWinContextCopy;
-    context->base.textureFromPixmap = &glxWinTextureFromPixmap;
+    context->base.bindTexImage = glxWinBindTexImage;
+    context->base.releaseTexImage = glxWinReleaseTexImage;
     context->base.config = modes;
     context->base.pGlxScreen = screen;
 
-- 
2.13.0



More information about the xorg-devel mailing list