xf86-video-intel: 9 commits - src/intel_batchbuffer.c src/sna/kgem.c src/sna/sna_accel.c src/sna/sna_display.c src/sna/sna_io.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jan 30 09:05:51 PST 2013


 src/intel_batchbuffer.c |   25 +++++++--------
 src/sna/kgem.c          |   15 +++------
 src/sna/sna_accel.c     |   76 +++++++++++++++++++++---------------------------
 src/sna/sna_display.c   |    5 +++
 src/sna/sna_io.c        |    3 +
 5 files changed, 59 insertions(+), 65 deletions(-)

New commits:
commit 6f1b862282ddb4545987fb9f0a45b528b7b7b5ee
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 30 15:44:53 2013 +0000

    sna: Pass the correct WRITE hint when migrating for rendering into the CPU 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 2a76855..58d8c19 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2233,7 +2233,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 	}
 
 done:
-	if (flags & MOVE_WRITE) {
+	if ((flags & (MOVE_WRITE | MOVE_ASYNC_HINT)) == MOVE_WRITE) {
 		DBG(("%s: applying cpu damage\n", __FUNCTION__));
 		assert(!DAMAGE_IS_ALL(priv->cpu_damage));
 		assert_pixmap_contains_box(pixmap, RegionExtents(region));
@@ -2862,7 +2862,7 @@ use_cpu_bo:
 		return NULL;
 
 	if (!sna_drawable_move_region_to_cpu(&pixmap->drawable, &region,
-					     MOVE_READ | MOVE_ASYNC_HINT)) {
+					     (flags & IGNORE_CPU ? MOVE_READ : 0) | MOVE_WRITE | MOVE_ASYNC_HINT)) {
 		DBG(("%s: failed to move-to-cpu, fallback\n", __FUNCTION__));
 		return NULL;
 	}
commit 5011ed2e729d46fe3cff5454e15a0fd16441f7e1
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 30 15:44:22 2013 +0000

    sna: Only discard the clear hint when writing inplace to the GPU pixmap
    
    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 dfc3384..2a76855 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1934,27 +1934,27 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 
 		DBG(("%s: try to operate inplace\n", __FUNCTION__));
 
-		pixmap->devPrivate.ptr =
-			kgem_bo_map(&sna->kgem, priv->gpu_bo);
+		pixmap->devPrivate.ptr = kgem_bo_map(&sna->kgem, priv->gpu_bo);
 		priv->mapped = pixmap->devPrivate.ptr != NULL;
 		if (priv->mapped) {
 			pixmap->devKind = priv->gpu_bo->pitch;
-			if (flags & MOVE_WRITE &&
-			    !DAMAGE_IS_ALL(priv->gpu_damage)) {
-				sna_damage_add(&priv->gpu_damage, region);
-				if (sna_damage_is_all(&priv->gpu_damage,
-						      pixmap->drawable.width,
-						      pixmap->drawable.height)) {
-					DBG(("%s: replaced entire pixmap, destroying CPU shadow\n",
-					     __FUNCTION__));
-					sna_damage_destroy(&priv->cpu_damage);
-					list_del(&priv->list);
-				} else
-					sna_damage_subtract(&priv->cpu_damage,
-							    region);
+			if (flags & MOVE_WRITE) {
+				if (!DAMAGE_IS_ALL(priv->gpu_damage)) {
+					sna_damage_add(&priv->gpu_damage, region);
+					if (sna_damage_is_all(&priv->gpu_damage,
+							      pixmap->drawable.width,
+							      pixmap->drawable.height)) {
+						DBG(("%s: replaced entire pixmap, destroying CPU shadow\n",
+						     __FUNCTION__));
+						sna_damage_destroy(&priv->cpu_damage);
+						list_del(&priv->list);
+					} else
+						sna_damage_subtract(&priv->cpu_damage,
+								    region);
+				}
+				priv->clear = false;
 			}
 			assert_pixmap_damage(pixmap);
-			priv->clear = false;
 			priv->cpu = false;
 			if (dx | dy)
 				RegionTranslate(region, -dx, -dy);
commit 6312f58014c0bb4afa56855be1e9becc3e3cc3d7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 30 15:43:05 2013 +0000

    sna: Don't force a migration from CPU rendering for a DRI2 flushed pixmap
    
    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 2cc45e4..dfc3384 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1579,8 +1579,7 @@ skip_inplace_map:
 		DBG(("%s: try to operate inplace (GTT)\n", __FUNCTION__));
 		assert(priv->cpu == false);
 
-		pixmap->devPrivate.ptr =
-			kgem_bo_map(&sna->kgem, priv->gpu_bo);
+		pixmap->devPrivate.ptr = kgem_bo_map(&sna->kgem, priv->gpu_bo);
 		priv->mapped = pixmap->devPrivate.ptr != NULL;
 		if (priv->mapped) {
 			pixmap->devKind = priv->gpu_bo->pitch;
@@ -1820,11 +1819,6 @@ static inline bool region_inplace(struct sna *sna,
 		return false;
 	}
 
-	if (priv->flush) {
-		DBG(("%s: yes, exported via dri, will flush\n", __FUNCTION__));
-		return true;
-	}
-
 	if (priv->cpu) {
 		DBG(("%s: no, preferring last action of CPU\n", __FUNCTION__));
 		return false;
@@ -1835,6 +1829,11 @@ static inline bool region_inplace(struct sna *sna,
 		return !IS_CPU_MAP(priv->gpu_bo->map);
 	}
 
+	if (priv->flush) {
+		DBG(("%s: yes, exported via dri, will flush\n", __FUNCTION__));
+		return true;
+	}
+
 	if (DAMAGE_IS_ALL(priv->gpu_damage)) {
 		DBG(("%s: yes, already wholly damaged on the GPU\n", __FUNCTION__));
 		return true;
commit 60a3b370aea0cf9ffb4947a73984c877b4695d4e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 30 15:41:51 2013 +0000

    sna: Retire the bo after a set-domain(CPU,0)
    
    Having relaxed the earlier assertion because the kernel is wrong, we can
    now retire for READ-READ optimisations.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 6b72782..ad6a5aa 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -4713,11 +4713,9 @@ void kgem_bo_sync__cpu_full(struct kgem *kgem, struct kgem_bo *bo, bool write)
 		set_domain.write_domain = write ? I915_GEM_DOMAIN_CPU : 0;
 
 		if (drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain) == 0) {
-			if (write) {
+			if (write || bo->needs_flush)
 				kgem_bo_retire(kgem, bo);
-				bo->domain = DOMAIN_CPU;
-			} else
-				bo->domain = DOMAIN_NONE;
+			bo->domain = write ? DOMAIN_CPU : DOMAIN_NONE;
 		}
 	}
 }
commit 78ad5a742f40c2311bfe90997aebedeb998464e5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 30 15:40:06 2013 +0000

    sna: Relax assertion the the kernel considers the bo idle when we call retire
    
    All the callers have explicitly changed the domain upon the bo before
    calling kgem_bo_retire(), so we still get the occasional sporadic
    failure as kgem_busy() reports true. Kill the assertion for now.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 6fa8ce4..6b72782 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -384,14 +384,11 @@ kgem_busy(struct kgem *kgem, int handle)
 
 static void kgem_bo_retire(struct kgem *kgem, struct kgem_bo *bo)
 {
-	DBG(("%s: handle=%d, domain=%d\n",
-	     __FUNCTION__, bo->handle, bo->domain));
-	assert(bo->flush || !kgem_busy(kgem, bo->handle));
+	DBG(("%s: retiring bo handle=%d (needed flush? %d), rq? %d [busy?=%d]\n",
+	     __FUNCTION__, bo->handle, bo->needs_flush, bo->rq != NULL,
+	     kgem_busy(kgem, bo->handle)));
 	assert(bo->exec == NULL);
 
-	DBG(("%s: retiring bo handle=%d (needed flush? %d), rq? %d\n",
-	     __FUNCTION__, bo->handle, bo->needs_flush, bo->rq != NULL));
-
 	if (bo->rq) {
 		kgem_retire(kgem);
 		bo->rq = NULL;
commit 83bcd310d279758542e366348f808d7ca0f6d0bb
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 30 13:18:21 2013 +0000

    sna: Prefer to use snooped buffers for readbacks
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c
index f672c3e..85622bf 100644
--- a/src/sna/sna_io.c
+++ b/src/sna/sna_io.c
@@ -123,6 +123,9 @@ static bool download_inplace(struct kgem *kgem, struct kgem_bo *bo)
 	if (FORCE_INPLACE)
 		return FORCE_INPLACE > 0;
 
+	if (kgem->can_blt_cpu && kgem->max_cpu_size)
+		return false;
+
 	return !__kgem_bo_is_busy(kgem, bo) || bo->tiling == I915_TILING_NONE;
 }
 
commit 496f3ff04453524639a52a3b9dfcb8e198e5e597
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 30 12:21:33 2013 +0000

    uxa: Harden against failures to submit batchbuffers
    
    If we fail to submit a batchbuffer, the driver is broken and likely to
    continue to fail to render. Give up, and fallback to swrast so that the
    session remains usable.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=59771
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_batchbuffer.c b/src/intel_batchbuffer.c
index 4e74a0f..a44a156 100644
--- a/src/intel_batchbuffer.c
+++ b/src/intel_batchbuffer.c
@@ -261,22 +261,21 @@ void intel_batch_submit(ScrnInfoPtr scrn)
 	}
 
 	if (ret != 0) {
-		if (ret == -EIO) {
-			static int once;
-
-			/* The GPU has hung and unlikely to recover by this point. */
-			if (!once) {
+		static int once;
+		if (!once) {
+			if (ret == -EIO) {
+				/* The GPU has hung and unlikely to recover by this point. */
 				xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Detected a hung GPU, disabling acceleration.\n");
 				xf86DrvMsg(scrn->scrnIndex, X_ERROR, "When reporting this, please include i915_error_state from debugfs and the full dmesg.\n");
-				uxa_set_force_fallback(xf86ScrnToScreen(scrn), TRUE);
-				intel->force_fallback = TRUE;
-				once = 1;
+			} else {
+				/* The driver is broken. */
+				xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+					   "Failed to submit batch buffer, expect rendering corruption: %s.\n ",
+					   strerror(-ret));
 			}
-		} else {
-			xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-				   "Failed to submit batch buffer, expect rendering corruption "
-				   "or even a frozen display: %s.\n",
-				   strerror(-ret));
+			uxa_set_force_fallback(xf86ScrnToScreen(scrn), TRUE);
+			intel->force_fallback = TRUE;
+			once = 1;
 		}
 	}
 
commit 04d48fee713e7bbc9cdf4f09855f6663a4bdc59f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 30 11:46:20 2013 +0000

    sna: Fix errors found from asserts in a66c5f9ed51e
    
    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 d7c639a..2cc45e4 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1520,14 +1520,12 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
 			    !sna_pixmap_create_mappable_gpu(pixmap))
 				goto skip_inplace_map;
 
-			if (!priv->mapped) {
-				pixmap->devPrivate.ptr =
-					kgem_bo_map(&sna->kgem, priv->gpu_bo);
-				if (pixmap->devPrivate.ptr == NULL)
-					goto skip_inplace_map;
+			pixmap->devPrivate.ptr =
+				kgem_bo_map(&sna->kgem, priv->gpu_bo);
+			priv->mapped = pixmap->devPrivate.ptr != NULL;
+			if (!priv->mapped)
+				goto skip_inplace_map;
 
-				priv->mapped = true;
-			}
 			pixmap->devKind = priv->gpu_bo->pitch;
 
 			assert(priv->gpu_bo->proxy == NULL);
@@ -1581,11 +1579,10 @@ skip_inplace_map:
 		DBG(("%s: try to operate inplace (GTT)\n", __FUNCTION__));
 		assert(priv->cpu == false);
 
-		assert(!priv->mapped);
 		pixmap->devPrivate.ptr =
 			kgem_bo_map(&sna->kgem, priv->gpu_bo);
-		if (pixmap->devPrivate.ptr != NULL) {
-			priv->mapped = true;
+		priv->mapped = pixmap->devPrivate.ptr != NULL;
+		if (priv->mapped) {
 			pixmap->devKind = priv->gpu_bo->pitch;
 			if (flags & MOVE_WRITE) {
 				assert(priv->gpu_bo->proxy == NULL);
@@ -1602,8 +1599,6 @@ skip_inplace_map:
 			DBG(("%s: operate inplace (GTT)\n", __FUNCTION__));
 			return true;
 		}
-
-		priv->mapped = false;
 	}
 
 	if (priv->mapped) {
@@ -1660,6 +1655,7 @@ skip_inplace_map:
 				  flags & MOVE_READ ? priv->gpu_damage && !priv->clear : 0))
 		return false;
 	assert(pixmap->devPrivate.ptr);
+	assert(!priv->mapped);
 
 	if (priv->clear) {
 		DBG(("%s: applying clear [%08x]\n",
@@ -1939,11 +1935,10 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 
 		DBG(("%s: try to operate inplace\n", __FUNCTION__));
 
-		assert(!priv->mapped);
 		pixmap->devPrivate.ptr =
 			kgem_bo_map(&sna->kgem, priv->gpu_bo);
-		if (pixmap->devPrivate.ptr != NULL) {
-			priv->mapped = true;
+		priv->mapped = pixmap->devPrivate.ptr != NULL;
+		if (priv->mapped) {
 			pixmap->devKind = priv->gpu_bo->pitch;
 			if (flags & MOVE_WRITE &&
 			    !DAMAGE_IS_ALL(priv->gpu_damage)) {
@@ -1967,8 +1962,6 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 			DBG(("%s: operate inplace\n", __FUNCTION__));
 			return true;
 		}
-
-		priv->mapped = false;
 	}
 
 	if (priv->clear && flags & MOVE_WRITE) {
commit bc8b191ef6f5030d17a3b6497d1fd7556756c1ff
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 30 09:04:10 2013 +0000

    sna: Return early if the Drawable box exactly matches one CRTC
    
    If we are trying to find the best coverage, then by definition if the
    drawable is an exact match for one CRTC, we can stop looking.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 307e763..e7eeb44 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2739,6 +2739,11 @@ sna_covering_crtc(ScrnInfoPtr scrn,
 		     __FUNCTION__, c,
 		     crtc->bounds.x1, crtc->bounds.y1,
 		     crtc->bounds.x2, crtc->bounds.y2));
+		if (*(const uint64_t *)box == *(uint64_t *)&crtc->bounds) {
+			DBG(("%s: box exactly matches crtc [%d]\n",
+			     __FUNCTION__, c));
+			return crtc;
+		}
 
 		if (!sna_box_intersect(&cover_box, &crtc->bounds, box))
 			continue;


More information about the xorg-commit mailing list