Module: Mesa
Branch: main
Commit: bec287b2a2c124b138dcb22910fb8d8020415c80
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bec287b2a2c124b138dcb22910fb8d8020415c80

Author: Yiwei Zhang <zzyi...@chromium.org>
Date:   Wed Dec 27 18:48:14 2023 -0800

venus: clean up secondary ring

Signed-off-by: Yiwei Zhang <zzyi...@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26838>

---

 src/virtio/vulkan/vn_device.c | 41 -----------------------------------------
 src/virtio/vulkan/vn_device.h |  6 ------
 2 files changed, 47 deletions(-)

diff --git a/src/virtio/vulkan/vn_device.c b/src/virtio/vulkan/vn_device.c
index 0844f8b9747..00ff23ebced 100644
--- a/src/virtio/vulkan/vn_device.c
+++ b/src/virtio/vulkan/vn_device.c
@@ -436,39 +436,6 @@ vn_device_update_shader_cache_id(struct vn_device *dev)
 #endif
 }
 
-bool
-vn_device_secondary_ring_init_once(struct vn_device *dev)
-{
-   VN_TRACE_FUNC();
-
-   static bool ok = true;
-   if (!ok)
-      return ok;
-
-   mtx_lock(&dev->ring_mutex);
-   /* allows caller to check secondary ring without holding a lock */
-   if (dev->secondary_ring)
-      goto out_unlock;
-
-   /* keep the extra for potential roundtrip sync on secondary ring */
-   static const size_t extra_size = sizeof(uint32_t);
-
-   /* only need a small ring for synchronous cmds on secondary ring */
-   static const size_t buf_size = 16 * 1024;
-
-   struct vn_ring_layout layout;
-   vn_ring_get_layout(buf_size, extra_size, &layout);
-
-   dev->secondary_ring = vn_ring_create(dev->instance, &layout);
-   if (!dev->secondary_ring) {
-      ok = false;
-      vn_log(dev->instance, "WARNING: failed to create secondary ring");
-   }
-out_unlock:
-   mtx_unlock(&dev->ring_mutex);
-   return ok;
-}
-
 static VkResult
 vn_device_init(struct vn_device *dev,
                struct vn_physical_device *physical_dev,
@@ -502,8 +469,6 @@ vn_device_init(struct vn_device *dev,
    if (result != VK_SUCCESS)
       return result;
 
-   mtx_init(&dev->ring_mutex, mtx_plain);
-
    result = vn_device_memory_report_init(dev, create_info);
    if (result != VK_SUCCESS)
       goto out_destroy_device;
@@ -556,7 +521,6 @@ out_memory_report_fini:
    vn_device_memory_report_fini(dev);
 
 out_destroy_device:
-   mtx_destroy(&dev->ring_mutex);
    vn_call_vkDestroyDevice(dev->primary_ring, dev_handle, NULL);
 
    return result;
@@ -655,11 +619,6 @@ vn_DestroyDevice(VkDevice device, const 
VkAllocationCallbacks *pAllocator)
       }
    }
 
-   if (dev->secondary_ring)
-      vn_ring_destroy(dev->secondary_ring);
-
-   mtx_destroy(&dev->ring_mutex);
-
    vk_free(alloc, dev->queues);
 
    vn_device_base_fini(&dev->base);
diff --git a/src/virtio/vulkan/vn_device.h b/src/virtio/vulkan/vn_device.h
index d5c610bee7a..c9f5489cf91 100644
--- a/src/virtio/vulkan/vn_device.h
+++ b/src/virtio/vulkan/vn_device.h
@@ -31,9 +31,6 @@ struct vn_device {
    struct vn_renderer *renderer;
    struct vn_ring *primary_ring;
 
-   mtx_t ring_mutex;
-   struct vn_ring *secondary_ring;
-
    struct vn_device_memory_report *memory_reports;
    uint32_t memory_report_count;
 
@@ -85,7 +82,4 @@ vn_device_emit_device_memory_report(struct vn_device *dev,
       dev->memory_reports[i].callback(&report, dev->memory_reports[i].data);
 }
 
-bool
-vn_device_secondary_ring_init_once(struct vn_device *dev);
-
 #endif /* VN_DEVICE_H */

Reply via email to