diff options
| author | AlxcBTW <187763517+AlxcBTW@users.noreply.github.com> | 2026-11-22 22:20:36 +0100 |
|---|---|---|
| committer | AlxcBTW <187763517+AlxcBTW@users.noreply.github.com> | 2026-11-22 22:20:36 +0100 |
| commit | 48cee7c2c69e502cc864b0789a9cf5bb88e98658 (patch) | |
| tree | 52fd1d94d86ee5fe479111579e48c696e18d42cf /runtime/src/queue_holds.h | |
| parent | 0d75876278a3f6b238a8667cf42c66cf1ae1d99a (diff) | |
Queue holds: second review fixes (claim after submit, presenter locking and bound, teardown pump, tests)
- A Signal counts as submitted only after vkQueueSubmit succeeded: a failed submit releases no waiter and the retry goes through.
- ~VulkanQueue pumps after dropping held work; fence keep-alives are also drained in wait() and marker().
- VulkanPresenter: counters are atomics, read_back/enable_capture take the presenter mutex, set_abort has its own mutex,
a deferred present reports not tearing, and at most 8 presents queue up before the caller waits.
- Tests: three presents (blit, blank, composed) queued behind held work run in order, a present behind a destroyed
queue's held work runs, a failed Signal does not release its waiters; the handover modes also run on the host runtime.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/queue_holds.h')
| -rw-r--r-- | runtime/src/queue_holds.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/runtime/src/queue_holds.h b/runtime/src/queue_holds.h index 4a1f990d8..2839d4210 100644 --- a/runtime/src/queue_holds.h +++ b/runtime/src/queue_holds.h | |||
| @@ -81,18 +81,16 @@ public: | |||
| 81 | if (it != fences_.end() && it->second < value) it->second = value; | 81 | if (it != fences_.end() && it->second < value) it->second = value; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | // A queue is about to submit a Signal of `value`; call inside the device submit lock, so the order of the | 84 | // A queue is about to submit a Signal of `value`; call inside the device submit lock, and record the value with |
| 85 | // calls is the order of the vkQueueSubmits. False when a Signal of at least `value` was already submitted: the | 85 | // signaled() only once the vkQueueSubmit succeeded (a failed submit signals nothing: waiters must stay held and a |
| 86 | // timeline cannot go down or stay (VUID-VkSubmitInfo-pSignalSemaphores-03242 and the timeline rules), and a wait | 86 | // retry must go through). False when a Signal of at least `value` was already submitted: the timeline cannot go |
| 87 | // for `value` is already satisfied, so the Vulkan signal is left out. This happens when a held Signal(F, 2) is | 87 | // down or stay (VUID-VkSubmitInfo-pSignalSemaphores-03242 and the timeline rules), and a wait for `value` is |
| 88 | // released after an unheld Signal(F, 3). Unknown semaphores are always signaled. | 88 | // already satisfied, so the Vulkan signal is left out. This happens when a held Signal(F, 2) is released after an |
| 89 | bool claim_signal(Semaphore semaphore, std::uint64_t value) { | 89 | // unheld Signal(F, 3). Unknown semaphores are always signaled. |
| 90 | bool would_signal(Semaphore semaphore, std::uint64_t value) const { | ||
| 90 | std::lock_guard lock(mutex_); | 91 | std::lock_guard lock(mutex_); |
| 91 | const auto it = fences_.find(semaphore); | 92 | const auto it = fences_.find(semaphore); |
| 92 | if (it == fences_.end()) return true; | 93 | return it == fences_.end() || it->second < value; |
| 93 | if (it->second >= value) return false; | ||
| 94 | it->second = value; | ||
| 95 | return true; | ||
| 96 | } | 94 | } |
| 97 | 95 | ||
| 98 | // true when no submitted Signal reaches `value` yet. Unknown semaphores are satisfied. | 96 | // true when no submitted Signal reaches `value` yet. Unknown semaphores are satisfied. |