diff options
author | Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> | 2020-10-08 18:34:48 -0400 |
---|---|---|
committer | Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> | 2020-10-10 17:15:02 -0400 |
commit | 8bb1d61f276c3ee8e546c861b86cd6e6f3dd1b6f (patch) | |
tree | fd0cafffe9210cc6210cdfa587f00c9fe5c2b4fa /src/panfrost | |
parent | aa6a5d20e6b4c95da527358581741656fe5a5d76 (diff) |
panfrost: Add panfrost_block_dim helper
So we can calculate strides of block-based formats correctly. Will help
us down the road for Bifrost AFBC.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
Diffstat (limited to 'src/panfrost')
-rw-r--r-- | src/panfrost/lib/pan_texture.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/panfrost/lib/pan_texture.c b/src/panfrost/lib/pan_texture.c index c65c60bf7e4..1600d0e3168 100644 --- a/src/panfrost/lib/pan_texture.c +++ b/src/panfrost/lib/pan_texture.c @@ -207,6 +207,28 @@ panfrost_estimate_texture_payload_size( */ static unsigned +panfrost_block_dim(uint64_t modifier, bool width, unsigned plane) +{ + if (!drm_is_afbc(modifier)) { + assert(modifier == DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED); + return 16; + } + + switch (modifier & AFBC_FORMAT_MOD_BLOCK_SIZE_MASK) { + case AFBC_FORMAT_MOD_BLOCK_SIZE_16x16: + return 16; + case AFBC_FORMAT_MOD_BLOCK_SIZE_32x8: + return width ? 32 : 32; + case AFBC_FORMAT_MOD_BLOCK_SIZE_64x4: + return width ? 64 : 4; + case AFBC_FORMAT_MOD_BLOCK_SIZE_32x8_64x4: + return plane ? (width ? 64 : 4) : (width ? 32 : 8); + default: + unreachable("Invalid AFBC block size"); + } +} + +static unsigned panfrost_nonlinear_stride(uint64_t modifier, unsigned bytes_per_pixel, unsigned width, |