On Son, 2003-02-02 at 12:51, Michel Dänzer wrote:
> On Son, 2003-02-02 at 06:09, hy0 wrote:
> > 
> > Judging from current situation, we probably should take
> > RADEONWaitForVerticalSync and RADEONWaitForVerticalSync2 all out of the
> > cursor routines. 
> 
> I'd prefer fixing those functions instead. After some more thought,
> polling for _VBLANK_SAVE in both is probably safest for 4.3.0.

Here's what I'm talking about, what do you think?


-- 
Earthling Michel Dänzer (MrCooper)/ Debian GNU/Linux (powerpc) developer
XFree86 and DRI project member   /  CS student, Free Software enthusiast
Index: programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h
===================================================================
RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v
retrieving revision 1.24
diff -p -u -r1.24 radeon_reg.h
--- programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h	2003/01/17 19:54:03	1.24
+++ programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h	2003/02/03 03:28:42
@@ -307,6 +307,10 @@
 #define RADEON_CRTC2_PITCH                  0x032c
 #define RADEON_CRTC_STATUS                  0x005c
 #       define RADEON_CRTC_VBLANK_SAVE      (1 <<  1)
+#       define RADEON_CRTC_VBLANK_SAVE_CLEAR  (1 <<  1)
+#define RADEON_CRTC2_STATUS                  0x03fc
+#       define RADEON_CRTC2_VBLANK_SAVE      (1 <<  1)
+#       define RADEON_CRTC2_VBLANK_SAVE_CLEAR  (1 <<  1)
 #define RADEON_CRTC_V_SYNC_STRT_WID         0x020c
 #       define RADEON_CRTC_V_SYNC_STRT        (0x7ff <<  0)
 #       define RADEON_CRTC_V_SYNC_STRT_SHIFT  0
Index: programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c
===================================================================
RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v
retrieving revision 1.84
diff -p -u -r1.84 radeon_driver.c
--- programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c	2003/01/30 05:31:31	1.84
+++ programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c	2003/02/03 03:28:46
@@ -671,9 +675,13 @@ void RADEONWaitForVerticalSync(ScrnInfoP
     unsigned char *RADEONMMIO = info->MMIO;
     int            i;
 
-    OUTREG(RADEON_GEN_INT_STATUS, RADEON_VSYNC_INT_AK);
-    for (i = 0; i < RADEON_TIMEOUT; i++) {
-	if (INREG(RADEON_GEN_INT_STATUS) & RADEON_VSYNC_INT) break;
+    /* Clear the CRTC_VBLANK_SAVE bit */
+    OUTREG(RADEON_CRTC_STATUS, RADEON_CRTC_VBLANK_SAVE_CLEAR);
+
+    /* Wait for it to go back up */
+    for (i = 0; i < RADEON_TIMEOUT/1000; i++) {
+	if (INREG(RADEON_CRTC_STATUS) & RADEON_CRTC_VBLANK_SAVE) break;
+	usleep(1);
     }
 }
 
@@ -683,10 +691,14 @@ void RADEONWaitForVerticalSync2(ScrnInfo
     RADEONInfoPtr  info       = RADEONPTR(pScrn);
     unsigned char *RADEONMMIO = info->MMIO;
     int            i;
+
+    /* Clear the CRTC2_VBLANK_SAVE bit */
+    OUTREG(RADEON_CRTC2_STATUS, RADEON_CRTC2_VBLANK_SAVE_CLEAR);
 
-    OUTREG(RADEON_GEN_INT_STATUS, RADEON_VSYNC2_INT_AK);
-    for (i = 0; i < RADEON_TIMEOUT; i++) {
-	if (INREG(RADEON_GEN_INT_STATUS) & RADEON_VSYNC2_INT) break;
+    /* Wait for it to go back up */
+    for (i = 0; i < RADEON_TIMEOUT/1000; i++) {
+	if (INREG(RADEON_CRTC2_STATUS) & RADEON_CRTC2_VBLANK_SAVE) break;
+	usleep(1);
     }
 }
 

Reply via email to