From c28c9956458e9c38048b845212ceccd50c229e84 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 15 Jul 2022 10:23:15 -0400 Subject: [PATCH] lavapipe: add command debugging I keep adding this in locally. it's great for debugging Reviewed-by: Dave Airlie Part-of: --- src/gallium/frontends/lavapipe/lvp_device.c | 1 + src/gallium/frontends/lavapipe/lvp_execute.c | 14 ++++++++------ src/gallium/frontends/lavapipe/lvp_private.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c index 627b01e..7aa5c3b 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -1607,6 +1607,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateDevice( device->queue.state = device + 1; device->poison_mem = debug_get_bool_option("LVP_POISON_MEMORY", false); + device->print_cmds = debug_get_bool_option("LVP_CMD_DEBUG", false); struct vk_device_dispatch_table dispatch_table; vk_device_dispatch_table_from_entrypoints(&dispatch_table, diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index 544b7ac..c5d78c1 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -2709,14 +2709,14 @@ static void handle_push_constants(struct vk_cmd_queue_entry *cmd, } static void lvp_execute_cmd_buffer(struct lvp_cmd_buffer *cmd_buffer, - struct rendering_state *state); + struct rendering_state *state, bool print_cmds); static void handle_execute_commands(struct vk_cmd_queue_entry *cmd, - struct rendering_state *state) + struct rendering_state *state, bool print_cmds) { for (unsigned i = 0; i < cmd->u.execute_commands.command_buffer_count; i++) { LVP_FROM_HANDLE(lvp_cmd_buffer, secondary_buf, cmd->u.execute_commands.command_buffers[i]); - lvp_execute_cmd_buffer(secondary_buf, state); + lvp_execute_cmd_buffer(secondary_buf, state, print_cmds); } } @@ -4001,13 +4001,15 @@ void lvp_add_enqueue_cmd_entrypoints(struct vk_device_dispatch_table *disp) } static void lvp_execute_cmd_buffer(struct lvp_cmd_buffer *cmd_buffer, - struct rendering_state *state) + struct rendering_state *state, bool print_cmds) { struct vk_cmd_queue_entry *cmd; bool first = true; bool did_flush = false; LIST_FOR_EACH_ENTRY(cmd, &cmd_buffer->vk.cmd_queue.cmds, cmd_link) { + if (print_cmds) + fprintf(stderr, "%s\n", vk_cmd_queue_type_names[cmd->type]); switch (cmd->type) { case VK_CMD_BIND_PIPELINE: handle_pipeline(cmd, state); @@ -4154,7 +4156,7 @@ static void lvp_execute_cmd_buffer(struct lvp_cmd_buffer *cmd_buffer, handle_push_constants(cmd, state); break; case VK_CMD_EXECUTE_COMMANDS: - handle_execute_commands(cmd, state); + handle_execute_commands(cmd, state, print_cmds); break; case VK_CMD_DRAW_INDIRECT_COUNT: emit_state(state); @@ -4344,7 +4346,7 @@ VkResult lvp_execute_cmds(struct lvp_device *device, state->cso_ss_ptr[s][i] = &state->ss[s][i]; } /* create a gallium context */ - lvp_execute_cmd_buffer(cmd_buffer, state); + lvp_execute_cmd_buffer(cmd_buffer, state, device->print_cmds); state->start_vb = -1; state->num_vb = 0; diff --git a/src/gallium/frontends/lavapipe/lvp_private.h b/src/gallium/frontends/lavapipe/lvp_private.h index 73f6d5a..fc17f01 100644 --- a/src/gallium/frontends/lavapipe/lvp_private.h +++ b/src/gallium/frontends/lavapipe/lvp_private.h @@ -181,6 +181,7 @@ struct lvp_device { struct pipe_screen *pscreen; void *noop_fs; bool poison_mem; + bool print_cmds; }; void lvp_device_get_cache_uuid(void *uuid); -- 2.7.4