Module: Mesa Branch: main Commit: 15235af62923af4acdb636838eebad89bbbdee90 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=15235af62923af4acdb636838eebad89bbbdee90
Author: Faith Ekstrand <[email protected]> Date: Mon Sep 25 17:22:13 2023 -0500 nvk/drm: Restructure nvk_queue_submit_drm_nouveau() Now that we don't need the lock, we can return directly. Also, now that we don't have the old UAPI, we can clean things up and make the whole function make a bit more sense. Also, drop some pointless braces while we're just moving code around. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25357> --- src/nouveau/vulkan/nvk_queue_drm_nouveau.c | 38 +++++++++++++----------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/src/nouveau/vulkan/nvk_queue_drm_nouveau.c b/src/nouveau/vulkan/nvk_queue_drm_nouveau.c index 68125149580..0f4c28b8f58 100644 --- a/src/nouveau/vulkan/nvk_queue_drm_nouveau.c +++ b/src/nouveau/vulkan/nvk_queue_drm_nouveau.c @@ -311,26 +311,24 @@ nvk_queue_submit_drm_nouveau(struct nvk_queue *queue, submit->image_opaque_bind_count > 0; push_builder_init(dev, &pb, is_vmbind); - for (uint32_t i = 0; i < submit->wait_count; i++) { + for (uint32_t i = 0; i < submit->wait_count; i++) push_add_sync_wait(&pb, &submit->waits[i]); - } - for (uint32_t i = 0; i < submit->signal_count; i++) { + for (uint32_t i = 0; i < submit->signal_count; i++) push_add_sync_signal(&pb, &submit->signals[i]); - } - - for (uint32_t i = 0; i < submit->buffer_bind_count; i++) { - push_add_buffer_bind(&pb, &submit->buffer_binds[i]); - } - - for (uint32_t i = 0; i < submit->image_opaque_bind_count; i++) { - push_add_image_opaque_bind(&pb, &submit->image_opaque_binds[i]); - } if (is_vmbind) { assert(submit->command_buffer_count == 0); - } else if (submit->command_buffer_count == 0) { - } else { + + for (uint32_t i = 0; i < submit->buffer_bind_count; i++) + push_add_buffer_bind(&pb, &submit->buffer_binds[i]); + + for (uint32_t i = 0; i < submit->image_opaque_bind_count; i++) + push_add_image_opaque_bind(&pb, &submit->image_opaque_binds[i]); + } else if (submit->command_buffer_count > 0) { + assert(submit->buffer_bind_count == 0); + assert(submit->image_opaque_bind_count == 0); + push_add_queue_state(&pb, &queue->state); for (unsigned i = 0; i < submit->command_buffer_count; i++) { @@ -342,12 +340,8 @@ nvk_queue_submit_drm_nouveau(struct nvk_queue *queue, } } - VkResult result; - if (is_vmbind) { - result = bind_submit(&pb, queue, sync); - } else { - result = push_submit(&pb, queue, sync); - } - - return result; + if (is_vmbind) + return bind_submit(&pb, queue, sync); + else + return push_submit(&pb, queue, sync); }
