From f2e310132fbe1520c1b5f3da4faa2d2d47835e72 Mon Sep 17 00:00:00 2001 From: Aaron Plattner Date: Wed, 31 Oct 2007 14:15:35 -0700 Subject: 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. --- fb/fb.h | 3 ++- fb/fboverlay.c | 2 +- fb/fbpixmap.c | 3 ++- fb/fbpseudocolor.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) (limited to 'fb') diff --git a/fb/fb.h b/fb/fb.h index 379a00a34..380e2e118 100644 --- a/fb/fb.h +++ b/fb/fb.h @@ -1624,7 +1624,8 @@ PixmapPtr 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); Bool fbDestroyPixmap (PixmapPtr pPixmap); diff --git a/fb/fboverlay.c b/fb/fboverlay.c index 0d1eb88eb..456c921a6 100644 --- a/fb/fboverlay.c +++ b/fb/fboverlay.c @@ -137,7 +137,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/fb/fbpixmap.c b/fb/fbpixmap.c index 88f693e73..cddab3ee3 100644 --- a/fb/fbpixmap.c +++ b/fb/fbpixmap.c @@ -80,7 +80,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/fb/fbpseudocolor.c b/fb/fbpseudocolor.c index 411bde1dc..a15697d43 100644 --- a/fb/fbpseudocolor.c +++ b/fb/fbpseudocolor.c @@ -275,7 +275,7 @@ xxCreateScreenResources(ScreenPtr pScreen) * (BitsPerPixel(depth) >> 3)); if (!pBits) return FALSE; - pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth); + pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth, 0); if (!pPixmap) { xfree(pBits); return FALSE; -- cgit v1.2.3 From 34cdf06e4ccb243664005cc33009d8759a7f6e4d Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Mon, 5 Nov 2007 14:12:22 +0000 Subject: fb: Remove usage of alloca Replace with heap storage. --- fb/fbcopy.c | 10 +++++----- fb/fbpseudocolor.c | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'fb') diff --git a/fb/fbcopy.c b/fb/fbcopy.c index 68f403f3f..b8b0b6a8c 100644 --- a/fb/fbcopy.c +++ b/fb/fbcopy.c @@ -326,7 +326,7 @@ fbCopyRegion (DrawablePtr pSrcDrawable, if (nbox > 1) { /* keep ordering in each band, reverse order of bands */ - pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); + pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox); if(!pboxNew1) return; pboxBase = pboxNext = pbox+nbox-1; @@ -363,11 +363,11 @@ fbCopyRegion (DrawablePtr pSrcDrawable, if (nbox > 1) { /* reverse order of rects in each band */ - pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); + pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox); if(!pboxNew2) { if (pboxNew1) - DEALLOCATE_LOCAL(pboxNew1); + xfree(pboxNew1); return; } pboxBase = pboxNext = pbox; @@ -402,9 +402,9 @@ fbCopyRegion (DrawablePtr pSrcDrawable, reverse, upsidedown, bitPlane, closure); if (pboxNew1) - DEALLOCATE_LOCAL (pboxNew1); + xfree (pboxNew1); if (pboxNew2) - DEALLOCATE_LOCAL (pboxNew2); + xfree (pboxNew2); } RegionPtr diff --git a/fb/fbpseudocolor.c b/fb/fbpseudocolor.c index a15697d43..8a48c3819 100644 --- a/fb/fbpseudocolor.c +++ b/fb/fbpseudocolor.c @@ -500,7 +500,7 @@ xxStoreColors(ColormapPtr pmap, int nColors, xColorItem *pColors) DBG("StoreColors\n"); - expanddefs = ALLOCATE_LOCAL(sizeof(xColorItem) + expanddefs = xalloc(sizeof(xColorItem) * (1 << pScrPriv->myDepth)); if (!expanddefs) return; @@ -527,7 +527,7 @@ xxStoreColors(ColormapPtr pmap, int nColors, xColorItem *pColors) pColors++; } - DEALLOCATE_LOCAL(expanddefs); + xfree(expanddefs); pCmapPriv->dirty = TRUE; pScrPriv->colormapDirty = TRUE; @@ -565,9 +565,9 @@ xxInstallColormap(ColormapPtr pmap) wrap(pScrPriv,pmap->pScreen,InstallColormap,xxInstallColormap); } - pixels = ALLOCATE_LOCAL(sizeof(Pixel) * (1 << pScrPriv->myDepth)); - colors = ALLOCATE_LOCAL(sizeof(xrgb) * (1 << pScrPriv->myDepth)); - defs = ALLOCATE_LOCAL(sizeof(xColorItem) * (1 << pScrPriv->myDepth)); + pixels = xalloc(sizeof(Pixel) * (1 << pScrPriv->myDepth)); + colors = xalloc(sizeof(xrgb) * (1 << pScrPriv->myDepth)); + defs = xalloc(sizeof(xColorItem) * (1 << pScrPriv->myDepth)); if (!pixels || !colors) return; @@ -595,9 +595,9 @@ xxInstallColormap(ColormapPtr pmap) } xxStoreColors(pmap,(1 << pScrPriv->myDepth),defs); - DEALLOCATE_LOCAL(pixels); - DEALLOCATE_LOCAL(colors); - DEALLOCATE_LOCAL(defs); + xfree(pixels); + xfree(colors); + xfree(defs); return; } -- cgit v1.2.3