media/omx-plugin/include/gb/pixelflinger/pixelflinger.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * Copyright (C) 2007 The Android Open Source Project
michael@0 3 *
michael@0 4 * Licensed under the Apache License, Version 2.0 (the "License");
michael@0 5 * you may not use this file except in compliance with the License.
michael@0 6 * You may obtain a copy of the License at
michael@0 7 *
michael@0 8 * http://www.apache.org/licenses/LICENSE-2.0
michael@0 9 *
michael@0 10 * Unless required by applicable law or agreed to in writing, software
michael@0 11 * distributed under the License is distributed on an "AS IS" BASIS,
michael@0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
michael@0 13 * See the License for the specific language governing permissions and
michael@0 14 * limitations under the License.
michael@0 15 */
michael@0 16
michael@0 17 #ifndef ANDROID_PIXELFLINGER_H
michael@0 18 #define ANDROID_PIXELFLINGER_H
michael@0 19
michael@0 20 #include <stdint.h>
michael@0 21 #include <sys/types.h>
michael@0 22
michael@0 23 #include <pixelflinger/format.h>
michael@0 24
michael@0 25 // GGL types
michael@0 26
michael@0 27 typedef int8_t GGLbyte; // b
michael@0 28 typedef int16_t GGLshort; // s
michael@0 29 typedef int32_t GGLint; // i
michael@0 30 typedef ssize_t GGLsizei; // i
michael@0 31 typedef int32_t GGLfixed; // x
michael@0 32 typedef int32_t GGLclampx; // x
michael@0 33 typedef float GGLfloat; // f
michael@0 34 typedef float GGLclampf; // f
michael@0 35 typedef double GGLdouble; // d
michael@0 36 typedef double GGLclampd; // d
michael@0 37 typedef uint8_t GGLubyte; // ub
michael@0 38 typedef uint8_t GGLboolean; // ub
michael@0 39 typedef uint16_t GGLushort; // us
michael@0 40 typedef uint32_t GGLuint; // ui
michael@0 41 typedef unsigned int GGLenum; // ui
michael@0 42 typedef unsigned int GGLbitfield; // ui
michael@0 43 typedef void GGLvoid;
michael@0 44 typedef int32_t GGLfixed32;
michael@0 45 typedef int32_t GGLcolor;
michael@0 46 typedef int32_t GGLcoord;
michael@0 47
michael@0 48 // ----------------------------------------------------------------------------
michael@0 49
michael@0 50 #define GGL_MAX_VIEWPORT_DIMS 4096
michael@0 51 #define GGL_MAX_TEXTURE_SIZE 4096
michael@0 52 #define GGL_MAX_ALIASED_POINT_SIZE 0x7FFFFFF
michael@0 53 #define GGL_MAX_SMOOTH_POINT_SIZE 2048
michael@0 54 #define GGL_MAX_SMOOTH_LINE_WIDTH 2048
michael@0 55
michael@0 56 // ----------------------------------------------------------------------------
michael@0 57
michael@0 58 // All these names are compatible with their OpenGL equivalents
michael@0 59 // some of them are listed only for completeness
michael@0 60 enum GGLNames {
michael@0 61 GGL_FALSE = 0,
michael@0 62 GGL_TRUE = 1,
michael@0 63
michael@0 64 // enable/disable
michael@0 65 GGL_SCISSOR_TEST = 0x0C11,
michael@0 66 GGL_TEXTURE_2D = 0x0DE1,
michael@0 67 GGL_ALPHA_TEST = 0x0BC0,
michael@0 68 GGL_BLEND = 0x0BE2,
michael@0 69 GGL_COLOR_LOGIC_OP = 0x0BF2,
michael@0 70 GGL_DITHER = 0x0BD0,
michael@0 71 GGL_STENCIL_TEST = 0x0B90,
michael@0 72 GGL_DEPTH_TEST = 0x0B71,
michael@0 73 GGL_AA = 0x80000001,
michael@0 74 GGL_W_LERP = 0x80000004,
michael@0 75 GGL_POINT_SMOOTH_NICE = 0x80000005,
michael@0 76
michael@0 77 // buffers, pixel drawing/reading
michael@0 78 GGL_COLOR = 0x1800,
michael@0 79
michael@0 80 // fog
michael@0 81 GGL_FOG = 0x0B60,
michael@0 82
michael@0 83 // shade model
michael@0 84 GGL_FLAT = 0x1D00,
michael@0 85 GGL_SMOOTH = 0x1D01,
michael@0 86
michael@0 87 // Texture parameter name
michael@0 88 GGL_TEXTURE_MIN_FILTER = 0x2801,
michael@0 89 GGL_TEXTURE_MAG_FILTER = 0x2800,
michael@0 90 GGL_TEXTURE_WRAP_S = 0x2802,
michael@0 91 GGL_TEXTURE_WRAP_T = 0x2803,
michael@0 92 GGL_TEXTURE_WRAP_R = 0x2804,
michael@0 93
michael@0 94 // Texture Filter
michael@0 95 GGL_NEAREST = 0x2600,
michael@0 96 GGL_LINEAR = 0x2601,
michael@0 97 GGL_NEAREST_MIPMAP_NEAREST = 0x2700,
michael@0 98 GGL_LINEAR_MIPMAP_NEAREST = 0x2701,
michael@0 99 GGL_NEAREST_MIPMAP_LINEAR = 0x2702,
michael@0 100 GGL_LINEAR_MIPMAP_LINEAR = 0x2703,
michael@0 101
michael@0 102 // Texture Wrap Mode
michael@0 103 GGL_CLAMP = 0x2900,
michael@0 104 GGL_REPEAT = 0x2901,
michael@0 105 GGL_CLAMP_TO_EDGE = 0x812F,
michael@0 106
michael@0 107 // Texture Env Mode
michael@0 108 GGL_REPLACE = 0x1E01,
michael@0 109 GGL_MODULATE = 0x2100,
michael@0 110 GGL_DECAL = 0x2101,
michael@0 111 GGL_ADD = 0x0104,
michael@0 112
michael@0 113 // Texture Env Parameter
michael@0 114 GGL_TEXTURE_ENV_MODE = 0x2200,
michael@0 115 GGL_TEXTURE_ENV_COLOR = 0x2201,
michael@0 116
michael@0 117 // Texture Env Target
michael@0 118 GGL_TEXTURE_ENV = 0x2300,
michael@0 119
michael@0 120 // Texture coord generation
michael@0 121 GGL_TEXTURE_GEN_MODE = 0x2500,
michael@0 122 GGL_S = 0x2000,
michael@0 123 GGL_T = 0x2001,
michael@0 124 GGL_R = 0x2002,
michael@0 125 GGL_Q = 0x2003,
michael@0 126 GGL_ONE_TO_ONE = 0x80000002,
michael@0 127 GGL_AUTOMATIC = 0x80000003,
michael@0 128
michael@0 129 // AlphaFunction
michael@0 130 GGL_NEVER = 0x0200,
michael@0 131 GGL_LESS = 0x0201,
michael@0 132 GGL_EQUAL = 0x0202,
michael@0 133 GGL_LEQUAL = 0x0203,
michael@0 134 GGL_GREATER = 0x0204,
michael@0 135 GGL_NOTEQUAL = 0x0205,
michael@0 136 GGL_GEQUAL = 0x0206,
michael@0 137 GGL_ALWAYS = 0x0207,
michael@0 138
michael@0 139 // LogicOp
michael@0 140 GGL_CLEAR = 0x1500, // 0
michael@0 141 GGL_AND = 0x1501, // s & d
michael@0 142 GGL_AND_REVERSE = 0x1502, // s & ~d
michael@0 143 GGL_COPY = 0x1503, // s
michael@0 144 GGL_AND_INVERTED = 0x1504, // ~s & d
michael@0 145 GGL_NOOP = 0x1505, // d
michael@0 146 GGL_XOR = 0x1506, // s ^ d
michael@0 147 GGL_OR = 0x1507, // s | d
michael@0 148 GGL_NOR = 0x1508, // ~(s | d)
michael@0 149 GGL_EQUIV = 0x1509, // ~(s ^ d)
michael@0 150 GGL_INVERT = 0x150A, // ~d
michael@0 151 GGL_OR_REVERSE = 0x150B, // s | ~d
michael@0 152 GGL_COPY_INVERTED = 0x150C, // ~s
michael@0 153 GGL_OR_INVERTED = 0x150D, // ~s | d
michael@0 154 GGL_NAND = 0x150E, // ~(s & d)
michael@0 155 GGL_SET = 0x150F, // 1
michael@0 156
michael@0 157 // blending equation & function
michael@0 158 GGL_ZERO = 0, // SD
michael@0 159 GGL_ONE = 1, // SD
michael@0 160 GGL_SRC_COLOR = 0x0300, // D
michael@0 161 GGL_ONE_MINUS_SRC_COLOR = 0x0301, // D
michael@0 162 GGL_SRC_ALPHA = 0x0302, // SD
michael@0 163 GGL_ONE_MINUS_SRC_ALPHA = 0x0303, // SD
michael@0 164 GGL_DST_ALPHA = 0x0304, // SD
michael@0 165 GGL_ONE_MINUS_DST_ALPHA = 0x0305, // SD
michael@0 166 GGL_DST_COLOR = 0x0306, // S
michael@0 167 GGL_ONE_MINUS_DST_COLOR = 0x0307, // S
michael@0 168 GGL_SRC_ALPHA_SATURATE = 0x0308, // S
michael@0 169
michael@0 170 // clear bits
michael@0 171 GGL_DEPTH_BUFFER_BIT = 0x00000100,
michael@0 172 GGL_STENCIL_BUFFER_BIT = 0x00000400,
michael@0 173 GGL_COLOR_BUFFER_BIT = 0x00004000,
michael@0 174
michael@0 175 // errors
michael@0 176 GGL_NO_ERROR = 0,
michael@0 177 GGL_INVALID_ENUM = 0x0500,
michael@0 178 GGL_INVALID_VALUE = 0x0501,
michael@0 179 GGL_INVALID_OPERATION = 0x0502,
michael@0 180 GGL_STACK_OVERFLOW = 0x0503,
michael@0 181 GGL_STACK_UNDERFLOW = 0x0504,
michael@0 182 GGL_OUT_OF_MEMORY = 0x0505
michael@0 183 };
michael@0 184
michael@0 185 // ----------------------------------------------------------------------------
michael@0 186
michael@0 187 typedef struct {
michael@0 188 GGLsizei version; // always set to sizeof(GGLSurface)
michael@0 189 GGLuint width; // width in pixels
michael@0 190 GGLuint height; // height in pixels
michael@0 191 GGLint stride; // stride in pixels
michael@0 192 GGLubyte* data; // pointer to the bits
michael@0 193 GGLubyte format; // pixel format
michael@0 194 GGLubyte rfu[3]; // must be zero
michael@0 195 // these values are dependent on the used format
michael@0 196 union {
michael@0 197 GGLint compressedFormat;
michael@0 198 GGLint vstride;
michael@0 199 };
michael@0 200 void* reserved;
michael@0 201 } GGLSurface;
michael@0 202
michael@0 203
michael@0 204 typedef struct {
michael@0 205 // immediate rendering
michael@0 206 void (*pointx)(void *con, const GGLcoord* v, GGLcoord r);
michael@0 207 void (*linex)(void *con,
michael@0 208 const GGLcoord* v0, const GGLcoord* v1, GGLcoord width);
michael@0 209 void (*recti)(void* c, GGLint l, GGLint t, GGLint r, GGLint b);
michael@0 210 void (*trianglex)(void* c,
michael@0 211 GGLcoord const* v0, GGLcoord const* v1, GGLcoord const* v2);
michael@0 212
michael@0 213 // scissor
michael@0 214 void (*scissor)(void* c, GGLint x, GGLint y, GGLsizei width, GGLsizei height);
michael@0 215
michael@0 216 // Set the textures and color buffers
michael@0 217 void (*activeTexture)(void* c, GGLuint tmu);
michael@0 218 void (*bindTexture)(void* c, const GGLSurface* surface);
michael@0 219 void (*colorBuffer)(void* c, const GGLSurface* surface);
michael@0 220 void (*readBuffer)(void* c, const GGLSurface* surface);
michael@0 221 void (*depthBuffer)(void* c, const GGLSurface* surface);
michael@0 222 void (*bindTextureLod)(void* c, GGLuint tmu, const GGLSurface* surface);
michael@0 223
michael@0 224 // enable/disable features
michael@0 225 void (*enable)(void* c, GGLenum name);
michael@0 226 void (*disable)(void* c, GGLenum name);
michael@0 227 void (*enableDisable)(void* c, GGLenum name, GGLboolean en);
michael@0 228
michael@0 229 // specify the fragment's color
michael@0 230 void (*shadeModel)(void* c, GGLenum mode);
michael@0 231 void (*color4xv)(void* c, const GGLclampx* color);
michael@0 232 // specify color iterators (16.16)
michael@0 233 void (*colorGrad12xv)(void* c, const GGLcolor* grad);
michael@0 234
michael@0 235 // specify Z coordinate iterators (0.32)
michael@0 236 void (*zGrad3xv)(void* c, const GGLfixed32* grad);
michael@0 237
michael@0 238 // specify W coordinate iterators (16.16)
michael@0 239 void (*wGrad3xv)(void* c, const GGLfixed* grad);
michael@0 240
michael@0 241 // specify fog iterator & color (16.16)
michael@0 242 void (*fogGrad3xv)(void* c, const GGLfixed* grad);
michael@0 243 void (*fogColor3xv)(void* c, const GGLclampx* color);
michael@0 244
michael@0 245 // specify blending parameters
michael@0 246 void (*blendFunc)(void* c, GGLenum src, GGLenum dst);
michael@0 247 void (*blendFuncSeparate)(void* c, GGLenum src, GGLenum dst,
michael@0 248 GGLenum srcAlpha, GGLenum dstAplha);
michael@0 249
michael@0 250 // texture environnement (REPLACE / MODULATE / DECAL / BLEND)
michael@0 251 void (*texEnvi)(void* c, GGLenum target,
michael@0 252 GGLenum pname,
michael@0 253 GGLint param);
michael@0 254
michael@0 255 void (*texEnvxv)(void* c, GGLenum target,
michael@0 256 GGLenum pname, const GGLfixed* params);
michael@0 257
michael@0 258 // texture parameters (Wrapping, filter)
michael@0 259 void (*texParameteri)(void* c, GGLenum target,
michael@0 260 GGLenum pname,
michael@0 261 GGLint param);
michael@0 262
michael@0 263 // texture iterators (16.16)
michael@0 264 void (*texCoord2i)(void* c, GGLint s, GGLint t);
michael@0 265 void (*texCoord2x)(void* c, GGLfixed s, GGLfixed t);
michael@0 266
michael@0 267 // s, dsdx, dsdy, scale, t, dtdx, dtdy, tscale
michael@0 268 // This api uses block floating-point for S and T texture coordinates.
michael@0 269 // All values are given in 16.16, scaled by 'scale'. In other words,
michael@0 270 // set scale to 0, for 16.16 values.
michael@0 271 void (*texCoordGradScale8xv)(void* c, GGLint tmu, const int32_t* grad8);
michael@0 272
michael@0 273 void (*texGeni)(void* c, GGLenum coord, GGLenum pname, GGLint param);
michael@0 274
michael@0 275 // masking
michael@0 276 void (*colorMask)(void* c, GGLboolean red,
michael@0 277 GGLboolean green,
michael@0 278 GGLboolean blue,
michael@0 279 GGLboolean alpha);
michael@0 280
michael@0 281 void (*depthMask)(void* c, GGLboolean flag);
michael@0 282
michael@0 283 void (*stencilMask)(void* c, GGLuint mask);
michael@0 284
michael@0 285 // alpha func
michael@0 286 void (*alphaFuncx)(void* c, GGLenum func, GGLclampx ref);
michael@0 287
michael@0 288 // depth func
michael@0 289 void (*depthFunc)(void* c, GGLenum func);
michael@0 290
michael@0 291 // logic op
michael@0 292 void (*logicOp)(void* c, GGLenum opcode);
michael@0 293
michael@0 294 // clear
michael@0 295 void (*clear)(void* c, GGLbitfield mask);
michael@0 296 void (*clearColorx)(void* c,
michael@0 297 GGLclampx r, GGLclampx g, GGLclampx b, GGLclampx a);
michael@0 298 void (*clearDepthx)(void* c, GGLclampx depth);
michael@0 299 void (*clearStencil)(void* c, GGLint s);
michael@0 300
michael@0 301 // framebuffer operations
michael@0 302 void (*copyPixels)(void* c, GGLint x, GGLint y,
michael@0 303 GGLsizei width, GGLsizei height, GGLenum type);
michael@0 304 void (*rasterPos2x)(void* c, GGLfixed x, GGLfixed y);
michael@0 305 void (*rasterPos2i)(void* c, GGLint x, GGLint y);
michael@0 306 } GGLContext;
michael@0 307
michael@0 308 // ----------------------------------------------------------------------------
michael@0 309
michael@0 310 #ifdef __cplusplus
michael@0 311 extern "C" {
michael@0 312 #endif
michael@0 313
michael@0 314 // construct / destroy the context
michael@0 315 ssize_t gglInit(GGLContext** context);
michael@0 316 ssize_t gglUninit(GGLContext* context);
michael@0 317
michael@0 318 GGLint gglBitBlti(
michael@0 319 GGLContext* c,
michael@0 320 int tmu,
michael@0 321 GGLint crop[4],
michael@0 322 GGLint where[4]);
michael@0 323
michael@0 324 #ifdef __cplusplus
michael@0 325 };
michael@0 326 #endif
michael@0 327
michael@0 328 // ----------------------------------------------------------------------------
michael@0 329
michael@0 330 #endif // ANDROID_PIXELFLINGER_H

mercurial