summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2007-06-22 19:18:04 +1000
committerDave Airlie <airlied@linux.ie>2007-06-22 19:18:04 +1000
commit0f7f6e4e9586b792548349567ba1646fcf1cac44 (patch)
tree1598a77ad90ab583d1275f48d5b6567525e1b924 /src/mesa/drivers
parent41d28d97f5916ff1bdaae525c4de0e53e2dc470c (diff)
clean up cache flush emission into one place
makes gears work with swtcl
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/r300/r300_emit.c16
-rw-r--r--src/mesa/drivers/dri/r300/r300_emit.h1
-rw-r--r--src/mesa/drivers/dri/r300/r300_ioctl.c6
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c16
-rw-r--r--src/mesa/drivers/dri/r300/r300_swtcl.c26
5 files changed, 25 insertions, 40 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c
index adeb688d19..a7763bd76e 100644
--- a/src/mesa/drivers/dri/r300/r300_emit.c
+++ b/src/mesa/drivers/dri/r300/r300_emit.c
@@ -532,3 +532,19 @@ void r300ReleaseArrays(GLcontext * ctx)
r300ReleaseDmaRegion(rmesa, &rmesa->state.aos[i], __FUNCTION__);
}
}
+
+void r300EmitCacheFlush(r300ContextPtr rmesa)
+{
+ int cmd_reserved = 0;
+ int cmd_written = 0;
+
+ drm_radeon_cmd_header_t *cmd = NULL;
+
+ reg_start(R300_RB3D_DSTCACHE_CTLSTAT, 0);
+ e32(R300_RB3D_DSTCACHE_UNKNOWN_0A);
+
+ reg_start(R300_RB3D_ZCACHE_CTLSTAT, 0);
+ e32(R300_RB3D_ZCACHE_UNKNOWN_03);
+
+
+}
diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h
index ce7279bbef..400e97f6f8 100644
--- a/src/mesa/drivers/dri/r300/r300_emit.h
+++ b/src/mesa/drivers/dri/r300/r300_emit.h
@@ -228,4 +228,5 @@ extern void r300ReleaseArrays(GLcontext * ctx);
extern int r300PrimitiveType(r300ContextPtr rmesa, int prim);
extern int r300NumVerts(r300ContextPtr rmesa, int num_verts, int prim);
+extern void r300EmitCacheFlush(r300ContextPtr rmesa);
#endif
diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c
index f7a44832e9..1001c4ec07 100644
--- a/src/mesa/drivers/dri/r300/r300_ioctl.c
+++ b/src/mesa/drivers/dri/r300/r300_ioctl.c
@@ -172,11 +172,7 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
cmd2[7].u = r300PackFloat32(ctx->Color.ClearColor[2]);
cmd2[8].u = r300PackFloat32(ctx->Color.ClearColor[3]);
- reg_start(R300_RB3D_DSTCACHE_CTLSTAT, 0);
- e32(R300_RB3D_DSTCACHE_UNKNOWN_0A);
-
- reg_start(R300_RB3D_ZCACHE_CTLSTAT, 0);
- e32(R300_RB3D_ZCACHE_UNKNOWN_03);
+ r300EmitCacheFlush(rmesa);
cp_wait(rmesa, R300_WAIT_3D | R300_WAIT_3D_CLEAN);
}
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index 7d97245281..db935795c7 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -287,9 +287,6 @@ static GLboolean r300RunRender(GLcontext * ctx,
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
int i;
- int cmd_reserved = 0;
- int cmd_written = 0;
- drm_radeon_cmd_header_t *cmd = NULL;
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *vb = &tnl->vb;
@@ -303,12 +300,7 @@ static GLboolean r300RunRender(GLcontext * ctx,
r300UpdateShaderStates(rmesa);
- reg_start(R300_RB3D_DSTCACHE_CTLSTAT, 0);
- e32(R300_RB3D_DSTCACHE_UNKNOWN_0A);
-
- reg_start(R300_RB3D_ZCACHE_CTLSTAT, 0);
- e32(R300_RB3D_ZCACHE_UNKNOWN_03);
-
+ r300EmitCacheFlush(rmesa);
r300EmitState(rmesa);
for (i = 0; i < vb->PrimitiveCount; i++) {
@@ -318,11 +310,7 @@ static GLboolean r300RunRender(GLcontext * ctx,
r300RunRenderPrimitive(rmesa, ctx, start, end, prim);
}
- reg_start(R300_RB3D_DSTCACHE_CTLSTAT, 0);
- e32(R300_RB3D_DSTCACHE_UNKNOWN_0A);
-
- reg_start(R300_RB3D_ZCACHE_CTLSTAT, 0);
- e32(R300_RB3D_ZCACHE_UNKNOWN_03);
+ r300EmitCacheFlush(rmesa);
#ifdef USER_BUFFERS
r300UseArrays(ctx);
diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c
index 35b0235aa1..e340f0b6e3 100644
--- a/src/mesa/drivers/dri/r300/r300_swtcl.c
+++ b/src/mesa/drivers/dri/r300/r300_swtcl.c
@@ -370,7 +370,7 @@ static void flush_last_swtcl_prim( r300ContextPtr rmesa )
if (rmesa->dma.current.start != rmesa->dma.current.ptr) {
- r300EnsureCmdBufSpace( rmesa, rmesa->hw.max_state_size + (8*sizeof(int)), __FUNCTION__);
+ r300EnsureCmdBufSpace( rmesa, rmesa->hw.max_state_size + (12*sizeof(int)), __FUNCTION__);
r300EmitVertexAOS( rmesa,
rmesa->swtcl.vertex_size,
current_offset);
@@ -378,6 +378,8 @@ static void flush_last_swtcl_prim( r300ContextPtr rmesa )
r300EmitVbufPrim( rmesa,
rmesa->swtcl.hw_primitive,
rmesa->swtcl.numverts);
+
+ r300EmitCacheFlush(rmesa);
}
rmesa->swtcl.numverts = 0;
@@ -679,11 +681,7 @@ static void r300ChooseRenderState( GLcontext *ctx )
static void r300RenderStart(GLcontext *ctx)
{
- r300ContextPtr rmesa = R300_CONTEXT( ctx );
- int cmd_reserved = 0;
- int cmd_written = 0;
- drm_radeon_cmd_header_t *cmd = NULL;
-
+ r300ContextPtr rmesa = R300_CONTEXT( ctx );
// fprintf(stderr, "%s\n", __FUNCTION__);
r300ChooseRenderState(ctx);
@@ -691,11 +689,7 @@ static void r300RenderStart(GLcontext *ctx)
r300UpdateShaderStates(rmesa);
- reg_start(R300_RB3D_DSTCACHE_CTLSTAT, 0);
- e32(R300_RB3D_DSTCACHE_UNKNOWN_0A);
-
- reg_start(R300_RB3D_ZCACHE_CTLSTAT, 0);
- e32(R300_RB3D_ZCACHE_UNKNOWN_03);
+ r300EmitCacheFlush(rmesa);
if (rmesa->dma.flush != 0 &&
rmesa->dma.flush != flush_last_swtcl_prim)
@@ -705,16 +699,6 @@ static void r300RenderStart(GLcontext *ctx)
static void r300RenderFinish(GLcontext *ctx)
{
- r300ContextPtr rmesa = R300_CONTEXT( ctx );
- int cmd_reserved = 0;
- int cmd_written = 0;
- drm_radeon_cmd_header_t *cmd = NULL;
-
- reg_start(R300_RB3D_DSTCACHE_CTLSTAT, 0);
- e32(R300_RB3D_DSTCACHE_UNKNOWN_0A);
-
- reg_start(R300_RB3D_ZCACHE_CTLSTAT, 0);
- e32(R300_RB3D_ZCACHE_UNKNOWN_03);
}
static void r300RasterPrimitive( GLcontext *ctx, GLuint hwprim )