Bug 86701 - [regression] weston-simple-egl not running anymore inside qemu
Summary: [regression] weston-simple-egl not running anymore inside qemu
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: EGL (show other bugs)
Version: 10.4
Hardware: All All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-25 13:44 UTC by Javier Jardón
Modified: 2015-05-24 12:36 UTC (History)
6 users (show)

See Also:
i915 platform:
i915 features:


Attachments
backtrace of weston-desktop-shell (6.90 KB, text/plain)
2015-05-12 11:34 UTC, nerdopolis1
Details

Description Javier Jardón 2014-11-25 13:44:31 UTC
Hi,

after the removal of the --enable-gallium-egl option [1] Im unable to run this egl demo.

The discussion of this removal was discussed here: [2]

[1] http://git.baserock.org/cgi-bin/cgit.cgi/delta/mesa.git/commit/?h=10.4&id=c46c551c56f78c6bf9e63524c89478695fc4f525

[2] http://lists.freedesktop.org/archives/mesa-dev/2014-November/070204.html
Comment 1 Pekka Paalanen 2014-11-25 13:52:51 UTC
egl_gallium.so was able to use llvmpipe and direct that rendering to wl_shm based buffers, and therefore does not need any EGL support from the compositor.

egl_dri2 does not implement that.

Could egl_dri2 be worked to implement it? What other options there are?

If someone suggests VGEM, then that will require special support in the compositor, and I will ask how compositors are supposed to support that and what do you do on systems with kernels that don't support VGEM.
Comment 2 Link Mauve 2014-12-17 19:59:06 UTC
This removal prevents any application from using llvmpipe on wayland, even with LIBGL_ALWAYS_SOFTWARE.

It still works fine on Xwayland and egl_dri2, but this isn’t a suitable fallback.

Imo the best fix would be to wire llvmpipe to egl_dri2 on wayland too.
Comment 3 Pekka Paalanen 2014-12-18 07:42:12 UTC
Actually we seem to have an even older report of a similar thing: bug #64045
Comment 4 nerdopolis1 2014-12-23 13:08:00 UTC
That other report seems to be when there was a bug in software rendering that ended up being fixed, as software rendering was working mostly until it was dropped. Without software rendering, many clients don't work well on VirtualBox and fbdev. (weston-desktop-shell appears to be limited to 16 bit color even) I don't know if the --use-gl option for Weston's fbdev backend is meant to work withou libhybris? 

