diff options
author | Gareth Hughes <gareth@users.sourceforge.net> | 2001-01-24 15:34:46 +0000 |
---|---|---|
committer | Gareth Hughes <gareth@users.sourceforge.net> | 2001-01-24 15:34:46 +0000 |
commit | 4d2a4455b4e7bc65952aa6167c34b488c4ca3b8d (patch) | |
tree | 853b80f2484ac679f46f6c8319807b6e0ec24b0c /linux/radeon_drv.h | |
parent | 642bb6fbb0bfbc6e549e61bd0ece72abcbd399b7 (diff) |
- Misc cleanups.
- Fix drmR128Clear parameters (Radeon to follow).
- Add some helper macros to r128/radeon kernel modules.
Diffstat (limited to 'linux/radeon_drv.h')
-rw-r--r-- | linux/radeon_drv.h | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/linux/radeon_drv.h b/linux/radeon_drv.h index 06b54199..e2c3ebd4 100644 --- a/linux/radeon_drv.h +++ b/linux/radeon_drv.h @@ -50,6 +50,8 @@ typedef struct drm_radeon_ring_buffer { u32 tail; u32 tail_mask; int space; + + int high_mark; } drm_radeon_ring_buffer_t; typedef struct drm_radeon_depth_clear_t { @@ -91,13 +93,13 @@ typedef struct drm_radeon_private { u32 crtc_offset; u32 crtc_offset_cntl; - unsigned int color_fmt; + u32 color_fmt; unsigned int front_offset; unsigned int front_pitch; unsigned int back_offset; unsigned int back_pitch; - unsigned int depth_fmt; + u32 depth_fmt; unsigned int depth_offset; unsigned int depth_pitch; @@ -534,15 +536,17 @@ extern int radeon_context_switch_complete(drm_device_t *dev, int new); #define RADEON_MAX_VB_AGE 0x7fffffff #define RADEON_MAX_VB_VERTS (0xffff) +#define RADEON_RING_HIGH_MARK 128 + #define RADEON_BASE(reg) ((u32)(dev_priv->mmio->handle)) #define RADEON_ADDR(reg) (RADEON_BASE(reg) + reg) -#define RADEON_DEREF(reg) *(__volatile__ u32 *)RADEON_ADDR(reg) +#define RADEON_DEREF(reg) *(volatile u32 *)RADEON_ADDR(reg) #define RADEON_READ(reg) RADEON_DEREF(reg) #define RADEON_WRITE(reg,val) do { RADEON_DEREF(reg) = val; } while (0) -#define RADEON_DEREF8(reg) *(__volatile__ u8 *)RADEON_ADDR(reg) +#define RADEON_DEREF8(reg) *(volatile u8 *)RADEON_ADDR(reg) #define RADEON_READ8(reg) RADEON_DEREF8(reg) #define RADEON_WRITE8(reg,val) do { RADEON_DEREF8(reg) = val; } while (0) @@ -630,7 +634,25 @@ do { \ * Misc helper macros */ -#define VB_AGE_CHECK_WITH_RET( dev_priv ) \ +#define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \ +do { \ + drm_radeon_ring_buffer_t *ring = &dev_priv->ring; int i; \ + if ( ring->space < ring->high_mark ) { \ + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \ + ring->space = *ring->head - ring->tail; \ + if ( ring->space <= 0 ) \ + ring->space += ring->size; \ + if ( ring->space >= ring->high_mark ) \ + goto __ring_space_done; \ + udelay( 1 ); \ + } \ + DRM_ERROR( "ring space check failed!\n" ); \ + return -EBUSY; \ + } \ + __ring_space_done: \ +} while (0) + +#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ do { \ drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; \ if ( sarea_priv->last_dispatch >= RADEON_MAX_VB_AGE ) { \ |