patch-2.4.20 linux-2.4.20/drivers/char/drm/mga_dma.c

Next file: linux-2.4.20/drivers/char/drm/mga_drv.h
Previous file: linux-2.4.20/drivers/char/drm/i830_drv.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.19/drivers/char/drm/mga_dma.c linux-2.4.20/drivers/char/drm/mga_dma.c
@@ -33,7 +33,6 @@
  *    Gareth Hughes <gareth@valinux.com>
  */
 
-#define __NO_VERSION__
 #include "mga.h"
 #include "drmP.h"
 #include "mga_drv.h"
@@ -159,9 +158,18 @@
 {
 	drm_mga_primary_buffer_t *primary = &dev_priv->prim;
 	u32 head, tail;
+	u32 status = 0;
+	int i;
 	DMA_LOCALS;
 	DRM_DEBUG( "%s:\n", __FUNCTION__ );
 
+        /* We need to wait so that we can do an safe flush */
+	for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) {
+		status = MGA_READ( MGA_STATUS ) & MGA_ENGINE_IDLE_MASK;
+		if ( status == MGA_ENDPRDMASTS ) break;
+		udelay( 1 );
+	}
+
 	if ( primary->tail == primary->last_flush ) {
 		DRM_DEBUG( "   bailing out...\n" );
 		return;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)