Download raw body.
graphics/ffmpeg: enable Vulkan support
Hi Brad, ports,
The following enables Vulkan support in FFmpeg. With this, and some
special environment variables, I'm able to use mpv with Vulkan-backed
accelerated decoding, which in particular means that there is support
for AMD-based accelerated video decoding.
There isn't anything out of the ordinary in the patch, with the
exception of some reordering of lines to keep things sorted, and I
also took the chance to add a missing LDEP on devel/fribidi.
To test this with mpv, please follow the instructions at [0]. In
particular, the environment variables listed (ANV_VIDEO_DECODE,
RADV_PERFTEST) are required for our Mesa to enable access to the
decoding APIs. In order to detect support for accelerated decoding
capabilities, set the corresponding environment variable and run
`vulkaninfo | grep -i video`. `vulkaninfo` is part of vulkan-tools pkg.
[0]: https://github.com/mpv-player/mpv/discussions/13909#discussion-6516065
OK?
Lucas
diff refs/heads/master 5b7cbbe278eb6b4b260d4a187a37944dee9e0aa8
commit - 92ae7b84d551b0910cb7a5fd62a5d9d7eecc3a42
commit + 5b7cbbe278eb6b4b260d4a187a37944dee9e0aa8
blob - 5f23a53961dfc3a34de5823a7e5774dddc8fa0c2
blob + 44265c29fb8fb16cf00e19b483562689d2e5ed33
--- graphics/ffmpeg/Makefile
+++ graphics/ffmpeg/Makefile
@@ -2,7 +2,7 @@ COMMENT= audio/video converter and streamer
V= 6.1.2
DISTNAME= ffmpeg-${V}
-REVISION= 1
+REVISION= 2
EPOCH= 1
CATEGORIES= graphics multimedia
SITES= https://ffmpeg.org/releases/
@@ -27,20 +27,24 @@ MAINTAINER= Brad Smith <brad@comstyle.com>
PERMIT_PACKAGE= Yes
WANTLIB += SDL2 X11 Xext Xv aom ass bz2 c crypto dav1d fontconfig
-WANTLIB += freetype fribidi gsm iconv lzma m mp3lame opus pthread
+WANTLIB += freetype fribidi glslang gsm iconv lzma m mp3lame opus pthread
WANTLIB += sndio speex ssl theoradec theoraenc v4l2 va va-drm
WANTLIB += va-x11 vidstab vorbis vorbisenc vpx webp webpmux x264
WANTLIB += x265 xcb xcb-shape xcb-shm xcb-xfixes xml2 xvidcore z
WANTLIB += zimg
+# dlopen
+WANTLIB += vulkan
+
COMPILER= base-clang ports-gcc
COMPILER_LANGS= c
DEBUG_PACKAGES= ${BUILD_PACKAGES}
BUILD_DEPENDS= audio/ladspa \
- textproc/texi2html \
- multimedia/frei0r-plugins
+ graphics/vulkan-headers \
+ multimedia/frei0r-plugins \
+ textproc/texi2html
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
BUILD_DEPENDS+= devel/nasm
.endif
@@ -52,7 +56,9 @@ LIB_DEPENDS= archivers/bzip2 \
audio/speex \
audio/gsm \
converters/libiconv \
+ devel/fribidi \
devel/sdl2 \
+ graphics/glslang \
graphics/libwebp \
graphics/zimg \
multimedia/aom \
@@ -67,6 +73,9 @@ LIB_DEPENDS= archivers/bzip2 \
multimedia/xvidcore \
textproc/libxml
+# dlopen'd
+LIB_DEPENDS+= graphics/vulkan-loader
+
# inter-library dependencies for the current configuration
LIBavcodec_EXTRALIBS=-L${LOCALBASE}/lib -L${X11BASE}/lib -laom -ldav1d -lgsm -liconv -llzma
LIBavcodec_EXTRALIBS+=-lmp3lame -lopus -lspeex -ltheoradec -ltheoraenc -lvorbis
@@ -77,7 +86,7 @@ LIBavdevice_EXTRALIBS=-L${LOCALBASE}/lib -L${X11BASE}/
LIBavdevice_EXTRALIBS+=-lxcb-shape -lxcb-shm -lxcb-xfixes -lxcb -lsndio -lv4l2 -lm
LIBavfilter_EXTRALIBS=-L${LOCALBASE}/lib -L${X11BASE}/lib -lass -lfontconfig
-LIBavfilter_EXTRALIBS+=-lfreetype -lfribidi -lvidstab -lm -lz -lzimg -lva -pthread
+LIBavfilter_EXTRALIBS+=-lfreetype -lfribidi -lglslang -lvidstab -lm -lz -lzimg -lva -pthread
LIBavformat_EXTRALIBS=-L${LOCALBASE}/lib -lbz2 -lxml2 -lssl -lcrypto -lm -lz
@@ -108,7 +117,6 @@ CONFIGURE_ARGS+=--enable-shared \
--disable-stripping \
--disable-indev=jack \
--disable-outdev=sdl2 \
- --disable-vulkan \
--enable-fontconfig \
--enable-frei0r \
--enable-gpl \
@@ -119,12 +127,14 @@ CONFIGURE_ARGS+=--enable-shared \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
+ --enable-libglslang \
--enable-libgsm \
--enable-libmp3lame \
--enable-libopus \
--enable-libspeex \
--enable-libtheora \
--enable-libv4l2 \
+ --enable-libvidstab \
--enable-libvorbis \
--enable-libvpx \
--enable-libwebp \
@@ -135,7 +145,7 @@ CONFIGURE_ARGS+=--enable-shared \
--enable-libzimg \
--enable-nonfree \
--enable-openssl \
- --enable-libvidstab \
+ --enable-vulkan \
--extra-cflags="-I${LOCALBASE}/include -I${X11BASE}/include" \
--extra-libs="-L${LOCALBASE}/lib -L${X11BASE}/lib" \
--extra-ldsoflags="${LDLIBFLAGS}" \
blob - fa16df99b92aa9200c8b4a978cbaff238bcb8723
blob + e79718b368b29605f2383da5c3cdf2051d35f7fe
--- graphics/ffmpeg/patches/patch-configure
+++ graphics/ffmpeg/patches/patch-configure
@@ -6,6 +6,10 @@
- Fix broken libatomic test
+- Fix libglslang support detection, as our libglslang doesn't provide
+ some deprecated .so stubs (HSLS, OGLCompiler, MachineIndependent,
+ OSDependent, SPIRV, GenericCodeGen), and remove unneeded libs
+
Index: configure
--- configure.orig
+++ configure
@@ -91,7 +95,21 @@ Index: configure
check_builtin stdatomic stdatomic.h \
"atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar" \
$LATOMIC && eval stdatomic_extralibs="\$LATOMIC" && break
-@@ -7748,6 +7759,7 @@ if enabled ppc; then
+@@ -6715,11 +6726,9 @@ enabled libfreetype && require_pkg_config libfre
+ enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
+ enabled libharfbuzz && require_pkg_config libharfbuzz harfbuzz hb.h hb_buffer_create
+ enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
+- -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \
+- -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||
++ -lglslang -lpthread -lstdc++ -lm ||
+ require spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
+- -lglslang -lOSDependent -lHLSL -lOGLCompiler \
+- -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm; }
++ -lglslang -lpthread -lstdc++ -lm; }
+ enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
+ require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
+ enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
+@@ -7748,6 +7757,7 @@ if enabled ppc; then
echo "POWER8 enabled ${power8-no}"
echo "PPC 4xx optimizations ${ppc4xx-no}"
echo "dcbzl available ${dcbzl-no}"
graphics/ffmpeg: enable Vulkan support