rs_core.rsh revision 14607a6bd1e909a7944e39b7ec71dc0ba65de2cd
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_element.rsh" 35#include "rs_math.rsh" 36#include "rs_mesh.rsh" 37#include "rs_matrix.rsh" 38#include "rs_object.rsh" 39#include "rs_program.rsh" 40#include "rs_quaternion.rsh" 41#include "rs_sampler.rsh" 42#include "rs_time.rsh" 43 44 45 46/** 47 * Send a message back to the client. Will not block and returns true 48 * if the message was sendable and false if the fifo was full. 49 * A message ID is required. Data payload is optional. 50 */ 51extern bool __attribute__((overloadable)) 52 rsSendToClient(int cmdID); 53/** 54 * \overload 55 */ 56extern bool __attribute__((overloadable)) 57 rsSendToClient(int cmdID, const void *data, uint len); 58/** 59 * Send a message back to the client, blocking until the message is queued. 60 * A message ID is required. Data payload is optional. 61 */ 62extern void __attribute__((overloadable)) 63 rsSendToClientBlocking(int cmdID); 64/** 65 * \overload 66 */ 67extern void __attribute__((overloadable)) 68 rsSendToClientBlocking(int cmdID, const void *data, uint len); 69 70 71/** 72 * Launch order hint for rsForEach calls. This provides a hint to the system to 73 * determine in which order the root function of the target is called with each 74 * cell of the allocation. 75 * 76 * This is a hint and implementations may not obey the order. 77 */ 78enum rs_for_each_strategy { 79 RS_FOR_EACH_STRATEGY_SERIAL, 80 RS_FOR_EACH_STRATEGY_DONT_CARE, 81 RS_FOR_EACH_STRATEGY_DST_LINEAR, 82 RS_FOR_EACH_STRATEGY_TILE_SMALL, 83 RS_FOR_EACH_STRATEGY_TILE_MEDIUM, 84 RS_FOR_EACH_STRATEGY_TILE_LARGE 85}; 86 87 88/** 89 * Structure to provide extra information to a rsForEach call. Primarly used to 90 * restrict the call to a subset of cells in the allocation. 91 */ 92typedef struct rs_script_call { 93 enum rs_for_each_strategy strategy; 94 uint32_t xStart; 95 uint32_t xEnd; 96 uint32_t yStart; 97 uint32_t yEnd; 98 uint32_t zStart; 99 uint32_t zEnd; 100 uint32_t arrayStart; 101 uint32_t arrayEnd; 102} rs_script_call_t; 103 104/** 105 * Make a script to script call to launch work. One of the input or output is 106 * required to be a valid object. The input and output must be of the same 107 * dimensions. 108 * API 10-13 109 * 110 * @param script The target script to call 111 * @param input The allocation to source data from 112 * @param output the allocation to write date into 113 * @param usrData The user definied params to pass to the root script. May be 114 * NULL. 115 * @param sc Extra control infomation used to select a sub-region of the 116 * allocation to be processed or suggest a walking strategy. May be 117 * NULL. 118 * 119 * */ 120#if !defined(RS_VERSION) || (RS_VERSION < 14) 121extern void __attribute__((overloadable)) 122 rsForEach(rs_script script, rs_allocation input, 123 rs_allocation output, const void * usrData, 124 const rs_script_call_t *sc); 125/** 126 * \overload 127 */ 128extern void __attribute__((overloadable)) 129 rsForEach(rs_script script, rs_allocation input, 130 rs_allocation output, const void * usrData); 131#else 132 133/** 134 * Make a script to script call to launch work. One of the input or output is 135 * required to be a valid object. The input and output must be of the same 136 * dimensions. 137 * API 14+ 138 * 139 * @param script The target script to call 140 * @param input The allocation to source data from 141 * @param output the allocation to write date into 142 * @param usrData The user definied params to pass to the root script. May be 143 * NULL. 144 * @param usrDataLen The size of the userData structure. This will be used to 145 * perform a shallow copy of the data if necessary. 146 * @param sc Extra control infomation used to select a sub-region of the 147 * allocation to be processed or suggest a walking strategy. May be 148 * NULL. 149 * 150 */ 151extern void __attribute__((overloadable)) 152 rsForEach(rs_script script, rs_allocation input, rs_allocation output, 153 const void * usrData, size_t usrDataLen, const rs_script_call_t *); 154/** 155 * \overload 156 */ 157extern void __attribute__((overloadable)) 158 rsForEach(rs_script script, rs_allocation input, rs_allocation output, 159 const void * usrData, size_t usrDataLen); 160/** 161 * \overload 162 */ 163extern void __attribute__((overloadable)) 164 rsForEach(rs_script script, rs_allocation input, rs_allocation output); 165#endif 166 167 168 169#undef _RS_RUNTIME 170 171#endif 172