diff --git a/src/panfrost/lib/pan_encoder.h b/src/panfrost/lib/pan_encoder.h index 7c26b135132..680808e0100 100644 --- a/src/panfrost/lib/pan_encoder.h +++ b/src/panfrost/lib/pan_encoder.h @@ -28,6 +28,7 @@ #define __PAN_ENCODER_H #include +#include "pan_bo.h" #include "midgard_pack.h" /* 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 */ +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 panfrost_tiler_header_size(unsigned width, unsigned height, unsigned mask, bool hierarchy); diff --git a/src/panfrost/lib/pan_tiler.c b/src/panfrost/lib/pan_tiler.c index fc42724a1e5..4493f5c01c9 100644 --- a/src/panfrost/lib/pan_tiler.c +++ b/src/panfrost/lib/pan_tiler.c @@ -26,7 +26,9 @@ #include "util/u_math.h" #include "util/macros.h" +#include "pan_device.h" #include "pan_encoder.h" +#include "panfrost-quirks.h" /* Mali GPUs are tiled-mode renderers, rather than immediate-mode. * Conceptually, the screen is divided into 16x16 tiles. Vertex shaders run. @@ -371,3 +373,21 @@ panfrost_choose_hierarchy_mask( 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); +}