summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/radeonsi_pm4.c
diff options
context:
space:
mode:
authorChristian König <[email protected]>2012-08-12 19:16:48 +0200
committerChristian König <[email protected]>2012-08-15 22:13:19 +0200
commitf2c95d93db197fe175d510436d7f4fa45aed1180 (patch)
tree1d965766a385035a5846215b4e5f1b5fbf91d9f7 /src/gallium/drivers/radeonsi/radeonsi_pm4.c
parent4444b9d1ecddb09468d2878ffb1463a66ea0ffd3 (diff)
radeonsi: add shader data infrastructure
With this we can embed data for the shaders (like resource descriptors) into the PM4 stream. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/radeonsi_pm4.c')
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_pm4.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pm4.c b/src/gallium/drivers/radeonsi/radeonsi_pm4.c
index 13fe99be3bd..3c53ce2e172 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pm4.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_pm4.c
@@ -96,6 +96,29 @@ void si_pm4_add_bo(struct si_pm4_state *state,
state->bo_usage[idx] = usage;
}
+void si_pm4_sh_data_begin(struct si_pm4_state *state)
+{
+ si_pm4_cmd_begin(state, PKT3_NOP);
+}
+
+void si_pm4_sh_data_add(struct si_pm4_state *state, uint32_t dw)
+{
+ si_pm4_cmd_add(state, dw);
+}
+
+void si_pm4_sh_data_end(struct si_pm4_state *state, unsigned reg)
+{
+ unsigned offs = state->last_pm4 + 1;
+ si_pm4_cmd_end(state, false);
+
+ si_pm4_cmd_begin(state, PKT3_SET_SH_REG_OFFSET);
+ si_pm4_cmd_add(state, (reg - SI_SH_REG_OFFSET) >> 2);
+ state->relocs[state->nrelocs++] = state->ndw;
+ si_pm4_cmd_add(state, offs << 2);
+ si_pm4_cmd_add(state, 0);
+ si_pm4_cmd_end(state, false);
+}
+
void si_pm4_inval_shader_cache(struct si_pm4_state *state)
{
state->cp_coher_cntl |= S_0085F0_SH_ICACHE_ACTION_ENA(1);
@@ -181,6 +204,11 @@ void si_pm4_emit(struct r600_context *rctx, struct si_pm4_state *state)
}
memcpy(&cs->buf[cs->cdw], state->pm4, state->ndw * 4);
+
+ for (int i = 0; i < state->nrelocs; ++i) {
+ cs->buf[cs->cdw + state->relocs[i]] += cs->cdw << 2;
+ }
+
cs->cdw += state->ndw;
}