вс, 15 дек. 2019 г. в 10:02, Bryan Steele <bry...@gmail.com>:
>
> On Sun, Dec 15, 2019 at 12:14:33AM -0500, Bryan Steele wrote:
> > I did a dirty, awful thing. For r600/radeonsi gallium drivers it seems
> > neccessary to compile Mesa with --enable-va for this to work. That said,
> > it seems that installing the shared libraries from this build is
> > enough to make the vainfo utility happy. I haven't seen if this
> > actualy works with ffmpeg at all.
>
> It works!
>
> The original ffmpeg diff Brad DeMorrow sent earlier was incomplete,
> with this patch to his updated port. Diff attached.
>
> ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
>   built with OpenBSD clang version 8.0.1 (tags/RELEASE_801/final) (based on 
> LLVM 8.0.1)
>   configuration: --enable-shared --arch=amd64 --cc=cc --disable-altivec 
> --disable-debug --disable-indev=jack --disable-indev=oss --disable-mipsdsp 
> --disable-mipsdspr2 --disable-mipsfpu --disable-mmi --disable-msa 
> --disable-outdev=oss --disable-outdev=sdl2 --enable-avresample 
> --enable-fontconfig --enable-frei0r --enable-gpl --enable-libaom 
> --enable-libass --enable-libdav1d --enable-libfreetype --enable-libfribidi 
> --enable-libgsm --enable-libmp3lame --enable-libopus --enable-libspeex 
> --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx 
> --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid 
> --enable-nonfree --enable-openssl --enable-vaapi 
> --extra-cflags='-I/usr/local/include -I/usr/X11R6/include' 
> --extra-libs='-L/usr/local/lib -L/usr/X11R6/lib' --extra-ldsoflags= 
> --mandir=/usr/local/man --optflags='-O2 -pipe -Wno-redundant-decls'
>   libavutil      56. 31.100 / 56. 31.100
>   libavcodec     58. 54.100 / 58. 54.100
>   libavformat    58. 29.100 / 58. 29.100
>   libavdevice    58.  8.100 / 58.  8.100
>   libavfilter     7. 57.100 /  7. 57.100
>   libavresample   4.  0.  0 /  4.  0.  0
>   libswscale      5.  5.100 /  5.  5.100
>   libswresample   3.  5.100 /  3.  5.100
>   libpostproc    55.  5.100 / 55.  5.100
> [AVHWDeviceContext @ 0x1a72a575f940] libva: VA-API version 1.6.0
> [AVHWDeviceContext @ 0x1a72a575f940] libva: va_getDriverName() returns 0
> [AVHWDeviceContext @ 0x1a72a575f940] libva: Trying to open 
> /usr/local/lib/dri/r600_drv_video.so
> [AVHWDeviceContext @ 0x1a72a575f940] libva: Found init function 
> __vaDriverInit_1_0
> [AVHWDeviceContext @ 0x1a72a575f940] libva: va_openDriver() returns 0
> [AVHWDeviceContext @ 0x1a72a575f940] Initialised VAAPI connection: version 1.6
> [AVHWDeviceContext @ 0x1a72a575f940] VAAPI driver: Mesa Gallium driver 19.0.8 
> for AMD CAICOS (DRM 2.50.0 / 6.6, LLVM 8.0.1).
> [AVHWDeviceContext @ 0x1a72a575f940] Driver not found in known nonstandard 
> list, using standard behaviour.
> [h264 @ 0x1a72c8da9000] Reinit context to 768x1088, pix_fmt: yuv420p
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'openbsd-sixdotsix.mp4':
>   Metadata:
>     major_brand     : mp42
>     minor_version   : 1
>     compatible_brands: mp41mp42isom
>     creation_time   : 2019-10-12T10:33:50.000000Z
>   Duration: 00:00:29.87, start: 0.000000, bitrate: 1666 kb/s
>     Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 
> 0x31637661), yuv420p(tv, bt709, left), 754x1080 (768x1088), 1660 kb/s, 30 
> fps, 30 tbr, 600 tbn, 1200 tbc (default)
>     Metadata:
>       creation_time   : 2019-10-12T10:33:50.000000Z
>       handler_name    : Core Media Video
> Stream mapping:
>   Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
> Press [q] to stop, [?] for help
> [h264 @ 0x1a731863f800] Reinit context to 768x1088, pix_fmt: vaapi_vld
> [graph 0 input from stream 0:0 @ 0x1a73156e7100] w:754 h:1080 
> pixfmt:vaapi_vld tb:1/600 fr:30/1 sar:0/1 sws_param:flags=2
> Output #0, null, to 'pipe:':
>   Metadata:
>     major_brand     : mp42
>     minor_version   : 1
>     compatible_brands: mp41mp42isom
>     encoder         : Lavf58.29.100
>     Stream #0:0(und): Video: wrapped_avframe, 1 reference frame, 
> vaapi_vld(left), 754x1080, q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)
>     Metadata:
>       creation_time   : 2019-10-12T10:33:50.000000Z
>       handler_name    : Core Media Video
>       encoder         : Lavc58.54.100 wrapped_avframe
> No more output streams to write to, finishing.:28.90 bitrate=N/A speed=5.74x
> frame=  896 fps=173 q=-0.0 Lsize=N/A time=00:00:29.86 bitrate=N/A speed=5.78x
> video:469kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB 
> muxing overhead: unknown
> Input file #0 (openbsd-sixdotsix.mp4):
>   Input stream #0:0 (video): 897 packets read (6207755 bytes); 896 frames 
> decoded;
>   Total: 897 packets (6207755 bytes) demuxed
> Output file #0 (pipe:):
> s);
>   Total: 896 packets (480256 bytes) muxed
> [AVIOContext @ 0x1a731ff5b000] Statistics: 6254355 bytes read, 2 seeks
>
> --- graphics/ffmpeg/Makefile    Sun Dec 15 01:53:55 2019
> +++ graphics/ffmpeg/Makefile    Sun Dec 15 01:25:13 2019
> @@ -63,12 +63,12 @@
>                 textproc/libxml
>
>  # inter-library dependencies for the current configuration
> -LIBavcodec_EXTRALIBS=-L${LOCALBASE}/lib -laom -ldav1d -lgsm -liconv -llzma 
> -lmp3lame -lopus -lspeex -ltheoradec -ltheoraenc -lvorbis -lvorbisenc -lvpx 
> -lx264 -lx265 -lxvidcore -lm -lz -pthread
> +LIBavcodec_EXTRALIBS=-L${LOCALBASE}/lib -laom -ldav1d -lgsm -liconv -llzma 
> -lmp3lame -lopus -lspeex -ltheoradec -ltheoraenc -lvorbis -lvorbisenc -lvpx 
> -lx264 -lx265 -lxvidcore -lm -lz -pthread -lva -lva-drm -lva-x11
>  LIBavdevice_EXTRALIBS=-L${LOCALBASE}/lib -L${X11BASE}/lib -lX11 -lXext -lXv 
> -lxcb-shape -lxcb-shm -lxcb-xfixes -lxcb -lsndio -lv4l2 -lm
>  LIBavfilter_EXTRALIBS=-L${LOCALBASE}/lib -L${X11BASE}/lib -lass -lfontconfig 
> -lfreetype -lfribidi -lm -lz -pthread
>  LIBavformat_EXTRALIBS=-L${LOCALBASE}/lib -lbz2 -lxml2 -lssl -lcrypto -lm -lz
>  LIBavresample_EXTRALIBS=-lm
> -LIBavutil_EXTRALIBS=-lm -pthread
> +LIBavutil_EXTRALIBS=-lm -pthread -L${LOCALBASE}/lib -lva -lva-drm -lva-x11
>  LIBpostproc_EXTRALIBS=-lm
>  LIBswresample_EXTRALIBS=-lm
>  LIBswscale_EXTRALIBS=-lm

