Skip to content
This repository was archived by the owner on Feb 16, 2025. It is now read-only.

New WebXR API using surfman - #72

Merged
bors-servo merged 1 commit into
servo:masterfrom
asajeffrey:surfman
Oct 31, 2019
Merged

bors-servo merged 1 commit into
servo:masterfrom
asajeffrey:surfman

Conversation

@asajeffrey

Copy link
Copy Markdown
Collaborator

This is a surfman-aware webxr. Fixes #60

@asajeffrey

Copy link
Copy Markdown
Collaborator Author

Probably shouldn't be merged until servo+surfman is ready to go.

@asajeffrey

Copy link
Copy Markdown
Collaborator Author

Note: I've only tested the glwindow implementation!

@jdm

jdm commented Oct 17, 2019

Copy link
Copy Markdown
Member

Panic when leaving immersive mode with the openxr backend:

thread '<unnamed>' panicked at 'Contexts must be destroyed explicitly with `destroy_context`!', C:\Users\image\.cargo\git\checkouts\surfman-a5c700867c3db833\a2115ae\surfman\src\platform\windows\angle\context.rs:52:

 	simpleservo.dll!rust_panic�()	Unknown
 	simpleservo.dll!_ZN3std9panicking20rust_panic_with_hook17hd2ba92dd1853b6d4E�()	Unknown
 	simpleservo.dll!std::panicking::begin_panic<str*>(str* msg, (str*, u32, u32) * file_line_col) Line 407	Unknown