Unfortunantly, VirtualBox probably isn't going to support running drm-backend properly for a long time, plus a software fallback would be nice for fallback some hardware platforms
Comment 5 Pekka Paalanen 2014-12-24 08:06:16 UTC
(In reply to nerdopolis1 from comment #4)
> I don't know if the --use-gl option for Weston's fbdev backend
> is meant to work withou libhybris? 

No, I don't think that will ever work on a FOSS driver stack. It's just for proprietary stacks that do not bother with proper DRM drivers, hybris or not.

Weston's compositing on a software rendered GLESv2 would be fairly useless since Pixman renderer exists. Besides, even if Weston used sw GL, it still wouldn't improve the situation for apps at all.
Comment 6 nerdopolis1 2015-02-01 01:31:21 UTC
Any updates on this one?
Comment 7 Pekka Paalanen 2015-02-24 08:17:02 UTC
Today I fetched the Mesa master branch and grepped for wl_shm. The only hits are in src/gallium/state_trackers/egl/wayland/native_shm.c.

Therefore there is no implementation for egl_dri2 yet, and the issue persists.
Comment 8 nerdopolis1 2015-04-11 01:08:18 UTC
Seems that there is still no way for running weston-simple-egl or weston-gears on software rendering?
Comment 9 Marko Moberg 2015-04-13 12:48:18 UTC
SW rastering for EGL is really an important feature for us. We have an embedded device with no GPU and no display. We are planning on using Wayland/Weston with RDP protocol to display OpenGl graphics over network connection. Current MESA doesn't seem to support this functionality.
Comment 10 Manuel Bachmann 2015-04-13 17:25:28 UTC
This is a very important feature for us, too. Reading the upstream thread, it seems there were legitimate reasons to remove egl-gallium, but bringing egl_dri2 to feature parity before doing that was ignored.

This needs insight from a proficient developer. Will try to help but have few experience personally. Distro-side, we will probably stick to an older Mesa until a solution is found.
Comment 11 Marek Olšák 2015-04-13 17:32:23 UTC
Is it the EGL_WL_bind_wayland_display extension that you'd like to have or something else? I'd like to understand exactly what is missing.
Comment 12 Daniel Stone 2015-04-13 18:00:11 UTC
(In reply to Marek Olšák from comment #11)
> Is it the EGL_WL_bind_wayland_display extension that you'd like to have or
> something else? I'd like to understand exactly what is missing.

Client-side support for swrast in src/egl/drivers/dri2/platform_wayland.c.

platform_x11.c has a whole section (see dri2_initialize_x11_swrast) with alternate codepaths to support swrast. platform_wayland totally lacks this, so not only does $LIBGL_ALWAYS_SOFTWARE do nothing, but on Wayland servers lacking hardware GL support (e.g. EGL_WL_bind_wayland_display), there is no fallback to the wl_shm interface. Implementing this is the minimum requirement.

Supporting swrast-on-VGEM (EGL_WL_bind_wayland_display support when running on swrast; client-side support for allocating VGEM backing buffers for swrast) would also allow us to cut down on alternate codepaths a little, but probably doesn't buy us too much.
Comment 13 Daniel Stone 2015-04-13 18:13:19 UTC
Two reasons why VGEM is less helpful on Wayland than X11:
  - MIT-SHM on X forces you to allocate out of POSIX/SysV (forget which) SHM regions, i.e. shmat() and friends; this is not true of wl_shm, which lets you specify an arbitrary fd, as long as it's mmap()able
  - MIT-SHM requires you to schedule a server-side copy out of the SHM Image to a Drawable (Pixmap or Window), whereas DRI2 adds the notion of flips and exchanging storage; this is not true of wl_shm, as the wl_surface/wl_buffer model natively supports buffer exchange

So I think just the relatively obvious wl_shm approach - which is less divergent from the existing platform_wayland.c code than platform_x11's, given that it shares the same buffer<->surface relationship, only diverging at buffer allocation - will do just fine.
Comment 14 Pekka Paalanen 2015-05-08 06:00:45 UTC
Patch series posted by Axel Davy:
http://lists.freedesktop.org/archives/mesa-dev/2015-May/083254.html
Reviews combined from Daniel Stone and Dave Airlie cover it all.
Comment 15 Pekka Paalanen 2015-05-12 07:15:05 UTC
The patch series has landed in Mesa, particularly:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cdcfe48fb0431184fabb40aa5a244d086f551df5

Feel free to test how the software GL on Wayland with Mesa master branch works.
Comment 16 nerdopolis1 2015-05-12 11:34:09 UTC
Created attachment 115713 [details]
backtrace of weston-desktop-shell

backtrace of weston-desktop-shell on qemu with Weston running under the Framebuffer backend. Unfortunately weston-desktop-shell hangs
Comment 17 Pekka Paalanen 2015-05-12 11:52:28 UTC
Adding Axel Davy to CC.
Comment 18 nerdopolis1 2015-05-12 22:16:04 UTC
Hi. I realized that the hang happens when I hover over an icon on the desktop shell, and it tries to show a tooltip

Output of weston running with WAYLAND_DEBUG=server
http://pastebin.com/0aQGBLFH

Only weston-desktop-shell hangs. If I get another client to run before weston-desktop-shell hangs, that client stays running.
Comment 19 nerdopolis1 2015-05-12 23:41:54 UTC
As suggested as a test, before running Weston, I exported 
vblank_mode=0

And this prevents the hangs
Comment 20 Pekka Paalanen 2015-05-13 06:44:31 UTC
(In reply to nerdopolis1 from comment #18)
> Hi. I realized that the hang happens when I hover over an icon on the
> desktop shell, and it tries to show a tooltip
> 
> Output of weston running with WAYLAND_DEBUG=server
> http://pastebin.com/0aQGBLFH

Please don't put pastebin links here, they tend go bad over time. Much better to attach a file.

> Only weston-desktop-shell hangs. If I get another client to run before
> weston-desktop-shell hangs, that client stays running.

*sigh* I wish we had a way to differentiate between clients in WAYLAND_DEBUG=server output... (there are several different clients interleaved in the trace, but I expected that)

Ok, I see what happens.

The tooltip is a sub-surface (due to migration to xdg-shell). Sub-surfaces start in synchronized mode, and the mode is never changed here. That means the frame callback cannot trigger, until the parent wl_surface is committed. Toytoolkit or weston-desktop-shell does not commit the parent before EGL starts waiting for the sub-surface's frame callback, which causes the hang.

The immediate thing to investigate is whether EGL even gives the app a chance to commit the parent wl_surface (which also is a EGLSurface when you use cairo-egl). If the answer is yes, there is nothing wrong in Mesa, and the bug is in toytoolkit.

Whether the answer is yes or no, this issue needs to be filed as a separate bug against Weston's toytoolkit.

As fixing the toytoolkit is very low priority (and I would assume hardware accelerated GL to be broken the same way), the solution for end users is: do not configure Weston using --with-cairo=gl nor --with-cairo=glesv2; use the default --with-cairo=image.

A quick'n'dirty fix would be to set the tooltip sub-surface to desync mode when it's created. That should avoid the hang, but it may be arguably a wrong solution. One must be able to use the synchronized mode even with EGL surfaces, so making sure it can work is essential.

When filing a new bug, please copy my explanation and attach again the same protocol dump.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.