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 
33 typedef struct {
37  uint32_t index;
41  uint32_t num_buf;
47  uint32_t num_other;
49  struct {
50  vx_node node;
51  uint32_t index;
52  } params_list[TIVX_GRAPH_MAX_PARAM_REFS];
64 
66 typedef struct {
70  uint32_t index;
72  uint32_t num_buf;
78 
80 typedef struct {
84  uint32_t index;
90  uint32_t delay_slot_index;
92 
96 typedef struct _vx_graph {
97 
100 
103 
106 
109 
110  /* \brief Number of nodes in a graph */
111  uint32_t num_nodes;
112 
115 
116  /* \brief Number of head nodes in a graph */
117  uint32_t num_head_nodes;
118 
121 
122  /* \brief Number of leaf nodes in a graph */
123  uint32_t num_leaf_nodes;
124 
127 
129  uint32_t num_params;
130 
133 
135  uint32_t num_data_ref_q;
136 
141 
144 
147 
150 
153 
156 
157 
160 
163 
165  uint32_t pipeline_depth;
166 
169 
172 
175 
178 
181 
184 
187 
190 
193 
196 
199 
201  uintptr_t free_q_mem[TIVX_GRAPH_MAX_PIPELINE_DEPTH];
202 
205 
208 
211 
214 
217 
220 
225 
227  uint32_t submitted_count;
228 
230  uint32_t num_data_ref;
231 
234 
236  uint8_t data_ref_num_in_nodes[TIVX_GRAPH_MAX_DATA_REF];
237 
239  uint8_t data_ref_num_out_nodes[TIVX_GRAPH_MAX_DATA_REF];
240 
243 
246 
249 
252 
255 
258 
260  uint32_t num_supernodes;
261 
264 
267 
270 
271 } tivx_graph_t;
272 
273 
274 
284 int32_t ownGraphGetFreeNodeIndex(vx_graph graph);
285 
299 vx_status ownGraphAddNode(vx_graph graph, vx_node node, int32_t idx);
300 
301 #if defined(BUILD_BAM)
302 
312 vx_status ownGraphAddSuperNode(vx_graph graph, tivx_super_node super_node);
313 
314 #endif
315 
326 
327 
338 void ownGraphTopologicalSort(tivx_graph_sort_context *context, vx_node *nodes, uint32_t num_nodes, vx_bool *has_cycle);
339 
350 
351 
362 
363 #if defined(BUILD_BAM)
364 
375 void ownGraphCheckContinuityOfSupernode(tivx_graph_sort_context *context, tivx_super_node super_node, uint32_t num_nodes, vx_bool *is_continuous);
376 
388 void ownGraphCheckSupernodeCycles(tivx_graph_sort_context *context, const vx_node *nodes, uint32_t num_nodes, vx_bool *has_cycle);
389 
397 vx_status ownGraphSuperNodeConfigure(vx_graph graph);
398 
399 #endif
400 
404 void ownGraphSetReverify(vx_graph graph);
405 
406 
414 
415 
421 
427 
433 
440 
446 
452 
458 
459 
464 vx_status ownGraphScheduleGraph(vx_graph graph, uint32_t num_schedule);
465 
471 
479 vx_bool ownCheckGraphCompleted(vx_graph graph, uint32_t pipeline_id);
480 
481 
492 vx_bool ownGraphDoScheduleGraphAfterEnqueue(vx_graph graph, uint32_t graph_parameter_index);
493 
498 vx_status ownUpdateGraphPerf(vx_graph graph, uint32_t pipeline_id);
499 
500 
505 void ownGraphClearState(vx_graph graph, uint32_t pipeline_id);
506 
511 void ownSetGraphState(vx_graph graph, uint32_t pipeline_id, vx_enum state);
512 
517 vx_status ownGraphRegisterCompletionEvent(vx_graph graph, vx_uint32 app_value, vx_bool is_context_event);
518 
523 vx_status ownGraphRegisterParameterConsumedEvent(vx_graph graph, uint32_t graph_parameter_index, vx_uint32 app_value, vx_bool is_context_event);
524 
525 
531 
540 uint32_t ownGraphGetNumSchedule(vx_graph graph);
541 
548 
555 
560 vx_status ownSendUserGraphEvent(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 
575  uint32_t prm_cur_idx,
576  vx_reference ref);
577 
578 #ifdef __cplusplus
579 }
580 #endif
581 
582 #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
flags to control context event send enable/disable
Definition: vx_graph.h:54
#define TIVX_GRAPH_MAX_SUPER_NODES
Max possible super nodes in graph.
Definition: tivx.h:130
struct tivx_vx_event_t * tivx_event
Typedef for a event.
Definition: tivx_event.h:91
uint32_t schedule_pending_count
number of graph schedule's that are requested but not submitted i.e pending
Definition: vx_graph.h:213
vx_bool is_enable_send_graph_complete_event
when true a graph is sent when a graph execution is completed
Definition: vx_graph.h:219
uint32_t delay_slot_index
delay slot index associated with this data ref queue
Definition: vx_graph.h:90
vx_bool trigger_node_set
trigger node has been set for graph
Definition: vx_graph.h:183
vx_status ownGraphFreeStreaming(vx_graph graph)
Free graph streaming objects.
vx_status ownGraphAllocateDataObject(vx_node node_cur, uint32_t prm_cur_idx, vx_reference ref)
Allocates data for an object during verification or graph parameter substitution. ...
vx_node node
The reference to the node which has the data ref queue.
Definition: vx_graph.h:82
vx_bool is_streaming
is graph currently streaming
Definition: vx_graph.h:171
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:135
vx_uint32 timeout_graph_event_val
Control API processing Timeout value in milli-sec for the graph events.
Definition: vx_graph.h:266
vx_perf_t perf
The performance logging variable.
Definition: vx_graph.h:146
uint32_t graph_consumed_context_app_value
Definition: vx_graph.h:58
uint32_t index
The index to the parameter on the node.
Definition: vx_graph.h:70
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 ownGraphRegisterParameterConsumedEvent(vx_graph graph, uint32_t graph_parameter_index, vx_uint32 app_value, vx_bool is_context_event)
Register event on graph parameter consumed.
The most basic type in the OpenVX system. Any type that inherits from tivx_reference_t must have a vx...
Definition: vx_reference.h:73
vx_uint32 debug_zonemask
Debug zonemask of a given graph.
Definition: vx_graph.h:269
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:66
vx_bool is_enable_send_context_complete_event
when true a context event is sent when a graph execution is completed
Definition: vx_graph.h:216
Event queue object.
void ownSetGraphState(vx_graph graph, uint32_t pipeline_id, vx_enum state)
Set graph state for a given pipeline ID.
#define TIVX_GRAPH_MAX_PARAM_REFS
Max number of associated references for a graph parameter.
Typedef for a queue.
Definition: tivx_queue.h:103
tivx_event delete_done
event to indicate that streaming is deleted
Definition: vx_graph.h:189
vx_bool is_streaming_error
is streaming enabled for graph
Definition: vx_graph.h:177
tivx_queue free_q
free graph object descriptors that are ready for scheduling
Definition: vx_graph.h:198
#define TIVX_GRAPH_MAX_HEAD_NODES
Max possible head nodes in graph.
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:224
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:62
struct _vx_reference * vx_reference
vx_bool is_enable_send_ref_consumed_graph_event
flags to control graph event send enable/disable
Definition: vx_graph.h:56
vx_status ownGraphAddNode(vx_graph graph, vx_node node, int32_t idx)
Add's a node to a graph.
tivx_reference_t base
The base reference object.
Definition: vx_graph.h:99
#define TIVX_GRAPH_MAX_PARAMS
Max possible parameters in graph.
tivx_data_ref_queue data_ref_queue
data ref queue handle when queueing is enabled at this graph parameter
Definition: vx_graph.h:43
vx_bool reverify
Flag to maintain state of graph re-verification.
Definition: vx_graph.h:105
vx_bool is_pipelining_enabled
graph pipelining enabled flag
Definition: vx_graph.h:207
vx_enum schedule_mode
graph schedule mode as defined by vx_graph_schedule_mode_type_e
Definition: vx_graph.h:204
vx_bool is_pipeline_depth_set
graph pipeline depth set flag via tivxSetGraphPipelineDepth
Definition: vx_graph.h:210
#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 previously scheduled graph execution is complete.
vx_delay delay_ref
delay associated with this data ref queue
Definition: vx_graph.h:88
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:74
The top level data for graph object.
Definition: vx_graph.h:96
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:140
tivx_data_ref_queue data_ref_queue
data ref queue handle
Definition: vx_graph.h:86
uint32_t graph_completed_graph_app_value
Definition: vx_graph.h:254
The list of graph parameters.
Definition: vx_graph.h:33
tivx_event stop_done
event to indicate that streaming has stopped
Definition: vx_graph.h:192
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:174
The list of delay data refs other than graph parameters.
Definition: vx_graph.h:80
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 graph_consumed_graph_app_value
Definition: vx_graph.h:60
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:180
Data structure which holds event information.
vx_uint32 trigger_node_index
index of trigger node
Definition: vx_graph.h:186
#define TIVX_GRAPH_MAX_NODES
Max possible nodes in graph.
uint32_t num_params
The number of graph parameters.
Definition: vx_graph.h:129
uint32_t num_supernodes
Definition: vx_graph.h:260
vx_enum state
The state of the graph (vx_graph_state_e)
Definition: vx_graph.h:143
vx_status ownSendUserGraphEvent(vx_graph graph, vx_uint32 app_value, const void *parameter)
Sends user event to graph event queue.
uint32_t num_buf
when queue_enable = vx_true_e, this hold the max buffers that can be enqueued
Definition: vx_graph.h:41
vx_node node
The reference to the node which has the data ref queue.
Definition: vx_graph.h:68
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.
#define TIVX_GRAPH_MAX_LEAF_NODES
Max possible leaf nodes in graph.
uint32_t num_buf
this hold the max buffers that can be enqueued
Definition: vx_graph.h:72
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:102
uint32_t index
The index to the parameter on the node.
Definition: vx_graph.h:84
#define TIVX_GRAPH_MAX_PIPELINE_DEPTH
Max possible pipeline depth of a graph.
uint32_t vx_uint32
vx_uint32 timeout_val
Control API processing Timeout value in milli-sec for the graph.
Definition: vx_graph.h:263
#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.
uint32_t num_other
the number of other node parameters affected by this graph parameter
Definition: vx_graph.h:47
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:230
#define TIVX_KERNEL_MAX_PARAMS
Max parameters in a kernel This is required to be <= 32 per framework requirements.
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 index
The index to the parameter on the node.
Definition: vx_graph.h:37
uint32_t pipeline_depth
graph pipeline depth
Definition: vx_graph.h:165
tivx_event_queue_t event_queue
Definition: vx_graph.h:245
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:35
tivx_event_queue_t streaming_event_queue
Definition: vx_graph.h:242
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:227
vx_status ownGraphRegisterCompletionEvent(vx_graph graph, vx_uint32 app_value, vx_bool is_context_event)
Register event on graph completion.
tivx_task streaming_task_handle
Definition: vx_graph.h:248
uint32_t graph_completed_context_app_value
Definition: vx_graph.h:251
tivx_data_ref_queue ownGraphGetParameterDataRefQueue(vx_graph graph, vx_uint32 graph_parameter_index)
If a data ref queue is associated with &#39;graph_parameter_index&#39; return it.
vx_bool queue_enable
vx_true_e, enqueue operation is supported on this parameter
Definition: vx_graph.h:39
vx_status ownWaitGraphEvent(vx_graph graph, vx_event_t *event, vx_bool do_not_block)
Waits for user event from graph event queue.
uint32_t streaming_executions
graph streaming executions
Definition: vx_graph.h:168