At dual monitor intel_do_flush_locked failed: Resource deadlock avoided
Submitted by Gert vd Kraats
Assigned to Default DRI bug account
Created attachment 142855 stacktrace
This is a copy of ubuntu bug 1797882. It should be directly submitted to mesa.
Using ubuntu 18.10 wayland with dual monitors, configured above each other. Dock is configured at both displays, not hiding. Icons for "terminal" and "libreofffice Writer" are present at the dock.
Start terminal on primary screen by mouseclick on dock. Start libreoffice Writer on primary screen by mouseclick on dock. Terminate libreoffice Witer by mouseclick on X. Repeat the starting and stopping of Writer.
Login-screen will appear. Syslog shows: Oct 15 00:09:51 Gert2 org.gnome.Shell.desktop: intel_do_flush_locked failed: Resource deadlock avoided Oct 15 00:09:51 Gert2 gnome-terminal-: Error reading events from display: Connection reset by peer Oct 15 00:09:51 Gert2 systemd: gnome-terminal-server.service: Main process exited, code=exited, status=1/FAILURE
This problem doesnot occur in a dual monitor-session without wayland. It also doesnot occur, if only one monitor used with wayland It also doesnot occur, if the dock is only present at the primary screen. It also doesnot occur if second started application is present at the dock and doesnot add an icon to the dock (as libreoffice does).
All other dual monitor/dock configurations seem to have this problem.
No idea if this is helpful info, but the used graphics card does not support OpenGL version 2.1: Oct 15 00:02:32 Gert2 org.gnome.Shell.desktop: Require OpenGL version 2.1 or later. Oct 15 00:02:32 Gert2 org.gnome.Shell.desktop: Failed to initialize glamor Oct 15 00:02:32 Gert2 org.gnome.Shell.desktop: Failed to initialize glamor, falling back to sw
glxinfo: OpenGL vendor string: VMware, Inc. OpenGL renderer string: llvmpipe (LLVM 7.0, 128 bits) OpenGL core profile version string: 3.3 (Core Profile) Mesa 18.2.2 OpenGL core profile shading language version string: 3.30 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 3.1 Mesa 18.2.2 OpenGL shading language version string: 1.40 OpenGL context flags: (none) OpenGL extensions: OpenGL ES profile version string: OpenGL ES 3.0 Mesa 18.2.2 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00 OpenGL ES profile extensions:
Without solving this problem, wayland cannot be used after logon, when using dual monitor. The sesssion stops very easy and often. Work is lost; you have to logon again. E.g. the simple switching between 2 overlapping windows causes the end of the session.
I changed src/mesa/drivers/dri/i915/intel_batchbuffer.c to force a coredump in this case. The stacktrace is added to this bug-report. Linenumbers might deviate a little bit because of extra coding of tracing. The deadlock always occurs at cogl_onscreen_swap_buffers calling cogl_flush(), at the first journal-batch-flush for the offscreen-framebuffer.
The deadlock disappeared as soon as cogl is compiled with disabled batching! To minimize this disabling of batching, I made a very dirty but working patch, which is attached to this bug. At program clutter_stage_cogl_redraw_view routine paint_stage is called for the "Unclipped stage paint". This call is manipulated to flush immedately the first journal-entry of the default onscreen framebuffer. This is done by misusing and changing program cogl_framebuffer_set_viewport and by changing _cogl_journal_flush. Apparenly this early flushing causes a lock to be set which avoids the deadlock.
I do not know how to see which locks are held and by which process, so I cannot solve the root-cause of the problem, but I assume some extra lock must be set in this case to avoid deadlock.
With this dirty patch combined with other suggested (simple) patches at #1790525, #1795774 and #1795760 wayland can be run without any problems on dual monitor and "old" intel graphic card. It performs better than lightdm, specially if the monitors are positioned aside of each other.
Attachment 142855, "stacktrace":