blob: f8e9e4b3543f0daec4e586aa36c9dc514b355840 [file] [log] [blame]
Jason Samsbad80742011-03-16 16:29:28 -07001/*
Stephen Hines2980f072012-04-09 18:26:29 -07002 * Copyright (C) 2011-2012 The Android Open Source Project
Jason Samsbad80742011-03-16 16:29:28 -07003 *
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#ifndef RS_HAL_H
18#define RS_HAL_H
19
Jason Sams66f0a162014-11-11 13:46:38 -080020#include <rsInternalDefines.h>
Jason Samsbad80742011-03-16 16:29:28 -070021
Jason Sams0ca7cba2015-03-11 15:22:38 -070022/**
23 * The interface for loading RenderScript drivers
24 *
25 * The startup sequence is
26 *
27 * 1: dlopen driver
28 * 2: Query driver version with rsdHalQueryVersion()
29 * 3: Fill in HAL pointer table with calls to rsdHalQueryHAL()
30 * 4: Initialize the context with rsdHalInit()
31 *
32 * If any of these functions return false, the loading of the
33 * driver will abort and the reference driver will be used.
34 * rsdHalAbort() will be called to clean up any partially
35 * allocated state.
36 *
37 * If these are successful, the driver will be loaded and used
38 * normally. Teardown will use the normal
39 * context->mHal.funcs.shutdown() path. There will be no call
40 * to rsdHalAbort().
41 *
42 *
43 */
44
45
Jason Sams7ac2a4d2012-02-15 12:04:24 -080046struct ANativeWindow;
47
Jason Samsbad80742011-03-16 16:29:28 -070048namespace android {
49namespace renderscript {
50
51class Context;
52class ObjectBase;
53class Element;
54class Type;
55class Allocation;
56class Script;
Jason Samsdbe66d62012-09-17 13:54:41 -070057class ScriptKernelID;
58class ScriptFieldID;
59class ScriptMethodID;
Jason Samsbad80742011-03-16 16:29:28 -070060class ScriptC;
Jason Samsdbe66d62012-09-17 13:54:41 -070061class ScriptGroup;
Yang Ni1ffd86b2015-01-07 09:16:40 -080062class ScriptGroupBase;
Jason Sams9e0afb52011-10-31 13:23:43 -070063class Path;
Alex Sakhartchouk7f126c72011-05-05 16:56:27 -070064class Program;
Jason Sams8feea4e2011-03-18 15:03:25 -070065class ProgramStore;
Jason Sams721acc42011-04-06 11:23:54 -070066class ProgramRaster;
Alex Sakhartchouka04e30d2011-04-29 16:49:08 -070067class ProgramVertex;
68class ProgramFragment;
69class Mesh;
Alex Sakhartchouk7f126c72011-05-05 16:56:27 -070070class Sampler;
Alex Sakhartchoukda6d34a2011-05-13 14:53:34 -070071class FBOCache;
Jason Samsbad80742011-03-16 16:29:28 -070072
Jason Samsa36c50a2014-06-17 12:06:06 -070073/**
74 * Define the internal object types. This ia a mirror of the
75 * definition in rs_types.rsh except with the p value typed
76 * correctly.
77 *
78 * p = pointer to internal object implementation
79 * r = reserved by libRS runtime
80 * v1 = Mirror of p->mHal.drv
81 * v2 = reserved for use by vendor drivers
82 */
83
84#ifndef __LP64__
85#define RS_BASE_OBJ(_t_) typedef struct { const _t_* p; } __attribute__((packed, aligned(4)))
86#else
87#define RS_BASE_OBJ(_t_) typedef struct { const _t_* p; const void* r; const void* v1; const void* v2; }
88#endif
89
Jason Sams05ef73f2014-08-05 14:59:22 -070090RS_BASE_OBJ(ObjectBase) rs_object_base;
Jason Samsa36c50a2014-06-17 12:06:06 -070091RS_BASE_OBJ(Element) rs_element;
92RS_BASE_OBJ(Type) rs_type;
93RS_BASE_OBJ(Allocation) rs_allocation;
94RS_BASE_OBJ(Sampler) rs_sampler;
95RS_BASE_OBJ(Script) rs_script;
96RS_BASE_OBJ(ScriptGroup) rs_script_group;
97
98#ifndef __LP64__
99typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_mesh;
100typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_path;
101typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_fragment;
102typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_vertex;
103typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_raster;
104typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_store;
105typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_font;
106#endif // __LP64__
107
108
Jason Samsbad80742011-03-16 16:29:28 -0700109typedef void *(*RsHalSymbolLookupFunc)(void *usrptr, char const *symbolName);
110
Jason Samsbad80742011-03-16 16:29:28 -0700111/**
112 * Script management functions
113 */
114typedef struct {
Jason Sams4b3de472011-04-06 17:52:23 -0700115 bool (*initGraphics)(const Context *);
116 void (*shutdownGraphics)(const Context *);
Alex Sakhartchouk7257c7e2011-05-17 12:32:47 -0700117 bool (*setSurface)(const Context *, uint32_t w, uint32_t h, RsNativeWindow);
Jason Sams4b3de472011-04-06 17:52:23 -0700118 void (*swap)(const Context *);
119
Jason Samscdfdb8f2011-03-17 16:12:47 -0700120 void (*shutdownDriver)(Context *);
Jason Samscdfdb8f2011-03-17 16:12:47 -0700121 void (*setPriority)(const Context *, int32_t priority);
Jason Samsbad80742011-03-16 16:29:28 -0700122
Tim Murray34689382013-03-11 12:12:03 -0700123 void* (*allocRuntimeMem)(size_t size, uint32_t flags);
124 void (*freeRuntimeMem)(void* ptr);
Jason Samsbad80742011-03-16 16:29:28 -0700125
126 struct {
Jason Sams8feea4e2011-03-18 15:03:25 -0700127 bool (*init)(const Context *rsc, ScriptC *s,
128 char const *resName,
129 char const *cacheDir,
130 uint8_t const *bitcode,
131 size_t bitcodeSize,
Jason Sams87fe59a2011-04-20 15:09:01 -0700132 uint32_t flags);
Jason Sams8eaba4f2012-08-14 14:38:05 -0700133 bool (*initIntrinsic)(const Context *rsc, Script *s,
Stephen Hines41d6c762012-08-21 17:07:38 -0700134 RsScriptIntrinsicID iid,
Jason Sams8eaba4f2012-08-14 14:38:05 -0700135 Element *e);
Jason Samsbad80742011-03-16 16:29:28 -0700136
Jason Samscdfdb8f2011-03-17 16:12:47 -0700137 void (*invokeFunction)(const Context *rsc, Script *s,
Jason Samsbad80742011-03-16 16:29:28 -0700138 uint32_t slot,
139 const void *params,
140 size_t paramLength);
Jason Samscdfdb8f2011-03-17 16:12:47 -0700141 int (*invokeRoot)(const Context *rsc, Script *s);
142 void (*invokeForEach)(const Context *rsc,
143 Script *s,
Jason Sams35e429e2011-07-13 11:26:26 -0700144 uint32_t slot,
Jason Samscdfdb8f2011-03-17 16:12:47 -0700145 const Allocation * ain,
146 Allocation * aout,
147 const void * usr,
Tim Murray099bc262013-03-20 16:54:03 -0700148 size_t usrLen,
Jason Samscdfdb8f2011-03-17 16:12:47 -0700149 const RsScriptCall *sc);
150 void (*invokeInit)(const Context *rsc, Script *s);
Stephen Hines4ee16ff2011-08-31 17:41:39 -0700151 void (*invokeFreeChildren)(const Context *rsc, Script *s);
Jason Samsbad80742011-03-16 16:29:28 -0700152
153 void (*setGlobalVar)(const Context *rsc, const Script *s,
154 uint32_t slot,
155 void *data,
156 size_t dataLength);
Tim Murray9c642392013-04-11 13:29:59 -0700157 void (*getGlobalVar)(const Context *rsc, const Script *s,
158 uint32_t slot,
159 void *data,
160 size_t dataLength);
Stephen Hines2980f072012-04-09 18:26:29 -0700161 void (*setGlobalVarWithElemDims)(const Context *rsc, const Script *s,
162 uint32_t slot,
163 void *data,
164 size_t dataLength,
165 const Element *e,
Stephen Hinesac8d1462014-06-25 00:01:23 -0700166 const uint32_t *dims,
Stephen Hines2980f072012-04-09 18:26:29 -0700167 size_t dimLength);
Jason Samsbad80742011-03-16 16:29:28 -0700168 void (*setGlobalBind)(const Context *rsc, const Script *s,
169 uint32_t slot,
Jason Sams807fdc42012-07-25 17:55:39 -0700170 Allocation *data);
Jason Samsbad80742011-03-16 16:29:28 -0700171 void (*setGlobalObj)(const Context *rsc, const Script *s,
172 uint32_t slot,
173 ObjectBase *data);
174
175 void (*destroy)(const Context *rsc, Script *s);
Chris Wailes4b3c34e2014-06-11 12:00:29 -0700176 void (*invokeForEachMulti)(const Context *rsc,
177 Script *s,
178 uint32_t slot,
179 const Allocation ** ains,
180 size_t inLen,
181 Allocation * aout,
182 const void * usr,
183 size_t usrLen,
184 const RsScriptCall *sc);
Jason Samsa36c50a2014-06-17 12:06:06 -0700185 void (*updateCachedObject)(const Context *rsc, const Script *, rs_script *obj);
Jason Samsbad80742011-03-16 16:29:28 -0700186 } script;
187
Jason Sams8feea4e2011-03-18 15:03:25 -0700188 struct {
Jason Samseb4fe182011-05-26 16:33:01 -0700189 bool (*init)(const Context *rsc, Allocation *alloc, bool forceZero);
Jason Samsbc9dc272015-02-09 12:50:22 -0800190 bool (*initAdapter)(const Context *rsc, Allocation *alloc);
Jason Samseb4fe182011-05-26 16:33:01 -0700191 void (*destroy)(const Context *rsc, Allocation *alloc);
Jason Samsddceab92013-08-07 13:02:32 -0700192 uint32_t (*grallocBits)(const Context *rsc, Allocation *alloc);
Jason Samseb4fe182011-05-26 16:33:01 -0700193
194 void (*resize)(const Context *rsc, const Allocation *alloc, const Type *newType,
195 bool zeroNew);
196 void (*syncAll)(const Context *rsc, const Allocation *alloc, RsAllocationUsageType src);
197 void (*markDirty)(const Context *rsc, const Allocation *alloc);
Jason Sams7ac2a4d2012-02-15 12:04:24 -0800198
Jason Sams733396b2013-02-22 12:46:18 -0800199 void (*setSurface)(const Context *rsc, Allocation *alloc, ANativeWindow *sur);
Jason Sams7ac2a4d2012-02-15 12:04:24 -0800200 void (*ioSend)(const Context *rsc, Allocation *alloc);
Jason Samsddceab92013-08-07 13:02:32 -0700201
202 /**
203 * A new gralloc buffer is in use. The pointers and strides in
204 * mHal.drvState.lod[0-2] will be updated with the new values.
205 *
206 * The new gralloc handle is provided in mHal.state.nativeBuffer
207 *
208 */
Jason Sams7ac2a4d2012-02-15 12:04:24 -0800209 void (*ioReceive)(const Context *rsc, Allocation *alloc);
Jason Samseb4fe182011-05-26 16:33:01 -0700210
211 void (*data1D)(const Context *rsc, const Allocation *alloc,
Tim Murray099bc262013-03-20 16:54:03 -0700212 uint32_t xoff, uint32_t lod, size_t count,
Alex Sakhartchoukc794cd52012-02-13 11:57:32 -0800213 const void *data, size_t sizeBytes);
Jason Samseb4fe182011-05-26 16:33:01 -0700214 void (*data2D)(const Context *rsc, const Allocation *alloc,
215 uint32_t xoff, uint32_t yoff, uint32_t lod,
216 RsAllocationCubemapFace face, uint32_t w, uint32_t h,
Tim Murray358747a2012-11-26 13:52:04 -0800217 const void *data, size_t sizeBytes, size_t stride);
Jason Samseb4fe182011-05-26 16:33:01 -0700218 void (*data3D)(const Context *rsc, const Allocation *alloc,
Jason Sams3bbc0fd2013-04-09 14:16:13 -0700219 uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod,
220 uint32_t w, uint32_t h, uint32_t d, const void *data, size_t sizeBytes,
221 size_t stride);
Jason Samseb4fe182011-05-26 16:33:01 -0700222
Jason Sams807fdc42012-07-25 17:55:39 -0700223 void (*read1D)(const Context *rsc, const Allocation *alloc,
Tim Murray099bc262013-03-20 16:54:03 -0700224 uint32_t xoff, uint32_t lod, size_t count,
Jason Sams807fdc42012-07-25 17:55:39 -0700225 void *data, size_t sizeBytes);
226 void (*read2D)(const Context *rsc, const Allocation *alloc,
227 uint32_t xoff, uint32_t yoff, uint32_t lod,
228 RsAllocationCubemapFace face, uint32_t w, uint32_t h,
Tim Murray358747a2012-11-26 13:52:04 -0800229 void *data, size_t sizeBytes, size_t stride);
Jason Sams807fdc42012-07-25 17:55:39 -0700230 void (*read3D)(const Context *rsc, const Allocation *alloc,
Jason Sams3bbc0fd2013-04-09 14:16:13 -0700231 uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod,
232 uint32_t w, uint32_t h, uint32_t d, void *data, size_t sizeBytes,
233 size_t stride);
Jason Sams807fdc42012-07-25 17:55:39 -0700234
235 // Lock and unlock make a 1D region of memory available to the CPU
236 // for direct access by pointer. Once unlock is called control is
237 // returned to the SOC driver.
238 void * (*lock1D)(const Context *rsc, const Allocation *alloc);
239 void (*unlock1D)(const Context *rsc, const Allocation *alloc);
240
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700241 // Allocation to allocation copies
242 void (*allocData1D)(const Context *rsc,
243 const Allocation *dstAlloc,
Tim Murray099bc262013-03-20 16:54:03 -0700244 uint32_t dstXoff, uint32_t dstLod, size_t count,
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700245 const Allocation *srcAlloc, uint32_t srcXoff, uint32_t srcLod);
246 void (*allocData2D)(const Context *rsc,
247 const Allocation *dstAlloc,
248 uint32_t dstXoff, uint32_t dstYoff, uint32_t dstLod,
249 RsAllocationCubemapFace dstFace, uint32_t w, uint32_t h,
250 const Allocation *srcAlloc,
251 uint32_t srcXoff, uint32_t srcYoff, uint32_t srcLod,
252 RsAllocationCubemapFace srcFace);
253 void (*allocData3D)(const Context *rsc,
254 const Allocation *dstAlloc,
255 uint32_t dstXoff, uint32_t dstYoff, uint32_t dstZoff,
Jason Sams3bbc0fd2013-04-09 14:16:13 -0700256 uint32_t dstLod,
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700257 uint32_t w, uint32_t h, uint32_t d,
258 const Allocation *srcAlloc,
259 uint32_t srcXoff, uint32_t srcYoff, uint32_t srcZoff,
Jason Sams3bbc0fd2013-04-09 14:16:13 -0700260 uint32_t srcLod);
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700261
Miao Wangcc8cea72015-02-19 18:14:46 -0800262 void (*elementData)(const Context *rsc, const Allocation *alloc,
263 uint32_t x, uint32_t y, uint32_t z,
264 const void *data, uint32_t elementOff, size_t sizeBytes);
265 void (*elementRead)(const Context *rsc, const Allocation *alloc,
266 uint32_t x, uint32_t y, uint32_t z,
267 void *data, uint32_t elementOff, size_t sizeBytes);
Jason Samseb4fe182011-05-26 16:33:01 -0700268
Jason Sams61a4bb72012-07-25 19:33:43 -0700269 void (*generateMipmaps)(const Context *rsc, const Allocation *alloc);
Jason Samsa36c50a2014-06-17 12:06:06 -0700270
271 void (*updateCachedObject)(const Context *rsc, const Allocation *alloc, rs_allocation *obj);
Jason Samsbc9dc272015-02-09 12:50:22 -0800272
273 void (*adapterOffset)(const Context *rsc, const Allocation *alloc);
Jason Samseb4fe182011-05-26 16:33:01 -0700274 } allocation;
275
276 struct {
Jason Sams8feea4e2011-03-18 15:03:25 -0700277 bool (*init)(const Context *rsc, const ProgramStore *ps);
278 void (*setActive)(const Context *rsc, const ProgramStore *ps);
279 void (*destroy)(const Context *rsc, const ProgramStore *ps);
280 } store;
281
Jason Sams721acc42011-04-06 11:23:54 -0700282 struct {
283 bool (*init)(const Context *rsc, const ProgramRaster *ps);
284 void (*setActive)(const Context *rsc, const ProgramRaster *ps);
285 void (*destroy)(const Context *rsc, const ProgramRaster *ps);
286 } raster;
Jason Sams8feea4e2011-03-18 15:03:25 -0700287
Alex Sakhartchouka04e30d2011-04-29 16:49:08 -0700288 struct {
289 bool (*init)(const Context *rsc, const ProgramVertex *pv,
Alex Sakhartchouk748eb072012-02-15 16:21:46 -0800290 const char* shader, size_t shaderLen,
291 const char** textureNames, size_t textureNamesCount,
292 const size_t *textureNamesLength);
Alex Sakhartchouka04e30d2011-04-29 16:49:08 -0700293 void (*setActive)(const Context *rsc, const ProgramVertex *pv);
294 void (*destroy)(const Context *rsc, const ProgramVertex *pv);
295 } vertex;
296
297 struct {
298 bool (*init)(const Context *rsc, const ProgramFragment *pf,
Alex Sakhartchouk748eb072012-02-15 16:21:46 -0800299 const char* shader, size_t shaderLen,
300 const char** textureNames, size_t textureNamesCount,
301 const size_t *textureNamesLength);
Alex Sakhartchouka04e30d2011-04-29 16:49:08 -0700302 void (*setActive)(const Context *rsc, const ProgramFragment *pf);
303 void (*destroy)(const Context *rsc, const ProgramFragment *pf);
304 } fragment;
305
306 struct {
307 bool (*init)(const Context *rsc, const Mesh *m);
308 void (*draw)(const Context *rsc, const Mesh *m, uint32_t primIndex, uint32_t start, uint32_t len);
309 void (*destroy)(const Context *rsc, const Mesh *m);
310 } mesh;
Jason Samsbad80742011-03-16 16:29:28 -0700311
Alex Sakhartchouk7f126c72011-05-05 16:56:27 -0700312 struct {
313 bool (*init)(const Context *rsc, const Sampler *m);
314 void (*destroy)(const Context *rsc, const Sampler *m);
Jason Samsa36c50a2014-06-17 12:06:06 -0700315 void (*updateCachedObject)(const Context *rsc, const Sampler *s, rs_sampler *obj);
Alex Sakhartchouk7f126c72011-05-05 16:56:27 -0700316 } sampler;
317
Alex Sakhartchoukda6d34a2011-05-13 14:53:34 -0700318 struct {
319 bool (*init)(const Context *rsc, const FBOCache *fb);
320 void (*setActive)(const Context *rsc, const FBOCache *fb);
321 void (*destroy)(const Context *rsc, const FBOCache *fb);
322 } framebuffer;
323
Jason Samsdbe66d62012-09-17 13:54:41 -0700324 struct {
Yang Ni1ffd86b2015-01-07 09:16:40 -0800325 bool (*init)(const Context *rsc, ScriptGroupBase *sg);
Jason Samsdbe66d62012-09-17 13:54:41 -0700326 void (*setInput)(const Context *rsc, const ScriptGroup *sg,
327 const ScriptKernelID *kid, Allocation *);
328 void (*setOutput)(const Context *rsc, const ScriptGroup *sg,
329 const ScriptKernelID *kid, Allocation *);
Yang Ni1ffd86b2015-01-07 09:16:40 -0800330 void (*execute)(const Context *rsc, const ScriptGroupBase *sg);
331 void (*destroy)(const Context *rsc, const ScriptGroupBase *sg);
Jason Samsa36c50a2014-06-17 12:06:06 -0700332 void (*updateCachedObject)(const Context *rsc, const ScriptGroup *sg, rs_script_group *obj);
Jason Samsdbe66d62012-09-17 13:54:41 -0700333 } scriptgroup;
334
Jason Samsa36c50a2014-06-17 12:06:06 -0700335 struct {
336 bool (*init)(const Context *rsc, const Type *m);
337 void (*destroy)(const Context *rsc, const Type *m);
338 void (*updateCachedObject)(const Context *rsc, const Type *s, rs_type *obj);
339 } type;
340
341 struct {
342 bool (*init)(const Context *rsc, const Element *m);
343 void (*destroy)(const Context *rsc, const Element *m);
344 void (*updateCachedObject)(const Context *rsc, const Element *s, rs_element *obj);
345 } element;
346
Jason Sams9761c3f2013-11-26 18:10:59 -0800347 void (*finish)(const Context *rsc);
Jason Samsbad80742011-03-16 16:29:28 -0700348} RsdHalFunctions;
349
Jason Samsbad80742011-03-16 16:29:28 -0700350
Jason Sams0ca7cba2015-03-11 15:22:38 -0700351enum RsHalInitEnums {
352 RS_HAL_CORE_SHUTDOWN = 1,
353 RS_HAL_CORE_SET_PRIORITY = 2,
354 RS_HAL_CORE_ALLOC_RUNTIME_MEM = 3,
355 RS_HAL_CORE_FREE_RUNTIME_MEM = 4,
356 RS_HAL_CORE_FINISH = 5,
357
358 RS_HAL_SCRIPT_INIT = 1000,
359 RS_HAL_SCRIPT_INIT_INTRINSIC = 1001,
360 RS_HAL_SCRIPT_INVOKE_FUNCTION = 1002,
361 RS_HAL_SCRIPT_INVOKE_ROOT = 1003,
362 RS_HAL_SCRIPT_INVOKE_FOR_EACH = 1004,
363 RS_HAL_SCRIPT_INVOKE_INIT = 1005,
364 RS_HAL_SCRIPT_INVOKE_FREE_CHILDREN = 1006,
365 RS_HAL_SCRIPT_SET_GLOBAL_VAR = 1007,
366 RS_HAL_SCRIPT_GET_GLOBAL_VAR = 1008,
367 RS_HAL_SCRIPT_SET_GLOBAL_VAR_WITH_ELEMENT_DIM = 1009,
368 RS_HAL_SCRIPT_SET_GLOBAL_BIND = 1010,
369 RS_HAL_SCRIPT_SET_GLOBAL_OBJECT = 1011,
370 RS_HAL_SCRIPT_DESTROY = 1012,
371 RS_HAL_SCRIPT_INVOKE_FOR_EACH_MULTI = 1013,
372 RS_HAL_SCRIPT_UPDATE_CACHED_OBJECT = 1014,
373
374 RS_HAL_ALLOCATION_INIT = 2000,
375 RS_HAL_ALLOCATION_INIT_ADAPTER = 2001,
376 RS_HAL_ALLOCATION_DESTROY = 2002,
377 RS_HAL_ALLOCATION_GET_GRALLOC_BITS = 2003,
378 RS_HAL_ALLOCATION_RESIZE = 2004,
379 RS_HAL_ALLOCATION_SYNC_ALL = 2005,
380 RS_HAL_ALLOCATION_MARK_DIRTY = 2006,
381 RS_HAL_ALLOCATION_SET_SURFACE = 2007,
382 RS_HAL_ALLOCATION_IO_SEND = 2008,
383 RS_HAL_ALLOCATION_IO_RECEIVE = 2009,
384 RS_HAL_ALLOCATION_DATA_1D = 2010,
385 RS_HAL_ALLOCATION_DATA_2D = 2011,
386 RS_HAL_ALLOCATION_DATA_3D = 2012,
387 RS_HAL_ALLOCATION_READ_1D = 2013,
388 RS_HAL_ALLOCATION_READ_2D = 2014,
389 RS_HAL_ALLOCATION_READ_3D = 2015,
390 RS_HAL_ALLOCATION_LOCK_1D = 2016,
391 RS_HAL_ALLOCATION_UNLOCK_1D = 2017,
392 RS_HAL_ALLOCATION_COPY_1D = 2018,
393 RS_HAL_ALLOCATION_COPY_2D = 2019,
394 RS_HAL_ALLOCATION_COPY_3D = 2020,
395 RS_HAL_ALLOCATION_ELEMENT_DATA = 2021,
396 RS_HAL_ALLOCATION_ELEMENT_READ = 2022,
397 RS_HAL_ALLOCATION_GENERATE_MIPMAPS = 2023,
398 RS_HAL_ALLOCATION_UPDATE_CACHED_OBJECT = 2024,
399 RS_HAL_ALLOCATION_ADAPTER_OFFSET = 2025,
400
401 RS_HAL_SAMPLER_INIT = 3000,
402 RS_HAL_SAMPLER_DESTROY = 3001,
403 RS_HAL_SAMPLER_UPDATE_CACHED_OBJECT = 3002,
404
405 RS_HAL_TYPE_INIT = 4000,
406 RS_HAL_TYPE_DESTROY = 4001,
407 RS_HAL_TYPE_UPDATE_CACHED_OBJECT = 4002,
408
409 RS_HAL_ELEMENT_INIT = 5000,
410 RS_HAL_ELEMENT_DESTROY = 5001,
411 RS_HAL_ELEMENT_UPDATE_CACHED_OBJECT = 5002,
412
413 RS_HAL_SCRIPT_GROUP_INIT = 6000,
414 RS_HAL_SCRIPT_GROUP_DESTROY = 6001,
415 RS_HAL_SCRIPT_GROUP_UPDATE_CACHED_OBJECT = 6002,
416 RS_HAL_SCRIPT_GROUP_SET_INPUT = 6003,
417 RS_HAL_SCRIPT_GROUP_SET_OUTPUT = 6004,
418 RS_HAL_SCRIPT_GROUP_EXECUTE = 6005,
419
420
421
422 RS_HAL_GRAPHICS_INIT = 100001,
423 RS_HAL_GRAPHICS_SHUTDOWN = 100002,
424 RS_HAL_GRAPHICS_SWAP = 100003,
425 RS_HAL_GRAPHICS_SET_SURFACE = 100004,
426 RS_HAL_GRAPHICS_RASTER_INIT = 101000,
427 RS_HAL_GRAPHICS_RASTER_SET_ACTIVE = 101001,
428 RS_HAL_GRAPHICS_RASTER_DESTROY = 101002,
429 RS_HAL_GRAPHICS_VERTEX_INIT = 102000,
430 RS_HAL_GRAPHICS_VERTEX_SET_ACTIVE = 102001,
431 RS_HAL_GRAPHICS_VERTEX_DESTROY = 102002,
432 RS_HAL_GRAPHICS_FRAGMENT_INIT = 103000,
433 RS_HAL_GRAPHICS_FRAGMENT_SET_ACTIVE = 103001,
434 RS_HAL_GRAPHICS_FRAGMENT_DESTROY = 103002,
435 RS_HAL_GRAPHICS_MESH_INIT = 104000,
436 RS_HAL_GRAPHICS_MESH_DRAW = 104001,
437 RS_HAL_GRAPHICS_MESH_DESTROY = 104002,
438 RS_HAL_GRAPHICS_FB_INIT = 105000,
439 RS_HAL_GRAPHICS_FB_SET_ACTIVE = 105001,
440 RS_HAL_GRAPHICS_FB_DESTROY = 105002,
441 RS_HAL_GRAPHICS_STORE_INIT = 106000,
442 RS_HAL_GRAPHICS_STORE_SET_ACTIVE = 106001,
443 RS_HAL_GRAPHICS_STORE_DESTROY = 106002,
444};
445
Jason Samsbad80742011-03-16 16:29:28 -0700446}
447}
448
Stephen Hines414a4612012-09-05 18:05:08 -0700449#ifdef __cplusplus
450extern "C" {
451#endif
Jason Samsbad80742011-03-16 16:29:28 -0700452
Jason Sams0ca7cba2015-03-11 15:22:38 -0700453/**
454 * Get the major version number of the driver. The major
455 * version should be the API version number
456 *
457 * The Minor version number is vendor specific
458 *
459 * return: False will abort loading the driver, true indicates
460 * success
461 */
462bool rsdHalQueryVersion(uint32_t *version_major, uint32_t *version_minor);
463
464
465/**
466 * Get an entry point in the driver HAL
467 *
468 * The driver should set the function pointer to its
469 * implementation of the function. If it does not have an entry
470 * for an enum, its should set the function pointer to NULL
471 *
472 * return: False will abort loading the driver, true indicates
473 * success
474 */
475bool rsdHalQueryHal(android::renderscript::RsHalInitEnums entry, void **fnPtr);
476
477
478/**
479 * Called to initialize the context for use with a driver.
480 *
481 * return: False will abort loading the driver, true indicates
482 * success
483 */
Stephen Hines414a4612012-09-05 18:05:08 -0700484bool rsdHalInit(RsContext, uint32_t version_major, uint32_t version_minor);
485
Jason Sams0ca7cba2015-03-11 15:22:38 -0700486/**
487 * Called if one of the loading functions above returns false.
488 * This is to clean up any resources allocated during an error
489 * condition. If this path is called it means the normal
490 * context->mHal.funcs.shutdown() will not be called.
491 */
492void rsdHalAbort(RsContext);
493
Stephen Hines414a4612012-09-05 18:05:08 -0700494#ifdef __cplusplus
495}
496#endif
Jason Samsbad80742011-03-16 16:29:28 -0700497
498#endif