aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-12-12 13:48:31 -0800
committerMarge Bot <[email protected]>2020-02-04 23:18:00 +0000
commit20357dfde85712503ae82aeedcfa9b2bf31f2adc (patch)
treeffe2209419436ef5ea2e45a0594bda652762b6f1 /src
parent65a6dc5139fddd5e01eaedcc57fc67e0a6a28c94 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/freedreno/fdl/fd6_layout.c24
-rw-r--r--src/freedreno/fdl/freedreno_layout.c26
-rw-r--r--src/freedreno/fdl/freedreno_layout.h5
-rw-r--r--src/gallium/drivers/freedreno/a5xx/fd5_resource.c9
-rw-r--r--src/gallium/drivers/freedreno/freedreno_resource.c3
-rw-r--r--src/gallium/drivers/freedreno/freedreno_screen.c1
-rw-r--r--src/gallium/drivers/freedreno/freedreno_util.h2
7 files changed, 39 insertions, 31 deletions
diff --git a/src/freedreno/fdl/fd6_layout.c b/src/freedreno/fdl/fd6_layout.c
index 966a3e4bbc4..6f0a91afcb9 100644
--- a/src/freedreno/fdl/fd6_layout.c
+++ b/src/freedreno/fdl/fd6_layout.c
@@ -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
diff --git a/src/freedreno/fdl/freedreno_layout.c b/src/freedreno/fdl/freedreno_layout.c
index 6f604333560..345b33deb83 100644
--- a/src/freedreno/fdl/freedreno_layout.c
+++ b/src/freedreno/fdl/freedreno_layout.c
@@ -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);
+ }
}
diff --git a/src/freedreno/fdl/freedreno_layout.h b/src/freedreno/fdl/freedreno_layout.h
index 54f7d3720d3..e7dbc057df7 100644
--- a/src/freedreno/fdl/freedreno_layout.h
+++ b/src/freedreno/fdl/freedreno_layout.h
@@ -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. */
@@ -177,6 +179,9 @@ fdl6_layout(struct fdl_layout *layout,
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);
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_resource.c b/src/gallium/drivers/freedreno/a5xx/fd5_resource.c
index 0d356286eb5..3fe730a99c8 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_resource.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_resource.c
@@ -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);
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index 2e15bbadea1..4eced1fb1fb 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -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;
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index 5c0feb9e0f6..3c0ed69a9cb 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -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
};
diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h
index 33b38472d69..a83056d89d0 100644
--- a/src/gallium/drivers/freedreno/freedreno_util.h
+++ b/src/gallium/drivers/freedreno/freedreno_util.h
@@ -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;