freedreno/a6xx+: Add support for the R8G8_R8B8 and G8R8_B8R8 formats.

This means that EGLimage imports of YUYV and UYVY can use a single sampler
instead of having to create RGBA8 and RG8 samplers mapping the same
texture.  The swizzles are the same as turnip uses, and it makes the
piglit tests for these formats happy.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>
This commit is contained in:
Emma Anholt 2021-09-30 11:03:49 -07:00 committed by Marge Bot
parent a7459b5409
commit ab0462e05d
2 changed files with 6 additions and 0 deletions

View file

@ -345,6 +345,9 @@ static struct fd6_format formats[PIPE_FORMAT_COUNT] = {
_T_(ASTC_12x10_SRGB, ASTC_12x10, WZYX),
_T_(ASTC_12x12_SRGB, ASTC_12x12, WZYX),
_T_(R8G8_R8B8_UNORM, R8G8R8B8_422_UNORM, WZYX), /* YUYV */
_T_(G8R8_B8R8_UNORM, G8R8B8R8_422_UNORM, WZYX), /* UYVY */
_T_(R8_G8B8_420_UNORM, R8_G8B8_2PLANE_420_UNORM, WZYX),
};
/* clang-format on */

View file

@ -65,6 +65,9 @@ fd6_tex_swiz(enum pipe_format format, unsigned char *swiz, unsigned swizzle_r,
const unsigned char stencil_swiz[4] = {PIPE_SWIZZLE_W, PIPE_SWIZZLE_W,
PIPE_SWIZZLE_W, PIPE_SWIZZLE_W};
util_format_compose_swizzles(stencil_swiz, uswiz, swiz);
} else if (format == PIPE_FORMAT_R8G8_R8B8_UNORM || format == PIPE_FORMAT_G8R8_B8R8_UNORM) {
unsigned char fswiz[4] = {PIPE_SWIZZLE_Z, PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_1};
util_format_compose_swizzles(fswiz, uswiz, swiz);
} else if (fd6_pipe2swap(format) != WZYX) {
/* Formats with a non-pass-through swap are permutations of RGBA
* formats. We program the permutation using the swap and don't