exa: fix ExaCheckCopyNtoN for exa_classic when source = dest

In case you want to copy a region with source = dest, you have the same pixmap
as source and dest.

At the end of exaPixmapIsOffscreen_classic() the devPrivate.ptr is reset to
NULL (look at the sources).

Now this is what happens in ExaCheckCopyNtoN:

exaPrepareAccess( pDst );
   Calls IsOffscreen()
      sets devPrivate.ptr to NULL
   sets up devPrivate.ptr to real pointer
   Everything OK
exaPrepareAccess( pSrc );
   Calls IsOffscreen()
      sets devPrivate.ptr to NULL
   BAILS OUT CAUSE OF NESTED OPERATION SINCE DST EQUALS SRC

We end up with devPrivate.ptr as NULL, and that is clearly wrong.

In particular this fixes a segfault when using the psb driver (bug 28077)

Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 7e8f100121)
This commit is contained in:
Éric Piel 2010-06-11 09:16:32 -07:00 committed by Julien Cristau
parent f44ebbd3d5
commit 5154dede3d

View File

@ -256,9 +256,10 @@ exaPixmapIsOffscreen_classic(PixmapPtr pPixmap)
Bool ret;
if (pExaScr->info->PixmapIsOffscreen) {
void* old_ptr = pPixmap->devPrivate.ptr;
pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap);
ret = pExaScr->info->PixmapIsOffscreen(pPixmap);
pPixmap->devPrivate.ptr = NULL;
pPixmap->devPrivate.ptr = old_ptr;
} else
ret = (pExaPixmap->offscreen && pExaPixmap->fb_ptr);