WIP: use pixmap lifecycle api

This commit is contained in:
Enrico Weigelt, metux IT consult 2024-10-08 21:04:00 +02:00
parent 28255c291c
commit 41f4b5188e
46 changed files with 290 additions and 228 deletions

View File

@ -36,6 +36,7 @@ in this Software without prior written authorization from the X Consortium.
#include "dix/colormap_priv.h" #include "dix/colormap_priv.h"
#include "dix/cursor_priv.h" #include "dix/cursor_priv.h"
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "include/dix_pixmap.h"
#include "miext/extinit_priv.h" #include "miext/extinit_priv.h"
#include "os/osdep.h" #include "os/osdep.h"
#include "os/screensaver.h" #include "os/screensaver.h"
@ -279,8 +280,8 @@ FreeAttrs(ScreenSaverAttrPtr pAttr)
{ {
CursorPtr pCursor; CursorPtr pCursor;
dixDestroyPixmap(pAttr->pBackgroundPixmap, 0); dixPixmapPut(pAttr->pBackgroundPixmap);
dixDestroyPixmap(pAttr->pBorderPixmap, 0); dixPixmapPut(pAttr->pBorderPixmap);
if ((pCursor = pAttr->pCursor) != 0) if ((pCursor = pAttr->pCursor) != 0)
FreeCursor(pCursor, (Cursor) 0); FreeCursor(pCursor, (Cursor) 0);
} }

View File

@ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xfuncproto.h> #include <X11/Xfuncproto.h>
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "include/dix_pixmap.h"
#include "miext/extinit_priv.h" #include "miext/extinit_priv.h"
#include "os/auth.h" #include "os/auth.h"
#include "os/busfault.h" #include "os/busfault.h"
@ -476,7 +477,7 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
if (!putGC) if (!putGC)
return; return;
pPixmap = (*dst->pScreen->CreatePixmap) (dst->pScreen, sw, sh, depth, pPixmap = dixPixmapCreate(dst->pScreen, sw, sh, depth,
CREATE_PIXMAP_USAGE_SCRATCH); CREATE_PIXMAP_USAGE_SCRATCH);
if (!pPixmap) { if (!pPixmap) {
FreeScratchGC(putGC); FreeScratchGC(putGC);
@ -494,7 +495,7 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
else else
(void) (*pGC->ops->CopyArea) (&pPixmap->drawable, dst, pGC, 0, 0, (void) (*pGC->ops->CopyArea) (&pPixmap->drawable, dst, pGC, 0, 0,
sw, sh, dx, dy); sw, sh, dx, dy);
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
} }
} }
@ -1003,7 +1004,7 @@ ProcShmCreatePixmap(ClientPtr client)
result = XaceHookResourceAccess(client, stuff->pid, result = XaceHookResourceAccess(client, stuff->pid,
X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess); X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (result != Success) { if (result != Success) {
dixDestroyPixmap(pMap, 0); dixPixmapPut(pMap);
break; break;
} }
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc); dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
@ -1039,9 +1040,7 @@ static PixmapPtr
fbShmCreatePixmap(ScreenPtr pScreen, fbShmCreatePixmap(ScreenPtr pScreen,
int width, int height, int depth, char *addr) int width, int height, int depth, char *addr)
{ {
PixmapPtr pPixmap; PixmapPtr pPixmap = dixPixmapCreate(pScreen, 0, 0, pScreen->rootDepth, 0);
pPixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, pScreen->rootDepth, 0);
if (!pPixmap) if (!pPixmap)
return NullPixmap; return NullPixmap;
@ -1049,7 +1048,7 @@ fbShmCreatePixmap(ScreenPtr pScreen,
BitsPerPixel(depth), BitsPerPixel(depth),
PixmapBytePad(width, depth), PixmapBytePad(width, depth),
(void *) addr)) { (void *) addr)) {
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
return NullPixmap; return NullPixmap;
} }
return pPixmap; return pPixmap;
@ -1117,7 +1116,7 @@ ShmCreatePixmap(ClientPtr client, xShmCreatePixmapReq *stuff)
rc = XaceHookResourceAccess(client, stuff->pid, X11_RESTYPE_PIXMAP, rc = XaceHookResourceAccess(client, stuff->pid, X11_RESTYPE_PIXMAP,
pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess); pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) { if (rc != Success) {
dixDestroyPixmap(pMap, 0); dixPixmapPut(pMap);
return rc; return rc;
} }
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc); dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);

View File

@ -43,6 +43,8 @@
#include <dix-config.h> #include <dix-config.h>
#include "include/dix_pixmap.h"
#include "compint.h" #include "compint.h"
static Bool static Bool
@ -308,7 +310,7 @@ compFreeClientWindow(WindowPtr pWin, XID id)
if (pPixmap) { if (pPixmap) {
compRestoreWindow(pWin, pPixmap); compRestoreWindow(pWin, pPixmap);
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
} }
} }
@ -532,7 +534,7 @@ compNewPixmap(WindowPtr pWin, int x, int y, int w, int h)
WindowPtr pParent = pWin->parent; WindowPtr pParent = pWin->parent;
PixmapPtr pPixmap; PixmapPtr pPixmap;
pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth, pPixmap = dixPixmapCreate(pScreen, w, h, pWin->drawable.depth,
CREATE_PIXMAP_USAGE_BACKING_PIXMAP); CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
if (!pPixmap) if (!pPixmap)

View File

@ -44,6 +44,7 @@
#include <dix-config.h> #include <dix-config.h>
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "include/dix_pixmap.h"
#include "os/osdep.h" #include "os/osdep.h"
#include "compint.h" #include "compint.h"
@ -180,7 +181,7 @@ compCheckRedirect(WindowPtr pWin)
compSetParentPixmap(pWin); compSetParentPixmap(pWin);
compRestoreWindow(pWin, pPixmap); compRestoreWindow(pWin, pPixmap);
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
} }
} }
else if (should) { else if (should) {
@ -370,7 +371,7 @@ compFreeOldPixmap(WindowPtr pWin)
CompWindowPtr cw = GetCompWindow(pWin); CompWindowPtr cw = GetCompWindow(pWin);
if (cw->pOldPixmap) { if (cw->pOldPixmap) {
dixDestroyPixmap(cw->pOldPixmap, 0); dixPixmapPut(cw->pOldPixmap);
cw->pOldPixmap = NullPixmap; cw->pOldPixmap = NullPixmap;
} }
} }
@ -599,7 +600,7 @@ void compWindowDestroy(ScreenPtr pScreen, WindowPtr pWin, void *arg)
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
compSetParentPixmap(pWin); compSetParentPixmap(pWin);
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
} }
/* Did we just destroy the overlay window? */ /* Did we just destroy the overlay window? */

View File

