xf86-video-intel: 2 commits - src/sna/gen3_render.c src/sna/sna_blt.c src/sna/sna_display.c src/sna/sna_dri.c src/sna/sna_render.c src/sna/sna_video.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Jun 23 08:00:56 PDT 2011


 src/sna/gen3_render.c |   23 +++++++++++++++--------
 src/sna/sna_blt.c     |   10 ++++++++--
 src/sna/sna_display.c |    2 +-
 src/sna/sna_dri.c     |   34 +++++++++++++++++++++++++++-------
 src/sna/sna_render.c  |   44 +++++++++++++++++++++++++++++---------------
 src/sna/sna_video.c   |    2 +-
 6 files changed, 81 insertions(+), 34 deletions(-)

New commits:
commit 33d3077266942b23c5bc05ef4a9a6cebe357272a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jun 23 15:53:45 2011 +0100

    sna: Debug compile fix, and some extra comments
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index c40718b..1252ba4 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -3394,7 +3394,7 @@ gen3_render_copy(struct sna *sna, uint8_t alu,
 	return sna_blt_copy(sna, alu,
 			    src_bo, dst_bo,
 			    dst->drawable.bitsPerPixel,
-			    op);
+			    tmp);
 #endif
 
 	/* Prefer to use the BLT */
@@ -3499,8 +3499,8 @@ gen3_render_fill_boxes(struct sna *sna,
 					      box, n);
 #endif
 
