servo: hololens: XR hangs
With this PR: #23777
The stack shows that it’s right when the “Enter VR” button is clicked (using this page: http://paulrouget.com/webgl-to-webvr/webxr.html)
simpleservo.dll!webxr_api::recv_timeout<webxr_api::session::SessionMsg>(ipc_channel::ipc::IpcReceiver<webxr_api::session::SessionMsg> * receiver, core::time::Duration timeout) Line 98
at C:\msys64\home\paul\git\webxr\webxr-api\lib.rs(98)
simpleservo.dll!webxr_api::session::{{impl}}::run_one_frame<webxr::hololens::GlWindowDevice>(webxr_api::session::SessionThread<webxr::hololens::GlWindowDevice> * self) Line 195
at C:\msys64\home\paul\git\webxr\webxr-api\session.rs(195)
simpleservo.dll!webxr_api::registry::MainThreadRegistry::run_one_frame() Line 116
at C:\msys64\home\paul\git\webxr\webxr-api\registry.rs(116)
simpleservo.dll!compositing::compositor::IOCompositor<simpleservo::ServoWindowCallbacks>::perform_updates<simpleservo::ServoWindowCallbacks>() Line 1488
at c:\msys64\home\paul\git\servo\components\compositing\compositor.rs(1488)
simpleservo.dll!servo::Servo<simpleservo::ServoWindowCallbacks>::handle_events<simpleservo::ServoWindowCallbacks>(alloc::vec::Vec<compositing::windowing::WindowEvent> self) Line 730
at c:\msys64\home\paul\git\servo\components\servo\lib.rs(730)
simpleservo.dll!simpleservo::ServoGlue::perform_updates() Line 271
at c:\msys64\home\paul\git\servo\ports\libsimpleservo\api\src\lib.rs(271)
simpleservo.dll!simpleservo::ServoGlue::process_event(compositing::windowing::WindowEvent self) Line 488
at c:\msys64\home\paul\git\servo\ports\libsimpleservo\api\src\lib.rs(488)
simpleservo.dll!simpleservo::ServoGlue::click(float self, float x) Line 464
at c:\msys64\home\paul\git\servo\ports\libsimpleservo\api\src\lib.rs(464)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 25 (25 by maintainers)
Actually I think that’s a lie - I had to solve a similar problem in #23777 for dealing with locking the webgl textures (see WebrenderExternallmageApi implementation for WebGLExternalImages), but it’s not immediately clear how to do the same for fixing the WebGLExternalImageApi implementation of SerializableWebGLMsgSender.
Oh, I see - we’re calling SerializableWebGLMsgSender::lock() on the main thread, which assumes that it can block on a response from the webgl thread, which will of course never happen. I suspect this is fixed by the later commits in https://github.com/jdm/servo/tree/webgl-main-thread-sync.
@gterzian tidying up the main thread is definitely something we should think about, it used to be quite clean (just running webrender and the main window) but is now a mess of webrender+webxr+wengl+… My temptation would be to rewrite it using async/await which is exactly intended to solve problems like this. This is quite a big project, though, and would require making anything that can run on the main thread async-aware, in particular webrender.
The current code for messages to the main thread is a bit brittle, and assumes that while an rAF is being processed, you don’t need to wake up the main thread, because of https://github.com/servo/servo/blob/master/components/compositing/compositor.rs#L1010. This is the same assumption animations make: the compositor has two modes, one where animations are running (and the compositor runs once per frame) and one where they’re not (and the compositor blocks on window events). This isn’t great, especially at phase transitions, but cleaning it up most likely means waiting for The Big Main Thread Rewrite.