summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-03-16 10:54:51 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-03-16 10:54:51 +0000
commitc5b901a635a9c8c74017682d17cfcd93031907b4 (patch)
tree11ba37a87cb8e95d1c5ebd60b61a79878fe0c90f
parent45d20e9a65bec8d962a4ec20ee35079935f71b91 (diff)
sna/dri: Clear flush flag upon bo destroy
Fixes sanity checks that we do not leak the flushing status, nor invoke an operation upon an unflushed bo. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c5
-rw-r--r--src/sna/sna_accel.c3
-rw-r--r--src/sna/sna_dri.c13
3 files changed, 19 insertions, 2 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 31e110e3..a01da885 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1515,6 +1515,7 @@ inline static void kgem_bo_move_to_inactive(struct kgem *kgem,
assert(!bo->io);
assert(!bo->scanout);
assert(!bo->snoop);
+ assert(!bo->flush);
assert(!bo->needs_flush);
assert(list_is_empty(&bo->vma));
ASSERT_IDLE(kgem, bo->handle);
@@ -1635,6 +1636,7 @@ static void kgem_bo_move_to_scanout(struct kgem *kgem, struct kgem_bo *bo)
assert(bo->refcnt == 0);
assert(bo->scanout);
assert(bo->delta);
+ assert(!bo->flush);
assert(!bo->snoop);
assert(!bo->io);
@@ -1750,6 +1752,7 @@ static void __kgem_bo_destroy(struct kgem *kgem, struct kgem_bo *bo)
kgem_bo_move_to_snoop(kgem, bo);
return;
}
+ bo->flush = false;
if (bo->scanout) {
kgem_bo_move_to_scanout(kgem, bo);
@@ -1769,6 +1772,7 @@ static void __kgem_bo_destroy(struct kgem *kgem, struct kgem_bo *bo)
assert(list_is_empty(&bo->vma));
assert(list_is_empty(&bo->list));
+ assert(bo->flush == false);
assert(bo->snoop == false);
assert(bo->io == false);
assert(bo->scanout == false);
@@ -3554,6 +3558,7 @@ struct kgem_bo *kgem_create_2d(struct kgem *kgem,
assert(bo->scanout);
assert(bo->delta);
assert(!bo->purged);
+ assert(!bo->flush);
if (size > num_pages(bo) || num_pages(bo) > 2*size)
continue;
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 19fe1e30..f654c1a1 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2442,6 +2442,9 @@ static inline struct sna_pixmap *
sna_pixmap_mark_active(struct sna *sna, struct sna_pixmap *priv)
{
assert(priv->gpu_bo);
+ DBG(("%s: pixmap=%ld, handle=%u\n", __FUNCTION__,
+ priv->pixmap->drawable.serialNumber,
+ priv->gpu_bo->handle));
return priv;
}
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 127793f8..2d3a2620 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -884,6 +884,9 @@ can_blit(struct sna * sna,
if (draw->type == DRAWABLE_PIXMAP)
return true;
+ if (get_private(front)->pixmap != get_private(back)->pixmap)
+ return false;
+
clip = &((WindowPtr)draw)->clipList;
w = clip->extents.x2 - draw->x;
h = clip->extents.y2 - draw->y;
@@ -919,6 +922,12 @@ sna_dri_copy_region(DrawablePtr draw,
void (*copy)(struct sna *, DrawablePtr, RegionPtr,
struct kgem_bo *, struct kgem_bo *, bool) = sna_dri_copy;
+ DBG(("%s: pixmap=%ld, src=%u, dst=%u\n",
+ __FUNCTION__,
+ pixmap->drawable.serialNumber,
+ get_private(src_buffer)->bo->handle,
+ get_private(dst_buffer)->bo->handle));
+
assert(get_private(src_buffer)->refcnt);
assert(get_private(dst_buffer)->refcnt);
@@ -928,11 +937,11 @@ sna_dri_copy_region(DrawablePtr draw,
assert(get_private(dst_buffer)->bo->refcnt);
assert(get_private(dst_buffer)->bo->flush);
- assert(sna_pixmap_from_drawable(draw)->flush);
-
if (!can_blit(sna, draw, dst_buffer, src_buffer))
return;
+ assert(sna_pixmap(pixmap)->flush);
+
if (dst_buffer->attachment == DRI2BufferFrontLeft) {
dst = sna_pixmap_get_bo(pixmap);
copy = (void *)sna_dri_copy_to_front;