blob: be900cb71f9cbde14f8ce614e25dbe43a3d2b43f [file] [log] [blame]
Jason Sams044e2ee2011-08-08 16:52:30 -07001/*
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 Sams1d526a42011-08-08 15:54:14 -070017/** @file rs_core.rsh
18 * \brief todo-jsams
19 *
20 * todo-jsams
21 *
22 */
Jason Sams044e2ee2011-08-08 16:52:30 -070023
Jason Sams275b1e92010-05-28 18:08:16 -070024#ifndef __RS_CORE_RSH__
25#define __RS_CORE_RSH__
26
Shih-wei Liao7a430312011-01-26 14:47:17 -080027#define _RS_RUNTIME extern
Stephen Hinesf6a28c62011-01-18 16:53:19 -080028
Jason Sams044e2ee2011-08-08 16:52:30 -070029#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 Liao9bb32e12010-10-07 18:21:32 -070040
Jason Sams09aeb8a2011-01-28 15:49:07 -080041
42/**
Jason Sams044e2ee2011-08-08 16:52:30 -070043 * 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 Sams09aeb8a2011-01-28 15:49:07 -080046 */
Jason Sams044e2ee2011-08-08 16:52:30 -070047extern bool __attribute__((overloadable))
48 rsSendToClient(int cmdID);
Jason Sams1d526a42011-08-08 15:54:14 -070049/**
50 * \overload
51 */
Jason Sams044e2ee2011-08-08 16:52:30 -070052extern bool __attribute__((overloadable))
53 rsSendToClient(int cmdID, const void *data, uint len);
Jason Sams1d526a42011-08-08 15:54:14 -070054/**
Jason Sams044e2ee2011-08-08 16:52:30 -070055 * Send a message back to the client, blocking until the message is queued.
56 * A message ID is required. Data payload is optional.
Jason Sams09aeb8a2011-01-28 15:49:07 -080057 */
Jason Sams693080e2011-01-25 21:33:44 -080058extern void __attribute__((overloadable))
Jason Sams044e2ee2011-08-08 16:52:30 -070059 rsSendToClientBlocking(int cmdID);
Jason Sams1d526a42011-08-08 15:54:14 -070060/**
61 * \overload
62 */
Jason Sams693080e2011-01-25 21:33:44 -080063extern void __attribute__((overloadable))
Jason Sams044e2ee2011-08-08 16:52:30 -070064 rsSendToClientBlocking(int cmdID, const void *data, uint len);
65
Jason Sams7fe6bce2010-06-24 13:54:11 -070066
Jason Sams1d526a42011-08-08 15:54:14 -070067/**
Jason Sams044e2ee2011-08-08 16:52:30 -070068 * 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 Sams1d526a42011-08-08 15:54:14 -070071 *
Jason Sams044e2ee2011-08-08 16:52:30 -070072 * This is a hint and implementations may not obey the order.
Jason Sams1d526a42011-08-08 15:54:14 -070073 */
Jason Sams044e2ee2011-08-08 16:52:30 -070074enum 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 Sams7fe6bce2010-06-24 13:54:11 -070083
Jason Sams1d526a42011-08-08 15:54:14 -070084/**
Jason Sams044e2ee2011-08-08 16:52:30 -070085 * 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
Jason Sams1d526a42011-08-08 15:54:14 -0700105 *
Jason Sams044e2ee2011-08-08 16:52:30 -0700106 * @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 Sams1d526a42011-08-08 15:54:14 -0700114 *
Jason Sams044e2ee2011-08-08 16:52:30 -0700115 * */
Jason Samseb0dfed2011-07-27 14:10:53 -0700116#if !defined(RS_VERSION) || (RS_VERSION < 14)
Jason Sams044e2ee2011-08-08 16:52:30 -0700117extern 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 Sams1d526a42011-08-08 15:54:14 -0700121/**
122 * \overload
123 */
Jason Sams044e2ee2011-08-08 16:52:30 -0700124extern void __attribute__((overloadable))
125 rsForEach(rs_script script, rs_allocation input,
126 rs_allocation output, const void * usrData);
Jason Samseb0dfed2011-07-27 14:10:53 -0700127#else
Jason Samseb0dfed2011-07-27 14:10:53 -0700128
Jason Sams1d526a42011-08-08 15:54:14 -0700129/**
Jason Sams044e2ee2011-08-08 16:52:30 -0700130 * 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/**
Jason Sams1d526a42011-08-08 15:54:14 -0700151 * \overload
152 */
Jason Sams044e2ee2011-08-08 16:52:30 -0700153extern void __attribute__((overloadable))
154 rsForEach(rs_script script, rs_allocation input, rs_allocation output,
155 const void * usrData, size_t usrDataLen);
Jason Sams1d526a42011-08-08 15:54:14 -0700156/**
157 * \overload
158 */
Jason Sams044e2ee2011-08-08 16:52:30 -0700159extern void __attribute__((overloadable))
160 rsForEach(rs_script script, rs_allocation input, rs_allocation output);
Jason Samseb0dfed2011-07-27 14:10:53 -0700161#endif
Jason Sams7fe6bce2010-06-24 13:54:11 -0700162
Jason Sams1d526a42011-08-08 15:54:14 -0700163
Jason Sams7fe6bce2010-06-24 13:54:11 -0700164
Shih-wei Liao7a430312011-01-26 14:47:17 -0800165#undef _RS_RUNTIME
Jason Sams275b1e92010-05-28 18:08:16 -0700166
167#endif