Skip to content

vulkan: Fix self-deadlock in legacy implicit queue sync - #158

Merged
Themaister merged 1 commit into
Themaister:masterfrom
Mystodan:patch-1
Oct 17, 2026
Merged

Themaister merged 1 commit into
Themaister:masterfrom
Mystodan:patch-1

Conversation

@Mystodan

@Mystodan Mystodan commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

On devices without timeline semaphores, emit_implicit_sync_to_queues() runs with the device
lock held (called from submit_queue() / submit_empty_inner()), but calls
request_legacy_semaphore() -> request_semaphore(), which takes LOCK() again on the same
non-recursive std::mutex and hangs forever.

Hit on NVIDIA Tegra X1 (Shield TV, Android 11, Vulkan 1.1.178, driver 495.00) while running the
PyroWave decoder. Backtrace of the hung thread:

std::mutex::lock()
Vulkan::Device::request_semaphore(VkSemaphoreType, VkSemaphore, bool)
Util::for_each_bit<Device::emit_implicit_sync_to_queues(QueueIndices)::$_1>
Vulkan::Device::submit_queue(...)
Vulkan::Device::submit_queue(...)
Vulkan::Device::flush_frame_nolock()
Vulkan::Device::end_frame_nolock()
Vulkan::Device::next_frame_context()
pyrowave_decoder_decode_gpu_buffer

The fix allocates the binary semaphore directly, as the other _nolock paths do. With it, the
decoder runs correctly on that device (output matches a desktop GPU decode at ~57 dB PSNR).

(Context: that driver also lacks VK_KHR_synchronization2; I'm opening a separate PyroWave issue
about Vulkan 1.1 / sync2 support. This fix is independent of that.)

Themaister/pyrowave#30

@Themaister
Themaister merged commit fa034b8 into Themaister:master Oct 17, 2026
8 checks passed
@Themaister

Copy link
Copy Markdown
Owner

Right, the legacy paths don't get tested much. Fix seems correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants