[Mesa-dev] [PATCH] glx: block attempt to swapbuffer on pixmap.
Dave Airlie
airlied at gmail.com
Wed Dec 7 02:02:19 PST 2011
From: Dave Airlie <airlied at redhat.com>
This keeps track of the creation process and stores a drawable type,
it then blocks DRI2 from getting called if the drawable is a pixmap.
Suggested by Michel Dänzer <michel at daenzer.net>
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/glx/glx_pbuffer.c | 3 ++-
src/glx/glxclient.h | 3 ++-
src/glx/glxcmds.c | 7 +++++--
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 6738252..4bc3292 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -434,7 +434,8 @@ CreateDrawable(Display *dpy, struct glx_config *config,
UnlockDisplay(dpy);
SyncHandle();
- if (InitGLXDrawable(dpy, glxDraw, drawable, xid)) {
+ if (InitGLXDrawable(dpy, glxDraw, drawable, xid,
+ (glxCode == X_GLXCreatePixmap) ? GLX_PIXMAP_BIT : GLX_WINDOW_BIT)) {
free(glxDraw);
return None;
}
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index f915426..a47a2f7 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -585,6 +585,7 @@ struct glx_drawable {
XID xDrawable;
XID drawable;
+ uint32_t drawableType;
uint32_t lastEventSbc;
int64_t eventSbcWrap;
};
@@ -797,7 +798,7 @@ applegl_create_display(struct glx_display *display);
extern struct glx_drawable *GetGLXDrawable(Display *dpy, GLXDrawable drawable);
extern int InitGLXDrawable(Display *dpy, struct glx_drawable *glxDraw,
- XID xDrawable, GLXDrawable drawable);
+ XID xDrawable, GLXDrawable drawable, uint32_t drawableType);
extern void DestroyGLXDrawable(Display *dpy, GLXDrawable drawable);
extern struct glx_context dummyContext;
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index c8ec9c2..f761b8b 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -107,7 +107,7 @@ GetGLXDrawable(Display *dpy, GLXDrawable drawable)
_X_HIDDEN int
InitGLXDrawable(Display *dpy, struct glx_drawable *glxDraw, XID xDrawable,
- GLXDrawable drawable)
+ GLXDrawable drawable, uint32_t drawableType)
{
struct glx_display *priv = __glXInitialize(dpy);
@@ -118,6 +118,7 @@ InitGLXDrawable(Display *dpy, struct glx_drawable *glxDraw, XID xDrawable,
glxDraw->drawable = drawable;
glxDraw->lastEventSbc = 0;
glxDraw->eventSbcWrap = 0;
+ glxDraw->drawableType = drawableType;
return __glxHashInsert(priv->glXDrawHash, drawable, glxDraw);
}
@@ -678,7 +679,7 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap)
UnlockDisplay(dpy);
SyncHandle();
- if (InitGLXDrawable(dpy, glxDraw, pixmap, req->glxpixmap)) {
+ if (InitGLXDrawable(dpy, glxDraw, pixmap, req->glxpixmap, GLX_PIXMAP_BIT)) {
free(glxDraw);
return None;
}
@@ -796,12 +797,14 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
{
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
+ struct glx_drawable *glx_draw = GetGLXDrawable(dpy, drawable);
if (pdraw != NULL) {
if (gc && drawable == gc->currentDrawable) {
glFlush();
}
+ if (glx_draw->drawableType == GLX_WINDOW_BIT)
(*pdraw->psc->driScreen->swapBuffers)(pdraw, 0, 0, 0);
return;
}
--
1.7.6.4
More information about the mesa-dev
mailing list