mesa/src
Alyssa Rosenzweig cd03392c7e panfrost: Choose hierarchy masks by vertex count
Currently, we always use a hierarchy mask with all levels enabled. While this is
efficient for geometry-heavy workloads like 3D games, it is wasteful for 2D
applications that draw very few vertices. For drawing just a few textured quads,
the overhead of small bin sizes outweighs any performance advantages, so it's a
bit slower. More problematically, small bin sizes require tremendous amounts of
memory for the polygon lists, leading to significant memory consumption (~10MB)
for the polygon list for even the simplest of 2D blits.

To reduce our memory footprint, we need to choose our hierarchy masks more
carefully. In general, we want to allow small bin sizes for geometry-heavy
workloads but not for geometry-light workloads. We estimate vertex count in the
driver as a proxy for this, and use a simple heuristic to select a bin size
based on the estimated vertex count. None of this is an exact science, and the
heuristic could probably be tuned. Nevertheless, the heuristic used (comparing
framebuffer size to vertex count) works well in practice, significantly reducing
the memory footprint of 2D applications like Firefox without hurting the
performance of 3D applications.

I originally wrote this patch while diagnosing high memory footprints on my
Midgard laptop, which is why only Midgard is in scope here. On Bifrost and
Valhall, we have a similar hiearchy mask selection problem. It seems likely that
the same heuristic would work there too, but it's a different code path that I
have not integrated or tested. I'll leave that for the adventurous reader, to
get the memory footprint win there too.

(It's also possible the win is smaller on newer Malis than on Midgard, since Arm
claims they optimized the tiler data structures on the newer parts. There's
probably still some merit to the idea.)

On Mali-T860, glmark2 -bdesktop frametime decreased by 1.35% +/- 0.91% at 95%
confidence, showing a slight win for 2D workloads No statistically significant
difference for glmark2 -bshading:shading=phong, since 3D workloads continue to
use the same hierarchy masks.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19482>
2023-03-31 00:19:18 +00:00
..
amd radv: Stop counting user SGPRS separately 2023-03-30 21:52:03 +00:00
android_stub util/log: improve logger_android 2023-02-22 17:55:40 +00:00
asahi asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
broadcom ci/broadcom: slightly increase coverage of vk tests 2023-03-30 08:21:23 +00:00
c11 c11: Remove _MTX_INITIALIZER_NP for windows 2022-11-09 04:38:28 +00:00
compiler nir/algebraic: Undistribute fsat from fmax 2023-03-29 23:48:19 +00:00
drm-shim drm-shim: Use hide_drm_device_path() to hide other drm devices 2022-12-30 15:51:11 -08:00
egl dri2/android: Bypass throttling 2023-03-30 18:46:04 +00:00
etnaviv ci/etnaviv: Polish the gc2000 xfails a bit. 2023-03-29 07:52:45 +00:00
freedreno freedreno/computerator: Add support for a7xx 2023-03-30 23:40:48 +00:00
gallium panfrost: Estimate vertex count for hier mask 2023-03-31 00:19:18 +00:00
gbm gbm: drop unnecessary vulkan dependency 2023-02-23 18:31:22 +00:00
getopt
glx glx: fix memory leak related to __glXCloseDisplay() 2023-03-20 21:12:54 +00:00
gtest
imagination pvr: Mark all normalized formats as supporting with_packed_usc_channel 2023-03-29 13:00:37 +00:00
imgui
intel intel: fix memory leak related to brw_nir_create_passthrough_tcs() 2023-03-30 10:52:07 +00:00
loader loader: Use libdrm shim 2023-03-05 16:31:51 +00:00
mapi mapi: add InternalInvalidateFramebufferAncillaryMESA 2023-03-30 05:06:47 +00:00
mesa mesa: Add a few more function traces 2023-03-30 19:42:01 +00:00
microsoft dzn: Use mesa_loge for DXIL validation errors 2023-03-23 21:48:44 +00:00
nouveau nouveau: Make getSize return unsigned int 2023-03-17 16:08:33 +00:00
panfrost panfrost: Choose hierarchy masks by vertex count 2023-03-31 00:19:18 +00:00
tool pps: Fix build errors. 2023-03-13 01:22:46 +00:00
util perfetto: Move intel's cmdbuf/queue annotation code to the shared util. 2023-03-30 02:19:35 +00:00
virtio venus: Enable VK_EXT_memory_budget 2023-03-30 09:55:40 +00:00
vulkan vulkan: vk_android.c should be copyright Intel 2023-03-26 00:16:26 +00:00
meson.build hgl: remove 2023-02-18 00:44:43 +00:00