1 /* 2 * Copyright (C) 2017 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 // TODO: Currently, most of the types are simply typedefs of uint64_t, so 18 // misusing one type as another won't be caught by the compiler. Should we wrap 19 // each type in a unique class to have stronger type guarantees? 20 // TODO: is there an enum for intrinsics? 21 22 package android.hardware.renderscript@1.0; 23 24 // OpaqueHandle is an object that is used entirely in the driver but still needs 25 // to be identified by the framework. 26 typedef uint64_t OpaqueHandle; 27 28 // A pointer is an actual local pointer that can be accessed by both the 29 // framework and the driver. This is possible because RenderScript is always 30 // running in Passthrough mode. 31 typedef pointer Ptr; 32 33 // This is an abstraction of size_t because it is not supported in HIDL. 34 typedef uint64_t Size; 35 36 // In RenderScript code, these are all defined as void*, but act only as 37 // handles. 38 typedef OpaqueHandle Allocation; 39 typedef OpaqueHandle AllocationAdapter; 40 typedef OpaqueHandle Closure; 41 typedef OpaqueHandle Element; 42 typedef OpaqueHandle NativeWindow; 43 typedef OpaqueHandle ObjectBase; 44 typedef OpaqueHandle Sampler; 45 typedef OpaqueHandle Script; 46 typedef OpaqueHandle ScriptFieldID; 47 typedef OpaqueHandle ScriptGroup; 48 typedef OpaqueHandle ScriptGroup2; 49 typedef OpaqueHandle ScriptInvokeID; 50 typedef OpaqueHandle ScriptKernelID; 51 typedef OpaqueHandle Type; 52 53 // types below are same as those in frameworks/rs/rsDefines.h 54 55 @export(name="RsContextType", value_prefix="RS_CONTEXT_TYPE_") 56 enum ContextType : int32_t { 57 NORMAL, 58 DEBUG, 59 PROFILE, 60 }; 61 62 @export(name="RsAllocationUsageType", value_prefix="RS_ALLOCATION_USAGE_") 63 enum AllocationUsageType : int32_t { 64 SCRIPT = 0x0001, 65 GRAPHICS_TEXTURE = 0x0002, 66 GRAPHICS_VERTEX = 0x0004, 67 GRAPHICS_CONSTANTS = 0x0008, 68 GRAPHICS_RENDER_TARGET = 0x0010, 69 IO_INPUT = 0x0020, 70 IO_OUTPUT = 0x0040, 71 SHARED = 0x0080, 72 OEM = 0x8000, 73 ALL = 0x80FF, 74 }; 75 76 @export(name="RsAllocationMipmapControl", value_prefix="RS_ALLOCATION_MIPMAP_") 77 enum AllocationMipmapControl : int32_t { 78 NONE = 0, 79 FULL = 1, 80 ON_SYNC_TO_TEXTURE = 2, 81 }; 82 83 @export(name="RsAllocationCubemapFace", 84 value_prefix="RS_ALLOCATION_CUBEMAP_FACE_") 85 enum AllocationCubemapFace : int32_t { 86 POSITIVE_X = 0, 87 NEGATIVE_X = 1, 88 POSITIVE_Y = 2, 89 NEGATIVE_Y = 3, 90 POSITIVE_Z = 4, 91 NEGATIVE_Z = 5, 92 }; 93 94 @export(name="RsDataType", value_prefix="RS_TYPE_") 95 enum DataType : int32_t { 96 NONE = 0, 97 FLOAT_16, 98 FLOAT_32, 99 FLOAT_64, 100 SIGNED_8, 101 SIGNED_16, 102 SIGNED_32, 103 SIGNED_64, 104 UNSIGNED_8, 105 UNSIGNED_16, 106 UNSIGNED_32, 107 UNSIGNED_64, 108 BOOLEAN, 109 UNSIGNED_5_6_5, 110 UNSIGNED_5_5_5_1, 111 UNSIGNED_4_4_4_4, 112 MATRIX_4X4, 113 MATRIX_3X3, 114 MATRIX_2X2, 115 ELEMENT = 1000, 116 TYPE, 117 ALLOCATION, 118 SAMPLER, 119 SCRIPT, 120 MESH, 121 PROGRAM_FRAGMENT, 122 PROGRAM_VERTEX, 123 PROGRAM_RASTER, 124 PROGRAM_STORE, 125 FONT, 126 INVALID = 10000, 127 }; 128 129 @export(name="RsDataKind", value_prefix="RS_KIND_") 130 enum DataKind : int32_t { 131 USER, 132 PIXEL_L = 7, 133 PIXEL_A, 134 PIXEL_LA, 135 PIXEL_RGB, 136 PIXEL_RGBA, 137 PIXEL_DEPTH, 138 PIXEL_YUV, 139 INVALID = 100, 140 }; 141 142 @export(name="RsYuvFormat", value_prefix="RS_") 143 enum YuvFormat : int32_t { 144 YUV_NONE = 0, 145 YUV_YV12 = 0x32315659, // HAL_PIXEL_FORMAT_YV12 in system/graphics.h 146 YUV_NV21 = 0x11, // HAL_PIXEL_FORMAT_YCrCb_420_SP 147 YUV_420_888 = 0x23, // HAL_PIXEL_FORMAT_YCbCr_420_888 148 }; 149 150 @export(name="RsSamplerValue", value_prefix="RS_SAMPLER_") 151 enum SamplerValue : int32_t { 152 NEAREST, 153 LINEAR, 154 LINEAR_MIP_LINEAR, 155 WRAP, 156 CLAMP, 157 LINEAR_MIP_NEAREST, 158 MIRRORED_REPEAT, 159 INVALID = 100, 160 }; 161 162 @export(name="RsForEachStrategy", value_prefix="RS_FOR_EACH_STRATEGY_") 163 enum ForEachStrategy : int32_t { 164 SERIAL = 0, 165 DONT_CARE = 1, 166 DST_LINEAR = 2, 167 TILE_SMALL = 3, 168 TILE_MEDIUM = 4, 169 TILE_LARGE = 5, 170 }; 171 172 // Script to Script 173 @export(name="RsScriptCall") 174 struct ScriptCall { 175 ForEachStrategy strategy; 176 uint32_t xStart; 177 uint32_t xEnd; 178 uint32_t yStart; 179 uint32_t yEnd; 180 uint32_t zStart; 181 uint32_t zEnd; 182 uint32_t arrayStart; 183 uint32_t arrayEnd; 184 uint32_t array2Start; 185 uint32_t array2End; 186 uint32_t array3Start; 187 uint32_t array3End; 188 uint32_t array4Start; 189 uint32_t array4End; 190 }; 191 192 @export(name="RsContextFlags", value_prefix="RS_CONTEXT_") 193 enum ContextFlags : int32_t { 194 SYNCHRONOUS = 1<<0, 195 LOW_LATENCY = 1<<1, 196 LOW_POWER = 1<<2, 197 WAIT_FOR_ATTACH = 1<<3, 198 }; 199 200 // types below are same as those in frameworks/rs/rsInternalDefines.h 201 202 @export(name="RsMessageToClientType", value_prefix="RS_MESSAGE_TO_CLIENT_") 203 enum MessageToClientType : int32_t { 204 NONE = 0, 205 EXCEPTION = 1, 206 RESIZE = 2, 207 ERROR = 3, 208 USER = 4, 209 NEW_BUFFER = 5, 210 }; 211 212 @export(name="RsScriptIntrinsicID", value_prefix="RS_SCRIPT_INTRINSIC_") 213 enum ScriptIntrinsicID : int32_t { 214 ID_UNDEFINED = 0, 215 ID_CONVOLVE_3X3 = 1, 216 ID_COLOR_MATRIX = 2, 217 ID_LUT = 3, 218 ID_CONVOLVE_5X5 = 4, 219 ID_BLUR = 5, 220 ID_YUV_TO_RGB = 6, 221 ID_BLEND = 7, 222 ID_3DLUT = 8, 223 ID_HISTOGRAM = 9, 224 // unused 10, 11 225 ID_RESIZE = 12, 226 ID_BLAS = 13, 227 ID_EXTBLAS = 14, 228 ID_OEM_START = 0x10000000, 229 }; 230 231 @export(name="RsThreadPriorities", value_prefix="RS_THREAD_PRIORITY_") 232 enum ThreadPriorities : int32_t { 233 LOW = 15, 234 NORMAL_GRAPHICS = -8, 235 NORMAL = -1, 236 LOW_LATENCY = -4, 237 }; 238 239 // types below are same as those in 240 // frameworks/compile/libbcc/include/bcinfo/MetadataExtractor.h 241 242 @export(name="", value_prefix="RS_MD_") 243 enum MetadataSignatureBitval : int32_t { 244 SIG_None = 0, 245 SIG_In = 1<<0, 246 SIG_Out = 1<<1, 247 SIG_Usr = 1<<2, 248 SIG_X = 1<<3, 249 SIG_Y = 1<<4, 250 SIG_Kernel = 1<<5, 251 SIG_Z = 1<<6, 252 SIG_Ctxt = 1<<7, 253 }; 254