diff options
Diffstat (limited to 'src/gallium/drivers/radeonsi/radeonsi_pm4.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/radeonsi_pm4.c | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pm4.c b/src/gallium/drivers/radeonsi/radeonsi_pm4.c index da680dc1ee1..13fe99be3bd 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pm4.c +++ b/src/gallium/drivers/radeonsi/radeonsi_pm4.c @@ -131,7 +131,7 @@ void si_pm4_free_state(struct r600_context *rctx, if (state == NULL) return; - if (rctx->emitted.array[idx] == state) { + if (idx != ~0 && rctx->emitted.array[idx] == state) { rctx->emitted.array[idx] = NULL; } @@ -141,10 +141,24 @@ void si_pm4_free_state(struct r600_context *rctx, FREE(state); } +uint32_t si_pm4_sync_flags(struct r600_context *rctx) +{ + uint32_t cp_coher_cntl = 0; + + for (int i = 0; i < NUMBER_OF_STATES; ++i) { + struct si_pm4_state *state = rctx->queued.array[i]; + + if (!state || rctx->emitted.array[i] == state) + continue; + + cp_coher_cntl |= state->cp_coher_cntl; + } + return cp_coher_cntl; +} + unsigned si_pm4_dirty_dw(struct r600_context *rctx) { unsigned count = 0; - uint32_t cp_coher_cntl = 0; for (int i = 0; i < NUMBER_OF_STATES; ++i) { struct si_pm4_state *state = rctx->queued.array[i]; @@ -153,33 +167,32 @@ unsigned si_pm4_dirty_dw(struct r600_context *rctx) continue; count += state->ndw; - cp_coher_cntl |= state->cp_coher_cntl; } - //TODO - rctx->atom_surface_sync.flush_flags |= cp_coher_cntl; - r600_atom_dirty(rctx, &rctx->atom_surface_sync.atom); return count; } -void si_pm4_emit_dirty(struct r600_context *rctx) +void si_pm4_emit(struct r600_context *rctx, struct si_pm4_state *state) { struct radeon_winsys_cs *cs = rctx->cs; + for (int i = 0; i < state->nbo; ++i) { + r600_context_bo_reloc(rctx, state->bo[i], + state->bo_usage[i]); + } + memcpy(&cs->buf[cs->cdw], state->pm4, state->ndw * 4); + cs->cdw += state->ndw; +} + +void si_pm4_emit_dirty(struct r600_context *rctx) +{ for (int i = 0; i < NUMBER_OF_STATES; ++i) { struct si_pm4_state *state = rctx->queued.array[i]; if (!state || rctx->emitted.array[i] == state) continue; - for (int j = 0; j < state->nbo; ++j) { - r600_context_bo_reloc(rctx, state->bo[j], - state->bo_usage[j]); - } - - memcpy(&cs->buf[cs->cdw], state->pm4, state->ndw * 4); - cs->cdw += state->ndw; - + si_pm4_emit(rctx, state); rctx->emitted.array[i] = state; } } |