diff --git a/apps/src/input_block.c b/apps/src/input_block.c index f51d09b..7ea654a 100644 --- a/apps/src/input_block.c +++ b/apps/src/input_block.c @@ -201,7 +201,9 @@ int32_t create_input_block(GraphObj *graph, InputBlock *input_block) sprintf(sensor_name, "SENSOR_OV2312_UB953_LI"); format_pixel_container = TIVX_RAW_IMAGE_16_BIT; format_msb = 9; - v4l2_pix_format = v4l2_fourcc('B','G','I','0'); +#if defined(TARGET_OS_LINUX) + v4l2_pix_format = v4l2_fourcc('B','G','I','0'); +#endif output_width = 1600; output_height = 1300; } diff --git a/cmake/common.cmake b/cmake/common.cmake index 706cccb..f1d6885 100644 --- a/cmake/common.cmake +++ b/cmake/common.cmake @@ -82,13 +82,15 @@ add_definitions( set(VISION_APPS_LIBS_PATH $ENV{VISION_APPS_LIBS_PATH}) set(EDGEAI_LIBS_PATH $ENV{EDGEAI_LIBS_PATH}) +set(QNX_LIB_PATH $ENV{QNX_LIB_PATH}) link_directories(${TARGET_FS}/usr/lib/aarch64-linux ${TARGET_FS}/usr/lib ${CMAKE_LIBRARY_PATH}/usr/lib ${CMAKE_LIBRARY_PATH}/lib ${VISION_APPS_LIBS_PATH} ${EDGEAI_LIBS_PATH} - ) + ${QNX_LIB_PATH} + ) if ("${TARGET_OS}" STREQUAL "QNX") link_directories(${PSDK_QNX_PATH}/qnx/codec/vpu/OpenMAXIL/core/nto/aarch64/so.le/ @@ -184,9 +186,10 @@ if ("${TARGET_OS}" STREQUAL "QNX") tiipc-usr ti-udmalld ti-pdk + ti-csirxlld + ti-fvid2lld ti-sciclient c++ - c++fs omxcore_j7 omxil_j7_utility) add_definitions( diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 406346d..1968f0b 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -46,7 +46,10 @@ if ("${TARGET_CPU}" STREQUAL "A72" OR "${TARGET_CPU}" STREQUAL "A53") list(APPEND SRC_FILES src/omx_encode_module.c - src/omx_decode_module.c) + src/omx_decode_module.c + src/tiovx_capture_module.c + src/qnx_display_module.c + src/tiovx_aewb_module.c) endif() endif() diff --git a/modules/core/include/tiovx_modules_cbs.h b/modules/core/include/tiovx_modules_cbs.h index a62fd7a..02f5266 100644 --- a/modules/core/include/tiovx_modules_cbs.h +++ b/modules/core/include/tiovx_modules_cbs.h @@ -81,15 +81,19 @@ #include "tiovx_pixelwise_add_module.h" #include "tiovx_lut_module.h" -#if defined(SOC_J721E) || defined(SOC_J721S2) || defined(SOC_J784S4) || defined(SOC_J722S) || defined(SOC_J742S2) +#if defined(SOC_J721E) || defined(SOC_J721S2) || defined(SOC_J784S4) || defined(SOC_J722S) || defined(SOC_J742S2) || defined(SOC_AM62A) +#if !defined(SOC_AM62A) #include "tiovx_display_module.h" +#endif #include "tiovx_capture_module.h" #include "tiovx_aewb_module.h" +#if !defined(SOC_AM62A) #include "tiovx_sde_module.h" #include "tiovx_sde_viz_module.h" #include "tiovx_dof_module.h" #include "tiovx_dof_viz_module.h" #endif +#endif #ifdef __cplusplus extern "C" { @@ -117,14 +121,18 @@ typedef enum { TIOVX_PIXELWISE_MULTIPLY, TIOVX_PIXELWISE_ADD, TIOVX_LUT, -#if defined(SOC_J721E) || defined(SOC_J721S2) || defined(SOC_J784S4) || defined(SOC_J722S) || defined(SOC_J742S2) +#if defined(SOC_J721E) || defined(SOC_J721S2) || defined(SOC_J784S4) || defined(SOC_J722S) || defined(SOC_J742S2) || defined(SOC_AM62A) +#if !defined(SOC_AM62A) TIOVX_DISPLAY, +#endif TIOVX_CAPTURE, TIOVX_AEWB, +#if !defined(SOC_AM62A) TIOVX_SDE, TIOVX_SDE_VIZ, TIOVX_DOF, TIOVX_DOF_VIZ, +#endif #endif TIOVX_MODULES_NUM_MODULES, } NODE_TYPES; @@ -132,5 +140,4 @@ typedef enum { #ifdef __cplusplus } #endif - #endif //_TIOVX_MODULES_CBS diff --git a/modules/core/src/tiovx_modules.c b/modules/core/src/tiovx_modules.c index 1d5b8aa..276e275 100644 --- a/modules/core/src/tiovx_modules.c +++ b/modules/core/src/tiovx_modules.c @@ -96,20 +96,18 @@ vx_status tiovx_modules_initialize_graph(GraphObj *graph) NodeObj* tiovx_modules_add_node(GraphObj *graph, NODE_TYPES node_type, void *cfg) { vx_status status = VX_FAILURE; - LOCK(graph); NodeObj *node = &(graph->node_list[graph->num_nodes]); - node->graph = graph; node->node_index = graph->num_nodes; node->cbs = &gNodeCbs[node_type]; node->node_cfg = malloc(node->cbs->get_cfg_size()); node->node_type = node_type; - + if (node->cbs->get_priv_size) { node->node_priv = malloc(node->cbs->get_priv_size()); } - + for (uint8_t i = 0; i < TIOVX_MODULES_MAX_NODE_INPUTS; i++) { node->sinks[i].direction = SINK; node->sinks[i].num_channels = TIOVX_MODULES_DEFAULT_NUM_CHANNELS; @@ -127,7 +125,6 @@ NodeObj* tiovx_modules_add_node(GraphObj *graph, NODE_TYPES node_type, void *cfg } memcpy(node->node_cfg, cfg, node->cbs->get_cfg_size()); - status = node->cbs->init_node(node); if (VX_SUCCESS != status) { TIOVX_MODULE_ERROR("Node Init failed, Node Type: %d\n", node_type); @@ -623,7 +620,7 @@ vx_bool tiovx_modules_compare_exemplars(vx_reference exemplar1, vx_reference exe vx_status tiovx_modules_link_pads(Pad *src_pad, Pad *sink_pad) { vx_status status = VX_FAILURE; - + if (SRC != src_pad->direction) { TIOVX_MODULE_ERROR("Invalid src pad\n"); return status; @@ -774,7 +771,7 @@ vx_status tiovx_modules_verify_graph(GraphObj *graph) } if(status != VX_SUCCESS) - { + { TIOVX_MODULE_ERROR("Creating Node failed: %d\n", i); return status; } diff --git a/modules/core/src/tiovx_modules_cbs.c b/modules/core/src/tiovx_modules_cbs.c index ff3d628..97e23f6 100644 --- a/modules/core/src/tiovx_modules_cbs.c +++ b/modules/core/src/tiovx_modules_cbs.c @@ -206,17 +206,19 @@ NodeCbs gNodeCbs[TIOVX_MODULES_NUM_MODULES] = .delete_node = tiovx_lut_delete_node, .get_cfg_size = tiovx_lut_get_cfg_size, .get_priv_size = tiovx_lut_get_priv_size -#if defined(SOC_J721E) || defined(SOC_J721S2) || defined(SOC_J784S4) || defined(SOC_J722S) || defined(SOC_J742S2) +#if defined(SOC_J721E) || defined(SOC_J721S2) || defined(SOC_J784S4) || defined(SOC_J722S) || defined(SOC_J742S2) || defined(SOC_AM62A) }, - { + #if !defined(SOC_AM62A) + { .init_node = tiovx_display_init_node, .create_node = tiovx_display_create_node, .post_verify_graph = NULL, .delete_node = tiovx_display_delete_node, .get_cfg_size = tiovx_display_get_cfg_size, .get_priv_size = tiovx_display_get_priv_size - }, - { + }, + #endif + { .init_node = tiovx_capture_init_node, .create_node = tiovx_capture_create_node, .post_verify_graph = tiovx_capture_post_verify_graph, @@ -232,6 +234,7 @@ NodeCbs gNodeCbs[TIOVX_MODULES_NUM_MODULES] = .get_cfg_size = tiovx_aewb_get_cfg_size, .get_priv_size = tiovx_aewb_get_priv_size }, + #if !defined(SOC_AM62A) { .init_node = tiovx_sde_init_node, .create_node = tiovx_sde_create_node, @@ -239,7 +242,7 @@ NodeCbs gNodeCbs[TIOVX_MODULES_NUM_MODULES] = .delete_node = tiovx_sde_delete_node, .get_cfg_size = tiovx_sde_get_cfg_size, .get_priv_size = tiovx_sde_get_priv_size - }, + }, { .init_node = tiovx_sde_viz_init_node, .create_node = tiovx_sde_viz_create_node, @@ -247,7 +250,7 @@ NodeCbs gNodeCbs[TIOVX_MODULES_NUM_MODULES] = .delete_node = tiovx_sde_viz_delete_node, .get_cfg_size = tiovx_sde_viz_get_cfg_size, .get_priv_size = tiovx_sde_viz_get_priv_size - }, + }, { .init_node = tiovx_dof_init_node, .create_node = tiovx_dof_create_node, @@ -255,7 +258,7 @@ NodeCbs gNodeCbs[TIOVX_MODULES_NUM_MODULES] = .delete_node = tiovx_dof_delete_node, .get_cfg_size = tiovx_dof_get_cfg_size, .get_priv_size = tiovx_dof_get_priv_size - }, + }, { .init_node = tiovx_dof_viz_init_node, .create_node = tiovx_dof_viz_create_node, @@ -263,7 +266,8 @@ NodeCbs gNodeCbs[TIOVX_MODULES_NUM_MODULES] = .delete_node = tiovx_dof_viz_delete_node, .get_cfg_size = tiovx_dof_viz_get_cfg_size, .get_priv_size = tiovx_dof_viz_get_priv_size - } + } + #endif #else } #endif diff --git a/modules/include/qnx_display_module.h b/modules/include/qnx_display_module.h new file mode 100644 index 0000000..413f3c1 --- /dev/null +++ b/modules/include/qnx_display_module.h @@ -0,0 +1,94 @@ +/* + * + * Copyright (c) 2024 Texas Instruments Incorporated + * + * All rights reserved not granted herein. + * + * Limited License. + * + * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive + * license under copyrights and patents it now or hereafter owns or controls to make, + * have made, use, import, offer to sell and sell ("Utilize") this software subject to the + * terms herein. With respect to the foregoing patent license, such license is granted + * solely to the extent that any such patent is necessary to Utilize the software alone. + * The patent license shall not apply to any combinations which include this software, + * other than combinations with devices manufactured by or for TI ("TI Devices"). + * No hardware patent is licensed hereunder. + * + * Redistributions must preserve existing copyright notices and reproduce this license + * (including the above copyright notice and the disclaimer and (if applicable) source + * code license limitations below) in the documentation and/or other materials provided + * with the distribution + * + * Redistribution and use in binary form, without modification, are permitted provided + * that the following conditions are met: + * + * * No reverse engineering, decompilation, or disassembly of this software is + * permitted with respect to any software provided in binary form. + * + * * any redistribution and use are licensed by TI for use only with TI Devices. + * + * * Nothing shall obligate TI to provide you with source code for the software + * licensed and provided to you in object code. + * + * If software source code is provided to you, modification and redistribution of the + * source code are permitted provided that the following conditions are met: + * + * * any redistribution and use of the source code, including any resulting derivative + * works, are licensed by TI for use only with TI Devices. + * + * * any redistribution and use of any object code compiled from the source code + * and any resulting derivative works, are licensed by TI for use only with TI Devices. + * + * Neither the name of Texas Instruments Incorporated nor the names of its suppliers + * + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * DISCLAIMER. + * + * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _qnx_DISPLAY_MODULE +#define _qnx_DISPLAY_MODULE + +#include +#include "tiovx_modules_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t qnx_display_render_buf(Buf *tiovx_buffer); +void qnx_display_init(); + +#ifdef __cplusplus +} +#endif + +#endif + + + + + + + + + + + + + + + diff --git a/modules/src/qnx_display_module.c b/modules/src/qnx_display_module.c new file mode 100644 index 0000000..5d99a75 --- /dev/null +++ b/modules/src/qnx_display_module.c @@ -0,0 +1,250 @@ +/* + * + * Copyright (c) 2024 Texas Instruments Incorporated + * + * All rights reserved not granted herein. + * + * Limited License. + * + * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive + * license under copyrights and patents it now or hereafter owns or controls to make, + * have made, use, import, offer to sell and sell ("Utilize") this software subject to the + * terms herein. With respect to the foregoing patent license, such license is granted + * solely to the extent that any such patent is necessary to Utilize the software alone. + * The patent license shall not apply to any combinations which include this software, + * other than combinations with devices manufactured by or for TI ("TI Devices"). + * No hardware patent is licensed hereunder. + * + * Redistributions must preserve existing copyright notices and reproduce this license + * (including the above copyright notice and the disclaimer and (if applicable) source + * code license limitations below) in the documentation and/or other materials provided + * with the distribution + * + * Redistribution and use in binary form, without modification, are permitted provided + * that the following conditions are met: + * + * * No reverse engineering, decompilation, or disassembly of this software is + * permitted with respect to any software provided in binary form. + * + * * any redistribution and use are licensed by TI for use only with TI Devices. + * + * * Nothing shall obligate TI to provide you with source code for the software + * licensed and provided to you in object code. + * + * If software source code is provided to you, modification and redistribution of the + * source code are permitted provided that the following conditions are met: + * + * * any redistribution and use of the source code, including any resulting derivative + * works, are licensed by TI for use only with TI Devices. + * + * * any redistribution and use of any object code compiled from the source code + * and any resulting derivative works, are licensed by TI for use only with TI Devices. + * + * Neither the name of Texas Instruments Incorporated nor the names of its suppliers + * + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * DISCLAIMER. + * + * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "qnx_display_module.h" + +screen_window_t screen_win = NULL; + +int32_t qnx_display_render_buf(Buf *tiovx_buffer) +{ + + static uint32_t j=0; + int32_t err = 0; + vx_uint32 width, height; + vx_df_image df; + vx_imagepatch_addressing_t image_addr; + vx_rectangle_t rect; + vx_map_id map_id1, map_id2; + void *data_ptr1 = NULL, *data_ptr2 = NULL; + vx_uint32 num_bytes_per_4pixels; + vx_uint32 imgaddr_width, imgaddr_height, imgaddr_stride; + uint32_t i; + + if(j==0) + { + qnx_display_init(); + j++; + } + else + { + + int buffer_size[2]; + err = screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size); + if(err != 0) { + printf("Failed to get window buffer size\n"); + } + + screen_buffer_t screen_buf[2]; + err = screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)&screen_buf); + if(err != 0) { + printf("Failed to get window buffer\n"); + } + + /* obtain pointers to the buffers */ + void *ptr1 = NULL; + err = screen_get_buffer_property_pv(screen_buf[0], SCREEN_PROPERTY_POINTER, (void **)&ptr1); + if(err != 0) { + printf("Failed to get buffer pointer\n"); + } + + int buf_stride1 = 0; + err = screen_get_buffer_property_iv(screen_buf[0], SCREEN_PROPERTY_STRIDE, &buf_stride1); + if(err != 0) { + printf("Failed to get buffer stride1\n"); + } + + /* copy frames from OVX buffer to screen buffer*/ + vx_image display_image = (vx_image)(tiovx_buffer->handle); + vxQueryImage(display_image, VX_IMAGE_WIDTH, &width, sizeof(vx_uint32)); + vxQueryImage(display_image, VX_IMAGE_HEIGHT, &height, sizeof(vx_uint32)); + vxQueryImage(display_image, VX_IMAGE_FORMAT, &df, sizeof(vx_df_image)); + + if(VX_DF_IMAGE_NV12 == df) + { + num_bytes_per_4pixels = 4; + } + else if(TIVX_DF_IMAGE_NV12_P12 == df) + { + num_bytes_per_4pixels = 6; + } + else + { + num_bytes_per_4pixels = 8; + } + + rect.start_x = 0; + rect.start_y = 0; + rect.end_x = width; + rect.end_y = height; + + vxMapImagePatch(display_image, + &rect, + 0, + &map_id1, + &image_addr, + &data_ptr1, + VX_WRITE_ONLY, + VX_MEMORY_TYPE_HOST, + VX_NOGAP_X + ); + + if(!data_ptr1) + { + printf("data_ptr1 is NULL \n"); + return -1; + } + + imgaddr_width = image_addr.dim_x; + imgaddr_height = image_addr.dim_y; + imgaddr_stride = image_addr.stride_y; + + /* The current implementation performs memcpy of frame from TIOVX buffer + * to screen buffer. This is not the optimal implementation and needs to + * be updated going ahead for better G2G latency figures + */ + for(i=0;i + #define TIOVX_MODULES_DEFAULT_CAPTURE_SENSOR "SENSOR_SONY_IMX390_UB953_D3" - + typedef struct { SensorObj sensor_obj; vx_user_data_object config; @@ -348,7 +349,6 @@ vx_status tiovx_capture_init_node(NodeObj *node) sensor_params->sensorInfo.raw_params.height, VX_DF_IMAGE_UYVY); } - status = tiovx_module_create_pad_exemplar(&node->srcs[0], exemplar); if (VX_SUCCESS != status) { diff --git a/modules/src/tiovx_sensor_module.c b/modules/src/tiovx_sensor_module.c index 562cf0d..2fc2292 100644 --- a/modules/src/tiovx_sensor_module.c +++ b/modules/src/tiovx_sensor_module.c @@ -121,7 +121,6 @@ vx_status tiovx_init_sensor_obj(SensorObj *sensorObj, char *objName) } TIOVX_MODULE_PRINTF("[SENSOR-MODULE] Dcc ID = %d\n", sensorObj->sensorParams.dccId); - return status; } @@ -158,8 +157,8 @@ vx_status tiovx_sensor_query(SensorObj *sensorObj) pthread_mutex_unlock(&g_lock); sensorObj->num_sensors_found = g_num_sensors_found; - memset(&sensorObj->sensorParams, 0, sizeof(IssSensor_CreateParams)); - selectedSensor = sensorObj->sensor_index; + memset(&sensorObj->sensorParams, 0, sizeof(IssSensor_CreateParams)); + selectedSensor = sensorObj->sensor_index; if(selectedSensor > (sensorObj->num_sensors_found - 1)) { TIOVX_MODULE_ERROR("[SENSOR-MODULE] Invalid selection %d from app:\n", selectedSensor); @@ -249,11 +248,12 @@ vx_status tiovx_sensor_query(SensorObj *sensorObj) } if(ISS_SENSOR_FEATURE_CFG_UC1 == (sensorObj->sensor_features_supported & ISS_SENSOR_FEATURE_CFG_UC1)) - { - if(sensorObj->usecase_option == TIOVX_SENSOR_MODULE_FEATURE_CFG_UC1) + { + if(sensorObj->usecase_option == TIOVX_SENSOR_MODULE_FEATURE_CFG_UC1) { TIOVX_MODULE_PRINTF("CMS Usecase is supported \n"); sensorObj->sensor_features_enabled |= ISS_SENSOR_FEATURE_CFG_UC1; + } } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 21d26b4..88908f2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -50,6 +50,16 @@ endif() endif() endif() +if ("${TARGET_OS}" STREQUAL "QNX") +if ("${TARGET_CPU}" STREQUAL "A72" OR "${TARGET_CPU}" STREQUAL "A53") + list(APPEND + SRC_FILES + app_tiovx_capture_module_test.c + app_tiovx_capture_viss_ldc_msc_display_test.c + app_tiovx_capture_dl_display_pipeline.c) +endif() +endif() + if ("${TARGET_SOC}" STREQUAL "J721E" OR "${TARGET_SOC}" STREQUAL "J721S2" OR "${TARGET_SOC}" STREQUAL "J742S2" OR "${TARGET_SOC}" STREQUAL "J784S4" OR "${TARGET_SOC}" STREQUAL "J722S") list(APPEND SRC_FILES @@ -69,6 +79,14 @@ if ("${TARGET_SOC}" STREQUAL "J721E" OR "${TARGET_SOC}" STREQUAL "J721S2" OR "${ app_tiovx_linux_decode_sde_test.c) endif() endif() + + if ("${TARGET_OS}" STREQUAL "QNX") + if ("${TARGET_CPU}" STREQUAL "A72" OR "${TARGET_CPU}" STREQUAL "A53") + list(APPEND + SRC_FILES + app_tiovx_qnx_decode_display_test.c) + endif() + endif() endif() build_app(${PROJ_NAME} diff --git a/tests/app_tiovx_capture_dl_display_pipeline.c b/tests/app_tiovx_capture_dl_display_pipeline.c index 27583df..02c704c 100644 --- a/tests/app_tiovx_capture_dl_display_pipeline.c +++ b/tests/app_tiovx_capture_dl_display_pipeline.c @@ -75,6 +75,10 @@ #include #include +#if defined(SOC_AM62A) && defined(TARGET_OS_QNX) +#include "qnx_display_module.h" +#endif + #define NUM_ITERATIONS (300) #define APP_BUFQ_DEPTH (1) @@ -95,8 +99,15 @@ #define MSC_INPUT_WIDTH LDC_OUTPUT_WIDTH #define MSC_INPUT_HEIGHT LDC_OUTPUT_HEIGHT +#if !(defined(SOC_AM62A) && defined(TARGET_OS_QNX)) #define MSC_OUTPUT_WIDTH MSC_INPUT_WIDTH/2 #define MSC_OUTPUT_HEIGHT MSC_INPUT_HEIGHT/2 +#endif + +#if defined(SOC_AM62A) && defined(TARGET_OS_QNX) +#define MSC_OUTPUT_WIDTH MSC_INPUT_WIDTH +#define MSC_OUTPUT_HEIGHT MSC_INPUT_HEIGHT +#endif #define LDC_TABLE_WIDTH (1920) #define LDC_TABLE_HEIGHT (1080) @@ -109,11 +120,18 @@ #define DCC_VISS TIOVX_MODULES_IMAGING_PATH"/imx390/linear/dcc_viss.bin" #define DCC_LDC TIOVX_MODULES_IMAGING_PATH"/imx390/linear/dcc_ldc.bin" -#define POST_PROC_OUT_WIDTH (1280) -#define POST_PROC_OUT_HEIGHT (720) +#define POST_PROC_OUT_WIDTH (1920) +#define POST_PROC_OUT_HEIGHT (1080) +#if !defined(SOC_AM62A) #define TIDL_IO_CONFIG_FILE_PATH "/opt/model_zoo/ONR-OD-8200-yolox-nano-lite-mmdet-coco-416x416/artifacts/detslabels_tidl_io_1.bin" #define TIDL_NETWORK_FILE_PATH "/opt/model_zoo/ONR-OD-8200-yolox-nano-lite-mmdet-coco-416x416/artifacts/detslabels_tidl_net.bin" +#endif + +#if defined(SOC_AM62A) +#define TIDL_IO_CONFIG_FILE_PATH "/ti_fs/edgeai/test_data/model_zoo/ONR-OD-8200-yolox-nano-lite-mmdet-coco-416x416/artifacts/subgraph_0_tidl_io_1.bin" +#define TIDL_NETWORK_FILE_PATH "/ti_fs/edgeai/test_data/model_zoo/ONR-OD-8200-yolox-nano-lite-mmdet-coco-416x416/artifacts/subgraph_0_tidl_net.bin" +#endif static char imgnet_labels3[TIVX_DL_POST_PROC_MAX_NUM_CLASSNAMES][TIVX_DL_POST_PROC_MAX_SIZE_CLASSNAME] = { @@ -128,6 +146,7 @@ vx_status app_modules_capture_dl_display_test(int argc, char* argv[]) GraphObj graph; Pad *input_pad = NULL, *output_pad[4] = {NULL, NULL, NULL, NULL}, *post_proc_in_img_pad = NULL; Buf *inbuf = NULL; + Buf *outbuf = NULL; status = tiovx_modules_initialize_graph(&graph); graph.schedule_mode = VX_GRAPH_SCHEDULE_MODE_QUEUE_AUTO; @@ -140,7 +159,9 @@ vx_status app_modules_capture_dl_display_test(int argc, char* argv[]) tiovx_capture_init_cfg(&capture_cfg); capture_cfg.ch_mask = 1; - + #if defined(SOC_AM62A) && defined(TARGET_OS_QNX) + sprintf(capture_cfg.target_string, TIVX_TARGET_CAPTURE2); + #endif capture_node = tiovx_modules_add_node(&graph, TIOVX_CAPTURE, (void *)&capture_cfg); input_pad = &capture_node->srcs[0]; } @@ -319,7 +340,6 @@ vx_status app_modules_capture_dl_display_test(int argc, char* argv[]) tiovx_modules_link_pads(output_pad[0], &dl_pre_proc_node->sinks[0]); output_pad[0] = &dl_pre_proc_node->srcs[0]; } - /* TIDL */ { TIOVXTIDLNodeCfg tidl_cfg; @@ -384,8 +404,9 @@ vx_status app_modules_capture_dl_display_test(int argc, char* argv[]) output_pad[0] = &dl_post_proc_node->srcs[0]; } - + /* Display */ + #if !defined(SOC_AM62A) { TIOVXDisplayNodeCfg display_cfg; NodeObj *display_node; @@ -402,11 +423,14 @@ vx_status app_modules_capture_dl_display_test(int argc, char* argv[]) display_node = tiovx_modules_add_node(&graph, TIOVX_DISPLAY, (void *)&display_cfg); /* Link DL Post Proc to Display */ + tiovx_modules_link_pads(output_pad[0], &display_node->sinks[0]); } + #endif status = tiovx_modules_verify_graph(&graph); + #if !defined(SOC_AM62A) for (int32_t i = 0; i < input_pad->buf_pool->bufq_depth; i++) { inbuf = tiovx_modules_acquire_buf(input_pad->buf_pool); @@ -429,4 +453,48 @@ vx_status app_modules_capture_dl_display_test(int argc, char* argv[]) tiovx_modules_clean_graph(&graph); return status; + #endif + + #if defined(SOC_AM62A) && defined(TARGET_OS_QNX) + for (int32_t i = 0; i < input_pad->buf_pool->bufq_depth; i++) + { + inbuf = tiovx_modules_acquire_buf(input_pad->buf_pool); + tiovx_modules_enqueue_buf(inbuf); + } + + for (int32_t i=0; i< output_pad[0]->buf_pool->bufq_depth;i++) + { + outbuf = tiovx_modules_acquire_buf(output_pad[0]->buf_pool); + tiovx_modules_enqueue_buf(outbuf); + } + + int frame_count = 0; + while (frame_count++ < NUM_ITERATIONS) + { + inbuf = tiovx_modules_dequeue_buf(input_pad->buf_pool); + tiovx_modules_enqueue_buf(inbuf); + outbuf = tiovx_modules_dequeue_buf(output_pad[0]->buf_pool); + /* function to render screen support using QNX on AM62A SOC */ + qnx_display_render_buf(outbuf); + tiovx_modules_enqueue_buf(outbuf); + } + + for (int32_t i = 0; i < 2; i++) + { + inbuf = tiovx_modules_dequeue_buf(input_pad->buf_pool); + tiovx_modules_release_buf(inbuf); + } + + for(int32_t i =0; i< output_pad[0]->buf_pool->bufq_depth; i++) + { + outbuf = tiovx_modules_dequeue_buf(output_pad[0]-> buf_pool); + tiovx_modules_release_buf(outbuf); + } + + tiovx_modules_clean_graph(&graph); + + return status; + #endif } + + diff --git a/tests/app_tiovx_capture_viss_ldc_msc_display_test.c b/tests/app_tiovx_capture_viss_ldc_msc_display_test.c index a05fa02..7ef763a 100644 --- a/tests/app_tiovx_capture_viss_ldc_msc_display_test.c +++ b/tests/app_tiovx_capture_viss_ldc_msc_display_test.c @@ -63,9 +63,14 @@ #include #include +#if defined(SOC_AM62A) && defined(TARGET_OS_QNX) +#include "qnx_display_module.h" +#endif + #define APP_BUFQ_DEPTH (1) #define APP_NUM_CH (1) + #define NUM_ITERATIONS (400) #define VISS_INPUT_WIDTH 1936 @@ -83,8 +88,15 @@ #define MSC_INPUT_WIDTH LDC_OUTPUT_WIDTH #define MSC_INPUT_HEIGHT LDC_OUTPUT_HEIGHT +#if !(defined(SOC_AM62A) && defined(TARGET_OS_QNX)) #define MSC_OUTPUT_WIDTH MSC_INPUT_WIDTH/2 #define MSC_OUTPUT_HEIGHT MSC_INPUT_HEIGHT/2 +#endif + +#if defined(SOC_AM62A) && defined(TARGET_OS_QNX) +#define MSC_OUTPUT_WIDTH MSC_INPUT_WIDTH +#define MSC_OUTPUT_HEIGHT MSC_INPUT_HEIGHT +#endif #define LDC_TABLE_WIDTH (1920) #define LDC_TABLE_HEIGHT (1080) @@ -95,62 +107,79 @@ #define SENSOR_NAME "SENSOR_SONY_IMX390_UB953_D3" #define DCC_VISS TIOVX_MODULES_IMAGING_PATH"/imx390/linear/dcc_viss.bin" -#define DCC_LDC TIOVX_MODULES_IMAGING_PATH"/imx390/linear/dcc_ldc.bin" +#define DCC_LDC TIOVX_MODULES_IMAGING_PATH"/imx390/linear/dcc_ldc.bin" vx_status app_modules_capture_viss_ldc_msc_display_test(vx_int32 argc, vx_char* argv[]) { vx_status status = VX_FAILURE; GraphObj graph; - NodeObj *capture_node = NULL, *tee_node = NULL, *viss_node = NULL, *ldc_node = NULL, *msc_node = NULL, *display_node = NULL; + NodeObj *capture_node = NULL, *tee_node = NULL, *viss_node = NULL, *ldc_node = NULL, *msc_node = NULL, *display_node = NULL, *aewb_node = NULL; TIOVXCaptureNodeCfg capture_cfg; TIOVXTeeNodeCfg tee_cfg; TIOVXVissNodeCfg viss_cfg; TIOVXLdcNodeCfg ldc_cfg; TIOVXMultiScalerNodeCfg msc_cfg; + #if !defined(SOC_AM62A) TIOVXDisplayNodeCfg display_cfg; + #endif BufPool *in_buf_pool = NULL; - Buf *inbuf = NULL; + BufPool *out_buf_pool = NULL; + Buf *inbuf = NULL; + Buf *outbuf = NULL; int32_t frame_count = 0; + Pad *output_pad[4] = {NULL, NULL, NULL, NULL}; status = tiovx_modules_initialize_graph(&graph); graph.schedule_mode = VX_GRAPH_SCHEDULE_MODE_QUEUE_AUTO; - /* Capture */ tiovx_capture_init_cfg(&capture_cfg); - sprintf(capture_cfg.sensor_name, SENSOR_NAME); capture_cfg.ch_mask = 1; capture_cfg.enable_error_detection = 0; - + #if defined(SOC_AM62A) && defined(TARGET_OS_QNX) + sprintf(capture_cfg.target_string, TIVX_TARGET_CAPTURE2); + #endif capture_node = tiovx_modules_add_node(&graph, TIOVX_CAPTURE, (void *)&capture_cfg); - + /* TEE */ tiovx_tee_init_cfg(&tee_cfg); - tee_cfg.peer_pad = &capture_node->srcs[0]; tee_cfg.num_outputs = 2; - tee_node = tiovx_modules_add_node(&graph, TIOVX_TEE, (void *)&tee_cfg); - tee_node->srcs[0].bufq_depth = 4; /* This must be greater than 3 */ - + /* VISS */ 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.enable_h3a_pad = vx_true_e; 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); + output_pad[0] = &viss_node->srcs[0]; + output_pad[1] = &viss_node->srcs[1]; + + /* AEWB */ + + TIOVXAewbNodeCfg aewb_cfg; + tiovx_aewb_init_cfg(&aewb_cfg); + + sprintf(aewb_cfg.sensor_name, SENSOR_NAME); + aewb_cfg.ch_mask = 1; + aewb_cfg.awb_mode = ALGORITHMS_ISS_AWB_AUTO; + aewb_cfg.awb_num_skip_frames = 9; + aewb_cfg.ae_num_skip_frames = 9; + + aewb_node = tiovx_modules_add_node(&graph, TIOVX_AEWB, (void *)&aewb_cfg); + /* LDC */ + 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.ldc_mode = TIOVX_MODULE_LDC_OP_MODE_DCC_DATA; @@ -174,7 +203,7 @@ vx_status app_modules_capture_viss_ldc_msc_display_test(vx_int32 argc, vx_char* sprintf(ldc_cfg.target_string, TIVX_TARGET_VPAC_LDC1); - ldc_node = tiovx_modules_add_node(&graph, TIOVX_LDC, (void *)&ldc_cfg); + ldc_node = tiovx_modules_add_node(&graph, TIOVX_LDC, (void *)&ldc_cfg); /* MSC */ tiovx_multi_scaler_init_cfg(&msc_cfg); @@ -192,8 +221,9 @@ vx_status app_modules_capture_viss_ldc_msc_display_test(vx_int32 argc, vx_char* tiovx_multi_scaler_module_crop_params_init(&msc_cfg); msc_node = tiovx_modules_add_node(&graph, TIOVX_MULTI_SCALER, (void *)&msc_cfg); - + /* DISPLAY */ + #if !defined(SOC_AM62A) tiovx_display_init_cfg(&display_cfg); display_cfg.width = MSC_OUTPUT_WIDTH; @@ -204,15 +234,20 @@ vx_status app_modules_capture_viss_ldc_msc_display_test(vx_int32 argc, vx_char* display_cfg.params.posY = (1080 - MSC_OUTPUT_HEIGHT)/2; display_node = tiovx_modules_add_node(&graph, TIOVX_DISPLAY, (void *)&display_cfg); - + #endif + /* Link Nodes */ tiovx_modules_link_pads(&tee_node->srcs[1], &viss_node->sinks[0]); + tiovx_modules_link_pads(&viss_node->srcs[1], &aewb_node->sinks[0]); tiovx_modules_link_pads(&viss_node->srcs[0], &ldc_node->sinks[0]); tiovx_modules_link_pads(&ldc_node->srcs[0], &msc_node->sinks[0]); - tiovx_modules_link_pads(&msc_node->srcs[0], &display_node->sinks[0]); - status = tiovx_modules_verify_graph(&graph); + #if !defined(SOC_AM62A) + tiovx_modules_link_pads(&msc_node->srcs[0], &display_node->sinks[0]); + #endif + status = tiovx_modules_verify_graph(&graph); + #if !defined(SOC_AM62A) in_buf_pool = tee_node->srcs[0].buf_pool; for (int32_t i = 0; i < in_buf_pool->bufq_depth; i++) { @@ -235,4 +270,47 @@ vx_status app_modules_capture_viss_ldc_msc_display_test(vx_int32 argc, vx_char* tiovx_modules_clean_graph(&graph); return status; + #endif + + #if defined(SOC_AM62A) && defined(TARGET_OS_QNX) + in_buf_pool = tee_node->srcs[0].buf_pool; + out_buf_pool = msc_node -> srcs[0].buf_pool; + for (int32_t i = 0; i < in_buf_pool->bufq_depth; i++) + { + inbuf = tiovx_modules_acquire_buf(in_buf_pool); + tiovx_modules_enqueue_buf(inbuf); + } + + for (int32_t i=0;i< out_buf_pool->bufq_depth;i++) + { + outbuf = tiovx_modules_acquire_buf(out_buf_pool); + tiovx_modules_enqueue_buf(outbuf); + } + + while (frame_count++ < NUM_ITERATIONS) + { + inbuf = tiovx_modules_dequeue_buf(in_buf_pool); + tiovx_modules_enqueue_buf(inbuf); + outbuf = tiovx_modules_dequeue_buf(out_buf_pool); + /*function to render screen support using QNX on AM62A SOC*/ + qnx_display_render_buf(outbuf); + tiovx_modules_enqueue_buf(outbuf); + } + for (int32_t i = 0; i < 2; i++) + { + inbuf = tiovx_modules_dequeue_buf(in_buf_pool); + tiovx_modules_release_buf(inbuf); + } + + for (int32_t i=0; i< out_buf_pool->bufq_depth;i++) + { + outbuf = tiovx_modules_dequeue_buf(out_buf_pool); + tiovx_modules_release_buf(outbuf); + } + + tiovx_modules_clean_graph(&graph); + + return status; + #endif } + diff --git a/tests/main.c b/tests/main.c index 28d601c..4d36870 100644 --- a/tests/main.c +++ b/tests/main.c @@ -337,7 +337,29 @@ int main(int argc, char *argv[]) } #endif -#if defined(SOC_J721E) || defined(SOC_J721S2) || defined(SOC_J784S4) || defined(SOC_J722S) || defined(SOC_J742S2) +#if defined(SOC_AM62A) && defined(TARGET_OS_QNX) + #if (APP_MODULES_TEST_CAPTURE_VISS_LDC_MSC_DISPLAY) + if(status==0) + { + printf("Running capture->viss->ldc->msc->display test\n"); + int app_modules_capture_viss_ldc_msc_display_test(int argc, char* argv[]); + + status = app_modules_capture_viss_ldc_msc_display_test(argc, argv); + } +#endif + +#if (APP_MODULES_TEST_CAPTURE_DL_DISPLAY) + if(status==0) + { + printf("Running capture->dl->display test\n"); + int app_modules_capture_dl_display_test(int argc, char* argv[]); + + status = app_modules_capture_dl_display_test(argc, argv); + } +#endif +#endif + +#if defined(SOC_J721E) || defined(SOC_J721S2) || defined(SOC_J784S4) || defined(SOC_J722S) || defined(SOC_J742S2) #if (APP_MODULES_TEST_DL_PIPELINE) if(status==0) {