summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
Diffstat (limited to 'linux')
-rw-r--r--linux/r128_cce.c19
-rw-r--r--linux/r128_drv.c4
-rw-r--r--linux/r128_drv.h15
-rw-r--r--linux/r128_state.c24
-rw-r--r--linux/radeon_cp.c19
-rw-r--r--linux/radeon_drv.c4
-rw-r--r--linux/radeon_drv.h15
-rw-r--r--linux/radeon_state.c15
8 files changed, 27 insertions, 88 deletions
diff --git a/linux/r128_cce.c b/linux/r128_cce.c
index d1790497..5c67bec9 100644
--- a/linux/r128_cce.c
+++ b/linux/r128_cce.c
@@ -839,13 +839,9 @@ int r128_wait_ring( drm_r128_private_t *dev_priv, int n )
int i;
for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) {
- ring->space = *ring->head - ring->tail;
- if ( ring->space <= 0 )
- ring->space += ring->size;
-
+ r128_update_ring_snapshot( ring );
if ( ring->space >= n )
return 0;
-
udelay( 1 );
}
@@ -854,19 +850,6 @@ int r128_wait_ring( drm_r128_private_t *dev_priv, int n )
return -EBUSY;
}
-void r128_update_ring_snapshot( drm_r128_private_t *dev_priv )
-{
- drm_r128_ring_buffer_t *ring = &dev_priv->ring;
-
- ring->space = *ring->head - ring->tail;
-#if R128_PERFORMANCE_BOXES
- if ( ring->space == 0 )
- atomic_inc( &dev_priv->idle_count );
-#endif
- if ( ring->space <= 0 )
- ring->space += ring->size;
-}
-
static int r128_cce_get_buffers( drm_device_t *dev, drm_dma_t *d )
{
int i;
diff --git a/linux/r128_drv.c b/linux/r128_drv.c
index e42868ed..daae0f87 100644
--- a/linux/r128_drv.c
+++ b/linux/r128_drv.c
@@ -38,11 +38,11 @@
#define DRIVER_NAME "r128"
#define DRIVER_DESC "ATI Rage 128"
-#define DRIVER_DATE "20010216"
+#define DRIVER_DATE "20010308"
#define DRIVER_MAJOR 2
#define DRIVER_MINOR 1
-#define DRIVER_PATCHLEVEL 4
+#define DRIVER_PATCHLEVEL 5
#define DRIVER_IOCTLS \
[DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { r128_cce_buffers, 1, 0 }, \
diff --git a/linux/r128_drv.h b/linux/r128_drv.h
index 9f53746f..6216b9a1 100644
--- a/linux/r128_drv.h
+++ b/linux/r128_drv.h
@@ -130,7 +130,14 @@ extern void r128_freelist_reset( drm_device_t *dev );
extern drm_buf_t *r128_freelist_get( drm_device_t *dev );
extern int r128_wait_ring( drm_r128_private_t *dev_priv, int n );
-extern void r128_update_ring_snapshot( drm_r128_private_t *dev_priv );
+
+static inline void
+r128_update_ring_snapshot( drm_r128_ring_buffer_t *ring )
+{
+ ring->space = (*(volatile int *)ring->head - ring->tail) * sizeof(u32);
+ if ( ring->space <= 0 )
+ ring->space += ring->size;
+}
extern int r128_do_cce_idle( drm_r128_private_t *dev_priv );
extern int r128_do_cleanup_cce( drm_device_t *dev );
@@ -415,9 +422,7 @@ do { \
drm_r128_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; \
+ r128_update_ring_snapshot( ring ); \
if ( ring->space >= ring->high_mark ) \
goto __ring_space_done; \
udelay( 1 ); \
@@ -462,7 +467,7 @@ do { \
DRM_INFO( "BEGIN_RING( %d ) in %s\n", \
(n), __FUNCTION__ ); \
} \
- if ( dev_priv->ring.space < (n) * sizeof(u32) ) { \
+ if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \
r128_wait_ring( dev_priv, (n) * sizeof(u32) ); \
} \
dev_priv->ring.space -= (n) * sizeof(u32); \
diff --git a/linux/r128_state.c b/linux/r128_state.c
index fa16f3ce..9fc6b485 100644
--- a/linux/r128_state.c
+++ b/linux/r128_state.c
@@ -372,8 +372,6 @@ static void r128_cce_dispatch_clear( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) {
unsigned int tmp = flags;
@@ -477,8 +475,6 @@ static void r128_cce_dispatch_swap( drm_device_t *dev )
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
#if R128_PERFORMANCE_BOXES
/* Do some trivial performance monitoring...
*/
@@ -535,8 +531,6 @@ static void r128_cce_dispatch_flip( drm_device_t *dev )
RING_LOCALS;
DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page );
- r128_update_ring_snapshot( dev_priv );
-
#if R128_PERFORMANCE_BOXES
/* Do some trivial performance monitoring...
*/
@@ -587,8 +581,6 @@ static void r128_cce_dispatch_vertex( drm_device_t *dev,
DRM_DEBUG( "%s: buf=%d nbox=%d\n",
__FUNCTION__, buf->idx, sarea_priv->nbox );
- r128_update_ring_snapshot( dev_priv );
-
if ( 0 )
r128_print_dirty( "dispatch_vertex", sarea_priv->dirty );
@@ -656,8 +648,6 @@ static void r128_cce_dispatch_indirect( drm_device_t *dev,
DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n",
buf->idx, start, end );
- r128_update_ring_snapshot( dev_priv );
-
if ( start != end ) {
int offset = buf->bus_address + start;
int dwords = (end - start + 3) / sizeof(u32);
@@ -722,8 +712,6 @@ static void r128_cce_dispatch_indices( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count );
- r128_update_ring_snapshot( dev_priv );
-
if ( 0 )
r128_print_dirty( "dispatch_indices", sarea_priv->dirty );
@@ -799,8 +787,6 @@ static int r128_cce_dispatch_blit( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
/* The compiler won't optimize away a division by a variable,
* even if the only legal values are powers of two. Thus, we'll
* use a shift instead.
@@ -911,8 +897,6 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
count = depth->n;
if ( copy_from_user( &x, depth->x, sizeof(x) ) ) {
return -EFAULT;
@@ -1006,8 +990,6 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
count = depth->n;
x = kmalloc( count * sizeof(*x), 0 );
@@ -1123,8 +1105,6 @@ static int r128_cce_dispatch_read_span( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
count = depth->n;
if ( copy_from_user( &x, depth->x, sizeof(x) ) ) {
return -EFAULT;
@@ -1167,8 +1147,6 @@ static int r128_cce_dispatch_read_pixels( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
count = depth->n;
if ( count > dev_priv->depth_pitch ) {
count = dev_priv->depth_pitch;
@@ -1236,8 +1214,6 @@ static void r128_cce_dispatch_stipple( drm_device_t *dev, u32 *stipple )
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
BEGIN_RING( 33 );
OUT_RING( CCE_PACKET0( R128_BRUSH_DATA0, 31 ) );
diff --git a/linux/radeon_cp.c b/linux/radeon_cp.c
index 3feb4b24..cea8c327 100644
--- a/linux/radeon_cp.c
+++ b/linux/radeon_cp.c
@@ -1166,13 +1166,9 @@ int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n )
int i;
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 >= n )
+ radeon_update_ring_snapshot( ring );
+ if ( ring->space > n )
return 0;
-
udelay( 1 );
}
@@ -1181,17 +1177,6 @@ int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n )
return -EBUSY;
}
-void radeon_update_ring_snapshot( drm_radeon_private_t *dev_priv )
-{
- drm_radeon_ring_buffer_t *ring = &dev_priv->ring;
-
- ring->space = *ring->head - ring->tail;
- if ( ring->space == 0 )
- atomic_inc( &dev_priv->idle_count );
- if ( ring->space <= 0 )
- ring->space += ring->size;
-}
-
static int radeon_cp_get_buffers( drm_device_t *dev, drm_dma_t *d )
{
int i;
diff --git a/linux/radeon_drv.c b/linux/radeon_drv.c
index 1aa889ae..dba2037f 100644
--- a/linux/radeon_drv.c
+++ b/linux/radeon_drv.c
@@ -36,11 +36,11 @@
#define DRIVER_NAME "radeon"
#define DRIVER_DESC "ATI Radeon"
-#define DRIVER_DATE "20010305"
+#define DRIVER_DATE "20010308"
#define DRIVER_MAJOR 1
#define DRIVER_MINOR 0
-#define DRIVER_PATCHLEVEL 0
+#define DRIVER_PATCHLEVEL 1
#define DRIVER_IOCTLS \
[DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { radeon_cp_buffers, 1, 0 }, \
diff --git a/linux/radeon_drv.h b/linux/radeon_drv.h
index d279b046..f176bb56 100644
--- a/linux/radeon_drv.h
+++ b/linux/radeon_drv.h
@@ -146,7 +146,14 @@ extern void radeon_freelist_reset( drm_device_t *dev );
extern drm_buf_t *radeon_freelist_get( drm_device_t *dev );
extern int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n );
-extern void radeon_update_ring_snapshot( drm_radeon_private_t *dev_priv );
+
+static inline void
+radeon_update_ring_snapshot( drm_radeon_ring_buffer_t *ring )
+{
+ ring->space = (*(volatile int *)ring->head - ring->tail) * sizeof(u32);
+ if ( ring->space <= 0 )
+ ring->space += ring->size;
+}
extern int radeon_do_cp_idle( drm_radeon_private_t *dev_priv );
extern int radeon_do_cleanup_cp( drm_device_t *dev );
@@ -601,9 +608,7 @@ 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; \
+ radeon_update_ring_snapshot( ring ); \
if ( ring->space >= ring->high_mark ) \
goto __ring_space_done; \
udelay( 1 ); \
@@ -657,7 +662,7 @@ do { \
DRM_INFO( "BEGIN_RING( %d ) in %s\n", \
n, __FUNCTION__ ); \
} \
- if ( dev_priv->ring.space < (n) * sizeof(u32) ) { \
+ if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \
radeon_wait_ring( dev_priv, (n) * sizeof(u32) ); \
} \
dev_priv->ring.space -= (n) * sizeof(u32); \
diff --git a/linux/radeon_state.c b/linux/radeon_state.c
index ff1b3512..816e63bd 100644
--- a/linux/radeon_state.c
+++ b/linux/radeon_state.c
@@ -498,8 +498,6 @@ static void radeon_cp_dispatch_clear( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- radeon_update_ring_snapshot( dev_priv );
-
if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) {
unsigned int tmp = flags;
@@ -656,8 +654,6 @@ static void radeon_cp_dispatch_swap( drm_device_t *dev )
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- radeon_update_ring_snapshot( dev_priv );
-
#if RADEON_PERFORMANCE_BOXES
/* Do some trivial performance monitoring...
*/
@@ -725,8 +721,6 @@ static void radeon_cp_dispatch_flip( drm_device_t *dev )
RING_LOCALS;
DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page );
- radeon_update_ring_snapshot( dev_priv );
-
#if RADEON_PERFORMANCE_BOXES
/* Do some trivial performance monitoring...
*/
@@ -777,8 +771,6 @@ static void radeon_cp_dispatch_vertex( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "%s: nbox=%d\n", __FUNCTION__, sarea_priv->nbox );
- radeon_update_ring_snapshot( dev_priv );
-
if ( 0 )
radeon_print_dirty( "dispatch_vertex", sarea_priv->dirty );
@@ -845,8 +837,6 @@ static void radeon_cp_dispatch_indirect( drm_device_t *dev,
DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n",
buf->idx, start, end );
- radeon_update_ring_snapshot( dev_priv );
-
if ( start != end ) {
int offset = (dev_priv->agp_buffers_offset
+ buf->offset + start);
@@ -909,8 +899,6 @@ static void radeon_cp_dispatch_indices( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count );
- radeon_update_ring_snapshot( dev_priv );
-
if ( 0 )
radeon_print_dirty( "dispatch_indices", sarea_priv->dirty );
@@ -1143,8 +1131,6 @@ static void radeon_cp_dispatch_stipple( drm_device_t *dev, u32 *stipple )
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- radeon_update_ring_snapshot( dev_priv );
-
BEGIN_RING( 35 );
OUT_RING( CP_PACKET0( RADEON_RE_STIPPLE_ADDR, 0 ) );
@@ -1180,7 +1166,6 @@ int radeon_cp_clear( struct inode *inode, struct file *filp,
sizeof(clear) ) )
return -EFAULT;
-
RING_SPACE_TEST_WITH_RETURN( dev_priv );
if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS )