mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.44k stars 2.91k forks source link

SIGSEGV vo=opengl on nvidia card #857

Closed ricardomv closed 9 years ago

ricardomv commented 10 years ago

Is this a problem in nvidia implementation of opengl? Or is there something i need to install to get this working?

[mkv] |  + Audio track
[mkv] |   + Sampling frequency: 48000.000000
[mkv] |   + Channels: 6
[mkv] |  + Codec ID: A_AC3
[mkv] |  + Language: und
[mkv] |  + Default duration: 32.000ms ( = 31.250 fps)
[mkv] | + a track...
[mkv] |  + Track number: 3
[mkv] |  + Track type: Subtitle
[mkv] |  + Codec ID: S_TEXT/UTF8
[mkv] |  + Language: und
[mkv] |+ found cluster
[mkv] Deferring reading cues.
[mkv] All headers are parsed!
[mkv] Aspect: 1.791045
[demux] Detected file format: Matroska
[mkv] Replaygain tags not found
[osc] Loading script...
[libass] Raster: FreeType 2.5.3
[osc] loading mp.defaults
[osc] loading @osc.lua
[libass] Shaper: FriBidi 0.19.6 (SIMPLE) HarfBuzz-ng 0.9.28 (COMPLEX)
[libass] Initialized
[global] user config path: 'subfont.ttf' -> '/home/archer/.mpv/subfont.ttf'
[global] user config path: 'fonts.conf' -> '/home/archer/.mpv/fonts.conf'
[global] global config path: 'fonts.conf' -> '/etc/mpv/fonts.conf'
[global] any config path: 'fonts.conf' -> '(NULL)'
[libass] Setting up fonts...
[osc] reading options for osc 
[global] user config path: 'lua-settings/osc.conf' -> '/home/archer/.mpv/lua-settings/osc.conf'
[osc] lua-settings/osc.conf not found. 
[libass] Updating font cache
[libass] Done.
[find_subfiles] Load subtitles in Desktop/
[global] user config path: 'sub/' -> '/home/archer/.mpv/sub/'
[stream] Video (+) --vid=1 (h264)
[stream] Audio (+) --aid=1 (*) (ac3)
[stream] Subs  (+) --sid=1 (*) (subrip)
[cplayer] [V] fourcc:0x31637661  size:1920x1072  fps:23.976
[vo/opengl] screen size: 1920x1080
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff029b0bb in _XSend () from /usr/lib/libX11.so.6
(gdb) bt
#0  0x00007ffff029b0bb in _XSend () from /usr/lib/libX11.so.6
#1  0x00007ffff029b575 in _XFlush () from /usr/lib/libX11.so.6
#2  0x00007ffff029e055 in _XGetRequest () from /usr/lib/libX11.so.6
#3  0x00007ffff02915ed in XQueryExtension () from /usr/lib/libX11.so.6
#4  0x00007ffff0285392 in XInitExtension () from /usr/lib/libX11.so.6
#5  0x00007ffff24a3d2f in XextAddDisplay () from /usr/lib/libXext.so.6
#6  0x00007fffe6f9a9c7 in ?? () from /usr/lib/libnvidia-glsi.so.337.25
#7  0x00007fffe6f3ce3c in _nv045glsi () from /usr/lib/libnvidia-glsi.so.337.25
#8  0x00007ffff1d807b8 in ?? () from /usr/lib/libEGL.so.1
#9  0x00007ffff1d88682 in ?? () from /usr/lib/libEGL.so.1
#10 0x00000000004b6eb9 in ?? ()
#11 0x00000000004afac5 in ?? ()
#12 0x00000000004ba41a in ?? ()
#13 0x00000000004b7cd4 in ?? ()
#14 0x00000000004b7e67 in ?? ()
#15 0x0000000000472bf2 in ?? ()
#16 0x0000000000464ddc in ?? ()
#17 0x000000000046620f in ?? ()
#18 0x00007fffefa79000 in __libc_start_main () from /usr/lib/libc.so.6
#19 0x0000000000414e8e in ?? ()
ghost commented 10 years ago

Does --vo=opengl:backend=x11 help?

ricardomv commented 10 years ago

yes it does. I had weston open and that had something to do with it. if i close weston it works without the backend option

ghost commented 10 years ago

So I guess trying to load the nvidia GLES drivers through EGL is what fails. EGL is currently only used by the wayland backend, so it works if you force X11. If you don't force a backend, wayland is tried first.

Well, not sure why the nvidia code seems to crash in X code. If this really is the wayland backend, X should not be involved, or the nvidia code somehow assumes X11.