>	simpleservo.dll!surfman::platform::windows::angle::context::{{impl}}::drop(surfman::platform::windows::angle::context::Context * self) Line 3	Unknown
 	simpleservo.dll!core::ptr::real_drop_in_place<surfman::platform::windows::angle::context::Context>(surfman::platform::windows::angle::context::Context *) Line 175	Unknown
 	simpleservo.dll!core::ptr::real_drop_in_place<(surfman::platform::windows::angle::device::Device, surfman::platform::windows::angle::context::Context)>((surfman::platform::windows::angle::device::Device, surfman::platform::windows::angle::context::Context) *) Line 175	Unknown
 	simpleservo.dll!core::ptr::real_drop_in_place<core::option::Option<(surfman::platform::windows::angle::device::Device, surfman::platform::windows::angle::context::Context)>>(core::option::Option<(surfman::platform::windows::angle::device::Device, surfman::platform::windows::angle::context::Context)> *) Line 175	Unknown
 	simpleservo.dll!core::ptr::real_drop_in_place<webxr::openxr::OpenXrDevice>(webxr::openxr::OpenXrDevice *) Line 175	Unknown
 	simpleservo.dll!core::ptr::real_drop_in_place<webxr_api::session::SessionThread<webxr::openxr::OpenXrDevice>>(webxr_api::session::SessionThread<webxr::openxr::OpenXrDevice> *) Line 175	Unknown
 	simpleservo.dll!core::ptr::real_drop_in_place<alloc::boxed::Box<MainThreadSession>>(webxr_api::session::Box<MainThreadSession> *) Line 175	Unknown
 	simpleservo.dll!core::mem::drop<alloc::boxed::Box<MainThreadSession>>(webxr_api::session::Box<MainThreadSession> _x) Line 706	Unknown
 	simpleservo.dll!core::ops::function::FnMut::call_mut<fn(alloc::boxed::Box<MainThreadSession>),(alloc::boxed::Box<MainThreadSession>)>(void(*)(webxr_api::session::Box<MainThreadSession>) *, webxr_api::session::Box<MainThreadSession>) Line 152	Unknown
 	simpleservo.dll!core::iter::traits::iterator::Iterator::for_each::call::{{closure}}<alloc::boxed::Box<MainThreadSession>,fn(alloc::boxed::Box<MainThreadSession>)>(core::iter::traits::iterator::Iterator::for_each::call::closure-0 *, ..., webxr_api::session::Box<MainThreadSession> item) Line 613	Unknown
 	simpleservo.dll!core::iter::traits::iterator::Iterator::fold::ok::{{closure}}<(),alloc::boxed::Box<MainThreadSession>,closure-0>(core::iter::traits::iterator::Iterator::fold::ok::closure-0 * acc, ..., webxr_api::session::Box<MainThreadSession> x) Line 1813	Unknown
 	simpleservo.dll!core::iter::traits::iterator::Iterator::try_fold<mut alloc::vec::DrainFilter<alloc::boxed::Box<MainThreadSession>, closure-0>*,(),closure-0,core::result::Result<(), !>>(alloc::vec::DrainFilter<alloc::boxed::Box<MainThreadSession>, closure-0> * * self, ..., core::iter::traits::iterator::Iterator::fold::ok::closure-0 f) Line 1694	Unknown
 	simpleservo.dll!core::iter::traits::iterator::Iterator::fold<mut alloc::vec::DrainFilter<alloc::boxed::Box<MainThreadSession>, closure-0>*,(),closure-0>(alloc::vec::DrainFilter<alloc::boxed::Box<MainThreadSession>, closure-0> * self, ..., core::iter::traits::iterator::Iterator::for_each::call::closure-0) Line 1816	Unknown
 	simpleservo.dll!core::iter::traits::iterator::Iterator::for_each<mut alloc::vec::DrainFilter<alloc::boxed::Box<MainThreadSession>, closure-0>*,fn(alloc::boxed::Box<MainThreadSession>)>(alloc::vec::DrainFilter<alloc::boxed::Box<MainThreadSession>, closure-0> * self, void(*)(webxr_api::session::Box<MainThreadSession>)) Line 616	Unknown
 	simpleservo.dll!alloc::vec::{{impl}}::drop<alloc::boxed::Box<MainThreadSession>,closure-0>(alloc::vec::DrainFilter<alloc::boxed::Box<MainThreadSession>, closure-0> * self) Line 2874	Unknown
 	simpleservo.dll!core::ptr::real_drop_in_place<alloc::vec::DrainFilter<alloc::boxed::Box<MainThreadSession>, closure-0>>(alloc::vec::DrainFilter<alloc::boxed::Box<MainThreadSession>, closure-0> *) Line 175	Unknown
 	simpleservo.dll!alloc::vec::Vec<alloc::boxed::Box<MainThreadSession>>::retain<alloc::boxed::Box<MainThreadSession>,closure-0>(webxr_api::registry::{{impl}}::run_one_frame::closure-0 self) Line 1038	Unknown
 	simpleservo.dll!webxr_api::registry::MainThreadRegistry::run_one_frame() Line 156	Unknown
 	simpleservo.dll!compositing::compositor::IOCompositor<simpleservo::ServoWindowCallbacks>::perform_updates<simpleservo::ServoWindowCallbacks>() Line 1521	Unknown
 	simpleservo.dll!servo::Servo<simpleservo::ServoWindowCallbacks>::handle_events<simpleservo::ServoWindowCallbacks>(alloc::vec::Vec<compositing::windowing::WindowEvent> self) Line 736	Unknown
 	simpleservo.dll!simpleservo::ServoGlue::perform_updates() Line 262	Unknown
 	simpleservo.dll!simpleservo::perform_updates::{{closure}}::{{closure}}(simpleservo::perform_updates::{{closure}}::closure-0 *, simpleservo::ServoGlue * s) Line 397	Unknown
 	simpleservo.dll!simpleservo::call::{{closure}}<closure-0>(simpleservo::call::closure-0 s, core::cell::RefCell<core::option::Option<simpleservo::ServoGlue>> *) Line 190	Unknown
 	simpleservo.dll!std::thread::local::LocalKey<core::cell::RefCell<core::option::Option<simpleservo::ServoGlue>>>::try_with<core::cell::RefCell<core::option::Option<simpleservo::ServoGlue>>,closure-0,core::result::Result<(), str*>>(simpleservo::call::closure-0 self) Line 262	Unknown
 	simpleservo.dll!std::thread::local::LocalKey<core::cell::RefCell<core::option::Option<simpleservo::ServoGlue>>>::with<core::cell::RefCell<core::option::Option<simpleservo::ServoGlue>>,closure-0,core::result::Result<(), str*>>(simpleservo::call::closure-0 self) Line 239	Unknown
 	simpleservo.dll!simpleservo::call<closure-0>(simpleservo::perform_updates::{{closure}}::closure-0 f) Line 189	Unknown
 	simpleservo.dll!simpleservo::perform_updates::{{closure}}(simpleservo::perform_updates::closure-0) Line 398	Unknown
 	simpleservo.dll!std::panicking::try::do_call<closure-0,()>(unsigned char * data) Line 292	Unknown
 	simpleservo.dll!__rust_maybe_catch_panic�()	Unknown
 	simpleservo.dll!std::panicking::try<(),closure-0>(simpleservo::perform_updates::closure-0 f) Line 271	Unknown
 	simpleservo.dll!std::panic::catch_unwind<closure-0,()>(simpleservo::perform_updates::closure-0 f) Line 394	Unknown
 	simpleservo.dll!simpleservo::catch_any_panic<(),closure-0>(simpleservo::perform_updates::closure-0) Line 45	Unknown
 	simpleservo.dll!simpleservo::perform_updates() Line 399	Unknown
 	ServoApp.exe!winrt::servo::Servo::PerformUpdates() Line 50	C++
 	ServoApp.exe!winrt::ServoApp::implementation::ServoControl::Loop() Line 193	C++
 	ServoApp.exe!winrt::ServoApp::implementation::ServoControl::StartRenderLoop::__l2::<lambda>() Line 208	C++
 	ServoApp.exe!std::_Invoker_functor::_Call<void <lambda>(void) &>(winrt::ServoApp::implementation::ServoControl::StartRenderLoop::__l2::void <lambda>(void) & _Obj)	C++
 	ServoApp.exe!std::invoke<void <lambda>(void) &>(winrt::ServoApp::implementation::ServoControl::StartRenderLoop::__l2::void <lambda>(void) & _Obj)	C++
 	ServoApp.exe!std::_Invoker_ret<void,1>::_Call<void <lambda>(void) &>(winrt::ServoApp::implementation::ServoControl::StartRenderLoop::__l2::void <lambda>(void) & <_Vals_0>)	C++
 	ServoApp.exe!std::_Func_impl_no_alloc<void <lambda>(void),void>::_Do_call()	C++
 	ServoApp.exe!std::_Func_class<void>::operator()()	C++
 	ServoApp.exe!Concurrency::details::_MakeVoidToUnitFunc::__l2::<lambda>() Line 2348	C++
 	ServoApp.exe!std::_Invoker_functor::_Call<unsigned char <lambda>(void) &>(Concurrency::details::_MakeVoidToUnitFunc::__l2::unsigned char <lambda>(void) & _Obj)	C++
 	ServoApp.exe!std::invoke<unsigned char <lambda>(void) &>(Concurrency::details::_MakeVoidToUnitFunc::__l2::unsigned char <lambda>(void) & _Obj)	C++
 	ServoApp.exe!std::_Invoker_ret<unsigned char,0>::_Call<unsigned char <lambda>(void) &>(Concurrency::details::_MakeVoidToUnitFunc::__l2::unsigned char <lambda>(void) & <_Vals_0>)	C++
 	ServoApp.exe!std::_Func_impl_no_alloc<unsigned char <lambda>(void),unsigned char>::_Do_call()	C++
 	ServoApp.exe!std::_Func_class<unsigned char>::operator()()	C++
 	ServoApp.exe!Concurrency::task<unsigned char>::_InitialTaskHandle<void,void <lambda>(void),Concurrency::details::_TypeSelectorNoAsync>::_LogWorkItemAndInvokeUserLambda<std::function<unsigned char __cdecl(void)> >(std::function<unsigned char __cdecl(void)> _func) Line 3517	C++
 	ServoApp.exe!Concurrency::task<unsigned char>::_InitialTaskHandle<void,void <lambda>(void),Concurrency::details::_TypeSelectorNoAsync>::_Init(Concurrency::details::_TypeSelectorNoAsync __formal) Line 3537	C++
 	ServoApp.exe!Concurrency::task<unsigned char>::_InitialTaskHandle<void,void <lambda>(void),Concurrency::details::_TypeSelectorNoAsync>::_Perform() Line 3523	C++
 	ServoApp.exe!Concurrency::details::_PPLTaskHandle<unsigned char,Concurrency::task<unsigned char>::_InitialTaskHandle<void,void <lambda>(void),Concurrency::details::_TypeSelectorNoAsync>,Concurrency::details::_TaskProcHandle>::invoke() Line 1465	C++
 	ServoApp.exe!Concurrency::details::_TaskProcHandle::_RunChoreBridge(void * _Parameter) Line 160	C++
 	ServoApp.exe!Concurrency::details::_DefaultPPLTaskScheduler::_PPLTaskChore::_Callback(void * _Args) Line 51	C++
 	msvcp140d_app.dll!00007ff9c9ef31b4()	Unknown
 	ntdll.dll!00007ff9e0b3093d()	Unknown
 	ntdll.dll!00007ff9e0b346d4()	Unknown
 	ntdll.dll!00007ff9e0b6cf8f()	Unknown
 	[Async Call]	
 	ServoApp.exe!winrt::ServoApp::implementation::ServoControl::StartRenderLoop() Line 208	C++
 	ServoApp.exe!winrt::ServoApp::implementation::ServoControl::OnLoaded(const winrt::Windows::Foundation::IInspectable & __formal, const winrt::Windows::UI::Xaml::RoutedEventArgs & __formal) Line 60	C++
 	ServoApp.exe!std::_Invoker_pmf_pointer::_Call<void (__cdecl winrt::ServoApp::implementation::ServoControl::*)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::UI::Xaml::RoutedEventArgs const &),winrt::ServoApp::implementation::ServoControl * &,winrt::Windows::Foundation::IInspectable const &,winrt::Windows::UI::Xaml::RoutedEventArgs const &>(void(winrt::ServoApp::implementation::ServoControl::*)(const winrt::Windows::Foundation::IInspectable &, const winrt::Windows::UI::Xaml::RoutedEventArgs &) _Pmf, winrt::ServoApp::implementation::ServoControl * & _Arg1, const winrt::Windows::Foundation::IInspectable & <_Args2_0>, const winrt::Windows::UI::Xaml::RoutedEventArgs & <_Args2_1>)	C++
 	ServoApp.exe!std::invoke<void (__cdecl winrt::ServoApp::implementation::ServoControl::*&)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::UI::Xaml::RoutedEventArgs const &),winrt::ServoApp::implementation::ServoControl * &,winrt::Windows::Foundation::IInspectable const &,winrt::Windows::UI::Xaml::RoutedEventArgs const &>(void(winrt::ServoApp::implementation::ServoControl::*)(const winrt::Windows::Foundation::IInspectable &, const winrt::Windows::UI::Xaml::RoutedEventArgs &) & _Obj, winrt::ServoApp::implementation::ServoControl * & <_Args_0>, const winrt::Windows::Foundation::IInspectable & <_Args_1>, const winrt::Windows::UI::Xaml::RoutedEventArgs & <_Args_2>)	C++
 	ServoApp.exe!std::_Invoker_ret<std::_Unforced,0>::_Call<void (__cdecl winrt::ServoApp::implementation::ServoControl::*&)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::UI::Xaml::RoutedEventArgs const &),winrt::ServoApp::implementation::ServoControl * &,winrt::Windows::Foundation::IInspectable const &,winrt::Windows::UI::Xaml::RoutedEventArgs const &>(void(winrt::ServoApp::implementation::ServoControl::*)(const winrt::Windows::Foundation::IInspectable &, const winrt::Windows::UI::Xaml::RoutedEventArgs &) & <_Vals_0>, winrt::ServoApp::implementation::ServoControl * & <_Vals_1>, const winrt::Windows::Foundation::IInspectable & <_Vals_2>, const winrt::Windows::UI::Xaml::RoutedEventArgs & <_Vals_3>)	C++
 	ServoApp.exe!std::_Call_binder<std::_Unforced,0,1,2,void (__cdecl winrt::ServoApp::implementation::ServoControl::*)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::UI::Xaml::RoutedEventArgs const &),std::tuple<winrt::ServoApp::implementation::ServoControl *,std::_Ph<1>,std::_Ph<2> >,std::tuple<winrt::Windows::Foundation::IInspectable const &,winrt::Windows::UI::Xaml::RoutedEventArgs const &> >(std::_Invoker_ret<std::_Unforced,0> __formal, std::integer_sequence<unsigned __int64,0,1,2> __formal, void(winrt::ServoApp::implementation::ServoControl::*)(const winrt::Windows::Foundation::IInspectable &, const winrt::Windows::UI::Xaml::RoutedEventArgs &) & _Obj, std::tuple<winrt::ServoApp::implementation::ServoControl *,std::_Ph<1>,std::_Ph<2> > & _Tpl, std::tuple<winrt::Windows::Foundation::IInspectable const &,winrt::Windows::UI::Xaml::RoutedEventArgs const &> && _Ut) Line 1859	C++
 	ServoApp.exe!std::_Binder<std::_Unforced,void (__cdecl winrt::ServoApp::implementation::ServoControl::*)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::UI::Xaml::RoutedEventArgs const &),winrt::ServoApp::implementation::ServoControl *,std::_Ph<1> const &,std::_Ph<2> const &>::operator()<winrt::Windows::Foundation::IInspectable const &,winrt::Windows::UI::Xaml::RoutedEventArgs const &>(const winrt::Windows::Foundation::IInspectable & <_Unbargs_0>, const winrt::Windows::UI::Xaml::RoutedEventArgs & <_Unbargs_1>) Line 1914	C++
 	ServoApp.exe!winrt::impl::delegate<winrt::Windows::UI::Xaml::RoutedEventHandler,std::_Binder<std::_Unforced,void (__cdecl winrt::ServoApp::implementation::ServoControl::*)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::UI::Xaml::RoutedEventArgs const &),winrt::ServoApp::implementation::ServoControl *,std::_Ph<1> const &,std::_Ph<2> const &> >::Invoke(void * sender, void * e) Line 4569	C++
 	Windows.UI.Xaml.dll!00007ff9c4fc2281()	Unknown
 	Windows.UI.Xaml.dll!00007ff9c4fc2134()	Unknown

