From: Francisco Jerez Date: Fri, 29 May 2020 23:12:34 +0000 (-0700) Subject: iris: Insert buffer-local memory barriers for SSBO reads and writes. X-Git-Tag: upstream/22.3.5~18427 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=077af5c928e4678bb16310696ea2a109ed6de8bb;p=platform%2Fupstream%2Fmesa.git iris: Insert buffer-local memory barriers for SSBO reads and writes. Similar to what was previously done for vertex buffers, render buffers, etc -- Insert memory barriers at resolves-and-flushes time instead of relying on the history flush mechanism. Reviewed-by: Kenneth Graunke Part-of: --- diff --git a/src/gallium/drivers/iris/iris_resolve.c b/src/gallium/drivers/iris/iris_resolve.c index b6154f3..1bb0618 100644 --- a/src/gallium/drivers/iris/iris_resolve.c +++ b/src/gallium/drivers/iris/iris_resolve.c @@ -152,6 +152,20 @@ resolve_image_views(struct iris_context *ice, } +static void +flush_ssbos(struct iris_batch *batch, + struct iris_shader_state *shs) +{ + uint32_t ssbos = shs->bound_ssbos; + + while (ssbos) { + const int i = u_bit_scan(&ssbos); + struct pipe_shader_buffer *ssbo = &shs->ssbo[i]; + struct iris_resource *res = (void *)ssbo->buffer; + iris_emit_buffer_barrier_for(batch, res->bo, IRIS_DOMAIN_DATA_WRITE); + } +} + /** * \brief Resolve buffers before drawing. * @@ -176,6 +190,7 @@ iris_predraw_resolve_inputs(struct iris_context *ice, consider_framebuffer); resolve_image_views(ice, batch, shs, info, draw_aux_buffer_disabled, consider_framebuffer); + flush_ssbos(batch, shs); } } diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 4a34524..52388a1 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -3400,6 +3400,8 @@ iris_set_shader_buffers(struct pipe_context *ctx, } } + ice->state.dirty |= (IRIS_DIRTY_RENDER_RESOLVES_AND_FLUSHES | + IRIS_DIRTY_COMPUTE_RESOLVES_AND_FLUSHES); ice->state.stage_dirty |= IRIS_STAGE_DIRTY_BINDINGS_VS << stage; }