[PATCH xserver 4/7] glx: Stop tracking hasUnflushedCommands

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


This is only meaningful for indirect contexts, and all it does is
(maybe) prevent a flush when switching away from an indirect context.
Indirect contexts aren't worth optimizing for, and Mesa tracks whether
a flush is needed anyway.

Careful readers will note that ReadPixels would reset the flag even
though it doesn't imply a flush!

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 glx/glxcmds.c       | 8 +-------
 glx/glxcontext.h    | 5 -----
 glx/glxext.c        | 1 -
 glx/single2.c       | 4 ----
 glx/single2swap.c   | 4 ----
 glx/singlepix.c     | 1 -
 glx/singlepixswap.c | 1 -
 7 files changed, 1 insertion(+), 23 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index b69a830..3c4209a 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -636,10 +636,9 @@ DoMakeCurrent(__GLXclientState * cl,
         if (prevglxc->releaseBehavior == GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB)
             need_flush = GL_FALSE;
 #endif
-        if (prevglxc->hasUnflushedCommands && need_flush) {
+        if (need_flush) {
             if (__glXForceCurrent(cl, tag, (int *) &error)) {
                 glFlush();
-                prevglxc->hasUnflushedCommands = GL_FALSE;
             }
             else {
                 return error;
@@ -922,7 +921,6 @@ __glXDisp_CopyContext(__GLXclientState * cl, GLbyte * pc)
              ** in both streams are completed before the copy is executed.
              */
             glFinish();
-            tagcx->hasUnflushedCommands = GL_FALSE;
         }
         else {
             return error;
@@ -1696,7 +1694,6 @@ __glXDisp_SwapBuffers(__GLXclientState * cl, GLbyte * pc)
              ** in both streams are completed before the swap is executed.
              */
             glFinish();
-            glxc->hasUnflushedCommands = GL_FALSE;
         }
         else {
             return error;
@@ -1893,7 +1890,6 @@ __glXDisp_CopySubBufferMESA(__GLXclientState * cl, GLbyte * pc)
              ** in both streams are completed before the swap is executed.
              */
             glFinish();
-            glxc->hasUnflushedCommands = GL_FALSE;
         }
         else {
             return error;
@@ -2116,7 +2112,6 @@ __glXDisp_Render(__GLXclientState * cl, GLbyte * pc)
         left -= cmdlen;
         commandsDone++;
     }
-    glxc->hasUnflushedCommands = GL_TRUE;
     return Success;
 }
 
@@ -2327,7 +2322,6 @@ __glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc)
              ** Skip over the header and execute the command.
              */
             (*proc) (cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
-            glxc->hasUnflushedCommands = GL_TRUE;
 
             /*
              ** Reset for the next RenderLarge series.
diff --git a/glx/glxcontext.h b/glx/glxcontext.h
index 0733281..edbd491 100644
--- a/glx/glxcontext.h
+++ b/glx/glxcontext.h
@@ -94,11 +94,6 @@ struct __GLXcontext {
     GLboolean isDirect;
 
     /*
-     ** This flag keeps track of whether there are unflushed GL commands.
-     */
-    GLboolean hasUnflushedCommands;
-
-    /*
      ** Current rendering mode for this context.
      */
     GLenum renderMode;
diff --git a/glx/glxext.c b/glx/glxext.c
index f3d8fdd..67ec07f 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -136,7 +136,6 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid)
 		(c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
             /* flush the context */
             glFlush();
-            c->hasUnflushedCommands = GL_FALSE;
             /* just force a re-bind the next time through */
             (*c->loseCurrent) (c);
             lastGLContext = NULL;
diff --git a/glx/single2.c b/glx/single2.c
index acc66ac..62dcd79 100644
--- a/glx/single2.c
+++ b/glx/single2.c
@@ -71,7 +71,6 @@ __glXDisp_FeedbackBuffer(__GLXclientState * cl, GLbyte * pc)
         cx->feedbackBufSize = size;
     }
     glFeedbackBuffer(size, type, cx->feedbackBuf);
-    cx->hasUnflushedCommands = GL_TRUE;
     return Success;
 }
 
@@ -102,7 +101,6 @@ __glXDisp_SelectBuffer(__GLXclientState * cl, GLbyte * pc)
         cx->selectBufSize = size;
     }
     glSelectBuffer(size, cx->selectBuf);
-    cx->hasUnflushedCommands = GL_TRUE;
     return Success;
 }
 
@@ -225,7 +223,6 @@ __glXDisp_Flush(__GLXclientState * cl, GLbyte * pc)
     }
 
     glFlush();
-    cx->hasUnflushedCommands = GL_FALSE;
     return Success;
 }
 
@@ -245,7 +242,6 @@ __glXDisp_Finish(__GLXclientState * cl, GLbyte * pc)
 
     /* Do a local glFinish */
     glFinish();
-    cx->hasUnflushedCommands = GL_FALSE;
 
     /* Send empty reply packet to indicate finish is finished */
     client = cl->client;
diff --git a/glx/single2swap.c b/glx/single2swap.c
index d5bb1c0..c1df248 100644
--- a/glx/single2swap.c
+++ b/glx/single2swap.c
@@ -72,7 +72,6 @@ __glXDispSwap_FeedbackBuffer(__GLXclientState * cl, GLbyte * pc)
         cx->feedbackBufSize = size;
     }
     glFeedbackBuffer(size, type, cx->feedbackBuf);
-    cx->hasUnflushedCommands = GL_TRUE;
     return Success;
 }
 
@@ -107,7 +106,6 @@ __glXDispSwap_SelectBuffer(__GLXclientState * cl, GLbyte * pc)
         cx->selectBufSize = size;
     }
     glSelectBuffer(size, cx->selectBuf);
-    cx->hasUnflushedCommands = GL_TRUE;
     return Success;
 }
 
@@ -245,7 +243,6 @@ __glXDispSwap_Flush(__GLXclientState * cl, GLbyte * pc)
     }
 
     glFlush();
-    cx->hasUnflushedCommands = GL_FALSE;
     return Success;
 }
 
@@ -268,7 +265,6 @@ __glXDispSwap_Finish(__GLXclientState * cl, GLbyte * pc)
 
     /* Do a local glFinish */
     glFinish();
-    cx->hasUnflushedCommands = GL_FALSE;
 
     /* Send empty reply packet to indicate finish is finished */
     __GLX_BEGIN_REPLY(0);
diff --git a/glx/singlepix.c b/glx/singlepix.c
index 54ed7fd..b253a59 100644
--- a/glx/singlepix.c
+++ b/glx/singlepix.c
@@ -86,7 +86,6 @@ __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
         __GLX_SEND_HEADER();
         __GLX_SEND_VOID_ARRAY(compsize);
     }
-    cx->hasUnflushedCommands = GL_FALSE;
     return Success;
 }
 
diff --git a/glx/singlepixswap.c b/glx/singlepixswap.c
index 9eff592..684f4e8 100644
--- a/glx/singlepixswap.c
+++ b/glx/singlepixswap.c
@@ -98,7 +98,6 @@ __glXDispSwap_ReadPixels(__GLXclientState * cl, GLbyte * pc)
         __GLX_SEND_HEADER();
         __GLX_SEND_VOID_ARRAY(compsize);
     }
-    cx->hasUnflushedCommands = GL_FALSE;
     return Success;
 }
 
-- 
2.5.0



More information about the xorg-devel mailing list