<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - X Freeze while rendering video with multiple displays and TearFree enabled"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=98645">98645</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>X Freeze while rendering video with multiple displays and TearFree enabled
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>xorg
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Driver/Radeon
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>xorg-driver-ati@lists.x.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>charlotte0m@gmail.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>xorg-team@lists.x.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=127849" name="attach_127849" title="system diagnostics">attachment 127849</a> <a href="attachment.cgi?id=127849&action=edit" title="system diagnostics">[details]</a></span>
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:
    <a href="https://github.com/charo-m/4K_displaywall_bench/tree/amd_xfreeze_repro">https://github.com/charo-m/4K_displaywall_bench/tree/amd_xfreeze_repro</a>

steps to reproduce:
git clone <a href="https://github.com/charo-m/4K_displaywall_bench.git">https://github.com/charo-m/4K_displaywall_bench.git</a>
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)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at
../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f61afed8213 in cnd_wait (mtx=0xdef5b0, cond=0xdef5d8)
    at ../../../../../../include/c11/threads_posix.h:159
#2  pipe_semaphore_wait (sema=0xdef5b0) at
../../../../../../src/gallium/auxiliary/os/os_thread.h:259
#3  radeon_drm_cs_emit_ioctl (param=param@entry=0xdef180)
    at ../../../../../../src/gallium/winsys/radeon/drm/radeon_drm_winsys.c:688
#4  0x00007f61afed7937 in impl_thrd_routine (p=<optimized out>) at
../../../../../../include/c11/threads_posix.h:87
#5  0x00007f61b34ea6fa in start_thread (arg=0x7f61abb7e700) at
pthread_create.c:333
#6  0x00007f61b3d48b5d in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7f61b4ecb740 (LWP 8248)):
#0  0x00007f61b3d3ce8d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007f61b289cc62 in poll (__timeout=-1, __nfds=1, __fds=0x7ffdbd4045a0)
    at /usr/include/x86_64-linux-gnu/bits/poll2.h:46
#2  _xcb_conn_wait (c=c@entry=0xd64000, cond=cond@entry=0x7ffdbd4046c0,
vector=vector@entry=0x0, 
    count=count@entry=0x0) at ../../src/xcb_conn.c:459
#3  0x00007f61b289e617 in wait_for_reply (c=c@entry=0xd64000, request=279249,
e=e@entry=0x7ffdbd404790)
    at ../../src/xcb_in.c:516
#4  0x00007f61b289e721 in xcb_wait_for_reply (c=c@entry=0xd64000,
request=279249, e=e@entry=0x7ffdbd404790)
    at ../../src/xcb_in.c:546
#5  0x00007f61b373da47 in _XReply (dpy=dpy@entry=0xd62cf0,
rep=rep@entry=0x7ffdbd404810, extra=extra@entry=0, 
    discard=discard@entry=0) at ../../src/xcb_io.c:602
#6  0x00007f61b1c3a29a in DRI2GetBuffersWithFormat (dpy=0xd62cf0,
drawable=2097159, width=width@entry=0xf52e38, 
    height=height@entry=0xf52e3c, attachments=0x7ffdbd4049b0, count=1,
outCount=0x7ffdbd404970)
    at ../../../src/glx/dri2.c:491
#7  0x00007f61b1c3a5d7 in dri2GetBuffersWithFormat (driDrawable=<optimized
out>, width=0xf52e38, height=0xf52e3c, 
    attachments=<optimized out>, count=<optimized out>,
out_count=0x7ffdbd404970, loaderPrivate=0xf53df0)
    at ../../../src/glx/dri2_glx.c:900
#8  0x00007f61afb4674a in dri2_drawable_get_buffers (count=<synthetic pointer>,
atts=0xf54550, drawable=0xf53ee0)
    at ../../../../../src/gallium/state_trackers/dri/dri2.c:213
#9  dri2_allocate_textures (ctx=0xd971f0, drawable=0xf53ee0, statts=0xf54550,
statts_count=2)
    at ../../../../../src/gallium/state_trackers/dri/dri2.c:407
#10 0x00007f61afb42f9c in dri_st_framebuffer_validate (stctx=<optimized out>,
stfbi=<optimized out>, 
    statts=0xf54550, count=2, out=0x7ffdbd404ae0)
    at ../../../../../src/gallium/state_trackers/dri/dri_drawable.c:83
#11 0x00007f61afa693be in st_framebuffer_validate (stfb=0xf540f0,
st=st@entry=0xf4acc0)
    at ../../../src/mesa/state_tracker/st_manager.c:202
#12 0x00007f61afa6a929 in st_manager_validate_framebuffers
(st=st@entry=0xf4acc0)
    at ../../../src/mesa/state_tracker/st_manager.c:877
#13 0x00007f61afa0fa12 in st_validate_state (st=st@entry=0xf4acc0,
pipeline=pipeline@entry=ST_PIPELINE_RENDER)
    at ../../../src/mesa/state_tracker/st_atom.c:235
#14 0x00007f61afa17a61 in st_Clear (ctx=0xf06460, mask=18) at
../../../src/mesa/state_tracker/st_cb_clear.c:393
#15 0x0000000000405605 in proto::Scene::Draw() ()
#16 0x0000000000402ca5 in main ()</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>