Repository navigation
fix(vulkan): destroy the enable2 device only after xrDestroySession (runtime#1779) - #345
Merged
Merged
Conversation
…isplayXR/displayxr-runtime#1779) dxr_prov_session_stop called dxr_pvk_destroy() before xrEndSession, and that destroyed the VkDevice + VkInstance we created through XR_KHR_vulkan_enable2. The session still runs on them: the runtime's repaint thread keeps presenting the last frame until xrEndSession. Every session stop and every quit crashed in vkQueuePresentKHR on that thread (SIGSEGV). Split the teardown: - dxr_pvk_destroy(): bridges, overlays, fence, command pool. Still before xrEndSession. - dxr_pvk_destroy_device(): device + instance, after xrDestroySession and xrDestroyInstance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the session-stop / quit crash reported as DisplayXR/displayxr-runtime#1779. The cause is in the plugin, not the runtime.
Problem
On Vulkan, every session stop (
XRGeneralSettings.Instance.Manager.StopSubsystems()) and every app quit crashed with SIGSEGV. That made a session restart impossible on Linux.A core dump against a runtime built with symbols shows two threads at the crash:
dxr_prov_session_stopcalleddxr_pvk_destroy()beforexrEndSession, anddxr_pvk_destroy()destroyed theVkDeviceandVkInstancethat we created throughXR_KHR_vulkan_enable2. The session still runs on them. The runtime's repaint thread keeps presenting the last frame untilxrEndSession, so it presented on a destroyed device.Fix
The teardown is split in two:
dxr_pvk_destroy()destroys the bridges, overlays, fence and command pool. It still runs beforexrEndSession.dxr_pvk_destroy_device()is new. It destroys the device and instance afterxrDestroySessionandxrDestroyInstance.Platforms: Vulkan backend only (
ENABLE_VULKAN): Linux, and Windows withDISPLAYXR_VK_EXPERIMENTAL=1. No change on D3D11/D3D12/Metal.Testing
Ubuntu 26.04, RTX 4090 Laptop, Leia DS1, installed runtime v2.21.11. App: the lenovo-avatar Linux player.
destroyedlogged after the sessionxrEndFrameerror, no XidThe last row is the restart check requested on #337 for the Local2D/wsui Vulkan paths.
🤖 Generated with Claude Code