This would break non-x86 archs. I'm attaching a patch for ffmpeg that
should work everywhere. But I don't have anything except amd64, so
this definitely needs testing, and, of course, then approvement from
Brad Smith.

-- 
  WBR,
  Vadim Zhukov
Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/ffmpeg/Makefile,v
retrieving revision 1.196
diff -u -p -r1.196 Makefile
--- Makefile	7 Nov 2019 10:13:50 -0000	1.196
+++ Makefile	15 Dec 2019 16:37:14 -0000
@@ -4,7 +4,7 @@ COMMENT=	audio/video converter and strea
 
 V=		4.2.1
 DISTNAME=	ffmpeg-${V}
-REVISION=	2
+REVISION=	3
 EPOCH=		0
 CATEGORIES=	graphics multimedia
 MASTER_SITES=	https://ffmpeg.org/releases/
@@ -29,7 +29,7 @@ PERMIT_PACKAGE=	Yes
 
 WANTLIB+=	SDL2 X11 Xext Xv aom ass bz2 c crypto dav1d fontconfig
 WANTLIB+=	freetype fribidi gsm iconv lzma m mp3lame ogg opus
-WANTLIB+=	pthread sndio speex ssl theoradec theoraenc v4l2
+WANTLIB+=	pthread sndio speex ssl theoradec theoraenc v4l2 va
 WANTLIB+=	vorbis vorbisenc vpx x264 x265 xcb xcb-shape xcb-shm
 WANTLIB+=	xcb-xfixes xml2 xvidcore z
 
@@ -50,6 +50,7 @@ LIB_DEPENDS=	archivers/bzip2 \
 		audio/gsm \
 		converters/libiconv \
 		devel/sdl2 \
+		graphics/libva \
 		multimedia/aom \
 		multimedia/dav1d \
 		multimedia/libass \
@@ -61,13 +62,18 @@ LIB_DEPENDS=	archivers/bzip2 \
 		multimedia/xvidcore \
 		textproc/libxml
 
+.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
+LIB_DEPENDS +=	graphics/libva
+VAAPI_LIBS=-L${LOCALBASE}/lib -lva-x11 -lva-drm -lva
+.endif
+
 # inter-library dependencies for the current configuration
-LIBavcodec_EXTRALIBS=-L${LOCALBASE}/lib -laom -ldav1d -lgsm -liconv -llzma -lmp3lame -lopus -lspeex -ltheoradec -ltheoraenc -lvorbis -lvorbisenc -lvpx -lx264 -lx265 -lxvidcore -lm -lz -pthread
+LIBavcodec_EXTRALIBS=${VAAPI_LIBS} -L${LOCALBASE}/lib -laom -ldav1d -lgsm -liconv -llzma -lmp3lame -lopus -lspeex -ltheoradec -ltheoraenc -lvorbis -lvorbisenc -lvpx -lx264 -lx265 -lxvidcore -lm -lz -pthread
 LIBavdevice_EXTRALIBS=-L${LOCALBASE}/lib -L${X11BASE}/lib -lX11 -lXext -lXv -lxcb-shape -lxcb-shm -lxcb-xfixes -lxcb -lsndio -lv4l2 -lm
 LIBavfilter_EXTRALIBS=-L${LOCALBASE}/lib -L${X11BASE}/lib -lass -lfontconfig -lfreetype -lfribidi -lm -lz -pthread
 LIBavformat_EXTRALIBS=-L${LOCALBASE}/lib -lbz2 -lxml2 -lssl -lcrypto -lm -lz
 LIBavresample_EXTRALIBS=-lm
-LIBavutil_EXTRALIBS=-lm -pthread
+LIBavutil_EXTRALIBS=${VAAPI_LIBS} -lm -pthread
 LIBpostproc_EXTRALIBS=-lm
 LIBswresample_EXTRALIBS=-lm
 LIBswscale_EXTRALIBS=-lm
@@ -96,8 +102,10 @@ CONFIGURE_ARGS+=--enable-shared \
 		--disable-mipsfpu \
 		--disable-mmi \
 		--disable-msa \
+		--disable-msa2 \
 		--disable-outdev=oss \
 		--disable-outdev=sdl2 \
+		--disable-securetransport \
 		--enable-avresample \
 		--enable-fontconfig \
 		--enable-frei0r \

Reply via email to