turnip: Always use GMEM for feedback loops in autotuner
authorDanylo Piliaiev <dpiliaiev@igalia.com>
Thu, 17 Feb 2022 15:02:06 +0000 (17:02 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 23 Feb 2022 11:31:59 +0000 (11:31 +0000)
For ordinary feedback loops GMEM is a lot faster than sysmem since
we don't set SINGLE_PRIM mode.

For feedback loops with ordered rasterization GMEM should also be
faster.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15106>

src/freedreno/vulkan/tu_autotune.c

index cee3321..421de8b 100644 (file)
@@ -474,6 +474,19 @@ tu_autotune_use_bypass(struct tu_autotune *at,
    const struct tu_render_pass *pass = cmd_buffer->state.pass;
    const struct tu_framebuffer *framebuffer = cmd_buffer->state.framebuffer;
 
+   for (unsigned i = 0; i < pass->subpass_count; i++) {
+      const struct tu_subpass *subpass = &pass->subpasses[i];
+      /* GMEM works much faster in this case */
+      if (subpass->raster_order_attachment_access)
+         return false;
+
+      /* Would be very slow in sysmem mode because we have to enable
+       * SINGLE_PRIM_MODE(FLUSH_PER_OVERLAP_AND_OVERWRITE)
+       */
+      if (subpass->feedback_loop_color || subpass->feedback_loop_ds)
+         return false;
+   }
+
    /* If we would want to support buffers that could be submitted
     * several times we would have to copy the sample counts of renderpasses
     * after each submission of such buffer (like with u_trace support).