diff --git a/apps/src/input_block.c b/apps/src/input_block.c index f51d09b..7a644b9 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; +#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..4c9b58f 100644 --- a/cmake/common.cmake +++ b/cmake/common.cmake @@ -33,6 +33,7 @@ endif() set(TARGET_SOC_LOWER $ENV{SOC}) set(TARGET_OS $ENV{TARGET_OS}) +set(QNX_SDP $ENV{QNX_SDP}) if ("${TARGET_OS}" STREQUAL "") set(TARGET_OS LINUX) @@ -82,6 +83,7 @@ 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 @@ -93,6 +95,7 @@ link_directories(${TARGET_FS}/usr/lib/aarch64-linux if ("${TARGET_OS}" STREQUAL "QNX") link_directories(${PSDK_QNX_PATH}/qnx/codec/vpu/OpenMAXIL/core/nto/aarch64/so.le/ ${PSDK_QNX_PATH}/qnx/codec/vpu/OpenMAXIL/utility/nto/aarch64/so.le + ${QNX_LIB_PATH} ) endif() @@ -186,7 +189,6 @@ if ("${TARGET_OS}" STREQUAL "QNX") ti-pdk ti-sciclient c++ - c++fs omxcore_j7 omxil_j7_utility) add_definitions( @@ -194,6 +196,19 @@ if ("${TARGET_OS}" STREQUAL "QNX") ) endif() +if ("${TARGET_SOC}" STREQUAL "AM62A" AND "${TARGET_OS}" STREQUAL "QNX") + list(APPEND + SYSTEM_LINK_LIBS + ti-csirxlld + ti-fvid2lld) +endif() + +if ("${QNX_SDP}" STREQUAL "710") + list(APPEND + SYSTEM_LINK_LIBS + c++fs) +endif() + set(COMMON_LINK_LIBS edgeai-tiovx-apps ) diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 406346d..54e825f 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -50,6 +50,14 @@ if ("${TARGET_CPU}" STREQUAL "A72" OR "${TARGET_CPU}" STREQUAL "A53") endif() endif() +if ("${TARGET_SOC}" STREQUAL "AM62A" AND "${TARGET_OS}" STREQUAL "QNX") + list(APPEND + SRC_FILES + src/tiovx_capture_module.c + src/qnx_display_module.c + src/tiovx_aewb_module.c) +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 diff --git a/modules/core/include/tiovx_modules_cbs.h b/modules/core/include/tiovx_modules_cbs.h index a62fd7a..7d5d3e0 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; diff --git a/modules/core/src/tiovx_modules_cbs.c b/modules/core/src/tiovx_modules_cbs.c index ff3d628..5cf3c4f 100644 --- a/modules/core/src/tiovx_modules_cbs.c +++ b/modules/core/src/tiovx_modules_cbs.c @@ -206,8 +206,9 @@ 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, @@ -216,6 +217,7 @@ NodeCbs gNodeCbs[TIOVX_MODULES_NUM_MODULES] = .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, @@ -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, @@ -264,6 +267,7 @@ NodeCbs gNodeCbs[TIOVX_MODULES_NUM_MODULES] = .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..37dc247 --- /dev/null +++ b/modules/include/qnx_display_module.h @@ -0,0 +1,79 @@ +/* + * + * 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 \ No newline at end of file diff --git a/modules/src/qnx_display_module.c b/modules/src/qnx_display_module.c new file mode 100644 index 0000000..cbf4576 --- /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 init=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(init==0) + { + qnx_display_init(); + init++; + } + 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 #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,9 +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 +#else +#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) #define LDC_DS_FACTOR (2) @@ -109,12 +119,24 @@ #define DCC_VISS TIOVX_MODULES_IMAGING_PATH"/imx390/linear/dcc_viss.bin" #define DCC_LDC TIOVX_MODULES_IMAGING_PATH"/imx390/linear/dcc_ldc.bin" +#if !(defined(SOC_AM62A) && defined(TARGET_OS_QNX)) #define POST_PROC_OUT_WIDTH (1280) #define POST_PROC_OUT_HEIGHT (720) +#else +#define POST_PROC_OUT_WIDTH (1920) +#define POST_PROC_OUT_HEIGHT (1080) +#endif + +#if !(defined(SOC_AM62A) && defined(TARGET_OS_QNX)) #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" +#else +#define TIDL_IO_CONFIG_FILE_PATH "/ti_fs/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/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] = { "Not Available" @@ -128,6 +150,9 @@ 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; + #if defined(SOC_AM62A) && defined(TARGET_OS_QNX) + Buf *outbuf = NULL; + #endif status = tiovx_modules_initialize_graph(&graph); graph.schedule_mode = VX_GRAPH_SCHEDULE_MODE_QUEUE_AUTO; @@ -140,6 +165,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]; @@ -386,6 +414,7 @@ vx_status app_modules_capture_dl_display_test(int argc, char* argv[]) } /* Display */ + #if !(defined(SOC_AM62A) && defined(TARGET_OS_QNX)) { TIOVXDisplayNodeCfg display_cfg; NodeObj *display_node; @@ -404,20 +433,57 @@ vx_status app_modules_capture_dl_display_test(int argc, char* argv[]) /* 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) && 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); + } + + int frame_count = 0; + while (frame_count++ < NUM_ITERATIONS) + { + inbuf = tiovx_modules_dequeue_buf(input_pad->buf_pool); + tiovx_modules_enqueue_buf(inbuf); + } + + for (int32_t i = 0; i < 2; i++) + { + inbuf = tiovx_modules_dequeue_buf(input_pad->buf_pool); + tiovx_modules_release_buf(inbuf); + } + + 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++) @@ -425,8 +491,15 @@ vx_status app_modules_capture_dl_display_test(int argc, char* argv[]) 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..eb7bbc8 100644 --- a/tests/app_tiovx_capture_viss_ldc_msc_display_test.c +++ b/tests/app_tiovx_capture_viss_ldc_msc_display_test.c @@ -63,6 +63,10 @@ #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) @@ -83,9 +87,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 +#else +#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) #define LDC_DS_FACTOR (2) @@ -101,16 +111,23 @@ vx_status app_modules_capture_viss_ldc_msc_display_test(vx_int32 argc, vx_char* { 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; + #if defined(SOC_AM62A) && defined(TARGET_OS_QNX) + BufPool *out_buf_pool = NULL; + Buf *outbuf = NULL; + #endif 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; @@ -121,6 +138,9 @@ vx_status app_modules_capture_viss_ldc_msc_display_test(vx_int32 argc, vx_char* 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); @@ -143,11 +163,29 @@ vx_status app_modules_capture_viss_ldc_msc_display_test(vx_int32 argc, vx_char* 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); @@ -194,6 +232,7 @@ vx_status app_modules_capture_viss_ldc_msc_display_test(vx_int32 argc, vx_char* msc_node = tiovx_modules_add_node(&graph, TIOVX_MULTI_SCALER, (void *)&msc_cfg); /* DISPLAY */ + #if !(defined(SOC_AM62A) && defined(TARGET_OS_QNX)) tiovx_display_init_cfg(&display_cfg); display_cfg.width = MSC_OUTPUT_WIDTH; @@ -204,15 +243,19 @@ 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) && defined(TARGET_OS_QNX)) + tiovx_modules_link_pads(&msc_node->srcs[0], &display_node->sinks[0]); + #endif + status = tiovx_modules_verify_graph(&graph); + #if !(defined(SOC_AM62A) && defined(TARGET_OS_QNX)) in_buf_pool = tee_node->srcs[0].buf_pool; for (int32_t i = 0; i < in_buf_pool->bufq_depth; i++) { @@ -235,4 +278,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/app_tiovx_qnx_decode_display_test.c b/tests/app_tiovx_qnx_decode_display_test.c index 5b1ae41..83a364c 100644 --- a/tests/app_tiovx_qnx_decode_display_test.c +++ b/tests/app_tiovx_qnx_decode_display_test.c @@ -76,7 +76,9 @@ vx_status app_modules_qnx_decode_display_test(vx_int32 argc, vx_char* argv[]) vx_status status = VX_FAILURE; GraphObj graph; NodeObj *node = NULL; + #if !(defined(SOC_AM62A) && defined(TARGET_OS_QNX)) TIOVXDisplayNodeCfg display_cfg; + #endif BufPool *in_buf_pool = NULL; Buf *inbuf = NULL; omxDecodeCfg omx_decode_cfg; @@ -87,7 +89,7 @@ vx_status app_modules_qnx_decode_display_test(vx_int32 argc, vx_char* argv[]) omx_decode_cfg.bufq_depth = APP_BUFQ_DEPTH; sprintf(omx_decode_cfg.file, "%s/videos/video0_1280_768.h264", EDGEAI_DATA_PATH); omx_decode_handle = omx_decode_create_handle(&omx_decode_cfg, &omx_decode_fmt); - + #if !(defined(SOC_AM62A) && defined(TARGET_OS_QNX)) tiovx_display_init_cfg(&display_cfg); display_cfg.width = 1280; @@ -96,10 +98,13 @@ vx_status app_modules_qnx_decode_display_test(vx_int32 argc, vx_char* argv[]) display_cfg.params.outHeight = 768; display_cfg.params.posX = (1920 - 1280)/2; display_cfg.params.posY = (1080 - 768)/2; + #endif status = tiovx_modules_initialize_graph(&graph); graph.schedule_mode = VX_GRAPH_SCHEDULE_MODE_QUEUE_AUTO; + #if !(defined(SOC_AM62A) && defined(TARGET_OS_QNX)) node = tiovx_modules_add_node(&graph, TIOVX_DISPLAY, (void *)&display_cfg); + #endif node->sinks[0].bufq_depth = APP_BUFQ_DEPTH; status = tiovx_modules_verify_graph(&graph); diff --git a/tests/main.c b/tests/main.c index 28d601c..fcb9040 100644 --- a/tests/main.c +++ b/tests/main.c @@ -337,6 +337,28 @@ int main(int argc, char *argv[]) } #endif +#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)