-	DBG(("%s (op=%d, color=(%04x,%04x,%04x, %04x))\n",
-	     __FUNCTION__, op,
+	DBG(("%s (op=%d, format=%x, color=(%04x,%04x,%04x, %04x))\n",
+	     __FUNCTION__, op, (int)format,
 	     color->red, color->green, color->blue, color->alpha));
 
 	if (op >= ARRAY_SIZE(gen3_blend_op)) {
@@ -3511,7 +3511,8 @@ gen3_render_fill_boxes(struct sna *sna,
 
 	if (dst->drawable.width > 2048 ||
 	    dst->drawable.height > 2048 ||
-	    dst_bo->pitch > 8192)
+	    dst_bo->pitch > 8192 ||
+	    !gen3_check_dst_format(format))
 		return gen3_render_fill_boxes_try_blt(sna, op, format, color,
 						      dst, dst_bo,
 						      box, n);
@@ -3529,6 +3530,12 @@ gen3_render_fill_boxes(struct sna *sna,
 				     PICT_a8r8g8b8))
 		return FALSE;
 
+	DBG(("%s: using shader for op=%d, format=%x, pixel=%x\n",
+	     __FUNCTION__, op, (int)format, pixel));
+
+	if (pixel == 0)
+		op = PictOpClear;
+
 	memset(&tmp, 0, sizeof(tmp));
 	tmp.op = op;
 	tmp.dst.pixmap = dst;
@@ -3538,7 +3545,7 @@ gen3_render_fill_boxes(struct sna *sna,
 	tmp.dst.bo = dst_bo;
 	tmp.floats_per_vertex = 2;
 
-	tmp.src.gen3.type = SHADER_CONSTANT;
+	tmp.src.gen3.type = op == PictOpClear ? SHADER_ZERO : SHADER_CONSTANT;
 	tmp.src.gen3.mode = pixel;
 
 	if (!kgem_check_bo(&sna->kgem, dst_bo))
@@ -3556,8 +3563,8 @@ gen3_render_fill_boxes(struct sna *sna,
 		n -= n_this_time;
 
 		do {
-			DBG(("	(%d, %d), (%d, %d)\n",
-			     box->x1, box->y1, box->x2, box->y2));
+			DBG(("	(%d, %d), (%d, %d): %x\n",
+			     box->x1, box->y1, box->x2, box->y2, pixel));
 			OUT_VERTEX(box->x2);
 			OUT_VERTEX(box->y2);
 			OUT_VERTEX(box->x1);
@@ -3608,7 +3615,7 @@ gen3_render_fill(struct sna *sna, uint8_t alu,
 	return sna_blt_fill(sna, alu,
 			    dst_bo, dst->drawable.bitsPerPixel,
 			    color,
-			    op);
+			    tmp);
 #endif
 
 	/* Prefer to use the BLT if already engaged */
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index 3d350b1..35fdc12 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -1155,8 +1155,11 @@ Bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu,
 	DBG(("%s (%d, %08x, %d) x %d\n",
 	     __FUNCTION__, bpp, color, alu, nbox));
 
-	if (bo->tiling == I915_TILING_Y)
+	if (bo->tiling == I915_TILING_Y) {
+		DBG(("%s: fallback -- dst uses Y-tiling\n",
+		     __FUNCTION__));
 		return FALSE;
+	}
 
 	cmd = XY_COLOR_BLT_CMD;
 	if (bpp == 32)
@@ -1167,8 +1170,11 @@ Bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu,
 		cmd |= BLT_DST_TILED;
 		br13 >>= 2;
 	}
-	if (br13 > MAXSHORT)
+	if (br13 > MAXSHORT) {
+		DBG(("%s: fallback -- pitch is too large %d [%d]\n",
+		     __FUNCTION__, bo->pitch, br13));
 		return FALSE;
+	}
 
 	br13 |= fill_ROP[alu] << 16;
 	switch (bpp) {
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 42e3f59..cb1beba 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -818,7 +818,7 @@ sna_crtc_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num)
 	list_add(&sna_crtc->link, &mode->crtcs);
 
 	DBG(("%s: attached crtc[%d] id=%d, pipe=%d\n",
-	     __FUNCTION__, num, sna_crtc->mode_crtc->crtc_id, sna_crtc->pipe));
+	     __FUNCTION__, num, sna_crtc->id, sna_crtc->pipe));
 }
 
 static Bool
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index f025607..d4a3e3f 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -388,16 +388,18 @@ sna_dri_copy_region(DrawablePtr draw,
 	int16_t dx, dy;
 
 	DBG(("%s(region=(%d, %d), (%d, %d)))\n", __FUNCTION__,
-	     region ? REGION_EXTENTS(NULL, region)->x1 : 0,
-	     region ? REGION_EXTENTS(NULL, region)->y1 : 0,
-	     region ? REGION_EXTENTS(NULL, region)->x2 : draw->width,
-	     region ? REGION_EXTENTS(NULL, region)->y2 : draw->height));
+	     REGION_EXTENTS(NULL, region)->x1,
+	     REGION_EXTENTS(NULL, region)->y1,
+	     REGION_EXTENTS(NULL, region)->x2,
+	     REGION_EXTENTS(NULL, region)->y2));
 