@asajeffrey

Copy link
Copy Markdown
Collaborator Author

That would be the drop code for a surface being run without destroy'ing it first.

@jdm

jdm commented Oct 17, 2019

Copy link
Copy Markdown
Member

OpenXrDevice contains an Option<(Device, Context)>, so I suppose it needs to be more careful about destroying the context before that value is dropped.

@asajeffrey

Copy link
Copy Markdown
Collaborator Author

Ah, that's a pretty easy fix, we can destroy the context in the drop code.

@asajeffrey

Copy link
Copy Markdown
Collaborator Author

@jdm: do you want to try again and see if that fixed it?

@asajeffrey

Copy link
Copy Markdown
Collaborator Author

The matching servo PR is servo/servo#24482

@asajeffrey

Copy link
Copy Markdown
Collaborator Author

r? @Manishearth (it needs squashed before landing)

@Manishearth Manishearth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

Comment thread webxr-api/registry.rs

fn request_session(&mut self, mode: SessionMode) -> Result<Session, Error> {
let webgl = self.webgl.as_ref().ok_or(Error::NoMatchingDevice)?;
let swap_chains = self.swap_chains.as_mut().ok_or(Error::NoMatchingDevice)?;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a new error variant?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I think the spec says the only error this can return is NoMatchingDevice?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but we can be more specific in our API if we want. r=me either way.

Comment thread webxr/glwindow/mod.rs Resolved
@asajeffrey

Copy link
Copy Markdown
Collaborator Author

@bors-servo r=Manishearth

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit c42611a has been approved by Manishearth

bors-servo pushed a commit that referenced this pull request Oct 31, 2019
New WebXR API using surfman

This is a surfman-aware webxr. Fixes #60
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit c42611a with merge 94bf6c6...

@asajeffrey
asajeffrey marked this pull request as ready for review October 31, 2019 18:08
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - checks-travis
Approved by: Manishearth
Pushing 94bf6c6 to master...

@bors-servo
bors-servo merged commit c42611a into servo:master Oct 31, 2019
@bors-servo bors-servo mentioned this pull request Oct 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use surfman for surface sharing

4 participants