SDK Ver: 10_00_00
I modify tests/app_tiovx_linux_decode_display_test.c and try to capture and display my sensor video. The block diagram is as follows.
The main function is as follows
vx_status sensor_capture_test() { vx_status status = VX_FAILURE; GraphObj graph; NodeObj *viss_node = NULL, *ldc_node = NULL, *scaler_node = NULL, *mosaic_node = NULL; BufPool *in_buf_pool = NULL, *out_buf_pool = {NULL}; Buf *inbuf = NULL, *outbuf = {NULL}; kmsDisplayCfg kms_display_cfg; kmsDisplayHandle *kms_display_handle; v4l2CaptureHandle *v4l2_capture_handle; TIOVXMultiScalerNodeCfg msc_cfg; TIOVXLdcNodeCfg ldc_cfg; TIOVXMosaicNodeCfg mosaic_cfg; threadParams mosaic_param, ldc_param; pthread_t id; printf("link test start\n"); status = tiovx_modules_initialize_graph(&graph); graph.schedule_mode = VX_GRAPH_SCHEDULE_MODE_QUEUE_AUTO; // v4l2 capture v4l2CaptureCfg v4l2_capture_cfg; v4l2_capture_init_cfg(&v4l2_capture_cfg); v4l2_capture_cfg.width = CAM_WIDTH; v4l2_capture_cfg.height = CAM_HEIGHT; v4l2_capture_cfg.pix_format = V4L2_PIX_FMT_SBGGR12; v4l2_capture_cfg.bufq_depth = APP_BUFQ_DEPTH; sprintf(v4l2_capture_cfg.device, "/dev/video3"); v4l2_capture_handle = v4l2_capture_create_handle(&v4l2_capture_cfg); printf("v4l2 capture success!\n"); // status = tiovx_modules_initialize_graph(&graph); // graph.schedule_mode = VX_GRAPH_SCHEDULE_MODE_QUEUE_AUTO; // cdns_csi2rx struct v4l2_subdev_format format; CLR(&format); format.which = V4L2_SUBDEV_FORMAT_ACTIVE; format.format.code = FMT; format.format.field = V4L2_FIELD_NONE; format.format.width = CAM_WIDTH; format.format.height = CAM_HEIGHT; format.pad = 0; set_subdev_fmt(SUBDEV_BRIDGE, &format); get_subdev_fmt(SUBDEV_BRIDGE, 0); printf("set cdns fmt end\n"); // ticsi2rx CLR(&format); format.which = V4L2_SUBDEV_FORMAT_ACTIVE; format.format.code = FMT; format.format.field = V4L2_FIELD_NONE; format.format.width = CAM_WIDTH; format.format.height = CAM_HEIGHT; format.pad = 0; set_subdev_fmt(SUBDEV_J271, &format); get_subdev_fmt(SUBDEV_J271, 0); printf("set ticsi2rx pad 0 fmt end\n"); // max96714 CLR(&format); format.which = V4L2_SUBDEV_FORMAT_ACTIVE; format.format.code = FMT; format.format.field = V4L2_FIELD_NONE; format.format.width = CAM_WIDTH; format.format.height = CAM_HEIGHT; format.pad = 0; set_subdev_fmt(SUBDEV_MAX96714, &format); get_subdev_fmt(SUBDEV_MAX96714, 0); printf("set 96714 fmt end\n"); // max96717 CLR(&format); format.which = V4L2_SUBDEV_FORMAT_ACTIVE; format.format.code = FMT; format.format.field = V4L2_FIELD_NONE; format.format.width = CAM_WIDTH; format.format.height = CAM_HEIGHT; format.pad = 0; set_subdev_fmt(SUBDEV_MAX96717, &format); get_subdev_fmt(SUBDEV_MAX96717, 0); printf("set 96717 fmt end\n"); // VISS TIOVXVissNodeCfg viss_cfg; tiovx_viss_init_cfg(&viss_cfg); sprintf(viss_cfg.sensor_name, SENSOR_NAME); snprintf(viss_cfg.dcc_config_file, TIVX_FILEIO_FILE_PATH_LENGTH, "%s", DCC_VISS); viss_cfg.width = VISS_INPUT_WIDTH; viss_cfg.height = VISS_INPUT_HEIGHT; sprintf(viss_cfg.target_string, TIVX_TARGET_VPAC_VISS1); viss_cfg.input_cfg.params.format[0].pixel_container = TIVX_RAW_IMAGE_16_BIT; viss_cfg.input_cfg.params.format[0].msb = 11; viss_node = tiovx_modules_add_node(&graph, TIOVX_VISS, (void *)&viss_cfg); viss_node->sinks[0].bufq_depth = APP_BUFQ_DEPTH; printf("viss capture success!\n"); // LDC // TIOVXLdcNodeCfg ldc_cfg; tiovx_ldc_init_cfg(&ldc_cfg); sprintf(ldc_cfg.sensor_name, SENSOR_NAME); snprintf(ldc_cfg.dcc_config_file, TIVX_FILEIO_FILE_PATH_LENGTH, "%s", DCC_LDC); ldc_cfg.input_cfg.color_format = VX_DF_IMAGE_NV12; ldc_cfg.input_cfg.width = VISS_INPUT_WIDTH; ldc_cfg.input_cfg.height = VISS_INPUT_HEIGHT; ldc_cfg.output_cfgs[0].color_format = VX_DF_IMAGE_NV12; ldc_cfg.output_cfgs[0].width = VISS_INPUT_WIDTH; ldc_cfg.output_cfgs[0].height = VISS_INPUT_HEIGHT; sprintf(ldc_cfg.target_string, TIVX_TARGET_VPAC_LDC1); ldc_node = tiovx_modules_add_node(&graph, TIOVX_LDC, (void *)&ldc_cfg); ldc_node->sinks[0].bufq_depth = APP_BUFQ_DEPTH; status = tiovx_modules_link_pads(&viss_node->srcs[0], &ldc_node->sinks[0]); printf("ldc inti success!\n"); // MSC tiovx_multi_scaler_init_cfg(&msc_cfg); msc_cfg.color_format = VX_DF_IMAGE_NV12; msc_cfg.num_outputs = 1; msc_cfg.input_cfg.width = VISS_INPUT_WIDTH; msc_cfg.input_cfg.height = VISS_INPUT_HEIGHT; msc_cfg.output_cfgs[0].width = 900; msc_cfg.output_cfgs[0].height = 720; sprintf(msc_cfg.target_string, TIVX_TARGET_VPAC_MSC1); tiovx_multi_scaler_module_crop_params_init(&msc_cfg); scaler_node = tiovx_modules_add_node(&graph, TIOVX_MULTI_SCALER, (void *)&msc_cfg); status = tiovx_modules_link_pads(&ldc_node->srcs[0], &scaler_node->sinks[0]); printf("msc init success!\n"); // mosaic tiovx_mosaic_init_cfg(&mosaic_cfg); mosaic_cfg.color_format = VX_DF_IMAGE_NV12; mosaic_cfg.num_inputs = 1; mosaic_cfg.output_cfg.width = DISPLAY_WIDTH; mosaic_cfg.output_cfg.height = DISPLAY_HEIGHT; mosaic_cfg.input_cfgs[0].width = 900; mosaic_cfg.input_cfgs[0].height = 720; mosaic_cfg.params.num_windows = 1; mosaic_cfg.params.clear_count = 5; mosaic_cfg.params.windows[0].startX = 0; mosaic_cfg.params.windows[0].startY = 0; mosaic_cfg.params.windows[0].width = 900; mosaic_cfg.params.windows[0].height = 720; mosaic_cfg.params.windows[0].input_select = 0; mosaic_cfg.params.windows[0].channel_select = 0; mosaic_node = tiovx_modules_add_node(&graph, TIOVX_MOSAIC, (void *)&mosaic_cfg); mosaic_node->srcs[0].bufq_depth = APP_BUFQ_DEPTH; status = tiovx_modules_link_pads(&scaler_node->srcs[0], &mosaic_node->sinks[0]); printf("mosaic init success!\n"); kms_display_init_cfg(&kms_display_cfg); kms_display_cfg.width = DISPLAY_WIDTH; kms_display_cfg.height = DISPLAY_HEIGHT; kms_display_cfg.pix_format = DRM_FORMAT_NV12; kms_display_handle = kms_display_create_handle(&kms_display_cfg); printf("kms init success!\n"); // verify status = tiovx_modules_verify_graph(&graph); in_buf_pool = viss_node->sinks[0].buf_pool; out_buf_pool = mosaic_node->srcs[0].buf_pool; printf("verify status[%d]\n", status); for (int i = 0; i < APP_BUFQ_DEPTH; i++) { outbuf = tiovx_modules_acquire_buf(out_buf_pool); status = kms_display_register_buf(kms_display_handle, outbuf); tiovx_modules_enqueue_buf(outbuf); } for (int i = 0; i < APP_BUFQ_DEPTH; i++) { inbuf = tiovx_modules_acquire_buf(in_buf_pool); v4l2_capture_enqueue_buf(v4l2_capture_handle, inbuf); } ldc_param.capture_handle = v4l2_capture_handle; ldc_param.pad = &viss_node->sinks[0]; ldc_param.enable = true; pthread_create(&id, NULL, ldc_enqueue, (void *)&ldc_param); pthread_create(&id, NULL, ldc_dequeue, (void *)&ldc_param); mosaic_param.pad = &mosaic_node->srcs[0]; mosaic_param.kms_handle = kms_display_handle; mosaic_param.enable = true; pthread_create(&id, NULL, mosaic_enqueue, (void *)&mosaic_param); pthread_create(&id, NULL, mosaic_dequeue, (void *)&mosaic_param); sleep(200); #if 0 sleep(300); mosaic_param.enable = false; ldc_param.enable = false; sleep(10); v4l2_capture_stop(v4l2_capture_handle); v4l2_capture_delete_handle(v4l2_capture_handle); tiovx_modules_clean_graph(&graph); #endif return 0; }
The program ran with an error
16552.514009 s: VX_ZONE_ERROR:[ownContextSendCmd:885] Command ack message returned failure cmd_status: -7
16552.514052 s: VX_ZONE_ERROR:[ownNodeKernelInit:592] Target kernel, TIVX_CMD_NODE_CREATE failed for node node_93
16552.514065 s: VX_ZONE_ERROR:[ownNodeKernelInit:593] Please be sure the target callbacks have been registered for this core
16552.514077 s: VX_ZONE_ERROR:[ownNodeKernelInit:594] If the target callbacks have been registered, please ensure no errors are occurring within the create callback of this kernel
16552.514092 s: VX_ZONE_ERROR:[ownGraphNodeKernelInit:620] kernel init for node 0, kernel com.ti.hwa.vpac_viss ... failed !!!
16552.514125 s: VX_ZONE_ERROR:[vxVerifyGraph:2254] Node kernel init failed
16552.514136 s: VX_ZONE_ERROR:[vxVerifyGraph:2311] Graph verify failed
[TIOVX_MODULES][ERROR] 791: tiovx_modules_verify_graph: Graph Verify failedverify status[-1]
There is no error when I delete the VISS node.I wonder how to solve this porblem.