[vlc-devel] [PATCH v2 1/1] wayland: add background surface and center video

Alexandre Janniaux ajanni at videolabs.io
Tue Feb 26 17:35:12 CET 2019

I would say that the error is on QtWayland instead, especially
when Qt can't check every surface created by clients, like video
subsurface or even SPU subsurface.

wl_pointer::enter event can literally reference any surface
belonging to the same client and it is not good-citizen to cast
this surface into its own wrapper type without checking that you
own it first.

 From that situation, either we ignore these events or we can't
make it works until at least Qt > 5.12.
The new Qt interface might also bring some new possible hack
which would be more doable directly in Qt. For example, as the
video would be behind the interface, maybe it is possible to
collect every events before they reach the video display.

Here is the stacktrace:

Thread 5 "vlc" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd4ebe700 (LWP 22694)]
0x00007fffd7b52340 in QPlatformWindow::window() const ()
    from /usr/lib/libQt5Gui.so.5
    (gdb) bt
#0  0x00007fffd7b52340 in QPlatformWindow::window() const ()
     at /usr/lib/libQt5Gui.so.5
#1  0x00007fffd4cf379e in 
_enter(unsigned int, wl_surface*, int, int) ()
     at /usr/lib/libQt5WaylandClient.so.5
#2  0x00007fffd6f286d0 in ffi_call_unix64 () at /usr/lib/libffi.so.6
#3  0x00007fffd6f280a0 in ffi_call () at /usr/lib/libffi.so.6
#4  0x00007ffff4253f5f in  () at /usr/lib/libwayland-client.so.0
#5  0x00007ffff42506ca in  () at /usr/lib/libwayland-client.so.0
#6  0x00007ffff4251c0c in wl_display_dispatch_queue_pending ()
     at /usr/lib/libwayland-client.so.0
#7  0x00007fffd4cf7544 in 
QtWaylandClient::QWaylandDisplay::flushRequests() ()
     at /usr/lib/libQt5WaylandClient.so.5
#8  0x00007fffd77ba87c in QMetaObject::activate(QObject*, int, int, 
void**) ()
     at /usr/lib/libQt5Core.so.5
#9  0x00007fffd77c658a in QSocketNotifier::activated(int, 
ateSignal) () at /usr/lib/libQt5Core.so.5
#10 0x00007fffd77c68e2 in QSocketNotifier::event(QEvent*) ()
     at /usr/lib/libQt5Core.so.5
#11 0x00007ffff44f1e24 in QApplicationPrivate::notify_helper(QObject*, 
     () at /usr/lib/libQt5Widgets.so.5
#12 0x00007ffff44f96e1 in QApplication::notify(QObject*, QEvent*) ()
     at /usr/lib/libQt5Widgets.so.5
     --Type <RET> for more, q to quit, c to continue without paging--
#13 0x00007fffd778fe99 in QCoreApplication::notifyInternal2(QObject*, 
     () at /usr/lib/libQt5Core.so.5
#14 0x00007fffd77e6966 in  () at /usr/lib/libQt5Core.so.5
#15 0x00007fffd6f98a2f in g_main_context_dispatch ()
     at /usr/lib/libglib-2.0.so.0
#16 0x00007fffd6f9a5e9 in  () at /usr/lib/libglib-2.0.so.0
#17 0x00007fffd6f9a62e in g_main_context_iteration ()
     at /usr/lib/libglib-2.0.so.0
#18 0x00007fffd77e5ce9 in 
:ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#19 0x00007fffd778eb2c in 
) () at /usr/lib/libQt5Core.so.5
#20 0x00007fffd7796e36 in QCoreApplication::exec() ()
     at /usr/lib/libQt5Core.so.5
#21 0x00007ffff4af445f in Thread(void*) (obj=0x555555657800)
     at ../../modules/gui/qt/qt.cpp:627
#22 0x00007ffff7c26a9d in start_thread () at /usr/lib/libpthread.so.0
#23 0x00007ffff7b56b23 in clone () at /usr/lib/libc.so.6

And the relevant QtWayland code in 

void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct 
wl_surface *surface,
                                                  wl_fixed_t sx, 
wl_fixed_t sy)
     if (!surface)

     QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface);
     mFocus = window;
     mSurfacePos = QPointF(wl_fixed_to_double(sx), 
     mGlobalPos = window->window()->mapToGlobal(mSurfacePos.toPoint());

On 2019-02-26 16:56, Rémi Denis-Courmont wrote:
> Le tiistaina 26. helmikuuta 2019, 17.49.32 EET Alexandre Janniaux a 
> écrit :
>> Would you prefer that I create a separate patch to set the input
>> region on the parent surface first?
> Not only the solution to that problem belongs in a separate patch, but 
> it
> belongs in the Qt module.
> You cannot assume that the SHM display is used. In fact, it typically 
> is not
> since EGL is essentially better nowadays. And you cannot assume that 
> EGL does
> not create subsurfaces just because current Mesa does not (?), or that 
> we
> won't have a third display plugin.

More information about the vlc-devel mailing list