freedreno/fdl: Re-indent

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10293>
This commit is contained in:
Rob Clark 2021-04-16 12:26:04 -07:00 committed by Marge Bot
parent 6050976232
commit c74d93cf01
8 changed files with 1145 additions and 1072 deletions

View File

@ -30,10 +30,10 @@
#include "freedreno_layout.h"
void
fdl5_layout(struct fdl_layout *layout,
enum pipe_format format, uint32_t nr_samples,
uint32_t width0, uint32_t height0, uint32_t depth0,
uint32_t mip_levels, uint32_t array_size, bool is_3d)
fdl5_layout(struct fdl_layout *layout, enum pipe_format format,
uint32_t nr_samples, uint32_t width0, uint32_t height0,
uint32_t depth0, uint32_t mip_levels, uint32_t array_size,
bool is_3d)
{
assert(nr_samples > 0);
layout->width0 = width0;
@ -64,7 +64,8 @@ fdl5_layout(struct fdl_layout *layout,
struct fdl_slice *slice = &layout->slices[level];
uint32_t tile_mode = fdl_tile_mode(layout, level);
uint32_t pitch = fdl_pitch(layout, level);
uint32_t nblocksy = util_format_get_nblocksy(format, u_minify(height0, level));
uint32_t nblocksy =
util_format_get_nblocksy(format, u_minify(height0, level));
if (tile_mode) {
nblocksy = align(nblocksy, heightalign);
@ -90,8 +91,7 @@ fdl5_layout(struct fdl_layout *layout,
* different than what this code does), so as soon as the layer size
* range gets into range, we stop reducing it.
*/
if (is_3d && (
level == 1 ||
if (is_3d && (level == 1 ||
(level > 1 && layout->slices[level - 1].size0 > 0xf000)))
slice->size0 = align(nblocksy * pitch, alignment);
else if (level == 0 || layout->layer_first || alignment == 1)
@ -102,4 +102,3 @@ fdl5_layout(struct fdl_layout *layout,
layout->size += slice->size0 * u_minify(depth0, level) * layers_in_level;
}
}

View File

@ -37,10 +37,13 @@ static const struct testcase testcases[] = {
/* Basic POT, non-UBWC layout test */
{
.format = PIPE_FORMAT_R9G9B9E5_FLOAT,
.layout = {
.layout =
{
.tile_mode = TILE5_3,
.width0 = 32, .height0 = 32,
.slices = {
.width0 = 32,
.height0 = 32,
.slices =
{
{.offset = 0, .pitch = 256},
{.offset = 8192, .pitch = 256},
{.offset = 12288, .pitch = 256},
@ -57,11 +60,15 @@ static const struct testcase testcases[] = {
{
.format = PIPE_FORMAT_R9G9B9E5_FLOAT,
.is_3d = true,
.layout = {
.layout =
{
.tile_mode = TILE5_3,
.ubwc = false,
.width0 = 59, .height0 = 37, .depth0 = 11,
.slices = {
.width0 = 59,
.height0 = 37,
.depth0 = 11,
.slices =
{
{.offset = 0, .pitch = 256},
{.offset = 135168, .pitch = 256},
{.offset = 176128, .pitch = 256},
@ -74,11 +81,15 @@ static const struct testcase testcases[] = {
{
.format = PIPE_FORMAT_R32G32_FLOAT,
.is_3d = true,
.layout = {
.layout =
{
.tile_mode = TILE5_3,
.ubwc = false,
.width0 = 63, .height0 = 29, .depth0 = 11,
.slices = {
.width0 = 63,
.height0 = 29,
.depth0 = 11,
.slices =
{
{.offset = 0, .pitch = 512},
{.offset = 180224, .pitch = 512},
{.offset = 221184, .pitch = 512},

View File

@ -37,8 +37,8 @@ is_r8g8(struct fdl_layout *layout)
}
void
fdl6_get_ubwc_blockwidth(struct fdl_layout *layout,
uint32_t *blockwidth, uint32_t *blockheight)
fdl6_get_ubwc_blockwidth(struct fdl_layout *layout, uint32_t *blockwidth,
uint32_t *blockheight)
{
static const struct {
uint8_t width;
@ -47,8 +47,8 @@ fdl6_get_ubwc_blockwidth(struct fdl_layout *layout,
{ 16, 4 }, /* cpp = 1 */
{ 16, 4 }, /* cpp = 2 */
{ 16, 4 }, /* cpp = 4 */
{ 8, 4, }, /* cpp = 8 */
{ 4, 4, }, /* cpp = 16 */
{ 8, 4 }, /* cpp = 8 */
{ 4, 4 }, /* cpp = 16 */
{ 4, 2 }, /* cpp = 32 */
{ 0, 0 }, /* cpp = 64 (TODO) */
};
@ -95,11 +95,10 @@ fdl6_tile_alignment(struct fdl_layout *layout, uint32_t *heightalign)
* piglit/bin/texelFetch fs sampler3D 100x100x8
*/
bool
fdl6_layout(struct fdl_layout *layout,
enum pipe_format format, uint32_t nr_samples,
uint32_t width0, uint32_t height0, uint32_t depth0,
uint32_t mip_levels, uint32_t array_size, bool is_3d,
struct fdl_explicit_layout *explicit_layout)
fdl6_layout(struct fdl_layout *layout, enum pipe_format format,
uint32_t nr_samples, uint32_t width0, uint32_t height0,
uint32_t depth0, uint32_t mip_levels, uint32_t array_size,
bool is_3d, struct fdl_explicit_layout *explicit_layout)
{
uint32_t offset = 0, heightalign;
uint32_t ubwc_blockwidth, ubwc_blockheight;
@ -238,10 +237,11 @@ fdl6_layout(struct fdl_layout *layout,
layout->size = align(layout->size, 4096);
uint32_t meta_pitch = fdl_ubwc_pitch(layout, level);
uint32_t meta_height = align(u_minify(ubwc_height0, level),
ubwc_tile_height_alignment);
uint32_t meta_height =
align(u_minify(ubwc_height0, level), ubwc_tile_height_alignment);
ubwc_slice->size0 = align(meta_pitch * meta_height, UBWC_PLANE_SIZE_ALIGNMENT);
ubwc_slice->size0 =
align(meta_pitch * meta_height, UBWC_PLANE_SIZE_ALIGNMENT);
ubwc_slice->offset = offset + layout->ubwc_layer_size;
layout->ubwc_layer_size += ubwc_slice->size0;
}

View File

@ -29,13 +29,18 @@
#include <stdio.h>
static const struct testcase testcases[] = {
static const struct testcase
testcases[] =
{
/* A straightforward first testcase, linear, with an obvious format. */
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.width0 = 32, .height0 = 32,
.slices = {
.layout =
{
.width0 = 32,
.height0 = 32,
.slices =
{
{.offset = 0, .pitch = 256},
{.offset = 8192, .pitch = 256},
{.offset = 12288, .pitch = 256},
@ -46,16 +51,19 @@ static const struct testcase testcases[] = {
},
},
/* A tiled/ubwc layout from the blob driver, at a size where the a630 blob
* driver does something interesting for linear.
/* A tiled/ubwc layout from the blob driver, at a size where the a630
* blob driver does something interesting for linear.
*/
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.layout =
{
.tile_mode = TILE6_3,
.ubwc = true,
.width0 = 1024, .height0 = 1,
.slices = {
.width0 = 1024,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 4096},
{.offset = 65536, .pitch = 2048},
{.offset = 98304, .pitch = 1024},
@ -68,7 +76,8 @@ static const struct testcase testcases[] = {
{.offset = 143360, .pitch = 256},
{.offset = 147456, .pitch = 256},
},
.ubwc_slices = {
.ubwc_slices =
{
{.offset = 0, .pitch = 64},
{.offset = 4096, .pitch = 64},
{.offset = 8192, .pitch = 64},
@ -116,9 +125,12 @@ static const struct testcase testcases[] = {
*/
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.width0 = 128, .height0 = 1,
.slices = {
.layout =
{
.width0 = 128,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 512},
{.offset = 512, .pitch = 256},
{.offset = 768, .pitch = 256},
@ -132,9 +144,12 @@ static const struct testcase testcases[] = {
},
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.width0 = 129, .height0 = 1,
.slices = {
.layout =
{
.width0 = 129,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 768},
{.offset = 768, .pitch = 512},
{.offset = 1280, .pitch = 256},
@ -148,9 +163,12 @@ static const struct testcase testcases[] = {
},
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.width0 = 130, .height0 = 1,
.slices = {
.layout =
{
.width0 = 130,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 768},
{.offset = 768, .pitch = 512},
{.offset = 1280, .pitch = 256},
@ -166,9 +184,12 @@ static const struct testcase testcases[] = {
/* The 129 failure seems to be across formats, let's test some cpps */
{
.format = PIPE_FORMAT_R8_UNORM,
.layout = {
.width0 = 129, .height0 = 1,
.slices = {
.layout =
{
.width0 = 129,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 192},
{.offset = 192, .pitch = 128},
{.offset = 320, .pitch = 64},
@ -182,9 +203,12 @@ static const struct testcase testcases[] = {
},
{
.format = PIPE_FORMAT_R16_UINT,
.layout = {
.width0 = 129, .height0 = 1,
.slices = {
.layout =
{
.width0 = 129,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 384},
{.offset = 384, .pitch = 256},
{.offset = 640, .pitch = 128},
@ -198,9 +222,12 @@ static const struct testcase testcases[] = {
},
{
.format = PIPE_FORMAT_R32G32B32A32_FLOAT,
.layout = {
.width0 = 129, .height0 = 1,
.slices = {
.layout =
{
.width0 = 129,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 3072},
{.offset = 3072, .pitch = 2048},
{.offset = 5120, .pitch = 1024},
@ -218,9 +245,12 @@ static const struct testcase testcases[] = {
*/
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.width0 = 385, .height0 = 128,
.slices = {
.layout =
{
.width0 = 385,
.height0 = 128,
.slices =
{
{.offset = 0, .pitch = 1792},
{.offset = 229376, .pitch = 1024},
{.offset = 294912, .pitch = 512},
@ -234,12 +264,16 @@ static const struct testcase testcases[] = {
},
},
/* At 257-259 (and replicated every +256 pixels) we had another failure. */
/* At 257-259 (and replicated every +256 pixels) we had another
failure. */
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.width0 = 257, .height0 = 1,
.slices = {
.layout =
{
.width0 = 257,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 1280},
{.offset = 1280, .pitch = 768},
{.offset = 2048, .pitch = 512},
@ -254,9 +288,12 @@ static const struct testcase testcases[] = {
},
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.width0 = 258, .height0 = 1,
.slices = {
.layout =
{
.width0 = 258,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 1280},
{.offset = 1280, .pitch = 768},
{.offset = 2048, .pitch = 512},
@ -271,9 +308,12 @@ static const struct testcase testcases[] = {
},
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.width0 = 259, .height0 = 1,
.slices = {
.layout =
{
.width0 = 259,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 1280},
{.offset = 1280, .pitch = 768},
{.offset = 2048, .pitch = 512},
@ -288,9 +328,12 @@ static const struct testcase testcases[] = {
},
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.width0 = 260, .height0 = 1,
.slices = {
.layout =
{
.width0 = 260,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 1280},
{.offset = 1280, .pitch = 768},
{.offset = 2048, .pitch = 512},
@ -307,9 +350,12 @@ static const struct testcase testcases[] = {
/* And, again for the 257-9 failure, test a replica with a larger size*/
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.width0 = 513, .height0 = 32,
.slices = {
.layout =
{
.width0 = 513,
.height0 = 32,
.slices =
{
{.offset = 0, .pitch = 2304},
{.offset = 73728, .pitch = 1280},
{.offset = 94208, .pitch = 768},
@ -329,9 +375,12 @@ static const struct testcase testcases[] = {
*/
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.width0 = 518, .height0 = 1,
.slices = {
.layout =
{
.width0 = 518,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 2304},
{.offset = 2304, .pitch = 1280},
{.offset = 3584, .pitch = 768},
@ -346,13 +395,17 @@ static const struct testcase testcases[] = {
},
},
/* Tiled mode testing of the unusual 1/2-bytes-per-pixel pitch alignment */
/* Tiled mode testing of the unusual 1/2-bytes-per-pixel pitch
alignment */
{
.format = PIPE_FORMAT_R8_UNORM,
.layout = {
.layout =
{
.tile_mode = TILE6_3,
.width0 = 129, .height0 = 1,
.slices = {
.width0 = 129,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 256},
{.offset = 8192, .pitch = 128},
{.offset = 12288, .pitch = 128},
@ -365,19 +418,23 @@ static const struct testcase testcases[] = {
},
},
/* Single-level RGBA8888 UBWC following UBWC alignment rules laid out in
* msm_media_info.h to verify that we don't break buffer sharing.
/* Single-level RGBA8888 UBWC following UBWC alignment rules laid out
* in msm_media_info.h to verify that we don't break buffer sharing.
*/
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.layout =
{
.tile_mode = TILE6_3,
.ubwc = true,
.width0 = 16384, .height0 = 129,
.slices = {
.width0 = 16384,
.height0 = 129,
.slices =
{
{.offset = 1024 * 48, .pitch = 16384 * 4},
},
.ubwc_slices = {
.ubwc_slices =
{
{.offset = 0, .pitch = 1024},
},
},
@ -389,11 +446,14 @@ static const struct testcase testcases[] = {
*/
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.layout =
{
.tile_mode = TILE6_3,
.ubwc = true,
.width0 = 2049, .height0 = 128,
.slices = {
.width0 = 2049,
.height0 = 128,
.slices =
{
{.offset = 0, .pitch = 8448},
{.offset = 1081344, .pitch = 4352},
{.offset = 1359872, .pitch = 2304},
@ -407,7 +467,8 @@ static const struct testcase testcases[] = {
{.offset = 1490944, .pitch = 256},
{.offset = 1495040, .pitch = 256},
},
.ubwc_slices = {
.ubwc_slices =
{
{.offset = 0, .pitch = 256},
{.offset = 16384, .pitch = 128},
{.offset = 24576, .pitch = 64},
@ -426,11 +487,14 @@ static const struct testcase testcases[] = {
/* UBWC: Height comes from POT-aligned level 0. */
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.layout =
{
.tile_mode = TILE6_3,
.ubwc = true,
.width0 = 1024, .height0 = 1025,
.slices = {
.width0 = 1024,
.height0 = 1025,
.slices =
{
{.offset = 0, .pitch = 4096},
{.offset = 4259840, .pitch = 2048},
{.offset = 5308416, .pitch = 1024},
@ -443,7 +507,8 @@ static const struct testcase testcases[] = {
{.offset = 5672960, .pitch = 256},
{.offset = 5677056, .pitch = 256},
},
.ubwc_slices = {
.ubwc_slices =
{
{.offset = 0, .pitch = 64},
{.offset = 32768, .pitch = 64},
{.offset = 49152, .pitch = 64},
@ -462,11 +527,14 @@ static const struct testcase testcases[] = {
/* UBWC: Get at minimum height of a level across cpps */
{
.format = PIPE_FORMAT_R16_UINT,
.layout = {
.layout =
{
.tile_mode = TILE6_3,
.ubwc = true,
.width0 = 16384, .height0 = 1,
.slices = {
.width0 = 16384,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 32768},
{.offset = 524288, .pitch = 16384},
{.offset = 786432, .pitch = 8192},
@ -483,7 +551,8 @@ static const struct testcase testcases[] = {
{.offset = 1064960, .pitch = 256},
{.offset = 1069056, .pitch = 256},
},
.ubwc_slices = {
.ubwc_slices =
{
{.offset = 0, .pitch = 1024},
{.offset = 65536, .pitch = 512},
{.offset = 98304, .pitch = 256},
@ -504,11 +573,14 @@ static const struct testcase testcases[] = {
},
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.layout =
{
.tile_mode = TILE6_3,
.ubwc = true,
.width0 = 16384, .height0 = 1,
.slices = {
.width0 = 16384,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 65536},
{.offset = 1048576, .pitch = 32768},
{.offset = 1572864, .pitch = 16384},
@ -525,7 +597,8 @@ static const struct testcase testcases[] = {
{.offset = 2109440, .pitch = 256},
{.offset = 2113536, .pitch = 256},
},
.ubwc_slices = {
.ubwc_slices =
{
{.offset = 0, .pitch = 1024},
{.offset = 65536, .pitch = 512},
{.offset = 98304, .pitch = 256},
@ -546,11 +619,14 @@ static const struct testcase testcases[] = {
},
{
.format = PIPE_FORMAT_R32G32B32A32_FLOAT,
.layout = {
.layout =
{
.tile_mode = TILE6_3,
.ubwc = true,
.width0 = 16384, .height0 = 1,
.slices = {
.width0 = 16384,
.height0 = 1,
.slices =
{
{.offset = 0, .pitch = 262144},
{.offset = 4194304, .pitch = 131072},
{.offset = 6291456, .pitch = 65536},
@ -567,7 +643,8 @@ static const struct testcase testcases[] = {
{.offset = 8437760, .pitch = 1024},
{.offset = 8454144, .pitch = 1024},
},
.ubwc_slices = {
.ubwc_slices =
{
{.offset = 0, .pitch = 4096},
{.offset = 262144, .pitch = 2048},
{.offset = 393216, .pitch = 1024},
@ -589,15 +666,19 @@ static const struct testcase testcases[] = {
{
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
.layout = {
.layout =
{
.tile_mode = TILE6_3,
.ubwc = true,
.nr_samples = 4,
.width0 = 412, .height0 = 732,
.slices = {
.width0 = 412,
.height0 = 732,
.slices =
{
{.offset = 0, .pitch = 7168},
},
.ubwc_slices = {
.ubwc_slices =
{
{.offset = 0, .pitch = 128},
},
},

View File

@ -29,7 +29,8 @@
#include <stdio.h>
bool fdl_test_layout(const struct testcase *testcase, int gpu_id)
bool
fdl_test_layout(const struct testcase *testcase, int gpu_id)
{
struct fdl_layout layout = {
.ubwc = testcase->layout.ubwc,
@ -45,27 +46,18 @@ bool fdl_test_layout(const struct testcase *testcase, int gpu_id)
}
if (gpu_id >= 600) {
fdl6_layout(&layout,
testcase->format,
MAX2(testcase->layout.nr_samples, 1),
testcase->layout.width0,
fdl6_layout(&layout, testcase->format,
MAX2(testcase->layout.nr_samples, 1), testcase->layout.width0,
MAX2(testcase->layout.height0, 1),
MAX2(testcase->layout.depth0, 1),
mip_levels,
MAX2(testcase->array_size, 1),
testcase->is_3d,
NULL);
MAX2(testcase->layout.depth0, 1), mip_levels,
MAX2(testcase->array_size, 1), testcase->is_3d, NULL);
} else {
assert(gpu_id >= 500);
fdl5_layout(&layout,
testcase->format,
MAX2(testcase->layout.nr_samples, 1),
testcase->layout.width0,
fdl5_layout(&layout, testcase->format,
MAX2(testcase->layout.nr_samples, 1), testcase->layout.width0,
MAX2(testcase->layout.height0, 1),
MAX2(testcase->layout.depth0, 1),
mip_levels,
MAX2(testcase->array_size, 1),
testcase->is_3d);
MAX2(testcase->layout.depth0, 1), mip_levels,
MAX2(testcase->array_size, 1), testcase->is_3d);
}
/* fdl lays out UBWC data before the color data, while all we have
@ -82,37 +74,32 @@ bool fdl_test_layout(const struct testcase *testcase, int gpu_id)
for (int l = 0; l < mip_levels; l++) {
if (layout.slices[l].offset != testcase->layout.slices[l].offset) {
fprintf(stderr, "%s %dx%dx%d@%dx lvl%d: offset 0x%x != 0x%x\n",
util_format_short_name(testcase->format),
layout.width0, layout.height0, layout.depth0,
layout.nr_samples, l,
layout.slices[l].offset,
testcase->layout.slices[l].offset);
util_format_short_name(testcase->format), layout.width0,
layout.height0, layout.depth0, layout.nr_samples, l,
layout.slices[l].offset, testcase->layout.slices[l].offset);
ok = false;
}
if (fdl_pitch(&layout, l) != testcase->layout.slices[l].pitch) {
fprintf(stderr, "%s %dx%dx%d@%dx lvl%d: pitch %d != %d\n",
util_format_short_name(testcase->format),
layout.width0, layout.height0, layout.depth0,
layout.nr_samples, l,
fdl_pitch(&layout, l),
testcase->layout.slices[l].pitch);
util_format_short_name(testcase->format), layout.width0,
layout.height0, layout.depth0, layout.nr_samples, l,
fdl_pitch(&layout, l), testcase->layout.slices[l].pitch);
ok = false;
}
if (layout.ubwc_slices[l].offset != testcase->layout.ubwc_slices[l].offset) {
if (layout.ubwc_slices[l].offset !=
testcase->layout.ubwc_slices[l].offset) {
fprintf(stderr, "%s %dx%dx%d@%dx lvl%d: UBWC offset 0x%x != 0x%x\n",
util_format_short_name(testcase->format),
layout.width0, layout.height0, layout.depth0,
layout.nr_samples, l,
util_format_short_name(testcase->format), layout.width0,
layout.height0, layout.depth0, layout.nr_samples, l,
layout.ubwc_slices[l].offset,
testcase->layout.ubwc_slices[l].offset);
ok = false;
}
if (fdl_ubwc_pitch(&layout, l) != testcase->layout.ubwc_slices[l].pitch) {
fprintf(stderr, "%s %dx%dx%d@%dx lvl%d: UBWC pitch %d != %d\n",
util_format_short_name(testcase->format),
layout.width0, layout.height0, layout.depth0,
layout.nr_samples, l,
util_format_short_name(testcase->format), layout.width0,
layout.height0, layout.depth0, layout.nr_samples, l,
fdl_ubwc_pitch(&layout, l),
testcase->layout.ubwc_slices[l].pitch);
ok = false;

View File

@ -45,22 +45,22 @@ fdl_layout_buffer(struct fdl_layout *layout, uint32_t size)
void
fdl_dump_layout(struct fdl_layout *layout)
{
for (uint32_t level = 0; level < ARRAY_SIZE(layout->slices) && layout->slices[level].size0; level++) {
for (uint32_t level = 0;
level < ARRAY_SIZE(layout->slices) && layout->slices[level].size0;
level++) {
struct fdl_slice *slice = &layout->slices[level];
struct fdl_slice *ubwc_slice = &layout->ubwc_slices[level];
fprintf(stderr, "%s: %ux%ux%u@%ux%u:\t%2u: stride=%4u, size=%6u,%6u, aligned_height=%3u, offset=0x%x,0x%x, layersz %5u,%5u tiling=%d\n",
util_format_name(layout->format),
u_minify(layout->width0, level),
u_minify(layout->height0, level),
u_minify(layout->depth0, level),
layout->cpp, layout->nr_samples,
level,
fdl_pitch(layout, level),
fprintf(
stderr,
"%s: %ux%ux%u@%ux%u:\t%2u: stride=%4u, size=%6u,%6u, "
"aligned_height=%3u, offset=0x%x,0x%x, layersz %5u,%5u tiling=%d\n",
util_format_name(layout->format), u_minify(layout->width0, level),
u_minify(layout->height0, level), u_minify(layout->depth0, level),
layout->cpp, layout->nr_samples, level, fdl_pitch(layout, level),
slice->size0, ubwc_slice->size0,
slice->size0 / fdl_pitch(layout, level),
slice->offset, ubwc_slice->offset,
layout->layer_size, layout->ubwc_layer_size,
slice->size0 / fdl_pitch(layout, level), slice->offset,
ubwc_slice->offset, layout->layer_size, layout->ubwc_layer_size,
fdl_tile_mode(layout, level));
}
}

View File

@ -27,9 +27,9 @@
#include <stdbool.h>
#include <stdint.h>
#include "util/format/u_format.h"
#include "util/u_debug.h"
#include "util/u_math.h"
#include "util/format/u_format.h"
/* Shared freedreno mipmap layout helper
*
@ -183,7 +183,8 @@ fdl2_pitch_pixels(const struct fdl_layout *layout, unsigned level)
}
static inline uint32_t
fdl_surface_offset(const struct fdl_layout *layout, unsigned level, unsigned layer)
fdl_surface_offset(const struct fdl_layout *layout, unsigned level,
unsigned layer)
{
const struct fdl_slice *slice = &layout->slices[level];
return slice->offset + fdl_layer_stride(layout, level) * layer;
@ -227,21 +228,17 @@ fdl_ubwc_enabled(const struct fdl_layout *layout, int level)
return layout->ubwc;
}
void
fdl_layout_buffer(struct fdl_layout *layout, uint32_t size);
void fdl_layout_buffer(struct fdl_layout *layout, uint32_t size);
void
fdl5_layout(struct fdl_layout *layout,
enum pipe_format format, uint32_t nr_samples,
uint32_t width0, uint32_t height0, uint32_t depth0,
uint32_t mip_levels, uint32_t array_size, bool is_3d);
void fdl5_layout(struct fdl_layout *layout, enum pipe_format format,
uint32_t nr_samples, uint32_t width0, uint32_t height0,
uint32_t depth0, uint32_t mip_levels, uint32_t array_size,
bool is_3d);
bool
fdl6_layout(struct fdl_layout *layout,
enum pipe_format format, uint32_t nr_samples,
uint32_t width0, uint32_t height0, uint32_t depth0,
uint32_t mip_levels, uint32_t array_size, bool is_3d,
struct fdl_explicit_layout *plane_layout);
bool fdl6_layout(struct fdl_layout *layout, enum pipe_format format,
uint32_t nr_samples, uint32_t width0, uint32_t height0,
uint32_t depth0, uint32_t mip_levels, uint32_t array_size,
bool is_3d, struct fdl_explicit_layout *plane_layout);
static inline void
fdl_set_pitchalign(struct fdl_layout *layout, unsigned pitchalign)
@ -251,11 +248,9 @@ fdl_set_pitchalign(struct fdl_layout *layout, unsigned pitchalign)
layout->pitch0 = align(nblocksx * layout->cpp, 1 << pitchalign);
}
void
fdl_dump_layout(struct fdl_layout *layout);
void fdl_dump_layout(struct fdl_layout *layout);
void
fdl6_get_ubwc_blockwidth(struct fdl_layout *layout,
uint32_t *blockwidth, uint32_t *blockheight);
void fdl6_get_ubwc_blockwidth(struct fdl_layout *layout, uint32_t *blockwidth,
uint32_t *blockheight);
#endif /* FREEDRENO_LAYOUT_H_ */