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/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 +- 5 files changed, 10 insertions(+), 7 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent') 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) { -- 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/hw/nxagent/Pixmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'nx-X11/programs/Xserver/hw/nxagent') 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. -- 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(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent') 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