panfrost: encode component order as an inverted swizzle (v10)

v10 restricts component orders when AFRC is in use, so we use the
same solution as for AFBC on v7.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28813>
This commit is contained in:
Louis-Francis Ratté-Boulianne
2024-05-30 18:30:01 -04:00
committed by Marge Bot
parent 2dae926850
commit 87aad0a5e4
5 changed files with 12 additions and 9 deletions

View File

@@ -190,8 +190,8 @@ panfrost_create_sampler_state(struct pipe_context *pctx,
struct panfrost_sampler_state *so = CALLOC_STRUCT(panfrost_sampler_state);
so->base = *cso;
#if PAN_ARCH == 7
/* On v7, pan_texture.c composes the API swizzle with a bijective
#if PAN_ARCH == 7 || PAN_ARCH >= 10
/* On v7 and v10+, pan_texture.c composes the API swizzle with a bijective
* swizzle derived from the format, to allow more formats than the
* hardware otherwise supports. When packing border colours, we need to
* undo this bijection, by swizzling with its inverse.

View File

@@ -5,7 +5,7 @@
subdir('genxml')
subdir('kmod')
pixel_format_versions = ['5', '6', '7', '9']
pixel_format_versions = ['5', '6', '7', '9', '10']
libpanfrost_pixel_format = []
foreach ver : pixel_format_versions

View File

@@ -599,7 +599,7 @@ const struct panfrost_format GENX(panfrost_pipe_format)[PIPE_FORMAT_COUNT] = {
};
/* clang-format on */
#if PAN_ARCH == 7
#if PAN_ARCH == 7 || PAN_ARCH >= 10
/*
* Decompose a component ordering swizzle into a component ordering (applied
* first) and a swizzle (applied second). The output ordering "pre" is allowed

View File

@@ -64,7 +64,8 @@ extern const struct pan_blendable_format
panfrost_blendable_formats_v7[PIPE_FORMAT_COUNT];
extern const struct pan_blendable_format
panfrost_blendable_formats_v9[PIPE_FORMAT_COUNT];
#define panfrost_blendable_formats_v10 panfrost_blendable_formats_v9
extern const struct pan_blendable_format
panfrost_blendable_formats_v10[PIPE_FORMAT_COUNT];
static inline const struct pan_blendable_format *
panfrost_blendable_format_table(unsigned arch)
@@ -89,7 +90,7 @@ extern const struct panfrost_format panfrost_pipe_format_v5[PIPE_FORMAT_COUNT];
extern const struct panfrost_format panfrost_pipe_format_v6[PIPE_FORMAT_COUNT];
extern const struct panfrost_format panfrost_pipe_format_v7[PIPE_FORMAT_COUNT];
extern const struct panfrost_format panfrost_pipe_format_v9[PIPE_FORMAT_COUNT];
#define panfrost_pipe_format_v10 panfrost_pipe_format_v9
extern const struct panfrost_format panfrost_pipe_format_v10[PIPE_FORMAT_COUNT];
static inline const struct panfrost_format *
panfrost_format_table(unsigned arch)
@@ -132,7 +133,7 @@ panfrost_get_default_swizzle(unsigned components)
}
}
#if PAN_ARCH == 7
#if PAN_ARCH == 7 || PAN_ARCH >= 10
struct pan_decomposed_swizzle {
/* Component ordering to apply first */
enum mali_rgb_component_order pre;

View File

@@ -619,11 +619,13 @@ GENX(panfrost_new_texture)(const struct pan_image_view *iview, void *out,
};
util_format_compose_swizzles(replicate_x, iview->swizzle, swizzle);
} else if (PAN_ARCH == 7 && !panfrost_format_is_yuv(format)) {
#if PAN_ARCH == 7
} else if ((PAN_ARCH == 7 || PAN_ARCH == 10) &&
!panfrost_format_is_yuv(format)) {
#if PAN_ARCH == 7 || PAN_ARCH >= 10
/* v7 (only) restricts component orders when AFBC is in use.
* Rather than restrict AFBC, we use an allowed component order
* with an invertible swizzle composed.
* v10 has the same restriction, but on AFRC formats.
*/
enum mali_rgb_component_order orig = mali_format & BITFIELD_MASK(12);
struct pan_decomposed_swizzle decomposed =