turnip: avoid FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8 for event blits

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>
This commit is contained in:
Chia-I Wu 2023-02-01 10:38:01 -08:00 committed by Marge Bot
parent dc1fab8b8c
commit 28d0ddead0
2 changed files with 10 additions and 1 deletions

View 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);
}

View 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)));