diff options
author | Boris Brezillon <boris.brezillon@collabora.com> | 2021-01-12 17:43:16 +0100 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-01-12 22:40:44 +0000 |
commit | 38823ba60d5f0c8280fb50abbb0a375bca672352 (patch) | |
tree | 6add54290d17be12894f276e9e4b228b64ab6cac /src | |
parent | 2cf41ae494043295f2d4b0334ffaa31be619eca8 (diff) |
panfrost: Fix estimate_texture_payload_size() on Bifrost
Bifrost mandates manual stride usage.
Fixes: a3d2936a8e9e ("panfrost: The texture descriptor has a pointer to a trampoline")
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/8449>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 3 | ||||
-rw-r--r-- | src/panfrost/lib/pan_texture.c | 17 | ||||
-rw-r--r-- | src/panfrost/lib/pan_texture.h | 13 |
3 files changed, 21 insertions, 12 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index ec5395e86ae..2df59a8230d 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1064,7 +1064,8 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so, unsigned size = (is_bifrost ? 0 : MALI_MIDGARD_TEXTURE_LENGTH) + - panfrost_estimate_texture_payload_size(first_level, last_level, + panfrost_estimate_texture_payload_size(device, + first_level, last_level, first_layer, last_layer, texture->nr_samples, type, diff --git a/src/panfrost/lib/pan_texture.c b/src/panfrost/lib/pan_texture.c index 73c9698e881..35fb450c890 100644 --- a/src/panfrost/lib/pan_texture.c +++ b/src/panfrost/lib/pan_texture.c @@ -220,14 +220,19 @@ panfrost_texture_num_elements( * as an allocation amount */ unsigned -panfrost_estimate_texture_payload_size( - unsigned first_level, unsigned last_level, - unsigned first_layer, unsigned last_layer, - unsigned nr_samples, - enum mali_texture_dimension dim, uint64_t modifier) +panfrost_estimate_texture_payload_size(const struct panfrost_device *dev, + unsigned first_level, + unsigned last_level, + unsigned first_layer, + unsigned last_layer, + unsigned nr_samples, + enum mali_texture_dimension dim, + uint64_t modifier) { + bool is_bifrost = dev->quirks & IS_BIFROST; /* Assume worst case */ - unsigned manual_stride = (modifier == DRM_FORMAT_MOD_LINEAR); + unsigned manual_stride = is_bifrost || + (modifier == DRM_FORMAT_MOD_LINEAR); unsigned elements = panfrost_texture_num_elements( first_level, last_level, diff --git a/src/panfrost/lib/pan_texture.h b/src/panfrost/lib/pan_texture.h index 975ffd2ebf2..1b2f40646ed 100644 --- a/src/panfrost/lib/pan_texture.h +++ b/src/panfrost/lib/pan_texture.h @@ -124,11 +124,14 @@ unsigned panfrost_block_dim(uint64_t modifier, bool width, unsigned plane); unsigned -panfrost_estimate_texture_payload_size( - unsigned first_level, unsigned last_level, - unsigned first_layer, unsigned last_layer, - unsigned nr_samples, - enum mali_texture_dimension dim, uint64_t modifier); +panfrost_estimate_texture_payload_size(const struct panfrost_device *dev, + unsigned first_level, + unsigned last_level, + unsigned first_layer, + unsigned last_layer, + unsigned nr_samples, + enum mali_texture_dimension dim, + uint64_t modifier); void panfrost_new_texture(const struct panfrost_device *dev, |