Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] GL support for Windows #304

Closed
wants to merge 10 commits into from
Closed

[WIP] GL support for Windows #304

wants to merge 10 commits into from

Conversation

@ferjm
Copy link
Member

ferjm commented Aug 29, 2019

No description provided.

@jdm
Copy link
Member

jdm commented Aug 29, 2019

Don't spend time making the WGL codepath work. I want to make ANGLE the default on Windows, and possibly just remove the WGL support entirely.

@ferjm ferjm force-pushed the ferjm:windows.gl branch from bdbaefe to 49a3187 Sep 9, 2019
@ferjm
Copy link
Member Author

ferjm commented Sep 9, 2019

Hitting rust-lang/cargo#1197 again here :(

@jdm
Copy link
Member

jdm commented Sep 9, 2019

I wonder if we could work around that problem with a build script that does something like https://github.com/rust-random/getrandom/blob/5cfa668403345340966ba597732387bfddff5b3d/build.rs#L11. That would allow checking the TARGET variable and setting rust-cfg values that can be checked in the library source - the crate would be enabling its own features based on the compilation target, rather than the crate that depends on it enabling features in its cargo.toml based on the compilation target.

@ferjm
Copy link
Member Author

ferjm commented Sep 9, 2019

Oh, that's interesting. Thanks for the pointer, @jdm!

@ferjm
Copy link
Member Author

ferjm commented Sep 10, 2019

If I am not wrong, the workaround won't work in this case, unless we modify gstreamer-gl directly.

We are indeed able to set the features for the render crates (i.e. servo-media-gstreamer-render-unix), but because we set the gstreamer-gl features based on the render crates features and because the render crate build script runs after building its dependencies, gstreamer-gl is built with its default features.

This is a build log where we can see that we are setting the render crate features after building gstreamer-gl with its default features, which breaks the build with the undefined symbols errors

@ferjm ferjm force-pushed the ferjm:windows.gl branch from 375c9c4 to e2627f5 Sep 16, 2019
@bors-servo
Copy link
Contributor

bors-servo commented Sep 16, 2019

