xf86-video-intel: src/sna/sna_dri.c src/sna/sna.h

Chris Wilson ickle at kemper.freedesktop.org
Thu Mar 8 00:58:44 PST 2012


 src/sna/sna.h     |    2 +-
 src/sna/sna_dri.c |   13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 3f73cc706ff39cd4c10433791f12b5f829f62e6d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Mar 8 08:54:24 2012 +0000

    sna/dri: Use a counter for the number of DRI drawables attached to a pixmap
    
    The root pixmap, for instance, may have unique DRI2Drawables for each
    inferior window. We only want to clear the flush flag on the last
    release, so we need to keep a count of how many DRI drawables remain
    attached rather than a solitary flag.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna.h b/src/sna/sna.h
index 119244d..8340345 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -129,12 +129,12 @@ struct sna_pixmap {
 
 	uint32_t stride;
 	uint32_t clear_color;
+	unsigned flush;
 
 #define SOURCE_BIAS 4
 	uint16_t source_count;
 	uint8_t pinned :1;
 	uint8_t mapped :1;
-	uint8_t flush :1;
 	uint8_t clear :1;
 	uint8_t undamaged :1;
 	uint8_t create :3;
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 3909b84..92132d6 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -163,7 +163,7 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
 	if (priv == NULL)
 		return NULL;
 
-	if (priv->flush)
+	if (priv->flush++)
 		return priv->gpu_bo;
 
 	tiling = color_tiling(sna, &pixmap->drawable);
@@ -177,7 +177,6 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
 	 *
 	 * As we don't track which Client, we flush for all.
 	 */
-	priv->flush = 1;
 	sna_accel_watch_flush(sna, 1);
 
 	/* Don't allow this named buffer to be replaced */
@@ -324,10 +323,12 @@ static void _sna_dri_destroy_buffer(struct sna *sna, DRI2Buffer2Ptr buffer)
 			struct sna_pixmap *priv = sna_pixmap(private->pixmap);
 
 			/* Undo the DRI markings on this pixmap */
-			list_del(&priv->list);
-			sna_accel_watch_flush(sna, -1);
-			priv->pinned = private->pixmap == sna->front;
-			priv->flush = 0;
+			assert(priv->flush > 0);
+			if (--priv->flush == 0) {
+				list_del(&priv->list);
+				sna_accel_watch_flush(sna, -1);
+				priv->pinned = private->pixmap == sna->front;
+			}
 
 			screen->DestroyPixmap(private->pixmap);
 		}


More information about the xorg-commit mailing list