summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-09-27 21:24:35 +0200
committerwm4 <wm4@nowhere>2015-09-27 21:38:45 +0200
commit8aa8417aa35fd30990a1695380f22179848c6463 (patch)
treeb261790ecaa06c6561721a07eb8c16957194f01a
parent1fa674c109c05e082bf0fb43be064cbdabea3327 (diff)
downloadmpv-8aa8417aa35fd30990a1695380f22179848c6463.tar.bz2
mpv-8aa8417aa35fd30990a1695380f22179848c6463.tar.xz
vo_opengl: vaapi: add Wayland support
Pretty trivial with the new EGL interop. Fixes #478.
-rwxr-xr-xTOOLS/old-configure6
-rw-r--r--video/out/opengl/hwdec_vaegl.c15
-rw-r--r--video/out/opengl/wayland.c3
-rw-r--r--wscript9
4 files changed, 31 insertions, 2 deletions
diff --git a/TOOLS/old-configure b/TOOLS/old-configure
index d5826ebc55..a7b49da9be 100755
--- a/TOOLS/old-configure
+++ b/TOOLS/old-configure
@@ -612,6 +612,12 @@ _vaapi=$(defretval)
define_yes_no $_vaapi HAVE_VAAPI_HWACCEL
define_yes_no $_vaapi HAVE_VAAPI_X11
+_vaapi_wayland=no
+if test "$_vaapi" = yes ; then
+_vaapi_wayland=auto
+fi
+check_pkg_config "VAAPI Wayland" $_vaapi_wayland VAAPI_WAYLAND 'libva-wayland >= 0.34.0'
+
if test "$_vaapi" = yes ; then
check_pkg_config "VAAPI VPP" auto VAAPI_VPP 'libva >= 0.34.0'
else
diff --git a/video/out/opengl/hwdec_vaegl.c b/video/out/opengl/hwdec_vaegl.c
index 90c7478d94..580e014423 100644
--- a/video/out/opengl/hwdec_vaegl.c
+++ b/video/out/opengl/hwdec_vaegl.c
@@ -56,6 +56,16 @@ static VADisplay *create_x11_va_display(GL *gl)
}
#endif
+#if HAVE_VAAPI_WAYLAND
+#include <va/va_wayland.h>
+
+static VADisplay *create_wayland_va_display(GL *gl)
+{
+ struct wl_display *wl = gl->MPGetNativeDisplay("wl");
+ return wl ? vaGetDisplayWl(wl) : NULL;
+}
+#endif
+
static VADisplay *create_native_va_display(GL *gl)
{
if (!gl->MPGetNativeDisplay)
@@ -66,6 +76,11 @@ static VADisplay *create_native_va_display(GL *gl)
if (display)
return display;
#endif
+#if HAVE_VAAPI_WAYLAND
+ display = create_wayland_va_display(gl);
+ if (display)
+ return display;
+#endif
return display;
}
diff --git a/video/out/opengl/wayland.c b/video/out/opengl/wayland.c
index 2963ec8985..b4d74ef98d 100644
--- a/video/out/opengl/wayland.c
+++ b/video/out/opengl/wayland.c
@@ -124,6 +124,9 @@ static bool egl_create_context(struct vo_wayland_state *wl,
mpgl_load_functions(gl, (void*(*)(const GLubyte*))eglGetProcAddress, eglstr,
wl->log);
+ ctx->native_display_type = "wl";
+ ctx->native_display = wl->display.display;
+
return true;
}
diff --git a/wscript b/wscript
index f7cc62e211..c6b1857766 100644
--- a/wscript
+++ b/wscript
@@ -640,7 +640,7 @@ video_output_features = [
'name': '--vaapi',
'desc': 'VAAPI acceleration',
'deps': [ 'libdl' ],
- 'deps_any': [ 'x11' ],
+ 'deps_any': [ 'x11', 'wayland' ],
'func': check_pkg_config('libva', '>= 0.34.0'),
}, {
'name': '--vaapi-x11',
@@ -648,6 +648,11 @@ video_output_features = [
'deps': [ 'vaapi', 'x11' ],
'func': check_pkg_config('libva-x11', '>= 0.34.0'),
}, {
+ 'name': '--vaapi-wayland',
+ 'desc': 'VAAPI (Wayland support)',
+ 'deps': [ 'vaapi', 'wayland' ],
+ 'func': check_pkg_config('libva-wayland', '>= 0.34.0'),
+ }, {
'name': '--vaapi-vpp',
'desc': 'VAAPI VPP',
'deps': [ 'vaapi' ],
@@ -666,7 +671,7 @@ video_output_features = [
'name': 'vaapi-egl',
'desc': 'VAAPI EGL',
'deps': [ 'c11-tls' ], # indirectly
- 'deps_any': [ 'vaapi-x-egl' ],
+ 'deps_any': [ 'vaapi-x-egl', 'vaapi-wayland' ],
'func': check_true,
}, {
'name': '--caca',