X Freeze while rendering video with multiple displays and TearFree enabled
Submitted by Charlotte Manning
Assigned to Default DRI bug account
Description
Created attachment 127849
system diagnostics
This was first observed while rendering video in our application after upgrading to Ubuntu 16.04 and enabling TearFree setting. We have reproduced the issue outside of our application with a minimal code sample:
https://github.com/charo-m/4K_displaywall_bench/tree/amd_xfreeze_repro
steps to reproduce:
git clone https://github.com/charo-m/4K_displaywall_bench.git
git checkout amd_xfreeze_repro
sudo apt-get install libxrandr-dev libxinerama-dev libxcursor-dev libglfw3-dev libglm-dev
cmake .
make
./4K_displaywall_bench -width 3840 -height 1080 -swap_interval 1 -gl 3 -i images/bubble4K.png
X.Org X Server 1.18.4
09:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Tahiti XT GL [FirePro W9000]
OpenGL renderer string: Gallium 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.8.0)
OpenGL version string: 3.0 Mesa 11.2.0
OpenGL core profile version string: 4.1 (Core Profile) Mesa 11.2.0
OS: Ubuntu 16.04.1 LTS
Kernel: 4.4.0-45-generic
Two 2K monitors:
1920x1080 @ 60Hz (not rotated) DP1 at pos 0x0, DP2 at pos 1920x0
Server hardware:
Dell Precision T5600
**** Option “TearFree” “on” ****
The issue does not seem to happen with a single monitor. The code sample re-uploads the same image data every frame with glTexSubImage2D. The "-swap_interval [0|1]" option maps to glXSwapIntervalEXT(0) which disables vsync or glXSwapIntervalEXT(1) which enables vsync. The issue seems to be a race condition and so is more likely to happen under certain conditions (at least two monitors, T5600, tearfree enabled).
single monitor:
./4K_displaywall_bench -width 1920 -height 1080 -swap_interval 1 -gl 3 -i images/bubble4K.png -> unlikely to happen at all / never reproduced
two monitors, viewport covers both, vsync enabled:
./4K_displaywall_bench -width 3840 -height 1080 -swap_interval 1 -gl 3 -i images/bubble4K.png -> most likely to happen (usually within 15 min, but not always)
two monitors, viewport only covers first, vsync enabled:
./4K_displaywall_bench -width 1920 -height 1080 -swap_interval 1 -gl 3 -i images/bubble4K.png -> unlikely to happen
two monitors, viewport covers both, vsync disabled:
./4K_displaywall_bench -width 3840 -height 1080 -swap_interval 0 -gl 3 -i images/bubble4K.png -> unlikely to happen
stacktrace:
Thread 2 (Thread 0x7f61abb7e700 (LWP 8249)):<br>
#0 pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185<br>
#1 0x00007f61afed8213 in cnd_wait (mtx=0xdef5b0, cond=0xdef5d8)<br>
at ../../../../../../include/c11/threads_posix.h:159<br>
#2 pipe_semaphore_wait (sema=0xdef5b0) at ../../../../../../src/gallium/auxiliary/os/os_thread.h:259<br>
#3 radeon_drm_cs_emit_ioctl (param=param@entry=0xdef180)<br>
at ../../../../../../src/gallium/winsys/radeon/drm/radeon_drm_winsys.c:688<br>
#4 0x00007f61afed7937 in impl_thrd_routine (p=<optimized out>) at ../../../../../../include/c11/threads_posix.h:87<br>
#5 0x00007f61b34ea6fa in start_thread (arg=0x7f61abb7e700) at pthread_create.c:333<br>
#6 0x00007f61b3d48b5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109<br>
<br>
Thread 1 (Thread 0x7f61b4ecb740 (LWP 8248)):<br>
#0 0x00007f61b3d3ce8d in poll () at ../sysdeps/unix/syscall-template.S:84<br>
#1 0x00007f61b289cc62 in poll (__timeout=-1, __nfds=1, __fds=0x7ffdbd4045a0)<br>
at /usr/include/x86_64-linux-gnu/bits/poll2.h:46<br>
#2 _xcb_conn_wait (c=c@entry=0xd64000, cond=cond@entry=0x7ffdbd4046c0, vector=vector@entry=0x0, <br>
count=count@entry=0x0) at ../../src/xcb_conn.c:459<br>
#3 0x00007f61b289e617 in wait_for_reply (c=c@entry=0xd64000, request=279249, e=e@entry=0x7ffdbd404790)<br>
at ../../src/xcb_in.c:516<br>
#4 0x00007f61b289e721 in xcb_wait_for_reply (c=c@entry=0xd64000, request=279249, e=e@entry=0x7ffdbd404790)<br>
at ../../src/xcb_in.c:546<br>
#5 0x00007f61b373da47 in _XReply (dpy=dpy@entry=0xd62cf0, rep=rep@entry=0x7ffdbd404810, extra=extra@entry=0, <br>
discard=discard@entry=0) at ../../src/xcb_io.c:602<br>
#6 0x00007f61b1c3a29a in DRI2GetBuffersWithFormat (dpy=0xd62cf0, drawable=2097159, width=width@entry=0xf52e38, <br>
height=height@entry=0xf52e3c, attachments=0x7ffdbd4049b0, count=1, outCount=0x7ffdbd404970)<br>
at ../../../src/glx/dri2.c:491<br>
#7 0x00007f61b1c3a5d7 in dri2GetBuffersWithFormat (driDrawable=<optimized out>, width=0xf52e38, height=0xf52e3c, <br>
attachments=<optimized out>, count=<optimized out>, out_count=0x7ffdbd404970, loaderPrivate=0xf53df0)<br>
at ../../../src/glx/dri2_glx.c:900<br>
#8 0x00007f61afb4674a in dri2_drawable_get_buffers (count=<synthetic pointer>, atts=0xf54550, drawable=0xf53ee0)<br>
at ../../../../../src/gallium/state_trackers/dri/dri2.c:213<br>
#9 dri2_allocate_textures (ctx=0xd971f0, drawable=0xf53ee0, statts=0xf54550, statts_count=2)<br>
at ../../../../../src/gallium/state_trackers/dri/dri2.c:407<br>
#10 0x00007f61afb42f9c in dri_st_framebuffer_validate (stctx=<optimized out>, stfbi=<optimized out>, <br>
statts=0xf54550, count=2, out=0x7ffdbd404ae0)<br>
at ../../../../../src/gallium/state_trackers/dri/dri_drawable.c:83<br>
#11 0x00007f61afa693be in st_framebuffer_validate (stfb=0xf540f0, st=st@entry=0xf4acc0)<br>
at ../../../src/mesa/state_tracker/st_manager.c:202<br>
#12 0x00007f61afa6a929 in st_manager_validate_framebuffers (st=st@entry=0xf4acc0)<br>
at ../../../src/mesa/state_tracker/st_manager.c:877<br>
#13 0x00007f61afa0fa12 in st_validate_state (st=st@entry=0xf4acc0, pipeline=pipeline@entry=ST_PIPELINE_RENDER)<br>
at ../../../src/mesa/state_tracker/st_atom.c:235<br>
#14 0x00007f61afa17a61 in st_Clear (ctx=0xf06460, mask=18) at ../../../src/mesa/state_tracker/st_cb_clear.c:393<br>
#15 0x0000000000405605 in proto::Scene::Draw() ()<br>
#16 0x0000000000402ca5 in main ()<br>
```<br>
<br>
**Attachment 127849**, "system diagnostics": <br>
[xfreeze_report_01.11.16_1855.zip](/uploads/e28040197e86b954ad8e03a5b414aed3/xfreeze_report_01.11.16_1855.zip)<br>