From: Dave Airlie Date: Fri, 24 Nov 2017 00:51:35 +0000 (+1000) Subject: r600: always flush between gfx and compute X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4388bbbf2990df86a447a55de450d262c777be45;p=mesa.git 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 --- diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index 06f8bc16ced..45fba007787 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 96475e64b59..f64d6150037 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 05d04f5399e..34075f687af 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 0f5dc6b3997..e042edf2b40 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 edb2597ef4e..e5a5a333679 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)) {