r600: always flush between gfx and compute
authorDave Airlie <airlied@redhat.com>
Fri, 24 Nov 2017 00:51:35 +0000 (10:51 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 18 Dec 2017 04:30:03 +0000 (04:30 +0000)
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@redhat.com>
src/gallium/drivers/r600/evergreen_compute.c
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_state_common.c

index 06f8bc16ced6b4b2d15658c0f2361185d7dcf57e..45fba0077873a390a7ab720587ca30fb7e60eb82 100644 (file)
@@ -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);
index 96475e64b599a934505501ea3f31d883ffec51c0..f64d6150037ccf7ac8c7254dee0e1f19a9b1f47a 100644 (file)
@@ -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;
index 05d04f5399eb333c4338b64cc23d3e722e84d0bf..34075f687afb17fd7bcc9fd469519f96adeb0dfe 100644 (file)
@@ -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);
index 0f5dc6b3997dbc773440a446f81ec2cb10834275..e042edf2b40ebfc4a64dda170100a83ed8668047 100644 (file)
@@ -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;
 };
index edb2597ef4e2e0aed1c466a6849dd4d992d38e69..e5a5a333679e1a61e403c1aa29ced4eab689c17b 100644 (file)
@@ -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)) {