@ -34,8 +34,12 @@
#include <dix-config.h> #include <dix-config.h>
#include <stdio.h>
#include <X11/X.h> #include <X11/X.h>
#include <X11/Xproto.h> #include <X11/Xproto.h>
#include "include/dix_pixmap.h"
#include "misc.h" #include "misc.h"
#include "os.h" #include "os.h"
#include "windowstr.h" #include "windowstr.h"
@ -52,8 +56,6 @@
#include "midbe.h" #include "midbe.h"
#include "xace.h" #include "xace.h"
#include <stdio.h>
/****************************************************************************** /******************************************************************************
* *
@ -150,19 +152,20 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
/* Get a front pixmap. */ /* Get a front pixmap. */
if (!(pDbeWindowPriv->pFrontBuffer = if (!(pDbeWindowPriv->pFrontBuffer = dixPixmapCreate(
(*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width, pScreen,
pDbeWindowPriv->width,
pDbeWindowPriv->height, pDbeWindowPriv->height,
pWin->drawable.depth, 0))) { pWin->drawable.depth,
0)))
return BadAlloc; return BadAlloc;
}
/* Get a back pixmap. */ /* Get a back pixmap. */
if (!(pDbeWindowPriv->pBackBuffer = if (!(pDbeWindowPriv->pBackBuffer =
(*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width, dixPixmapCreate(pScreen, pDbeWindowPriv->width,
pDbeWindowPriv->height, pDbeWindowPriv->height,
pWin->drawable.depth, 0))) { pWin->drawable.depth, 0))) {
dixDestroyPixmap(pDbeWindowPriv->pFrontBuffer, 0); dixPixmapPut(pDbeWindowPriv->pFrontBuffer);
return BadAlloc; return BadAlloc;
} }
@ -426,10 +429,10 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
/* Destroy the front and back pixmaps. */ /* Destroy the front and back pixmaps. */
if (pDbeWindowPriv->pFrontBuffer) if (pDbeWindowPriv->pFrontBuffer)
dixDestroyPixmap(pDbeWindowPriv->pFrontBuffer, 0); dixPixmapPut(pDbeWindowPriv->pFrontBuffer);
if (pDbeWindowPriv->pBackBuffer) if (pDbeWindowPriv->pBackBuffer)
dixDestroyPixmap(pDbeWindowPriv->pBackBuffer, 0); dixPixmapPut(pDbeWindowPriv->pBackBuffer);
} /* miDbeWinPrivDelete() */ } /* 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. */ /* Create DBE buffer pixmaps equal to size of resized window. */
pFrontBuffer = (*pScreen->CreatePixmap) (pScreen, width, height, pFrontBuffer = dixPixmapCreate(pScreen, width, height,
pWin->drawable.depth, 0); pWin->drawable.depth, 0);
pBackBuffer = (*pScreen->CreatePixmap) (pScreen, width, height, pBackBuffer = dixPixmapCreate(pScreen, width, height,
pWin->drawable.depth, 0); pWin->drawable.depth, 0);
if (!pFrontBuffer || !pBackBuffer) { if (!pFrontBuffer || !pBackBuffer) {
/* We failed at creating 1 or 2 of the pixmaps. */ /* We failed at creating 1 or 2 of the pixmaps. */
dixDestroyPixmap(pFrontBuffer, 0); dixPixmapPut(pFrontBuffer);
dixDestroyPixmap(pBackBuffer, 0); dixPixmapPut(pBackBuffer);
/* Destroy all buffers for this window. */ /* Destroy all buffers for this window. */
while (pDbeWindowPriv) { while (pDbeWindowPriv) {
@ -595,8 +598,8 @@ void miDbeWindowPosition(ScreenPtr pScreen, WindowPtr pWin, void *arg, int32_t x
* pixmaps. * pixmaps.
*/ */
dixDestroyPixmap(pDbeWindowPriv->pFrontBuffer, 0); dixPixmapPut(pDbeWindowPriv->pFrontBuffer);
dixDestroyPixmap(pDbeWindowPriv->pBackBuffer, 0); dixPixmapPut(pDbeWindowPriv->pBackBuffer);
pDbeWindowPriv->pFrontBuffer = pFrontBuffer; pDbeWindowPriv->pFrontBuffer = pFrontBuffer;
pDbeWindowPriv->pBackBuffer = pBackBuffer; pDbeWindowPriv->pBackBuffer = pBackBuffer;

View File

@ -1478,7 +1478,6 @@ dixDestroyPixmap(void *value, XID pid)
int int
ProcCreatePixmap(ClientPtr client) ProcCreatePixmap(ClientPtr client)
{ {
PixmapPtr pMap;
DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xCreatePixmapReq); REQUEST(xCreatePixmapReq);
@ -1522,9 +1521,9 @@ ProcCreatePixmap(ClientPtr client)
client->errorValue = stuff->depth; client->errorValue = stuff->depth;
return BadValue; return BadValue;
} }
CreatePmap: CreatePmap:;
pMap = (PixmapPtr) (*pDraw->pScreen->CreatePixmap) PixmapPtr pMap = dixPixmapCreate(pDraw->pScreen, stuff->width,
(pDraw->pScreen, stuff->width, stuff->height, stuff->depth, 0); stuff->height, stuff->depth, 0);
if (pMap) { if (pMap) {
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = stuff->pid; pMap->drawable.id = stuff->pid;

View File

@ -52,6 +52,7 @@ SOFTWARE.
#include <X11/Xproto.h> #include <X11/Xproto.h>
#include "dix/gc_priv.h" #include "dix/gc_priv.h"
#include "include/dix_pixmap.h"
#include "os/osdep.h" #include "os/osdep.h"
#include "misc.h" #include "misc.h"
@ -254,7 +255,7 @@ ChangeGC(ClientPtr client, GCPtr pGC, BITS32 mask, ChangeGCValPtr pUnion)
else { else {
pPixmap->refcnt++; pPixmap->refcnt++;
if (!pGC->tileIsPixel) if (!pGC->tileIsPixel)
dixDestroyPixmap(pGC->tile.pixmap, 0); dixPixmapPut(pGC->tile.pixmap);
pGC->tileIsPixel = FALSE; pGC->tileIsPixel = FALSE;
pGC->tile.pixmap = pPixmap; pGC->tile.pixmap = pPixmap;
} }
@ -271,7 +272,7 @@ ChangeGC(ClientPtr client, GCPtr pGC, BITS32 mask, ChangeGCValPtr pUnion)
if (pPixmap) if (pPixmap)
pPixmap->refcnt++; pPixmap->refcnt++;
if (pGC->stipple) if (pGC->stipple)
dixDestroyPixmap(pGC->stipple, 0); dixPixmapPut(pGC->stipple);
pGC->stipple = pPixmap; pGC->stipple = pPixmap;
} }
break; break;
@ -584,11 +585,10 @@ CreateDefaultTile(GCPtr pGC)
w = 1; w = 1;
h = 1; h = 1;
(*pGC->pScreen->QueryBestSize) (TileShape, &w, &h, pGC->pScreen); (*pGC->pScreen->QueryBestSize) (TileShape, &w, &h, pGC->pScreen);
pTile = (PixmapPtr) pTile = dixPixmapCreate(pGC->pScreen, w, h, pGC->depth, 0);
(*pGC->pScreen->CreatePixmap) (pGC->pScreen, w, h, pGC->depth, 0);
pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen); pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen);
if (!pTile || !pgcScratch) { if (!pTile || !pgcScratch) {
dixDestroyPixmap(pTile, 0); dixPixmapPut(pTile);
if (pgcScratch) if (pgcScratch)
FreeScratchGC(pgcScratch); FreeScratchGC(pgcScratch);
return FALSE; return FALSE;
@ -667,7 +667,7 @@ CopyGC(GCPtr pgcSrc, GCPtr pgcDst, BITS32 mask)
break; break;
} }
if (!pgcDst->tileIsPixel) if (!pgcDst->tileIsPixel)
dixDestroyPixmap(pgcDst->tile.pixmap, 0); dixPixmapPut(pgcDst->tile.pixmap);
pgcDst->tileIsPixel = pgcSrc->tileIsPixel; pgcDst->tileIsPixel = pgcSrc->tileIsPixel;
pgcDst->tile = pgcSrc->tile; pgcDst->tile = pgcSrc->tile;
if (!pgcDst->tileIsPixel) if (!pgcDst->tileIsPixel)
@ -679,7 +679,7 @@ CopyGC(GCPtr pgcSrc, GCPtr pgcDst, BITS32 mask)
if (pgcDst->stipple == pgcSrc->stipple) if (pgcDst->stipple == pgcSrc->stipple)
break; break;
if (pgcDst->stipple) if (pgcDst->stipple)
dixDestroyPixmap(pgcDst->stipple, 0); dixPixmapPut(pgcDst->stipple);
pgcDst->stipple = pgcSrc->stipple; pgcDst->stipple = pgcSrc->stipple;
if (pgcDst->stipple) if (pgcDst->stipple)
pgcDst->stipple->refcnt++; pgcDst->stipple->refcnt++;
@ -774,9 +774,9 @@ FreeGC(void *value, XID gid)
(*pGC->funcs->DestroyClip) (pGC); (*pGC->funcs->DestroyClip) (pGC);
if (!pGC->tileIsPixel) if (!pGC->tileIsPixel)
dixDestroyPixmap(pGC->tile.pixmap, 0); dixPixmapPut(pGC->tile.pixmap);
if (pGC->stipple) if (pGC->stipple)
dixDestroyPixmap(pGC->stipple, 0); dixPixmapPut(pGC->stipple);
if (pGC->funcs) if (pGC->funcs)
(*pGC->funcs->DestroyGC) (pGC); (*pGC->funcs->DestroyGC) (pGC);
@ -876,7 +876,7 @@ CreateDefaultStipple(int screenNum)
w = 16; w = 16;
h = 16; h = 16;
(*pScreen->QueryBestSize) (StippleShape, &w, &h, pScreen); (*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; return FALSE;
/* fill stipple with 1 */ /* fill stipple with 1 */
tmpval[0].val = GXcopy; tmpval[0].val = GXcopy;
@ -884,7 +884,7 @@ CreateDefaultStipple(int screenNum)
tmpval[2].val = FillSolid; tmpval[2].val = FillSolid;
pgcScratch = GetScratchGC(1, pScreen); pgcScratch = GetScratchGC(1, pScreen);
if (!pgcScratch) { if (!pgcScratch) {
dixDestroyPixmap(pScreen->defaultStipple, 0); dixPixmapPut(pScreen->defaultStipple);
return FALSE; return FALSE;
} }
(void) ChangeGC(NullClient, pgcScratch, (void) ChangeGC(NullClient, pgcScratch,
@ -904,7 +904,7 @@ void
FreeDefaultStipple(int screenNum) FreeDefaultStipple(int screenNum)
{ {
ScreenPtr pScreen = screenInfo.screens[screenNum]; ScreenPtr pScreen = screenInfo.screens[screenNum];
dixDestroyPixmap(pScreen->defaultStipple, 0); dixPixmapPut(pScreen->defaultStipple);
} }
int int

View File

@ -46,10 +46,12 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#include <X11/fonts/fontstruct.h>
#include "dix/cursor_priv.h" #include "dix/cursor_priv.h"
#include "include/dix_pixmap.h"
#include "misc.h" #include "misc.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h" #include "dixfontstr.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include "gcstruct.h" #include "gcstruct.h"
@ -77,7 +79,6 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm,
ScreenPtr pScreen; ScreenPtr pScreen;
GCPtr pGC; GCPtr pGC;
xRectangle rect; xRectangle rect;
PixmapPtr ppix;
char *pbits; char *pbits;
ChangeGCVal gcval[3]; ChangeGCVal gcval[3];
unsigned char char2b[2]; unsigned char char2b[2];
@ -91,12 +92,11 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm,
if (!pbits) if (!pbits)
return BadAlloc; return BadAlloc;
ppix = (PixmapPtr) (*pScreen->CreatePixmap) (pScreen, cm->width, PixmapPtr ppix = dixPixmapCreate(pScreen, cm->width, cm->height, 1,
cm->height, 1,
CREATE_PIXMAP_USAGE_SCRATCH); CREATE_PIXMAP_USAGE_SCRATCH);
pGC = GetScratchGC(1, pScreen); pGC = GetScratchGC(1, pScreen);
if (!ppix || !pGC) { if (!ppix || !pGC) {
dixDestroyPixmap(ppix, 0); dixPixmapPut(ppix);
if (pGC) if (pGC)
FreeScratchGC(pGC); FreeScratchGC(pGC);
free(pbits); free(pbits);
@ -126,7 +126,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm,
XYPixmap, 1, pbits); XYPixmap, 1, pbits);
*ppbits = (unsigned char *) pbits; *ppbits = (unsigned char *) pbits;
FreeScratchGC(pGC); FreeScratchGC(pGC);
dixDestroyPixmap(ppix, 0); dixPixmapPut(ppix);
return Success; return Success;
} }

View File

@ -29,6 +29,10 @@ from The Open Group.
#include <dix-config.h> #include <dix-config.h>
#include <X11/X.h> #include <X11/X.h>
#include <X11/extensions/render.h>
#include "include/dix_pixmap.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include "mi.h" #include "mi.h"
#include "misc.h" #include "misc.h"
@ -38,7 +42,6 @@ from The Open Group.
#include "dixstruct.h" #include "dixstruct.h"
#include "gcstruct.h" #include "gcstruct.h"
#include "servermd.h" #include "servermd.h"
#include "X11/extensions/render.h"
#include "picturestr.h" #include "picturestr.h"
#include "randrstr.h" #include "randrstr.h"
/* /*
@ -61,7 +64,7 @@ GetScratchPixmapHeader(ScreenPtr pScreen, int width, int height, int depth,
if ((*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth, if ((*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth,
bitsPerPixel, devKind, pPixData)) bitsPerPixel, devKind, pPixData))
return pPixmap; return pPixmap;
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
} }
return NullPixmap; return NullPixmap;
} }
@ -72,7 +75,7 @@ FreeScratchPixmapHeader(PixmapPtr pPixmap)
{ {
if (pPixmap) { if (pPixmap) {
pPixmap->devPrivate.ptr = NULL; /* help catch/avoid heap-use-after-free */ 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); ret = secondary->SetSharedPixmapBacking(spix, handle);
if (ret == FALSE) { if (ret == FALSE) {
dixDestroyPixmap(spix, 0); dixPixmapPut(spix);
return NULL; return NULL;
} }

View File

@ -105,6 +105,7 @@ Equipment Corporation.
#include "dix/input_priv.h" #include "dix/input_priv.h"
#include "dix/property_priv.h" #include "dix/property_priv.h"
#include "dix/selection_priv.h" #include "dix/selection_priv.h"
#include "include/dix_pixmap.h"
#include "os/auth.h" #include "os/auth.h"
#include "os/client_priv.h" #include "os/client_priv.h"
#include "os/screensaver.h" #include "os/screensaver.h"
@ -1007,9 +1008,9 @@ FreeWindowResources(WindowPtr pWin)
if (wInputShape(pWin)) if (wInputShape(pWin))
RegionDestroy(wInputShape(pWin)); RegionDestroy(wInputShape(pWin));
if (pWin->borderIsPixel == FALSE) if (pWin->borderIsPixel == FALSE)
dixDestroyPixmap(pWin->border.pixmap, 0); dixPixmapPut(pWin->border.pixmap);
if (pWin->backgroundState == BackgroundPixmap) if (pWin->backgroundState == BackgroundPixmap)
dixDestroyPixmap(pWin->background.pixmap, 0); dixPixmapPut(pWin->background.pixmap);
DeleteAllWindowProperties(pWin); DeleteAllWindowProperties(pWin);
@ -1189,7 +1190,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
borderRelative = TRUE; borderRelative = TRUE;
if (pixID == None) { if (pixID == None) {
if (pWin->backgroundState == BackgroundPixmap) if (pWin->backgroundState == BackgroundPixmap)
dixDestroyPixmap(pWin->background.pixmap, 0); dixPixmapPut(pWin->background.pixmap);
if (!pWin->parent) if (!pWin->parent)
SetRootWindowBackground(pWin, pScreen, &index2); SetRootWindowBackground(pWin, pScreen, &index2);
else { else {
@ -1204,7 +1205,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
goto PatchUp; goto PatchUp;
} }
if (pWin->backgroundState == BackgroundPixmap) if (pWin->backgroundState == BackgroundPixmap)
dixDestroyPixmap(pWin->background.pixmap, 0); dixPixmapPut(pWin->background.pixmap);
if (!pWin->parent) if (!pWin->parent)
SetRootWindowBackground(pWin, pScreen, &index2); SetRootWindowBackground(pWin, pScreen, &index2);
else else
@ -1223,7 +1224,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
goto PatchUp; goto PatchUp;
} }
if (pWin->backgroundState == BackgroundPixmap) if (pWin->backgroundState == BackgroundPixmap)
dixDestroyPixmap(pWin->background.pixmap, 0); dixPixmapPut(pWin->background.pixmap);
pWin->backgroundState = BackgroundPixmap; pWin->backgroundState = BackgroundPixmap;
pWin->background.pixmap = pPixmap; pWin->background.pixmap = pPixmap;
pPixmap->refcnt++; pPixmap->refcnt++;
@ -1239,7 +1240,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
if (pWin->backgroundState == ParentRelative) if (pWin->backgroundState == ParentRelative)
borderRelative = TRUE; borderRelative = TRUE;
if (pWin->backgroundState == BackgroundPixmap) if (pWin->backgroundState == BackgroundPixmap)
dixDestroyPixmap(pWin->background.pixmap, 0); dixPixmapPut(pWin->background.pixmap);
pWin->backgroundState = BackgroundPixel; pWin->backgroundState = BackgroundPixel;
pWin->background.pixel = (CARD32) *pVlist; pWin->background.pixel = (CARD32) *pVlist;
/* background pixel overrides background pixmap, /* 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->parent->borderIsPixel == TRUE) {
if (pWin->borderIsPixel == FALSE) if (pWin->borderIsPixel == FALSE)
dixDestroyPixmap(pWin->border.pixmap, 0); dixPixmapPut(pWin->border.pixmap);
pWin->border = pWin->parent->border; pWin->border = pWin->parent->border;
pWin->borderIsPixel = TRUE; pWin->borderIsPixel = TRUE;
index2 = CWBorderPixel; index2 = CWBorderPixel;
@ -1277,7 +1278,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
goto PatchUp; goto PatchUp;
} }
if (pWin->borderIsPixel == FALSE) if (pWin->borderIsPixel == FALSE)
dixDestroyPixmap(pWin->border.pixmap, 0); dixPixmapPut(pWin->border.pixmap);
pWin->borderIsPixel = FALSE; pWin->borderIsPixel = FALSE;
pWin->border.pixmap = pPixmap; pWin->border.pixmap = pPixmap;
pPixmap->refcnt++; pPixmap->refcnt++;
@ -1290,7 +1291,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
break; break;
case CWBorderPixel: case CWBorderPixel:
if (pWin->borderIsPixel == FALSE) if (pWin->borderIsPixel == FALSE)
dixDestroyPixmap(pWin->border.pixmap, 0); dixPixmapPut(pWin->border.pixmap);
pWin->borderIsPixel = TRUE; pWin->borderIsPixel = TRUE;
pWin->border.pixel = (CARD32) *pVlist; pWin->border.pixel = (CARD32) *pVlist;
/* border pixel overrides border pixmap, /* border pixel overrides border pixmap,

View File

@ -24,6 +24,7 @@
#include <unistd.h> #include <unistd.h>
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "include/dix_pixmap.h"
#include "dri3_priv.h" #include "dri3_priv.h"
#include <syncsrv.h> #include <syncsrv.h>
@ -243,7 +244,7 @@ proc_dri3_pixmap_from_buffer(ClientPtr client)
pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess); pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) { if (rc != Success) {
dixDestroyPixmap(pixmap, 0); dixPixmapPut(pixmap);
return rc; return rc;
} }
if (!AddResource(stuff->pixmap, X11_RESTYPE_PIXMAP, (void *) pixmap)) 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); pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) { if (rc != Success) {
dixDestroyPixmap(pixmap, 0); dixPixmapPut(pixmap);
return rc; return rc;
} }
if (!AddResource(stuff->pixmap, X11_RESTYPE_PIXMAP, (void *) pixmap)) if (!AddResource(stuff->pixmap, X11_RESTYPE_PIXMAP, (void *) pixmap))

View File

@ -26,6 +26,8 @@
#include <string.h> #include <string.h>
#include "include/dix_pixmap.h"
#include "exa_priv.h" #include "exa_priv.h"
#include "exa.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; pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
if (pExaPixmap->fb_pitch > 131071) { if (pExaPixmap->fb_pitch > 131071) {
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
return NULL; return NULL;
} }
@ -106,7 +108,7 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
pScreen, pPixmap); pScreen, pPixmap);
if (pExaPixmap->pDamage == NULL) { if (pExaPixmap->pDamage == NULL) {
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
return NULL; return NULL;
} }

View File

@ -26,6 +26,8 @@
#include <string.h> #include <string.h>
#include "include/dix_pixmap.h"
#include "exa_priv.h" #include "exa_priv.h"
#include "exa.h" #include "exa.h"
@ -98,7 +100,7 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
} }
if (!pExaPixmap->driverPriv) { if (!pExaPixmap->driverPriv) {
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
return NULL; return NULL;
} }

View File

@ -44,6 +44,8 @@
#include <stdlib.h> #include <stdlib.h>
#include "include/dix_pixmap.h"
#include "exa_priv.h" #include "exa_priv.h"
#include "glyphstr_priv.h" #include "glyphstr_priv.h"
#include "mipict.h" #include "mipict.h"
@ -194,7 +196,7 @@ exaRealizeGlyphCaches(ScreenPtr pScreen, unsigned int format)
CPComponentAlpha, &component_alpha, serverClient, CPComponentAlpha, &component_alpha, serverClient,
&error); &error);
dixDestroyPixmap(pPixmap, 0); /* picture holds a refcount */ dixPixmapPut(pPixmap); /* picture holds a refcount */
if (!pPicture) if (!pPicture)
return FALSE; return FALSE;
@ -728,7 +730,7 @@ exaGlyphs(CARD8 op,
{ {
PictFormatPtr argbFormat; PictFormatPtr argbFormat;
dixDestroyPixmap(pMaskPixmap, 0); dixPixmapPut(pMaskPixmap);
if (!pMask) if (!pMask)
return; return;
@ -751,7 +753,7 @@ exaGlyphs(CARD8 op,
pMask = CreatePicture(0, &pMaskPixmap->drawable, maskFormat, 0, 0, pMask = CreatePicture(0, &pMaskPixmap->drawable, maskFormat, 0, 0,
serverClient, &error); serverClient, &error);
if (!pMask) { if (!pMask) {
dixDestroyPixmap(pMaskPixmap, 0); dixPixmapPut(pMaskPixmap);
return; return;
} }
} }
@ -832,6 +834,6 @@ exaGlyphs(CARD8 op,
xSrc + x - first_xOff, xSrc + x - first_xOff,
ySrc + y - first_yOff, 0, 0, x, y, width, height); ySrc + y - first_yOff, 0, 0, x, y, width, height);
FreePicture((void *) pMask, (XID) 0); FreePicture((void *) pMask, (XID) 0);
dixDestroyPixmap(pMaskPixmap, 0); dixPixmapPut(pMaskPixmap);
} }
} }

