servo / servo

Servo, the embeddable, independent, memory-safe, modular, parallel web rendering engine
https://servo.org
Mozilla Public License 2.0
28.37k stars 3.03k forks source link

Failed to create window.: CreationErrors([NoAvailablePixelFormat, OsError("Couldn\'t find any available vsync extension")]) #23594

Open jankeromnes opened 5 years ago

jankeromnes commented 5 years ago

Hi Servo team! 👋

I'm trying to make a fully-automated Servo dev environment in the cloud using Gitpod, a bit like what Janitor already has.

I've made some progress on a dockerfile in my fork https://github.com/jankeromnes/servo, but I'm failing to run the compiled Servo in Xvfb.

FYI, I'm running Xvfb like this (with the extensions recommended in https://github.com/servo/servo/issues/7512#issuecomment-216665988):

Xvfb -screen 0 1920x1080x16 -ac -pn -noreset +extension RANDR +extension RENDER +extension GLX

Steps To Reproduce

  1. Open my Servo fork in Gitpod
  2. Build Servo with ./mach build -r (might get OOM-killed once -- just retry and it will work)
  3. Run ./mach run -r
  4. Open port 6080 in a Preview (it's the noVNC Remote Desktop view)

Expected Behavior

Servo starts and opens a browser window in the Remote Desktop view.

Actual Behavior

Servo doesn't start and instead prints this error in the Terminal:

Failed to create window.: CreationErrors([NoAvailablePixelFormat, OsError("Couldn\'t find any available vsync extension")]) (thread main, at src/libcore/result.rs:999) Servo exited with return value -11

But using headless mode e.g. with ./mach run -d -z https://www.wikipedia.org -x -o test.png does work.

It would be nice to get a full interactive Servo browser window. Would you have any ideas on how to fix this? (Maybe with some xpra tinkering?)

jankeromnes commented 5 years ago

Relevant IRC discussion:

18:01:40 SimonSapin> so this one is about "vsync" rather than XRANDR, but I would guess it’s also related to the config of your X11 server 18:01:50 janx> agreed 18:03:16 janx> I've also tried randomly enabling various Xvfb extensions that seemed related to "vsync", but without success so far (also, there is an "xpra" option called "vsync", but I don't know how to configure that yet) 18:03:42 SimonSapin> the message comes from https://github.com/rust-windowing/glutin/blob/master/glutin/src/api/glx/mod.rs#L454 18:04:18 jdm> presumably it was introduced in the glutin upgrade we did within the past month 18:04:20 SimonSapin> it’s looking for GLX_EXT_swap_control, GLX_MESA_swap_control, or GLX_SGI_swap_control 18:06:02 SimonSapin> servo also has a disable-vsync option, but I don’t find it in the command line arguments 18:06:33 SimonSapin> ah 18:06:46 SimonSapin> janx: try ./mach run --debug disable-vsync 18:06:58 jdm> janx: belay that, use -Z disable-vsync 18:07:02 jdm> --debug will do something different 18:07:12 SimonSapin> --help is lying 18:07:24 SimonSapin> -Z, --debug A comma-separated string of debug options. Pass help 18:07:26 SimonSapin> to show available options. 18:07:53 jdm> target/debug/servo --debug disable-vsync would work 18:07:56 SimonSapin> oh, maybe mach run’s --debug v.s. servo’s --debug? 18:07:57 jdm> but mach run hooks --debug 18:08:04 SimonSapin> right 18:08:24 SimonSapin> ./mach run -- --debug disable-vsync would also work I think 18:08:27 SimonSapin> but yeah -Z is easier

jankeromnes commented 5 years ago

I confirm that ./mach run -r -Z disable-vsync successfully works around this bug! 🎉

Still, I wonder if there is a way to get Xvfb to support one of these features:

SimonSapin> it’s looking for GLX_EXT_swap_control, GLX_MESA_swap_control, or GLX_SGI_swap_control

Maybe with virtualGL, as recommended in this StackExchange?