diff --git a/Xext/saver.c b/Xext/saver.c index a91bc0aed..60b250fdd 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -277,10 +277,13 @@ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask) static void FreeAttrs(ScreenSaverAttrPtr pAttr) { + PixmapPtr pPixmap; CursorPtr pCursor; - dixDestroyPixmap(pAttr->pBackgroundPixmap, 0); - dixDestroyPixmap(pAttr->pBorderPixmap, 0); + if ((pPixmap = pAttr->pBackgroundPixmap) != 0) + (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap); + if ((pPixmap = pAttr->pBorderPixmap) != 0) + (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap); if ((pCursor = pAttr->pCursor) != 0) FreeCursor(pCursor, (Cursor) 0); } diff --git a/Xext/shm.c b/Xext/shm.c index 725cafc33..5d6fd240e 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -512,7 +512,7 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC, else (void) (*pGC->ops->CopyArea) (&pPixmap->drawable, dst, pGC, 0, 0, sw, sh, dx, dy); - dixDestroyPixmap(pPixmap, 0); + (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap); } } @@ -1002,7 +1002,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client) result = XaceHookResourceAccess(client, stuff->pid, X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (result != Success) { - dixDestroyPixmap(pMap, 0); + pDraw->pScreen->DestroyPixmap(pMap); break; } dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc); @@ -1046,7 +1046,7 @@ fbShmCreatePixmap(ScreenPtr pScreen, BitsPerPixel(depth), PixmapBytePad(width, depth), (void *) addr)) { - dixDestroyPixmap(pPixmap, 0); + (*pScreen->DestroyPixmap) (pPixmap); return NullPixmap; } return pPixmap; @@ -1117,7 +1117,7 @@ ProcShmCreatePixmap(ClientPtr client) rc = XaceHookResourceAccess(client, stuff->pid, X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) { - dixDestroyPixmap(pMap, 0); + pDraw->pScreen->DestroyPixmap(pMap); return rc; } dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc); diff --git a/composite/compalloc.c b/composite/compalloc.c index 4a1243170..d1342799b 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -309,7 +309,7 @@ compFreeClientWindow(WindowPtr pWin, XID id) if (pPixmap) { compRestoreWindow(pWin, pPixmap); - dixDestroyPixmap(pPixmap, 0); + (*pScreen->DestroyPixmap) (pPixmap); } } diff --git a/composite/compwindow.c b/composite/compwindow.c index 40a742438..1970860c3 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -180,7 +180,7 @@ compCheckRedirect(WindowPtr pWin) compSetParentPixmap(pWin); compRestoreWindow(pWin, pPixmap); - dixDestroyPixmap(pPixmap, 0); + (*pScreen->DestroyPixmap) (pPixmap); } } else if (should) { @@ -378,11 +378,13 @@ 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) { - dixDestroyPixmap(cw->pOldPixmap, 0); + (*pScreen->DestroyPixmap) (cw->pOldPixmap); cw->pOldPixmap = NullPixmap; } } @@ -615,7 +617,7 @@ compDestroyWindow(WindowPtr pWin) PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); compSetParentPixmap(pWin); - dixDestroyPixmap(pPixmap, 0); + (*pScreen->DestroyPixmap) (pPixmap); } ret = (*pScreen->DestroyWindow) (pWin); cs->DestroyWindow = pScreen->DestroyWindow; diff --git a/dbe/midbe.c b/dbe/midbe.c index 3033062f8..379b7a024 100644 --- a/dbe/midbe.c +++ b/dbe/midbe.c @@ -162,7 +162,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) (*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width, pDbeWindowPriv->height, pWin->drawable.depth, 0))) { - dixDestroyPixmap(pDbeWindowPriv->pFrontBuffer, 0); + (*pScreen->DestroyPixmap) (pDbeWindowPriv->pFrontBuffer); return BadAlloc; } @@ -426,11 +426,14 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId) */ /* Destroy the front and back pixmaps. */ - if (pDbeWindowPriv->pFrontBuffer) - dixDestroyPixmap(pDbeWindowPriv->pFrontBuffer, 0); - - if (pDbeWindowPriv->pBackBuffer) - dixDestroyPixmap(pDbeWindowPriv->pBackBuffer, 0); + if (pDbeWindowPriv->pFrontBuffer) { + (*pDbeWindowPriv->pWindow->drawable.pScreen-> + DestroyPixmap) (pDbeWindowPriv->pFrontBuffer); + } + if (pDbeWindowPriv->pBackBuffer) { + (*pDbeWindowPriv->pWindow->drawable.pScreen-> + DestroyPixmap) (pDbeWindowPriv->pBackBuffer); + } } /* miDbeWinPrivDelete() */ /****************************************************************************** @@ -582,8 +585,13 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) if (!pFrontBuffer || !pBackBuffer) { /* We failed at creating 1 or 2 of the pixmaps. */ - dixDestroyPixmap(pFrontBuffer, 0); - dixDestroyPixmap(pBackBuffer, 0); + if (pFrontBuffer) { + (*pScreen->DestroyPixmap) (pFrontBuffer); + } + + if (pBackBuffer) { + (*pScreen->DestroyPixmap) (pBackBuffer); + } /* Destroy all buffers for this window. */ while (pDbeWindowPriv) { @@ -634,8 +642,8 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) * pixmaps. */ - dixDestroyPixmap(pDbeWindowPriv->pFrontBuffer, 0); - dixDestroyPixmap(pDbeWindowPriv->pBackBuffer, 0); + (*pScreen->DestroyPixmap) (pDbeWindowPriv->pFrontBuffer); + (*pScreen->DestroyPixmap) (pDbeWindowPriv->pBackBuffer); pDbeWindowPriv->pFrontBuffer = pFrontBuffer; pDbeWindowPriv->pBackBuffer = pBackBuffer; diff --git a/dix/dispatch.c b/dix/dispatch.c index 2308cfe6d..efb6818df 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1525,7 +1525,7 @@ ProcCreatePixmap(ClientPtr client) rc = XaceHookResourceAccess(client, stuff->pid, X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) { - dixDestroyPixmap(pMap, 0); + (*pDraw->pScreen->DestroyPixmap) (pMap); return rc; } if (AddResource(stuff->pid, X11_RESTYPE_PIXMAP, (void *) pMap)) diff --git a/dix/gc.c b/dix/gc.c index ab5844353..5f7535803 100644 --- a/dix/gc.c +++ b/dix/gc.c @@ -254,7 +254,7 @@ ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion) else { pPixmap->refcnt++; if (!pGC->tileIsPixel) - dixDestroyPixmap(pGC->tile.pixmap, 0); + (*pGC->pScreen->DestroyPixmap) (pGC->tile.pixmap); pGC->tileIsPixel = FALSE; pGC->tile.pixmap = pPixmap; } @@ -271,7 +271,7 @@ ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion) if (pPixmap) pPixmap->refcnt++; if (pGC->stipple) - dixDestroyPixmap(pGC->stipple, 0); + (*pGC->pScreen->DestroyPixmap) (pGC->stipple); pGC->stipple = pPixmap; } break; @@ -588,7 +588,8 @@ CreateDefaultTile(GCPtr pGC) (*pGC->pScreen->CreatePixmap) (pGC->pScreen, w, h, pGC->depth, 0); pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen); if (!pTile || !pgcScratch) { - dixDestroyPixmap(pTile, 0); + if (pTile) + (*pTile->drawable.pScreen->DestroyPixmap) (pTile); if (pgcScratch) FreeScratchGC(pgcScratch); return FALSE; @@ -667,7 +668,7 @@ CopyGC(GC * pgcSrc, GC * pgcDst, BITS32 mask) break; } if (!pgcDst->tileIsPixel) - dixDestroyPixmap(pgcDst->tile.pixmap, 0); + (*pgcDst->pScreen->DestroyPixmap) (pgcDst->tile.pixmap); pgcDst->tileIsPixel = pgcSrc->tileIsPixel; pgcDst->tile = pgcSrc->tile; if (!pgcDst->tileIsPixel) @@ -679,7 +680,7 @@ CopyGC(GC * pgcSrc, GC * pgcDst, BITS32 mask) if (pgcDst->stipple == pgcSrc->stipple) break; if (pgcDst->stipple) - dixDestroyPixmap(pgcDst->stipple, 0); + (*pgcDst->pScreen->DestroyPixmap) (pgcDst->stipple); pgcDst->stipple = pgcSrc->stipple; if (pgcDst->stipple) pgcDst->stipple->refcnt++; @@ -774,9 +775,9 @@ FreeGC(void *value, XID gid) (*pGC->funcs->DestroyClip) (pGC); if (!pGC->tileIsPixel) - dixDestroyPixmap(pGC->tile.pixmap, 0); + (*pGC->pScreen->DestroyPixmap) (pGC->tile.pixmap); if (pGC->stipple) - dixDestroyPixmap(pGC->stipple, 0); + (*pGC->pScreen->DestroyPixmap) (pGC->stipple); if (pGC->funcs) (*pGC->funcs->DestroyGC) (pGC); @@ -884,7 +885,7 @@ CreateDefaultStipple(int screenNum) tmpval[2].val = FillSolid; pgcScratch = GetScratchGC(1, pScreen); if (!pgcScratch) { - dixDestroyPixmap(pScreen->defaultStipple, 0); + (*pScreen->DestroyPixmap) (pScreen->defaultStipple); return FALSE; } (void) ChangeGC(NullClient, pgcScratch, @@ -904,7 +905,8 @@ void FreeDefaultStipple(int screenNum) { ScreenPtr pScreen = screenInfo.screens[screenNum]; - dixDestroyPixmap(pScreen->defaultStipple, 0); + + (*pScreen->DestroyPixmap) (pScreen->defaultStipple); } int diff --git a/dix/glyphcurs.c b/dix/glyphcurs.c index 5747d0b20..012af910e 100644 --- a/dix/glyphcurs.c +++ b/dix/glyphcurs.c @@ -96,7 +96,8 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, CREATE_PIXMAP_USAGE_SCRATCH); pGC = GetScratchGC(1, pScreen); if (!ppix || !pGC) { - dixDestroyPixmap(ppix, 0); + if (ppix) + (*pScreen->DestroyPixmap) (ppix); if (pGC) FreeScratchGC(pGC); free(pbits); @@ -126,7 +127,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, XYPixmap, 1, pbits); *ppbits = (unsigned char *) pbits; FreeScratchGC(pGC); - dixDestroyPixmap(ppix, 0); + (*pScreen->DestroyPixmap) (ppix); return Success; } diff --git a/dix/pixmap.c b/dix/pixmap.c index f7812804a..020ceb83a 100644 --- a/dix/pixmap.c +++ b/dix/pixmap.c @@ -63,7 +63,7 @@ GetScratchPixmapHeader(ScreenPtr pScreen, int width, int height, int depth, if ((*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth, bitsPerPixel, devKind, pPixData)) return pPixmap; - dixDestroyPixmap(pPixmap, 0); + (*pScreen->DestroyPixmap) (pPixmap); } return NullPixmap; } @@ -73,8 +73,9 @@ void FreeScratchPixmapHeader(PixmapPtr pPixmap) { if (pPixmap) { + ScreenPtr pScreen = pPixmap->drawable.pScreen; pPixmap->devPrivate.ptr = NULL; /* help catch/avoid heap-use-after-free */ - dixDestroyPixmap(pPixmap, 0); + (*pScreen->DestroyPixmap)(pPixmap); } } @@ -150,7 +151,7 @@ PixmapPtr PixmapShareToSecondary(PixmapPtr pixmap, ScreenPtr secondary) ret = secondary->SetSharedPixmapBacking(spix, handle); if (ret == FALSE) { - dixDestroyPixmap(spix, 0); + secondary->DestroyPixmap(spix); return NULL; } diff --git a/dix/window.c b/dix/window.c index 672593512..6b7fc808e 100644 --- a/dix/window.c +++ b/dix/window.c @@ -1014,9 +1014,9 @@ FreeWindowResources(WindowPtr pWin) if (wInputShape(pWin)) RegionDestroy(wInputShape(pWin)); if (pWin->borderIsPixel == FALSE) - dixDestroyPixmap(pWin->border.pixmap, 0); + (*pScreen->DestroyPixmap) (pWin->border.pixmap); if (pWin->backgroundState == BackgroundPixmap) - dixDestroyPixmap(pWin->background.pixmap, 0); + (*pScreen->DestroyPixmap) (pWin->background.pixmap); DeleteAllWindowProperties(pWin); /* We SHOULD check for an error value here XXX */ @@ -1195,7 +1195,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) borderRelative = TRUE; if (pixID == None) { if (pWin->backgroundState == BackgroundPixmap) - dixDestroyPixmap(pWin->background.pixmap, 0); + (*pScreen->DestroyPixmap) (pWin->background.pixmap); if (!pWin->parent) SetRootWindowBackground(pWin, pScreen, &index2); else { @@ -1210,7 +1210,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) goto PatchUp; } if (pWin->backgroundState == BackgroundPixmap) - dixDestroyPixmap(pWin->background.pixmap, 0); + (*pScreen->DestroyPixmap) (pWin->background.pixmap); if (!pWin->parent) SetRootWindowBackground(pWin, pScreen, &index2); else @@ -1229,7 +1229,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) goto PatchUp; } if (pWin->backgroundState == BackgroundPixmap) - dixDestroyPixmap(pWin->background.pixmap, 0); + (*pScreen->DestroyPixmap) (pWin->background.pixmap); pWin->backgroundState = BackgroundPixmap; pWin->background.pixmap = pPixmap; pPixmap->refcnt++; @@ -1245,7 +1245,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) if (pWin->backgroundState == ParentRelative) borderRelative = TRUE; if (pWin->backgroundState == BackgroundPixmap) - dixDestroyPixmap(pWin->background.pixmap, 0); + (*pScreen->DestroyPixmap) (pWin->background.pixmap); pWin->backgroundState = BackgroundPixel; pWin->background.pixel = (CARD32) *pVlist; /* background pixel overrides background pixmap, @@ -1264,7 +1264,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) } if (pWin->parent->borderIsPixel == TRUE) { if (pWin->borderIsPixel == FALSE) - dixDestroyPixmap(pWin->border.pixmap, 0); + (*pScreen->DestroyPixmap) (pWin->border.pixmap); pWin->border = pWin->parent->border; pWin->borderIsPixel = TRUE; index2 = CWBorderPixel; @@ -1283,7 +1283,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) goto PatchUp; } if (pWin->borderIsPixel == FALSE) - dixDestroyPixmap(pWin->border.pixmap, 0); + (*pScreen->DestroyPixmap) (pWin->border.pixmap); pWin->borderIsPixel = FALSE; pWin->border.pixmap = pPixmap; pPixmap->refcnt++; @@ -1296,7 +1296,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) break; case CWBorderPixel: if (pWin->borderIsPixel == FALSE) - dixDestroyPixmap(pWin->border.pixmap, 0); + (*pScreen->DestroyPixmap) (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 96a72b2b6..c2508def1 100644 --- a/doc/Xserver-spec.xml +++ b/doc/Xserver-spec.xml @@ -3054,14 +3054,6 @@ must deallocate the PixmapRec and all attached devPrivate blocks. If successful, it returns TRUE. See Xserver/fb/fbpixmap.c for the sample server implementation. -Consumers should never ever call that proc directly, but call dixDestroyPixmap() instead. - - -If it's ever wrapped (by an extension), the wrapping handler must be written -in a way that it can always be called, even when the private structures are in -an half-initialized state (error pathes), so no extra unwrapping magic necessary. - -
Bool diff --git a/dri3/dri3_request.c b/dri3/dri3_request.c index 3da27b68f..cdb5a1f1e 100644 --- a/dri3/dri3_request.c +++ b/dri3/dri3_request.c @@ -244,7 +244,7 @@ proc_dri3_pixmap_from_buffer(ClientPtr client) pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) { - dixDestroyPixmap(pixmap, 0); + (*drawable->pScreen->DestroyPixmap) (pixmap); return rc; } if (!AddResource(stuff->pixmap, X11_RESTYPE_PIXMAP, (void *) pixmap)) @@ -508,7 +508,7 @@ proc_dri3_pixmap_from_buffers(ClientPtr client) pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) { - dixDestroyPixmap(pixmap, 0); + (*screen->DestroyPixmap) (pixmap); return rc; } if (!AddResource(stuff->pixmap, X11_RESTYPE_PIXMAP, (void *) pixmap)) diff --git a/exa/exa_classic.c b/exa/exa_classic.c index 05f0ff2a8..7f93f1e3d 100644 --- a/exa/exa_classic.c +++ b/exa/exa_classic.c @@ -96,9 +96,10 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, pExaPixmap->fb_size = pExaPixmap->fb_pitch * h; if (pExaPixmap->fb_pitch > 131071) { - // don't need to protect from calling our own (wrapped) DestroyPixmap - // handler, because it can deal with half-initialized state - dixDestroyPixmap(pPixmap, 0); + swap(pExaScr, pScreen, DestroyPixmap); + if (pScreen->DestroyPixmap) + pScreen->DestroyPixmap(pPixmap); + swap(pExaScr, pScreen, DestroyPixmap); return NULL; } @@ -108,9 +109,10 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, pScreen, pPixmap); if (pExaPixmap->pDamage == NULL) { - // don't need to protect from calling our own (wrapped) DestroyPixmap - // handler, because it can deal with half-initialized state - dixDestroyPixmap(pPixmap, 0); + swap(pExaScr, pScreen, DestroyPixmap); + if (pScreen->DestroyPixmap) + pScreen->DestroyPixmap(pPixmap); + swap(pExaScr, pScreen, DestroyPixmap); return NULL; } @@ -216,8 +218,6 @@ exaDestroyPixmap_classic(PixmapPtr pPixmap) if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap); - if (!pExaPixmap) // we're called on an error path - goto out; exaDestroyPixmap(pPixmap); @@ -235,10 +235,9 @@ exaDestroyPixmap_classic(PixmapPtr pPixmap) RegionUninit(&pExaPixmap->validFB); } -out: - // restore original (screen driver's) DestroyPixmap() handler and call it swap(pExaScr, pScreen, DestroyPixmap); - dixDestroyPixmap(pPixmap, 0); + if (pScreen->DestroyPixmap) + ret = pScreen->DestroyPixmap(pPixmap); swap(pExaScr, pScreen, DestroyPixmap); return ret; diff --git a/exa/exa_driver.c b/exa/exa_driver.c index e56f980c7..17106fcb9 100644 --- a/exa/exa_driver.c +++ b/exa/exa_driver.c @@ -98,9 +98,10 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth, } if (!pExaPixmap->driverPriv) { - // don't need to protect from calling our own (wrapped) DestroyPixmap - // handler, because it can deal with half-initialized state - dixDestroyPixmap(pPixmap, 0); + swap(pExaScr, pScreen, DestroyPixmap); + if (pScreen->DestroyPixmap) + pScreen->DestroyPixmap(pPixmap); + swap(pExaScr, pScreen, DestroyPixmap); return NULL; } @@ -195,8 +196,6 @@ exaDestroyPixmap_driver(PixmapPtr pPixmap) if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap); - if (!pExaPixmap) // we're called on an error path - goto out; exaDestroyPixmap(pPixmap); @@ -205,10 +204,9 @@ exaDestroyPixmap_driver(PixmapPtr pPixmap) pExaPixmap->driverPriv = NULL; } -out: - // restore original (screen driver's) DestroyPixmap() handler and call it swap(pExaScr, pScreen, DestroyPixmap); - dixDestroyPixmap(pPixmap, 0); + if (pScreen->DestroyPixmap) + ret = pScreen->DestroyPixmap(pPixmap); swap(pExaScr, pScreen, DestroyPixmap); return ret; diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c index 3ea4a540e..371301888 100644 --- a/exa/exa_glyphs.c +++ b/exa/exa_glyphs.c @@ -194,7 +194,7 @@ exaRealizeGlyphCaches(ScreenPtr pScreen, unsigned int format) CPComponentAlpha, &component_alpha, serverClient, &error); - dixDestroyPixmap(pPixmap, 0); /* picture holds a refcount */ + (*pScreen->DestroyPixmap) (pPixmap); /* picture holds a refcount */ if (!pPicture) return FALSE; @@ -728,7 +728,7 @@ exaGlyphs(CARD8 op, { PictFormatPtr argbFormat; - dixDestroyPixmap(pMaskPixmap, 0); + (*pScreen->DestroyPixmap) (pMaskPixmap); if (!pMask) return; @@ -751,7 +751,7 @@ exaGlyphs(CARD8 op, pMask = CreatePicture(0, &pMaskPixmap->drawable, maskFormat, 0, 0, serverClient, &error); if (!pMask) { - dixDestroyPixmap(pMaskPixmap, 0); + (*pScreen->DestroyPixmap) (pMaskPixmap); return; } } @@ -832,6 +832,6 @@ exaGlyphs(CARD8 op, xSrc + x - first_xOff, ySrc + y - first_yOff, 0, 0, x, y, width, height); FreePicture((void *) pMask, (XID) 0); - dixDestroyPixmap(pMaskPixmap, 0); + (*pScreen->DestroyPixmap) (pMaskPixmap); } } diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c index 340c45a1f..7138f9b30 100644 --- a/exa/exa_mixed.c +++ b/exa/exa_mixed.c @@ -249,8 +249,6 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap) if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap); - if (!pExaPixmap) - goto out; // we're called on an error path exaDestroyPixmap(pPixmap); @@ -268,10 +266,9 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap) } } -out: - // restore original (screen driver's) DestroyPixmap() handler and call it swap(pExaScr, pScreen, DestroyPixmap); - dixDestroyPixmap(pPixmap, 0); + if (pScreen->DestroyPixmap) + ret = pScreen->DestroyPixmap(pPixmap); swap(pExaScr, pScreen, DestroyPixmap); return ret; diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c index 37fb624da..c77e36261 100644 --- a/exa/exa_offscreen.c +++ b/exa/exa_offscreen.c @@ -614,7 +614,7 @@ ExaOffscreenDefragment(ScreenPtr pScreen) pDstPix->drawable.depth = 0; pDstPix->drawable.bitsPerPixel = 0; - dixDestroyPixmap(pDstPix, 0); + (*pScreen->DestroyPixmap) (pDstPix); if (area->state == ExaOffscreenAvail && area->size > largest_size) return area; diff --git a/exa/exa_render.c b/exa/exa_render.c index 49a4fdbc6..da74f64d7 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -1082,7 +1082,7 @@ exaCreateAlphaPicture(ScreenPtr pScreen, return 0; pGC = GetScratchGC(pPixmap->drawable.depth, pScreen); if (!pGC) { - dixDestroyPixmap(pPixmap, 0); + (*pScreen->DestroyPixmap) (pPixmap); return 0; } ValidateGC(&pPixmap->drawable, pGC); @@ -1095,7 +1095,7 @@ exaCreateAlphaPicture(ScreenPtr pScreen, FreeScratchGC(pGC); pPicture = CreatePicture(0, &pPixmap->drawable, pPictFormat, 0, 0, serverClient, &error); - dixDestroyPixmap(pPixmap, 0); + (*pScreen->DestroyPixmap) (pPixmap); return pPicture; } diff --git a/fb/fboverlay.c b/fb/fboverlay.c index d8d9c2d75..7ea8e660b 100644 --- a/fb/fboverlay.c +++ b/fb/fboverlay.c @@ -83,7 +83,7 @@ fbOverlayCloseScreen(ScreenPtr pScreen) int i; for (i = 0; i < pScrPriv->nlayers; i++) { - dixDestroyPixmap(pScrPriv->layer[i].u.run.pixmap, 0); + (*pScreen->DestroyPixmap) (pScrPriv->layer[i].u.run.pixmap); RegionUninit(&pScrPriv->layer[i].u.run.region); } return TRUE; diff --git a/glamor/glamor_composite_glyphs.c b/glamor/glamor_composite_glyphs.c index c1a0cb0f0..428303091 100644 --- a/glamor/glamor_composite_glyphs.c +++ b/glamor/glamor_composite_glyphs.c @@ -436,7 +436,7 @@ glamor_composite_glyphs(CARD8 op, glyphs_queued = 0; } if (glyph_atlas->atlas) { - dixDestroyPixmap(glyph_atlas->atlas, 0); + (*screen->DestroyPixmap)(glyph_atlas->atlas); glyph_atlas->atlas = NULL; } } @@ -571,7 +571,8 @@ glamor_free_glyph_atlas(struct glamor_glyph_atlas *atlas) { if (!atlas) return; - dixDestroyPixmap(atlas->atlas, 0); + if (atlas->atlas) + (*atlas->atlas->drawable.pScreen->DestroyPixmap)(atlas->atlas); free (atlas); } diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index e6992deee..668eddc86 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -346,7 +346,7 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok) xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to make %dx%dx%dbpp pixmap from GBM bo\n", width, height, pixmap->drawable.bitsPerPixel); - dixDestroyPixmap(exported, 0); + screen->DestroyPixmap(exported); gbm_bo_destroy(bo); return FALSE; } @@ -367,7 +367,7 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok) /* Swap the devKind into the original pixmap, reflecting the bo's stride */ screen->ModifyPixmapHeader(pixmap, 0, 0, 0, 0, exported->devKind, NULL); - dixDestroyPixmap(exported, 0); + screen->DestroyPixmap(exported); return TRUE; } @@ -632,7 +632,7 @@ glamor_pixmap_from_fds(ScreenPtr screen, error: if (ret == FALSE) { - dixDestroyPixmap(pixmap, 0); + screen->DestroyPixmap(pixmap); return NULL; } return pixmap; @@ -654,7 +654,7 @@ glamor_pixmap_from_fd(ScreenPtr screen, stride, depth, bpp); if (ret == FALSE) { - dixDestroyPixmap(pixmap, 0); + screen->DestroyPixmap(pixmap); return NULL; } return pixmap; diff --git a/glx/glxcmds.c b/glx/glxcmds.c index f8c3a965c..90154b404 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -1391,7 +1391,7 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, err = XaceHookResourceAccess(client, glxDrawableId, X11_RESTYPE_PIXMAP, pPixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (err != Success) { - dixDestroyPixmap(pPixmap, 0); + (*pGlxScreen->pScreen->DestroyPixmap) (pPixmap); return err; } diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index 33dcccf8f..b7ac56d50 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -1655,7 +1655,7 @@ ephyr_glamor_create_screen_resources(ScreenPtr pScreen) * Thus, delete the current screen pixmap, and put a fresh one in. */ old_screen_pixmap = pScreen->GetScreenPixmap(pScreen); - dixDestroyPixmap(old_screen_pixmap, 0); + pScreen->DestroyPixmap(old_screen_pixmap); screen_pixmap = pScreen->CreatePixmap(pScreen, pScreen->width, diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c index 94a227b40..71ea78e2f 100644 --- a/hw/vfb/InitOutput.c +++ b/hw/vfb/InitOutput.c @@ -801,7 +801,8 @@ vfbCloseScreen(ScreenPtr pScreen) /* * fb overwrites miCloseScreen, so do this here */ - dixDestroyPixmap(pScreen->devPrivate, 0); + if (pScreen->devPrivate) + (*pScreen->DestroyPixmap) (pScreen->devPrivate); pScreen->devPrivate = NULL; return pScreen->CloseScreen(pScreen); diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 2482530a1..41b58d9e3 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -370,7 +370,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet) if (oldPix->drawable.id) FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE); else - dixDestroyPixmap(oldPix, 0); + (*pScreen->DestroyPixmap) (oldPix); } free(pScreenPriv->current); pScreenPriv->current = NULL; @@ -432,7 +432,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet) if (oldPix->drawable.id) FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE); else - dixDestroyPixmap(oldPix, 0); + (*pScreen->DestroyPixmap) (oldPix); } free(pScreenPriv->current); pScreenPriv->current = NULL; diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 4ac0e144e..8158a1661 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -436,8 +436,8 @@ DRI2DrawableGone(void *p, XID id) } if (pPriv->prime_secondary_pixmap) { - dixDestroyPixmap(pPriv->prime_secondary_pixmap->primary_pixmap, 0); - dixDestroyPixmap(pPriv->prime_secondary_pixmap, 0); + (*pPriv->prime_secondary_pixmap->primary_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_secondary_pixmap->primary_pixmap); + (*pPriv->prime_secondary_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_secondary_pixmap); } if (pPriv->buffers != NULL) { @@ -449,7 +449,7 @@ DRI2DrawableGone(void *p, XID id) if (pPriv->redirectpixmap) { (*pDraw->pScreen->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); - dixDestroyPixmap(pPriv->redirectpixmap, 0); + (*pDraw->pScreen->DestroyPixmap)(pPriv->redirectpixmap); } dri2WakeAll(CLIENT_SIGNAL_ANY, pPriv, WAKE_SWAP); @@ -847,7 +847,7 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest) ret = (*primary->ReplaceScanoutPixmap)(pDraw, mpix, TRUE); if (ret == FALSE) { - dixDestroyPixmap(mpix, 0); + (*primary->DestroyPixmap)(mpix); return NULL; } pPriv->redirectpixmap = mpix; @@ -856,7 +856,7 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest) } } else if (pPriv->redirectpixmap) { (*primary->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); - dixDestroyPixmap(pPriv->redirectpixmap, 0); + (*primary->DestroyPixmap)(pPriv->redirectpixmap); pPriv->redirectpixmap = NULL; } } @@ -869,8 +869,8 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest) return &pPriv->prime_secondary_pixmap->drawable; else { PixmapUnshareSecondaryPixmap(pPriv->prime_secondary_pixmap); - dixDestroyPixmap(pPriv->prime_secondary_pixmap->primary_pixmap, 0); - dixDestroyPixmap(pPriv->prime_secondary_pixmap, 0); + (*pPriv->prime_secondary_pixmap->primary_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_secondary_pixmap->primary_pixmap); + (*secondary->DestroyPixmap)(pPriv->prime_secondary_pixmap); pPriv->prime_secondary_pixmap = NULL; } } diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c index 68765cad8..af7db7ddc 100644 --- a/hw/xfree86/drivers/modesetting/dri2.c +++ b/hw/xfree86/drivers/modesetting/dri2.c @@ -208,7 +208,7 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable, if (buffer->name == -1) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to get DRI2 name for pixmap\n"); - dixDestroyPixmap(pixmap, 0); + screen->DestroyPixmap(pixmap); free(private); free(buffer); return NULL; @@ -247,7 +247,8 @@ static void ms_dri2_destroy_buffer2(ScreenPtr unused, DrawablePtr unused2, if (buffer->driverPrivate) { ms_dri2_buffer_private_ptr private = buffer->driverPrivate; if (--private->refcnt == 0) { - dixDestroyPixmap(private->pixmap, 0); + ScreenPtr screen = private->pixmap->drawable.pScreen; + screen->DestroyPixmap(private->pixmap); free(private); free(buffer); } @@ -522,7 +523,7 @@ update_front(DrawablePtr draw, DRI2BufferPtr front) front->name = name; - dixDestroyPixmap(priv->pixmap, 0); + (*screen->DestroyPixmap) (priv->pixmap); front->pitch = pixmap->devKind; front->cpp = pixmap->drawable.bitsPerPixel / 8; priv->pixmap = pixmap; diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index cf4269403..6769d3dbf 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -1570,7 +1570,8 @@ drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) pScreen->canDoBGNoneRoot = TRUE; - dixDestroyPixmap(drmmode->fbcon_pixmap, 0); + if (drmmode->fbcon_pixmap) + pScrn->pScreen->DestroyPixmap(drmmode->fbcon_pixmap); drmmode->fbcon_pixmap = NULL; #endif } @@ -2155,7 +2156,7 @@ drmmode_create_pixmap_header(ScreenPtr pScreen, int width, int height, if ((*pScreen->ModifyPixmapHeader)(pixmap, width, height, depth, bitsPerPixel, devKind, pPixData)) return pixmap; - dixDestroyPixmap(pixmap, 0); + (*pScreen->DestroyPixmap)(pixmap); } return NullPixmap; } @@ -2227,7 +2228,9 @@ drmmode_shadow_fb_destroy(xf86CrtcPtr crtc, PixmapPtr pixmap, drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; - dixDestroyPixmap(pixmap, 0); + if (pixmap) { + pixmap->drawable.pScreen->DestroyPixmap(pixmap); + } if (data) { drmModeRmFB(drmmode->fd, *fb_id); diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c index f9f60177f..a50803ea5 100644 --- a/hw/xnest/GC.c +++ b/hw/xnest/GC.c @@ -224,7 +224,7 @@ xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects) * current pixmap contents. */ pGC->clientClip = (*pGC->pScreen->BitmapToRegion) ((PixmapPtr) pValue); - dixDestroyPixmap((PixmapPtr) pValue, 0); + (*pGC->pScreen->DestroyPixmap) ((PixmapPtr) pValue); pValue = pGC->clientClip; break; diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index 2b901431b..dd0d71690 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -180,7 +180,7 @@ update_backing_pixmaps(struct xwl_screen *xwl_screen, int width, int height) if (old_pixmap) { TraverseTree(pRoot, xwl_set_pixmap_visit_window, old_pixmap); - dixDestroyPixmap(old_pixmap, 0); + pScreen->DestroyPixmap(old_pixmap); } pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL); diff --git a/hw/xwayland/xwayland-window-buffers.c b/hw/xwayland/xwayland-window-buffers.c index 09265078c..a470ef313 100644 --- a/hw/xwayland/xwayland-window-buffers.c +++ b/hw/xwayland/xwayland-window-buffers.c @@ -97,8 +97,10 @@ xwl_window_buffer_new(struct xwl_window *xwl_window) static void xwl_window_buffer_destroy_pixmap(struct xwl_window_buffer *xwl_window_buffer) { + ScreenPtr pScreen = xwl_window_buffer->pixmap->drawable.pScreen; + xwl_pixmap_del_buffer_release_cb(xwl_window_buffer->pixmap); - dixDestroyPixmap(xwl_window_buffer->pixmap, 0); + (*pScreen->DestroyPixmap) (xwl_window_buffer->pixmap); xwl_window_buffer->pixmap = NullPixmap; } @@ -361,7 +363,7 @@ xwl_window_realloc_pixmap(struct xwl_window *xwl_window) window_pixmap->drawable.width, window_pixmap->drawable.height); xwl_window_set_pixmap(xwl_window->surface_window, new_window_pixmap); - dixDestroyPixmap(window_pixmap, 0); + screen->DestroyPixmap(window_pixmap); } static Bool diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index a77f4fb88..b717fcf3c 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -317,7 +317,7 @@ damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data) window_pixmap = xwl_screen->screen->GetWindowPixmap(xwl_window->surface_window); if (xwl_is_client_pixmap(window_pixmap)) - dixDestroyPixmap(xwl_window_swap_pixmap(xwl_window, FALSE), 0); + xwl_screen->screen->DestroyPixmap(xwl_window_swap_pixmap(xwl_window, FALSE)); } static void diff --git a/include/dix.h b/include/dix.h index e40a3e64c..65e66e06c 100644 --- a/include/dix.h +++ b/include/dix.h @@ -147,20 +147,8 @@ extern _X_EXPORT void UpdateCurrentTime(void); extern _X_EXPORT void UpdateCurrentTimeIf(void); -/* - * @brief dereference a pixmap and destroy it when not used anymore - * - * Despite the name, this function unref's the pixmap, and only destroys it when - * the pixmap isn't used anymore. (perhaps it should be renamed to dixUnrefPixmap()) - * - * Note: it's also used as resource destructor callback, hence that strange args. - * (not actually finest art, but for now a good compromise, since it's already - * existing and exported, thus can easily be used by drivers, w/o breaking compat) - * - * @param pPixmap pointer to pixmap (PixmapPtr) that should be unref'ed - * @param unused ignored, only for matching the resource destructor prototype - */ -_X_EXPORT int dixDestroyPixmap(void *pPixmap, XID unused); +extern _X_EXPORT int dixDestroyPixmap(void *value, + XID pid); extern _X_EXPORT ClientPtr NextAvailableClient(void *ospriv); diff --git a/mi/miarc.c b/mi/miarc.c index 3223bcb02..9ea4a6155 100644 --- a/mi/miarc.c +++ b/mi/miarc.c @@ -1112,7 +1112,7 @@ miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) out: if (fTricky) { - dixDestroyPixmap((PixmapPtr) pDrawTo, 0); + (*pGCTo->pScreen->DestroyPixmap) ((PixmapPtr) pDrawTo); FreeScratchGC(pGCTo); } } diff --git a/mi/midispcur.c b/mi/midispcur.c index 401e16768..305b6fc68 100644 --- a/mi/midispcur.c +++ b/mi/midispcur.c @@ -119,11 +119,12 @@ miDCSwitchScreenCursor(ScreenPtr pScreen, CursorPtr pCursor, PixmapPtr sourceBit { miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); - dixDestroyPixmap(pScreenPriv->sourceBits, 0); + if (pScreenPriv->sourceBits) + (*pScreen->DestroyPixmap)(pScreenPriv->sourceBits); pScreenPriv->sourceBits = sourceBits; if (pScreenPriv->maskBits) - dixDestroyPixmap(pScreenPriv->maskBits, 0); + (*pScreen->DestroyPixmap)(pScreenPriv->maskBits); pScreenPriv->maskBits = maskBits; if (pScreenPriv->pPicture) @@ -202,7 +203,7 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor) pGC = GetScratchGC(32, pScreen); if (!pGC) { - dixDestroyPixmap(pPixmap, 0); + (*pScreen->DestroyPixmap) (pPixmap); return FALSE; } ValidateGC(&pPixmap->drawable, pGC); @@ -213,7 +214,7 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor) FreeScratchGC(pGC); pPicture = CreatePicture(0, &pPixmap->drawable, pFormat, 0, 0, serverClient, &error); - dixDestroyPixmap(pPixmap, 0); + (*pScreen->DestroyPixmap) (pPixmap); if (!pPicture) return FALSE; @@ -229,7 +230,7 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor) maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0); if (!maskBits) { - dixDestroyPixmap(sourceBits, 0); + (*pScreen->DestroyPixmap) (sourceBits); return FALSE; } @@ -237,8 +238,8 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor) pGC = GetScratchGC(1, pScreen); if (!pGC) { - dixDestroyPixmap(sourceBits, 0); - dixDestroyPixmap(maskBits, 0); + (*pScreen->DestroyPixmap) (sourceBits); + (*pScreen->DestroyPixmap) (maskBits); return FALSE; } @@ -394,7 +395,8 @@ miDCSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen, pSave = pBuffer->pSave; pWin = pScreen->root; if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) { - dixDestroyPixmap(pSave, 0); + if (pSave) + (*pScreen->DestroyPixmap) (pSave); pBuffer->pSave = pSave = (*pScreen->CreatePixmap) (pScreen, w, h, pScreen->rootDepth, 0); if (!pSave) @@ -511,7 +513,8 @@ miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) * is freed when that root window is destroyed, so don't * free it again here. */ - dixDestroyPixmap(pBuffer->pSave, 0); + if (pBuffer->pSave) + (*pScreen->DestroyPixmap) (pBuffer->pSave); free(pBuffer); dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen, diff --git a/mi/migc.c b/mi/migc.c index 14389b0f5..e4f3b547e 100644 --- a/mi/migc.c +++ b/mi/migc.c @@ -63,7 +63,7 @@ miChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) if (type == CT_PIXMAP) { /* convert the pixmap to a region */ pGC->clientClip = BitmapToRegion(pGC->pScreen, (PixmapPtr) pvalue); - dixDestroyPixmap(pvalue, 0); + (*pGC->pScreen->DestroyPixmap) (pvalue); } else if (type == CT_REGION) { /* stuff the region in the GC */ diff --git a/mi/miglblt.c b/mi/miglblt.c index accd55ffe..4314b4091 100644 --- a/mi/miglblt.c +++ b/mi/miglblt.c @@ -118,7 +118,7 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyp pGCtmp = GetScratchGC(1, pDrawable->pScreen); if (!pGCtmp) { - dixDestroyPixmap(pPixmap, 0); + (*pDrawable->pScreen->DestroyPixmap) (pPixmap); return; } @@ -132,7 +132,7 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyp nbyLine = BitmapBytePad(width); pbits = xallocarray(height, nbyLine); if (!pbits) { - dixDestroyPixmap(pPixmap, 0); + (*pDrawable->pScreen->DestroyPixmap) (pPixmap); FreeScratchGC(pGCtmp); return; } @@ -174,7 +174,7 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyp } x += pci->metrics.characterWidth; } - dixDestroyPixmap(pPixmap, 0); + (*pDrawable->pScreen->DestroyPixmap) (pPixmap); free(pbits); FreeScratchGC(pGCtmp); } diff --git a/mi/miscrinit.c b/mi/miscrinit.c index 1372cf754..cf67baab0 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -125,8 +125,7 @@ miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, static Bool miCloseScreen(ScreenPtr pScreen) { - dixDestroyPixmap((PixmapPtr) pScreen->devPrivate, 0); - return TRUE; + return ((*pScreen->DestroyPixmap) ((PixmapPtr) pScreen->devPrivate)); } static Bool diff --git a/miext/shadow/shadow.c b/miext/shadow/shadow.c index c0f08780a..cecedee7d 100644 --- a/miext/shadow/shadow.c +++ b/miext/shadow/shadow.c @@ -103,7 +103,8 @@ shadowCloseScreen(ScreenPtr pScreen) unwrap(pBuf, pScreen, BlockHandler); shadowRemove(pScreen, pBuf->pPixmap); DamageDestroy(pBuf->pDamage); - dixDestroyPixmap(pBuf->pPixmap, 0); + if (pBuf->pPixmap) + pScreen->DestroyPixmap(pBuf->pPixmap); free(pBuf); return pScreen->CloseScreen(pScreen); } diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 2fb92b053..42421b1ce 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -382,11 +382,11 @@ rrDestroySharedPixmap(RRCrtcPtr crtc, PixmapPtr pPixmap) { */ PixmapUnshareSecondaryPixmap(pPixmap); - dixDestroyPixmap(pPixmap->primary_pixmap, 0); - dixDestroyPixmap(pPixmap->primary_pixmap, 0); + primary->DestroyPixmap(pPixmap->primary_pixmap); + primary->DestroyPixmap(pPixmap->primary_pixmap); } - dixDestroyPixmap(pPixmap, 0); + crtc->pScreen->DestroyPixmap(pPixmap); } void @@ -440,7 +440,7 @@ rrCreateSharedPixmap(RRCrtcPtr crtc, ScreenPtr primary, spix = PixmapShareToSecondary(mpix, crtc->pScreen); if (spix == NULL) { - dixDestroyPixmap(mpix, 0); + primary->DestroyPixmap(mpix); return NULL; } diff --git a/render/glyph.c b/render/glyph.c index 30f423742..57aa46789 100644 --- a/render/glyph.c +++ b/render/glyph.c @@ -608,7 +608,7 @@ miGlyphs(CARD8 op, maskFormat, CPComponentAlpha, &component_alpha, serverClient, &error); if (!pMask) { - dixDestroyPixmap(pMaskPixmap, 0); + (*pScreen->DestroyPixmap) (pMaskPixmap); return; } pGC = GetScratchGC(pMaskPixmap->drawable.depth, pScreen); @@ -676,7 +676,7 @@ miGlyphs(CARD8 op, xSrc + x - xDst, ySrc + y - yDst, 0, 0, x, y, width, height); FreePicture((void *) pMask, (XID) 0); - dixDestroyPixmap(pMaskPixmap, 0); + (*pScreen->DestroyPixmap) (pMaskPixmap); } } diff --git a/render/mipict.c b/render/mipict.c index 0bc5417c6..ac376eb71 100644 --- a/render/mipict.c +++ b/render/mipict.c @@ -67,7 +67,7 @@ miChangePictureClip(PicturePtr pPicture, int type, void *value, int n) clientClip = BitmapToRegion(pScreen, (PixmapPtr) value); if (!clientClip) return BadAlloc; - dixDestroyPixmap((PixmapPtr) value, 0); + (*pScreen->DestroyPixmap) ((PixmapPtr) value); break; case CT_REGION: clientClip = value; diff --git a/render/picture.c b/render/picture.c index feb29a7d7..1126eb97e 100644 --- a/render/picture.c +++ b/render/picture.c @@ -1416,7 +1416,7 @@ FreePicture(void *value, XID pid) } } else if (pPicture->pDrawable->type == DRAWABLE_PIXMAP) { - dixDestroyPixmap((PixmapPtr) pPicture->pDrawable, 0); + (*pScreen->DestroyPixmap) ((PixmapPtr) pPicture->pDrawable); } } dixFreeObjectWithPrivates(pPicture, PRIVATE_PICTURE); diff --git a/render/render.c b/render/render.c index fe9f03c8c..e97c671af 100644 --- a/render/render.c +++ b/render/render.c @@ -1137,7 +1137,7 @@ ProcRenderAddGlyphs(ClientPtr client) /* The picture takes a reference to the pixmap, so we drop ours. */ - dixDestroyPixmap(pDstPix, 0); + (pScreen->DestroyPixmap) (pDstPix); pDstPix = NULL; if (!pDst) { @@ -1542,7 +1542,7 @@ ProcRenderCreateCursor(ClientPtr client) free(mskbits); return error; } - dixDestroyPixmap(pPixmap, 0); + (*pScreen->DestroyPixmap) (pPixmap); CompositePicture(PictOpSrc, pSrc, 0, pPicture, 0, 0, 0, 0, 0, 0, width, height); (*pScreen->GetImage) (pPicture->pDrawable,