summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGareth Hughes <gareth@users.sourceforge.net>2000-11-28 18:48:43 +0000
committerGareth Hughes <gareth@users.sourceforge.net>2000-11-28 18:48:43 +0000
commit1f86294ff77ec1ca3a9969f470e5c7c0d085f1a3 (patch)
treeb4feb986b49158b0e1ca194b01d88e8a654b1123
parentf848f0336bd2d79fc58b70410d92c5731046ff10 (diff)
- Fix long-standing scissor bug.
- Fix texture uploads. Now request/upload a single buffer at a time, improves available space sharing with other contexts (rather than grabbing most of it for a single texture upload). Really need larger buffers for better efficiency, this is coming... - Fix glean makeCurrent failure. Need to track down some strangeness in the texture LRU mechanism seen with Q3 High Quality, but apart from that we're looking in good shape to merge with the trunk.
-rw-r--r--linux-core/r128_drv.c34
-rw-r--r--linux/r128_drm.h12
-rw-r--r--linux/r128_drv.c34
-rw-r--r--linux/r128_state.c111
4 files changed, 85 insertions, 106 deletions
diff --git a/linux-core/r128_drv.c b/linux-core/r128_drv.c
index e2568eb6c..f73d4c0b8 100644
--- a/linux-core/r128_drv.c
+++ b/linux-core/r128_drv.c
@@ -37,10 +37,10 @@
#define R128_NAME "r128"
#define R128_DESC "ATI Rage 128"
-#define R128_DATE "20001121"
+#define R128_DATE "20001129"
#define R128_MAJOR 2
#define R128_MINOR 0
-#define R128_PATCHLEVEL 0
+#define R128_PATCHLEVEL 1
static drm_device_t r128_device;
drm_ctx_t r128_res_ctx;
@@ -358,12 +358,12 @@ static int __init r128_init(void)
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
dev->agp = drm_agp_init();
- if (dev->agp == NULL) {
- DRM_ERROR("Cannot initialize agpgart module.\n");
- drm_proc_cleanup();
- misc_deregister(&r128_misc);
- r128_takedown(dev);
- return -ENOMEM;
+ if (dev->agp == NULL) {
+ DRM_ERROR("Cannot initialize agpgart module.\n");
+ drm_proc_cleanup();
+ misc_deregister(&r128_misc);
+ r128_takedown(dev);
+ return -ENOMEM;
}
#ifdef CONFIG_MTRR
@@ -422,8 +422,8 @@ module_init(r128_init);
module_exit(r128_cleanup);
-int r128_version(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
+int r128_version(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
{
drm_version_t version;
int len;
@@ -515,8 +515,8 @@ int r128_release(struct inode *inode, struct file *filp)
}
/* r128_ioctl is called whenever a process performs an ioctl on /dev/drm. */
-int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
+int r128_ioctl(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
{
int nr = DRM_IOCTL_NR(cmd);
drm_file_t *priv = filp->private_data;
@@ -542,7 +542,7 @@ int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
DRM_DEBUG("no function\n");
retcode = -EINVAL;
} else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN))
- || (ioctl->auth_needed && !priv->authenticated)) {
+ || (ioctl->auth_needed && !priv->authenticated)) {
retcode = -EACCES;
} else {
retcode = (func)(inode, filp, cmd, arg);
@@ -559,8 +559,8 @@ int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
return retcode;
}
-int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
+int r128_lock(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
@@ -655,8 +655,8 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
}
-int r128_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
+int r128_unlock(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
diff --git a/linux/r128_drm.h b/linux/r128_drm.h
index aefe03b4c..51e31cd34 100644
--- a/linux/r128_drm.h
+++ b/linux/r128_drm.h
@@ -240,19 +240,13 @@ typedef struct drm_r128_indices {
int discard; /* Client finished with buffer? */
} drm_r128_indices_t;
-typedef struct drm_r128_blit_rect {
- int index;
- unsigned short x, y;
- unsigned short width, height;
- int padding;
-} drm_r128_blit_rect_t;
-
typedef struct drm_r128_blit {
+ int idx;
int pitch;
int offset;
int format;
- drm_r128_blit_rect_t *rects;
- int count;
+ unsigned short x, y;
+ unsigned short width, height;
} drm_r128_blit_t;
typedef struct drm_r128_packet {
diff --git a/linux/r128_drv.c b/linux/r128_drv.c
index e2568eb6c..f73d4c0b8 100644
--- a/linux/r128_drv.c
+++ b/linux/r128_drv.c
@@ -37,10 +37,10 @@
#define R128_NAME "r128"
#define R128_DESC "ATI Rage 128"
-#define R128_DATE "20001121"
+#define R128_DATE "20001129"
#define R128_MAJOR 2
#define R128_MINOR 0
-#define R128_PATCHLEVEL 0
+#define R128_PATCHLEVEL 1
static drm_device_t r128_device;
drm_ctx_t r128_res_ctx;
@@ -358,12 +358,12 @@ static int __init r128_init(void)
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
dev->agp = drm_agp_init();
- if (dev->agp == NULL) {
- DRM_ERROR("Cannot initialize agpgart module.\n");
- drm_proc_cleanup();
- misc_deregister(&r128_misc);
- r128_takedown(dev);
- return -ENOMEM;
+ if (dev->agp == NULL) {
+ DRM_ERROR("Cannot initialize agpgart module.\n");
+ drm_proc_cleanup();
+ misc_deregister(&r128_misc);
+ r128_takedown(dev);
+ return -ENOMEM;
}
#ifdef CONFIG_MTRR
@@ -422,8 +422,8 @@ module_init(r128_init);
module_exit(r128_cleanup);
-int r128_version(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
+int r128_version(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
{
drm_version_t version;
int len;
@@ -515,8 +515,8 @@ int r128_release(struct inode *inode, struct file *filp)
}
/* r128_ioctl is called whenever a process performs an ioctl on /dev/drm. */
-int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
+int r128_ioctl(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
{
int nr = DRM_IOCTL_NR(cmd);
drm_file_t *priv = filp->private_data;
@@ -542,7 +542,7 @@ int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
DRM_DEBUG("no function\n");
retcode = -EINVAL;
} else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN))
- || (ioctl->auth_needed && !priv->authenticated)) {
+ || (ioctl->auth_needed && !priv->authenticated)) {
retcode = -EACCES;
} else {
retcode = (func)(inode, filp, cmd, arg);
@@ -559,8 +559,8 @@ int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
return retcode;
}
-int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
+int r128_lock(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
@@ -655,8 +655,8 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
}
-int r128_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
+int r128_unlock(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
diff --git a/linux/r128_state.c b/linux/r128_state.c
index 7308597d7..9694c4c78 100644
--- a/linux/r128_state.c
+++ b/linux/r128_state.c
@@ -35,8 +35,6 @@
#define USE_OLD_BLITS 1
-static drm_r128_blit_rect_t rects[R128_MAX_BLIT_BUFFERS];
-
/* ================================================================
* CCE hardware state programming functions
@@ -45,7 +43,7 @@ static drm_r128_blit_rect_t rects[R128_MAX_BLIT_BUFFERS];
static void r128_emit_clip_rects( drm_r128_private_t *dev_priv,
drm_clip_rect_t *boxes, int count )
{
- unsigned int aux_sc_cntl = 0x00000000;
+ u32 aux_sc_cntl = 0x00000000;
RING_LOCALS;
DRM_DEBUG( " %s\n", __FUNCTION__ );
@@ -935,17 +933,14 @@ static void r128_cce_dispatch_indices( drm_device_t *dev,
}
static int r128_cce_dispatch_blit( drm_device_t *dev,
- int offset, int pitch, int format,
- drm_r128_blit_rect_t *rects, int count )
+ drm_r128_blit_t *blit )
{
drm_r128_private_t *dev_priv = dev->dev_private;
drm_device_dma_t *dma = dev->dma;
drm_buf_t *buf;
drm_r128_buf_priv_t *buf_priv;
- drm_r128_blit_rect_t *rect;
u32 *data;
int dword_shift, dwords;
- int i;
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
@@ -955,7 +950,7 @@ static int r128_cce_dispatch_blit( drm_device_t *dev,
* even if the only legal values are powers of two. Thus, we'll
* use a shift instead.
*/
- switch ( format ) {
+ switch ( blit->format ) {
case R128_DATATYPE_ARGB1555:
case R128_DATATYPE_RGB565:
case R128_DATATYPE_ARGB4444:
@@ -965,7 +960,7 @@ static int r128_cce_dispatch_blit( drm_device_t *dev,
dword_shift = 0;
break;
default:
- DRM_ERROR( "invalid blit format %d\n", format );
+ DRM_ERROR( "invalid blit format %d\n", blit->format );
return -EINVAL;
}
@@ -981,53 +976,48 @@ static int r128_cce_dispatch_blit( drm_device_t *dev,
ADVANCE_RING();
- /* Dispatch each of the indirect buffers.
+ /* Dispatch the indirect buffer.
*/
- for ( i = 0 ; i < count ; i++ ) {
- rect = &rects[i];
- buf = dma->buflist[rect->index];
- buf_priv = buf->dev_private;
-
- if ( buf->pid != current->pid ) {
- DRM_ERROR( "process %d using buffer owned by %d\n",
- current->pid, buf->pid );
- return -EINVAL;
- }
- if ( buf->pending ) {
- DRM_ERROR( "sending pending buffer %d\n",
- rect->index );
- return -EINVAL;
- }
+ buf = dma->buflist[blit->idx];
+ buf_priv = buf->dev_private;
- buf_priv->discard = 1;
+ if ( buf->pid != current->pid ) {
+ DRM_ERROR( "process %d using buffer owned by %d\n",
+ current->pid, buf->pid );
+ return -EINVAL;
+ }
+ if ( buf->pending ) {
+ DRM_ERROR( "sending pending buffer %d\n", blit->idx );
+ return -EINVAL;
+ }
- dwords = (rect->width * rect->height) >> dword_shift;
+ buf_priv->discard = 1;
- data = (u32 *)((char *)dev_priv->buffers->handle
- + buf->offset);
-
- data[0] = CCE_PACKET3( R128_CNTL_HOSTDATA_BLT, dwords + 6 );
- data[1] = ( R128_GMC_DST_PITCH_OFFSET_CNTL
- | R128_GMC_BRUSH_NONE
- | (format << 8)
- | R128_GMC_SRC_DATATYPE_COLOR
- | R128_ROP3_S
- | R128_DP_SRC_SOURCE_HOST_DATA
- | R128_GMC_CLR_CMP_CNTL_DIS
- | R128_GMC_AUX_CLIP_DIS
- | R128_GMC_WR_MSK_DIS );
-
- data[2] = (pitch << 21) | (offset >> 5);
- data[3] = 0xffffffff;
- data[4] = 0xffffffff;
- data[5] = (rect->y << 16) | rect->x;
- data[6] = (rect->height << 16) | rect->width;
- data[7] = dwords;
-
- buf->used = (dwords + 8) * sizeof(u32);
-
- r128_cce_dispatch_indirect( dev, buf, 0, buf->used );
- }
+ dwords = (blit->width * blit->height) >> dword_shift;
+
+ data = (u32 *)((char *)dev_priv->buffers->handle + buf->offset);
+
+ data[0] = CCE_PACKET3( R128_CNTL_HOSTDATA_BLT, dwords + 6 );
+ data[1] = ( R128_GMC_DST_PITCH_OFFSET_CNTL
+ | R128_GMC_BRUSH_NONE
+ | (blit->format << 8)
+ | R128_GMC_SRC_DATATYPE_COLOR
+ | R128_ROP3_S
+ | R128_DP_SRC_SOURCE_HOST_DATA
+ | R128_GMC_CLR_CMP_CNTL_DIS
+ | R128_GMC_AUX_CLIP_DIS
+ | R128_GMC_WR_MSK_DIS );
+
+ data[2] = (blit->pitch << 21) | (blit->offset >> 5);
+ data[3] = 0xffffffff;
+ data[4] = 0xffffffff;
+ data[5] = (blit->y << 16) | blit->x;
+ data[6] = (blit->height << 16) | blit->width;
+ data[7] = dwords;
+
+ buf->used = (dwords + 8) * sizeof(u32);
+
+ r128_cce_dispatch_indirect( dev, buf, 0, buf->used );
/* Flush the pixel cache after the blit completes. This ensures
* the texture data is written out to memory before rendering
@@ -1265,19 +1255,14 @@ int r128_cce_blit( struct inode *inode, struct file *filp,
sizeof(blit) ) )
return -EFAULT;
- DRM_DEBUG( "%s: pid=%d count=%d\n",
- __FUNCTION__, current->pid, blit.count );
+ DRM_DEBUG( "%s: pid=%d index=%d\n",
+ __FUNCTION__, current->pid, blit.idx );
- if ( blit.count < 0 || blit.count > dma->buf_count ) {
- DRM_ERROR( "sending %d buffers (of %d max)\n",
- blit.count, dma->buf_count );
+ if ( blit.idx < 0 || blit.idx >= dma->buf_count ) {
+ DRM_ERROR( "buffer index %d (of %d max)\n",
+ blit.idx, dma->buf_count - 1 );
return -EINVAL;
}
- if ( copy_from_user( &rects, blit.rects,
- blit.count * sizeof(drm_r128_blit_rect_t) ) )
- return -EFAULT;
-
- return r128_cce_dispatch_blit( dev, blit.offset, blit.pitch,
- blit.format, rects, blit.count );
+ return r128_cce_dispatch_blit( dev, &blit );
}