Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 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 | |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 17 | /** @file rs_core.rsh |
| 18 | * \brief todo-jsams |
| 19 | * |
| 20 | * todo-jsams |
| 21 | * |
| 22 | */ |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 23 | |
Jason Sams | 275b1e9 | 2010-05-28 18:08:16 -0700 | [diff] [blame] | 24 | #ifndef __RS_CORE_RSH__ |
| 25 | #define __RS_CORE_RSH__ |
| 26 | |
Shih-wei Liao | 7a43031 | 2011-01-26 14:47:17 -0800 | [diff] [blame] | 27 | #define _RS_RUNTIME extern |
Stephen Hines | f6a28c6 | 2011-01-18 16:53:19 -0800 | [diff] [blame] | 28 | |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 29 | #include "rs_types.rsh" |
| 30 | #include "rs_allocation.rsh" |
| 31 | #include "rs_atomic.rsh" |
| 32 | #include "rs_cl.rsh" |
| 33 | #include "rs_debug.rsh" |
| 34 | #include "rs_math.rsh" |
| 35 | #include "rs_matrix.rsh" |
| 36 | #include "rs_object.rsh" |
| 37 | #include "rs_quaternion.rsh" |
| 38 | #include "rs_time.rsh" |
| 39 | |
Shih-wei Liao | 9bb32e1 | 2010-10-07 18:21:32 -0700 | [diff] [blame] | 40 | |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 41 | |
| 42 | /** |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 43 | * Send a message back to the client. Will not block and returns true |
| 44 | * if the message was sendable and false if the fifo was full. |
| 45 | * A message ID is required. Data payload is optional. |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 46 | */ |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 47 | extern bool __attribute__((overloadable)) |
| 48 | rsSendToClient(int cmdID); |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 49 | /** |
| 50 | * \overload |
| 51 | */ |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 52 | extern bool __attribute__((overloadable)) |
| 53 | rsSendToClient(int cmdID, const void *data, uint len); |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 54 | /** |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 55 | * Send a message back to the client, blocking until the message is queued. |
| 56 | * A message ID is required. Data payload is optional. |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 57 | */ |
Jason Sams | 693080e | 2011-01-25 21:33:44 -0800 | [diff] [blame] | 58 | extern void __attribute__((overloadable)) |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 59 | rsSendToClientBlocking(int cmdID); |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 60 | /** |
| 61 | * \overload |
| 62 | */ |
Jason Sams | 693080e | 2011-01-25 21:33:44 -0800 | [diff] [blame] | 63 | extern void __attribute__((overloadable)) |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 64 | rsSendToClientBlocking(int cmdID, const void *data, uint len); |
| 65 | |
Jason Sams | 7fe6bce | 2010-06-24 13:54:11 -0700 | [diff] [blame] | 66 | |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 67 | /** |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 68 | * Launch order hint for rsForEach calls. This provides a hint to the system to |
| 69 | * determine in which order the root function of the target is called with each |
| 70 | * cell of the allocation. |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 71 | * |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 72 | * This is a hint and implementations may not obey the order. |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 73 | */ |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 74 | enum rs_for_each_strategy { |
| 75 | RS_FOR_EACH_STRATEGY_SERIAL, |
| 76 | RS_FOR_EACH_STRATEGY_DONT_CARE, |
| 77 | RS_FOR_EACH_STRATEGY_DST_LINEAR, |
| 78 | RS_FOR_EACH_STRATEGY_TILE_SMALL, |
| 79 | RS_FOR_EACH_STRATEGY_TILE_MEDIUM, |
| 80 | RS_FOR_EACH_STRATEGY_TILE_LARGE |
| 81 | }; |
| 82 | |
Jason Sams | 7fe6bce | 2010-06-24 13:54:11 -0700 | [diff] [blame] | 83 | |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 84 | /** |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 85 | * Structure to provide extra information to a rsForEach call. Primarly used to |
| 86 | * restrict the call to a subset of cells in the allocation. |
| 87 | */ |
| 88 | typedef struct rs_script_call { |
| 89 | enum rs_for_each_strategy strategy; |
| 90 | uint32_t xStart; |
| 91 | uint32_t xEnd; |
| 92 | uint32_t yStart; |
| 93 | uint32_t yEnd; |
| 94 | uint32_t zStart; |
| 95 | uint32_t zEnd; |
| 96 | uint32_t arrayStart; |
| 97 | uint32_t arrayEnd; |
| 98 | } rs_script_call_t; |
| 99 | |
| 100 | /** |
| 101 | * Make a script to script call to launch work. One of the input or output is |
| 102 | * required to be a valid object. The input and output must be of the same |
| 103 | * dimensions. |
| 104 | * API 10-13 |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 105 | * |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 106 | * @param script The target script to call |
| 107 | * @param input The allocation to source data from |
| 108 | * @param output the allocation to write date into |
| 109 | * @param usrData The user definied params to pass to the root script. May be |
| 110 | * NULL. |
| 111 | * @param sc Extra control infomation used to select a sub-region of the |
| 112 | * allocation to be processed or suggest a walking strategy. May be |
| 113 | * NULL. |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 114 | * |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 115 | * */ |
Jason Sams | eb0dfed | 2011-07-27 14:10:53 -0700 | [diff] [blame] | 116 | #if !defined(RS_VERSION) || (RS_VERSION < 14) |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 117 | extern void __attribute__((overloadable)) |
| 118 | rsForEach(rs_script script, rs_allocation input, |
| 119 | rs_allocation output, const void * usrData, |
| 120 | const rs_script_call_t *sc); |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 121 | /** |
| 122 | * \overload |
| 123 | */ |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 124 | extern void __attribute__((overloadable)) |
| 125 | rsForEach(rs_script script, rs_allocation input, |
| 126 | rs_allocation output, const void * usrData); |
Jason Sams | eb0dfed | 2011-07-27 14:10:53 -0700 | [diff] [blame] | 127 | #else |
Jason Sams | eb0dfed | 2011-07-27 14:10:53 -0700 | [diff] [blame] | 128 | |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 129 | /** |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 130 | * Make a script to script call to launch work. One of the input or output is |
| 131 | * required to be a valid object. The input and output must be of the same |
| 132 | * dimensions. |
| 133 | * API 14+ |
| 134 | * |
| 135 | * @param script The target script to call |
| 136 | * @param input The allocation to source data from |
| 137 | * @param output the allocation to write date into |
| 138 | * @param usrData The user definied params to pass to the root script. May be |
| 139 | * NULL. |
| 140 | * @param usrDataLen The size of the userData structure. This will be used to |
| 141 | * perform a shallow copy of the data if necessary. |
| 142 | * @param sc Extra control infomation used to select a sub-region of the |
| 143 | * allocation to be processed or suggest a walking strategy. May be |
| 144 | * NULL. |
| 145 | * |
| 146 | */ |
| 147 | extern void __attribute__((overloadable)) |
| 148 | rsForEach(rs_script script, rs_allocation input, rs_allocation output, |
| 149 | const void * usrData, size_t usrDataLen, const rs_script_call_t *); |
| 150 | /** |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 151 | * \overload |
| 152 | */ |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 153 | extern void __attribute__((overloadable)) |
| 154 | rsForEach(rs_script script, rs_allocation input, rs_allocation output, |
| 155 | const void * usrData, size_t usrDataLen); |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 156 | /** |
| 157 | * \overload |
| 158 | */ |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 159 | extern void __attribute__((overloadable)) |
| 160 | rsForEach(rs_script script, rs_allocation input, rs_allocation output); |
Jason Sams | eb0dfed | 2011-07-27 14:10:53 -0700 | [diff] [blame] | 161 | #endif |
Jason Sams | 7fe6bce | 2010-06-24 13:54:11 -0700 | [diff] [blame] | 162 | |
Jason Sams | 1d526a4 | 2011-08-08 15:54:14 -0700 | [diff] [blame] | 163 | |
Jason Sams | 7fe6bce | 2010-06-24 13:54:11 -0700 | [diff] [blame] | 164 | |
Shih-wei Liao | 7a43031 | 2011-01-26 14:47:17 -0800 | [diff] [blame] | 165 | #undef _RS_RUNTIME |
Jason Sams | 275b1e9 | 2010-05-28 18:08:16 -0700 | [diff] [blame] | 166 | |
| 167 | #endif |