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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/19/2014 06:40 AM, Christophe Fergeau wrote:
Any idea in which situation we are trying to access uninitialized pixmap
memory?

I no longer recall with precision. The valgrind trigger was in hash_and_copy; I suspect I first encountered it in the case I fixed with a later patch (copying past the stride).

However, a prepare_access that doesn't fill the region, or the new tuning code I've added to dfps has a clear logical need for a preinitialized pixmap, so I think this is correct for a variety of reasons.

Cheers,

Jeremy

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@xxxxxxxxxxxxxxx>
---
  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@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]