Should I always add wl_display_sync() before wl_display_dispatch_queue()?

Rafael Antognolli rafael.antognolli at intel.com
Tue Oct 29 19:10:34 CET 2013


On Mon, Oct 28, 2013 at 10:06:47PM -0500, Jason Ekstrand wrote:
> On Mon, Oct 28, 2013 at 9:39 PM, Zhao, Halley <halley.zhao at intel.com> wrote:
> 
> >  Video player use frame callback on an event queue, sometimes there is
> > synchronization issue.****
> >
> > After looked at other usage of event queue, I found:****
> >
> > In order to avoid blocking by wl_display_dispatch_queue(), a padding
> > callback of wl_display_sync is added on purpose.****
> >
> > Is my understanding correct?****
> >
> > Here is the changes:****
> >
> >
> > https://gitorious.org/halley-test/gstreamer-vaapi/commit/9846c75e7a2bb223900457beffc3384c77cc5075
> > ****
> >
> > ** **
> >
> > ** **
> >
> > however, with or without the above change, I found there is still hangs in
> > my player (efl based) : ****
> >
> >
> > https://gitorious.org/gst-plugins-vaapi/simple-player/source/87837fc1b4c11d7a33142c7d4fac1225d8973b80
> > :****
> >
> > it seems to be ECore issue during wl_display_dispatch_pending():
> >
> 
> The short answer is that you shouldn't have to.  Also, sitting in a
> round-trip loop is asking for bad performance if the CPU is under load.
> 
> If I had to take a guess, I think it's likely that ecore and gstreamer are
> fighting over the file descriptor.  I don't know the codebase of either,
> but you have to be careful with handing it back and forth.  In particular,
> take a look at wl_display_prepare_read:
> 
> http://cgit.freedesktop.org/wayland/wayland/tree/src/wayland-client.c#n1078
> 
> I hope that's helpful,
> --Jason Ekstrand

Hmm... in fact, Ecore is not using wl_display_prepare_read. I think
Christopher did that in some branch, but we didn't fix some bug that it
caused, and then we probably didn't integrate it. I'll try to take a
look at that again.

BTW, Halley, I see that gstreamer-vaapi connects to wayland and uses its
own wl_display. I am not sure what happens in this case. Would it behave
as another client, or it should be the same client as the rest of the
app using EFL?

And I am able to run the eflplayer that you provided, but I don't see
any freeze/block. How can I trigger it? I just played a simple mpeg2
video, it created a new toplevel surface and displayed things there
(probably if I set the MOBILE define, it will use a subsurface instead).