-	DBG(("%s: dst -- attachment=%d, name=%d, handle=%d\n",
+	DBG(("%s: draw (%d, %d)\n", __FUNCTION__, draw->x, draw->y));
+	DBG(("%s: dst -- attachment=%d, name=%d, handle=%d [screen %d]\n",
 	     __FUNCTION__,
 	     dst_buffer->attachment,
 	     dst_buffer->name,
-	     dst_priv->bo->handle));
+	     dst_priv->bo->handle,
+	     sna_pixmap(sna->front)->gpu_bo->handle));
 	DBG(("%s: src -- attachment=%d, name=%d, handle=%d\n",
 	     __FUNCTION__,
 	     src_buffer->attachment,
@@ -407,6 +409,9 @@ sna_dri_copy_region(DrawablePtr draw,
 	if (draw->type == DRAWABLE_WINDOW) {
 		WindowPtr win = (WindowPtr)draw;
 
+		DBG(("%s: draw=(%d, %d), delta=(%d, %d)\n",
+		     __FUNCTION__, draw->x, draw->y,
+		     get_drawable_dx(draw), get_drawable_dy(draw)));
 		pixman_region_translate(region, draw->x, draw->y);
 
 		pixman_region_init(&clip);
@@ -418,8 +423,23 @@ sna_dri_copy_region(DrawablePtr draw,
 		region = &clip;
 
 		get_drawable_deltas(draw, dst, &dx, &dy);
-	} else
+
+		DBG(("%s clipped=(%d, %d), (%d, %d)x%d\n", __FUNCTION__,
+		     REGION_EXTENTS(NULL, region)->x1,
+		     REGION_EXTENTS(NULL, region)->y1,
+		     REGION_EXTENTS(NULL, region)->x2,
+		     REGION_EXTENTS(NULL, region)->y2,
+		     REGION_NUM_RECTS(region)));
+
+		if (dst_buffer->attachment == DRI2BufferFrontLeft) {
+			assert(dst == sna->front);
+			assert(dst_priv->bo == sna_pixmap(sna->front)->gpu_bo);
+		}
+	} else {
+		assert(draw->x == 0);
+		assert(draw->y == 0);
 		dx = dy = 0;
+	}
 
 	assert(sna_pixmap(src)->cpu_damage == NULL);
 	assert(sna_pixmap(dst)->cpu_damage == NULL);
diff --git a/src/sna/sna_video.c b/src/sna/sna_video.c
index 7f520da..c0b1451 100644
--- a/src/sna/sna_video.c
+++ b/src/sna/sna_video.c
@@ -482,7 +482,7 @@ sna_video_copy_data(struct sna *sna,
 	if (frame->bo == NULL)
 		return FALSE;
 
-	/* In the common case, we can simply the upload to a single pwrite */
+	/* In the common case, we can simply the upload in a single pwrite */
 	if (video->rotation == RR_Rotate_0) {
 		if (is_planar_fourcc(frame->id)) {
 			uint16_t pitch[2] = {
commit 03e6aee8fd2cc7486fbd2ec55a537c712786486b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jun 23 15:51:59 2011 +0100

    sna: For an unbounded op, we need to convert the whole surface
    
    Otherwise if we fail to check, then we create a 0x0 surface to sample
    with the operation -- net result is that we end up using a clear source
    instead of the desired mask.
    
    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 c89be51..b05689d 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -714,28 +714,36 @@ sna_render_picture_convert(struct sna *sna,
 	return -1;
 #endif
 
-	box.x1 = x;
-	box.y1 = y;
-	box.x2 = x + w;
-	box.y2 = y + h;
+	if (w != 0 && h != 0) {
+		box.x1 = x;
+		box.y1 = y;
+		box.x2 = x + w;
+		box.y2 = y + h;
 
-	if (channel->transform) {
-		DBG(("%s: has transform, uploading whole surface\n",
+		if (channel->transform) {
+			DBG(("%s: has transform, converting whole surface\n",
+			     __FUNCTION__));
+			box.x1 = box.y1 = 0;
+			box.x2 = pixmap->drawable.width;
+			box.y2 = pixmap->drawable.height;
+		}
+
+		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 {
+		DBG(("%s: op no bounds, converting whole surface\n",
 		     __FUNCTION__));
 		box.x1 = box.y1 = 0;
 		box.x2 = pixmap->drawable.width;
 		box.y2 = pixmap->drawable.height;
 	}
 
-	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;
 	h = box.y2 - box.y1;
 
@@ -744,6 +752,12 @@ sna_render_picture_convert(struct sna *sna,
 	     pixmap->drawable.width,
 	     pixmap->drawable.height));
 
+	if (w == 0 || h == 0) {
+		DBG(("%s: sample extents lie outside of source, using clear\n",
+		     __FUNCTION__));
+		return 0;
+	}
+
 	sna_pixmap_move_to_cpu(pixmap, false);
 
 	src = pixman_image_create_bits(picture->format,


More information about the xorg-commit mailing list