Fix up BSD irq handling.

main
Eric Anholt 2002-09-29 20:48:18 +00:00
parent ec48dfa835
commit e6901cad69
4 changed files with 20 additions and 52 deletions

View File

@ -598,26 +598,6 @@ int DRM(control)( DRM_IOCTL_ARGS )
#if __HAVE_VBL_IRQ #if __HAVE_VBL_IRQ
int DRM(vblank_wait)(drm_device_t *dev, unsigned int *sequence)
{
unsigned int cur_vblank;
int ret = 0;
/* Assume that the user has missed the current sequence number by about
* a day rather than she wants to wait for years using vertical blanks :)
*/
while ( ( ( cur_vblank = atomic_read(&dev->vbl_received ) )
+ ~*sequence + 1 ) > (1<<23) ) {
ret = tsleep( &dev->vbl_queue, 3*hz, "rdnvbl", PZERO | PCATCH);
if (ret)
break;
}
*sequence = cur_vblank;
return ret;
}
int DRM(wait_vblank)( DRM_IOCTL_ARGS ) int DRM(wait_vblank)( DRM_IOCTL_ARGS )
{ {
DRM_DEVICE; DRM_DEVICE;

View File

@ -598,26 +598,6 @@ int DRM(control)( DRM_IOCTL_ARGS )
#if __HAVE_VBL_IRQ #if __HAVE_VBL_IRQ
int DRM(vblank_wait)(drm_device_t *dev, unsigned int *sequence)
{
unsigned int cur_vblank;
int ret = 0;
/* Assume that the user has missed the current sequence number by about
* a day rather than she wants to wait for years using vertical blanks :)
*/
while ( ( ( cur_vblank = atomic_read(&dev->vbl_received ) )
+ ~*sequence + 1 ) > (1<<23) ) {
ret = tsleep( &dev->vbl_queue, 3*hz, "rdnvbl", PZERO | PCATCH);
if (ret)
break;
}
*sequence = cur_vblank;
return ret;
}
int DRM(wait_vblank)( DRM_IOCTL_ARGS ) int DRM(wait_vblank)( DRM_IOCTL_ARGS )
{ {
DRM_DEVICE; DRM_DEVICE;

View File

@ -92,7 +92,7 @@ void DRM(dma_service)( DRM_IRQ_ARGS )
RADEON_WRITE(RADEON_GEN_INT_STATUS, ack); RADEON_WRITE(RADEON_GEN_INT_STATUS, ack);
} }
static inline void radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv) static __inline__ void radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv)
{ {
RADEON_WRITE( RADEON_GEN_INT_STATUS, RADEON_READ( RADEON_GEN_INT_STATUS ) ); RADEON_WRITE( RADEON_GEN_INT_STATUS, RADEON_READ( RADEON_GEN_INT_STATUS ) );
} }
@ -156,10 +156,14 @@ int radeon_wait_irq(drm_device_t *dev, int swi_nr)
#endif /* __linux__ */ #endif /* __linux__ */
#ifdef __FreeBSD__ #ifdef __FreeBSD__
ret = tsleep( &dev_priv->swi_queue, PZERO | PCATCH, \ for (;;) {
"rdnirq", 3*hz ); if (RADEON_READ( RADEON_LAST_SWI_REG ) >= swi_nr)
if ( (ret == EWOULDBLOCK) || (ret == EINTR) ) break;
return DRM_ERR(EBUSY); ret = tsleep( &dev_priv->swi_queue, PZERO | PCATCH, \
"rdnirq", 3*hz );
if (ret)
break;
}
return ret; return ret;
#endif /* __FreeBSD__ */ #endif /* __FreeBSD__ */
} }
@ -200,7 +204,7 @@ int radeon_vblank_wait(drm_device_t *dev, unsigned int *sequence)
} }
#endif /* __linux__ */ #endif /* __linux__ */
#ifdef __FreeBSD__ #ifdef __FreeBSD__
ret = tsleep( &dev_priv->vbl_queue, 3*hz, "rdnvbl", PZERO | PCATCH); ret = tsleep( &dev->vbl_queue, 3*hz, "rdnvbl", PZERO | PCATCH);
if (ret) if (ret)
break; break;
#endif /* __FreeBSD__ */ #endif /* __FreeBSD__ */

View File

@ -92,7 +92,7 @@ void DRM(dma_service)( DRM_IRQ_ARGS )
RADEON_WRITE(RADEON_GEN_INT_STATUS, ack); RADEON_WRITE(RADEON_GEN_INT_STATUS, ack);
} }
static inline void radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv) static __inline__ void radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv)
{ {
RADEON_WRITE( RADEON_GEN_INT_STATUS, RADEON_READ( RADEON_GEN_INT_STATUS ) ); RADEON_WRITE( RADEON_GEN_INT_STATUS, RADEON_READ( RADEON_GEN_INT_STATUS ) );
} }
@ -156,10 +156,14 @@ int radeon_wait_irq(drm_device_t *dev, int swi_nr)
#endif /* __linux__ */ #endif /* __linux__ */
#ifdef __FreeBSD__ #ifdef __FreeBSD__
ret = tsleep( &dev_priv->swi_queue, PZERO | PCATCH, \ for (;;) {
"rdnirq", 3*hz ); if (RADEON_READ( RADEON_LAST_SWI_REG ) >= swi_nr)
if ( (ret == EWOULDBLOCK) || (ret == EINTR) ) break;
return DRM_ERR(EBUSY); ret = tsleep( &dev_priv->swi_queue, PZERO | PCATCH, \
"rdnirq", 3*hz );
if (ret)
break;
}
return ret; return ret;
#endif /* __FreeBSD__ */ #endif /* __FreeBSD__ */
} }
@ -200,7 +204,7 @@ int radeon_vblank_wait(drm_device_t *dev, unsigned int *sequence)
} }
#endif /* __linux__ */ #endif /* __linux__ */
#ifdef __FreeBSD__ #ifdef __FreeBSD__
ret = tsleep( &dev_priv->vbl_queue, 3*hz, "rdnvbl", PZERO | PCATCH); ret = tsleep( &dev->vbl_queue, 3*hz, "rdnvbl", PZERO | PCATCH);
if (ret) if (ret)
break; break;
#endif /* __FreeBSD__ */ #endif /* __FreeBSD__ */