Merge branch 'revert-1711' into 'master'

Revert !1711 ("use dixDestroyPixmap() instead of direct driver calls")

See merge request xorg/xserver!2020
This commit is contained in:
Marge Bot 2025-06-17 20:12:22 +00:00
commit 81b14fb1a6
44 changed files with 158 additions and 156 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -309,7 +309,7 @@ compFreeClientWindow(WindowPtr pWin, XID id)
if (pPixmap) {
compRestoreWindow(pWin, pPixmap);
dixDestroyPixmap(pPixmap, 0);
(*pScreen->DestroyPixmap) (pPixmap);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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))

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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,

View File

@ -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.</para>
<para>
Consumers should never ever call that proc directly, but call dixDestroyPixmap() instead.
</para>
<para>
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.
</para>
<para>
<blockquote><programlisting>
Bool

View File

@ -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))

View File

@ -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;

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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,

View File

@ -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);

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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,

View File

@ -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 */

View File

@ -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);
}

View File

@ -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

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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);

View File

@ -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,