return "instanced_npot";
case MALI_ATTR_IMAGE:
return "image";
- case MALI_ATTR_INTERNAL:
- return "internal";
default:
pandecode_msg("XXX: invalid attribute mode %X\n", mode);
return "";
}
static const char *
-pandecode_special_varying(uint64_t v)
+pandecode_special_record(uint64_t v, bool* attribute)
{
switch(v) {
+ case MALI_ATTR_VERTEXID:
+ *attribute = true;
+ return "gl_VertexID";
+ case MALI_ATTR_INSTANCEID:
+ *attribute = true;
+ return "gl_InstanceID";
case MALI_VARYING_FRAG_COORD:
return "gl_FragCoord";
case MALI_VARYING_FRONT_FACING:
case MALI_VARYING_POINT_COORD:
return "gl_PointCoord";
default:
- pandecode_msg("XXX: invalid special varying %" PRIx64 "\n", v);
+ pandecode_msg("XXX: invalid special record %" PRIx64 "\n", v);
return "";
}
}
pandecode_log_cont(",\n");
pandecode_prop("nr_channels = MALI_POSITIVE(%d)",
- MALI_NEGATIVE(format.nr_channels));
+ (format.nr_channels + 1));
pandecode_log(".unk2 = ");
pandecode_log_decoded_flags(sfbd_unk2_info, format.unk2);
pandecode_log_cont(",\n");
pandecode_prop("nr_channels = MALI_POSITIVE(%d)",
- MALI_NEGATIVE(format.nr_channels));
+ (format.nr_channels + 1));
pandecode_log(".flags = ");
pandecode_log_decoded_flags(mfbd_fmt_flag_info, format.flags);
pandecode_log("struct bifrost_render_target rts_list_%"PRIx64"_%d[] = {\n", gpu_va, job_no);
pandecode_indent++;
- for (int i = 0; i < MALI_NEGATIVE(fb->rt_count_1); i++) {
+ for (int i = 0; i < (fb->rt_count_1 + 1); i++) {
mali_ptr rt_va = gpu_va + i * sizeof(struct bifrost_render_target);
struct pandecode_mapped_memory *mem =
pandecode_find_mapped_gpu_mem_containing(rt_va);
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 (attr[i].elements < MALI_RECORD_SPECIAL) {
+ if (attr[i].size)
+ pandecode_msg("XXX: tripped size=%d\n", attr[i].size);
+
+ if (attr[i].stride) {
+ /* gl_InstanceID passes a magic divisor in the
+ * stride field to divide by the padded vertex
+ * count. No other records should do so, so
+ * stride should otherwise be zero. Note that
+ * stride in the usual attribute sense doesn't
+ * apply to special records. */
+
+ bool has_divisor = attr[i].elements == MALI_ATTR_INSTANCEID;
+
+ pandecode_log_cont("/* %smagic divisor = %X */ ",
+ has_divisor ? "" : "XXX: ", attr[i].stride);
+ }
- if (!varying)
- pandecode_msg("XXX: Special varying in attribute field\n");
+ if (attr[i].shift || attr[i].extra_flags) {
+ /* Attributes use these fields for
+ * instancing/padding/etc type issues, but
+ * varyings don't */
- if (job_type != JOB_TYPE_TILER)
- pandecode_msg("XXX: Special varying in non-FS\n");
+ pandecode_log_cont("/* %sshift=%d, extra=%d */ ",
+ varying ? "XXX: " : "",
+ attr[i].shift, attr[i].extra_flags);
+ }
- /* 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;
+ /* Print the special record name */
+ bool attribute = false;
+ pandecode_log("%s_%d = %s;\n", prefix, i, pandecode_special_record(attr[i].elements, &attribute));
- 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;
- }
- }
+ /* Sanity check */
+ if (attribute == varying)
+ pandecode_msg("XXX: mismatched special record\n");
+
+ continue;
+ }
enum mali_attr_mode mode = attr[i].elements & 7;
}
static void
-pandecode_vertex_tiler_prefix(struct mali_vertex_tiler_prefix *p, int job_no, bool noninstanced)
+pandecode_vertex_tiler_prefix(struct mali_vertex_tiler_prefix *p, int job_no, bool graphics)
{
pandecode_log_cont("{\n");
pandecode_indent++;
* decoded, we're good to go. */
struct mali_vertex_tiler_prefix ref;
- panfrost_pack_work_groups_compute(&ref, groups_x, groups_y, groups_z, size_x, size_y, size_z, noninstanced);
+ panfrost_pack_work_groups_compute(&ref, groups_x, groups_y, groups_z, size_x, size_y, size_z, graphics);
bool canonical =
(p->invocation_count == ref.invocation_count) &&
pandecode_log("};\n");
}
+static const char *
+shader_type_for_job(unsigned type)
+{
+ switch (type) {
+ case JOB_TYPE_VERTEX: return "VERTEX";
+ case JOB_TYPE_TILER: return "FRAGMENT";
+ case JOB_TYPE_COMPUTE: return "COMPUTE";
+ default:
+ return "UNKNOWN";
+ }
+}
+
static unsigned shader_id = 0;
static struct midgard_disasm_stats
MESA_SHADER_FRAGMENT : MESA_SHADER_VERTEX);
}
- /* Print shader-db stats */
+ /* Print shader-db stats. Skip COMPUTE jobs since they are used for
+ * driver-internal purposes with the blob and interfere */
- unsigned nr_threads =
- (stats.work_count <= 4) ? 4 :
- (stats.work_count <= 8) ? 2 :
- 1;
+ bool should_shaderdb = type != JOB_TYPE_COMPUTE;
- printf("shader%d - %s shader: "
- "%u inst, %u bundles, %u quadwords, "
- "%u registers, %u threads, 0 loops\n\n\n",
- shader_id++,
- (type == JOB_TYPE_TILER) ? "FRAGMENT" : "VERTEX",
- stats.instruction_count, stats.bundle_count, stats.quadword_count,
- stats.work_count, nr_threads);
+ if (should_shaderdb) {
+ unsigned nr_threads =
+ (stats.work_count <= 4) ? 4 :
+ (stats.work_count <= 8) ? 2 :
+ 1;
+
+ printf("shader%d - MESA_SHADER_%s shader: "
+ "%u inst, %u bundles, %u quadwords, "
+ "%u registers, %u threads, 0 loops, 0:0 spills:fills\n\n\n",
+ shader_id++,
+ shader_type_for_job(type),
+ stats.instruction_count, stats.bundle_count, stats.quadword_count,
+ stats.work_count, nr_threads);
+ }
return stats;
* properties, but dump extra
* possibilities to futureproof */
- int bitmap_count = MALI_NEGATIVE(t->levels);
+ int bitmap_count = t->levels + 1;
/* Miptree for each face */
if (f.type == MALI_TEX_CUBE)
bitmap_count *= 6;
/* Array of textures */
- bitmap_count *= MALI_NEGATIVE(t->array_size);
+ bitmap_count *= (t->array_size + 1);
/* Stride for each element */
if (f.manual_stride)
bool has_primitive_pointer = v->prefix.unknown_draw & MALI_DRAW_VARYING_SIZE;
pandecode_primitive_size(v->primitive_size, !has_primitive_pointer);
- bool instanced = v->instance_shift || v->instance_odd;
bool is_graphics = (h->job_type == JOB_TYPE_VERTEX) || (h->job_type == JOB_TYPE_TILER);
pandecode_log(".prefix = ");
- pandecode_vertex_tiler_prefix(&v->prefix, job_no, !instanced && is_graphics);
+ pandecode_vertex_tiler_prefix(&v->prefix, job_no, is_graphics);
pandecode_gl_enables(v->gl_enables, h->job_type);