Bug 106719

Summary: Blocking on wl_display_dispatch_queue if egl swap interval is set to Zero
Product: Wayland Reporter: mohamed.sharaf-el-deen
Component: westonAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: medium CC: mohamed.sharaf-el-deen
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description mohamed.sharaf-el-deen 2018-05-30 09:58:19 UTC
Hello,
I am trying to run "weston-simple-egl" with command line parameter "-b Don't sync to compositor redraw (eglSwapInterval 0)" on weston with command line parameter "--use-pixman   Use the pixman (CPU) renderer".
This leads to the application "weston-simple-egl" blocking on wl_display_dispatch_queue() inside eglSwapBuffers(). After that the applicaiton stops updating forever.
From observations (running the app several times) seems like the application always blocks on the 4th call to eglSwapBuffers.

I can reproduce the problem with any program that uses eglSwapInterval(0).
I have strong feeling this should not happen especially because I am using egl swap interval of Zero.

Is this normal behavior?
Please let me know if there is any more information I could provide.

If I run weston without "--use-pixman" or weston-simple-egl without "-b" the problem does not happen.
Ubuntu version: 18.04 LTS (vanilla, with all updates installed)
Weston versions: 3.0.0 (the one I got installed using apt-get install)
				 4.0.90 (latest master as of 29.05.2018)

Callstack of weston-simple-egl from GDB:
#0  0x00007ffff6d1bbf9 in __GI___poll (fds=0x7fffffffd7a0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007ffff75a33f9 in ?? () from /usr/lib/x86_64-linux-gnu/libwayland-client.so.0
#2  0x00007ffff75a4a3c in wl_display_dispatch_queue () from /usr/lib/x86_64-linux-gnu/libwayland-client.so.0
#3  0x00007ffff5f04a03 in dri2_wl_swrast_commit_backbuffer (dri2_surf=0x5555558290d0) at ../../../src/egl/drivers/dri2/platform_wayland.c:1739
#4  dri2_wl_swrast_put_image2 (draw=0x555555968090, op=<optimized out>, x=<optimized out>, y=0, w=<optimized out>, h=0, stride=1024, data=0x7fffec5c2040 "", loaderPrivate=0x5555558290d0)
    at ../../../src/egl/drivers/dri2/platform_wayland.c:1869
#5  0x00007ffff5f04bed in dri2_wl_swrast_put_image (draw=<optimized out>, op=<optimized out>, x=<optimized out>, y=<optimized out>, w=<optimized out>, h=<optimized out>, data=0x7fffec5c2040 "", 
    loaderPrivate=0x5555558290d0) at ../../../src/egl/drivers/dri2/platform_wayland.c:1881
#6  0x00007ffff30d5066 in put_image (height=<optimized out>, width=<optimized out>, data=<optimized out>, dPriv=<optimized out>) at ../../../../../src/gallium/state_trackers/dri/drisw.c:72
#7  drisw_put_image (drawable=<optimized out>, data=<optimized out>, width=<optimized out>, height=<optimized out>) at ../../../../../src/gallium/state_trackers/dri/drisw.c:142
#8  0x00007ffff30d582a in drisw_present_texture (sub_box=0x0, ptex=0x5555559c6410, dPriv=0x555555968090) at ../../../../../src/gallium/state_trackers/dri/drisw.c:165
#9  drisw_copy_to_front (ptex=0x5555559c6410, dPriv=0x555555968090) at ../../../../../src/gallium/state_trackers/dri/drisw.c:182
#10 drisw_swap_buffers (dPriv=0x555555968090) at ../../../../../src/gallium/state_trackers/dri/drisw.c:209
#11 0x00007ffff5f02706 in dri2_wl_swrast_swap_buffers (drv=<optimized out>, disp=<optimized out>, draw=<optimized out>) at ../../../src/egl/drivers/dri2/platform_wayland.c:1891
#12 0x00007ffff5ef571e in eglSwapBuffers (dpy=0x555555767f90, surface=<optimized out>) at ../../../src/egl/main/eglapi.c:1254
#13 0x00005555555580c9 in redraw (callback=0x0, time=0, data=0x7fffffffd960) at clients/simple-egl.c:577
#14 main (argc=<optimized out>, argv=<optimized out>) at clients/simple-egl.c:930


Output when running weston:
[09:14:16.337] weston 3.0.0
               http://wayland.freedesktop.org
               Bug reports to: https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=weston&version=3.0.0
               Build: unknown (not built from git or tarball)
[09:14:16.338] Command line: weston --use-pixman
[09:14:16.338] OS: Linux, 4.15.0-22-generic, #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018, x86_64
[09:14:16.338] Starting with no config file.
[09:14:16.338] Output repaint window is 7 ms maximum.
[09:14:16.338] Loading module '/usr/lib/x86_64-linux-gnu/libweston-3/x11-backend.so'
[09:14:16.347] Using pixman renderer
[09:14:16.370] Registered plugin API 'weston_windowed_output_api_v1' of size 16
[09:14:16.371] Found visual, bits per value: 8, red_mask: 00ff0000, green_mask: 0000ff00, blue_mask: 000000ff
[09:14:16.371] Visual depth is 24
[09:14:16.371] Found format for depth 24, bpp: 32
[09:14:16.371] Will use x8r8g8b8 format for SHM surfaces
[09:14:16.372] x11 output 1024x600, window id 44040197
[09:14:16.372] Compositor capabilities:
               arbitrary surface rotation: yes
               screen capture uses y-flip: yes
               presentation clock: CLOCK_MONOTONIC_RAW, id 4
               presentation clock resolution: 0.000000001 s
[09:14:16.372] Loading module '/usr/lib/x86_64-linux-gnu/weston/desktop-shell.so'
[09:14:16.373] launching '/usr/lib/weston/weston-keyboard'
[09:14:16.373] launching '/usr/lib/weston/weston-desktop-shell'
Comment 1 Daniel Stone 2018-05-30 10:38:42 UTC
This is a bug which was fixed in Mesa; please upgrade Mesa to 17.3.8, 18.0.2, 18.1.0, or later. You can also ask Ubuntu to cherry-pick Mesa commit aa18a63512cc.

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.