Mesa (main): freedreno/a6xx+: Add support for the R8G8_R8B8 and G8R8_B8R8 formats.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 5 20:44:49 UTC 2021


Module: Mesa
Branch: main
Commit: ab0462e05df2ec47b518ecf5cedd5714eb8f922f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ab0462e05df2ec47b518ecf5cedd5714eb8f922f

Author: Emma Anholt <emma at anholt.net>
Date:   Thu Sep 30 11:03:49 2021 -0700

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>

---

 src/freedreno/fdl/fd6_format_table.c            | 3 +++
 src/gallium/drivers/freedreno/a6xx/fd6_format.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/freedreno/fdl/fd6_format_table.c b/src/freedreno/fdl/fd6_format_table.c
index b4a27404c88..8ff7cba7abd 100644
--- a/src/freedreno/fdl/fd6_format_table.c
+++ b/src/freedreno/fdl/fd6_format_table.c
@@ -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 */
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_format.c b/src/gallium/drivers/freedreno/a6xx/fd6_format.c
index 42a7189e2bb..1d08f83a12a 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_format.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_format.c
@@ -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



More information about the mesa-commit mailing list