xf86-video-intel: 4 commits - src/sna/kgem.c src/sna/kgem.h src/sna/sna_accel.c src/sna/sna_render.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Nov 21 06:56:33 PST 2012


 src/sna/kgem.c       |    4 ++--
 src/sna/kgem.h       |   17 +++++++----------
 src/sna/sna_accel.c  |   17 ++++++++++++++---
 src/sna/sna_render.c |    3 +++
 4 files changed, 26 insertions(+), 15 deletions(-)

New commits:
commit c0c48c7a5aca4d24936efbeaefc7674ada2ef87f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 21 14:46:45 2012 +0000

    sna: Add a few refcnt assertions
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=47597
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 4fb8a6f..ac60957 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1242,7 +1242,7 @@ kgem_add_handle(struct kgem *kgem, struct kgem_bo *bo)
 	return exec;
 }
 
-void _kgem_add_bo(struct kgem *kgem, struct kgem_bo *bo)
+static void kgem_add_bo(struct kgem *kgem, struct kgem_bo *bo)
 {
 	bo->exec = kgem_add_handle(kgem, bo);
 	bo->rq = kgem->next_request;
@@ -3907,7 +3907,7 @@ uint32_t kgem_add_reloc(struct kgem *kgem,
 		}
 
 		if (bo->exec == NULL)
-			_kgem_add_bo(kgem, bo);
+			kgem_add_bo(kgem, bo);
 		assert(bo->rq == kgem->next_request);
 
 		if (kgem->gen < 40 && read_write_domain & KGEM_RELOC_FENCED) {
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index b42a8e0..01efc8e 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -411,16 +411,6 @@ bool kgem_check_bo(struct kgem *kgem, ...) __attribute__((sentinel(0)));
 bool kgem_check_bo_fenced(struct kgem *kgem, struct kgem_bo *bo);
 bool kgem_check_many_bo_fenced(struct kgem *kgem, ...) __attribute__((sentinel(0)));
 
-void _kgem_add_bo(struct kgem *kgem, struct kgem_bo *bo);
-static inline void kgem_add_bo(struct kgem *kgem, struct kgem_bo *bo)
-{
-	if (bo->proxy)
-		bo = bo->proxy;
-
-	if (bo->exec == NULL)
-		_kgem_add_bo(kgem, bo);
-}
-
 #define KGEM_RELOC_FENCED 0x8000
 uint32_t kgem_add_reloc(struct kgem *kgem,
 			uint32_t pos,
@@ -498,6 +488,7 @@ static inline bool kgem_bo_is_mappable(struct kgem *kgem,
 {
 	DBG(("%s: domain=%d, offset: %d size: %d\n",
 	     __FUNCTION__, bo->domain, bo->presumed_offset, kgem_bo_size(bo)));
+	assert(bo->refcnt);
 
 	if (bo->domain == DOMAIN_GTT)
 		return true;
@@ -516,6 +507,7 @@ static inline bool kgem_bo_mapped(struct kgem *kgem, struct kgem_bo *bo)
 {
 	DBG(("%s: map=%p, tiling=%d, domain=%d\n",
 	     __FUNCTION__, bo->map, bo->tiling, bo->domain));
+	assert(bo->refcnt);
 
 	if (bo->map == NULL)
 		return bo->tiling == I915_TILING_NONE && bo->domain == DOMAIN_CPU;
@@ -539,6 +531,7 @@ static inline bool kgem_bo_can_map(struct kgem *kgem, struct kgem_bo *bo)
 
 static inline bool kgem_bo_is_snoop(struct kgem_bo *bo)
 {
+	assert(bo->refcnt);
 	while (bo->proxy)
 		bo = bo->proxy;
 	return bo->snoop;
@@ -548,6 +541,7 @@ static inline bool kgem_bo_is_busy(struct kgem_bo *bo)
 {
 	DBG(("%s: handle=%d, domain: %d exec? %d, rq? %d\n", __FUNCTION__,
 	     bo->handle, bo->domain, bo->exec != NULL, bo->rq != NULL));
+	assert(bo->refcnt);
 	return bo->rq;
 }
 
@@ -555,6 +549,7 @@ static inline bool __kgem_bo_is_busy(struct kgem *kgem, struct kgem_bo *bo)
 {
 	DBG(("%s: handle=%d, domain: %d exec? %d, rq? %d\n", __FUNCTION__,
 	     bo->handle, bo->domain, bo->exec != NULL, bo->rq != NULL));
+	assert(bo->refcnt);
 	if (kgem_flush(kgem))
 		kgem_submit(kgem);
 	if (bo->rq && !bo->exec)
@@ -567,11 +562,13 @@ static inline bool kgem_bo_is_dirty(struct kgem_bo *bo)
 	if (bo == NULL)
 		return false;
 
+	assert(bo->refcnt);
 	return bo->dirty;
 }
 
 static inline void kgem_bo_mark_dirty(struct kgem_bo *bo)
 {
+	assert(bo->refcnt);
 	do {
 		if (bo->dirty)
 			return;
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ef14251..4b0d014 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2588,6 +2588,7 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box,
 	     flags));
 
 	assert(box->x2 > box->x1 && box->y2 > box->y1);
+	assert(pixmap->refcnt);
 	assert_pixmap_damage(pixmap);
 	assert_drawable_contains_box(drawable, box);
 
@@ -2785,6 +2786,7 @@ move_to_gpu:
 
 done:
 	assert(priv->gpu_bo != NULL);
+	assert(priv->gpu_bo->refcnt);
 	if (sna_damage_is_all(&priv->gpu_damage,
 			      pixmap->drawable.width,
 			      pixmap->drawable.height)) {
@@ -2806,6 +2808,7 @@ done:
 use_gpu_bo:
 	DBG(("%s: using whole GPU bo\n", __FUNCTION__));
 	assert(priv->gpu_bo != NULL);
+	assert(priv->gpu_bo->refcnt);
 	assert(priv->gpu_bo->proxy == NULL);
 	assert(priv->gpu_damage);
 	priv->clear = false;
@@ -2820,6 +2823,8 @@ use_cpu_bo:
 	if (priv->cpu_bo == NULL)
 		return NULL;
 
+	assert(priv->cpu_bo->refcnt);
+
 	sna = to_sna_from_pixmap(pixmap);
 	if ((flags & FORCE_GPU) == 0 &&
 	    !__kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) {
commit 0884777c33d20dbc329b98ad0db5ffb0df93ac8c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 21 14:31:44 2012 +0000

    sna: Fix bogus assertion from 03fb9ded43
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index b0e4c6c..ef14251 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4659,7 +4659,9 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 			if (n == 1 &&
 			    tmp->drawable.width == src_pixmap->drawable.width &&
 			    tmp->drawable.height == src_pixmap->drawable.height) {
-				assert(src_priv->gpu_damage);
+				DBG(("%s: caching upload for src bo\n",
+				     __FUNCTION__));
+				assert(src_priv->gpu_damage == NULL);
 				kgem_proxy_bo_attach(src_bo, &src_priv->gpu_bo);
 			}
 
commit 2249e9edc37811c07e2807d6b4def05585b44c22
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 21 13:05:36 2012 +0000

    sna: Dispose of local copy for render sources
    
    If we transfer the pixmap to the GPU to use as a render source, presume
    that we will not need to then touch the local copy (at least for a
    while) and so return that memory to the system.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 8e461df..b0e4c6c 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3151,7 +3151,10 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
 	}
 
 	/* For large bo, try to keep only a single copy around */
-	if (priv->create & KGEM_CAN_CREATE_LARGE) {
+	if (priv->create & KGEM_CAN_CREATE_LARGE || flags & MOVE_SOURCE_HINT) {
+		DBG(("%s: disposing of system copy for large/source\n",
+		     __FUNCTION__));
+		assert(!priv->shm);
 		assert(priv->gpu_bo->proxy == NULL);
 		sna_damage_all(&priv->gpu_damage,
 			       pixmap->drawable.width,
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index f5586cb..42cd8fb 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -429,6 +429,9 @@ move_to_gpu(PixmapPtr pixmap, const BoxRec *box, bool blt)
 		return NULL;
 	}
 
+	if (priv->shm)
+		blt = true;
+
 	if (DBG_FORCE_UPLOAD < 0) {
 		if (!sna_pixmap_force_to_gpu(pixmap,
 					     blt ? MOVE_READ : MOVE_SOURCE_HINT | MOVE_READ))
commit 736bb0f7058bf05ef48cdfe6a30d880de817aff9
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 21 12:16:46 2012 +0000

    sna: Tighten a couple of assertions for damage with use_bo
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index dfd7d26..8e461df 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2797,7 +2797,7 @@ done:
 
 	DBG(("%s: using GPU bo with damage? %d\n",
 	     __FUNCTION__, *damage != NULL));
-	assert(damage == NULL || !DAMAGE_IS_ALL(*damage));
+	assert(*damage == NULL || !DAMAGE_IS_ALL(*damage));
 	assert(priv->gpu_bo->proxy == NULL);
 	assert(priv->clear == false);
 	assert(priv->cpu == false);
@@ -2807,6 +2807,7 @@ use_gpu_bo:
 	DBG(("%s: using whole GPU bo\n", __FUNCTION__));
 	assert(priv->gpu_bo != NULL);
 	assert(priv->gpu_bo->proxy == NULL);
+	assert(priv->gpu_damage);
 	priv->clear = false;
 	priv->cpu = false;
 	*damage = NULL;


More information about the xorg-commit mailing list