diff options
author | Maarten Maathuis <madman2003@gmail.com> | 2009-08-02 02:35:46 +0200 |
---|---|---|
committer | Maarten Maathuis <madman2003@gmail.com> | 2009-08-06 23:48:14 +0200 |
commit | 9d2a7128d3e66b8c076a714d69f84bcad49391b9 (patch) | |
tree | c2ceeeede1bc83356bb00247d1f7650d115987d1 /exa/exa_mixed.c | |
parent | 03ecb164f2592c954aa408bf121e0c67b604d854 (diff) |
exa: Use damage to optimise away useless copies.
Diffstat (limited to 'exa/exa_mixed.c')
-rw-r--r-- | exa/exa_mixed.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c index 26406c42f..7e02abc61 100644 --- a/exa/exa_mixed.c +++ b/exa/exa_mixed.c @@ -114,6 +114,23 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth, /* We want to be able to copy the pixmap to driver memory later on. */ pExaPixmap->score = EXA_PIXMAP_SCORE_INIT; + + /* Set up damage tracking */ + pExaPixmap->pDamage = DamageCreate (NULL, NULL, + DamageReportNone, TRUE, + pScreen, pPixmap); + + if (pExaPixmap->pDamage == NULL) { + swap(pExaScr, pScreen, DestroyPixmap); + pScreen->DestroyPixmap (pPixmap); + swap(pExaScr, pScreen, DestroyPixmap); + return NULL; + } + + DamageRegister (&pPixmap->drawable, pExaPixmap->pDamage); + /* This ensures that pending damage reflects the current operation. */ + /* This is used by exa to optimize migration. */ + DamageSetReportAfterOp (pExaPixmap->pDamage, TRUE); } return pPixmap; @@ -136,8 +153,16 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, if (pExaPixmap) { if (pPixData) { - if (!exaPixmapIsPinned(pPixmap)) + if (!exaPixmapIsPinned(pPixmap)) { free(pExaPixmap->sys_ptr); + + /* We no longer need this. */ + if (pExaPixmap->pDamage) { + DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage); + DamageDestroy(pExaPixmap->pDamage); + pExaPixmap->pDamage = NULL; + } + } pExaPixmap->sys_ptr = pPixData; } |