1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-01 04:12:25 +00:00

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.
This commit is contained in:
wm4 2019-11-07 22:32:58 +01:00
parent 17a89e5778
commit 1c8d2246bf
2 changed files with 3 additions and 6 deletions

View File

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

View File

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