[Mesa-dev] [PATCH 1/2] glx: move the glFlush call one layer down
Marek Olšák
maraeo at gmail.com
Wed Nov 14 19:43:22 PST 2012
---
src/glx/dri2_glx.c | 6 +++++-
src/glx/dri_glx.c | 6 +++++-
src/glx/drisw_glx.c | 7 ++++++-
src/glx/glxclient.h | 2 +-
src/glx/glxcmds.c | 8 +++-----
5 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 12b3026..f469431 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -731,7 +731,7 @@ static void show_fps(struct dri2_drawable *draw)
static int64_t
dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
- int64_t remainder)
+ int64_t remainder, Bool flush)
{
struct dri2_drawable *priv = (struct dri2_drawable *) pdraw;
struct glx_display *dpyPriv = __glXInitialize(priv->base.psc->dpy);
@@ -740,6 +740,10 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
(struct dri2_display *)dpyPriv->dri2Display;
CARD64 ret = 0;
+ if (flush) {
+ glFlush();
+ }
+
/* Check we have the right attachments */
if (!priv->have_back)
return ret;
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index de777fb..07f9a00 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -684,11 +684,15 @@ driCreateDrawable(struct glx_screen *base,
static int64_t
driSwapBuffers(__GLXDRIdrawable * pdraw, int64_t unused1, int64_t unused2,
- int64_t unused3)
+ int64_t unused3, Bool flush)
{
struct dri_screen *psc = (struct dri_screen *) pdraw->psc;
struct dri_drawable *pdp = (struct dri_drawable *) pdraw;
+ if (flush) {
+ glFlush();
+ }
+
(*psc->core->swapBuffers) (pdp->driDrawable);
return 0;
}
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 014296b..832e964 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -551,7 +551,8 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable,
static int64_t
driswSwapBuffers(__GLXDRIdrawable * pdraw,
- int64_t target_msc, int64_t divisor, int64_t remainder)
+ int64_t target_msc, int64_t divisor, int64_t remainder,
+ Bool flush)
{
struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw;
struct drisw_screen *psc = (struct drisw_screen *) pdp->base.psc;
@@ -560,6 +561,10 @@ driswSwapBuffers(__GLXDRIdrawable * pdraw,
(void) divisor;
(void) remainder;
+ if (flush) {
+ glFlush();
+ }
+
(*psc->core->swapBuffers) (pdp->driDrawable);
return 0;
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index e4adedd..a238749 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -113,7 +113,7 @@ struct __GLXDRIscreenRec {
struct glx_config *config);
int64_t (*swapBuffers)(__GLXDRIdrawable *pdraw, int64_t target_msc,
- int64_t divisor, int64_t remainder);
+ int64_t divisor, int64_t remainder, Bool flush);
void (*copySubBuffer)(__GLXDRIdrawable *pdraw,
int x, int y, int width, int height);
int (*getDrawableMSC)(struct glx_screen *psc, __GLXDRIdrawable *pdraw,
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 394bf59..265a9a8 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -781,11 +781,9 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
if (pdraw != NULL) {
- if (gc && drawable == gc->currentDrawable) {
- glFlush();
- }
+ Bool flush = gc && drawable == gc->currentDrawable;
- (*pdraw->psc->driScreen->swapBuffers)(pdraw, 0, 0, 0);
+ (*pdraw->psc->driScreen->swapBuffers)(pdraw, 0, 0, 0, flush);
return;
}
}
@@ -2171,7 +2169,7 @@ __glXSwapBuffersMscOML(Display * dpy, GLXDrawable drawable,
#ifdef GLX_DIRECT_RENDERING
if (psc->driScreen && psc->driScreen->swapBuffers)
return (*psc->driScreen->swapBuffers)(pdraw, target_msc, divisor,
- remainder);
+ remainder, False);
#endif
return -1;
--
1.7.9.5
More information about the mesa-dev
mailing list