This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-TDA4VM: v4l2h264enc Failed to allocate required memory.

Part Number: SK-TDA4VM


Hello, I faced an issue when trying to switch from Edge AI SDK 8.6 to SDK 9.0 [here].

I tried to follow the manual to set up 10b images for the IMX219, but it still has a bug: when trying to set parameters as specified in the manual, I receive the following: 

Unable to setup formats: Invalid argument (22)
CSI Camera 1 detected
    device = /dev/video-rpi-cam0
    name = imx219
    format = [fmt:SRGGB8_1X10/1920x1080]
    subdev_id = /dev/v4l-rpi-subdev0
    isp_required = yes
 

So instead I just wrote `[fmt:SRGGB10_1X10/1920x1080]` as I did before. After that, I tried the simple gst pipeline, and it failed: 

root@tda4vm-sk:/opt/edgeai-gst-apps# GST_DEBUG=3  gst-launch-1.0 v4l2src device=/dev/video-rpi-cam0 io-mode=dmabuf ! video/x-bayer,width=1920,height=1080, framerate=30/1, format=rggb10 ! tiovxisp sensor-name=SENSOR_SONY_IMX219_RPI dcc-isp-file=/opt/imaging/imx219/linear/dcc_viss_10b_1920x1080.bin format-msb=10 sink_0::dcc-2a-file=/opt/imaging/imx219/linear/dcc_2a_10b_1920x1080.bin sink_0::device=/dev/v4l-rpi-subdev0 ! video/x-raw,format=NV12 ! v4l2h264enc output-io-mode=dmabuf-import extra-controls="controls, h264_i_frame_period=60, video_bitrate=20000000 " ! rtph264pay ! udpsink port=8081 host=192.168.31.210
APP: Init ... !!!
MEM: Init ... !!!
MEM: Initialized DMA HEAP (fd=6) !!!
MEM: Init ... Done !!!
IPC: Init ... !!!
IPC: Init ... Done !!!
REMOTE_SERVICE: Init ... !!!
REMOTE_SERVICE: Init ... Done !!!
  3209.510567 s: GTC Frequency = 200 MHz
APP: Init ... Done !!!
  3209.510665 s:  VX_ZONE_INIT:Enabled
  3209.510684 s:  VX_ZONE_ERROR:Enabled
  3209.510699 s:  VX_ZONE_WARNING:Enabled
  3209.511747 s:  VX_ZONE_INIT:[tivxInitLocal:130] Initialization Done !!!
  3209.511882 s:  VX_ZONE_INIT:[tivxHostInitLocal:101] Initialization Done for HOST !!!
Setting pipeline to PAUSED ...

(gst-launch-1.0:5071): GStreamer-WARNING **: 16:30:14.102: (../gstreamer-1.20.7/gst/gstinfo.c:556):gst_debug_log_valist: runtime check failed: (object == NULL || G_IS_OBJECT (object))

