summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/r600_pipe_common.c
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2016-04-26 19:29:55 +0200
committerMarek Olšák <marek.olsak@amd.com>2016-05-10 17:20:09 +0200
commita512da36aed3a1c893b34681dec2dfd51d250ee5 (patch)
treec75c1df6ae8562356ffff061f21fefffc2ebed04 /src/gallium/drivers/radeon/r600_pipe_common.c
parentf837c37f022ecf4925a574961027eb12f125e66c (diff)
downloadexternal_mesa3d-a512da36aed3a1c893b34681dec2dfd51d250ee5.zip
external_mesa3d-a512da36aed3a1c893b34681dec2dfd51d250ee5.tar.gz
external_mesa3d-a512da36aed3a1c893b34681dec2dfd51d250ee5.tar.bz2
gallium/radeon: fix (S)DMA read-after-write hazards
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/gallium/drivers/radeon/r600_pipe_common.c')
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index cea6b7b..3e15b14 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -149,6 +149,30 @@ void r600_need_dma_space(struct r600_common_context *ctx, unsigned num_dw)
}
}
+/* This is required to prevent read-after-write hazards. */
+void r600_dma_emit_wait_idle(struct r600_common_context *rctx)
+{
+ struct radeon_winsys_cs *cs = rctx->dma.cs;
+
+ /* done at the end of DMA calls, so increment this. */
+ rctx->num_dma_calls++;
+
+ r600_need_dma_space(rctx, 1);
+
+ if (cs->cdw == 0) /* empty queue */
+ return;
+
+ /* NOP waits for idle on Evergreen and later. */
+ if (rctx->chip_class >= CIK)
+ radeon_emit(cs, 0x00000000); /* NOP */
+ else if (rctx->chip_class >= EVERGREEN)
+ radeon_emit(cs, 0xf0000000); /* NOP */
+ else {
+ /* TODO: R600-R700 should use the FENCE packet.
+ * CS checker support is required. */
+ }
+}
+
static void r600_memory_barrier(struct pipe_context *ctx, unsigned flags)
{
}