schunckt Posted 22 hours ago Posted 22 hours ago Hi all! On NanoPi Duo2 I'm trying to use the builtin video hw processor. ffmpeg already works with -hwaccel v4l2request but throws errors: Press [q] to stop, [?] for help [h264 @ 0x11645f0] Using V4L2 media driver cedrus (6.12.35) for S264 [V4L2RequestContext @ 0xae5f0db0] Failed to create buffer of type 1: Cannot allocate memory (12) [h264 @ 0x11645f0] Failed setup for format drm_prime: hwaccel initialisation returned error. dmesg [ 8906.864389] cma: __cma_alloc: reserved: alloc failed, req-size: 3038 pages, ret: -12 [ 8906.872255] cma: number of available pages: 42@86+128@384+34@3550+34@6622+34@9694+34@12766+34@15838+34@18910+34@21982+1570@25054=> 1978 free of 26624 total pages [ 8906.886783] cedrus 1c0e000.video-codec: dma alloc of size 12443648 failed root@nanopiduo2:~# I already did play around with armbianEnv tweaking extraargs cma but no success. I found a link talking about VPU device tree dma limitations https://git.sec.in.tum.de/croemheld/linux/-/blob/v5.1-rc5/Documentation/devicetree/bindings/media/cedrus.txt Zitat Device-tree bindings for the VPU found in Allwinner SoCs, referred to as the Video Engine (VE) in Allwinner literature. The VPU can only access the first 256 MiB of DRAM, that are DMA-mapped starting from the DRAM base. This requires specific memory allocation and handling. I already decompiled the DT and verified there are is no such "reserved-memory" section. Is this the root cause? Maybe someone can provide some hints or ideas confirming that I'm on the right track? If yes I'd give it a try adjusting the DT. T. 0 Quote
laibsch Posted 21 hours ago Posted 21 hours ago are you sure this is not a genuine running-out-of-memory situation? 0 Quote
going Posted 19 hours ago Posted 19 hours ago (edited) 3 часа назад, schunckt сказал: I found a link talking about VPU device tree dma limitations https://git.sec.in.tum.de/croemheld/linux/-/blob/v5.1-rc5/Documentation/devicetree/bindings/media/cedrus.txt v5.1-rc5 3 часа назад, schunckt сказал: [h264 @ 0x11645f0] Using V4L2 media driver cedrus (6.12.35) v6.12.35 Please use the current documentation for the CURRENT kernel. sun4i-a10-video-engine.yaml sun8i-h3-deinterlace.yaml Documentation/arch/arm/sunxi.rst arch/arm/boot/dts/allwinner/sun8i-h3-nanopi-duo2.dts arch/arm/boot/dts/allwinner/sun8i-h3.dtsi P.S. Please read this. repository-for-v4l2request-hardware-video-decoding-rockchip-allwinner Edited 19 hours ago by going Add P.S. 0 Quote
schunckt Posted 3 hours ago Author Posted 3 hours ago Great, thanks for the links! Meanwhile it works partially. The DT tweaking was not needed. I made a mistake by specifying the armbian extraargs. I added a second line to armbianEnv.txt but realized all args must be one line. I had to increase cma=256M (Yes, really, tested all lower values). Then it works, BUT ... Fun fact, will further investigate: Decoding with "-hwaccel drm" results in lower fps (about 6..8) whereas software decoder goes up to 10 😀 Decoding has been verified with htop. CPU only => 4 cores 100%. hwaccel one core about 20% which is likely th e yuv to rgb and scaling. Maybe this is still an issue caused by DT, at least when reading https://gregdavill.com/posts/allwinner-s3-videoencoders/ It specifies memory-region = <&cma_pool>; which is missing in my decompiled DT, also the referenced reserved-memory section. Maybe that's not needed if it's coded inside the driver or specified elswhere. T. 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.