diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-02-11 11:05:02 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-02-11 11:17:05 +0000 |
commit | 58b61bcd02467d2b08b2dd194ab6884437b83fa6 (patch) | |
tree | cb952ecd0ae2f2856d7e47b8b890cd8a8c45423a | |
parent | a13f806ae28459a5cf671ccbf9cc8725f541a4ba (diff) |
sna/dri: Tighten the assertions that we have one DRI2Buffer per Pixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna.h | 3 | ||||
-rw-r--r-- | src/sna/sna_dri.c | 32 |
2 files changed, 18 insertions, 17 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index b470c48a..a51e6a11 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -118,8 +118,6 @@ struct sna_pixmap { uint32_t stride; uint32_t clear_color; - uint32_t flush; - #define SOURCE_BIAS 4 uint16_t source_count; uint8_t pinned :3; @@ -128,6 +126,7 @@ struct sna_pixmap { #define PIN_PRIME 0x4 uint8_t create :4; uint8_t mapped :1; + uint8_t flush :1; uint8_t shm :1; uint8_t clear :1; uint8_t header :1; diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index cd02db3d..85c2e335 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -175,13 +175,10 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna, return NULL; } + assert(priv->flush == false); assert(priv->cpu_damage == NULL); assert(priv->gpu_bo->proxy == NULL); - if (priv->flush++) { - assert(priv->gpu_bo->flush); - assert(priv->pinned & PIN_DRI); - return priv->gpu_bo; - } + assert(priv->gpu_bo->flush == false); tiling = color_tiling(sna, &pixmap->drawable); if (tiling < 0) @@ -194,6 +191,7 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna, * * As we don't track which Client, we flush for all. */ + priv->flush = true; sna_accel_watch_flush(sna, 1); /* Don't allow this named buffer to be replaced */ @@ -414,19 +412,23 @@ static void _sna_dri_destroy_buffer(struct sna *sna, DRI2Buffer2Ptr buffer) PixmapPtr pixmap = private->pixmap; struct sna_pixmap *priv = sna_pixmap(pixmap); + assert(sna_pixmap_get_buffer(pixmap) == buffer); assert(priv->gpu_bo == private->bo); + assert(priv->flush); /* Undo the DRI markings on this pixmap */ - if (priv->flush && --priv->flush == 0) { - DBG(("%s: releasing last DRI pixmap=%ld, scanout?=%d\n", - __FUNCTION__, - pixmap->drawable.serialNumber, - pixmap == sna->front)); - list_del(&priv->list); - priv->gpu_bo->flush = 0; - priv->pinned &= ~PIN_DRI; - sna_accel_watch_flush(sna, -1); - } + DBG(("%s: releasing last DRI pixmap=%ld, scanout?=%d\n", + __FUNCTION__, + pixmap->drawable.serialNumber, + pixmap == sna->front)); + + list_del(&priv->list); + + priv->gpu_bo->flush = false; + priv->pinned &= ~PIN_DRI; + + priv->flush = false; + sna_accel_watch_flush(sna, -1); sna_pixmap_set_buffer(pixmap, NULL); pixmap->drawable.pScreen->DestroyPixmap(pixmap); |