View File

@ -25,13 +25,16 @@
* When allocating, the contiguous block of areas with the minimum eviction * 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. * cost is found and evicted in order to make room for the new allocation.
*/ */
#include <dix-config.h>
#include "exa_priv.h"
#include <limits.h> #include <limits.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include "include/dix_pixmap.h"
#include "exa_priv.h"
#if DEBUG_OFFSCREEN #if DEBUG_OFFSCREEN
#define DBG_OFFSCREEN(a) ErrorF a #define DBG_OFFSCREEN(a) ErrorF a
#else #else
@ -478,10 +481,9 @@ ExaOffscreenDefragment(ScreenPtr pScreen)
ExaScreenPriv(pScreen); ExaScreenPriv(pScreen);
ExaOffscreenArea *area, *largest_available = NULL; ExaOffscreenArea *area, *largest_available = NULL;
int largest_size = 0; int largest_size = 0;
PixmapPtr pDstPix;
ExaPixmapPrivPtr pExaDstPix; ExaPixmapPrivPtr pExaDstPix;
pDstPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, 0, 0); PixmapPtr pDstPix = dixPixmapCreate(pScreen, 0, 0, 0, 0);
if (!pDstPix) if (!pDstPix)
return NULL; return NULL;
@ -614,7 +616,7 @@ ExaOffscreenDefragment(ScreenPtr pScreen)
pDstPix->drawable.depth = 0; pDstPix->drawable.depth = 0;
pDstPix->drawable.bitsPerPixel = 0; pDstPix->drawable.bitsPerPixel = 0;
dixDestroyPixmap(pDstPix, 0); dixPixmapPut(pDstPix);
if (area->state == ExaOffscreenAvail && area->size > largest_size) if (area->state == ExaOffscreenAvail && area->size > largest_size)
return area; return area;

