diff options
-rw-r--r-- | composite/compalloc.c | 26 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | glx/Makefile.am | 5 | ||||
-rw-r--r-- | glx/glxcmds.c | 11 | ||||
-rw-r--r-- | glx/glxdri2.c | 1 | ||||
-rw-r--r-- | glx/glxext.c | 22 |
6 files changed, 26 insertions, 41 deletions
diff --git a/composite/compalloc.c b/composite/compalloc.c index e4064f6b1..7164c0d3c 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -508,17 +508,6 @@ compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin) return Success; } -static int -bgNoneVisitWindow(WindowPtr pWin, void *null) -{ - if (pWin->backgroundState != BackgroundPixmap) - return WT_WALKCHILDREN; - if (pWin->background.pixmap != None) - return WT_WALKCHILDREN; - - return WT_STOPWALKING; -} - static PixmapPtr compNewPixmap (WindowPtr pWin, int x, int y, int w, int h, Bool map) { @@ -539,21 +528,6 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h, Bool map) if (!map) return pPixmap; - /* - * If there's no bg=None in the tree, we're done. - * - * We could optimize this more by collection the regions of all the - * bg=None subwindows and feeding that in as the clip for the - * CopyArea below, but since window trees are shallow these days it - * might not be worth the effort. - */ - if (TraverseTree(pWin, bgNoneVisitWindow, NULL) == WT_NOMATCH) - return pPixmap; - - /* - * Copy bits from the parent into the new pixmap so that it will - * have "reasonable" contents in case for background None areas. - */ if (pParent->drawable.depth == pWin->drawable.depth) { GCPtr pGC = GetScratchGC (pWin->drawable.depth, pScreen); diff --git a/configure.ac b/configure.ac index 166874095..339fdfc2e 100644 --- a/configure.ac +++ b/configure.ac @@ -1004,7 +1004,7 @@ else fi AM_CONDITIONAL(GLX, test "x$GLX" = xyes) -if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a "x$DRI" = xyes; then +if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a \( "x$DRI" = xyes -o "x$DRI2" = xyes \); then AC_DEFINE(AIGLX, 1, [Build AIGLX loader]) else AIGLX=no diff --git a/glx/Makefile.am b/glx/Makefile.am index 72531f248..ef8677a7c 100644 --- a/glx/Makefile.am +++ b/glx/Makefile.am @@ -48,10 +48,13 @@ glapi_sources = \ glthread.h libglxdri_la_SOURCES = \ - glxdri.c \ extension_string.c \ extension_string.h +if DRI +libglxdri_la_SOURCES += glxdri.c +endif + if DRI2_AIGLX libglxdri_la_SOURCES += glxdri2.c endif diff --git a/glx/glxcmds.c b/glx/glxcmds.c index 66d4c7e16..d5b764fd0 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -1127,10 +1127,11 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, return BadAlloc; } - /* Add the glx drawable under the XID of the underlying X drawable - * too. That way we'll get a callback in DrawableGone and can - * clean up properly when the drawable is destroyed. */ - if (drawableId != glxDrawableId && + /* + * Windows aren't refcounted, so track both the X and the GLX window + * so we get called regardless of destruction order. + */ + if (drawableId != glxDrawableId && type == GLX_DRAWABLE_WINDOW && !AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) { pGlxDraw->destroy (pGlxDraw); return BadAlloc; @@ -1161,6 +1162,8 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, drawableId, glxDrawableId, GLX_DRAWABLE_PIXMAP); + ((PixmapPtr)pDraw)->refcnt++; + return err; } diff --git a/glx/glxdri2.c b/glx/glxdri2.c index e8961e255..d97971739 100644 --- a/glx/glxdri2.c +++ b/glx/glxdri2.c @@ -184,6 +184,7 @@ __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust, break; default: /* unknown swap completion type */ + wire.event_type = 0; break; } wire.drawable = drawable->drawId; diff --git a/glx/glxext.c b/glx/glxext.c index 3f3dd798f..9cfc096c3 100644 --- a/glx/glxext.c +++ b/glx/glxext.c @@ -118,15 +118,15 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid) { __GLXcontext *c, *next; - /* If this drawable was created using glx 1.3 drawable - * constructors, we added it as a glx drawable resource under both - * its glx drawable ID and it X drawable ID. Remove the other - * resource now so we don't a callback for freed memory. */ - if (glxPriv->drawId != glxPriv->pDraw->id) { - if (xid == glxPriv->drawId) - FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE); - else - FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE); + if (glxPriv->type == GLX_DRAWABLE_WINDOW) { + /* If this was created by glXCreateWindow, free the matching resource */ + if (glxPriv->drawId != glxPriv->pDraw->id) { + if (xid == glxPriv->drawId) + FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE); + else + FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE); + } + /* otherwise this window was implicitly created by MakeCurrent */ } for (c = glxAllContexts; c; c = next) { @@ -143,6 +143,10 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid) c->readPriv = NULL; } + /* drop our reference to any backing pixmap */ + if (glxPriv->type == GLX_DRAWABLE_PIXMAP) + glxPriv->pDraw->pScreen->DestroyPixmap((PixmapPtr)glxPriv->pDraw); + glxPriv->destroy(glxPriv); return True; |