radeonsi: flush TC L2 before using a compute indirect buffer
authorMarek Olšák <marek.olsak@amd.com>
Thu, 8 Sep 2016 18:15:51 +0000 (20:15 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 9 Sep 2016 20:45:07 +0000 (22:45 +0200)
There is no known test for this.

Cc: 12.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_compute.c

index f43c616b2721887010f85144b8191b6b635fa497..d9882141444f9a521712894bfac4bb98c5684b39 100644 (file)
@@ -464,10 +464,18 @@ static void si_launch_grid(
 
        /* Add buffer sizes for memory checking in need_cs_space. */
        r600_context_add_resource_size(ctx, &program->shader.bo->b.b);
-       if (info->indirect)
-               r600_context_add_resource_size(ctx, info->indirect);
        /* TODO: add the scratch buffer */
 
+       if (info->indirect) {
+               r600_context_add_resource_size(ctx, info->indirect);
+
+               /* The hw doesn't read the indirect buffer via TC L2. */
+               if (r600_resource(info->indirect)->TC_L2_dirty) {
+                       sctx->b.flags |= SI_CONTEXT_INV_GLOBAL_L2;
+                       r600_resource(info->indirect)->TC_L2_dirty = false;
+               }
+       }
+
        si_need_cs_space(sctx);
 
        if (!sctx->cs_shader_state.initialized)