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 
43 typedef struct _vx_graph {
44 
47 
50 
53 
56 
57  /* \brief Number of nodes in a graph */
58  uint32_t num_nodes;
59 
62 
63  /* \brief Number of head nodes in a graph */
64  uint32_t num_head_nodes;
65 
68 
69  /* \brief Number of leaf nodes in a graph */
70  uint32_t num_leaf_nodes;
71 
73  struct {
77  uint32_t index;
81  uint32_t num_buf;
92  } parameters[TIVX_GRAPH_MAX_PARAMS];
94  uint32_t num_params;
95 
97  struct {
99  vx_node node;
101  uint32_t index;
103  uint32_t num_buf;
105  tivx_data_ref_queue data_ref_queue;
108  } data_ref_q_list[TIVX_GRAPH_MAX_DATA_REF_QUEUE];
110  uint32_t num_data_ref_q;
111 
113  struct {
115  vx_node node;
117  uint32_t index;
119  tivx_data_ref_queue data_ref_queue;
124  } delay_data_ref_q_list[TIVX_GRAPH_MAX_DATA_REF_QUEUE];
127 
130 
133 
136 
139 
142 
143 
146 
149 
151  uint32_t pipeline_depth;
152 
155 
158 
161 
164 
167 
170 
173 
176 
179 
181  uintptr_t free_q_mem[TIVX_GRAPH_MAX_PIPELINE_DEPTH];
182 
185 
188 
191 
194 
197 
202 
204  uint32_t submitted_count;
205 
207  uint32_t num_data_ref;
208 
211 
213  uint8_t data_ref_num_in_nodes[TIVX_GRAPH_MAX_DATA_REF];
214 
216  uint8_t data_ref_num_out_nodes[TIVX_GRAPH_MAX_DATA_REF];
217 
220 
223 
226 
229 
231  uint32_t num_supernodes;
232 
235 
236 } tivx_graph_t;
237 
238 
239 
249 int32_t ownGraphGetFreeNodeIndex(vx_graph graph);
250 
264 vx_status ownGraphAddNode(vx_graph graph, vx_node node, int32_t index);
265 
276 
287 
288 
299 void ownGraphTopologicalSort(tivx_graph_sort_context *context, vx_node *nodes, uint32_t num_nodes, vx_bool *has_cycle);
300 
311 
312 
323 
334 void ownGraphCheckContinuityOfSupernode(tivx_graph_sort_context *context, tivx_super_node super_node, uint32_t num_nodes, vx_bool *is_continuous);
335 
347 void ownGraphCheckSupernodeCycles(tivx_graph_sort_context *context, const vx_node *nodes, uint32_t num_nodes, vx_bool *has_cycle);
348 
357 
361 void ownGraphSetReverify(vx_graph graph);
362 
363 
371 
372 
378 
384 
390 
396 void ownGraphFreeObjDesc(vx_graph graph);
397 
402 void ownGraphFreeStreaming(vx_graph graph);
403 
409 
414 void ownGraphDeleteQueues(vx_graph graph);
415 
416 
421 vx_status ownGraphScheduleGraph(vx_graph graph, uint32_t num_schedule);
422 
428 
436 vx_bool ownCheckGraphCompleted(vx_graph graph, uint32_t pipeline_id);
437 
438 
449 vx_bool ownGraphDoScheduleGraphAfterEnqueue(vx_graph graph, uint32_t graph_parameter_index);
450 
455 vx_status ownUpdateGraphPerf(vx_graph graph, uint32_t pipeline_id);
456 
457 
462 void ownGraphClearState(vx_graph graph, uint32_t pipeline_id);
463 
468 void ownSetGraphState(vx_graph graph, uint32_t pipeline_id, vx_enum state);
469 
475 
480 vx_status ownGraphRegisterParameterConsumedEvent(vx_graph graph, uint32_t graph_parameter_index, vx_uint32 app_value);
481 
482 
488 
497 vx_status ownGraphParameterCheckValidEnqueueRef(vx_graph graph, uint32_t graph_parameter_index, vx_reference ref);
498 
507 uint32_t ownGraphGetNumSchedule(vx_graph graph);
508 
515 
522 
527 vx_status VX_API_CALL tivxSendUserGraphEvent(vx_graph graph, vx_uint32 app_value, const void *parameter);
528 
534  vx_graph graph, vx_event_t *event,
535  vx_bool do_not_block);
536 
537 #ifdef __cplusplus
538 }
539 #endif
540 
541 #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
#define TIVX_GRAPH_MAX_SUPER_NODES
Max possible super nodes in graph.
Definition: tivx.h:146
uint32_t schedule_pending_count
number of graph schedule's that are requested but not submitted i.e pending
Definition: vx_graph.h:193
vx_bool trigger_node_set
trigger node has been set for graph
Definition: vx_graph.h:163
vx_bool is_streaming
is graph currently streaming
Definition: vx_graph.h:157
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:110
uint32_t index
The index to the parameter on the node.
Definition: vx_graph.h:77
vx_perf_t perf
The performance logging variable.
Definition: vx_graph.h:132
vx_status VX_API_CALL tivxSendUserGraphEvent(vx_graph graph, vx_uint32 app_value, const void *parameter)
Sends user event to graph event queue.
int32_t ownGraphGetFreeNodeIndex(vx_graph graph)
Get next free node entry in graph.
uint32_t graph_consumed_app_value
Definition: vx_graph.h:89
int32_t vx_enum
vx_status ownGraphAllocAndEnqueueObjDescForPipeline(vx_graph graph)
Alloc and enqueue graph obj desc based on graph pipeline depth.
vx_status ownGraphAddSuperNode(vx_graph graph, tivx_super_node super_node)
Add's a super node to a graph.
uint32_t num_buf
when queue_enable = vx_true_e, this hold the max buffers that can be enqueued
Definition: vx_graph.h:81
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 sucessfully...
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:169
tivx_queue free_q
free graph object descriptors that are ready for scheduling
Definition: vx_graph.h:178
#define TIVX_GRAPH_MAX_HEAD_NODES
Max possible head nodes in graph.
vx_enum vx_status
vx_status VX_API_CALL tivxWaitGraphEvent(vx_graph graph, vx_event_t *event, vx_bool do_not_block)
Waits for user event from graph event queue.
#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:201
vx_status ownGraphAllocForStreaming(vx_graph graph)
Alloc objects for graph streaming.
struct _vx_reference * vx_reference
vx_bool queue_enable
vx_true_e, enqueue operation is supported on this parameter
Definition: vx_graph.h:79
uint32_t graph_completed_app_value
Definition: vx_graph.h:225
vx_enum type
Set to an enum value in vx_type_e.
Definition: vx_graph.h:91
tivx_reference_t base
The base reference object.
Definition: vx_graph.h:46
#define TIVX_GRAPH_MAX_PARAMS
Max possible parameters in graph.
void ownGraphFreeObjDesc(vx_graph graph)
Free graph obj desc based allocated during ownGraphAllocAndEnqueueObjDescForPipeline() ...
vx_bool is_enable_send_ref_consumed_event
flag to control event send enable/disable
Definition: vx_graph.h:87
vx_bool reverify
Flag to maintain state of graph re-verification.
Definition: vx_graph.h:52
vx_bool is_pipelining_enabled
graph pipelining enabled flag
Definition: vx_graph.h:187
vx_enum schedule_mode
graph schedule mode as defined by vx_graph_schedule_mode_type_e
Definition: vx_graph.h:184
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:190
#define TIVX_GRAPH_MAX_DATA_REF
Max possible data references in a graph.
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 previoulsy scehduled graph execution is complete.
void ownGraphCheckContinuityOfSupernode(tivx_graph_sort_context *context, tivx_super_node super_node, uint32_t num_nodes, vx_bool *is_continuous)
Perform topological sort of graph nodes.
Context used while sorting a graph.
Definition: vx_context.h:50
vx_status ownUpdateGraphPerf(vx_graph graph, uint32_t pipeline_id)
Update graph performance.
The top level data for graph object.
Definition: vx_graph.h:43
vx_status ownGraphSuperNodeConfigure(vx_graph graph)
Configure Supernode.
void ownGraphSetReverify(vx_graph graph)
Mark graph to be reverified.
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:126
void ownGraphDeleteQueues(vx_graph graph)
Delete queues created during ownGraphCreateQueues.
vx_delay delay_ref
delay associated with this data ref queue
Definition: vx_graph.h:121
tivx_event stop_done
event to indicate that streaming has stopped
Definition: vx_graph.h:172
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:160
struct _tivx_data_ref_queue * tivx_data_ref_queue
Data Ref Queue Object.
#define TIVX_PYRAMID_MAX_LEVEL_OBJECTS
Maximum number of objects supported in pyramid.
uint32_t delay_slot_index
delay slot index associated with this data ref queue
Definition: vx_graph.h:123
void ownGraphCheckSupernodeCycles(tivx_graph_sort_context *context, const vx_node *nodes, uint32_t num_nodes, vx_bool *has_cycle)
Perform topological sort of graph nodes after supernodes have been inserted.
Data structure which holds event information.
vx_uint32 trigger_node_index
index of trigger node
Definition: vx_graph.h:166
#define TIVX_GRAPH_MAX_NODES
Max possible nodes in graph.
void ownGraphFreeStreaming(vx_graph graph)
Free graph streaming objects.
uint32_t num_params
The number of graph parameters.
Definition: vx_graph.h:94
uint32_t num_supernodes
Definition: vx_graph.h:231
vx_enum state
The state of the graph (vx_graph_state_e)
Definition: vx_graph.h:129
vx_status ownGraphRegisterParameterConsumedEvent(vx_graph graph, uint32_t graph_parameter_index, vx_uint32 app_value)
Register event on graph parameter consumed.
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:196
#define TIVX_GRAPH_MAX_LEAF_NODES
Max possible leaf nodes in graph.
vx_status ownGraphVerifyStreamingMode(vx_graph graph)
verify graph schedule mode with streaming
vx_status ownGraphAddNode(vx_graph graph, vx_node node, int32_t index)
Add's a node to a graph.
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:49
#define TIVX_GRAPH_MAX_PIPELINE_DEPTH
Max possible pipeline depth of a graph.
tivx_data_ref_queue data_ref_queue
data ref queue handle when queueing is enabled at this graph parameter
Definition: vx_graph.h:83
uint32_t vx_uint32
vx_uint32 timeout_val
Control API processing Timeout value in milli-sec.
Definition: vx_graph.h:234
#define TIVX_GRAPH_MAX_DATA_REF_QUEUE
Max data ref queue in graph.
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:207
#define TIVX_KERNEL_MAX_PARAMS
Max parameters in a kernel.
void ownGraphClearState(vx_graph graph, uint32_t pipeline_id)
Graph execution state for given pipeline ID.
#define TIVX_GRAPH_MAX_DELAYS
Max possible delays in graph.
struct _vx_graph * vx_graph
uint32_t pipeline_depth
graph pipeline depth
Definition: vx_graph.h:151
tivx_event_queue_t event_queue
Definition: vx_graph.h:219
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:204
vx_node node
The reference to the node which has the parameter.
Definition: vx_graph.h:75
tivx_task streaming_task_handle
Definition: vx_graph.h:222
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
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.
struct _tivx_event_t * tivx_event
Typedef for a event.
Definition: tivx_event.h:100
uint32_t streaming_executions
graph streaming executions
Definition: vx_graph.h:154