summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2000-02-14 05:02:20 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2000-02-14 05:02:20 +0000
commit4a1d30de1e4caa16cfa3ef5a29dc0901fed36818 (patch)
tree7312ff5edfb3649f9bbbf83031a1bff15196ac8a
parentfcb9e630da894a5e82295a7e64442e8d7a3d737d (diff)
vertex dispatch improvements
-rw-r--r--linux/mga_dma.c44
-rw-r--r--linux/mga_dma.h5
-rw-r--r--linux/mga_drm_public.h14
3 files changed, 47 insertions, 16 deletions
diff --git a/linux/mga_dma.c b/linux/mga_dma.c
index 2d4fe2fd..30e82e79 100644
--- a/linux/mga_dma.c
+++ b/linux/mga_dma.c
@@ -633,31 +633,38 @@ static void mga_dma_dispatch_vertex(drm_device_t *dev, drm_buf_t *buf)
unsigned long address = (unsigned long)real_buf->bus_address;
int length = buf->used; /* this is correct */
int use_agp = PDEA_pagpxfer_enable;
- int i, count;
+ int i = 0;
PRIMLOCALS;
PRIMRESET(dev_priv);
- count = buf_priv->nbox;
-
- if (count)
- mgaEmitState( dev_priv, buf_priv );
if (MGA_VERBOSE)
printk("dispatch vertex addr 0x%lx, length 0x%x nbox %d\n",
address, length, buf_priv->nbox);
- for (i = 0 ; i < count ; i++) {
- mgaEmitClipRect( dev_priv, &buf_priv->boxes[i] );
+ if (!buf_priv->vertex_discard) {
- PRIMGETPTR(dev_priv);
- PRIMOUTREG( MGAREG_DMAPAD, 0);
- PRIMOUTREG( MGAREG_DMAPAD, 0);
- PRIMOUTREG( MGAREG_SECADDRESS, ((__u32)address) | TT_VERTEX);
- PRIMOUTREG( MGAREG_SECEND, (((__u32)(address + length)) |
- use_agp));
- PRIMADVANCE( dev_priv );
+ mgaEmitState( dev_priv, buf_priv );
+
+ do {
+ if (i < buf_priv->nbox)
+ mgaEmitClipRect( dev_priv,
+ &buf_priv->boxes[i] );
+
+
+ PRIMGETPTR(dev_priv);
+ PRIMOUTREG( MGAREG_DMAPAD, 0);
+ PRIMOUTREG( MGAREG_DMAPAD, 0);
+ PRIMOUTREG( MGAREG_SECADDRESS,
+ ((__u32)address) | TT_VERTEX);
+ PRIMOUTREG( MGAREG_SECEND,
+ (((__u32)(address + length)) |
+ use_agp));
+ PRIMADVANCE( dev_priv );
+ } while (++i < buf_priv->nbox);
}
+
dev_priv->last_sync_tag = mga_create_sync_tag(dev_priv);
@@ -1043,6 +1050,7 @@ static int mga_do_dma(drm_device_t *dev, int locked)
drm_device_dma_t *dma = dev->dma;
drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
drm_mga_buf_priv_t *buf_priv;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
if (MGA_VERBOSE) printk("mga_do_dma\n");
if (test_and_set_bit(0, &dev->dma_flag)) {
@@ -1114,7 +1122,13 @@ static int mga_do_dma(drm_device_t *dev, int locked)
buf->list = DRM_LIST_PEND;
buf_priv = buf->dev_private;
- if (MGA_VERBOSE) printk("mga_do_dma - type %d\n", buf_priv->dma_type);
+ sarea_priv->last_dispatch = buf_priv->age;
+
+ if (MGA_VERBOSE)
+ printk("mga_do_dma - type %d age %d\n",
+ buf_priv->dma_type,
+ buf_priv->age);
+
switch (buf_priv->dma_type) {
case MGA_DMA_GENERAL:
diff --git a/linux/mga_dma.h b/linux/mga_dma.h
index e93939ae..e91f608b 100644
--- a/linux/mga_dma.h
+++ b/linux/mga_dma.h
@@ -21,7 +21,10 @@ typedef struct {
unsigned short clear_zval;
unsigned int clear_flags;
- unsigned int vertex_real_idx;
+ unsigned int vertex_real_idx;
+ unsigned int vertex_discard;
+
+ unsigned int age;
unsigned int nbox;
xf86drmClipRectRec boxes[MGA_NR_SAREA_CLIPRECTS];
diff --git a/linux/mga_drm_public.h b/linux/mga_drm_public.h
index 01e76e1a..13386e8b 100644
--- a/linux/mga_drm_public.h
+++ b/linux/mga_drm_public.h
@@ -190,11 +190,20 @@ typedef struct
unsigned int nbox;
xf86drmClipRectRec boxes[MGA_NR_SAREA_CLIPRECTS];
+
+ int last_enqueue; /* last time a buffer was enqueued */
+ int last_dispatch; /* age of the most recently dispatched buffer */
+ int last_quiescent; /* */
+
+
/* kernel doesn't touch from here down */
int ctxOwner;
mgaTexRegion texList[MGA_NR_TEX_REGIONS+1];
int texAge;
+
+
+
} drm_mga_sarea_t;
@@ -205,11 +214,13 @@ typedef struct {
int clear_color;
int clear_depth;
int flags;
+ int age;
} drm_mga_clear_t;
typedef struct {
int idx;
+ int age;
} drm_mga_swap_t;
typedef struct {
@@ -218,6 +229,7 @@ typedef struct {
unsigned int pitch;
xf86drmClipRectRec texture;
int idx;
+ int age;
} drm_mga_iload_t;
@@ -233,6 +245,8 @@ typedef struct {
int idx; /* buffer to queue and free on completion */
int real_idx; /* buffer to execute */
int real_used; /* buf->used in for real buffer */
+ int age;
+ int discard;
} drm_mga_vertex_t;