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

View File

@ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xfuncproto.h>
#include "dix/dix_priv.h"
#include "include/dix_pixmap.h"
#include "miext/extinit_priv.h"
#include "os/auth.h"
#include "os/busfault.h"
@ -476,7 +477,7 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
if (!putGC)
return;
pPixmap = (*dst->pScreen->CreatePixmap) (dst->pScreen, sw, sh, depth,
pPixmap = dixPixmapCreate(dst->pScreen, sw, sh, depth,
CREATE_PIXMAP_USAGE_SCRATCH);
if (!pPixmap) {
FreeScratchGC(putGC);
@ -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);

View File

@ -43,6 +43,8 @@
#include <dix-config.h>
#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,7 +534,7 @@ 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,
pPixmap = dixPixmapCreate(pScreen, w, h, pWin->drawable.depth,
CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
if (!pPixmap)

View File

@ -44,6 +44,7 @@
#include <dix-config.h>
#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? */

View File

@ -34,8 +34,12 @@
#include <dix-config.h>
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#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 <stdio.h>
/******************************************************************************
*
@ -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,
if (!(pDbeWindowPriv->pFrontBuffer = dixPixmapCreate(
pScreen,
pDbeWindowPriv->width,
pDbeWindowPriv->height,
pWin->drawable.depth, 0))) {
pWin->drawable.depth,
0)))
return BadAlloc;
}
/* Get a back pixmap. */
if (!(pDbeWindowPriv->pBackBuffer =
(*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width,
dixPixmapCreate(pScreen, pDbeWindowPriv->width,
pDbeWindowPriv->height,
pWin->drawable.depth, 0))) {
dixDestroyPixmap(pDbeWindowPriv->pFrontBuffer, 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,
pFrontBuffer = dixPixmapCreate(pScreen, width, height,
pWin->drawable.depth, 0);
pBackBuffer = (*pScreen->CreatePixmap) (pScreen, width, height,
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;

View File

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

View File

@ -52,6 +52,7 @@ SOFTWARE.
#include <X11/Xproto.h>
#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

View File

@ -46,10 +46,12 @@ SOFTWARE.
#include <dix-config.h>
#include <X11/fonts/fontstruct.h>
#include "dix/cursor_priv.h"
#include "include/dix_pixmap.h"
#include "misc.h"
#include <X11/fonts/fontstruct.h>
#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,
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;
}

View File

@ -29,6 +29,10 @@ from The Open Group.
#include <dix-config.h>
#include <X11/X.h>
#include <X11/extensions/render.h>
#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;
}

View File

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

View File

@ -24,6 +24,7 @@
#include <unistd.h>
#include "dix/dix_priv.h"
#include "include/dix_pixmap.h"
#include "dri3_priv.h"
#include <syncsrv.h>
@ -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))

View File

@ -26,6 +26,8 @@
#include <string.h>
#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;
}

View File

@ -26,6 +26,8 @@
#include <string.h>
#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;
}

View File

@ -44,6 +44,8 @@
#include <stdlib.h>
#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);
}
}

View File

@ -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 <dix-config.h>
#include <limits.h>
#include <assert.h>
#include <stdlib.h>
#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;

View File

@ -26,6 +26,8 @@
#include <stdlib.h>
#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;
}

View File

@ -26,6 +26,8 @@
#include <stdlib.h>
#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,

View File

@ -19,9 +19,13 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdlib.h>
#include "Xprintf.h"
#include <dix-config.h>
#include <stdlib.h>
#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);
}

View File

@ -39,6 +39,8 @@
#include <xf86drm.h>
#define EGL_DISPLAY_NO_X_MESA
#include "include/dix_pixmap.h"
#include <gbm.h>
#include <drm_fourcc.h>
@ -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;

View File

@ -36,6 +36,7 @@
#include <X11/extensions/presenttokens.h>
#include "dix/dix_priv.h"
#include "include/dix_pixmap.h"
#include "glxserver.h"
#include <unpack.h>
@ -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;
}

View File

@ -38,6 +38,7 @@
#include <sys/mman.h>
#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);

View File

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

View File

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

View File

@ -38,6 +38,9 @@
#ifdef WITH_LIBDRM
#include <xf86drm.h>
#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,
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;
}
}

View File

