1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/omx-plugin/include/froyo/pixelflinger/pixelflinger.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,330 @@ 1.4 +/* 1.5 + * Copyright (C) 2007 The Android Open Source Project 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 +#ifndef ANDROID_PIXELFLINGER_H 1.21 +#define ANDROID_PIXELFLINGER_H 1.22 + 1.23 +#include <stdint.h> 1.24 +#include <sys/types.h> 1.25 + 1.26 +#include <pixelflinger/format.h> 1.27 + 1.28 +// GGL types 1.29 + 1.30 +typedef int8_t GGLbyte; // b 1.31 +typedef int16_t GGLshort; // s 1.32 +typedef int32_t GGLint; // i 1.33 +typedef ssize_t GGLsizei; // i 1.34 +typedef int32_t GGLfixed; // x 1.35 +typedef int32_t GGLclampx; // x 1.36 +typedef float GGLfloat; // f 1.37 +typedef float GGLclampf; // f 1.38 +typedef double GGLdouble; // d 1.39 +typedef double GGLclampd; // d 1.40 +typedef uint8_t GGLubyte; // ub 1.41 +typedef uint8_t GGLboolean; // ub 1.42 +typedef uint16_t GGLushort; // us 1.43 +typedef uint32_t GGLuint; // ui 1.44 +typedef unsigned int GGLenum; // ui 1.45 +typedef unsigned int GGLbitfield; // ui 1.46 +typedef void GGLvoid; 1.47 +typedef int32_t GGLfixed32; 1.48 +typedef int32_t GGLcolor; 1.49 +typedef int32_t GGLcoord; 1.50 + 1.51 +// ---------------------------------------------------------------------------- 1.52 + 1.53 +#define GGL_MAX_VIEWPORT_DIMS 4096 1.54 +#define GGL_MAX_TEXTURE_SIZE 4096 1.55 +#define GGL_MAX_ALIASED_POINT_SIZE 0x7FFFFFF 1.56 +#define GGL_MAX_SMOOTH_POINT_SIZE 2048 1.57 +#define GGL_MAX_SMOOTH_LINE_WIDTH 2048 1.58 + 1.59 +// ---------------------------------------------------------------------------- 1.60 + 1.61 +// All these names are compatible with their OpenGL equivalents 1.62 +// some of them are listed only for completeness 1.63 +enum GGLNames { 1.64 + GGL_FALSE = 0, 1.65 + GGL_TRUE = 1, 1.66 + 1.67 + // enable/disable 1.68 + GGL_SCISSOR_TEST = 0x0C11, 1.69 + GGL_TEXTURE_2D = 0x0DE1, 1.70 + GGL_ALPHA_TEST = 0x0BC0, 1.71 + GGL_BLEND = 0x0BE2, 1.72 + GGL_COLOR_LOGIC_OP = 0x0BF2, 1.73 + GGL_DITHER = 0x0BD0, 1.74 + GGL_STENCIL_TEST = 0x0B90, 1.75 + GGL_DEPTH_TEST = 0x0B71, 1.76 + GGL_AA = 0x80000001, 1.77 + GGL_W_LERP = 0x80000004, 1.78 + GGL_POINT_SMOOTH_NICE = 0x80000005, 1.79 + 1.80 + // buffers, pixel drawing/reading 1.81 + GGL_COLOR = 0x1800, 1.82 + 1.83 + // fog 1.84 + GGL_FOG = 0x0B60, 1.85 + 1.86 + // shade model 1.87 + GGL_FLAT = 0x1D00, 1.88 + GGL_SMOOTH = 0x1D01, 1.89 + 1.90 + // Texture parameter name 1.91 + GGL_TEXTURE_MIN_FILTER = 0x2801, 1.92 + GGL_TEXTURE_MAG_FILTER = 0x2800, 1.93 + GGL_TEXTURE_WRAP_S = 0x2802, 1.94 + GGL_TEXTURE_WRAP_T = 0x2803, 1.95 + GGL_TEXTURE_WRAP_R = 0x2804, 1.96 + 1.97 + // Texture Filter 1.98 + GGL_NEAREST = 0x2600, 1.99 + GGL_LINEAR = 0x2601, 1.100 + GGL_NEAREST_MIPMAP_NEAREST = 0x2700, 1.101 + GGL_LINEAR_MIPMAP_NEAREST = 0x2701, 1.102 + GGL_NEAREST_MIPMAP_LINEAR = 0x2702, 1.103 + GGL_LINEAR_MIPMAP_LINEAR = 0x2703, 1.104 + 1.105 + // Texture Wrap Mode 1.106 + GGL_CLAMP = 0x2900, 1.107 + GGL_REPEAT = 0x2901, 1.108 + GGL_CLAMP_TO_EDGE = 0x812F, 1.109 + 1.110 + // Texture Env Mode 1.111 + GGL_REPLACE = 0x1E01, 1.112 + GGL_MODULATE = 0x2100, 1.113 + GGL_DECAL = 0x2101, 1.114 + GGL_ADD = 0x0104, 1.115 + 1.116 + // Texture Env Parameter 1.117 + GGL_TEXTURE_ENV_MODE = 0x2200, 1.118 + GGL_TEXTURE_ENV_COLOR = 0x2201, 1.119 + 1.120 + // Texture Env Target 1.121 + GGL_TEXTURE_ENV = 0x2300, 1.122 + 1.123 + // Texture coord generation 1.124 + GGL_TEXTURE_GEN_MODE = 0x2500, 1.125 + GGL_S = 0x2000, 1.126 + GGL_T = 0x2001, 1.127 + GGL_R = 0x2002, 1.128 + GGL_Q = 0x2003, 1.129 + GGL_ONE_TO_ONE = 0x80000002, 1.130 + GGL_AUTOMATIC = 0x80000003, 1.131 + 1.132 + // AlphaFunction 1.133 + GGL_NEVER = 0x0200, 1.134 + GGL_LESS = 0x0201, 1.135 + GGL_EQUAL = 0x0202, 1.136 + GGL_LEQUAL = 0x0203, 1.137 + GGL_GREATER = 0x0204, 1.138 + GGL_NOTEQUAL = 0x0205, 1.139 + GGL_GEQUAL = 0x0206, 1.140 + GGL_ALWAYS = 0x0207, 1.141 + 1.142 + // LogicOp 1.143 + GGL_CLEAR = 0x1500, // 0 1.144 + GGL_AND = 0x1501, // s & d 1.145 + GGL_AND_REVERSE = 0x1502, // s & ~d 1.146 + GGL_COPY = 0x1503, // s 1.147 + GGL_AND_INVERTED = 0x1504, // ~s & d 1.148 + GGL_NOOP = 0x1505, // d 1.149 + GGL_XOR = 0x1506, // s ^ d 1.150 + GGL_OR = 0x1507, // s | d 1.151 + GGL_NOR = 0x1508, // ~(s | d) 1.152 + GGL_EQUIV = 0x1509, // ~(s ^ d) 1.153 + GGL_INVERT = 0x150A, // ~d 1.154 + GGL_OR_REVERSE = 0x150B, // s | ~d 1.155 + GGL_COPY_INVERTED = 0x150C, // ~s 1.156 + GGL_OR_INVERTED = 0x150D, // ~s | d 1.157 + GGL_NAND = 0x150E, // ~(s & d) 1.158 + GGL_SET = 0x150F, // 1 1.159 + 1.160 + // blending equation & function 1.161 + GGL_ZERO = 0, // SD 1.162 + GGL_ONE = 1, // SD 1.163 + GGL_SRC_COLOR = 0x0300, // D 1.164 + GGL_ONE_MINUS_SRC_COLOR = 0x0301, // D 1.165 + GGL_SRC_ALPHA = 0x0302, // SD 1.166 + GGL_ONE_MINUS_SRC_ALPHA = 0x0303, // SD 1.167 + GGL_DST_ALPHA = 0x0304, // SD 1.168 + GGL_ONE_MINUS_DST_ALPHA = 0x0305, // SD 1.169 + GGL_DST_COLOR = 0x0306, // S 1.170 + GGL_ONE_MINUS_DST_COLOR = 0x0307, // S 1.171 + GGL_SRC_ALPHA_SATURATE = 0x0308, // S 1.172 + 1.173 + // clear bits 1.174 + GGL_DEPTH_BUFFER_BIT = 0x00000100, 1.175 + GGL_STENCIL_BUFFER_BIT = 0x00000400, 1.176 + GGL_COLOR_BUFFER_BIT = 0x00004000, 1.177 + 1.178 + // errors 1.179 + GGL_NO_ERROR = 0, 1.180 + GGL_INVALID_ENUM = 0x0500, 1.181 + GGL_INVALID_VALUE = 0x0501, 1.182 + GGL_INVALID_OPERATION = 0x0502, 1.183 + GGL_STACK_OVERFLOW = 0x0503, 1.184 + GGL_STACK_UNDERFLOW = 0x0504, 1.185 + GGL_OUT_OF_MEMORY = 0x0505 1.186 +}; 1.187 + 1.188 +// ---------------------------------------------------------------------------- 1.189 + 1.190 +typedef struct { 1.191 + GGLsizei version; // always set to sizeof(GGLSurface) 1.192 + GGLuint width; // width in pixels 1.193 + GGLuint height; // height in pixels 1.194 + GGLint stride; // stride in pixels 1.195 + GGLubyte* data; // pointer to the bits 1.196 + GGLubyte format; // pixel format 1.197 + GGLubyte rfu[3]; // must be zero 1.198 + // these values are dependent on the used format 1.199 + union { 1.200 + GGLint compressedFormat; 1.201 + GGLint vstride; 1.202 + }; 1.203 + void* reserved; 1.204 +} GGLSurface; 1.205 + 1.206 + 1.207 +typedef struct { 1.208 + // immediate rendering 1.209 + void (*pointx)(void *con, const GGLcoord* v, GGLcoord r); 1.210 + void (*linex)(void *con, 1.211 + const GGLcoord* v0, const GGLcoord* v1, GGLcoord width); 1.212 + void (*recti)(void* c, GGLint l, GGLint t, GGLint r, GGLint b); 1.213 + void (*trianglex)(void* c, 1.214 + GGLcoord const* v0, GGLcoord const* v1, GGLcoord const* v2); 1.215 + 1.216 + // scissor 1.217 + void (*scissor)(void* c, GGLint x, GGLint y, GGLsizei width, GGLsizei height); 1.218 + 1.219 + // Set the textures and color buffers 1.220 + void (*activeTexture)(void* c, GGLuint tmu); 1.221 + void (*bindTexture)(void* c, const GGLSurface* surface); 1.222 + void (*colorBuffer)(void* c, const GGLSurface* surface); 1.223 + void (*readBuffer)(void* c, const GGLSurface* surface); 1.224 + void (*depthBuffer)(void* c, const GGLSurface* surface); 1.225 + void (*bindTextureLod)(void* c, GGLuint tmu, const GGLSurface* surface); 1.226 + 1.227 + // enable/disable features 1.228 + void (*enable)(void* c, GGLenum name); 1.229 + void (*disable)(void* c, GGLenum name); 1.230 + void (*enableDisable)(void* c, GGLenum name, GGLboolean en); 1.231 + 1.232 + // specify the fragment's color 1.233 + void (*shadeModel)(void* c, GGLenum mode); 1.234 + void (*color4xv)(void* c, const GGLclampx* color); 1.235 + // specify color iterators (16.16) 1.236 + void (*colorGrad12xv)(void* c, const GGLcolor* grad); 1.237 + 1.238 + // specify Z coordinate iterators (0.32) 1.239 + void (*zGrad3xv)(void* c, const GGLfixed32* grad); 1.240 + 1.241 + // specify W coordinate iterators (16.16) 1.242 + void (*wGrad3xv)(void* c, const GGLfixed* grad); 1.243 + 1.244 + // specify fog iterator & color (16.16) 1.245 + void (*fogGrad3xv)(void* c, const GGLfixed* grad); 1.246 + void (*fogColor3xv)(void* c, const GGLclampx* color); 1.247 + 1.248 + // specify blending parameters 1.249 + void (*blendFunc)(void* c, GGLenum src, GGLenum dst); 1.250 + void (*blendFuncSeparate)(void* c, GGLenum src, GGLenum dst, 1.251 + GGLenum srcAlpha, GGLenum dstAplha); 1.252 + 1.253 + // texture environnement (REPLACE / MODULATE / DECAL / BLEND) 1.254 + void (*texEnvi)(void* c, GGLenum target, 1.255 + GGLenum pname, 1.256 + GGLint param); 1.257 + 1.258 + void (*texEnvxv)(void* c, GGLenum target, 1.259 + GGLenum pname, const GGLfixed* params); 1.260 + 1.261 + // texture parameters (Wrapping, filter) 1.262 + void (*texParameteri)(void* c, GGLenum target, 1.263 + GGLenum pname, 1.264 + GGLint param); 1.265 + 1.266 + // texture iterators (16.16) 1.267 + void (*texCoord2i)(void* c, GGLint s, GGLint t); 1.268 + void (*texCoord2x)(void* c, GGLfixed s, GGLfixed t); 1.269 + 1.270 + // s, dsdx, dsdy, scale, t, dtdx, dtdy, tscale 1.271 + // This api uses block floating-point for S and T texture coordinates. 1.272 + // All values are given in 16.16, scaled by 'scale'. In other words, 1.273 + // set scale to 0, for 16.16 values. 1.274 + void (*texCoordGradScale8xv)(void* c, GGLint tmu, const int32_t* grad8); 1.275 + 1.276 + void (*texGeni)(void* c, GGLenum coord, GGLenum pname, GGLint param); 1.277 + 1.278 + // masking 1.279 + void (*colorMask)(void* c, GGLboolean red, 1.280 + GGLboolean green, 1.281 + GGLboolean blue, 1.282 + GGLboolean alpha); 1.283 + 1.284 + void (*depthMask)(void* c, GGLboolean flag); 1.285 + 1.286 + void (*stencilMask)(void* c, GGLuint mask); 1.287 + 1.288 + // alpha func 1.289 + void (*alphaFuncx)(void* c, GGLenum func, GGLclampx ref); 1.290 + 1.291 + // depth func 1.292 + void (*depthFunc)(void* c, GGLenum func); 1.293 + 1.294 + // logic op 1.295 + void (*logicOp)(void* c, GGLenum opcode); 1.296 + 1.297 + // clear 1.298 + void (*clear)(void* c, GGLbitfield mask); 1.299 + void (*clearColorx)(void* c, 1.300 + GGLclampx r, GGLclampx g, GGLclampx b, GGLclampx a); 1.301 + void (*clearDepthx)(void* c, GGLclampx depth); 1.302 + void (*clearStencil)(void* c, GGLint s); 1.303 + 1.304 + // framebuffer operations 1.305 + void (*copyPixels)(void* c, GGLint x, GGLint y, 1.306 + GGLsizei width, GGLsizei height, GGLenum type); 1.307 + void (*rasterPos2x)(void* c, GGLfixed x, GGLfixed y); 1.308 + void (*rasterPos2i)(void* c, GGLint x, GGLint y); 1.309 +} GGLContext; 1.310 + 1.311 +// ---------------------------------------------------------------------------- 1.312 + 1.313 +#ifdef __cplusplus 1.314 +extern "C" { 1.315 +#endif 1.316 + 1.317 +// construct / destroy the context 1.318 +ssize_t gglInit(GGLContext** context); 1.319 +ssize_t gglUninit(GGLContext* context); 1.320 + 1.321 +GGLint gglBitBlti( 1.322 + GGLContext* c, 1.323 + int tmu, 1.324 + GGLint crop[4], 1.325 + GGLint where[4]); 1.326 + 1.327 +#ifdef __cplusplus 1.328 +}; 1.329 +#endif 1.330 + 1.331 +// ---------------------------------------------------------------------------- 1.332 + 1.333 +#endif // ANDROID_PIXELFLINGER_H