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 22package 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. 26typedef 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. 31typedef pointer Ptr; 32 33// This is an abstraction of size_t because it is not supported in HIDL. 34typedef uint64_t Size; 35 36// In RenderScript code, these are all defined as void*, but act only as 37// handles. 38typedef OpaqueHandle Allocation; 39typedef OpaqueHandle AllocationAdapter; 40typedef OpaqueHandle Closure; 41typedef OpaqueHandle Element; 42typedef OpaqueHandle NativeWindow; 43typedef OpaqueHandle ObjectBase; 44typedef OpaqueHandle Sampler; 45typedef OpaqueHandle Script; 46typedef OpaqueHandle ScriptFieldID; 47typedef OpaqueHandle ScriptGroup; 48typedef OpaqueHandle ScriptGroup2; 49typedef OpaqueHandle ScriptInvokeID; 50typedef OpaqueHandle ScriptKernelID; 51typedef 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_") 56enum ContextType : int32_t { 57 NORMAL, 58 DEBUG, 59 PROFILE, 60}; 61 62@export(name="RsAllocationUsageType", value_prefix="RS_ALLOCATION_USAGE_") 63enum 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_") 77enum 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_") 85enum 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_") 95enum 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_") 130enum 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_") 143enum 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_") 151enum 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_") 163enum 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 173struct ScriptCall { 174 ForEachStrategy strategy; 175 uint32_t xStart; 176 uint32_t xEnd; 177 uint32_t yStart; 178 uint32_t yEnd; 179 uint32_t zStart; 180 uint32_t zEnd; 181 uint32_t arrayStart; 182 uint32_t arrayEnd; 183 uint32_t array2Start; 184 uint32_t array2End; 185 uint32_t array3Start; 186 uint32_t array3End; 187 uint32_t array4Start; 188 uint32_t array4End; 189}; 190 191@export(name="RsContextFlags", value_prefix="RS_CONTEXT_") 192enum ContextFlags : int32_t { 193 SYNCHRONOUS = 1<<0, 194 LOW_LATENCY = 1<<1, 195 LOW_POWER = 1<<2, 196 WAIT_FOR_ATTACH = 1<<3, 197}; 198 199// types below are same as those in frameworks/rs/rsInternalDefines.h 200 201@export(name="RsMessageToClientType", value_prefix="RS_MESSAGE_TO_CLIENT_") 202enum MessageToClientType : int32_t { 203 NONE = 0, 204 EXCEPTION = 1, 205 RESIZE = 2, 206 ERROR = 3, 207 USER = 4, 208 NEW_BUFFER = 5, 209}; 210 211@export(name="RsScriptIntrinsicID", value_prefix="RS_SCRIPT_INTRINSIC_") 212enum ScriptIntrinsicID : int32_t { 213 ID_UNDEFINED = 0, 214 ID_CONVOLVE_3X3 = 1, 215 ID_COLOR_MATRIX = 2, 216 ID_LUT = 3, 217 ID_CONVOLVE_5X5 = 4, 218 ID_BLUR = 5, 219 ID_YUV_TO_RGB = 6, 220 ID_BLEND = 7, 221 ID_3DLUT = 8, 222 ID_HISTOGRAM = 9, 223 // unused 10, 11 224 ID_RESIZE = 12, 225 ID_BLAS = 13, 226 ID_EXTBLAS = 14, 227 ID_OEM_START = 0x10000000, 228}; 229 230@export(name="RsThreadPriorities", value_prefix="RS_THREAD_PRIORITY_") 231enum ThreadPriorities : int32_t { 232 LOW = 15, 233 NORMAL_GRAPHICS = -8, 234 NORMAL = -1, 235 LOW_LATENCY = -4, 236}; 237 238// types below are same as those in 239// frameworks/compile/libbcc/include/bcinfo/MetadataExtractor.h 240 241@export(name="", value_prefix="RS_MD_") 242enum MetadataSignatureBitval : int32_t { 243 SIG_None = 0, 244 SIG_In = 1<<0, 245 SIG_Out = 1<<1, 246 SIG_Usr = 1<<2, 247 SIG_X = 1<<3, 248 SIG_Y = 1<<4, 249 SIG_Kernel = 1<<5, 250 SIG_Z = 1<<6, 251 SIG_Ctxt = 1<<7, 252}; 253