summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-20 19:41:29 +0100
committerwm4 <wm4@nowhere>2016-01-20 19:41:29 +0100
commit68366b05f283d8f12f5602c74954e2ec986b2f50 (patch)
tree812859932e800bdabbfc3ab489cba889e4aaaee9
parentca00e347fc8bf8c7ddfd45ef488180c49537e698 (diff)
downloadmpv-68366b05f283d8f12f5602c74954e2ec986b2f50.tar.bz2
mpv-68366b05f283d8f12f5602c74954e2ec986b2f50.tar.xz
vo_opengl: add KMS/DRM VAAPI hardware decoding interop
Just requires glueing it together with Bloat Super Glue (tm).
-rw-r--r--video/out/opengl/context_drm_egl.c3
-rw-r--r--video/out/opengl/hwdec_vaegl.c18
-rw-r--r--wscript6
3 files changed, 26 insertions, 1 deletions
diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c
index 6cc5ef092b..e613fca38a 100644
--- a/video/out/opengl/context_drm_egl.c
+++ b/video/out/opengl/context_drm_egl.c
@@ -353,6 +353,9 @@ static int drm_egl_init(struct MPGLContext *ctx, int flags)
void *(*gpa)(const GLubyte*) = (void *(*)(const GLubyte*))eglGetProcAddress;
mpgl_load_functions(ctx->gl, gpa, egl_exts, ctx->vo->log);
+ ctx->native_display_type = "drm";
+ ctx->native_display = (void *)(intptr_t)p->kms->fd;
+
// required by gbm_surface_lock_front_buffer
eglSwapBuffers(p->egl.display, p->egl.surface);
diff --git a/video/out/opengl/hwdec_vaegl.c b/video/out/opengl/hwdec_vaegl.c
index 8b9dc93c09..d37c9d55dc 100644
--- a/video/out/opengl/hwdec_vaegl.c
+++ b/video/out/opengl/hwdec_vaegl.c
@@ -65,6 +65,19 @@ static VADisplay *create_wayland_va_display(GL *gl)
}
#endif
+#if HAVE_VAAPI_DRM
+#include <va/va_drm.h>
+
+static VADisplay *create_drm_va_display(GL *gl)
+{
+ int drm_fd = (intptr_t)gl->MPGetNativeDisplay("drm");
+ // Note: yes, drm_fd==0 could be valid - but it's rare and doesn't fit with
+ // our slightly crappy way of passing it through, so consider 0 not
+ // valid.
+ return drm_fd ? vaGetDisplayDRM(drm_fd) : NULL;
+}
+#endif
+
static VADisplay *create_native_va_display(GL *gl)
{
if (!gl->MPGetNativeDisplay)
@@ -80,6 +93,11 @@ static VADisplay *create_native_va_display(GL *gl)
if (display)
return display;
#endif
+#if HAVE_VAAPI_DRM
+ display = create_drm_va_display(gl);
+ if (display)
+ return display;
+#endif
return display;
}
diff --git a/wscript b/wscript
index 8d15f383f3..ca48401c4e 100644
--- a/wscript
+++ b/wscript
@@ -705,7 +705,11 @@ video_output_features = [
'desc': 'VAAPI (Wayland support)',
'deps': [ 'vaapi', 'gl-wayland' ],
'func': check_pkg_config('libva-wayland', '>= 0.36.0'),
-
+ }, {
+ 'name': '--vaapi-drm',
+ 'desc': 'VAAPI (DRM/EGL support)',
+ 'deps': [ 'vaapi', 'egl-drm' ],
+ 'func': check_pkg_config('libva-drm', '>= 0.36.0'),
}, {
'name': '--vaapi-glx',
'desc': 'VAAPI GLX',