The latest upstream changes (presumably #308) made this pull request unmergeable. Please resolve the merge conflicts.

@ferjm ferjm force-pushed the ferjm:windows.gl branch from e2627f5 to 1a35904 Sep 26, 2019
@ferjm
Copy link
Member Author

ferjm commented Oct 21, 2019

I am currently trying to understand why eglMakeCurrent is not working with the given display and context. We are throwing the exception at https://dxr.mozilla.org/servo/source/support/hololens/ServoApp/ServoControl/OpenGLES.cpp#235

D3D11: Removing Device.
Exception thrown at 0x00007FFF72609129 (KernelBase.dll) in ServoApp.exe: WinRT originate error - 0x80004005 : 'Failed to make EGLSurface current'.
RUST: WARN - servo::media_platform - "glframebuffer" Warning "../gst-libs/gst/gl/gstglframebuffer.c":554:"gst_gl_context_check_framebuffer_status" DebugMessage(Some("Unknown FBO error"))
RUST: WARN - servo::media_platform - "glconvertelement" Warning "../ext/gl/gstglcolorconvertelement.c":215:"gst_gl_color_convert_element_prepare_output_buffer" DebugMessage(Some("error: Failed to convert video buffer"))
RUST: WARN - servo::media_platform - "basetransform" Warning "../libs/gst/base/gstbasetransform.c":2168:"default_generate_output" DebugMessage(Some("could not get buffer from pool: error"))
RUST: WARN - servo::media_platform - "libav" Debug "":0:"" DebugMessage(Some("nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2"))
RUST: WARN - servo::media_platform - "gst-player" Error "../gst-libs/gst/player/gstplayer.c":1188:"error_cb" DebugMessage(Some("ERROR: from element /GstPlayBin:playbin/GstPlaySink:playsink/GstBin:vbin/GstGLSinkBin:servo-media-vsink/GstGLColorConvertElement:glcolorconvertelement0: Failed to convert video buffer\n"))
RUST: WARN - servo::media_platform - "gst-player" Error "../gst-libs/gst/player/gstplayer.c":1190:"error_cb" DebugMessage(Some("Additional debug info:\n../ext/gl/gstglcolorconvertelement.c(215): gst_gl_color_convert_element_prepare_output_buffer (): /GstPlayBin:playbin/GstPlaySink:playsink/GstBin:vbin/GstGLSinkBin:servo-media-vsink/GstGLColorConvertElement:glcolorconvertelement0\n"))
RUST: WARN - servo::media_platform - "gst-player" Error "../gst-libs/gst/player/gstplayer.c":1065:"emit_error" DebugMessage(Some("Error: Error from element /GstPlayBin:playbin/GstPlaySink:playsink/GstBin:vbin/GstGLSinkBin:servo-media-vsink/GstGLColorConvertElement:glcolorconvertelement0: Resource not found.\nFailed to convert video buffer\n../ext/gl/gstglcolorconvertelement.c(215): gst_gl_color_convert_element_prepare_output_buffer (): /GstPlayBin:playbin/GstPlaySink:playsink/GstBin:vbin/GstGLSinkBin:servo-media-vsink/GstGLColorConvertElement:glcolorconvertelement0 (gst-player-error-quark, 0)"))
'ServoApp.exe' (Win32): Loaded 'C:\Windows\System32\userenv.dll'. Cannot find or open the PDB file.
RUST: ERROR - script::dom::htmlmediaelement - Player error: "Error from element /GstPlayBin:playbin/GstPlaySink:playsink/GstBin:vbin/GstGLSinkBin:servo-media-vsink/GstGLColorConvertElement:glcolorconvertelement0: Resource not found.\nFailed to convert video buffer\n../ext/gl/gstglcolorconvertelement.c(215): gst_gl_color_convert_element_prepare_output_buffer (): /GstPlayBin:playbin/GstPlaySink:playsink/GstBin:vbin/GstGLSinkBin:servo-media-vsink/GstGLColorConvertElement:glcolorconvertelement0"
RUST: WARN - servo::media_platform - "queue2" Warning "../plugins/elements/gstqueue2.c":3189:"gst_queue2_loop" DebugMessage(Some("error: Internal data stream error."))
RUST: WARN - servo::media_platform - "queue2" Warning "../plugins/elements/gstqueue2.c":3189:"gst_queue2_loop" DebugMessage(Some("error: streaming stopped, reason error (-5)"))
'ServoApp.exe' (Win32): Loaded 'C:\Windows\System32\profext.dll'. Cannot find or open the PDB file.
Exception thrown at 0x00007FFF72609129 in ServoApp.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x000000DF098FC328.
>	ServoApp.exe!OpenGLES::MakeCurrent(void * const surface) Line 237	C++
 	ServoApp.exe!winrt::ServoApp::implementation::ServoControl::MakeCurrent() Line 268	C++
 	ServoApp.exe!winrt::servo::make_current() Line 30	C++
 	simpleservo.dll!simpleservo::{{impl}}::make_current(simpleservo::HostCallbacks * self) Line 573	Unknown
 	simpleservo.dll!simpleservo::{{impl}}::prepare_for_composite(simpleservo::ServoWindowCallbacks * self) Line 651	Unknown
 	simpleservo.dll!compositing::compositor::IOCompositor<simpleservo::ServoWindowCallbacks>::composite_specific_target<simpleservo::ServoWindowCallbacks>(compositing::compositor::CompositeTarget self, core::option::Option<euclid::rect::Rect<f32, style_traits::CSSPixel>> target) Line 1267	Unknown
 	simpleservo.dll!compositing::compositor::IOCompositor<simpleservo::ServoWindowCallbacks>::composite<simpleservo::ServoWindowCallbacks>() Line 1236	Unknown
 	simpleservo.dll!compositing::compositor::IOCompositor<simpleservo::ServoWindowCallbacks>::perform_updates<simpleservo::ServoWindowCallbacks>() Line 1512	Unknown
 	simpleservo.dll!servo::Servo<simpleservo::ServoWindowCallbacks>::handle_events<simpleservo::ServoWindowCallbacks>(alloc::vec::Vec<compositing::windowing::WindowEvent> self) Line 790	Unknown
 	simpleservo.dll!simpleservo::ServoGlue::perform_updates() Line 257	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!panic_unwind::__rust_maybe_catch_panic() Line 80	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++
 	[External Code]	
 	[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++
 	[External Code]	
 	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++
@ferjm
Copy link
Member Author

ferjm commented Oct 21, 2019

@ceyusa any idea of what is wrong here? Thanks

@ferjm
Copy link
Member Author

ferjm commented Oct 22, 2019

With a debug version of ANGLE I get this:

D3D11 CORRUPTION: ID3D11DeviceContext::Map: Two threads were found to be executing functions associated with the same Device[Context] at the same time. This will cause corruption of memory. Appropriate thread synchronization needs to occur external to the Direct3D API (or through the ID3D10Multithread interface). 10728 and 4796 are the implicated thread ids. [ MISCELLANEOUS CORRUPTION #28: CORRUPTED_MULTITHREADING]

@bors-servo
Copy link
Contributor

bors-servo commented Nov 15, 2019

The latest upstream changes (presumably #321) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.