xf86-video-intel: 6 commits - src/sna/sna_accel.c tools/virtual.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Sep 22 02:43:38 PDT 2013


 src/sna/sna_accel.c |  147 ++++++++++++++++++++++++++++++----------------------
 tools/virtual.c     |    2 
 2 files changed, 88 insertions(+), 61 deletions(-)

New commits:
commit 8478e9c44477094e32868e2bb06d8d0077aabe62
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Sep 22 10:32:24 2013 +0100

    sna: Both clear PolyGlyph and ImageGlyph are no-ops
    
    For ImageGlyphs, we pre-clear the area hence the bg is always set.
    
    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 4bbecd6..8a55e12 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -13186,7 +13186,6 @@ struct sna_font {
 };
 #define GLYPH_INVALID (void *)1
 #define GLYPH_EMPTY (void *)2
-#define GLYPH_CLEAR (void *)3
 
 static Bool
 sna_realize_font(ScreenPtr screen, FontPtr font)
@@ -13362,9 +13361,6 @@ sna_glyph_blt(DrawablePtr drawable, GCPtr gc,
 			if (c->bits == GLYPH_EMPTY)
 				goto skip;
 
-			if (!transparent && c->bits == GLYPH_CLEAR)
-				goto skip;
-
 			len = (w8 * h + 7) >> 3 << 1;
 			x1 = x + c->metrics.leftSideBearing;
 			y1 = y - c->metrics.ascent;
@@ -13377,7 +13373,6 @@ sna_glyph_blt(DrawablePtr drawable, GCPtr gc,
 			if (x1 + w <= extents->x1 || y1 + h <= extents->y1)
 				goto skip;
 
-
 			if (!kgem_check_batch(&sna->kgem, 3+len)) {
 				_kgem_submit(&sna->kgem);
 				_kgem_set_mode(&sna->kgem, KGEM_BLT);
@@ -13417,9 +13412,7 @@ sna_glyph_blt(DrawablePtr drawable, GCPtr gc,
 			b[0] = br00 | (1 + len);
 			b[1] = (uint16_t)y1 << 16 | (uint16_t)x1;
 			b[2] = (uint16_t)(y1+h) << 16 | (uint16_t)(x1+w);
-			if (c->bits == GLYPH_CLEAR) {
-				memset(b+3, 0, len*4);
-			} else {
+			{
 				uint64_t *src = (uint64_t *)c->bits;
 				uint64_t *dst = (uint64_t *)(b + 3);
 				do  {
@@ -13544,7 +13537,7 @@ static bool sna_set_glyph(CharInfoPtr in, CharInfoPtr out)
 
 	if (clear) {
 		free(out->bits);
-		out->bits = GLYPH_CLEAR;
+		out->bits = GLYPH_EMPTY;
 	}
 
 	return true;
@@ -14043,7 +14036,7 @@ sna_reversed_glyph_blt(DrawablePtr drawable, GCPtr gc,
 				goto skip;
 			}
 
-			if (!transparent) {
+			{
 				int clear = 1, j = h;
 				uint8_t *g = glyph;
 
commit 395f07b1fe950ad09d439a0b9eba1792ba6a245d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Sep 22 10:31:15 2013 +0100

    sna: Undo region translation after failing to begin ImageGlyphs
    
    If we fail the initial tests, we need to undo our translation to the
    region before returning and starting the fallback paths.
    
    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 e8e5d27..4bbecd6 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -13287,26 +13287,32 @@ sna_glyph_blt(DrawablePtr drawable, GCPtr gc,
 		}
 	}
 
-	get_drawable_deltas(drawable, pixmap, &dx, &dy);
+	if (get_drawable_deltas(drawable, pixmap, &dx, &dy))
+		RegionTranslate(clip, dx, dy);
 	_x += drawable->x + dx;
 	_y += drawable->y + dy;
 
-	RegionTranslate(clip, dx, dy);
 	extents = RegionRects(clip);
 	last_extents = extents + RegionNumRects(clip);
 
-	if (!transparent) /* emulate miImageGlyphBlt */
-		sna_blt_fill_boxes(sna, GXcopy,
-				   bo, drawable->bitsPerPixel,
-				   bg, extents, RegionNumRects(clip));
+	if (!transparent) { /* emulate miImageGlyphBlt */
+		if (!sna_blt_fill_boxes(sna, GXcopy,
+					bo, drawable->bitsPerPixel,
+					bg, extents, last_extents - extents)) {
+			RegionTranslate(clip, -dx, -dy);
+			return false;
+		}
+	}
 
 	kgem_set_mode(&sna->kgem, KGEM_BLT, bo);
 	if (!kgem_check_batch(&sna->kgem, 16) ||
 	    !kgem_check_bo_fenced(&sna->kgem, bo) ||
 	    !kgem_check_reloc(&sna->kgem, 1)) {
 		kgem_submit(&sna->kgem);
-		if (!kgem_check_bo_fenced(&sna->kgem, bo))
+		if (!kgem_check_bo_fenced(&sna->kgem, bo)) {
+			RegionTranslate(clip, -dx, -dy);
 			return false;
+		}
 		_kgem_set_mode(&sna->kgem, KGEM_BLT);
 	}
 
@@ -13753,8 +13759,8 @@ out:
 
 static void
 sna_image_text8(DrawablePtr drawable, GCPtr gc,
-	       int x, int y,
-	       int count, char *chars)
+		int x, int y,
+		int count, char *chars)
 {
 	struct sna_font *priv = gc->font->devPrivates[sna_font_key];
 	CharInfoPtr info[255];
@@ -13834,8 +13840,8 @@ out:
 
 static void
 sna_image_text16(DrawablePtr drawable, GCPtr gc,
-	       int x, int y,
-	       int count, unsigned short *chars)
+		int x, int y,
+		int count, unsigned short *chars)
 {
 	struct sna_font *priv = gc->font->devPrivates[sna_font_key];
 	CharInfoPtr info[255];
@@ -13947,26 +13953,32 @@ sna_reversed_glyph_blt(DrawablePtr drawable, GCPtr gc,
 		}
 	}
 
-	get_drawable_deltas(drawable, pixmap, &dx, &dy);
+	if (get_drawable_deltas(drawable, pixmap, &dx, &dy))
+		RegionTranslate(clip, dx, dy);
 	_x += drawable->x + dx;
 	_y += drawable->y + dy;
 
-	RegionTranslate(clip, dx, dy);
 	extents = RegionRects(clip);
 	last_extents = extents + RegionNumRects(clip);
 
-	if (!transparent) /* emulate miImageGlyphBlt */
-		sna_blt_fill_boxes(sna, GXcopy,
-				   bo, drawable->bitsPerPixel,
-				   bg, extents, RegionNumRects(clip));
+	if (!transparent) { /* emulate miImageGlyphBlt */
+		if (!sna_blt_fill_boxes(sna, GXcopy,
+					bo, drawable->bitsPerPixel,
+					bg, extents, last_extents - extents)) {
+			RegionTranslate(clip, -dx, -dy);
+			return false;
+		}
+	}
 
 	kgem_set_mode(&sna->kgem, KGEM_BLT, bo);
 	if (!kgem_check_batch(&sna->kgem, 16) ||
 	    !kgem_check_bo_fenced(&sna->kgem, bo) ||
 	    !kgem_check_reloc(&sna->kgem, 1)) {
 		kgem_submit(&sna->kgem);
-		if (!kgem_check_bo_fenced(&sna->kgem, bo))
+		if (!kgem_check_bo_fenced(&sna->kgem, bo)) {
+			RegionTranslate(clip, -dx, -dy);
 			return false;
+		}
 		_kgem_set_mode(&sna->kgem, KGEM_BLT);
 	}
 
commit 2851b7747bc8e143aa5c6209b8800eeccb629058
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 20 18:20:39 2013 +0000

    sna: ImageGlyphs completely overwrite the destination
    
    So we can use the usual rules for discarding unused reads.
    
    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 791efc4..e8e5d27 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -13255,6 +13255,7 @@ sna_glyph_blt(DrawablePtr drawable, GCPtr gc,
 	int16_t dx, dy;
 	uint32_t br00;
 	uint16_t unwind_batch, unwind_reloc;
+	unsigned hint;
 
 	uint8_t rop = transparent ? copy_ROP[gc->alu] : ROP_S;
 
@@ -13266,7 +13267,12 @@ sna_glyph_blt(DrawablePtr drawable, GCPtr gc,
 		return false;
 	}
 
-	bo = sna_drawable_use_bo(drawable, PREFER_GPU, &clip->extents, &damage);
+	if (!transparent && clip->data == NULL)
+		hint = PREFER_GPU | IGNORE_CPU;
+	else
+		hint = PREFER_GPU;
+
+	bo = sna_drawable_use_bo(drawable, hint, &clip->extents, &damage);
 	if (bo == NULL)
 		return false;
 
@@ -13812,8 +13818,7 @@ fallback:
 
 		if (!sna_gc_move_to_cpu(gc, drawable, &region))
 			goto out;
-		if (!sna_drawable_move_region_to_cpu(drawable, &region,
-						     MOVE_READ | MOVE_WRITE))
+		if (!sna_drawable_move_region_to_cpu(drawable, &region, MOVE_WRITE))
 			goto out_gc;
 
 		DBG(("%s: fallback -- fbImageGlyphBlt\n", __FUNCTION__));
@@ -13895,8 +13900,7 @@ fallback:
 
 		if (!sna_gc_move_to_cpu(gc, drawable, &region))
 			goto out;
-		if (!sna_drawable_move_region_to_cpu(drawable, &region,
-						     MOVE_READ | MOVE_WRITE))
+		if (!sna_drawable_move_region_to_cpu(drawable, &region, MOVE_WRITE))
 			goto out_gc;
 
 		DBG(("%s: fallback -- fbImageGlyphBlt\n", __FUNCTION__));
@@ -13929,6 +13933,9 @@ sna_reversed_glyph_blt(DrawablePtr drawable, GCPtr gc,
 	uint8_t rop = transparent ? copy_ROP[gc->alu] : ROP_S;
 	uint16_t unwind_batch, unwind_reloc;
 
+	DBG(("%s: pixmap=%ld, bo=%d, damage=%p, fg=%08x, bg=%08x\n",
+	     __FUNCTION__, pixmap->drawable.serialNumber, bo->handle, damage, fg, bg));
+
 	if (bo->tiling == I915_TILING_Y) {
 		DBG(("%s: converting bo from Y-tiling\n", __FUNCTION__));
 		assert(bo == __sna_pixmap_get_bo(pixmap));
@@ -14151,6 +14158,7 @@ sna_image_glyph(DrawablePtr drawable, GCPtr gc,
 	RegionRec region;
 	struct sna_damage **damage;
 	struct kgem_bo *bo;
+	unsigned hint;
 
 	if (n == 0)
 		return;
@@ -14199,7 +14207,11 @@ sna_image_glyph(DrawablePtr drawable, GCPtr gc,
 	if (sna_font_too_large(gc->font))
 		goto fallback;
 
-	if ((bo = sna_drawable_use_bo(drawable, PREFER_GPU,
+	if (region.data == NULL)
+		hint = IGNORE_CPU | PREFER_GPU;
+	else
+		hint = PREFER_GPU;
+	if ((bo = sna_drawable_use_bo(drawable, hint,
 				      &region.extents, &damage)) &&
 	    sna_reversed_glyph_blt(drawable, gc, x, y, n, info, base,
 				   bo, damage, &region,
@@ -14210,8 +14222,7 @@ fallback:
 	DBG(("%s: fallback\n", __FUNCTION__));
 	if (!sna_gc_move_to_cpu(gc, drawable, &region))
 		goto out;
-	if (!sna_drawable_move_region_to_cpu(drawable, &region,
-					     MOVE_READ | MOVE_WRITE))
+	if (!sna_drawable_move_region_to_cpu(drawable, &region, MOVE_WRITE))
 		goto out_gc;
 
 	DBG(("%s: fallback -- fbImageGlyphBlt\n", __FUNCTION__));
commit 27f87a56e9fe8cb0e3f41ddac9b3511d0316b436
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 20 18:18:54 2013 +0000

    sna: Don't set the mapped hint for inplace tiled accesses
    
    The mapped hint is only useful for coherent mappings where it is
    preferable to guide placement of regular operations.
    
    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 a956e2b..791efc4 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -5133,6 +5133,11 @@ sna_copy_boxes__inplace(struct sna *sna, RegionPtr region, int alu,
 					    box->x2 - box->x1, box->y2 - box->y1);
 			box++;
 		} while (--n);
+
+		if (!src_priv->shm) {
+			src_pixmap->devPrivate.ptr = NULL;
+			src_priv->mapped = false;
+		}
 	} else {
 		DBG(("%s: copy from a linear CPU map\n", __FUNCTION__));
 		do {
@@ -5145,13 +5150,13 @@ sna_copy_boxes__inplace(struct sna *sna, RegionPtr region, int alu,
 				   box->x2 - box->x1, box->y2 - box->y1);
 			box++;
 		} while (--n);
-	}
 
-	if (!src_priv->shm) {
-		src_pixmap->devPrivate.ptr = src;
-		src_pixmap->devKind = src_priv->gpu_bo->pitch;
-		src_priv->mapped = true;
-		src_priv->cpu = true;
+		if (!src_priv->shm) {
+			src_pixmap->devPrivate.ptr = src;
+			src_pixmap->devKind = src_priv->gpu_bo->pitch;
+			src_priv->mapped = true;
+			src_priv->cpu = true;
+		}
 	}
 
 	return true;
@@ -14603,10 +14608,10 @@ static int sna_create_gc(GCPtr gc)
 }
 
 static bool
-sna_get_image_blt(PixmapPtr pixmap,
-		  RegionPtr region,
-		  char *dst,
-		  unsigned flags)
+sna_get_image__blt(PixmapPtr pixmap,
+		   RegionPtr region,
+		   char *dst,
+		   unsigned flags)
 {
 	struct sna_pixmap *priv = sna_pixmap(pixmap);
 	struct sna *sna = to_sna_from_pixmap(pixmap);
@@ -14697,10 +14702,10 @@ sna_get_image_blt(PixmapPtr pixmap,
 }
 
 static bool
-sna_get_image_inplace(PixmapPtr pixmap,
-		      RegionPtr region,
-		      char *dst,
-		      unsigned flags)
+sna_get_image__inplace(PixmapPtr pixmap,
+		       RegionPtr region,
+		       char *dst,
+		       unsigned flags)
 {
 	struct sna_pixmap *priv = sna_pixmap(pixmap);
 	struct sna *sna = to_sna_from_pixmap(pixmap);
@@ -14751,6 +14756,11 @@ sna_get_image_inplace(PixmapPtr pixmap,
 				    0, 0,
 				    region->extents.x2 - region->extents.x1,
 				    region->extents.y2 - region->extents.y1);
+		if (!priv->shm) {
+			pixmap->devPrivate.ptr = NULL;
+			priv->mapped = false;
+			priv->cpu = false;
+		}
 	} else {
 		DBG(("%s: download through a linear CPU map\n", __FUNCTION__));
 		memcpy_blt(src, dst,
@@ -14762,13 +14772,12 @@ sna_get_image_inplace(PixmapPtr pixmap,
 			   0, 0,
 			   region->extents.x2 - region->extents.x1,
 			   region->extents.y2 - region->extents.y1);
-	}
-
-	if (!priv->shm) {
-		pixmap->devPrivate.ptr = src;
-		pixmap->devKind = priv->gpu_bo->pitch;
-		priv->mapped = true;
-		priv->cpu = true;
+		if (!priv->shm) {
+			pixmap->devPrivate.ptr = src;
+			pixmap->devKind = priv->gpu_bo->pitch;
+			priv->mapped = true;
+			priv->cpu = true;
+		}
 	}
 
 	return true;
@@ -14812,10 +14821,10 @@ sna_get_image(DrawablePtr drawable,
 		region.extents.y2 = region.extents.y1 + h;
 		region.data = NULL;
 
-		if (sna_get_image_blt(pixmap, &region, dst, flags))
+		if (sna_get_image__blt(pixmap, &region, dst, flags))
 			return;
 
-		if (sna_get_image_inplace(pixmap, &region, dst, flags))
+		if (sna_get_image__inplace(pixmap, &region, dst, flags))
 			return;
 
 		if (!sna_drawable_move_region_to_cpu(&pixmap->drawable,
commit 799f1e2355999fb8691cffee4033847c1d2c640b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 20 15:51:35 2013 +0000

    sna: Prevent invalid use of set-write-domain on scanouts when debugging
    
    One debugging option forces the use of the write domain when
    synchronising to force a full synchronisation. This trips up an
    assertion to catch when we try to move the scanout into the CPU write
    domain. So don't.
    
    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 bf7cb9c..a956e2b 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -5087,7 +5087,7 @@ sna_copy_boxes__inplace(struct sna *sna, RegionPtr region, int alu,
 		break;
 	}
 
-	if (!kgem_bo_can_map__cpu(&sna->kgem, src_priv->gpu_bo, false)) {
+	if (!kgem_bo_can_map__cpu(&sna->kgem, src_priv->gpu_bo, FORCE_FULL_SYNC)) {
 		DBG(("%s - no, cannot map src for reads into the CPU\n", __FUNCTION__));
 		return false;
 	}
@@ -14722,7 +14722,7 @@ sna_get_image_inplace(PixmapPtr pixmap,
 		break;
 	}
 
-	if (!kgem_bo_can_map__cpu(&sna->kgem, priv->gpu_bo, false))
+	if (!kgem_bo_can_map__cpu(&sna->kgem, priv->gpu_bo, FORCE_FULL_SYNC))
 		return false;
 
 	if (priv->gpu_damage == NULL ||
commit 011636d25be6b42ea1cf76e312d3abdf3855349d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 20 18:57:11 2013 +0100

    intel-virtual-output: Hide the remote cursor on initial connection
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/tools/virtual.c b/tools/virtual.c
index 3147943..9987476 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -1684,6 +1684,8 @@ static int add_display(struct context *ctx, Display *dpy)
 	display->invisible_cursor = display_load_invisible_cursor(display);
 	display->cursor = None;
 
+	display_cursor_move(display, 0, 0, 0);
+
 	return ConnectionNumber(dpy);
 }
 


More information about the xorg-commit mailing list