panfrost: Provide a helper to calculate the polygon list size

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10033>
This commit is contained in:
Boris Brezillon 2021-03-31 09:49:00 +02:00 committed by Marge Bot
parent f5d7c419e7
commit af34e29f15
2 changed files with 28 additions and 0 deletions

View file

@ -28,6 +28,7 @@
#define __PAN_ENCODER_H #define __PAN_ENCODER_H
#include <stdbool.h> #include <stdbool.h>
#include "pan_bo.h"
#include "midgard_pack.h" #include "midgard_pack.h"
/* Indices for named (non-XFB) varyings that are present. These are packed /* Indices for named (non-XFB) varyings that are present. These are packed
@ -69,6 +70,13 @@ panfrost_pack_work_groups_compute(
/* Tiler structure size computation */ /* Tiler structure size computation */
struct panfrost_device;
unsigned
panfrost_tiler_get_polygon_list_size(const struct panfrost_device *dev,
unsigned fb_width, unsigned fb_height,
bool has_draws);
unsigned unsigned
panfrost_tiler_header_size(unsigned width, unsigned height, unsigned mask, bool hierarchy); panfrost_tiler_header_size(unsigned width, unsigned height, unsigned mask, bool hierarchy);

View file

@ -26,7 +26,9 @@
#include "util/u_math.h" #include "util/u_math.h"
#include "util/macros.h" #include "util/macros.h"
#include "pan_device.h"
#include "pan_encoder.h" #include "pan_encoder.h"
#include "panfrost-quirks.h"
/* Mali GPUs are tiled-mode renderers, rather than immediate-mode. /* Mali GPUs are tiled-mode renderers, rather than immediate-mode.
* Conceptually, the screen is divided into 16x16 tiles. Vertex shaders run. * Conceptually, the screen is divided into 16x16 tiles. Vertex shaders run.
@ -371,3 +373,21 @@ panfrost_choose_hierarchy_mask(
return 0xFF; return 0xFF;
} }
unsigned
panfrost_tiler_get_polygon_list_size(const struct panfrost_device *dev,
unsigned fb_width, unsigned fb_height,
bool has_draws)
{
if (pan_is_bifrost(dev))
return 0;
if (!has_draws)
return MALI_MIDGARD_TILER_MINIMUM_HEADER_SIZE + 4;
bool hierarchy = !(dev->quirks & MIDGARD_NO_HIER_TILING);
unsigned hierarchy_mask =
panfrost_choose_hierarchy_mask(fb_width, fb_height, 1, hierarchy);
return panfrost_tiler_full_size(fb_width, fb_height, hierarchy_mask, hierarchy);
}