diff options
author | Eric Anholt <eric@anholt.net> | 2008-01-02 16:55:21 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2008-01-03 15:46:16 -0800 |
commit | 8abffada70fcd62e3c2dcbcdc6d00d258805326b (patch) | |
tree | d04daf5de22d6bbdb97beda35da6b33f4f1bc6c1 /src/mesa/drivers/dri/i965/brw_clip_state.c | |
parent | 0ff3eb637bac9e100aab0a109a46e81bea9203a3 (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_clip_state.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_clip_state.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c index cec717ee26..e6e9fceb14 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_state.c +++ b/src/mesa/drivers/dri/i965/brw_clip_state.c @@ -69,6 +69,7 @@ clip_unit_create_from_key(struct brw_context *brw, struct brw_clip_unit_key *key) { struct brw_clip_unit_state clip; + dri_bo *bo; memset(&clip, 0, sizeof(clip)); @@ -106,12 +107,22 @@ clip_unit_create_from_key(struct brw_context *brw, clip.viewport_ymin = -1; clip.viewport_ymax = 1; - brw->clip.thread0_delta = clip.thread0.grf_reg_count << 1; - return brw_upload_cache(&brw->cache, BRW_CLIP_UNIT, - key, sizeof(*key), - &brw->clip.prog_bo, 1, - &clip, sizeof(clip), - NULL, NULL); + bo = brw_upload_cache(&brw->cache, BRW_CLIP_UNIT, + key, sizeof(*key), + &brw->clip.prog_bo, 1, + &clip, sizeof(clip), + NULL, NULL); + + if (!brw->metaops.active) { + /* Emit clip program relocation */ + dri_emit_reloc(bo, + DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ, + clip.thread0.grf_reg_count << 1, + offsetof(struct brw_clip_unit_state, thread0), + brw->clip.prog_bo); + } + + return bo; } static void upload_clip_unit( struct brw_context *brw ) @@ -130,18 +141,6 @@ static void upload_clip_unit( struct brw_context *brw ) } } -static void emit_reloc_clip_unit(struct brw_context *brw) -{ - if (!brw->metaops.active) { - /* Emit clip program relocation */ - dri_emit_reloc(brw->clip.state_bo, - DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ, - brw->clip.thread0_delta, - offsetof(struct brw_clip_unit_state, thread0), - brw->clip.prog_bo); - } -} - const struct brw_tracked_state brw_clip_unit = { .dirty = { .mesa = 0, @@ -150,5 +149,4 @@ const struct brw_tracked_state brw_clip_unit = { .cache = CACHE_NEW_CLIP_PROG }, .update = upload_clip_unit, - .emit_reloc = emit_reloc_clip_unit, }; |