v3dv: add a heuristic for double-buffer mode
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 27 Jul 2022 09:42:01 +0000 (11:42 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 15 Aug 2022 23:35:16 +0000 (23:35 +0000)
commitad1961a4416a7f6c42625d0b51f2297f7de423a1
tree70e85223a043691e917e41f1450976d6d33eb4bd
parentd17c56078a29f6c54f4c1787747299f3e627a6b1
v3dv: add a heuristic for double-buffer mode

For this we add a scoring system that evaluates various aspects of
the draw calls in a job.

If the cost of the geometry side of the pipeline is too high, then
we may pay too high a price in double-buffer mode because with smaller
tile size may will probably have more vertex shader invocations in the
render and binning stages.

On the other hand, if rendering cost is not high enough, we may not
have enough rendering work to hide the latency of tile stores in
double-buffer mode.

Also, because we need to make a decision after we know all the draw
calls in a job, but the double-buffer enable bit comes in the
TILE_BINNING_MODE_CFG that needs to be emitted first in the binning
command list before the draw calls are recorded, if we decide to
enable it we need to rewrite that packet and we need to size the
tile state properly to account for the extra tiles. For this
purpose we delay tile state setup for render pass jobs until we are
finishing a job.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17854>
src/broadcom/vulkan/v3dv_cmd_buffer.c
src/broadcom/vulkan/v3dv_pass.c
src/broadcom/vulkan/v3dv_private.h
src/broadcom/vulkan/v3dvx_cmd_buffer.c
src/broadcom/vulkan/v3dvx_private.h