turnip: avoid FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8 for event blits
authorChia-I Wu <olvaffe@gmail.com>
Wed, 1 Feb 2023 18:38:01 +0000 (10:38 -0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 16 Feb 2023 01:35:50 +0000 (01:35 +0000)
We don't need it for event blits.  It also does not support fast clears
which makes it slower.

For event blits, blob has

  VK_FORMAT_D16_UNORM           -> FMT6_16_UNORM
  VK_FORMAT_X8_D24_UNORM_PACK32 -> FMT6_Z24_UNORM_S8_UINT
  VK_FORMAT_D32_SFLOAT          -> FMT6_32_FLOAT
  VK_FORMAT_S8_UINT             -> FMT6_8_UINT
  VK_FORMAT_D24_UNORM_S8_UINT   -> FMT6_Z24_UNORM_S8_UINT
  VK_FORMAT_D32_SFLOAT_S8_UINT  -> FMT6_32_FLOAT + FMT6_8_UINT

and always sets RB_BLIT_INFO:DEPTH.  It is unclear what
RB_BLIT_INFO:DEPTH is for but we set it anyway.

Improves "glmark2 -b refract" on angle by 15-20% on a618/a635.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8218
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21116>

src/freedreno/fdl/fd6_view.c
src/freedreno/vulkan/tu_clear_blit.c

index e6a75a7..c9d6bb9 100644 (file)
@@ -375,6 +375,7 @@ fdl6_view_init(struct fdl6_view *view, const struct fdl_layout **layouts,
 
    enum a3xx_color_swap color_swap =
       fd6_color_swap(args->format, layout->tile_mode);
+   enum a6xx_format blit_format = color_format;
 
    if (is_d24s8)
       color_format = FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8;
@@ -382,6 +383,13 @@ fdl6_view_init(struct fdl6_view *view, const struct fdl_layout **layouts,
    if (color_format == FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8 && !ubwc_enabled)
       color_format = FMT6_8_8_8_8_UNORM;
 
+   /* We don't need FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8 / FMT6_8_8_8_8_UNORM
+    * for event blits.  FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8 also does not
+    * support fast clears and is slower.
+    */
+   if (is_d24s8 || blit_format == FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8)
+      blit_format = FMT6_Z24_UNORM_S8_UINT;
+
    memset(view->storage_descriptor, 0, sizeof(view->storage_descriptor));
 
    view->storage_descriptor[0] =
@@ -427,7 +435,7 @@ fdl6_view_init(struct fdl6_view *view, const struct fdl_layout **layouts,
    view->RB_BLIT_DST_INFO =
       A6XX_RB_BLIT_DST_INFO_TILE_MODE(tile_mode) |
       A6XX_RB_BLIT_DST_INFO_SAMPLES(util_logbase2(layout->nr_samples)) |
-      A6XX_RB_BLIT_DST_INFO_COLOR_FORMAT(color_format) |
+      A6XX_RB_BLIT_DST_INFO_COLOR_FORMAT(blit_format) |
       A6XX_RB_BLIT_DST_INFO_COLOR_SWAP(color_swap) |
       COND(ubwc_enabled, A6XX_RB_BLIT_DST_INFO_FLAGS);
 }
index 404b3ae..7347472 100644 (file)
@@ -3044,6 +3044,7 @@ tu_emit_blit(struct tu_cmd_buffer *cmd,
    tu_cs_emit_regs(cs, A6XX_RB_BLIT_INFO(
       .unk0 = !resolve,
       .gmem = !resolve,
+      .depth = vk_format_is_depth_or_stencil(attachment->format),
       .sample_0 = vk_format_is_int(attachment->format) ||
          vk_format_is_depth_or_stencil(attachment->format)));