[Intel-gfx] [PATCH 14/22] Xv I830PutImage splitup: extract i830_wait_for scanline

Daniel Vetter daniel.vetter at ffwll.ch
Thu Jul 2 14:15:47 CEST 2009


Also scrap the unecessary variable sync in I830PutImage and the
accompanying obfuscated logic.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 src/i830_video.c |   78 +++++++++++++++++++++++++++---------------------------
 1 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/src/i830_video.c b/src/i830_video.c
index eb9cde4..bf66dba 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -2158,6 +2158,43 @@ i830_fill_colorkey (ScreenPtr pScreen, uint32_t key, RegionPtr clipboxes)
    FreeScratchGC (gc);
 }
 
+static void
+i830_wait_for_scanline(ScrnInfoPtr pScrn, PixmapPtr pPixmap,
+	xf86CrtcPtr crtc, RegionPtr clipBoxes)
+{
+    I830Ptr pI830 = I830PTR(pScrn);
+    BoxPtr box;
+    int y1, y2;
+    int pipe = -1, event, load_scan_lines_pipe;
+
+    if (pixmap_is_scanout(pPixmap)) 
+	pipe = i830_crtc_to_pipe(crtc);
+
+    if (pipe >= 0) {
+	if (pipe == 0) {
+	    event = MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW;
+	    load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEA;
+	} else {
+	    event = MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW;
+	    load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEB;
+	}
+
+	box = REGION_EXTENTS(unused, clipBoxes);
+	y1 = box->y1 - crtc->y;
+	y2 = box->y2 - crtc->y;
+
+	BEGIN_BATCH(5);
+	/* The documentation says that the LOAD_SCAN_LINES command
+	 * always comes in pairs. Don't ask me why. */
+	OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe);
+	OUT_BATCH((y1 << 16) | y2);
+	OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe);
+	OUT_BATCH((y1 << 16) | y2);
+	OUT_BATCH(MI_WAIT_FOR_EVENT | event);
+	ADVANCE_BATCH();
+    }
+}
+
 static Bool
 i830_setup_video_buffer(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv,
 	int alloc_size, int id)
@@ -2453,45 +2490,8 @@ I830PutImage(ScrnInfoPtr pScrn,
 	    i830_fill_colorkey (pScreen, pPriv->colorKey, clipBoxes);
 	}
     } else {
-        Bool sync = TRUE;
-        
-        if (crtc == NULL) {
-            sync = FALSE;
-        } else if (pPriv->SyncToVblank == 0) {
-            sync = FALSE;
-        }
-
-        if (sync) {
-	    BoxPtr box;
-	    int y1, y2;
-	    int pipe = -1, event, load_scan_lines_pipe;
-
-	    if (pixmap_is_scanout(pPixmap))
-		pipe = i830_crtc_to_pipe(crtc);
-
-	    if (pipe >= 0) {
-		if (pipe == 0) {
-		    event = MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW;
-		    load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEA;
-		} else {
-		    event = MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW;
-		    load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEB;
-		}
-
-		box = REGION_EXTENTS(unused, clipBoxes);
-		y1 = box->y1 - crtc->y;
-		y2 = box->y2 - crtc->y;
-
-		BEGIN_BATCH(5);
-		/* The documentation says that the LOAD_SCAN_LINES command
-		 * always comes in pairs. Don't ask me why. */
-		OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe);
-		OUT_BATCH((y1 << 16) | y2);
-		OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe);
-		OUT_BATCH((y1 << 16) | y2);
-		OUT_BATCH(MI_WAIT_FOR_EVENT | event);
-		ADVANCE_BATCH();
-	    }
+        if (crtc && pPriv->SyncToVblank != 0) {
+	    i830_wait_for_scanline(pScrn, pPixmap, crtc, clipBoxes);
         }
 
         if (IS_I965G(pI830)) {
-- 
1.6.3.3




More information about the Intel-gfx mailing list