[PATCH:xf86-video-mach64] Mach64PixelARGB should use exaGetPixmapFirstPixel when EXA is in use
Dave Airlie
airlied at gmail.com
Thu Dec 6 17:45:58 PST 2012
> Fixes crash attempting to read a pixel from a NULL pPixmap->devPrivate.ptr
>
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
seems sane, well as sane as a mach64.
Reviewed-by: Dave Airlie <airlied at redhat.com>
> ---
> 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
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
More information about the xorg-devel
mailing list