summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/hwdec_vaegl.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/opengl/hwdec_vaegl.c')
-rw-r--r--video/out/opengl/hwdec_vaegl.c18
1 files changed, 18 insertions, 0 deletions
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;
}