summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-09-14 18:36:23 -0700
committerJamey Sharp <jamey@minilop.net>2011-12-14 18:27:51 -0800
commit16e610abbedc69f4aeb28cfd2ec4e4256d5b050c (patch)
treec86b11aa695794f59a54fa1e2dbdd8b61521235e
parent5a70cf630b8777a665363c7efc8861137109d6fc (diff)
Introduce ReleasePixmap to unreference, call screen hooks, and free.
This replaces FreePixmap, which was called at the bottom of DestroyPixmap hook chains. The screen hooks were responsible for reference counting, and did it inconsistently. Commit by Jamey Sharp and Josh Triplett. Signed-off-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Josh Triplett <josh@joshtriplett.org> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--Xext/saver.c4
-rw-r--r--Xext/shm.c29
-rw-r--r--Xext/xvmain.c10
-rw-r--r--composite/compalloc.c2
-rw-r--r--composite/compwindow.c7
-rw-r--r--dbe/midbe.c24
-rw-r--r--dix/dispatch.c6
-rw-r--r--dix/gc.c20
-rw-r--r--dix/glyphcurs.c4
-rw-r--r--dix/pixmap.c9
-rw-r--r--dix/window.c18
-rw-r--r--doc/Xserver-spec.xml12
-rw-r--r--exa/exa_classic.c45
-rw-r--r--exa/exa_driver.c23
-rw-r--r--exa/exa_glyphs.c8
-rw-r--r--exa/exa_mixed.c33
-rw-r--r--exa/exa_offscreen.c2
-rw-r--r--exa/exa_priv.h6
-rw-r--r--exa/exa_render.c4
-rw-r--r--fb/fb.h2
-rw-r--r--fb/fbgc.c4
-rw-r--r--fb/fboverlay.c2
-rw-r--r--fb/fbpixmap.c6
-rw-r--r--fb/fbwindow.c2
-rw-r--r--hw/dmx/dmxpixmap.c11
-rw-r--r--hw/dmx/dmxpixmap.h2
-rw-r--r--hw/dmx/glxProxy/glxext.c4
-rw-r--r--hw/xfree86/common/xf86DGA.c4
-rw-r--r--hw/xfree86/xaa/xaaInit.c63
-rw-r--r--hw/xnest/Pixmap.c6
-rw-r--r--hw/xnest/XNPixmap.h2
-rw-r--r--include/pixmap.h2
-rw-r--r--include/scrnintstr.h2
-rw-r--r--mi/miarc.c4
-rw-r--r--mi/mibitblt.c6
-rw-r--r--mi/midispcur.c14
-rw-r--r--mi/migc.c2
-rw-r--r--mi/miglblt.c6
-rw-r--r--mi/miscrinit.c3
-rw-r--r--miext/damage/damage.c20
-rw-r--r--miext/shadow/shadow.c4
-rw-r--r--render/glyph.c4
-rw-r--r--render/mipict.c4
-rw-r--r--render/mirect.c2
-rw-r--r--render/picture.c2
-rw-r--r--render/render.c4
46 files changed, 196 insertions, 257 deletions
diff --git a/Xext/saver.c b/Xext/saver.c
index 18d5e468d..730428c6e 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -326,9 +326,9 @@ FreeAttrs (ScreenSaverAttrPtr pAttr)
CursorPtr pCursor;
if ((pPixmap = pAttr->pBackgroundPixmap) != 0)
- (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(pPixmap);
if ((pPixmap = pAttr->pBorderPixmap) != 0)
- (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(pPixmap);
if ((pCursor = pAttr->pCursor) != 0)
FreeCursor (pCursor, (Cursor) 0);
}
diff --git a/Xext/shm.c b/Xext/shm.c
index 7ca027a90..7097593f4 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -118,7 +118,7 @@ static void SShmCompletionEvent(
xShmCompletionEvent * /* to */
);
-static Bool ShmDestroyPixmap (PixmapPtr pPixmap);
+static void ShmDestroyPixmap (PixmapPtr pPixmap);
static unsigned char ShmReqCode;
@@ -257,26 +257,21 @@ ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs)
ShmInitScreenPriv(pScreen)->shmFuncs = funcs;
}
-static Bool
+static void
ShmDestroyPixmap (PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
- Bool ret;
- if (pPixmap->refcnt == 1)
- {
- ShmDescPtr shmdesc;
- shmdesc = (ShmDescPtr)dixLookupPrivate(&pPixmap->devPrivates,
- shmPixmapPrivateKey);
- if (shmdesc)
- ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id);
- }
-
+ ShmDescPtr shmdesc;
+ shmdesc = (ShmDescPtr)dixLookupPrivate(&pPixmap->devPrivates,
+ shmPixmapPrivateKey);
+ if (shmdesc)
+ ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id);
+
pScreen->DestroyPixmap = screen_priv->destroyPixmap;
- ret = (*pScreen->DestroyPixmap) (pPixmap);
+ (*pScreen->DestroyPixmap) (pPixmap);
screen_priv->destroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = ShmDestroyPixmap;
- return ret;
}
void
@@ -512,7 +507,7 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
else
(void)(*pGC->ops->CopyArea)(&pPixmap->drawable, dst, pGC, 0, 0, sw, sh,
dx, dy);
- (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(pPixmap);
}
}
@@ -1021,7 +1016,7 @@ fbShmCreatePixmap (ScreenPtr pScreen,
if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
BitsPerPixel(depth), PixmapBytePad(width, depth), (pointer)addr)) {
- (*pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(pPixmap);
return NullPixmap;
}
return pPixmap;
@@ -1094,7 +1089,7 @@ CreatePmap:
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
pMap, RT_NONE, NULL, DixCreateAccess);
if (rc != Success) {
- pDraw->pScreen->DestroyPixmap(pMap);
+ ReleasePixmap(pMap);
return rc;
}
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index d21a56c3e..0f12ec4b5 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -129,7 +129,7 @@ static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *);
static Bool CreateResourceTypes(void);
static Bool XvCloseScreen(int, ScreenPtr);
-static Bool XvDestroyPixmap(PixmapPtr);
+static void XvDestroyPixmap(PixmapPtr);
static Bool XvDestroyWindow(WindowPtr);
static void XvResetProc(ExtensionEntry*);
static int XvdiDestroyGrab(pointer, XID);
@@ -341,10 +341,9 @@ XvGetRTPort(void)
return XvRTPort;
}
-static Bool
+static void
XvDestroyPixmap(PixmapPtr pPix)
{
- Bool status;
ScreenPtr pScreen;
XvScreenPtr pxvs;
XvAdaptorPtr pa;
@@ -384,12 +383,9 @@ XvDestroyPixmap(PixmapPtr pPix)
pa++;
}
- status = (* pScreen->DestroyPixmap)(pPix);
+ (* pScreen->DestroyPixmap)(pPix);
SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
-
- return status;
-
}
static Bool
diff --git a/composite/compalloc.c b/composite/compalloc.c
index 9857a92b2..48bc47cb6 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -327,7 +327,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
if (pPixmap) {
compRestoreWindow (pWin, pPixmap);
- (*pScreen->DestroyPixmap) (pPixmap);
+ ReleasePixmap (pPixmap);
}
}
diff --git a/composite/compwindow.c b/composite/compwindow.c
index d2a866d6f..7c8b4b4e2 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -169,7 +169,7 @@ compCheckRedirect (WindowPtr pWin)
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
compSetParentPixmap (pWin);
compRestoreWindow (pWin, pPixmap);
- (*pScreen->DestroyPixmap) (pPixmap);
+ ReleasePixmap (pPixmap);
}
} else if (should) {
if (cw->update == CompositeRedirectAutomatic)
@@ -360,13 +360,12 @@ compImplicitRedirect (WindowPtr pWin, WindowPtr pParent)
static void compFreeOldPixmap(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
if (pWin->redirectDraw != RedirectDrawNone)
{
CompWindowPtr cw = GetCompWindow (pWin);
if (cw->pOldPixmap)
{
- (*pScreen->DestroyPixmap) (cw->pOldPixmap);
+ ReleasePixmap(cw->pOldPixmap);
cw->pOldPixmap = NullPixmap;
}
}
@@ -596,7 +595,7 @@ compDestroyWindow (WindowPtr pWin)
if (pWin->redirectDraw != RedirectDrawNone) {
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
compSetParentPixmap (pWin);
- (*pScreen->DestroyPixmap) (pPixmap);
+ ReleasePixmap (pPixmap);
}
ret = (*pScreen->DestroyWindow) (pWin);
cs->DestroyWindow = pScreen->DestroyWindow;
diff --git a/dbe/midbe.c b/dbe/midbe.c
index b43ac1b3d..97034bc23 100644
--- a/dbe/midbe.c
+++ b/dbe/midbe.c
@@ -184,7 +184,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
pDbeWindowPriv->height,
pWin->drawable.depth, 0)))
{
- (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer);
+ ReleasePixmap(pDbeWindowPrivPriv->pFrontBuffer);
return BadAlloc;
}
@@ -478,15 +478,9 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
/* Destroy the front and back pixmaps. */
if (pDbeWindowPrivPriv->pFrontBuffer)
- {
- (*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)(
- pDbeWindowPrivPriv->pFrontBuffer);
- }
+ ReleasePixmap(pDbeWindowPrivPriv->pFrontBuffer);
if (pDbeWindowPrivPriv->pBackBuffer)
- {
- (*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)(
- pDbeWindowPrivPriv->pBackBuffer);
- }
+ ReleasePixmap(pDbeWindowPrivPriv->pBackBuffer);
} /* miDbeWinPrivDelete() */
@@ -652,14 +646,10 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
/* We failed at creating 1 or 2 of the pixmaps. */
if (pFrontBuffer)
- {
- (*pScreen->DestroyPixmap)(pFrontBuffer);
- }
+ ReleasePixmap(pFrontBuffer);
if (pBackBuffer)
- {
- (*pScreen->DestroyPixmap)(pBackBuffer);
- }
+ ReleasePixmap(pBackBuffer);
/* Destroy all buffers for this window. */
while (pDbeWindowPriv)
@@ -719,8 +709,8 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
* pixmaps.
*/
- (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer);
- (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pBackBuffer);
+ ReleasePixmap(pDbeWindowPrivPriv->pFrontBuffer);
+ ReleasePixmap(pDbeWindowPrivPriv->pBackBuffer);
pDbeWindowPrivPriv->pFrontBuffer = pFrontBuffer;
pDbeWindowPrivPriv->pBackBuffer = pBackBuffer;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 048dff652..a4faf537f 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1352,8 +1352,8 @@ ProcListFontsWithInfo(ClientPtr client)
int
dixDestroyPixmap(pointer value, XID pid)
{
- PixmapPtr pPixmap = (PixmapPtr)value;
- return (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(value);
+ return TRUE;
}
int
@@ -1417,7 +1417,7 @@ CreatePmap:
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
pMap, RT_NONE, NULL, DixCreateAccess);
if (rc != Success) {
- (*pDraw->pScreen->DestroyPixmap)(pMap);
+ ReleasePixmap(pMap);
return rc;
}
if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
diff --git a/dix/gc.c b/dix/gc.c
index d33f93495..78d71e91f 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -258,7 +258,7 @@ ChangeGC(ClientPtr client, GC *pGC, BITS32 mask, ChangeGCValPtr pUnion)
{
pPixmap->refcnt++;
if (!pGC->tileIsPixel)
- (* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap);
+ ReleasePixmap(pGC->tile.pixmap);
pGC->tileIsPixel = FALSE;
pGC->tile.pixmap = pPixmap;
}
@@ -274,7 +274,7 @@ ChangeGC(ClientPtr client, GC *pGC, BITS32 mask, ChangeGCValPtr pUnion)
{
pPixmap->refcnt++;
if (pGC->stipple)
- (* pGC->pScreen->DestroyPixmap)(pGC->stipple);
+ ReleasePixmap(pGC->stipple);
pGC->stipple = pPixmap;
}
break;
@@ -582,7 +582,7 @@ CreateDefaultTile (GCPtr pGC)
if (!pTile || !pgcScratch)
{
if (pTile)
- (*pTile->drawable.pScreen->DestroyPixmap)(pTile);
+ ReleasePixmap(pTile);
if (pgcScratch)
FreeScratchGC(pgcScratch);
return FALSE;
@@ -663,7 +663,7 @@ CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask)
break;
}
if (!pgcDst->tileIsPixel)
- (* pgcDst->pScreen->DestroyPixmap)(pgcDst->tile.pixmap);
+ ReleasePixmap(pgcDst->tile.pixmap);
pgcDst->tileIsPixel = pgcSrc->tileIsPixel;
pgcDst->tile = pgcSrc->tile;
if (!pgcDst->tileIsPixel)
@@ -675,7 +675,7 @@ CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask)
if (pgcDst->stipple == pgcSrc->stipple)
break;
if (pgcDst->stipple)
- (* pgcDst->pScreen->DestroyPixmap)(pgcDst->stipple);
+ ReleasePixmap(pgcDst->stipple);
pgcDst->stipple = pgcSrc->stipple;
if (pgcDst->stipple)
pgcDst->stipple->refcnt ++;
@@ -775,9 +775,9 @@ FreeGC(pointer value, XID gid)
DestroyClip(pGC);
if (!pGC->tileIsPixel)
- (* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap);
+ ReleasePixmap(pGC->tile.pixmap);
if (pGC->stipple)
- (* pGC->pScreen->DestroyPixmap)(pGC->stipple);
+ ReleasePixmap(pGC->stipple);
(*pGC->funcs->DestroyGC) (pGC);
if (pGC->dash != DefaultDash)
@@ -925,7 +925,7 @@ CreateDefaultStipple(int screenNum)
pgcScratch = GetScratchGC(1, pScreen);
if (!pgcScratch)
{
- (*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]);
+ ReleasePixmap(pScreen->PixmapPerDepth[0]);
return FALSE;
}
(void)ChangeGC(NullClient, pgcScratch, GCFunction|GCForeground|GCFillStyle, tmpval);
@@ -944,7 +944,7 @@ void
FreeDefaultStipple(int screenNum)
{
ScreenPtr pScreen = screenInfo.screens[screenNum];
- (*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]);
+ ReleasePixmap(pScreen->PixmapPerDepth[0]);
}
int
@@ -1099,7 +1099,7 @@ ChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
{
/* convert the pixmap to a region */
pGC->clientClip = BitmapToRegion(pGC->pScreen, (PixmapPtr) pvalue);
- (*pGC->pScreen->DestroyPixmap) (pvalue);
+ ReleasePixmap(pvalue);
}
else if (type == CT_REGION)
{
diff --git a/dix/glyphcurs.c b/dix/glyphcurs.c
index fa2aeca26..71e7286e3 100644
--- a/dix/glyphcurs.c
+++ b/dix/glyphcurs.c
@@ -102,7 +102,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned cha
if (!ppix || !pGC)
{
if (ppix)
- (*pScreen->DestroyPixmap)(ppix);
+ ReleasePixmap(ppix);
if (pGC)
FreeScratchGC(pGC);
free(pbits);
@@ -132,7 +132,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned cha
XYPixmap, 1, pbits);
*ppbits = (unsigned char *)pbits;
FreeScratchGC(pGC);
- (*pScreen->DestroyPixmap)(ppix);
+ ReleasePixmap(ppix);
return Success;
}
diff --git a/dix/pixmap.c b/dix/pixmap.c
index cbb5e7f99..9c04560da 100644
--- a/dix/pixmap.c
+++ b/dix/pixmap.c
@@ -65,7 +65,7 @@ GetScratchPixmapHeader(ScreenPtr pScreen, int width, int height, int depth,
if ((*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
bitsPerPixel, devKind, pPixData))
return pPixmap;
- (*pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(pPixmap);
}
return NullPixmap;
}
@@ -81,7 +81,7 @@ FreeScratchPixmapHeader(PixmapPtr pPixmap)
pPixmap->devPrivate.ptr = NULL; /* lest ddx chases bad ptr */
if (pScreen->pScratchPixmap)
- (*pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(pPixmap);
else
pScreen->pScratchPixmap = pPixmap;
}
@@ -130,8 +130,11 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
/* callable by ddx */
void
-FreePixmap(PixmapPtr pPixmap)
+ReleasePixmap(PixmapPtr pPixmap)
{
+ if(--pPixmap->refcnt)
+ return;
+ (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
dixFiniPrivates(pPixmap, PRIVATE_PIXMAP);
free(pPixmap);
}
diff --git a/dix/window.c b/dix/window.c
index 1953f025b..77d99c0cc 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -932,9 +932,9 @@ FreeWindowResources(WindowPtr pWin)
if (wInputShape (pWin))
RegionDestroy(wInputShape (pWin));
if (pWin->borderIsPixel == FALSE)
- (*pScreen->DestroyPixmap)(pWin->border.pixmap);
+ ReleasePixmap(pWin->border.pixmap);
if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ ReleasePixmap(pWin->background.pixmap);
DeleteAllWindowProperties(pWin);
/* We SHOULD check for an error value here XXX */
@@ -1125,7 +1125,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
if (pixID == None)
{
if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ ReleasePixmap(pWin->background.pixmap);
if (!pWin->parent)
SetRootWindowBackground(pWin, pScreen, &index2);
else {
@@ -1142,7 +1142,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
goto PatchUp;
}
if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ ReleasePixmap(pWin->background.pixmap);
if (!pWin->parent)
SetRootWindowBackground(pWin, pScreen, &index2);
else
@@ -1164,7 +1164,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
goto PatchUp;
}
if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ ReleasePixmap(pWin->background.pixmap);
pWin->backgroundState = BackgroundPixmap;
pWin->background.pixmap = pPixmap;
pPixmap->refcnt++;
@@ -1181,7 +1181,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
if (pWin->backgroundState == ParentRelative)
borderRelative = TRUE;
if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ ReleasePixmap(pWin->background.pixmap);
pWin->backgroundState = BackgroundPixel;
pWin->background.pixel = (CARD32 ) *pVlist;
/* background pixel overrides background pixmap,
@@ -1202,7 +1202,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
}
if (pWin->parent->borderIsPixel == TRUE) {
if (pWin->borderIsPixel == FALSE)
- (*pScreen->DestroyPixmap)(pWin->border.pixmap);
+ ReleasePixmap(pWin->border.pixmap);
pWin->border = pWin->parent->border;
pWin->borderIsPixel = TRUE;
index2 = CWBorderPixel;
@@ -1224,7 +1224,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
goto PatchUp;
}
if (pWin->borderIsPixel == FALSE)
- (*pScreen->DestroyPixmap)(pWin->border.pixmap);
+ ReleasePixmap(pWin->border.pixmap);
pWin->borderIsPixel = FALSE;
pWin->border.pixmap = pPixmap;
pPixmap->refcnt++;
@@ -1238,7 +1238,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
break;
case CWBorderPixel:
if (pWin->borderIsPixel == FALSE)
- (*pScreen->DestroyPixmap)(pWin->border.pixmap);
+ ReleasePixmap(pWin->border.pixmap);
pWin->borderIsPixel = TRUE;
pWin->border.pixel = (CARD32) *pVlist;
/* border pixel overrides border pixmap,
diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml
index 1bd36971c..38bf4efb9 100644
--- a/doc/Xserver-spec.xml
+++ b/doc/Xserver-spec.xml
@@ -3084,15 +3084,15 @@ See Xserver/fb/fbpixmap.c for the sample server implementation.</para>
<para>
<blockquote><programlisting>
- Bool pScreen->DestroyPixmap(pPixmap)
+ void pScreen->DestroyPixmap(pPixmap)
PixmapPtr pPixmap;
</programlisting></blockquote>
-This ScreenRec procedure must "destroy" a pixmap.
-It should decrement the reference count and, if zero, it
-must deallocate the PixmapRec and all attached devPrivate blocks.
-If successful, it returns TRUE.
-See Xserver/fb/fbpixmap.c for the sample server implementation.</para>
+This ScreenRec procedure must "destroy" a pixmap. It must clean up
+screen private data. It will only be called when the pixmap's reference
+count has dropped to zero, and after the screen hooks return the pixmap
+will be free'd. See Xserver/fb/fbpixmap.c for the sample server
+implementation.</para>
<para>
<blockquote><programlisting>
diff --git a/exa/exa_classic.c b/exa/exa_classic.c
index 919b29df2..33b759944 100644
--- a/exa/exa_classic.c
+++ b/exa/exa_classic.c
@@ -98,7 +98,7 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
if (pExaPixmap->fb_pitch > 131071) {
swap(pExaScr, pScreen, DestroyPixmap);
- pScreen->DestroyPixmap (pPixmap);
+ ReleasePixmap(pPixmap);
swap(pExaScr, pScreen, DestroyPixmap);
return NULL;
}
@@ -110,7 +110,7 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
if (pExaPixmap->pDamage == NULL) {
swap(pExaScr, pScreen, DestroyPixmap);
- pScreen->DestroyPixmap (pPixmap);
+ ReleasePixmap(pPixmap);
swap(pExaScr, pScreen, DestroyPixmap);
return NULL;
}
@@ -210,40 +210,33 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int dept
return ret;
}
-Bool
+void
exaDestroyPixmap_classic (PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaScreenPriv(pScreen);
- Bool ret;
+ ExaPixmapPriv(pPixmap);
+
+ exaDestroyPixmap(pPixmap);
- if (pPixmap->refcnt == 1)
+ if (pExaPixmap->area)
{
- ExaPixmapPriv (pPixmap);
-
- exaDestroyPixmap(pPixmap);
-
- if (pExaPixmap->area)
- {
- DBG_PIXMAP(("-- 0x%p (0x%x) (%dx%d)\n",
- (void*)pPixmap->drawable.id,
- ExaGetPixmapPriv(pPixmap)->area->offset,
- pPixmap->drawable.width,
- pPixmap->drawable.height));
- /* Free the offscreen area */
- exaOffscreenFree (pPixmap->drawable.pScreen, pExaPixmap->area);
- pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
- pPixmap->devKind = pExaPixmap->sys_pitch;
- }
- RegionUninit(&pExaPixmap->validSys);
- RegionUninit(&pExaPixmap->validFB);
+ DBG_PIXMAP(("-- 0x%p (0x%x) (%dx%d)\n",
+ (void*)pPixmap->drawable.id,
+ ExaGetPixmapPriv(pPixmap)->area->offset,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height));
+ /* Free the offscreen area */
+ exaOffscreenFree (pPixmap->drawable.pScreen, pExaPixmap->area);
+ pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
+ pPixmap->devKind = pExaPixmap->sys_pitch;
}
+ RegionUninit(&pExaPixmap->validSys);
+ RegionUninit(&pExaPixmap->validFB);
swap(pExaScr, pScreen, DestroyPixmap);
- ret = pScreen->DestroyPixmap (pPixmap);
+ pScreen->DestroyPixmap (pPixmap);
swap(pExaScr, pScreen, DestroyPixmap);
-
- return ret;
}
Bool
diff --git a/exa/exa_driver.c b/exa/exa_driver.c
index 795cb00cd..34de8257c 100644
--- a/exa/exa_driver.c
+++ b/exa/exa_driver.c
@@ -96,7 +96,7 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
if (!pExaPixmap->driverPriv) {
swap(pExaScr, pScreen, DestroyPixmap);
- pScreen->DestroyPixmap (pPixmap);
+ ReleasePixmap(pPixmap);
swap(pExaScr, pScreen, DestroyPixmap);
return NULL;
}
@@ -184,29 +184,22 @@ out:
return ret;
}
-Bool
+void
exaDestroyPixmap_driver (PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaScreenPriv(pScreen);
- Bool ret;
+ ExaPixmapPriv(pPixmap);
- if (pPixmap->refcnt == 1)
- {
- ExaPixmapPriv (pPixmap);
+ exaDestroyPixmap(pPixmap);
- exaDestroyPixmap(pPixmap);
-
- if (pExaPixmap->driverPriv)
- pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
- pExaPixmap->driverPriv = NULL;
- }
+ if (pExaPixmap->driverPriv)
+ pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
+ pExaPixmap->driverPriv = NULL;
swap(pExaScr, pScreen, DestroyPixmap);
- ret = pScreen->DestroyPixmap (pPixmap);
+ pScreen->DestroyPixmap (pPixmap);
swap(pExaScr, pScreen, DestroyPixmap);
-
- return ret;
}
Bool
diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index 5c46ec901..63017434f 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -194,7 +194,7 @@ exaRealizeGlyphCaches(ScreenPtr pScreen,
CPComponentAlpha, &component_alpha, serverClient,
&error);
- (*pScreen->DestroyPixmap) (pPixmap); /* picture holds a refcount */
+ ReleasePixmap(pPixmap); /* picture holds a refcount */
if (!pPicture)
return FALSE;
@@ -749,7 +749,7 @@ exaGlyphs (CARD8 op,
{
PictFormatPtr argbFormat;
- (*pScreen->DestroyPixmap) (pMaskPixmap);
+ ReleasePixmap(pMaskPixmap);
if (!pMask)
return;
@@ -772,7 +772,7 @@ exaGlyphs (CARD8 op,
pMask = CreatePicture (0, &pMaskPixmap->drawable, maskFormat, 0, 0,
serverClient, &error);
if (!pMask) {
- (*pScreen->DestroyPixmap) (pMaskPixmap);
+ ReleasePixmap(pMaskPixmap);
return;
}
}
@@ -858,6 +858,6 @@ exaGlyphs (CARD8 op,
x, y,
width, height);
FreePicture ((pointer) pMask, (XID) 0);
- (*pScreen->DestroyPixmap) (pMaskPixmap);
+ ReleasePixmap(pMaskPixmap);
}
}
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index 0b1a4a4a4..e853ac911 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -238,38 +238,31 @@ out:
return ret;
}
-Bool
+void
exaDestroyPixmap_mixed(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaScreenPriv(pScreen);
- Bool ret;
-
- if (pPixmap->refcnt == 1)
- {
- ExaPixmapPriv (pPixmap);
+ ExaPixmapPriv(pPixmap);
- exaDestroyPixmap(pPixmap);
+ exaDestroyPixmap(pPixmap);
- if (pExaScr->deferred_mixed_pixmap == pPixmap)
- pExaScr->deferred_mixed_pixmap = NULL;
+ if (pExaScr->deferred_mixed_pixmap == pPixmap)
+ pExaScr->deferred_mixed_pixmap = NULL;
- if (pExaPixmap->driverPriv)
- pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
- pExaPixmap->driverPriv = NULL;
+ if (pExaPixmap->driverPriv)
+ pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
+ pExaPixmap->driverPriv = NULL;
- if (pExaPixmap->pDamage) {
- free(pExaPixmap->sys_ptr);
- pExaPixmap->sys_ptr = NULL;
- pExaPixmap->pDamage = NULL;
- }
+ if (pExaPixmap->pDamage) {
+ free(pExaPixmap->sys_ptr);
+ pExaPixmap->sys_ptr = NULL;
+ pExaPixmap->pDamage = NULL;
}
swap(pExaScr, pScreen, DestroyPixmap);
- ret = pScreen->DestroyPixmap (pPixmap);
+ pScreen->DestroyPixmap (pPixmap);
swap(pExaScr, pScreen, DestroyPixmap);
-
- return ret;
}
Bool
diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c
index 5abe3b891..1245d136b 100644
--- a/exa/exa_offscreen.c
+++ b/exa/exa_offscreen.c
@@ -632,7 +632,7 @@ ExaOffscreenDefragment (ScreenPtr pScreen)
pDstPix->drawable.depth = 0;
pDstPix->drawable.bitsPerPixel = 0;
- (*pScreen->DestroyPixmap) (pDstPix);
+ ReleasePixmap(pDstPix);
if (area->state == ExaOffscreenAvail && area->size > largest_size)
return area;
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 64b2671e7..38ac4aa27 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -593,7 +593,7 @@ Bool
exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, pointer pPixData);
-Bool
+void
exaDestroyPixmap_classic (PixmapPtr pPixmap);
Bool
@@ -608,7 +608,7 @@ Bool
exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, pointer pPixData);
-Bool
+void
exaDestroyPixmap_driver (PixmapPtr pPixmap);
Bool
@@ -623,7 +623,7 @@ Bool
exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, pointer pPixData);
-Bool
+void
exaDestroyPixmap_mixed(PixmapPtr pPixmap);
Bool
diff --git a/exa/exa_render.c b/exa/exa_render.c
index 3974afe87..881d46440 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -1112,7 +1112,7 @@ exaCreateAlphaPicture (ScreenPtr pScreen,
pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
if (!pGC)
{
- (*pScreen->DestroyPixmap) (pPixmap);
+ ReleasePixmap(pPixmap);
return 0;
}
ValidateGC (&pPixmap->drawable, pGC);
@@ -1125,7 +1125,7 @@ exaCreateAlphaPicture (ScreenPtr pScreen,
FreeScratchGC (pGC);
pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
0, 0, serverClient, &error);
- (*pScreen->DestroyPixmap) (pPixmap);
+ ReleasePixmap(pPixmap);
return pPicture;
}
diff --git a/fb/fb.h b/fb/fb.h
index eaa21ad75..35fdb6561 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1603,7 +1603,7 @@ extern _X_EXPORT PixmapPtr
fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
unsigned usage_hint);
-extern _X_EXPORT Bool
+extern _X_EXPORT void
fbDestroyPixmap (PixmapPtr pPixmap);
extern _X_EXPORT RegionPtr
diff --git a/fb/fbgc.c b/fb/fbgc.c
index aa75d7a00..bc381d8f4 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -210,7 +210,7 @@ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
}
if ((changes & GCTile) && fbGetRotatedPixmap(pGC))
{
- (*pGC->pScreen->DestroyPixmap) (fbGetRotatedPixmap(pGC));
+ ReleasePixmap(fbGetRotatedPixmap(pGC));
fbGetRotatedPixmap(pGC) = 0;
}
@@ -225,7 +225,7 @@ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
if (!pNewTile || pNewTile ->drawable.bitsPerPixel != pDrawable->bitsPerPixel)
{
if (pNewTile)
- (*pGC->pScreen->DestroyPixmap) (pNewTile);
+ ReleasePixmap(pNewTile);
pNewTile = fb24_32ReformatTile (pOldTile, pDrawable->bitsPerPixel);
}
if (pNewTile)
diff --git a/fb/fboverlay.c b/fb/fboverlay.c
index 255cc23c1..ce7de2e48 100644
--- a/fb/fboverlay.c
+++ b/fb/fboverlay.c
@@ -89,7 +89,7 @@ fbOverlayCloseScreen (int iScreen, ScreenPtr pScreen)
for (i = 0; i < pScrPriv->nlayers; i++)
{
- (*pScreen->DestroyPixmap)(pScrPriv->layer[i].u.run.pixmap);
+ ReleasePixmap(pScrPriv->layer[i].u.run.pixmap);
RegionUninit(&pScrPriv->layer[i].u.run.region);
}
return TRUE;
diff --git a/fb/fbpixmap.c b/fb/fbpixmap.c
index a356c67b6..4045ee065 100644
--- a/fb/fbpixmap.c
+++ b/fb/fbpixmap.c
@@ -94,13 +94,9 @@ fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
return fbCreatePixmapBpp (pScreen, width, height, depth, bpp, usage_hint);
}
-Bool
+void
fbDestroyPixmap (PixmapPtr pPixmap)
{
- if(--pPixmap->refcnt)
- return TRUE;
- FreePixmap(pPixmap);
- return TRUE;
}
#define ADDRECT(reg,r,fr,rx1,ry1,rx2,ry2) \
diff --git a/fb/fbwindow.c b/fb/fbwindow.c
index 7906f8dd2..367e79458 100644
--- a/fb/fbwindow.c
+++ b/fb/fbwindow.c
@@ -156,7 +156,7 @@ fbFixupWindowPixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap)
pPixmap = fb24_32ReformatTile (pPixmap, pDrawable->bitsPerPixel);
if (!pPixmap)
return;
- (*pDrawable->pScreen->DestroyPixmap) (*ppPixmap);
+ ReleasePixmap(*ppPixmap);
*ppPixmap = pPixmap;
}
if (FbEvenTile (pPixmap->drawable.width *
diff --git a/hw/dmx/dmxpixmap.c b/hw/dmx/dmxpixmap.c
index 81b71151a..19f3ac7cb 100644
--- a/hw/dmx/dmxpixmap.c
+++ b/hw/dmx/dmxpixmap.c
@@ -151,19 +151,15 @@ Bool dmxBEFreePixmap(PixmapPtr pPixmap)
}
/** Destroy the pixmap pointed to by \a pPixmap. */
-Bool dmxDestroyPixmap(PixmapPtr pPixmap)
+void dmxDestroyPixmap(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
#if 0
DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen);
#endif
- if (--pPixmap->refcnt)
- return TRUE;
-
/* Destroy pixmap on back-end server */
if (dmxScreen->beDisplay) {
if (dmxBEFreePixmap(pPixmap)) {
@@ -174,15 +170,12 @@ Bool dmxDestroyPixmap(PixmapPtr pPixmap)
dmxSync(dmxScreen, FALSE);
}
}
- FreePixmap(pPixmap);
#if 0
if (pScreen->DestroyPixmap)
- ret = pScreen->DestroyPixmap(pPixmap);
+ pScreen->DestroyPixmap(pPixmap);
DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen);
#endif
-
- return ret;
}
/** Create and return a region based on the pixmap pointed to by \a
diff --git a/hw/dmx/dmxpixmap.h b/hw/dmx/dmxpixmap.h
index 59da788b3..0bb19c3ea 100644
--- a/hw/dmx/dmxpixmap.h
+++ b/hw/dmx/dmxpixmap.h
@@ -51,7 +51,7 @@ extern Bool dmxInitPixmap(ScreenPtr pScreen);
extern PixmapPtr dmxCreatePixmap(ScreenPtr pScreen,
int width, int height, int depth,
unsigned usage_hint);
-extern Bool dmxDestroyPixmap(PixmapPtr pPixmap);
+extern void dmxDestroyPixmap(PixmapPtr pPixmap);
extern RegionPtr dmxBitmapToRegion(PixmapPtr pPixmap);
extern void dmxBECreatePixmap(PixmapPtr pPixmap);
diff --git a/hw/dmx/glxProxy/glxext.c b/hw/dmx/glxProxy/glxext.c
index 7f63b6b0b..0ebbaf87f 100644
--- a/hw/dmx/glxProxy/glxext.c
+++ b/hw/dmx/glxProxy/glxext.c
@@ -163,10 +163,10 @@ void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap )
PixmapPtr pPixmap = (PixmapPtr) pGlxPixmap->pDraw;
/*
- ** The DestroyPixmap routine should decrement the refcount and free
+ ** The ReleasePixmap routine decrements the refcount and frees
** only if it's zero.
*/
- (*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(pPixmap);
free(pGlxPixmap->be_xids);
free(pGlxPixmap);
}
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 0c958cdf3..58bc85cd8 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -363,7 +363,7 @@ xf86SetDGAMode(
if(oldPix->drawable.id)
FreeResource(oldPix->drawable.id, RT_NONE);
else
- (*pScreen->DestroyPixmap)(oldPix);
+ ReleasePixmap(oldPix);
}
free(pScreenPriv->current);
pScreenPriv->current = NULL;
@@ -424,7 +424,7 @@ xf86SetDGAMode(
if(oldPix->drawable.id)
FreeResource(oldPix->drawable.id, RT_NONE);
else
- (*pScreen->DestroyPixmap)(oldPix);
+ ReleasePixmap(oldPix);
}
free(pScreenPriv->current);
pScreenPriv->current = NULL;
diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c
index 11443a60e..d70906883 100644
--- a/hw/xfree86/xaa/xaaInit.c
+++ b/hw/xfree86/xaa/xaaInit.c
@@ -35,7 +35,7 @@ static void XAAGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
int *pwidth, int nspans, char *pdstStart);
static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
unsigned usage_hint);
-static Bool XAADestroyPixmap(PixmapPtr pPixmap);
+static void XAADestroyPixmap(PixmapPtr pPixmap);
static Bool XAAEnterVT (int index, int flags);
static void XAALeaveVT (int index, int flags);
static int XAASetDGAMode(int index, int num, DGADevicePtr devRet);
@@ -307,7 +307,7 @@ XAAPixmapBPP (ScreenPtr pScreen, int depth)
bpp = pPix->drawable.bitsPerPixel;
destroyPixmap = pScreen->DestroyPixmap;
XAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap);
- (*pScreen->DestroyPixmap) (pPix);
+ ReleasePixmap(pPix);
XAA_SCREEN_EPILOGUE (pScreen, DestroyPixmap, destroyPixmap);
return bpp;
}
@@ -426,50 +426,45 @@ BAILOUT:
return pPix;
}
-static Bool
+static void
XAADestroyPixmap(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- Bool ret;
- if(pPix->refcnt == 1) {
- if(pPriv->flags & OFFSCREEN) {
- if(pPriv->flags & DGA_PIXMAP)
- free(pPriv->offscreenArea);
- else {
- FBAreaPtr area = pPriv->offscreenArea;
- PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
- PixmapLinkPtr prev = NULL;
-
- while(pLink->pPix != pPix) {
- prev = pLink;
- pLink = pLink->next;
- }
-
- if(prev) prev->next = pLink->next;
- else infoRec->OffscreenPixmaps = pLink->next;
-
- if(!area) area = pLink->area;
-
- xf86FreeOffscreenArea(area);
- pPriv->offscreenArea = NULL;
- free(pLink);
- }
+ if(pPriv->flags & OFFSCREEN) {
+ if(pPriv->flags & DGA_PIXMAP)
+ free(pPriv->offscreenArea);
+ else {
+ FBAreaPtr area = pPriv->offscreenArea;
+ PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
+ PixmapLinkPtr prev = NULL;
+
+ while(pLink->pPix != pPix) {
+ prev = pLink;
+ pLink = pLink->next;
+ }
+
+ if(prev) prev->next = pLink->next;
+ else infoRec->OffscreenPixmaps = pLink->next;
+
+ if(!area) area = pLink->area;
+
+ xf86FreeOffscreenArea(area);
+ pPriv->offscreenArea = NULL;
+ free(pLink);
}
+ }
- if(pPriv->freeData) { /* pixmaps that were once in video ram */
- free(pPix->devPrivate.ptr);
- pPix->devPrivate.ptr = NULL;
- }
+ if(pPriv->freeData) { /* pixmaps that were once in video ram */
+ free(pPix->devPrivate.ptr);
+ pPix->devPrivate.ptr = NULL;
}
XAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap);
- ret = (*pScreen->DestroyPixmap) (pPix);
+ (*pScreen->DestroyPixmap) (pPix);
XAA_SCREEN_EPILOGUE (pScreen, DestroyPixmap, XAADestroyPixmap);
-
- return ret;
}
static Bool
diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c
index eccf56986..735f75408 100644
--- a/hw/xnest/Pixmap.c
+++ b/hw/xnest/Pixmap.c
@@ -68,14 +68,10 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
return pPixmap;
}
-Bool
+void
xnestDestroyPixmap(PixmapPtr pPixmap)
{
- if(--pPixmap->refcnt)
- return TRUE;
XFreePixmap(xnestDisplay, xnestPixmap(pPixmap));
- FreePixmap(pPixmap);
- return TRUE;
}
RegionPtr
diff --git a/hw/xnest/XNPixmap.h b/hw/xnest/XNPixmap.h
index aa671ed1f..5816cef29 100644
--- a/hw/xnest/XNPixmap.h
+++ b/hw/xnest/XNPixmap.h
@@ -31,7 +31,7 @@ typedef struct {
PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height,
int depth, unsigned usage_hint);
-Bool xnestDestroyPixmap(PixmapPtr pPixmap);
+void xnestDestroyPixmap(PixmapPtr pPixmap);
RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap);
#endif /* XNESTPIXMAP_H */
diff --git a/include/pixmap.h b/include/pixmap.h
index 014a11183..07b1849b6 100644
--- a/include/pixmap.h
+++ b/include/pixmap.h
@@ -113,7 +113,7 @@ extern _X_EXPORT PixmapPtr AllocatePixmap(
ScreenPtr /*pScreen*/,
int /*pixDataSize*/);
-extern _X_EXPORT void FreePixmap(
+extern _X_EXPORT void ReleasePixmap(
PixmapPtr /*pPixmap*/);
#endif /* PIXMAP_H */
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 132a67193..6f91f46c1 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -210,7 +210,7 @@ typedef PixmapPtr (* CreatePixmapProcPtr)(
int /*depth*/,
unsigned /*usage_hint*/);
-typedef Bool (* DestroyPixmapProcPtr)(
+typedef void (* DestroyPixmapProcPtr)(
PixmapPtr /*pPixmap*/);
typedef Bool (* RealizeFontProcPtr)(
diff --git a/mi/miarc.c b/mi/miarc.c
index cd870fa39..b9260a079 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -1073,7 +1073,7 @@ miPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
if (!polyArcs)
{
if (fTricky) {
- (*pDraw->pScreen->DestroyPixmap) ((PixmapPtr)pDrawTo);
+ ReleasePixmap ((PixmapPtr)pDrawTo);
FreeScratchGC (pGCTo);
}
return;
@@ -1164,7 +1164,7 @@ miPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
if(fTricky)
{
- (*pGCTo->pScreen->DestroyPixmap)((PixmapPtr)pDrawTo);
+ ReleasePixmap((PixmapPtr)pDrawTo);
FreeScratchGC(pGCTo);
}
}
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index d701e0e9e..ab567443b 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -418,7 +418,7 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
pGCT = GetScratchGC(1, pDraw->pScreen);
if (!pGCT)
{
- (*pDraw->pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(pPixmap);
return;
}
/* First set the whole pixmap to 0 */
@@ -528,7 +528,7 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
ValidateGC(pDraw, pGC);
FreeScratchGC(pGCT);
- (*pDraw->pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(pPixmap);
}
@@ -700,7 +700,7 @@ miGetImage( DrawablePtr pDraw, int sx, int sy, int w, int h,
}
if (pPixmap)
{
- (*pGC->pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(pPixmap);
FreeScratchGC(pGC);
}
}
diff --git a/mi/midispcur.c b/mi/midispcur.c
index 32c5c9df6..bf812bf47 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -221,7 +221,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
pGC = GetScratchGC (32, pScreen);
if (!pGC)
{
- (*pScreen->DestroyPixmap) (pPixmap);
+ ReleasePixmap(pPixmap);
free((pointer) pPriv);
return NULL;
}
@@ -233,7 +233,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
FreeScratchGC (pGC);
pPriv->pPicture = CreatePicture (0, &pPixmap->drawable,
pFormat, 0, 0, serverClient, &error);
- (*pScreen->DestroyPixmap) (pPixmap);
+ ReleasePixmap(pPixmap);
if (!pPriv->pPicture)
{
free((pointer) pPriv);
@@ -253,7 +253,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
pPriv->maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0);
if (!pPriv->maskBits)
{
- (*pScreen->DestroyPixmap) (pPriv->sourceBits);
+ ReleasePixmap(pPriv->sourceBits);
free((pointer) pPriv);
return NULL;
}
@@ -306,9 +306,9 @@ miDCUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
if (pPriv && (pCursor->bits->refcnt <= 1))
{
if (pPriv->sourceBits)
- (*pScreen->DestroyPixmap) (pPriv->sourceBits);
+ ReleasePixmap(pPriv->sourceBits);
if (pPriv->maskBits)
- (*pScreen->DestroyPixmap) (pPriv->maskBits);
+ ReleasePixmap(pPriv->maskBits);
#ifdef ARGB_CURSOR
if (pPriv->pPicture)
FreePicture (pPriv->pPicture, 0);
@@ -454,7 +454,7 @@ miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h)
{
if (pSave)
- (*pScreen->DestroyPixmap) (pSave);
+ ReleasePixmap(pSave);
pBuffer->pSave = pSave =
(*pScreen->CreatePixmap) (pScreen, w, h, pScreen->rootDepth, 0);
if (!pSave)
@@ -574,7 +574,7 @@ miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
* free it again here. */
#endif
- if (pBuffer->pSave) (*pScreen->DestroyPixmap)(pBuffer->pSave);
+ if (pBuffer->pSave) ReleasePixmap(pBuffer->pSave);
free(pBuffer);
dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen, NULL);
diff --git a/mi/migc.c b/mi/migc.c
index bf9cf5a06..c52fa6103 100644
--- a/mi/migc.c
+++ b/mi/migc.c
@@ -48,7 +48,7 @@ void
miDestroyGC(GCPtr pGC)
{
if (pGC->pRotatedPixmap)
- (*pGC->pScreen->DestroyPixmap) (pGC->pRotatedPixmap);
+ ReleasePixmap(pGC->pRotatedPixmap);
if (pGC->freeCompClip)
RegionDestroy(pGC->pCompositeClip);
}
diff --git a/mi/miglblt.c b/mi/miglblt.c
index 9edb500c4..220c906eb 100644
--- a/mi/miglblt.c
+++ b/mi/miglblt.c
@@ -130,7 +130,7 @@ miPolyGlyphBlt(
pGCtmp = GetScratchGC(1, pDrawable->pScreen);
if (!pGCtmp)
{
- (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(pPixmap);
return;
}
@@ -144,7 +144,7 @@ miPolyGlyphBlt(
pbits = malloc(height*nbyLine);
if (!pbits)
{
- (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(pPixmap);
FreeScratchGC(pGCtmp);
return;
}
@@ -189,7 +189,7 @@ miPolyGlyphBlt(
}
x += pci->metrics.characterWidth;
}
- (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
+ ReleasePixmap(pPixmap);
free(pbits);
FreeScratchGC(pGCtmp);
}
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index fb01c6810..0d787b7f9 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -122,7 +122,8 @@ miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
static Bool
miCloseScreen (int iScreen, ScreenPtr pScreen)
{
- return ((*pScreen->DestroyPixmap)((PixmapPtr)pScreen->devPrivate));
+ ReleasePixmap(pScreen->devPrivate);
+ return TRUE;
}
/* With the introduction of pixmap privates, the "screen pixmap" can no
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index a24b6cccc..9fba1b3d8 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -1599,28 +1599,24 @@ damageInsertDamage (DamagePtr *pPrev, DamagePtr pDamage)
*pPrev = pDamage;
}
-static Bool
+static void
damageDestroyPixmap (PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
damageScrPriv(pScreen);
+ DamagePtr *pPrev = getPixmapDamageRef (pPixmap);
+ DamagePtr pDamage;
- if (pPixmap->refcnt == 1)
+ while ((pDamage = *pPrev))
{
- DamagePtr *pPrev = getPixmapDamageRef (pPixmap);
- DamagePtr pDamage;
-
- while ((pDamage = *pPrev))
- {
- damageRemoveDamage (pPrev, pDamage);
- if (!pDamage->isWindow)
- DamageDestroy (pDamage);
- }
+ damageRemoveDamage (pPrev, pDamage);
+ if (!pDamage->isWindow)
+ DamageDestroy (pDamage);
}
+
unwrap (pScrPriv, pScreen, DestroyPixmap);
(*pScreen->DestroyPixmap) (pPixmap);
wrap (pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap);
- return TRUE;
}
static void
diff --git a/miext/shadow/shadow.c b/miext/shadow/shadow.c
index 95f11cd21..19a672628 100644
--- a/miext/shadow/shadow.c
+++ b/miext/shadow/shadow.c
@@ -106,7 +106,7 @@ shadowCloseScreen(int i, ScreenPtr pScreen)
RegionUninit(&pBuf->damage); /* bc */
#endif
if (pBuf->pPixmap)
- pScreen->DestroyPixmap(pBuf->pPixmap);
+ ReleasePixmap(pBuf->pPixmap);
free(pBuf);
return pScreen->CloseScreen(i, pScreen);
}
@@ -242,7 +242,7 @@ shadowInit(ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window)
return FALSE;
if (!shadowSetup(pScreen)) {
- pScreen->DestroyPixmap(pPixmap);
+ ReleasePixmap(pPixmap);
return FALSE;
}
diff --git a/render/glyph.c b/render/glyph.c
index 7193d4763..eae84ad19 100644
--- a/render/glyph.c
+++ b/render/glyph.c
@@ -663,7 +663,7 @@ miGlyphs (CARD8 op,
serverClient, &error);
if (!pMask)
{
- (*pScreen->DestroyPixmap) (pMaskPixmap);
+ ReleasePixmap(pMaskPixmap);
return;
}
pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen);
@@ -743,6 +743,6 @@ miGlyphs (CARD8 op,
x, y,
width, height);
FreePicture ((pointer) pMask, (XID) 0);
- (*pScreen->DestroyPixmap) (pMaskPixmap);
+ ReleasePixmap(pMaskPixmap);
}
}
diff --git a/render/mipict.c b/render/mipict.c
index 0b86bee34..99b134857 100644
--- a/render/mipict.c
+++ b/render/mipict.c
@@ -53,7 +53,7 @@ miDestroyPictureClip (PicturePtr pPicture)
case CT_NONE:
return;
case CT_PIXMAP:
- (*pPicture->pDrawable->pScreen->DestroyPixmap) ((PixmapPtr) (pPicture->clientClip));
+ ReleasePixmap((PixmapPtr) (pPicture->clientClip));
break;
default:
/*
@@ -85,7 +85,7 @@ miChangePictureClip (PicturePtr pPicture,
if (!clientClip)
return BadAlloc;
clientClipType = CT_REGION;
- (*pScreen->DestroyPixmap) ((PixmapPtr) value);
+ ReleasePixmap(value);
break;
case CT_REGION:
clientClip = value;
diff --git a/render/mirect.c b/render/mirect.c
index 73a165126..c7e12eba3 100644
--- a/render/mirect.c
+++ b/render/mirect.c
@@ -177,7 +177,7 @@ miCompositeRects (CARD8 op,
bail4:
FreeScratchGC (pGC);
bail3:
- (*pScreen->DestroyPixmap) (pPixmap);
+ ReleasePixmap(pPixmap);
bail2:
bail1:
;
diff --git a/render/picture.c b/render/picture.c
index f13459665..017d8dbe1 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1499,7 +1499,7 @@ FreePicture (pointer value,
}
else if (pPicture->pDrawable->type == DRAWABLE_PIXMAP)
{
- (*pScreen->DestroyPixmap) ((PixmapPtr)pPicture->pDrawable);
+ ReleasePixmap((PixmapPtr)pPicture->pDrawable);
}
}
dixFreeObjectWithPrivates(pPicture, PRIVATE_PICTURE);
diff --git a/render/render.c b/render/render.c
index d82e09959..f87de4373 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1174,7 +1174,7 @@ ProcRenderAddGlyphs (ClientPtr client)
/* The picture takes a reference to the pixmap, so we
drop ours. */
- (pScreen->DestroyPixmap) (pDstPix);
+ ReleasePixmap(pDstPix);
pDstPix = NULL;
if (! pDst)
@@ -1598,7 +1598,7 @@ ProcRenderCreateCursor (ClientPtr client)
free(mskbits);
return error;
}
- (*pScreen->DestroyPixmap) (pPixmap);
+ ReleasePixmap(pPixmap);
CompositePicture (PictOpSrc,
pSrc, 0, pPicture,
0, 0, 0, 0, 0, 0, width, height);