panfrost: fix texture.border_clamp regression for valhall

We have to swizzle the border color in order to offset the
automatic swizzling introduced to compensate for limited
component order support in AFBC/AFRC. However, the border color
format is only available if the `TEXTURE_BORDER_COLOR_QUIRK` is
enabled, so set that for v10 (it was already set for v7).

While testing, we uncovered another issue: valhall introduces a
swizzle for depth+stencil formats that isn't present for bifrost, and
also isn't needed (or wanted) for the border color. So ignore the
border color swizzle for depth+stencil on valhall (on bifrost the
swizzle is a no-op anyway).

Fixes: 87aad0a5e4 ("panfrost: encode component order as an inverted swizzle (v10)")
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30542>
This commit is contained in:
Eric R. Smith
2024-08-06 23:38:36 +00:00
committed by Marge Bot
parent f36fccabf5
commit 3135f76331
2 changed files with 10 additions and 1 deletions

View File

@@ -195,7 +195,12 @@ panfrost_create_sampler_state(struct pipe_context *pctx,
* 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.
* On v10+, watch out for depth+stencil formats, because those have a
* swizzle that doesn't really apply to the border color
*/
#if PAN_ARCH >= 10
if (!util_format_is_depth_and_stencil(cso->border_color_format)) {
#endif
unsigned mali_format =
GENX(panfrost_format_from_pipe_format)(cso->border_color_format)->hw;
enum mali_rgb_component_order order = mali_format & BITFIELD_MASK(12);
@@ -207,6 +212,10 @@ panfrost_create_sampler_state(struct pipe_context *pctx,
util_format_apply_color_swizzle(&so->base.border_color, &cso->border_color,
inverted_swizzle,
false /* is_integer (irrelevant) */);
#if PAN_ARCH >= 10
}
#endif
#endif
bool using_nearest = cso->min_img_filter == PIPE_TEX_MIPFILTER_NEAREST;

View File

@@ -208,7 +208,7 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param)
* handles this but we need to fix up the border colour.
*/
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
if (dev->arch == 7)
if (dev->arch == 7 || dev->arch >= 10)
return PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_FREEDRENO;
else
return 0;