xf86-video-intel: 2 commits - src/intel_dri.c src/intel_driver.c

Kristian Høgsberg krh at kemper.freedesktop.org
Fri Jul 30 06:43:23 PDT 2010


 src/intel_dri.c    |   20 ++++++++++----------
 src/intel_driver.c |   33 ++++++++++++++++++++++++---------
 2 files changed, 34 insertions(+), 19 deletions(-)

New commits:
commit 0be3e95c844247746742805830860ace9f546d99
Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Fri Jul 30 09:39:58 2010 -0400

    Remove explicit batchbuffer submit in DRI2 copyregion
    
    Now that we submit from the flush callback chain, we know we'll always
    submit before the client receives the reply or event that blocks it from
    rendering the next frame.

diff --git a/src/intel_dri.c b/src/intel_dri.c
index d5dc30f..9b6ccb3 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -383,22 +383,22 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
 		}
 	}
 
+	/* It's important that this copy gets submitted before the
+	 * direct rendering client submits rendering for the next
+	 * frame, but we don't actually need to submit right now.  The
+	 * client will wait for the DRI2CopyRegion reply or the swap
+	 * buffer event before rendering, and we'll hit the flush
+	 * callback chain before those messages are sent.  We submit
+	 * our batch buffers from the flush callback chain so we know
+	 * that will happen before the client tries to render
+	 * again. */
+
 	(*gc->ops->CopyArea) (src, dst,
 			       gc,
 			       0, 0,
 			       drawable->width, drawable->height,
 			       0, 0);
 	FreeScratchGC(gc);
-
-	/* Emit a flush of the rendering cache, or on the 965 and beyond
-	 * rendering results may not hit the framebuffer until significantly
-	 * later.
-	 *
-	 * We can't rely on getting into the block handler before the DRI
-	 * client gets to run again so flush now.
-	 */
-	intel_batch_submit(scrn, TRUE);
-	drmCommandNone(intel->drmSubFD, DRM_I915_GEM_THROTTLE);
 }
 
 #if DRI2INFOREC_VERSION >= 4
commit 69d65f9184006eac790efcff78a0e425160e95aa
Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Thu Jul 29 18:31:48 2010 -0400

    Submit batch buffers from flush callback chain
    
    There are a few cases where the server will flush client output buffers
    but our block handler only catches the most common (before going into select).
    If the server flushes client buffers before we submit our batch buffer,
    the client may receive a damage event for rendering that hasn't happened yet.
    
    Instead, we can hook into the flush callback chain, which the server will
    invoke just before flushing output.  This lets us submit batch buffers
    before sending out events, preserving ordering.
    
    Fixes 28438: [bisected] incorrect character in gnome-terminal under compiz
    https://bugs.freedesktop.org/show_bug.cgi?id=28438
    
    Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>

diff --git a/src/intel_driver.c b/src/intel_driver.c
index 7761ccf..d09c432 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -678,16 +678,8 @@ I830BlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
 	intel->BlockHandler = screen->BlockHandler;
 	screen->BlockHandler = I830BlockHandler;
 
-	if (scrn->vtSema) {
-		/* Emit a flush of the rendering cache, or on the 965 and beyond
-		 * rendering results may not hit the framebuffer until significantly
-		 * later.
-		 */
-		intel_batch_submit(scrn,
-				   intel->need_mi_flush ||
-				   !list_is_empty(&intel->flush_pixmaps));
+	if (scrn->vtSema == TRUE)
 		drmCommandNone(intel->drmSubFD, DRM_I915_GEM_THROTTLE);
-	}
 
 	intel_uxa_block_handler(intel);
 	intel_video_block_handler(intel);
@@ -787,6 +779,24 @@ int intel_crtc_to_pipe(xf86CrtcPtr crtc)
 	return drmmode_get_pipe_from_crtc_id(intel->bufmgr, crtc);
 }
 
+static void
+intel_flush_callback(CallbackListPtr *list,
+		     pointer user_data, pointer call_data)
+{
+	ScrnInfoPtr scrn = user_data;
+	intel_screen_private *intel = intel_get_screen_private(scrn);
+
+	if (scrn->vtSema) {
+		/* Emit a flush of the rendering cache, or on the 965
+		 * and beyond rendering results may not hit the
+		 * framebuffer until significantly later.
+		 */
+		intel_batch_submit(scrn,
+				   intel->need_mi_flush ||
+				   !list_is_empty(&intel->flush_pixmaps));
+	}
+}
+
 static Bool
 I830ScreenInit(int scrnIndex, ScreenPtr screen, int argc, char **argv)
 {
@@ -955,6 +965,9 @@ I830ScreenInit(int scrnIndex, ScreenPtr screen, int argc, char **argv)
 	intel->BlockHandler = screen->BlockHandler;
 	screen->BlockHandler = I830BlockHandler;
 
+	if (!AddCallback(&FlushCallback, intel_flush_callback, scrn))
+		return FALSE;
+
 	screen->SaveScreen = xf86SaveScreen;
 	intel->CloseScreen = screen->CloseScreen;
 	screen->CloseScreen = I830CloseScreen;
@@ -1114,6 +1127,8 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen)
 		intel->front_buffer = NULL;
 	}
 
+	DeleteCallback(&FlushCallback, intel_flush_callback, scrn);
+
 	intel_batch_teardown(scrn);
 
 	if (IS_I965G(intel))


More information about the xorg-commit mailing list