TIOVX User Guide
vx_graph.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_GRAPH_H_
20 #define VX_GRAPH_H_
21 
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
38 #define TIVX_DEFAULT_GRAPH_TIMEOUT (TIVX_EVENT_TIMEOUT_WAIT_FOREVER)
39 
49 #define TIVX_GRAPH_PARAMETER_ENQUEUE_FLAG_PIPEUP (0x00000001u)
50 
52 typedef struct {
56  uint32_t index;
60  uint32_t num_buf;
72 
74 typedef struct {
78  uint32_t index;
80  uint32_t num_buf;
86 
88 typedef struct {
92  uint32_t index;
98  uint32_t delay_slot_index;
100 
104 typedef struct _vx_graph {
105 
108 
111 
114 
116  vx_node nodes[TIVX_GRAPH_MAX_NODES];
117 
118  /* \brief Number of nodes in a graph */
119  uint32_t num_nodes;
120 
122  vx_node head_nodes[TIVX_GRAPH_MAX_HEAD_NODES];
123 
124  /* \brief Number of head nodes in a graph */
125  uint32_t num_head_nodes;
126 
128  vx_node leaf_nodes[TIVX_GRAPH_MAX_LEAF_NODES];
129 
130  /* \brief Number of leaf nodes in a graph */
131  uint32_t num_leaf_nodes;
132 
134  tivx_parameters_t parameters[TIVX_GRAPH_MAX_PARAMS];
135 
137  uint32_t num_params;
138 
140  tivx_data_ref_q_list_t data_ref_q_list[TIVX_GRAPH_MAX_DATA_REF_QUEUE];
141 
143  uint32_t num_data_ref_q;
144 
146  tivx_delay_data_ref_q_list_t delay_data_ref_q_list[TIVX_GRAPH_MAX_DATA_REF_QUEUE];
149 
152 
155 
157  vx_delay delays[TIVX_GRAPH_MAX_DELAYS];
158 
160  vx_rectangle_t in_valid_rect[TIVX_KERNEL_MAX_PARAMS];
161 
163  vx_rectangle_t *in_valid_rect_ptr[TIVX_KERNEL_MAX_PARAMS];
164 
165 
167  vx_rectangle_t out_valid_rect[TIVX_PYRAMID_MAX_LEVEL_OBJECTS];
168 
170  vx_rectangle_t *out_valid_rect_ptr[TIVX_PYRAMID_MAX_LEVEL_OBJECTS];
171 
173  uint32_t pipeline_depth;
174 
177 
180 
183 
186 
189 
192 
195 
198 
200  tivx_obj_desc_graph_t *obj_desc[TIVX_GRAPH_MAX_PIPELINE_DEPTH];
201 
204 
206  uintptr_t free_q_mem[TIVX_GRAPH_MAX_PIPELINE_DEPTH];
207 
210 
213 
216 
219 
222 
227 
229  uint32_t submitted_count;
230 
232  uint32_t num_data_ref;
233 
235  vx_reference data_ref[TIVX_GRAPH_MAX_DATA_REF];
236 
238  uint8_t data_ref_num_in_nodes[TIVX_GRAPH_MAX_DATA_REF];
239 
241  uint8_t data_ref_num_out_nodes[TIVX_GRAPH_MAX_DATA_REF];
242 
245 
248 
251 
254 
256  uint32_t num_supernodes;
257 
260 
261 } tivx_graph_t;
262 
263 
264 
274 int32_t ownGraphGetFreeNodeIndex(vx_graph graph);
275 
289 vx_status ownGraphAddNode(vx_graph graph, vx_node node, int32_t idx);
290 
291 #if defined(BUILD_BAM)
292 
302 vx_status ownGraphAddSuperNode(vx_graph graph, tivx_super_node super_node);
303 
304 #endif
305 
316 
317 
328 void ownGraphTopologicalSort(tivx_graph_sort_context *context, vx_node *nodes, uint32_t num_nodes, vx_bool *has_cycle);
329 
340 
341 
352 
353 #if defined(BUILD_BAM)
354 
365 void ownGraphCheckContinuityOfSupernode(tivx_graph_sort_context *context, tivx_super_node super_node, uint32_t num_nodes, vx_bool *is_continuous);
366 
378 void ownGraphCheckSupernodeCycles(tivx_graph_sort_context *context, const vx_node *nodes, uint32_t num_nodes, vx_bool *has_cycle);
379 
387 vx_status ownGraphSuperNodeConfigure(vx_graph graph);
388 
389 #endif
390 
394 void ownGraphSetReverify(vx_graph graph);
395 
396 
404 
405 
411 
417 
423 
430 
436 
442 
448 
449 
454 vx_status ownGraphScheduleGraph(vx_graph graph, uint32_t num_schedule);
455 
461 
469 vx_bool ownCheckGraphCompleted(vx_graph graph, uint32_t pipeline_id);
470 
471 
482 vx_bool ownGraphDoScheduleGraphAfterEnqueue(vx_graph graph, uint32_t graph_parameter_index);
483 
488 vx_status ownUpdateGraphPerf(vx_graph graph, uint32_t pipeline_id);
489 
490 
495 void ownGraphClearState(vx_graph graph, uint32_t pipeline_id);
496 
501 void ownSetGraphState(vx_graph graph, uint32_t pipeline_id, vx_enum state);
502 
508 
513 vx_status ownGraphRegisterParameterConsumedEvent(vx_graph graph, uint32_t graph_parameter_index, vx_uint32 app_value);
514 
515 
521 
530 vx_status ownGraphParameterCheckValidEnqueueRef(vx_graph graph, uint32_t graph_parameter_index, vx_reference ref);
531 
540 uint32_t ownGraphGetNumSchedule(vx_graph graph);
541 
548 
555 
560 vx_status tivxSendUserGraphEvent(vx_graph graph, vx_uint32 app_value, const void *parameter);
561 
567  vx_graph graph, vx_event_t *event,
568  vx_bool do_not_block);
569 
604  vx_uint32 graph_parameter_index,
605  vx_reference *refs,
606  vx_uint32 num_refs,
607  vx_uint32 flags);
608 
609 #ifdef __cplusplus
610 }
611 #endif
612 
613 #endif
vx_status ownGraphCreateQueues(vx_graph graph)
Create queues to maintain submitted graph desc and free graph desc.
struct _vx_delay * vx_delay
vx_bool
vx_bool is_enable_send_ref_consumed_event
flag to control event send enable/disable
Definition: vx_graph.h:66
#define TIVX_GRAPH_MAX_SUPER_NODES
Max possible super nodes in graph.
Definition: tivx.h:136
struct tivx_vx_event_t * tivx_event
Typedef for a event.
Definition: tivx_event.h:100
uint32_t schedule_pending_count
number of graph schedule's that are requested but not submitted i.e pending
Definition: vx_graph.h:218
uint32_t delay_slot_index
delay slot index associated with this data ref queue
Definition: vx_graph.h:98
vx_bool trigger_node_set
trigger node has been set for graph
Definition: vx_graph.h:188
vx_status ownGraphFreeStreaming(vx_graph graph)
Free graph streaming objects.
vx_node node
The reference to the node which has the data ref queue.
Definition: vx_graph.h:90
vx_bool is_streaming
is graph currently streaming
Definition: vx_graph.h:179
vx_status ownGraphScheduleGraph(vx_graph graph, uint32_t num_schedule)
Schedule a graph for execution 'num_schedule' times.
uint32_t num_data_ref_q
The number of graph parameters.
Definition: vx_graph.h:143
vx_perf_t perf
The performance logging variable.
Definition: vx_graph.h:154
uint32_t index
The index to the parameter on the node.
Definition: vx_graph.h:78
int32_t ownGraphGetFreeNodeIndex(vx_graph graph)
Get next free node entry in graph.
int32_t vx_enum
vx_status ownGraphAllocAndEnqueueObjDescForPipeline(vx_graph graph)
Alloc and enqueue graph obj desc based on graph pipeline depth.
vx_status 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...
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
Graph object descriptor as placed in shared memory.
uint32_t ownGraphGetNumSchedule(vx_graph graph)
Counts number of enqueued 'refs' and returns number of times graph can be scheduled successfully...
The list of data refs other than graph parameters.
Definition: vx_graph.h:74
Event queue object.
void ownSetGraphState(vx_graph graph, uint32_t pipeline_id, vx_enum state)
Set graph state for a given pipeline ID.
vx_status ownGraphParameterCheckValidEnqueueRef(vx_graph graph, uint32_t graph_parameter_index, vx_reference ref)
Checks if 'ref' is valid ref that can be enqueued.
Typedef for a queue.
Definition: tivx_queue.h:103
tivx_event delete_done
event to indicate that streaming is deleted
Definition: vx_graph.h:194
tivx_queue free_q
free graph object descriptors that are ready for scheduling
Definition: vx_graph.h:203
vx_enum vx_status
#define TIVX_OBJ_DESC_QUEUE_MAX_DEPTH
Max elements in a object descriptor queue.
tivx_event all_graph_completed_event
event to indicate all schedule graphs have finished execution and none are pending ...
Definition: vx_graph.h:226
vx_status ownGraphAllocForStreaming(vx_graph graph)
Alloc objects for graph streaming.
vx_enum type
Set to an enum value in vx_type_e.
Definition: vx_graph.h:70
struct _vx_reference * vx_reference
vx_status ownGraphAddNode(vx_graph graph, vx_node node, int32_t idx)
Add's a node to a graph.
uint32_t graph_completed_app_value
Definition: vx_graph.h:250
tivx_reference_t base
The base reference object.
Definition: vx_graph.h:107
tivx_data_ref_queue data_ref_queue
data ref queue handle when queueing is enabled at this graph parameter
Definition: vx_graph.h:62
vx_bool reverify
Flag to maintain state of graph re-verification.
Definition: vx_graph.h:113
vx_bool is_pipelining_enabled
graph pipelining enabled flag
Definition: vx_graph.h:212
vx_enum schedule_mode
graph schedule mode as defined by vx_graph_schedule_mode_type_e
Definition: vx_graph.h:209
vx_status ownGraphRegisterCompletionEvent(vx_graph graph, vx_uint32 app_value)
Register event on graph completion.
vx_bool is_pipeline_depth_set
graph pipeline depth set flag via tivxSetGraphPipelineDepth
Definition: vx_graph.h:215
vx_status ownGraphRemoveNode(vx_graph graph, vx_node node)
Remove a node from a graph.
void ownGraphDetectAndSetNumBuf(vx_graph graph)
Sets buffers automatically if not already set (see: TIOVX-903)
void ownGraphTopologicalSort(tivx_graph_sort_context *context, vx_node *nodes, uint32_t num_nodes, vx_bool *has_cycle)
Perform topological sort of graph nodes.
vx_bool ownCheckGraphCompleted(vx_graph graph, uint32_t pipeline_id)
Check if a previously scheduled graph execution is complete.
vx_delay delay_ref
delay associated with this data ref queue
Definition: vx_graph.h:96
Context used while sorting a graph.
Definition: vx_context.h:50
vx_status ownGraphFreeObjDesc(vx_graph graph)
Free graph obj desc based allocated during ownGraphAllocAndEnqueueObjDescForPipeline() ...
vx_status ownUpdateGraphPerf(vx_graph graph, uint32_t pipeline_id)
Update graph performance.
tivx_data_ref_queue data_ref_queue
data ref queue handle
Definition: vx_graph.h:82
The top level data for graph object.
Definition: vx_graph.h:104
void ownGraphSetReverify(vx_graph graph)
Mark graph to be reverified.
vx_status tivxWaitGraphEvent(vx_graph graph, vx_event_t *event, vx_bool do_not_block)
Waits for user event from graph event queue.
Typedef for a task.
Definition: tivx_task.h:119
uint32_t num_delay_data_ref_q
The number of graph parameters.
Definition: vx_graph.h:148
tivx_data_ref_queue data_ref_queue
data ref queue handle
Definition: vx_graph.h:94
The list of graph parameters.
Definition: vx_graph.h:52
vx_status tivxSendUserGraphEvent(vx_graph graph, vx_uint32 app_value, const void *parameter)
Sends user event to graph event queue.
tivx_event stop_done
event to indicate that streaming has stopped
Definition: vx_graph.h:197
struct _tivx_super_node * tivx_super_node
The Super Node Framework Object. Super Node is a strongly-typed container for connected nodes...
vx_bool is_streaming_enabled
is streaming enabled for graph
Definition: vx_graph.h:182
The list of delay data refs other than graph parameters.
Definition: vx_graph.h:88
struct _tivx_data_ref_queue * tivx_data_ref_queue
Data Ref Queue Object.
vx_bool is_streaming_alloc
when true, all allocations have occurred properly in order for streaming to occur within a graph ...
Definition: vx_graph.h:185
Data structure which holds event information.
vx_uint32 trigger_node_index
index of trigger node
Definition: vx_graph.h:191
uint32_t num_params
The number of graph parameters.
Definition: vx_graph.h:137
uint32_t num_supernodes
Definition: vx_graph.h:256
vx_enum state
The state of the graph (vx_graph_state_e)
Definition: vx_graph.h:151
vx_status ownGraphRegisterParameterConsumedEvent(vx_graph graph, uint32_t graph_parameter_index, vx_uint32 app_value)
Register event on graph parameter consumed.
uint32_t num_buf
when queue_enable = vx_true_e, this hold the max buffers that can be enqueued
Definition: vx_graph.h:60
vx_node node
The reference to the node which has the data ref queue.
Definition: vx_graph.h:76
vx_status ownGraphScheduleGraphWrapper(vx_graph graph)
Wrapper for ownGraphScheduleGraph.
vx_uint32 ownGraphGetPipeDepth(vx_graph graph)
Query the leaf nodes of the graph for their depth to find the total depth of the graph.
vx_bool is_enable_send_complete_event
when true a event is sent when a graph execution is completed
Definition: vx_graph.h:221
uint32_t num_buf
this hold the max buffers that can be enqueued
Definition: vx_graph.h:80
vx_status ownGraphVerifyStreamingMode(vx_graph graph)
verify graph schedule mode with streaming
vx_bool ownGraphCheckIsRefMatch(vx_graph graph, vx_reference ref1, vx_reference ref2)
Abstracted check for checking if references match "vx_true_e" will be returned if references match or...
vx_bool verified
Flag to maintain state of graph verification.
Definition: vx_graph.h:110
uint32_t index
The index to the parameter on the node.
Definition: vx_graph.h:92
uint32_t vx_uint32
vx_uint32 timeout_val
Control API processing Timeout value in milli-sec.
Definition: vx_graph.h:259
vx_bool ownGraphDoScheduleGraphAfterEnqueue(vx_graph graph, uint32_t graph_parameter_index)
Check if a graph should be scheduled after a graph parameter has been enqueued.
void ownSendGraphCompletedEvent(vx_graph graph)
Send graph completion event if enabled.
vx_status ownGraphValidatePipelineParameters(vx_graph graph)
Checks for invalid pipelining conditions (see: TIOVX-726)
uint32_t num_data_ref
number of data references in the graph
Definition: vx_graph.h:232
void ownGraphClearState(vx_graph graph, uint32_t pipeline_id)
Graph execution state for given pipeline ID.
struct _vx_graph * vx_graph
uint32_t index
The index to the parameter on the node.
Definition: vx_graph.h:56
uint32_t pipeline_depth
graph pipeline depth
Definition: vx_graph.h:173
tivx_event_queue_t event_queue
Definition: vx_graph.h:244
vx_status ownGraphDeleteQueues(vx_graph graph)
Delete queues created during ownGraphCreateQueues.
vx_node node
The reference to the node which has the parameter.
Definition: vx_graph.h:54
struct _vx_node * vx_node
uint32_t submitted_count
counts the number of graphs schedule or submitted but not yet completed
Definition: vx_graph.h:229
uint32_t graph_consumed_app_value
Definition: vx_graph.h:68
tivx_task streaming_task_handle
Definition: vx_graph.h:247
tivx_data_ref_queue ownGraphGetParameterDataRefQueue(vx_graph graph, vx_uint32 graph_parameter_index)
If a data ref queue is associated with 'graph_parameter_index' return it.
vx_bool queue_enable
vx_true_e, enqueue operation is supported on this parameter
Definition: vx_graph.h:58
uint32_t streaming_executions
graph streaming executions
Definition: vx_graph.h:176