xf86-video-intel: 8 commits - src/sna/blt.c src/sna/kgem.c src/sna/sna_accel.c src/sna/sna_glyphs.c src/sna/sna_trapezoids.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Sep 16 16:29:27 PDT 2011


 src/sna/blt.c            |    2 --
 src/sna/kgem.c           |   27 +++++++++++++++------------
 src/sna/sna_accel.c      |   23 +++++++++++------------
 src/sna/sna_glyphs.c     |   38 +++++++++++++++++++++++++++++---------
 src/sna/sna_trapezoids.c |    2 +-
 5 files changed, 56 insertions(+), 36 deletions(-)

New commits:
commit a5b5b4ebb14cab19258dd1cbc12721aaa9df226d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Sep 17 00:28:30 2011 +0100

    sna: Apply the screen offset for direct upload of a composited pixmap
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38733
    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 44a40db..767453d 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1272,7 +1272,9 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 			if (!dst_priv->pinned && replaces) {
 				stride = src_pixmap->devKind;
 				bits = src_pixmap->devPrivate.ptr;
-				bits += src_dy * stride + src_dx * bpp / 8;
+				bits += (src_dy + box->y1) * stride + (src_dx + box->x1) * bpp / 8;
+				assert(src_dy + dst_pixmap->drawable.height <= src_pixmap->drawable.height);
+				assert(src_dx + dst_pixmap->drawable.width <= src_pixmap->drawable.width);
 
 				dst_priv->gpu_bo =
 					sna_replace(sna,
commit daeb9291e22d94cd2f81b3b56418f0f879531da5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Sep 17 00:27:55 2011 +0100

    sna/trapezoids: Ensure we do not overrun the vertical edges for mono
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index ef3cd04..18376a0 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -1795,7 +1795,7 @@ mono_render(struct mono *mono)
 
 		if (mono->is_vertical) {
 			struct mono_edge *e = mono->head.next;
-			int min_height = e->height_left;
+			int min_height = h - i;
 
 			while (e != &mono->tail) {
 				if (e->height_left < min_height)
commit 481df2618af3c10877db0610c4cadf6fc509e72f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Sep 17 00:27:32 2011 +0100

    sna: Add debug option to force allocaiton of gpu-only pixmaps
    
    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 c6aac0e..44a40db 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -54,6 +54,8 @@
 #define NDEBUG 1
 #endif
 
+#define FORCE_GPU_ONLY 0
+
 DevPrivateKeyRec sna_pixmap_index;
 
 #define PM_IS_SOLID(_draw, _pm) \
@@ -209,7 +211,7 @@ sna_pixmap_create_scratch(ScreenPtr screen,
 	if (!pixmap)
 		return NullPixmap;
 
-	priv = malloc(sizeof(*priv));
+	priv = _sna_pixmap_attach(pixmap);
 	if (!priv) {
 		fbDestroyPixmap(pixmap);
 		return NullPixmap;
@@ -224,16 +226,7 @@ sna_pixmap_create_scratch(ScreenPtr screen,
 		return NullPixmap;
 	}
 
-	priv->source_count = 0;
-	priv->cpu_bo = NULL;
-	priv->cpu_damage = priv->gpu_damage = NULL;
 	priv->gpu_only = 1;
-	priv->pinned = 0;
-	priv->mapped = 0;
-	list_init(&priv->list);
-
-	priv->pixmap = pixmap;
-	sna_set_pixmap(pixmap, priv);
 
 	miModifyPixmapHeader(pixmap,
 			     width, height, depth, bpp,
@@ -243,7 +236,6 @@ sna_pixmap_create_scratch(ScreenPtr screen,
 	return pixmap;
 }
 
-
 static PixmapPtr sna_create_pixmap(ScreenPtr screen,
 				   int width, int height, int depth,
 				   unsigned int usage)
@@ -259,6 +251,11 @@ static PixmapPtr sna_create_pixmap(ScreenPtr screen,
 						 width, height, depth,
 						 I915_TILING_Y);
 
+	if (FORCE_GPU_ONLY && width && height)
+		return sna_pixmap_create_scratch(screen,
+						 width, height, depth,
+						 I915_TILING_X);
+
 #if FAKE_CREATE_PIXMAP_USAGE_SCRATCH_HEADER
 	if (width == 0 || height == 0)
 		usage = CREATE_PIXMAP_USAGE_SCRATCH_HEADER;
commit 52f93c95465151d16f588d648a58b1f979e946a3
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 16 23:24:16 2011 +0100

    sna/glyphs: Disable the glyph cache for debugging
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index a669921..720b3e4 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -78,6 +78,7 @@
 #endif
 
 #define FALLBACK 0
+#define NO_GLYPH_CACHE 0
 #define NO_GLYPHS_TO_DST 0
 #define NO_GLYPHS_VIA_MASK 0
 #define NO_GLYPHS_SLOW 0
@@ -304,6 +305,9 @@ glyph_cache(ScreenPtr screen,
 	struct sna_glyph *priv;
 	int size, mask, pos, s;
 
+	if (NO_GLYPH_CACHE)
+		return FALSE;
+
 	if (glyph->info.width > GLYPH_MAX_SIZE ||
 	    glyph->info.height > GLYPH_MAX_SIZE) {
 		((PixmapPtr)glyph_picture->pDrawable)->usage_hint = 0;
commit c8a144d6f84a00a26785fd518cb890ad77edd45f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 16 22:56:36 2011 +0100

    sna/glyphs: Correct offset of fallback-via-mask glyphs
    
    Under a compositing manager where we have fun values for both
    drawable->x/y and pixmap->screen.x/y, we were not drawing either the
    glyphs into the mask correctly and then failed to composite the mask in
    the right position on top of the pixmap.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index 87a6719..a669921 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -958,8 +958,11 @@ glyphs_fallback(CARD8 op,
 	sna_drawable_move_region_to_cpu(dst->pDrawable, &region, true);
 	if (src->pDrawable)
 		sna_drawable_move_to_cpu(src->pDrawable, false);
+	RegionTranslate(&region, -dst->pDrawable->x, -dst->pDrawable->y);
 
 	dst_image = image_from_pict(dst, TRUE, &x, &y);
+	if (dst_image == NULL)
+		goto cleanup_region;
 	DBG(("%s: dst offset (%d, %d)\n", __FUNCTION__, x, y));
 	if (x | y) {
 		region.extents.x1 += x;
@@ -969,28 +972,40 @@ glyphs_fallback(CARD8 op,
 	}
 
 	src_image = image_from_pict(src, FALSE, &dx, &dy);
+	if (src_image == NULL)
+		goto cleanup_dst;
 	DBG(("%s: src offset (%d, %d)\n", __FUNCTION__, dx, dy));
-	src_x += dx - list->xOff - x;
-	src_y += dy - list->yOff - y;
+	src_x += dx - list->xOff;
+	src_y += dy - list->yOff;
 
 	if (mask_format) {
-		DBG(("%s: create mask %dx%dca? %d\n",
+		DBG(("%s: create mask (%d, %d)x(%d,%d) + (%d,%d) + (%d,%d), depth=%d, format=%lx [%lx], ca? %d\n",
 		     __FUNCTION__,
+		     region.extents.x1, region.extents.y1,
 		     region.extents.x2 - region.extents.x1,
 		     region.extents.y2 - region.extents.y1,
+		     dst->pDrawable->x, dst->pDrawable->y,
+		     x, y,
+		     mask_format->depth, mask_format->format,
+		     mask_format->depth << 24 | mask_format->format,
 		     NeedsComponent(mask_format->format)));
 		mask_image =
 			pixman_image_create_bits(mask_format->depth << 24 | mask_format->format,
 						 region.extents.x2 - region.extents.x1,
 						 region.extents.y2 - region.extents.y1,
 						 NULL, 0);
+		if (mask_image == NULL)
+			goto cleanup_src;
 		if (NeedsComponent(mask_format->format))
 			pixman_image_set_component_alpha(mask_image, TRUE);
 
 		x -= region.extents.x1;
 		y -= region.extents.y1;
-	} else
+	} else {
 		mask_image = dst_image;
+		src_x -= x;
+		src_y -= y;
+	}
 
 	do {
 		int n = list->len;
@@ -1063,16 +1078,14 @@ next_glyph:
 	} while (--nlist);
 
 	if (mask_format) {
-		DBG(("%s: glyph mask composite src=(%d,%d) dst=(%d, %d)x(%d, %d)\n",
+		DBG(("%s: glyph mask composite src=(%d+%d,%d+%d) dst=(%d, %d)x(%d, %d)\n",
 		     __FUNCTION__,
-		     src_x + region.extents.x1,
-		     src_y + region.extents.y1,
+		     src_x, region.extents.x1, src_y, region.extents.y1,
 		     region.extents.x1, region.extents.y1,
 		     region.extents.x2 - region.extents.x1,
 		     region.extents.y2 - region.extents.y1));
 		pixman_image_composite(op, src_image, mask_image, dst_image,
-				       src_x + region.extents.x1,
-				       src_y + region.extents.y1,
+				       src_x, src_y,
 				       0, 0,
 				       region.extents.x1, region.extents.y1,
 				       region.extents.x2 - region.extents.x1,
@@ -1080,8 +1093,11 @@ next_glyph:
 		pixman_image_unref(mask_image);
 	}
 
+cleanup_src:
 	free_pixman_pict(src, src_image);
+cleanup_dst:
 	free_pixman_pict(dst, dst_image);
+cleanup_region:
 	RegionUninit(&region);
 }
 
commit 1eea2c4e60af535ac6500b1b62367f9f63f2a784
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 16 20:35:03 2011 +0100

    sna: Can't free bo from the active list
    
    As the active bo is still referenced in the request list, we can not
    simply free it but need to wait for it to be purged on expiration.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index f179d20..c13fabf 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1157,26 +1157,22 @@ void kgem_cleanup_cache(struct kgem *kgem)
 static struct kgem_bo *
 search_linear_cache(struct kgem *kgem, int size, bool active)
 {
-	struct kgem_bo *bo, *next;
+	struct kgem_bo *bo;
 	struct list *cache;
 
 	cache = active ? &kgem->active : inactive(kgem, size);
-	list_for_each_entry_safe(bo, next, cache, list) {
+	list_for_each_entry(bo, cache, list) {
 		if (size > bo->size)
 			continue;
 
 		if (active && bo->tiling != I915_TILING_NONE)
 			continue;
 
-		list_del(&bo->list);
-		if (bo->rq == NULL)
-			list_del(&bo->request);
-
 		if (bo->deleted) {
 			if (!gem_madvise(kgem->fd, bo->handle,
 					 I915_MADV_WILLNEED)) {
 				kgem->need_purge |= bo->gpu;
-				goto next_bo;
+				continue;
 			}
 
 			bo->deleted = 0;
@@ -1185,7 +1181,11 @@ search_linear_cache(struct kgem *kgem, int size, bool active)
 		if (I915_TILING_NONE != bo->tiling &&
 		    gem_set_tiling(kgem->fd, bo->handle,
 				   I915_TILING_NONE, 0) != I915_TILING_NONE)
-			goto next_bo;
+			continue;
+
+		list_del(&bo->list);
+		if (bo->rq == NULL)
+			list_del(&bo->request);
 
 		bo->tiling = I915_TILING_NONE;
 		bo->pitch = 0;
@@ -1197,10 +1197,6 @@ search_linear_cache(struct kgem *kgem, int size, bool active)
 		assert(bo->reusable);
 		assert(active || !kgem_busy(kgem, bo->handle));
 		return bo;
-next_bo:
-		list_del(&bo->request);
-		gem_close(kgem->fd, bo->handle);
-		free(bo);
 	}
 
 	return NULL;
commit d743c456db11bd3c0d21948dc3a2eb4b33e46342
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 16 20:34:33 2011 +0100

    sna: Debug option to disable tiling
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 82c5cf1..f179d20 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -62,6 +62,7 @@ static inline void list_replace(struct list *old,
 
 
 #define DBG_NO_HW 0
+#define DBG_NO_TILING 0
 #define DBG_NO_VMAP 0
 #define DBG_NO_RELAXED_FENCING 0
 #define DBG_DUMP 0
@@ -107,6 +108,9 @@ static int gem_set_tiling(int fd, uint32_t handle, int tiling, int stride)
 	struct drm_i915_gem_set_tiling set_tiling;
 	int ret;
 
+	if (DBG_NO_TILING)
+		return I915_TILING_NONE;
+
 	do {
 		set_tiling.handle = handle;
 		set_tiling.tiling_mode = tiling;
@@ -1247,6 +1251,9 @@ struct kgem_bo *kgem_create_linear(struct kgem *kgem, int size)
 
 int kgem_choose_tiling(struct kgem *kgem, int tiling, int width, int height, int bpp)
 {
+	if (DBG_NO_TILING)
+		return I915_TILING_NONE;
+
 	if (kgem->gen < 40) {
 		if (tiling) {
 			if (width * bpp > 8192 * 8) {
commit 8c35df4493c910ef62c66a411c14e5be3b26bcf0
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 16 20:33:57 2011 +0100

    sna: Remove bad assert
    
    The caller intentionally violates this assert, so it is useless.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/blt.c b/src/sna/blt.c
index 1d5cace..ac20372 100644
--- a/src/sna/blt.c
+++ b/src/sna/blt.c
@@ -50,8 +50,6 @@ memcpy_blt(const void *src, void *dst, int bpp,
 
 	assert(width && height);
 	assert(bpp >= 8);
-	assert((src_x + width) * bpp <= 8 * src_stride);
-	assert((dst_x + width) * bpp <= 8 * dst_stride);
 
 	DBG(("%s: src=(%d, %d), dst=(%d, %d), size=%dx%d, pitch=%d/%d\n",
 	     __FUNCTION__, src_x, src_y, dst_x, dst_y, width, height, src_stride, dst_stride));


More information about the xorg-commit mailing list