(gst-launch-1.0:5071): GStreamer-WARNING **: 16:30:14.103: (../gstreamer-1.20.7/gst/gstinfo.c:1340):gst_debug_log_default: runtime check failed: (object == NULL || G_IS_OBJECT (object))
0:00:00.189766516  5071     0x2ad9c430 WARN                    v4l2 v4l2_calls.c:1059:set_control:0x2ae1af70 Control 'h264_i_frame_period' does not exist or has an unsupported type.
Pipeline is live and does not need PREROLL ...
0:00:00.192304693  5071     0x2ad65300 WARN                 v4l2src gstv4l2src.c:814:gst_v4l2src_query:<v4l2src0> Can't give latency since framerate isn't fixated !
0:00:00.192351065  5071     0x2ad65300 WARN              aggregator gstaggregator.c:2104:gst_aggregator_query_latency_unlocked:<tiovxisp0> Latency query failed
0:00:00.192824403  5071     0x2ad65300 WARN                 v4l2src gstv4l2src.c:814:gst_v4l2src_query:<v4l2src0> Can't give latency since framerate isn't fixated !
Pipeline is PREROLLED ...
0:00:00.193593868  5071     0x2ad65300 WARN              aggregator gstaggregator.c:2104:gst_aggregator_query_latency_unlocked:<tiovxisp0> Latency query failed
Setting pipeline to PLAYING ...
0:00:00.194000513  5071     0x2ad65300 WARN                 v4l2src gstv4l2src.c:814:gst_v4l2src_query:<v4l2src0> Can't give latency since framerate isn't fixated !
0:00:00.194028374  5071     0x2ad65300 WARN              aggregator gstaggregator.c:2104:gst_aggregator_query_latency_unlocked:<tiovxisp0> Latency query failed
0:00:00.194090547  5071     0x2ad65300 WARN                 v4l2src gstv4l2src.c:814:gst_v4l2src_query:<v4l2src0> Can't give latency since framerate isn't fixated !
0:00:00.194110098  5071     0x2ad65300 WARN              aggregator gstaggregator.c:2104:gst_aggregator_query_latency_unlocked:<tiovxisp0> Latency query failed
New clock: GstSystemClock
0:00:00.194763968  5071     0x2ad65300 WARN                 v4l2src gstv4l2src.c:814:gst_v4l2src_query:<v4l2src0> Can't give latency since framerate isn't fixated !
0:00:00.194797459  5071     0x2ad65300 WARN              aggregator gstaggregator.c:2104:gst_aggregator_query_latency_unlocked:<tiovxisp0> Latency query failed
0:00:00.302130144  5071     0x2ad8c060 WARN          v4l2bufferpool gstv4l2bufferpool.c:1397:gst_v4l2_buffer_pool_dqbuf:<v4l2src0:pool0:src> Driver should never set v4l2_buffer.field to ANY
0:00:00.302793985  5071     0x2ad65300 FIXME               basesink gstbasesink.c:3395:gst_base_sink_default_event:<udpsink0> stream-start event without group-id. Consider implementing group-id handling in the upstream elements
Redistribute latency...
0:00:00.353610433  5071     0x2ad65300 ERROR         v4l2bufferpool gstv4l2bufferpool.c:957:gst_v4l2_buffer_pool_start:<v4l2h264enc0:pool0:src> we received 2 buffer from device '/dev/video1', we want at least 4
0:00:00.353670996  5071     0x2ad65300 ERROR             bufferpool gstbufferpool.c:572:gst_buffer_pool_set_active:<v4l2h264enc0:pool0:src> start failed
0:00:00.353698912  5071     0x2ad65300 WARN            v4l2videoenc gstv4l2videoenc.c:805:gst_v4l2_video_enc_handle_frame:<v4l2h264enc0> Could not activate capture buffer pool.
0:00:00.353725783  5071     0x2ad65300 WARN            v4l2videoenc gstv4l2videoenc.c:849:gst_v4l2_video_enc_handle_frame:<v4l2h264enc0> error: Failed to allocate required memory.
0:00:00.353743563  5071     0x2ad65300 WARN            v4l2videoenc gstv4l2videoenc.c:849:gst_v4l2_video_enc_handle_frame:<v4l2h264enc0> error: Buffer pool activation failed
ERROR: from element /GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0: Failed to allocate required memory.
Additional debug info:
../gst-plugins-good-1.20.7/sys/v4l2/gstv4l2videoenc.c(849): gst_v4l2_video_enc_handle_frame (): /GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0:
Buffer pool activation failed
0:00:00.354047785  5071     0x2ad65300 FIXME             aggregator gstaggregator.c:1412:gst_aggregator_aggregate_func:<tiovxisp0> Subclass should call gst_aggregator_selected_samples() from its aggregate implementation.
Execution ended after 0:00:00.160274156
Setting pipeline to NULL ...
Freeing pipeline ...
  3209.759468 s:  VX_ZONE_WARNING:[vxReleaseContext:1088] Found a reference 0xffff8dd20988 of type 0000080f at external count 1, internal count 0, releasing it
  3209.759496 s:  VX_ZONE_WARNING:[vxReleaseContext:1090] Releasing reference (name=image_107) now as a part of garbage collection
  3209.759524 s:  VX_ZONE_WARNING:[vxReleaseContext:1088] Found a reference 0xffff8dda3cf8 of type 00000813 at external count 1, internal count 0, releasing it
  3209.759535 s:  VX_ZONE_WARNING:[vxReleaseContext:1090] Releasing reference (name=object_array_109) now as a part of garbage collection
  3209.760068 s:  VX_ZONE_WARNING:[vxReleaseContext:1088] Found a reference 0xffff8dda3e98 of type 00000813 at external count 1, internal count 0, releasing it
  3209.760080 s:  VX_ZONE_WARNING:[vxReleaseContext:1090] Releasing reference (name=object_array_111) now as a part of garbage collection
  3209.760735 s:  VX_ZONE_INIT:[tivxHostDeInitLocal:115] De-Initialization Done for HOST !!!
  3209.765188 s:  VX_ZONE_INIT:[tivxDeInitLocal:193] De-Initialization Done !!!
APP: Deinit ... !!!
REMOTE_SERVICE: Deinit ... !!!
REMOTE_SERVICE: Deinit ... Done !!!
IPC: Deinit ... !!!
IPC: DeInit ... Done !!!
MEM: Deinit ... !!!
DDR_SHARED_MEM: Alloc's: 21 alloc's of 22193123 bytes 
DDR_SHARED_MEM: Free's : 21 free's  of 22193123 bytes 
DDR_SHARED_MEM: Open's : 0 allocs  of 0 bytes 
MEM: Deinit ... Done !!!
APP: Deinit ... Done !!!

Also I tried to launch the apps_python, and receiving the same error, but only after killing the process with keyboard interrupt (without that it just freeze):

root@tda4vm-sk:/opt/edgeai-gst-apps# ./apps_python/app_edgeai.py ./configs/rpiV2_cam_example.yaml -n
libtidl_onnxrt_EP loaded 0x3c8f5d20 
Final number of subgraphs created are : 1, - Offloaded Nodes - 283, Total Nodes - 283 
APP: Init ... !!!
MEM: Init ... !!!
MEM: Initialized DMA HEAP (fd=5) !!!
MEM: Init ... Done !!!
IPC: Init ... !!!
IPC: Init ... Done !!!
REMOTE_SERVICE: Init ... !!!
REMOTE_SERVICE: Init ... Done !!!
  4769.536858 s: GTC Frequency = 200 MHz
APP: Init ... Done !!!
  4769.537050 s:  VX_ZONE_INIT:Enabled
  4769.537098 s:  VX_ZONE_ERROR:Enabled
  4769.537137 s:  VX_ZONE_WARNING:Enabled
  4769.537890 s:  VX_ZONE_INIT:[tivxInitLocal:130] Initialization Done !!!
  4769.538148 s:  VX_ZONE_INIT:[tivxHostInitLocal:101] Initialization Done for HOST !!!
==========[INPUT PIPELINE(S)]==========

[PIPE-0]

v4l2src device=/dev/video-rpi-cam0 io-mode=5 pixel-aspect-ratio=None ! queue leaky=2 ! capsfilter caps="video/x-bayer, width=(int)1920, height=(int)1080, format=(string)rggb10;" ! tiovxisp dcc-isp-file=/opt/imaging/imx219/linear/dcc_viss.bin sensor-name=SENSOR_SONY_IMX219_RPI ! capsfilter caps="video/x-raw, format=(string)NV12;" ! tiovxmultiscaler name=split_01
split_01. ! queue ! capsfilter caps="video/x-raw, width=(int)1280, height=(int)720;" ! tiovxdlcolorconvert out-pool-size=4 ! capsfilter caps="video/x-raw, format=(string)RGB;" ! appsink max-buffers=2 drop=True name=sen_0
split_01. ! queue ! capsfilter caps="video/x-raw, width=(int)1168, height=(int)748;" ! tiovxmultiscaler target=1 ! capsfilter caps="video/x-raw, width=(int)416, height=(int)416;" ! tiovxdlpreproc out-pool-size=4 data-type=3 tensor-format=1 ! capsfilter caps="application/x-tensor-tiovx;" ! appsink max-buffers=2 drop=True name=pre_0


