rs_hal.h revision cdfdb8f2cdf4668c476cac842212892b2505ff3f
1ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell/* 2ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell * Copyright (C) 2011 The Android Open Source Project 3ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell * 4ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 5ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell * you may not use this file except in compliance with the License. 6ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell * You may obtain a copy of the License at 7ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell * 8ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell * http://www.apache.org/licenses/LICENSE-2.0 9ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell * 10ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell * Unless required by applicable law or agreed to in writing, software 11ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell * distributed under the License is distributed on an "AS IS" BASIS, 12ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell * See the License for the specific language governing permissions and 14ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell * limitations under the License. 15ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell */ 16ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 17ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell#ifndef RS_HAL_H 18ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell#define RS_HAL_H 19ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 203307958c6b4b3707c8861db829893b1f5820b677Adam Powell#include <RenderScriptDefines.h> 21e8ce8ba2b5633e479ccaa82d8e3147ccbba62961Mindy Pereira 22e8ce8ba2b5633e479ccaa82d8e3147ccbba62961Mindy Pereiranamespace android { 23a4ce6ae0d379c8866697d064cfd1661ea156405eAdam Powellnamespace renderscript { 24346c8fb036b99a33756c66dcebeb5d0f67a1df72Adam Powell 25a4ce6ae0d379c8866697d064cfd1661ea156405eAdam Powellclass Context; 26ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powellclass ObjectBase; 27618cbea4e746196cbde43746706bec02e14b487bAdam Powellclass Element; 28618cbea4e746196cbde43746706bec02e14b487bAdam Powellclass Type; 29618cbea4e746196cbde43746706bec02e14b487bAdam Powellclass Allocation; 30618cbea4e746196cbde43746706bec02e14b487bAdam Powellclass Script; 31ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powellclass ScriptC; 3247c41e807e36999e4d0d2072e41a82bc45655ff2Erik 33ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 34ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powelltypedef void *(*RsHalSymbolLookupFunc)(void *usrptr, char const *symbolName); 35ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 36ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powelltypedef struct ScriptTLSStructRec { 37ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell Context * mContext; 38ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell Script * mScript; 39ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell} ScriptTLSStruct; 40ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 41ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 42ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell/** 430818020d7cb04d83d51b71b8262d34bd79a76a95Adam Powell * Script management functions 440818020d7cb04d83d51b71b8262d34bd79a76a95Adam Powell */ 45ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powelltypedef struct { 46ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell void (*shutdownDriver)(Context *); 47ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell void (*getVersion)(unsigned int *major, unsigned int *minor); 48ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell void (*setPriority)(const Context *, int32_t priority); 49ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 5047c41e807e36999e4d0d2072e41a82bc45655ff2Erik 51ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 52ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell struct { 53ab905c87b7324d15715b78eaae7ef8558ad3bd10Adam Powell bool (*scriptInit)(const Context *rsc, ScriptC *s, 54ab905c87b7324d15715b78eaae7ef8558ad3bd10Adam Powell char const *resName, 55ab905c87b7324d15715b78eaae7ef8558ad3bd10Adam Powell char const *cacheDir, 56ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell uint8_t const *bitcode, 57ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell size_t bitcodeSize, 58ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell uint32_t flags, 59ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell RsHalSymbolLookupFunc lookupFunc); 60ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 61ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell void (*invokeFunction)(const Context *rsc, Script *s, 6247c41e807e36999e4d0d2072e41a82bc45655ff2Erik uint32_t slot, 63ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell const void *params, 64ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell size_t paramLength); 65ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell int (*invokeRoot)(const Context *rsc, Script *s); 66ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell void (*invokeForEach)(const Context *rsc, 67ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell Script *s, 68ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell const Allocation * ain, 69ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell Allocation * aout, 70ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell const void * usr, 71ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell uint32_t usrLen, 72ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell const RsScriptCall *sc); 73ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell void (*invokeInit)(const Context *rsc, Script *s); 74ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 75ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell void (*setGlobalVar)(const Context *rsc, const Script *s, 76ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell uint32_t slot, 7747c41e807e36999e4d0d2072e41a82bc45655ff2Erik void *data, 78ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell size_t dataLength); 79ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell void (*setGlobalBind)(const Context *rsc, const Script *s, 80ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell uint32_t slot, 81ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell void *data); 82ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell void (*setGlobalObj)(const Context *rsc, const Script *s, 83ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell uint32_t slot, 84ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell ObjectBase *data); 85ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 86ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell void (*destroy)(const Context *rsc, Script *s); 87ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell } script; 88ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 89ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 90216bccf804db9c972b317620a27de6a8adf7fbfeAdam Powell 9147c41e807e36999e4d0d2072e41a82bc45655ff2Erik} RsdHalFunctions; 92ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 9347ec2fb37046797bebc82b505a13c552021b9ff3Adam Powellvoid rsiSetObject(ObjectBase **vdst, ObjectBase * vsrc); 9447ec2fb37046797bebc82b505a13c552021b9ff3Adam Powellvoid rsiClearObject(ObjectBase **vdst); 9547c41e807e36999e4d0d2072e41a82bc45655ff2Erikbool rsiIsObject(const ObjectBase *vdst); 96ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 97ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell} 98ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell} 99ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 100ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 10147c41e807e36999e4d0d2072e41a82bc45655ff2Erikbool rsdHalInit(android::renderscript::Context *, uint32_t version_major, uint32_t version_minor); 102ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 103ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell#endif 104ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell 105ae542ff055301a4c3c8a18e8da1739df3a771958Adam Powell