View File

@ -26,6 +26,8 @@
#include <stdlib.h> #include <stdlib.h>
#include "include/dix_pixmap.h"
#include "exa_priv.h" #include "exa_priv.h"
#include "mipict.h" #include "mipict.h"
@ -1082,7 +1084,7 @@ exaCreateAlphaPicture(ScreenPtr pScreen,
return 0; return 0;
pGC = GetScratchGC(pPixmap->drawable.depth, pScreen); pGC = GetScratchGC(pPixmap->drawable.depth, pScreen);
if (!pGC) { if (!pGC) {
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
return 0; return 0;
} }
ValidateGC(&pPixmap->drawable, pGC); ValidateGC(&pPixmap->drawable, pGC);
@ -1095,7 +1097,7 @@ exaCreateAlphaPicture(ScreenPtr pScreen,
FreeScratchGC(pGC); FreeScratchGC(pGC);
pPicture = CreatePicture(0, &pPixmap->drawable, pPictFormat, pPicture = CreatePicture(0, &pPixmap->drawable, pPictFormat,
0, 0, serverClient, &error); 0, 0, serverClient, &error);
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
return pPicture; return pPicture;
} }

View File

@ -26,6 +26,8 @@
#include <stdlib.h> #include <stdlib.h>
#include "include/dix_pixmap.h"
#include "fb.h" #include "fb.h"
#include "fboverlay.h" #include "fboverlay.h"
#include "shmint.h" #include "shmint.h"
@ -81,7 +83,7 @@ fbOverlayCloseScreen(ScreenPtr pScreen)
int i; int i;
for (i = 0; i < pScrPriv->nlayers; 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); RegionUninit(&pScrPriv->layer[i].u.run.region);
} }
return TRUE; return TRUE;
@ -125,8 +127,7 @@ fbOverlayCreateScreenResources(ScreenPtr pScreen)
pbits = pScrPriv->layer[i].u.init.pbits; pbits = pScrPriv->layer[i].u.init.pbits;
width = pScrPriv->layer[i].u.init.width; width = pScrPriv->layer[i].u.init.width;
depth = pScrPriv->layer[i].u.init.depth; depth = pScrPriv->layer[i].u.init.depth;
pPixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, 0); if (!(pPixmap = dixPixmapCreate(pScreen, 0, 0, depth, 0)))
if (!pPixmap)
return FALSE; return FALSE;
if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScreen->width, if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScreen->width,
pScreen->height, depth, pScreen->height, depth,

View File

@ -19,9 +19,13 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE. * OF THIS SOFTWARE.
*/ */
#include <stdlib.h> #include <dix-config.h>
#include "Xprintf.h"
#include <stdlib.h>
#include "include/dix_pixmap.h"
#include "Xprintf.h"
#include "glamor_priv.h" #include "glamor_priv.h"
#include "glamor_transform.h" #include "glamor_transform.h"
#include "glamor_transfer.h" #include "glamor_transfer.h"
@ -436,7 +440,7 @@ glamor_composite_glyphs(CARD8 op,
glyphs_queued = 0; glyphs_queued = 0;
} }
if (glyph_atlas->atlas) { if (glyph_atlas->atlas) {
dixDestroyPixmap(glyph_atlas->atlas, 0); dixPixmapPut(glyph_atlas->atlas);
glyph_atlas->atlas = NULL; glyph_atlas->atlas = NULL;
} }
} }
@ -571,7 +575,7 @@ glamor_free_glyph_atlas(struct glamor_glyph_atlas *atlas)
{ {
if (!atlas) if (!atlas)
return; return;
dixDestroyPixmap(atlas->atlas, 0); dixPixmapPut(atlas->atlas);
free (atlas); free (atlas);
} }

View File

@ -39,6 +39,8 @@
#include <xf86drm.h> #include <xf86drm.h>
#define EGL_DISPLAY_NO_X_MESA #define EGL_DISPLAY_NO_X_MESA
#include "include/dix_pixmap.h"
#include <gbm.h> #include <gbm.h>
#include <drm_fourcc.h> #include <drm_fourcc.h>
@ -337,7 +339,7 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok)
return FALSE; 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, screen->ModifyPixmapHeader(exported, width, height, 0, 0,
gbm_bo_get_stride(bo), NULL); gbm_bo_get_stride(bo), NULL);
if (!glamor_egl_create_textured_pixmap_from_gbm_bo(exported, bo, 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, xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Failed to make %dx%dx%dbpp pixmap from GBM bo\n", "Failed to make %dx%dx%dbpp pixmap from GBM bo\n",
width, height, pixmap->drawable.bitsPerPixel); width, height, pixmap->drawable.bitsPerPixel);
dixDestroyPixmap(exported, 0); dixPixmapPut(exported);
gbm_bo_destroy(bo); gbm_bo_destroy(bo);
return FALSE; 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 */ /* Swap the devKind into the original pixmap, reflecting the bo's stride */
screen->ModifyPixmapHeader(pixmap, 0, 0, 0, 0, exported->devKind, NULL); screen->ModifyPixmapHeader(pixmap, 0, 0, 0, 0, exported->devKind, NULL);
dixDestroyPixmap(exported, 0); dixPixmapPut(exported);
return TRUE; return TRUE;
} }
@ -584,14 +586,13 @@ glamor_pixmap_from_fds(ScreenPtr screen,
CARD8 depth, CARD8 bpp, CARD8 depth, CARD8 bpp,
uint64_t modifier) uint64_t modifier)
{ {
PixmapPtr pixmap;
struct glamor_egl_screen_private *glamor_egl; struct glamor_egl_screen_private *glamor_egl;
Bool ret = FALSE; Bool ret = FALSE;
int i; int i;
glamor_egl = glamor_egl_get_screen_private(xf86ScreenToScrn(screen)); 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 #ifdef GBM_BO_WITH_MODIFIERS
if (glamor_egl->dmabuf_capable && modifier != DRM_FORMAT_MOD_INVALID) { if (glamor_egl->dmabuf_capable && modifier != DRM_FORMAT_MOD_INVALID) {
@ -624,7 +625,7 @@ glamor_pixmap_from_fds(ScreenPtr screen,
} }
if (ret == FALSE) { if (ret == FALSE) {
dixDestroyPixmap(pixmap, 0); dixPixmapPut(pixmap);
return NULL; return NULL;
} }
return pixmap; return pixmap;
@ -637,16 +638,15 @@ glamor_pixmap_from_fd(ScreenPtr screen,
CARD16 height, CARD16 height,
CARD16 stride, CARD8 depth, CARD8 bpp) CARD16 stride, CARD8 depth, CARD8 bpp)
{ {
PixmapPtr pixmap;
Bool ret; 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, ret = glamor_back_pixmap_from_fd(pixmap, fd, width, height,
stride, depth, bpp); stride, depth, bpp);
if (ret == FALSE) { if (ret == FALSE) {
dixDestroyPixmap(pixmap, 0); dixPixmapPut(pixmap);
return NULL; return NULL;
} }
return pixmap; return pixmap;

View File

@ -36,6 +36,7 @@
#include <X11/extensions/presenttokens.h> #include <X11/extensions/presenttokens.h>
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "include/dix_pixmap.h"
#include "glxserver.h" #include "glxserver.h"
#include <unpack.h> #include <unpack.h>
@ -1391,7 +1392,7 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
err = XaceHookResourceAccess(client, glxDrawableId, X11_RESTYPE_PIXMAP, err = XaceHookResourceAccess(client, glxDrawableId, X11_RESTYPE_PIXMAP,
pPixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess); pPixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (err != Success) { if (err != Success) {
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
return err; return err;
} }

View File

@ -38,6 +38,7 @@
#include <sys/mman.h> #include <sys/mman.h>
#include "dix/input_priv.h" #include "dix/input_priv.h"
#include "include/dix_pixmap.h"
#include "hostx.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. * Thus, delete the current screen pixmap, and put a fresh one in.
*/ */
old_screen_pixmap = pScreen->GetScreenPixmap(pScreen); 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->width,
pScreen->height, pScreen->height,
pScreen->rootDepth, pScreen->rootDepth,
GLAMOR_CREATE_NO_LARGE); GLAMOR_CREATE_NO_LARGE)))
if (!screen_pixmap)
return FALSE; return FALSE;
pScreen->SetScreenPixmap(screen_pixmap); pScreen->SetScreenPixmap(screen_pixmap);

