xf86-video-intel: 3 commits - 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

Chris Wilson ickle at kemper.freedesktop.org
Thu Jun 13 08:12:16 PDT 2013


 src/sna/gen3_render.c |    1 
 src/sna/gen4_render.c |    2 +
 src/sna/gen5_render.c |    2 +
 src/sna/gen6_render.c |    6 +++--
 src/sna/gen7_render.c |   54 +++++++++++++++++++++++++++++---------------------
 src/sna/sna_accel.c   |    6 ++++-
 6 files changed, 46 insertions(+), 25 deletions(-)

New commits:
commit 8f340f90f4b2f269d6308d0bd31fbc2a5f579608
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jun 13 16:08:49 2013 +0100

    sna/gen7: Set sampler swizzle for video sources
    
    Otherwise the sampler on Haswell will just read all zeros when trying to
    playback a video.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65699
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 1212975..20dc6d8 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -1638,33 +1638,41 @@ gen7_composite_create_blend_state(struct sna_static_stream *stream)
 }
 
 static uint32_t gen7_bind_video_source(struct sna *sna,
-				       struct kgem_bo *src_bo,
-				       uint32_t src_offset,
-				       int src_width,
-				       int src_height,
-				       int src_pitch,
-				       uint32_t src_surf_format)
+				       struct kgem_bo *bo,
+				       uint32_t offset,
+				       int width,
+				       int height,
+				       int pitch,
+				       uint32_t format)
 {
-	struct gen7_surface_state *ss;
+	uint32_t *ss, bind;
 
-	sna->kgem.surface -= sizeof(struct gen7_surface_state) / sizeof(uint32_t);
+	bind = sna->kgem.surface -=
+		sizeof(struct gen7_surface_state) / sizeof(uint32_t);
 
-	ss = memset(sna->kgem.batch + sna->kgem.surface, 0, sizeof(*ss));
-	ss->ss0.surface_type = GEN7_SURFACE_2D;
-	ss->ss0.surface_format = src_surf_format;
+	assert(bo->tiling == I915_TILING_NONE);
 
-	ss->ss1.base_addr =
-		kgem_add_reloc(&sna->kgem,
-			       sna->kgem.surface + 1,
-			       src_bo,
+	ss = sna->kgem.batch + bind;
+	ss[0] = (GEN7_SURFACE_2D << GEN7_SURFACE_TYPE_SHIFT |
+		 format << GEN7_SURFACE_FORMAT_SHIFT);
+	ss[1] = kgem_add_reloc(&sna->kgem, bind + 1, bo,
 			       I915_GEM_DOMAIN_SAMPLER << 16,
-			       src_offset);
+			       offset);
+	ss[2] = ((width - 1)  << GEN7_SURFACE_WIDTH_SHIFT |
+		 (height - 1) << GEN7_SURFACE_HEIGHT_SHIFT);
+	ss[3] = (pitch - 1) << GEN7_SURFACE_PITCH_SHIFT;
+	ss[4] = 0;
+	ss[5] = 0;
+	ss[6] = 0;
+	ss[7] = 0;
+	if (sna->kgem.gen == 075)
+		ss[7] |= HSW_SURFACE_SWIZZLE(RED, GREEN, BLUE, ALPHA);
 
-	ss->ss2.width  = src_width - 1;
-	ss->ss2.height = src_height - 1;
-	ss->ss3.pitch  = src_pitch - 1;
+	DBG(("[%x] bind bo(handle=%d, addr=%d), format=%d, width=%d, height=%d, pitch=%d, offset=%d\n",
+	     bind, bo->handle, ss[1],
+	     format, width, height, pitch, offset));
 
-	return sna->kgem.surface * sizeof(uint32_t);
+	return bind * sizeof(uint32_t);
 }
 
 static void gen7_emit_video_state(struct sna *sna,
commit 5f20be82563176c45a31a9676b68a3455566bc67
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jun 13 11:18:42 2013 +0100

    sna/gen2+: Promote a conditional dirty into an assertion
    
    If the target bo is not bound when we start to emit the composite state
    for the operation, we are screwed.
    
    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 94cd541..3c30623 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -1975,6 +1975,7 @@ static void gen3_emit_target(struct sna *sna,
 
 		state->current_dst = bo->unique_id;
 	}
+	assert(bo->exec);
 	kgem_bo_mark_dirty(bo);
 }
 
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index e94fb6d..addd838 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -1014,6 +1014,8 @@ gen4_emit_state(struct sna *sna,
 {
 	bool flush;
 
+	assert(op->dst.bo->exec);
+
 	flush = wm_binding_table & 1;
 	if (kgem_bo_is_dirty(op->src.bo) || kgem_bo_is_dirty(op->mask.bo)) {
 		DBG(("%s: flushing dirty (%d, %d), forced? %d\n", __FUNCTION__,
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index 2de7eb8..5870c02 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -1009,6 +1009,8 @@ gen5_emit_state(struct sna *sna,
 		const struct sna_composite_op *op,
 		uint16_t offset)
 {
+	assert(op->dst.bo->exec);
+
 	if (kgem_bo_is_dirty(op->src.bo) || kgem_bo_is_dirty(op->mask.bo)) {
 		DBG(("%s: flushing dirty (%d, %d)\n", __FUNCTION__,
 		     kgem_bo_is_dirty(op->src.bo),
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 4279538..007d2ff 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -862,6 +862,8 @@ gen6_emit_state(struct sna *sna,
 {
 	bool need_stall = wm_binding_table & 1;
 
+	assert(op->dst.bo->exec);
+
 	if (gen6_emit_cc(sna, GEN6_BLEND(op->u.gen6.flags)))
 		need_stall = false;
 	gen6_emit_sampler(sna, GEN6_SAMPLER(op->u.gen6.flags));
@@ -875,8 +877,8 @@ gen6_emit_state(struct sna *sna,
 	if (kgem_bo_is_dirty(op->src.bo) || kgem_bo_is_dirty(op->mask.bo)) {
 		gen6_emit_flush(sna);
 		kgem_clear_dirty(&sna->kgem);
-		if (op->dst.bo->exec)
-			kgem_bo_mark_dirty(op->dst.bo);
+		assert(op->dst.bo->exec);
+		kgem_bo_mark_dirty(op->dst.bo);
 		need_stall = false;
 	}
 	if (need_stall) {
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 901a12c..1212975 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -1048,6 +1048,8 @@ gen7_emit_state(struct sna *sna,
 {
 	bool need_stall;
 
+	assert(op->dst.bo->exec);
+
 	if (sna->render_state.gen7.emit_flush)
 		gen7_emit_pipe_flush(sna);
 
@@ -1063,8 +1065,8 @@ gen7_emit_state(struct sna *sna,
 	if (kgem_bo_is_dirty(op->src.bo) || kgem_bo_is_dirty(op->mask.bo)) {
 		gen7_emit_pipe_invalidate(sna);
 		kgem_clear_dirty(&sna->kgem);
-		if (op->dst.bo->exec)
-			kgem_bo_mark_dirty(op->dst.bo);
+		assert(op->dst.bo->exec);
+		kgem_bo_mark_dirty(op->dst.bo);
 		need_stall = false;
 	}
 	if (need_stall)
commit 6655cc1d9735a8433994c762583753b12e2125b4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 12 18:44:27 2013 +0100

    sna: Do not enlarge the read back region if there is already CPU damage
    
    We enlarge the read back into to minimise the number of times we have to
    migrate pixmap data. However, if we then enlarge the read so that it
    overwrites CPU dirty data, then we can introduce corruption.
    
    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 1663fe3..5d96ac5 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2451,7 +2451,11 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 			if (flags & MOVE_WRITE) {
 				int n = RegionNumRects(region), i;
 				BoxPtr boxes = RegionRects(region);
-				BoxPtr blocks = malloc(sizeof(BoxRec) * RegionNumRects(region));
+				BoxPtr blocks;
+
+				blocks = NULL;
+				if (priv->cpu_damage == NULL)
+					blocks = malloc(sizeof(BoxRec) * RegionNumRects(region));
 				if (blocks) {
 					for (i = 0; i < n; i++) {
 						blocks[i].x1 = boxes[i].x1 & ~31;


More information about the xorg-commit mailing list