@ -38,6 +38,7 @@
#include <time.h>
#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,
if (!(pixmap = dixPixmapCreate(screen,
pixmap_width,
pixmap_height,
pixmap_cpp,
0);
if (pixmap == NULL) {
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;

View File

@ -33,6 +33,9 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <unistd.h>
#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);

View File

@ -18,15 +18,17 @@ is" without express or implied warranty.
#include <X11/X.h>
#include <X11/Xdefs.h>
#include <X11/Xproto.h>
#include <X11/fonts/fontstruct.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include "include/dix_pixmap.h"
#include "gcstruct.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include <X11/fonts/fontstruct.h>
#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;

View File

@ -25,6 +25,8 @@
#include <xwayland-config.h>
#include "include/dix_pixmap.h"
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
#include <glamor_egl.h>
@ -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);
}

View File

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

View File

@ -35,6 +35,8 @@
#include <sys/eventfd.h>
#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;

View File

@ -26,6 +26,8 @@
#include <xwayland-config.h>
#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

View File

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

View File

@ -51,6 +51,10 @@ SOFTWARE.
#include <math.h>
#include <X11/X.h>
#include <X11/Xprotostr.h>
#include <X11/Xfuncproto.h>
#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 <X11/Xfuncproto.h>
#define EPSILON 0.000001
#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 */
pDrawTo = (DrawablePtr) (*pDraw->pScreen->CreatePixmap)
(pDraw->pScreen, pixmapWidth, pixmapHeight, 1,
pDrawTo = (DrawablePtr) dixPixmapCreate(pDraw->pScreen, pixmapWidth,
pixmapHeight, 1,
CREATE_PIXMAP_USAGE_SCRATCH);
if (!pDrawTo) {
FreeScratchGC(pGCTo);
@ -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);
}
}

View File

@ -35,6 +35,7 @@ in this Software without prior written authorization from The Open Group.
#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,7 +195,7 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor)
if (!pFormat)
return FALSE;
pPixmap = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width,
pPixmap = dixPixmapCreate(pScreen, pCursor->bits->width,
pCursor->bits->height, 32,
CREATE_PIXMAP_USAGE_SCRATCH);
if (!pPixmap)
@ -202,7 +203,7 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor)
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,
sourceBits = dixPixmapCreate(pScreen, pCursor->bits->width,
pCursor->bits->height, 1, 0);
if (!sourceBits)
return FALSE;
maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width,
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,

View File

@ -28,6 +28,8 @@ from The Open Group.
#include <dix-config.h>
#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 */

View File

@ -46,12 +46,16 @@ SOFTWARE.
#include <dix-config.h>
#include <stdlib.h>
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include "misc.h"
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/libxfont2.h>
#include "include/dix_pixmap.h"
#include "misc.h"
#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,
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);
}

View File

@ -30,6 +30,7 @@ from The Open Group.
#include <X11/X.h>
#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,

View File

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

View File

@ -23,8 +23,10 @@
#include <dix-config.h>
#include <stdlib.h>
#include <X11/X.h>
#include "include/dix_pixmap.h"
#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);
}

View File

@ -19,6 +19,9 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <dix-config.h>
#include "include/dix_pixmap.h"
#include "present_priv.h"
#include <misync.h>
@ -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;

View File

@ -19,9 +19,13 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <dix-config.h>
#include <unistd.h>
#include "include/dix_pixmap.h"
#include "present_priv.h"
#include <unistd.h>
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)

View File

@ -20,13 +20,16 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <dix-config.h>
#include <X11/Xatom.h>
#include "include/dix_pixmap.h"
#include "randrstr_priv.h"
#include "swaprep.h"
#include "mipointer.h"
#include <X11/Xatom.h>
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,
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;
}

View File

@ -24,6 +24,7 @@
#include <dix-config.h>
#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,
if (!(pMaskPixmap = dixPixmapCreate(pScreen, width, height,
maskFormat->depth,
CREATE_PIXMAP_USAGE_SCRATCH);
if (!pMaskPixmap)
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);
}
}

View File

@ -23,6 +23,7 @@
#include <dix-config.h>
#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;

View File

@ -25,6 +25,7 @@
#include <dix-config.h>
#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);

View File

@ -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,
if (!(pDstPix = dixPixmapCreate(pScreen,
width, height, depth,
CREATE_PIXMAP_USAGE_GLYPH_PICTURE);
if (!pDstPix) {
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,