View File

@ -39,6 +39,7 @@ from The Open Group.
#include "dix/colormap_priv.h" #include "dix/colormap_priv.h"
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "dix/screenint_priv.h" #include "dix/screenint_priv.h"
#include "include/dix_pixmap.h"
#include "os/cmdline.h" #include "os/cmdline.h"
#include "os/ddx_priv.h" #include "os/ddx_priv.h"
#include "os/osdep.h" #include "os/osdep.h"
@ -729,7 +730,7 @@ vfbCloseScreen(ScreenPtr pScreen)
/* /*
* fb overwrites miCloseScreen, so do this here * fb overwrites miCloseScreen, so do this here
*/ */
dixDestroyPixmap(pScreen->devPrivate, 0); dixPixmapPut(pScreen->devPrivate);
pScreen->devPrivate = NULL; pScreen->devPrivate = NULL;
return pScreen->CloseScreen(pScreen); return pScreen->CloseScreen(pScreen);

View File

@ -50,6 +50,7 @@
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "dix/eventconvert.h" #include "dix/eventconvert.h"
#include "dix/exevents_priv.h" #include "dix/exevents_priv.h"
#include "include/dix_pixmap.h"
#include "xf86.h" #include "xf86.h"
#include "xf86str.h" #include "xf86str.h"
@ -372,7 +373,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet)
if (oldPix->drawable.id) if (oldPix->drawable.id)
FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE); FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE);
else else
dixDestroyPixmap(oldPix, 0); dixPixmapPut(oldPix);
} }
free(pScreenPriv->current); free(pScreenPriv->current);
pScreenPriv->current = NULL; pScreenPriv->current = NULL;
@ -434,14 +435,14 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet)
if (oldPix->drawable.id) if (oldPix->drawable.id)
FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE); FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE);
else else
dixDestroyPixmap(oldPix, 0); dixPixmapPut(oldPix);
} }
free(pScreenPriv->current); free(pScreenPriv->current);
pScreenPriv->current = NULL; pScreenPriv->current = NULL;
} }
if (pMode->flags & DGA_PIXMAP_AVAILABLE) { 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, (*pScreen->ModifyPixmapHeader) (pPix,
pMode->pixmapWidth, pMode->pixmapWidth,
pMode->pixmapHeight, pMode->depth, pMode->pixmapHeight, pMode->depth,

View File

@ -38,6 +38,9 @@
#ifdef WITH_LIBDRM #ifdef WITH_LIBDRM
#include <xf86drm.h> #include <xf86drm.h>
#endif #endif
#include "include/dix_pixmap.h"
#include "list.h" #include "list.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include "windowstr.h" #include "windowstr.h"
@ -433,8 +436,8 @@ DRI2DrawableGone(void *p, XID id)
} }
if (pPriv->prime_secondary_pixmap) { if (pPriv->prime_secondary_pixmap) {
dixDestroyPixmap(pPriv->prime_secondary_pixmap->primary_pixmap, 0); dixPixmapPut(pPriv->prime_secondary_pixmap->primary_pixmap);
dixDestroyPixmap(pPriv->prime_secondary_pixmap, 0); dixPixmapPut(pPriv->prime_secondary_pixmap);
} }
if (pPriv->buffers != NULL) { if (pPriv->buffers != NULL) {
@ -446,7 +449,7 @@ DRI2DrawableGone(void *p, XID id)
if (pPriv->redirectpixmap) { if (pPriv->redirectpixmap) {
(*pDraw->pScreen->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); (*pDraw->pScreen->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE);
dixDestroyPixmap(pPriv->redirectpixmap, 0); dixPixmapPut(pPriv->redirectpixmap);
} }
dri2WakeAll(CLIENT_SIGNAL_ANY, pPriv, WAKE_SWAP); dri2WakeAll(CLIENT_SIGNAL_ANY, pPriv, WAKE_SWAP);
@ -837,14 +840,14 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
mpix = pPriv->redirectpixmap; mpix = pPriv->redirectpixmap;
} else { } else {
if (primary->ReplaceScanoutPixmap) { if (primary->ReplaceScanoutPixmap) {
mpix = (*primary->CreatePixmap)(primary, pDraw->width, pDraw->height, mpix = dixPixmapCreate(primary, pDraw->width, pDraw->height,
pDraw->depth, CREATE_PIXMAP_USAGE_SHARED); pDraw->depth, CREATE_PIXMAP_USAGE_SHARED);
if (!mpix) if (!mpix)
return NULL; return NULL;
ret = (*primary->ReplaceScanoutPixmap)(pDraw, mpix, TRUE); ret = (*primary->ReplaceScanoutPixmap)(pDraw, mpix, TRUE);
if (ret == FALSE) { if (ret == FALSE) {
dixDestroyPixmap(mpix, 0); dixPixmapPut(mpix);
return NULL; return NULL;
} }
pPriv->redirectpixmap = mpix; pPriv->redirectpixmap = mpix;
@ -853,7 +856,7 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
} }
} else if (pPriv->redirectpixmap) { } else if (pPriv->redirectpixmap) {
(*primary->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); (*primary->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE);
dixDestroyPixmap(pPriv->redirectpixmap, 0); dixPixmapPut(pPriv->redirectpixmap);
pPriv->redirectpixmap = NULL; pPriv->redirectpixmap = NULL;
} }
} }
@ -866,8 +869,8 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
return &pPriv->prime_secondary_pixmap->drawable; return &pPriv->prime_secondary_pixmap->drawable;
else { else {
PixmapUnshareSecondaryPixmap(pPriv->prime_secondary_pixmap); PixmapUnshareSecondaryPixmap(pPriv->prime_secondary_pixmap);
dixDestroyPixmap(pPriv->prime_secondary_pixmap->primary_pixmap, 0); dixPixmapPut(pPriv->prime_secondary_pixmap->primary_pixmap);
dixDestroyPixmap(pPriv->prime_secondary_pixmap, 0); dixPixmapPut(pPriv->prime_secondary_pixmap);
pPriv->prime_secondary_pixmap = NULL; pPriv->prime_secondary_pixmap = NULL;
} }
} }

View File

