diff options
author | Maarten Maathuis <madman2003@gmail.com> | 2009-08-05 18:39:47 +0200 |
---|---|---|
committer | Maarten Maathuis <madman2003@gmail.com> | 2009-08-06 23:48:14 +0200 |
commit | 3047bd067464efb9857960d3fa6324b947faa970 (patch) | |
tree | fefaab177a825139aa7c2cb58f28adeff240524e /exa | |
parent | e8ac2ed5dc4c2ac0a5e1e1f371f94c15b1c729dd (diff) |
exa: delay malloc for "mixed"
Diffstat (limited to 'exa')
-rw-r--r-- | exa/exa.c | 12 | ||||
-rw-r--r-- | exa/exa_migration_mixed.c | 4 | ||||
-rw-r--r-- | exa/exa_mixed.c | 11 |
3 files changed, 17 insertions, 10 deletions
@@ -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); diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c index 771c2c342..915bed9a1 100644 --- a/exa/exa_migration_mixed.c +++ b/exa/exa_migration_mixed.c @@ -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; diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c index 7e02abc61..47fa6d448 100644 --- a/exa/exa_mixed.c +++ b/exa/exa_mixed.c @@ -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; |