rs_hal.h revision 8e70791ff732ce244077310bdfdaf75dc19baabc
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#ifndef RS_HAL_H
18#define RS_HAL_H
19
20#include <rsInternalDefines.h>
21
22/*
23 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
24 * !! Major version number of the driver.  This is used to ensure that
25 * !! the driver (e.g., libRSDriver) is compatible with the shell
26 * !! (i.e., libRS_internal) responsible for loading the driver.
27 * !! There is no notion of backwards compatibility -- the driver and
28 * !! the shell must agree on the major version number.
29 * !!
30 * !! The version number must change whenever there is a semantic change
31 * !! to the HAL such as adding or removing an entry point or changing
32 * !! the meaning of an entry point.  By convention it is monotonically
33 * !! increasing across all branches (e.g., aosp/master and all internal
34 * !! branches).
35 * !!
36 * !! Be very careful when merging or cherry picking between branches!
37 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
38 */
39#define RS_HAL_VERSION 100
40
41/**
42 * The interface for loading RenderScript drivers
43 *
44 * The startup sequence is
45 *
46 * 1: dlopen driver
47 * 2: Query driver version with rsdHalQueryVersion() and verify
48 *    that the driver (e.g., libRSDriver) is compatible with the shell
49 *    (i.e., libRS_internal) responsible for loading the driver
50 * 3: Fill in HAL pointer table with calls to rsdHalQueryHAL()
51 * 4: Initialize the context with rsdHalInit()
52 *
53 * If any of these functions return false, the loading of the
54 * driver will abort and the reference driver will be used.
55 * rsdHalAbort() will be called to clean up any partially
56 * allocated state.
57 *
58 * A driver should return FALSE for any conditions that will
59 * prevent the driver from working normally.
60 *
61 *
62 * If these are successful, the driver will be loaded and used
63 * normally.  Teardown will use the normal
64 * context->mHal.funcs.shutdown() path.  There will be no call
65 * to rsdHalAbort().
66 *
67 *
68 */
69
70
71struct ANativeWindow;
72
73namespace android {
74namespace renderscript {
75
76class Context;
77class ObjectBase;
78class Element;
79class Type;
80class Allocation;
81class Script;
82class ScriptKernelID;
83class ScriptFieldID;
84class ScriptMethodID;
85class ScriptC;
86class ScriptGroup;
87class ScriptGroupBase;
88class Path;
89class Program;
90class ProgramStore;
91class ProgramRaster;
92class ProgramVertex;
93class ProgramFragment;
94class Mesh;
95class Sampler;
96class FBOCache;
97
98/**
99 * Define the internal object types.  This ia a mirror of the
100 * definition in rs_types.rsh except with the p value typed
101 * correctly.
102 *
103 * p = pointer to internal object implementation
104 * r = reserved by libRS runtime
105 * v1 = Mirror of p->mHal.drv
106 * v2 = reserved for use by vendor drivers
107 */
108
109#ifndef __LP64__
110#define RS_BASE_OBJ(_t_) typedef struct { const _t_* p; } __attribute__((packed, aligned(4)))
111#else
112#define RS_BASE_OBJ(_t_) typedef struct { const _t_* p; const void* r; const void* v1; const void* v2; }
113#endif
114
115RS_BASE_OBJ(ObjectBase) rs_object_base;
116RS_BASE_OBJ(Element) rs_element;
117RS_BASE_OBJ(Type) rs_type;
118RS_BASE_OBJ(Allocation) rs_allocation;
119RS_BASE_OBJ(Sampler) rs_sampler;
120RS_BASE_OBJ(Script) rs_script;
121RS_BASE_OBJ(ScriptGroup) rs_script_group;
122
123#ifndef __LP64__
124typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_mesh;
125typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_fragment;
126typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_vertex;
127typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_raster;
128typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_store;
129typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_font;
130#endif // __LP64__
131
132
133typedef void *(*RsHalSymbolLookupFunc)(void *usrptr, char const *symbolName);
134
135/**
136 * Script management functions
137 */
138typedef struct {
139    bool (*initGraphics)(const Context *);
140    void (*shutdownGraphics)(const Context *);
141    bool (*setSurface)(const Context *, uint32_t w, uint32_t h, RsNativeWindow);
142    void (*swap)(const Context *);
143
144    void (*shutdownDriver)(Context *);
145    void (*setPriority)(const Context *, int32_t priority);
146
147    void* (*allocRuntimeMem)(size_t size, uint32_t flags);
148    void (*freeRuntimeMem)(void* ptr);
149
150    struct {
151        bool (*init)(const Context *rsc, ScriptC *s,
152                     char const *resName,
153                     char const *cacheDir,
154                     uint8_t const *bitcode,
155                     size_t bitcodeSize,
156                     uint32_t flags);
157        bool (*initIntrinsic)(const Context *rsc, Script *s,
158                              RsScriptIntrinsicID iid,
159                              Element *e);
160
161        void (*invokeFunction)(const Context *rsc, Script *s,
162                               uint32_t slot,
163                               const void *params,
164                               size_t paramLength);
165        int (*invokeRoot)(const Context *rsc, Script *s);
166        void (*invokeForEach)(const Context *rsc,
167                              Script *s,
168                              uint32_t slot,
169                              const Allocation * ain,
170                              Allocation * aout,
171                              const void * usr,
172                              size_t usrLen,
173                              const RsScriptCall *sc);
174        void (*invokeReduce)(const Context *rsc, Script *s,
175                             uint32_t slot, const Allocation *ain,
176                             Allocation *aout,
177                             const RsScriptCall *sc);
178        void (*invokeReduceNew)(const Context *rsc, Script *s,
179                                uint32_t slot,
180                                const Allocation ** ains, size_t inLen,
181                                Allocation *aout,
182                                const RsScriptCall *sc);
183        void (*invokeInit)(const Context *rsc, Script *s);
184        void (*invokeFreeChildren)(const Context *rsc, Script *s);
185
186        void (*setGlobalVar)(const Context *rsc, const Script *s,
187                             uint32_t slot,
188                             void *data,
189                             size_t dataLength);
190        void (*getGlobalVar)(const Context *rsc, const Script *s,
191                             uint32_t slot,
192                             void *data,
193                             size_t dataLength);
194        void (*setGlobalVarWithElemDims)(const Context *rsc, const Script *s,
195                                         uint32_t slot,
196                                         void *data,
197                                         size_t dataLength,
198                                         const Element *e,
199                                         const uint32_t *dims,
200                                         size_t dimLength);
201        void (*setGlobalBind)(const Context *rsc, const Script *s,
202                              uint32_t slot,
203                              Allocation *data);
204        void (*setGlobalObj)(const Context *rsc, const Script *s,
205                             uint32_t slot,
206                             ObjectBase *data);
207
208        void (*destroy)(const Context *rsc, Script *s);
209        void (*invokeForEachMulti)(const Context *rsc,
210                                   Script *s,
211                                   uint32_t slot,
212                                   const Allocation ** ains,
213                                   size_t inLen,
214                                   Allocation * aout,
215                                   const void * usr,
216                                   size_t usrLen,
217                                   const RsScriptCall *sc);
218        void (*updateCachedObject)(const Context *rsc, const Script *, rs_script *obj);
219    } script;
220
221    struct {
222        bool (*init)(const Context *rsc, Allocation *alloc, bool forceZero);
223        bool (*initOem)(const Context *rsc, Allocation *alloc, bool forceZero, void *usrPtr);
224        bool (*initAdapter)(const Context *rsc, Allocation *alloc);
225        void (*destroy)(const Context *rsc, Allocation *alloc);
226        uint32_t (*grallocBits)(const Context *rsc, Allocation *alloc);
227
228        void (*resize)(const Context *rsc, const Allocation *alloc, const Type *newType,
229                       bool zeroNew);
230        void (*syncAll)(const Context *rsc, const Allocation *alloc, RsAllocationUsageType src);
231        void (*markDirty)(const Context *rsc, const Allocation *alloc);
232
233        void (*setSurface)(const Context *rsc, Allocation *alloc, ANativeWindow *sur);
234        void (*ioSend)(const Context *rsc, Allocation *alloc);
235
236        /**
237         * A new gralloc buffer is in use. The pointers and strides in
238         * mHal.drvState.lod[0-2] will be updated with the new values.
239         *
240         * The new gralloc handle is provided in mHal.state.nativeBuffer
241         *
242         */
243        void (*ioReceive)(const Context *rsc, Allocation *alloc);
244
245        void (*data1D)(const Context *rsc, const Allocation *alloc,
246                       uint32_t xoff, uint32_t lod, size_t count,
247                       const void *data, size_t sizeBytes);
248        void (*data2D)(const Context *rsc, const Allocation *alloc,
249                       uint32_t xoff, uint32_t yoff, uint32_t lod,
250                       RsAllocationCubemapFace face, uint32_t w, uint32_t h,
251                       const void *data, size_t sizeBytes, size_t stride);
252        void (*data3D)(const Context *rsc, const Allocation *alloc,
253                       uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod,
254                       uint32_t w, uint32_t h, uint32_t d, const void *data, size_t sizeBytes,
255                       size_t stride);
256
257        void (*read1D)(const Context *rsc, const Allocation *alloc,
258                       uint32_t xoff, uint32_t lod, size_t count,
259                       void *data, size_t sizeBytes);
260        void (*read2D)(const Context *rsc, const Allocation *alloc,
261                       uint32_t xoff, uint32_t yoff, uint32_t lod,
262                       RsAllocationCubemapFace face, uint32_t w, uint32_t h,
263                       void *data, size_t sizeBytes, size_t stride);
264        void (*read3D)(const Context *rsc, const Allocation *alloc,
265                       uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod,
266                       uint32_t w, uint32_t h, uint32_t d, void *data, size_t sizeBytes,
267                       size_t stride);
268
269        // Lock and unlock make a 1D region of memory available to the CPU
270        // for direct access by pointer.  Once unlock is called control is
271        // returned to the SOC driver.
272        void * (*lock1D)(const Context *rsc, const Allocation *alloc);
273        void (*unlock1D)(const Context *rsc, const Allocation *alloc);
274
275        // Allocation to allocation copies
276        void (*allocData1D)(const Context *rsc,
277                            const Allocation *dstAlloc,
278                            uint32_t dstXoff, uint32_t dstLod, size_t count,
279                            const Allocation *srcAlloc, uint32_t srcXoff, uint32_t srcLod);
280        void (*allocData2D)(const Context *rsc,
281                            const Allocation *dstAlloc,
282                            uint32_t dstXoff, uint32_t dstYoff, uint32_t dstLod,
283                            RsAllocationCubemapFace dstFace, uint32_t w, uint32_t h,
284                            const Allocation *srcAlloc,
285                            uint32_t srcXoff, uint32_t srcYoff, uint32_t srcLod,
286                            RsAllocationCubemapFace srcFace);
287        void (*allocData3D)(const Context *rsc,
288                            const Allocation *dstAlloc,
289                            uint32_t dstXoff, uint32_t dstYoff, uint32_t dstZoff,
290                            uint32_t dstLod,
291                            uint32_t w, uint32_t h, uint32_t d,
292                            const Allocation *srcAlloc,
293                            uint32_t srcXoff, uint32_t srcYoff, uint32_t srcZoff,
294                            uint32_t srcLod);
295
296        void (*elementData)(const Context *rsc, const Allocation *alloc,
297                            uint32_t x, uint32_t y, uint32_t z,
298                            const void *data, uint32_t elementOff, size_t sizeBytes);
299        void (*elementRead)(const Context *rsc, const Allocation *alloc,
300                            uint32_t x, uint32_t y, uint32_t z,
301                            void *data, uint32_t elementOff, size_t sizeBytes);
302
303        void (*generateMipmaps)(const Context *rsc, const Allocation *alloc);
304
305        void (*updateCachedObject)(const Context *rsc, const Allocation *alloc, rs_allocation *obj);
306
307        void (*adapterOffset)(const Context *rsc, const Allocation *alloc);
308
309        void (*getPointer)(const Context *rsc, const Allocation *alloc,
310                           uint32_t lod, RsAllocationCubemapFace face,
311                           uint32_t z, uint32_t array);
312#ifdef RS_COMPATIBILITY_LIB
313        bool (*initStrided)(const Context *rsc, Allocation *alloc, bool forceZero, size_t requiredAlignment);
314#endif
315    } allocation;
316
317    struct {
318        bool (*init)(const Context *rsc, const ProgramStore *ps);
319        void (*setActive)(const Context *rsc, const ProgramStore *ps);
320        void (*destroy)(const Context *rsc, const ProgramStore *ps);
321    } store;
322
323    struct {
324        bool (*init)(const Context *rsc, const ProgramRaster *ps);
325        void (*setActive)(const Context *rsc, const ProgramRaster *ps);
326        void (*destroy)(const Context *rsc, const ProgramRaster *ps);
327    } raster;
328
329    struct {
330        bool (*init)(const Context *rsc, const ProgramVertex *pv,
331                     const char* shader, size_t shaderLen,
332                     const char** textureNames, size_t textureNamesCount,
333                     const size_t *textureNamesLength);
334        void (*setActive)(const Context *rsc, const ProgramVertex *pv);
335        void (*destroy)(const Context *rsc, const ProgramVertex *pv);
336    } vertex;
337
338    struct {
339        bool (*init)(const Context *rsc, const ProgramFragment *pf,
340                     const char* shader, size_t shaderLen,
341                     const char** textureNames, size_t textureNamesCount,
342                     const size_t *textureNamesLength);
343        void (*setActive)(const Context *rsc, const ProgramFragment *pf);
344        void (*destroy)(const Context *rsc, const ProgramFragment *pf);
345    } fragment;
346
347    struct {
348        bool (*init)(const Context *rsc, const Mesh *m);
349        void (*draw)(const Context *rsc, const Mesh *m, uint32_t primIndex, uint32_t start, uint32_t len);
350        void (*destroy)(const Context *rsc, const Mesh *m);
351    } mesh;
352
353    struct {
354        bool (*init)(const Context *rsc, const Sampler *m);
355        void (*destroy)(const Context *rsc, const Sampler *m);
356        void (*updateCachedObject)(const Context *rsc, const Sampler *s, rs_sampler *obj);
357    } sampler;
358
359    struct {
360        bool (*init)(const Context *rsc, const FBOCache *fb);
361        void (*setActive)(const Context *rsc, const FBOCache *fb);
362        void (*destroy)(const Context *rsc, const FBOCache *fb);
363    } framebuffer;
364
365    struct {
366        bool (*init)(const Context *rsc, ScriptGroupBase *sg);
367        void (*setInput)(const Context *rsc, const ScriptGroup *sg,
368                         const ScriptKernelID *kid, Allocation *);
369        void (*setOutput)(const Context *rsc, const ScriptGroup *sg,
370                          const ScriptKernelID *kid, Allocation *);
371        void (*execute)(const Context *rsc, const ScriptGroupBase *sg);
372        void (*destroy)(const Context *rsc, const ScriptGroupBase *sg);
373        void (*updateCachedObject)(const Context *rsc, const ScriptGroup *sg, rs_script_group *obj);
374    } scriptgroup;
375
376    struct {
377        bool (*init)(const Context *rsc, const Type *m);
378        void (*destroy)(const Context *rsc, const Type *m);
379        void (*updateCachedObject)(const Context *rsc, const Type *s, rs_type *obj);
380    } type;
381
382    struct {
383        bool (*init)(const Context *rsc, const Element *m);
384        void (*destroy)(const Context *rsc, const Element *m);
385        void (*updateCachedObject)(const Context *rsc, const Element *s, rs_element *obj);
386    } element;
387
388    void (*finish)(const Context *rsc);
389} RsdHalFunctions;
390
391
392enum RsHalInitEnums {
393    RS_HAL_CORE_SHUTDOWN                                    = 1,
394    RS_HAL_CORE_SET_PRIORITY                                = 2,
395    RS_HAL_CORE_ALLOC_RUNTIME_MEM                           = 3,
396    RS_HAL_CORE_FREE_RUNTIME_MEM                            = 4,
397    RS_HAL_CORE_FINISH                                      = 5,
398
399    RS_HAL_SCRIPT_INIT                                      = 1000,
400    RS_HAL_SCRIPT_INIT_INTRINSIC                            = 1001,
401    RS_HAL_SCRIPT_INVOKE_FUNCTION                           = 1002,
402    RS_HAL_SCRIPT_INVOKE_ROOT                               = 1003,
403    RS_HAL_SCRIPT_INVOKE_FOR_EACH                           = 1004,
404    RS_HAL_SCRIPT_INVOKE_INIT                               = 1005,
405    RS_HAL_SCRIPT_INVOKE_FREE_CHILDREN                      = 1006,
406    RS_HAL_SCRIPT_SET_GLOBAL_VAR                            = 1007,
407    RS_HAL_SCRIPT_GET_GLOBAL_VAR                            = 1008,
408    RS_HAL_SCRIPT_SET_GLOBAL_VAR_WITH_ELEMENT_DIM           = 1009,
409    RS_HAL_SCRIPT_SET_GLOBAL_BIND                           = 1010,
410    RS_HAL_SCRIPT_SET_GLOBAL_OBJECT                         = 1011,
411    RS_HAL_SCRIPT_DESTROY                                   = 1012,
412    RS_HAL_SCRIPT_INVOKE_FOR_EACH_MULTI                     = 1013,
413    RS_HAL_SCRIPT_UPDATE_CACHED_OBJECT                      = 1014,
414    RS_HAL_SCRIPT_INVOKE_REDUCE                             = 1015,
415    RS_HAL_SCRIPT_INVOKE_REDUCE_NEW                         = 1016,
416
417    RS_HAL_ALLOCATION_INIT                                  = 2000,
418    RS_HAL_ALLOCATION_INIT_ADAPTER                          = 2001,
419    RS_HAL_ALLOCATION_DESTROY                               = 2002,
420    RS_HAL_ALLOCATION_GET_GRALLOC_BITS                      = 2003,
421    RS_HAL_ALLOCATION_RESIZE                                = 2004,
422    RS_HAL_ALLOCATION_SYNC_ALL                              = 2005,
423    RS_HAL_ALLOCATION_MARK_DIRTY                            = 2006,
424    RS_HAL_ALLOCATION_SET_SURFACE                           = 2007,
425    RS_HAL_ALLOCATION_IO_SEND                               = 2008,
426    RS_HAL_ALLOCATION_IO_RECEIVE                            = 2009,
427    RS_HAL_ALLOCATION_DATA_1D                               = 2010,
428    RS_HAL_ALLOCATION_DATA_2D                               = 2011,
429    RS_HAL_ALLOCATION_DATA_3D                               = 2012,
430    RS_HAL_ALLOCATION_READ_1D                               = 2013,
431    RS_HAL_ALLOCATION_READ_2D                               = 2014,
432    RS_HAL_ALLOCATION_READ_3D                               = 2015,
433    RS_HAL_ALLOCATION_LOCK_1D                               = 2016,
434    RS_HAL_ALLOCATION_UNLOCK_1D                             = 2017,
435    RS_HAL_ALLOCATION_COPY_1D                               = 2018,
436    RS_HAL_ALLOCATION_COPY_2D                               = 2019,
437    RS_HAL_ALLOCATION_COPY_3D                               = 2020,
438    RS_HAL_ALLOCATION_ELEMENT_DATA                          = 2021,
439    RS_HAL_ALLOCATION_ELEMENT_READ                          = 2022,
440    RS_HAL_ALLOCATION_GENERATE_MIPMAPS                      = 2023,
441    RS_HAL_ALLOCATION_UPDATE_CACHED_OBJECT                  = 2024,
442    RS_HAL_ALLOCATION_ADAPTER_OFFSET                        = 2025,
443    RS_HAL_ALLOCATION_INIT_OEM                              = 2026,
444    RS_HAL_ALLOCATION_GET_POINTER                           = 2027,
445#ifdef RS_COMPATIBILITY_LIB
446    RS_HAL_ALLOCATION_INIT_STRIDED                          = 2999,
447#endif
448
449    RS_HAL_SAMPLER_INIT                                     = 3000,
450    RS_HAL_SAMPLER_DESTROY                                  = 3001,
451    RS_HAL_SAMPLER_UPDATE_CACHED_OBJECT                     = 3002,
452
453    RS_HAL_TYPE_INIT                                        = 4000,
454    RS_HAL_TYPE_DESTROY                                     = 4001,
455    RS_HAL_TYPE_UPDATE_CACHED_OBJECT                        = 4002,
456
457    RS_HAL_ELEMENT_INIT                                     = 5000,
458    RS_HAL_ELEMENT_DESTROY                                  = 5001,
459    RS_HAL_ELEMENT_UPDATE_CACHED_OBJECT                     = 5002,
460
461    RS_HAL_SCRIPT_GROUP_INIT                                = 6000,
462    RS_HAL_SCRIPT_GROUP_DESTROY                             = 6001,
463    RS_HAL_SCRIPT_GROUP_UPDATE_CACHED_OBJECT                = 6002,
464    RS_HAL_SCRIPT_GROUP_SET_INPUT                           = 6003,
465    RS_HAL_SCRIPT_GROUP_SET_OUTPUT                          = 6004,
466    RS_HAL_SCRIPT_GROUP_EXECUTE                             = 6005,
467
468
469
470    RS_HAL_GRAPHICS_INIT                                    = 100001,
471    RS_HAL_GRAPHICS_SHUTDOWN                                = 100002,
472    RS_HAL_GRAPHICS_SWAP                                    = 100003,
473    RS_HAL_GRAPHICS_SET_SURFACE                             = 100004,
474    RS_HAL_GRAPHICS_RASTER_INIT                             = 101000,
475    RS_HAL_GRAPHICS_RASTER_SET_ACTIVE                       = 101001,
476    RS_HAL_GRAPHICS_RASTER_DESTROY                          = 101002,
477    RS_HAL_GRAPHICS_VERTEX_INIT                             = 102000,
478    RS_HAL_GRAPHICS_VERTEX_SET_ACTIVE                       = 102001,
479    RS_HAL_GRAPHICS_VERTEX_DESTROY                          = 102002,
480    RS_HAL_GRAPHICS_FRAGMENT_INIT                           = 103000,
481    RS_HAL_GRAPHICS_FRAGMENT_SET_ACTIVE                     = 103001,
482    RS_HAL_GRAPHICS_FRAGMENT_DESTROY                        = 103002,
483    RS_HAL_GRAPHICS_MESH_INIT                               = 104000,
484    RS_HAL_GRAPHICS_MESH_DRAW                               = 104001,
485    RS_HAL_GRAPHICS_MESH_DESTROY                            = 104002,
486    RS_HAL_GRAPHICS_FB_INIT                                 = 105000,
487    RS_HAL_GRAPHICS_FB_SET_ACTIVE                           = 105001,
488    RS_HAL_GRAPHICS_FB_DESTROY                              = 105002,
489    RS_HAL_GRAPHICS_STORE_INIT                              = 106000,
490    RS_HAL_GRAPHICS_STORE_SET_ACTIVE                        = 106001,
491    RS_HAL_GRAPHICS_STORE_DESTROY                           = 106002,
492};
493
494}
495}
496
497#ifdef __cplusplus
498extern "C" {
499#endif
500
501/**
502 * Get the major version number of the driver.  The major
503 * version should be the RS_HAL_VERSION against which the
504 * driver was built
505 *
506 * The Minor version number is vendor specific
507 *
508 * The caller should ensure that *version_major is the same as
509 * RS_HAL_VERSION -- i.e., that the driver (e.g., libRSDriver)
510 * is compatible with the shell (i.e., libRS_internal) responsible
511 * for loading the driver
512 *
513 * return: False will abort loading the driver, true indicates
514 * success
515 */
516bool rsdHalQueryVersion(uint32_t *version_major, uint32_t *version_minor);
517
518
519/**
520 * Get an entry point in the driver HAL
521 *
522 * The driver should set the function pointer to its
523 * implementation of the function.  If it does not have an entry
524 * for an enum, its should set the function pointer to NULL
525 *
526 * Returning NULL is expected in cases during development as new
527 * entry points are added that a driver may not understand.  If
528 * the runtime receives a NULL it will decide if the function is
529 * required and will either continue loading or abort as needed.
530 *
531 *
532 * return: False will abort loading the driver, true indicates
533 * success
534 *
535 */
536bool rsdHalQueryHal(android::renderscript::RsHalInitEnums entry, void **fnPtr);
537
538
539/**
540 * Called to initialize the context for use with a driver.
541 *
542 * return: False will abort loading the driver, true indicates
543 * success
544 */
545bool rsdHalInit(RsContext, uint32_t version_major, uint32_t version_minor);
546
547/**
548 * Called if one of the loading functions above returns false.
549 * This is to clean up any resources allocated during an error
550 * condition. If this path is called it means the normal
551 * context->mHal.funcs.shutdown() will not be called.
552 */
553void rsdHalAbort(RsContext);
554
555#ifdef __cplusplus
556}
557#endif
558
559#endif
560