turnip: Skip load/stores for tiles with no geometry
authorDanylo Piliaiev <dpiliaiev@igalia.com>
Thu, 14 Apr 2022 14:19:21 +0000 (17:19 +0300)
committerMarge Bot <emma+marge@anholt.net>
Fri, 29 Apr 2022 09:29:55 +0000 (09:29 +0000)
commit0c489f18cb27d3c725f424f8f57d45636f4eb297
tree62d7347baa21345f0908a215db7565dd2ddb220b
parentd5debf0d8afab24e3034288d5a03caacf7b5cdd2
turnip: Skip load/stores for tiles with no geometry

When HW binning is used tile loads/stores could be skipped
if there is no geometry in the tile.

Loads could be skipped when:
- The attachment won't be resolved, otherwise if load is skipped
  there would be holes in the resolved attachment;
- There is no vkCmdClearAttachments afterwards since it is likely
  a partial clear done via 2d blit (2d blit doesn't produce geometry).

Stores could be skipped when:
- The attachment was not cleared, which may happen by load_op or
  vkCmdClearAttachments;
- When store is not a resolve.

I chose to predicate each load/store separately to allow them to be
skipped when only some attachments are cleared or resolved.

Gmem loads are moved into separate cs because whether to emit
CP_COND_REG_EXEC depends on HW binning being enabled and usage of
vkCmdClearAttachments.

CP_COND_REG_EXEC predicate could be changed during draw_cs only
by perf query, in such case the predicate should be re-emitted.
(At the moment it is always re-emitted before stores)

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15974>
src/freedreno/vulkan/tu_clear_blit.c
src/freedreno/vulkan/tu_cmd_buffer.c
src/freedreno/vulkan/tu_pass.c
src/freedreno/vulkan/tu_private.h
src/freedreno/vulkan/tu_query.c