freedreno/fdl: Use A8_UNORM HW format for sampling
authorConnor Abbott <cwabbott0@gmail.com>
Fri, 1 Sep 2023 12:20:19 +0000 (14:20 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 27 Sep 2023 19:07:22 +0000 (19:07 +0000)
We've already been using this for 3d blits on turnip and it works fine.
There's no need to emulate it, and it won't work on turnip where we
can't swizzle the border colors.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25001>

src/freedreno/fdl/fd6_format_table.c
src/freedreno/fdl/fd6_view.c

index e80d48e..0e6b802 100644 (file)
@@ -68,7 +68,7 @@ static const struct fd6_format formats[PIPE_FORMAT_COUNT] = {
    _TC(R8_SRGB,    8_UNORM,                     WZYX),
    _TC(Y8_UNORM,   NV12_Y,                      WZYX),
 
-   FMT(A8_UNORM,   NONE, 8_UNORM, A8_UNORM,     WZYX),
+   _TC(A8_UNORM,   A8_UNORM,                    WZYX),
    _TC(L8_UNORM,   8_UNORM,                     WZYX),
    _TC(L8_SRGB,    8_UNORM,                     WZYX),
    _TC(L8_SNORM,   8_SNORM,                     WZYX),
index 8976b88..1e25fea 100644 (file)
@@ -109,11 +109,11 @@ fdl6_format_swiz(enum pipe_format format, bool has_z24uint_s8uint,
       break;
 
    default:
-      /* Our I, L, A, and LA formats use R or RG HW formats. These aren't
-       * supported in Vulkan, and freedreno uses a hack to get the border
-       * colors correct by undoing these swizzles.
+      /* Our I, L, A, and LA formats use R or RG HW formats except for
+       * A8_UNORM. These aren't supported in Vulkan, and freedreno uses a hack
+       * to get the border colors correct by undoing these swizzles.
        */
-      if (util_format_is_alpha(format)) {
+      if (util_format_is_alpha(format) && format != PIPE_FORMAT_A8_UNORM) {
          format_swiz[0] = PIPE_SWIZZLE_0;
          format_swiz[1] = PIPE_SWIZZLE_0;
          format_swiz[2] = PIPE_SWIZZLE_0;