TIOVX User Guide
vx_context.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2016 The Khronos Group Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 
19 #ifndef VX_CONTEXT_H_
20 #define VX_CONTEXT_H_
21 
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
35 #define TIVX_CONTEXT_MAX_CONVOLUTION_DIM (9)
36 
40 #define TIVX_CONTEXT_MAX_OPTICALFLOWPYRLK_DIM (9)
41 
45 #define TIVX_CONTEXT_MAX_NONLINEAR_DIM (9)
46 
50 typedef struct _tivx_graph_sort_context {
51 
53  vx_node sorted_nodes[TIVX_GRAPH_MAX_NODES];
55  vx_node stack[TIVX_GRAPH_MAX_NODES];
57  uint16_t stack_top;
59  uint16_t stack_max_elems;
60 
62 
63 
65 typedef struct {
71 
75 typedef struct _vx_context {
76 
79 
81  vx_reference reftable[TIVX_CONTEXT_MAX_REFERENCES];
101  vx_bool is_dynamic_user_kernel_id_used[TIVX_MAX_KERNEL_ID];
105  vx_bool is_dynamic_user_library_id_used[TIVX_MAX_LIBRARY_ID];
111  vx_char imm_target_string[TIVX_TARGET_MAX_NAME];
112 
114  tivx_user_structs_t user_structs[TIVX_CONTEXT_MAX_USER_STRUCTS];
115 
117  vx_kernel kerneltable[TIVX_CONTEXT_MAX_KERNELS];
118 
120  tivx_obj_desc_cmd_t *obj_desc_cmd[TIVX_MAX_CTRL_CMD_OBJECTS];
121 
123  tivx_event cmd_ack_event[TIVX_MAX_CTRL_CMD_OBJECTS];
124 
129 
131  uintptr_t free_queue_memory[TIVX_MAX_CTRL_CMD_OBJECTS];
132 
137 
139  uintptr_t pend_queue_memory[TIVX_MAX_CTRL_CMD_OBJECTS];
140 
141 
146 
149 
153 
165 
177 
186 
187 
196 
204 
212 
218 vx_status ownIsKernelInContext(vx_context context, vx_enum enumeration, const vx_char string[VX_MAX_KERNEL_NAME], vx_bool *is_found);
219 
220 
235 vx_status ownContextSendCmd(vx_context context, uint32_t target_id, uint32_t cmd, uint32_t num_obj_desc, const uint16_t *obj_desc_id, uint32_t timeout);
236 
253 vx_status ownContextSendControlCmd(vx_context context, uint16_t node_obj_desc,
254  uint32_t target_id, uint32_t replicated_node_idx, uint32_t node_cmd_id,
255  const uint16_t obj_desc_id[], uint32_t num_obj_desc, uint32_t timeout);
256 
265 
274 void ownContextSetKernelRemoveLock(vx_context context, vx_bool do_lock);
275 
282 
291 
300 
312 
313 #ifdef __cplusplus
314 }
315 #endif
316 
317 #endif
vx_bool log_enabled
The log enable toggle.
Definition: vx_context.h:89
vx_bool
struct tivx_vx_event_t * tivx_event
Typedef for a event.
Definition: tivx_event.h:100
struct tivx_vx_mutex_t * tivx_mutex
Typedef for a mutex.
Definition: tivx_mutex.h:82
void ownContextSetKernelRemoveLock(vx_context context, vx_bool do_lock)
Set value of kernel remove lock flag.
The top level context data for the entire OpenVX instance.
Definition: vx_context.h:75
vx_bool ownContextGetKernelRemoveLock(vx_context context)
Get value of kernel remove lock flag.
size_t vx_size
vx_log_callback_f log_callback
Callback to call for logging messages from framework.
Definition: vx_context.h:87
vx_uint32 num_dynamic_user_library_id
Number of dynamic_user_library_id's being used.
Definition: vx_context.h:107
vx_status ownContextSendCmd(vx_context context, uint32_t target_id, uint32_t cmd, uint32_t num_obj_desc, const uint16_t *obj_desc_id, uint32_t timeout)
Send a command to specified target with object descriptor ID's as parameters.
int32_t vx_enum
vx_bool ownAddReferenceToContext(vx_context context, vx_reference ref)
Add reference to a context.
The most basic type in the OpenVX system. Any type that inherits from tivx_reference_t must have a vx...
Definition: vx_reference.h:63
vx_context ownGetContext(void)
Returns the vx_context object currently being used.
Event queue object.
vx_enum imm_border_policy
The unsupported border mode policy for immediate mode functions.
Definition: vx_context.h:99
char vx_char
Typedef for a queue.
Definition: tivx_queue.h:103
vx_border_t imm_border
The immediate mode border.
Definition: vx_context.h:97
vx_status ownContextUnlock(vx_context context)
Lock context.
vx_status ownRemoveKernelFromContext(vx_context context, vx_kernel kernel)
Remove unique kernel from context.
void(* vx_log_callback_f)(vx_context context, vx_reference ref, vx_status status, const vx_char string[])
vx_enum vx_status
tivx_event_queue_t event_queue
Definition: vx_context.h:151
struct _vx_context * vx_context
struct _vx_reference * vx_reference
tivx_queue free_queue
handle to free queue holding tivx_event_queue_elem_t's NOTE: queue holds index's to event_list[] ...
Definition: vx_context.h:128
tivx_graph_sort_context graph_sort_context
Definition: vx_context.h:148
vx_uint32 num_dynamic_user_kernel_id
Number of dynamic_user_kernel_id's being used.
Definition: vx_context.h:103
vx_bool ownIsValidContext(vx_context context)
Check if 'context' is valid.
vx_status ownIsKernelInContext(vx_context context, vx_enum enumeration, const vx_char string[VX_MAX_KERNEL_NAME], vx_bool *is_found)
Check if kernel exists inside the context.
vx_bool remove_kernel_lock
Definition: vx_context.h:145
vx_status ownAddKernelToContext(vx_context context, vx_kernel kernel)
Add's unique kernel to context.
vx_enum type
Type constant.
Definition: vx_context.h:67
Context used while sorting a graph.
Definition: vx_context.h:50
#define TIVX_TARGET_MAX_NAME
Max possible name of a target.
Definition: tivx.h:94
vx_uint32 num_unique_kernels
The combined number of unique kernels in the system.
Definition: vx_context.h:85
Command object descriptor.
tivx_mutex lock
Lock to use for locking context.
Definition: vx_context.h:93
struct _vx_kernel * vx_kernel
vx_bool ownRemoveReferenceFromContext(vx_context context, vx_reference ref)
Remove reference from a context.
tivx_mutex log_lock
Lock to use for locking log print's.
Definition: vx_context.h:91
#define TIVX_MAX_LIBRARY_ID
Max number of kernel library ID's.
Definition: tivx.h:177
vx_enum imm_target_enum
The immediate mode enumeration.
Definition: vx_context.h:109
#define TIVX_MAX_KERNEL_ID
Max number of kernel ID's.
Definition: tivx.h:172
vx_uint32 num_references
The number of references in the table.
Definition: vx_context.h:83
#define VX_MAX_KERNEL_NAME
uint32_t vx_uint32
vx_bool perf_enabled
The performance counter enable toggle.
Definition: vx_context.h:95
tivx_queue pend_queue
handle to ready queue holding tivx_event_queue_elem_t's which are ready to be delivered to users NOTE...
Definition: vx_context.h:136
The list of user defined structs.
Definition: vx_context.h:65
vx_status ownContextSendControlCmd(vx_context context, uint16_t node_obj_desc, uint32_t target_id, uint32_t replicated_node_idx, uint32_t node_cmd_id, const uint16_t obj_desc_id[], uint32_t num_obj_desc, uint32_t timeout)
Send a control command to specified target with object descriptor ID's as parameters.
vx_status ownContextLock(vx_context context)
Lock context.
vx_size size
Size in bytes.
Definition: vx_context.h:69
vx_status ownContextFlushCmdPendQueue(vx_context context)
Flushes the command pend queue, if not empty.
struct _vx_node * vx_node
tivx_reference_t base
The base reference object.
Definition: vx_context.h:78
vx_status ownReleaseReferenceBufferGeneric(vx_reference *ref)
Common callback function.