mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
cf0373e15b
commit
2616b2b11e
20
meson.build
20
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!',
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
10
wscript
10
wscript
|
@ -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',
|
||||
|
@ -696,11 +701,6 @@ video_output_features = [
|
|||
'desc': 'VAAPI (Wayland support)',
|
||||
'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)',
|
||||
|
|
Loading…
Reference in New Issue