Mesa (main): turnip: Do not use hw binning if tiles per pipe are over the limit

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 4 06:30:10 UTC 2022


Module: Mesa
Branch: main
Commit: 5e4bf6d100b3f4492ee3a897a4fbccc9c0564371
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e4bf6d100b3f4492ee3a897a4fbccc9c0564371

Author: Danylo Piliaiev <dpiliaiev at igalia.com>
Date:   Thu Feb  3 14:04:01 2022 +0200

turnip: Do not use hw binning if tiles per pipe are over the limit

Otherwise GPU would hang.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5951

Freedreno commit as a reference:
39d00722b22a0059bbc58f0158a22f384519cd39

Fixes VK cts tests on a618 if their memory limit is raised to 1024 MB:
 dEQP-VK.pipeline.render_to_image.core.2d_array.huge.width_height.r8g8b8a8_unorm_d16_unorm
 dEQP-VK.pipeline.render_to_image.core.2d_array.huge.width_height.r8g8b8a8_unorm_s8_uint
 dEQP-VK.pipeline.render_to_image.core.2d_array.huge.width_height.r8g8b8a8_unorm_d24_unorm_s8_uint
 dEQP-VK.pipeline.render_to_image.core.2d_array.huge.width_height.r8g8b8a8_unorm_d32_sfloat_s8_uint
 dEQP-VK.pipeline.render_to_image.core.cube.huge.width_height.r8g8b8a8_unorm
 dEQP-VK.pipeline.render_to_image.core.cube.huge.width_height.r8g8b8a8_unorm_d16_unorm
 dEQP-VK.pipeline.render_to_image.core.cube.huge.width_height.r8g8b8a8_unorm_s8_uint
 dEQP-VK.pipeline.render_to_image.core.cube.huge.width_height.r8g8b8a8_unorm_d24_unorm_s8_uint
 dEQP-VK.pipeline.render_to_image.core.cube_array.huge.width_height.r8g8b8a8_unorm
 dEQP-VK.pipeline.render_to_image.core.cube_array.huge.width_height.r8g8b8a8_unorm_d24_unorm_s8_uint

Signed-off-by: Danylo Piliaiev <dpiliaiev at igalia.com>
Tested-by: Chia-I Wu <olvaffe at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14849>

---

 src/freedreno/vulkan/tu_cmd_buffer.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c
index 3f1a7aec9a6..e029794f544 100644
--- a/src/freedreno/vulkan/tu_cmd_buffer.c
+++ b/src/freedreno/vulkan/tu_cmd_buffer.c
@@ -569,6 +569,17 @@ tu_cs_emit_draw_state(struct tu_cs *cs, uint32_t id, struct tu_draw_state state)
    tu_cs_emit_qw(cs, state.iova);
 }
 
+static bool
+is_hw_binning_possible(const struct tu_framebuffer *fb)
+{
+   /* Similar to older gens, # of tiles per pipe cannot be more than 32.
+    * But there are no hangs with 16 or more tiles per pipe in either
+    * X or Y direction, so that limit does not seem to apply.
+    */
+   uint32_t tiles_per_pipe = fb->pipe0.width * fb->pipe0.height;
+   return tiles_per_pipe <= 32;
+}
+
 static bool
 use_hw_binning(struct tu_cmd_buffer *cmd)
 {
@@ -578,8 +589,13 @@ use_hw_binning(struct tu_cmd_buffer *cmd)
     * with non-hw binning GMEM rendering. this is required because some of the
     * XFB commands need to only be executed once
     */
-   if (cmd->state.xfb_used)
+   if (cmd->state.xfb_used) {
+      assert(is_hw_binning_possible(fb));
       return true;
+   }
+
+   if (!is_hw_binning_possible(fb))
+      return false;
 
    if (unlikely(cmd->device->physical_device->instance->debug_flags & TU_DEBUG_NOBIN))
       return false;
@@ -615,6 +631,10 @@ use_sysmem_rendering(struct tu_cmd_buffer *cmd,
    if (cmd->state.disable_gmem)
       return true;
 
+   /* XFB is incompatible with non-hw binning GMEM rendering, see use_hw_binning */
+   if (cmd->state.xfb_used && !is_hw_binning_possible(cmd->state.framebuffer))
+      return true;
+
    if (unlikely(cmd->device->physical_device->instance->debug_flags & TU_DEBUG_GMEM))
       return false;
 



More information about the mesa-commit mailing list