diff --git a/src/panfrost/ci/deqp-panfrost-g52-vk.toml b/src/panfrost/ci/deqp-panfrost-g52-vk.toml index 73b27f56434..f135d8a71c0 100644 --- a/src/panfrost/ci/deqp-panfrost-g52-vk.toml +++ b/src/panfrost/ci/deqp-panfrost-g52-vk.toml @@ -5,6 +5,11 @@ renderer_check = "Mali-G52" include = [ "dEQP-VK.pipeline.blend.*", "dEQP-VK.api.buffer_view.*", + "dEQP-VK.api.command_buffers.record_many_draws_secondary_2", + "dEQP-VK.api.command_buffers.record_many_secondary", + "dEQP-VK.api.command_buffers.record_one_time_submit_secondary", + "dEQP-VK.api.command_buffers.render_pass_continue", + "dEQP-VK.api.command_buffers.render_pass_continue_no_fb", "dEQP-VK.api.copy_and_blit.core.*", "dEQP-VK.compute.builtin_var.*", "dEQP-VK.draw.renderpass.instanced.draw_indexed_vk_*", diff --git a/src/panfrost/vulkan/panvk_cmd_buffer.c b/src/panfrost/vulkan/panvk_cmd_buffer.c index ab420b0e2de..c3b6f9c87d9 100644 --- a/src/panfrost/vulkan/panvk_cmd_buffer.c +++ b/src/panfrost/vulkan/panvk_cmd_buffer.c @@ -338,14 +338,6 @@ panvk_CmdSetStencilReference(VkCommandBuffer commandBuffer, cmdbuf->state.fs_rsd = 0; } -void -panvk_CmdExecuteCommands(VkCommandBuffer commandBuffer, - uint32_t commandBufferCount, - const VkCommandBuffer *pCmdBuffers) -{ - panvk_stub(); -} - VkResult panvk_CreateCommandPool(VkDevice _device, const VkCommandPoolCreateInfo *pCreateInfo, diff --git a/src/panfrost/vulkan/panvk_device.c b/src/panfrost/vulkan/panvk_device.c index 17d580cbb4f..8fcab6124c2 100644 --- a/src/panfrost/vulkan/panvk_device.c +++ b/src/panfrost/vulkan/panvk_device.c @@ -31,6 +31,8 @@ #include "pan_bo.h" #include "pan_encoder.h" #include "pan_util.h" +#include "vk_common_entrypoints.h" +#include "vk_cmd_enqueue_entrypoints.h" #include #include @@ -920,6 +922,25 @@ panvk_queue_finish(struct panvk_queue *queue) vk_queue_finish(&queue->vk); } +static void +panvk_ref_pipeline_layout(struct vk_device *dev, + VkPipelineLayout layout) +{ + VK_FROM_HANDLE(panvk_pipeline_layout, playout, layout); + + panvk_pipeline_layout_ref(playout); +} + +static void +panvk_unref_pipeline_layout(struct vk_device *dev, + VkPipelineLayout layout) +{ + struct panvk_device *device = container_of(dev, struct panvk_device, vk); + VK_FROM_HANDLE(panvk_pipeline_layout, playout, layout); + + panvk_pipeline_layout_unref(device, playout); +} + VkResult panvk_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, @@ -952,15 +973,35 @@ panvk_CreateDevice(VkPhysicalDevice physicalDevice, unreachable("Unsupported architecture"); } + /* For secondary command buffer support, overwrite any command entrypoints + * in the main device-level dispatch table with + * vk_cmd_enqueue_unless_primary_Cmd*. + */ + vk_device_dispatch_table_from_entrypoints(&dispatch_table, + &vk_cmd_enqueue_unless_primary_device_entrypoints, + true); + vk_device_dispatch_table_from_entrypoints(&dispatch_table, dev_entrypoints, - true); + false); vk_device_dispatch_table_from_entrypoints(&dispatch_table, &panvk_device_entrypoints, false); vk_device_dispatch_table_from_entrypoints(&dispatch_table, &wsi_device_entrypoints, false); + + /* Populate our primary cmd_dispatch table. */ + vk_device_dispatch_table_from_entrypoints(&device->cmd_dispatch, + dev_entrypoints, + true); + vk_device_dispatch_table_from_entrypoints(&device->cmd_dispatch, + &panvk_device_entrypoints, + false); + vk_device_dispatch_table_from_entrypoints(&device->cmd_dispatch, + &vk_common_device_entrypoints, + false); + result = vk_device_init(&device->vk, &physical_device->vk, &dispatch_table, pCreateInfo, pAllocator); if (result != VK_SUCCESS) { @@ -968,6 +1009,13 @@ panvk_CreateDevice(VkPhysicalDevice physicalDevice, return result; } + /* Must be done after vk_device_init() because this function memset(0) the + * whole struct. + */ + device->vk.command_dispatch_table = &device->cmd_dispatch; + device->vk.ref_pipeline_layout = panvk_ref_pipeline_layout; + device->vk.unref_pipeline_layout = panvk_unref_pipeline_layout; + device->instance = physical_device->instance; device->physical_device = physical_device; diff --git a/src/panfrost/vulkan/panvk_private.h b/src/panfrost/vulkan/panvk_private.h index f5e5eaf9f88..f44356ab28c 100644 --- a/src/panfrost/vulkan/panvk_private.h +++ b/src/panfrost/vulkan/panvk_private.h @@ -246,6 +246,8 @@ struct panvk_queue { struct panvk_device { struct vk_device vk; + struct vk_device_dispatch_table cmd_dispatch; + struct panvk_instance *instance; struct panvk_queue *queues[PANVK_MAX_QUEUE_FAMILIES]; diff --git a/src/panfrost/vulkan/panvk_vX_cmd_buffer.c b/src/panfrost/vulkan/panvk_vX_cmd_buffer.c index a9b2c2af501..703a8a4cb2d 100644 --- a/src/panfrost/vulkan/panvk_vX_cmd_buffer.c +++ b/src/panfrost/vulkan/panvk_vX_cmd_buffer.c @@ -1071,11 +1071,15 @@ VkResult panvk_per_arch(EndCommandBuffer)(VkCommandBuffer commandBuffer) { VK_FROM_HANDLE(panvk_cmd_buffer, cmdbuf, commandBuffer); + VkResult ret = + cmdbuf->vk.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY ? + cmdbuf->vk.cmd_queue.error : cmdbuf->record_result; panvk_per_arch(cmd_close_batch)(cmdbuf); - cmdbuf->status = PANVK_CMD_BUFFER_STATUS_EXECUTABLE; - - return cmdbuf->record_result; + cmdbuf->status = ret == VK_SUCCESS ? + PANVK_CMD_BUFFER_STATUS_EXECUTABLE : + PANVK_CMD_BUFFER_STATUS_INVALID; + return ret; } void