From: Connor Abbott Date: Fri, 27 Mar 2020 11:00:13 +0000 (+0100) Subject: freedreno/fdl: Add base_align X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d84c206d85c15cb8bc7e2d3113ab40c2b65f47cc;p=mesa.git freedreno/fdl: Add base_align Tell users what the base address of the image needs to be aligned to. These values are based on experimentation via passing an offset to vkBindImageMemory with turnip and seeing if tests still pass. Note that r8g8 is also special in this regard, however it actually has an increased alignment (in bytes). Part-of: --- diff --git a/src/freedreno/fdl/fd6_layout.c b/src/freedreno/fdl/fd6_layout.c index 661d7574e8b..62700ad61b6 100644 --- a/src/freedreno/fdl/fd6_layout.c +++ b/src/freedreno/fdl/fd6_layout.c @@ -36,26 +36,27 @@ * missing 96/128 CPP for 8x MSAA with 32_32_32/32_32_32_32 */ static const struct { + unsigned basealign; unsigned pitchalign; unsigned heightalign; uint8_t ubwc_blockwidth; uint8_t ubwc_blockheight; } tile_alignment[] = { - [1] = { 128, 32, 16, 4 }, - [2] = { 128, 16, 16, 4 }, - [3] = { 64, 32 }, - [4] = { 64, 16, 16, 4 }, - [6] = { 64, 16 }, - [8] = { 64, 16, 8, 4, }, - [12] = { 64, 16 }, - [16] = { 64, 16, 4, 4, }, - [24] = { 64, 16 }, - [32] = { 64, 16, 4, 2 }, - [48] = { 64, 16 }, - [64] = { 64, 16 }, + [1] = { 64, 128, 32, 16, 4 }, + [2] = { 128, 128, 16, 16, 4 }, + [3] = { 256, 64, 32 }, + [4] = { 256, 64, 16, 16, 4 }, + [6] = { 256, 64, 16 }, + [8] = { 256, 64, 16, 8, 4, }, + [12] = { 256, 64, 16 }, + [16] = { 256, 64, 16, 4, 4, }, + [24] = { 256, 64, 16 }, + [32] = { 256, 64, 16, 4, 2 }, + [48] = { 256, 64, 16 }, + [64] = { 256, 64, 16 }, /* special cases for r8g8: */ - [0] = { 64, 32, 16, 4 }, + [0] = { 256, 64, 32, 16, 4 }, }; #define RGB_TILE_WIDTH_ALIGNMENT 64 @@ -117,6 +118,12 @@ fdl6_layout(struct fdl_layout *layout, debug_assert(ta < ARRAY_SIZE(tile_alignment)); debug_assert(tile_alignment[ta].pitchalign); + if (layout->tile_mode) { + layout->base_align = tile_alignment[ta].basealign; + } else { + layout->base_align = 64; + } + for (uint32_t level = 0; level < mip_levels; level++) { struct fdl_slice *slice = &layout->slices[level]; struct fdl_slice *ubwc_slice = &layout->ubwc_slices[level]; diff --git a/src/freedreno/fdl/freedreno_layout.h b/src/freedreno/fdl/freedreno_layout.h index f20a3056c2c..e9bc3bdb371 100644 --- a/src/freedreno/fdl/freedreno_layout.h +++ b/src/freedreno/fdl/freedreno_layout.h @@ -114,6 +114,7 @@ struct fdl_layout { enum pipe_format format; uint32_t size; /* Size of the whole image, in bytes. */ + uint32_t base_align; /* Alignment of the base address, in bytes. */ }; static inline uint32_t