summaryrefslogtreecommitdiffstats
path: root/src/panfrost
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-08-22 13:27:38 -0700
committerAlyssa Rosenzweig <[email protected]>2019-08-22 13:31:39 -0700
commitf4678f3c620d52b55522494e306196e8047f8136 (patch)
tree20e8d7927c28f952fe50466801072b513e399d37 /src/panfrost
parentcaec0b32320de68c35a3f02dd2ef1e8f37de928c (diff)
pan/decode: Handle special varyings
We need a special path for special varyings so we parse them correctly instead of throwing an error when they inevitably point to bad memory. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost')
-rw-r--r--src/panfrost/pandecode/decode.c46
1 files changed, 41 insertions, 5 deletions
diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c
index 2de376d4604..d68dbf7acb8 100644
--- a/src/panfrost/pandecode/decode.c
+++ b/src/panfrost/pandecode/decode.c
@@ -413,7 +413,6 @@ pandecode_stencil_op(enum mali_stencil_op op)
#undef DEFINE_CASE
-#define DEFINE_CASE(name) case MALI_ATTR_ ## name: return "MALI_ATTR_" #name
static char *pandecode_attr_mode_short(enum mali_attr_mode mode)
{
switch(mode) {
@@ -435,7 +434,21 @@ static char *pandecode_attr_mode_short(enum mali_attr_mode mode)
}
}
-#undef DEFINE_CASE
+static const char *
+pandecode_special_varying(uint64_t v)
+{
+ switch(v) {
+ case MALI_VARYING_FRAG_COORD:
+ return "gl_FragCoord";
+ case MALI_VARYING_FRONT_FACING:
+ return "gl_FrontFacing";
+ case MALI_VARYING_POINT_COORD:
+ return "gl_PointCoord";
+ default:
+ pandecode_msg("XXX: invalid special varying %X\n", v);
+ return "";
+ }
+}
#define DEFINE_CASE(name) case MALI_WRAP_## name: return "MALI_WRAP_" #name
static char *
@@ -1248,7 +1261,7 @@ pandecode_magic_divisor(uint32_t magic, unsigned shift, unsigned orig_divisor, u
static void
pandecode_attributes(const struct pandecode_mapped_memory *mem,
mali_ptr addr, int job_no, char *suffix,
- int count, bool varying)
+ int count, bool varying, enum mali_job_type job_type)
{
char *prefix = varying ? "varying" : "attribute";
assert(addr);
@@ -1261,6 +1274,29 @@ pandecode_attributes(const struct pandecode_mapped_memory *mem,
union mali_attr *attr = pandecode_fetch_gpu_mem(mem, addr, sizeof(union mali_attr) * count);
for (int i = 0; i < count; ++i) {
+ /* First, check for special records */
+ if (attr[i].elements < MALI_VARYING_SPECIAL) {
+ /* Special records are always varyings */
+
+ if (!varying)
+ pandecode_msg("XXX: Special varying in attribute field\n");
+
+ if (job_type != JOB_TYPE_TILER)
+ pandecode_msg("XXX: Special varying in non-FS\n");
+
+ /* We're special, so all fields should be zero */
+ unsigned zero = attr[i].stride | attr[i].size;
+ zero |= attr[i].shift | attr[i].extra_flags;
+
+ if (zero)
+ pandecode_msg("XXX: Special varying has non-zero fields\n");
+ else {
+ /* Print the special varying name */
+ pandecode_log("varying_%d = %s;", i, pandecode_special_varying(attr[i].elements));
+ continue;
+ }
+ }
+
enum mali_attr_mode mode = attr[i].elements & 7;
if (mode == MALI_ATTR_UNUSED)
@@ -2225,7 +2261,7 @@ pandecode_vertex_tiler_postfix_pre(
if (p->attributes) {
attr_mem = pandecode_find_mapped_gpu_mem_containing(p->attributes);
- pandecode_attributes(attr_mem, p->attributes, job_no, suffix, max_attr_index, false);
+ pandecode_attributes(attr_mem, p->attributes, job_no, suffix, max_attr_index, false, job_type);
}
/* Varyings are encoded like attributes but not actually sent; we just
@@ -2242,7 +2278,7 @@ pandecode_vertex_tiler_postfix_pre(
/* Number of descriptors depends on whether there are
* non-internal varyings */
- pandecode_attributes(attr_mem, p->varyings, job_no, suffix, varying_count, true);
+ pandecode_attributes(attr_mem, p->varyings, job_no, suffix, varying_count, true, job_type);
}
if (p->uniform_buffers) {