summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-03-10 14:15:46 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-03-10 14:15:46 +0000
commitb81ee116d36845e55f71be2db391f93c1b681d5d (patch)
treebec63a2c45169ea2cce053b86431fd461153af5f
parent93ecd5606eaf2e1db2b844f39bb04d77fa53cf8d (diff)
sna/dri: Add a couple more basic assertions
To catch bad reference counting and loss of flush. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_dri.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index ebcbdcf6..9da27cb9 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -419,6 +419,7 @@ static void _sna_dri_destroy_buffer(struct sna *sna, DRI2Buffer2Ptr buffer)
DBG(("%s: %p [handle=%d] -- refcnt=%d, pixmap=%ld\n",
__FUNCTION__, buffer, private->bo->handle, private->refcnt,
private->pixmap ? private->pixmap->drawable.serialNumber : 0));
+ assert(private->refcnt > 0);
if (--private->refcnt == 0) {
if (private->pixmap) {
@@ -427,6 +428,8 @@ static void _sna_dri_destroy_buffer(struct sna *sna, DRI2Buffer2Ptr buffer)
assert(sna_pixmap_get_buffer(pixmap) == buffer);
assert(priv->gpu_bo == private->bo);
+ assert(priv->gpu_bo->flush);
+ assert(priv->pinned & PIN_DRI);
assert(priv->flush);
/* Undo the DRI markings on this pixmap */
@@ -446,7 +449,7 @@ static void _sna_dri_destroy_buffer(struct sna *sna, DRI2Buffer2Ptr buffer)
sna_pixmap_set_buffer(pixmap, NULL);
pixmap->drawable.pScreen->DestroyPixmap(pixmap);
} else
- private->bo->flush = 0;
+ private->bo->flush = false;
kgem_bo_destroy(&sna->kgem, private->bo);
free(buffer);