[PATCH 2/2] Fix vline range calculations.

Michel Dänzer michel at daenzer.net
Wed Feb 1 04:35:42 PST 2012


From: Michel Dänzer <michel.daenzer at amd.com>

The range passed in is in pixmap coordinates, so the CRTC offset needs to be
added to the clamping limits and subtracted from the clamped range for
pre-AVIVO display engines.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/evergreen_accel.c    |    8 ++------
 src/r6xx_accel.c         |    8 ++------
 src/radeon_commonfuncs.c |   12 ++++++------
 3 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/src/evergreen_accel.c b/src/evergreen_accel.c
index 7c6b777..6610c28 100644
--- a/src/evergreen_accel.c
+++ b/src/evergreen_accel.c
@@ -303,16 +303,12 @@ void evergreen_cp_wait_vline_sync(ScrnInfoPtr pScrn, PixmapPtr pPix,
 	    return;
     }
 
-    start = max(start, 0);
-    stop = min(stop, crtc->mode.VDisplay);
+    start = max(start, crtc->y);
+    stop = min(stop, crtc->y + crtc->mode.VDisplay);
 
     if (start >= stop)
         return;
 
-    /* on r5xx+ vline starts at viewport_y */
-    start += crtc->y;
-    stop += crtc->y;
-
     BEGIN_BATCH(11);
     /* set the VLINE range */
     EREG(EVERGREEN_VLINE_START_END, /* this is just a marker */
diff --git a/src/r6xx_accel.c b/src/r6xx_accel.c
index 94678a1..d1a5085 100644
--- a/src/r6xx_accel.c
+++ b/src/r6xx_accel.c
@@ -364,16 +364,12 @@ r600_cp_wait_vline_sync(ScrnInfoPtr pScrn, drmBufPtr ib, PixmapPtr pPix,
 	    return;
     }
 
-    start = max(start, 0);
-    stop = min(stop, crtc->mode.VDisplay);
+    start = max(start, crtc->y);
+    stop = min(stop, crtc->y + crtc->mode.VDisplay);
 
     if (start >= stop)
         return;
 
-    /* on r5xx+ vline starts at viewport_y */
-    start += crtc->y;
-    stop += crtc->y;
-
 #if defined(XF86DRM_MODE)
     if (info->cs) {
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
diff --git a/src/radeon_commonfuncs.c b/src/radeon_commonfuncs.c
index e2b7171..e0b026f 100644
--- a/src/radeon_commonfuncs.c
+++ b/src/radeon_commonfuncs.c
@@ -858,16 +858,16 @@ void FUNC_NAME(RADEONWaitForVLine)(ScrnInfoPtr pScrn, PixmapPtr pPix,
 	    return;
     }
 
-    start = max(start, 0);
-    stop = min(stop, crtc->mode.VDisplay);
+    start = max(start, crtc->y);
+    stop = min(stop, crtc->y + crtc->mode.VDisplay);
 
     if (start >= stop)
 	return;
 
-    if (IS_AVIVO_VARIANT) {
-	/* on r5xx+ vline starts at viewport_y */
-	start += crtc->y;
-	stop += crtc->y;
+    if (!IS_AVIVO_VARIANT) {
+	/* on pre-r5xx vline starts at CRTC scanout */
+	start -= crtc->y;
+	stop -= crtc->y;
     }
 
 #if defined(ACCEL_CP) && defined(XF86DRM_MODE)
-- 
1.7.8.3



More information about the xorg-driver-ati mailing list