From 41f4b5188ea89fa1989a5692587aaee6993d6042 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 8 Oct 2024 21:04:00 +0200 Subject: [PATCH] WIP: use pixmap lifecycle api --- Xext/saver.c | 5 ++- Xext/shm.c | 17 ++++--- composite/compalloc.c | 8 ++-- composite/compwindow.c | 7 +-- dbe/midbe.c | 45 ++++++++++--------- dix/dispatch.c | 7 ++- dix/gc.c | 24 +++++----- dix/glyphcurs.c | 14 +++--- dix/pixmap.c | 11 +++-- dix/window.c | 19 ++++---- dri3/dri3_request.c | 5 ++- exa/exa_classic.c | 6 ++- exa/exa_driver.c | 4 +- exa/exa_glyphs.c | 10 +++-- exa/exa_offscreen.c | 12 ++--- exa/exa_render.c | 6 ++- fb/fboverlay.c | 7 +-- glamor/glamor_composite_glyphs.c | 12 +++-- glamor/glamor_egl.c | 18 ++++---- glx/glxcmds.c | 3 +- hw/kdrive/ephyr/hostx.c | 8 ++-- hw/vfb/InitOutput.c | 3 +- hw/xfree86/common/xf86DGA.c | 7 +-- hw/xfree86/dri2/dri2.c | 21 +++++---- hw/xfree86/drivers/modesetting/dri2.c | 18 ++++---- .../drivers/modesetting/drmmode_display.c | 9 ++-- hw/xnest/GC.c | 6 ++- hw/xwayland/xwayland-glamor.c | 4 +- hw/xwayland/xwayland-output.c | 12 ++--- hw/xwayland/xwayland-present.c | 6 ++- hw/xwayland/xwayland-window-buffers.c | 6 ++- hw/xwayland/xwayland-window.c | 3 +- mi/miarc.c | 13 +++--- mi/midispcur.c | 41 ++++++++--------- mi/migc.c | 4 +- mi/miglblt.c | 26 ++++++----- mi/miscrinit.c | 7 ++- miext/rootless/rootlessScreen.c | 2 +- miext/shadow/shadow.c | 6 ++- present/present_scmd.c | 5 ++- present/present_vblank.c | 10 +++-- randr/rrcrtc.c | 23 +++++----- render/glyph.c | 13 +++--- render/mipict.c | 3 +- render/picture.c | 3 +- render/render.c | 19 ++++---- 46 files changed, 290 insertions(+), 228 deletions(-) diff --git a/Xext/saver.c b/Xext/saver.c index a44035985..4a2599a69 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -36,6 +36,7 @@ in this Software without prior written authorization from the X Consortium. #include "dix/colormap_priv.h" #include "dix/cursor_priv.h" #include "dix/dix_priv.h" +#include "include/dix_pixmap.h" #include "miext/extinit_priv.h" #include "os/osdep.h" #include "os/screensaver.h" @@ -279,8 +280,8 @@ FreeAttrs(ScreenSaverAttrPtr pAttr) { CursorPtr pCursor; - dixDestroyPixmap(pAttr->pBackgroundPixmap, 0); - dixDestroyPixmap(pAttr->pBorderPixmap, 0); + dixPixmapPut(pAttr->pBackgroundPixmap); + dixPixmapPut(pAttr->pBorderPixmap); if ((pCursor = pAttr->pCursor) != 0) FreeCursor(pCursor, (Cursor) 0); } diff --git a/Xext/shm.c b/Xext/shm.c index 19f7eef11..af3edf93c 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group. #include #include "dix/dix_priv.h" +#include "include/dix_pixmap.h" #include "miext/extinit_priv.h" #include "os/auth.h" #include "os/busfault.h" @@ -476,8 +477,8 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC, if (!putGC) return; - pPixmap = (*dst->pScreen->CreatePixmap) (dst->pScreen, sw, sh, depth, - CREATE_PIXMAP_USAGE_SCRATCH); + pPixmap = dixPixmapCreate(dst->pScreen, sw, sh, depth, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { FreeScratchGC(putGC); return; @@ -494,7 +495,7 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC, else (void) (*pGC->ops->CopyArea) (&pPixmap->drawable, dst, pGC, 0, 0, sw, sh, dx, dy); - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); } } @@ -1003,7 +1004,7 @@ ProcShmCreatePixmap(ClientPtr client) result = XaceHookResourceAccess(client, stuff->pid, X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (result != Success) { - dixDestroyPixmap(pMap, 0); + dixPixmapPut(pMap); break; } dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc); @@ -1039,9 +1040,7 @@ static PixmapPtr fbShmCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, char *addr) { - PixmapPtr pPixmap; - - pPixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, pScreen->rootDepth, 0); + PixmapPtr pPixmap = dixPixmapCreate(pScreen, 0, 0, pScreen->rootDepth, 0); if (!pPixmap) return NullPixmap; @@ -1049,7 +1048,7 @@ fbShmCreatePixmap(ScreenPtr pScreen, BitsPerPixel(depth), PixmapBytePad(width, depth), (void *) addr)) { - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); return NullPixmap; } return pPixmap; @@ -1117,7 +1116,7 @@ ShmCreatePixmap(ClientPtr client, xShmCreatePixmapReq *stuff) rc = XaceHookResourceAccess(client, stuff->pid, X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) { - dixDestroyPixmap(pMap, 0); + dixPixmapPut(pMap); return rc; } dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc); diff --git a/composite/compalloc.c b/composite/compalloc.c index f7048a75b..3ab0e5413 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -43,6 +43,8 @@ #include +#include "include/dix_pixmap.h" + #include "compint.h" static Bool @@ -308,7 +310,7 @@ compFreeClientWindow(WindowPtr pWin, XID id) if (pPixmap) { compRestoreWindow(pWin, pPixmap); - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); } } @@ -532,8 +534,8 @@ compNewPixmap(WindowPtr pWin, int x, int y, int w, int h) WindowPtr pParent = pWin->parent; PixmapPtr pPixmap; - pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth, - CREATE_PIXMAP_USAGE_BACKING_PIXMAP); + pPixmap = dixPixmapCreate(pScreen, w, h, pWin->drawable.depth, + CREATE_PIXMAP_USAGE_BACKING_PIXMAP); if (!pPixmap) return 0; diff --git a/composite/compwindow.c b/composite/compwindow.c index 2e7ce41c0..b7533016c 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -44,6 +44,7 @@ #include #include "dix/dix_priv.h" +#include "include/dix_pixmap.h" #include "os/osdep.h" #include "compint.h" @@ -180,7 +181,7 @@ compCheckRedirect(WindowPtr pWin) compSetParentPixmap(pWin); compRestoreWindow(pWin, pPixmap); - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); } } else if (should) { @@ -370,7 +371,7 @@ compFreeOldPixmap(WindowPtr pWin) CompWindowPtr cw = GetCompWindow(pWin); if (cw->pOldPixmap) { - dixDestroyPixmap(cw->pOldPixmap, 0); + dixPixmapPut(cw->pOldPixmap); cw->pOldPixmap = NullPixmap; } } @@ -599,7 +600,7 @@ void compWindowDestroy(ScreenPtr pScreen, WindowPtr pWin, void *arg) PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); compSetParentPixmap(pWin); - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); } /* Did we just destroy the overlay window? */ diff --git a/dbe/midbe.c b/dbe/midbe.c index ab6f0ecc8..c9d5630d3 100644 --- a/dbe/midbe.c +++ b/dbe/midbe.c @@ -34,8 +34,12 @@ #include +#include #include #include + +#include "include/dix_pixmap.h" + #include "misc.h" #include "os.h" #include "windowstr.h" @@ -52,8 +56,6 @@ #include "midbe.h" #include "xace.h" -#include - /****************************************************************************** * @@ -150,19 +152,20 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); /* Get a front pixmap. */ - if (!(pDbeWindowPriv->pFrontBuffer = - (*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width, - pDbeWindowPriv->height, - pWin->drawable.depth, 0))) { + if (!(pDbeWindowPriv->pFrontBuffer = dixPixmapCreate( + pScreen, + pDbeWindowPriv->width, + pDbeWindowPriv->height, + pWin->drawable.depth, + 0))) return BadAlloc; - } /* Get a back pixmap. */ if (!(pDbeWindowPriv->pBackBuffer = - (*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width, - pDbeWindowPriv->height, - pWin->drawable.depth, 0))) { - dixDestroyPixmap(pDbeWindowPriv->pFrontBuffer, 0); + dixPixmapCreate(pScreen, pDbeWindowPriv->width, + pDbeWindowPriv->height, + pWin->drawable.depth, 0))) { + dixPixmapPut(pDbeWindowPriv->pFrontBuffer); return BadAlloc; } @@ -426,10 +429,10 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId) /* Destroy the front and back pixmaps. */ if (pDbeWindowPriv->pFrontBuffer) - dixDestroyPixmap(pDbeWindowPriv->pFrontBuffer, 0); + dixPixmapPut(pDbeWindowPriv->pFrontBuffer); if (pDbeWindowPriv->pBackBuffer) - dixDestroyPixmap(pDbeWindowPriv->pBackBuffer, 0); + dixPixmapPut(pDbeWindowPriv->pBackBuffer); } /* miDbeWinPrivDelete() */ /****************************************************************************** @@ -534,17 +537,17 @@ void miDbeWindowPosition(ScreenPtr pScreen, WindowPtr pWin, void *arg, int32_t x } /* Create DBE buffer pixmaps equal to size of resized window. */ - pFrontBuffer = (*pScreen->CreatePixmap) (pScreen, width, height, - pWin->drawable.depth, 0); + pFrontBuffer = dixPixmapCreate(pScreen, width, height, + pWin->drawable.depth, 0); - pBackBuffer = (*pScreen->CreatePixmap) (pScreen, width, height, - pWin->drawable.depth, 0); + pBackBuffer = dixPixmapCreate(pScreen, width, height, + pWin->drawable.depth, 0); if (!pFrontBuffer || !pBackBuffer) { /* We failed at creating 1 or 2 of the pixmaps. */ - dixDestroyPixmap(pFrontBuffer, 0); - dixDestroyPixmap(pBackBuffer, 0); + dixPixmapPut(pFrontBuffer); + dixPixmapPut(pBackBuffer); /* Destroy all buffers for this window. */ while (pDbeWindowPriv) { @@ -595,8 +598,8 @@ void miDbeWindowPosition(ScreenPtr pScreen, WindowPtr pWin, void *arg, int32_t x * pixmaps. */ - dixDestroyPixmap(pDbeWindowPriv->pFrontBuffer, 0); - dixDestroyPixmap(pDbeWindowPriv->pBackBuffer, 0); + dixPixmapPut(pDbeWindowPriv->pFrontBuffer); + dixPixmapPut(pDbeWindowPriv->pBackBuffer); pDbeWindowPriv->pFrontBuffer = pFrontBuffer; pDbeWindowPriv->pBackBuffer = pBackBuffer; diff --git a/dix/dispatch.c b/dix/dispatch.c index 2ae5304de..19c8aed83 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1478,7 +1478,6 @@ dixDestroyPixmap(void *value, XID pid) int ProcCreatePixmap(ClientPtr client) { - PixmapPtr pMap; DrawablePtr pDraw; REQUEST(xCreatePixmapReq); @@ -1522,9 +1521,9 @@ ProcCreatePixmap(ClientPtr client) client->errorValue = stuff->depth; return BadValue; } - CreatePmap: - pMap = (PixmapPtr) (*pDraw->pScreen->CreatePixmap) - (pDraw->pScreen, stuff->width, stuff->height, stuff->depth, 0); + CreatePmap:; + PixmapPtr pMap = dixPixmapCreate(pDraw->pScreen, stuff->width, + stuff->height, stuff->depth, 0); if (pMap) { pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = stuff->pid; diff --git a/dix/gc.c b/dix/gc.c index 266a22883..97c80b276 100644 --- a/dix/gc.c +++ b/dix/gc.c @@ -52,6 +52,7 @@ SOFTWARE. #include #include "dix/gc_priv.h" +#include "include/dix_pixmap.h" #include "os/osdep.h" #include "misc.h" @@ -254,7 +255,7 @@ ChangeGC(ClientPtr client, GCPtr pGC, BITS32 mask, ChangeGCValPtr pUnion) else { pPixmap->refcnt++; if (!pGC->tileIsPixel) - dixDestroyPixmap(pGC->tile.pixmap, 0); + dixPixmapPut(pGC->tile.pixmap); pGC->tileIsPixel = FALSE; pGC->tile.pixmap = pPixmap; } @@ -271,7 +272,7 @@ ChangeGC(ClientPtr client, GCPtr pGC, BITS32 mask, ChangeGCValPtr pUnion) if (pPixmap) pPixmap->refcnt++; if (pGC->stipple) - dixDestroyPixmap(pGC->stipple, 0); + dixPixmapPut(pGC->stipple); pGC->stipple = pPixmap; } break; @@ -584,11 +585,10 @@ CreateDefaultTile(GCPtr pGC) w = 1; h = 1; (*pGC->pScreen->QueryBestSize) (TileShape, &w, &h, pGC->pScreen); - pTile = (PixmapPtr) - (*pGC->pScreen->CreatePixmap) (pGC->pScreen, w, h, pGC->depth, 0); + pTile = dixPixmapCreate(pGC->pScreen, w, h, pGC->depth, 0); pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen); if (!pTile || !pgcScratch) { - dixDestroyPixmap(pTile, 0); + dixPixmapPut(pTile); if (pgcScratch) FreeScratchGC(pgcScratch); return FALSE; @@ -667,7 +667,7 @@ CopyGC(GCPtr pgcSrc, GCPtr pgcDst, BITS32 mask) break; } if (!pgcDst->tileIsPixel) - dixDestroyPixmap(pgcDst->tile.pixmap, 0); + dixPixmapPut(pgcDst->tile.pixmap); pgcDst->tileIsPixel = pgcSrc->tileIsPixel; pgcDst->tile = pgcSrc->tile; if (!pgcDst->tileIsPixel) @@ -679,7 +679,7 @@ CopyGC(GCPtr pgcSrc, GCPtr pgcDst, BITS32 mask) if (pgcDst->stipple == pgcSrc->stipple) break; if (pgcDst->stipple) - dixDestroyPixmap(pgcDst->stipple, 0); + dixPixmapPut(pgcDst->stipple); pgcDst->stipple = pgcSrc->stipple; if (pgcDst->stipple) pgcDst->stipple->refcnt++; @@ -774,9 +774,9 @@ FreeGC(void *value, XID gid) (*pGC->funcs->DestroyClip) (pGC); if (!pGC->tileIsPixel) - dixDestroyPixmap(pGC->tile.pixmap, 0); + dixPixmapPut(pGC->tile.pixmap); if (pGC->stipple) - dixDestroyPixmap(pGC->stipple, 0); + dixPixmapPut(pGC->stipple); if (pGC->funcs) (*pGC->funcs->DestroyGC) (pGC); @@ -876,7 +876,7 @@ CreateDefaultStipple(int screenNum) w = 16; h = 16; (*pScreen->QueryBestSize) (StippleShape, &w, &h, pScreen); - if (!(pScreen->defaultStipple = pScreen->CreatePixmap(pScreen, w, h, 1, 0))) + if (!(pScreen->defaultStipple = dixPixmapCreate(pScreen, w, h, 1, 0))) return FALSE; /* fill stipple with 1 */ tmpval[0].val = GXcopy; @@ -884,7 +884,7 @@ CreateDefaultStipple(int screenNum) tmpval[2].val = FillSolid; pgcScratch = GetScratchGC(1, pScreen); if (!pgcScratch) { - dixDestroyPixmap(pScreen->defaultStipple, 0); + dixPixmapPut(pScreen->defaultStipple); return FALSE; } (void) ChangeGC(NullClient, pgcScratch, @@ -904,7 +904,7 @@ void FreeDefaultStipple(int screenNum) { ScreenPtr pScreen = screenInfo.screens[screenNum]; - dixDestroyPixmap(pScreen->defaultStipple, 0); + dixPixmapPut(pScreen->defaultStipple); } int diff --git a/dix/glyphcurs.c b/dix/glyphcurs.c index 5747d0b20..fb3c05ef3 100644 --- a/dix/glyphcurs.c +++ b/dix/glyphcurs.c @@ -46,10 +46,12 @@ SOFTWARE. #include +#include + #include "dix/cursor_priv.h" +#include "include/dix_pixmap.h" #include "misc.h" -#include #include "dixfontstr.h" #include "scrnintstr.h" #include "gcstruct.h" @@ -77,7 +79,6 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, ScreenPtr pScreen; GCPtr pGC; xRectangle rect; - PixmapPtr ppix; char *pbits; ChangeGCVal gcval[3]; unsigned char char2b[2]; @@ -91,12 +92,11 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, if (!pbits) return BadAlloc; - ppix = (PixmapPtr) (*pScreen->CreatePixmap) (pScreen, cm->width, - cm->height, 1, - CREATE_PIXMAP_USAGE_SCRATCH); + PixmapPtr ppix = dixPixmapCreate(pScreen, cm->width, cm->height, 1, + CREATE_PIXMAP_USAGE_SCRATCH); pGC = GetScratchGC(1, pScreen); if (!ppix || !pGC) { - dixDestroyPixmap(ppix, 0); + dixPixmapPut(ppix); if (pGC) FreeScratchGC(pGC); free(pbits); @@ -126,7 +126,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, XYPixmap, 1, pbits); *ppbits = (unsigned char *) pbits; FreeScratchGC(pGC); - dixDestroyPixmap(ppix, 0); + dixPixmapPut(ppix); return Success; } diff --git a/dix/pixmap.c b/dix/pixmap.c index 13e555fbf..81010a725 100644 --- a/dix/pixmap.c +++ b/dix/pixmap.c @@ -29,6 +29,10 @@ from The Open Group. #include #include +#include + +#include "include/dix_pixmap.h" + #include "scrnintstr.h" #include "mi.h" #include "misc.h" @@ -38,7 +42,6 @@ from The Open Group. #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" -#include "X11/extensions/render.h" #include "picturestr.h" #include "randrstr.h" /* @@ -61,7 +64,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); + dixPixmapPut(pPixmap); } return NullPixmap; } @@ -72,7 +75,7 @@ FreeScratchPixmapHeader(PixmapPtr pPixmap) { if (pPixmap) { pPixmap->devPrivate.ptr = NULL; /* help catch/avoid heap-use-after-free */ - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); } } @@ -148,7 +151,7 @@ PixmapPtr PixmapShareToSecondary(PixmapPtr pixmap, ScreenPtr secondary) ret = secondary->SetSharedPixmapBacking(spix, handle); if (ret == FALSE) { - dixDestroyPixmap(spix, 0); + dixPixmapPut(spix); return NULL; } diff --git a/dix/window.c b/dix/window.c index b1829aec4..167f28763 100644 --- a/dix/window.c +++ b/dix/window.c @@ -105,6 +105,7 @@ Equipment Corporation. #include "dix/input_priv.h" #include "dix/property_priv.h" #include "dix/selection_priv.h" +#include "include/dix_pixmap.h" #include "os/auth.h" #include "os/client_priv.h" #include "os/screensaver.h" @@ -1007,9 +1008,9 @@ FreeWindowResources(WindowPtr pWin) if (wInputShape(pWin)) RegionDestroy(wInputShape(pWin)); if (pWin->borderIsPixel == FALSE) - dixDestroyPixmap(pWin->border.pixmap, 0); + dixPixmapPut(pWin->border.pixmap); if (pWin->backgroundState == BackgroundPixmap) - dixDestroyPixmap(pWin->background.pixmap, 0); + dixPixmapPut(pWin->background.pixmap); DeleteAllWindowProperties(pWin); @@ -1189,7 +1190,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) borderRelative = TRUE; if (pixID == None) { if (pWin->backgroundState == BackgroundPixmap) - dixDestroyPixmap(pWin->background.pixmap, 0); + dixPixmapPut(pWin->background.pixmap); if (!pWin->parent) SetRootWindowBackground(pWin, pScreen, &index2); else { @@ -1204,7 +1205,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) goto PatchUp; } if (pWin->backgroundState == BackgroundPixmap) - dixDestroyPixmap(pWin->background.pixmap, 0); + dixPixmapPut(pWin->background.pixmap); if (!pWin->parent) SetRootWindowBackground(pWin, pScreen, &index2); else @@ -1223,7 +1224,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) goto PatchUp; } if (pWin->backgroundState == BackgroundPixmap) - dixDestroyPixmap(pWin->background.pixmap, 0); + dixPixmapPut(pWin->background.pixmap); pWin->backgroundState = BackgroundPixmap; pWin->background.pixmap = pPixmap; pPixmap->refcnt++; @@ -1239,7 +1240,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); + dixPixmapPut(pWin->background.pixmap); pWin->backgroundState = BackgroundPixel; pWin->background.pixel = (CARD32) *pVlist; /* background pixel overrides background pixmap, @@ -1258,7 +1259,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) } if (pWin->parent->borderIsPixel == TRUE) { if (pWin->borderIsPixel == FALSE) - dixDestroyPixmap(pWin->border.pixmap, 0); + dixPixmapPut(pWin->border.pixmap); pWin->border = pWin->parent->border; pWin->borderIsPixel = TRUE; index2 = CWBorderPixel; @@ -1277,7 +1278,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) goto PatchUp; } if (pWin->borderIsPixel == FALSE) - dixDestroyPixmap(pWin->border.pixmap, 0); + dixPixmapPut(pWin->border.pixmap); pWin->borderIsPixel = FALSE; pWin->border.pixmap = pPixmap; pPixmap->refcnt++; @@ -1290,7 +1291,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) break; case CWBorderPixel: if (pWin->borderIsPixel == FALSE) - dixDestroyPixmap(pWin->border.pixmap, 0); + dixPixmapPut(pWin->border.pixmap); pWin->borderIsPixel = TRUE; pWin->border.pixel = (CARD32) *pVlist; /* border pixel overrides border pixmap, diff --git a/dri3/dri3_request.c b/dri3/dri3_request.c index 31f5abc61..dcc26627a 100644 --- a/dri3/dri3_request.c +++ b/dri3/dri3_request.c @@ -24,6 +24,7 @@ #include #include "dix/dix_priv.h" +#include "include/dix_pixmap.h" #include "dri3_priv.h" #include @@ -243,7 +244,7 @@ proc_dri3_pixmap_from_buffer(ClientPtr client) pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) { - dixDestroyPixmap(pixmap, 0); + dixPixmapPut(pixmap); return rc; } if (!AddResource(stuff->pixmap, X11_RESTYPE_PIXMAP, (void *) pixmap)) @@ -506,7 +507,7 @@ proc_dri3_pixmap_from_buffers(ClientPtr client) pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) { - dixDestroyPixmap(pixmap, 0); + dixPixmapPut(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 2e840d4a4..c9e6ca713 100644 --- a/exa/exa_classic.c +++ b/exa/exa_classic.c @@ -26,6 +26,8 @@ #include +#include "include/dix_pixmap.h" + #include "exa_priv.h" #include "exa.h" @@ -96,7 +98,7 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, pExaPixmap->fb_size = pExaPixmap->fb_pitch * h; if (pExaPixmap->fb_pitch > 131071) { - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); return NULL; } @@ -106,7 +108,7 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, pScreen, pPixmap); if (pExaPixmap->pDamage == NULL) { - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); return NULL; } diff --git a/exa/exa_driver.c b/exa/exa_driver.c index ace336eeb..df1ff9cd3 100644 --- a/exa/exa_driver.c +++ b/exa/exa_driver.c @@ -26,6 +26,8 @@ #include +#include "include/dix_pixmap.h" + #include "exa_priv.h" #include "exa.h" @@ -98,7 +100,7 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth, } if (!pExaPixmap->driverPriv) { - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); return NULL; } diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c index 3ea4a540e..bda3b0e40 100644 --- a/exa/exa_glyphs.c +++ b/exa/exa_glyphs.c @@ -44,6 +44,8 @@ #include +#include "include/dix_pixmap.h" + #include "exa_priv.h" #include "glyphstr_priv.h" #include "mipict.h" @@ -194,7 +196,7 @@ exaRealizeGlyphCaches(ScreenPtr pScreen, unsigned int format) CPComponentAlpha, &component_alpha, serverClient, &error); - dixDestroyPixmap(pPixmap, 0); /* picture holds a refcount */ + dixPixmapPut(pPixmap); /* picture holds a refcount */ if (!pPicture) return FALSE; @@ -728,7 +730,7 @@ exaGlyphs(CARD8 op, { PictFormatPtr argbFormat; - dixDestroyPixmap(pMaskPixmap, 0); + dixPixmapPut(pMaskPixmap); if (!pMask) return; @@ -751,7 +753,7 @@ exaGlyphs(CARD8 op, pMask = CreatePicture(0, &pMaskPixmap->drawable, maskFormat, 0, 0, serverClient, &error); if (!pMask) { - dixDestroyPixmap(pMaskPixmap, 0); + dixPixmapPut(pMaskPixmap); return; } } @@ -832,6 +834,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); + dixPixmapPut(pMaskPixmap); } } diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c index 37fb624da..40aa645bb 100644 --- a/exa/exa_offscreen.c +++ b/exa/exa_offscreen.c @@ -25,13 +25,16 @@ * When allocating, the contiguous block of areas with the minimum eviction * cost is found and evicted in order to make room for the new allocation. */ - -#include "exa_priv.h" +#include #include #include #include +#include "include/dix_pixmap.h" + +#include "exa_priv.h" + #if DEBUG_OFFSCREEN #define DBG_OFFSCREEN(a) ErrorF a #else @@ -478,10 +481,9 @@ ExaOffscreenDefragment(ScreenPtr pScreen) ExaScreenPriv(pScreen); ExaOffscreenArea *area, *largest_available = NULL; int largest_size = 0; - PixmapPtr pDstPix; ExaPixmapPrivPtr pExaDstPix; - pDstPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, 0, 0); + PixmapPtr pDstPix = dixPixmapCreate(pScreen, 0, 0, 0, 0); if (!pDstPix) return NULL; @@ -614,7 +616,7 @@ ExaOffscreenDefragment(ScreenPtr pScreen) pDstPix->drawable.depth = 0; pDstPix->drawable.bitsPerPixel = 0; - dixDestroyPixmap(pDstPix, 0); + dixPixmapPut(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..a9eb2483e 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -26,6 +26,8 @@ #include +#include "include/dix_pixmap.h" + #include "exa_priv.h" #include "mipict.h" @@ -1082,7 +1084,7 @@ exaCreateAlphaPicture(ScreenPtr pScreen, return 0; pGC = GetScratchGC(pPixmap->drawable.depth, pScreen); if (!pGC) { - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); return 0; } ValidateGC(&pPixmap->drawable, pGC); @@ -1095,7 +1097,7 @@ exaCreateAlphaPicture(ScreenPtr pScreen, FreeScratchGC(pGC); pPicture = CreatePicture(0, &pPixmap->drawable, pPictFormat, 0, 0, serverClient, &error); - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); return pPicture; } diff --git a/fb/fboverlay.c b/fb/fboverlay.c index 06f9ee4e2..04b41045e 100644 --- a/fb/fboverlay.c +++ b/fb/fboverlay.c @@ -26,6 +26,8 @@ #include +#include "include/dix_pixmap.h" + #include "fb.h" #include "fboverlay.h" #include "shmint.h" @@ -81,7 +83,7 @@ fbOverlayCloseScreen(ScreenPtr pScreen) int i; for (i = 0; i < pScrPriv->nlayers; i++) { - dixDestroyPixmap(pScrPriv->layer[i].u.run.pixmap, 0); + dixPixmapPut(pScrPriv->layer[i].u.run.pixmap); RegionUninit(&pScrPriv->layer[i].u.run.region); } return TRUE; @@ -125,8 +127,7 @@ fbOverlayCreateScreenResources(ScreenPtr pScreen) pbits = pScrPriv->layer[i].u.init.pbits; width = pScrPriv->layer[i].u.init.width; depth = pScrPriv->layer[i].u.init.depth; - pPixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, 0); - if (!pPixmap) + if (!(pPixmap = dixPixmapCreate(pScreen, 0, 0, depth, 0))) return FALSE; if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScreen->width, pScreen->height, depth, diff --git a/glamor/glamor_composite_glyphs.c b/glamor/glamor_composite_glyphs.c index c1a0cb0f0..8a87267fe 100644 --- a/glamor/glamor_composite_glyphs.c +++ b/glamor/glamor_composite_glyphs.c @@ -19,9 +19,13 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ -#include -#include "Xprintf.h" +#include +#include + +#include "include/dix_pixmap.h" + +#include "Xprintf.h" #include "glamor_priv.h" #include "glamor_transform.h" #include "glamor_transfer.h" @@ -436,7 +440,7 @@ glamor_composite_glyphs(CARD8 op, glyphs_queued = 0; } if (glyph_atlas->atlas) { - dixDestroyPixmap(glyph_atlas->atlas, 0); + dixPixmapPut(glyph_atlas->atlas); glyph_atlas->atlas = NULL; } } @@ -571,7 +575,7 @@ glamor_free_glyph_atlas(struct glamor_glyph_atlas *atlas) { if (!atlas) return; - dixDestroyPixmap(atlas->atlas, 0); + dixPixmapPut(atlas->atlas); free (atlas); } diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 9924eb944..29ad8ac83 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -39,6 +39,8 @@ #include #define EGL_DISPLAY_NO_X_MESA +#include "include/dix_pixmap.h" + #include #include @@ -337,7 +339,7 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok) return FALSE; } - exported = screen->CreatePixmap(screen, 0, 0, pixmap->drawable.depth, 0); + exported = dixPixmapCreate(screen, 0, 0, pixmap->drawable.depth, 0); screen->ModifyPixmapHeader(exported, width, height, 0, 0, gbm_bo_get_stride(bo), NULL); if (!glamor_egl_create_textured_pixmap_from_gbm_bo(exported, bo, @@ -345,7 +347,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); + dixPixmapPut(exported); gbm_bo_destroy(bo); return FALSE; } @@ -366,7 +368,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); + dixPixmapPut(exported); return TRUE; } @@ -584,14 +586,13 @@ glamor_pixmap_from_fds(ScreenPtr screen, CARD8 depth, CARD8 bpp, uint64_t modifier) { - PixmapPtr pixmap; struct glamor_egl_screen_private *glamor_egl; Bool ret = FALSE; int i; glamor_egl = glamor_egl_get_screen_private(xf86ScreenToScrn(screen)); - pixmap = screen->CreatePixmap(screen, 0, 0, depth, 0); + PixmapPtr pixmap = dixPixmapCreate(screen, 0, 0, depth, 0); #ifdef GBM_BO_WITH_MODIFIERS if (glamor_egl->dmabuf_capable && modifier != DRM_FORMAT_MOD_INVALID) { @@ -624,7 +625,7 @@ glamor_pixmap_from_fds(ScreenPtr screen, } if (ret == FALSE) { - dixDestroyPixmap(pixmap, 0); + dixPixmapPut(pixmap); return NULL; } return pixmap; @@ -637,16 +638,15 @@ glamor_pixmap_from_fd(ScreenPtr screen, CARD16 height, CARD16 stride, CARD8 depth, CARD8 bpp) { - PixmapPtr pixmap; Bool ret; - pixmap = screen->CreatePixmap(screen, 0, 0, depth, 0); + PixmapPtr pixmap = dixPixmapCreate(screen, 0, 0, depth, 0); ret = glamor_back_pixmap_from_fd(pixmap, fd, width, height, stride, depth, bpp); if (ret == FALSE) { - dixDestroyPixmap(pixmap, 0); + dixPixmapPut(pixmap); return NULL; } return pixmap; diff --git a/glx/glxcmds.c b/glx/glxcmds.c index f8c3a965c..217e39b30 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -36,6 +36,7 @@ #include #include "dix/dix_priv.h" +#include "include/dix_pixmap.h" #include "glxserver.h" #include @@ -1391,7 +1392,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); + dixPixmapPut(pPixmap); return err; } diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index 33dcccf8f..663fe96b7 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -38,6 +38,7 @@ #include #include "dix/input_priv.h" +#include "include/dix_pixmap.h" #include "hostx.h" @@ -1655,14 +1656,13 @@ 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); + dixPixmapPut(old_screen_pixmap); - screen_pixmap = pScreen->CreatePixmap(pScreen, + if (!(screen_pixmap = dixPixmapCreate(pScreen, pScreen->width, pScreen->height, pScreen->rootDepth, - GLAMOR_CREATE_NO_LARGE); - if (!screen_pixmap) + GLAMOR_CREATE_NO_LARGE))) return FALSE; pScreen->SetScreenPixmap(screen_pixmap); diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c index 945efa105..0a94a0305 100644 --- a/hw/vfb/InitOutput.c +++ b/hw/vfb/InitOutput.c @@ -39,6 +39,7 @@ from The Open Group. #include "dix/colormap_priv.h" #include "dix/dix_priv.h" #include "dix/screenint_priv.h" +#include "include/dix_pixmap.h" #include "os/cmdline.h" #include "os/ddx_priv.h" #include "os/osdep.h" @@ -729,7 +730,7 @@ vfbCloseScreen(ScreenPtr pScreen) /* * fb overwrites miCloseScreen, so do this here */ - dixDestroyPixmap(pScreen->devPrivate, 0); + dixPixmapPut(pScreen->devPrivate); pScreen->devPrivate = NULL; return pScreen->CloseScreen(pScreen); diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index f838006bc..ff7cb295e 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -50,6 +50,7 @@ #include "dix/dix_priv.h" #include "dix/eventconvert.h" #include "dix/exevents_priv.h" +#include "include/dix_pixmap.h" #include "xf86.h" #include "xf86str.h" @@ -372,7 +373,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet) if (oldPix->drawable.id) FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE); else - dixDestroyPixmap(oldPix, 0); + dixPixmapPut(oldPix); } free(pScreenPriv->current); pScreenPriv->current = NULL; @@ -434,14 +435,14 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet) if (oldPix->drawable.id) FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE); else - dixDestroyPixmap(oldPix, 0); + dixPixmapPut(oldPix); } free(pScreenPriv->current); pScreenPriv->current = NULL; } if (pMode->flags & DGA_PIXMAP_AVAILABLE) { - if ((pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, pMode->depth, 0))) { + if ((pPix = dixPixmapCreate(pScreen, 0, 0, pMode->depth, 0))) { (*pScreen->ModifyPixmapHeader) (pPix, pMode->pixmapWidth, pMode->pixmapHeight, pMode->depth, diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index f86635d4d..597c7a7a8 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -38,6 +38,9 @@ #ifdef WITH_LIBDRM #include #endif + +#include "include/dix_pixmap.h" + #include "list.h" #include "scrnintstr.h" #include "windowstr.h" @@ -433,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); + dixPixmapPut(pPriv->prime_secondary_pixmap->primary_pixmap); + dixPixmapPut(pPriv->prime_secondary_pixmap); } if (pPriv->buffers != NULL) { @@ -446,7 +449,7 @@ DRI2DrawableGone(void *p, XID id) if (pPriv->redirectpixmap) { (*pDraw->pScreen->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); - dixDestroyPixmap(pPriv->redirectpixmap, 0); + dixPixmapPut(pPriv->redirectpixmap); } dri2WakeAll(CLIENT_SIGNAL_ANY, pPriv, WAKE_SWAP); @@ -837,14 +840,14 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest) mpix = pPriv->redirectpixmap; } else { if (primary->ReplaceScanoutPixmap) { - mpix = (*primary->CreatePixmap)(primary, pDraw->width, pDraw->height, - pDraw->depth, CREATE_PIXMAP_USAGE_SHARED); + mpix = dixPixmapCreate(primary, pDraw->width, pDraw->height, + pDraw->depth, CREATE_PIXMAP_USAGE_SHARED); if (!mpix) return NULL; ret = (*primary->ReplaceScanoutPixmap)(pDraw, mpix, TRUE); if (ret == FALSE) { - dixDestroyPixmap(mpix, 0); + dixPixmapPut(mpix); return NULL; } pPriv->redirectpixmap = mpix; @@ -853,7 +856,7 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest) } } else if (pPriv->redirectpixmap) { (*primary->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); - dixDestroyPixmap(pPriv->redirectpixmap, 0); + dixPixmapPut(pPriv->redirectpixmap); pPriv->redirectpixmap = NULL; } } @@ -866,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); + dixPixmapPut(pPriv->prime_secondary_pixmap->primary_pixmap); + dixPixmapPut(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..780ca539e 100644 --- a/hw/xfree86/drivers/modesetting/dri2.c +++ b/hw/xfree86/drivers/modesetting/dri2.c @@ -38,6 +38,7 @@ #include #include "dix/dix_priv.h" +#include "include/dix_pixmap.h" #include "list.h" #include "xf86.h" @@ -183,12 +184,11 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable, return NULL; } - pixmap = screen->CreatePixmap(screen, - pixmap_width, - pixmap_height, - pixmap_cpp, - 0); - if (pixmap == NULL) { + if (!(pixmap = dixPixmapCreate(screen, + pixmap_width, + pixmap_height, + pixmap_cpp, + 0))) { free(private); free(buffer); return NULL; @@ -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); + dixPixmapPut(pixmap); free(private); free(buffer); return NULL; @@ -247,7 +247,7 @@ 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); + dixPixmapPut(private->pixmap); free(private); free(buffer); } @@ -522,7 +522,7 @@ update_front(DrawablePtr draw, DRI2BufferPtr front) front->name = name; - dixDestroyPixmap(priv->pixmap, 0); + dixPixmapPut(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 2072ce0c5..80f307762 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -33,6 +33,9 @@ #include #include #include + +#include "include/dix_pixmap.h" + #include "dumb_bo.h" #include "inputstr.h" #include "xf86str.h" @@ -1570,7 +1573,7 @@ drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) pScreen->canDoBGNoneRoot = TRUE; - dixDestroyPixmap(drmmode->fbcon_pixmap, 0); + dixPixmapPut(drmmode->fbcon_pixmap); drmmode->fbcon_pixmap = NULL; #endif } @@ -2150,7 +2153,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); + dixPixmapPut(pixmap); } return NullPixmap; } @@ -2222,7 +2225,7 @@ 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); + dixPixmapPut(pixmap); if (data) { drmModeRmFB(drmmode->fd, *fb_id); diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c index 15a6d03c6..47eebf4c2 100644 --- a/hw/xnest/GC.c +++ b/hw/xnest/GC.c @@ -18,15 +18,17 @@ is" without express or implied warranty. #include #include #include +#include #include #include +#include "include/dix_pixmap.h" + #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "scrnintstr.h" -#include #include "mistruct.h" #include "region.h" @@ -262,7 +264,7 @@ xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects) * current pixmap contents. */ pGC->clientClip = (*pGC->pScreen->BitmapToRegion) ((PixmapPtr) pValue); - dixDestroyPixmap((PixmapPtr) pValue, 0); + dixPixmapPut((PixmapPtr) pValue); pValue = pGC->clientClip; break; diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index 6618a0a34..7caab1ac0 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -25,6 +25,8 @@ #include +#include "include/dix_pixmap.h" + #define MESA_EGL_NO_X11_HEADERS #define EGL_NO_X11 #include @@ -156,7 +158,7 @@ xwl_glamor_create_screen_resources(ScreenPtr screen) fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0); } else { - screen->devPrivate = screen->CreatePixmap( + screen->devPrivate = dixPixmapCreate( screen, screen->width, screen->height, screen->rootDepth, CREATE_PIXMAP_USAGE_BACKING_PIXMAP); } diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index db2019c61..7ff391616 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -31,6 +31,7 @@ #include "dix/dix_priv.h" #include "dix/input_priv.h" +#include "include/dix_pixmap.h" #include "randr/randrstr_priv.h" #include "os/log_priv.h" @@ -171,17 +172,16 @@ update_backing_pixmaps(struct xwl_screen *xwl_screen, int width, int height) { ScreenPtr pScreen = xwl_screen->screen; WindowPtr pRoot = pScreen->root; - PixmapPtr old_pixmap, new_pixmap; - old_pixmap = pScreen->GetScreenPixmap(pScreen); - new_pixmap = pScreen->CreatePixmap(pScreen, width, height, - pScreen->rootDepth, - CREATE_PIXMAP_USAGE_BACKING_PIXMAP); + PixmapPtr old_pixmap = pScreen->GetScreenPixmap(pScreen); + PixmapPtr new_pixmap = dixPixmapCreate(pScreen, width, height, + pScreen->rootDepth, + CREATE_PIXMAP_USAGE_BACKING_PIXMAP); pScreen->SetScreenPixmap(new_pixmap); if (old_pixmap) { TraverseTree(pRoot, xwl_set_pixmap_visit_window, old_pixmap); - dixDestroyPixmap(old_pixmap, 0); + dixPixmapPut(old_pixmap); } pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL); diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c index 07d58ee6a..6fe1ef850 100644 --- a/hw/xwayland/xwayland-present.c +++ b/hw/xwayland/xwayland-present.c @@ -35,6 +35,8 @@ #include #endif /* DRI3 */ +#include "include/dix_pixmap.h" + #include "xwayland-present.h" #include "xwayland-screen.h" #include "xwayland-shm.h" @@ -315,7 +317,7 @@ xwl_present_release_pixmap(struct xwl_present_event *event) return; xwl_pixmap_del_buffer_release_cb(event->pixmap); - dixDestroyPixmap(event->pixmap, event->pixmap->drawable.id); + dixPixmapPut(event->pixmap); event->pixmap = NULL; } @@ -1122,7 +1124,7 @@ retry: screen->SetScreenPixmap(vblank->pixmap); vblank->pixmap->refcnt++; - dixDestroyPixmap(old_pixmap, old_pixmap->drawable.id); + dixPixmapPut(old_pixmap); /* Report damage, let damage_report ignore it though */ xwl_screen->ignore_damage = TRUE; diff --git a/hw/xwayland/xwayland-window-buffers.c b/hw/xwayland/xwayland-window-buffers.c index 09265078c..4142bafcd 100644 --- a/hw/xwayland/xwayland-window-buffers.c +++ b/hw/xwayland/xwayland-window-buffers.c @@ -26,6 +26,8 @@ #include +#include "include/dix_pixmap.h" + #include "gcstruct.h" #include "xwayland-window.h" @@ -98,7 +100,7 @@ static void xwl_window_buffer_destroy_pixmap(struct xwl_window_buffer *xwl_window_buffer) { xwl_pixmap_del_buffer_release_cb(xwl_window_buffer->pixmap); - dixDestroyPixmap(xwl_window_buffer->pixmap, 0); + dixPixmapPut(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); + dixPixmapPut(window_pixmap); } static Bool diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index c1eea17b5..6791ddc82 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -34,6 +34,7 @@ #include "dix/dix_priv.h" #include "dix/property_priv.h" +#include "include/dix_pixmap.h" #include "os/log_priv.h" #include "compositeext.h" @@ -318,7 +319,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); + dixPixmapPut(xwl_window_swap_pixmap(xwl_window, FALSE)); } static void diff --git a/mi/miarc.c b/mi/miarc.c index 94a18846f..9c5fa4ef5 100644 --- a/mi/miarc.c +++ b/mi/miarc.c @@ -51,6 +51,10 @@ SOFTWARE. #include #include #include +#include + +#include "include/dix_pixmap.h" + #include "misc.h" #include "gcstruct.h" #include "scrnintstr.h" @@ -59,7 +63,6 @@ SOFTWARE. #include "mifpoly.h" #include "mi.h" #include "mifillarc.h" -#include #define EPSILON 0.000001 #define ISEQUAL(a,b) (fabs((a) - (b)) <= EPSILON) @@ -992,9 +995,9 @@ miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) } /* allocate a bitmap of the appropriate size, and validate it */ - pDrawTo = (DrawablePtr) (*pDraw->pScreen->CreatePixmap) - (pDraw->pScreen, pixmapWidth, pixmapHeight, 1, - CREATE_PIXMAP_USAGE_SCRATCH); + pDrawTo = (DrawablePtr) dixPixmapCreate(pDraw->pScreen, pixmapWidth, + pixmapHeight, 1, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pDrawTo) { FreeScratchGC(pGCTo); return; @@ -1110,7 +1113,7 @@ miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) out: if (fTricky) { - dixDestroyPixmap((PixmapPtr) pDrawTo, 0); + dixPixmapPut((PixmapPtr) pDrawTo); FreeScratchGC(pGCTo); } } diff --git a/mi/midispcur.c b/mi/midispcur.c index 401e16768..d8b1a14c5 100644 --- a/mi/midispcur.c +++ b/mi/midispcur.c @@ -31,10 +31,11 @@ in this Software without prior written authorization from The Open Group. #include -#include +#include -#include "dix/dix_priv.h" -#include "dix/gc_priv.h" +#include "dix/dix_priv.h" +#include "dix/gc_priv.h" +#include "include/dix_pixmap.h" #include "misc.h" #include "input.h" @@ -119,11 +120,11 @@ miDCSwitchScreenCursor(ScreenPtr pScreen, CursorPtr pCursor, PixmapPtr sourceBit { miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); - dixDestroyPixmap(pScreenPriv->sourceBits, 0); + dixPixmapPut(pScreenPriv->sourceBits); pScreenPriv->sourceBits = sourceBits; if (pScreenPriv->maskBits) - dixDestroyPixmap(pScreenPriv->maskBits, 0); + dixPixmapPut(pScreenPriv->maskBits); pScreenPriv->maskBits = maskBits; if (pScreenPriv->pPicture) @@ -194,15 +195,15 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor) if (!pFormat) return FALSE; - pPixmap = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, - pCursor->bits->height, 32, - CREATE_PIXMAP_USAGE_SCRATCH); + pPixmap = dixPixmapCreate(pScreen, pCursor->bits->width, + pCursor->bits->height, 32, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) return FALSE; pGC = GetScratchGC(32, pScreen); if (!pGC) { - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(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); + dixPixmapPut(pPixmap); if (!pPicture) return FALSE; @@ -221,15 +222,15 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor) return TRUE; } - sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, - pCursor->bits->height, 1, 0); + sourceBits = dixPixmapCreate(pScreen, pCursor->bits->width, + pCursor->bits->height, 1, 0); if (!sourceBits) return FALSE; - maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, - pCursor->bits->height, 1, 0); + maskBits = dixPixmapCreate(pScreen, pCursor->bits->width, + pCursor->bits->height, 1, 0); if (!maskBits) { - dixDestroyPixmap(sourceBits, 0); + dixPixmapPut(sourceBits); return FALSE; } @@ -237,8 +238,8 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor) pGC = GetScratchGC(1, pScreen); if (!pGC) { - dixDestroyPixmap(sourceBits, 0); - dixDestroyPixmap(maskBits, 0); + dixPixmapPut(sourceBits); + dixPixmapPut(maskBits); return FALSE; } @@ -394,9 +395,9 @@ miDCSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen, pSave = pBuffer->pSave; pWin = pScreen->root; if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) { - dixDestroyPixmap(pSave, 0); + dixPixmapPut(pSave); pBuffer->pSave = pSave = - (*pScreen->CreatePixmap) (pScreen, w, h, pScreen->rootDepth, 0); + dixPixmapCreate(pScreen, w, h, pScreen->rootDepth, 0); if (!pSave) return FALSE; } @@ -511,7 +512,7 @@ miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) * is freed when that root window is destroyed, so don't * free it again here. */ - dixDestroyPixmap(pBuffer->pSave, 0); + dixPixmapPut(pBuffer->pSave); free(pBuffer); dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen, diff --git a/mi/migc.c b/mi/migc.c index 14389b0f5..acdb609ed 100644 --- a/mi/migc.c +++ b/mi/migc.c @@ -28,6 +28,8 @@ from The Open Group. #include +#include "include/dix_pixmap.h" + #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" @@ -63,7 +65,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); + dixPixmapPut(pvalue); } else if (type == CT_REGION) { /* stuff the region in the GC */ diff --git a/mi/miglblt.c b/mi/miglblt.c index a3e625a20..705b4bbea 100644 --- a/mi/miglblt.c +++ b/mi/miglblt.c @@ -46,12 +46,16 @@ SOFTWARE. #include -#include -#include -#include +#include +#include +#include +#include +#include +#include + +#include "include/dix_pixmap.h" + #include "misc.h" -#include -#include #include "dixfontstr.h" #include "gcstruct.h" #include "windowstr.h" @@ -84,7 +88,6 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int ngly ) { int width, height; - PixmapPtr pPixmap; int nbyLine; /* bytes per line of padded pixmap */ FontPtr pfont; GCPtr pGCtmp; @@ -110,15 +113,14 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int ngly FONTMINBOUNDS(pfont, leftSideBearing); height = FONTMAXBOUNDS(pfont, ascent) + FONTMAXBOUNDS(pfont, descent); - pPixmap = (*pDrawable->pScreen->CreatePixmap) (pDrawable->pScreen, - width, height, 1, - CREATE_PIXMAP_USAGE_SCRATCH); + PixmapPtr pPixmap = dixPixmapCreate(pDrawable->pScreen, width, height, 1, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) return; pGCtmp = GetScratchGC(1, pDrawable->pScreen); if (!pGCtmp) { - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); return; } @@ -132,7 +134,7 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int ngly nbyLine = BitmapBytePad(width); pbits = xallocarray(height, nbyLine); if (!pbits) { - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); FreeScratchGC(pGCtmp); return; } @@ -174,7 +176,7 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int ngly } x += pci->metrics.characterWidth; } - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); free(pbits); FreeScratchGC(pGCtmp); } diff --git a/mi/miscrinit.c b/mi/miscrinit.c index 7208dcec2..620d9181c 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -30,6 +30,7 @@ from The Open Group. #include +#include "include/dix_pixmap.h" #include "mi/mi_priv.h" #include "servermd.h" @@ -124,7 +125,7 @@ miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, static Bool miCloseScreen(ScreenPtr pScreen) { - dixDestroyPixmap((PixmapPtr) pScreen->devPrivate, 0); + dixPixmapPut((PixmapPtr) pScreen->devPrivate); return TRUE; } @@ -165,9 +166,7 @@ miCreateScreenResources(ScreenPtr pScreen) /* create a pixmap with no data, then redirect it to point to * the screen */ - pPixmap = - (*pScreen->CreatePixmap) (pScreen, 0, 0, pScreen->rootDepth, 0); - if (!pPixmap) + if (!(pPixmap = dixPixmapCreate(pScreen, 0, 0, pScreen->rootDepth, 0))) return FALSE; if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScrInitParms->xsize, diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c index 53b904ef2..b2dc88aab 100644 --- a/miext/rootless/rootlessScreen.c +++ b/miext/rootless/rootlessScreen.c @@ -79,7 +79,7 @@ RootlessUpdateScreenPixmap(ScreenPtr pScreen) pPix = (*pScreen->GetScreenPixmap) (pScreen); if (pPix == NULL) { - pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, pScreen->rootDepth, 0); + pPix = dixPixmapCreate(pScreen, 0, 0, pScreen->rootDepth, 0); (*pScreen->SetScreenPixmap) (pPix); } diff --git a/miext/shadow/shadow.c b/miext/shadow/shadow.c index c0f08780a..34706cddd 100644 --- a/miext/shadow/shadow.c +++ b/miext/shadow/shadow.c @@ -23,8 +23,10 @@ #include #include +#include + +#include "include/dix_pixmap.h" -#include #include "scrnintstr.h" #include "windowstr.h" #include "dixfontstr.h" @@ -103,7 +105,7 @@ shadowCloseScreen(ScreenPtr pScreen) unwrap(pBuf, pScreen, BlockHandler); shadowRemove(pScreen, pBuf->pPixmap); DamageDestroy(pBuf->pDamage); - dixDestroyPixmap(pBuf->pPixmap, 0); + dixPixmapPut(pBuf->pPixmap); free(pBuf); return pScreen->CloseScreen(pScreen); } diff --git a/present/present_scmd.c b/present/present_scmd.c index 5f05f8fc9..cf8e3e8af 100644 --- a/present/present_scmd.c +++ b/present/present_scmd.c @@ -19,6 +19,9 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ +#include + +#include "include/dix_pixmap.h" #include "present_priv.h" #include @@ -274,7 +277,7 @@ present_flip_idle(ScreenPtr screen) screen_priv->flip_serial, screen_priv->flip_idle_fence); if (screen_priv->flip_idle_fence) present_fence_destroy(screen_priv->flip_idle_fence); - dixDestroyPixmap(screen_priv->flip_pixmap, screen_priv->flip_pixmap->drawable.id); + dixPixmapPut(screen_priv->flip_pixmap); screen_priv->flip_crtc = NULL; screen_priv->flip_window = NULL; screen_priv->flip_serial = 0; diff --git a/present/present_vblank.c b/present/present_vblank.c index 1c0461e84..3210a09da 100644 --- a/present/present_vblank.c +++ b/present/present_vblank.c @@ -19,9 +19,13 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ +#include + +#include + +#include "include/dix_pixmap.h" #include "present_priv.h" -#include void present_vblank_notify(present_vblank_ptr vblank, CARD8 kind, CARD8 mode, uint64_t ust, uint64_t crtc_msc) @@ -230,7 +234,7 @@ present_vblank_scrap(present_vblank_ptr vblank) present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence); present_fence_destroy(vblank->idle_fence); - dixDestroyPixmap(vblank->pixmap, vblank->pixmap->drawable.id); + dixPixmapPut(vblank->pixmap); vblank->pixmap = NULL; vblank->idle_fence = NULL; @@ -252,7 +256,7 @@ present_vblank_destroy(present_vblank_ptr vblank) /* Drop pixmap reference */ if (vblank->pixmap) - dixDestroyPixmap(vblank->pixmap, vblank->pixmap->drawable.id); + dixPixmapPut(vblank->pixmap); /* Free regions */ if (vblank->valid) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 2fb92b053..1e23aaa4c 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -20,13 +20,16 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ +#include + +#include + +#include "include/dix_pixmap.h" #include "randrstr_priv.h" #include "swaprep.h" #include "mipointer.h" -#include - RESTYPE RRCrtcType = 0; /* @@ -382,11 +385,11 @@ rrDestroySharedPixmap(RRCrtcPtr crtc, PixmapPtr pPixmap) { */ PixmapUnshareSecondaryPixmap(pPixmap); - dixDestroyPixmap(pPixmap->primary_pixmap, 0); - dixDestroyPixmap(pPixmap->primary_pixmap, 0); + dixPixmapPut(pPixmap->primary_pixmap); + dixPixmapPut(pPixmap->primary_pixmap); } - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); } void @@ -431,16 +434,14 @@ rrCreateSharedPixmap(RRCrtcPtr crtc, ScreenPtr primary, int width, int height, int depth, int x, int y, Rotation rotation) { - PixmapPtr mpix, spix; - - mpix = primary->CreatePixmap(primary, width, height, depth, - CREATE_PIXMAP_USAGE_SHARED); + PixmapPtr mpix = dixPixmapCreate(primary, width, height, depth, + CREATE_PIXMAP_USAGE_SHARED); if (!mpix) return NULL; - spix = PixmapShareToSecondary(mpix, crtc->pScreen); + PixmapPtr spix = PixmapShareToSecondary(mpix, crtc->pScreen); if (spix == NULL) { - dixDestroyPixmap(mpix, 0); + dixPixmapPut(mpix); return NULL; } diff --git a/render/glyph.c b/render/glyph.c index 30f423742..04e770bfa 100644 --- a/render/glyph.c +++ b/render/glyph.c @@ -24,6 +24,7 @@ #include +#include "include/dix_pixmap.h" #include "os/xsha1.h" #include "misc.h" @@ -598,17 +599,17 @@ miGlyphs(CARD8 op, return; width = extents.x2 - extents.x1; height = extents.y2 - extents.y1; - pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, - maskFormat->depth, - CREATE_PIXMAP_USAGE_SCRATCH); - if (!pMaskPixmap) + if (!(pMaskPixmap = dixPixmapCreate(pScreen, width, height, + maskFormat->depth, + CREATE_PIXMAP_USAGE_SCRATCH))) return; + component_alpha = NeedsComponent(maskFormat->format); pMask = CreatePicture(0, &pMaskPixmap->drawable, maskFormat, CPComponentAlpha, &component_alpha, serverClient, &error); if (!pMask) { - dixDestroyPixmap(pMaskPixmap, 0); + dixPixmapPut(pMaskPixmap); return; } pGC = GetScratchGC(pMaskPixmap->drawable.depth, pScreen); @@ -676,7 +677,7 @@ miGlyphs(CARD8 op, xSrc + x - xDst, ySrc + y - yDst, 0, 0, x, y, width, height); FreePicture((void *) pMask, (XID) 0); - dixDestroyPixmap(pMaskPixmap, 0); + dixPixmapPut(pMaskPixmap); } } diff --git a/render/mipict.c b/render/mipict.c index 0bc5417c6..3c35ac06c 100644 --- a/render/mipict.c +++ b/render/mipict.c @@ -23,6 +23,7 @@ #include +#include "include/dix_pixmap.h" #include "os/osdep.h" #include "scrnintstr.h" @@ -67,7 +68,7 @@ miChangePictureClip(PicturePtr pPicture, int type, void *value, int n) clientClip = BitmapToRegion(pScreen, (PixmapPtr) value); if (!clientClip) return BadAlloc; - dixDestroyPixmap((PixmapPtr) value, 0); + dixPixmapPut((PixmapPtr) value); break; case CT_REGION: clientClip = value; diff --git a/render/picture.c b/render/picture.c index 972d2d278..c1f9ae559 100644 --- a/render/picture.c +++ b/render/picture.c @@ -25,6 +25,7 @@ #include #include "dix/colormap_priv.h" +#include "include/dix_pixmap.h" #include "os/osdep.h" #include "misc.h" @@ -1402,7 +1403,7 @@ FreePicture(void *value, XID pid) } } else if (pPicture->pDrawable->type == DRAWABLE_PIXMAP) { - dixDestroyPixmap((PixmapPtr) pPicture->pDrawable, 0); + dixPixmapPut((PixmapPtr) pPicture->pDrawable); } } dixFreeObjectWithPrivates(pPicture, PRIVATE_PICTURE); diff --git a/render/render.c b/render/render.c index e47c60269..a3059b356 100644 --- a/render/render.c +++ b/render/render.c @@ -33,6 +33,7 @@ #include "dix/cursor_priv.h" #include "dix/dix_priv.h" +#include "include/dix_pixmap.h" #include "miext/extinit_priv.h" #include "os/osdep.h" @@ -1120,11 +1121,9 @@ ProcRenderAddGlyphs(ClientPtr client) goto bail; } - pDstPix = (pScreen->CreatePixmap) (pScreen, - width, height, depth, - CREATE_PIXMAP_USAGE_GLYPH_PICTURE); - - if (!pDstPix) { + if (!(pDstPix = dixPixmapCreate(pScreen, + width, height, depth, + CREATE_PIXMAP_USAGE_GLYPH_PICTURE))) { err = BadAlloc; goto bail; } @@ -1137,7 +1136,7 @@ ProcRenderAddGlyphs(ClientPtr client) /* The picture takes a reference to the pixmap, so we drop ours. */ - dixDestroyPixmap(pDstPix, 0); + dixPixmapPut(pDstPix); pDstPix = NULL; if (!pDst) { @@ -1526,9 +1525,9 @@ ProcRenderCreateCursor(ClientPtr client) free(mskbits); return BadImplementation; } - pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32, - CREATE_PIXMAP_USAGE_SCRATCH); - if (!pPixmap) { + + if (!(pPixmap = dixPixmapCreate(pScreen, width, height, 32, + CREATE_PIXMAP_USAGE_SCRATCH))) { free(argbbits); free(srcbits); free(mskbits); @@ -1542,7 +1541,7 @@ ProcRenderCreateCursor(ClientPtr client) free(mskbits); return error; } - dixDestroyPixmap(pPixmap, 0); + dixPixmapPut(pPixmap); CompositePicture(PictOpSrc, pSrc, 0, pPicture, 0, 0, 0, 0, 0, 0, width, height); (*pScreen->GetImage) (pPicture->pDrawable,