0

I am writing an application using OpenXR on Windows using the Windows Mixed Reality OpenXR addon/plugin. When my application runs and the VR device goes to sleep, I get a state change to exit the OpenXR application. According to the OpenXR lifecycle there's no way back (and I properly exit my application). I can wake up the glasses in the Mixed Reality Portal. Even if I ignore the exit state change in my application and keep it running, after waking up the glasses I don't get any state-changing events in my OpenXR application. Is this the correct behaviour? I assumed I need to properly handle going to sleep in my application (pause the application for example and continue on waking up the device). Is there something else I am missing?

Here are the state changes I recorded (just starting the application and waiting for the VR device to go sleep):

- XR_SESSION_STATE_IDLE
- XR_SESSION_STATE_READY
- XR_SESSION_STATE_SYNCHRONIZED
- XR_SESSION_STATE_VISIBLE
- XR_SESSION_STATE_SYNCHRONIZED
- XR_SESSION_STATE_STOPPING
- XR_SESSION_STATE_IDLE
- XR_SESSION_STATE_EXITING

so the actual question is: How do I properly handle VR devices going to sleep when using OpenXR with Windows Mixed Reality?

Thanks for any hints :)

pettersson
  • 317
  • 2
  • 10
  • May I ask what is the platform/tool that you are using to develop the project and please share more details of development environment. – Seth DU - MSFT Aug 23 '22 at 10:37
  • I am using Windows 10 with Visual Studio 2019. VR Device is a HP Reverb G2. The OpenXR Dev Tools are version 107.2106.1002.0. Windows 10 is 10.0.19042 – pettersson Aug 24 '22 at 05:44

2 Answers2

1

As you have stated, the OpenXR Dev Tool you have installed on the device is version 107.2106.1002.0. We notice there are stability improvements in a later release. Please refer to OpenXR Tools for Windows Mixed Reality - 110.2202.10002.

If you have used the latest version from Micrsoft Store App, please try to manually install 110.2202+ version from Github, and let me know if this state changing issue still exist after the upgrade.

  • Thanks for the hint with the updated version. I will try it on my developer machine but in the end it has to be able to run without internet access. – pettersson Aug 25 '22 at 07:50
  • Also what is there to install? Just linking the included openxr_loader and then switching the OpenXR Dev tool to "use latest preview runtime"? – pettersson Aug 25 '22 at 07:56
  • This document may help -- https://learn.microsoft.com/en-us/windows/mixed-reality/develop/native/openxr-getting-started#getting-the-openxr-tools-for-windows-mixed-reality – Seth DU - MSFT Aug 25 '22 at 08:51
  • Thanks for the heads-up that did help. I built a new loader from Khronos Sources and Microsoft Headers, switched to "use latest preview" and still it's calling XR_SESSION_STATE_EXITING when the headset goes to sleep. How do I know that it is really using something new? I only have a never openxr_loader (1.0.23 latest version that goes with the Microsoft headers) – pettersson Aug 25 '22 at 12:52
  • You still need to access OpenXR Tools for Windows Mixed Reality from Internet for update. BTW, have you checked the "Sleep timeout" option in the display setting of device? – Seth DU - MSFT Aug 26 '22 at 02:11
  • 1
    Yes, we usually set the "sleep timeout" to a rather high value but also lost a device this way because of the OLED burn in :D So I rather need the sleep to work :) I try and connect my developer machine to the internet to try and update the OpenXR Tools. Thanks for your help :) – pettersson Aug 26 '22 at 05:42
  • Sry for the late response, I was on vacation. I managed to install/build the current version. It still sends an EXIT when the VR device goes to sleep. I also managed to reproduce this behaviour when running the BasicXRApp. Once the VR device goes to sleep, the application exits. – pettersson Sep 14 '22 at 06:34
1

Thanks for the comments and updates. For the behavior, this is correct for XR_SESSION_STATE_EXITING being sent before closure. There is not a resume state or suspend state in OpenXR spec:

https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSessionState.html

XR_SESSION_STATE_EXITING.

"The application should end its XR experience and not automatically restart it."

So, if you do have any clean-up that you want to perform for the application, you can do that piece when receiving: XR_SESSION_STATE_STOPPING

Upon re-launching, you should get the standard XR_SESSION_STATE_READY notification again to do any application specific startup. That could be reading status from storage, web service, etc. There was an issue that was fixed for resume and rendering but as noted in comments, this has been fixed

Nathan - MSFT
  • 331
  • 1
  • 7