cedar_ve driver not able to allocate memory - Printable Version +- PINE64 (https://forum.pine64.org) +-- Forum: PineCube (https://forum.pine64.org/forumdisplay.php?fid=149) +--- Forum: General Discussion on PineCube (https://forum.pine64.org/forumdisplay.php?fid=150) +--- Thread: cedar_ve driver not able to allocate memory (/showthread.php?tid=15367) Pages:
1
2
|
cedar_ve driver not able to allocate memory - ajellisuk - 11-19-2021 Hello I have been trying to make use of the h264 encoder by obtaining the source code for the cedar_ve driver from here: https://github.com/uboborov/sunxi-cedar-mainline I have successfully built the driver, but when I try and load it the driver fails with the error in the kernel log: Quote:[ 110.831285] sunxi-cedar 1c0e000.video-engine: could not assign reserved memory, ret: -22 I have checked the device tree to ensure that it is consistent with the sources in the above git repository. I'm not sure why the driver is not able to allocate the needed memory. I have tried setting the CMA pool both from the boot parameters by adding: Quote:setenv bootargs "${bootargs} cma=60M"to boot.cmd and rebuilding before rebooting. I have also tried adding this to my device tree: Code: reserved-memory { I updated the video engine entry in the deivce tree to that it referenced the cma_pool entry: Code: ve: video-engine@01c0e000 { Has anyone successfully managed to get the cedar_ve driver to work on a pine cube? Is there a set of instructions that someone could point me to that will help me resolce this issue. Andrew RE: cedar_ve driver not able to allocate memory - cooler - 12-14-2021 I've managed to install the driver. But there are several things to consider and I'm not sure that resolved them correctly. First, the shared memory pool required by the driver cedar_ve.ko is hardcoded to 80 Megabytes. We cannot spend so much RAM because there is about 128 onboard. So I've decreased hardcoded value to 16M and rebuilt the driver. Code: #if !defined(USE_ION) I've also updated the device tree that way: Code: reserved-memory { ... Code: syscon: system-control@1c00000 { Don't even ask about why I've done it that way, I know literally nothing about that device trees, I've just compiled several examples from Orange PI giving a heuristics about how little RAM we have dmesg output: Code: [ 0.000000] Memory policy: Data cache writealloc .... Code: [ 8.063755] sunxi cedar version 0.1 and now I have Code: root@pinecube:/dev# ls -l But... so what, how do we utilize this module to encode camera stream to video files then? RE: cedar_ve driver not able to allocate memory - cooler - 12-20-2021 So far I've utilized hardware cedar encoder having ~8fps at 1280x720 and 2-3-4fps at 1920x1080 via gstreamer. The hardware encoded video looks way better than pixelized software x264enc at recommended minimal settings. Several system tunung was required including disabling ZRAM completely to reduce CPU consumption, adoption of shared buffer sizes, disabling services to decrease RAM consumption. At the current setup it consumes <90% CPU with free ~6Mb of RAM while continiously encoding 1920x1080 video. I am going to try this setup from the scratch on another SD card with clean Armbian installation and if succeded try to describe the main steps involved to run hardware camera video encoding RE: cedar_ve driver not able to allocate memory - tvall - 12-21-2021 which kernel are you on? im running the 5.15.4 edge kernel, and when i load the module, all i get is "sunxi cedar version 0.1 " and nothing else from it. RE: cedar_ve driver not able to allocate memory - cooler - 12-21-2021 (12-21-2021, 07:49 AM)tvall Wrote: which kernel are you on? im running the 5.15.4 edge kernel, and when i load the module, all i get is "sunxi cedar version 0.1 " and nothing else from it. Code: root@pinecube:~# uname -a I've faced the same problem. There are two main blocking things that disallow cedar module to start. If it is the only message you see in dmesg, than "sunxi cedar version 0.1 " So the driver could not find the device in the device tree description. Refer to my first message in this thread. I can explain how to do this in details later. When you update the device tree, it then it starts to initialize, but could not fetch as much as 80M of RAM that is probably hardcoded in that version that you are trying to run. The full initialization at my setup looks like this: Code: [ 7.986773] sunxi cedar version 0.1 I can provide the tree config and modified cedar_ve.ko binary and you can play with it. It is compatible at least with armbian image that a posted above. But the procedure of compilation took me a lot of time and I could not reproduce it fully. PS. Device tree is the file /boot/dtb/sun8i-s3-pinecube.dtb RE: cedar_ve driver not able to allocate memory - tvall - 12-21-2021 im guessing either i messed up the dts somehow, or something changed between 5.10 and 5.15 that requires more work. i just noticed the sram part seems to be failing earlier in boot, and im assuming without that the video engine part isnt being started Code: [ 1.644739] sunxi-sram 1c00000.system-control: can't request region for resource [mem 0x01c00000-0x01c00fff] care to share a diff of your dts changes vs stock? would make it a little easier to make sure i didnt miss something RE: cedar_ve driver not able to allocate memory - cooler - 12-21-2021 (12-21-2021, 10:45 AM)tvall Wrote: im guessing either i messed up the dts somehow, or something changed between 5.10 and 5.15 that requires more work. i just noticed the sram part seems to be failing earlier in boot, and im assuming without that the video engine part isnt being started Sure. This is the only file that I modified in dtb sources The size if shared pool is set to size = <0x2800000> (40M) I tried different values and ended up with this that makes stable simultaneous camera and encoder initialization. RE: cedar_ve driver not able to allocate memory - tvall - 12-21-2021 the only difference i saw other than spacing was the cma pool size, and even making it 40mb instead of 32 didnt change anything, so im going with something related to sram changed between kernel releases. RE: cedar_ve driver not able to allocate memory - cooler - 12-21-2021 (12-21-2021, 11:42 AM)tvall Wrote: the only difference i saw other than spacing was the cma pool size, and even making it 40mb instead of 32 didnt change anything, so im going with something related to sram changed between kernel releases. Maybe you want to recheck how much shared RAM driver tries to allocate. Code: cedar_devp->ve_size = ?? RE: cedar_ve driver not able to allocate memory - tvall - 12-21-2021 yeah i had ve_size set to 16mb most tests. but ive tried several values between 12mb and 32mb and they all give the same result. |