summaryrefslogtreecommitdiffstats
path: root/src/panfrost/pandecode/decode.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-08-19 10:38:25 -0700
committerAlyssa Rosenzweig <[email protected]>2019-08-21 08:40:52 -0700
commit52101e48f8851433d2c72b39d82ece793f8cfa1f (patch)
treeb63cfdd9f189f01dfcc2360bda40e58b4f786946 /src/panfrost/pandecode/decode.c
parente918dd8a6c6c1e5cba6fc06f751212ebb04bda3c (diff)
pan/decode: Express tiler structures as offsets
This allows us to catch a class of errors (for negative offsets, etc) automatically. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost/pandecode/decode.c')
-rw-r--r--src/panfrost/pandecode/decode.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c
index 25fd261b6e2..782ad2991fc 100644
--- a/src/panfrost/pandecode/decode.c
+++ b/src/panfrost/pandecode/decode.c
@@ -486,19 +486,21 @@ pandecode_midgard_tiler_descriptor(const struct midgard_tiler_descriptor *t)
pandecode_prop("polygon_list_size = 0x%x", t->polygon_list_size);
MEMORY_PROP(t, polygon_list);
- MEMORY_PROP(t, polygon_list_body);
- MEMORY_PROP(t, heap_start);
+ /* The body is offset from the base of the polygon list */
+ assert(t->polygon_list_body > t->polygon_list);
+ unsigned body_offset = t->polygon_list_body - t->polygon_list;
- if (t->heap_start == t->heap_end) {
- /* Print identically to show symmetry for empty tiler heaps */
- MEMORY_PROP(t, heap_end);
- } else {
- /* Points to the end of a buffer */
- char *a = pointer_as_memory_reference(t->heap_end - 1);
- pandecode_prop("heap_end = %s + 1", a);
- free(a);
- }
+ /* It needs to fit inside the reported size */
+ assert(t->polygon_list_size >= body_offset);
+
+ /* TODO: Check BO size */
+ pandecode_msg("body offset %d\n", body_offset);
+
+ /* The tiler heap has a start and end specified. TODO: Check size */
+ MEMORY_PROP(t, heap_start);
+ assert(t->heap_end >= t->heap_start);
+ pandecode_msg("heap size %d\n", t->heap_end - t->heap_start);
bool nonzero_weights = false;