diff options
author | Dudemanguy <random342@airmail.cc> | 2023-07-12 20:11:32 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-07-14 14:24:45 +0000 |
commit | 2616b2b11eac26dfbb85926477a652d2a0540ef6 (patch) | |
tree | 127ff33a2175caf750bfe7a767a4bceee9222801 | |
parent | cf0373e15bbe3da8af7b3d1bbe1ae5caee9672cf (diff) | |
download | mpv-2616b2b11eac26dfbb85926477a652d2a0540ef6.tar.bz2 mpv-2616b2b11eac26dfbb85926477a652d2a0540ef6.tar.xz |
build: make dmabuf-wayland a build option and require drm
It makes more sense as an option at this point. Also libdrm is not
optional at all. You have to get a drm format and modifier for this to
even work (the VO will just fail without DRM). Just hard require it and
remove the guards. vaapi can remain optional.
-rw-r--r-- | meson.build | 20 | ||||
-rw-r--r-- | meson_options.txt | 1 | ||||
-rw-r--r-- | video/out/vo_dmabuf_wayland.c | 8 | ||||
-rw-r--r-- | wscript | 10 |
4 files changed, 19 insertions, 20 deletions
diff --git a/meson.build b/meson.build index 19448f44f6..8754a1b5e3 100644 --- a/meson.build +++ b/meson.build @@ -1013,6 +1013,18 @@ if features['wayland'] and features['memfd_create'] sources += files('video/out/vo_wlshm.c') endif +dmabuf_wayland = get_option('dmabuf-wayland').require( + features['drm'] and features['memfd_create'] and features['wayland'], + error_message: 'drm, memfd_create, or wayland was not found!', +) +features += {'dmabuf-wayland': dmabuf_wayland.allowed()} +if features['dmabuf-wayland'] + sources += files('video/out/vo_dmabuf_wayland.c') + sources += files('video/out/hwdec/dmabuf_interop_wl.c') + sources += files('video/out/wldmabuf/context_wldmabuf.c') + sources += files('video/out/wldmabuf/ra_wldmabuf.c') +endif + x11_opt = get_option('x11').require( get_option('gpl'), error_message: 'the build is not GPL!', @@ -1431,14 +1443,6 @@ if features['dmabuf-interop-pl'] sources += files('video/out/hwdec/dmabuf_interop_pl.c') endif -features += {'dmabuf-wayland' : features['wayland'] and features['memfd_create'] and (features['vaapi-wayland'] or features['drm'])} -if features['dmabuf-wayland'] - sources += files('video/out/vo_dmabuf_wayland.c') - sources += files('video/out/hwdec/dmabuf_interop_wl.c') - sources += files('video/out/wldmabuf/context_wldmabuf.c') - sources += files('video/out/wldmabuf/ra_wldmabuf.c') -endif - vdpau_opt = get_option('vdpau').require( features['x11'], error_message: 'x11 was not found!', diff --git a/meson_options.txt b/meson_options.txt index 65047b110f..5f2d31df3d 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -58,6 +58,7 @@ option('caca', type: 'feature', value: 'auto', description: 'CACA') option('cocoa', type: 'feature', value: 'auto', description: 'Cocoa') option('d3d11', type: 'feature', value: 'auto', description: 'Direct3D 11 video output') option('direct3d', type: 'feature', value: 'auto', description: 'Direct3D support') +option('dmabuf-wayland', type: 'feature', value: 'auto', description: 'dmabuf-wayland video output') option('drm', type: 'feature', value: 'auto', description: 'DRM') option('egl', type: 'feature', value: 'auto', description: 'EGL 1.4') option('egl-android', type: 'feature', value: 'auto', description: 'Android EGL support') diff --git a/video/out/vo_dmabuf_wayland.c b/video/out/vo_dmabuf_wayland.c index e46dcadb47..269ddc2a3d 100644 --- a/video/out/vo_dmabuf_wayland.c +++ b/video/out/vo_dmabuf_wayland.c @@ -15,6 +15,7 @@ * License along with mpv. If not, see <http://www.gnu.org/licenses/>. */ +#include <libavutil/hwcontext_drm.h> #include <sys/mman.h> #include <unistd.h> #include "config.h" @@ -22,9 +23,6 @@ #if HAVE_VAAPI #include <va/va_drmcommon.h> #endif -#if HAVE_DRM -#include <libavutil/hwcontext_drm.h> -#endif #include "common/global.h" #include "gpu/hwdec.h" @@ -192,19 +190,16 @@ done: static uintptr_t drmprime_surface_id(struct mp_image *src) { uintptr_t id = 0; -#if HAVE_DRM struct AVDRMFrameDescriptor *desc = (AVDRMFrameDescriptor *)src->planes[0]; AVDRMObjectDescriptor object = desc->objects[0]; id = (uintptr_t)object.fd; -#endif return id; } static void drmprime_dmabuf_importer(struct buffer *buf, struct mp_image *src, struct zwp_linux_buffer_params_v1 *params) { -#if HAVE_DRM int layer_no, plane_no; int max_planes = 0; const AVDRMFrameDescriptor *desc = (AVDRMFrameDescriptor *)src->planes[0]; @@ -227,7 +222,6 @@ static void drmprime_dmabuf_importer(struct buffer *buf, struct mp_image *src, plane.pitch, modifier >> 32, modifier & 0xffffffff); } } -#endif } static intptr_t surface_id(struct vo *vo, struct mp_image *src) @@ -569,6 +569,11 @@ video_output_features = [ 'deps': 'wayland', 'func': check_statement('sys/mman.h', 'memfd_create("mpv", MFD_CLOEXEC | MFD_ALLOW_SEALING)') + }, { + 'name': '--dmabuf-wayland', + 'desc': 'dmabuf-wayland video output', + 'deps': 'wayland && memfd_create && drm', + 'func': check_true, } , { 'name': '--x11', 'desc': 'X11', @@ -697,11 +702,6 @@ video_output_features = [ 'deps': 'vaapi && gl-wayland', 'func': check_pkg_config('libva-wayland', '>= 1.1.0'), }, { - 'name': 'dmabuf-wayland', - 'desc': 'Wayland dmabuf support', - 'deps': 'wayland && memfd_create && (vaapi-wayland || drm)', - 'func': check_true, - }, { 'name': '--vaapi-drm', 'desc': 'VAAPI (DRM/EGL support)', 'deps': 'vaapi && egl-drm', |