Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFailed to create hardware graphics context!: NoCurrentContext (thread main, at src/libcore/result.rs:1165) #24642
Comments
|
I can have a look at this when I get home. |
|
Unfortunately it works at my end, and I'm also on Ubuntu 16.04. Are you running wayland? |
|
Similar problems. I am in Mint 19.2, on a VM that is running in VirtualBox under a Windows 10 host. (Given the way VM video is different from native video, this could be a key reproducibility point?) A difference for me is that without LIBGL_ALWAYS_SOFTWARE I get OpenGlVersionNotSupported, and NoCurrentContext is what I get when I do use LIBGL_ALWAYS_SOFTWARE. I get a flash of an unpainted window first, and then the window goes away and I see the error. This problem does not happen when running headless tests. pshaughn@pshaughn-VirtualBox:~/servo$ ./mach run -r Stack trace for thread "main" Servo exited with return value 11 Servo exited with return value 101 |
|
@pshaughn Could you paste the output of running |
|
Guest extensions are installed. glxinfo output the following: name of display: :0 OpenGL ES profile version string: OpenGL ES 2.0 Mesa 19.0.8 108 GLX Visuals
|
|
I may have spoken too soon about guest extensions actually. I have mouse pointer integration and was inferring that to mean guest extensions in general were installed but I'm explicitly installing them now to double-check if that changes anything! |
|
After installing the guest extensions ISO and rebooting the VM, both the run errors and glxinfo are unchanged. |
|
In the short term, see if running with the following patch avoids the issue: diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index 2e20e1955f..d1bbd40122 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -510,7 +510,7 @@ where
webrender_api_sender,
webxr_main_thread.registry(),
player_context,
- Some(webgl_threads),
+ webgl_threads,
webvr_chan,
webvr_constellation_sender,
glplayer_threads,
@@ -1026,7 +1026,7 @@ fn create_webgl_threads<W>(
webxr_main_thread: &mut webxr::MainThreadRegistry,
external_image_handlers: &mut WebrenderExternalImageHandlers,
external_images: Arc<Mutex<WebrenderExternalImageRegistry>>,
-) -> WebGLThreads
+) -> Option<WebGLThreads>
where
W: WindowMethods + 'static + ?Sized,
{
@@ -1036,18 +1036,33 @@ where
#[cfg(not(target_os = "windows"))]
let (device, context) = unsafe {
if opts::get().headless {
- let (device, context) = SWDevice::from_current_context()
- .expect("Failed to create software graphics context!");
+ let (device, context) = match SWDevice::from_current_context() {
+ Ok(a) => a,
+ Err(e) => {
+ warn!(format!("Failed to create software graphics context: {:?}", e));
+ return None;
+ }
+ };
(Device::Software(device), Context::Software(context))
} else {
- let (device, context) = HWDevice::from_current_context()
- .expect("Failed to create hardware graphics context!");
+ let (device, context) = match HWDevice::from_current_context() {
+ Ok(a) => a,
+ Err(e) => {
+ warn!(format!("Failed to create hardware graphics context: {:?}", e));
+ return None;
+ }
+ };
(Device::Hardware(device), Context::Hardware(context))
}
};
#[cfg(target_os = "windows")]
- let (device, context) =
- unsafe { Device::from_current_context().expect("Failed to create graphics context!") };
+ let (device, context) = match unsafe { Device::from_current_context() } {
+ Ok(a) => a,
+ Err(e) => {
+ warn!(format!("Failed to create graphics context: {:?}", e));
+ return None;
+ }
+ };
let gl_type = match window.gl().get_type() {
gleam::gl::GlType::Gl => sparkle::gl::GlType::Gl,
@@ -1080,5 +1095,5 @@ where
webrender.set_output_image_handler(output_handler);
}
- webgl_threads
+ Some(webgl_threads)
} |
|
after taking the redundant format! part out from inside the warn so this compiles, it works when LIBGL_ALWAYS_SOFTWARE=1 , no change to the opengl version problem. |
WebRender needs OpenGL 3.1. If certain conditions are not met, only OpenGL 2.1 is supported by VirtualBox. It could be that only commercial VMware products support it on Windows, I don't know. It sounds like it should work with a Linux host though:
|
Don't panic if surfman initialization fails. Since WebGL is only one component of the web platform, there's no reason that failing to initialize surfman for webgl support should take down the entire browser. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #24642 (in that the browser will now start up) and fix #24627 - [x] These changes do not require tests because tests for graphics acceleration? don't make me laugh.
running ubuntu 16.04, clang 6
build from sources, getting this:
./mach run --release tests/html/about-mozilla.html
Failed to create hardware graphics context!: NoCurrentContext (thread main, at src/libcore/result.rs:1165)
stack backtrace:
0: servo::main::{{closure}}
1: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:472
2: std::panicking::continue_panic_fmt
at src/libstd/panicking.rs:375
3: rust_begin_unwind
at src/libstd/panicking.rs:302
4: core::panicking::panic_fmt
at src/libcore/panicking.rs:84
5: core::result::unwrap_failed
at src/libcore/result.rs:1165
6: servo::Servo::new
7: servo::app::App::run
8: servo::main
9: std::rt::lang_start::{{closure}}
10: std::rt::lang_start_internal::{{closure}}
at src/libstd/rt.rs:48
std::panicking::try::do_call
at src/libstd/panicking.rs:287
11: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:80
12: std::panicking::try
at src/libstd/panicking.rs:265
std::panic::catch_unwind
at src/libstd/panic.rs:396
std::rt::lang_start_internal
at src/libstd/rt.rs:47
13: main
14: __libc_start_main
15: _start
Servo exited with return value 101
the same if I try to force software GL:
LIBGL_ALWAYS_SOFTWARE=1 LD_LIBRARY_PATH=./support/linux/gstreamer/gst/lib ./target/release/servo
Failed to create hardware graphics context!: NoCurrentContext (thread main, at src/libcore/result.rs:1165)