diff --git a/src/virtio/vulkan/vn_device_memory.h b/src/virtio/vulkan/vn_device_memory.h index 88a602cdd29..a2c48485160 100644 --- a/src/virtio/vulkan/vn_device_memory.h +++ b/src/virtio/vulkan/vn_device_memory.h @@ -31,7 +31,7 @@ struct vn_device_memory { struct vn_renderer_bo *base_bo; /* enforce kernel and ring ordering between memory export and free */ bool bo_roundtrip_seqno_valid; - uint32_t bo_roundtrip_seqno; + uint64_t bo_roundtrip_seqno; VkDeviceSize base_offset; VkDeviceSize map_end; diff --git a/src/virtio/vulkan/vn_instance.c b/src/virtio/vulkan/vn_instance.c index 3f03eac1cca..3405321088b 100644 --- a/src/virtio/vulkan/vn_instance.c +++ b/src/virtio/vulkan/vn_instance.c @@ -277,7 +277,7 @@ vn_instance_init_renderer(struct vn_instance *instance) VkResult vn_instance_submit_roundtrip(struct vn_instance *instance, - uint32_t *roundtrip_seqno) + uint64_t *roundtrip_seqno) { uint32_t write_ring_extra_data[8]; struct vn_cs_encoder local_enc = VN_CS_ENCODER_INITIALIZER_LOCAL( @@ -285,7 +285,8 @@ vn_instance_submit_roundtrip(struct vn_instance *instance, /* submit a vkWriteRingExtraMESA through the renderer */ mtx_lock(&instance->ring.roundtrip_mutex); - const uint32_t seqno = instance->ring.roundtrip_next++; + const uint64_t seqno = instance->ring.roundtrip_next++; + /* clamp to 32bit for legacy ring extra based roundtrip waiting */ vn_encode_vkWriteRingExtraMESA(&local_enc, 0, instance->ring.id, 0, seqno); VkResult result = vn_renderer_submit_simple(instance->renderer, write_ring_extra_data, @@ -305,7 +306,7 @@ roundtrip_seqno_ge(uint32_t a, uint32_t b) void vn_instance_wait_roundtrip(struct vn_instance *instance, - uint32_t roundtrip_seqno) + uint64_t roundtrip_seqno) { VN_TRACE_FUNC(); const struct vn_ring *ring = &instance->ring.ring; @@ -313,6 +314,7 @@ vn_instance_wait_roundtrip(struct vn_instance *instance, uint32_t iter = 0; do { const uint32_t cur = atomic_load_explicit(ptr, memory_order_acquire); + /* clamp to 32bit for legacy ring extra based roundtrip waiting */ if (roundtrip_seqno_ge(cur, roundtrip_seqno)) break; vn_relax(ring, &iter, "roundtrip"); diff --git a/src/virtio/vulkan/vn_instance.h b/src/virtio/vulkan/vn_instance.h index 134b0c50b5b..a72a2faa922 100644 --- a/src/virtio/vulkan/vn_instance.h +++ b/src/virtio/vulkan/vn_instance.h @@ -55,7 +55,7 @@ struct vn_instance { /* to synchronize renderer/ring */ mtx_t roundtrip_mutex; - uint32_t roundtrip_next; + uint64_t roundtrip_next; } ring; /* XXX staged features to be merged to core venus protocol */ @@ -95,16 +95,16 @@ VK_DEFINE_HANDLE_CASTS(vn_instance, VkResult vn_instance_submit_roundtrip(struct vn_instance *instance, - uint32_t *roundtrip_seqno); + uint64_t *roundtrip_seqno); void vn_instance_wait_roundtrip(struct vn_instance *instance, - uint32_t roundtrip_seqno); + uint64_t roundtrip_seqno); static inline void vn_instance_roundtrip(struct vn_instance *instance) { - uint32_t roundtrip_seqno; + uint64_t roundtrip_seqno; if (vn_instance_submit_roundtrip(instance, &roundtrip_seqno) == VK_SUCCESS) vn_instance_wait_roundtrip(instance, roundtrip_seqno); }