0 Replies Latest reply on Feb 21, 2016 5:20 PM by sesse

    Linux device driver race between glXSwapBuffers and glTexSubImage2D

    sesse

      Hi,

       

      I originally sent this to devrel@, but got no answer, so I'm trying here, too.

       

      I'm seeing crashes in my application that are specific to AMD GPUs. I'm working on an R7 20X with 15.2 drivers (“4.5.13416 Core profile Context 15.30.1025”, according to glxinfo), on 64-bit Debian GNU/Linux. It seems the crashes happen when one thread does glXSwapBuffers while another one tries to upload data into a texture with glTexSubImage2D. (The two threads use different contexts, but the contexts share textures.) It simply segfaults after a few frames; here's a sample backtrace:

       

        733       if (mb->alloc_type_ == kMagicDeletedSizeT) {

        (gdb) bt

        #0  0x00007ffff2d45246 in MallocBlock::FromRawPointer (p=0xffffffffffffffff) at src/debugallocation.cc:733

        #1  DebugDeallocate (type=-271733872, ptr=0xffffffffffffffff) at src/debugallocation.cc:1025

        #2  tc_free (ptr=0xffffffffffffffff) at src/debugallocation.cc:1228

        #3  0x00007fffde819119 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #4  0x00007fffde81914c in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #5  0x00007fffde8742fc in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #6  0x00007fffde87fe4f in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #7  0x00007fffde8055f7 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #8  0x00007fffde48596f in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #9  0x00007fffde82ab4c in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #10 0x00007fffde8854a0 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #11 0x00007fffde848752 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #12 0x00007fffde84904f in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #13 0x00007fffddf47f50 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #14 0x00007fffddf5469d in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #15 0x00007fffddf61a2c in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #16 0x00007fffde1513c5 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #17 0x00007fffddec069d in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #18 0x00007fffddec2207 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #19 0x00007fffddecafb3 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #20 0x00007fffdd5a6444 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #21 0x00007fffdd5a6e28 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #22 0x00007fffdda1f229 in ?? () from /usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so

        #23 0x0000000000429577 in Mixer::bm_frame (this=0x3180020, card_index=<optimized out>, timecode=<optimized out>, video_frame=...

      ,

            video_offset=<optimized out>, video_format=<optimized out>, audio_frame=..., audio_offset=<optimized out>, audio_format=2048

      ) at mixer.cpp:442

       

      I've captured an apitrace that crashes every single time on my AMD card and works every single time on a different brand; it's included. If I run apitrace with --singlethreaded, it does not crash on either. You should be able to reproduce with

       

        apitrace replay -v nageru.1.trace

       

      Could you please take a look? Thanks!

       

      n my AM