From 31ed081ca3b55f12a768d2d408d88a49908a3f54 Mon Sep 17 00:00:00 2001 From: Andreas Baierl Date: Thu, 5 Dec 2019 17:39:01 +0100 Subject: [PATCH] lima/parser: Some fixes and cleanups Signed-off-by: Andreas Baierl Part-of: --- src/gallium/drivers/lima/lima_parser.c | 80 +++++++++++--------------- src/gallium/drivers/lima/lima_util.c | 2 +- 2 files changed, 36 insertions(+), 46 deletions(-) diff --git a/src/gallium/drivers/lima/lima_parser.c b/src/gallium/drivers/lima/lima_parser.c index 5d606bdc24a..2b5e89368a0 100644 --- a/src/gallium/drivers/lima/lima_parser.c +++ b/src/gallium/drivers/lima/lima_parser.c @@ -36,19 +36,17 @@ parse_vs_draw(FILE *fp, uint32_t *value1, uint32_t *value2) if ((*value1 == 0x00000000) && (*value2 == 0x00000000)) fprintf(fp, "\t/* ---EMPTY CMD */\n"); else - fprintf(fp, "\t/* DRAW: num: %d (0x%x), index_draw: %s */\n", + fprintf(fp, "\t/* DRAW: num: %d, index_draw: %s */\n", (*value1 & 0xff000000) >> 24 | (*value2 & 0x000000ff) << 8, - (*value1 & 0xff000000) >> 24 | (*value2 & 0x000000ff) << 8, - (*value2 & 0x00000001) ? "true" : "false"); + (*value1 & 0x00000001) ? "true" : "false"); } static void parse_vs_shader_info(FILE *fp, uint32_t *value1, uint32_t *value2) { - fprintf(fp, "\t/* SHADER_INFO: prefetch: %s, size: %d (0x%x) */\n", - (*value1 & 0x00100000) ? "enabled" : "disabled", - (((*value1 & 0x000fffff) >> 10) + 1) << 4, - (((*value1 & 0x000fffff) >> 10) + 1) << 4); + fprintf(fp, "\t/* SHADER_INFO: prefetch: %s, size: %d */\n", + (*value1 & 0x00100000) ? "enabled" : "disabled", + (((*value1 & 0x000fffff) >> 10) + 1) << 4); } static void @@ -60,37 +58,36 @@ parse_vs_unknown1(FILE *fp, uint32_t *value1, uint32_t *value2) static void parse_vs_varying_attribute_count(FILE *fp, uint32_t *value1, uint32_t *value2) { - fprintf(fp, "\t/* VARYING_ATTRIBUTE_COUNT: nr_vary: %d (0x%x), nr_attr: %d (0x%x) */\n", - ((*value1 & 0x00ffffff) >> 8) + 1, ((*value1 & 0x00ffffff) >> 8) + 1, - (*value1 >> 24) + 1, (*value1 >> 24) + 1); + fprintf(fp, "\t/* VARYING_ATTRIBUTE_COUNT: nr_vary: %d, nr_attr: %d */\n", + ((*value1 & 0x00ffffff) >> 8) + 1, (*value1 >> 24) + 1); } static void parse_vs_attributes_address(FILE *fp, uint32_t *value1, uint32_t *value2) { - fprintf(fp, "\t/* ATTRIBUTES_ADDRESS: address: 0x%08x, size: %d (0x%x) */\n", - *value1, (*value2 & 0x0fffffff) >> 17, (*value2 & 0x0fffffff) >> 17); + fprintf(fp, "\t/* ATTRIBUTES_ADDRESS: address: 0x%08x, size: %d */\n", + *value1, (*value2 & 0x0fffffff) >> 17); } static void parse_vs_varyings_address(FILE *fp, uint32_t *value1, uint32_t *value2) { - fprintf(fp, "\t/* VARYINGS_ADDRESS: address: 0x%08x, size: %d (0x%x) */\n", - *value1, (*value2 & 0x0fffffff) >> 17, (*value2 & 0x0fffffff) >> 17); + fprintf(fp, "\t/* VARYINGS_ADDRESS: varying info @ 0x%08x, size: %d */\n", + *value1, (*value2 & 0x0fffffff) >> 17); } static void parse_vs_uniforms_address(FILE *fp, uint32_t *value1, uint32_t *value2) { - fprintf(fp, "\t/* UNIFORMS_ADDRESS: address: 0x%08x, size: %d (0x%x) */\n", - *value1, (*value2 & 0x0fffffff) >> 12, (*value2 & 0x0fffffff) >> 12); + fprintf(fp, "\t/* UNIFORMS_ADDRESS (GP): address: 0x%08x, size: %d */\n", + *value1, (*value2 & 0x0fffffff) >> 12); } static void parse_vs_shader_address(FILE *fp, uint32_t *value1, uint32_t *value2) { - fprintf(fp, "\t/* SHADER_ADDRESS: address: 0x%08x, size: %d (0x%x) */\n", - *value1, (*value2 & 0x0fffffff) >> 12, (*value2 & 0x0fffffff) >> 12); + fprintf(fp, "\t/* SHADER_ADDRESS (VS): address: 0x%08x, size: %d */\n", + *value1, (*value2 & 0x0fffffff) >> 12); } static void @@ -168,35 +165,31 @@ lima_parse_vs(FILE *fp, uint32_t *data, int size, uint32_t start) static void parse_plbu_block_step(FILE *fp, uint32_t *value1, uint32_t *value2) { - fprintf(fp, "\t/* BLOCK_STEP: shift_min: %d (0x%x), shift_h: %d (0x%x), shift_w: %d (0x%x) */\n", - (*value1 & 0xf0000000) >> 28, (*value1 & 0xf0000000) >> 28, - (*value1 & 0x0fff0000) >> 16, (*value1 & 0x0fff0000) >> 16, - *value1 & 0x0000ffff, *value1 & 0x0000ffff); + fprintf(fp, "\t/* BLOCK_STEP: shift_min: %d, shift_h: %d, shift_w: %d */\n", + (*value1 & 0xf0000000) >> 28, + (*value1 & 0x0fff0000) >> 16, + *value1 & 0x0000ffff); } static void parse_plbu_tiled_dimensions(FILE *fp, uint32_t *value1, uint32_t *value2) { - fprintf(fp, "\t/* TILED_DIMENSIONS: tiled_w: %d (0x%x), tiled_h: %d (0x%x) */\n", - ((*value1 & 0xff000000) >> 24) + 1, + fprintf(fp, "\t/* TILED_DIMENSIONS: tiled_w: %d, tiled_h: %d */\n", ((*value1 & 0xff000000) >> 24) + 1, - ((*value1 & 0x00ffff00) >> 8) + 1, ((*value1 & 0x00ffff00) >> 8) + 1); } static void parse_plbu_block_stride(FILE *fp, uint32_t *value1, uint32_t *value2) { - fprintf(fp, "\t/* BLOCK_STRIDE: block_w: %d (0x%x) */\n", - *value1 & 0x000000ff, *value1 & 0x000000ff); + fprintf(fp, "\t/* BLOCK_STRIDE: block_w: %d */\n", *value1 & 0x000000ff); } static void parse_plbu_array_address(FILE *fp, uint32_t *value1, uint32_t *value2) { - fprintf(fp, "\t/* ARRAY_ADDRESS: gp_stream: 0x%x, block_num (block_w * block_h): %d (0x%x) */\n", - *value1, - (*value2 & 0x00ffffff) + 1, (*value2 & 0x00ffffff) + 1); + fprintf(fp, "\t/* ARRAY_ADDRESS: gp_stream: 0x%08x, block_num (block_w * block_h): %d */\n", + *value1, (*value2 & 0x00ffffff) + 1); } static void @@ -251,16 +244,16 @@ parse_plbu_primitive_setup(FILE *fp, uint32_t *value1, uint32_t *value2) if (*value1 == 0x00000200) fprintf(fp, "\t/* UNKNOWN_2 (PRIMITIVE_SETUP INIT?) */\n"); else - fprintf(fp, "\t/* PRIMITIVE_SETUP: prim: %s, cull: %d (0x%x), index_size: %d (0x%08x) */\n", + fprintf(fp, "\t/* PRIMITIVE_SETUP: prim: %s, cull: %d (0x%x), index_size: %d */\n", prim, (*value1 & 0x000f0000) >> 16, (*value1 & 0x000f0000) >> 16, - (*value1 & 0x00001e00) >> 9, (*value1 & 0x00001e00) >> 9); + (*value1 & 0x00000e00) >> 9); } static void parse_plbu_rsw_vertex_array(FILE *fp, uint32_t *value1, uint32_t *value2) { - fprintf(fp, "\t/* RSW_VERTEX_ARRAY: rsw: 0x%x, gl_pos: 0x%x */\n", + fprintf(fp, "\t/* RSW_VERTEX_ARRAY: rsw: 0x%08x, gl_pos: 0x%08x */\n", *value1, (*value2 & 0x0fffffff) << 4); } @@ -268,12 +261,12 @@ parse_plbu_rsw_vertex_array(FILE *fp, uint32_t *value1, uint32_t *value2) static void parse_plbu_scissors(FILE *fp, uint32_t *value1, uint32_t *value2) { - uint32_t minx = (*value1 & 0xc0000000) >> 30 | (*value2 & 0x00001fff) << 2; - uint32_t maxx = ((*value2 & 0xffffe000) >> 13) + 1; - uint32_t miny = *value1 & 0x00003fff; - uint32_t maxy = ((*value2 & 0x3fff8000) >> 15) + 1; + float minx = (*value1 & 0xc0000000) >> 30 | (*value2 & 0x00001fff) << 2; + float maxx = ((*value2 & 0x0fffe000) >> 13) + 1; + float miny = *value1 & 0x00003fff; + float maxy = ((*value1 & 0x3fff8000) >> 15) + 1; - fprintf(fp, "\t/* SCISSORS: minx: %d, maxx: %d, miny: %d, maxy: %d */\n", + fprintf(fp, "\t/* SCISSORS: minx: %f, maxx: %f, miny: %f, maxy: %f */\n", minx, maxx, miny, maxy); } @@ -286,22 +279,19 @@ parse_plbu_unknown_1(FILE *fp, uint32_t *value1, uint32_t *value2) static void parse_plbu_low_prim_size(FILE *fp, float *value1, uint32_t *value2) { - fprintf(fp, "\t/* LOW_PRIM_SIZE: size: %f (0x%x) */\n", - *value1, *(uint32_t *)value1); + fprintf(fp, "\t/* LOW_PRIM_SIZE: size: %f */\n", *value1); } static void parse_plbu_depth_range_near(FILE *fp, float *value1, uint32_t *value2) { - fprintf(fp, "\t/* DEPTH_RANG_NEAR: depth_range: %f (0x%x) */\n", - *value1, *(uint32_t *)value1); + fprintf(fp, "\t/* DEPTH_RANG_NEAR: depth_range: %f */\n", *value1); } static void parse_plbu_depth_range_far(FILE *fp, float *value1, uint32_t *value2) { - fprintf(fp, "\t/* DEPTH_RANGE_FAR: depth_range: %f (0x%x) */\n", - *value1, *(uint32_t *)value1); + fprintf(fp, "\t/* DEPTH_RANGE_FAR: depth_range: %f */\n", *value1); } static void @@ -319,7 +309,7 @@ parse_plbu_indexed_pt_size(FILE *fp, uint32_t *value1, uint32_t *value2) static void parse_plbu_indices(FILE *fp, uint32_t *value1, uint32_t *value2) { - fprintf(fp, "\t/* INDICES: indices: 0x%x */\n", *value1); + fprintf(fp, "\t/* INDICES: indices: 0x%08x */\n", *value1); } static void diff --git a/src/gallium/drivers/lima/lima_util.c b/src/gallium/drivers/lima/lima_util.c index 93bf948dbc1..2d0198c7f23 100644 --- a/src/gallium/drivers/lima/lima_util.c +++ b/src/gallium/drivers/lima/lima_util.c @@ -63,7 +63,7 @@ void lima_dump_blob(FILE *fp, void *data, int size, bool is_float) fprintf(fp, "0x%08x, ", ((uint32_t *)data)[i]); if ((i % 4 == 3) || (i == size / 4 - 1)) { - fprintf(fp, "/* 0x%08x */", (i - 3) * 4); + fprintf(fp, "/* 0x%08x */", MAX2((i - 3) * 4, 0)); if (i) fprintf(fp, "\n"); } } -- 2.30.2