[Mesa-dev] [PATCH 2/3] panfrost/decode: Stride decoding
Alyssa Rosenzweig
alyssa at rosenzweig.io
Tue May 14 23:25:27 UTC 2019
With a special flag, texture descriptors can include custom stride(s).
We haven't seen a case of this used for mipmaps/cubemaps, so it's not
clear how that will be encoded, but this dumps correctly for single
one-level 2D textures.
Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
---
.../drivers/panfrost/include/panfrost-job.h | 3 ++
.../drivers/panfrost/pandecode/decode.c | 33 +++++++++++++++++--
2 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/panfrost/include/panfrost-job.h b/src/gallium/drivers/panfrost/include/panfrost-job.h
index 71ac054f7c3..96c2d07ef4d 100644
--- a/src/gallium/drivers/panfrost/include/panfrost-job.h
+++ b/src/gallium/drivers/panfrost/include/panfrost-job.h
@@ -1106,6 +1106,9 @@ enum mali_wrap_mode {
/* Corresponds to the type passed to glTexImage2D and so forth */
+/* Flags for usage2 */
+#define MALI_TEX_MANUAL_STRIDE (0x20)
+
struct mali_texture_format {
unsigned swizzle : 12;
enum mali_format format : 8;
diff --git a/src/gallium/drivers/panfrost/pandecode/decode.c b/src/gallium/drivers/panfrost/pandecode/decode.c
index 5a1fcf75ead..f8f49f69e42 100644
--- a/src/gallium/drivers/panfrost/pandecode/decode.c
+++ b/src/gallium/drivers/panfrost/pandecode/decode.c
@@ -1507,6 +1507,20 @@ pandecode_replay_vertex_tiler_postfix_pre(const struct mali_vertex_tiler_postfix
bitmap_count *= 6;
}
+ if (f.usage2 & MALI_TEX_MANUAL_STRIDE) {
+ /* Stride for each... what exactly? TODO More traces */
+
+ if (bitmap_count > 1) {
+ pandecode_msg("Manual stride with mip/cubemaps, decode uncertain");
+ }
+
+ /* This is a guess, we've only
+ * seen for 1-level non-mip 2D
+ * */
+
+ bitmap_count += 1;
+ }
+
int max_count = sizeof(t->swizzled_bitmaps) / sizeof(t->swizzled_bitmaps[0]);
if (bitmap_count > max_count) {
@@ -1518,9 +1532,22 @@ pandecode_replay_vertex_tiler_postfix_pre(const struct mali_vertex_tiler_postfix
int safe_count = MIN2(bitmap_count * 2, max_count);
for (int i = 0; i < safe_count; ++i) {
- char *a = pointer_as_memory_reference(t->swizzled_bitmaps[i]);
- pandecode_log("%s%s, \n", (i >= bitmap_count) ? "// " : "", a);
- free(a);
+ char *prefix = (i >= bitmap_count) ? "// " : "";
+
+ /* How we dump depends if this is a stride or a pointer */
+
+ if ((f.usage2 & MALI_TEX_MANUAL_STRIDE) && ((i + 1) == bitmap_count)) {
+ /* signed 32-bit snuck in as a 64-bit pointer */
+ uint64_t stride_set = t->swizzled_bitmaps[i];
+ uint32_t clamped_stride = stride_set;
+ int32_t stride = clamped_stride;
+ assert(stride_set == clamped_stride);
+ pandecode_log("%s(mali_ptr) %d /* stride */, \n", prefix, stride);
+ } else {
+ char *a = pointer_as_memory_reference(t->swizzled_bitmaps[i]);
+ pandecode_log("%s%s, \n", prefix, a);
+ free(a);
+ }
}
pandecode_indent--;
--
2.20.1
More information about the mesa-dev
mailing list