plexinc / plex-media-player

Next generation Plex Desktop/Embedded Client
GNU General Public License v2.0
1.17k stars 170 forks source link

VAAPI-EGL driver fails to load #857

Open badgerkin opened 5 years ago

badgerkin commented 5 years ago

PMS Version: 1.15.4.993 PMP Version: 2.33.1.dev-c4087ea7 Platform: $(uname -r) = 5.0.10-arch1-1-ARCH, gpu = Intel HD Graphics 3000

Hardware decoding functions using vaapi-copy instead of vaapi when vo=opengl-cb (default). Playback taxes CPU more than necessary.

Steps to reproduce

(non working):

  1. Compile PMP AUR package: makepkg -Csi
  2. Enable Hardware Decode in the TV mode settings
  3. Play jellyfish-h264

(working):

  1. Comment out the line if (probeHwdecInterop() == "vaapi-egl") from OpenGLDetect.cpp (do qputenv() regardless)
  2. Recompile AUR package: makepkg -efi
  3. Play jellyfish-h264

Current behavior (log)

  1. libmpv_render: Loading hwdec driver 'vaapi-egl'
  2. libmpv_render: Loading failed.

Expected behavior (log)

  1. libmpv_render: Loading hwdec driver 'vaapi-egl'
  2. libmpv_render/vaapi-egl: using VAAPI EGL interop
mitzsch commented 5 years ago

This is an mpv issue. opengl-cb nor libmpv work (correctly or only sometimes) with vaapi (native, non copy) only nvdec (/cuda) or vdpau work. I already opened an issue on the mpv repository addressing this .... but no response yet. (well I opened it in December 2018) https://github.com/mpv-player/mpv/issues/6353

But you were able to use it??????? just by editing the OpenGLDetect.cpp file?

badgerkin commented 5 years ago

But you were able to use it??????? just by editing the OpenGLDetect.cpp file?

Yes. Actually it's sufficient for me to run QT_XCB_GL_INTEGRATION=xcb_egl plexmediaplayer. Then ctrl-shift-D shows Hardware Decoding: vaapi (vaapi-egl) while playing back video.

mitzsch commented 5 years ago

Well, that is amazing, never thought that vaapi would work somehow. And how do you execute the command?

Could you please try it with the libmpv patch (https://github.com/plexinc/plex-media-player/pull/727)? :)

badgerkin commented 5 years ago

I'm running QT_XCB_GL_INTEGRATION=xcb_egl plexmediaplayer --tv from a bash prompt (in xfce4-terminal). plexmediaplayer resolves to /usr/bin/plexmedia and loads /usr/lib/libmpv.so.1 from the arch package mpv 1:0.29.1-6.

I obtain the same result after applying #727.

mitzsch commented 5 years ago

Amazing, it really works. That´s unbelievable. Thank you so much!!! First time I tried it, it gave me an error, that´s why I asked how the command is executed... it was just a typo on my side ... ^^

So now how should "we" proceed with this?

mseeley commented 5 years ago

@badgerkin thanks for your time + input.

To be honest, I'm having a little trouble telling if you're reporting an issue or proposing a fix. If the latter would you like to PR the change? Either way it'd be great if @rcombs could weigh in.

badgerkin commented 5 years ago

This is a bug report.

The workaround can't be applied in the general case, where the xcb-glx binding may be preferred. On an ubuntu box with nvidia nonfree graphics, for example, pmp starts to a black screen if I set QT_XCB_GL_INTEGRATION=xcb_egl. It'd be nice if pmp could determine which to use at runtime.

On systems that support vaapi-egl, detectOpenGLEarly() should set the egl backend, but doesn't because probeHwdecInterop() returns a null QString from line 54.

rcork commented 4 years ago

Any movement on this bug? Without setting the environment variable, vaapi hardware decoding doesn't work on my XPS 13 9300 with Intel Iris Plus graphics running Linux Mint 20.

samip5 commented 2 years ago

Is my issue similar to this one?

2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: GL_VERSION='4.6 (Compatibility Profile) Mesa 21.2.5' 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Detected desktop OpenGL 4.6. 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: GL_VENDOR='Intel' 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: GL_RENDERER='Mesa Intel(R) UHD Graphics 620 (KBL GT2)' 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: GL_SHADING_LANGUAGE_VERSION='4.60' 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: GL_*_swap_control extension missing. 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Testing FBO format rgba16f 
2021-11-19 15:41:26 [ ERROR ] PlayerComponent.cpp @ 604 - libmpv_render: after creating texture: OpenGL error INVALID_OPERATION. 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Using FBO format rgba16f. 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: No advanced processing required. Enabling dumb mode. 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading hwdec driver 'vaapi-egl' 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading failed. 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading hwdec driver 'cuda-nvdec' 
2021-11-19 15:41:26 [ ERROR ] PlayerComponent.cpp @ 604 - libmpv_render/cuda-nvdec: cu->cuInit(0) failed -> CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected 
2021-11-19 15:41:26 [ ERROR ] PlayerComponent.cpp @ 604 - libmpv_render/cuda-nvdec: cu->cuCtxPopCurrent(&dummy) failed -> CUDA_ERROR_NOT_INITIALIZED: initialization error 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading failed. 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading hwdec driver 'vdpau-glx' 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading failed. 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading hwdec driver 'drmprime-drm' 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render/drmprime-drm: Failed to retrieve DRM fd from native display. 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading failed. 
2021-11-19 15:41:26 [ DEBUG ] PlayerComponent.cpp @ 598 - cplayer: Set property: audio-device="auto" -> 1 
2021-11-19 15:41:27 [ DEBUG ] Log.cpp @ 29 - "qrc:/ui/webview.qml:166:onLoadingChanged: WebEngineLoadRequest starting: file:///tmp/.mount_Plex_Mo14Y7s/usr/bin/web-client/tv/index.html" 

That is when I had QT_XCB_GL_INTEGRATION=xcb_egl set.

Without it:

2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: GL_VERSION='4.6 (Compatibility Profile) Mesa 21.2.5' 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Detected desktop OpenGL 4.6. 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: GL_VENDOR='Intel' 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: GL_RENDERER='Mesa Intel(R) UHD Graphics 620 (KBL GT2)' 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: GL_SHADING_LANGUAGE_VERSION='4.60' 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: GL_*_swap_control extension missing. 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Testing FBO format rgba16f 
2021-11-19 15:37:18 [ ERROR ] PlayerComponent.cpp @ 604 - libmpv_render: after creating texture: OpenGL error INVALID_OPERATION. 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Using FBO format rgba16f. 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: No advanced processing required. Enabling dumb mode. 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading hwdec driver 'vaapi-egl' 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading failed. 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading hwdec driver 'cuda-nvdec' 
2021-11-19 15:37:18 [ ERROR ] PlayerComponent.cpp @ 604 - libmpv_render/cuda-nvdec: cu->cuInit(0) failed -> CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected 
2021-11-19 15:37:18 [ ERROR ] PlayerComponent.cpp @ 604 - libmpv_render/cuda-nvdec: cu->cuCtxPopCurrent(&dummy) failed -> CUDA_ERROR_NOT_INITIALIZED: initialization error 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading failed. 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading hwdec driver 'vdpau-glx' 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading failed. 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading hwdec driver 'drmprime-drm' 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render/drmprime-drm: Failed to retrieve DRM fd from native display. 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - libmpv_render: Loading failed. 
2021-11-19 15:37:18 [ DEBUG ] PlayerComponent.cpp @ 598 - cplayer: Set property: audio-device="auto" -> 1