diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-08 08:54:24 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-08 08:58:12 +0000 |
commit | 3f73cc706ff39cd4c10433791f12b5f829f62e6d (patch) | |
tree | 68928f442e1c4656de0ffb65052898f74e358790 | |
parent | 49a80ce1ff336fb2fa7d214bd3fddbce5a62b77a (diff) |
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@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna.h | 2 | ||||
-rw-r--r-- | src/sna/sna_dri.c | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index 119244db..8340345e 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 3909b84d..92132d67 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); } |