panfrost: Add format codes for new compressed textures
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 10 Jul 2020 14:17:44 +0000 (10:17 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 13 Jul 2020 15:21:35 +0000 (11:21 -0400)
Compressed formats line up with CONFIG_TEX_COMPRESSED_FORMAT_ENABLE
documented on
https://releases.linaro.org/archive/14.07/android/images/armv8-android-juno-lsk/

None of the new formats have been seen in the wild.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5856>

src/panfrost/encoder/pan_format.c
src/panfrost/encoder/pan_texture.c
src/panfrost/include/panfrost-job.h
src/panfrost/pandecode/pan_pretty_print.c

index 67c6fba41641fc639095628b2a1b9160ce835b6d..549b3bea50357bc96a99cd45edd9a1b94c70b4e0 100644 (file)
@@ -51,35 +51,35 @@ struct panfrost_format panfrost_pipe_format_table[PIPE_FORMAT_COUNT] = {
         [PIPE_FORMAT_ETC2_RGB8A1]              = { MALI_ETC2_RGB8A1, _T },
         [PIPE_FORMAT_ETC2_SRGB8A1]             = { MALI_ETC2_RGB8A1, _T },
 
-        [PIPE_FORMAT_ASTC_4x4]                 = { MALI_ASTC_HDR_SUPP, _T },
-        [PIPE_FORMAT_ASTC_5x4]                 = { MALI_ASTC_HDR_SUPP, _T },
-        [PIPE_FORMAT_ASTC_5x5]                 = { MALI_ASTC_HDR_SUPP, _T },
-        [PIPE_FORMAT_ASTC_6x5]                 = { MALI_ASTC_HDR_SUPP, _T },
-        [PIPE_FORMAT_ASTC_6x6]                 = { MALI_ASTC_HDR_SUPP, _T },
-        [PIPE_FORMAT_ASTC_8x5]                 = { MALI_ASTC_HDR_SUPP, _T },
-        [PIPE_FORMAT_ASTC_8x6]                 = { MALI_ASTC_HDR_SUPP, _T },
-        [PIPE_FORMAT_ASTC_8x8]                 = { MALI_ASTC_HDR_SUPP, _T },
-        [PIPE_FORMAT_ASTC_10x5]                        = { MALI_ASTC_HDR_SUPP, _T },
-        [PIPE_FORMAT_ASTC_10x6]                        = { MALI_ASTC_HDR_SUPP, _T },
-        [PIPE_FORMAT_ASTC_10x8]                        = { MALI_ASTC_HDR_SUPP, _T },
-        [PIPE_FORMAT_ASTC_10x10]               = { MALI_ASTC_HDR_SUPP, _T },
-        [PIPE_FORMAT_ASTC_12x10]               = { MALI_ASTC_HDR_SUPP, _T },
-        [PIPE_FORMAT_ASTC_12x12]               = { MALI_ASTC_HDR_SUPP, _T },
-
-        [PIPE_FORMAT_ASTC_4x4_SRGB]             = { MALI_ASTC_SRGB_SUPP, _T },
-        [PIPE_FORMAT_ASTC_5x4_SRGB]             = { MALI_ASTC_SRGB_SUPP, _T },
-        [PIPE_FORMAT_ASTC_5x5_SRGB]             = { MALI_ASTC_SRGB_SUPP, _T },
-        [PIPE_FORMAT_ASTC_6x5_SRGB]             = { MALI_ASTC_SRGB_SUPP, _T },
-        [PIPE_FORMAT_ASTC_6x6_SRGB]             = { MALI_ASTC_SRGB_SUPP, _T },
-        [PIPE_FORMAT_ASTC_8x5_SRGB]             = { MALI_ASTC_SRGB_SUPP, _T },
-        [PIPE_FORMAT_ASTC_8x6_SRGB]             = { MALI_ASTC_SRGB_SUPP, _T },
-        [PIPE_FORMAT_ASTC_8x8_SRGB]             = { MALI_ASTC_SRGB_SUPP, _T },
-        [PIPE_FORMAT_ASTC_10x5_SRGB]            = { MALI_ASTC_SRGB_SUPP, _T },
-        [PIPE_FORMAT_ASTC_10x6_SRGB]            = { MALI_ASTC_SRGB_SUPP, _T },
-        [PIPE_FORMAT_ASTC_10x8_SRGB]            = { MALI_ASTC_SRGB_SUPP, _T },
-        [PIPE_FORMAT_ASTC_10x10_SRGB]           = { MALI_ASTC_SRGB_SUPP, _T },
-        [PIPE_FORMAT_ASTC_12x10_SRGB]           = { MALI_ASTC_SRGB_SUPP, _T },
-        [PIPE_FORMAT_ASTC_12x12_SRGB]           = { MALI_ASTC_SRGB_SUPP, _T },
+        [PIPE_FORMAT_ASTC_4x4]                 = { MALI_ASTC_2D_HDR, _T },
+        [PIPE_FORMAT_ASTC_5x4]                 = { MALI_ASTC_2D_HDR, _T },
+        [PIPE_FORMAT_ASTC_5x5]                 = { MALI_ASTC_2D_HDR, _T },
+        [PIPE_FORMAT_ASTC_6x5]                 = { MALI_ASTC_2D_HDR, _T },
+        [PIPE_FORMAT_ASTC_6x6]                 = { MALI_ASTC_2D_HDR, _T },
+        [PIPE_FORMAT_ASTC_8x5]                 = { MALI_ASTC_2D_HDR, _T },
+        [PIPE_FORMAT_ASTC_8x6]                 = { MALI_ASTC_2D_HDR, _T },
+        [PIPE_FORMAT_ASTC_8x8]                 = { MALI_ASTC_2D_HDR, _T },
+        [PIPE_FORMAT_ASTC_10x5]                        = { MALI_ASTC_2D_HDR, _T },
+        [PIPE_FORMAT_ASTC_10x6]                        = { MALI_ASTC_2D_HDR, _T },
+        [PIPE_FORMAT_ASTC_10x8]                        = { MALI_ASTC_2D_HDR, _T },
+        [PIPE_FORMAT_ASTC_10x10]               = { MALI_ASTC_2D_HDR, _T },
+        [PIPE_FORMAT_ASTC_12x10]               = { MALI_ASTC_2D_HDR, _T },
+        [PIPE_FORMAT_ASTC_12x12]               = { MALI_ASTC_2D_HDR, _T },
+
+        [PIPE_FORMAT_ASTC_4x4_SRGB]             = { MALI_ASTC_2D_LDR, _T },
+        [PIPE_FORMAT_ASTC_5x4_SRGB]             = { MALI_ASTC_2D_LDR, _T },
+        [PIPE_FORMAT_ASTC_5x5_SRGB]             = { MALI_ASTC_2D_LDR, _T },
+        [PIPE_FORMAT_ASTC_6x5_SRGB]             = { MALI_ASTC_2D_LDR, _T },
+        [PIPE_FORMAT_ASTC_6x6_SRGB]             = { MALI_ASTC_2D_LDR, _T },
+        [PIPE_FORMAT_ASTC_8x5_SRGB]             = { MALI_ASTC_2D_LDR, _T },
+        [PIPE_FORMAT_ASTC_8x6_SRGB]             = { MALI_ASTC_2D_LDR, _T },
+        [PIPE_FORMAT_ASTC_8x8_SRGB]             = { MALI_ASTC_2D_LDR, _T },
+        [PIPE_FORMAT_ASTC_10x5_SRGB]            = { MALI_ASTC_2D_LDR, _T },
+        [PIPE_FORMAT_ASTC_10x6_SRGB]            = { MALI_ASTC_2D_LDR, _T },
+        [PIPE_FORMAT_ASTC_10x8_SRGB]            = { MALI_ASTC_2D_LDR, _T },
+        [PIPE_FORMAT_ASTC_10x10_SRGB]           = { MALI_ASTC_2D_LDR, _T },
+        [PIPE_FORMAT_ASTC_12x10_SRGB]           = { MALI_ASTC_2D_LDR, _T },
+        [PIPE_FORMAT_ASTC_12x12_SRGB]           = { MALI_ASTC_2D_LDR, _T },
         [PIPE_FORMAT_B5G6R5_UNORM]             = { MALI_RGB565, _VTR },
         [PIPE_FORMAT_B5G5R5X1_UNORM]           = { MALI_RGB5_X1_UNORM, _VT },
         [PIPE_FORMAT_R5G5B5A1_UNORM]           = { MALI_RGB5_A1_UNORM, _VTR },
index 5aa74d60c2fb55701b09f39990eb3c3042144a6d..c270ececd45129a0240fdee3cafabf6799e9e3f2 100644 (file)
@@ -94,7 +94,7 @@ panfrost_compression_tag(
 {
         if (layout == MALI_TEXTURE_AFBC)
                 return desc->nr_channels >= 3;
-        else if (format == MALI_ASTC_HDR_SUPP || format == MALI_ASTC_SRGB_SUPP)
+        else if (format == MALI_ASTC_2D_LDR || format == MALI_ASTC_2D_HDR)
                 return (panfrost_astc_stretch(desc->block.height) << 3) |
                         panfrost_astc_stretch(desc->block.width);
         else
index 178455ca8f78122313b1987f68de7a237c28d956..720420f8ed176923f037e930c1084aa25fe12d22 100644 (file)
@@ -281,15 +281,35 @@ struct mali_channel_swizzle {
 #define MALI_EXTRACT_BITS(fmt) (fmt & 0x7)
 
 enum mali_format {
+        /* Not all formats are in fact available, need to query dynamically to
+         * check. Factory settings for Juno enables only ETC2 and ASTC, no
+         * DXT/RGTC formats.
+         * */
+
+        /* 0x0 invalid */
        MALI_ETC2_RGB8       = MALI_FORMAT_COMPRESSED | 0x1,
        MALI_ETC2_R11_UNORM  = MALI_FORMAT_COMPRESSED | 0x2,
        MALI_ETC2_RGBA8      = MALI_FORMAT_COMPRESSED | 0x3,
        MALI_ETC2_RG11_UNORM = MALI_FORMAT_COMPRESSED | 0x4,
-       MALI_ETC2_R11_SNORM  = MALI_FORMAT_COMPRESSED | 0x11,
-       MALI_ETC2_RG11_SNORM = MALI_FORMAT_COMPRESSED | 0x12,
+        /* 0x5 reserved */
+        MALI_NXR             = MALI_FORMAT_COMPRESSED | 0x6, /* Nokia eXtended Range */
+        MALI_BC1_UNORM       = MALI_FORMAT_COMPRESSED | 0x7, /* DXT1 */
+        MALI_BC2_UNORM       = MALI_FORMAT_COMPRESSED | 0x8, /* DXT3 */
+        MALI_BC3_UNORM       = MALI_FORMAT_COMPRESSED | 0x9, /* DXT5 */
+        MALI_BC4_UNORM       = MALI_FORMAT_COMPRESSED | 0xA, /* RGTC1_UNORM */
+        MALI_BC4_SNORM       = MALI_FORMAT_COMPRESSED | 0xB, /* RGTC1_SNORM */
+        MALI_BC5_UNORM       = MALI_FORMAT_COMPRESSED | 0xC, /* RGTC2_UNORM */
+        MALI_BC5_SNORM       = MALI_FORMAT_COMPRESSED | 0xD, /* RGTC2_SNORM */
+        MALI_BC6H_UF16       = MALI_FORMAT_COMPRESSED | 0xE,
+        MALI_BC6H_SF16       = MALI_FORMAT_COMPRESSED | 0xF,
+        MALI_BC7_UNORM       = MALI_FORMAT_COMPRESSED | 0x10,
+       MALI_ETC2_R11_SNORM  = MALI_FORMAT_COMPRESSED | 0x11, /* EAC_SNORM */
+       MALI_ETC2_RG11_SNORM = MALI_FORMAT_COMPRESSED | 0x12, /* EAC_SNORM */
        MALI_ETC2_RGB8A1     = MALI_FORMAT_COMPRESSED | 0x13,
-       MALI_ASTC_SRGB_SUPP  = MALI_FORMAT_COMPRESSED | 0x16,
-       MALI_ASTC_HDR_SUPP   = MALI_FORMAT_COMPRESSED | 0x17,
+       MALI_ASTC_3D_LDR     = MALI_FORMAT_COMPRESSED | 0x14,
+       MALI_ASTC_3D_HDR     = MALI_FORMAT_COMPRESSED | 0x15,
+       MALI_ASTC_2D_LDR     = MALI_FORMAT_COMPRESSED | 0x16,
+       MALI_ASTC_2D_HDR     = MALI_FORMAT_COMPRESSED | 0x17,
 
        MALI_RGB565         = MALI_FORMAT_SPECIAL | 0x0,
        MALI_RGB5_X1_UNORM  = MALI_FORMAT_SPECIAL | 0x1,
index 05b0d1ae4cbae583d527c639bdccc09716d5d210..23664e43958b9ee2ed074b8be407b29ec461d1be 100644 (file)
@@ -43,8 +43,21 @@ char *pandecode_format(enum mali_format format)
                 DEFINE_CASE(ETC2_R11_SNORM);
                 DEFINE_CASE(ETC2_RG11_SNORM);
                 DEFINE_CASE(ETC2_RGB8A1);
-                DEFINE_CASE(ASTC_SRGB_SUPP);
-                DEFINE_CASE(ASTC_HDR_SUPP);
+                DEFINE_CASE(NXR);
+                DEFINE_CASE(BC1_UNORM);
+                DEFINE_CASE(BC2_UNORM);
+                DEFINE_CASE(BC3_UNORM);
+                DEFINE_CASE(BC4_UNORM);
+                DEFINE_CASE(BC4_SNORM);
+                DEFINE_CASE(BC5_UNORM);
+                DEFINE_CASE(BC5_SNORM);
+                DEFINE_CASE(BC6H_UF16);
+                DEFINE_CASE(BC6H_SF16);
+                DEFINE_CASE(BC7_UNORM);
+                DEFINE_CASE(ASTC_3D_LDR);
+                DEFINE_CASE(ASTC_3D_HDR);
+                DEFINE_CASE(ASTC_2D_LDR);
+                DEFINE_CASE(ASTC_2D_HDR);
                 DEFINE_CASE(RGB565);
                 DEFINE_CASE(RGB5_X1_UNORM);
                 DEFINE_CASE(RGB5_A1_UNORM);