> > ****
> >
> > ** **
> >
> > Rafael:****
> >
> > Do you think it is an ECore issue?****
> >
> > ** **
> >
> > // wl_display_sync callback with wl_display_dispatch_pending()****
> >
> > (gdb) bt****
> >
> > #0  0xb7c4ddd0 in _ecore_wl_input_cb_keyboard_enter () from
> > /lib/libecore_wayland.so.1****
> >
> > #1  0xb6f16666 in ffi_call_SYSV () from /lib/libffi.so.6****
> >
> > #2  0xb6f163eb in ffi_call () from /lib/libffi.so.6****
> >
> > #3  0xb79a9ae5 in wl_closure_invoke () from /lib/libwayland-client.so.0***
> > *
> >
> > #4  0xb79a74c2 in dispatch_queue () from /lib/libwayland-client.so.0****
> >
> > #5  0xb79a803e in wl_display_dispatch_queue_pending () from
> > /lib/libwayland-client.so.0****
> >
> > #6  0xb79a8162 in wl_display_dispatch_pending () from
> > /lib/libwayland-client.so.0****
> >
> > #7  0xb3ca72a6 in gst_vaapi_window_wayland_sync (window=0x87d2d50) at
> > gstvaapiwindow_wayland.c:162****
> >
> > #8  gst_vaapi_window_wayland_render (window=0x87d2d50, surface=0xb0a02860,
> > src_rect=0xb017dbd0, dst_rect=0x88bdbe0, flags=0) at
> > gstvaapiwindow_wayland.c:514****
> >
> > #9  0xb3c5a2fb in gst_vaapi_window_put_surface (window=0x87d2d50,
> > surface=surface at entry=0xb0a02860, src_rect=0xb017dbd0, src_rect at entry=0x0,
> > dst_rect=<optimized out>, dst_rect at entry=0x88bdbe0, ****
> >
> >     flags=flags at entry=0) at gstvaapiwindow.c:435****
> >
> > #10 0xb3ccc1e1 in gst_vaapisink_put_surface (flags=0,
> > surface_rect=<optimized out>, surface=0xb0a02860, sink=0x88bd958) at
> > gstvaapisink.c:1150****
> >
> > ** **
> >
> > If I remove wl_display_dispatch_pending in frame callback sync:****
> >
> > There is backtrace, ****
> >
> > // wl_display_sync callback with wl_display_dispatch_pending()****
> >
> > (gdb) bt****
> >
> > #0  0xb7c4ddd0 in _ecore_wl_input_cb_keyboard_enter () from
> > /lib/libecore_wayland.so.1****
> >
> > #1  0xb6f16666 in ffi_call_SYSV () from /lib/libffi.so.6****
> >
> > #2  0xb6f163eb in ffi_call () from /lib/libffi.so.6****
> >
> > #3  0xb79a9ae5 in wl_closure_invoke () from /lib/libwayland-client.so.0***
> > *
> >
> > #4  0xb79a74c2 in dispatch_queue () from /lib/libwayland-client.so.0****
> >
> > #5  0xb79a803e in wl_display_dispatch_queue_pending () from
> > /lib/libwayland-client.so.0****
> >
> > #6  0xb79a8162 in wl_display_dispatch_pending () from
> > /lib/libwayland-client.so.0****
> >
> > #7  0xb3ca72a6 in gst_vaapi_window_wayland_sync (window=0x87d2d50) at
> > gstvaapiwindow_wayland.c:162****
> >
> > #8  gst_vaapi_window_wayland_render (window=0x87d2d50, surface=0xb0a02860,
> > src_rect=0xb017dbd0, dst_rect=0x88bdbe0, flags=0) at
> > gstvaapiwindow_wayland.c:514****
> >
> > #9  0xb3c5a2fb in gst_vaapi_window_put_surface (window=0x87d2d50,
> > surface=surface at entry=0xb0a02860, src_rect=0xb017dbd0, src_rect at entry=0x0,
> > dst_rect=<optimized out>, dst_rect at entry=0x88bdbe0, ****
> >
> >     flags=flags at entry=0) at gstvaapiwindow.c:435****
> >
> > #10 0xb3ccc1e1 in gst_vaapisink_put_surface (flags=0,
> > surface_rect=<optimized out>, surface=0xb0a02860, sink=0x88bd958) at
> > gstvaapisink.c:1150****
> >
> > ** **
> >
> > // no wl_display_sync callback witt wl_display_displatch_pending****
> >
> > #0  0xb7c4ddd0 in _ecore_wl_input_cb_keyboard_enter () from
> > /lib/libecore_wayland.so.1****
> >
> > #1  0xb6f16666 in ffi_call_SYSV () from /lib/libffi.so.6****
> >
> > #2  0xb6f163eb in ffi_call () from /lib/libffi.so.6****
> >
> > #3  0xb79a9ae5 in wl_closure_invoke () from /lib/libwayland-client.so.0***
> > *
> >
> > #4  0xb79a74c2 in dispatch_queue () from /lib/libwayland-client.so.0****
> >
> > #5  0xb79a803e in wl_display_dispatch_queue_pending () from
> > /lib/libwayland-client.so.0****
> >
> > #6  0xb79a8162 in wl_display_dispatch_pending () from
> > /lib/libwayland-client.so.0****
> >
> > #7  0xb3ca72a6 in gst_vaapi_window_wayland_sync (window=0x87d2950) at
> > gstvaapiwindow_wayland.c:162****
> >
> > #8  gst_vaapi_window_wayland_render (window=0x87d2950, surface=0xb0a02860,
> > src_rect=0xb017dbd0, dst_rect=0x88bd850, flags=0) at
> > gstvaapiwindow_wayland.c:514****
> >
> > #9  0xb3c5a2fb in gst_vaapi_window_put_surface (window=0x87d2950,
> > surface=surface at entry=0xb0a02860, src_rect=0xb017dbd0, src_rect at entry=0x0,
> > dst_rect=<optimized out>, dst_rect at entry=0x88bd850, ****
> >
> >     flags=flags at entry=0) at gstvaapiwindow.c:435****
> >
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> >
> >


More information about the wayland-devel mailing list