diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-03-10 15:51:45 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-03-10 15:52:29 +0000 |
commit | 35f50a98fde7a4ebe6871bd23475948a2a530633 (patch) | |
tree | 4e11c1f14b1810e12f667ec2c6b5a961ab2328f2 | |
parent | b81ee116d36845e55f71be2db391f93c1b681d5d (diff) |
sna/dri: Flatten _sna_dri_destroy_buffer()
One level of indentation can be trivially removed with an earlier return.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_dri.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index 9da27cb9..6e60570d 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -420,40 +420,41 @@ static void _sna_dri_destroy_buffer(struct sna *sna, DRI2Buffer2Ptr buffer) __FUNCTION__, buffer, private->bo->handle, private->refcnt, private->pixmap ? private->pixmap->drawable.serialNumber : 0)); assert(private->refcnt > 0); + if (--private->refcnt) + return; - if (--private->refcnt == 0) { - if (private->pixmap) { - PixmapPtr pixmap = private->pixmap; - struct sna_pixmap *priv = sna_pixmap(pixmap); + assert(private->bo); + if (private->pixmap) { + 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->gpu_bo->flush); - assert(priv->pinned & PIN_DRI); - assert(priv->flush); + 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 */ - DBG(("%s: releasing last DRI pixmap=%ld, scanout?=%d\n", - __FUNCTION__, - pixmap->drawable.serialNumber, - pixmap == sna->front)); + /* Undo the DRI markings on this pixmap */ + DBG(("%s: releasing last DRI pixmap=%ld, scanout?=%d\n", + __FUNCTION__, + pixmap->drawable.serialNumber, + pixmap == sna->front)); - list_del(&priv->list); + list_del(&priv->list); - priv->gpu_bo->flush = false; - priv->pinned &= ~PIN_DRI; + priv->gpu_bo->flush = false; + priv->pinned &= ~PIN_DRI; - priv->flush = false; - sna_accel_watch_flush(sna, -1); + priv->flush = false; + sna_accel_watch_flush(sna, -1); - sna_pixmap_set_buffer(pixmap, NULL); - pixmap->drawable.pScreen->DestroyPixmap(pixmap); - } else - private->bo->flush = false; + sna_pixmap_set_buffer(pixmap, NULL); + pixmap->drawable.pScreen->DestroyPixmap(pixmap); + } else + private->bo->flush = false; - kgem_bo_destroy(&sna->kgem, private->bo); - free(buffer); - } + kgem_bo_destroy(&sna->kgem, private->bo); + free(buffer); } static void sna_dri_destroy_buffer(DrawablePtr draw, DRI2Buffer2Ptr buffer) |