summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2002-10-10 08:25:40 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2002-10-10 08:25:40 +0000
commit3d69766ea6df4ab1837f5270beafb13c70ec61e6 (patch)
tree5271b98a26b76af2b5133a54498d333e9a07e0d0
parent2af90a581d20c983446d354051f0f098a5d4eacb (diff)
Jonny Strom's mga_dma.c patch
-rw-r--r--shared-core/mga_dma.c11
-rw-r--r--shared/mga_dma.c11
2 files changed, 20 insertions, 2 deletions
diff --git a/shared-core/mga_dma.c b/shared-core/mga_dma.c
index a0ad70e9..3c84de63 100644
--- a/shared-core/mga_dma.c
+++ b/shared-core/mga_dma.c
@@ -157,9 +157,18 @@ void mga_do_dma_flush( drm_mga_private_t *dev_priv )
{
drm_mga_primary_buffer_t *primary = &dev_priv->prim;
u32 head, tail;
- DMA_LOCALS;
+ u32 status = 0;
+ int i;
+ DMA_LOCALS;
DRM_DEBUG( "\n" );
+ /* 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;
diff --git a/shared/mga_dma.c b/shared/mga_dma.c
index a0ad70e9..3c84de63 100644
--- a/shared/mga_dma.c
+++ b/shared/mga_dma.c
@@ -157,9 +157,18 @@ void mga_do_dma_flush( drm_mga_private_t *dev_priv )
{
drm_mga_primary_buffer_t *primary = &dev_priv->prim;
u32 head, tail;
- DMA_LOCALS;
+ u32 status = 0;
+ int i;
+ DMA_LOCALS;
DRM_DEBUG( "\n" );
+ /* 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;