xf86-video-intel: 3 commits - src/sna/gen2_render.c src/sna/gen3_render.c src/sna/gen4_render.c src/sna/gen5_render.c src/sna/gen6_render.c src/sna/gen7_render.c src/sna/sna_accel.c src/sna/sna_render_inline.h

Chris Wilson ickle at kemper.freedesktop.org
Thu Jan 26 15:28:30 PST 2012


 src/sna/gen2_render.c       |    9 ++++++++-
 src/sna/gen3_render.c       |   12 +++++++++++-
 src/sna/gen4_render.c       |   13 ++++++++++++-
 src/sna/gen5_render.c       |    9 ++++++++-
 src/sna/gen6_render.c       |   13 ++++++++++++-
 src/sna/gen7_render.c       |   13 ++++++++++++-
 src/sna/sna_accel.c         |   33 ++++++++++++++++++---------------
 src/sna/sna_render_inline.h |   11 +++++++++++
 8 files changed, 92 insertions(+), 21 deletions(-)

New commits:
commit 541908524f9ee754db3bc45d2e1681d34479c1cc
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jan 26 23:14:14 2012 +0000

    sna: Remove extraneous clipping from GetImage
    
    The spec says that they must wholly contained with the valid BorderClip
    for a Window or within the Pixmap or else a BadMatch is thrown. Rely on
    this behaviour and not perform the clipping ourselves.
    
    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 cad8d66..3c8f2be 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -11154,42 +11154,15 @@ sna_get_image(DrawablePtr drawable,
 	      char *dst)
 {
 	RegionRec region;
-	DDXPointRec origin;
 
 	DBG(("%s (%d, %d, %d, %d)\n", __FUNCTION__, x, y, w, h));
 
-	/* XXX should be clipped already according to the spec... */
-	origin.x = region.extents.x1 = x + drawable->x;
-	origin.y = region.extents.y1 = y + drawable->y;
+	region.extents.x1 = x + drawable->x;
+	region.extents.y1 = y + drawable->y;
 	region.extents.x2 = region.extents.x1 + w;
 	region.extents.y2 = region.extents.y1 + h;
 	region.data = NULL;
 
-	if (drawable->type == DRAWABLE_PIXMAP) {
-		if (region.extents.x1 < drawable->x)
-			region.extents.x1 = drawable->x;
-		if (region.extents.x2 > drawable->x + drawable->width)
-			region.extents.x2 = drawable->x + drawable->width;
-
-		if (region.extents.y1 < drawable->y)
-			region.extents.y1 = drawable->y;
-		if (region.extents.y2 > drawable->y + drawable->height)
-			region.extents.y2 = drawable->y + drawable->height;
-	} else {
-		pixman_box16_t *c = &((WindowPtr)drawable)->borderClip.extents;
-		pixman_box16_t *r = &region.extents;
-
-		if (r->x1 < c->x1)
-			r->x1 = c->x1;
-		if (r->x2 > c->x2)
-			r->x2 = c->x2;
-
-		if (r->y1 < c->y1)
-			r->y1 = c->y1;
-		if (r->y2 > c->y2)
-			r->y2 = c->y2;
-	}
-
 	if (!sna_drawable_move_region_to_cpu(drawable, &region, MOVE_READ))
 		return;
 
@@ -11202,17 +11175,13 @@ sna_get_image(DrawablePtr drawable,
 		DBG(("%s: copy box (%d, %d), (%d, %d), origin (%d, %d)\n",
 		     __FUNCTION__,
 		     region.extents.x1, region.extents.y1,
-		     region.extents.x2, region.extents.y2,
-		     origin.x, origin.y));
+		     region.extents.x2, region.extents.y2));
 		get_drawable_deltas(drawable, pixmap, &dx, &dy);
 		memcpy_blt(pixmap->devPrivate.ptr, dst, drawable->bitsPerPixel,
 			   pixmap->devKind, PixmapBytePad(w, drawable->depth),
 			   region.extents.x1 + dx,
 			   region.extents.y1 + dy,
-			   region.extents.x1 - origin.x,
-			   region.extents.y1 - origin.y,
-			   region.extents.x2 - region.extents.x1,
-			   region.extents.y2 - region.extents.y1);
+			   0, 0, w, h);
 	} else
 		fbGetImage(drawable, x, y, w, h, format, mask, dst);
 }
