radeonsi: fix synchronization of shader images
authorMarek Olšák <marek.olsak@amd.com>
Thu, 28 Apr 2016 19:08:27 +0000 (21:08 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 30 Apr 2016 17:36:16 +0000 (19:36 +0200)
This fixes the winsys->cs_is_buffer_referenced query, which is used for
synchronization before buffers are mapped.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_descriptors.c

index fbaf804be907fccaa424878b5f309f95de0f3c03..27f2a7412e69a45c93d23ac50c3261b07835ba3a 100644 (file)
@@ -261,15 +261,15 @@ static void si_release_sampler_views(struct si_sampler_views *views)
 }
 
 static void si_sampler_view_add_buffer(struct si_context *sctx,
-                                      struct pipe_resource *resource)
+                                      struct pipe_resource *resource,
+                                      enum radeon_bo_usage usage)
 {
        struct r600_resource *rres = (struct r600_resource*)resource;
 
        if (!resource)
                return;
 
-       radeon_add_to_buffer_list(&sctx->b, &sctx->b.gfx, rres,
-                                 RADEON_USAGE_READ,
+       radeon_add_to_buffer_list(&sctx->b, &sctx->b.gfx, rres, usage,
                                  r600_get_sampler_view_priority(rres));
 }
 
@@ -282,7 +282,8 @@ static void si_sampler_views_begin_new_cs(struct si_context *sctx,
        while (mask) {
                int i = u_bit_scan(&mask);
 
-               si_sampler_view_add_buffer(sctx, views->views[i]->texture);
+               si_sampler_view_add_buffer(sctx, views->views[i]->texture,
+                                          RADEON_USAGE_READ);
        }
 
        views->desc.ce_ram_dirty = true;
@@ -310,7 +311,8 @@ static void si_set_sampler_view(struct si_context *sctx,
        if (view) {
                struct r600_texture *rtex = (struct r600_texture *)view->texture;
 
-               si_sampler_view_add_buffer(sctx, view->texture);
+               si_sampler_view_add_buffer(sctx, view->texture,
+                                          RADEON_USAGE_READ);
 
                pipe_sampler_view_reference(&views->views[slot], view);
                memcpy(views->desc.list + slot * 16, rview->state, 8*4);
@@ -441,7 +443,8 @@ si_image_views_begin_new_cs(struct si_context *sctx, struct si_images_info *imag
 
                assert(view->resource);
 
-               si_sampler_view_add_buffer(sctx, view->resource);
+               si_sampler_view_add_buffer(sctx, view->resource,
+                                          RADEON_USAGE_READWRITE);
        }
 
        images->desc.ce_ram_dirty = true;
@@ -495,7 +498,8 @@ si_set_shader_images(struct pipe_context *pipe, unsigned shader,
                res = (struct r600_resource *)views[i].resource;
                util_copy_image_view(&images->views[slot], &views[i]);
 
-               si_sampler_view_add_buffer(ctx, &res->b.b);
+               si_sampler_view_add_buffer(ctx, &res->b.b,
+                                          RADEON_USAGE_READWRITE);
 
                if (res->b.b.target == PIPE_BUFFER) {
                        si_make_buffer_descriptor(screen, res,