summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i965/brw_clip_state.c
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2009-11-05 22:43:36 +0000
committerKeith Whitwell <keithw@vmware.com>2009-11-05 22:43:36 +0000
commit4c196ed7a8e06933d11b96ac520afa39252fc5c7 (patch)
treed32fea2784830e7695c071104a461eb853da638f /src/gallium/drivers/i965/brw_clip_state.c
parent3763457892c2d0c654c0eca7585e4d3a863f7714 (diff)
i965g: pass relocation information in an array with bo_subdata
Makes it easier to dump as we get all of the information about the upload in a single hit. Opens the window to simplification in the driver if these relocation arrays can be maintained statically rather than being recreated whenever we check for a new upload. Still needs some cleanup to avoid uglyness introduced with the delta values.
Diffstat (limited to 'src/gallium/drivers/i965/brw_clip_state.c')
-rw-r--r--src/gallium/drivers/i965/brw_clip_state.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/gallium/drivers/i965/brw_clip_state.c b/src/gallium/drivers/i965/brw_clip_state.c
index 157e6edf19..3f2b9701e6 100644
--- a/src/gallium/drivers/i965/brw_clip_state.c
+++ b/src/gallium/drivers/i965/brw_clip_state.c
@@ -75,6 +75,7 @@ clip_unit_populate_key(struct brw_context *brw, struct brw_clip_unit_key *key)
static enum pipe_error
clip_unit_create_from_key(struct brw_context *brw,
struct brw_clip_unit_key *key,
+ struct brw_winsys_reloc *reloc,
struct brw_winsys_buffer **bo_out)
{
struct brw_clip_unit_state clip;
@@ -82,7 +83,6 @@ clip_unit_create_from_key(struct brw_context *brw,
memset(&clip, 0, sizeof(clip));
- clip.thread0.grf_reg_count = align(key->total_grf, 16) / 16 - 1;
/* reloc */
clip.thread0.kernel_start_pointer = 0;
@@ -144,36 +144,44 @@ clip_unit_create_from_key(struct brw_context *brw,
ret = brw_upload_cache(&brw->cache, BRW_CLIP_UNIT,
key, sizeof(*key),
- &brw->clip.prog_bo, 1,
+ reloc, 1,
&clip, sizeof(clip),
NULL, NULL,
bo_out);
if (ret)
return ret;
- /* Emit clip program relocation */
- assert(brw->clip.prog_bo);
- ret = brw->sws->bo_emit_reloc(*bo_out,
- BRW_USAGE_STATE,
- clip.thread0.grf_reg_count << 1,
- offsetof(struct brw_clip_unit_state, thread0),
- brw->clip.prog_bo);
- if (ret)
- return ret;
-
return PIPE_OK;
}
static int upload_clip_unit( struct brw_context *brw )
{
struct brw_clip_unit_key key;
+ struct brw_winsys_reloc reloc[1];
+ unsigned grf_reg_count;
enum pipe_error ret;
clip_unit_populate_key(brw, &key);
+ grf_reg_count = align(key.total_grf, 16) / 16 - 1;
+
+ /* clip program relocation
+ *
+ * XXX: these reloc structs are long lived and only need to be
+ * updated when the bound BO changes. Hopefully the stuff mixed in
+ * in the delta's is non-orthogonal.
+ */
+ assert(brw->clip.prog_bo);
+ make_reloc(&reloc[0],
+ BRW_USAGE_STATE,
+ grf_reg_count << 1,
+ offsetof(struct brw_clip_unit_state, thread0),
+ brw->clip.prog_bo);
+
+
if (brw_search_cache(&brw->cache, BRW_CLIP_UNIT,
&key, sizeof(key),
- &brw->clip.prog_bo, 1,
+ reloc, 1,
NULL,
&brw->clip.state_bo))
return PIPE_OK;
@@ -181,6 +189,7 @@ static int upload_clip_unit( struct brw_context *brw )
/* Create new:
*/
ret = clip_unit_create_from_key(brw, &key,
+ reloc,
&brw->clip.state_bo);
if (ret)
return ret;