mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 17:30:12 +01:00
radeonsi: emit SURFACE_SYNC last
This fixes a case where a transform feedback buffer is fed back as an index buffer, because SURFACE_SYNC must be after VS_PARTIAL_FLUSH. Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
This commit is contained in:
parent
7c9ec6ca7e
commit
d8185aa9a8
1 changed files with 51 additions and 39 deletions
|
|
@ -369,6 +369,7 @@ void si_emit_cache_flush(struct r600_common_context *sctx, struct r600_atom *ato
|
|||
{
|
||||
struct radeon_winsys_cs *cs = sctx->rings.gfx.cs;
|
||||
uint32_t cp_coher_cntl = 0;
|
||||
uint32_t sqc_caches = 0;
|
||||
uint32_t compute =
|
||||
PKT3_SHADER_TYPE_S(!!(sctx->flags & SI_CONTEXT_FLAG_COMPUTE));
|
||||
|
||||
|
|
@ -377,10 +378,9 @@ void si_emit_cache_flush(struct r600_common_context *sctx, struct r600_atom *ato
|
|||
if (sctx->chip_class == SI &&
|
||||
sctx->flags & BOTH_ICACHE_KCACHE &&
|
||||
(sctx->flags & BOTH_ICACHE_KCACHE) != BOTH_ICACHE_KCACHE) {
|
||||
r600_write_config_reg(cs, R_008C08_SQC_CACHES,
|
||||
sqc_caches =
|
||||
S_008C08_INST_INVALIDATE(!!(sctx->flags & SI_CONTEXT_INV_ICACHE)) |
|
||||
S_008C08_DATA_INVALIDATE(!!(sctx->flags & SI_CONTEXT_INV_KCACHE)));
|
||||
cs->buf[cs->cdw-3] |= compute; /* set the compute bit in the header */
|
||||
S_008C08_DATA_INVALIDATE(!!(sctx->flags & SI_CONTEXT_INV_KCACHE));
|
||||
} else {
|
||||
if (sctx->flags & SI_CONTEXT_INV_ICACHE)
|
||||
cp_coher_cntl |= S_0085F0_SH_ICACHE_ACTION_ENA(1);
|
||||
|
|
@ -409,6 +409,54 @@ void si_emit_cache_flush(struct r600_common_context *sctx, struct r600_atom *ato
|
|||
S_0085F0_DB_DEST_BASE_ENA(1);
|
||||
}
|
||||
|
||||
if (sctx->flags & SI_CONTEXT_FLUSH_AND_INV_CB_META) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_FLUSH_AND_INV_CB_META) | EVENT_INDEX(0));
|
||||
}
|
||||
if (sctx->flags & SI_CONTEXT_FLUSH_AND_INV_DB_META) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_FLUSH_AND_INV_DB_META) | EVENT_INDEX(0));
|
||||
}
|
||||
if (sctx->flags & SI_CONTEXT_FLUSH_WITH_INV_L2) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH) | EVENT_INDEX(7) |
|
||||
EVENT_WRITE_INV_L2);
|
||||
}
|
||||
|
||||
/* FLUSH_AND_INV events must be emitted before PS_PARTIAL_FLUSH.
|
||||
* Otherwise, clearing CMASK (CB meta) with CP DMA isn't reliable.
|
||||
*
|
||||
* I think the reason is that FLUSH_AND_INV is only added to a queue
|
||||
* and it is PS_PARTIAL_FLUSH that waits for it to complete.
|
||||
*/
|
||||
if (sctx->flags & SI_CONTEXT_PS_PARTIAL_FLUSH) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_PS_PARTIAL_FLUSH) | EVENT_INDEX(4));
|
||||
} else if (sctx->flags & SI_CONTEXT_VS_PARTIAL_FLUSH) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_VS_PARTIAL_FLUSH) | EVENT_INDEX(4));
|
||||
}
|
||||
if (sctx->flags & SI_CONTEXT_CS_PARTIAL_FLUSH) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_CS_PARTIAL_FLUSH | EVENT_INDEX(4)));
|
||||
}
|
||||
if (sctx->flags & SI_CONTEXT_VGT_FLUSH) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_VGT_FLUSH) | EVENT_INDEX(0));
|
||||
}
|
||||
if (sctx->flags & SI_CONTEXT_VGT_STREAMOUT_SYNC) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_VGT_STREAMOUT_SYNC) | EVENT_INDEX(0));
|
||||
}
|
||||
|
||||
/* SURFACE_SYNC must be emitted after partial flushes.
|
||||
* It looks like SURFACE_SYNC flushes caches immediately and doesn't
|
||||
* wait for any engines. This should be last.
|
||||
*/
|
||||
if (sqc_caches) {
|
||||
r600_write_config_reg(cs, R_008C08_SQC_CACHES, sqc_caches);
|
||||
cs->buf[cs->cdw-3] |= compute; /* set the compute bit in the header */
|
||||
}
|
||||
if (cp_coher_cntl) {
|
||||
if (sctx->chip_class >= CIK) {
|
||||
radeon_emit(cs, PKT3(PKT3_ACQUIRE_MEM, 5, 0) | compute);
|
||||
|
|
@ -427,42 +475,6 @@ void si_emit_cache_flush(struct r600_common_context *sctx, struct r600_atom *ato
|
|||
}
|
||||
}
|
||||
|
||||
if (sctx->flags & SI_CONTEXT_FLUSH_AND_INV_CB_META) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_FLUSH_AND_INV_CB_META) | EVENT_INDEX(0));
|
||||
}
|
||||
if (sctx->flags & SI_CONTEXT_FLUSH_AND_INV_DB_META) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_FLUSH_AND_INV_DB_META) | EVENT_INDEX(0));
|
||||
}
|
||||
if (sctx->flags & SI_CONTEXT_FLUSH_WITH_INV_L2) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH) | EVENT_INDEX(7) |
|
||||
EVENT_WRITE_INV_L2);
|
||||
}
|
||||
|
||||
if (sctx->flags & SI_CONTEXT_PS_PARTIAL_FLUSH) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_PS_PARTIAL_FLUSH) | EVENT_INDEX(4));
|
||||
} else if (sctx->flags & SI_CONTEXT_VS_PARTIAL_FLUSH) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_VS_PARTIAL_FLUSH) | EVENT_INDEX(4));
|
||||
}
|
||||
|
||||
if (sctx->flags & SI_CONTEXT_CS_PARTIAL_FLUSH) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_CS_PARTIAL_FLUSH | EVENT_INDEX(4)));
|
||||
}
|
||||
|
||||
if (sctx->flags & SI_CONTEXT_VGT_FLUSH) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_VGT_FLUSH) | EVENT_INDEX(0));
|
||||
}
|
||||
if (sctx->flags & SI_CONTEXT_VGT_STREAMOUT_SYNC) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0) | compute);
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_VGT_STREAMOUT_SYNC) | EVENT_INDEX(0));
|
||||
}
|
||||
|
||||
sctx->flags = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue