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 17/** @file rs_core.rsh 18 * \brief todo-jsams 19 * 20 * todo-jsams 21 * 22 */ 23 24#ifndef __RS_CORE_RSH__ 25#define __RS_CORE_RSH__ 26 27#define _RS_RUNTIME extern 28 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 40 41 42/** 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. 46 */ 47extern bool __attribute__((overloadable)) 48 rsSendToClient(int cmdID); 49/** 50 * \overload 51 */ 52extern bool __attribute__((overloadable)) 53 rsSendToClient(int cmdID, const void *data, uint len); 54/** 55 * Send a message back to the client, blocking until the message is queued. 56 * A message ID is required. Data payload is optional. 57 */ 58extern void __attribute__((overloadable)) 59 rsSendToClientBlocking(int cmdID); 60/** 61 * \overload 62 */ 63extern void __attribute__((overloadable)) 64 rsSendToClientBlocking(int cmdID, const void *data, uint len); 65 66 67/** 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. 71 * 72 * This is a hint and implementations may not obey the order. 73 */ 74enum 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 83 84/** 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 */ 88typedef 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 105 * 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. 114 * 115 * */ 116#if !defined(RS_VERSION) || (RS_VERSION < 14) 117extern 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); 121/** 122 * \overload 123 */ 124extern void __attribute__((overloadable)) 125 rsForEach(rs_script script, rs_allocation input, 126 rs_allocation output, const void * usrData); 127#else 128 129/** 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 */ 147extern 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/** 151 * \overload 152 */ 153extern void __attribute__((overloadable)) 154 rsForEach(rs_script script, rs_allocation input, rs_allocation output, 155 const void * usrData, size_t usrDataLen); 156/** 157 * \overload 158 */ 159extern void __attribute__((overloadable)) 160 rsForEach(rs_script script, rs_allocation input, rs_allocation output); 161#endif 162 163 164 165#undef _RS_RUNTIME 166 167#endif 168