diff options
author | Gareth Hughes <gareth@users.sourceforge.net> | 2000-10-27 01:52:53 +0000 |
---|---|---|
committer | Gareth Hughes <gareth@users.sourceforge.net> | 2000-10-27 01:52:53 +0000 |
commit | 79857ad822f65aa9e5037feffcd993f4bb830b2d (patch) | |
tree | f173d64094589c2aadc5b38001de9d634e2ad316 | |
parent | 05ef8effbffaab3b4005e938617d0a37d9db855a (diff) |
Add support for different primitive types in vertex buffer flush ioctl.
Try and fix Mobility 128 lockups. Seems to lock when shutting down the X
server from non-standard resolutions, so I've probably messed up the
CCE ioctls somewhat. Default panel resolution seems to be rock solid...
-rw-r--r-- | linux-core/r128_drv.c | 2 | ||||
-rw-r--r-- | linux/r128_cce.c | 21 | ||||
-rw-r--r-- | linux/r128_drm.h | 10 | ||||
-rw-r--r-- | linux/r128_drv.c | 2 | ||||
-rw-r--r-- | linux/r128_drv.h | 1 | ||||
-rw-r--r-- | linux/r128_state.c | 10 |
6 files changed, 37 insertions, 9 deletions
diff --git a/linux-core/r128_drv.c b/linux-core/r128_drv.c index 6f07b5bb..a4fd2f6b 100644 --- a/linux-core/r128_drv.c +++ b/linux-core/r128_drv.c @@ -37,7 +37,7 @@ #define R128_NAME "r128" #define R128_DESC "ATI Rage 128" -#define R128_DATE "20001019" +#define R128_DATE "20001027" #define R128_MAJOR 1 #define R128_MINOR 1 #define R128_PATCHLEVEL 0 diff --git a/linux/r128_cce.c b/linux/r128_cce.c index 1b95c2d7..3820c14d 100644 --- a/linux/r128_cce.c +++ b/linux/r128_cce.c @@ -149,7 +149,7 @@ static int r128_do_pixcache_flush( drm_r128_private_t *dev_priv ) udelay( 1 ); } - DRM_DEBUG( "%s failed!\n", __FUNCTION__ ); + DRM_ERROR( "%s failed!\n", __FUNCTION__ ); return -EBUSY; } @@ -579,11 +579,15 @@ int r128_cce_stop( struct inode *inode, struct file *filp, DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); return -EINVAL; } - if ( !dev_priv ) + if ( !dev_priv ) { + DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); return -EINVAL; + } - if ( !dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4 ) + if ( !dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4 ){ + DRM_DEBUG( "%s while CCE not running\n", __FUNCTION__ ); return 0; + } /* Flush any pending CCE commands. This ensures any outstanding * commands are exectuted by the engine before we turn it off. @@ -621,11 +625,16 @@ int r128_cce_reset( struct inode *inode, struct file *filp, DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); return -EINVAL; } - if ( !dev_priv ) + if ( !dev_priv ) { + DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); return -EINVAL; - - if ( !dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4 ) + } +#if 0 + if ( !dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4 ){ + DRM_DEBUG( "%s while CCE not running\n", __FUNCTION__ ); return 0; + } +#endif r128_do_cce_reset( dev_priv ); diff --git a/linux/r128_drm.h b/linux/r128_drm.h index 7ee6d7ce..54a7375c 100644 --- a/linux/r128_drm.h +++ b/linux/r128_drm.h @@ -58,6 +58,15 @@ #define R128_BACK 0x2 #define R128_DEPTH 0x4 +/* Primitive types + */ +#define R128_POINTS 0x1 +#define R128_LINES 0x2 +#define R128_LINE_STRIP 0x3 +#define R128_TRIANGLES 0x4 +#define R128_TRIANGLE_FAN 0x5 +#define R128_TRIANGLE_STRIP 0x6 + /* Vertex/indirect buffer size */ #define R128_BUFFER_SIZE 16384 @@ -203,6 +212,7 @@ typedef struct drm_r128_clear { } drm_r128_clear_t; typedef struct drm_r128_vertex { + int prim; int idx; /* Index of vertex buffer */ int used; /* Amount of buffer used */ int discard; /* Client finished with buffer? */ diff --git a/linux/r128_drv.c b/linux/r128_drv.c index 6f07b5bb..a4fd2f6b 100644 --- a/linux/r128_drv.c +++ b/linux/r128_drv.c @@ -37,7 +37,7 @@ #define R128_NAME "r128" #define R128_DESC "ATI Rage 128" -#define R128_DATE "20001019" +#define R128_DATE "20001027" #define R128_MAJOR 1 #define R128_MINOR 1 #define R128_PATCHLEVEL 0 diff --git a/linux/r128_drv.h b/linux/r128_drv.h index 98182284..727c268b 100644 --- a/linux/r128_drv.h +++ b/linux/r128_drv.h @@ -95,6 +95,7 @@ typedef struct drm_r128_private { typedef struct drm_r128_buf_priv { u32 age; + int prim; int discard; int dispatched; drm_r128_freelist_t *list_entry; diff --git a/linux/r128_state.c b/linux/r128_state.c index a8320486..4eec9f9d 100644 --- a/linux/r128_state.c +++ b/linux/r128_state.c @@ -507,7 +507,7 @@ static void r128_cce_dispatch_vertex( drm_device_t *dev, int index = buf->idx; int offset = dev_priv->buffers->offset + buf->offset - dev->agp->base; int size = buf->used / (vertsize * sizeof(u32)); - int prim; + int prim = buf_priv->prim; int i = 0; RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); @@ -524,7 +524,9 @@ static void r128_cce_dispatch_vertex( drm_device_t *dev, if ( 0 ) r128_print_dirty( "dispatch_vertex", sarea_priv->dirty ); +#if 0 prim = R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST; +#endif if ( buf->used ) { buf_priv->dispatched = 1; @@ -854,6 +856,11 @@ int r128_cce_vertex( struct inode *inode, struct file *filp, vertex.idx, dma->buf_count - 1 ); return -EINVAL; } + if ( vertex.prim < 0 || + vertex.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 ) { + DRM_ERROR( "buffer prim %d\n", vertex.prim ); + return -EINVAL; + } buf = dma->buflist[vertex.idx]; buf_priv = buf->dev_private; @@ -869,6 +876,7 @@ int r128_cce_vertex( struct inode *inode, struct file *filp, } buf->used = vertex.used; + buf_priv->prim = vertex.prim; buf_priv->discard = vertex.discard; r128_cce_dispatch_vertex( dev, buf ); |