diff options
authorwm4 <wm4@nowhere>2019-11-07 22:32:58 +0100
committerwm4 <wm4@nowhere>2019-11-07 22:53:13 +0100
commit1c8d2246bf03626f098139f31e67d1452a41fa73 (patch)
parent17a89e5778cc5be2035e0c2ddc6e7eddae8596bc (diff)
vo_gpu: vdpau actually works under EGL
The use of glXGetCurrentDisplay() restricted this to the GLX backend. But actually it works under EGL as well. Removing the GLX-specific call and using the general mpv-internal method to get the X "Display" makes it work in mpv. I didn't know this. Nvidia didn't list this as extension in the EGL context when I still used their GPUs. Note that this might in theory break use of vdpau in some libmpv clients using the render API. But only if MPV_RENDER_PARAM_X11_DISPLAY is not used, and they relied on mpv using glXGetCurrentDisplay(). EGL does not provide such an API, and hwdec_vaapi.c also uses what hwdec_vdpau.c uses now. Considering that vaapi is preferable these days, it's not bad at all if these clients get "broken". They can be easily fixed by passing the display to mpv correctly.
2 files changed, 3 insertions, 6 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index bd844e4a2d..27b24d0e98 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -987,8 +987,7 @@ Video
:auto: enable best hw decoder (see below)
:yes: exactly the same as ``auto``
:auto-copy: enable best hw decoder with copy-back (see below)
- :vdpau: requires ``--vo=gpu`` with ``--gpu-context=x11``,
- or ``--vo=vdpau`` (Linux only)
+ :vdpau: requires ``--vo=gpu`` with X11, or ``--vo=vdpau`` (Linux only)
:vdpau-copy: copies video back into system RAM (Linux with some GPUs only)
:vaapi: requires ``--vo=gpu`` or ``--vo=vaapi`` (Linux only)
:vaapi-copy: copies video back into system RAM (Linux with some GPUs only)
diff --git a/video/out/opengl/hwdec_vdpau.c b/video/out/opengl/hwdec_vdpau.c
index f865978f5b..ce0d32b3a9 100644
--- a/video/out/opengl/hwdec_vdpau.c
+++ b/video/out/opengl/hwdec_vdpau.c
@@ -18,8 +18,6 @@
#include <stddef.h>
#include <assert.h>
-#include <GL/glx.h>
#include "video/out/gpu/hwdec.h"
#include "ra_gl.h"
#include "video/vdpau.h"
@@ -49,7 +47,7 @@ struct priv {
static int init(struct ra_hwdec *hw)
- Display *x11disp = glXGetCurrentDisplay();
+ Display *x11disp = ra_get_native_resource(hw->ra, "x11");
if (!x11disp || !ra_is_gl(hw->ra))
return -1;
GL *gl = ra_gl_get(hw->ra);
@@ -313,7 +311,7 @@ static int mapper_map(struct ra_hwdec_mapper *mapper)
const struct ra_hwdec_driver ra_hwdec_vdpau = {
- .name = "vdpau-glx",
+ .name = "vdpau-gl",
.priv_size = sizeof(struct priv_owner),
.imgfmts = {IMGFMT_VDPAU, 0},
.init = init,