From 3ef6d51202a5c4f8ad23d17abf0ee9957129e88c Mon Sep 17 00:00:00 2001 From: Aaron Plattner Date: Wed, 22 Feb 2017 13:30:48 +0100 Subject: Add CreatePixmap allocation hints. Backported from X.org: commit f2e310132fbe1520c1b5f3da4faa2d2d47835e72 Author: Aaron Plattner Date: Wed Oct 31 14:15:35 2007 -0700 Add CreatePixmap allocation hints. These hints allow an acceleration architecture to optimize allocation of certain types of pixmaps, such as pixmaps that will serve as backing pixmaps for redirected windows. Backported-to-NX-by: Mike Gabriel --- nx-X11/programs/Xserver/Xext/shm.c | 5 +++-- nx-X11/programs/Xserver/composite/compalloc.c | 4 ++-- nx-X11/programs/Xserver/dbe/midbe.c | 8 ++++---- nx-X11/programs/Xserver/dix/dispatch.c | 2 +- nx-X11/programs/Xserver/dix/gc.c | 4 ++-- nx-X11/programs/Xserver/dix/glyphcurs.c | 3 ++- nx-X11/programs/Xserver/dix/pixmap.c | 2 +- nx-X11/programs/Xserver/dix/window.c | 2 +- nx-X11/programs/Xserver/fb/fb.h | 5 +++-- nx-X11/programs/Xserver/fb/fboverlay.c | 2 +- nx-X11/programs/Xserver/fb/fbpixmap.c | 3 ++- nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c | 3 ++- nx-X11/programs/Xserver/hw/nxagent/NXrender.c | 3 ++- nx-X11/programs/Xserver/hw/nxagent/NXshm.c | 7 ++++--- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 2 +- nx-X11/programs/Xserver/include/scrnintstr.h | 10 +++++++++- nx-X11/programs/Xserver/mi/miarc.c | 3 ++- nx-X11/programs/Xserver/mi/mibitblt.c | 6 ++++-- nx-X11/programs/Xserver/mi/mibstore.c | 7 ++++--- nx-X11/programs/Xserver/mi/midispcur.c | 11 ++++++----- nx-X11/programs/Xserver/mi/miglblt.c | 3 ++- nx-X11/programs/Xserver/mi/miscrinit.c | 2 +- nx-X11/programs/Xserver/render/mirect.c | 3 ++- nx-X11/programs/Xserver/render/mitrap.c | 2 +- nx-X11/programs/Xserver/render/render.c | 3 ++- 26 files changed, 65 insertions(+), 42 deletions(-) diff --git a/nx-X11/programs/Xserver/Xext/shm.c b/nx-X11/programs/Xserver/Xext/shm.c index 274284151..ca1ff9a7f 100644 --- a/nx-X11/programs/Xserver/Xext/shm.c +++ b/nx-X11/programs/Xserver/Xext/shm.c @@ -505,7 +505,8 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) putGC = GetScratchGC(depth, dst->pScreen); if (!putGC) return; - pmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth); + pmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pmap) { FreeScratchGC(putGC); @@ -1051,7 +1052,7 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr) { register PixmapPtr pPixmap; - pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth); + pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0); if (!pPixmap) return NullPixmap; diff --git a/nx-X11/programs/Xserver/composite/compalloc.c b/nx-X11/programs/Xserver/composite/compalloc.c index e24c490d2..22b036265 100644 --- a/nx-X11/programs/Xserver/composite/compalloc.c +++ b/nx-X11/programs/Xserver/composite/compalloc.c @@ -539,8 +539,8 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h) PixmapPtr pPixmap; /* usage_hint unsupported by our old server infrastructure. */ - pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth /*, - CREATE_PIXMAP_USAGE_BACKING_PIXMAP */); + pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth, + CREATE_PIXMAP_USAGE_BACKING_PIXMAP); if (!pPixmap) return 0; diff --git a/nx-X11/programs/Xserver/dbe/midbe.c b/nx-X11/programs/Xserver/dbe/midbe.c index bc8dd242e..e241e5f28 100644 --- a/nx-X11/programs/Xserver/dbe/midbe.c +++ b/nx-X11/programs/Xserver/dbe/midbe.c @@ -188,7 +188,7 @@ miDbeAllocBackBufferName(pWin, bufId, swapAction) if (!(pDbeWindowPrivPriv->pFrontBuffer = (*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width, pDbeWindowPriv->height, - pWin->drawable.depth))) + pWin->drawable.depth, 0))) { return(BadAlloc); } @@ -197,7 +197,7 @@ miDbeAllocBackBufferName(pWin, bufId, swapAction) if (!(pDbeWindowPrivPriv->pBackBuffer = (*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width, pDbeWindowPriv->height, - pWin->drawable.depth))) + pWin->drawable.depth, 0))) { (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer); return(BadAlloc); @@ -668,10 +668,10 @@ miDbePositionWindow(pWin, x, y) /* Create DBE buffer pixmaps equal to size of resized window. */ pFrontBuffer = (*pScreen->CreatePixmap)(pScreen, width, height, - pWin->drawable.depth); + pWin->drawable.depth, 0); pBackBuffer = (*pScreen->CreatePixmap)(pScreen, width, height, - pWin->drawable.depth); + pWin->drawable.depth, 0); if (!pFrontBuffer || !pBackBuffer) { diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c index 51468f1c7..c9ce8981c 100644 --- a/nx-X11/programs/Xserver/dix/dispatch.c +++ b/nx-X11/programs/Xserver/dix/dispatch.c @@ -1508,7 +1508,7 @@ ProcCreatePixmap(register ClientPtr client) CreatePmap: pMap = (PixmapPtr)(*pDraw->pScreen->CreatePixmap) (pDraw->pScreen, stuff->width, - stuff->height, stuff->depth); + stuff->height, stuff->depth, 0); if (pMap) { pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; diff --git a/nx-X11/programs/Xserver/dix/gc.c b/nx-X11/programs/Xserver/dix/gc.c index b3a4edf4d..d40334f5f 100644 --- a/nx-X11/programs/Xserver/dix/gc.c +++ b/nx-X11/programs/Xserver/dix/gc.c @@ -694,7 +694,7 @@ CreateDefaultTile (GCPtr pGC) (*pGC->pScreen->QueryBestSize)(TileShape, &w, &h, pGC->pScreen); pTile = (PixmapPtr) (*pGC->pScreen->CreatePixmap)(pGC->pScreen, - w, h, pGC->depth); + w, h, pGC->depth, 0); pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen); if (!pTile || !pgcScratch) { @@ -1047,7 +1047,7 @@ CreateDefaultStipple(int screenNum) h = 16; (* pScreen->QueryBestSize)(StippleShape, &w, &h, pScreen); if (!(pScreen->PixmapPerDepth[0] = - (*pScreen->CreatePixmap)(pScreen, w, h, 1))) + (*pScreen->CreatePixmap)(pScreen, w, h, 1, 0))) return FALSE; /* fill stipple with 1 */ tmpval[0] = GXcopy; tmpval[1] = 1; tmpval[2] = FillSolid; diff --git a/nx-X11/programs/Xserver/dix/glyphcurs.c b/nx-X11/programs/Xserver/dix/glyphcurs.c index 08d67b922..5e36f158c 100644 --- a/nx-X11/programs/Xserver/dix/glyphcurs.c +++ b/nx-X11/programs/Xserver/dix/glyphcurs.c @@ -99,7 +99,8 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, uns bzero(pbits, nby); ppix = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, cm->width, - cm->height, 1); + cm->height, 1, + CREATE_PIXMAP_USAGE_SCRATCH); pGC = GetScratchGC(1, pScreen); if (!ppix || !pGC) { diff --git a/nx-X11/programs/Xserver/dix/pixmap.c b/nx-X11/programs/Xserver/dix/pixmap.c index 1f2239c12..747120b48 100644 --- a/nx-X11/programs/Xserver/dix/pixmap.c +++ b/nx-X11/programs/Xserver/dix/pixmap.c @@ -59,7 +59,7 @@ GetScratchPixmapHeader(ScreenPtr pScreen, int width, int height, int depth, pScreen->pScratchPixmap = NULL; else /* width and height of 0 means don't allocate any pixmap data */ - pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth); + pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth, 0); if (pPixmap) { if ((*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth, diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c index a7346e778..ba9cfc2d2 100644 --- a/nx-X11/programs/Xserver/dix/window.c +++ b/nx-X11/programs/Xserver/dix/window.c @@ -295,7 +295,7 @@ MakeRootTile(WindowPtr pWin) register int i, j; pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4, - pScreen->rootDepth); + pScreen->rootDepth, 0); pWin->backgroundState = BackgroundPixmap; pGC = GetScratchGC(pScreen->rootDepth, pScreen); diff --git a/nx-X11/programs/Xserver/fb/fb.h b/nx-X11/programs/Xserver/fb/fb.h index a52c8d0e3..14738df2e 100644 --- a/nx-X11/programs/Xserver/fb/fb.h +++ b/nx-X11/programs/Xserver/fb/fb.h @@ -1596,10 +1596,11 @@ fbPictureInit (ScreenPtr pScreen, */ PixmapPtr -fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp); +fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp, + unsigned usage_hint); PixmapPtr -fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth); +fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint); Bool fbDestroyPixmap (PixmapPtr pPixmap); diff --git a/nx-X11/programs/Xserver/fb/fboverlay.c b/nx-X11/programs/Xserver/fb/fboverlay.c index af7693ab8..392ffc70b 100644 --- a/nx-X11/programs/Xserver/fb/fboverlay.c +++ b/nx-X11/programs/Xserver/fb/fboverlay.c @@ -140,7 +140,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); + pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth, 0); if (!pPixmap) return FALSE; if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width, diff --git a/nx-X11/programs/Xserver/fb/fbpixmap.c b/nx-X11/programs/Xserver/fb/fbpixmap.c index a2b98bc3c..abdbc54a9 100644 --- a/nx-X11/programs/Xserver/fb/fbpixmap.c +++ b/nx-X11/programs/Xserver/fb/fbpixmap.c @@ -86,7 +86,8 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp) } PixmapPtr -fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth) +fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, + unsigned usage_hint) { int bpp; bpp = BitsPerPixel (depth); diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c b/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c index 8b875555f..549ab4333 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c @@ -114,7 +114,8 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, uns /* zeroing the (pad) bits seems to help some ddx cursor handling */ bzero(pbits, nby); - ppix = fbCreatePixmap(pScreen, cm->width, cm->height, 1); + ppix = fbCreatePixmap(pScreen, cm->width, cm->height, 1, + CREATE_PIXMAP_USAGE_SCRATCH); pGC = GetScratchGC(1, pScreen); if (!ppix || !pGC) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index ef288db0b..c1a4577bd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c @@ -1266,7 +1266,8 @@ ProcRenderCreateCursor (ClientPtr client) free (mskbits); return (BadImplementation); } - pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32); + pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { free (argbbits); diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c index f251f3b9f..2ffca8066 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c @@ -173,7 +173,8 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) nxagentShmTrap = 1; return; } - pmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth); + pmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pmap) { nxagentShmTrap = 1; @@ -387,7 +388,7 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr) nxagentShmPixmapTrap = 1; - pPixmap = (*pScreen->CreatePixmap)(pScreen, width, height, depth); + pPixmap = (*pScreen->CreatePixmap)(pScreen, width, height, depth, 0); if (!pPixmap) { @@ -397,7 +398,7 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr) } #ifdef TEST - fprintf(stderr,"fbShmCreatePixmap: Width [%d] Height [%d] Depth [%d]\n", width, height, depth); + fprintf(stderr,"fbShmCreatePixmap: Width [%d] Height [%d] Depth [%d] Hint[%d]\n", width, height, depth, 0); #endif if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth, diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index adff36569..7de25ca28 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -162,7 +162,7 @@ MakeRootTile(WindowPtr pWin) register int i, j; pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4, - pScreen->rootDepth); + pScreen->rootDepth, 0); pWin->backgroundState = BackgroundPixmap; pGC = GetScratchGC(pScreen->rootDepth, pScreen); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index 05558e34f..87cf136cc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -242,7 +242,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, * Create the pixmap in the virtual framebuffer. */ - pVirtual = fbCreatePixmap(pScreen, width, height, depth); + pVirtual = fbCreatePixmap(pScreen, width, height, depth, 0); if (pVirtual == NULL) { diff --git a/nx-X11/programs/Xserver/include/scrnintstr.h b/nx-X11/programs/Xserver/include/scrnintstr.h index 341d1145c..5a3f32309 100644 --- a/nx-X11/programs/Xserver/include/scrnintstr.h +++ b/nx-X11/programs/Xserver/include/scrnintstr.h @@ -196,11 +196,19 @@ typedef void (* ClipNotifyProcPtr)( int /*dx*/, int /*dy*/); +/* pixmap will exist only for the duration of the current rendering operation */ +#define CREATE_PIXMAP_USAGE_SCRATCH 1 +/* pixmap will be the backing pixmap for a redirected window */ +#define CREATE_PIXMAP_USAGE_BACKING_PIXMAP 2 +/* pixmap will contain a glyph */ +#define CREATE_PIXMAP_USAGE_GLYPH_PICTURE 3 + typedef PixmapPtr (* CreatePixmapProcPtr)( ScreenPtr /*pScreen*/, int /*width*/, int /*height*/, - int /*depth*/); + int /*depth*/, + unsigned /*usage_hint*/); typedef Bool (* DestroyPixmapProcPtr)( PixmapPtr /*pPixmap*/); diff --git a/nx-X11/programs/Xserver/mi/miarc.c b/nx-X11/programs/Xserver/mi/miarc.c index bd46a243a..5695e24af 100644 --- a/nx-X11/programs/Xserver/mi/miarc.c +++ b/nx-X11/programs/Xserver/mi/miarc.c @@ -1184,7 +1184,8 @@ miPolyArc(pDraw, pGC, narcs, parcs) /* allocate a 1 bit deep pixmap of the appropriate size, and * validate it */ pDrawTo = (DrawablePtr)(*pDraw->pScreen->CreatePixmap) - (pDraw->pScreen, pixmapWidth, pixmapHeight, 1); + (pDraw->pScreen, pixmapWidth, pixmapHeight, 1, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pDrawTo) { FreeScratchGC(pGCTo); diff --git a/nx-X11/programs/Xserver/mi/mibitblt.c b/nx-X11/programs/Xserver/mi/mibitblt.c index 2fdc32500..67d36a742 100644 --- a/nx-X11/programs/Xserver/mi/mibitblt.c +++ b/nx-X11/programs/Xserver/mi/mibitblt.c @@ -420,7 +420,8 @@ miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty) RegionPtr prgnSrcClip; pPixmap = (*pDraw->pScreen->CreatePixmap) - (pDraw->pScreen, w + srcx, h, 1); + (pDraw->pScreen, w + srcx, h, 1, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) return; @@ -671,7 +672,8 @@ miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst) if (!pGC) return; pPixmap = (*pDraw->pScreen->CreatePixmap) - (pDraw->pScreen, w, 1, depth); + (pDraw->pScreen, w, 1, depth, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { FreeScratchGC(pGC); diff --git a/nx-X11/programs/Xserver/mi/mibstore.c b/nx-X11/programs/Xserver/mi/mibstore.c index 3c4b74814..3eafac235 100644 --- a/nx-X11/programs/Xserver/mi/mibstore.c +++ b/nx-X11/programs/Xserver/mi/mibstore.c @@ -493,7 +493,8 @@ miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine) XID subWindowMode = IncludeInferiors; int x, y; - pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, depth); + pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, depth, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) goto punt; pGC = GetScratchGC (depth, pScreen); @@ -2737,7 +2738,7 @@ miResizeBackingStore( pNewPixmap = (PixmapPtr)(*pScreen->CreatePixmap) (pScreen, nw, nh, - pWin->drawable.depth); + pWin->drawable.depth, 0); if (!pNewPixmap) { #ifdef BSEAGER @@ -3737,7 +3738,7 @@ miCreateBSPixmap (pWin, pExtents) (pScreen, extents->x2 - extents->x1, extents->y2 - extents->y1, - pWin->drawable.depth); + pWin->drawable.depth, 0); } if (!pBackingStore->pBackingPixmap) { diff --git a/nx-X11/programs/Xserver/mi/midispcur.c b/nx-X11/programs/Xserver/mi/midispcur.c index df15ea311..92d0fb15c 100644 --- a/nx-X11/programs/Xserver/mi/midispcur.c +++ b/nx-X11/programs/Xserver/mi/midispcur.c @@ -266,7 +266,8 @@ miDCRealize ( pPriv->sourceBits = 0; pPriv->maskBits = 0; pPixmap = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, - pCursor->bits->height, 32); + pCursor->bits->height, 32, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { free ((void *) pPriv); @@ -298,13 +299,13 @@ miDCRealize ( } pPriv->pPicture = 0; #endif - pPriv->sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1); + pPriv->sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0); if (!pPriv->sourceBits) { free ((void *) pPriv); return (miDCCursorPtr)NULL; } - pPriv->maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1); + pPriv->maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0); if (!pPriv->maskBits) { (*pScreen->DestroyPixmap) (pPriv->sourceBits); @@ -525,7 +526,7 @@ miDCSaveUnderCursor (pScreen, x, y, w, h) if (pSave) (*pScreen->DestroyPixmap) (pSave); pScreenPriv->pSave = pSave = - (*pScreen->CreatePixmap) (pScreen, w, h, pScreen->rootDepth); + (*pScreen->CreatePixmap) (pScreen, w, h, pScreen->rootDepth, 0); if (!pSave) return FALSE; } @@ -735,7 +736,7 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask) } #endif pScreenPriv->pTemp = pTemp = (*pScreen->CreatePixmap) - (pScreen, w, h, pScreenPriv->pSave->drawable.depth); + (pScreen, w, h, pScreenPriv->pSave->drawable.depth, 0); if (!pTemp) return FALSE; } diff --git a/nx-X11/programs/Xserver/mi/miglblt.c b/nx-X11/programs/Xserver/mi/miglblt.c index 60c28fad4..462534bb6 100644 --- a/nx-X11/programs/Xserver/mi/miglblt.c +++ b/nx-X11/programs/Xserver/mi/miglblt.c @@ -125,7 +125,8 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) FONTMAXBOUNDS(pfont,descent); pPixmap = (*pDrawable->pScreen->CreatePixmap)(pDrawable->pScreen, - width, height, 1); + width, height, 1, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) return; diff --git a/nx-X11/programs/Xserver/mi/miscrinit.c b/nx-X11/programs/Xserver/mi/miscrinit.c index c5b78fa8f..e38284c50 100644 --- a/nx-X11/programs/Xserver/mi/miscrinit.c +++ b/nx-X11/programs/Xserver/mi/miscrinit.c @@ -160,7 +160,7 @@ miCreateScreenResources(pScreen) /* create a pixmap with no data, then redirect it to point to * the screen */ - pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth); + pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0); if (!pPixmap) return FALSE; diff --git a/nx-X11/programs/Xserver/render/mirect.c b/nx-X11/programs/Xserver/render/mirect.c index 3ce7a7f4c..888492140 100644 --- a/nx-X11/programs/Xserver/render/mirect.c +++ b/nx-X11/programs/Xserver/render/mirect.c @@ -137,7 +137,8 @@ miCompositeRects (CARD8 op, goto bail1; pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, - rgbaFormat->depth); + rgbaFormat->depth, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) goto bail2; diff --git a/nx-X11/programs/Xserver/render/mitrap.c b/nx-X11/programs/Xserver/render/mitrap.c index 96f1159a4..d3d052800 100644 --- a/nx-X11/programs/Xserver/render/mitrap.c +++ b/nx-X11/programs/Xserver/render/mitrap.c @@ -62,7 +62,7 @@ miCreateAlphaPicture (ScreenPtr pScreen, } pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, - pPictFormat->depth); + pPictFormat->depth, 0); if (!pPixmap) return 0; pGC = GetScratchGC (pPixmap->drawable.depth, pScreen); diff --git a/nx-X11/programs/Xserver/render/render.c b/nx-X11/programs/Xserver/render/render.c index 43cb430aa..24a8675f6 100644 --- a/nx-X11/programs/Xserver/render/render.c +++ b/nx-X11/programs/Xserver/render/render.c @@ -1570,7 +1570,8 @@ ProcRenderCreateCursor (ClientPtr client) free (mskbits); return (BadImplementation); } - pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32); + pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { free (argbbits); -- cgit v1.2.3 From aa50b35a5054d59d7d1d430435665b0a38866b74 Mon Sep 17 00:00:00 2001 From: Aaron Plattner Date: Wed, 22 Feb 2017 14:14:41 +0100 Subject: Save pixmap allocation hints into the PixmapRec. Backported from X.org: commit f797c96845a3fab37cda6839ebecf9ac5401fd6e Author: Aaron Plattner Date: Thu Nov 15 12:12:02 2007 -0800 Save pixmap allocation hints into the PixmapRec. Backported-to-NX-by: Mike Gabriel --- nx-X11/programs/Xserver/fb/fb24_32.c | 2 +- nx-X11/programs/Xserver/fb/fbpixmap.c | 6 ++++-- nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 1 + nx-X11/programs/Xserver/include/pixmapstr.h | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/fb/fb24_32.c b/nx-X11/programs/Xserver/fb/fb24_32.c index 13af3acb2..f80874e2f 100644 --- a/nx-X11/programs/Xserver/fb/fb24_32.c +++ b/nx-X11/programs/Xserver/fb/fb24_32.c @@ -537,7 +537,7 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel) pOldTile->drawable.width, pOldTile->drawable.height, pOldTile->drawable.depth, - bitsPerPixel); + bitsPerPixel, 0); if (!pNewTile) return 0; fbGetDrawable (&pOldTile->drawable, diff --git a/nx-X11/programs/Xserver/fb/fbpixmap.c b/nx-X11/programs/Xserver/fb/fbpixmap.c index abdbc54a9..5f24433e3 100644 --- a/nx-X11/programs/Xserver/fb/fbpixmap.c +++ b/nx-X11/programs/Xserver/fb/fbpixmap.c @@ -31,7 +31,8 @@ #include "fb.h" PixmapPtr -fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp) +fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp, + unsigned usage_hint) { PixmapPtr pPixmap; size_t datasize; @@ -81,6 +82,7 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp) pPixmap->screen_x = 0; pPixmap->screen_y = 0; #endif + pPixmap->usage_hint = usage_hint; return pPixmap; } @@ -95,7 +97,7 @@ fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, if (bpp == 32 && depth <= 24) bpp = fbGetScreenPrivate(pScreen)->pix32bpp; #endif - return fbCreatePixmapBpp (pScreen, width, height, depth, bpp); + return fbCreatePixmapBpp (pScreen, width, height, depth, bpp, usage_hint); } Bool diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index 87cf136cc..3f2d65de2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -144,6 +144,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, pPixmap -> devKind = 0; pPixmap -> refcnt = 1; pPixmap -> devPrivate.ptr = NULL; + pPixmap -> usage_hint = usage_hint; /* * Initialize the privates of the real picture. diff --git a/nx-X11/programs/Xserver/include/pixmapstr.h b/nx-X11/programs/Xserver/include/pixmapstr.h index 5189c3e09..82b96d456 100644 --- a/nx-X11/programs/Xserver/include/pixmapstr.h +++ b/nx-X11/programs/Xserver/include/pixmapstr.h @@ -82,6 +82,7 @@ typedef struct _Pixmap { short screen_x; short screen_y; #endif + unsigned usage_hint; /* see CREATE_PIXMAP_USAGE_* */ } PixmapRec; #endif /* PIXMAPSTRUCT_H */ -- cgit v1.2.3 From 560c9564346f2c663320a072e2685f9c846e5a08 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 11 Mar 2017 01:13:58 +0100 Subject: Mesa.patches: Adapt Mesa to CreatePixmap allocation hint ABI bump. --- .../Mesa.patches/4001_CreatePixmap-AllocationHints.patch | 13 +++++++++++++ nx-X11/extras/Mesa.patches/series | 1 + 2 files changed, 14 insertions(+) create mode 100644 nx-X11/extras/Mesa.patches/4001_CreatePixmap-AllocationHints.patch create mode 100644 nx-X11/extras/Mesa.patches/series diff --git a/nx-X11/extras/Mesa.patches/4001_CreatePixmap-AllocationHints.patch b/nx-X11/extras/Mesa.patches/4001_CreatePixmap-AllocationHints.patch new file mode 100644 index 000000000..f2caf2812 --- /dev/null +++ b/nx-X11/extras/Mesa.patches/4001_CreatePixmap-AllocationHints.patch @@ -0,0 +1,13 @@ +Index: Mesa/include/GL/xmesa_xf86.h +=================================================================== +--- Mesa.orig/include/GL/xmesa_xf86.h ++++ Mesa/include/GL/xmesa_xf86.h +@@ -130,7 +130,7 @@ do { \ + + /* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */ + #define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \ +- (*__d->CreatePixmap)(__d, __w, __h, __depth) ++ (*__d->CreatePixmap)(__d, __w, __h, __depth, 0) + + #define XMesaFreePixmap(__d,__b) \ + (*__d->DestroyPixmap)(__b) diff --git a/nx-X11/extras/Mesa.patches/series b/nx-X11/extras/Mesa.patches/series new file mode 100644 index 000000000..2ddad71d6 --- /dev/null +++ b/nx-X11/extras/Mesa.patches/series @@ -0,0 +1 @@ +4001_CreatePixmap-AllocationHints.patch -- cgit v1.2.3 From 8b5bb2cdafe5f7bd77826a1fd28f07b7329be899 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 22 Feb 2017 12:59:07 +0000 Subject: hw/nxagent/Pixmap.c et al.: Propagate usage_hint through nxagentCreatePixmap, as well. --- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/NXglyph.c | 4 +++- nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 31 ++++++++++++++++----------- nx-X11/programs/Xserver/hw/nxagent/Pixmaps.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 8d6f4139d..917f460ba 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -2702,7 +2702,7 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) * would fail. */ - pBitmap = nxagentCreatePixmap(pDrawable -> pScreen, pDrawable -> width, pDrawable -> height, pDrawable -> depth); + pBitmap = nxagentCreatePixmap(pDrawable -> pScreen, pDrawable -> width, pDrawable -> height, pDrawable -> depth, 0); if (pBitmap == NULL) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c b/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c index 7bf285d1f..34195808d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c @@ -245,7 +245,9 @@ miGlyphs (CARD8 op, return; width = extents.x2 - extents.x1; height = extents.y2 - extents.y1; - pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, maskFormat->depth); + pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, + maskFormat->depth, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pMaskPixmap) return; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index 3f2d65de2..be5408d13 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -96,8 +96,8 @@ struct nxagentPixmapPair PixmapPtr pMap; }; -PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, - int height, int depth) +PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, + int depth, unsigned usage_hint) { nxagentPrivPixmapPtr pPixmapPriv, pVirtualPriv; @@ -106,7 +106,8 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, #ifdef DEBUG fprintf(stderr, "nxagentCreatePixmap: Creating pixmap with width [%d] " - "height [%d] depth [%d].\n", width, height, depth); + "height [%d] depth [%d] and allocation hint [%d].\n", + width, height, depth, usage_hint); #endif /* @@ -120,7 +121,8 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, { #ifdef WARNING fprintf(stderr, "nxagentCreatePixmap: WARNING! Failed to create pixmap with " - "width [%d] height [%d] depth [%d].\n", width, height, depth); + "width [%d] height [%d] depth [%d] and allocation hint [%d].\n", + width, height, depth, usage_hint); #endif return NullPixmap; @@ -243,13 +245,14 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, * Create the pixmap in the virtual framebuffer. */ - pVirtual = fbCreatePixmap(pScreen, width, height, depth, 0); + pVirtual = fbCreatePixmap(pScreen, width, height, depth, usage_hint); if (pVirtual == NULL) { #ifdef PANIC fprintf(stderr, "nxagentCreatePixmap: PANIC! Failed to create virtual pixmap with " - "width [%d] height [%d] depth [%d].\n", width, height, depth); + "width [%d] height [%d] depth [%d] and allocation hint [%d].\n", + width, height, depth, usage_hint); #endif nxagentDestroyPixmap(pPixmap); @@ -258,8 +261,9 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, } #ifdef TEST - fprintf(stderr,"nxagentCreatePixmap: Allocated memory for the Virtual %sPixmap %p of real Pixmap %p (%dx%d)\n", - nxagentShmPixmapTrap ? "Shm " : "", (void *) pVirtual, (void *) pPixmap, width, height); + fprintf(stderr,"nxagentCreatePixmap: Allocated memory for the Virtual %sPixmap %p of real Pixmap %p (%dx%d),", + "allocation hint [%d].\n", + nxagentShmPixmapTrap ? "Shm " : "", (void *) pVirtual, (void *) pPixmap, width, height, usage_hint); #endif pPixmapPriv -> pVirtualPixmap = pVirtual; @@ -331,10 +335,11 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, "bits per pixel.\n", (void *) pVirtual); fprintf(stderr, "nxagentCreatePixmap: WARNING! Real pixmap created with width [%d] " - "height [%d] depth [%d] bits per pixel [%d].\n", pPixmap -> drawable.width, + "height [%d] depth [%d] bits per pixel [%d] and allocation hint [%d].\n", + pPixmap -> drawable.width, pPixmap -> drawable.height = height, pPixmap -> drawable.depth, - pPixmap -> drawable.bitsPerPixel); - + pPixmap -> drawable.bitsPerPixel, + usage_hint); #endif if (!nxagentRenderTrap) @@ -353,8 +358,8 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, #ifdef TEST fprintf(stderr, "nxagentCreatePixmap: Created pixmap at [%p] virtual at [%p] with width [%d] " - "height [%d] depth [%d].\n", (void *) pPixmap, (void *) pVirtual, - width, height, depth); + "height [%d] depth [%d] and allocation hint [%d].\n", + (void *) pPixmap, (void *) pVirtual, width, height, depth, usage_hint); #endif return pPixmap; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmaps.h b/nx-X11/programs/Xserver/hw/nxagent/Pixmaps.h index d823cd77b..00cc39c5f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmaps.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmaps.h @@ -117,7 +117,7 @@ extern int nxagentPixmapPrivateIndex; PixmapPtr nxagentPixmapPtr(Pixmap pixmap); PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, - int height, int depth); + int height, int depth, unsigned usage_hint); Bool nxagentDestroyPixmap(PixmapPtr pPixmap); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 8fb4ce710..1c3e76580 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -2855,7 +2855,7 @@ int nxagentShadowCreateMainWindow(ScreenPtr pScreen, WindowPtr pWin, int width, DeleteWindow(nxagentShadowWindowPtr, accessWindowID); } - nxagentShadowPixmapPtr = nxagentCreatePixmap(pScreen, nxagentShadowWidth, nxagentShadowHeight, nxagentShadowDepth); + nxagentShadowPixmapPtr = nxagentCreatePixmap(pScreen, nxagentShadowWidth, nxagentShadowHeight, nxagentShadowDepth, 0); if (nxagentShadowPixmapPtr) { -- cgit v1.2.3