iris: Insert buffer-local memory barriers for VF reads.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 5 May 2020 19:02:07 +0000 (12:02 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 2 Sep 2021 03:14:37 +0000 (03:14 +0000)
This ensures that any required synchronization (i.e. PIPE_CONTROL)
commands are emitted whenever a vertex or index buffer is used in
cases where it had been previously accessed from an incoherent caching
domain.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12691>

src/gallium/drivers/iris/iris_state.c

index f5d9e65..9854244 100644 (file)
@@ -6400,6 +6400,10 @@ iris_upload_dirty_render_state(struct iris_context *ice,
          uint64_t bound = dynamic_bound;
          while (bound) {
             const int i = u_bit_scan64(&bound);
+
+            iris_emit_buffer_barrier_for(
+               batch, iris_resource_bo(genx->vertex_buffers[i].resource),
+               IRIS_DOMAIN_VF_READ);
             iris_use_optional_res(batch, genx->vertex_buffers[i].resource,
                                   false, IRIS_DOMAIN_VF_READ);
          }
@@ -6423,6 +6427,8 @@ iris_upload_dirty_render_state(struct iris_context *ice,
             struct iris_resource *res =
                (void *) genx->vertex_buffers[i].resource;
             if (res) {
+               iris_emit_buffer_barrier_for(batch, res->bo,
+                                            IRIS_DOMAIN_VF_READ);
                iris_use_pinned_bo(batch, res->bo, false, IRIS_DOMAIN_VF_READ);
 
                high_bits = res->bo->address >> 32ull;
@@ -6662,6 +6668,8 @@ iris_upload_render_state(struct iris_context *ice,
          pipe_resource_reference(&ice->state.last_res.index_buffer,
                                  draw->index.resource);
          offset = 0;
+
+         iris_emit_buffer_barrier_for(batch, res->bo, IRIS_DOMAIN_VF_READ);
       }
 
       struct iris_genx_state *genx = ice->state.genx;