xf86-video-intel: src/i830_dri.c

Jesse Barnes jbarnes at kemper.freedesktop.org
Fri Mar 26 10:46:47 PDT 2010


 src/i830_dri.c |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit df3b26847914557eb3c9c70732d91169b1936d77
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Fri Mar 26 10:44:55 2010 -0700

    DRI2: release our private front buffer ref when buffer swapping
    
    Pauli pointed out that we take a ref on the front buffer when exchanging
    but forget to release it.  The ref is necessary since the set functions
    will drop refs as necessary, but once we set the front buffer to point
    at the back pixmap, we ned to release our private ref again, or we'll
    leak buffers.
    
    Reported-by: Pauli Nieminen <suokkos at gmail.com>
    Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>

diff --git a/src/i830_dri.c b/src/i830_dri.c
index 7c595dd..321faf6 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -446,12 +446,17 @@ I830DRI2ExchangeBuffers(DrawablePtr draw, DRI2BufferPtr front,
 	back->name = tmp;
 
 	/* Swap pixmap bos */
+
+	/* Hold a ref on the front so the set calls below don't destroy it */
 	dri_bo_reference(i830_get_pixmap_bo(front_priv->pixmap));
 
 	tmp_bo = i830_get_pixmap_bo(front_priv->pixmap);
 	i830_set_pixmap_bo(front_priv->pixmap,
 			   i830_get_pixmap_bo(back_priv->pixmap));
 	i830_set_pixmap_bo(back_priv->pixmap, tmp_bo); /* should be screen */
+
+	/* Release our ref, the last set should have bumped it */
+	dri_bo_unreference(tmp_bo);
 }
 
 /*


More information about the xorg-commit mailing list