freedreno: Move the layout debug under FD_MESA_DEBUG=layout.

I keep wanting to turn this on while debugging layout stuff, and I
suspect krh and robclark could use it too.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3059>
This commit is contained in:
Eric Anholt 2019-12-12 13:48:31 -08:00 committed by Marge Bot
parent 65a6dc5139
commit 20357dfde8
7 changed files with 39 additions and 31 deletions

View File

@ -78,6 +78,8 @@ fdl6_layout(struct fdl_layout *layout,
layout->cpp = util_format_get_blocksize(format);
layout->cpp *= nr_samples;
layout->format = format;
layout->nr_samples = nr_samples;
const struct util_format_description *format_desc =
util_format_description(format);
@ -222,28 +224,6 @@ fdl6_layout(struct fdl_layout *layout,
layout->slices[level].offset += layout->ubwc_size * array_size;
layout->size += layout->ubwc_size * array_size;
}
if (false) {
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];
uint32_t tile_mode = (ubwc ?
layout->tile_mode : fdl_tile_mode(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 tiling=%d\n",
util_format_name(format),
u_minify(layout->width0, level),
u_minify(layout->height0, level),
u_minify(layout->depth0, level),
layout->cpp, nr_samples,
level,
slice->pitch * layout->cpp,
slice->size0, ubwc_slice->size0,
slice->size0 / (slice->pitch * layout->cpp),
slice->offset, ubwc_slice->offset,
tile_mode);
}
}
}
void

View File

@ -37,4 +37,30 @@ fdl_layout_buffer(struct fdl_layout *layout, uint32_t size)
layout->depth0 = 1;
layout->cpp = 1;
layout->size = size;
layout->format = PIPE_FORMAT_R8_UINT;
layout->nr_samples = 1;
}
void
fdl_dump_layout(struct fdl_layout *layout)
{
for (uint32_t level = 0; level < layout->slices[level].size0; level++) {
struct fdl_slice *slice = &layout->slices[level];
struct fdl_slice *ubwc_slice = &layout->ubwc_slices[level];
uint32_t tile_mode = (layout->ubwc_size ?
layout->tile_mode : fdl_tile_mode(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 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,
slice->pitch * layout->cpp,
slice->size0, ubwc_slice->size0,
slice->size0 / (slice->pitch * layout->cpp),
slice->offset, ubwc_slice->offset,
tile_mode);
}
}

View File

@ -108,6 +108,8 @@ struct fdl_layout {
uint8_t cpp;
uint32_t width0, height0, depth0;
uint32_t nr_samples;
enum pipe_format format;
uint32_t size; /* Size of the whole image, in bytes. */
@ -176,6 +178,9 @@ fdl6_layout(struct fdl_layout *layout,
uint32_t width0, uint32_t height0, uint32_t depth0,
uint32_t mip_levels, uint32_t array_size, bool is_3d, bool ubwc);
void
fdl_dump_layout(struct fdl_layout *layout);
void
fdl6_get_ubwc_blockwidth(struct fdl_layout *layout,
uint32_t *blockwidth, uint32_t *blockheight);

View File

@ -108,15 +108,6 @@ setup_slices(struct fd_resource *rsc, uint32_t alignment, enum pipe_format forma
else
slice->size0 = fd_resource_slice(rsc, level - 1)->size0;
#if 0
debug_printf("%s: %ux%ux%u@%u: %2u: stride=%4u, size=%7u, aligned_height=%3u\n",
util_format_name(prsc->format),
prsc->width0, prsc->height0, prsc->depth0, rsc->layout.cpp,
level, slice->pitch * rsc->layout.cpp,
slice->size0 * depth * layers_in_level,
aligned_height);
#endif
size += slice->size0 * depth * layers_in_level;
width = u_minify(width, 1);

View File

@ -1003,6 +1003,9 @@ fd_resource_create_with_modifiers(struct pipe_screen *pscreen,
size = rsc->layout.layer_size * prsc->array_size;
}
if (fd_mesa_debug & FD_DBG_LAYOUT)
fdl_dump_layout(&rsc->layout);
realloc_bo(rsc, size);
if (!rsc->bo)
goto fail;

View File

@ -91,6 +91,7 @@ static const struct debug_named_value debug_options[] = {
{"noubwc", FD_DBG_NOUBWC, "Disable UBWC for all internal buffers"},
{"nolrz", FD_DBG_NOLRZ, "Disable LRZ (a6xx)"},
{"notile", FD_DBG_NOTILE, "Disable tiling for all internal buffers"},
{"layout", FD_DBG_LAYOUT, "Dump resource layouts"},
DEBUG_NAMED_VALUE_END
};

View File

@ -88,6 +88,8 @@ enum fd_debug_flag {
FD_DBG_NOUBWC = BITFIELD_BIT(23),
FD_DBG_NOLRZ = BITFIELD_BIT(24),
FD_DBG_NOTILE = BITFIELD_BIT(25),
FD_DBG_LAYOUT = BITFIELD_BIT(26),
};
extern int fd_mesa_debug;