WebGL in headless_shell

248 views
Skip to first unread message

Artem

unread,
Jul 23, 2016, 3:53:17 PM7/23/16
to headless-dev
Hello there! I've been trying to build headless_shell with WebGL capabilities but with little success. I've build libosmesa with:

ninja -C out/Debug osmesa

and tried to run headless_shell with:

./headless_shell
 
--remote-debugging-port=9222 \
 
--use-gl=osmesa \
 
--enable-webgl \
 
--ignore-gpu-blacklist \
 
"chrome://gpu"

and still see: "WebGL: unavailable". I've also attempted to build llvmpipe and install it but I don't know how to verify that it's being used instead of the softpipe or another rendering engine.

Has anyone gotten this to work? If so, could you post detailed instructions for getting this working? Or am I wasting my time and have to wait for this to be supported? 

Any help would be greatly appreciated!

Alex Clarke

unread,
Jul 25, 2016, 4:45:14 AM7/25/16
to Artem, headless-dev
I'm not sure if WebGL can be currently made to work with headless_lib.  We do intend to make it work, you might want to star this bug: https://bugs.chromium.org/p/chromium/issues/detail?id=617551

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To post to this group, send email to headle...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/632851b5-dc44-4900-b7a0-1a28d3bc9325%40chromium.org.

Artem Titoulenko

unread,
Jul 25, 2016, 9:26:36 AM7/25/16
to Alex Clarke, headless-dev
From that issue, apparently a software GL backend through mesa and swiftshader is already implemented (https://codereview.chromium.org/1548893004/). This is what led me to believe that it's possible but that I'm missing something. If Chromium can already use mesa for WebGL, why can't headless_shell?


_____________________________
From: Alex Clarke <alexc...@google.com>
Sent: Monday, July 25, 2016 4:45 AM
Subject: Re: WebGL in headless_shell
To: Artem <artem.ti...@gmail.com>
Cc: headless-dev <headle...@chromium.org>

Sami Kyostila

unread,
Jul 26, 2016, 10:34:45 AM7/26/16
to Artem Titoulenko, Alex Clarke, headless-dev
Turns out this was because we're unconditionally turning off GPU support. I've got a patch to make that configurable[1], and with it WebGL seems to work:

$ headless_shell --screenshot https://www.khronos.org/registry/webgl/sdk/demos/google/san-angeles/

screenshot.png

I'll need to find out if this also makes the compositor use software GL for compositing (which is slower than the regular software path), but at least it makes things work for now.

- Sami

[1] https://codereview.chromium.org/2184763002/

Sami Kyostila

unread,
Jul 26, 2016, 10:37:15 AM7/26/16
to Artem Titoulenko, Alex Clarke, headless-dev

Artem

unread,
Jul 26, 2016, 11:34:32 AM7/26/16
to headless-dev, artem.ti...@gmail.com, alexc...@google.com
This looks awesome, Sami! Thank you for investigating and making the change.

Is this going to work by building both headless_shell and osmesa and having the libosmesa.so in the same dir as the headless_shell binary? Or are there special deps/build args that need to be turned on in order for the software renderer to be used?

Sami Kyostila

unread,
Jul 26, 2016, 12:54:01 PM7/26/16
to Artem, headless-dev, alexc...@google.com
I checked that osmesa is built as a dependency of headless already, so this should work out of the box.

- Sami

Zack Chapple

unread,
Aug 1, 2016, 2:08:41 PM8/1/16
to headless-dev, artem.ti...@gmail.com, alexc...@google.com
I had issues around this as well and opened https://bugs.chromium.org/p/chromium/issues/detail?id=633207  

In order to get it to work I had to manually install osmesa and copy the file into the built headless app. 
Reply all
Reply to author
Forward
0 new messages