diff options
author | Eric Anholt <anholt@freebsd.org> | 2002-09-29 20:48:18 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2002-09-29 20:48:18 +0000 |
commit | e6901cad696cf58ee9f1a48bdc7e9fa047824f8a (patch) | |
tree | e1933dfa938eac90db9592b4b86805f79c5bd528 | |
parent | ec48dfa83599fa6061bb9cc566f8d8dc1727aced (diff) |
Fix up BSD irq handling.
-rw-r--r-- | bsd-core/drm_dma.c | 20 | ||||
-rw-r--r-- | bsd/drm_dma.h | 20 | ||||
-rw-r--r-- | shared-core/radeon_irq.c | 16 | ||||
-rw-r--r-- | shared/radeon_irq.c | 16 |
4 files changed, 20 insertions, 52 deletions
diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c index ebb6fbf6..25d7eb6e 100644 --- a/bsd-core/drm_dma.c +++ b/bsd-core/drm_dma.c @@ -598,26 +598,6 @@ int DRM(control)( DRM_IOCTL_ARGS ) #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 ) { DRM_DEVICE; diff --git a/bsd/drm_dma.h b/bsd/drm_dma.h index ebb6fbf6..25d7eb6e 100644 --- a/bsd/drm_dma.h +++ b/bsd/drm_dma.h @@ -598,26 +598,6 @@ int DRM(control)( DRM_IOCTL_ARGS ) #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 ) { DRM_DEVICE; diff --git a/shared-core/radeon_irq.c b/shared-core/radeon_irq.c index 9b551b90..19872e9a 100644 --- a/shared-core/radeon_irq.c +++ b/shared-core/radeon_irq.c @@ -92,7 +92,7 @@ void DRM(dma_service)( DRM_IRQ_ARGS ) 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 ) ); } @@ -156,10 +156,14 @@ int radeon_wait_irq(drm_device_t *dev, int swi_nr) #endif /* __linux__ */ #ifdef __FreeBSD__ - ret = tsleep( &dev_priv->swi_queue, PZERO | PCATCH, \ - "rdnirq", 3*hz ); - if ( (ret == EWOULDBLOCK) || (ret == EINTR) ) - return DRM_ERR(EBUSY); + for (;;) { + if (RADEON_READ( RADEON_LAST_SWI_REG ) >= swi_nr) + break; + ret = tsleep( &dev_priv->swi_queue, PZERO | PCATCH, \ + "rdnirq", 3*hz ); + if (ret) + break; + } return ret; #endif /* __FreeBSD__ */ } @@ -200,7 +204,7 @@ int radeon_vblank_wait(drm_device_t *dev, unsigned int *sequence) } #endif /* __linux__ */ #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) break; #endif /* __FreeBSD__ */ diff --git a/shared/radeon_irq.c b/shared/radeon_irq.c index 9b551b90..19872e9a 100644 --- a/shared/radeon_irq.c +++ b/shared/radeon_irq.c @@ -92,7 +92,7 @@ void DRM(dma_service)( DRM_IRQ_ARGS ) 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 ) ); } @@ -156,10 +156,14 @@ int radeon_wait_irq(drm_device_t *dev, int swi_nr) #endif /* __linux__ */ #ifdef __FreeBSD__ - ret = tsleep( &dev_priv->swi_queue, PZERO | PCATCH, \ - "rdnirq", 3*hz ); - if ( (ret == EWOULDBLOCK) || (ret == EINTR) ) - return DRM_ERR(EBUSY); + for (;;) { + if (RADEON_READ( RADEON_LAST_SWI_REG ) >= swi_nr) + break; + ret = tsleep( &dev_priv->swi_queue, PZERO | PCATCH, \ + "rdnirq", 3*hz ); + if (ret) + break; + } return ret; #endif /* __FreeBSD__ */ } @@ -200,7 +204,7 @@ int radeon_vblank_wait(drm_device_t *dev, unsigned int *sequence) } #endif /* __linux__ */ #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) break; #endif /* __FreeBSD__ */ |