aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorAndreas Baierl <[email protected]>2019-10-25 16:38:52 +0200
committerVasily Khoruzhick <[email protected]>2019-11-17 05:39:17 +0000
commitef9635d0bce9383a22bb3a8506da4d55726e5d59 (patch)
tree82371488ea0862513a006946d3c9f2d317d42f28 /src/gallium
parentc76eb7ea8490e630451beb056b4294fd846902d2 (diff)
lima: Parse VS and PLBU command stream while making a dump
This makes the streams more readable and comparable with the blob's parser as it parses the VS and PLBU stream and shows the currently known values. Reviewed-by: Qiang Yu <[email protected]> Signed-off-by: Andreas Baierl <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/lima/Android.mk2
-rw-r--r--src/gallium/drivers/lima/lima_draw.c2
-rw-r--r--src/gallium/drivers/lima/lima_parser.c408
-rw-r--r--src/gallium/drivers/lima/lima_parser.h30
-rw-r--r--src/gallium/drivers/lima/lima_util.c15
-rw-r--r--src/gallium/drivers/lima/lima_util.h2
-rw-r--r--src/gallium/drivers/lima/meson.build2
7 files changed, 461 insertions, 0 deletions
diff --git a/src/gallium/drivers/lima/Android.mk b/src/gallium/drivers/lima/Android.mk
index 9408e96bd7d..aea52241911 100644
--- a/src/gallium/drivers/lima/Android.mk
+++ b/src/gallium/drivers/lima/Android.mk
@@ -56,6 +56,8 @@ LOCAL_SRC_FILES := \
lima_draw.c \
lima_fence.c \
lima_fence.h \
+ lima_parser.c \
+ lima_parser.h \
lima_program.c \
lima_program.h \
lima_query.c \
diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c
index ea318a103d5..fb0ce031417 100644
--- a/src/gallium/drivers/lima/lima_draw.c
+++ b/src/gallium/drivers/lima/lima_draw.c
@@ -1525,6 +1525,7 @@ _lima_flush(struct lima_context *ctx, bool end_of_frame)
lima_dump_command_stream_print(
vs_cmd, vs_cmd_size, false, "flush vs cmd at va %x\n", vs_cmd_va);
+ lima_dump_vs_command_stream_print(vs_cmd, vs_cmd_size, vs_cmd_va);
}
void *plbu_cmd =
@@ -1536,6 +1537,7 @@ _lima_flush(struct lima_context *ctx, bool end_of_frame)
lima_dump_command_stream_print(
plbu_cmd, plbu_cmd_size, false, "flush plbu cmd at va %x\n", plbu_cmd_va);
+ lima_dump_plbu_command_stream_print(plbu_cmd, plbu_cmd_size, plbu_cmd_va);
struct lima_screen *screen = lima_screen(ctx->base.screen);
struct drm_lima_gp_frame gp_frame;
diff --git a/src/gallium/drivers/lima/lima_parser.c b/src/gallium/drivers/lima/lima_parser.c
new file mode 100644
index 00000000000..64b99664f5a
--- /dev/null
+++ b/src/gallium/drivers/lima/lima_parser.c
@@ -0,0 +1,408 @@
+/*
+ * Copyright (c) 2019 Andreas Baierl <[email protected]>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+
+#include "lima_parser.h"
+
+/* VS CMD stream parser functions */
+
+static void
+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",
+ (*value1 & 0xff000000) >> 24 | (*value2 & 0x000000ff) << 8,
+ (*value1 & 0xff000000) >> 24 | (*value2 & 0x000000ff) << 8,
+ (*value2 & 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);
+}
+
+static void
+parse_vs_unknown1(FILE *fp, uint32_t *value1, uint32_t *value2)
+{
+ fprintf(fp, "\t/* UNKNOWN_1 */\n");
+}
+
+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);
+}
+
+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);
+}
+
+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);
+}
+
+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);
+}
+
+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);
+}
+
+static void
+parse_vs_semaphore(FILE *fp, uint32_t *value1, uint32_t *value2)
+{
+ if (*value1 == 0x00028000)
+ fprintf(fp, "\t/* SEMAPHORE_BEGIN_1 */\n");
+ else if (*value1 == 0x00000001)
+ fprintf(fp, "\t/* SEMAPHORE_BEGIN_2 */\n");
+ else if (*value1 == 0x00000000)
+ fprintf(fp, "\t/* SEMAPHORE_END: index_draw disabled */\n");
+ else if (*value1 == 0x00018000)
+ fprintf(fp, "\t/* SEMAPHORE_END: index_draw disabled */\n");
+ else
+ fprintf(fp, "\t/* SEMAPHORE - cmd unknown! */\n");
+}
+
+static void
+parse_vs_unknown2(FILE *fp, uint32_t *value1, uint32_t *value2)
+{
+ fprintf(fp, "\t/* UNKNOWN_2 */\n");
+}
+
+static void
+parse_vs_continue(FILE *fp, uint32_t *value1, uint32_t *value2)
+{
+ fprintf(fp, "\t/* CONTINUE: at 0x%08x */\n", *value1);
+}
+
+void
+lima_parse_vs(FILE *fp, uint32_t *data, int size, uint32_t start)
+{
+ uint32_t *value1;
+ uint32_t *value2;
+
+ fprintf(fp, "\n");
+ fprintf(fp, "/* ============ VS CMD STREAM BEGIN ============= */\n");
+ for (int i = 0; i * 4 < size; i += 2) {
+ value1 = &data[i];
+ value2 = &data[i + 1];
+ fprintf(fp, "/* 0x%08x (0x%08x) */\t0x%08x 0x%08x",
+ start + i * 4, i * 4, *value1, *value2);
+
+ if ((*value2 & 0xffff0000) == 0x00000000)
+ parse_vs_draw(fp, value1, value2);
+ else if ((*value2 & 0xff0000ff) == 0x10000040)
+ parse_vs_shader_info(fp, value1, value2);
+ else if ((*value2 & 0xff0000ff) == 0x10000041)
+ parse_vs_unknown1(fp, value1, value2);
+ else if ((*value2 & 0xff0000ff) == 0x10000042)
+ parse_vs_varying_attribute_count(fp, value1, value2);
+ else if ((*value2 & 0xff0000ff) == 0x20000000)
+ parse_vs_attributes_address(fp, value1, value2);
+ else if ((*value2 & 0xff0000ff) == 0x20000008)
+ parse_vs_varyings_address(fp, value1, value2);
+ else if ((*value2 & 0xff000000) == 0x30000000)
+ parse_vs_uniforms_address(fp, value1, value2);
+ else if ((*value2 & 0xff000000) == 0x40000000)
+ parse_vs_shader_address(fp, value1, value2);
+ else if ((*value2 & 0xff000000)== 0x50000000)
+ parse_vs_semaphore(fp, value1, value2);
+ else if ((*value2 & 0xff000000) == 0x60000000)
+ parse_vs_unknown2(fp, value1, value2);
+ else if ((*value2 & 0xff000000) == 0xf0000000)
+ parse_vs_continue(fp, value1, value2);
+ else
+ fprintf(fp, "\t/* --- unknown cmd --- */\n");
+ }
+ fprintf(fp, "/* ============ VS CMD STREAM END =============== */\n");
+ fprintf(fp, "\n");
+}
+
+/* PLBU CMD stream parser functions */
+
+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);
+}
+
+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,
+ ((*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);
+}
+
+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);
+}
+
+static void
+parse_plbu_viewport_left(FILE *fp, float *value1, uint32_t *value2)
+{
+ fprintf(fp, "\t/* VIEWPORT_LEFT: viewport_left: %f */\n", *value1);
+}
+
+static void
+parse_plbu_viewport_right(FILE *fp, float *value1, uint32_t *value2)
+{
+ fprintf(fp, "\t/* VIEWPORT_RIGHT: viewport_right: %f */\n", *value1);
+}
+
+static void
+parse_plbu_viewport_bottom(FILE *fp, float *value1, uint32_t *value2)
+{
+ fprintf(fp, "\t/* VIEWPORT_BOTTOM: viewport_bottom: %f */\n", *value1);
+}
+
+static void
+parse_plbu_viewport_top(FILE *fp, float *value1, uint32_t *value2)
+{
+ fprintf(fp, "\t/* VIEWPORT_TOP: viewport_top: %f */\n", *value1);
+}
+
+static void
+parse_plbu_semaphore(FILE *fp, uint32_t *value1, uint32_t *value2)
+{
+ if (*value1 == 0x00010002)
+ fprintf(fp, "\t/* ARRAYS_SEMAPHORE_BEGIN */\n");
+ else if (*value1 == 0x00010001)
+ fprintf(fp, "\t/* ARRAYS_SEMAPHORE_END */\n");
+ else
+ fprintf(fp, "\t/* SEMAPHORE - cmd unknown! */\n");
+}
+
+static void
+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: low_prim: %s, cull: %d (0x%x), index_size: %d (0x%08x) */\n",
+ (*value1 & 0x0000f000) == 0x00003000 ? "true" : "false",
+ (*value1 & 0x000f0000) >> 16, (*value1 & 0x000f0000) >> 16,
+ (*value1 & 0x00001e00) >> 9, (*value1 & 0x00001e00) >> 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",
+ *value1,
+ (*value2 & 0x0fffffff) << 4);
+}
+
+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;
+
+ fprintf(fp, "\t/* SCISSORS: minx: %d, maxx: %d, miny: %d, maxy: %d */\n",
+ minx, maxx, miny, maxy);
+}
+
+static void
+parse_plbu_unknown_1(FILE *fp, uint32_t *value1, uint32_t *value2)
+{
+ fprintf(fp, "\t/* UNKNOWN_1 */\n");
+}
+
+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);
+}
+
+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);
+}
+
+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);
+}
+
+static void
+parse_plbu_indexed_dest(FILE *fp, uint32_t *value1, uint32_t *value2)
+{
+ fprintf(fp, "\t/* INDEXED_DEST: gl_pos: 0x%08x */\n", *value1);
+}
+
+static void
+parse_plbu_indices(FILE *fp, uint32_t *value1, uint32_t *value2)
+{
+ fprintf(fp, "\t/* INDICES: indices: 0x%x */\n", *value1);
+}
+
+static void
+parse_plbu_draw_arrays(FILE *fp, uint32_t *value1, uint32_t *value2)
+{
+ if ((*value1 == 0x00000000) && (*value2 == 0x00000000)) {
+ fprintf(fp, "\t/* ---EMPTY CMD */\n");
+ return;
+ }
+
+ uint32_t count = (*value1 & 0xff000000) >> 24 | (*value2 & 0x000000ff) << 8;
+ uint32_t start = *value1 & 0x00ffffff;
+ uint32_t mode = (*value2 & 0x001f0000) >> 16;
+
+ fprintf(fp, "\t/* DRAW_ARRAYS: count: %d, start: %d, mode: %d (0x%x) */\n",
+ count, start, mode, mode);
+}
+
+static void
+parse_plbu_draw_elements(FILE *fp, uint32_t *value1, uint32_t *value2)
+{
+ uint32_t count = (*value1 & 0xff000000) >> 24 | (*value2 & 0x000000ff) << 8;
+ uint32_t start = *value1 & 0x00ffffff;
+ uint32_t mode = (*value2 & 0x001f0000) >> 16;
+
+ fprintf(fp, "\t/* DRAW_ELEMENTS: count: %d, start: %d, mode: %d (0x%x) */\n",
+ count, start, mode, mode);
+}
+
+static void
+parse_plbu_continue(FILE *fp, uint32_t *value1, uint32_t *value2)
+{
+ fprintf(fp, "\t/* CONTINUE: continue at 0x%08x */\n", *value1);
+}
+
+static void
+parse_plbu_end(FILE *fp, uint32_t *value1, uint32_t *value2)
+{
+ fprintf(fp, "\t/* END (FINISH/FLUSH) */\n");
+}
+
+void
+lima_parse_plbu(FILE *fp, uint32_t *data, int size, uint32_t start)
+{
+ uint32_t *value1;
+ uint32_t *value2;
+
+ fprintf(fp, "/* ============ PLBU CMD STREAM BEGIN ============= */\n");
+ for (int i = 0; i * 4 < size; i += 2) {
+ value1 = &data[i];
+ value2 = &data[i + 1];
+ fprintf(fp, "/* 0x%08x (0x%08x) */\t0x%08x 0x%08x",
+ start + i * 4, i * 4, *value1, *value2);
+
+ if ((*value2 & 0xffe00000) == 0x00000000)
+ parse_plbu_draw_arrays(fp, value1, value2);
+ else if ((*value2 & 0xffe00000) == 0x00200000)
+ parse_plbu_draw_elements(fp, value1, value2);
+ else if ((*value2 & 0xff000fff) == 0x10000100)
+ parse_plbu_indexed_dest(fp, value1, value2);
+ else if ((*value2 & 0xff000fff) == 0x10000101)
+ parse_plbu_indices(fp, value1, value2);
+ else if ((*value2 & 0xff000fff) == 0x10000105)
+ parse_plbu_viewport_bottom(fp, (float *)value1, value2);
+ else if ((*value2 & 0xff000fff) == 0x10000106)
+ parse_plbu_viewport_top(fp, (float *)value1, value2);
+ else if ((*value2 & 0xff000fff) == 0x10000107)
+ parse_plbu_viewport_left(fp, (float *)value1, value2);
+ else if ((*value2 & 0xff000fff) == 0x10000108)
+ parse_plbu_viewport_right(fp, (float *)value1, value2);
+ else if ((*value2 & 0xff000fff) == 0x10000109)
+ parse_plbu_tiled_dimensions(fp, value1, value2);
+ else if ((*value2 & 0xff000fff) == 0x1000010a)
+ parse_plbu_unknown_1(fp, value1, value2);
+ else if ((*value2 & 0xff000fff) == 0x1000010b) /* also unknown_2 */
+ parse_plbu_primitive_setup(fp, value1, value2);
+ else if ((*value2 & 0xff000fff) == 0x1000010c)
+ parse_plbu_block_step(fp, value1, value2);
+ else if ((*value2 & 0xff000fff) == 0x1000010d)
+ parse_plbu_low_prim_size(fp, (float *)value1, value2);
+ else if ((*value2 & 0xff000fff) == 0x1000010e)
+ parse_plbu_depth_range_near(fp, (float *)value1, value2);
+ else if ((*value2 & 0xff000fff) == 0x1000010f)
+ parse_plbu_depth_range_far(fp, (float *)value1, value2);
+ else if ((*value2 & 0xff000000) == 0x28000000)
+ parse_plbu_array_address(fp, value1, value2);
+ else if ((*value2 & 0xf0000000) == 0x30000000)
+ parse_plbu_block_stride(fp, value1, value2);
+ else if (*value2 == 0x50000000)
+ parse_plbu_end(fp, value1, value2);
+ else if ((*value2 & 0xf0000000)== 0x60000000)
+ parse_plbu_semaphore(fp, value1, value2);
+ else if ((*value2 & 0xf0000000)== 0x70000000)
+ parse_plbu_scissors(fp, value1, value2);
+ else if ((*value2 & 0xf0000000)== 0x80000000)
+ parse_plbu_rsw_vertex_array(fp, value1, value2);
+ else if ((*value2 & 0xf0000000)== 0xf0000000)
+ parse_plbu_continue(fp, value1, value2);
+ else
+ fprintf(fp, "\t/* --- unknown cmd --- */\n");
+ }
+ fprintf(fp, "/* ============ PLBU CMD STREAM END =============== */\n");
+ fprintf(fp, "\n");
+}
diff --git a/src/gallium/drivers/lima/lima_parser.h b/src/gallium/drivers/lima/lima_parser.h
new file mode 100644
index 00000000000..6fb949c5cb9
--- /dev/null
+++ b/src/gallium/drivers/lima/lima_parser.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2018-2019 Lima Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef H_LIMA_PARSER
+#define H_LIMA_PARSER
+
+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);
+
+#endif
diff --git a/src/gallium/drivers/lima/lima_util.c b/src/gallium/drivers/lima/lima_util.c
index 579eba7ec3d..93bf948dbc1 100644
--- a/src/gallium/drivers/lima/lima_util.c
+++ b/src/gallium/drivers/lima/lima_util.c
@@ -28,6 +28,7 @@
#include <pipe/p_defines.h>
#include "lima_util.h"
+#include "lima_parser.h"
FILE *lima_dump_command_stream = NULL;
@@ -70,6 +71,20 @@ void lima_dump_blob(FILE *fp, void *data, int size, bool is_float)
}
void
+lima_dump_vs_command_stream_print(void *data, int size, uint32_t start)
+{
+ if (lima_dump_command_stream)
+ lima_parse_vs(lima_dump_command_stream, (uint32_t *)data, size, start);
+}
+
+void
+lima_dump_plbu_command_stream_print(void *data, int size, uint32_t start)
+{
+ if (lima_dump_command_stream)
+ lima_parse_plbu(lima_dump_command_stream, (uint32_t *)data, size, start);
+}
+
+void
lima_dump_command_stream_print(void *data, int size, bool is_float,
const char *fmt, ...)
{
diff --git a/src/gallium/drivers/lima/lima_util.h b/src/gallium/drivers/lima/lima_util.h
index ad9f42158bf..49fe906e268 100644
--- a/src/gallium/drivers/lima/lima_util.h
+++ b/src/gallium/drivers/lima/lima_util.h
@@ -31,6 +31,8 @@
bool lima_get_absolute_timeout(uint64_t *timeout);
void lima_dump_blob(FILE *fp, void *data, int size, bool is_float);
+void lima_dump_vs_command_stream_print(void *data, int size, uint32_t start);
+void lima_dump_plbu_command_stream_print(void *data, int size, uint32_t start);
void lima_dump_command_stream_print(void *data, int size, bool is_float,
const char *fmt, ...);
diff --git a/src/gallium/drivers/lima/meson.build b/src/gallium/drivers/lima/meson.build
index 6fa5795e0d2..01c41c31728 100644
--- a/src/gallium/drivers/lima/meson.build
+++ b/src/gallium/drivers/lima/meson.build
@@ -64,6 +64,8 @@ files_lima = files(
'lima_bo.h',
'lima_submit.c',
'lima_submit.h',
+ 'lima_parser.c',
+ 'lima_parser.h',
'lima_util.c',
'lima_util.h',
'lima_texture.c',