commit 7ff40b572ec5cd860d7c7ff23beca0388f37c31c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jan 26 22:55:04 2012 +0000

    sna: Avoid fbBlt for the easy GetImage cases
    
    From (i5-2520m):
      60000 trep @   0.6145 msec (  1630.0/sec): GetImage 500x500 square
    To:
      60000 trep @   0.4949 msec (  2020.0/sec): GetImage 500x500 square
    
    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 7fe06de..cad8d66 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -11154,11 +11154,13 @@ sna_get_image(DrawablePtr drawable,
 	      char *dst)
 {
 	RegionRec region;
+	DDXPointRec origin;
 
 	DBG(("%s (%d, %d, %d, %d)\n", __FUNCTION__, x, y, w, h));
 
-	region.extents.x1 = x + drawable->x;
-	region.extents.y1 = y + drawable->y;
+	/* XXX should be clipped already according to the spec... */
+	origin.x = region.extents.x1 = x + drawable->x;
+	origin.y = region.extents.y1 = y + drawable->y;
 	region.extents.x2 = region.extents.x1 + w;
 	region.extents.y2 = region.extents.y1 + h;
 	region.data = NULL;
@@ -11173,14 +11175,46 @@ sna_get_image(DrawablePtr drawable,
 			region.extents.y1 = drawable->y;
 		if (region.extents.y2 > drawable->y + drawable->height)
 			region.extents.y2 = drawable->y + drawable->height;
-	} else
-		RegionIntersect(&region, &region,
-				&((WindowPtr)drawable)->borderClip);
+	} else {
+		pixman_box16_t *c = &((WindowPtr)drawable)->borderClip.extents;
+		pixman_box16_t *r = &region.extents;
+
+		if (r->x1 < c->x1)
+			r->x1 = c->x1;
+		if (r->x2 > c->x2)
+			r->x2 = c->x2;
+
+		if (r->y1 < c->y1)
+			r->y1 = c->y1;
+		if (r->y2 > c->y2)
+			r->y2 = c->y2;
+	}
 
 	if (!sna_drawable_move_region_to_cpu(drawable, &region, MOVE_READ))
 		return;
 
-	fbGetImage(drawable, x, y, w, h, format, mask, dst);
+	if (format == ZPixmap &&
+	    drawable->bitsPerPixel >= 8 &&
+	    PM_IS_SOLID(drawable, mask)) {
+		PixmapPtr pixmap = get_drawable_pixmap(drawable);
+		int16_t dx, dy;
+
+		DBG(("%s: copy box (%d, %d), (%d, %d), origin (%d, %d)\n",
+		     __FUNCTION__,
+		     region.extents.x1, region.extents.y1,
+		     region.extents.x2, region.extents.y2,
+		     origin.x, origin.y));
+		get_drawable_deltas(drawable, pixmap, &dx, &dy);
+		memcpy_blt(pixmap->devPrivate.ptr, dst, drawable->bitsPerPixel,
+			   pixmap->devKind, PixmapBytePad(w, drawable->depth),
+			   region.extents.x1 + dx,
+			   region.extents.y1 + dy,
+			   region.extents.x1 - origin.x,
+			   region.extents.y1 - origin.y,
+			   region.extents.x2 - region.extents.x1,
+			   region.extents.y2 - region.extents.y1);
+	} else
+		fbGetImage(drawable, x, y, w, h, format, mask, dst);
 }
 
 static void
commit adb1320bba15a3a3b4fa8e7d0fd0360fa696721d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jan 26 16:05:48 2012 +0000

    sna/gen2+: Include being unattached in the list of source fallbacks
    
    If the source is not attached to a buffer (be it a GPU bo or a CPU bo),
    a temporary upload buffer would be required and so it is not worth
    forcing the target to the destination in that case (should the target
    not be on the GPU already).
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c
index eb8d4ef..2a97cea 100644
--- a/src/sna/gen2_render.c
+++ b/src/sna/gen2_render.c
@@ -1514,12 +1514,19 @@ has_alphamap(PicturePtr p)
 }
 
 static bool
+need_upload(PicturePtr p)
+{
+	return p->pDrawable && unattached(p->pDrawable);
+}
+
+static bool
 source_fallback(PicturePtr p)
 {
 	return (has_alphamap(p) ||
 		is_unhandled_gradient(p) ||
 		!gen2_check_filter(p) ||
-		!gen2_check_repeat(p));
+		!gen2_check_repeat(p) ||
+		need_upload(p));
 }
 
 static bool
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index af83966..931142d 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -2426,9 +2426,19 @@ has_alphamap(PicturePtr p)
 }
 
 static bool
