Skip to content

Instantly share code, notes, and snippets.

@leegao
Created July 24, 2026 08:22
Show Gist options
  • Select an option

  • Save leegao/f2731c02d3cd40de23622280d9f11a2d to your computer and use it in GitHub Desktop.

Select an option

Save leegao/f2731c02d3cd40de23622280d9f11a2d to your computer and use it in GitHub Desktop.
Mali G610 g29p1-11eac-18 (r54p1) Rockchip (DRM-based) driver's BCn -> RGBA8 transcode table

For https://github.com/JeffyCN/mirrors/commit/4233031d818e97a19e8a9cdbbd5c15795ededd93

libmali: update G310/G610 userspace driver to g29p1-11eac-18

enable VULKAN_TEXTURE_BC

Change-Id: Ia23e5e3fffd8bdef15e32a0362f47a173ba821fc

Signed-off-by: Li Huang putin.li@rock-chips.com

Internal ID Extension / Core VkFormat Enum Input Format Name Mode 0 Target ID Mode 0 Fallback Target (VkFormat) Mode 1 Target ID Mode 1 Fallback Target (VkFormat)
0xEA 1000156000 (0x3b9d2b60) VK_FORMAT_BC1_RGB_UNORM_BLOCK 0x0107 VK_FORMAT_R8G8B8A8_UNORM 0x0000 N/A (Out of Range)
0xEB 1000156001 (0x3b9d2b61) VK_FORMAT_BC1_RGB_SRGB_BLOCK 0x0000 None 0x0000 N/A (Out of Range)
0xEC 1000156002 (0x3b9d2b62) VK_FORMAT_BC1_RGBA_UNORM_BLOCK 0x00EF VK_FORMAT_R8G8B8A8_SRGB 0x0000 N/A (Out of Range)
0xED 1000156003 (0x3b9d2b63) VK_FORMAT_BC1_RGBA_SRGB_BLOCK 0x00EF VK_FORMAT_R8G8B8A8_SRGB 0x0000 N/A (Out of Range)
0xEE 135 (0x87) VK_FORMAT_BC2_UNORM_BLOCK 0x00EF VK_FORMAT_R8G8B8A8_SRGB 0x00EE VK_FORMAT_R8G8B8A8_UNORM
0xEF 136 (0x88) VK_FORMAT_BC2_SRGB_BLOCK 0x00EF VK_FORMAT_R8G8B8A8_SRGB 0x0000 None
0xF0 137 (0x89) VK_FORMAT_BC3_UNORM_BLOCK 0x00EF VK_FORMAT_R8G8B8A8_SRGB 0x00EE VK_FORMAT_R8G8B8A8_UNORM
0xF1 1000156004 (0x3b9d2b64) VK_FORMAT_BC3_SRGB_BLOCK 0x0000 None 0x0000 None
0xF2 1000156005 (0x3b9d2b65) VK_FORMAT_BC4_UNORM_BLOCK 0x0107 VK_FORMAT_R8G8B8A8_UNORM 0x00F2 VK_FORMAT_R8_UNORM
0xF3 1000156006 (0x3b9d2b66) VK_FORMAT_BC4_SNORM_BLOCK 0x0000 None 0x0000 None
0xF4 1000156010 (0x3b9d2b6a) VK_FORMAT_BC5_UNORM_BLOCK 0x0106 VK_FORMAT_R8G8B8A8_UNORM 0x0000 None
0xF5 1000156011 (0x3b9d2b6b) VK_FORMAT_BC5_SNORM_BLOCK 0x0000 None 0x0000 None
0xF6 143 (0x8F) VK_FORMAT_BC6H_UFLOAT_BLOCK 0x0105 VK_FORMAT_R16G16B16A16_SFLOAT 0x0000 None
0xF7 1000156013 (0x3b9d2b6d) VK_FORMAT_BC6H_SFLOAT_BLOCK 0x0000 None 0x010A VK_FORMAT_R32G32B32A32_SFLOAT
0xF8 145 (0x91) VK_FORMAT_BC7_UNORM_BLOCK 0x0106 VK_FORMAT_R8G8B8A8_UNORM 0x0000 None
0xF9 1000156015 (0x3b9d2b6f) VK_FORMAT_BC7_SRGB_BLOCK 0x0000 None 0x0109 VK_FORMAT_R16G16B16A16_SFLOAT
0x104 157 (0x9D) VK_FORMAT_ASTC_4x4_UNORM_BLOCK 0x0105 VK_FORMAT_R16G16B16A16_SFLOAT 0x0000 None
0x105 159 (0x9F) VK_FORMAT_ASTC_5x4_UNORM_BLOCK 0x0105 VK_FORMAT_R16G16B16A16_SFLOAT 0x0000 None
0x106 161 (0xA1) VK_FORMAT_ASTC_5x5_UNORM_BLOCK 0x0106 VK_FORMAT_R8G8B8A8_UNORM 0x0000 None
0x107 163 (0xA3) VK_FORMAT_ASTC_6x5_UNORM_BLOCK 0x0107 VK_FORMAT_R8G8B8A8_UNORM 0x0000 None
0x109 167 (0xA7) VK_FORMAT_ASTC_8x5_UNORM_BLOCK 0x0106 VK_FORMAT_R8G8B8A8_UNORM 0x0109 VK_FORMAT_R16G16B16A16_SFLOAT
0x10A 169 (0xA9) VK_FORMAT_ASTC_8x6_UNORM_BLOCK 0x0105 VK_FORMAT_R16G16B16A16_SFLOAT 0x010A VK_FORMAT_R32G32B32A32_SFLOAT

Ghidra symbols:

  1. 0x030391e0, mali_bc_format_fallback_table, Format translation table mapping BC compressed formats to uncompressed RGBA/ASTC target fallback formats
  2. 0x01728400, mali_vk_format_get_bc_fallback_target, Looks up uncompressed RGBA/ASTC target fallback formats for BC texture emulation
  3. 0x00431120, mali_vk_format_to_internal_id, Maps standard Vulkan VkFormat enum values to internal Mali driver format index IDs

additoinally, 0x01713700 likely contains the code to setup the various transcode/decode pipelines

These should be sufficient to reconstruct mali_bc_format_fallback_table using mali_vk_format_to_internal_id and VkFormat from vulkan_core.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment