plex-media-player icon indicating copy to clipboard operation
plex-media-player copied to clipboard

VAAPI-EGL driver fails to load

Open badgerkin opened this issue 5 years ago • 9 comments

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

badgerkin avatar May 05 '19 07:05 badgerkin

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?

mitzsch avatar May 07 '19 18:05 mitzsch

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.

badgerkin avatar May 08 '19 07:05 badgerkin

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)? :)

mitzsch avatar May 14 '19 17:05 mitzsch

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.

badgerkin avatar May 14 '19 23:05 badgerkin

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?

mitzsch avatar May 15 '19 11:05 mitzsch

@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.

mseeley avatar Jun 11 '19 21:06 mseeley

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.

badgerkin avatar Jun 12 '19 22:06 badgerkin

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.

rcork avatar Sep 29 '20 17:09 rcork

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

samip5 avatar Nov 19 '21 13:11 samip5