From fc137ae504b31a238e64bc1a5d19c41b2074c60a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 12 Jun 2015 13:24:10 +0100 Subject: [PATCH] sna/dri2: Avoid touching shared gpu_bo->flush between dri2/dri3 Not only is the pixmap->flush flag shared, but so is the lower level gpu_bo->flush flag, so further to commit 19d1e4ee19a93905d8d2496f856a18eb07bc23d6 Author: Chris Wilson Date: Thu Jun 11 13:43:10 2015 +0100 sna/dri2: Be wary of interactions with DRI3 and sna_pixmap->flush we need to be more careful when asserting the state of gpu_bo->flush Signed-off-by: Chris Wilson --- src/sna/sna_dri2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c index 5ad33fd3..9bfa9c5b 100644 --- a/src/sna/sna_dri2.c +++ b/src/sna/sna_dri2.c @@ -468,10 +468,10 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna, } assert(priv->flush == false || priv->pinned & PIN_DRI3); + assert(priv->gpu_bo->flush == false || priv->pinned & PIN_DRI3); assert(priv->cpu_damage == NULL); assert(priv->gpu_bo); assert(priv->gpu_bo->proxy == NULL); - assert(priv->gpu_bo->flush == false); if (!sna->kgem.can_fence) { if (priv->gpu_bo->tiling && @@ -782,17 +782,17 @@ static void _sna_dri2_destroy_buffer(struct sna *sna, DRI2Buffer2Ptr buffer) list_del(&priv->flush_list); DBG(("%s: dropping flush hint from handle=%d\n", __FUNCTION__, private->bo->handle)); - priv->gpu_bo->flush = false; priv->pinned &= ~PIN_DRI2; - if ((priv->pinned & PIN_DRI3) == 0) + if ((priv->pinned & PIN_DRI3) == 0) { + priv->gpu_bo->flush = false; priv->flush = false; + } sna_accel_watch_flush(sna, -1); sna_pixmap_set_buffer(pixmap, NULL); pixmap->drawable.pScreen->DestroyPixmap(pixmap); } - assert(private->bo->flush == false); kgem_bo_destroy(&sna->kgem, private->bo); free(buffer);