From ea2f4cbecbd02a76a199445c454638dee830da7a Mon Sep 17 00:00:00 2001 From: Rajnesh Kanwal Date: Wed, 21 Sep 2022 16:56:49 +0100 Subject: [PATCH] pvr: Reserve space for vdm state for deferred secondary buffer. For secondary buffer we need to emit additional vdm state along with additional ppp state words to provide depthbias and scissor indexes. These are indexes into depthbias and scissor tables. In vkCmdExecuteCommands we append secondary buffer tables to primary buffer tables, so the depthbias and scissor indexes change and need fixing. This is why we need to emit these separatly. Signed-off-by: Rajnesh Kanwal Reviewed-by: Karmjit Mahil Part-of: --- src/imagination/vulkan/pvr_cmd_buffer.c | 18 ++++++++++++++---- src/imagination/vulkan/pvr_private.h | 6 +++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/imagination/vulkan/pvr_cmd_buffer.c b/src/imagination/vulkan/pvr_cmd_buffer.c index 7d9dc242cbf..4f759f2e0e8 100644 --- a/src/imagination/vulkan/pvr_cmd_buffer.c +++ b/src/imagination/vulkan/pvr_cmd_buffer.c @@ -4542,21 +4542,31 @@ static VkResult pvr_emit_ppp_state(struct pvr_cmd_buffer *const cmd_buffer, struct pvr_deferred_cs_command cmd; if (deferred_secondary) { + const uint32_t num_dwords = pvr_cmd_length(VDMCTRL_PPP_STATE0) + + pvr_cmd_length(VDMCTRL_PPP_STATE1); + + uint32_t *vdm_state = pvr_csb_alloc_dwords(control_stream, num_dwords); + if (!vdm_state) { + cmd_buffer->state.status = pvr_csb_get_status(control_stream); + return cmd_buffer->state.status; + } + cmd = (struct pvr_deferred_cs_command){ .type = PVR_DEFERRED_CS_COMMAND_TYPE_DBSC, - .dbsc = ppp_state->depthbias_scissor_indices, + .dbsc = { + .state = ppp_state->depthbias_scissor_indices, + .vdm_state = vdm_state, + }, }; } else { - /* clang-format off */ cmd = (struct pvr_deferred_cs_command){ .type = PVR_DEFERRED_CS_COMMAND_TYPE_DBSC2, .dbsc2 = { .state = ppp_state->depthbias_scissor_indices, .ppp_cs_bo = pvr_bo, .patch_offset = dbsc_patching_offset, - } + }, }; - /* clang-format on */ } util_dynarray_append(&cmd_buffer->deferred_csb_commands, diff --git a/src/imagination/vulkan/pvr_private.h b/src/imagination/vulkan/pvr_private.h index 96471809494..6230a0c9f84 100644 --- a/src/imagination/vulkan/pvr_private.h +++ b/src/imagination/vulkan/pvr_private.h @@ -867,7 +867,11 @@ struct pvr_ppp_state { struct pvr_deferred_cs_command { enum pvr_deferred_cs_command_type type; union { - struct pvr_ppp_dbsc dbsc; + struct { + struct pvr_ppp_dbsc state; + + uint32_t *vdm_state; + } dbsc; struct { struct pvr_ppp_dbsc state;