Hi Experts,
Our goal: Passing camera video frames to linux virtual video device.
Modification: I changed writeMosaicOutput funtion to copying frame data to /dev/video instead of copying frame data to sd card.
Outcome: The dispay freezed occasionally.
I have tried to increase frame buffer size for writeMosaicOutput and remove display node from graph but those did not help much.
As you can see in the log, FILEIO and TOTAL recoreds are well in the acceptable range.
I also set timeout to 34 ms in the gstreamer. The updating frame interval did not exceed timeout, so it probably dequed the same frame and wrote the same frame to /dev/video repeadly.
Summary of CPU load,
====================
CPU: mpu1_0: TOTAL LOAD = 21.95 % ( HWI = 0.42 %, SWI = 0.79 % )
CPU: mcu2_0: TOTAL LOAD = 7. 0 % ( HWI = 0. 0 %, SWI = 0. 0 % )
CPU: mcu2_1: TOTAL LOAD = 1. 0 % ( HWI = 0. 0 %, SWI = 0. 0 % )
CPU: c6x_1: TOTAL LOAD = 1. 0 % ( HWI = 0. 0 %, SWI = 0. 0 % )
CPU: c6x_2: TOTAL LOAD = 1. 0 % ( HWI = 0. 0 %, SWI = 0. 0 % )
CPU: c7x_1: TOTAL LOAD = 1. 0 % ( HWI = 0. 0 %, SWI = 0. 0 % )
HWA performance statistics,
===========================
HWA: MSC0: LOAD = 7.99 % ( 61 MP/s )
DDR performance statistics,
===========================
DDR: READ BW: AVG = 466 MB/s, PEAK = 3316 MB/s
DDR: WRITE BW: AVG = 315 MB/s, PEAK = 3407 MB/s
DDR: TOTAL BW: AVG = 781 MB/s, PEAK = 6723 MB/s
Detailed CPU performance/memory statistics,
===========================================
CPU: mcu2_0: TASK: IPC_RX: 0.31 %
CPU: mcu2_0: TASK: REMOTE_SRV: 0. 0 %
CPU: mcu2_0: TASK: LOAD_TEST: 0. 0 %
CPU: mcu2_0: TASK: TIVX_CPU_0: 0. 0 %
CPU: mcu2_0: TASK: TIVX_NF: 0. 0 %
CPU: mcu2_0: TASK: TIVX_LDC1: 0. 0 %
CPU: mcu2_0: TASK: TIVX_MSC1: 1.54 %
CPU: mcu2_0: TASK: TIVX_MSC2: 0. 0 %
CPU: mcu2_0: TASK: TIVX_VISS1: 0. 0 %
CPU: mcu2_0: TASK: TIVX_CAPT1: 0.93 %
CPU: mcu2_0: TASK: TIVX_CAPT2: 0. 0 %
CPU: mcu2_0: TASK: TIVX_DISP1: 1.74 %
CPU: mcu2_0: TASK: TIVX_DISP2: 0. 0 %
CPU: mcu2_0: TASK: TIVX_CSITX: 0. 0 %
CPU: mcu2_0: TASK: TIVX_CAPT3: 0. 0 %
CPU: mcu2_0: TASK: TIVX_CAPT4: 0. 0 %
CPU: mcu2_0: TASK: TIVX_CAPT5: 0. 0 %
CPU: mcu2_0: TASK: TIVX_CAPT6: 0. 0 %
CPU: mcu2_0: TASK: TIVX_CAPT7: 0. 0 %
CPU: mcu2_0: TASK: TIVX_CAPT8: 0. 0 %
CPU: mcu2_0: TASK: TIVX_DISP_M: 1.59 %
CPU: mcu2_0: TASK: TIVX_DISP_M: 0. 0 %
CPU: mcu2_0: TASK: TIVX_DISP_M: 0. 0 %
CPU: mcu2_0: TASK: TIVX_DISP_M: 0. 0 %
CPU: mcu2_0: HEAP: DDR_SHARED_MEM: size = 16777216 B, free = 16701440 B ( 99 % unused)
CPU: mcu2_0: HEAP: L3_MEM: size = 262144 B, free = 261888 B ( 99 % unused)
CPU: mcu2_1: TASK: IPC_RX: 0. 0 %
CPU: mcu2_1: TASK: REMOTE_SRV: 0. 0 %
CPU: mcu2_1: TASK: LOAD_TEST: 0. 0 %
CPU: mcu2_1: TASK: TIVX_SDE: 0. 0 %
CPU: mcu2_1: TASK: TIVX_DOF: 0. 0 %
CPU: mcu2_1: TASK: TIVX_CPU_1: 0. 0 %
CPU: mcu2_1: TASK: IPC_TEST_RX: 0. 0 %
CPU: mcu2_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: mcu2_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: mcu2_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: mcu2_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: mcu2_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: mcu2_1: HEAP: DDR_SHARED_MEM: size = 16777216 B, free = 16773376 B ( 99 % unused)
CPU: mcu2_1: HEAP: L3_MEM: size = 262144 B, free = 262144 B (100 % unused)
CPU: c6x_1: TASK: IPC_RX: 0. 0 %
CPU: c6x_1: TASK: REMOTE_SRV: 0. 0 %
CPU: c6x_1: TASK: LOAD_TEST: 0. 0 %
CPU: c6x_1: TASK: TIVX_CPU: 0. 0 %
CPU: c6x_1: TASK: IPC_TEST_RX: 0. 0 %
CPU: c6x_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: c6x_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: c6x_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: c6x_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: c6x_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: c6x_1: HEAP: DDR_SHARED_MEM: size = 16777216 B, free = 16773376 B ( 99 % unused)
CPU: c6x_1: HEAP: L2_MEM: size = 229376 B, free = 229376 B (100 % unused)
CPU: c6x_1: HEAP: DDR_SCRATCH_MEM: size = 50331648 B, free = 50331648 B (100 % unused)
CPU: c6x_2: TASK: IPC_RX: 0. 0 %
CPU: c6x_2: TASK: REMOTE_SRV: 0. 0 %
CPU: c6x_2: TASK: LOAD_TEST: 0. 0 %
CPU: c6x_2: TASK: TIVX_CPU: 0. 0 %
CPU: c6x_2: TASK: IPC_TEST_RX: 0. 0 %
CPU: c6x_2: TASK: IPC_TEST_TX: 0. 0 %
CPU: c6x_2: TASK: IPC_TEST_TX: 0. 0 %
CPU: c6x_2: TASK: IPC_TEST_TX: 0. 0 %
CPU: c6x_2: TASK: IPC_TEST_TX: 0. 0 %
CPU: c6x_2: TASK: IPC_TEST_TX: 0. 0 %
CPU: c6x_2: HEAP: DDR_SHARED_MEM: size = 16777216 B, free = 16773376 B ( 99 % unused)
CPU: c6x_2: HEAP: L2_MEM: size = 229376 B, free = 229376 B (100 % unused)
CPU: c6x_2: HEAP: DDR_SCRATCH_MEM: size = 50331648 B, free = 50331648 B (100 % unused)
CPU: c7x_1: TASK: IPC_RX: 0. 0 %
CPU: c7x_1: TASK: REMOTE_SRV: 0. 0 %
CPU: c7x_1: TASK: LOAD_TEST: 0. 0 %
CPU: c7x_1: TASK: TIVX_CPU_PR: 0. 0 %
CPU: c7x_1: TASK: TIVX_CPU_PR: 0. 0 %
CPU: c7x_1: TASK: TIVX_CPU_PR: 0. 0 %
CPU: c7x_1: TASK: TIVX_CPU_PR: 0. 0 %
CPU: c7x_1: TASK: TIVX_CPU_PR: 0. 0 %
CPU: c7x_1: TASK: TIVX_CPU_PR: 0. 0 %
CPU: c7x_1: TASK: TIVX_CPU_PR: 0. 0 %
CPU: c7x_1: TASK: TIVX_CPU_PR: 0. 0 %
CPU: c7x_1: TASK: IPC_TEST_RX: 0. 0 %
CPU: c7x_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: c7x_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: c7x_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: c7x_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: c7x_1: TASK: IPC_TEST_TX: 0. 0 %
CPU: c7x_1: HEAP: DDR_SHARED_MEM: size = 268435456 B, free = 268435200 B ( 99 % unused)
CPU: c7x_1: HEAP: L3_MEM: size = 8159232 B, free = 8159232 B (100 % unused)
CPU: c7x_1: HEAP: L2_MEM: size = 458752 B, free = 458752 B (100 % unused)
CPU: c7x_1: HEAP: L1_MEM: size = 16384 B, free = 16384 B (100 % unused)
CPU: c7x_1: HEAP: DDR_SCRATCH_MEM: size = 385875968 B, free = 385875968 B (100 % unused)
GRAPH: app_multi_cam_graph (#nodes = 4, #executions = 839)
NODE: CAPTURE1: capture_node: avg = 19902 usecs, min/max = 3254 / 44525 usecs9
NODE: DSS_M2M1: FmtConvNode: avg = 2126 usecs, min/max = 2114 / 2152 usecs9
NODE: VPAC_MSC1: mosaic_node: avg = 2938 usecs, min/max = 2861 / 14112 usecs9
NODE: DISPLAY1: DisplayNode: avg = 6685 usecs, min/max = 74 / 11974 usecs9
PERF: FILEIO: avg = 1133 usecs, min/max = 1005 / 1664 usecs, #executions = 88
PERF: TOTAL: avg = 33332 usecs, min/max = 33140 / 33513 usecs, #executions = 50
PERF: TOTAL: 30. 0 FPS
=========================
Demo : Camera Demo
=========================
s: Save CSIx, VISS and LDC outputs
p: Print performance statistics
x: Exit
Enter Choice:
=========================
Demo : Camera Demo
=========================
s: Save CSIx, VISS and LDC outputs
p: Print performance statistics
x: Exit
Enter Choice: [MCU2_0] 261.761782 s: ==========================================================
[MCU2_0] 261.761878 s: Capture Status: Instance|0
[MCU2_0] 261.761914 s: ==========================================================
[MCU2_0] 261.761959 s: overflowCount: 0
[MCU2_0] 261.761994 s: spuriousUdmaIntrCount: 0
[MCU2_0] 261.762029 s: frontFIFOOvflCount: 0
[MCU2_0] 261.762062 s: crcCount: 0
[MCU2_0] 261.762092 s: eccCount: 0
[MCU2_0] 261.762125 s: correctedEccCount: 0
[MCU2_0] 261.762159 s: dataIdErrorCount: 0
[MCU2_0] 261.762206 s: invalidAccessCount: 0
[MCU2_0] 261.762240 s: invalidSpCount: 0
[MCU2_0] 261.762277 s: strmFIFOOvflCount[0]: 0
[MCU2_0] 261.762306 s: Channel Num | Frame Queue Count | Frame De-queue Count | Frame Drop Count|
[MCU2_0] 261.762383 s: 0 | 842 | 840 | 0|
vx_status gst_writeMosaicOutput(char* file_name, vx_image out_img, FILE *fpp) { vx_status status; vx_int32 j; static uint8_t i_buffer[SIZE] = {0}; status = vxGetStatus((vx_reference)out_img); if(status == VX_SUCCESS) { rewind(fpp); //if(fp == NULL) { // printf("Unable to open file %s \n", file_name); // return (VX_FAILURE); } { vx_rectangle_t rect; vx_imagepatch_addressing_t image_addr; vx_map_id map_id; void * data_ptr; vx_uint32 img_width; vx_uint32 img_height; vx_uint32 num_bytes = 0; vxQueryImage(out_img, VX_IMAGE_WIDTH, &img_width, sizeof(vx_uint32)); vxQueryImage(out_img, VX_IMAGE_HEIGHT, &img_height, sizeof(vx_uint32)); rect.start_x = 0; rect.start_y = 0; rect.end_x = img_width; rect.end_y = img_height; status = vxMapImagePatch(out_img, &rect, 0, &map_id, &image_addr, &data_ptr, VX_READ_ONLY, VX_MEMORY_TYPE_HOST, VX_NOGAP_X); /* Copy Luma */ for (j = 0; j < img_height; j++) { //num_bytes += fwrite(data_ptr, 1, img_width, fp); memcpy(i_buffer + num_bytes, data_ptr, img_width); num_bytes += img_width; //fwrite(data_ptr, 1, img_width, fpp); data_ptr += image_addr.stride_y; } if(num_bytes != (img_width*img_height)) { printf("Luma bytes written = %d, expected = %d", num_bytes, img_width*img_height); } vxUnmapImagePatch(out_img, map_id); status = vxMapImagePatch(out_img, &rect, 1, &map_id, &image_addr, &data_ptr, VX_READ_ONLY, VX_MEMORY_TYPE_HOST, VX_NOGAP_X); /* Copy CbCr */ num_bytes = 0; for (j = 0; j < img_height/2; j++) { //num_bytes += fwrite(data_ptr, 1, img_width, fp); memcpy(i_buffer + num_bytes + FRAME_SIZE, data_ptr, img_width); num_bytes += img_width; //fwrite(data_ptr, 1, img_width, fpp); data_ptr += image_addr.stride_y; } if(num_bytes != (img_width*img_height/2)) { printf("CbCr bytes written = %d, expected = %d", num_bytes, img_width*img_height/2); } vxUnmapImagePatch(out_img, map_id); fwrite(i_buffer, SIZE, 1, fpp); fsync(fileno(fpp)); } //fclose(fp); } return(status); }
Thanks
Michael