[Spice-devel] [PATCH xf86-video-qxl] Initialize the frame buffer used in dfps mode; this silences a number of valgrind errors.

Christophe Fergeau cfergeau at redhat.com
Fri Sep 19 04:40:05 PDT 2014


Any idea in which situation we are trying to access uninitialized pixmap
memory?
Apart from that, why not.

Christophe

On Fri, Sep 12, 2014 at 02:20:36PM -0500, Jeremy White wrote:
> 
> Signed-off-by: Jeremy White <jwhite at codeweavers.com>
> ---
>  src/dfps.c |   14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/src/dfps.c b/src/dfps.c
> index 5db34dc..568ba5e 100644
> --- a/src/dfps.c
> +++ b/src/dfps.c
> @@ -312,6 +312,17 @@ static void dfps_set_screen_pixmap (PixmapPtr pixmap)
>      pixmap->drawable.pScreen->devPrivate = pixmap;
>  }
>  
> +static void dfps_clear_pixmap(PixmapPtr pixmap, int w, int h)
> +{
> +    GCPtr pgc;
> +    pgc = GetScratchGC(pixmap->drawable.depth, pixmap->drawable.pScreen);
> +    if (pgc)
> +    {
> +        fbFill(&pixmap->drawable, pgc, 0, 0, w, h);
> +        FreeScratchGC(pgc);
> +    }
> +}
> +
>  static PixmapPtr dfps_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usage)
>  {
>      PixmapPtr pixmap;
> @@ -324,7 +335,10 @@ static PixmapPtr dfps_create_pixmap (ScreenPtr screen, int w, int h, int depth,
>  
>      pixmap = fbCreatePixmap (screen, w, h, depth, usage);
>      if (pixmap)
> +    {
> +        dfps_clear_pixmap(pixmap, w, h);
>          dfps_set_info(pixmap, info);
> +    }
>      else
>          free(info);
>  
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140919/69b22418/attachment.sig>


More information about the Spice-devel mailing list