panfrost: Pass a pipe-like swizzle to panfrost_new_texture()

And let the function translate it to a mali swizzle. This way we will
be able to adjust the swizzle if needed.

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/8125>
This commit is contained in:
Boris Brezillon 2020-12-18 10:37:11 +01:00
parent e91cb99ec6
commit 256d4a3eee
4 changed files with 14 additions and 5 deletions

View file

@ -1070,7 +1070,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
so->base.u.tex.first_layer,
so->base.u.tex.last_layer,
texture->nr_samples,
panfrost_translate_swizzle_4(user_swizzle),
user_swizzle,
prsrc->bo->ptr.gpu, &payload);
}

View file

@ -321,6 +321,10 @@ midgard_load_emit_texture(struct pan_pool *pool, struct MALI_DRAW *draw,
image->first_layer *
panfrost_get_layer_stride(image->layout, image->first_level);
unsigned char swizzle[4] = {
PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W
};
panfrost_new_texture(pool->dev, image->layout, texture.cpu,
image->width0, image->height0,
MAX2(image->nr_samples, 1), 1,
@ -328,7 +332,7 @@ midgard_load_emit_texture(struct pan_pool *pool, struct MALI_DRAW *draw,
image->first_level, image->last_level,
0, 0,
image->nr_samples,
PAN_V6_SWIZZLE(R, G, B, A),
swizzle,
image->bo->ptr.gpu + offset, &payload);
pan_pack(sampler.cpu, MIDGARD_SAMPLER, cfg)
@ -495,6 +499,10 @@ bifrost_load_emit_texture(struct pan_pool *pool, struct MALI_DRAW *draw,
image->first_layer *
panfrost_get_layer_stride(image->layout, image->first_level);
unsigned char swizzle[4] = {
PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W
};
panfrost_new_texture(pool->dev, image->layout, texture.cpu,
image->width0, image->height0,
MAX2(image->nr_samples, 1), 1,
@ -502,7 +510,7 @@ bifrost_load_emit_texture(struct pan_pool *pool, struct MALI_DRAW *draw,
image->first_level, image->last_level,
0, 0,
image->nr_samples,
PAN_V6_SWIZZLE(R, G, B, A),
swizzle,
image->bo->ptr.gpu + offset, &payload);
pan_pack(sampler.cpu, BIFROST_SAMPLER, cfg) {

View file

@ -409,10 +409,11 @@ panfrost_new_texture(const struct panfrost_device *dev,
unsigned first_level, unsigned last_level,
unsigned first_layer, unsigned last_layer,
unsigned nr_samples,
unsigned swizzle,
const unsigned char user_swizzle[4],
mali_ptr base,
const struct panfrost_ptr *payload)
{
unsigned swizzle = panfrost_translate_swizzle_4(user_swizzle);
const struct util_format_description *desc =
util_format_description(format);

View file

@ -133,7 +133,7 @@ panfrost_new_texture(const struct panfrost_device *dev,
unsigned first_level, unsigned last_level,
unsigned first_layer, unsigned last_layer,
unsigned nr_samples,
unsigned swizzle,
const unsigned char swizzle[4],
mali_ptr base,
const struct panfrost_ptr *payload);