lima/parser: Extend rsw parsing showing strings instead of numbers

Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Andreas Baierl <ichgeh@imkreisrum.de>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3807>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3807>
This commit is contained in:
Andreas Baierl 2020-01-30 10:37:55 +01:00 committed by Marge Bot
parent 7e2b4bf256
commit fe1b0b7c50
2 changed files with 131 additions and 22 deletions

View file

@ -450,19 +450,25 @@ parse_rsw(FILE *fp, uint32_t *value, int i, uint32_t *helper)
(float)(ubyte_to_float(*value & 0x0000ffff)));
break;
case 2: /* ALPHA BLEND */
fprintf(fp, "(1): colormask 0x%02x, rgb_func %d, alpha_func %d */\n",
fprintf(fp, "(1): colormask 0x%02x, rgb_func %d (%s), alpha_func %d (%s) */\n",
(*value & 0xf0000000) >> 28, /* colormask */
(*value & 0x00000007), /* rgb_func */
(*value & 0x00000038) >> 3); /* alpha_func */
(*value & 0x00000007),
lima_get_blend_func_string((*value & 0x00000007)), /* rgb_func */
(*value & 0x00000038) >> 3,
lima_get_blend_func_string((*value & 0x00000038) >> 3)); /* alpha_func */
/* add a few tabs for alignment */
fprintf(fp, "\t\t\t\t\t\t/* %s(2)", render_state_infos[i].info);
fprintf(fp, ": rgb_src_factor %d, rbg_dst_factor %d */\n",
(*value & 0x000007c0) >> 6, /* rgb_src_factor */
(*value & 0x0000f800) >> 11); /* rgb_dst_factor */
fprintf(fp, ": rgb_src_factor %d (%s), rbg_dst_factor %d (%s) */\n",
(*value & 0x000007c0) >> 6,
lima_get_blendfactor_string((*value & 0x000007c0) >> 6), /* rgb_src_factor */
(*value & 0x0000f800) >> 11,
lima_get_blendfactor_string((*value & 0x0000f800) >> 11)); /* rgb_dst_factor */
fprintf(fp, "\t\t\t\t\t\t/* %s(3)", render_state_infos[i].info);
fprintf(fp, ": alpha_src_factor %d, alpha_dst_factor %d, bits 24-27 0x%02x */\n",
(*value & 0x000f0000) >> 16, /* alpha_src_factor */
(*value & 0x00f00000) >> 20, /* alpha_dst_factor */
fprintf(fp, ": alpha_src_factor %d (%s), alpha_dst_factor %d (%s), bits 24-27 0x%02x */\n",
(*value & 0x000f0000) >> 16,
lima_get_blendfactor_string((*value & 0x000f0000) >> 16), /* alpha_src_factor */
(*value & 0x00f00000) >> 20,
lima_get_blendfactor_string((*value & 0x00f00000) >> 20), /* alpha_dst_factor */
(*value & 0x0f000000) >> 24); /* bits 24-27 */
break;
case 3: /* DEPTH TEST */
@ -472,7 +478,8 @@ parse_rsw(FILE *fp, uint32_t *value, int i, uint32_t *helper)
fprintf(fp, "(1): depth test disabled || writes not allowed");
fprintf(fp, "\n\t\t\t\t\t\t/* %s(2)", render_state_infos[i].info);
fprintf(fp, ": PIPE_FUNC_%d", (*value & 0x0000000e) >> 1);
fprintf(fp, ": blend_func %d (%s)", ((*value & 0x0000000e) >> 1),
lima_get_compare_func_string((*value & 0x0000000e) >> 1));
fprintf(fp, ", offset_scale: %d", (*value & 0x00ff0000) >> 16);
fprintf(fp, ", offset_units: %d", (*value & 0xff000000) >> 24);
fprintf(fp, ", unknown bits 4-15: 0x%08x */\n", *value & 0x0000fff0);
@ -483,29 +490,37 @@ parse_rsw(FILE *fp, uint32_t *value, int i, uint32_t *helper)
(float)(ushort_to_float(*value & 0x0000ffff)));
break;
case 5: /* STENCIL FRONT */
fprintf(fp, "(1): valuemask 0x%02x, ref value %d (0x%02x), stencil_func %d */\n",
fprintf(fp, "(1): valuemask 0x%02x, ref value %d (0x%02x), stencil_func %d (%s)*/\n",
(*value & 0xff000000) >> 24, /* valuemask */
(*value & 0x00ff0000) >> 16, (*value & 0x00ff0000) >> 16, /* ref value */
(*value & 0x00000007)); /* stencil_func */
(*value & 0x00000007),
lima_get_compare_func_string((*value & 0x00000007))); /* stencil_func */
/* add a few tabs for alignment */
fprintf(fp, "\t\t\t\t\t\t/* %s(2)", render_state_infos[i].info);
fprintf(fp, ": fail_op %d, zfail_op %d, zpass_op %d, unknown (12-15) 0x%02x */\n",
(*value & 0x00000038) >> 3, /* fail_op */
(*value & 0x000001c0) >> 6, /* zfail_op */
(*value & 0x00000e00) >> 9, /* zpass_op */
fprintf(fp, ": fail_op %d (%s), zfail_op %d (%s), zpass_op %d (%s), unknown (12-15) 0x%02x */\n",
(*value & 0x00000038) >> 3,
lima_get_stencil_op_string((*value & 0x00000038) >> 3), /* fail_op */
(*value & 0x000001c0) >> 6,
lima_get_stencil_op_string((*value & 0x000001c0) >> 6), /* zfail_op */
(*value & 0x00000e00) >> 9,
lima_get_stencil_op_string((*value & 0x00000e00) >> 9), /* zpass_op */
(*value & 0x0000f000) >> 12); /* unknown */
break;
case 6: /* STENCIL BACK */
fprintf(fp, "(1): valuemask 0x%02x, ref value %d (0x%02x), stencil_func %d */\n",
fprintf(fp, "(1): valuemask 0x%02x, ref value %d (0x%02x), stencil_func %d (%s)*/\n",
(*value & 0xff000000) >> 24, /* valuemask */
(*value & 0x00ff0000) >> 16, (*value & 0x00ff0000) >> 16, /* ref value */
(*value & 0x00000007)); /* stencil_func */
(*value & 0x00000007),
lima_get_compare_func_string((*value & 0x00000007))); /* stencil_func */
/* add a few tabs for alignment */
fprintf(fp, "\t\t\t\t\t\t/* %s(2)", render_state_infos[i].info);
fprintf(fp, ": fail_op %d, zfail_op %d, zpass_op %d, unknown (12-15) 0x%02x */\n",
(*value & 0x00000038) >> 3, /* fail_op */
(*value & 0x000001c0) >> 6, /* zfail_op */
(*value & 0x00000e00) >> 9, /* zpass_op */
fprintf(fp, ": fail_op %d (%s), zfail_op %d (%s), zpass_op %d (%s), unknown (12-15) 0x%02x */\n",
(*value & 0x00000038) >> 3,
lima_get_stencil_op_string((*value & 0x00000038) >> 3), /* fail_op */
(*value & 0x000001c0) >> 6,
lima_get_stencil_op_string((*value & 0x000001c0) >> 6), /* zfail_op */
(*value & 0x00000e00) >> 9,
lima_get_stencil_op_string((*value & 0x00000e00) >> 9), /* zpass_op */
(*value & 0x0000f000) >> 12); /* unknown */
break;
case 7: /* STENCIL TEST */

View file

@ -24,6 +24,100 @@
#ifndef H_LIMA_PARSER
#define H_LIMA_PARSER
static const char *PIPE_COMPARE_FUNC_STRING[] = {
"NEVER", /* 0 */
"LESS", /* 1 */
"EQUAL", /* 2 */
"LEQUAL", /* 3 */
"GREATER", /* 4 */
"NOTEQUAL", /* 5 */
"GEQUAL", /* 6 */
"ALWAYS", /* 7 */
};
static const char *PIPE_STENCIL_OP_STRING[] = {
"KEEP", /* 0 */
"REPLACE", /* 1 */
"ZERO", /* 2 */
"INVERT", /* 3 */
"INCR_WRAP", /* 4 */
"DECR_WRAP", /* 5 */
"INCR", /* 6 */
"DECR", /* 7 */
};
static const char *PIPE_BLEND_FUNC_STRING[] = {
"SUBTRACT", /* 0 */
"REV_SUBTRACT", /* 1 */
"ADD", /* 2 */
"UNKNOWN_3", /* 3 */
"BLEND_MIN", /* 4 */
"BLEND_MAX", /* 5 */
};
static const char *PIPE_BLENDFACTOR_STRING[] = {
"SRC_COLOR", /* 0 */
"DST_COLOR", /* 1 */
"CONST_COLOR", /* 2 */
"ZERO", /* 3 */
"UNKNOWN_4", /* 4 */
"UNKNOWN_5", /* 5 */
"UNKNOWN_6", /* 6 */
"SRC_ALPHA_SAT", /* 7 */
"INV_SRC_COLOR", /* 8 */
"INV_DST_COLOR", /* 9 */
"INV_CONST_COLOR", /* 10 */
"ONE", /* 11 */
"UNKNOWN_12", /* 12 */
"UNKNOWN_13", /* 13 */
"UNKNOWN_14", /* 14 */
"UNKNOWN_15", /* 15 */
"SRC_ALPHA", /* 16 */
"DST_ALPHA", /* 17 */
"CONST_ALPHA", /* 18 */
"UNKNOWN_19", /* 19 */
"UNKNOWN_20", /* 20 */
"UNKNOWN_21", /* 21 */
"UNKNOWN_22", /* 22 */
"UNKNOWN_23", /* 23 */
"INV_SRC_ALPHA", /* 24 */
"INV_DST_ALPHA", /* 25 */
"INV_CONST_ALPHA", /* 26 */
};
static inline const char
*lima_get_compare_func_string(int func) {
if ((func >= 0) && (func <= 7))
return PIPE_COMPARE_FUNC_STRING[func];
else
return "UNKNOWN";
}
static inline const char
*lima_get_stencil_op_string(int func) {
if ((func >= 0) && (func <= 7))
return PIPE_STENCIL_OP_STRING[func];
else
return "UNKNOWN";
}
static inline const char
*lima_get_blend_func_string(int func) {
if ((func >= 0) && (func <= 5))
return PIPE_BLEND_FUNC_STRING[func];
else
return "UNKNOWN";
}
static inline const char
*lima_get_blendfactor_string(int func) {
if ((func >= 0) && (func <= 26))
return PIPE_BLENDFACTOR_STRING[func];
else
return "UNKNOWN";
}
void lima_parse_vs(FILE *fp, uint32_t *data, int size, uint32_t start);
void lima_parse_plbu(FILE *fp, uint32_t *data, int size, uint32_t start);
void lima_parse_render_state(FILE *fp, uint32_t *data, int size, uint32_t start);