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

Chris Wilson ickle at kemper.freedesktop.org
Mon Mar 11 12:18:18 PDT 2013


 src/sna/kgem.c      |   12 +++++++++---
 src/sna/sna_accel.c |   14 +++++++-------
 2 files changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 0b143fcb2bdeec9abd1c1d2a9dbe707cb9165b65
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Mar 11 18:11:27 2013 +0000

    sna: Improve sna_copy_boxes DBG by printing the bo handles
    
    The handles of the bo are easier to track through the DBG as they are
    more often printed than then their addresses.
    
    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 662304d..ce63338 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4274,14 +4274,14 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 		box->x2 >= dst_pixmap->drawable.width &&
 		box->y2 >= dst_pixmap->drawable.height;
 
-	DBG(("%s: dst=(priv=%p, gpu_bo=%p, cpu_bo=%p), src=(priv=%p, gpu_bo=%p, cpu_bo=%p), replaces=%d\n",
+	DBG(("%s: dst=(priv=%p, gpu_bo=%d, cpu_bo=%d), src=(priv=%p, gpu_bo=%d, cpu_bo=%d), replaces=%d\n",
 	     __FUNCTION__,
 	     dst_priv,
-	     dst_priv ? dst_priv->gpu_bo : NULL,
-	     dst_priv ? dst_priv->cpu_bo : NULL,
+	     dst_priv && dst_priv->gpu_bo ? dst_priv->gpu_bo->handle : 0,
+	     dst_priv && dst_priv->cpu_bo ? dst_priv->cpu_bo->handle : 0,
 	     src_priv,
-	     src_priv ? src_priv->gpu_bo : NULL,
-	     src_priv ? src_priv->cpu_bo : NULL,
+	     src_priv && src_priv->gpu_bo ? src_priv->gpu_bo->handle : 0,
+	     src_priv && src_priv->cpu_bo ? src_priv->cpu_bo->handle : 0,
 	     replaces));
 
 	if (dst_priv == NULL)
commit 44d3ffdf534eb1c24ab729b9af31f09a86b82256
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Mar 11 17:14:39 2013 +0000

    sna: Only allocate addition space if we need pixel data
    
    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 35c2a90..662304d 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -725,7 +725,7 @@ create_pixmap(struct sna *sna, ScreenPtr screen,
 
 	datasize = height * stride;
 	base = screen->totalPixmapSize;
-	if (base & 15) {
+	if (datasize && base & 15) {
 		int adjust = 16 - (base & 15);
 		base += adjust;
 		datasize += adjust;
@@ -753,7 +753,7 @@ create_pixmap(struct sna *sna, ScreenPtr screen,
 	pixmap->drawable.height = height;
 	pixmap->devKind = stride;
 	pixmap->refcnt = 1;
-	pixmap->devPrivate.ptr =  (char *)pixmap + base;
+	pixmap->devPrivate.ptr = datasize ? (char *)pixmap + base : NULL;
 
 #ifdef COMPOSITE
 	pixmap->screen_x = 0;
commit b500e30d5dbcf91542c2831ebd3c48b28a01bf28
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Mar 11 17:14:07 2013 +0000

    sna: Mark the userptr as a CPU mapping
    
    This helps clarify some recent asserts.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index d469e51..2032679 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1478,9 +1478,10 @@ static void kgem_bo_free(struct kgem *kgem, struct kgem_bo *bo)
 
 	if (IS_USER_MAP(bo->map)) {
 		assert(bo->rq == NULL);
-		assert(MAP(bo->map) != bo || bo->io);
-		if (bo != MAP(bo->map)) {
+		assert(MAP(bo->map) != bo || bo->io || bo->flush);
+		if (!(bo->io || bo->flush)) {
 			DBG(("%s: freeing snooped base\n", __FUNCTION__));
+			assert(bo != MAP(bo->map));
 			free(MAP(bo->map));
 		}
 		bo->map = NULL;
@@ -4077,7 +4078,6 @@ struct kgem_bo *kgem_create_cpu_2d(struct kgem *kgem,
 			return NULL;
 		}
 
-		bo->map = MAKE_USER_MAP(ptr);
 		bo->pitch = stride;
 		bo->unique_id = kgem_get_unique_id(kgem);
 		return bo;
@@ -4454,6 +4454,7 @@ void *kgem_bo_map__async(struct kgem *kgem, struct kgem_bo *bo)
 	assert(!bo->purged);
 	assert(bo->proxy == NULL);
 	assert(list_is_empty(&bo->list));
+	assert(!IS_USER_MAP(bo->map));
 
 	if (bo->tiling == I915_TILING_NONE && !bo->scanout && kgem->has_llc) {
 		DBG(("%s: converting request for GTT map into CPU map\n",
@@ -4496,6 +4497,7 @@ void *kgem_bo_map(struct kgem *kgem, struct kgem_bo *bo)
 	assert(!bo->purged);
 	assert(bo->proxy == NULL);
 	assert(list_is_empty(&bo->list));
+	assert(!IS_USER_MAP(bo->map));
 	assert(bo->exec == NULL);
 
 	if (bo->tiling == I915_TILING_NONE && !bo->scanout &&
@@ -4561,6 +4563,7 @@ void *kgem_bo_map__gtt(struct kgem *kgem, struct kgem_bo *bo)
 	assert(!bo->purged);
 	assert(bo->exec == NULL);
 	assert(list_is_empty(&bo->list));
+	assert(!IS_USER_MAP(bo->map));
 
 	if (IS_CPU_MAP(bo->map))
 		kgem_bo_release_map(kgem, bo);
@@ -4738,6 +4741,8 @@ struct kgem_bo *kgem_create_map(struct kgem *kgem,
 	struct kgem_bo *bo;
 	uint32_t handle;
 
+	assert(MAP(ptr) == ptr);
+
 	if (!kgem->has_userptr)
 		return NULL;
 
@@ -4752,6 +4757,7 @@ struct kgem_bo *kgem_create_map(struct kgem *kgem,
 	}
 
 	bo->snoop = !kgem->has_llc;
+	bo->map = MAKE_USER_MAP(ptr);
 	debug_alloc__bo(kgem, bo);
 
 	DBG(("%s(ptr=%p, size=%d, pages=%d, read_only=%d) => handle=%d\n",


More information about the xorg-commit mailing list