From 96300120609a37020733cb9545707d863ebfe00a Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Sat, 20 Jun 2020 18:53:33 +1200 Subject: [PATCH] panfrost: RGBA4 and RGB5_A1 framebuffer support Tested with fbo_firecube. Reviewed-by: Tomeu Vizoso Part-of: --- src/gallium/drivers/panfrost/pan_mfbd.c | 2 ++ src/gallium/drivers/panfrost/pan_sfbd.c | 1 + src/panfrost/util/pan_lower_framebuffer.c | 3 +++ 3 files changed, 6 insertions(+) diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c index 62d86a678e7..41f21128198 100644 --- a/src/gallium/drivers/panfrost/pan_mfbd.c +++ b/src/gallium/drivers/panfrost/pan_mfbd.c @@ -74,6 +74,7 @@ panfrost_mfbd_format(struct pipe_surface *surf) case PIPE_FORMAT_A4B4G4R4_UNORM: case PIPE_FORMAT_B4G4R4A4_UNORM: + case PIPE_FORMAT_R4G4B4A4_UNORM: fmt.unk1 = 0x10000000; fmt.unk3 = 0x5; fmt.nr_channels = MALI_POSITIVE(1); @@ -89,6 +90,7 @@ panfrost_mfbd_format(struct pipe_surface *surf) break; case PIPE_FORMAT_B5G5R5A1_UNORM: + case PIPE_FORMAT_R5G5B5A1_UNORM: case PIPE_FORMAT_B5G5R5X1_UNORM: fmt.unk1 = 0x18000000; fmt.unk3 = 0x7; diff --git a/src/gallium/drivers/panfrost/pan_sfbd.c b/src/gallium/drivers/panfrost/pan_sfbd.c index 7a0deaf4d39..a163fa9b6a6 100644 --- a/src/gallium/drivers/panfrost/pan_sfbd.c +++ b/src/gallium/drivers/panfrost/pan_sfbd.c @@ -68,6 +68,7 @@ panfrost_sfbd_format(struct pipe_surface *surf) case PIPE_FORMAT_A4B4G4R4_UNORM: case PIPE_FORMAT_B4G4R4A4_UNORM: + case PIPE_FORMAT_R4G4B4A4_UNORM: fmt.unk1 = 0x4; fmt.nr_channels = MALI_POSITIVE(1); fmt.unk2 = 0x5; diff --git a/src/panfrost/util/pan_lower_framebuffer.c b/src/panfrost/util/pan_lower_framebuffer.c index 6e704f7763c..76adcfbcaa3 100644 --- a/src/panfrost/util/pan_lower_framebuffer.c +++ b/src/panfrost/util/pan_lower_framebuffer.c @@ -506,6 +506,7 @@ pan_is_unorm4(const struct util_format_description *desc) case PIPE_FORMAT_A4R4_UNORM: case PIPE_FORMAT_R4A4_UNORM: case PIPE_FORMAT_A4B4G4R4_UNORM: + case PIPE_FORMAT_R4G4B4A4_UNORM: return true; default: return false; @@ -545,6 +546,7 @@ pan_unpack(nir_builder *b, switch (desc->format) { case PIPE_FORMAT_B5G5R5A1_UNORM: + case PIPE_FORMAT_R5G5B5A1_UNORM: return pan_unpack_unorm_5551(b, packed); case PIPE_FORMAT_B5G6R5_UNORM: return pan_unpack_unorm_565(b, packed); @@ -597,6 +599,7 @@ pan_pack(nir_builder *b, switch (desc->format) { case PIPE_FORMAT_B5G5R5A1_UNORM: + case PIPE_FORMAT_R5G5B5A1_UNORM: return pan_pack_unorm_5551(b, unpacked); case PIPE_FORMAT_B5G6R5_UNORM: return pan_pack_unorm_565(b, unpacked); -- 2.30.2