From: Faith Ekstrand Date: Mon, 25 Sep 2023 22:22:13 +0000 (-0500) Subject: nvk/drm: Restructure nvk_queue_submit_drm_nouveau() X-Git-Tag: upstream/23.3.3~1613 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=15235af62923af4acdb636838eebad89bbbdee90;p=platform%2Fupstream%2Fmesa.git 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: --- diff --git a/src/nouveau/vulkan/nvk_queue_drm_nouveau.c b/src/nouveau/vulkan/nvk_queue_drm_nouveau.c index 6812514..0f4c28b 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); }