summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2003-06-18 12:23:25 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2003-06-18 12:23:25 +0000
commitf0b29f9c0490dd2b46d36391ef0593696239e96a (patch)
tree9ccfbd71dfcd714a053e6aa4767c71a5f1a38dd6
parentcb90f57c0d9b48cc234ba784462bac2171ed172d (diff)
Move flush_queue functionality into dma_quiescent, remove flush_queue()
-rw-r--r--linux-core/i830_dma.c46
-rw-r--r--linux/i830_dma.c46
2 files changed, 22 insertions, 70 deletions
diff --git a/linux-core/i830_dma.c b/linux-core/i830_dma.c
index a93c2118..4411e8d7 100644
--- a/linux-core/i830_dma.c
+++ b/linux-core/i830_dma.c
@@ -1337,51 +1337,27 @@ static int i830_dma_dispatch_vertex2(drm_device_t *dev,
void i830_dma_quiescent(drm_device_t *dev)
{
- drm_i830_private_t *dev_priv = dev->dev_private;
- RING_LOCALS;
-
- i830_kernel_lost_context(dev);
-
- BEGIN_LP_RING(4);
- OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE );
- OUT_RING( CMD_REPORT_HEAD );
- OUT_RING( 0 );
- OUT_RING( 0 );
- ADVANCE_LP_RING();
-
- i830_wait_ring( dev, dev_priv->ring.Size - 8, __FUNCTION__ );
-}
-
-static int i830_flush_queue(drm_device_t *dev)
-{
drm_i830_private_t *dev_priv = dev->dev_private;
drm_device_dma_t *dma = dev->dma;
- int i, ret = 0;
+ int i;
RING_LOCALS;
-
- i830_kernel_lost_context(dev);
+
+ i830_kernel_lost_context(dev);
BEGIN_LP_RING(2);
- OUT_RING( CMD_REPORT_HEAD );
+ OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE );
+ OUT_RING( CMD_REPORT_HEAD );
+ OUT_RING( 0 );
OUT_RING( 0 );
- ADVANCE_LP_RING();
+ ADVANCE_LP_RING();
i830_wait_ring( dev, dev_priv->ring.Size - 8, __FUNCTION__ );
for (i = 0; i < dma->buf_count; i++) {
drm_buf_t *buf = dma->buflist[ i ];
- drm_i830_buf_priv_t *buf_priv = buf->dev_private;
-
- int used = cmpxchg(buf_priv->in_use, I830_BUF_HARDWARE,
- I830_BUF_FREE);
-
- if (used == I830_BUF_HARDWARE)
- DRM_DEBUG("reclaimed from HARDWARE\n");
- if (used == I830_BUF_CLIENT)
- DRM_DEBUG("still on client\n");
+ drm_i830_buf_priv_t *buf_priv = buf->dev_private;
+ cmpxchg(buf_priv->in_use, I830_BUF_HARDWARE, I830_BUF_FREE);
}
-
- return ret;
}
/* Must be called with the lock held */
@@ -1396,7 +1372,7 @@ void i830_reclaim_buffers( struct file *filp )
if (!dev->dev_private) return;
if (!dma->buflist) return;
- i830_flush_queue(dev);
+ i830_dma_quiescent(dev);
for (i = 0; i < dma->buf_count; i++) {
drm_buf_t *buf = dma->buflist[ i ];
@@ -1424,7 +1400,7 @@ int i830_flush_ioctl( DRM_IOCTL_ARGS )
return DRM_ERR(EINVAL);
}
- i830_flush_queue(dev);
+ i830_dma_quiescent(dev);
return 0;
}
diff --git a/linux/i830_dma.c b/linux/i830_dma.c
index a93c2118..4411e8d7 100644
--- a/linux/i830_dma.c
+++ b/linux/i830_dma.c
@@ -1337,51 +1337,27 @@ static int i830_dma_dispatch_vertex2(drm_device_t *dev,
void i830_dma_quiescent(drm_device_t *dev)
{
- drm_i830_private_t *dev_priv = dev->dev_private;
- RING_LOCALS;
-
- i830_kernel_lost_context(dev);
-
- BEGIN_LP_RING(4);
- OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE );
- OUT_RING( CMD_REPORT_HEAD );
- OUT_RING( 0 );
- OUT_RING( 0 );
- ADVANCE_LP_RING();
-
- i830_wait_ring( dev, dev_priv->ring.Size - 8, __FUNCTION__ );
-}
-
-static int i830_flush_queue(drm_device_t *dev)
-{
drm_i830_private_t *dev_priv = dev->dev_private;
drm_device_dma_t *dma = dev->dma;
- int i, ret = 0;
+ int i;
RING_LOCALS;
-
- i830_kernel_lost_context(dev);
+
+ i830_kernel_lost_context(dev);
BEGIN_LP_RING(2);
- OUT_RING( CMD_REPORT_HEAD );
+ OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE );
+ OUT_RING( CMD_REPORT_HEAD );
+ OUT_RING( 0 );
OUT_RING( 0 );
- ADVANCE_LP_RING();
+ ADVANCE_LP_RING();
i830_wait_ring( dev, dev_priv->ring.Size - 8, __FUNCTION__ );
for (i = 0; i < dma->buf_count; i++) {
drm_buf_t *buf = dma->buflist[ i ];
- drm_i830_buf_priv_t *buf_priv = buf->dev_private;
-
- int used = cmpxchg(buf_priv->in_use, I830_BUF_HARDWARE,
- I830_BUF_FREE);
-
- if (used == I830_BUF_HARDWARE)
- DRM_DEBUG("reclaimed from HARDWARE\n");
- if (used == I830_BUF_CLIENT)
- DRM_DEBUG("still on client\n");
+ drm_i830_buf_priv_t *buf_priv = buf->dev_private;
+ cmpxchg(buf_priv->in_use, I830_BUF_HARDWARE, I830_BUF_FREE);
}
-
- return ret;
}
/* Must be called with the lock held */
@@ -1396,7 +1372,7 @@ void i830_reclaim_buffers( struct file *filp )
if (!dev->dev_private) return;
if (!dma->buflist) return;
- i830_flush_queue(dev);
+ i830_dma_quiescent(dev);
for (i = 0; i < dma->buf_count; i++) {
drm_buf_t *buf = dma->buflist[ i ];
@@ -1424,7 +1400,7 @@ int i830_flush_ioctl( DRM_IOCTL_ARGS )
return DRM_ERR(EINVAL);
}
- i830_flush_queue(dev);
+ i830_dma_quiescent(dev);
return 0;
}