summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Zhu <James.Zhu@amd.com>2019-03-29 15:59:39 -0400
committerLeo Liu <leo.liu@amd.com>2019-04-05 09:50:52 -0400
commit0f416b85fbb2a3988ddc2c81540e9aadfd63d6ae (patch)
tree99c4f345b2592ed8ae38d5f4b9ec506b5511bba8
parent4bbc9c493f4b923516d9ef40b41a0dd7648fdb1e (diff)
gallium/auxiliary/vl: Add barrier/unbind after compute shader launch.
Add memory barrier sync for multiple launch cases, and unbind completed resources after launch. Signed-off-by: James Zhu <James.Zhu@amd.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--src/gallium/auxiliary/vl/vl_compositor_cs.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/vl/vl_compositor_cs.c b/src/gallium/auxiliary/vl/vl_compositor_cs.c
index c3afe618117..485b4174b8e 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,15 @@ draw_layers(struct vl_compositor *c,
cs_launch(c, layer->cs, &(drawn.area));
+ /* Unbind. */
+ c->pipe->set_shader_images(c->pipe, PIPE_SHADER_COMPUTE, 0, 1, NULL);
+ c->pipe->set_constant_buffer(c->pipe, PIPE_SHADER_COMPUTE, 0, NULL);
+ c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_FRAGMENT, 0,
+ num_sampler_views, NULL);
+ c->pipe->bind_compute_state(c->pipe, NULL);
+ c->pipe->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);