nvk: Use an empty EXEC for the empty submit case
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Fri, 21 Jul 2023 20:03:25 +0000 (15:03 -0500)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Aug 2023 21:32:07 +0000 (21:32 +0000)
The new UAPI allows for an EXEC with zero pushes just fine so we no
longer need the no-op push just for synchronization.  This lets us drop
the whole empty push we allocate per-queue as well.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

src/nouveau/vulkan/nvk_queue.c
src/nouveau/vulkan/nvk_queue.h
src/nouveau/vulkan/nvk_queue_drm_nouveau.c

index 85e6844..2d5c0c0 100644 (file)
@@ -325,6 +325,8 @@ nvk_queue_init(struct nvk_device *dev, struct nvk_queue *queue,
       goto fail_init;
    }
 #endif
+
+#if NVK_NEW_UAPI == 0
    void *empty_push_map;
    queue->empty_push = nouveau_ws_bo_new_mapped(dev->ws_dev, 4096, 0,
                                                 NOUVEAU_WS_BO_GART |
@@ -344,6 +346,7 @@ nvk_queue_init(struct nvk_device *dev, struct nvk_queue *queue,
       queue->empty_push_dw_count = nv_push_dw_count(&push);
    }
    nouveau_ws_bo_unmap(queue->empty_push, empty_push_map);
+#endif
 
    result = nvk_queue_init_context_draw_state(queue);
    if (result != VK_SUCCESS)
@@ -352,7 +355,9 @@ nvk_queue_init(struct nvk_device *dev, struct nvk_queue *queue,
    return VK_SUCCESS;
 
 fail_empty_push:
+#if NVK_NEW_UAPI == 0
    nouveau_ws_bo_destroy(queue->empty_push);
+#endif
 fail_init:
    vk_queue_finish(&queue->vk);
 
@@ -367,7 +372,9 @@ nvk_queue_finish(struct nvk_device *dev, struct nvk_queue *queue)
    ASSERTED int err = drmSyncobjDestroy(dev->ws_dev->fd, queue->syncobj_handle);
    assert(err == 0);
 #endif
+#if NVK_NEW_UAPI == 0
    nouveau_ws_bo_destroy(queue->empty_push);
+#endif
    vk_queue_finish(&queue->vk);
 }
 
index 65c113c..7cf6953 100644 (file)
@@ -45,8 +45,10 @@ struct nvk_queue {
 
    struct nvk_queue_state state;
 
+#if NVK_NEW_UAPI == 0
    struct nouveau_ws_bo *empty_push;
    uint32_t empty_push_dw_count;
+#endif
 
    uint32_t syncobj_handle;
 };
index 6cca10e..b387530 100644 (file)
@@ -458,8 +458,10 @@ nvk_queue_submit_drm_nouveau(struct nvk_queue *queue,
    if (is_vmbind) {
       assert(submit->command_buffer_count == 0);
    } else if (submit->command_buffer_count == 0) {
+#if NVK_NEW_UAPI == 0
       push_add_push_bo(&pb, queue->empty_push, 0,
                        queue->empty_push_dw_count * 4);
+#endif
    } else {
       push_add_queue_state(&pb, &queue->state);