TIOVX User Guide
tivx.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (c) 2017 - 2019 Texas Instruments Incorporated
4 *
5 * All rights reserved not granted herein.
6 *
7 * Limited License.
8 *
9 * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10 * license under copyrights and patents it now or hereafter owns or controls to make,
11 * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12 * terms herein. With respect to the foregoing patent license, such license is granted
13 * solely to the extent that any such patent is necessary to Utilize the software alone.
14 * The patent license shall not apply to any combinations which include this software,
15 * other than combinations with devices manufactured by or for TI ("TI Devices").
16 * No hardware patent is licensed hereunder.
17 *
18 * Redistributions must preserve existing copyright notices and reproduce this license
19 * (including the above copyright notice and the disclaimer and (if applicable) source
20 * code license limitations below) in the documentation and/or other materials provided
21 * with the distribution
22 *
23 * Redistribution and use in binary form, without modification, are permitted provided
24 * that the following conditions are met:
25 *
26 * * No reverse engineering, decompilation, or disassembly of this software is
27 * permitted with respect to any software provided in binary form.
28 *
29 * * any redistribution and use are licensed by TI for use only with TI Devices.
30 *
31 * * Nothing shall obligate TI to provide you with source code for the software
32 * licensed and provided to you in object code.
33 *
34 * If software source code is provided to you, modification and redistribution of the
35 * source code are permitted provided that the following conditions are met:
36 *
37 * * any redistribution and use of the source code, including any resulting derivative
38 * works, are licensed by TI for use only with TI Devices.
39 *
40 * * any redistribution and use of any object code compiled from the source code
41 * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42 *
43 * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44 *
45 * may be used to endorse or promote products derived from this software without
46 * specific prior written permission.
47 *
48 * DISCLAIMER.
49 *
50 * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53 * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59 * OF THE POSSIBILITY OF SUCH DAMAGE.
60 *
61 */
62 
63 #ifndef VX_EXT_TI_H_
64 #define VX_EXT_TI_H_
65 
66 #include <VX/vx.h>
67 #include <VX/vx_khr_pipelining.h>
69 #include <TI/tivx_debug.h>
70 #include <TI/tivx_log_rt.h>
71 #include <TI/tivx_kernels.h>
72 #include <TI/tivx_nodes.h>
73 #include <TI/tivx_mem.h>
74 #include <TI/tivx_tensor.h>
75 #include <TI/tivx_ext_raw_image.h>
76 #include <TI/tivx_ext_super_node.h>
77 #include <TI/tivx_soc.h>
78 
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82 
93 #define TIVX_TARGET_MAX_NAME (64u)
94 
103 #define TIVX_TARGET_HOST "HOST"
104 
110 #define TIVX_RESOURCE_NAME_MAX (39u)
111 
117 #define TIVX_CONFIG_PATH_LENGTH (512u)
118 
128 #define TIVX_GRAPH_PARAMETER_ENQUEUE_FLAG_PIPEUP (0x00000001u)
129 
138 #define TIVX_CONTROL_CMD_SEND_TO_ALL_REPLICATED_NODES ((uint32_t)-1)
139 
140 /*
141  * Super node configuration resources
142  */
146 #define TIVX_GRAPH_MAX_SUPER_NODES (8u)
147 
151 #define TIVX_MAX_DSP_BAM_USER_PLUGINS (8u)
152 
156 #define TIVX_SUPER_NODE_MAX_NODES (16u)
157 
161 #define TIVX_SUPER_NODE_MAX_EDGES (16u)
162 
166 #define TIVX_SUPER_NODE_MAX_OBJECTS (16u)
167 
168 /*
169  * The following parameters are publicly included to retain functionality
170  * within the boundary test cases.
171  */
177 #define TIVX_PYRAMID_MAX_LEVELS_ORB (17u)
178 
182 #define TIVX_MAX_KERNEL_ID (VX_KERNEL_MASK)
183 
187 #define TIVX_MAX_LIBRARY_ID (VX_LIBRARY(VX_LIBRARY_MASK))
188 
189 
196 typedef struct _tivx_resource_stats_t {
197 
198  uint32_t max_value;
200  uint32_t cur_used_value;
202  uint32_t max_used_value;
209 
216 typedef enum _tivx_attribute_extensions_e {
217 
220 
223 
226 
229 
232 
240 
250 
262 
269 
276 
282 
288 
295 
297 
298 
303 typedef enum _tivx_df_image_e {
304 
308  TIVX_DF_IMAGE_P12 = VX_DF_IMAGE('P','0','1','2'),
309 
314 
318  TIVX_DF_IMAGE_RGB565 = VX_DF_IMAGE('R','5','6','5'),
319 
324  TIVX_DF_IMAGE_BGRX = VX_DF_IMAGE('B','G','R','A'),
326 
330 typedef enum _tivx_status_e {
335 
336  /* add new codes here */
341 
342 } tivx_status_e;
343 
355 void tivxInit(void);
356 
368 void tivxDeInit(void);
369 
381 void tivxHostInit(void);
382 
394 void tivxHostDeInit(void);
395 
414 VX_API_ENTRY vx_status VX_API_CALL tivxAddKernelTarget(vx_kernel kernel, const char *target_name);
415 
428 VX_API_ENTRY vx_status VX_API_CALL tivxSetKernelSinkDepth(vx_kernel kernel, uint32_t num_sink_bufs);
429 
448 VX_API_ENTRY vx_status VX_API_CALL tivxRegisterModule(const char *name, vx_publish_kernels_f publish, vx_unpublish_kernels_f unpublish);
449 
461 VX_API_ENTRY vx_status VX_API_CALL tivxUnRegisterModule(const char *name);
462 
471 
484 vx_status tivxQueryResourceStats(const char *resource_name, tivx_resource_stats_t *stat);
485 
491 void tivxPrintAllResourceStats(void);
492 
508 
509 
513 #ifndef dimof
514 #define dimof(x) (sizeof(x)/sizeof(x[0]))
515 #endif
516 
531  vx_enum kernelenum,
532  vx_reference params[],
533  vx_uint32 num);
534 
549  vx_kernel kernel,
550  vx_reference params[],
551  vx_uint32 num);
552 
567  const char *kernel_name,
568  vx_reference params[],
569  vx_uint32 num);
570 
583 
593 
605 vx_bool tivxIsTargetEnabled(const char target_name[]);
606 
614 uint64_t tivxPlatformGetTimeInUsecs(void);
615 
630 vx_status VX_API_CALL tivxExportGraphToDot(vx_graph graph, const char *output_file_path, const char *output_file_prefix);
631 
650 
673 
683 
718  vx_uint32 graph_parameter_index,
719  vx_reference *refs,
720  vx_uint32 num_refs,
721  vx_uint32 flags);
722 
761  uint32_t replicate_nodex_idx, uint32_t node_cmd_id,
762  vx_reference ref[], uint32_t num_refs);
763 
805  uint32_t replicate_nodex_idx, uint32_t node_cmd_id,
806  vx_reference ref[], uint32_t num_refs, uint32_t timeout);
807 
823 vx_node tivxGraphGetNode(vx_graph graph, uint32_t index);
824 
841 VX_API_ENTRY vx_status VX_API_CALL tivxSetUserDataObjectAttribute(vx_user_data_object user_data_object, vx_enum attribute, const void *ptr, vx_size size);
842 
852 VX_API_ENTRY vx_status VX_API_CALL tivxSetNodeTileSize(vx_node node, vx_uint32 block_width, vx_uint32 block_height);
853 
864 VX_API_ENTRY vx_status VX_API_CALL tivxSetReferenceAttribute(vx_reference ref, vx_enum attribute, const void *ptr, vx_size size);
865 
878 
932 VX_API_ENTRY vx_status VX_API_CALL tivxReferenceImportHandle(vx_reference ref, const void *addr[], const uint32_t size[], uint32_t num_entries);
933 
982 VX_API_ENTRY vx_status VX_API_CALL tivxReferenceExportHandle(const vx_reference ref, void *addr[], uint32_t size[], uint32_t max_entries, uint32_t *num_entries);
983 
984 
996 
997 
998 #ifdef __cplusplus
999 }
1000 #endif
1001 
1002 #endif
1003 
vx_bool
void tivxHostInit(void)
Function to initialize OpenVX HOST side functionality.
uint32_t min_required_value
Definition: tivx.h:204
VX_API_ENTRY vx_bool VX_API_CALL tivxIsReferenceMetaFormatEqual(vx_reference ref1, vx_reference ref2)
Check for equivalence between the meta formats of two reference objects.
vx_status VX_API_CALL tivxGetNodeParameterNumBufByIndex(vx_node node, vx_uint32 index, vx_uint32 *num_buf)
Get number of buffers to allocate at output of a node parameter.
Interface to Memory allocation and deallocation APIs.
#define TIVX_RESOURCE_NAME_MAX
Max size of macro.
Definition: tivx.h:110
tivx_attribute_extensions_e
TI attribute extensions.
Definition: tivx.h:216
uint64_t tivxPlatformGetTimeInUsecs(void)
Get the time in micro seconds.
VX_API_ENTRY vx_status VX_API_CALL tivxSetReferenceAttribute(vx_reference ref, vx_enum attribute, const void *ptr, vx_size size)
Sets reference attributes for the below enums: TIVX_REFERENCE_TIMESTAMP.
size_t vx_size
vx_status tivxExportAllResourceMaxUsedValueToFile(void)
Exports the max used values to a file.
void tivxInit(void)
Function to initialize OpenVX framework.
int32_t vx_enum
VX_API_ENTRY vx_status VX_API_CALL tivxSetKernelSinkDepth(vx_kernel kernel, uint32_t num_sink_bufs)
Set the number of sink buffers.
uint32_t max_used_value
Definition: tivx.h:202
vx_status VX_API_CALL tivxSetNodeParameterNumBufByIndex(vx_node node, vx_uint32 index, vx_uint32 num_buf)
Set number of buffers to allocate at output of a node parameter.
Interface to Tensor APIs (modeled after OpenVX 1.2 tensor support)
int32_t vx_int32
Set/Query the node level timeout parameter. Read-Write. Can be written at initialization as well as a...
Definition: tivx.h:249
vx_bool tivxIsTargetEnabled(const char target_name[])
Utility function to know if target is enabled or not.
uint32_t cur_used_value
Definition: tivx.h:200
The TI Raw Image extension.
VX_ID_TI
vx_enum vx_status
tivx_df_image_e
Based on the VX_DF_IMAGE definition.
Definition: tivx.h:303
struct _vx_context * vx_context
Query the strides from a vx_tensor object. Read-Only. Can be read at initialization as well as at run...
Definition: tivx.h:287
Indicates the base for the TIVX error codes. Used for bounds checks only.
Definition: tivx.h:334
Query the imagepatch addressing structure from a vx_image. Read-Only. Can be read at initialization a...
Definition: tivx.h:281
struct _vx_reference * vx_reference
The OpenVX Pipelining, Streaming and Batch Processing extension API.
Query the graph pipeline depth. Read-Only. Can be read at initialization as well as at runtime...
Definition: tivx.h:268
Indicates that the wait operation on an event timed-out.
Definition: tivx.h:340
The Internal Debugging API.
A single plane of packed 12-bit data.
Definition: tivx.h:308
vx_status(* vx_publish_kernels_f)(vx_context context)
Query the context number of user library ID&#39;s. Read-Only. Can be read at initialization as well as at...
Definition: tivx.h:294
void tivxDeInit(void)
Function to de-initialize OpenVX framework.
VX_API_ENTRY vx_status VX_API_CALL tivxReferenceExportHandle(const vx_reference ref, void *addr[], uint32_t size[], uint32_t max_entries, uint32_t *num_entries)
Exports the handles from a reference object.
Struct containing config parameters of given static resource. Allows for a log to be kept of the reso...
Definition: tivx.h:196
vx_status VX_API_CALL tivxSetGraphPipelineDepth(vx_graph graph, vx_uint32 pipeline_depth)
Indicates to the implementation the depth of the graph pipeline.
vx_status VX_API_CALL tivxGraphParameterEnqueueReadyRef(vx_graph graph, vx_uint32 graph_parameter_index, vx_reference *refs, vx_uint32 num_refs, vx_uint32 flags)
Same as vxGraphParameterEnqueueReadyRef except that it take an additional TIOVX specific flag paramet...
vx_reference tivxGetReferenceParent(vx_reference child_ref)
Utility function to extract the parent reference from an element.
vx_node tivxCreateNodeByKernelRef(vx_graph graph, vx_kernel kernel, vx_reference params[], vx_uint32 num)
Utility function to create a node given parameter references and kernel reference.
vx_node tivxCreateNodeByKernelEnum(vx_graph graph, vx_enum kernelenum, vx_reference params[], vx_uint32 num)
Utility function to create a node given parameter references and kernel enum.
The TI Super Node extension.
Set/Query the kernel level timeout parameter. Read-Write. Can be written at initialization as well as...
Definition: tivx.h:239
#define VX_ATTRIBUTE_BASE(vendor, object)
Returns a boolean indicating whether or not a reference is invalid.
Definition: tivx.h:228
vx_status VX_API_CALL tivxNodeSendCommand(vx_node node, uint32_t replicate_nodex_idx, uint32_t node_cmd_id, vx_reference ref[], uint32_t num_refs)
Send node specific Control command.
struct _vx_user_data_object * vx_user_data_object
The User Data Object. User Data Object is a strongly-typed container for other data structures...
VX_API_ENTRY vx_status VX_API_CALL tivxSetUserDataObjectAttribute(vx_user_data_object user_data_object, vx_enum attribute, const void *ptr, vx_size size)
Sets attributes on the user data object.
The list of supported kernels in the TIOVX.
struct _vx_kernel * vx_kernel
VX_API_ENTRY vx_status VX_API_CALL tivxSetNodeTileSize(vx_node node, vx_uint32 block_width, vx_uint32 block_height)
Sets the tile size for a given node in a graph. This is only valid for BAM-enabled kernels on C66 DSP...
uint32_t max_value
Definition: tivx.h:198
tivx_status_e
The enumeration of all TIVX operational error codes.
Definition: tivx.h:330
Sets the valid data size within the user data object.
Definition: tivx.h:222
a NV12 frame of packed 12-bit data.
Definition: tivx.h:313
#define VX_DF_IMAGE(a, b, c, d)
vx_status tivxQueryResourceStats(const char *resource_name, tivx_resource_stats_t *stat)
Query resource for resource stats.
Set/Query the graph level timeout parameter. Read-Write. Can be written at initialization as well as ...
Definition: tivx.h:261
A single plane of 32-bit pixel as 4 interleaved 8-bit units of B then G then R data, then a don&#39;t care byte. This uses the BT709 full range by default.
Definition: tivx.h:324
Returns the target string corresponding to the node.
Definition: tivx.h:219
vx_status VX_API_CALL tivxNodeSendCommandTimed(vx_node node, uint32_t replicate_nodex_idx, uint32_t node_cmd_id, vx_reference ref[], uint32_t num_refs, uint32_t timeout)
Send node specific Control command.
vx_node tivxGraphGetNode(vx_graph graph, uint32_t index)
This API is used to get a reference to a node within a graph at a given index within the graph...
VX_API_ENTRY vx_status VX_API_CALL tivxAddKernelTarget(vx_kernel kernel, const char *target_name)
Associate a target with a kernel.
Returns the timestamp in micro-seconds corresponding to the given reference.
Definition: tivx.h:225
void tivxHostDeInit(void)
Function to de-initialize OpenVX HOST side functionality.
vx_enum tivxGetSelfCpuId(void)
Return CPU ID of the CPU on which this API is called.
VX_API_ENTRY vx_reference VX_API_CALL tivxCreateReferenceFromExemplar(vx_context context, vx_reference exemplar)
Create reference from a exemplar object.
uint32_t vx_uint32
Interface to TI run-time logging APIs.
Returns the graph stream executions. Read-only. Use a vx_uint32 parameter.
Definition: tivx.h:231
struct _vx_graph * vx_graph
VX_API_ENTRY vx_status VX_API_CALL tivxRegisterModule(const char *name, vx_publish_kernels_f publish, vx_unpublish_kernels_f unpublish)
Register publish and unpublish functions against a module name.
A single plane of packed 16-bit RGB565 data.
Definition: tivx.h:318
VX_API_ENTRY vx_status VX_API_CALL tivxReferenceImportHandle(vx_reference ref, const void *addr[], const uint32_t size[], uint32_t num_entries)
Updates a reference object with the supplied handles (pointers to memory).
Query the context number of user kernel ID&#39;s. Read-Only. Can be read at initialization as well as at ...
Definition: tivx.h:275
vx_status VX_API_CALL tivxExportGraphToDot(vx_graph graph, const char *output_file_path, const char *output_file_prefix)
Export graph representation as DOT graph file.
vx_bool tivxIsReferenceVirtual(vx_reference ref)
Utility function to check if the given reference is virtual or not.
VX_API_ENTRY vx_status VX_API_CALL tivxUnRegisterModule(const char *name)
UnRegister publish and unpublish functions if previously registered.
struct _vx_node * vx_node
vx_node tivxCreateNodeByKernelName(vx_graph graph, const char *kernel_name, vx_reference params[], vx_uint32 num)
Utility function to create a node given parameter references and kernel name.
vx_status(* VX_API_CALL)(vx_reference *ref)
Callback type used to register release callbacks from object dervied from references.
Definition: vx_reference.h:56
void tivxPrintAllResourceStats(void)
Prints out resource stats.
The OpenVX User Data Object extension API.