exa: delay malloc for "mixed"

This commit is contained in:
Maarten Maathuis 2009-08-05 18:39:47 +02:00
parent e8ac2ed5dc
commit 3047bd0674
3 changed files with 17 additions and 10 deletions

View File

@ -333,8 +333,18 @@ ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
pExaScr->access[index].pixmap = pPixmap;
pExaScr->access[index].count = 1;
if (!offscreen)
if (!offscreen) {
/* Do we need to allocate our system buffer? */
if ((pExaScr->info->flags & EXA_HANDLES_PIXMAPS) && (pExaScr->info->flags & EXA_MIXED_PIXMAPS)) {
if (!pExaPixmap->sys_ptr) {
pExaPixmap->sys_ptr = malloc(pExaPixmap->sys_pitch * pDrawable->height);
if (!pExaPixmap->sys_ptr)
FatalError("EXA: malloc failed for size %d bytes\n", pExaPixmap->sys_pitch * pDrawable->height);
pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
}
}
return FALSE;
}
exaWaitSync (pDrawable->pScreen);

View File

@ -109,6 +109,10 @@ exaCreateDriverPixmap_mixed(PixmapPtr pPixmap)
if (!w || !h)
goto finish;
/* we do not malloc memory by default. */
if (!sys_buffer)
goto finish;
if (!pExaScr->info->UploadToScreen)
goto fallback;

View File

@ -81,17 +81,10 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
datasize = h * paddedWidth;
/* Allocate temporary pixmap. */
pExaPixmap->sys_ptr = malloc(datasize);
/* We will allocate the system pixmap later if needed. */
pExaPixmap->sys_ptr = NULL;
pExaPixmap->sys_pitch = paddedWidth;
if (!pExaPixmap->sys_ptr) {
swap(pExaScr, pScreen, DestroyPixmap);
pScreen->DestroyPixmap (pPixmap);
swap(pExaScr, pScreen, DestroyPixmap);
return NULL;
}
pExaPixmap->area = NULL;
pExaPixmap->offscreen = FALSE;
pExaPixmap->score = EXA_PIXMAP_SCORE_INIT;