martos Posted July 31, 2018 Author Posted July 31, 2018 the same with kavas: [h264_v4l2m2m @ 0xaaaaf4606910] Could not find a valid device [h264_v4l2m2m @ 0xaaaaf4606910] can't configure decoder In my opinion i must have /dev/video0 ( ely ): You should get a /dev/video0 node if the decoder probe was successful And in dmesg [ 6.889112] libphy: stmmac: probed [ 7.129018] meson_pwrc_vdec_power_on [ 7.129024] meson_pwrc_vdec_setup_clk [ 7.129505] Requesting IRQ 32 [ 7.129702] meson_pwrc_vdec_power_off [ 7.762147] vdec_open [ 7.762166] vdec_querycap [ 7.762305] vdec_close And i don't have /dev/video0 and no vdec in dmesg ...
martos Posted July 31, 2018 Author Posted July 31, 2018 I think i need the PC to use cross-compilation, it seem easier to run the build on the device BUT i don't find an "how to" for make a VM for cross compiling vm kernel. Could some one can give me some link to make it ?
talraash Posted July 31, 2018 Posted July 31, 2018 13 minutes ago, martos said: I think i need the PC to use cross-compilation, it seem easier to run the build on the device BUT i don't find an "how to" for make a VM for cross compiling vm kernel. Could some one can give me some link to make it ? Many clue you can find in armbian documentation... And you can compile "kernel only" for s9xx box from balbes150 fork https://github.com/150balbes/Build-Armbian
martos Posted July 31, 2018 Author Posted July 31, 2018 So install in my PC https://www.virtualbox.org/wiki/Downloads create vm ( 10 CPU 16 G Ram ) with http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/installer-amd64/current/images/netboot/mini.iso minimal + sudo apt-get install sed wget cvs subversion git-core \ coreutils unzip texi2html texinfo docbook-utils \ gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ \ desktop-file-utils chrpath default-jre gettext zip sudo apt-get update -qq && sudo apt-get -y install \ autoconf \ automake \ build-essential \ cmake \ git-core \ libass-dev \ libfreetype6-dev \ libsdl2-dev \ libtool \ libva-dev \ libvdpau-dev \ libvorbis-dev \ libxcb1-dev \ libxcb-shm0-dev \ libxcb-xfixes0-dev \ pkg-config \ texinfo \ wget \ zlib1g-dev sudo apt-get install yasm sudo apt-get -y install bc curl gcc git libssl-dev libncurses5-dev lzop make u-boot-tools sudo apt-get install locate mc download kernel git clone https://github.com/Elyotna/linux sudo apt-get install flex bison sudo apt-get install elfutils make menuconfig save make -j10 waiting ...
martos Posted July 31, 2018 Author Posted July 31, 2018 Could you give me some information : it's on the menuconfig where it's choose arm compile ? the S905 cpu ? How i choose the dtb to compile ? How i can install the kernel ? ( if i don't make mistake ) ps: it's the firts time where i see my PC at the max for long time ... 35 minutes ...
martos Posted July 31, 2018 Author Posted July 31, 2018 try to understand https://wiki.libreelec.tv/compile#tab__for_version_90_current_github_master https://github.com/umiddelb/armhf/wiki/How-To-compile-a-custom-Linux-kernel-for-your-ARM-device and adapt
martos Posted July 31, 2018 Author Posted July 31, 2018 i find the command : cat /proc/config.gz | gunzip | less give this : # # Automatically generated file; DO NOT EDIT. # Linux/arm64 4.18.0-rc5 Kernel Configuration # # # Compiler: aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011 # CONFIG_ARM64=y CONFIG_64BIT=y CONFIG_MMU=y CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_CONT_SHIFT=4 CONFIG_ARCH_MMAP_RND_BITS_MIN=18 CONFIG_ARCH_MMAP_RND_BITS_MAX=33 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 CONFIG_NO_IOPORT_MAP=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 CONFIG_LOCKDEP_SUPPORT=y CONFIG_TRACE_IRQFLAGS_SUPPORT=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y ... because i don(t find how create Elyotna kernel , I try to build Build-Armbian git clone https://github.com/150balbes/Build-Armbian cd Build-Armbian ./compile.sh but error : [ error ] ERROR in function compile_kernel [ compilation.sh:362 ] [ error ] Kernel was not built [ @host ] [ o.k. ] Process terminated Works if i don't choose dev : [ o.k. ] Done building [ /home/martos/Build-Armbian/output/images/Armbian_5.44_S9xxx_Ubuntu_bionic_4.18.0-rc7-next-20180731-g85eac38-dirty_server.img ] [ o.k. ] Runtime [ 29 min ] So my vm it's ok, but i don't know how compile Elyotna kernel ...
martos Posted July 31, 2018 Author Posted July 31, 2018 If someone can help me ... i am near but if someone can give a sample or a explain me...
martos Posted August 1, 2018 Author Posted August 1, 2018 ELY REPLY : Before I write down a small guide, I want to make sure of a few things: - The driver is not suitable for any production workflow at the moment. It's been tested with limited samples and will have bugs. - There's no deinterlacing support, so if you capture from a DVB source it's likely going to look bad. - What are you going to do with the decoded frames if you can't transcode them ? Encoding them with software might prove to be painfully slow as the frames' buffers are uncached for CPU. With that said, here's a quick cross-compile-your-kernel guide: 1) Grab a toolchain such as gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu. Uncompress it somewhere like /opt 2) cd into your kernel repository and create a file source-build. Edit it and put this as the content: Code: Select all export ARCH=arm64 export CROSS_COMPILE=/opt/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- 3) source it Code: Select all $ source ./source-build 4) Only to do once - initialize your default .config from defconfig Code: Select all $ make defconfig This defconfig enables most arm64 things for every SoC. 5) Menuconfig to disable what you don't need (all the archs except MESON for instance..), and enable things like the vdec (CONFIG_VIDEO_AML_MESON_VDEC) Code: Select all $ make menuconfig 6) Build the Image and the dtb Code: Select all $ make -j10 Image amlogic/meson-gxbb-odroidc2.dtb And then you can push those 2 files to your board, I don't know specifically how it's done with your distro though. Hopefully you have a mainline u-boot and the kernel/dtb are somewhere in /boot. The dtb will end up at ./arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb, while Image will be at the root directory. If you want to use the vdec, you'll also need to download additional firmware from here. Place the meson directory in /lib/firmware on your board.
martos Posted August 1, 2018 Author Posted August 1, 2018 Compil Armbian_5.44_S9xxx_Ubuntu_bionic_4.18.0-rc7-next-20180731-g85eac38-dirty_server ok Compil Elyotna kernell ok Now i make the test Armbian with Elyotna kernel 1 test Armbian_5.44_S9xxx_Ubuntu_bionic_4.18.0-rc7-next-20180731-g85eac38-dirty_server boot Boot ok ok i have the file "Image" of Elyotna kernell But the Armbian at the boot i have zImage and vmlinuz-4.18.0-rc7-next-20180731-aml-s9xxx-g85eac38-dirty ( same size i think this file it not use ) How i can change the kernel ? i try to rename Image in zImage and copy into vmlinuz-4.18.0-rc7-next-20180731-aml-s9xxx-g85eac38-dirty But it's not work ... Someone have an idea ? i can change : make -j10 Image amlogic/meson-gxbb-odroidc2.dtb to make -j10 zImage amlogic/meson-gxl-s905x-khadas-vim.dtb i have : make: *** Aucune règle pour fabriquer la cible « zImage ». Arrêt.
balbes150 Posted August 2, 2018 Posted August 2, 2018 Rename Image it to zImage. Process with mkimage vmlinuz-4.18.0-rc7-next-20180731-aml-s9xxx-g85eac38-dirty utility to get a uInitrd file (this is an initrd in a format that understands u-boot) and copy these files with replacement to the BOOT (FAT) partition. And don't forget to copy the kernel modules.
martos Posted August 2, 2018 Author Posted August 2, 2018 Stop all ! It's works !!! i try last librelec dev ( LibreELEC-Khadas_VIM.arm-9.0-devel-20180731153357-778b48a.img.gz ) i see the meson firmware installed When i launch ffmpeg -vcodec h264_v4l2m2m -i http://192.168.1.50:8001/+1:0:19:401:4:20FA:EEEE0000:0:0:0: -s 320x240 /tmp/test.mp4 the drivers is used : [h264_v4l2m2m @ 0x295e490] driver 'meson-vdec' on card 'AMLogic Video Decoder' [h264_v4l2m2m @ 0x295e490] Using device /dev/video0 [h264_v4l2m2m @ 0x295e490] driver 'meson-vdec' on card 'AMLogic Video Decoder' Stream mapping: Stream #0:0 -> #0:0 (h264 (h264_v4l2m2m) -> mpeg4 (native)) Stream #0:1 -> #0:1 (eac3 (native) -> aac (native)) Press [q] to stop, [?] for help [aac @ 0x29582d0] Using a PCE to encode channel layout i begin to test .
martos Posted August 2, 2018 Author Posted August 2, 2018 for information i find some error but ely make some change ... ( https://github.com/Elyotna/linux ) Now i muts continue to find how i can have on image with the new ely kernel ...
balbes150 Posted August 3, 2018 Posted August 3, 2018 14 hours ago, martos said: for information i find some error but ely make some change ... ( https://github.com/Elyotna/linux ) Now i muts continue to find how i can have on image with the new ely kernel ... You can build your version of LE using the desired changes.
martos Posted August 3, 2018 Author Posted August 3, 2018 yes it's seem the more easy find all the change https://github.com/Elyotna/linux and make the change in: https://github.com/150balbes/Build-Armbian and make new image ?
balbes150 Posted August 3, 2018 Posted August 3, 2018 43 minutes ago, martos said: and make new image ? No. You can immediately build your version of LE with the addition of new changes. https://github.com/chewitt/LibreELEC.tv
martos Posted August 3, 2018 Author Posted August 3, 2018 ely have repy : I'm confident the performance is going to be poor when doing software scale/encode on v4l2 frames. (with HW ) ffmpeg -c:v h264_v4l2m2m -i Sintel.2010.720p.mkv -c:a copy -vcodec mpeg4 -s 320x240 /tmp/test.mp4 frame= 191 fps=8.5 q=4.7 Lsize= 1136kB time=00:00:10.52 bitrate= 884.2kbits/s speed=0.466x (without HW ) ffmpeg -i Sintel.2010.720p.mkv -c:a copy -vcodec mpeg4 -s 320x240 /tmp/test.mp4 frame= 1345 fps= 79 q=17.9 Lsize= 5990kB time=00:00:56.19 bitrate= 873.2kbits/s speed=3.28x The reason behind this is that the frames that come out of the decoder via V4L2 have pages with CPU cache disabled, so any software access is very, very slow. BUT memeka ( dev who use hardware accelerator for exynos chip with MFC who use too v4l2m2m ) ask: can something like this: https://github.com/mihailescu2m/linux/compare/b5edc85935d83e48a973a6e730706ac3cd255746...53f47a87e0aa8e25e960d42ee56ef79c5c91e9c8 be done for S905 SoC as well? So i am waiting to make new test ...
martos Posted August 3, 2018 Author Posted August 3, 2018 ELY had a cache to improve performance (memeka proposal): So, I could *sorta* replicate the patches, I had to drop the cache maintenance because it was crashing but could still enable read cache (although of course it's not really usable since some of the data will be corrupted by cache). Software decoding: ffmpeg -i Sintel.2010.720p.mkv -an -vcodec mpeg4 -s 320x240 -vframes 1500 -f null - frame= 1500 fps= 79 q=10.2 Lsize=N/A time=00:01:02.50 bitrate=N/A speed=3.28x ffmpeg -i bbb_sunflower_1080p_60fps_normal.mp4 -an -vcodec mpeg4 -s 320x240 -vframes 1500 -f null - frame= 1500 fps= 40 q=31.0 Lsize=N/A time=00:00:25.03 bitrate=N/A speed=0.673x HW decoding + read cache: ffmpeg -c:v h264_v4l2m2m -i Sintel.2010.720p.mkv -an -vcodec mpeg4 -s 320x240 -vframes 1500 -f null - frame= 1500 fps= 84 q=10.2 Lsize=N/A time=00:01:02.50 bitrate=N/A speed= 3.5x ffmpeg -c:v h264_v4l2m2m -i bbb_sunflower_1080p_60fps_normal.mp4 -an -vcodec mpeg4 -s 320x240 -vframes 1500 -f null - frame= 1500 fps= 40 q=31.0 Lsize=N/A time=00:00:25.03 bitrate=N/A speed=0.661x 720p had a slight advantage (6%). On the 1080p sample the bottleneck was elsewhere (probably mpeg4 encoder not being able to take full multi-thread advantage on such a small resolution), as CPU usage was 300% for software decoding and 100% for HW decoding. The performance gains would probably be more significant if encoding at a higher resolution or with x264. when the code isok, i can test h264 to know if we can have 1080p -> 320x240 with speed 1.x
belaid38 Posted August 4, 2018 Posted August 4, 2018 hi after compile build i tested libreelec 9 with kernel 4.18 r7 for wetek play 2 video is work fine nice i tested hd x264 p1080
martos Posted August 5, 2018 Author Posted August 5, 2018 i am not shure kodi use ffmpeg ... I think some change from ely going nearly in the official kernel because official raodmap vor V4L2( not only aml ) is on the roadmap 4.19 For us the more important is : https://patchwork.linuxtv.org/project/linux-media/list/?submitter=7555
balbes150 Posted August 6, 2018 Posted August 6, 2018 KODI in LE uses FFMPEG (with additional patches for v4l-m2m).
martos Posted August 11, 2018 Author Posted August 11, 2018 some change https://github.com/Elyotna/linux but i don't think its important change ... vdec: Rework the recycle mechanism Now the thread code appears only once in vdec.c. Added can_recycle and recycle codec ops. Also remove "meson" from the dts compatibles. I've decided to no longer force push into my dev branch to better track the changes I make. Patchset will be redone cleanly for 4.19.
balbes150 Posted January 28, 2019 Posted January 28, 2019 @martos Did you manage to build your version of FFMPEG using v4l-m2m ?
martos Posted January 28, 2019 Author Posted January 28, 2019 Yes, I make it with V4l2-m2m , but this way don't use all the hardware , so we can use use for decode in realtime (it's not perfect at all ) , but not for encode . So for Amlogic ( or other device using the v4l2_m2m ) it's not enough ok for me ( just reduce cpu using ) For rockchip i wait the encode hardware in mpp ( in the roadmap this year ) and someone in the ffmpeg team have a look on my ticket ( open 6 month ago )
balbes150 Posted January 28, 2019 Posted January 28, 2019 8 minutes ago, martos said: Yes, I make it with V4l2-m2m , but this way don't use all the hardware , so we can use use for decode in realtime (it's not perfect at all ) , but not for encode . So for Amlogic ( or other device using the v4l2_m2m ) it's not enough ok for me ( just reduce cpu using ) For rockchip i wait the encode hardware in mpp ( in the roadmap this year ) and someone in the ffmpeg team have a look on my ticket ( open 6 month ago ) I am interested in decoding for S9xxx. You can write details, what kernel do you use, what kernel config do you use ? What are the FFMPEG source code and build option ?
martos Posted January 30, 2019 Author Posted January 30, 2019 normaly i write all i use in the begining of the post, but i try it again this week end ( i m not at home this week) with the new kernel and put here the details.
balbes150 Posted January 31, 2019 Posted January 31, 2019 7 hours ago, martos said: normaly i write all i use in the begining of the post, but i try it again this week end ( i m not at home this week) with the new kernel and put here the details. I figured out the FFMPEG build. Details in this post. Testing the decoder seems to work correctly (there is a noticeable difference with the soft mode), but so far there is an incomprehensible situation with the use of FFPLAY.
Jingzhao Liu Posted November 19, 2019 Posted November 19, 2019 On 1/31/2019 at 6:37 AM, martos said: normaly i write all i use in the begining of the post, but i try it again this week end ( i m not at home this week) with the new kernel and put here the details. Hello, I have encountered a similar problem, I want to use ff-mpeg hardware accelerated decoding on the s905D armbian system, but I did not find the relevant information on the Internet, and s905 on the le kodi can be hardware accelerated decoding. Do you know what I should do on armbian. I look forward to your reply, thank you very much!
Recommended Posts