Module: Mesa Branch: main Commit: a865a4a789ac21ebe7fbb6cc98a7e2a519e7e8c7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a865a4a789ac21ebe7fbb6cc98a7e2a519e7e8c7
Author: Boris Brezillon <[email protected]> Date: Fri Aug 6 14:09:43 2021 +0200 panfrost: Prepare pan_encoder.h to per-gen XML Signed-off-by: Boris Brezillon <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12935> --- src/panfrost/lib/pan_encoder.h | 34 +++++++++++++++++++++++++++------- src/panfrost/lib/pan_tiler.c | 19 ------------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/panfrost/lib/pan_encoder.h b/src/panfrost/lib/pan_encoder.h index aa65b159e38..1b80f3fc695 100644 --- a/src/panfrost/lib/pan_encoder.h +++ b/src/panfrost/lib/pan_encoder.h @@ -27,10 +27,14 @@ #ifndef __PAN_ENCODER_H #define __PAN_ENCODER_H +#include "util/macros.h" +#include "panfrost-quirks.h" + #include <stdbool.h> #include "util/format/u_format.h" #include "pan_bo.h" #include "gen_macros.h" +#include "pan_device.h" /* Indices for named (non-XFB) varyings that are present. These are packed * tightly so they correspond to a bitfield present (P) indexed by (1 << @@ -58,13 +62,6 @@ enum pan_special_varying { /* 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); @@ -76,6 +73,24 @@ panfrost_choose_hierarchy_mask( unsigned width, unsigned height, unsigned vertex_count, bool hierarchy); +#if defined(PAN_ARCH) && PAN_ARCH <= 5 +static inline unsigned +panfrost_tiler_get_polygon_list_size(const struct panfrost_device *dev, + unsigned fb_width, unsigned fb_height, + bool has_draws) +{ + 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) + + panfrost_tiler_header_size(fb_width, fb_height, hierarchy_mask, hierarchy); +} +#endif + /* Stack sizes */ unsigned @@ -97,8 +112,10 @@ panfrost_padded_vertex_count(unsigned vertex_count); unsigned panfrost_compute_magic_divisor(unsigned hw_divisor, unsigned *o_shift, unsigned *extra_flags); +#ifdef PAN_ARCH /* Records for gl_VertexID and gl_InstanceID use special encodings on Midgard */ +#if PAN_ARCH <= 5 static inline void panfrost_vertex_id(unsigned padded_count, struct mali_attribute_buffer_packed *attr, @@ -137,6 +154,7 @@ panfrost_instance_id(unsigned padded_count, } } } +#endif /* PAN_ARCH <= 5 */ /* Sampler comparison functions are flipped in OpenGL from the hardware, so we * need to be able to flip accordingly */ @@ -234,4 +252,6 @@ panfrost_get_z_internal_format(enum pipe_format fmt) } } +#endif /* PAN_ARCH */ + #endif diff --git a/src/panfrost/lib/pan_tiler.c b/src/panfrost/lib/pan_tiler.c index e45240eeac6..a4c1ef9504a 100644 --- a/src/panfrost/lib/pan_tiler.c +++ b/src/panfrost/lib/pan_tiler.c @@ -373,22 +373,3 @@ 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) + - panfrost_tiler_header_size(fb_width, fb_height, hierarchy_mask, hierarchy); -}
