diff options
author | Michel Dänzer <daenzer@vmware.com> | 2009-09-27 02:08:10 +0200 |
---|---|---|
committer | Michel Dänzer <daenzer@vmware.com> | 2009-09-27 02:08:10 +0200 |
commit | 73ae547d5e687ef10dea45801fc627e10ac4b659 (patch) | |
tree | 012869faafe853e870d9ee19675e5198b4991586 | |
parent | c9ec2bab2f258798fd6e6676698c732f09571a60 (diff) |
EXA: Fix mixed pixmaps crash with missing / failing UploadToScreen hook.
For the recent mixed pixmaps changes, I failed to realize (or hit in my
testing) a problem which can occur if the driver doesn't provide an
UploadToScreen hook or provides one which can fail: There can be a crash
in exaMemcpyBox() because exaCopyDirtyToFb() passes pExaPixmap->fb_ptr to
exaCopyDirty(), but that's normally NULL with driver allocated pixmaps.
The solution is to make exaCopyDirty*() no longer rely on pExaPixmap->fb_ptr
but use pPixmap->devPrivate.ptr after PrepareAccess instead.
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=24167 .
-rw-r--r-- | exa/exa_migration_classic.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/exa/exa_migration_classic.c b/exa/exa_migration_classic.c index 0032f02f9..4819af841 100644 --- a/exa/exa_migration_classic.c +++ b/exa/exa_migration_classic.c @@ -104,9 +104,8 @@ exaPixmapShouldBeInFB (PixmapPtr pPix) static void exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc, Bool (*transfer) (PixmapPtr pPix, int x, int y, int w, int h, - char *sys, int sys_pitch), CARD8 *fallback_src, - CARD8 *fallback_dst, int fallback_srcpitch, int fallback_dstpitch, - int fallback_index, void (*sync) (ScreenPtr pScreen)) + char *sys, int sys_pitch), int fallback_index, + void (*sync) (ScreenPtr pScreen)) { PixmapPtr pPixmap = migrate->pPix; ExaPixmapPriv (pPixmap); @@ -228,9 +227,15 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc, ExaDoPrepareAccess(pPixmap, fallback_index); access_prepared = TRUE; } - exaMemcpyBox (pPixmap, pBox, - fallback_src, fallback_srcpitch, - fallback_dst, fallback_dstpitch); + if (fallback_index == EXA_PREPARE_DEST) { + exaMemcpyBox (pPixmap, pBox, + pExaPixmap->sys_ptr, pExaPixmap->sys_pitch, + pPixmap->devPrivate.ptr, pPixmap->devKind); + } else { + exaMemcpyBox (pPixmap, pBox, + pPixmap->devPrivate.ptr, pPixmap->devKind, + pExaPixmap->sys_ptr, pExaPixmap->sys_pitch); + } } else need_sync = TRUE; @@ -271,9 +276,8 @@ exaCopyDirtyToSys (ExaMigrationPtr migrate) ExaPixmapPriv (pPixmap); exaCopyDirty(migrate, &pExaPixmap->validSys, &pExaPixmap->validFB, - pExaScr->info->DownloadFromScreen, pExaPixmap->fb_ptr, - pExaPixmap->sys_ptr, pExaPixmap->fb_pitch, - pExaPixmap->sys_pitch, EXA_PREPARE_SRC, exaWaitSync); + pExaScr->info->DownloadFromScreen, EXA_PREPARE_SRC, + exaWaitSync); } /** @@ -289,9 +293,7 @@ exaCopyDirtyToFb (ExaMigrationPtr migrate) ExaPixmapPriv (pPixmap); exaCopyDirty(migrate, &pExaPixmap->validFB, &pExaPixmap->validSys, - pExaScr->info->UploadToScreen, pExaPixmap->sys_ptr, - pExaPixmap->fb_ptr, pExaPixmap->sys_pitch, - pExaPixmap->fb_pitch, EXA_PREPARE_DEST, NULL); + pExaScr->info->UploadToScreen, EXA_PREPARE_DEST, NULL); } /** |