pan/decode: Cleanup mali_attr printing

We can smush this into one-line per record as per usual. We still need
more validation and cleaning this up, especially around instancing. But
for LINEAR records, it works okay already.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-08-21 08:05:02 -07:00
parent 62e6673908
commit fc69a5cf73

View file

@ -414,16 +414,21 @@ pandecode_stencil_op(enum mali_stencil_op op)
#undef DEFINE_CASE #undef DEFINE_CASE
#define DEFINE_CASE(name) case MALI_ATTR_ ## name: return "MALI_ATTR_" #name #define DEFINE_CASE(name) case MALI_ATTR_ ## name: return "MALI_ATTR_" #name
static char *pandecode_attr_mode(enum mali_attr_mode mode) static char *pandecode_attr_mode_short(enum mali_attr_mode mode)
{ {
switch(mode) { switch(mode) {
DEFINE_CASE(UNUSED); /* TODO: Combine to just "instanced" once this can be done
DEFINE_CASE(LINEAR); * unambiguously in all known cases */
DEFINE_CASE(POT_DIVIDE); case MALI_ATTR_POT_DIVIDE:
DEFINE_CASE(MODULO); return "instanced_pot";
DEFINE_CASE(NPOT_DIVIDE); case MALI_ATTR_MODULO:
DEFINE_CASE(IMAGE); return "instanced_mod";
DEFINE_CASE(INTERNAL); case MALI_ATTR_NPOT_DIVIDE:
return "instanced_npot";
case MALI_ATTR_IMAGE:
return "image";
case MALI_ATTR_INTERNAL:
return "internal";
default: default:
pandecode_msg("XXX: invalid attribute mode %X\n", mode); pandecode_msg("XXX: invalid attribute mode %X\n", mode);
return ""; return "";
@ -1220,7 +1225,7 @@ pandecode_attributes(const struct pandecode_mapped_memory *mem,
mali_ptr addr, int job_no, char *suffix, mali_ptr addr, int job_no, char *suffix,
int count, bool varying) int count, bool varying)
{ {
char *prefix = varying ? "varyings" : "attributes"; char *prefix = varying ? "varying" : "attribute";
if (!addr) { if (!addr) {
pandecode_msg("no %s\n", prefix); pandecode_msg("no %s\n", prefix);
@ -1233,26 +1238,48 @@ pandecode_attributes(const struct pandecode_mapped_memory *mem,
pandecode_indent++; pandecode_indent++;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
pandecode_log("{\n");
pandecode_indent++;
enum mali_attr_mode mode = attr[i].elements & 7; enum mali_attr_mode mode = attr[i].elements & 7;
if (mode == MALI_ATTR_UNUSED) if (mode == MALI_ATTR_UNUSED)
pandecode_msg("XXX: unused attribute record\n"); pandecode_msg("XXX: unused attribute record\n");
pandecode_make_indent();
/* For non-linear records, we need to print the type of record */
if (mode != MALI_ATTR_LINEAR)
pandecode_log_cont("%s ", pandecode_attr_mode_short(mode));
/* Print the name to link with attr_meta */
pandecode_log_cont("%s_%d", prefix, i);
/* Print the stride and size */
pandecode_log_cont("<%u>[%u]", attr[i].stride, attr[i].size);
/* Check: the size must be divisible by the stride */
if (attr[i].size % attr[i].stride)
pandecode_msg("XXX: size not divisible by stride\n");
/* TODO: Sanity check the quotient itself -- it should equal
* vertex count (or something computed from it for instanced)
* which means we can check and elide */
/* Finally, print the pointer */
mali_ptr raw_elements = attr[i].elements & ~7; mali_ptr raw_elements = attr[i].elements & ~7;
char *a = pointer_as_memory_reference(raw_elements); char *a = pointer_as_memory_reference(raw_elements);
pandecode_prop("elements = (%s) | %s", a, pandecode_attr_mode(mode)); pandecode_log_cont(" = (%s);\n", a);
free(a); free(a);
/* Check the pointer */ /* Check the pointer */
pandecode_validate_buffer(raw_elements, attr[i].size); pandecode_validate_buffer(raw_elements, attr[i].size);
pandecode_prop("shift = %d", attr[i].shift); /* shift/extra_flags exist only for instanced */
pandecode_prop("extra_flags = %d", attr[i].extra_flags); if (attr[i].shift | attr[i].extra_flags) {
pandecode_prop("stride = 0x%" PRIx32, attr[i].stride); if (mode == MALI_ATTR_LINEAR)
pandecode_prop("size = 0x%" PRIx32, attr[i].size); pandecode_msg("XXX: instancing fields set for linear\n");
pandecode_prop("shift = %d", attr[i].shift);
pandecode_prop("extra_flags = %d", attr[i].extra_flags);
}
/* Decode further where possible */ /* Decode further where possible */
@ -1262,9 +1289,6 @@ pandecode_attributes(const struct pandecode_mapped_memory *mem,
attr[i].extra_flags); attr[i].extra_flags);
} }
pandecode_indent--;
pandecode_log("}, \n");
if (mode == MALI_ATTR_NPOT_DIVIDE) { if (mode == MALI_ATTR_NPOT_DIVIDE) {
i++; i++;
pandecode_log("{\n"); pandecode_log("{\n");