Commit f2e31013 authored by Aaron Plattner's avatar Aaron Plattner
Browse files

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.
parent 3f1b6765
......@@ -1252,7 +1252,7 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
__glXenterServer(GL_FALSE);
pPixmap = (*pGlxScreen->pScreen->CreatePixmap) (pGlxScreen->pScreen,
width, height, config->rgbBits);
width, height, config->rgbBits, 0);
__glXleaveServer(GL_FALSE);
return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable,
......
......@@ -403,7 +403,7 @@ CreateImageBuffers (pWin, nbuf, ids, action, hint)
pMultibuffer->pMultibuffers = pMultibuffers;
if (!AddResource (ids[i], MultibufferResType, (pointer) pMultibuffer))
break;
pMultibuffer->pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, depth);
pMultibuffer->pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, depth, 0);
if (!pMultibuffer->pPixmap)
break;
if (!AddResource (ids[i], MultibufferDrawableResType, (pointer) pMultibuffer->pPixmap))
......@@ -1576,7 +1576,8 @@ MultibufferPositionWindow (pWin, x, y)
{
pMultibuffer = &pMultibuffers->buffers[i];
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
pWin->drawable.depth);
pWin->drawable.depth,
CREATE_PIXMAP_USAGE_SCRATCH);
if (!pPixmap)
{
DestroyImageBuffers (pWin);
......
......@@ -155,7 +155,7 @@ pixCreateImageBuffers (pWin, nbuf, ids, action, hint)
{
pMBBuffer = &pMBWindow->buffers[i];
pMBBuffer->pDrawable = (DrawablePtr)
(*pScreen->CreatePixmap) (pScreen, width, height, depth);
(*pScreen->CreatePixmap) (pScreen, width, height, depth, 0);
if (!pMBBuffer->pDrawable)
break;
......@@ -542,7 +542,8 @@ pixPositionWindow (pWin, x, y)
for (i = 0; i < pMBWindow->numMultibuffer; i++)
{
pMBBuffer = &pMBWindow->buffers[i];
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, pWin->drawable.depth);
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, pWin->drawable.depth,
CREATE_PIXMAP_USAGE_SCRATCH);
if (!pPixmap)
{
(* MB_SCREEN_PRIV(pScreen)->DestroyImageBuffers)(pWin);
......
......@@ -543,7 +543,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);
......@@ -1070,7 +1071,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;
......
......@@ -483,7 +483,8 @@ extern PixmapPtr afbCreatePixmap(
ScreenPtr /*pScreen*/,
int /*width*/,
int /*height*/,
int /*depth*/
int /*depth*/,
unsigned /*usage_hint*/
);
extern Bool afbDestroyPixmap(
......
......@@ -72,7 +72,8 @@ afbPutImage(pDraw, pGC, depth, x, y, width, height, leftPad, format, pImage)
int depthDst;
/* Create a tmp pixmap */
pPixmap = (pScreen->CreatePixmap)(pScreen, width, height, depth);
pPixmap = (pScreen->CreatePixmap)(pScreen, width, height, depth,
CREATE_PIXMAP_USAGE_SCRATCH);
if (!pPixmap)
return;
......
......@@ -70,11 +70,12 @@ SOFTWARE.
#include "mfb.h"
PixmapPtr
afbCreatePixmap(pScreen, width, height, depth)
afbCreatePixmap(pScreen, width, height, depth, usage_hint)
ScreenPtr pScreen;
int width;
int height;
int depth;
unsigned usage_hint;
{
PixmapPtr pPixmap;
size_t datasize;
......@@ -127,8 +128,10 @@ afbCopyPixmap(PixmapPtr pSrc)
size = pSrc->drawable.height * pSrc->devKind * pSrc->drawable.depth;
pScreen = pSrc->drawable.pScreen;
pDst = (*pScreen->CreatePixmap)(pScreen, pSrc->drawable.width,
pSrc->drawable.height, pSrc->drawable.depth);
pDst = (*pScreen->CreatePixmap)(pScreen,
pSrc->drawable.width,
pSrc->drawable.height,
pSrc->drawable.depth, 0);
if (!pDst)
return(NullPixmap);
memmove((char *)pDst->devPrivate.ptr, (char *)pSrc->devPrivate.ptr, size);
......
......@@ -739,7 +739,8 @@ extern PixmapPtr cfbCreatePixmap(
ScreenPtr /*pScreen*/,
int /*width*/,
int /*height*/,
int /*depth*/
int /*depth*/,
unsigned /*usage_hint*/
);
extern Bool cfbDestroyPixmap(
......
......@@ -1407,7 +1407,8 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
ScreenPtr pScreen = pSrcDrawable->pScreen;
GCPtr pGC1;
pBitmap = (*pScreen->CreatePixmap) (pScreen, width, height, 1);
pBitmap = (*pScreen->CreatePixmap) (pScreen, width, height, 1,
CREATE_PIXMAP_USAGE_SCRATCH);
if (!pBitmap)
return NULL;
pGC1 = GetScratchGC (1, pScreen);
......
......@@ -65,11 +65,12 @@ SOFTWARE.
#include "cfbmskbits.h"
PixmapPtr
cfbCreatePixmap (pScreen, width, height, depth)
cfbCreatePixmap (pScreen, width, height, depth, usage_hint)
ScreenPtr pScreen;
int width;
int height;
int depth;
unsigned usage_hint;
{
PixmapPtr pPixmap;
size_t datasize;
......@@ -122,7 +123,7 @@ cfbCopyPixmap(pSrc)
size = pSrc->drawable.height * pSrc->devKind;
pScreen = pSrc->drawable.pScreen;
pDst = (*pScreen->CreatePixmap) (pScreen, pSrc->drawable.width,
pSrc->drawable.height, pSrc->drawable.depth);
pSrc->drawable.height, pSrc->drawable.depth, 0);
if (!pDst)
return NullPixmap;
memmove((char *)pDst->devPrivate.ptr, (char *)pSrc->devPrivate.ptr, size);
......
......@@ -462,7 +462,8 @@ 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 = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth,
CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
if (!pPixmap)
return 0;
......
......@@ -177,7 +177,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
if (!(pDbeWindowPrivPriv->pFrontBuffer =
(*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width,
pDbeWindowPriv->height,
pWin->drawable.depth)))
pWin->drawable.depth, 0)))
{
return(BadAlloc);
}
......@@ -186,7 +186,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
if (!(pDbeWindowPrivPriv->pBackBuffer =
(*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width,
pDbeWindowPriv->height,
pWin->drawable.depth)))
pWin->drawable.depth, 0)))
{
(*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer);
return(BadAlloc);
......@@ -648,10 +648,10 @@ miDbePositionWindow(WindowPtr pWin, int x, int 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)
{
......
......@@ -1554,7 +1554,7 @@ ProcCreatePixmap(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;
......
......@@ -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)
{
......@@ -1036,7 +1036,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;
......
......@@ -98,7 +98,8 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned cha
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)
{
......
......@@ -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,
......
......@@ -312,7 +312,7 @@ MakeRootTile(WindowPtr pWin)
int i, j;
pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4,
pScreen->rootDepth);
pScreen->rootDepth, 0);
pWin->backgroundState = BackgroundPixmap;
pGC = GetScratchGC(pScreen->rootDepth, pScreen);
......
......@@ -234,7 +234,8 @@ exaLog2(int val)
* for scratch pixmaps, or to represent the visible screen.
*/
static PixmapPtr
exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
unsigned usage_hint)
{
PixmapPtr pPixmap;
ExaPixmapPrivPtr pExaPixmap;
......@@ -246,10 +247,10 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
return NullPixmap;
if (!pExaScr->info->CreatePixmap) {
pPixmap = fbCreatePixmap (pScreen, w, h, depth);
pPixmap = fbCreatePixmap (pScreen, w, h, depth, usage_hint);
} else {
driver_alloc = 1;
pPixmap = fbCreatePixmap(pScreen, 0, 0, depth);
pPixmap = fbCreatePixmap(pScreen, 0, 0, depth, usage_hint);
}
if (!pPixmap)
......
......@@ -774,7 +774,7 @@ exaCreateAlphaPicture (ScreenPtr pScreen,
}
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
pPictFormat->depth);
pPictFormat->depth, 0);
if (!pPixmap)
return 0;
pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment