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

Chromium Aw, Snap! error #3

Closed
Botspot opened this issue Mar 16, 2020 · 14 comments
Closed

Chromium Aw, Snap! error #3

Botspot opened this issue Mar 16, 2020 · 14 comments

Comments

@Botspot
Copy link
Owner

Botspot commented Mar 16, 2020

The existing Xephyr method does not allow for any form of OpenGL acceleration.
Therefore, programs that depend on OpenGL will not function properly.
Known programs are chromium-browser and firefox-esr. Other programs such as omxplayer will likely fail also, but have not been tested.

Any solutions that surface will be added here.

@Botspot
Copy link
Owner Author

Botspot commented Mar 16, 2020

Interestingly, running a non-OpenGL-accelerated version of Chromium does work in the Xephyr window.

@Botspot
Copy link
Owner Author

Botspot commented Jun 5, 2020

Even more interesting, running vdesktop on a Pi3 makes the default Chromium work.
Very strange.

@Botspot
Copy link
Owner Author

Botspot commented Jul 28, 2020

To everyone - (This means YOU) -
If you have any ideas about what's causing the Aw Snap error, please let me know! (on here or on the RPi forum thread)
If you find the problem, I'll compensate (pay) you for the info and make it well worth your time.

@krishenriksen
Copy link

krishenriksen commented Oct 6, 2020

TL;DR
This will give you OpenGL hardware acceleration in any client you choose to run with systemd-nspawn using the host GPU, as long as the client supports virgl.

Host
git clone https://gitlab.freedesktop.org/virgl/virglrenderer.git
cd virglrenderer
meson --prefix=/usr/local -Dbuildtype=release build
cd build
sudo ninja install

start service on Host
/usr/local/bin/virgl_test_server --use-gles

Modify 'nspawn' to connect to external X server aka host
--bind=/tmp/.X11-unix
--bind=/tmp/.virgl_test

The binding of .X11-unix allows the client to run X applications on the host without Xephyr, but still have to export DISPLAY=0
If using Xephyr bind '.virgl_test' rw and export DISPLAY=:1

----- virgl start ----- ( Note the mesa version might already come with 'virgl', but might run better with upgrade )
on client
sudo apt-get install libxcb-randr0-dev libxrandr-dev
libxcb-xinerama0-dev libxinerama-dev libxcursor-dev
libxcb-cursor-dev libxkbcommon-dev xutils-dev
xutils-dev libpthread-stubs0-dev libpciaccess-dev
libffi-dev x11proto-xext-dev libxcb1-dev libxcb-*dev
bison flex libssl-dev libgnutls28-dev x11proto-dri2-dev
x11proto-dri3-dev libx11-dev libxcb-glx0-dev
libx11-xcb-dev libxext-dev libxdamage-dev libxfixes-dev
libva-dev x11proto-randr-dev x11proto-present-dev
libclc-dev libelf-dev git build-essential mesa-utils
libvulkan-dev ninja-build libvulkan1 python-mako
libdrm-dev libxshmfence-dev libxxf86vm-dev
python3-mako python3-pip llvm-dev

sudo pip3 install meson

git clone https://gitlab.freedesktop.org/apinheiro/mesa.git mesa
cd mesa
meson --prefix=/usr -Dosmesa=gallium -Dplatforms=x11,drm,surfaceless -Ddri-drivers='' -Dgallium-drivers=swrast,virgl -Dbuildtype=release build
cd build
ninja -j4
sudo ninja install
----- virgl end -----

compile systemd to make box86 and chromium work, as it seems Chromium also need more exposed CPU
functionality via kernel syscall to work with Virgl

sudo apt install gperf libcap-dev
git clone https://github.com/systemd/systemd.git
meson --prefix=/usr/local -Dbuildtype=release build
cd build && ninja -j4

Note do not install systemd, we just need systemd-nspawn

edit 'nspawn' systemd-nspawn command to:
sudo /home/pi/Development/systemd/build/systemd-nspawn ( or where you build systemd )

Add the following in .bashrc on client
#export DISPLAY=:0 # for X host
export DISPLAY=:1 # for Xephyr
export LIBGL_ALWAYS_SOFTWARE=1
export GALLIUM_DRIVER=virpipe

Note that if virgl_test_server crash, one will have to restart the client, as the binding of '.virgl_test' unix socket becomes invalid.

For fixing hardware acceleration in Chromium add the following
chromium-browser --ignore-gpu-blacklist --disable-gpu-compositing

@Botspot

Screenshot_2020-10-06_05-53-51

@Botspot
Copy link
Owner Author

Botspot commented Oct 6, 2020

Wow, this is crazy! XD
Now I'd like to minimize host dependencies, so would there happen to be an alternative way, which may not allow for OpenGL, but would allow Chromium to load pages through pure LXDE? (like it somehow did on the Pi3)

OK, I've started following your steps:

meson --prefix=/usr/local -Dbuildtype=release build
The Meson build system
Version: 0.52.1
Source dir: /home/pi/virglrenderer
Build dir: /home/pi/virglrenderer/build
Build type: native build
Project name: virglrenderer
Project version: 0.8.2
C compiler for the host machine: cc (gcc 8.3.0 "cc (Raspbian 8.3.0-6+rpi1) 8.3.0")
C linker for the host machine: GNU ld.bfd 2.31.1
Host machine cpu family: arm
Host machine cpu: armv7l
Compiler for C supports arguments -Werror=implicit-function-declaration: YES 
Compiler for C supports arguments -Werror=missing-prototypes: YES 
Compiler for C supports arguments -Wmissing-prototypes: YES 
Compiler for C supports arguments -Werror=int-to-pointer-cast: YES 
Compiler for C supports arguments -Wno-overlength-strings -Woverlength-strings: YES 
Compiler for C supports arguments -fvisibility=hidden: YES 
Program python3 found: YES (/usr/bin/python3)
Found pkg-config: /usr/bin/pkg-config (0.29)
Found CMake: /usr/bin/cmake (3.13.4)
Run-time dependency libdrm found: NO (tried pkgconfig and cmake)

meson.build:77:0: ERROR: Dependency "libdrm" not found, tried pkgconfig and cmake

A full log can be found at /home/pi/virglrenderer/build/meson-logs/meson-log.txt

That seems strange to me, as apt says libdrm2 is installed. Any ideas?

@krishenriksen
Copy link

The only host dependencies is virglrenderer. The rest goes in client, and you might not even need to update mesa, as it sometimes comes with virgl already.

meson.build:77:0: ERROR: Dependency "libdrm" not found, tried pkgconfig and cmake
libdrm-dev

@Botspot
Copy link
Owner Author

Botspot commented Oct 7, 2020

Libdrm-dev appeared to work.
Now I'm stuck at:

Run-time dependency epoxy found: NO (tried pkgconfig and cmake)

meson.build:79:0: ERROR: Dependency "epoxy" not found, tried pkgconfig and cmake

@Botspot
Copy link
Owner Author

Botspot commented Oct 7, 2020

OK after installing libexpoy-dev, I get this from the meson command:

Dependency epoxy found: NO found '1.5.3' but need: '>= 1.5.4'
Found CMake: /usr/bin/cmake (3.13.4)
Run-time dependency epoxy found: NO (tried cmake)

meson.build:79:0: ERROR: Invalid version of dependency, need 'epoxy' ['>= 1.5.4'] found '1.5.3'.

So not only do I need epoxy, I need a later version than what's in the repositories.

@krishenriksen
Copy link

Go down to version 7 of virglrenderer maybe.

In the virglrenderer folder do git checkout virglrenderer-0.7.0

@Botspot
Copy link
Owner Author

Botspot commented Oct 7, 2020

OK I did the git checkout virglrenderer-0.7.0.
Now what?

pi@raspberrypi:~/virglrenderer $ meson --prefix=/usr/local -Dbuildtype=release build

ERROR: Neither directory contains a build file meson.build.

@krishenriksen
Copy link

Well it seems there are no meson in that version, so resort to the good old make.

./autogen.sh --prefix=/usr/local

@Botspot
Copy link
Owner Author

Botspot commented Oct 8, 2020

Before doing that, I figured I would try to trick meson. I would find the file mandating version 1.5.4 of Epoxy be installed, and manually change the file to 1.5.3.

It may work, it may not.

Edited /home/pi/virglrenderer/meson.build, and every mention of '1.5.4' was changed to '1.5.3'.

Now the Meson command succeeded!

@Botspot
Copy link
Owner Author

Botspot commented Oct 8, 2020

...But sudo ninja install did not succeed.

sudo ninja install
[4/53] Compiling C object 'src/gallium...llium@sta/auxiliary_util_u_debug.c.o'.
../src/gallium/auxiliary/util/u_debug.c: In function ‘str_has_option’:
../src/gallium/auxiliary/util/u_debug.c:239:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
             if (str-start == name_len &&
                           ^~
[6/53] Compiling C object 'src/gallium...allium@sta/auxiliary_util_u_math.c.o'.
../src/gallium/auxiliary/util/u_math.c: In function ‘util_fpstate_set’:
../src/gallium/auxiliary/util/u_math.c:130:27: warning: unused parameter ‘mxcsr’ [-Wunused-parameter]
 util_fpstate_set(unsigned mxcsr)
                  ~~~~~~~~~^~~~~
[47/53] Compiling C object 'src/25a6634@@virgl@sta/vrend_renderer.c.o'.
FAILED: src/25a6634@@virgl@sta/vrend_renderer.c.o 
cc -Isrc/25a6634@@virgl@sta -Isrc -I../src -I../src/gallium/include -I../src/gallium/auxiliary -I../src/gallium/auxiliary/util -I. -I../ -I/usr/include/libdrm -fdiagnostics-color=always -DNDEBUG -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -O3 -DHAVE_CONFIG_H=1 -D_GNU_SOURCE=1 -DVIRGL_RENDERER_UNSTABLE_APIS -Werror=implicit-function-declaration -Werror=missing-prototypes -Wmissing-prototypes -Werror=int-to-pointer-cast -Wno-overlength-strings -fvisibility=hidden -fPIC -pthread -MD -MQ 'src/25a6634@@virgl@sta/vrend_renderer.c.o' -MF 'src/25a6634@@virgl@sta/vrend_renderer.c.o.d' -o 'src/25a6634@@virgl@sta/vrend_renderer.c.o' -c ../src/vrend_renderer.c
../src/vrend_renderer.c: In function ‘vrend_renderer_resource_allocate_texture’:
../src/vrend_renderer.c:6684:10: error: implicit declaration of function ‘glEGLImageTargetTexStorageEXT’; did you mean ‘glEGLImageTargetTexture2DOES’? [-Werror=implicit-function-declaration]
          glEGLImageTargetTexStorageEXT(gr->target, (GLeglImageOES) image_oes, NULL);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          glEGLImageTargetTexture2DOES
cc1: some warnings being treated as errors
[48/53] Compiling C object 'src/25a6634@@virgl@sta/vrend_shader.c.o'.
ninja: build stopped: subcommand failed.

@Botspot
Copy link
Owner Author

Botspot commented Nov 2, 2020

Update: Kreal helped me out a lot, and by using a compiled later version of systemd-nspawn, combined with a virgl server, now vdesktop is fully hardware accelerated.
See the RPi forum post: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=288093

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

No branches or pull requests

2 participants