summaryrefslogtreecommitdiff
path: root/exa
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-09-27 02:08:10 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2009-09-27 20:18:08 +1000
commit0c6423b3d52af85cd990811f7be982c0b6ed7c32 (patch)
treeec0b68e2a0935c12429ce23e20496cc3146d7290 /exa
parentbb7c26e38c262614c5d1c21fc7a04c71a9028e51 (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 . (cherry picked from commit 73ae547d5e687ef10dea45801fc627e10ac4b659)
Diffstat (limited to 'exa')
-rw-r--r--exa/exa_migration_classic.c26
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);
}
/**