xf86-video-intel: 2 commits - configure.ac src/drmmode_display.c src/i830.h src/i830_video.c

Keith Packard keithp at kemper.freedesktop.org
Thu May 14 17:02:45 PDT 2009


 configure.ac          |    2 -
 src/drmmode_display.c |    8 +++++++
 src/i830.h            |    1 
 src/i830_video.c      |   52 ++++++++++++++++++++++++++++----------------------
 4 files changed, 40 insertions(+), 23 deletions(-)

New commits:
commit 04772b6c09a88f0483c2a7efc48029967c77b9bc
Author: Keith Packard <keithp at keithp.com>
Date:   Thu May 14 16:57:11 2009 -0700

    If DRM can't figure out which pipe to sync on, then don't sync at all.
    
    Syncing to the wrong pipe can wedge the hardware if the exclusion area is
    larger than the vtotal
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 8aef4cf..028d17d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -130,7 +130,7 @@ if test "x$GCC" = "xyes"; then
 	-Wnested-externs -fno-strict-aliasing"
 fi
 
-PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.6])
+PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.11])
 AM_CONDITIONAL(DRI, test x$DRI = xyes)
 if test "$DRI" = yes; then
         PKG_CHECK_MODULES(DRI, [xf86driproto glproto])
diff --git a/src/i830_video.c b/src/i830_video.c
index 64cea04..1c3a5b7 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -2504,27 +2504,29 @@ I830PutImage(ScrnInfoPtr pScrn,
 		pipe = intel_crtc->pipe;
 	    }
 
-	    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;
-	    }
+	    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();
+		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 (IS_I965G(pI830)) {
commit 128c1c3b7d57b157604788f82bf9fd389839068f
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 29 14:43:56 2009 -0700

    Use libdrm to lookup pipe for tear-free sync of XV
    
    Previously, the code was trying to examine a driver_private field,
    but those fields are only set by the userland-modesetting code so
    would fail in the case of KMS. This fixes bug #21076:
    
    [945GME] [KMS] XV_SYNC_TO_VBLANK does not prevent tearing of xv video
    https://bugs.freedesktop.org/show_bug.cgi?id=21076

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 15ffc29..7df7b6f 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -920,3 +920,11 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
 
 	return TRUE;
 }
+
+int
+drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, xf86CrtcPtr crtc)
+{
+	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+	return drm_intel_get_pipe_from_crtc_id (bufmgr, drmmode_crtc->mode_crtc->crtc_id);
+}
diff --git a/src/i830.h b/src/i830.h
index 68bc0a5..33a92c6 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -679,6 +679,7 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen);
 void I830DRI2CloseScreen(ScreenPtr pScreen);
 
 extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp);
+extern int drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, xf86CrtcPtr crtc);
 
 extern Bool I830AccelInit(ScreenPtr pScreen);
 extern void I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir,
diff --git a/src/i830_video.c b/src/i830_video.c
index 1e05e9c..64cea04 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -2495,15 +2495,21 @@ I830PutImage(ScrnInfoPtr pScrn,
         if (sync) {
 	    BoxPtr box;
 	    int y1, y2;
-            int event, pipe;
-	    I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
+            int pipe, event, load_scan_lines_pipe;
 
-	    if (intel_crtc->pipe == 0) {
+	    if (pI830->use_drm_mode)
+		pipe = drmmode_get_pipe_from_crtc_id(pI830->bufmgr, crtc);
+	    else {
+		I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
+		pipe = intel_crtc->pipe;
+	    }
+
+	    if (pipe == 0) {
 		event = MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW;
-		pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEA;
+		load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEA;
 	    } else {
 		event = MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW;
-		pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEB;
+		load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEB;
 	    }
 
 	    box = REGION_EXTENTS(unused, clipBoxes);
@@ -2513,9 +2519,9 @@ I830PutImage(ScrnInfoPtr pScrn,
             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 | pipe);
+	    OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe);
 	    OUT_BATCH((y1 << 16) | y2);
-	    OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | pipe);
+	    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();


More information about the xorg-commit mailing list