[PATCH xserver 6/7] glx: Push internal glF{lus, inis}h calls into the backend

Adam Jackson ajax at redhat.com
Fri Apr 1 16:53:34 UTC 2016


These calls are appropriate for indirect contexts; when we're building
without indirect support we don't want to reference libGL at all.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 glx/glxcmds.c            | 15 ++++++++++-----
 glx/glxcontext.h         |  2 ++
 glx/glxdri2.c            |  2 ++
 glx/glxdriswrast.c       |  2 ++
 glx/indirect_util.c      | 12 ++++++++++++
 glx/indirect_util.h      |  3 +++
 hw/xquartz/GL/indirect.c |  3 +++
 hw/xwin/glx/indirect.c   |  3 +++
 8 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 3c4209a..5b5b93e 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -638,7 +638,8 @@ DoMakeCurrent(__GLXclientState * cl,
 #endif
         if (need_flush) {
             if (__glXForceCurrent(cl, tag, (int *) &error)) {
-                glFlush();
+                if (prevglxc->flush)
+                    prevglxc->flush(prevglxc);
             }
             else {
                 return error;
@@ -822,7 +823,8 @@ __glXDisp_WaitGL(__GLXclientState * cl, GLbyte * pc)
         if (!__glXForceCurrent(cl, req->contextTag, &error))
             return error;
 
-        glFinish();
+        if (glxc->finish)
+            glxc->finish(glxc);
     }
 
     if (glxc && glxc->drawPriv->waitGL)
@@ -920,7 +922,8 @@ __glXDisp_CopyContext(__GLXclientState * cl, GLbyte * pc)
              ** Do whatever is needed to make sure that all preceding requests
              ** in both streams are completed before the copy is executed.
              */
-            glFinish();
+            if (tagcx->finish)
+                tagcx->finish(tagcx);
         }
         else {
             return error;
@@ -1693,7 +1696,8 @@ __glXDisp_SwapBuffers(__GLXclientState * cl, GLbyte * pc)
              ** Do whatever is needed to make sure that all preceding requests
              ** in both streams are completed before the swap is executed.
              */
-            glFinish();
+            if (glxc->finish)
+                glxc->finish(glxc);
         }
         else {
             return error;
@@ -1889,7 +1893,8 @@ __glXDisp_CopySubBufferMESA(__GLXclientState * cl, GLbyte * pc)
              ** Do whatever is needed to make sure that all preceding requests
              ** in both streams are completed before the swap is executed.
              */
-            glFinish();
+            if (glxc->finish)
+                glxc->finish(glxc);
         }
         else {
             return error;
diff --git a/glx/glxcontext.h b/glx/glxcontext.h
index edbd491..97f4e4f 100644
--- a/glx/glxcontext.h
+++ b/glx/glxcontext.h
@@ -49,6 +49,8 @@ struct __GLXcontext {
     int (*loseCurrent) (__GLXcontext * context);
     int (*copy) (__GLXcontext * dst, __GLXcontext * src, unsigned long mask);
     Bool (*wait) (__GLXcontext * context, __GLXclientState * cl, int *error);
+    void (*flush) (__GLXcontext *context);
+    void (*finish) (__GLXcontext *context);
 
     __GLXtextureFromPixmap *textureFromPixmap;
 
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index afaf44e..ebf29d2 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -565,6 +565,8 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
     context->base.copy = __glXDRIcontextCopy;
     context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
     context->base.wait = __glXDRIcontextWait;
+    context->base.flush = __glXIndirectContextFlush;
+    context->base.finish = __glXIndirectContextFinish;
 
     create_driver_context(context, screen, config, driShare, num_attribs,
                           attribs, error);
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index be32527..7354f4a 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -249,6 +249,8 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
     context->base.loseCurrent = __glXDRIcontextLoseCurrent;
     context->base.copy = __glXDRIcontextCopy;
     context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
+    context->base.flush = __glXIndirectContextFlush;
+    context->base.finish = __glXIndirectContextFinish;
 
     context->driContext =
         (*core->createNewContext) (screen->driScreen,
diff --git a/glx/indirect_util.c b/glx/indirect_util.c
index 9ba2815..4bee70f 100644
--- a/glx/indirect_util.c
+++ b/glx/indirect_util.c
@@ -291,3 +291,15 @@ __glXGetProtocolSizeData(const struct __glXDispatchInfo *dispatch_info,
 
     return -1;
 }
+
+void
+__glXIndirectContextFlush(__GLXcontext *ctx)
+{
+    glFlush();
+}
+
+void
+__glXIndirectContextFinish(__GLXcontext *ctx)
+{
+    glFinish();
+}
diff --git a/glx/indirect_util.h b/glx/indirect_util.h
index f5db262..ae2c6a0 100644
--- a/glx/indirect_util.h
+++ b/glx/indirect_util.h
@@ -50,4 +50,7 @@ extern int __glXGetProtocolSizeData(const struct __glXDispatchInfo
                                     *dispatch_info, int opcode,
                                     __GLXrenderSizeData * data);
 
+extern void __glXIndirectContextFlush(__GLXcontext *ctx);
+extern void __glXIndirectContextFinish(__GLXcontext *ctx);
+
 #endif                          /* __GLX_INDIRECT_UTIL_H__ */
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 2d88ef2..135739d 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -53,6 +53,7 @@
 #include "visualConfigs.h"
 #include "dri.h"
 #include "extension_string.h"
+#include "indirect_util.h"
 
 #include "darwin.h"
 #define GLAQUA_DEBUG_MSG(msg, args ...) ASL_LOG(ASL_LEVEL_DEBUG, "GLXAqua", \
@@ -161,6 +162,8 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
     context->base.makeCurrent = __glXAquaContextMakeCurrent;
     context->base.loseCurrent = __glXAquaContextLoseCurrent;
     context->base.copy = __glXAquaContextCopy;
+    context->base.flush = __glXIndirectContextFlush;
+    context->base.finish = __glXIndirectContextFinish;
     /*FIXME verify that the context->base is fully initialized. */
 
     context->pixelFormat = makeFormat(conf);
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index 26832e6..6894086 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -82,6 +82,7 @@
 #include <glx/glxserver.h>
 #include <glx/glxutil.h>
 #include <glx/extension_string.h>
+#include <glx/indirect_util.h>
 #include <GL/glxtokens.h>
 
 #include <winpriv.h>
@@ -1543,6 +1544,8 @@ glxWinCreateContext(__GLXscreen * screen,
     context->base.makeCurrent = glxWinContextMakeCurrent;
     context->base.loseCurrent = glxWinContextLoseCurrent;
     context->base.copy = glxWinContextCopy;
+    context->base.flush = __glXIndirectContextFlush;
+    context->base.finish = __glXIndirectContextFinish;
     context->base.textureFromPixmap = &glxWinTextureFromPixmap;
     context->base.config = modes;
     context->base.pGlxScreen = screen;
-- 
2.5.0



More information about the xorg-devel mailing list