xf86-video-intel: 4 commits - src/i830_accel.c src/i830_batchbuffer.c src/i830_batchbuffer.h src/i830_dri.c src/i830_driver.c src/i830.h src/i830_uxa.c src/i965_render.c src/i965_video.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Dec 2 12:57:52 PST 2009


 src/i830.h             |    3 ++-
 src/i830_accel.c       |   16 +---------------
 src/i830_batchbuffer.c |   40 +++++++++++++++++++++++++++-------------
 src/i830_batchbuffer.h |    6 +++---
 src/i830_dri.c         |    4 ++--
 src/i830_driver.c      |    9 +++++----
 src/i830_uxa.c         |    4 ++--
 src/i965_render.c      |    4 ++--
 src/i965_video.c       |    4 ++--
 9 files changed, 46 insertions(+), 44 deletions(-)

New commits:
commit a938673ee84d51ef655c37dfa7bbc5c35334cd28
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Dec 2 20:51:53 2009 +0000

    batch: Downgrade batch submission from a FatalError.
    
    If we wedge the GPU then we will return -EIO for the current batch and
    then attempt to reset the GPU. Meanwhile the X server detects the error,
    throws a FatalError and to all intents and purposes appears to crash to
    the user - whereas before it often just appeared to momentarily freeze.
    Of course, on older hardware the server remains frozen until we can find
    a way to reset those GPUs at runtime.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c
index 9d691d1..12e044a 100644
--- a/src/i830_batchbuffer.c
+++ b/src/i830_batchbuffer.c
@@ -160,7 +160,9 @@ void intel_batch_flush(ScrnInfoPtr scrn)
 	    dri_bo_exec(intel->batch_bo, intel->batch_used, NULL, 0,
 			0xffffffff);
 	if (ret != 0)
-		FatalError("Failed to submit batchbuffer: %s\n",
+		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+			   "Failed to submit batch buffer, expect rendering corruption "
+			   "or even a frozen display: %s.\n",
 			   strerror(-ret));
 
 	while (!list_is_empty(&intel->batch_pixmaps)) {
commit 98e11210367c950e3f932419d2a4722cf971885d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Dec 2 20:48:37 2009 +0000

    Remove flush parameter from intel_batch_flush()
    
    There is only a single caller that wishes to forcibly append a flush
    into the batch: intel_sync(). So move the logic there.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830_accel.c b/src/i830_accel.c
index 0f922a8..509d652 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -51,20 +51,6 @@ unsigned long intel_get_pixmap_pitch(PixmapPtr pixmap)
 	return (unsigned long)pixmap->devKind;
 }
 
-void intel_sync(ScrnInfoPtr scrn)
-{
-	intel_screen_private *intel = intel_get_screen_private(scrn);
-
-	if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL | DEBUG_VERBOSE_SYNC))
-		ErrorF("I830Sync\n");
-
-	if (!scrn->vtSema || !intel->batch_bo || !intel->batch_ptr)
-		return;
-
-	intel_batch_flush(scrn, TRUE);
-	intel_batch_wait_last(scrn);
-}
-
 void i830_debug_flush(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
@@ -73,7 +59,7 @@ void i830_debug_flush(ScrnInfoPtr scrn)
 		intel_batch_pipelined_flush(scrn);
 
 	if (intel->debug_flush & DEBUG_FLUSH_BATCHES)
-		intel_batch_flush(scrn, FALSE);
+		intel_batch_flush(scrn);
 }
 
 /* The following function sets up the supported acceleration. Call it
diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c
index e1537ae..9d691d1 100644
--- a/src/i830_batchbuffer.c
+++ b/src/i830_batchbuffer.c
@@ -124,24 +124,13 @@ void intel_batch_pipelined_flush(ScrnInfoPtr scrn)
 	}
 }
 
-void intel_batch_flush(ScrnInfoPtr scrn, Bool flush)
+void intel_batch_flush(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	int ret;
 
 	assert (!intel->in_batch_atomic);
 
-	if (flush) {
-		int flags = MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE;
-
-		if (IS_I965G(intel))
-			flags = 0;
-
-		*(uint32_t *) (intel->batch_ptr + intel->batch_used) =
-			MI_FLUSH | flags;
-		intel->batch_used += 4;
-	}
-
 	if (intel->batch_used == 0)
 		return;
 
@@ -228,3 +217,26 @@ void intel_batch_wait_last(ScrnInfoPtr scrn)
 	drm_intel_bo_map(intel->last_batch_bo, TRUE);
 	drm_intel_bo_unmap(intel->last_batch_bo);
 }
+
+void intel_sync(ScrnInfoPtr scrn)
+{
+	intel_screen_private *intel = intel_get_screen_private(scrn);
+	int flags;
+
+	if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL | DEBUG_VERBOSE_SYNC))
+		ErrorF("I830Sync\n");
+
+	if (!scrn->vtSema || !intel->batch_bo || !intel->batch_ptr)
+		return;
+
+	flags = MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE;
+	if (IS_I965G(intel))
+		flags = 0;
+
+	BEGIN_BATCH(1);
+	OUT_BATCH(flags);
+	ADVANCE_BATCH();
+
+	intel_batch_flush(scrn);
+	intel_batch_wait_last(scrn);
+}
diff --git a/src/i830_batchbuffer.h b/src/i830_batchbuffer.h
index 520179c..10d6fcb 100644
--- a/src/i830_batchbuffer.h
+++ b/src/i830_batchbuffer.h
@@ -36,7 +36,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 void intel_batch_init(ScrnInfoPtr scrn);
 void intel_batch_teardown(ScrnInfoPtr scrn);
 void intel_batch_pipelined_flush(ScrnInfoPtr scrn);
-void intel_batch_flush(ScrnInfoPtr scrn, Bool flush);
+void intel_batch_flush(ScrnInfoPtr scrn);
 void intel_batch_wait_last(ScrnInfoPtr scrn);
 
 static inline int intel_batch_space(intel_screen_private *intel)
@@ -49,7 +49,7 @@ intel_batch_require_space(ScrnInfoPtr scrn, intel_screen_private *intel, GLuint
 {
 	assert(sz < intel->batch_bo->size - 8);
 	if (intel_batch_space(intel) < sz)
-		intel_batch_flush(scrn, FALSE);
+		intel_batch_flush(scrn);
 }
 
 static inline void intel_batch_start_atomic(ScrnInfoPtr scrn, unsigned int sz)
@@ -193,7 +193,7 @@ do {									\
 	if ((intel->batch_emitting > 8) &&				\
 	    (I810_DEBUG & DEBUG_ALWAYS_SYNC)) {				\
 		/* Note: not actually syncing, just flushing each batch. */ \
