*
*/
+#include <stdint.h>
#include <stdlib.h>
#include <util/macros.h>
#define LIMA_TEXEL_FORMAT_A8 0x0a
#define LIMA_TEXEL_FORMAT_I8 0x0b
#define LIMA_TEXEL_FORMAT_BGR_565 0x0e
+#define LIMA_TEXEL_FORMAT_BGRA_5551 0x0f
+#define LIMA_TEXEL_FORMAT_BGRA_4444 0x10
#define LIMA_TEXEL_FORMAT_L8A8 0x11
#define LIMA_TEXEL_FORMAT_L16 0x12
#define LIMA_TEXEL_FORMAT_A16 0x13
#define LIMA_TEXEL_FORMAT_NONE -1
#define LIMA_PIXEL_FORMAT_B5G6R5 0x00
+#define LIMA_PIXEL_FORMAT_B5G5R5A1 0x01
+#define LIMA_PIXEL_FORMAT_B4G4R4A4 0x02
#define LIMA_PIXEL_FORMAT_B8G8R8A8 0x03
#define LIMA_PIXEL_FORMAT_Z16 0x0e
#define LIMA_PIXEL_FORMAT_Z24S8 0x0f
int texel;
int pixel;
bool swap_r_b;
+ uint32_t channel_layout;
};
-#define LIMA_FORMAT(pipe, tex, pix, swap) \
- [PIPE_FORMAT_##pipe] = { \
- .present = true, .texel = LIMA_TEXEL_FORMAT_##tex, \
+#define LIMA_FORMAT(pipe, tex, pix, swap, ch_layout) \
+ [PIPE_FORMAT_##pipe] = { \
+ .present = true, .texel = LIMA_TEXEL_FORMAT_##tex, \
.pixel = LIMA_PIXEL_FORMAT_##pix, .swap_r_b = swap, \
+ .channel_layout = ch_layout, \
}
static const struct lima_format lima_format_table[] = {
- LIMA_FORMAT(R8G8B8A8_UNORM, RGBA_8888, B8G8R8A8, true),
- LIMA_FORMAT(B8G8R8A8_UNORM, RGBA_8888, B8G8R8A8, false),
- LIMA_FORMAT(R8G8B8A8_SRGB, RGBA_8888, B8G8R8A8, true),
- LIMA_FORMAT(B8G8R8A8_SRGB, RGBA_8888, B8G8R8A8, false),
- LIMA_FORMAT(R8G8B8X8_UNORM, RGBX_8888, B8G8R8A8, true),
- LIMA_FORMAT(B8G8R8X8_UNORM, RGBX_8888, B8G8R8A8, false),
- LIMA_FORMAT(B5G6R5_UNORM, BGR_565, B5G6R5, false),
- LIMA_FORMAT(Z24_UNORM_S8_UINT, Z24S8, Z24S8, false),
- LIMA_FORMAT(Z24X8_UNORM, Z24S8, Z24S8, false),
+ LIMA_FORMAT(R8G8B8A8_UNORM, RGBA_8888, B8G8R8A8, true, 0x8888),
+ LIMA_FORMAT(B8G8R8A8_UNORM, RGBA_8888, B8G8R8A8, false, 0x8888),
+ LIMA_FORMAT(R8G8B8A8_SRGB, RGBA_8888, B8G8R8A8, true, 0x8888),
+ LIMA_FORMAT(B8G8R8A8_SRGB, RGBA_8888, B8G8R8A8, false, 0x8888),
+ LIMA_FORMAT(R8G8B8X8_UNORM, RGBX_8888, B8G8R8A8, true, 0x8888),
+ LIMA_FORMAT(B8G8R8X8_UNORM, RGBX_8888, B8G8R8A8, false, 0x8888),
+ LIMA_FORMAT(B5G6R5_UNORM, BGR_565, B5G6R5, false, 0x8565),
+ /* BGRA_5551 seems to need channel layout 0x8565, it's not a typo */
+ LIMA_FORMAT(B5G5R5A1_UNORM, BGRA_5551, B5G5R5A1, false, 0x8565),
+ LIMA_FORMAT(B4G4R4A4_UNORM, BGRA_4444, B4G4R4A4, false, 0x8444),
+ LIMA_FORMAT(Z24_UNORM_S8_UINT, Z24S8, Z24S8, false, 0x0000),
+ LIMA_FORMAT(Z24X8_UNORM, Z24S8, Z24S8, false, 0x0000),
/* Blob uses L16 for Z16 */
- LIMA_FORMAT(Z16_UNORM, L16, Z16, false),
- LIMA_FORMAT(L16_UNORM, L16, NONE, false),
- LIMA_FORMAT(L8_UNORM, L8, NONE, false),
- LIMA_FORMAT(A16_UNORM, A16, NONE, false),
- LIMA_FORMAT(A8_UNORM, A8, NONE, false),
- LIMA_FORMAT(I16_UNORM, I16, NONE, false),
- LIMA_FORMAT(I8_UNORM, I8, NONE, false),
- LIMA_FORMAT(L8A8_UNORM, L8A8, NONE, false),
- LIMA_FORMAT(ETC1_RGB8, ETC1_RGB8, NONE, false),
+ LIMA_FORMAT(Z16_UNORM, L16, Z16, false, 0x0000),
+ LIMA_FORMAT(L16_UNORM, L16, NONE, false, 0x0000),
+ LIMA_FORMAT(L8_UNORM, L8, NONE, false, 0x0000),
+ LIMA_FORMAT(A16_UNORM, A16, NONE, false, 0x0000),
+ LIMA_FORMAT(A8_UNORM, A8, NONE, false, 0x0000),
+ LIMA_FORMAT(I16_UNORM, I16, NONE, false, 0x0000),
+ LIMA_FORMAT(I8_UNORM, I8, NONE, false, 0x0000),
+ LIMA_FORMAT(L8A8_UNORM, L8A8, NONE, false, 0x0000),
+ LIMA_FORMAT(ETC1_RGB8, ETC1_RGB8, NONE, false, 0x8888),
};
static const struct lima_format *
{
return lima_format_table[f].swap_r_b;
}
+
+uint32_t
+lima_format_get_channel_layout(enum pipe_format f)
+{
+ return lima_format_table[f].channel_layout;
+}