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.

PROCESSOR-SDK-AM62A: How to reduce the system's reserved shared memory?

Part Number: PROCESSOR-SDK-AM62A

Tool/software:

Hi TI Experts:

    We intend to run two pipelines of RGB and IR cameras with a resolution of 2592x1944 on our custom board, as well as the DMS (Driver Monitoring System) algorithm. Now, we want to know if 1GB DDR memory will be sufficient to meet the requirements. 

   The system's reserved memory, which is referred to as the Memory Map in firmware-builder-user-guide, amounts to over 600MB.

   So we would like to reconfigure the parameters.We reduce the DDR_C7X_1_LOCAL_HEAP and DDR_C7X_1_SCRATCH to 50MB. But when we reduced the DDR_SHARED_MEM from 178MB to 50MB, the gst pipeline encountered memory allocation errors. Then we made some experiments , the details as followed:

0. set DDR_SHARED_MEM  178MB

1. run the pipeline:

gst-launch-1.0 v4l2src device=/dev/video2 io-mode=5 ! video/x-bayer, width=2592, height=1944, format=bggi10 ! tiovxisp using_ir_mode=False sensor-name=SENSOR_OX05B_RGBIR dcc-isp-file=/opt/imaging/ox05b/dcc_viss.bin sink_0::dcc-2a-file=/opt/imaging/ox05b/dcc_2a.bin sink_0::device=/dev/v4l-subdev2 format-msb=9 sink_0::pool-size=2 src::pool-size=2 ! video/x-raw, format=NV12 ! fakesink

2. run cat /sys/kernel/debug/dma_buf/bufinfo,get the total size is 55914496 bytes(53.3M)

Dma-buf Objects:
size    	flags   	mode    	count   	exp_name	ino     
07561216	00000002	00080007	00000003	carveout_heap	00015385	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

07561216	00000002	00080007	00000003	carveout_heap	00015384	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

00028672	00000002	00080007	00000003	carveout_heap	00015381	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

00004096	00000002	00080007	00000003	carveout_heap	00015380	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

00012288	00000002	00080007	00000003	carveout_heap	00015377	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

00057344	00000002	00080007	00000003	carveout_heap	00015376	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

00057344	00000002	00080007	00000003	carveout_heap	00015375	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

00036864	00000002	00080007	00000003	carveout_heap	00015374	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

00004096	00000002	00080007	00000003	carveout_heap	00015373	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

00004096	00000002	00080007	00000003	carveout_heap	00015372	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

00192512	00000002	00080007	00000003	carveout_heap	00015371	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

00004096	00000002	00080007	00000003	carveout_heap	00015370	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

00045056	00000002	00080007	00000003	carveout_heap	00015369	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

00020480	00000002	00080007	00000003	carveout_heap	00015364	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

00004096	00000002	00080007	00000003	carveout_heap	00013218	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

10080256	00000002	00080007	00000003	carveout_heap	00014353	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached

10080256	00000002	00080007	00000004	carveout_heap	00014352	
	Attached Devices:
	4e230000.dma-controller
	dma_buf_phys
Total 2 devices attached

10080256	00000002	00080007	00000004	carveout_heap	00014351	
	Attached Devices:
	4e230000.dma-controller
	dma_buf_phys
Total 2 devices attached

10080256	00000002	00080007	00000003	carveout_heap	00014350	
	Attached Devices:
	dma_buf_phys
Total 1 devices attached


Total 19 objects, 55914496 bytes

3. change the sink_0::pool-size=2 src::pool-size=2 to sink_0::pool-size=8 src::pool-size=8get the Total  size 161763328 bytes(154.3MB)

4. change the  sink_0::pool-size=2 src::pool-size=2 to sink_0::pool-size=9 src::pool-size=9,get the Total  size 179404800 bytes(171.1MB)

5. change the  sink_0::pool-size=2 src::pool-size=2 to sink_0::pool-size=10 src::pool-size=10, get MEM: ERROR: Alloc failed with status = 12 !!!

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 !!!
   292.164765 s: GTC Frequency = 200 MHz
APP: Init ... Done !!!
   292.164837 s:  VX_ZONE_INIT:Enabled
   292.164842 s:  VX_ZONE_ERROR:Enabled
   292.164845 s:  VX_ZONE_WARNING:Enabled
   292.165520 s:  VX_ZONE_INIT:[tivxInitLocal:130] Initialization Done !!!
   292.165661 s:  VX_ZONE_INIT:[tivxHostInitLocal:93] Initialization Done for HOST !!!
----Now prop_id is : 7 
---------77777777777777777777777777
----Now prop_id is : 2 
----Now prop_id is : 1 
----Now prop_id is : 6 
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
MEM: ERROR: Alloc failed with status = 12 !!!
   292.617718 s:  VX_ZONE_ERROR:[tivxMemBufferAlloc:87] Shared mem ptr allocation failed
