[v2,3/3] gallium/auxiliary/vl: Add barrier/unbind after compute shader launch.

Submitted by Zhu, James on April 3, 2019, 3:01 p.m.

Details

Message ID 1554303699-7133-1-git-send-email-James.Zhu@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 2 ) in Mesa

Not browsing as part of any series.

Commit Message

Zhu, James April 3, 2019, 3:01 p.m.
Add memory barrier sync for multiple launch cases, and unbind completed
resources after launch.

Signed-off-by: James Zhu <James.Zhu@amd.com>

---
 src/gallium/auxiliary/vl/vl_compositor_cs.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

-- 
2.7.4

Patch hide | download patch | download mbox

diff --git a/src/gallium/auxiliary/vl/vl_compositor_cs.c b/src/gallium/auxiliary/vl/vl_compositor_cs.c
index c3afe61..a659fd2 100644
--- a/src/gallium/auxiliary/vl/vl_compositor_cs.c
+++ b/src/gallium/auxiliary/vl/vl_compositor_cs.c
@@ -292,6 +292,10 @@  cs_launch(struct vl_compositor *c,
    info.grid[2] = 1;
 
    ctx->launch_grid(ctx, &info);
+
+   /* Make the result visible to all clients. */
+   ctx->memory_barrier(ctx, PIPE_BARRIER_ALL);
+
 }
 
 static inline struct u_rect
@@ -389,6 +393,13 @@  draw_layers(struct vl_compositor       *c,
 
          cs_launch(c, layer->cs, &(drawn.area));
 
+         /* Unbind. */
+         ctx->set_shader_images(ctx, PIPE_SHADER_COMPUTE, 0, 1, NULL);
+         ctx->set_constant_buffer(ctx, PIPE_SHADER_COMPUTE, 0, NULL);
+         ctx->set_sampler_views(c->pipe, PIPE_SHADER_FRAGMENT, 0, num_sampler_views, NULL);
+         ctx->bind_compute_state(ctx, NULL);
+         ctx->bind_sampler_states(c->pipe, PIPE_SHADER_COMPUTE, 0, num_sampler_views, NULL);
+
          if (dirty) {
             struct u_rect drawn = calc_drawn_area(s, layer);
             dirty->x0 = MIN2(drawn.x0, dirty->x0);

Comments