@ -38,6 +38,7 @@
#include <time.h> #include <time.h>
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "include/dix_pixmap.h"
#include "list.h" #include "list.h"
#include "xf86.h" #include "xf86.h"
@ -183,12 +184,11 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable,
return NULL; return NULL;
} }
pixmap = screen->CreatePixmap(screen, if (!(pixmap = dixPixmapCreate(screen,
pixmap_width, pixmap_width,
pixmap_height, pixmap_height,
pixmap_cpp, pixmap_cpp,
0); 0))) {
if (pixmap == NULL) {
free(private); free(private);
free(buffer); free(buffer);
return NULL; return NULL;
@ -208,7 +208,7 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable,
if (buffer->name == -1) { if (buffer->name == -1) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR, xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Failed to get DRI2 name for pixmap\n"); "Failed to get DRI2 name for pixmap\n");
dixDestroyPixmap(pixmap, 0); dixPixmapPut(pixmap);
free(private); free(private);
free(buffer); free(buffer);
return NULL; return NULL;
@ -247,7 +247,7 @@ static void ms_dri2_destroy_buffer2(ScreenPtr unused, DrawablePtr unused2,
if (buffer->driverPrivate) { if (buffer->driverPrivate) {
ms_dri2_buffer_private_ptr private = buffer->driverPrivate; ms_dri2_buffer_private_ptr private = buffer->driverPrivate;
if (--private->refcnt == 0) { if (--private->refcnt == 0) {
dixDestroyPixmap(private->pixmap, 0); dixPixmapPut(private->pixmap);
free(private); free(private);
free(buffer); free(buffer);
} }
@ -522,7 +522,7 @@ update_front(DrawablePtr draw, DRI2BufferPtr front)
front->name = name; front->name = name;
dixDestroyPixmap(priv->pixmap, 0); dixPixmapPut(priv->pixmap);
front->pitch = pixmap->devKind; front->pitch = pixmap->devKind;
front->cpp = pixmap->drawable.bitsPerPixel / 8; front->cpp = pixmap->drawable.bitsPerPixel / 8;
priv->pixmap = pixmap; priv->pixmap = pixmap;

View File

@ -33,6 +33,9 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <unistd.h> #include <unistd.h>
#include "include/dix_pixmap.h"
#include "dumb_bo.h" #include "dumb_bo.h"
#include "inputstr.h" #include "inputstr.h"
#include "xf86str.h" #include "xf86str.h"
@ -1570,7 +1573,7 @@ drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
pScreen->canDoBGNoneRoot = TRUE; pScreen->canDoBGNoneRoot = TRUE;
dixDestroyPixmap(drmmode->fbcon_pixmap, 0); dixPixmapPut(drmmode->fbcon_pixmap);
drmmode->fbcon_pixmap = NULL; drmmode->fbcon_pixmap = NULL;
#endif #endif
} }
@ -2150,7 +2153,7 @@ drmmode_create_pixmap_header(ScreenPtr pScreen, int width, int height,
if ((*pScreen->ModifyPixmapHeader)(pixmap, width, height, depth, if ((*pScreen->ModifyPixmapHeader)(pixmap, width, height, depth,
bitsPerPixel, devKind, pPixData)) bitsPerPixel, devKind, pPixData))
return pixmap; return pixmap;
dixDestroyPixmap(pixmap, 0); dixPixmapPut(pixmap);
} }
return NullPixmap; return NullPixmap;
} }
@ -2222,7 +2225,7 @@ drmmode_shadow_fb_destroy(xf86CrtcPtr crtc, PixmapPtr pixmap,
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
drmmode_ptr drmmode = drmmode_crtc->drmmode; drmmode_ptr drmmode = drmmode_crtc->drmmode;
dixDestroyPixmap(pixmap, 0); dixPixmapPut(pixmap);
if (data) { if (data) {
drmModeRmFB(drmmode->fd, *fb_id); drmModeRmFB(drmmode->fd, *fb_id);

View File

@ -18,15 +18,17 @@ is" without express or implied warranty.
#include <X11/X.h> #include <X11/X.h>
#include <X11/Xdefs.h> #include <X11/Xdefs.h>
#include <X11/Xproto.h> #include <X11/Xproto.h>
#include <X11/fonts/fontstruct.h>
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_aux.h> #include <xcb/xcb_aux.h>
#include "include/dix_pixmap.h"
#include "gcstruct.h" #include "gcstruct.h"
#include "windowstr.h" #include "windowstr.h"
#include "pixmapstr.h" #include "pixmapstr.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include <X11/fonts/fontstruct.h>
#include "mistruct.h" #include "mistruct.h"
#include "region.h" #include "region.h"
@ -262,7 +264,7 @@ xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
* current pixmap contents. * current pixmap contents.
*/ */
pGC->clientClip = (*pGC->pScreen->BitmapToRegion) ((PixmapPtr) pValue); pGC->clientClip = (*pGC->pScreen->BitmapToRegion) ((PixmapPtr) pValue);
dixDestroyPixmap((PixmapPtr) pValue, 0); dixPixmapPut((PixmapPtr) pValue);
pValue = pGC->clientClip; pValue = pGC->clientClip;
break; break;

View File

@ -25,6 +25,8 @@
#include <xwayland-config.h> #include <xwayland-config.h>
#include "include/dix_pixmap.h"
#define MESA_EGL_NO_X11_HEADERS #define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11 #define EGL_NO_X11
#include <glamor_egl.h> #include <glamor_egl.h>
@ -156,7 +158,7 @@ xwl_glamor_create_screen_resources(ScreenPtr screen)
fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0); fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0);
} }
else { else {
screen->devPrivate = screen->CreatePixmap( screen->devPrivate = dixPixmapCreate(
screen, screen->width, screen->height, screen->rootDepth, screen, screen->width, screen->height, screen->rootDepth,
CREATE_PIXMAP_USAGE_BACKING_PIXMAP); CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
} }

View File

@ -31,6 +31,7 @@
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "dix/input_priv.h" #include "dix/input_priv.h"
#include "include/dix_pixmap.h"
#include "randr/randrstr_priv.h" #include "randr/randrstr_priv.h"
#include "os/log_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; ScreenPtr pScreen = xwl_screen->screen;
WindowPtr pRoot = pScreen->root; WindowPtr pRoot = pScreen->root;
PixmapPtr old_pixmap, new_pixmap;
old_pixmap = pScreen->GetScreenPixmap(pScreen); PixmapPtr old_pixmap = pScreen->GetScreenPixmap(pScreen);
new_pixmap = pScreen->CreatePixmap(pScreen, width, height, PixmapPtr new_pixmap = dixPixmapCreate(pScreen, width, height,
pScreen->rootDepth, pScreen->rootDepth,
CREATE_PIXMAP_USAGE_BACKING_PIXMAP); CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
pScreen->SetScreenPixmap(new_pixmap); pScreen->SetScreenPixmap(new_pixmap);
if (old_pixmap) { if (old_pixmap) {
TraverseTree(pRoot, xwl_set_pixmap_visit_window, 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); pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL);

View File

@ -35,6 +35,8 @@
#include <sys/eventfd.h> #include <sys/eventfd.h>
#endif /* DRI3 */ #endif /* DRI3 */
#include "include/dix_pixmap.h"
#include "xwayland-present.h" #include "xwayland-present.h"
#include "xwayland-screen.h" #include "xwayland-screen.h"
#include "xwayland-shm.h" #include "xwayland-shm.h"
@ -315,7 +317,7 @@ xwl_present_release_pixmap(struct xwl_present_event *event)
return; return;
xwl_pixmap_del_buffer_release_cb(event->pixmap); xwl_pixmap_del_buffer_release_cb(event->pixmap);
dixDestroyPixmap(event->pixmap, event->pixmap->drawable.id); dixPixmapPut(event->pixmap);
event->pixmap = NULL; event->pixmap = NULL;
} }
@ -1122,7 +1124,7 @@ retry:
screen->SetScreenPixmap(vblank->pixmap); screen->SetScreenPixmap(vblank->pixmap);
vblank->pixmap->refcnt++; vblank->pixmap->refcnt++;
dixDestroyPixmap(old_pixmap, old_pixmap->drawable.id); dixPixmapPut(old_pixmap);
/* Report damage, let damage_report ignore it though */ /* Report damage, let damage_report ignore it though */
xwl_screen->ignore_damage = TRUE; xwl_screen->ignore_damage = TRUE;

View File

@ -26,6 +26,8 @@
#include <xwayland-config.h> #include <xwayland-config.h>
#include "include/dix_pixmap.h"
#include "gcstruct.h" #include "gcstruct.h"
#include "xwayland-window.h" #include "xwayland-window.h"
@ -98,7 +100,7 @@ static void
xwl_window_buffer_destroy_pixmap(struct xwl_window_buffer *xwl_window_buffer) xwl_window_buffer_destroy_pixmap(struct xwl_window_buffer *xwl_window_buffer)
{ {
xwl_pixmap_del_buffer_release_cb(xwl_window_buffer->pixmap); 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; 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.width,
window_pixmap->drawable.height); window_pixmap->drawable.height);
xwl_window_set_pixmap(xwl_window->surface_window, new_window_pixmap); xwl_window_set_pixmap(xwl_window->surface_window, new_window_pixmap);
dixDestroyPixmap(window_pixmap, 0); dixPixmapPut(window_pixmap);
} }
static Bool static Bool

View File

@ -34,6 +34,7 @@
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "dix/property_priv.h" #include "dix/property_priv.h"
#include "include/dix_pixmap.h"
#include "os/log_priv.h" #include "os/log_priv.h"
#include "compositeext.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); window_pixmap = xwl_screen->screen->GetWindowPixmap(xwl_window->surface_window);
if (xwl_is_client_pixmap(window_pixmap)) 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 static void

View File

@ -51,6 +51,10 @@ SOFTWARE.
#include <math.h> #include <math.h>
#include <X11/X.h> #include <X11/X.h>
#include <X11/Xprotostr.h> #include <X11/Xprotostr.h>
#include <X11/Xfuncproto.h>
#include "include/dix_pixmap.h"
#include "misc.h" #include "misc.h"
#include "gcstruct.h" #include "gcstruct.h"
#include "scrnintstr.h" #include "scrnintstr.h"
@ -59,7 +63,6 @@ SOFTWARE.
#include "mifpoly.h" #include "mifpoly.h"
#include "mi.h" #include "mi.h"
#include "mifillarc.h" #include "mifillarc.h"
#include <X11/Xfuncproto.h>
#define EPSILON 0.000001 #define EPSILON 0.000001
#define ISEQUAL(a,b) (fabs((a) - (b)) <= EPSILON) #define ISEQUAL(a,b) (fabs((a) - (b)) <= EPSILON)
@ -992,8 +995,8 @@ miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
} }
/* allocate a bitmap of the appropriate size, and validate it */ /* allocate a bitmap of the appropriate size, and validate it */
pDrawTo = (DrawablePtr) (*pDraw->pScreen->CreatePixmap) pDrawTo = (DrawablePtr) dixPixmapCreate(pDraw->pScreen, pixmapWidth,
(pDraw->pScreen, pixmapWidth, pixmapHeight, 1, pixmapHeight, 1,
CREATE_PIXMAP_USAGE_SCRATCH); CREATE_PIXMAP_USAGE_SCRATCH);
if (!pDrawTo) { if (!pDrawTo) {
FreeScratchGC(pGCTo); FreeScratchGC(pGCTo);
@ -1110,7 +1113,7 @@ miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
out: out:
if (fTricky) { if (fTricky) {
dixDestroyPixmap((PixmapPtr) pDrawTo, 0); dixPixmapPut((PixmapPtr) pDrawTo);
FreeScratchGC(pGCTo); FreeScratchGC(pGCTo);
} }
} }

View File

