OpenGL : Segfault when using opengl elements in multiple pipelines

Matthew Waters ystreet00 at gmail.com
Wed Mar 5 19:19:19 PST 2014


On 06/03/14 09:25, adrien_sch wrote:
> Hello guys,
>
> I'm trying to use some OpenGL element in multiple pipelines (differents
> GMainContext) in a process. In this case, I observed multiple segfault in
> XOpenDisplay, XCloseDisplay, gst_gl_shader_compile probably due to
> concurrent access (see the backtrace log). With my knowledge, Xlib isn't
> well know for this robustness in multiple threaded context, and it isn't
> possible to share the same display object between the pipelines (instanced
> by GstGLWindow_X11).
>
> So, what can I do to fix this ? Does this case is a supported case by opengl
> elements ?
> File a bug because the previous case must work ? File a bug to suggest a
> design review ? Or just forget about this ?

It should work theoretically however AFAIK, you are the first person to 
actually try it :)

> Environment :
> Arch linux with lastest version of gstreamer, mesa, xf86-video-intel.
>
> Test application :
> http://pastebin.com/1RWud2Ns
>
> Video sample used :
> http://www.auby.no/files/video_tests/h264_1080p_hp_4.1_10mbps_dts_unstyled_subs_monsters.mkv
>
> Complete threads backtrace :
> http://pastebin.com/YbHNDJtj
>
> Thread 1 :
> #0  0x00007f574f2ea389 in raise () from /usr/lib/libc.so.6
> #1  0x00007f574f2eb788 in abort () from /usr/lib/libc.so.6
> #2  0x00007f574f328204 in __libc_message () from /usr/lib/libc.so.6
> #3  0x00007f574f32d9ae in malloc_printerr () from /usr/lib/libc.so.6
> #4  0x00007f574f32e6b6 in _int_free () from /usr/lib/libc.so.6
> #5  0x00007f571e1a632d in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #6  0x00007f571e14f6d0 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #7  0x00007f571e16f749 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #8  0x00007f571e1a821e in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #9  0x00007f572b1651a2 in ?? () from /usr/lib/libGL.so.1
> #10 0x00007f572b141a56 in ?? () from /usr/lib/libGL.so.1
> #11 0x00007f572b141ad5 in ?? () from /usr/lib/libGL.so.1
> #12 0x00007f572b141bd5 in ?? () from /usr/lib/libGL.so.1
> #13 0x00007f574f67c9f2 in XCloseDisplay () from /usr/lib/libX11.so.6
> #14 0x00007f5728dca91c in gst_gl_window_x11_close (window=<optimized out>)
> at gstglwindow_x11.c:295
> #15 0x00007f5728db12ec in gst_gl_context_create_thread
> (context=0x7f56f8012310) at gstglcontext.c:805
> #16 0x00007f574fd05fb5 in ?? () from /usr/lib/libglib-2.0.so.0
> #17 0x00007f574ebe80a2 in start_thread () from /usr/lib/libpthread.so.0
> #18 0x00007f574f39ad1d in clone () from /usr/lib/libc.so.6
>
> Thread 20
> #0  0x00007f574f396e6a in mmap64 () from /usr/lib/libc.so.6
> #1  0x00007f574f2e3464 in __assert_fail_base () from /usr/lib/libc.so.6
> #2  0x00007f574f2e3552 in __assert_fail () from /usr/lib/libc.so.6
> #3  0x00007f571df7f4ee in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #4  0x00007f571e1a66b9 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #5  0x00007f571e13a925 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #6  0x00007f571e14f44c in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #7  0x00007f571e12a9cc in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #8  0x00007f571e130c6d in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #9  0x00007f571e13158f in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #10 0x00007f571e130a5f in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #11 0x00007f571e1327cd in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #12 0x00007f571e12d760 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #13 0x00007f571e16f4e6 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #14 0x00007f571e018ddb in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #15 0x00007f5728dbdbe6 in gst_gl_shader_compile
> (shader=shader at entry=0x7f5708636180, error=error at entry=0x7f571d478d48) at
> gstglshader.c:429
> #16 0x00007f5728dc50eb in _create_shader (out_shader=0x7f5724013958,
>      fragment_src=0x7f5728dd1bf8 "uniform sampler2D tex;\nuniform vec2
> tex_scale0;\nuniform vec2 tex_scale1;\nuniform vec2 tex_scale2;\nvoid
> main(void)\n{\n vec4 t = texture2D(tex, gl_TexCoord[0].xy);\n gl_FragColor =
> vec4(t.rgb, 1.0);\n}\n", vertex_src=0x0, context=0x7f57241371e0) at
> gstglupload.c:986
> #17 _init_upload (context=0x7f57241371e0, upload=0x7f57240137c0) at
> gstglupload.c:1102
> #18 0x00007f5728dc6be8 in _run_message_sync (message=0x7f574520c650) at
> gstglwindow.c:317
> #19 0x00007f5728dca472 in _run_message (message=0x7f5748001520) at
> gstglwindow_x11.c:620
> #20 0x00007f574fce1296 in g_main_context_dispatch () from
> /usr/lib/libglib-2.0.so.0
> #21 0x00007f574fce15e8 in ?? () from /usr/lib/libglib-2.0.so.0
> #22 0x00007f574fce19ea in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
> #23 0x00007f5728db1254 in gst_gl_context_create_thread
> (context=0x7f57241371e0) at gstglcontext.c:787
> #24 0x00007f574fd05fb5 in ?? () from /usr/lib/libglib-2.0.so.0
> #25 0x00007f574ebe80a2 in start_thread () from /usr/lib/libpthread.so.0
> #26 0x00007f574f39ad1d in clone () from /usr/lib/libc.so.6
>
> Thread 19 :
> #0  0x00007f574f393907 in ioctl () from /usr/lib/libc.so.6
> #1  0x00007f572a2e39d4 in drmIoctl () from /usr/lib/libdrm.so.2
> #2  0x00007f5722d2ab4f in ?? () from /usr/lib/libdrm_intel.so.1
> #3  0x00007f571e1e57c5 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #4  0x00007f571e1e598c in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #5  0x00007f571e1e6088 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #6  0x00007f571e1e354d in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #7  0x00007f571e0146f7 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #8  0x00007f571e1eaff2 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #9  0x00007f571e015028 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #10 0x00007f571e01521a in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #11 0x00007f5728dc2f47 in _do_download_draw_yuv_opengl
> (context=0x7f56f81a4300, download=0x7f56f800a1f0) at gstgldownload.c:1222
> #12 0x00007f5728dc2a60 in _do_download (context=0x7f56f81a4300,
> download=0x7f56f800a1f0) at gstgldownload.c:897
> #13 0x00007f5728dc6be8 in _run_message_sync (message=0x7f5704e936b0) at
> gstglwindow.c:317
> #14 0x00007f5728dca472 in _run_message (message=0x7f572c01ca20) at
> gstglwindow_x11.c:620
> #15 0x00007f574fce1296 in g_main_context_dispatch () from
> /usr/lib/libglib-2.0.so.0
> #16 0x00007f574fce15e8 in ?? () from /usr/lib/libglib-2.0.so.0
> #17 0x00007f574fce19ea in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
> #18 0x00007f5728db1254 in gst_gl_context_create_thread
> (context=0x7f56f81a4300) at gstglcontext.c:787
> #19 0x00007f574fd05fb5 in ?? () from /usr/lib/libglib-2.0.so.0
> #20 0x00007f574ebe80a2 in start_thread () from /usr/lib/libpthread.so.0
> #21 0x00007f574f39ad1d in clone () from /usr/lib/libc.so.6
>
> Thread 18 :
> #0  0x00007f574f393907 in ioctl () from /usr/lib/libc.so.6
> #1  0x00007f572a2e39d4 in drmIoctl () from /usr/lib/libdrm.so.2
> #2  0x00007f5722d2ab4f in ?? () from /usr/lib/libdrm_intel.so.1
> #3  0x00007f571e1e57c5 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #4  0x00007f571e1e598c in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #5  0x00007f571e1e6088 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #6  0x00007f571e1e354d in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #7  0x00007f571e0146f7 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #8  0x00007f571e1eaff2 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #9  0x00007f571e015028 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #10 0x00007f571e01521a in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
> #11 0x00007f5728dc2f15 in _do_download_draw_yuv_opengl
> (context=0x7f56f81a4b00, download=0x7f5724070de0) at gstgldownload.c:1217
> #12 0x00007f5728dc2a60 in _do_download (context=0x7f56f81a4b00,
> download=0x7f5724070de0) at gstgldownload.c:897
> #13 0x00007f5728dc6be8 in _run_message_sync (message=0x7f56ff7fd6b0) at
> gstglwindow.c:317
> #14 0x00007f5728dca472 in _run_message (message=0x7f572c037940) at
> gstglwindow_x11.c:620
> #15 0x00007f574fce1296 in g_main_context_dispatch () from
> /usr/lib/libglib-2.0.so.0
> #16 0x00007f574fce15e8 in ?? () from /usr/lib/libglib-2.0.so.0
> #17 0x00007f574fce19ea in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
> #18 0x00007f5728db1254 in gst_gl_context_create_thread
> (context=0x7f56f81a4b00) at gstglcontext.c:787
> #19 0x00007f574fd05fb5 in ?? () from /usr/lib/libglib-2.0.so.0
> #20 0x00007f574ebe80a2 in start_thread () from /usr/lib/libpthread.so.0
> #21 0x00007f574f39ad1d in clone () from /usr/lib/libc.so.6

It would be most helpful if you could grab that backtrace with debugging 
symbols for mesa.  Also, how often does this occur? every time, 
occasionally (1 in 10ish), once in a blue moon? To be honest, it
looks like an intel mesa driver bug that seems to be fixed in later 
releases of mesa (at least on my system, mesa git seems to work fine 
where the latest stable (10.0.3) segfaults occasionally).

> Valgrind log :
> Vaapi : http://pastebin.com/cwFnACcc significant ?
>
> OpenGL : http://pastebin.com/bWPLHqzS
>
> Thx for our help (thx ystreet :) ).
>
>
>
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/OpenGL-Segfault-when-using-opengl-elements-in-multiple-pipelines-tp4665772.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
>



More information about the gstreamer-devel mailing list