xf86-video-intel: 4 commits - src/sna/kgem.c src/sna/sna_accel.c src/sna/sna_dri2.c src/sna/sna_dri3.c src/sna/sna_driver.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Jun 1 01:16:24 PDT 2015


 src/sna/kgem.c       |    3 +++
 src/sna/sna_accel.c  |    6 ++++++
 src/sna/sna_dri2.c   |   21 +++++++++++++++------
 src/sna/sna_dri3.c   |    9 +++++++++
 src/sna/sna_driver.c |    2 ++
 5 files changed, 35 insertions(+), 6 deletions(-)

New commits:
commit b792b2c0b8e6984a5a45b60e6502cb959db92ba8
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jun 1 09:08:52 2015 +0100

    sna/dri2+: The DRI2/DRI3 protocol requires fenced tiling
    
    If we export a surface over DRI2/DRI3, we have to use explicit tiling
    via the kernel. :(
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index be33480..3611270 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -400,6 +400,9 @@ static uint32_t color_tiling(struct sna *sna, DrawablePtr draw)
 {
 	uint32_t tiling;
 
+	if (!sna->kgem.can_fence)
+		return I915_TILING_NONE;
+
 	if (COLOR_PREFER_TILING_Y &&
 	    (draw->width  != sna->front->drawable.width ||
 	     draw->height != sna->front->drawable.height))
@@ -427,7 +430,6 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
 					  PixmapPtr pixmap)
 {
 	struct sna_pixmap *priv;
-	int tiling;
 
 	DBG(("%s: attaching DRI client to pixmap=%ld\n",
 	     __FUNCTION__, pixmap->drawable.serialNumber));
@@ -451,11 +453,18 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
 	assert(priv->gpu_bo->proxy == NULL);
 	assert(priv->gpu_bo->flush == false);
 
-	tiling = color_tiling(sna, &pixmap->drawable);
-	if (tiling < 0)
-		tiling = -tiling;
-	if (priv->gpu_bo->tiling < tiling && !priv->gpu_bo->scanout)
-		sna_pixmap_change_tiling(pixmap, tiling);
+	if (!sna->kgem.can_fence) {
+		if (!sna_pixmap_change_tiling(pixmap, I915_TILING_NONE)) {
+			DBG(("%s: failed to discard tiling (%d) for DRI2 protocol\n", __FUNCTION__, priv->gpu_bo->tiling));
+			return NULL;
+		}
+	} else {
+		int tiling = color_tiling(sna, &pixmap->drawable);
+		if (tiling < 0)
+			tiling = -tiling;
+		if (priv->gpu_bo->tiling < tiling && !priv->gpu_bo->scanout)
+			sna_pixmap_change_tiling(pixmap, tiling);
+	}
 
 	return priv->gpu_bo;
 }
diff --git a/src/sna/sna_dri3.c b/src/sna/sna_dri3.c
index ecfb6f3..1a2ba5d 100644
--- a/src/sna/sna_dri3.c
+++ b/src/sna/sna_dri3.c
@@ -327,6 +327,15 @@ static int sna_dri3_fd_from_pixmap(ScreenPtr screen,
 		return -1;
 	}
 
+	if (bo->tiling && !sna->kgem.can_fence) {
+		if (!sna_pixmap_change_tiling(pixmap, I915_TILING_NONE)) {
+			DBG(("%s: unable to discard GPU tiling (%d) for DRI3 protocol\n",
+			     __FUNCTION__, bo->tiling));
+			return -1;
+		}
+		bo = priv->gpu_bo;
+	}
+
 	fd = kgem_bo_export_to_prime(&sna->kgem, bo);
 	if (fd == -1) {
 		DBG(("%s: exporting handle=%d to fd failed\n", __FUNCTION__, bo->handle));
commit 085efe68177e252af127a9e7f1186c51e9d68c80
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jun 1 08:59:30 2015 +0100

    sna: Force Linear FB when swizzling is unknown and fencing disabled
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index b1011b7..de2bb77 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -619,6 +619,8 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int probe)
 
 	if (xf86ReturnOptValBool(sna->Options, OPTION_TILING_FB, FALSE))
 		sna->flags |= SNA_LINEAR_FB;
+	if (!sna->kgem.can_fence)
+		sna->flags |= SNA_LINEAR_FB;
 
 	if (!xf86ReturnOptValBool(sna->Options, OPTION_SWAPBUFFERS_WAIT, TRUE))
 		sna->flags |= SNA_NO_WAIT;
commit e08589de09b2e27b86321473efd4f29e57a18371
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jun 1 08:54:19 2015 +0100

    sna: Disable tiling assertion with unknown swizzling and white lies
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 9fc14a4..c3b848d 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -285,6 +285,9 @@ static void assert_tiling(struct kgem *kgem, struct kgem_bo *bo)
 
 	assert(bo);
 
+	if (!kgem->can_fence && kgem->gen >= 040 && bo->tiling)
+		return; /* lies */
+
 	VG_CLEAR(tiling);
 	tiling.handle = bo->handle;
 	tiling.tiling_mode = bo->tiling;
commit d1479d8d03f2a1f2c2f0f3f89c5341c65e27d2d5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jun 1 08:42:28 2015 +0100

    sna: Double check that a tiling change request results in a change
    
    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 9a5079f..8f0326b 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -683,6 +683,12 @@ struct kgem_bo *sna_pixmap_change_tiling(PixmapPtr pixmap, uint32_t tiling)
 		return NULL;
 	}
 
+	if (bo->tiling == priv->gpu_bo->tiling) {
+		DBG(("%s: tiling request failed\n", __FUNCTION__));
+		kgem_bo_destroy(&sna->kgem, bo);
+		return NULL;
+	}
+
 	box.x1 = box.y1 = 0;
 	box.x2 = pixmap->drawable.width;
 	box.y2 = pixmap->drawable.height;


More information about the xorg-commit mailing list