From f5ca11e12bc55d14bd6895b619c4abfd470c6452 Mon Sep 17 00:00:00 2001 From: llyyr Date: Wed, 20 Sep 2023 02:50:26 +0530 Subject: [PATCH] meson: make libplacebo a required dependency Make it not possible to build mpv without the latest libplacebo anymore. This will allow for less code duplication between mpv and libplacebo, and in the future also let us delete legacy ifdefs and track libplacebo better. --- ci/build-macos.sh | 2 +- ci/build-mingw64.sh | 2 +- meson.build | 44 ++++++++++++-------------------- meson_options.txt | 1 - player/main.c | 4 --- video/out/gpu/hwdec.c | 2 +- video/out/hwdec/hwdec_drmprime.c | 2 +- video/out/hwdec/hwdec_vaapi.c | 2 -- video/out/vo.c | 2 -- 9 files changed, 20 insertions(+), 41 deletions(-) diff --git a/ci/build-macos.sh b/ci/build-macos.sh index 19288578a6..14b3a1b934 100755 --- a/ci/build-macos.sh +++ b/ci/build-macos.sh @@ -14,7 +14,7 @@ PKG_CONFIG_PATH="${FFMPEG_SYSROOT}/lib/pkgconfig/" CC="${CC}" CXX="${CXX}" \ meson setup build \ -Dprefix="${MPV_INSTALL_PREFIX}" \ -D{libmpv,tests}=true \ - -D{gl,iconv,lcms2,libplacebo,lua,jpeg,plain-gl,zlib}=enabled \ + -D{gl,iconv,lcms2,lua,jpeg,plain-gl,zlib}=enabled \ -D{cocoa,coreaudio,gl-cocoa,macos-cocoa-cb,macos-touchbar,videotoolbox-gl}=enabled meson compile -C build -j4 diff --git a/ci/build-mingw64.sh b/ci/build-mingw64.sh index 259ba86c5a..57068c1c9b 100755 --- a/ci/build-mingw64.sh +++ b/ci/build-mingw64.sh @@ -272,7 +272,7 @@ meson setup $build --cross-file "$prefix_dir/crossfile" \ -Dc_args="-Wno-error=deprecated -Wno-error=deprecated-declarations" \ --buildtype debugoptimized \ -Dlibmpv=true -Dlua=luajit \ - -D{shaderc,spirv-cross,d3d11,libplacebo}=enabled + -D{shaderc,spirv-cross,d3d11}=enabled meson compile -C $build diff --git a/meson.build b/meson.build index 1067284e7f..2ccba61138 100644 --- a/meson.build +++ b/meson.build @@ -23,6 +23,9 @@ libavutil = dependency('libavutil', version: '>= 56.70.100') libswresample = dependency('libswresample', version: '>= 3.9.100') libswscale = dependency('libswscale', version: '>= 5.9.100') +libplacebo = dependency('libplacebo', version: '>=6.338.0', fallback: ['libplacebo', 'libplacebo'], + default_options: ['default_library=static', 'demos=false']) + libass = dependency('libass', version: '>= 0.12.2') # the dependency order of libass -> ffmpeg is necessary due to @@ -32,6 +35,7 @@ dependencies = [libass, libavfilter, libavformat, libavutil, + libplacebo, libswresample, libswscale] @@ -44,6 +48,7 @@ features = { 'avif-muxer': libavformat.version().version_compare('>= 59.24.100'), 'libass': true, 'threads': true, + 'libplacebo': true, } @@ -234,6 +239,12 @@ sources = files( 'video/repack.c', 'video/sws_utils.c', + ## libplacebo + 'video/out/placebo/ra_pl.c', + 'video/out/placebo/utils.c', + 'video/out/vo_gpu_next.c', + 'video/out/gpu_next/context.c', + ## osdep 'osdep/io.c', 'osdep/semaphore_osx.c', @@ -930,16 +941,6 @@ if features['jpeg'] dependencies += jpeg endif -libplacebo = dependency('libplacebo', version: '>=6.292.0', required: get_option('libplacebo')) -features += {'libplacebo': libplacebo.found()} -if features['libplacebo'] - dependencies += libplacebo - sources += files('video/out/placebo/ra_pl.c', - 'video/out/placebo/utils.c', - 'video/out/vo_gpu_next.c', - 'video/out/gpu_next/context.c') -endif - sdl2_video = get_option('sdl2-video').require( features['sdl2'], error_message: 'sdl2 was not found!', @@ -1257,7 +1258,7 @@ endif # vulkan vulkan_opt = get_option('vulkan').require( libplacebo.get_variable('pl_has_vulkan', default_value: '0') == '1', - error_message: 'libplacebo could not be found!', + error_message: 'libplacebo compiled without vulkan support!', ) vulkan = dependency('vulkan', version: '>= 1.1.70', required: vulkan_opt) features += {'vulkan': vulkan.found()} @@ -1330,9 +1331,8 @@ endif vulkan_interop = get_option('vulkan-interop').require( features['vulkan'] and vulkan.version().version_compare('>=1.3.238') and - features['libplacebo'] and libavutil.version().version_compare('>=58.11.100'), - error_message: 'Vulkan Interop requires vulkan headers >= 1.3.238, libplacebo, and libavutil >= 58.11.100', + error_message: 'Vulkan Interop requires vulkan headers >= 1.3.238, and libavutil >= 58.11.100', ) features += {'vulkan-interop': vulkan_interop.allowed()} if vulkan_interop.allowed() @@ -1426,14 +1426,9 @@ features += {'vaapi': vaapi.allowed()} if features['vaapi'] dependencies += libva sources += files('video/filter/vf_vavpp.c', - 'video/vaapi.c') -endif - -features += {'vaapi-egl': features['vaapi'] and features['egl'] and features['drm']} -features += {'vaapi-libplacebo': features['vaapi'] and libplacebo.found()} - -if features['vaapi-egl'] or features['vaapi-libplacebo'] - sources += files('video/out/hwdec/hwdec_vaapi.c') + 'video/vaapi.c', + 'video/out/hwdec/hwdec_vaapi.c', + 'video/out/hwdec/dmabuf_interop_pl.c') endif dmabuf_interop_gl = features['egl'] and features['drm'] @@ -1442,12 +1437,6 @@ if features['dmabuf-interop-gl'] sources += files('video/out/hwdec/dmabuf_interop_gl.c') endif -dmabuf_interop_pl = features['vaapi-libplacebo'] -features += {'dmabuf-interop-pl': dmabuf_interop_pl} -if features['dmabuf-interop-pl'] - sources += files('video/out/hwdec/dmabuf_interop_pl.c') -endif - vdpau_opt = get_option('vdpau').require( features['x11'], error_message: 'x11 was not found!', @@ -1786,7 +1775,6 @@ if get_option('tests') endif summary({'d3d11': features['d3d11'], - 'gpu-next': features['libplacebo'], 'javascript': features['javascript'], 'libmpv': get_option('libmpv'), 'lua': features['lua'], diff --git a/meson_options.txt b/meson_options.txt index b22884354f..8a7e4af4f9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -74,7 +74,6 @@ option('gl-dxinterop', type: 'feature', value: 'auto', description: 'OpenGL/Dire option('gl-win32', type: 'feature', value: 'auto', description: 'OpenGL Win32 Backend') option('gl-x11', type: 'feature', value: 'disabled', description: 'OpenGL X11/GLX (deprecated/legacy)') option('jpeg', type: 'feature', value: 'auto', description: 'JPEG support') -option('libplacebo', type: 'feature', value: 'auto', description: 'libplacebo support') option('rpi', type: 'feature', value: 'disabled', description: 'Raspberry Pi support') option('sdl2-video', type: 'feature', value: 'auto', description: 'SDL2 video output') option('shaderc', type: 'feature', value: 'auto', description: 'libshaderc SPIR-V compiler') diff --git a/player/main.c b/player/main.c index 8f0e63b418..cd84026730 100644 --- a/player/main.c +++ b/player/main.c @@ -26,9 +26,7 @@ #include "config.h" -#if HAVE_LIBPLACEBO #include -#endif #include "mpv_talloc.h" @@ -149,9 +147,7 @@ void mp_print_version(struct mp_log *log, int always) mp_msg(log, v, "%s %s\n", mpv_version, mpv_copyright); if (strcmp(mpv_builddate, "UNKNOWN")) mp_msg(log, v, " built on %s\n", mpv_builddate); -#if HAVE_LIBPLACEBO mp_msg(log, v, "libplacebo version: %s\n", PL_VERSION); -#endif check_library_versions(log, v); mp_msg(log, v, "\n"); // Only in verbose mode. diff --git a/video/out/gpu/hwdec.c b/video/out/gpu/hwdec.c index 878ac148fb..d8be6da777 100644 --- a/video/out/gpu/hwdec.c +++ b/video/out/gpu/hwdec.c @@ -41,7 +41,7 @@ extern const struct ra_hwdec_driver ra_hwdec_aimagereader; extern const struct ra_hwdec_driver ra_hwdec_vulkan; const struct ra_hwdec_driver *const ra_hwdec_drivers[] = { -#if HAVE_VAAPI_EGL || HAVE_VAAPI_LIBPLACEBO +#if HAVE_VAAPI &ra_hwdec_vaapi, #endif #if HAVE_VIDEOTOOLBOX_GL || HAVE_IOS_GL diff --git a/video/out/hwdec/hwdec_drmprime.c b/video/out/hwdec/hwdec_drmprime.c index 290f11c535..f7c6250cb6 100644 --- a/video/out/hwdec/hwdec_drmprime.c +++ b/video/out/hwdec/hwdec_drmprime.c @@ -55,7 +55,7 @@ const static dmabuf_interop_init interop_inits[] = { #if HAVE_DMABUF_INTEROP_GL dmabuf_interop_gl_init, #endif -#if HAVE_DMABUF_INTEROP_PL +#if HAVE_VAAPI dmabuf_interop_pl_init, #endif #if HAVE_DMABUF_WAYLAND diff --git a/video/out/hwdec/hwdec_vaapi.c b/video/out/hwdec/hwdec_vaapi.c index 2eb458fa99..d8a45171a0 100644 --- a/video/out/hwdec/hwdec_vaapi.c +++ b/video/out/hwdec/hwdec_vaapi.c @@ -128,9 +128,7 @@ const static dmabuf_interop_init interop_inits[] = { #if HAVE_DMABUF_INTEROP_GL dmabuf_interop_gl_init, #endif -#if HAVE_DMABUF_INTEROP_PL dmabuf_interop_pl_init, -#endif #if HAVE_DMABUF_WAYLAND dmabuf_interop_wl_init, #endif diff --git a/video/out/vo.c b/video/out/vo.c index 8d907d6bde..9b48ad20a7 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -76,9 +76,7 @@ static const struct vo_driver *const video_out_drivers[] = &video_out_mediacodec_embed, #endif &video_out_gpu, -#if HAVE_LIBPLACEBO &video_out_gpu_next, -#endif #if HAVE_VDPAU &video_out_vdpau, #endif