Got EOS from element "pipeline0".
Execution ended after 0:00:00.443706500
Setting pipeline to NULL ...
Freeing pipeline ...
   293.719571 s:  VX_ZONE_WARNING:[vxReleaseContext:1055] Found a reference 0xffff83101b60 of type 0000080f at external count 1, internal count 0, releasing it
   293.719579 s:  VX_ZONE_WARNING:[vxReleaseContext:1057] Releasing reference (name=image_129) now as a part of garbage collection
   293.719594 s:  VX_ZONE_WARNING:[vxReleaseContext:1055] Found a reference 0xffff83170450 of type 00000813 at external count 1, internal count 0, releasing it
   293.719599 s:  VX_ZONE_WARNING:[vxReleaseContext:1057] Releasing reference (name=object_array_131) now as a part of garbage collection
   293.720353 s:  VX_ZONE_WARNING:[vxReleaseContext:1055] Found a reference 0xffff831705f0 of type 00000813 at external count 1, internal count 0, releasing it
   293.720359 s:  VX_ZONE_WARNING:[vxReleaseContext:1057] Releasing reference (name=object_array_133) now as a part of garbage collection
   293.721031 s:  VX_ZONE_WARNING:[vxReleaseContext:1055] Found a reference 0xffff83170790 of type 00000813 at external count 1, internal count 0, releasing it
   293.721036 s:  VX_ZONE_WARNING:[vxReleaseContext:1057] Releasing reference (name=object_array_135) now as a part of garbage collection
   293.721704 s:  VX_ZONE_WARNING:[vxReleaseContext:1055] Found a reference 0xffff83170930 of type 00000813 at external count 1, internal count 0, releasing it
   293.721709 s:  VX_ZONE_WARNING:[vxReleaseContext:1057] Releasing reference (name=object_array_137) now as a part of garbage collection
   293.722378 s:  VX_ZONE_WARNING:[vxReleaseContext:1055] Found a reference 0xffff83170ad0 of type 00000813 at external count 1, internal count 0, releasing it
   293.722384 s:  VX_ZONE_WARNING:[vxReleaseContext:1057] Releasing reference (name=object_array_139) now as a part of garbage collection
   293.723055 s:  VX_ZONE_WARNING:[vxReleaseContext:1055] Found a reference 0xffff83170c70 of type 00000813 at external count 1, internal count 0, releasing it
   293.723061 s:  VX_ZONE_WARNING:[vxReleaseContext:1057] Releasing reference (name=object_array_141) now as a part of garbage collection
   293.723727 s:  VX_ZONE_WARNING:[vxReleaseContext:1055] Found a reference 0xffff83170e10 of type 00000813 at external count 1, internal count 0, releasing it
   293.723732 s:  VX_ZONE_WARNING:[vxReleaseContext:1057] Releasing reference (name=object_array_143) now as a part of garbage collection
   293.724433 s:  VX_ZONE_WARNING:[vxReleaseContext:1055] Found a reference 0xffff83170fb0 of type 00000813 at external count 1, internal count 0, releasing it
   293.724438 s:  VX_ZONE_WARNING:[vxReleaseContext:1057] Releasing reference (name=object_array_145) now as a part of garbage collection
   293.725154 s:  VX_ZONE_INIT:[tivxHostDeInitLocal:107] De-Initialization Done for HOST !!!
   293.726365 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: 39 alloc's of 199521329 bytes 
DDR_SHARED_MEM: Free's : 39 free's  of 199521329 bytes 
DDR_SHARED_MEM: Open's : 0 allocs  of 0 bytes 
DDR_SHARED_MEM: Total size: 184549376 bytes 
MEM: Deinit ... Done !!!
APP: Deinit ... Done !!!

Above all, we have the following questions:

  1. Is the dma_buf used by the gst isp plugin allocated from DDR_SHARED_MEM?
  2. If so, should the minimum DDR_SHARED_MEM for this camera pipeline be 53.3M?
  3. Could you provide some suggestions on how to reduce the reserve memory usage while algorithms and pipelines runs successfully
  4. Or could you provide some suggestions on how to run algorithms and pipelines on 1GB DDR memory?

 

  • Could you please share your use case:

    1) SDK version

    2) Pipeline that you are planning to use.

    2) C7x memory requirement both heap and scratch

    3) How many frames it takes to run inference? 

  • Hi Yogesh,

    1) the SDK version is 8.6

    2) We are planning to use two pipelines:

    a.  v4l2src device=/dev/video2 io-mode=5 ! video/x-bayer, width=2592, height=1944, format=bggi10 ! tiovxisp using_ir_mode=True sensor-name=SENSOR_OX05B_RGBIR dcc-isp-file=/opt/imaging/ox05b/dcc_viss.bin sink_0::dcc-2a-file=/opt/imaging/ox05b/dcc_2a.bin sink_0::device=/dev/v4l-subdev2 format-msb=9 sink_0::pool-size=2 src::pool-size=2 ! video/x-raw, format=NV12 ! appsink name=sen_0 max-buffers=2 drop=true

    b.  v4l2src device=/dev/video3 io-mode=5 ! video/x-bayer, width=2592, height=1944, format=bggi10 ! tiovxisp using_ir_mode=False sensor-name=SENSOR_OX05B_RGBIR dcc-isp-file=/opt/imaging/ox05b/dcc_viss.bin sink_0::dcc-2a-file=/opt/imaging/ox05b/dcc_2a.bin sink_0::device=/dev/v4l-subdev2 format-msb=9 sink_0::pool-size=2 src::pool-size=2 ! video/x-raw, format=NV12 ! queue max-size-buffers=1 leaky=1 ! v4l2h264enc output-io-mode=dmabuf-import ! rtph264pay ! udpsink host=192.168.3.77 port=5000 sync=false

    the first pipeline is used for DMS, the second pipeline is used for H.264 streaming.

    3) We have tested setting C7x heap and scratch memory to 50MB, and it's ok for DMS algorithm.

    4) The DMS SDK is provided by another company, and it is unclear how many frames it takes to run inference internally. Can we assume that it only requires one frame?

  • Hi Yogesh,

    Please help me check this issue. The relevant responses are below, thank you.