panfrost: Don't round up Midgard polygon list BOs
authorAlyssa Rosenzweig <alyssa@collabora.com>
Mon, 31 Oct 2022 01:37:51 +0000 (21:37 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 16 Mar 2023 04:13:46 +0000 (04:13 +0000)
Rounding up the polygon list BO can waste large amounts of memory. In a common
case I observed, it rounded up 11MB to 16MB, wasting 5MB. That adds up quickly
across processes, especially on the 2GB machines.

This only applies to Midgard. On Bifrost and newer, the driver does not
explicitly allocate this data structure. Cc stable because this rounding is
incorrect and the increase in RAM usage can cause real problems (especially
given how slow the shrinker is).

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21831>

src/gallium/drivers/panfrost/pan_cmdstream.c

index b3c28ba..6ce9398 100644 (file)
@@ -4477,7 +4477,6 @@ batch_get_polygon_list(struct panfrost_batch *batch)
       bool has_draws = batch->scoreboard.first_tiler != NULL;
       unsigned size = panfrost_tiler_get_polygon_list_size(
          dev, batch->key.width, batch->key.height, has_draws);
-      size = util_next_power_of_two(size);
 
       /* Create the BO as invisible if we can. If there are no draws,
        * we need to write the polygon list manually because there's