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

Chris Wilson ickle at kemper.freedesktop.org
Wed Nov 18 03:11:22 PST 2015


 src/sna/kgem.c |   24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

New commits:
commit 666f25baf00ac3f04096655c4022ec7a2d17247b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 18 11:08:37 2015 +0000

    sna: Only reap the VMA if tiling actually changes
    
    We only need to recreate the GTT mmap iff we need a new fence, so
    preserve the old mmaping when we can.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index b6a2ef1..9e32c7a 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -5262,6 +5262,14 @@ static void __kgem_bo_make_scanout(struct kgem *kgem,
 	}
 }
 
+static bool tiling_changed(struct kgem_bo *bo, int tiling, int pitch)
+{
+	if (tiling != bo->tiling)
+		return true;
+
+	return tiling != I915_TILING_NONE && pitch != bo->pitch;
+}
+
 static void set_gpu_tiling(struct kgem *kgem,
 			   struct kgem_bo *bo,
 			   int tiling, int pitch)
@@ -5271,10 +5279,7 @@ static void set_gpu_tiling(struct kgem *kgem,
 
 	assert(!kgem->can_fence);
 
-	bo->tiling = tiling;
-	bo->pitch = pitch;
-
-	if (tiling && bo->map__gtt) {
+	if (tiling_changed(bo, tiling, pitch) && bo->map__gtt) {
 		if (!list_is_empty(&bo->vma)) {
 			list_del(&bo->vma);
 			kgem->vma[0].count--;
@@ -5282,6 +5287,9 @@ static void set_gpu_tiling(struct kgem *kgem,
 		munmap(bo->map__gtt, bytes(bo));
 		bo->map__gtt = NULL;
 	}
+
+	bo->tiling = tiling;
+	bo->pitch = pitch;
 }
 
 struct kgem_bo *kgem_create_2d(struct kgem *kgem,
commit 4ef8dd65e1b533191c234ff8de56e1965a7d58b8
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 18 10:59:41 2015 +0000

    sna: Add some DBG around tiling changes
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index d0fba34..b6a2ef1 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -469,6 +469,11 @@ restart:
 	if (ioctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling) == 0) {
 		bo->tiling = set_tiling.tiling_mode;
 		bo->pitch = set_tiling.tiling_mode ? set_tiling.stride : stride;
+		DBG(("%s: handle=%d, tiling=%d [%d], pitch=%d [%d]: %d\n",
+		     __FUNCTION__, bo->handle,
+		     bo->tiling, tiling,
+		     bo->pitch, stride,
+		     set_tiling.tiling_mode == tiling));
 		return set_tiling.tiling_mode == tiling;
 	}
 
@@ -5261,6 +5266,9 @@ static void set_gpu_tiling(struct kgem *kgem,
 			   struct kgem_bo *bo,
 			   int tiling, int pitch)
 {
+	DBG(("%s: handle=%d, tiling=%d, pitch=%d\n",
+	     __FUNCTION__, bo->handle, tiling, pitch));
+
 	assert(!kgem->can_fence);
 
 	bo->tiling = tiling;


More information about the xorg-commit mailing list