xf86-video-intel: src/sna/sna_render.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Aug 24 03:08:59 PDT 2011


 src/sna/sna_render.c |   65 +++++++++++++++++++++++++++------------------------
 1 file changed, 35 insertions(+), 30 deletions(-)

New commits:
commit ef52f6c8c3421a31552d5965c40b4d9cf68f6a5c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Aug 24 11:04:28 2011 +0100

    sna/render: allow CLAMP_TO_EDGE for outside samples of extract regions as well
    
    When clipping the sample region to the edge of the texture we can also
    allow the GPU to use CLAMP_TO_EDGE (as well as CLAMP_TO_BORDER) to
    emulate the RepeatPad mode of the parent texture. (Only the
    RepeatNormal, RepeatReflect need special treatment with regard to tiling
    that is not yet handled.)
    
    This fixes the recent performance regression due to a slight change in
    the fish benchmark that caused it to sample outside of the texture atlas
    for one of its little fish.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 113f9ec..41e7694 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -351,16 +351,7 @@ sna_render_pixmap_bo(struct sna *sna,
 		box.x2 = x + w;
 		box.y2 = y + h;
 
-		if (channel->repeat != RepeatNone) {
-			if (box.x1 < 0 ||
-			    box.y1 < 0 ||
-			    box.x2 > pixmap->drawable.width ||
-			    box.y2 > pixmap->drawable.height) {
-				box.x1 = box.y1 = 0;
-				box.x2 = pixmap->drawable.width;
-				box.y2 = pixmap->drawable.height;
-			}
-		} else {
+		if (channel->repeat == RepeatNone || channel->repeat == RepeatPad) {
 			if (box.x1 < 0)
 				box.x1 = 0;
 			if (box.y1 < 0)
@@ -369,6 +360,15 @@ sna_render_pixmap_bo(struct sna *sna,
 				box.x2 = pixmap->drawable.width;
 			if (box.y2 > pixmap->drawable.height)
 				box.y2 = pixmap->drawable.height;
+		} else {
+			if (box.x1 < 0 ||
+			    box.y1 < 0 ||
+			    box.x2 > pixmap->drawable.width ||
+			    box.y2 > pixmap->drawable.height) {
+				box.x1 = box.y1 = 0;
+				box.x2 = pixmap->drawable.width;
+				box.y2 = pixmap->drawable.height;
+			}
 		}
 	}
 
@@ -468,7 +468,16 @@ static int sna_render_picture_downsample(struct sna *sna,
 		oy = v.vector[1] / v.vector[2];
 	}
 
-	if (channel->repeat != RepeatNone) {
+	if (channel->repeat == RepeatNone || channel->repeat == RepeatPad) {
+		if (box.x1 < 0)
+			box.x1 = 0;
+		if (box.y1 < 0)
+			box.y1 = 0;
+		if (box.x2 > pixmap->drawable.width)
+			box.x2 = pixmap->drawable.width;
+		if (box.y2 > pixmap->drawable.height)
+			box.y2 = pixmap->drawable.height;
+	} else {
 		if (box.x1 < 0 ||
 		    box.y1 < 0 ||
 		    box.x2 > pixmap->drawable.width ||
@@ -488,15 +497,6 @@ static int sna_render_picture_downsample(struct sna *sna,
 								dst_x, dst_y);
 			}
 		}
-	} else {
-		if (box.x1 < 0)
-			box.x1 = 0;
-		if (box.y1 < 0)
-			box.y1 = 0;
-		if (box.x2 > pixmap->drawable.width)
-			box.x2 = pixmap->drawable.width;
-		if (box.y2 > pixmap->drawable.height)
-			box.y2 = pixmap->drawable.height;
 	}
 
 	w = box.x2 - box.x1;
@@ -704,7 +704,21 @@ sna_render_picture_extract(struct sna *sna,
 		oy = v.vector[1] / v.vector[2];
 	}
 
-	if (channel->repeat != RepeatNone) {
+	DBG(("%s sample=(%d, %d), (%d, %d): (%d, %d)/(%d, %d), repeat=%d\n", __FUNCTION__,
+	     box.x1, box.y1, box.x2, box.y2, w, h,
+	     pixmap->drawable.width, pixmap->drawable.height,
+	     channel->repeat));
+
+	if (channel->repeat == RepeatNone || channel->repeat == RepeatPad) {
+		if (box.x1 < 0)
+			box.x1 = 0;
+		if (box.y1 < 0)
+			box.y1 = 0;
+		if (box.x2 > pixmap->drawable.width)
+			box.x2 = pixmap->drawable.width;
+		if (box.y2 > pixmap->drawable.height)
+			box.y2 = pixmap->drawable.height;
+	} else {
 		if (box.x1 < 0 ||
 		    box.y1 < 0 ||
 		    box.x2 > pixmap->drawable.width ||
@@ -724,15 +738,6 @@ sna_render_picture_extract(struct sna *sna,
 								dst_x, dst_y);
 			}
 		}
-	} else {
-		if (box.x1 < 0)
-			box.x1 = 0;
-		if (box.y1 < 0)
-			box.y1 = 0;
-		if (box.x2 > pixmap->drawable.width)
-			box.x2 = pixmap->drawable.width;
-		if (box.y2 > pixmap->drawable.height)
-			box.y2 = pixmap->drawable.height;
 	}
 
 	w = box.x2 - box.x1;


More information about the xorg-commit mailing list