diff options
author | Michel Dänzer <daenzer@vmware.com> | 2009-12-08 20:25:02 +0100 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-12-08 13:06:42 -0800 |
commit | 955b9f23a34cc79a5cd9676b45b3df4ffcc7302b (patch) | |
tree | cf6c95b64766726b23327a53da1612c6beade664 | |
parent | c1503861cf75654d4f7b22e6f7f6487c47a0a395 (diff) |
EXA: ModifyPixmapHeader_mixed fixes.
* Better detection of dimension changes.
* Make sure to re-create the system memory copy when the pixmap dimensions
change (e.g. the screen pixmap on screen resize).
* Clear the valid regions.
Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Acked-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | exa/exa_mixed.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c index 764c7dd58..0fb644b9c 100644 --- a/exa/exa_mixed.c +++ b/exa/exa_mixed.c @@ -135,17 +135,54 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED; } - if (pExaPixmap->driverPriv) { - if (width > 0 && height > 0 && bitsPerPixel > 0) { + has_gpu_copy = exaPixmapHasGpuCopy(pPixmap); + + if (width <= 0) + width = pPixmap->drawable.width; + + if (height <= 0) + height = pPixmap->drawable.height; + + if (bitsPerPixel <= 0) { + if (depth <= 0) + bitsPerPixel = pPixmap->drawable.bitsPerPixel; + else + bitsPerPixel = BitsPerPixel(depth); + } + + if (depth <= 0) + depth = pPixmap->drawable.depth; + + if (width != pPixmap->drawable.width || + height != pPixmap->drawable.height || + devKind != pPixmap->devKind || + depth != pPixmap->drawable.depth || + bitsPerPixel != pPixmap->drawable.bitsPerPixel) { + if (pExaPixmap->driverPriv) { exaSetFbPitch(pExaScr, pExaPixmap, width, height, bitsPerPixel); exaSetAccelBlock(pExaScr, pExaPixmap, width, height, bitsPerPixel); + REGION_EMPTY(pScreen, &pExaPixmap->validFB); } + + /* Need to re-create system copy if there's also a GPU copy */ + if (has_gpu_copy && pExaPixmap->sys_ptr) { + free(pExaPixmap->sys_ptr); + pExaPixmap->sys_ptr = NULL; + pExaPixmap->sys_pitch = devKind > 0 ? devKind : + PixmapBytePad(width, depth); + DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage); + DamageDestroy(pExaPixmap->pDamage); + pExaPixmap->pDamage = NULL; + REGION_EMPTY(pScreen, &pExaPixmap->validSys); + + if (pExaScr->deferred_mixed_pixmap == pPixmap) + pExaScr->deferred_mixed_pixmap = NULL; + } } - has_gpu_copy = exaPixmapHasGpuCopy(pPixmap); if (has_gpu_copy) { pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr; pPixmap->devKind = pExaPixmap->fb_pitch; |