@ -35,6 +35,7 @@ in this Software without prior written authorization from The Open Group.
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "dix/gc_priv.h" #include "dix/gc_priv.h"
#include "include/dix_pixmap.h"
#include "misc.h" #include "misc.h"
#include "input.h" #include "input.h"
@ -119,11 +120,11 @@ miDCSwitchScreenCursor(ScreenPtr pScreen, CursorPtr pCursor, PixmapPtr sourceBit
{ {
miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey);
dixDestroyPixmap(pScreenPriv->sourceBits, 0); dixPixmapPut(pScreenPriv->sourceBits);
pScreenPriv->sourceBits = sourceBits; pScreenPriv->sourceBits = sourceBits;
if (pScreenPriv->maskBits) if (pScreenPriv->maskBits)
dixDestroyPixmap(pScreenPriv->maskBits, 0); dixPixmapPut(pScreenPriv->maskBits);
pScreenPriv->maskBits = maskBits; pScreenPriv->maskBits = maskBits;
if (pScreenPriv->pPicture) if (pScreenPriv->pPicture)
@ -194,7 +195,7 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor)
if (!pFormat) if (!pFormat)
return FALSE; return FALSE;
pPixmap = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pPixmap = dixPixmapCreate(pScreen, pCursor->bits->width,
pCursor->bits->height, 32, pCursor->bits->height, 32,
CREATE_PIXMAP_USAGE_SCRATCH); CREATE_PIXMAP_USAGE_SCRATCH);
if (!pPixmap) if (!pPixmap)
@ -202,7 +203,7 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor)
pGC = GetScratchGC(32, pScreen); pGC = GetScratchGC(32, pScreen);
if (!pGC) { if (!pGC) {
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
return FALSE; return FALSE;
} }
ValidateGC(&pPixmap->drawable, pGC); ValidateGC(&pPixmap->drawable, pGC);
@ -213,7 +214,7 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor)
FreeScratchGC(pGC); FreeScratchGC(pGC);
pPicture = CreatePicture(0, &pPixmap->drawable, pPicture = CreatePicture(0, &pPixmap->drawable,
pFormat, 0, 0, serverClient, &error); pFormat, 0, 0, serverClient, &error);
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
if (!pPicture) if (!pPicture)
return FALSE; return FALSE;
@ -221,15 +222,15 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor)
return TRUE; return TRUE;
} }
sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, sourceBits = dixPixmapCreate(pScreen, pCursor->bits->width,
pCursor->bits->height, 1, 0); pCursor->bits->height, 1, 0);
if (!sourceBits) if (!sourceBits)
return FALSE; return FALSE;
maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, maskBits = dixPixmapCreate(pScreen, pCursor->bits->width,
pCursor->bits->height, 1, 0); pCursor->bits->height, 1, 0);
if (!maskBits) { if (!maskBits) {
dixDestroyPixmap(sourceBits, 0); dixPixmapPut(sourceBits);
return FALSE; return FALSE;
} }
@ -237,8 +238,8 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor)
pGC = GetScratchGC(1, pScreen); pGC = GetScratchGC(1, pScreen);
if (!pGC) { if (!pGC) {
dixDestroyPixmap(sourceBits, 0); dixPixmapPut(sourceBits);
dixDestroyPixmap(maskBits, 0); dixPixmapPut(maskBits);
return FALSE; return FALSE;
} }
@ -394,9 +395,9 @@ miDCSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
pSave = pBuffer->pSave; pSave = pBuffer->pSave;
pWin = pScreen->root; pWin = pScreen->root;
if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) { if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) {
dixDestroyPixmap(pSave, 0); dixPixmapPut(pSave);
pBuffer->pSave = pSave = pBuffer->pSave = pSave =
(*pScreen->CreatePixmap) (pScreen, w, h, pScreen->rootDepth, 0); dixPixmapCreate(pScreen, w, h, pScreen->rootDepth, 0);
if (!pSave) if (!pSave)
return FALSE; return FALSE;
} }
@ -511,7 +512,7 @@ miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
* is freed when that root window is destroyed, so don't * is freed when that root window is destroyed, so don't
* free it again here. */ * free it again here. */
dixDestroyPixmap(pBuffer->pSave, 0); dixPixmapPut(pBuffer->pSave);
free(pBuffer); free(pBuffer);
dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen, dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen,

View File

@ -28,6 +28,8 @@ from The Open Group.
#include <dix-config.h> #include <dix-config.h>
#include "include/dix_pixmap.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include "gcstruct.h" #include "gcstruct.h"
#include "pixmapstr.h" #include "pixmapstr.h"
@ -63,7 +65,7 @@ miChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
if (type == CT_PIXMAP) { if (type == CT_PIXMAP) {
/* convert the pixmap to a region */ /* convert the pixmap to a region */
pGC->clientClip = BitmapToRegion(pGC->pScreen, (PixmapPtr) pvalue); pGC->clientClip = BitmapToRegion(pGC->pScreen, (PixmapPtr) pvalue);
dixDestroyPixmap(pvalue, 0); dixPixmapPut(pvalue);
} }
else if (type == CT_REGION) { else if (type == CT_REGION) {
/* stuff the region in the GC */ /* stuff the region in the GC */

View File

@ -46,12 +46,16 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#include <stdlib.h>
#include <X11/X.h> #include <X11/X.h>
#include <X11/Xmd.h> #include <X11/Xmd.h>
#include <X11/Xproto.h> #include <X11/Xproto.h>
#include "misc.h"
#include <X11/fonts/fontstruct.h> #include <X11/fonts/fontstruct.h>
#include <X11/fonts/libxfont2.h> #include <X11/fonts/libxfont2.h>
#include "include/dix_pixmap.h"
#include "misc.h"
#include "dixfontstr.h" #include "dixfontstr.h"
#include "gcstruct.h" #include "gcstruct.h"
#include "windowstr.h" #include "windowstr.h"
@ -84,7 +88,6 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int ngly
) )
{ {
int width, height; int width, height;
PixmapPtr pPixmap;
int nbyLine; /* bytes per line of padded pixmap */ int nbyLine; /* bytes per line of padded pixmap */
FontPtr pfont; FontPtr pfont;
GCPtr pGCtmp; GCPtr pGCtmp;
@ -110,15 +113,14 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int ngly
FONTMINBOUNDS(pfont, leftSideBearing); FONTMINBOUNDS(pfont, leftSideBearing);
height = FONTMAXBOUNDS(pfont, ascent) + FONTMAXBOUNDS(pfont, descent); height = FONTMAXBOUNDS(pfont, ascent) + FONTMAXBOUNDS(pfont, descent);
pPixmap = (*pDrawable->pScreen->CreatePixmap) (pDrawable->pScreen, PixmapPtr pPixmap = dixPixmapCreate(pDrawable->pScreen, width, height, 1,
width, height, 1,
CREATE_PIXMAP_USAGE_SCRATCH); CREATE_PIXMAP_USAGE_SCRATCH);
if (!pPixmap) if (!pPixmap)
return; return;
pGCtmp = GetScratchGC(1, pDrawable->pScreen); pGCtmp = GetScratchGC(1, pDrawable->pScreen);
if (!pGCtmp) { if (!pGCtmp) {
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
return; return;
} }
@ -132,7 +134,7 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int ngly
nbyLine = BitmapBytePad(width); nbyLine = BitmapBytePad(width);
pbits = xallocarray(height, nbyLine); pbits = xallocarray(height, nbyLine);
if (!pbits) { if (!pbits) {
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
FreeScratchGC(pGCtmp); FreeScratchGC(pGCtmp);
return; return;
} }
@ -174,7 +176,7 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int ngly
} }
x += pci->metrics.characterWidth; x += pci->metrics.characterWidth;
} }
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
free(pbits); free(pbits);
FreeScratchGC(pGCtmp); FreeScratchGC(pGCtmp);
} }

View File

@ -30,6 +30,7 @@ from The Open Group.
#include <X11/X.h> #include <X11/X.h>
#include "include/dix_pixmap.h"
#include "mi/mi_priv.h" #include "mi/mi_priv.h"
#include "servermd.h" #include "servermd.h"
@ -124,7 +125,7 @@ miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
static Bool static Bool
miCloseScreen(ScreenPtr pScreen) miCloseScreen(ScreenPtr pScreen)
{ {
dixDestroyPixmap((PixmapPtr) pScreen->devPrivate, 0); dixPixmapPut((PixmapPtr) pScreen->devPrivate);
return TRUE; return TRUE;
} }
@ -165,9 +166,7 @@ miCreateScreenResources(ScreenPtr pScreen)
/* create a pixmap with no data, then redirect it to point to /* create a pixmap with no data, then redirect it to point to
* the screen * the screen
*/ */
pPixmap = if (!(pPixmap = dixPixmapCreate(pScreen, 0, 0, pScreen->rootDepth, 0)))
(*pScreen->CreatePixmap) (pScreen, 0, 0, pScreen->rootDepth, 0);
if (!pPixmap)
return FALSE; return FALSE;
if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScrInitParms->xsize, if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScrInitParms->xsize,

View File

@ -79,7 +79,7 @@ RootlessUpdateScreenPixmap(ScreenPtr pScreen)
pPix = (*pScreen->GetScreenPixmap) (pScreen); pPix = (*pScreen->GetScreenPixmap) (pScreen);
if (pPix == NULL) { if (pPix == NULL) {
pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, pScreen->rootDepth, 0); pPix = dixPixmapCreate(pScreen, 0, 0, pScreen->rootDepth, 0);
(*pScreen->SetScreenPixmap) (pPix); (*pScreen->SetScreenPixmap) (pPix);
} }

View File

@ -23,8 +23,10 @@
#include <dix-config.h> #include <dix-config.h>
#include <stdlib.h> #include <stdlib.h>
#include <X11/X.h> #include <X11/X.h>
#include "include/dix_pixmap.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include "windowstr.h" #include "windowstr.h"
#include "dixfontstr.h" #include "dixfontstr.h"
@ -103,7 +105,7 @@ shadowCloseScreen(ScreenPtr pScreen)
unwrap(pBuf, pScreen, BlockHandler); unwrap(pBuf, pScreen, BlockHandler);
shadowRemove(pScreen, pBuf->pPixmap); shadowRemove(pScreen, pBuf->pPixmap);
DamageDestroy(pBuf->pDamage); DamageDestroy(pBuf->pDamage);
dixDestroyPixmap(pBuf->pPixmap, 0); dixPixmapPut(pBuf->pPixmap);
free(pBuf); free(pBuf);
return pScreen->CloseScreen(pScreen); return pScreen->CloseScreen(pScreen);
} }

View File

