aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_vs_state.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2008-01-02 16:55:21 -0800
committerEric Anholt <[email protected]>2008-01-03 15:46:16 -0800
commit8abffada70fcd62e3c2dcbcdc6d00d258805326b (patch)
treed04daf5de22d6bbdb97beda35da6b33f4f1bc6c1 /src/mesa/drivers/dri/i965/brw_vs_state.c
parent0ff3eb637bac9e100aab0a109a46e81bea9203a3 (diff)
[intel] Convert relocations to not be cleared out on buffer submit.
We have two consumers of relocations. One is static state buffers, which want the same relocation every time. The other is the batchbuffer, which gets thrown out immediately after submit. This lets us reduce repeated computation for static state buffers, and clean up the code by moving relocations nearer to where the state buffer is computed.
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vs_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_state.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vs_state.c b/src/mesa/drivers/dri/i965/brw_vs_state.c
index 22e32fe6a7f..573be01a2bb 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_state.c
@@ -76,6 +76,7 @@ static dri_bo *
vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key)
{
struct brw_vs_unit_state vs;
+ dri_bo *bo;
memset(&vs, 0, sizeof(vs));
@@ -107,12 +108,20 @@ vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key)
*/
vs.vs6.vs_enable = 1;
- brw->vs.thread0_delta = vs.thread0.grf_reg_count << 1;
- return brw_upload_cache(&brw->cache, BRW_VS_UNIT,
- key, sizeof(*key),
- &brw->vs.prog_bo, 1,
- &vs, sizeof(vs),
- NULL, NULL);
+ bo = brw_upload_cache(&brw->cache, BRW_VS_UNIT,
+ key, sizeof(*key),
+ &brw->vs.prog_bo, 1,
+ &vs, sizeof(vs),
+ NULL, NULL);
+
+ /* Emit VS program relocation */
+ dri_emit_reloc(bo,
+ DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
+ vs.thread0.grf_reg_count << 1,
+ offsetof(struct brw_vs_unit_state, thread0),
+ brw->vs.prog_bo);
+
+ return bo;
}
static void upload_vs_unit( struct brw_context *brw )
@@ -131,16 +140,6 @@ static void upload_vs_unit( struct brw_context *brw )
}
}
-static void emit_reloc_vs_unit(struct brw_context *brw)
-{
- /* Emit VS program relocation */
- dri_emit_reloc(brw->vs.state_bo,
- DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
- brw->vs.thread0_delta,
- offsetof(struct brw_vs_unit_state, thread0),
- brw->vs.prog_bo);
-}
-
const struct brw_tracked_state brw_vs_unit = {
.dirty = {
.mesa = _NEW_TRANSFORM,
@@ -149,5 +148,4 @@ const struct brw_tracked_state brw_vs_unit = {
.cache = CACHE_NEW_VS_PROG
},
.update = upload_vs_unit,
- .emit_reloc = emit_reloc_vs_unit,
};