Fixes crash attempting to read a pixel from a NULL pPixmap->devPrivate.ptr
Signed-off-by: Alan Coopersmith <[email protected]> --- src/atimach64render.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) Mostly just cut-and-paste and guess-and-hope, but it seems to work and stops the crash for me. diff --git a/src/atimach64render.c b/src/atimach64render.c index 4862cd4..1328cca 100644 --- a/src/atimach64render.c +++ b/src/atimach64render.c @@ -208,22 +208,31 @@ Mach64PixelARGB(PixmapPtr pPixmap, CARD32 format, CARD32 *argb) CARD32 pixel; CARD8 comp; int bits, shift; +#ifdef USE_EXA + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pPixmap->drawable.pScreen); + ATIPtr pATI = ATIPTR(pScreenInfo); +#endif /* Ensure that texture drawing has completed. */ exaWaitSync(pPixmap->drawable.pScreen); - /* exaGetPixmapFirstPixel() */ - - switch (pPixmap->drawable.bitsPerPixel) { - case 32: - pixel = *(CARD32 *)(pPixmap->devPrivate.ptr); - break; - case 16: - pixel = *(CARD16 *)(pPixmap->devPrivate.ptr); - break; - default: - pixel = *(CARD8 *)(pPixmap->devPrivate.ptr); - break; +#ifdef USE_EXA + if (pATI->useEXA) + pixel = exaGetPixmapFirstPixel(pPixmap); + else +#endif + { + switch (pPixmap->drawable.bitsPerPixel) { + case 32: + pixel = *(CARD32 *)(pPixmap->devPrivate.ptr); + break; + case 16: + pixel = *(CARD16 *)(pPixmap->devPrivate.ptr); + break; + default: + pixel = *(CARD8 *)(pPixmap->devPrivate.ptr); + break; + } } /* exaGetRGBAFromPixel()/viaPixelARGB8888() */ -- 1.7.9.2 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
