[PATCH:xf86-video-mga] Fix pointer cast warning.

Mark Kettenis mark.kettenis at xs4all.nl
Wed Feb 25 05:01:34 PST 2015


> Date: Wed, 25 Feb 2015 11:31:50 +0100
> From: Tormod Volden <lists.tormod at gmail.com>
> 
> On Tue, Feb 24, 2015 at 7:36 AM, Mark Kettenis <mark.kettenis at xs4all.nl> wrote:
> >>  cast to pointer from integer of different size
> >>  [-Werror=int-to-pointer-cast]
> >>
> >>  Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
> >>  ---
> >>   src/mga_exa.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > This code makes no sense to me.  exaGetPixmapFirstPixel() returns a pixel
> > value.  Interpreting that as a pointer to the first pixel must be wrong.
> 
> Are you sure about this? What would be the utility of a function
> returning the pixel /value/ of the first pixel in a pixmap?

>From exa/exa_unaccel.c:

/**
 * Gets the 0,0 pixel of a pixmap.  Used for doing solid fills of tiled pixmaps
 * that happen to be 1x1.  Pixmap must be at least 8bpp.
 */

And yes, there really is little doubt that the implementation returns
the pixel value of the 0,0 pixel of the pixmap.

> > Note that the actual usage of mgaDownloadFromScreen() is #if 0'ed out.
> > Perhaps this code should just be removed from the driver?  Or perhaps the
> > code was #if 0'ed out because the code didn't work?
> 
> About the EXA code working or not, see also
> https://bugs.freedesktop.org/show_bug.cgi?id=53423

That pretty much confirms the code doesn't work (before or after your
change).  Probably the answer is to revert the
exaGetPixmapFirstPixel() changes you made (here and in other drivers).
And then disable the DownloadFromScreen() implementation, or perhaps
even disable EXA altogether.


More information about the xorg-devel mailing list