The delay is very large because this routine is waiting for the graphics coprocessor to finish an operation. Some of the operations can take many ms to complete; for example telling the chip to copy 64MB of memory somewhere. I would think the question should be, how do we wait on the GPU without killing both audio and video latency.
The problem here is that most graphics commands are very short in duration. Some of these commands can be issued a million of times per second. A few commands are much longer running. I don't believe there is an easy way to tell how long the commands will run. A better solution might be to loop twenty times to pick up the very short commands. After 20us switch to a loop that allows the kernel to schedule. You don't want to immediately schedule since that will kill graphics performance. What's the right way to write a loop like this that meets the above requirements and also satisfies the audio needs? static int radeon_do_wait_for_idle( drm_radeon_private_t *dev_priv ) { int i, ret; dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; ret = radeon_do_wait_for_fifo( dev_priv, 64 ); if ( ret ) return ret; for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { if ( !(RADEON_READ( RADEON_RBBM_STATUS ) & RADEON_RBBM_ACTIVE) ) { radeon_do_pixcache_flush( dev_priv ); return 0; } DRM_UDELAY( 1 ); } #if RADEON_FIFO_DEBUG DRM_ERROR( "failed!\n" ); radeon_status( dev_priv ); #endif return DRM_ERR(EBUSY); } ===== Jon Smirl [EMAIL PROTECTED] __________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 -- _______________________________________________ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel