cedar icon indicating copy to clipboard operation
cedar copied to clipboard

LicheePi Zero - ION_ALLOC_ERROR after increasing CMA_AREAS and CMA_SIZE_MBYTES

Open matheusrfdesign opened this issue 5 years ago • 10 comments

Hey,

First, thanks for uploading the driver and library. I managed to compile both for the Lichee Pi Zero (V3S) following your instructions, but I am still getting ION_IOC_ALLOC even after increasing CMA_AREAS (7) and CMA_SIZE_MBYTES (32). I am using Kernel 5.3 at the moment because I could not get the USB to work on 5.4 yet.

debug  : ionAlloc <__GetIonMemOpsS:985>:*** get __GetIonMemOpsS ***
debug  : omx_venc <openVencDriver:3221>:AVC 4 byte interleave nalu Disable.
debug  : cedarc <VideoEncInit:195>: (f:VideoEncInit, l:195)
debug  : cedarc <VideoEncInit:210>: (f:VideoEncInit, l:210)
error  : ionAlloc <ion_alloc_palloc:335>:ION_IOC_ALLOC error

I am using a camera attached to the Lichee via USB, and run ffmpeg as bellow:

ffmpeg -f v4l2 -video_size 1280x720 -i /dev/video0 -codec:v h264_omx -b:v 2048k webcam.mkv

I thought I could be genuinely running out of memory, but this is what I get when I run free -k

# free -k
              total        used        free      shared  buff/cache   available
Mem:          53812        6216       41108         336        6488       44008
Swap:             0           0           0

Am I missing something? Or could you share your Buildroot and Linux defconfigs so I can check if I missed something?

Appreciate any help...

matheusrfdesign avatar Nov 19 '20 01:11 matheusrfdesign

I encountered a very similar issue https://github.com/aodzip/cedar/issues/4 but on a F1C100S instead. Not matter how much i allocate memory to CMA, (i can only go as far as 16MB on my Soc), it just seemingly fails. I am also using ffmpeg 4.3 with omx enabled btw.

The only difference is that i'm using kernel 4.14.0 rather than 5.3/5.4.

Maybe it works only on an older ffmpeg build ? I'm not sure as i also tried the CedarX Player and encountered a similar issue too. I thought it would be a memory allocation issue but seeing that you tried it on the v3s and also encounter the same issue (despite you having 64MB of RAM).

gameblabla avatar Nov 21 '20 10:11 gameblabla

I made some changes to libcedarc that displays how much memory it is trying to allocate. Have a look:

https://github.com/matheusrfdesign/libcedarc/commit/f17465e55541e65618c5d0f8b429b3298ff339f2

It might shed some light on the issue. On the V3S, it is only trying to allocate 8MB and it still fails...

matheusrfdesign avatar Nov 22 '20 22:11 matheusrfdesign

I made some changes to libcedarc that displays how much memory it is trying to allocate. Have a look:

https://github.com/matheusrfdesign/libcedarc/commit/f17465e55541e65618c5d0f8b429b3298ff339f2

It might shed some light on the issue. On the V3S, it is only trying to allocate 8MB and it still fails...

Hello, Did you not managed to solve ion allocation failure? Can this article help wtih issue? https://blog.csdn.net/tugouxp/article/details/116714552

niyazFattahov avatar Aug 02 '21 06:08 niyazFattahov

I encountered a very similar issue #4 but on a F1C100S instead. Not matter how much i allocate memory to CMA, (i can only go as far as 16MB on my Soc), it just seemingly fails. I am also using ffmpeg 4.3 with omx enabled btw.

The only difference is that i'm using kernel 4.14.0 rather than 5.3/5.4.

Maybe it works only on an older ffmpeg build ? I'm not sure as i also tried the CedarX Player and encountered a similar issue too. I thought it would be a memory allocation issue but seeing that you tried it on the v3s and also encounter the same issue (despite you having 64MB of RAM).

did you get the F1C00S to play H264 correctly (26fps or better)?

0x0fe avatar Sep 13 '21 15:09 0x0fe

I encountered a very similar issue #4 but on a F1C100S instead. Not matter how much i allocate memory to CMA, (i can only go as far as 16MB on my Soc), it just seemingly fails. I am also using ffmpeg 4.3 with omx enabled btw. The only difference is that i'm using kernel 4.14.0 rather than 5.3/5.4. Maybe it works only on an older ffmpeg build ? I'm not sure as i also tried the CedarX Player and encountered a similar issue too. I thought it would be a memory allocation issue but seeing that you tried it on the v3s and also encounter the same issue (despite you having 64MB of RAM).

did you get the F1C00S to play H264 correctly (26fps or better)?

Nope, could not even get it to work at all. I really hope the opensource decoder supports the F1C100S because clearly this isn't going to work.

gameblabla avatar Sep 13 '21 21:09 gameblabla

but, some got it working, the only problem is that something is suboptimal somewhere because the framerate is well below the 30fps it should be, but at least the whole pipeline works.

https://whycan.com/t_4219.html https://whycan.com/p_58245.html

0x0fe avatar Sep 13 '21 21:09 0x0fe

i have a secret dream to use the VE (video engine) and maybe the whole CEDAR api on bare metal or RTOS, but it is quite a task.

0x0fe avatar Sep 13 '21 21:09 0x0fe

also, have you ever tried TINA 3.5? as far as i kow everything is fully implemented on this distro, and mplayer is very smooth with mp4 and hardware decoding, i wish i could try it too. https://whycan.com/t_6113.html

0x0fe avatar Sep 13 '21 21:09 0x0fe

Hey,

First, thanks for uploading the driver and library. I managed to compile both for the Lichee Pi Zero (V3S) following your instructions, but I am still getting ION_IOC_ALLOC even after increasing CMA_AREAS (7) and CMA_SIZE_MBYTES (32). I am using Kernel 5.3 at the moment because I could not get the USB to work on 5.4 yet.

debug  : ionAlloc <__GetIonMemOpsS:985>:*** get __GetIonMemOpsS ***
debug  : omx_venc <openVencDriver:3221>:AVC 4 byte interleave nalu Disable.
debug  : cedarc <VideoEncInit:195>: (f:VideoEncInit, l:195)
debug  : cedarc <VideoEncInit:210>: (f:VideoEncInit, l:210)
error  : ionAlloc <ion_alloc_palloc:335>:ION_IOC_ALLOC error

I am using a camera attached to the Lichee via USB, and run ffmpeg as bellow:

ffmpeg -f v4l2 -video_size 1280x720 -i /dev/video0 -codec:v h264_omx -b:v 2048k webcam.mkv

I thought I could be genuinely running out of memory, but this is what I get when I run free -k

# free -k
              total        used        free      shared  buff/cache   available
Mem:          53812        6216       41108         336        6488       44008
Swap:             0           0           0

Am I missing something? Or could you share your Buildroot and Linux defconfigs so I can check if I missed something?

Appreciate any help...

Can you fix this problem? I also get this error debug : cedarc <VideoEncInit:195>: (f:VideoEncInit, l:195) debug : cedarc <VideoEncInit:210>: (f:VideoEncInit, l:210) error : ionAlloc <ion_alloc_palloc:335>:ION_IOC_ALLOC error error : cedarc <BitStreamCreate:45>: pSbmBuf == NULL. error : cedarc <H264InitMemory:904>: h264Context->pBSMamager == NULL error : cedarc <BitStreamFreeBufferSize:180>: BitStreamManager == NULL. error : cedarc <BitStreamFreeBufferSize

ZhiyangZhou24 avatar May 16 '22 14:05 ZhiyangZhou24