xf86-video-intel: 2 commits - src/sna/kgem.c src/sna/kgem.h src/sna/sna_accel.c src/sna/sna_display.c src/sna/sna.h

Chris Wilson ickle at kemper.freedesktop.org
Thu Aug 14 13:20:30 PDT 2014


 src/sna/kgem.c        |    4 ++--
 src/sna/kgem.h        |    1 +
 src/sna/sna.h         |    1 +
 src/sna/sna_accel.c   |   11 +++++++++--
 src/sna/sna_display.c |   27 ++++++++++++++-------------
 5 files changed, 27 insertions(+), 17 deletions(-)

New commits:
commit e461427ad3667554a01b5b74525a15d19538a8e5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Aug 14 21:19:10 2014 +0100

    sna: Add error message to explain modesetting failures due to allocation
    
    Since this is an error path with a major user visible failure (the
    modeset fails), make sure that we log the reason.
    
    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 2cc8c42..e30984c 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2066,8 +2066,11 @@ __sna_crtc_set_mode(xf86CrtcPtr crtc)
 	sna_crtc->fallback_shadow = false;
 retry: /* Attach per-crtc pixmap or direct */
 	bo = sna_crtc_attach(crtc);
-	if (bo == NULL)
-		return FALSE;
+	if (bo == NULL) {
+		xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
+			   "unable to attach scanout\n");
+		goto error;
+	}
 
 	kgem_bo_submit(&sna->kgem, bo);
 
@@ -2084,11 +2087,7 @@ retry: /* Attach per-crtc pixmap or direct */
 
 		xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
 			   "failed to set mode: %s [%d]\n", strerror(err), err);
-
-		sna_crtc->offset = saved_offset;
-		sna_crtc->transform = saved_transform;
-		sna_crtc->bo = saved_bo;
-		return FALSE;
+		goto error;
 	}
 
 	bo->active_scanout++;
@@ -2106,6 +2105,12 @@ retry: /* Attach per-crtc pixmap or direct */
 	sna->mode.dirty = true;
 
 	return TRUE;
+
+error:
+	sna_crtc->offset = saved_offset;
+	sna_crtc->transform = saved_transform;
+	sna_crtc->bo = saved_bo;
+	return FALSE;
 }
 
 static Bool
commit 72ed21c694aecba1e91089479b2cb5f957548fec
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Aug 14 21:09:12 2014 +0100

    sna: Do not force creation of a linear GPU bo that we don't want
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 865291e..2b146ca 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -4306,7 +4306,7 @@ unsigned kgem_can_create_2d(struct kgem *kgem,
 					 &pitch);
 		DBG(("%s: tiled[%d] size=%d\n", __FUNCTION__, tiling, size));
 		if (size > 0 && size <= kgem->max_gpu_size)
-			flags |= KGEM_CAN_CREATE_GPU;
+			flags |= KGEM_CAN_CREATE_GPU | KGEM_CAN_CREATE_TILED;
 		if (size > 0 && size <= PAGE_SIZE*kgem->aperture_mappable/4)
 			flags |= KGEM_CAN_CREATE_GTT;
 		if (size > PAGE_SIZE*kgem->aperture_mappable/4)
@@ -4323,7 +4323,7 @@ unsigned kgem_can_create_2d(struct kgem *kgem,
 			while (fence_size < size)
 				fence_size <<= 1;
 			if (fence_size > kgem->max_gpu_size)
-				flags &= ~KGEM_CAN_CREATE_GPU;
+				flags &= ~KGEM_CAN_CREATE_GPU | KGEM_CAN_CREATE_TILED;
 			if (fence_size > PAGE_SIZE*kgem->aperture_fenceable/4)
 				flags &= ~KGEM_CAN_CREATE_GTT;
 		}
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index a5ee2ef..c3a9b13 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -273,6 +273,7 @@ unsigned kgem_can_create_2d(struct kgem *kgem, int width, int height, int depth)
 #define KGEM_CAN_CREATE_CPU	0x2
 #define KGEM_CAN_CREATE_LARGE	0x4
 #define KGEM_CAN_CREATE_GTT	0x8
+#define KGEM_CAN_CREATE_TILED	0x10
 
 bool kgem_check_surface_size(struct kgem *kgem,
 			     uint32_t width,
diff --git a/src/sna/sna.h b/src/sna/sna.h
index bce8bab..24f96bb 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -705,6 +705,7 @@ sna_pixmap_undo_cow(struct sna *sna, struct sna_pixmap *priv, unsigned flags);
 #define __MOVE_FORCE 0x40
 #define __MOVE_DRI 0x80
 #define __MOVE_SCANOUT 0x100
+#define __MOVE_TILED 0x200
 
 struct sna_pixmap *
 sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int flags);
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index f8a5924..9282210 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4114,12 +4114,19 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
 		assert(list_is_empty(&priv->flush_list));
 
 		if (flags & __MOVE_FORCE || priv->create & KGEM_CAN_CREATE_GPU) {
+			bool is_linear;
+
 			assert(pixmap->drawable.width > 0);
 			assert(pixmap->drawable.height > 0);
 			assert(pixmap->drawable.bitsPerPixel >= 8);
 
-			if (sna_pixmap_default_tiling(sna, pixmap) == I915_TILING_NONE &&
-			    priv->cpu_bo && !priv->shm &&
+			is_linear = sna_pixmap_default_tiling(sna, pixmap) == I915_TILING_NONE;
+			if (is_linear && flags & __MOVE_TILED) {
+				DBG(("%s: not creating linear GPU bo\n", __FUNCTION__));
+				return NULL;
+			}
+
+			if (is_linear && priv->cpu_bo && !priv->shm &&
 			    kgem_bo_convert_to_gpu(&sna->kgem, priv->cpu_bo, flags)) {
 				assert(!priv->mapped);
 				assert(!IS_STATIC_PTR(priv->ptr));
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index c5580a1..2cc8c42 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1704,12 +1704,8 @@ static bool use_shadow(struct sna *sna, xf86CrtcPtr crtc)
 	if (priv->gpu_bo->pitch > pitch_limit)
 		return true;
 
-	if (priv->gpu_bo->tiling && sna->flags 	& SNA_LINEAR_FB) {
-		DBG(("%s: gpu bo is tiled, needlinear, forcing shadow\n", __FUNCTION__));
-		return true;
-	}
-	if (!priv->gpu_bo->tiling && !(sna->flags & SNA_LINEAR_FB)) {
-		DBG(("%s: gpu bo is linear, forcing shadow\n", __FUNCTION__));
+	if (priv->gpu_bo->tiling && sna->flags & SNA_LINEAR_FB) {
+		DBG(("%s: gpu bo is tiled, need linear, forcing shadow\n", __FUNCTION__));
 		return true;
 	}
 


More information about the xorg-commit mailing list