[Mesa-dev] [PATCH 1/2] loader_dri3: Wait for pending swaps to complete before drawable_fini.

Roman Gilg subdiff at gmail.com
Sat May 5 23:22:43 UTC 2018


On Sat, May 5, 2018 at 8:50 PM, Mario Kleiner
<mario.kleiner.de at gmail.com> wrote:
> Thanks. Can you see if you get any freezes in kwin_x11 by "violent
> alt-tabbing" with patch 1? I've seen two such freezes within 8 hours
> of normal use yesterday, each occuring when i alt-tabbed (normally)
> and the switcher side panel moved out from the left. Desktop was
> mostly blocked then, i assume it was kwin_x11 that got stuck. When
> VT-switching to the console and attaching gdb to kwin_x11 the
> backtrace showed it blocked in the loader_dri3_swapbuffer_barrier()
> from patch 1. I don't know if that was the cause of the freeze, or if
> something unrelated was going wrong and kwin just happens to block
> there when one VT switches away from the X-Server while kwin does its
> thing. Freezes happened both with compositing enabled and disabled.

Yes, I can confirm it happened to me as well now with patch 1.
Happened when holding Alt + Tab, but I had to try a few times. I
logged in directly with sddm and got the following backtrace without
VT switch by ssh session. So should be a clean one:

#0  0x00007f4517e1074d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007f4516d32172 in poll (__timeout=-1, __nfds=1,
__fds=0x7ffed4e8ead0) at /usr/include/x86_64-linux-gnu/bits/poll2.h:46
#2  _xcb_conn_wait (c=c at entry=0xcc4be0, cond=cond at entry=0x19ef968,
vector=vector at entry=0x0, count=count at entry=0x0) at
/home/roman/dev/gfx/xcb/src/libxcb/src/xcb_conn.c:479
#3  0x00007f4516d33e69 in xcb_wait_for_special_event (c=0xcc4be0,
se=0x19ef940) at /home/roman/dev/gfx/xcb/src/libxcb/src/xcb_in.c:795
#4  0x00007f450d764d36 in dri3_wait_for_event_locked (draw=0x1a28288)
at ../../src/mesa/src/loader/loader_dri3_helper.c:457
#5  0x00007f450d765568 in loader_dri3_wait_for_sbc
(draw=draw at entry=0x1a28288, target_sbc=47, target_sbc at entry=0,
ust=ust at entry=0x7ffed4e8eca0, msc=msc at entry=0x7ffed4e8eca8,
sbc=sbc at entry=0x7ffed4e8ecb0) at
../../src/mesa/src/loader/loader_dri3_helper.c:534
#6  0x00007f450d76560b in loader_dri3_swapbuffer_barrier
(draw=0x1a28288) at
../../src/mesa/src/loader/loader_dri3_helper.c:1930
#7  loader_dri3_drawable_fini (draw=0x1a28288) at
../../src/mesa/src/loader/loader_dri3_helper.c:238
#8  0x00007f450d75aaad in dri3_destroy_drawable (base=0x1a28250) at
../../src/mesa/src/glx/dri3_glx.c:349
#9  0x00007f450d7537d2 in driReleaseDrawables (gc=gc at entry=0x1542920)
at ../../src/mesa/src/glx/dri_common.c:481
#10 0x00007f450d75af0c in dri3_bind_context (context=0x1542920,
old=<optimized out>, draw=41946959, read=41946959) at
../../src/mesa/src/glx/dri3_glx.c:198
#11 0x00007f450d746537 in MakeContextCurrent (dpy=0xcc3850,
draw=41946959, read=41946959, gc_user=0x1542920) at
../../src/mesa/src/glx/glxcurrent.c:213
#12 0x00007f44fd3056fd in ?? () from
/usr/lib/x86_64-linux-gnu/qt5/plugins/xcbglintegrations/libqxcb-glx-integration.so
#13 0x00007f45157d5229 in QOpenGLContext::makeCurrent(QSurface*) ()
from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#14 0x00007f451024ea5e in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5
#15 0x00007f451024faa5 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5
#16 0x00007f45157a5625 in QWindow::event(QEvent*) () from
/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#17 0x00007f45102c78c5 in QQuickWindow::event(QEvent*) () from
/usr/lib/x86_64-linux-gnu/libQt5Quick.so.5
#18 0x00007f44d974565b in PlasmaQuick::Dialog::event(QEvent*) () from
/usr/lib/x86_64-linux-gnu/libKF5PlasmaQuick.so.5
#19 0x00007f4515f40acc in QApplicationPrivate::notify_helper(QObject*,
QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#20 0x00007f4515f48417 in QApplication::notify(QObject*, QEvent*) ()
from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007f45152003c8 in QCoreApplication::notifyInternal2(QObject*,
QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#22 0x00007f451579a28d in
QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*)
() from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#23 0x00007f451579aebd in
QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*)
() from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#24 0x00007f45157748fb in
QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>)
() from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#25 0x00007f44fec534b6 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#26 0x00007f45151fe64a in
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#27 0x00007f4515207854 in QCoreApplication::exec() () from
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#28 0x00007f45180e81f9 in kdemain () from
/usr/lib/x86_64-linux-gnu/libkdeinit5_kwin_x11.so
#29 0x00007f4517d35830 in __libc_start_main (main=0x4006b0, argc=1,
argv=0x7ffed4e8f868, init=<optimized out>, fini=<optimized out>,
rtld_fini=<optimized out>, stack_end=0x7ffed4e8f858) at
../csu/libc-start.c:291
#30 0x00000000004006e9 in _start ()

> So far, only using patch 2/2, i haven't seen any new freezes, but
> looking at the debug output i get a lot of these when alt-tabbing:
>
> INIT: wxh = 264 x 1062, drawable 54662577 eid 54662586
> QXcbConnection: XCB error: 3 (BadWindow), sequence: 13890, resource
> id: 54662577, major code: 20 (GetProperty), minor code: 0
> QXcbConnection: XCB error: 3 (BadWindow), sequence: 13902, resource
> id: 54662577, major code: 20 (GetProperty), minor code: 0
> FINI: wxh = 264 x 1062, drawable 54662577 eid 54662586 recv_sbc 3,
> send_sbc 4 PENDING 1
> INIT: wxh = 264 x 1062, drawable 54662633 eid 54662644
> QXcbConnection: XCB error: 3 (BadWindow), sequence: 14502, resource
> id: 54662633, major code: 20 (GetProperty), minor code: 0
> QXcbConnection: XCB error: 3 (BadWindow), sequence: 14514, resource
> id: 54662633, major code: 20 (GetProperty), minor code: 0
> FINI: wxh = 264 x 1062, drawable 54662633 eid 54662644 recv_sbc 2,
> send_sbc 3 PENDING 1

I haven't tested patch 2/2 yet, but the XCB errors are probably
unrelated. I get saw in KWin's Tabbox and Plasmashell task manager
thumbnails already for a long time (> 1 year). Just spams the log, but
we hadn't see any real problems as a result.

> Curiously my display is only 1050 pixels high, that window looks higher.
>
> Anyway, would be good to know if patch 1/1 replaces a high frequency
> of lockups of plasmashell by a low frequency of lockups of kwin_x11 if
> you notice something like that.
>
> Ideally one of the more experienced Mesa developers would find a
> better solution than one of these patches, at least long-term.
>
> thanks,
> -mario


More information about the xorg-devel mailing list