rs_core.rsh revision 197fc09254eace8d2625c23c192487e376b39d35
1/*
2 * Copyright (C) 2011-2012 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 /*! \mainpage notitle
18  *
19  * RenderScript is a high-performance runtime that provides
20  * compute operations at the native level. RenderScript code is compiled on devices
21  * at runtime to allow platform-independence as well.
22  * This reference documentation describes the RenderScript runtime APIs, which you
23  * can utilize to write RenderScript code in C99. The RenderScript compute header
24  * files are automatically included for you.
25  *
26  * To use RenderScript, you need to utilize the RenderScript runtime APIs documented here
27  * as well as the Android framework APIs for RenderScript.
28  * For documentation on the Android framework APIs, see the <a target="_parent" href=
29  * "http://developer.android.com/reference/android/renderscript/package-summary.html">
30  * android.renderscript</a> package reference.
31  * For more information on how to develop with RenderScript and how the runtime and
32  * Android framework APIs interact, see the <a target="_parent" href=
33  * "http://developer.android.com/guide/topics/renderscript/index.html">RenderScript
34  * developer guide</a> and the <a target="_parent" href=
35  * "http://developer.android.com/resources/samples/RenderScript/index.html">
36  * RenderScript samples</a>.
37  */
38
39/** @file rs_core.rsh
40 *  \brief todo-jsams
41 *
42 *  todo-jsams
43 *
44 */
45
46#ifndef __RS_CORE_RSH__
47#define __RS_CORE_RSH__
48
49#define _RS_RUNTIME extern
50
51#include "rs_types.rsh"
52#include "rs_allocation.rsh"
53#include "rs_atomic.rsh"
54#include "rs_cl.rsh"
55#include "rs_debug.rsh"
56#include "rs_element.rsh"
57#include "rs_math.rsh"
58#include "rs_matrix.rsh"
59#include "rs_object.rsh"
60#include "rs_quaternion.rsh"
61#include "rs_sampler.rsh"
62#include "rs_time.rsh"
63#include "rs_idct.rsh"
64#include "rs_dct.rsh"
65#include "rs_iadst.rsh"
66#include "rs_fadst.rsh"
67#include "rs_walsh.rsh"
68
69/**
70 * Send a message back to the client.  Will not block and returns true
71 * if the message was sendable and false if the fifo was full.
72 * A message ID is required.  Data payload is optional.
73 */
74extern bool __attribute__((overloadable))
75    rsSendToClient(int cmdID);
76/**
77 * \overload
78 */
79extern bool __attribute__((overloadable))
80    rsSendToClient(int cmdID, const void *data, uint len);
81/**
82 * Send a message back to the client, blocking until the message is queued.
83 * A message ID is required.  Data payload is optional.
84 */
85extern void __attribute__((overloadable))
86    rsSendToClientBlocking(int cmdID);
87/**
88 * \overload
89 */
90extern void __attribute__((overloadable))
91    rsSendToClientBlocking(int cmdID, const void *data, uint len);
92
93
94/**
95 * Launch order hint for rsForEach calls.  This provides a hint to the system to
96 * determine in which order the root function of the target is called with each
97 * cell of the allocation.
98 *
99 * This is a hint and implementations may not obey the order.
100 */
101enum rs_for_each_strategy {
102    RS_FOR_EACH_STRATEGY_SERIAL = 0,
103    RS_FOR_EACH_STRATEGY_DONT_CARE = 1,
104    RS_FOR_EACH_STRATEGY_DST_LINEAR = 2,
105    RS_FOR_EACH_STRATEGY_TILE_SMALL= 3,
106    RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4,
107    RS_FOR_EACH_STRATEGY_TILE_LARGE = 5
108};
109
110
111/**
112 * Structure to provide extra information to a rsForEach call.  Primarly used to
113 * restrict the call to a subset of cells in the allocation.
114 */
115typedef struct rs_script_call {
116    enum rs_for_each_strategy strategy;
117    uint32_t xStart;
118    uint32_t xEnd;
119    uint32_t yStart;
120    uint32_t yEnd;
121    uint32_t zStart;
122    uint32_t zEnd;
123    uint32_t arrayStart;
124    uint32_t arrayEnd;
125} rs_script_call_t;
126
127/**
128 * Make a script to script call to launch work. One of the input or output is
129 * required to be a valid object. The input and output must be of the same
130 * dimensions.
131 * API 10-13
132 *
133 * @param script The target script to call
134 * @param input The allocation to source data from
135 * @param output the allocation to write date into
136 * @param usrData The user definied params to pass to the root script.  May be
137 *                NULL.
138 * @param sc Extra control infomation used to select a sub-region of the
139 *           allocation to be processed or suggest a walking strategy.  May be
140 *           NULL.
141 *
142 *  */
143#if !defined(RS_VERSION) || (RS_VERSION < 14)
144extern void __attribute__((overloadable))
145    rsForEach(rs_script script, rs_allocation input,
146              rs_allocation output, const void * usrData,
147              const rs_script_call_t *sc);
148/**
149 * \overload
150 */
151extern void __attribute__((overloadable))
152    rsForEach(rs_script script, rs_allocation input,
153              rs_allocation output, const void * usrData);
154#else
155
156/**
157 * Make a script to script call to launch work. One of the input or output is
158 * required to be a valid object. The input and output must be of the same
159 * dimensions.
160 * API 14+
161 *
162 * @param script The target script to call
163 * @param input The allocation to source data from
164 * @param output the allocation to write date into
165 * @param usrData The user definied params to pass to the root script.  May be
166 *                NULL.
167 * @param usrDataLen The size of the userData structure.  This will be used to
168 *                   perform a shallow copy of the data if necessary.
169 * @param sc Extra control infomation used to select a sub-region of the
170 *           allocation to be processed or suggest a walking strategy.  May be
171 *           NULL.
172 *
173 */
174extern void __attribute__((overloadable))
175    rsForEach(rs_script script, rs_allocation input, rs_allocation output,
176              const void * usrData, size_t usrDataLen, const rs_script_call_t *);
177/**
178 * \overload
179 */
180extern void __attribute__((overloadable))
181    rsForEach(rs_script script, rs_allocation input, rs_allocation output,
182              const void * usrData, size_t usrDataLen);
183/**
184 * \overload
185 */
186extern void __attribute__((overloadable))
187    rsForEach(rs_script script, rs_allocation input, rs_allocation output);
188#endif
189
190
191
192#undef _RS_RUNTIME
193
194#endif
195