@ -19,6 +19,9 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE. * OF THIS SOFTWARE.
*/ */
#include <dix-config.h>
#include "include/dix_pixmap.h"
#include "present_priv.h" #include "present_priv.h"
#include <misync.h> #include <misync.h>
@ -274,7 +277,7 @@ present_flip_idle(ScreenPtr screen)
screen_priv->flip_serial, screen_priv->flip_idle_fence); screen_priv->flip_serial, screen_priv->flip_idle_fence);
if (screen_priv->flip_idle_fence) if (screen_priv->flip_idle_fence)
present_fence_destroy(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_crtc = NULL;
screen_priv->flip_window = NULL; screen_priv->flip_window = NULL;
screen_priv->flip_serial = 0; screen_priv->flip_serial = 0;

View File

@ -19,9 +19,13 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE. * OF THIS SOFTWARE.
*/ */
#include <dix-config.h>
#include <unistd.h>
#include "include/dix_pixmap.h"
#include "present_priv.h" #include "present_priv.h"
#include <unistd.h>
void void
present_vblank_notify(present_vblank_ptr vblank, CARD8 kind, CARD8 mode, uint64_t ust, uint64_t crtc_msc) 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_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence);
present_fence_destroy(vblank->idle_fence); present_fence_destroy(vblank->idle_fence);
dixDestroyPixmap(vblank->pixmap, vblank->pixmap->drawable.id); dixPixmapPut(vblank->pixmap);
vblank->pixmap = NULL; vblank->pixmap = NULL;
vblank->idle_fence = NULL; vblank->idle_fence = NULL;
@ -252,7 +256,7 @@ present_vblank_destroy(present_vblank_ptr vblank)
/* Drop pixmap reference */ /* Drop pixmap reference */
if (vblank->pixmap) if (vblank->pixmap)
dixDestroyPixmap(vblank->pixmap, vblank->pixmap->drawable.id); dixPixmapPut(vblank->pixmap);
/* Free regions */ /* Free regions */
if (vblank->valid) if (vblank->valid)

View File

@ -20,13 +20,16 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE. * OF THIS SOFTWARE.
*/ */
#include <dix-config.h>
#include <X11/Xatom.h>
#include "include/dix_pixmap.h"
#include "randrstr_priv.h" #include "randrstr_priv.h"
#include "swaprep.h" #include "swaprep.h"
#include "mipointer.h" #include "mipointer.h"
#include <X11/Xatom.h>
RESTYPE RRCrtcType = 0; RESTYPE RRCrtcType = 0;
/* /*
@ -382,11 +385,11 @@ rrDestroySharedPixmap(RRCrtcPtr crtc, PixmapPtr pPixmap) {
*/ */
PixmapUnshareSecondaryPixmap(pPixmap); PixmapUnshareSecondaryPixmap(pPixmap);
dixDestroyPixmap(pPixmap->primary_pixmap, 0); dixPixmapPut(pPixmap->primary_pixmap);
dixDestroyPixmap(pPixmap->primary_pixmap, 0); dixPixmapPut(pPixmap->primary_pixmap);
} }
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
} }
void void
@ -431,16 +434,14 @@ rrCreateSharedPixmap(RRCrtcPtr crtc, ScreenPtr primary,
int width, int height, int depth, int width, int height, int depth,
int x, int y, Rotation rotation) int x, int y, Rotation rotation)
{ {
PixmapPtr mpix, spix; PixmapPtr mpix = dixPixmapCreate(primary, width, height, depth,
mpix = primary->CreatePixmap(primary, width, height, depth,
CREATE_PIXMAP_USAGE_SHARED); CREATE_PIXMAP_USAGE_SHARED);
if (!mpix) if (!mpix)
return NULL; return NULL;
spix = PixmapShareToSecondary(mpix, crtc->pScreen); PixmapPtr spix = PixmapShareToSecondary(mpix, crtc->pScreen);
if (spix == NULL) { if (spix == NULL) {
dixDestroyPixmap(mpix, 0); dixPixmapPut(mpix);
return NULL; return NULL;
} }

View File

@ -24,6 +24,7 @@
#include <dix-config.h> #include <dix-config.h>
#include "include/dix_pixmap.h"
#include "os/xsha1.h" #include "os/xsha1.h"
#include "misc.h" #include "misc.h"
@ -598,17 +599,17 @@ miGlyphs(CARD8 op,
return; return;
width = extents.x2 - extents.x1; width = extents.x2 - extents.x1;
height = extents.y2 - extents.y1; height = extents.y2 - extents.y1;
pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, if (!(pMaskPixmap = dixPixmapCreate(pScreen, width, height,
maskFormat->depth, maskFormat->depth,
CREATE_PIXMAP_USAGE_SCRATCH); CREATE_PIXMAP_USAGE_SCRATCH)))
if (!pMaskPixmap)
return; return;
component_alpha = NeedsComponent(maskFormat->format); component_alpha = NeedsComponent(maskFormat->format);
pMask = CreatePicture(0, &pMaskPixmap->drawable, pMask = CreatePicture(0, &pMaskPixmap->drawable,
maskFormat, CPComponentAlpha, &component_alpha, maskFormat, CPComponentAlpha, &component_alpha,
serverClient, &error); serverClient, &error);
if (!pMask) { if (!pMask) {
dixDestroyPixmap(pMaskPixmap, 0); dixPixmapPut(pMaskPixmap);
return; return;
} }
pGC = GetScratchGC(pMaskPixmap->drawable.depth, pScreen); pGC = GetScratchGC(pMaskPixmap->drawable.depth, pScreen);
@ -676,7 +677,7 @@ miGlyphs(CARD8 op,
xSrc + x - xDst, xSrc + x - xDst,
ySrc + y - yDst, 0, 0, x, y, width, height); ySrc + y - yDst, 0, 0, x, y, width, height);
FreePicture((void *) pMask, (XID) 0); FreePicture((void *) pMask, (XID) 0);
dixDestroyPixmap(pMaskPixmap, 0); dixPixmapPut(pMaskPixmap);
} }
} }

View File

@ -23,6 +23,7 @@
#include <dix-config.h> #include <dix-config.h>
#include "include/dix_pixmap.h"
#include "os/osdep.h" #include "os/osdep.h"
#include "scrnintstr.h" #include "scrnintstr.h"
@ -67,7 +68,7 @@ miChangePictureClip(PicturePtr pPicture, int type, void *value, int n)
clientClip = BitmapToRegion(pScreen, (PixmapPtr) value); clientClip = BitmapToRegion(pScreen, (PixmapPtr) value);
if (!clientClip) if (!clientClip)
return BadAlloc; return BadAlloc;
dixDestroyPixmap((PixmapPtr) value, 0); dixPixmapPut((PixmapPtr) value);
break; break;
case CT_REGION: case CT_REGION:
clientClip = value; clientClip = value;

View File

@ -25,6 +25,7 @@
#include <dix-config.h> #include <dix-config.h>
#include "dix/colormap_priv.h" #include "dix/colormap_priv.h"
#include "include/dix_pixmap.h"
#include "os/osdep.h" #include "os/osdep.h"
#include "misc.h" #include "misc.h"
@ -1402,7 +1403,7 @@ FreePicture(void *value, XID pid)
} }
} }
else if (pPicture->pDrawable->type == DRAWABLE_PIXMAP) { else if (pPicture->pDrawable->type == DRAWABLE_PIXMAP) {
dixDestroyPixmap((PixmapPtr) pPicture->pDrawable, 0); dixPixmapPut((PixmapPtr) pPicture->pDrawable);
} }
} }
dixFreeObjectWithPrivates(pPicture, PRIVATE_PICTURE); dixFreeObjectWithPrivates(pPicture, PRIVATE_PICTURE);

View File

@ -33,6 +33,7 @@
#include "dix/cursor_priv.h" #include "dix/cursor_priv.h"
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "include/dix_pixmap.h"
#include "miext/extinit_priv.h" #include "miext/extinit_priv.h"
#include "os/osdep.h" #include "os/osdep.h"
@ -1120,11 +1121,9 @@ ProcRenderAddGlyphs(ClientPtr client)
goto bail; goto bail;
} }
pDstPix = (pScreen->CreatePixmap) (pScreen, if (!(pDstPix = dixPixmapCreate(pScreen,
width, height, depth, width, height, depth,
CREATE_PIXMAP_USAGE_GLYPH_PICTURE); CREATE_PIXMAP_USAGE_GLYPH_PICTURE))) {
if (!pDstPix) {
err = BadAlloc; err = BadAlloc;
goto bail; goto bail;
} }
@ -1137,7 +1136,7 @@ ProcRenderAddGlyphs(ClientPtr client)
/* The picture takes a reference to the pixmap, so we /* The picture takes a reference to the pixmap, so we
drop ours. */ drop ours. */
dixDestroyPixmap(pDstPix, 0); dixPixmapPut(pDstPix);
pDstPix = NULL; pDstPix = NULL;
if (!pDst) { if (!pDst) {
@ -1526,9 +1525,9 @@ ProcRenderCreateCursor(ClientPtr client)
free(mskbits); free(mskbits);
return BadImplementation; return BadImplementation;
} }
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32,
CREATE_PIXMAP_USAGE_SCRATCH); if (!(pPixmap = dixPixmapCreate(pScreen, width, height, 32,
if (!pPixmap) { CREATE_PIXMAP_USAGE_SCRATCH))) {
free(argbbits); free(argbbits);
free(srcbits); free(srcbits);
free(mskbits); free(mskbits);
@ -1542,7 +1541,7 @@ ProcRenderCreateCursor(ClientPtr client)
free(mskbits); free(mskbits);
return error; return error;
} }
dixDestroyPixmap(pPixmap, 0); dixPixmapPut(pPixmap);
CompositePicture(PictOpSrc, CompositePicture(PictOpSrc,
pSrc, 0, pPicture, 0, 0, 0, 0, 0, 0, width, height); pSrc, 0, pPicture, 0, 0, 0, 0, 0, 0, width, height);
(*pScreen->GetImage) (pPicture->pDrawable, (*pScreen->GetImage) (pPicture->pDrawable,