sna/dri: Tighten the assertions that we have one DRI2Buffer per Pixmap

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-02-11 11:05:02 +00:00
parent a13f806ae2
commit 58b61bcd02
2 changed files with 18 additions and 17 deletions

View File

@ -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;

View File

@ -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);