==========[OUTPUT PIPELINE]==========

appsrc do-timestamp=True format=3 block=True name=post_0 ! tiovxdlcolorconvert ! capsfilter caps="video/x-raw, format=(string)NV12, width=(int)1280, height=(int)720;" ! queue ! mosaic_0.sink_0

tiovxmosaic target=1 background=/tmp/background_0 name=mosaic_0 src::pool-size=4
sink_0::startx="<320>" sink_0::starty="<150>" sink_0::widths="<1280>" sink_0::heights="<720>"
! capsfilter caps="video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080;" ! queue ! tiperfoverlay title=RPi Camera ! v4l2h264enc extra-controls="controls, frame_level_rate_control_enable=(int)1, video_bitrate=(int)10000000, video_gop_size=(int)30;" ! h264parse ! rtph264pay ! udpsink sync=False clients=192.168.31.12:8081 host=192.168.31.222 port=8081

^C^C^C^C [ERROR] Failed to allocate required memory.
  4772.824993 s:  VX_ZONE_WARNING:[vxReleaseContext:1088] Found a reference 0xffff83ee6088 of type 0000080f at external count 1, internal count 0, releasing it
  4772.825029 s:  VX_ZONE_WARNING:[vxReleaseContext:1090] Releasing reference (name=mosaic_node_output_image_0) now as a part of garbage collection
  4772.825043 s:  VX_ZONE_WARNING:[vxReleaseContext:1088] Found a reference 0xffff83f68138 of type 00000813 at external count 1, internal count 0, releasing it
  4772.825061 s:  VX_ZONE_WARNING:[vxReleaseContext:1090] Releasing reference (name=object_array_243) now as a part of garbage collection
  4772.825575 s:  VX_ZONE_WARNING:[vxReleaseContext:1088] Found a reference 0xffff83f682d8 of type 00000813 at external count 1, internal count 0, releasing it
  4772.825589 s:  VX_ZONE_WARNING:[vxReleaseContext:1090] Releasing reference (name=object_array_245) now as a part of garbage collection
  4772.826045 s:  VX_ZONE_WARNING:[vxReleaseContext:1088] Found a reference 0xffff83f68478 of type 00000813 at external count 1, internal count 0, releasing it
  4772.826055 s:  VX_ZONE_WARNING:[vxReleaseContext:1090] Releasing reference (name=object_array_247) now as a part of garbage collection
  4772.826509 s:  VX_ZONE_WARNING:[vxReleaseContext:1088] Found a reference 0xffff83f68618 of type 00000813 at external count 1, internal count 0, releasing it
  4772.826518 s:  VX_ZONE_WARNING:[vxReleaseContext:1090] Releasing reference (name=object_array_249) now as a part of garbage collection
  4772.827038 s:  VX_ZONE_INIT:[tivxHostDeInitLocal:115] De-Initialization Done for HOST !!!
  4772.831525 s:  VX_ZONE_INIT:[tivxDeInitLocal:193] De-Initialization Done !!!
APP: Deinit ... !!!
REMOTE_SERVICE: Deinit ... !!!
REMOTE_SERVICE: Deinit ... Done !!!
IPC: Deinit ... !!!
IPC: DeInit ... Done !!!
MEM: Deinit ... !!!
DDR_SHARED_MEM: Alloc's: 95 alloc's of 162719871 bytes 
DDR_SHARED_MEM: Free's : 95 free's  of 162719871 bytes 
DDR_SHARED_MEM: Open's : 0 allocs  of 0 bytes 
MEM: Deinit ... Done !!!
APP: Deinit ... Done !!!

Would you please provide me with a guide to fix this problem? 

Setup Information:

  • device: SK-TDA4VM
  • image: tisdk-edgeai-image-j721e-evm.wic.xz (link)

  • image sensor : IMX219 Raw sensor(RPiV2)