Maybe you can compile mpv with debug infos, so we get a better backtrace?

ricardomv commented 10 years ago

i will try

ricardomv commented 10 years ago
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff17445d9 in XQueryExtension () from /usr/lib/libX11.so.6
(gdb) bt
#0  0x00007ffff17445d9 in XQueryExtension () from /usr/lib/libX11.so.6
#1  0x00007ffff1738392 in XInitExtension () from /usr/lib/libX11.so.6
#2  0x00007ffff2192d2f in XextAddDisplay () from /usr/lib/libXext.so.6
#3  0x00007fffe61d19c7 in ?? () from /usr/lib/libnvidia-glsi.so.337.25
#4  0x00007fffe6173e3c in _nv045glsi () from /usr/lib/libnvidia-glsi.so.337.25
#5  0x00007ffff067c7b8 in ?? () from /usr/lib/libEGL.so.1
#6  0x00007ffff0684682 in ?? () from /usr/lib/libEGL.so.1
#7  0x00000000004f56cf in egl_create_context (wl=0xda3cc0, ctx=0xda9070, enable_alpha=false) at ../video/out/gl_wayland.c:83
#8  0x00000000004f5992 in config_window_wayland (ctx=0xda9070, flags=16) at ../video/out/gl_wayland.c:158
#9  0x00000000004eb499 in mpgl_config_window (ctx=0xda9070, gl_caps=1073742857, flags=16) at ../video/out/gl_common.c:941
#10 0x00000000004f9fd8 in config_window (p=0xd86b10, flags=16) at ../video/out/vo_opengl.c:150
#11 0x00000000004faacf in preinit (vo=0xda0900) at ../video/out/vo_opengl.c:418
#12 0x00000000004f6d62 in vo_create (global=0x7cac20, input_ctx=0x816e30, osd=0x83bad0, encode_lavc_ctx=0x0, name=0x814f10 "opengl", args=0x0) at ../video/out/vo.c:188
#13 0x00000000004f6eaa in init_best_video_out (global=0x7cac20, input_ctx=0x816e30, osd=0x83bad0, encode_lavc_ctx=0x0) at ../video/out/vo.c:212
#14 0x0000000000494fe5 in reinit_video_chain (mpctx=0x7c8fb0) at ../player/video.c:189
#15 0x000000000048236b in play_current_file (mpctx=0x7c8fb0) at ../player/loadfile.c:1248
#16 0x0000000000482ed5 in mp_play_files (mpctx=0x7c8fb0) at ../player/loadfile.c:1456
#17 0x000000000048429d in mpv_main (argc=3, argv=0x7fffffffe9d8) at ../player/main.c:531
#18 0x0000000000516e5b in main (argc=3, argv=0x7fffffffe9d8) at ../player/main_fn.c:13
ghost commented 10 years ago

That confirms it. libEGL loads the nvidia GLES driver, which in turn does something with X. I'm not sure why the nvidia driver even crashes. Maybe it's because a wayland display is passed as X display to the nvidia driver. I'm not sure of the EGL API allows distinguishing between them. I feel like it should. So there's still a possibility that we somehow should declare the windowing system (wayland vs. X) at some point.

@giselher: do you know anything?

giselher commented 10 years ago

Sorry for the late response. This should fix it, if you want to use it under wayland. export EGL_PLATFORM=wayland

But I also have no idea why it crashes. This has to be on the driver side.

giselher commented 10 years ago

Wait. This is the proprietary nvidia driver and as far as I know it doesn't support wayland at all. How come you are running weston? Are you using the picman backend of weston?

ricardomv commented 10 years ago

I was using the x11 backend. The problem was that is was starting mpv outside weston with vo=openegl and that made mpv crash

giselher commented 10 years ago

Is your goal launching mpv in wayland or x11?

giselher commented 10 years ago

At the moment I can only guess what the problem is, but (from phoronix)

Support for the EGL API! EGL is needed for Mir and Wayland support. However, before getting too exciting, this EGL support right now is just for 32-bit platforms. Additionally, the EGL interface only works for OpenGL ES 1.1/2.0/3.0 and not OpenGL standard. The only window system back-end that the NVIDIA driver supports with EGL right now is X11. At least this is movement in the right direction for supporting Wayland and Mir.

I guess I have to implement some more checks to not crash mpv.

giselher commented 10 years ago

Any new info? I tagged it as not our bug since the Nvidia EGL driver doesn't even support wayland but still returns a non-null EGLDisploy from eglGetDisplay.

ricardomv commented 10 years ago

Sorry i can't test this anymore. I know Nvidia doesn't have support for wayland i just was not expecting mpv would crash if i had weston open