summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/hwdec_vaegl.c
diff options
context:
space:
mode:
authorAnton Kindestam <antonki@kth.se>2018-06-28 15:06:41 +0200
committerJan Ekström <jeebjp@gmail.com>2018-07-09 02:33:35 +0300
commit351c083487050c88adb0e3d60f2174850f869018 (patch)
tree79664f12e0815e590470d07873c724d42608ec1e /video/out/opengl/hwdec_vaegl.c
parent7beee68f8d8617557990a5f860d9d1f99c4ba009 (diff)
downloadmpv-351c083487050c88adb0e3d60f2174850f869018.tar.bz2
mpv-351c083487050c88adb0e3d60f2174850f869018.tar.xz
hwdec_vaegl: Fix VAAPI EGL interop used with gpu-context=drm
Add another parameter to mpv_opengl_drm_params to hold the FD to the render node, so that the fd can be passed to hwdec_vaegl. The render node is opened in context_drm_egl and inferred from the primary device fd using drmGetRenderDeviceNameFromFd.
Diffstat (limited to 'video/out/opengl/hwdec_vaegl.c')
-rw-r--r--video/out/opengl/hwdec_vaegl.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/video/out/opengl/hwdec_vaegl.c b/video/out/opengl/hwdec_vaegl.c
index 1620617c03..2ff0d98df3 100644
--- a/video/out/opengl/hwdec_vaegl.c
+++ b/video/out/opengl/hwdec_vaegl.c
@@ -36,6 +36,7 @@
#include "video/vaapi.h"
#include "common.h"
#include "ra_gl.h"
+#include "libmpv/render_gl.h"
#ifndef GL_OES_EGL_image
typedef void* GLeglImageOES;
@@ -77,11 +78,11 @@ static VADisplay *create_wayland_va_display(struct ra *ra)
static VADisplay *create_drm_va_display(struct ra *ra)
{
- int drm_fd = (intptr_t)ra_get_native_resource(ra, "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;
+ mpv_opengl_drm_params *params = ra_get_native_resource(ra, "drm_params");
+ if (!params || params->render_fd < 0)
+ return NULL;
+
+ return vaGetDisplayDRM(params->render_fd);
}
#endif