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);
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
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);
+ }
}
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. */
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);
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);
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;
{"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
};
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;