From 0167391a1ac9d6b5a519f67a7d0fb58eef89da0d Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 9 Mar 2020 09:45:52 -0400 Subject: [PATCH] panfrost: Add tentative bifrost_texture_descriptor It looks very similar to the Midgard texture descriptor, just with a bunch of fields moved around and the whole descriptor flattened (so basically just memory access optimizations, from what I can tell). Signed-off-by: Alyssa Rosenzweig Signed-off-by: Tomeu Vizoso Reviewed-by: Alyssa Rosenzweig Part-of: --- src/panfrost/include/panfrost-job.h | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index 71beac01e6b..c5934ab824e 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -1238,6 +1238,38 @@ struct mali_texture_descriptor { uint32_t unknown7; } __attribute__((packed)); +/* While Midgard texture descriptors are variable length, Bifrost descriptors + * are fixed like samplers with more pointers to expand if necessary */ + +struct bifrost_texture_descriptor { + unsigned format_unk : 4; /* 2 */ + enum mali_texture_type type : 2; + unsigned format_unk2 : 16; /* 0 */ + enum mali_format format : 8; + unsigned srgb : 1; + unsigned format_unk3 : 1; /* 0 */ + + uint16_t width; /* MALI_POSITIVE */ + uint16_t height; /* MALI_POSITIVE */ + + /* OpenGL swizzle */ + unsigned swizzle : 12; + unsigned unk0 : 4; /* 1 */ + uint8_t levels : 8; /* Number of levels-1 if mipmapped, 0 if not */ + unsigned unk1 : 4; + + unsigned levels_unk : 24; /* 0 */ + unsigned level_2 : 8; /* Number of levels, again? */ + + mali_ptr payload; + + uint16_t array_size; + uint16_t unk4; + + uint16_t depth; + uint16_t unk5; +} __attribute__((packed)); + /* filter_mode */ #define MALI_SAMP_MAG_NEAREST (1 << 0)