blob: b4070ac13992b8b53c92d0a39299beb52f7436bc [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 *
Jason Samsb9276ce2015-03-17 13:42:47 -070037 * A driver should return FALSE for any conditions that will
38 * prevent the driver from working normally.
39 *
40 *
Jason Sams0ca7cba2015-03-11 15:22:38 -070041 * If these are successful, the driver will be loaded and used
42 * normally. Teardown will use the normal
43 * context->mHal.funcs.shutdown() path. There will be no call
44 * to rsdHalAbort().
45 *
46 *
47 */
48
49
Jason Sams7ac2a4d2012-02-15 12:04:24 -080050struct ANativeWindow;
51
Jason Samsbad80742011-03-16 16:29:28 -070052namespace android {
53namespace renderscript {
54
55class Context;
56class ObjectBase;
57class Element;
58class Type;
59class Allocation;
60class Script;
Jason Samsdbe66d62012-09-17 13:54:41 -070061class ScriptKernelID;
62class ScriptFieldID;
63class ScriptMethodID;
Jason Samsbad80742011-03-16 16:29:28 -070064class ScriptC;
Jason Samsdbe66d62012-09-17 13:54:41 -070065class ScriptGroup;
Yang Ni1ffd86b2015-01-07 09:16:40 -080066class ScriptGroupBase;
Jason Sams9e0afb52011-10-31 13:23:43 -070067class Path;
Alex Sakhartchouk7f126c72011-05-05 16:56:27 -070068class Program;
Jason Sams8feea4e2011-03-18 15:03:25 -070069class ProgramStore;
Jason Sams721acc42011-04-06 11:23:54 -070070class ProgramRaster;
Alex Sakhartchouka04e30d2011-04-29 16:49:08 -070071class ProgramVertex;
72class ProgramFragment;
73class Mesh;
Alex Sakhartchouk7f126c72011-05-05 16:56:27 -070074class Sampler;
Alex Sakhartchoukda6d34a2011-05-13 14:53:34 -070075class FBOCache;
Jason Samsbad80742011-03-16 16:29:28 -070076
Jason Samsa36c50a2014-06-17 12:06:06 -070077/**
78 * Define the internal object types. This ia a mirror of the
79 * definition in rs_types.rsh except with the p value typed
80 * correctly.
81 *
82 * p = pointer to internal object implementation
83 * r = reserved by libRS runtime
84 * v1 = Mirror of p->mHal.drv
85 * v2 = reserved for use by vendor drivers
86 */
87
88#ifndef __LP64__
89#define RS_BASE_OBJ(_t_) typedef struct { const _t_* p; } __attribute__((packed, aligned(4)))
90#else
91#define RS_BASE_OBJ(_t_) typedef struct { const _t_* p; const void* r; const void* v1; const void* v2; }
92#endif
93
Jason Sams05ef73f2014-08-05 14:59:22 -070094RS_BASE_OBJ(ObjectBase) rs_object_base;
Jason Samsa36c50a2014-06-17 12:06:06 -070095RS_BASE_OBJ(Element) rs_element;
96RS_BASE_OBJ(Type) rs_type;
97RS_BASE_OBJ(Allocation) rs_allocation;
98RS_BASE_OBJ(Sampler) rs_sampler;
99RS_BASE_OBJ(Script) rs_script;
100RS_BASE_OBJ(ScriptGroup) rs_script_group;
101
102#ifndef __LP64__
103typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_mesh;
Jason Samsa36c50a2014-06-17 12:06:06 -0700104typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_fragment;
105typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_vertex;
106typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_raster;
107typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_store;
108typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_font;
109#endif // __LP64__
110
111
Jason Samsbad80742011-03-16 16:29:28 -0700112typedef void *(*RsHalSymbolLookupFunc)(void *usrptr, char const *symbolName);
113
Jason Samsbad80742011-03-16 16:29:28 -0700114/**
115 * Script management functions
116 */
117typedef struct {
Jason Sams4b3de472011-04-06 17:52:23 -0700118 bool (*initGraphics)(const Context *);
119 void (*shutdownGraphics)(const Context *);
Alex Sakhartchouk7257c7e2011-05-17 12:32:47 -0700120 bool (*setSurface)(const Context *, uint32_t w, uint32_t h, RsNativeWindow);
Jason Sams4b3de472011-04-06 17:52:23 -0700121 void (*swap)(const Context *);
122
Jason Samscdfdb8f2011-03-17 16:12:47 -0700123 void (*shutdownDriver)(Context *);
Jason Samscdfdb8f2011-03-17 16:12:47 -0700124 void (*setPriority)(const Context *, int32_t priority);
Jason Samsbad80742011-03-16 16:29:28 -0700125
Tim Murray34689382013-03-11 12:12:03 -0700126 void* (*allocRuntimeMem)(size_t size, uint32_t flags);
127 void (*freeRuntimeMem)(void* ptr);
Jason Samsbad80742011-03-16 16:29:28 -0700128
129 struct {
Jason Sams8feea4e2011-03-18 15:03:25 -0700130 bool (*init)(const Context *rsc, ScriptC *s,
131 char const *resName,
132 char const *cacheDir,
133 uint8_t const *bitcode,
134 size_t bitcodeSize,
Jason Sams87fe59a2011-04-20 15:09:01 -0700135 uint32_t flags);
Jason Sams8eaba4f2012-08-14 14:38:05 -0700136 bool (*initIntrinsic)(const Context *rsc, Script *s,
Stephen Hines41d6c762012-08-21 17:07:38 -0700137 RsScriptIntrinsicID iid,
Jason Sams8eaba4f2012-08-14 14:38:05 -0700138 Element *e);
Jason Samsbad80742011-03-16 16:29:28 -0700139
Jason Samscdfdb8f2011-03-17 16:12:47 -0700140 void (*invokeFunction)(const Context *rsc, Script *s,
Jason Samsbad80742011-03-16 16:29:28 -0700141 uint32_t slot,
142 const void *params,
143 size_t paramLength);
Jason Samscdfdb8f2011-03-17 16:12:47 -0700144 int (*invokeRoot)(const Context *rsc, Script *s);
145 void (*invokeForEach)(const Context *rsc,
146 Script *s,
Jason Sams35e429e2011-07-13 11:26:26 -0700147 uint32_t slot,
Jason Samscdfdb8f2011-03-17 16:12:47 -0700148 const Allocation * ain,
149 Allocation * aout,
150 const void * usr,
Tim Murray099bc262013-03-20 16:54:03 -0700151 size_t usrLen,
Jason Samscdfdb8f2011-03-17 16:12:47 -0700152 const RsScriptCall *sc);
153 void (*invokeInit)(const Context *rsc, Script *s);
Stephen Hines4ee16ff2011-08-31 17:41:39 -0700154 void (*invokeFreeChildren)(const Context *rsc, Script *s);
Jason Samsbad80742011-03-16 16:29:28 -0700155
156 void (*setGlobalVar)(const Context *rsc, const Script *s,
157 uint32_t slot,
158 void *data,
159 size_t dataLength);
Tim Murray9c642392013-04-11 13:29:59 -0700160 void (*getGlobalVar)(const Context *rsc, const Script *s,
161 uint32_t slot,
162 void *data,
163 size_t dataLength);
Stephen Hines2980f072012-04-09 18:26:29 -0700164 void (*setGlobalVarWithElemDims)(const Context *rsc, const Script *s,
165 uint32_t slot,
166 void *data,
167 size_t dataLength,
168 const Element *e,
Stephen Hinesac8d1462014-06-25 00:01:23 -0700169 const uint32_t *dims,
Stephen Hines2980f072012-04-09 18:26:29 -0700170 size_t dimLength);
Jason Samsbad80742011-03-16 16:29:28 -0700171 void (*setGlobalBind)(const Context *rsc, const Script *s,
172 uint32_t slot,
Jason Sams807fdc42012-07-25 17:55:39 -0700173 Allocation *data);
Jason Samsbad80742011-03-16 16:29:28 -0700174 void (*setGlobalObj)(const Context *rsc, const Script *s,
175 uint32_t slot,
176 ObjectBase *data);
177
178 void (*destroy)(const Context *rsc, Script *s);
Chris Wailes4b3c34e2014-06-11 12:00:29 -0700179 void (*invokeForEachMulti)(const Context *rsc,
180 Script *s,
181 uint32_t slot,
182 const Allocation ** ains,
183 size_t inLen,
184 Allocation * aout,
185 const void * usr,
186 size_t usrLen,
187 const RsScriptCall *sc);
Jason Samsa36c50a2014-06-17 12:06:06 -0700188 void (*updateCachedObject)(const Context *rsc, const Script *, rs_script *obj);
Jason Samsbad80742011-03-16 16:29:28 -0700189 } script;
190
Jason Sams8feea4e2011-03-18 15:03:25 -0700191 struct {
Jason Samseb4fe182011-05-26 16:33:01 -0700192 bool (*init)(const Context *rsc, Allocation *alloc, bool forceZero);
Jason Samsbc9dc272015-02-09 12:50:22 -0800193 bool (*initAdapter)(const Context *rsc, Allocation *alloc);
Jason Samseb4fe182011-05-26 16:33:01 -0700194 void (*destroy)(const Context *rsc, Allocation *alloc);
Jason Samsddceab92013-08-07 13:02:32 -0700195 uint32_t (*grallocBits)(const Context *rsc, Allocation *alloc);
Jason Samseb4fe182011-05-26 16:33:01 -0700196
197 void (*resize)(const Context *rsc, const Allocation *alloc, const Type *newType,
198 bool zeroNew);
199 void (*syncAll)(const Context *rsc, const Allocation *alloc, RsAllocationUsageType src);
200 void (*markDirty)(const Context *rsc, const Allocation *alloc);
Jason Sams7ac2a4d2012-02-15 12:04:24 -0800201
Jason Sams733396b2013-02-22 12:46:18 -0800202 void (*setSurface)(const Context *rsc, Allocation *alloc, ANativeWindow *sur);
Jason Sams7ac2a4d2012-02-15 12:04:24 -0800203 void (*ioSend)(const Context *rsc, Allocation *alloc);
Jason Samsddceab92013-08-07 13:02:32 -0700204
205 /**
206 * A new gralloc buffer is in use. The pointers and strides in
207 * mHal.drvState.lod[0-2] will be updated with the new values.
208 *
209 * The new gralloc handle is provided in mHal.state.nativeBuffer
210 *
211 */
Jason Sams7ac2a4d2012-02-15 12:04:24 -0800212 void (*ioReceive)(const Context *rsc, Allocation *alloc);
Jason Samseb4fe182011-05-26 16:33:01 -0700213
214 void (*data1D)(const Context *rsc, const Allocation *alloc,
Tim Murray099bc262013-03-20 16:54:03 -0700215 uint32_t xoff, uint32_t lod, size_t count,
Alex Sakhartchoukc794cd52012-02-13 11:57:32 -0800216 const void *data, size_t sizeBytes);
Jason Samseb4fe182011-05-26 16:33:01 -0700217 void (*data2D)(const Context *rsc, const Allocation *alloc,
218 uint32_t xoff, uint32_t yoff, uint32_t lod,
219 RsAllocationCubemapFace face, uint32_t w, uint32_t h,
Tim Murray358747a2012-11-26 13:52:04 -0800220 const void *data, size_t sizeBytes, size_t stride);
Jason Samseb4fe182011-05-26 16:33:01 -0700221 void (*data3D)(const Context *rsc, const Allocation *alloc,
Jason Sams3bbc0fd2013-04-09 14:16:13 -0700222 uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod,
223 uint32_t w, uint32_t h, uint32_t d, const void *data, size_t sizeBytes,
224 size_t stride);
Jason Samseb4fe182011-05-26 16:33:01 -0700225
Jason Sams807fdc42012-07-25 17:55:39 -0700226 void (*read1D)(const Context *rsc, const Allocation *alloc,
Tim Murray099bc262013-03-20 16:54:03 -0700227 uint32_t xoff, uint32_t lod, size_t count,
Jason Sams807fdc42012-07-25 17:55:39 -0700228 void *data, size_t sizeBytes);
229 void (*read2D)(const Context *rsc, const Allocation *alloc,
230 uint32_t xoff, uint32_t yoff, uint32_t lod,
231 RsAllocationCubemapFace face, uint32_t w, uint32_t h,
Tim Murray358747a2012-11-26 13:52:04 -0800232 void *data, size_t sizeBytes, size_t stride);
Jason Sams807fdc42012-07-25 17:55:39 -0700233 void (*read3D)(const Context *rsc, const Allocation *alloc,
Jason Sams3bbc0fd2013-04-09 14:16:13 -0700234 uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod,
235 uint32_t w, uint32_t h, uint32_t d, void *data, size_t sizeBytes,
236 size_t stride);
Jason Sams807fdc42012-07-25 17:55:39 -0700237
238 // Lock and unlock make a 1D region of memory available to the CPU
239 // for direct access by pointer. Once unlock is called control is
240 // returned to the SOC driver.
241 void * (*lock1D)(const Context *rsc, const Allocation *alloc);
242 void (*unlock1D)(const Context *rsc, const Allocation *alloc);
243
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700244 // Allocation to allocation copies
245 void (*allocData1D)(const Context *rsc,
246 const Allocation *dstAlloc,
Tim Murray099bc262013-03-20 16:54:03 -0700247 uint32_t dstXoff, uint32_t dstLod, size_t count,
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700248 const Allocation *srcAlloc, uint32_t srcXoff, uint32_t srcLod);
249 void (*allocData2D)(const Context *rsc,
250 const Allocation *dstAlloc,
251 uint32_t dstXoff, uint32_t dstYoff, uint32_t dstLod,
252 RsAllocationCubemapFace dstFace, uint32_t w, uint32_t h,
253 const Allocation *srcAlloc,
254 uint32_t srcXoff, uint32_t srcYoff, uint32_t srcLod,
255 RsAllocationCubemapFace srcFace);
256 void (*allocData3D)(const Context *rsc,
257 const Allocation *dstAlloc,
258 uint32_t dstXoff, uint32_t dstYoff, uint32_t dstZoff,
Jason Sams3bbc0fd2013-04-09 14:16:13 -0700259 uint32_t dstLod,
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700260 uint32_t w, uint32_t h, uint32_t d,
261 const Allocation *srcAlloc,
262 uint32_t srcXoff, uint32_t srcYoff, uint32_t srcZoff,
Jason Sams3bbc0fd2013-04-09 14:16:13 -0700263 uint32_t srcLod);
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700264
Miao Wangcc8cea72015-02-19 18:14:46 -0800265 void (*elementData)(const Context *rsc, const Allocation *alloc,
266 uint32_t x, uint32_t y, uint32_t z,
267 const void *data, uint32_t elementOff, size_t sizeBytes);
268 void (*elementRead)(const Context *rsc, const Allocation *alloc,
269 uint32_t x, uint32_t y, uint32_t z,
270 void *data, uint32_t elementOff, size_t sizeBytes);
Jason Samseb4fe182011-05-26 16:33:01 -0700271
Jason Sams61a4bb72012-07-25 19:33:43 -0700272 void (*generateMipmaps)(const Context *rsc, const Allocation *alloc);
Jason Samsa36c50a2014-06-17 12:06:06 -0700273
274 void (*updateCachedObject)(const Context *rsc, const Allocation *alloc, rs_allocation *obj);
Jason Samsbc9dc272015-02-09 12:50:22 -0800275
276 void (*adapterOffset)(const Context *rsc, const Allocation *alloc);
Jason Samseb4fe182011-05-26 16:33:01 -0700277 } allocation;
278
279 struct {
Jason Sams8feea4e2011-03-18 15:03:25 -0700280 bool (*init)(const Context *rsc, const ProgramStore *ps);
281 void (*setActive)(const Context *rsc, const ProgramStore *ps);
282 void (*destroy)(const Context *rsc, const ProgramStore *ps);
283 } store;
284
Jason Sams721acc42011-04-06 11:23:54 -0700285 struct {
286 bool (*init)(const Context *rsc, const ProgramRaster *ps);
287 void (*setActive)(const Context *rsc, const ProgramRaster *ps);
288 void (*destroy)(const Context *rsc, const ProgramRaster *ps);
289 } raster;
Jason Sams8feea4e2011-03-18 15:03:25 -0700290
Alex Sakhartchouka04e30d2011-04-29 16:49:08 -0700291 struct {
292 bool (*init)(const Context *rsc, const ProgramVertex *pv,
Alex Sakhartchouk748eb072012-02-15 16:21:46 -0800293 const char* shader, size_t shaderLen,
294 const char** textureNames, size_t textureNamesCount,
295 const size_t *textureNamesLength);
Alex Sakhartchouka04e30d2011-04-29 16:49:08 -0700296 void (*setActive)(const Context *rsc, const ProgramVertex *pv);
297 void (*destroy)(const Context *rsc, const ProgramVertex *pv);
298 } vertex;
299
300 struct {
301 bool (*init)(const Context *rsc, const ProgramFragment *pf,
Alex Sakhartchouk748eb072012-02-15 16:21:46 -0800302 const char* shader, size_t shaderLen,
303 const char** textureNames, size_t textureNamesCount,
304 const size_t *textureNamesLength);
Alex Sakhartchouka04e30d2011-04-29 16:49:08 -0700305 void (*setActive)(const Context *rsc, const ProgramFragment *pf);
306 void (*destroy)(const Context *rsc, const ProgramFragment *pf);
307 } fragment;
308
309 struct {
310 bool (*init)(const Context *rsc, const Mesh *m);
311 void (*draw)(const Context *rsc, const Mesh *m, uint32_t primIndex, uint32_t start, uint32_t len);
312 void (*destroy)(const Context *rsc, const Mesh *m);
313 } mesh;
Jason Samsbad80742011-03-16 16:29:28 -0700314
Alex Sakhartchouk7f126c72011-05-05 16:56:27 -0700315 struct {
316 bool (*init)(const Context *rsc, const Sampler *m);
317 void (*destroy)(const Context *rsc, const Sampler *m);
Jason Samsa36c50a2014-06-17 12:06:06 -0700318 void (*updateCachedObject)(const Context *rsc, const Sampler *s, rs_sampler *obj);
Alex Sakhartchouk7f126c72011-05-05 16:56:27 -0700319 } sampler;
320
Alex Sakhartchoukda6d34a2011-05-13 14:53:34 -0700321 struct {
322 bool (*init)(const Context *rsc, const FBOCache *fb);
323 void (*setActive)(const Context *rsc, const FBOCache *fb);
324 void (*destroy)(const Context *rsc, const FBOCache *fb);
325 } framebuffer;
326
Jason Samsdbe66d62012-09-17 13:54:41 -0700327 struct {
Yang Ni1ffd86b2015-01-07 09:16:40 -0800328 bool (*init)(const Context *rsc, ScriptGroupBase *sg);
Jason Samsdbe66d62012-09-17 13:54:41 -0700329 void (*setInput)(const Context *rsc, const ScriptGroup *sg,
330 const ScriptKernelID *kid, Allocation *);
331 void (*setOutput)(const Context *rsc, const ScriptGroup *sg,
332 const ScriptKernelID *kid, Allocation *);
Yang Ni1ffd86b2015-01-07 09:16:40 -0800333 void (*execute)(const Context *rsc, const ScriptGroupBase *sg);
334 void (*destroy)(const Context *rsc, const ScriptGroupBase *sg);
Jason Samsa36c50a2014-06-17 12:06:06 -0700335 void (*updateCachedObject)(const Context *rsc, const ScriptGroup *sg, rs_script_group *obj);
Jason Samsdbe66d62012-09-17 13:54:41 -0700336 } scriptgroup;
337
Jason Samsa36c50a2014-06-17 12:06:06 -0700338 struct {
339 bool (*init)(const Context *rsc, const Type *m);
340 void (*destroy)(const Context *rsc, const Type *m);
341 void (*updateCachedObject)(const Context *rsc, const Type *s, rs_type *obj);
342 } type;
343
344 struct {
345 bool (*init)(const Context *rsc, const Element *m);
346 void (*destroy)(const Context *rsc, const Element *m);
347 void (*updateCachedObject)(const Context *rsc, const Element *s, rs_element *obj);
348 } element;
349
Jason Sams9761c3f2013-11-26 18:10:59 -0800350 void (*finish)(const Context *rsc);
Jason Samsbad80742011-03-16 16:29:28 -0700351} RsdHalFunctions;
352
Jason Samsbad80742011-03-16 16:29:28 -0700353
Jason Sams0ca7cba2015-03-11 15:22:38 -0700354enum RsHalInitEnums {
355 RS_HAL_CORE_SHUTDOWN = 1,
356 RS_HAL_CORE_SET_PRIORITY = 2,
357 RS_HAL_CORE_ALLOC_RUNTIME_MEM = 3,
358 RS_HAL_CORE_FREE_RUNTIME_MEM = 4,
359 RS_HAL_CORE_FINISH = 5,
360
361 RS_HAL_SCRIPT_INIT = 1000,
362 RS_HAL_SCRIPT_INIT_INTRINSIC = 1001,
363 RS_HAL_SCRIPT_INVOKE_FUNCTION = 1002,
364 RS_HAL_SCRIPT_INVOKE_ROOT = 1003,
365 RS_HAL_SCRIPT_INVOKE_FOR_EACH = 1004,
366 RS_HAL_SCRIPT_INVOKE_INIT = 1005,
367 RS_HAL_SCRIPT_INVOKE_FREE_CHILDREN = 1006,
368 RS_HAL_SCRIPT_SET_GLOBAL_VAR = 1007,
369 RS_HAL_SCRIPT_GET_GLOBAL_VAR = 1008,
370 RS_HAL_SCRIPT_SET_GLOBAL_VAR_WITH_ELEMENT_DIM = 1009,
371 RS_HAL_SCRIPT_SET_GLOBAL_BIND = 1010,
372 RS_HAL_SCRIPT_SET_GLOBAL_OBJECT = 1011,
373 RS_HAL_SCRIPT_DESTROY = 1012,
374 RS_HAL_SCRIPT_INVOKE_FOR_EACH_MULTI = 1013,
375 RS_HAL_SCRIPT_UPDATE_CACHED_OBJECT = 1014,
376
377 RS_HAL_ALLOCATION_INIT = 2000,
378 RS_HAL_ALLOCATION_INIT_ADAPTER = 2001,
379 RS_HAL_ALLOCATION_DESTROY = 2002,
380 RS_HAL_ALLOCATION_GET_GRALLOC_BITS = 2003,
381 RS_HAL_ALLOCATION_RESIZE = 2004,
382 RS_HAL_ALLOCATION_SYNC_ALL = 2005,
383 RS_HAL_ALLOCATION_MARK_DIRTY = 2006,
384 RS_HAL_ALLOCATION_SET_SURFACE = 2007,
385 RS_HAL_ALLOCATION_IO_SEND = 2008,
386 RS_HAL_ALLOCATION_IO_RECEIVE = 2009,
387 RS_HAL_ALLOCATION_DATA_1D = 2010,
388 RS_HAL_ALLOCATION_DATA_2D = 2011,
389 RS_HAL_ALLOCATION_DATA_3D = 2012,
390 RS_HAL_ALLOCATION_READ_1D = 2013,
391 RS_HAL_ALLOCATION_READ_2D = 2014,
392 RS_HAL_ALLOCATION_READ_3D = 2015,
393 RS_HAL_ALLOCATION_LOCK_1D = 2016,
394 RS_HAL_ALLOCATION_UNLOCK_1D = 2017,
395 RS_HAL_ALLOCATION_COPY_1D = 2018,
396 RS_HAL_ALLOCATION_COPY_2D = 2019,
397 RS_HAL_ALLOCATION_COPY_3D = 2020,
398 RS_HAL_ALLOCATION_ELEMENT_DATA = 2021,
399 RS_HAL_ALLOCATION_ELEMENT_READ = 2022,
400 RS_HAL_ALLOCATION_GENERATE_MIPMAPS = 2023,
401 RS_HAL_ALLOCATION_UPDATE_CACHED_OBJECT = 2024,
402 RS_HAL_ALLOCATION_ADAPTER_OFFSET = 2025,
403
404 RS_HAL_SAMPLER_INIT = 3000,
405 RS_HAL_SAMPLER_DESTROY = 3001,
406 RS_HAL_SAMPLER_UPDATE_CACHED_OBJECT = 3002,
407
408 RS_HAL_TYPE_INIT = 4000,
409 RS_HAL_TYPE_DESTROY = 4001,
410 RS_HAL_TYPE_UPDATE_CACHED_OBJECT = 4002,
411
412 RS_HAL_ELEMENT_INIT = 5000,
413 RS_HAL_ELEMENT_DESTROY = 5001,
414 RS_HAL_ELEMENT_UPDATE_CACHED_OBJECT = 5002,
415
416 RS_HAL_SCRIPT_GROUP_INIT = 6000,
417 RS_HAL_SCRIPT_GROUP_DESTROY = 6001,
418 RS_HAL_SCRIPT_GROUP_UPDATE_CACHED_OBJECT = 6002,
419 RS_HAL_SCRIPT_GROUP_SET_INPUT = 6003,
420 RS_HAL_SCRIPT_GROUP_SET_OUTPUT = 6004,
421 RS_HAL_SCRIPT_GROUP_EXECUTE = 6005,
422
423
424
425 RS_HAL_GRAPHICS_INIT = 100001,
426 RS_HAL_GRAPHICS_SHUTDOWN = 100002,
427 RS_HAL_GRAPHICS_SWAP = 100003,
428 RS_HAL_GRAPHICS_SET_SURFACE = 100004,
429 RS_HAL_GRAPHICS_RASTER_INIT = 101000,
430 RS_HAL_GRAPHICS_RASTER_SET_ACTIVE = 101001,
431 RS_HAL_GRAPHICS_RASTER_DESTROY = 101002,
432 RS_HAL_GRAPHICS_VERTEX_INIT = 102000,
433 RS_HAL_GRAPHICS_VERTEX_SET_ACTIVE = 102001,
434 RS_HAL_GRAPHICS_VERTEX_DESTROY = 102002,
435 RS_HAL_GRAPHICS_FRAGMENT_INIT = 103000,
436 RS_HAL_GRAPHICS_FRAGMENT_SET_ACTIVE = 103001,
437 RS_HAL_GRAPHICS_FRAGMENT_DESTROY = 103002,
438 RS_HAL_GRAPHICS_MESH_INIT = 104000,
439 RS_HAL_GRAPHICS_MESH_DRAW = 104001,
440 RS_HAL_GRAPHICS_MESH_DESTROY = 104002,
441 RS_HAL_GRAPHICS_FB_INIT = 105000,
442 RS_HAL_GRAPHICS_FB_SET_ACTIVE = 105001,
443 RS_HAL_GRAPHICS_FB_DESTROY = 105002,
444 RS_HAL_GRAPHICS_STORE_INIT = 106000,
445 RS_HAL_GRAPHICS_STORE_SET_ACTIVE = 106001,
446 RS_HAL_GRAPHICS_STORE_DESTROY = 106002,
447};
448
Jason Samsbad80742011-03-16 16:29:28 -0700449}
450}
451
Stephen Hines414a4612012-09-05 18:05:08 -0700452#ifdef __cplusplus
453extern "C" {
454#endif
Jason Samsbad80742011-03-16 16:29:28 -0700455
Jason Sams0ca7cba2015-03-11 15:22:38 -0700456/**
457 * Get the major version number of the driver. The major
458 * version should be the API version number
459 *
460 * The Minor version number is vendor specific
461 *
462 * return: False will abort loading the driver, true indicates
463 * success
464 */
465bool rsdHalQueryVersion(uint32_t *version_major, uint32_t *version_minor);
466
467
468/**
469 * Get an entry point in the driver HAL
470 *
471 * The driver should set the function pointer to its
472 * implementation of the function. If it does not have an entry
473 * for an enum, its should set the function pointer to NULL
474 *
Jason Samsb9276ce2015-03-17 13:42:47 -0700475 * Returning NULL is expected in cases during development as new
476 * entry points are added that a driver may not understand. If
477 * the runtime receives a NULL it will decide if the function is
478 * required and will either continue loading or abort as needed.
479 *
480 *
Jason Sams0ca7cba2015-03-11 15:22:38 -0700481 * return: False will abort loading the driver, true indicates
482 * success
Jason Samsb9276ce2015-03-17 13:42:47 -0700483 *
Jason Sams0ca7cba2015-03-11 15:22:38 -0700484 */
485bool rsdHalQueryHal(android::renderscript::RsHalInitEnums entry, void **fnPtr);
486
487
488/**
489 * Called to initialize the context for use with a driver.
490 *
491 * return: False will abort loading the driver, true indicates
492 * success
493 */
Stephen Hines414a4612012-09-05 18:05:08 -0700494bool rsdHalInit(RsContext, uint32_t version_major, uint32_t version_minor);
495
Jason Sams0ca7cba2015-03-11 15:22:38 -0700496/**
497 * Called if one of the loading functions above returns false.
498 * This is to clean up any resources allocated during an error
499 * condition. If this path is called it means the normal
500 * context->mHal.funcs.shutdown() will not be called.
501 */
502void rsdHalAbort(RsContext);
503
Stephen Hines414a4612012-09-05 18:05:08 -0700504#ifdef __cplusplus
505}
506#endif
Jason Samsbad80742011-03-16 16:29:28 -0700507
508#endif