xf86-video-intel: 8 commits - src/sna/gen6_render.c src/sna/gen7_render.c src/sna/gen8_render.c src/sna/kgem.c src/sna/sna_accel.c src/sna/sna_threads.c src/sna/sna_tiling.c src/sna/sna_trapezoids.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Feb 23 05:54:41 PST 2014


 src/sna/gen6_render.c    |    2 +-
 src/sna/gen7_render.c    |    2 +-
 src/sna/gen8_render.c    |    2 +-
 src/sna/kgem.c           |   37 +++++++++++++++++++++++++------------
 src/sna/sna_accel.c      |    6 +++---
 src/sna/sna_threads.c    |    6 ++++--
 src/sna/sna_tiling.c     |    3 +--
 src/sna/sna_trapezoids.c |   43 ++++++++++++++++++++++++++++---------------
 8 files changed, 64 insertions(+), 37 deletions(-)

New commits:
commit ff49944928c7399527b11bb0da7699711591c21a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 21 21:21:46 2014 +0000

    sna: Tighten assertion for tiling blt fallbacks
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c
index e21ede1..2d11443 100644
--- a/src/sna/sna_tiling.c
+++ b/src/sna/sna_tiling.c
@@ -854,8 +854,7 @@ sna_tiling_blt_copy_boxes__with_alpha(struct sna *sna, uint8_t alu,
 				int16_t dx = this.extents.x1;
 				int16_t dy = this.extents.y1;
 
-				assert(bo->pitch <= 8192);
-				assert(bo->tiling != I915_TILING_Y);
+				assert(kgem_bo_can_blt(&sna->kgem, bo));
 
 				if (!sna_blt_copy_boxes(sna, GXcopy,
 							src_bo, src_dx, src_dy,
commit cf4683209d11ca7382079feb242cc0c07fefc402
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Feb 22 20:17:08 2014 +0000

    sna/gen6+: Add missing DBG argument
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index f36bf79..6ff187c 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1832,7 +1832,7 @@ gen6_composite_set_target(struct sna *sna,
 	BoxRec box;
 	unsigned int hint;
 
-	DBG(("%s: (%d, %d)x(%d, %d), partial?=%d\n", __FUNCTION__, x, y, w, h));
+	DBG(("%s: (%d, %d)x(%d, %d), partial?=%d\n", __FUNCTION__, x, y, w, h, partial));
 
 	op->dst.pixmap = get_drawable_pixmap(dst->pDrawable);
 	op->dst.format = dst->format;
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index a90bd15..39a95f6 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2111,7 +2111,7 @@ gen7_composite_set_target(struct sna *sna,
 	BoxRec box;
 	unsigned int hint;
 
-	DBG(("%s: (%d, %d)x(%d, %d), partial?=%d\n", __FUNCTION__, x, y, w, h));
+	DBG(("%s: (%d, %d)x(%d, %d), partial?=%d\n", __FUNCTION__, x, y, w, h, partial));
 
 	op->dst.pixmap = get_drawable_pixmap(dst->pDrawable);
 	op->dst.format = dst->format;
diff --git a/src/sna/gen8_render.c b/src/sna/gen8_render.c
index c096db1..2a36795 100644
--- a/src/sna/gen8_render.c
+++ b/src/sna/gen8_render.c
@@ -1862,7 +1862,7 @@ gen8_composite_set_target(struct sna *sna,
 	BoxRec box;
 	unsigned int hint;
 
-	DBG(("%s: (%d, %d)x(%d, %d), partial?=%d\n", __FUNCTION__, x, y, w, h));
+	DBG(("%s: (%d, %d)x(%d, %d), partial?=%d\n", __FUNCTION__, x, y, w, h, partial));
 
 	op->dst.pixmap = get_drawable_pixmap(dst->pDrawable);
 	op->dst.format = dst->format;
commit a4d23ff3b2a75cc5a1c65b6b8464fc639c9f90b8
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Feb 22 19:35:40 2014 +0000

    sna: Add DBG for why trapezoids may be preferred inplace
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index da2042e..c42053d 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -512,24 +512,39 @@ trapezoid_spans_maybe_inplace(struct sna *sna,
 
 out:
 	priv = sna_pixmap_from_drawable(dst->pDrawable);
-	if (priv == NULL)
+	if (priv == NULL) {
+		DBG(("%s? yes -- unattached\n", __FUNCTION__));
 		return true;
+	}
 
-	if (priv->cpu_bo && kgem_bo_is_busy(priv->cpu_bo))
+	if (priv->cpu_bo && kgem_bo_is_busy(priv->cpu_bo)) {
+		DBG(("%s? no -- CPU bo is busy\n", __FUNCTION__));
 		return false;
+	}
 
-	if (DAMAGE_IS_ALL(priv->cpu_damage) || priv->gpu_damage == NULL)
+	if (DAMAGE_IS_ALL(priv->cpu_damage) || priv->gpu_damage == NULL) {
+		DBG(("%s? yes -- damaged on CPU only (all? %d)\n", __FUNCTION__, DAMAGE_IS_ALL(priv->cpu_damage)));
 		return true;
+	}
 
-	if (priv->clear)
+	if (priv->clear) {
+		DBG(("%s? clear, %s\n", __FUNCTION__,
+		     dst->pDrawable->width <= TOR_INPLACE_SIZE ? "yes" : "no"));
 		return dst->pDrawable->width <= TOR_INPLACE_SIZE;
+	}
 
-	if (kgem_bo_is_busy(priv->gpu_bo))
+	if (kgem_bo_is_busy(priv->gpu_bo)) {
+		DBG(("%s? no, GPU bo is busy\n", __FUNCTION__));
 		return false;
+	}
 
-	if (priv->cpu_damage)
+	if (priv->cpu_damage) {
+		DBG(("%s? yes, idle GPU bo and damage on idle CPU\n", __FUNCTION__));
 		return true;
+	}
 
+	DBG(("%s? small enough? %s\n", __FUNCTION__,
+	     dst->pDrawable->width <= TOR_INPLACE_SIZE ? "yes" : "no"));
 	return dst->pDrawable->width <= TOR_INPLACE_SIZE;
 }
 
@@ -582,13 +597,10 @@ sna_composite_trapezoids(CARD8 op,
 	if (FORCE_FALLBACK == 0 &&
 	    (too_small(priv) || DAMAGE_IS_ALL(priv->cpu_damage)) &&
 	    !picture_is_gpu(sna, src) && untransformed(src)) {
-		DBG(("%s: force fallbacks --too small, %dx%d? %d, all-cpu? %d, src-is-cpu? %d\n",
-		     __FUNCTION__,
-		     dst->pDrawable->width,
-		     dst->pDrawable->height,
-		     too_small(priv),
-		     (int)DAMAGE_IS_ALL(priv->cpu_damage),
-		     !picture_is_gpu(sna, src)));
+		DBG(("%s: force fallbacks -- (too small, %dx%d? %d || all-cpu? %d) && (src-is-cpu? %d && untransformed? %d)\n",
+		     __FUNCTION__, dst->pDrawable->width, dst->pDrawable->height,
+		     too_small(priv), (int)DAMAGE_IS_ALL(priv->cpu_damage),
+		     !picture_is_gpu(sna, src), untransformed(src)));
 
 force_fallback:
 		force_fallback = true;
@@ -631,7 +643,7 @@ force_fallback:
 
 	DBG(("%s: rectilinear? %d, pixel-aligned? %d, mono? %d precise? %d\n",
 	     __FUNCTION__, rectilinear, pixel_aligned,
-	     is_mono(dst, maskFormat), is_precise(dst, maskFromat)));
+	     is_mono(dst, maskFormat), is_precise(dst, maskFormat)));
 
 	flags = 0;
 	if (rectilinear) {
commit d316d14283d8af86e4c5020f9974280570a78959
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Feb 22 19:31:39 2014 +0000

    sna: Include mono/precise hints in trapezoids DBG
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index 71016e8..da2042e 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -629,8 +629,9 @@ force_fallback:
 		}
 	}
 
-	DBG(("%s: rectilinear? %d, pixel-aligned? %d\n",
-	     __FUNCTION__, rectilinear, pixel_aligned));
+	DBG(("%s: rectilinear? %d, pixel-aligned? %d, mono? %d precise? %d\n",
+	     __FUNCTION__, rectilinear, pixel_aligned,
+	     is_mono(dst, maskFormat), is_precise(dst, maskFromat)));
 
 	flags = 0;
 	if (rectilinear) {
commit 2a144baec87b17ead36373a8c5fd80f37be3ac19
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Feb 22 19:19:11 2014 +0000

    sna: Add a little more DBG to watch the flow of allocated bo sizes
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 7fa9334..698e251 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -683,6 +683,8 @@ constant inline static int cache_bucket(int num_pages)
 static struct kgem_bo *__kgem_bo_init(struct kgem_bo *bo,
 				      int handle, int num_pages)
 {
+	DBG(("%s(handle=%d, num_pages=%d)\n", __FUNCTION__, handle, num_pages));
+
 	assert(num_pages);
 	memset(bo, 0, sizeof(*bo));
 
@@ -1754,7 +1756,7 @@ static void kgem_bo_binding_free(struct kgem *kgem, struct kgem_bo *bo)
 
 static void kgem_bo_free(struct kgem *kgem, struct kgem_bo *bo)
 {
-	DBG(("%s: handle=%d\n", __FUNCTION__, bo->handle));
+	DBG(("%s: handle=%d, size=%d\n", __FUNCTION__, bo->handle, bytes(bo)));
 	assert(bo->refcnt == 0);
 	assert(bo->proxy == NULL);
 	assert(bo->exec == NULL);
@@ -2081,7 +2083,7 @@ void kgem_bo_undo(struct kgem *kgem, struct kgem_bo *bo)
 
 static void __kgem_bo_destroy(struct kgem *kgem, struct kgem_bo *bo)
 {
-	DBG(("%s: handle=%d\n", __FUNCTION__, bo->handle));
+	DBG(("%s: handle=%d, size=%d\n", __FUNCTION__, bo->handle, bytes(bo)));
 
 	assert(list_is_empty(&bo->list));
 	assert(bo->refcnt == 0);
commit 921e9aff3f8e7c4a33c352241311aeb4df3011fc
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Feb 22 18:29:27 2014 +0000

    sna: Avoid signed overflow when printing allocated bytes in DBG
    
    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 4af4875..abc3b85 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -16669,13 +16669,13 @@ static bool sna_accel_do_debug_memory(struct sna *sna)
 
 static void sna_accel_debug_memory(struct sna *sna)
 {
-	ErrorF("Allocated pixmaps: %d (cached: %d), bo: %d, %ld bytes (CPU bo: %d, %ld bytes)\n",
+	ErrorF("Allocated pixmaps: %d (cached: %d), bo: %d, %lu bytes (CPU bo: %d, %lu bytes)\n",
 	       sna->debug_memory.pixmap_allocs,
 	       sna->debug_memory.pixmap_cached,
 	       sna->kgem.debug_memory.bo_allocs,
-	       (long)sna->kgem.debug_memory.bo_bytes,
+	       (unsigned long)sna->kgem.debug_memory.bo_bytes,
 	       sna->debug_memory.cpu_bo_allocs,
-	       (long)sna->debug_memory.cpu_bo_bytes);
+	       (unsigned long)sna->debug_memory.cpu_bo_bytes);
 
 #ifdef VALGRIND_DO_ADDED_LEAK_CHECK
 	VG(VALGRIND_DO_ADDED_LEAK_CHECK);
commit b0b6c043c997732559a971a788c24a5a73812df4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Feb 22 18:22:38 2014 +0000

    sna: Cleanup caches if execbuf fails
    
    One of the failure modes for execbuf is running out of memory - often
    this is reported as a false ENOSPC (thanks shmemfs!). Because of this,
    we should try to resubmit after we purge our caches.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 8e46960..7fa9334 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -3008,6 +3008,25 @@ static void dump_fence_regs(struct kgem *kgem)
 }
 #endif
 
+static int do_execbuf(struct kgem *kgem, struct drm_i915_gem_execbuffer2 *execbuf)
+{
+	int ret;
+
+retry:
+	ret = do_ioctl(kgem->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
+	if (ret == 0)
+		return 0;
+
+	(void)__kgem_throttle_retire(kgem, 0);
+	if (kgem_expire_cache(kgem))
+		goto retry;
+
+	if (kgem_cleanup_cache(kgem))
+		goto retry;
+
+	return ret;
+}
+
 void _kgem_submit(struct kgem *kgem)
 {
 	struct kgem_request *rq;
@@ -3073,7 +3092,7 @@ void _kgem_submit(struct kgem *kgem)
 
 		if (kgem_batch_write(kgem, handle, size) == 0) {
 			struct drm_i915_gem_execbuffer2 execbuf;
-			int ret, retry = 3;
+			int ret;
 
 			memset(&execbuf, 0, sizeof(execbuf));
 			execbuf.buffers_ptr = (uintptr_t)kgem->exec;
@@ -3091,15 +3110,7 @@ void _kgem_submit(struct kgem *kgem)
 				}
 			}
 
-			ret = do_ioctl(kgem->fd,
-				       DRM_IOCTL_I915_GEM_EXECBUFFER2,
-				       &execbuf);
-			while (ret == -EBUSY && retry--) {
-				__kgem_throttle(kgem);
-				ret = do_ioctl(kgem->fd,
-					       DRM_IOCTL_I915_GEM_EXECBUFFER2,
-					       &execbuf);
-			}
+			ret = do_execbuf(kgem, &execbuf);
 			if (DEBUG_SYNC && ret == 0) {
 				struct drm_i915_gem_set_domain set_domain;
 
commit bfef9916124973b5e08f9b32eb1fcfb400ee4e8b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Feb 22 18:12:24 2014 +0000

    sna: Propagate thread signals for extra DBG
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_threads.c b/src/sna/sna_threads.c
index eac6964..089d8ab 100644
--- a/src/sna/sna_threads.c
+++ b/src/sna/sna_threads.c
@@ -187,9 +187,11 @@ void sna_threads_trap(int sig)
 	for (n = 1; threads[n].thread != t; n++)
 		;
 
+	ERR(("%s: thread[%d] caught signal %d\n", __func__, n, sig));
+
 	pthread_mutex_lock(&threads[n].mutex);
 	threads[n].func = NULL;
-	threads[n].arg = &threads[n];
+	threads[n].arg = (void *)(intptr_t)sig;
 	pthread_cond_signal(&threads[n].cond);
 	pthread_mutex_unlock(&threads[n].mutex);
 
@@ -212,7 +214,7 @@ void sna_threads_wait(void)
 		}
 
 		if (threads[n].arg != NULL) {
-			ERR(("%s: thread %d died\n", __func__, n));
+			DBG(("%s: thread[%d] died from signal %d\n", __func__, n, (int)threads[n].arg));
 			sna_threads_kill();
 			return;
 		}


More information about the xorg-commit mailing list