summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_gs_state.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-01-02 16:55:21 -0800
committerEric Anholt <eric@anholt.net>2008-01-03 15:46:16 -0800
commit8abffada70fcd62e3c2dcbcdc6d00d258805326b (patch)
treed04daf5de22d6bbdb97beda35da6b33f4f1bc6c1 /src/mesa/drivers/dri/i965/brw_gs_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_gs_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs_state.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_gs_state.c b/src/mesa/drivers/dri/i965/brw_gs_state.c
index 5cff15a7a4..bf38fd7385 100644
--- a/src/mesa/drivers/dri/i965/brw_gs_state.c
+++ b/src/mesa/drivers/dri/i965/brw_gs_state.c
@@ -73,6 +73,7 @@ static dri_bo *
gs_unit_create_from_key(struct brw_context *brw, struct brw_gs_unit_key *key)
{
struct brw_gs_unit_state gs;
+ dri_bo *bo;
memset(&gs, 0, sizeof(gs));
@@ -97,12 +98,22 @@ gs_unit_create_from_key(struct brw_context *brw, struct brw_gs_unit_key *key)
if (INTEL_DEBUG & DEBUG_STATS)
gs.thread4.stats_enable = 1;
- brw->gs.thread0_delta = gs.thread0.grf_reg_count << 1;
- return brw_upload_cache(&brw->cache, BRW_GS_UNIT,
- key, sizeof(*key),
- &brw->gs.prog_bo, 1,
- &gs, sizeof(gs),
- NULL, NULL);
+ bo = brw_upload_cache(&brw->cache, BRW_GS_UNIT,
+ key, sizeof(*key),
+ &brw->gs.prog_bo, 1,
+ &gs, sizeof(gs),
+ NULL, NULL);
+
+ if (key->prog_active) {
+ /* Emit GS program relocation */
+ dri_emit_reloc(bo,
+ DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
+ gs.thread0.grf_reg_count << 1,
+ offsetof(struct brw_gs_unit_state, thread0),
+ brw->gs.prog_bo);
+ }
+
+ return bo;
}
static void upload_gs_unit( struct brw_context *brw )
@@ -121,18 +132,6 @@ static void upload_gs_unit( struct brw_context *brw )
}
}
-static void emit_reloc_gs_unit(struct brw_context *brw)
-{
- if (brw->gs.prog_active) {
- /* Emit GS program relocation */
- dri_emit_reloc(brw->gs.state_bo,
- DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
- brw->gs.thread0_delta,
- offsetof(struct brw_gs_unit_state, thread0),
- brw->gs.prog_bo);
- }
-}
-
const struct brw_tracked_state brw_gs_unit = {
.dirty = {
.mesa = 0,
@@ -141,5 +140,4 @@ const struct brw_tracked_state brw_gs_unit = {
.cache = CACHE_NEW_GS_PROG
},
.update = upload_gs_unit,
- .emit_reloc = emit_reloc_gs_unit,
};