xf86-video-intel: 3 commits - src/sna/gen4_render.c src/sna/sna_accel.c src/sna/sna_composite.c src/sna/sna_display.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Jul 31 09:49:03 PDT 2012


 src/sna/gen4_render.c   |   81 +++++++++++++++---------------------------------
 src/sna/sna_accel.c     |    5 ++
 src/sna/sna_composite.c |   47 ++++++++++++++++-----------
 src/sna/sna_display.c   |   17 +++++++---
 4 files changed, 71 insertions(+), 79 deletions(-)

New commits:
commit 6a5ed88f9fab654c9c11c566b841d42150d26c5d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jul 30 17:08:20 2012 +0100

    sna/gen4: Tidy debugging code
    
    Cluster the ifdefs together in the initialisation code.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index 64fd7df..d1dbf5a 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -55,7 +55,9 @@
 #define NO_COPY 0
 #define NO_COPY_BOXES 0
 #define NO_FILL 0
+#define NO_FILL_ONE 0
 #define NO_FILL_BOXES 0
+#define NO_VIDEO 0
 
 #if FLUSH_EVERY_VERTEX
 #define FLUSH(OP) do { \
@@ -1206,6 +1208,7 @@ gen4_get_batch(struct sna *sna)
 static void
 gen4_align_vertex(struct sna *sna, const struct sna_composite_op *op)
 {
+	assert(op->floats_per_rect == 3*op->floats_per_vertex);
 	if (op->floats_per_vertex != sna->render_state.gen4.floats_per_vertex) {
 		if (sna->render.vertex_size - sna->render.vertex_used < 2*op->floats_per_rect)
 			gen4_vertex_finish(sna);
@@ -2271,17 +2274,6 @@ gen4_render_composite(struct sna *sna,
 	if (op >= ARRAY_SIZE(gen4_blend_op))
 		return false;
 
-#if NO_COMPOSITE
-	if (mask)
-		return false;
-
-	return sna_blt_composite(sna, op,
-				 src, dst,
-				 src_x, src_y,
-				 dst_x, dst_y,
-				 width, height, tmp);
-#endif
-
 	if (mask == NULL &&
 	    try_blt(sna, dst, src, width, height) &&
 	    sna_blt_composite(sna, op,
@@ -2819,17 +2811,6 @@ gen4_render_copy_boxes(struct sna *sna, uint8_t alu,
 
 	DBG(("%s x %d\n", __FUNCTION__, n));
 
-#if NO_COPY_BOXES
-	if (!sna_blt_compare_depth(&src->drawable, &dst->drawable))
-		return false;
-
-	return sna_blt_copy_boxes(sna, alu,
-				  src_bo, src_dx, src_dy,
-				  dst_bo, dst_dx, dst_dy,
-				  dst->drawable.bitsPerPixel,
-				  box, n);
-#endif
-
 	if (prefer_blt_copy(sna, flags) &&
 	    sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
 	    sna_blt_copy_boxes(sna, alu,
@@ -3007,16 +2988,6 @@ gen4_render_copy(struct sna *sna, uint8_t alu,
 	     dst->drawable.serialNumber,
 	     alu));
 
-#if NO_COPY
-	if (!sna_blt_compare_depth(&src->drawable, &dst->drawable))
-		return false;
-
-	return sna_blt_copy(sna, alu,
-			    src_bo, dst_bo,
-			    dst->drawable.bitsPerPixel,
-			    op);
-#endif
-
 	if (prefer_blt(sna) &&
 	    sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
 	    sna_blt_copy(sna, alu,
@@ -3194,18 +3165,15 @@ gen4_render_fill_boxes(struct sna *sna,
 						     dst, dst_bo, box, n);
 	}
 
-#if NO_FILL_BOXES
-	return false;
-#endif
-
-	if (op == PictOpClear)
+	if (op == PictOpClear) {
 		pixel = 0;
-	else if (!sna_get_pixel_from_rgba(&pixel,
-					  color->red,
-					  color->green,
-					  color->blue,
-					  color->alpha,
-					  PICT_a8r8g8b8))
+		op = PictOpSrc;
+	} else if (!sna_get_pixel_from_rgba(&pixel,
+					    color->red,
+					    color->green,
+					    color->blue,
+					    color->alpha,
+					    PICT_a8r8g8b8))
 		return false;
 
 	DBG(("%s(%08x x %d)\n", __FUNCTION__, pixel, n));
@@ -3295,13 +3263,6 @@ gen4_render_fill(struct sna *sna, uint8_t alu,
 		 uint32_t color,
 		 struct sna_fill_op *op)
 {
-#if NO_FILL
-	return sna_blt_fill(sna, alu,
-			    dst_bo, dst->drawable.bitsPerPixel,
-			    color,
-			    op);
-#endif
-
 	if (prefer_blt(sna) &&
 	    sna_blt_fill(sna, alu,
 			 dst_bo, dst->drawable.bitsPerPixel,
@@ -3392,11 +3353,6 @@ gen4_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo,
 
 	DBG(("%s: color=%08x\n", __FUNCTION__, color));
 
-#if NO_FILL_ONE
-	return gen4_render_fill_one_try_blt(sna, dst, bo, color,
-					    x1, y1, x2, y2, alu);
-#endif
-
 	if (gen4_render_fill_one_try_blt(sna, dst, bo, color,
 					 x1, y1, x2, y2, alu))
 		return true;
@@ -3755,19 +3711,34 @@ bool gen4_render_init(struct sna *sna)
 	sna->kgem.retire = gen4_render_retire;
 	sna->kgem.expire = gen4_render_expire;
 
+#if !NO_COMPOSITE
 	sna->render.composite = gen4_render_composite;
+#endif
 #if !NO_COMPOSITE_SPANS
 	sna->render.check_composite_spans = gen4_check_composite_spans;
 	sna->render.composite_spans = gen4_render_composite_spans;
 #endif
+
+#if !NO_VIDEO
 	sna->render.video = gen4_render_video;
+#endif
 
+#if !NO_COPY_BOXES
 	sna->render.copy_boxes = gen4_render_copy_boxes;
+#endif
+#if !NO_COPY
 	sna->render.copy = gen4_render_copy;
+#endif
 
+#if !NO_FILL_BOXES
 	sna->render.fill_boxes = gen4_render_fill_boxes;
+#endif
+#if !NO_FILL
 	sna->render.fill = gen4_render_fill;
+#endif
+#if !NO_FILL_ONE
 	sna->render.fill_one = gen4_render_fill_one;
+#endif
 
 	sna->render.flush = gen4_render_flush;
 	sna->render.reset = gen4_render_reset;
commit 46ec9b0ed55d0fcade40f92206e59c02e402d870
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jul 31 17:41:34 2012 +0100

    sna: Update DPMS mode on CRTC after forcing the outputs on
    
    If we forcibly update the outputs to be on, then the core will not issue
    its on DPMS event and we miss out on updating the CRTC bookkeeping in
    sna_crtc_dpms(). So we need to update the flag on the CRTC as we
    manipulate the outputs during modesetting.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=52142
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index a908596..7754efa 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -499,6 +499,8 @@ sna_crtc_force_outputs_on(xf86CrtcPtr crtc)
 
 		output->funcs->dpms(output, DPMSModeOn);
 	}
+
+	to_sna_crtc(crtc)->dpms_mode = DPMSModeOn;
 }
 
 static bool
@@ -663,14 +665,21 @@ static void update_flush_interval(struct sna *sna)
 	int i, max_vrefresh = 0;
 
 	for (i = 0; i < xf86_config->num_crtc; i++) {
-		if (!xf86_config->crtc[i]->enabled)
+		xf86CrtcPtr crtc = xf86_config->crtc[i];
+
+		if (!crtc->enabled) {
+			DBG(("%s: CRTC:%d (pipe %d) disabled\n",
+			     __FUNCTION__,i, to_sna_crtc(crtc)->pipe));
 			continue;
+		}
 
-		if (to_sna_crtc(xf86_config->crtc[i])->dpms_mode != DPMSModeOn)
+		if (to_sna_crtc(crtc)->dpms_mode != DPMSModeOn) {
+			DBG(("%s: CRTC:%d (pipe %d) turned off\n",
+			     __FUNCTION__,i, to_sna_crtc(crtc)->pipe));
 			continue;
+		}
 
-		max_vrefresh = max(max_vrefresh,
-				   xf86ModeVRefresh(&xf86_config->crtc[i]->mode));
+		max_vrefresh = max(max_vrefresh, xf86ModeVRefresh(&crtc->mode));
 	}
 
 	if (max_vrefresh == 0)
commit 8f166d26b8a93592939068c5a8d160981c724cfd
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jul 31 11:58:24 2012 +0100

    sna: Be more careful with damage reduction during CompositeRectangles
    
    We actually need to force DAMAGE_ALL in case we are promoting the GPU
    pixmap.
    
    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 d2fd298..a4287f7 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -314,9 +314,12 @@ static void assert_pixmap_damage(PixmapPtr p)
 	if (priv == NULL)
 		return;
 
-	if (DAMAGE_IS_ALL(priv->gpu_damage) && DAMAGE_IS_ALL(priv->cpu_damage))
+	if (DAMAGE_IS_ALL(priv->gpu_damage) && DAMAGE_IS_ALL(priv->cpu_damage)) {
 		/* special upload buffer */
+		assert(priv->gpu_bo && priv->gpu_bo->proxy);
+		assert(priv->cpu_bo == NULL);
 		return;
+	}
 
 	assert(!DAMAGE_IS_ALL(priv->gpu_damage) || priv->cpu_damage == NULL);
 	assert(!DAMAGE_IS_ALL(priv->cpu_damage) || priv->gpu_damage == NULL);
diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c
index 36287c6..0ca66c7 100644
--- a/src/sna/sna_composite.c
+++ b/src/sna/sna_composite.c
@@ -855,25 +855,34 @@ sna_composite_rectangles(CARD8		 op,
 	/* Clearing a pixmap after creation is a common operation, so take
 	 * advantage and reduce further damage operations.
 	 */
-	if (op <= PictOpSrc &&
-	    region_subsumes_drawable(&region, &pixmap->drawable)) {
-		bool ok;
-
-		assert(DAMAGE_IS_ALL(priv->gpu_damage));
-
-		priv->undamaged = false;
-		priv->clear_color = 0;
-		ok = true;
-		if (op == PictOpSrc)
-			ok = sna_get_pixel_from_rgba(&priv->clear_color,
-						     color->red,
-						     color->green,
-						     color->blue,
-						     color->alpha,
-						     dst->format);
-		priv->clear = ok;
-		DBG(("%s: marking clear [%08x]? %d\n",
-		     __FUNCTION__, priv->clear_color, ok));
+	if (region_subsumes_drawable(&region, &pixmap->drawable)) {
+		if (damage) {
+			sna_damage_all(damage,
+				       pixmap->drawable.width,
+				       pixmap->drawable.height);
+			sna_damage_destroy(damage == &priv->gpu_damage ?
+					   &priv->cpu_damage : &priv->gpu_damage);
+			priv->undamaged = false;
+		}
+
+		if (op <= PictOpSrc && bo == priv->gpu_bo) {
+			bool ok;
+
+			assert(DAMAGE_IS_ALL(priv->gpu_damage));
+
+			priv->clear_color = 0;
+			ok = true;
+			if (op == PictOpSrc)
+				ok = sna_get_pixel_from_rgba(&priv->clear_color,
+							     color->red,
+							     color->green,
+							     color->blue,
+							     color->alpha,
+							     dst->format);
+			priv->clear = ok;
+			DBG(("%s: marking clear [%08x]? %d\n",
+			     __FUNCTION__, priv->clear_color, ok));
+		}
 	}
 	goto done;
 


More information about the xorg-commit mailing list