Mesa (master): r600: always flush between gfx and compute
Dave Airlie
airlied at kemper.freedesktop.org
Mon Dec 18 04:30:27 UTC 2017
Module: Mesa
Branch: master
Commit: 4388bbbf2990df86a447a55de450d262c777be45
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4388bbbf2990df86a447a55de450d262c777be45
Author: Dave Airlie <airlied at redhat.com>
Date: Fri Nov 24 10:51:35 2017 +1000
r600: always flush between gfx and compute
This is in no way optimal, but there seems to be some problems
mixing at the moment, lots of hangs, it is possible, just need
to figure out more magic.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/gallium/drivers/r600/evergreen_compute.c | 5 +++++
src/gallium/drivers/r600/evergreen_state.c | 5 +++++
src/gallium/drivers/r600/r600_blit.c | 5 +++++
src/gallium/drivers/r600/r600_pipe.h | 1 +
src/gallium/drivers/r600/r600_state_common.c | 5 +++++
5 files changed, 21 insertions(+)
diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
index 06f8bc16ce..45fba00778 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -699,6 +699,11 @@ static void compute_emit_cs(struct r600_context *rctx,
r600_update_compressed_resource_state(rctx, true);
+ if (!rctx->cmd_buf_is_compute) {
+ rctx->b.gfx.flush(rctx, PIPE_FLUSH_ASYNC, NULL);
+ rctx->cmd_buf_is_compute = true;
+ }
+
r600_need_cs_space(rctx, 0, true);
if (rctx->cs_shader_state.shader->ir_type == PIPE_SHADER_IR_TGSI) {
r600_shader_select(&rctx->b.b, rctx->cs_shader_state.shader->sel, &compute_dirty);
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 96475e64b5..f64d615003 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -3792,6 +3792,11 @@ static void evergreen_dma_copy(struct pipe_context *ctx,
goto fallback;
}
+ if (rctx->cmd_buf_is_compute) {
+ rctx->b.gfx.flush(rctx, PIPE_FLUSH_ASYNC, NULL);
+ rctx->cmd_buf_is_compute = false;
+ }
+
if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
evergreen_dma_copy_buffer(rctx, dst, src, dst_x, src_box->x, src_box->width);
return;
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index 05d04f5399..34075f687a 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -54,6 +54,11 @@ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op
{
struct r600_context *rctx = (struct r600_context *)ctx;
+ if (rctx->cmd_buf_is_compute) {
+ rctx->b.gfx.flush(rctx, PIPE_FLUSH_ASYNC, NULL);
+ rctx->cmd_buf_is_compute = false;
+ }
+
util_blitter_save_vertex_buffer_slot(rctx->blitter, rctx->vertex_buffer_state.vb);
util_blitter_save_vertex_elements(rctx->blitter, rctx->vertex_fetch_shader.cso);
util_blitter_save_vertex_shader(rctx->blitter, rctx->vs_shader);
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 0f5dc6b399..e042edf2b4 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -591,6 +591,7 @@ struct r600_context {
struct r600_resource *trace_buf;
unsigned trace_id;
+ bool cmd_buf_is_compute;
struct pipe_resource *append_fence;
uint32_t append_fence_id;
};
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index edb2597ef4..e5a5a33367 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -1910,6 +1910,11 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
rctx->b.dma.flush(rctx, PIPE_FLUSH_ASYNC, NULL);
}
+ if (rctx->cmd_buf_is_compute) {
+ rctx->b.gfx.flush(rctx, PIPE_FLUSH_ASYNC, NULL);
+ rctx->cmd_buf_is_compute = false;
+ }
+
/* Re-emit the framebuffer state if needed. */
dirty_tex_counter = p_atomic_read(&rctx->b.screen->dirty_tex_counter);
if (unlikely(dirty_tex_counter != rctx->b.last_dirty_tex_counter)) {
More information about the mesa-commit
mailing list