+need_upload(PicturePtr p)
+{
+	return p->pDrawable && unattached(p->pDrawable);
+}
+
+static bool
 source_fallback(PicturePtr p)
 {
-	return has_alphamap(p) || !gen3_check_xformat(p) || !gen3_check_filter(p) || !gen3_check_repeat(p);
+	return (has_alphamap(p) ||
+		!gen3_check_xformat(p) ||
+		!gen3_check_filter(p) ||
+		!gen3_check_repeat(p) ||
+		need_upload(p));
 }
 
 static bool
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index c798ce5..91d5f49 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -2015,9 +2015,20 @@ has_alphamap(PicturePtr p)
 }
 
 static bool
+need_upload(PicturePtr p)
+{
+	return p->pDrawable && unattached(p->pDrawable);
+}
+
+static bool
 source_fallback(PicturePtr p)
 {
-	return has_alphamap(p) || is_gradient(p) || !gen4_check_filter(p) || !gen4_check_repeat(p) || !gen4_check_format(p->format);
+	return (has_alphamap(p) ||
+		is_gradient(p) ||
+		!gen4_check_filter(p) ||
+		!gen4_check_repeat(p) ||
+		!gen4_check_format(p->format) ||
+		need_upload(p));
 }
 
 static bool
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index 47c4e96..2c6d020 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -2049,13 +2049,20 @@ has_alphamap(PicturePtr p)
 }
 
 static bool
+need_upload(PicturePtr p)
+{
+	return p->pDrawable && unattached(p->pDrawable);
+}
+
+static bool
 source_fallback(PicturePtr p)
 {
 	return (has_alphamap(p) ||
 		is_gradient(p) ||
 		!gen5_check_filter(p) ||
 		!gen5_check_repeat(p) ||
-		!gen5_check_format(p->format));
+		!gen5_check_format(p->format) ||
+		need_upload(p));
 }
 
 static bool
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index c3bc2e7..d813d95 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -2266,9 +2266,20 @@ has_alphamap(PicturePtr p)
 }
 
 static bool
+need_upload(PicturePtr p)
+{
+	return p->pDrawable && unattached(p->pDrawable);
+}
+
+static bool
 source_fallback(PicturePtr p)
 {
-	return has_alphamap(p) || is_gradient(p) || !gen6_check_filter(p) || !gen6_check_repeat(p) || !gen6_check_format(p->format);
+	return (has_alphamap(p) ||
+		is_gradient(p) ||
+		!gen6_check_filter(p) ||
+		!gen6_check_repeat(p) ||
+		!gen6_check_format(p->format) ||
+		need_upload(p));
 }
 
 static bool
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 21d8c99..282b724 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2333,9 +2333,20 @@ has_alphamap(PicturePtr p)
 }
 
 static bool
+need_upload(PicturePtr p)
+{
+	return p->pDrawable && unattached(p->pDrawable);
+}
+
+static bool
 source_fallback(PicturePtr p)
 {
-	return has_alphamap(p) || is_gradient(p) || !gen7_check_filter(p) || !gen7_check_repeat(p) || !gen7_check_format(p->format);
+	return (has_alphamap(p) ||
+		is_gradient(p) ||
+		!gen7_check_filter(p) ||
+		!gen7_check_repeat(p) ||
+		!gen7_check_format(p->format) ||
+		need_upload(p));
 }
 
 static bool
diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h
index c9d2b5f..489f215 100644
--- a/src/sna/sna_render_inline.h
+++ b/src/sna/sna_render_inline.h
@@ -106,6 +106,17 @@ too_small(DrawablePtr drawable)
 }
 
 static inline Bool
+unattached(DrawablePtr drawable)
+{
+	struct sna_pixmap *priv = sna_pixmap_from_drawable(drawable);
+
+	if (priv == NULL)
+		return true;
+
+	return priv->gpu_bo == NULL && priv->cpu_bo == NULL;
+}
+
+static inline Bool
 picture_is_gpu(PicturePtr picture)
 {
 	if (!picture || !picture->pDrawable)


More information about the xorg-commit mailing list