-		intel_batch_flush(scrn, FALSE);			\
+		intel_batch_flush(scrn);			\
 	}								\
 	intel->batch_emitting = 0;					\
 } while (0)
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 3b128f4..38de093 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -352,7 +352,7 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
 	 * We can't rely on getting into the block handler before the DRI
 	 * client gets to run again so flush now. */
 	intel->need_mi_flush = FALSE;
-	intel_batch_flush(scrn, TRUE);
+	intel_batch_flush(scrn);
 #if ALWAYS_SYNC
 	intel_sync(scrn);
 #endif
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 7ab4e96..21fb2ba 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -997,7 +997,8 @@ I830BlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
 		/* Flush the batch, so that any rendering is executed in a timely
 		 * fashion.
 		 */
-		intel_batch_flush(scrn, flush);
+		if (flush)
+			intel_batch_pipelined_flush(scrn);
 		drmCommandNone(intel->drmSubFD, DRM_I915_GEM_THROTTLE);
 
 		intel->need_mi_flush = FALSE;
diff --git a/src/i830_uxa.c b/src/i830_uxa.c
index 6d056c8..ef02263 100644
--- a/src/i830_uxa.c
+++ b/src/i830_uxa.c
@@ -93,7 +93,7 @@ i830_get_aperture_space(ScrnInfoPtr scrn, drm_intel_bo ** bo_table,
 
 	bo_table[0] = intel->batch_bo;
 	if (drm_intel_bufmgr_check_aperture_space(bo_table, num_bos) != 0) {
-		intel_batch_flush(scrn, FALSE);
+		intel_batch_flush(scrn);
 		bo_table[0] = intel->batch_bo;
 		if (drm_intel_bufmgr_check_aperture_space(bo_table, num_bos) !=
 		    0) {
@@ -573,7 +573,7 @@ static Bool i830_uxa_prepare_access(PixmapPtr pixmap, uxa_access_t access)
 
 	if (!list_is_empty(&priv->batch) &&
 	    (access == UXA_ACCESS_RW || priv->batch_write_domain))
-		intel_batch_flush(scrn, FALSE);
+		intel_batch_flush(scrn);
 
 	/* No VT sema or GEM?  No GTT mapping. */
 	if (!scrn->vtSema || bo->size > intel->max_gtt_map_size) {
diff --git a/src/i965_render.c b/src/i965_render.c
index cb057d7..a6a0d6b 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -1627,7 +1627,7 @@ i965_prepare_composite(int op, PicturePtr source_picture,
 	}
 
 	if (!i965_composite_check_aperture(scrn)) {
-		intel_batch_flush(scrn, FALSE);
+		intel_batch_flush(scrn);
 		if (!i965_composite_check_aperture(scrn)) {
 			intel_debug_fallback(scrn,
 					     "Couldn't fit render operation "
@@ -1805,7 +1805,7 @@ i965_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
 	drm_intel_bo_subdata(vb_bo, render_state->vb_offset * 4, i * 4, vb);
 
 	if (!i965_composite_check_aperture(scrn))
-		intel_batch_flush(scrn, FALSE);
+		intel_batch_flush(scrn);
 
 	intel_batch_start_atomic(scrn, 200);
 	if (intel->needs_render_state_emit)
diff --git a/src/i965_video.c b/src/i965_video.c
index f17999c..cc9b309 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -1213,7 +1213,7 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 		if (drm_intel_bufmgr_check_aperture_space(bo_table,
 							  ARRAY_SIZE(bo_table))
 		    < 0) {
-			intel_batch_flush(scrn, FALSE);
+			intel_batch_flush(scrn);
 		}
 
 		intel_batch_start_atomic(scrn, 100);
commit 57336c26f1fb90d43851ddcf78539585b67d86d9
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Dec 2 20:42:41 2009 +0000

    Rename I830Sync() to intel_sync()
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830.h b/src/i830.h
index c895021..21a5025 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -410,7 +410,6 @@ unsigned long intel_get_pixmap_pitch(PixmapPtr pixmap);
 #include "i830_batchbuffer.h"
 
 /* I830 specific functions */
-extern void I830Sync(ScrnInfoPtr scrn);
 extern void IntelEmitInvarientState(ScrnInfoPtr scrn);
 extern void I830EmitInvarientState(ScrnInfoPtr scrn);
 extern void I915EmitInvarientState(ScrnInfoPtr scrn);
@@ -517,6 +516,8 @@ i830_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform,
 
 void i830_enter_render(ScrnInfoPtr);
 
+extern void intel_sync(ScrnInfoPtr scrn);
+
 static inline void
 intel_debug_fallback(ScrnInfoPtr scrn, char *format, ...)
 {
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 17c3409..0f922a8 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -51,7 +51,7 @@ unsigned long intel_get_pixmap_pitch(PixmapPtr pixmap)
 	return (unsigned long)pixmap->devKind;
 }
 
-void I830Sync(ScrnInfoPtr scrn)
+void intel_sync(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
diff --git a/src/i830_dri.c b/src/i830_dri.c
index a9eed5b..3b128f4 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -354,7 +354,7 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
 	intel->need_mi_flush = FALSE;
 	intel_batch_flush(scrn, TRUE);
 #if ALWAYS_SYNC
-	I830Sync(scrn);
+	intel_sync(scrn);
 #endif
 	drmCommandNone(intel->drmSubFD, DRM_I915_GEM_THROTTLE);
 
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 94837eb..7ab4e96 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -428,7 +428,7 @@ static Bool i830_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 		xf86DrvMsg(scrn->scrnIndex, X_INFO,
 			   "Allocate new frame buffer %dx%d stride %d\n", width,
 			   height, scrn->displayWidth);
-		I830Sync(scrn);
+		intel_sync(scrn);
 		i830WaitForVblank(scrn);
 		new_front = i830_allocate_framebuffer(scrn);
 		if (!new_front) {
@@ -456,7 +456,7 @@ static Bool i830_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 			   "New front buffer at 0x%lx\n",
 			   intel->front_buffer->offset);
 		i830_set_new_crtc_bo(scrn);
-		I830Sync(scrn);
+		intel_sync(scrn);
 		i830WaitForVblank(scrn);
 		i830_free_memory(scrn, old_front);
 	}
@@ -1462,7 +1462,7 @@ static void I830LeaveVT(int scrnIndex, int flags)
 
 	xf86_hide_cursors(scrn);
 
-	I830Sync(scrn);
+	intel_sync(scrn);
 
 	intel_batch_teardown(scrn);
 
diff --git a/src/i965_video.c b/src/i965_video.c
index 6225aa4..f17999c 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -161,7 +161,7 @@ static void brw_debug(ScrnInfoPtr scrn, char *when)
 	int i;
 	uint32_t v;
 
-	I830Sync(scrn);
+	intel_sync(scrn);
 	ErrorF("brw_debug: %s\n", when);
 	for (i = 0; svg_ctl_bits[i].name; i++) {
 		OUTREG(BRW_SVG_CTL, svg_ctl_bits[i].svg_ctl);
commit 370157f4932cf9067ba81c8bd5a311aff610882b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Dec 2 20:28:49 2009 +0000

    batch: Avoid flushing a NULL batch
    
    During shutdown from a FatalError during batchbuffer submission, it is
    possible for the batch_ptr to be NULL, so we must be careful not to
    append a flush on this error path.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830_accel.c b/src/i830_accel.c
index 4302eca..17c3409 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -58,7 +58,7 @@ void I830Sync(ScrnInfoPtr scrn)
 	if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL | DEBUG_VERBOSE_SYNC))
 		ErrorF("I830Sync\n");
 
-	if (!scrn->vtSema || !intel->batch_bo)
+	if (!scrn->vtSema || !intel->batch_bo || !intel->batch_ptr)
 		return;
 
 	intel_batch_flush(scrn, TRUE);


More information about the xorg-commit mailing list