summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'libpixelflinger')
-rw-r--r--libpixelflinger/Android.mk2
-rw-r--r--libpixelflinger/include/pixelflinger/format.h136
-rw-r--r--libpixelflinger/include/pixelflinger/pixelflinger.h330
-rw-r--r--libpixelflinger/include/private/pixelflinger/ggl_context.h565
-rw-r--r--libpixelflinger/include/private/pixelflinger/ggl_fixed.h633
-rw-r--r--libpixelflinger/tests/arch-arm64/assembler/Android.mk2
-rw-r--r--libpixelflinger/tests/arch-arm64/disassembler/Android.mk3
-rw-r--r--libpixelflinger/tests/codegen/Android.mk2
-rw-r--r--libpixelflinger/tests/gglmul/Android.mk2
9 files changed, 6 insertions, 1669 deletions
diff --git a/libpixelflinger/Android.mk b/libpixelflinger/Android.mk
index 697db25e1..aa614bc17 100644
--- a/libpixelflinger/Android.mk
+++ b/libpixelflinger/Android.mk
@@ -62,8 +62,6 @@ LOCAL_SRC_FILES_arm := $(PIXELFLINGER_SRC_FILES_arm)
62LOCAL_SRC_FILES_arm64 := $(PIXELFLINGER_SRC_FILES_arm64) 62LOCAL_SRC_FILES_arm64 := $(PIXELFLINGER_SRC_FILES_arm64)
63LOCAL_SRC_FILES_mips := $(PIXELFLINGER_SRC_FILES_mips) 63LOCAL_SRC_FILES_mips := $(PIXELFLINGER_SRC_FILES_mips)
64LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS) 64LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS)
65LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
66LOCAL_C_INCLUDES += $(LOCAL_EXPORT_C_INCLUDE_DIRS)
67LOCAL_SHARED_LIBRARIES := libcutils liblog 65LOCAL_SHARED_LIBRARIES := libcutils liblog
68 66
69# Really this should go away entirely or at least not depend on 67# Really this should go away entirely or at least not depend on
diff --git a/libpixelflinger/include/pixelflinger/format.h b/libpixelflinger/include/pixelflinger/format.h
deleted file mode 100644
index 82eeca4d7..000000000
--- a/libpixelflinger/include/pixelflinger/format.h
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * Copyright (C) 2005 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#ifndef ANDROID_PIXELFLINGER_FORMAT_H
18#define ANDROID_PIXELFLINGER_FORMAT_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
23enum GGLPixelFormat {
24 // these constants need to match those
25 // in graphics/PixelFormat.java, ui/PixelFormat.h, BlitHardware.h
26 GGL_PIXEL_FORMAT_UNKNOWN = 0,
27 GGL_PIXEL_FORMAT_NONE = 0,
28
29 GGL_PIXEL_FORMAT_RGBA_8888 = 1, // 4x8-bit ARGB
30 GGL_PIXEL_FORMAT_RGBX_8888 = 2, // 3x8-bit RGB stored in 32-bit chunks
31 GGL_PIXEL_FORMAT_RGB_888 = 3, // 3x8-bit RGB
32 GGL_PIXEL_FORMAT_RGB_565 = 4, // 16-bit RGB
33 GGL_PIXEL_FORMAT_BGRA_8888 = 5, // 4x8-bit BGRA
34 GGL_PIXEL_FORMAT_RGBA_5551 = 6, // 16-bit RGBA
35 GGL_PIXEL_FORMAT_RGBA_4444 = 7, // 16-bit RGBA
36
37 GGL_PIXEL_FORMAT_A_8 = 8, // 8-bit A
38 GGL_PIXEL_FORMAT_L_8 = 9, // 8-bit L (R=G=B = L)
39 GGL_PIXEL_FORMAT_LA_88 = 0xA, // 16-bit LA
40 GGL_PIXEL_FORMAT_RGB_332 = 0xB, // 8-bit RGB (non paletted)
41
42 // reserved range. don't use.
43 GGL_PIXEL_FORMAT_RESERVED_10 = 0x10,
44 GGL_PIXEL_FORMAT_RESERVED_11 = 0x11,
45 GGL_PIXEL_FORMAT_RESERVED_12 = 0x12,
46 GGL_PIXEL_FORMAT_RESERVED_13 = 0x13,
47 GGL_PIXEL_FORMAT_RESERVED_14 = 0x14,
48 GGL_PIXEL_FORMAT_RESERVED_15 = 0x15,
49 GGL_PIXEL_FORMAT_RESERVED_16 = 0x16,
50 GGL_PIXEL_FORMAT_RESERVED_17 = 0x17,
51
52 // reserved/special formats
53 GGL_PIXEL_FORMAT_Z_16 = 0x18,
54 GGL_PIXEL_FORMAT_S_8 = 0x19,
55 GGL_PIXEL_FORMAT_SZ_24 = 0x1A,
56 GGL_PIXEL_FORMAT_SZ_8 = 0x1B,
57
58 // reserved range. don't use.
59 GGL_PIXEL_FORMAT_RESERVED_20 = 0x20,
60 GGL_PIXEL_FORMAT_RESERVED_21 = 0x21,
61};
62
63enum GGLFormatComponents {
64 GGL_STENCIL_INDEX = 0x1901,
65 GGL_DEPTH_COMPONENT = 0x1902,
66 GGL_ALPHA = 0x1906,
67 GGL_RGB = 0x1907,
68 GGL_RGBA = 0x1908,
69 GGL_LUMINANCE = 0x1909,
70 GGL_LUMINANCE_ALPHA = 0x190A,
71};
72
73enum GGLFormatComponentIndex {
74 GGL_INDEX_ALPHA = 0,
75 GGL_INDEX_RED = 1,
76 GGL_INDEX_GREEN = 2,
77 GGL_INDEX_BLUE = 3,
78 GGL_INDEX_STENCIL = 0,
79 GGL_INDEX_DEPTH = 1,
80 GGL_INDEX_Y = 0,
81 GGL_INDEX_CB = 1,
82 GGL_INDEX_CR = 2,
83};
84
85typedef struct {
86#ifdef __cplusplus
87 enum {
88 ALPHA = GGL_INDEX_ALPHA,
89 RED = GGL_INDEX_RED,
90 GREEN = GGL_INDEX_GREEN,
91 BLUE = GGL_INDEX_BLUE,
92 STENCIL = GGL_INDEX_STENCIL,
93 DEPTH = GGL_INDEX_DEPTH,
94 LUMA = GGL_INDEX_Y,
95 CHROMAB = GGL_INDEX_CB,
96 CHROMAR = GGL_INDEX_CR,
97 };
98 inline uint32_t mask(int i) const {
99 return ((1<<(c[i].h-c[i].l))-1)<<c[i].l;
100 }
101 inline uint32_t bits(int i) const {
102 return c[i].h - c[i].l;
103 }
104#endif
105 uint8_t size; // bytes per pixel
106 uint8_t bitsPerPixel;
107 union {
108 struct {
109 uint8_t ah; // alpha high bit position + 1
110 uint8_t al; // alpha low bit position
111 uint8_t rh; // red high bit position + 1
112 uint8_t rl; // red low bit position
113 uint8_t gh; // green high bit position + 1
114 uint8_t gl; // green low bit position
115 uint8_t bh; // blue high bit position + 1
116 uint8_t bl; // blue low bit position
117 };
118 struct {
119 uint8_t h;
120 uint8_t l;
121 } __attribute__((__packed__)) c[4];
122 } __attribute__((__packed__));
123 uint16_t components; // GGLFormatComponents
124} GGLFormat;
125
126
127#ifdef __cplusplus
128extern "C" const GGLFormat* gglGetPixelFormatTable(size_t* numEntries = 0);
129#else
130const GGLFormat* gglGetPixelFormatTable(size_t* numEntries);
131#endif
132
133
134// ----------------------------------------------------------------------------
135
136#endif // ANDROID_PIXELFLINGER_FORMAT_H
diff --git a/libpixelflinger/include/pixelflinger/pixelflinger.h b/libpixelflinger/include/pixelflinger/pixelflinger.h
deleted file mode 100644
index 8a2b4421b..000000000
--- a/libpixelflinger/include/pixelflinger/pixelflinger.h
+++ /dev/null
@@ -1,330 +0,0 @@
1/*
2 * Copyright (C) 2007 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#ifndef ANDROID_PIXELFLINGER_H
18#define ANDROID_PIXELFLINGER_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
23#include <pixelflinger/format.h>
24
25// GGL types
26
27typedef int8_t GGLbyte; // b
28typedef int16_t GGLshort; // s
29typedef int32_t GGLint; // i
30typedef ssize_t GGLsizei; // i
31typedef int32_t GGLfixed; // x
32typedef int32_t GGLclampx; // x
33typedef float GGLfloat; // f
34typedef float GGLclampf; // f
35typedef double GGLdouble; // d
36typedef double GGLclampd; // d
37typedef uint8_t GGLubyte; // ub
38typedef uint8_t GGLboolean; // ub
39typedef uint16_t GGLushort; // us
40typedef uint32_t GGLuint; // ui
41typedef unsigned int GGLenum; // ui
42typedef unsigned int GGLbitfield; // ui
43typedef void GGLvoid;
44typedef int32_t GGLfixed32;
45typedef int32_t GGLcolor;
46typedef int32_t GGLcoord;
47
48// ----------------------------------------------------------------------------
49
50#define GGL_MAX_VIEWPORT_DIMS 4096
51#define GGL_MAX_TEXTURE_SIZE 4096
52#define GGL_MAX_ALIASED_POINT_SIZE 0x7FFFFFF
53#define GGL_MAX_SMOOTH_POINT_SIZE 2048
54#define GGL_MAX_SMOOTH_LINE_WIDTH 2048
55
56// ----------------------------------------------------------------------------
57
58// All these names are compatible with their OpenGL equivalents
59// some of them are listed only for completeness
60enum GGLNames {
61 GGL_FALSE = 0,
62 GGL_TRUE = 1,
63
64 // enable/disable
65 GGL_SCISSOR_TEST = 0x0C11,
66 GGL_TEXTURE_2D = 0x0DE1,
67 GGL_ALPHA_TEST = 0x0BC0,
68 GGL_BLEND = 0x0BE2,
69 GGL_COLOR_LOGIC_OP = 0x0BF2,
70 GGL_DITHER = 0x0BD0,
71 GGL_STENCIL_TEST = 0x0B90,
72 GGL_DEPTH_TEST = 0x0B71,
73 GGL_AA = 0x80000001,
74 GGL_W_LERP = 0x80000004,
75 GGL_POINT_SMOOTH_NICE = 0x80000005,
76
77 // buffers, pixel drawing/reading
78 GGL_COLOR = 0x1800,
79
80 // fog
81 GGL_FOG = 0x0B60,
82
83 // shade model
84 GGL_FLAT = 0x1D00,
85 GGL_SMOOTH = 0x1D01,
86
87 // Texture parameter name
88 GGL_TEXTURE_MIN_FILTER = 0x2801,
89 GGL_TEXTURE_MAG_FILTER = 0x2800,
90 GGL_TEXTURE_WRAP_S = 0x2802,
91 GGL_TEXTURE_WRAP_T = 0x2803,
92 GGL_TEXTURE_WRAP_R = 0x2804,
93
94 // Texture Filter
95 GGL_NEAREST = 0x2600,
96 GGL_LINEAR = 0x2601,
97 GGL_NEAREST_MIPMAP_NEAREST = 0x2700,
98 GGL_LINEAR_MIPMAP_NEAREST = 0x2701,
99 GGL_NEAREST_MIPMAP_LINEAR = 0x2702,
100 GGL_LINEAR_MIPMAP_LINEAR = 0x2703,
101
102 // Texture Wrap Mode
103 GGL_CLAMP = 0x2900,
104 GGL_REPEAT = 0x2901,
105 GGL_CLAMP_TO_EDGE = 0x812F,
106
107 // Texture Env Mode
108 GGL_REPLACE = 0x1E01,
109 GGL_MODULATE = 0x2100,
110 GGL_DECAL = 0x2101,
111 GGL_ADD = 0x0104,
112
113 // Texture Env Parameter
114 GGL_TEXTURE_ENV_MODE = 0x2200,
115 GGL_TEXTURE_ENV_COLOR = 0x2201,
116
117 // Texture Env Target
118 GGL_TEXTURE_ENV = 0x2300,
119
120 // Texture coord generation
121 GGL_TEXTURE_GEN_MODE = 0x2500,
122 GGL_S = 0x2000,
123 GGL_T = 0x2001,
124 GGL_R = 0x2002,
125 GGL_Q = 0x2003,
126 GGL_ONE_TO_ONE = 0x80000002,
127 GGL_AUTOMATIC = 0x80000003,
128
129 // AlphaFunction
130 GGL_NEVER = 0x0200,
131 GGL_LESS = 0x0201,
132 GGL_EQUAL = 0x0202,
133 GGL_LEQUAL = 0x0203,
134 GGL_GREATER = 0x0204,
135 GGL_NOTEQUAL = 0x0205,
136 GGL_GEQUAL = 0x0206,
137 GGL_ALWAYS = 0x0207,
138
139 // LogicOp
140 GGL_CLEAR = 0x1500, // 0
141 GGL_AND = 0x1501, // s & d
142 GGL_AND_REVERSE = 0x1502, // s & ~d
143 GGL_COPY = 0x1503, // s
144 GGL_AND_INVERTED = 0x1504, // ~s & d
145 GGL_NOOP = 0x1505, // d
146 GGL_XOR = 0x1506, // s ^ d
147 GGL_OR = 0x1507, // s | d
148 GGL_NOR = 0x1508, // ~(s | d)
149 GGL_EQUIV = 0x1509, // ~(s ^ d)
150 GGL_INVERT = 0x150A, // ~d
151 GGL_OR_REVERSE = 0x150B, // s | ~d
152 GGL_COPY_INVERTED = 0x150C, // ~s
153 GGL_OR_INVERTED = 0x150D, // ~s | d
154 GGL_NAND = 0x150E, // ~(s & d)
155 GGL_SET = 0x150F, // 1
156
157 // blending equation & function
158 GGL_ZERO = 0, // SD
159 GGL_ONE = 1, // SD
160 GGL_SRC_COLOR = 0x0300, // D
161 GGL_ONE_MINUS_SRC_COLOR = 0x0301, // D
162 GGL_SRC_ALPHA = 0x0302, // SD
163 GGL_ONE_MINUS_SRC_ALPHA = 0x0303, // SD
164 GGL_DST_ALPHA = 0x0304, // SD
165 GGL_ONE_MINUS_DST_ALPHA = 0x0305, // SD
166 GGL_DST_COLOR = 0x0306, // S
167 GGL_ONE_MINUS_DST_COLOR = 0x0307, // S
168 GGL_SRC_ALPHA_SATURATE = 0x0308, // S
169
170 // clear bits
171 GGL_DEPTH_BUFFER_BIT = 0x00000100,
172 GGL_STENCIL_BUFFER_BIT = 0x00000400,
173 GGL_COLOR_BUFFER_BIT = 0x00004000,
174
175 // errors
176 GGL_NO_ERROR = 0,
177 GGL_INVALID_ENUM = 0x0500,
178 GGL_INVALID_VALUE = 0x0501,
179 GGL_INVALID_OPERATION = 0x0502,
180 GGL_STACK_OVERFLOW = 0x0503,
181 GGL_STACK_UNDERFLOW = 0x0504,
182 GGL_OUT_OF_MEMORY = 0x0505
183};
184
185// ----------------------------------------------------------------------------
186
187typedef struct {
188 GGLsizei version; // always set to sizeof(GGLSurface)
189 GGLuint width; // width in pixels
190 GGLuint height; // height in pixels
191 GGLint stride; // stride in pixels
192 GGLubyte* data; // pointer to the bits
193 GGLubyte format; // pixel format
194 GGLubyte rfu[3]; // must be zero
195 // these values are dependent on the used format
196 union {
197 GGLint compressedFormat;
198 GGLint vstride;
199 };
200 void* reserved;
201} GGLSurface;
202
203
204typedef struct {
205 // immediate rendering
206 void (*pointx)(void *con, const GGLcoord* v, GGLcoord r);
207 void (*linex)(void *con,
208 const GGLcoord* v0, const GGLcoord* v1, GGLcoord width);
209 void (*recti)(void* c, GGLint l, GGLint t, GGLint r, GGLint b);
210 void (*trianglex)(void* c,
211 GGLcoord const* v0, GGLcoord const* v1, GGLcoord const* v2);
212
213 // scissor
214 void (*scissor)(void* c, GGLint x, GGLint y, GGLsizei width, GGLsizei height);
215
216 // Set the textures and color buffers
217 void (*activeTexture)(void* c, GGLuint tmu);
218 void (*bindTexture)(void* c, const GGLSurface* surface);
219 void (*colorBuffer)(void* c, const GGLSurface* surface);
220 void (*readBuffer)(void* c, const GGLSurface* surface);
221 void (*depthBuffer)(void* c, const GGLSurface* surface);
222 void (*bindTextureLod)(void* c, GGLuint tmu, const GGLSurface* surface);
223
224 // enable/disable features
225 void (*enable)(void* c, GGLenum name);
226 void (*disable)(void* c, GGLenum name);
227 void (*enableDisable)(void* c, GGLenum name, GGLboolean en);
228
229 // specify the fragment's color
230 void (*shadeModel)(void* c, GGLenum mode);
231 void (*color4xv)(void* c, const GGLclampx* color);
232 // specify color iterators (16.16)
233 void (*colorGrad12xv)(void* c, const GGLcolor* grad);
234
235 // specify Z coordinate iterators (0.32)
236 void (*zGrad3xv)(void* c, const GGLfixed32* grad);
237
238 // specify W coordinate iterators (16.16)
239 void (*wGrad3xv)(void* c, const GGLfixed* grad);
240
241 // specify fog iterator & color (16.16)
242 void (*fogGrad3xv)(void* c, const GGLfixed* grad);
243 void (*fogColor3xv)(void* c, const GGLclampx* color);
244
245 // specify blending parameters
246 void (*blendFunc)(void* c, GGLenum src, GGLenum dst);
247 void (*blendFuncSeparate)(void* c, GGLenum src, GGLenum dst,
248 GGLenum srcAlpha, GGLenum dstAplha);
249
250 // texture environnement (REPLACE / MODULATE / DECAL / BLEND)
251 void (*texEnvi)(void* c, GGLenum target,
252 GGLenum pname,
253 GGLint param);
254
255 void (*texEnvxv)(void* c, GGLenum target,
256 GGLenum pname, const GGLfixed* params);
257
258 // texture parameters (Wrapping, filter)
259 void (*texParameteri)(void* c, GGLenum target,
260 GGLenum pname,
261 GGLint param);
262
263 // texture iterators (16.16)
264 void (*texCoord2i)(void* c, GGLint s, GGLint t);
265 void (*texCoord2x)(void* c, GGLfixed s, GGLfixed t);
266
267 // s, dsdx, dsdy, scale, t, dtdx, dtdy, tscale
268 // This api uses block floating-point for S and T texture coordinates.
269 // All values are given in 16.16, scaled by 'scale'. In other words,
270 // set scale to 0, for 16.16 values.
271 void (*texCoordGradScale8xv)(void* c, GGLint tmu, const int32_t* grad8);
272
273 void (*texGeni)(void* c, GGLenum coord, GGLenum pname, GGLint param);
274
275 // masking
276 void (*colorMask)(void* c, GGLboolean red,
277 GGLboolean green,
278 GGLboolean blue,
279 GGLboolean alpha);
280
281 void (*depthMask)(void* c, GGLboolean flag);
282
283 void (*stencilMask)(void* c, GGLuint mask);
284
285 // alpha func
286 void (*alphaFuncx)(void* c, GGLenum func, GGLclampx ref);
287
288 // depth func
289 void (*depthFunc)(void* c, GGLenum func);
290
291 // logic op
292 void (*logicOp)(void* c, GGLenum opcode);
293
294 // clear
295 void (*clear)(void* c, GGLbitfield mask);
296 void (*clearColorx)(void* c,
297 GGLclampx r, GGLclampx g, GGLclampx b, GGLclampx a);
298 void (*clearDepthx)(void* c, GGLclampx depth);
299 void (*clearStencil)(void* c, GGLint s);
300
301 // framebuffer operations
302 void (*copyPixels)(void* c, GGLint x, GGLint y,
303 GGLsizei width, GGLsizei height, GGLenum type);
304 void (*rasterPos2x)(void* c, GGLfixed x, GGLfixed y);
305 void (*rasterPos2i)(void* c, GGLint x, GGLint y);
306} GGLContext;
307
308// ----------------------------------------------------------------------------
309
310#ifdef __cplusplus
311extern "C" {
312#endif
313
314// construct / destroy the context
315ssize_t gglInit(GGLContext** context);
316ssize_t gglUninit(GGLContext* context);
317
318GGLint gglBitBlit(
319 GGLContext* c,
320 int tmu,
321 GGLint crop[4],
322 GGLint where[4]);
323
324#ifdef __cplusplus
325};
326#endif
327
328// ----------------------------------------------------------------------------
329
330#endif // ANDROID_PIXELFLINGER_H
diff --git a/libpixelflinger/include/private/pixelflinger/ggl_context.h b/libpixelflinger/include/private/pixelflinger/ggl_context.h
deleted file mode 100644
index d43655cbb..000000000
--- a/libpixelflinger/include/private/pixelflinger/ggl_context.h
+++ /dev/null
@@ -1,565 +0,0 @@
1/*
2 * Copyright (C) 2006 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#ifndef ANDROID_GGL_CONTEXT_H
18#define ANDROID_GGL_CONTEXT_H
19
20#include <stdint.h>
21#include <stddef.h>
22#include <string.h>
23#include <sys/types.h>
24#include <endian.h>
25
26#include <pixelflinger/pixelflinger.h>
27#include <private/pixelflinger/ggl_fixed.h>
28
29namespace android {
30
31// ----------------------------------------------------------------------------
32
33#if BYTE_ORDER == LITTLE_ENDIAN
34
35inline uint32_t GGL_RGBA_TO_HOST(uint32_t v) {
36 return v;
37}
38inline uint32_t GGL_HOST_TO_RGBA(uint32_t v) {
39 return v;
40}
41
42#else
43
44inline uint32_t GGL_RGBA_TO_HOST(uint32_t v) {
45#if defined(__mips__) && __mips==32 && __mips_isa_rev>=2
46 uint32_t r;
47 __asm__("wsbh %0, %1;"
48 "rotr %0, %0, 16"
49 : "=r" (r)
50 : "r" (v)
51 );
52 return r;
53#else
54 return (v<<24) | (v>>24) | ((v<<8)&0xff0000) | ((v>>8)&0xff00);
55#endif
56}
57inline uint32_t GGL_HOST_TO_RGBA(uint32_t v) {
58#if defined(__mips__) && __mips==32 && __mips_isa_rev>=2
59 uint32_t r;
60 __asm__("wsbh %0, %1;"
61 "rotr %0, %0, 16"
62 : "=r" (r)
63 : "r" (v)
64 );
65 return r;
66#else
67 return (v<<24) | (v>>24) | ((v<<8)&0xff0000) | ((v>>8)&0xff00);
68#endif
69}
70
71#endif
72
73// ----------------------------------------------------------------------------
74
75const int GGL_DITHER_BITS = 6; // dither weights stored on 6 bits
76const int GGL_DITHER_ORDER_SHIFT= 3;
77const int GGL_DITHER_ORDER = (1<<GGL_DITHER_ORDER_SHIFT);
78const int GGL_DITHER_SIZE = GGL_DITHER_ORDER * GGL_DITHER_ORDER;
79const int GGL_DITHER_MASK = GGL_DITHER_ORDER-1;
80
81// ----------------------------------------------------------------------------
82
83const int GGL_SUBPIXEL_BITS = 4;
84
85// TRI_FRACTION_BITS defines the number of bits we want to use
86// for the sub-pixel coordinates during the edge stepping, the
87// value shouldn't be more than 7, or bad things are going to
88// happen when drawing large triangles (8 doesn't work because
89// 32 bit muls will loose the sign bit)
90
91#define TRI_FRACTION_BITS (GGL_SUBPIXEL_BITS)
92#define TRI_ONE (1 << TRI_FRACTION_BITS)
93#define TRI_HALF (1 << (TRI_FRACTION_BITS-1))
94#define TRI_FROM_INT(x) ((x) << TRI_FRACTION_BITS)
95#define TRI_FRAC(x) ((x) & (TRI_ONE-1))
96#define TRI_FLOOR(x) ((x) & ~(TRI_ONE-1))
97#define TRI_CEIL(x) (((x) + (TRI_ONE-1)) & ~(TRI_ONE-1))
98#define TRI_ROUND(x) (((x) + TRI_HALF ) & ~(TRI_ONE-1))
99
100#define TRI_ROUDNING (1 << (16 - TRI_FRACTION_BITS - 1))
101#define TRI_FROM_FIXED(x) (((x)+TRI_ROUDNING) >> (16-TRI_FRACTION_BITS))
102
103#define TRI_SNAP_NEXT_HALF(x) (TRI_CEIL((x)+TRI_HALF) - TRI_HALF)
104#define TRI_SNAP_PREV_HALF(x) (TRI_CEIL((x)-TRI_HALF) - TRI_HALF)
105
106// ----------------------------------------------------------------------------
107
108const int GGL_COLOR_BITS = 24;
109
110// To maintain 8-bits color chanels, with a maximum GGLSurface
111// size of 4096 and GGL_SUBPIXEL_BITS=4, we need 8 + 12 + 4 = 24 bits
112// for encoding the color iterators
113
114inline GGLcolor gglFixedToIteratedColor(GGLfixed c) {
115 return (c << 8) - c;
116}
117
118// ----------------------------------------------------------------------------
119
120template<bool> struct CTA;
121template<> struct CTA<true> { };
122
123#define GGL_CONTEXT(con, c) context_t *con = static_cast<context_t *>(c)
124#define GGL_OFFSETOF(field) uintptr_t(&(((context_t*)0)->field))
125#define GGL_INIT_PROC(p, f) p.f = ggl_ ## f;
126#define GGL_BETWEEN(x, L, H) (uint32_t((x)-(L)) <= ((H)-(L)))
127
128#define ggl_likely(x) __builtin_expect(!!(x), 1)
129#define ggl_unlikely(x) __builtin_expect(!!(x), 0)
130
131const int GGL_TEXTURE_UNIT_COUNT = 2;
132const int GGL_TMU_STATE = 0x00000001;
133const int GGL_CB_STATE = 0x00000002;
134const int GGL_PIXEL_PIPELINE_STATE = 0x00000004;
135
136// ----------------------------------------------------------------------------
137
138#define GGL_RESERVE_NEEDS(name, l, s) \
139 const uint32_t GGL_NEEDS_##name##_MASK = (((1LU<<(s))-1)<<l); \
140 const uint32_t GGL_NEEDS_##name##_SHIFT = (l);
141
142#define GGL_BUILD_NEEDS(val, name) \
143 (((val)<<(GGL_NEEDS_##name##_SHIFT)) & GGL_NEEDS_##name##_MASK)
144
145#define GGL_READ_NEEDS(name, n) \
146 (uint32_t(n & GGL_NEEDS_##name##_MASK) >> GGL_NEEDS_##name##_SHIFT)
147
148#define GGL_NEED_MASK(name) (uint32_t(GGL_NEEDS_##name##_MASK))
149#define GGL_NEED(name, val) GGL_BUILD_NEEDS(val, name)
150
151GGL_RESERVE_NEEDS( CB_FORMAT, 0, 6 )
152GGL_RESERVE_NEEDS( SHADE, 6, 1 )
153GGL_RESERVE_NEEDS( W, 7, 1 )
154GGL_RESERVE_NEEDS( BLEND_SRC, 8, 4 )
155GGL_RESERVE_NEEDS( BLEND_DST, 12, 4 )
156GGL_RESERVE_NEEDS( BLEND_SRCA, 16, 4 )
157GGL_RESERVE_NEEDS( BLEND_DSTA, 20, 4 )
158GGL_RESERVE_NEEDS( LOGIC_OP, 24, 4 )
159GGL_RESERVE_NEEDS( MASK_ARGB, 28, 4 )
160
161GGL_RESERVE_NEEDS( P_ALPHA_TEST, 0, 3 )
162GGL_RESERVE_NEEDS( P_AA, 3, 1 )
163GGL_RESERVE_NEEDS( P_DEPTH_TEST, 4, 3 )
164GGL_RESERVE_NEEDS( P_MASK_Z, 7, 1 )
165GGL_RESERVE_NEEDS( P_DITHER, 8, 1 )
166GGL_RESERVE_NEEDS( P_FOG, 9, 1 )
167GGL_RESERVE_NEEDS( P_RESERVED1, 10,22 )
168
169GGL_RESERVE_NEEDS( T_FORMAT, 0, 6 )
170GGL_RESERVE_NEEDS( T_RESERVED0, 6, 1 )
171GGL_RESERVE_NEEDS( T_POT, 7, 1 )
172GGL_RESERVE_NEEDS( T_S_WRAP, 8, 2 )
173GGL_RESERVE_NEEDS( T_T_WRAP, 10, 2 )
174GGL_RESERVE_NEEDS( T_ENV, 12, 3 )
175GGL_RESERVE_NEEDS( T_LINEAR, 15, 1 )
176
177const int GGL_NEEDS_WRAP_CLAMP_TO_EDGE = 0;
178const int GGL_NEEDS_WRAP_REPEAT = 1;
179const int GGL_NEEDS_WRAP_11 = 2;
180
181inline uint32_t ggl_wrap_to_needs(uint32_t e) {
182 switch (e) {
183 case GGL_CLAMP: return GGL_NEEDS_WRAP_CLAMP_TO_EDGE;
184 case GGL_REPEAT: return GGL_NEEDS_WRAP_REPEAT;
185 }
186 return 0;
187}
188
189inline uint32_t ggl_blendfactor_to_needs(uint32_t b) {
190 if (b <= 1) return b;
191 return (b & 0xF)+2;
192}
193
194inline uint32_t ggl_needs_to_blendfactor(uint32_t n) {
195 if (n <= 1) return n;
196 return (n - 2) + 0x300;
197}
198
199inline uint32_t ggl_env_to_needs(uint32_t e) {
200 switch (e) {
201 case GGL_REPLACE: return 0;
202 case GGL_MODULATE: return 1;
203 case GGL_DECAL: return 2;
204 case GGL_BLEND: return 3;
205 case GGL_ADD: return 4;
206 }
207 return 0;
208}
209
210inline uint32_t ggl_needs_to_env(uint32_t n) {
211 const uint32_t envs[] = { GGL_REPLACE, GGL_MODULATE,
212 GGL_DECAL, GGL_BLEND, GGL_ADD };
213 return envs[n];
214
215}
216
217// ----------------------------------------------------------------------------
218
219enum {
220 GGL_ENABLE_BLENDING = 0x00000001,
221 GGL_ENABLE_SMOOTH = 0x00000002,
222 GGL_ENABLE_AA = 0x00000004,
223 GGL_ENABLE_LOGIC_OP = 0x00000008,
224 GGL_ENABLE_ALPHA_TEST = 0x00000010,
225 GGL_ENABLE_SCISSOR_TEST = 0x00000020,
226 GGL_ENABLE_TMUS = 0x00000040,
227 GGL_ENABLE_DEPTH_TEST = 0x00000080,
228 GGL_ENABLE_STENCIL_TEST = 0x00000100,
229 GGL_ENABLE_W = 0x00000200,
230 GGL_ENABLE_DITHER = 0x00000400,
231 GGL_ENABLE_FOG = 0x00000800,
232 GGL_ENABLE_POINT_AA_NICE= 0x00001000
233};
234
235// ----------------------------------------------------------------------------
236
237class needs_filter_t;
238struct needs_t {
239 inline int match(const needs_filter_t& filter);
240 inline bool operator == (const needs_t& rhs) const {
241 return (n==rhs.n) &&
242 (p==rhs.p) &&
243 (t[0]==rhs.t[0]) &&
244 (t[1]==rhs.t[1]);
245 }
246 inline bool operator != (const needs_t& rhs) const {
247 return !operator == (rhs);
248 }
249 uint32_t n;
250 uint32_t p;
251 uint32_t t[GGL_TEXTURE_UNIT_COUNT];
252};
253
254inline int compare_type(const needs_t& lhs, const needs_t& rhs) {
255 return memcmp(&lhs, &rhs, sizeof(needs_t));
256}
257
258struct needs_filter_t {
259 needs_t value;
260 needs_t mask;
261};
262
263int needs_t::match(const needs_filter_t& filter) {
264 uint32_t result =
265 ((filter.value.n ^ n) & filter.mask.n) |
266 ((filter.value.p ^ p) & filter.mask.p) |
267 ((filter.value.t[0] ^ t[0]) & filter.mask.t[0]) |
268 ((filter.value.t[1] ^ t[1]) & filter.mask.t[1]);
269 return (result == 0);
270}
271
272// ----------------------------------------------------------------------------
273
274struct context_t;
275class Assembly;
276
277struct blend_state_t {
278 uint32_t src;
279 uint32_t dst;
280 uint32_t src_alpha;
281 uint32_t dst_alpha;
282 uint8_t reserved;
283 uint8_t alpha_separate;
284 uint8_t operation;
285 uint8_t equation;
286};
287
288struct mask_state_t {
289 uint8_t color;
290 uint8_t depth;
291 uint32_t stencil;
292};
293
294struct clear_state_t {
295 GGLclampx r;
296 GGLclampx g;
297 GGLclampx b;
298 GGLclampx a;
299 GGLclampx depth;
300 GGLint stencil;
301 uint32_t colorPacked;
302 uint32_t depthPacked;
303 uint32_t stencilPacked;
304 uint32_t dirty;
305};
306
307struct fog_state_t {
308 uint8_t color[4];
309};
310
311struct logic_op_state_t {
312 uint16_t opcode;
313};
314
315struct alpha_test_state_t {
316 uint16_t func;
317 GGLcolor ref;
318};
319
320struct depth_test_state_t {
321 uint16_t func;
322 GGLclampx clearValue;
323};
324
325struct scissor_t {
326 uint32_t user_left;
327 uint32_t user_right;
328 uint32_t user_top;
329 uint32_t user_bottom;
330 uint32_t left;
331 uint32_t right;
332 uint32_t top;
333 uint32_t bottom;
334};
335
336struct pixel_t {
337 uint32_t c[4];
338 uint8_t s[4];
339};
340
341struct surface_t {
342 union {
343 GGLSurface s;
344 // Keep the following struct field types in line with the corresponding
345 // GGLSurface fields to avoid mismatches leading to errors.
346 struct {
347 GGLsizei reserved;
348 GGLuint width;
349 GGLuint height;
350 GGLint stride;
351 GGLubyte* data;
352 GGLubyte format;
353 GGLubyte dirty;
354 GGLubyte pad[2];
355 };
356 };
357 void (*read) (const surface_t* s, context_t* c,
358 uint32_t x, uint32_t y, pixel_t* pixel);
359 void (*write)(const surface_t* s, context_t* c,
360 uint32_t x, uint32_t y, const pixel_t* pixel);
361};
362
363// ----------------------------------------------------------------------------
364
365struct texture_shade_t {
366 union {
367 struct {
368 int32_t is0;
369 int32_t idsdx;
370 int32_t idsdy;
371 int sscale;
372 int32_t it0;
373 int32_t idtdx;
374 int32_t idtdy;
375 int tscale;
376 };
377 struct {
378 int32_t v;
379 int32_t dx;
380 int32_t dy;
381 int scale;
382 } st[2];
383 };
384};
385
386struct texture_iterators_t {
387 // these are not encoded in the same way than in the
388 // texture_shade_t structure
389 union {
390 struct {
391 GGLfixed ydsdy;
392 GGLfixed dsdx;
393 GGLfixed dsdy;
394 int sscale;
395 GGLfixed ydtdy;
396 GGLfixed dtdx;
397 GGLfixed dtdy;
398 int tscale;
399 };
400 struct {
401 GGLfixed ydvdy;
402 GGLfixed dvdx;
403 GGLfixed dvdy;
404 int scale;
405 } st[2];
406 };
407};
408
409struct texture_t {
410 surface_t surface;
411 texture_iterators_t iterators;
412 texture_shade_t shade;
413 uint32_t s_coord;
414 uint32_t t_coord;
415 uint16_t s_wrap;
416 uint16_t t_wrap;
417 uint16_t min_filter;
418 uint16_t mag_filter;
419 uint16_t env;
420 uint8_t env_color[4];
421 uint8_t enable;
422 uint8_t dirty;
423};
424
425struct raster_t {
426 GGLfixed x;
427 GGLfixed y;
428};
429
430struct framebuffer_t {
431 surface_t color;
432 surface_t read;
433 surface_t depth;
434 surface_t stencil;
435 int16_t *coverage;
436 size_t coverageBufferSize;
437};
438
439// ----------------------------------------------------------------------------
440
441struct iterators_t {
442 int32_t xl;
443 int32_t xr;
444 int32_t y;
445 GGLcolor ydady;
446 GGLcolor ydrdy;
447 GGLcolor ydgdy;
448 GGLcolor ydbdy;
449 GGLfixed ydzdy;
450 GGLfixed ydwdy;
451 GGLfixed ydfdy;
452};
453
454struct shade_t {
455 GGLcolor a0;
456 GGLcolor dadx;
457 GGLcolor dady;
458 GGLcolor r0;
459 GGLcolor drdx;
460 GGLcolor drdy;
461 GGLcolor g0;
462 GGLcolor dgdx;
463 GGLcolor dgdy;
464 GGLcolor b0;
465 GGLcolor dbdx;
466 GGLcolor dbdy;
467 uint32_t z0;
468 GGLfixed32 dzdx;
469 GGLfixed32 dzdy;
470 GGLfixed w0;
471 GGLfixed dwdx;
472 GGLfixed dwdy;
473 uint32_t f0;
474 GGLfixed dfdx;
475 GGLfixed dfdy;
476};
477
478// these are used in the generated code
479// we use this mirror structure to improve
480// data locality in the pixel pipeline
481struct generated_tex_vars_t {
482 uint32_t width;
483 uint32_t height;
484 uint32_t stride;
485 uintptr_t data;
486 int32_t dsdx;
487 int32_t dtdx;
488 int32_t spill[2];
489};
490
491struct generated_vars_t {
492 struct {
493 int32_t c;
494 int32_t dx;
495 } argb[4];
496 int32_t aref;
497 int32_t dzdx;
498 int32_t zbase;
499 int32_t f;
500 int32_t dfdx;
501 int32_t spill[3];
502 generated_tex_vars_t texture[GGL_TEXTURE_UNIT_COUNT];
503 int32_t rt;
504 int32_t lb;
505};
506
507// ----------------------------------------------------------------------------
508
509struct state_t {
510 framebuffer_t buffers;
511 texture_t texture[GGL_TEXTURE_UNIT_COUNT];
512 scissor_t scissor;
513 raster_t raster;
514 blend_state_t blend;
515 alpha_test_state_t alpha_test;
516 depth_test_state_t depth_test;
517 mask_state_t mask;
518 clear_state_t clear;
519 fog_state_t fog;
520 logic_op_state_t logic_op;
521 uint32_t enables;
522 uint32_t enabled_tmu;
523 needs_t needs;
524};
525
526// ----------------------------------------------------------------------------
527
528struct context_t {
529 GGLContext procs;
530 state_t state;
531 shade_t shade;
532 iterators_t iterators;
533 generated_vars_t generated_vars __attribute__((aligned(32)));
534 uint8_t ditherMatrix[GGL_DITHER_SIZE] __attribute__((aligned(32)));
535 uint32_t packed;
536 uint32_t packed8888;
537 const GGLFormat* formats;
538 uint32_t dirty;
539 texture_t* activeTMU;
540 uint32_t activeTMUIndex;
541
542 void (*init_y)(context_t* c, int32_t y);
543 void (*step_y)(context_t* c);
544 void (*scanline)(context_t* c);
545 void (*span)(context_t* c);
546 void (*rect)(context_t* c, size_t yc);
547
548 void* base;
549 Assembly* scanline_as;
550 GGLenum error;
551};
552
553// ----------------------------------------------------------------------------
554
555void ggl_init_context(context_t* context);
556void ggl_uninit_context(context_t* context);
557void ggl_error(context_t* c, GGLenum error);
558int64_t ggl_system_time();
559
560// ----------------------------------------------------------------------------
561
562};
563
564#endif // ANDROID_GGL_CONTEXT_H
565
diff --git a/libpixelflinger/include/private/pixelflinger/ggl_fixed.h b/libpixelflinger/include/private/pixelflinger/ggl_fixed.h
deleted file mode 100644
index 787f6202b..000000000
--- a/libpixelflinger/include/private/pixelflinger/ggl_fixed.h
+++ /dev/null
@@ -1,633 +0,0 @@
1/*
2 * Copyright (C) 2005 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#ifndef ANDROID_GGL_FIXED_H
18#define ANDROID_GGL_FIXED_H
19
20#include <math.h>
21#include <pixelflinger/pixelflinger.h>
22
23// ----------------------------------------------------------------------------
24
25#define CONST __attribute__((const))
26#define ALWAYS_INLINE __attribute__((always_inline))
27
28const GGLfixed FIXED_BITS = 16;
29const GGLfixed FIXED_EPSILON = 1;
30const GGLfixed FIXED_ONE = 1L<<FIXED_BITS;
31const GGLfixed FIXED_HALF = 1L<<(FIXED_BITS-1);
32const GGLfixed FIXED_MIN = 0x80000000L;
33const GGLfixed FIXED_MAX = 0x7FFFFFFFL;
34
35inline GGLfixed gglIntToFixed(GGLfixed i) ALWAYS_INLINE ;
36inline GGLfixed gglFixedToIntRound(GGLfixed f) ALWAYS_INLINE ;
37inline GGLfixed gglFixedToIntFloor(GGLfixed f) ALWAYS_INLINE ;
38inline GGLfixed gglFixedToIntCeil(GGLfixed f) ALWAYS_INLINE ;
39inline GGLfixed gglFracx(GGLfixed v) ALWAYS_INLINE ;
40inline GGLfixed gglFloorx(GGLfixed v) ALWAYS_INLINE ;
41inline GGLfixed gglCeilx(GGLfixed v) ALWAYS_INLINE ;
42inline GGLfixed gglCenterx(GGLfixed v) ALWAYS_INLINE ;
43inline GGLfixed gglRoundx(GGLfixed v) ALWAYS_INLINE ;
44
45GGLfixed gglIntToFixed(GGLfixed i) {
46 return i<<FIXED_BITS;
47}
48GGLfixed gglFixedToIntRound(GGLfixed f) {
49 return (f + FIXED_HALF)>>FIXED_BITS;
50}
51GGLfixed gglFixedToIntFloor(GGLfixed f) {
52 return f>>FIXED_BITS;
53}
54GGLfixed gglFixedToIntCeil(GGLfixed f) {
55 return (f + ((1<<FIXED_BITS) - 1))>>FIXED_BITS;
56}
57
58GGLfixed gglFracx(GGLfixed v) {
59 return v & ((1<<FIXED_BITS)-1);
60}
61GGLfixed gglFloorx(GGLfixed v) {
62 return gglFixedToIntFloor(v)<<FIXED_BITS;
63}
64GGLfixed gglCeilx(GGLfixed v) {
65 return gglFixedToIntCeil(v)<<FIXED_BITS;
66}
67GGLfixed gglCenterx(GGLfixed v) {
68 return gglFloorx(v + FIXED_HALF) | FIXED_HALF;
69}
70GGLfixed gglRoundx(GGLfixed v) {
71 return gglFixedToIntRound(v)<<FIXED_BITS;
72}
73
74// conversion from (unsigned) int, short, byte to fixed...
75#define GGL_B_TO_X(_x) GGLfixed( ((int32_t(_x)+1)>>1)<<10 )
76#define GGL_S_TO_X(_x) GGLfixed( ((int32_t(_x)+1)>>1)<<2 )
77#define GGL_I_TO_X(_x) GGLfixed( ((int32_t(_x)>>1)+1)>>14 )
78#define GGL_UB_TO_X(_x) GGLfixed( uint32_t(_x) + \
79 (uint32_t(_x)<<8) + \
80 (uint32_t(_x)>>7) )
81#define GGL_US_TO_X(_x) GGLfixed( (_x) + ((_x)>>15) )
82#define GGL_UI_TO_X(_x) GGLfixed( (((_x)>>1)+1)>>15 )
83
84// ----------------------------------------------------------------------------
85
86GGLfixed gglPowx(GGLfixed x, GGLfixed y) CONST;
87GGLfixed gglSqrtx(GGLfixed a) CONST;
88GGLfixed gglSqrtRecipx(GGLfixed x) CONST;
89GGLfixed gglFastDivx(GGLfixed n, GGLfixed d) CONST;
90int32_t gglMulDivi(int32_t a, int32_t b, int32_t c);
91
92int32_t gglRecipQNormalized(int32_t x, int* exponent);
93int32_t gglRecipQ(GGLfixed x, int q) CONST;
94
95inline GGLfixed gglRecip(GGLfixed x) CONST;
96inline GGLfixed gglRecip(GGLfixed x) {
97 return gglRecipQ(x, 16);
98}
99
100inline GGLfixed gglRecip28(GGLfixed x) CONST;
101int32_t gglRecip28(GGLfixed x) {
102 return gglRecipQ(x, 28);
103}
104
105// ----------------------------------------------------------------------------
106
107#if defined(__arm__) && !defined(__thumb__)
108
109// inline ARM implementations
110inline GGLfixed gglMulx(GGLfixed x, GGLfixed y, int shift) CONST;
111inline GGLfixed gglMulx(GGLfixed x, GGLfixed y, int shift) {
112 GGLfixed result, t;
113 if (__builtin_constant_p(shift)) {
114 asm("smull %[lo], %[hi], %[x], %[y] \n"
115 "movs %[lo], %[lo], lsr %[rshift] \n"
116 "adc %[lo], %[lo], %[hi], lsl %[lshift] \n"
117 : [lo]"=r"(result), [hi]"=r"(t), [x]"=r"(x)
118 : "%[x]"(x), [y]"r"(y), [lshift] "I"(32-shift), [rshift] "I"(shift)
119 : "cc"
120 );
121 } else {
122 asm("smull %[lo], %[hi], %[x], %[y] \n"
123 "movs %[lo], %[lo], lsr %[rshift] \n"
124 "adc %[lo], %[lo], %[hi], lsl %[lshift] \n"
125 : [lo]"=&r"(result), [hi]"=&r"(t), [x]"=&r"(x)
126 : "%[x]"(x), [y]"r"(y), [lshift] "r"(32-shift), [rshift] "r"(shift)
127 : "cc"
128 );
129 }
130 return result;
131}
132
133inline GGLfixed gglMulAddx(GGLfixed x, GGLfixed y, GGLfixed a, int shift) CONST;
134inline GGLfixed gglMulAddx(GGLfixed x, GGLfixed y, GGLfixed a, int shift) {
135 GGLfixed result, t;
136 if (__builtin_constant_p(shift)) {
137 asm("smull %[lo], %[hi], %[x], %[y] \n"
138 "add %[lo], %[a], %[lo], lsr %[rshift] \n"
139 "add %[lo], %[lo], %[hi], lsl %[lshift] \n"
140 : [lo]"=&r"(result), [hi]"=&r"(t), [x]"=&r"(x)
141 : "%[x]"(x), [y]"r"(y), [a]"r"(a), [lshift] "I"(32-shift), [rshift] "I"(shift)
142 );
143 } else {
144 asm("smull %[lo], %[hi], %[x], %[y] \n"
145 "add %[lo], %[a], %[lo], lsr %[rshift] \n"
146 "add %[lo], %[lo], %[hi], lsl %[lshift] \n"
147 : [lo]"=&r"(result), [hi]"=&r"(t), [x]"=&r"(x)
148 : "%[x]"(x), [y]"r"(y), [a]"r"(a), [lshift] "r"(32-shift), [rshift] "r"(shift)
149 );
150 }
151 return result;
152}
153
154inline GGLfixed gglMulSubx(GGLfixed x, GGLfixed y, GGLfixed a, int shift) CONST;
155inline GGLfixed gglMulSubx(GGLfixed x, GGLfixed y, GGLfixed a, int shift) {
156 GGLfixed result, t;
157 if (__builtin_constant_p(shift)) {
158 asm("smull %[lo], %[hi], %[x], %[y] \n"
159 "rsb %[lo], %[a], %[lo], lsr %[rshift] \n"
160 "add %[lo], %[lo], %[hi], lsl %[lshift] \n"
161 : [lo]"=&r"(result), [hi]"=&r"(t), [x]"=&r"(x)
162 : "%[x]"(x), [y]"r"(y), [a]"r"(a), [lshift] "I"(32-shift), [rshift] "I"(shift)
163 );
164 } else {
165 asm("smull %[lo], %[hi], %[x], %[y] \n"
166 "rsb %[lo], %[a], %[lo], lsr %[rshift] \n"
167 "add %[lo], %[lo], %[hi], lsl %[lshift] \n"
168 : [lo]"=&r"(result), [hi]"=&r"(t), [x]"=&r"(x)
169 : "%[x]"(x), [y]"r"(y), [a]"r"(a), [lshift] "r"(32-shift), [rshift] "r"(shift)
170 );
171 }
172 return result;
173}
174
175inline int64_t gglMulii(int32_t x, int32_t y) CONST;
176inline int64_t gglMulii(int32_t x, int32_t y)
177{
178 // 64-bits result: r0=low, r1=high
179 union {
180 struct {
181 int32_t lo;
182 int32_t hi;
183 } s;
184 int64_t res;
185 };
186 asm("smull %0, %1, %2, %3 \n"
187 : "=r"(s.lo), "=&r"(s.hi)
188 : "%r"(x), "r"(y)
189 :
190 );
191 return res;
192}
193#elif defined(__mips__) && __mips_isa_rev < 6
194
195/*inline MIPS implementations*/
196inline GGLfixed gglMulx(GGLfixed a, GGLfixed b, int shift) CONST;
197inline GGLfixed gglMulx(GGLfixed a, GGLfixed b, int shift) {
198 GGLfixed result,tmp,tmp1,tmp2;
199
200 if (__builtin_constant_p(shift)) {
201 if (shift == 0) {
202 asm ("mult %[a], %[b] \t\n"
203 "mflo %[res] \t\n"
204 : [res]"=&r"(result),[tmp]"=&r"(tmp)
205 : [a]"r"(a),[b]"r"(b)
206 : "%hi","%lo"
207 );
208 } else if (shift == 32)
209 {
210 asm ("mult %[a], %[b] \t\n"
211 "li %[tmp],1\t\n"
212 "sll %[tmp],%[tmp],0x1f\t\n"
213 "mflo %[res] \t\n"
214 "addu %[tmp1],%[tmp],%[res] \t\n"
215 "sltu %[tmp1],%[tmp1],%[tmp]\t\n" /*obit*/
216 "sra %[tmp],%[tmp],0x1f \t\n"
217 "mfhi %[res] \t\n"
218 "addu %[res],%[res],%[tmp]\t\n"
219 "addu %[res],%[res],%[tmp1]\t\n"
220 : [res]"=&r"(result),[tmp]"=&r"(tmp),[tmp1]"=&r"(tmp1)
221 : [a]"r"(a),[b]"r"(b),[shift]"I"(shift)
222 : "%hi","%lo"
223 );
224 } else if ((shift >0) && (shift < 32))
225 {
226 asm ("mult %[a], %[b] \t\n"
227 "li %[tmp],1 \t\n"
228 "sll %[tmp],%[tmp],%[shiftm1] \t\n"
229 "mflo %[res] \t\n"
230 "addu %[tmp1],%[tmp],%[res] \t\n"
231 "sltu %[tmp1],%[tmp1],%[tmp] \t\n" /*obit?*/
232 "addu %[res],%[res],%[tmp] \t\n"
233 "mfhi %[tmp] \t\n"
234 "addu %[tmp],%[tmp],%[tmp1] \t\n"
235 "sll %[tmp],%[tmp],%[lshift] \t\n"
236 "srl %[res],%[res],%[rshift] \t\n"
237 "or %[res],%[res],%[tmp] \t\n"
238 : [res]"=&r"(result),[tmp]"=&r"(tmp),[tmp1]"=&r"(tmp1),[tmp2]"=&r"(tmp2)
239 : [a]"r"(a),[b]"r"(b),[lshift]"I"(32-shift),[rshift]"I"(shift),[shiftm1]"I"(shift-1)
240 : "%hi","%lo"
241 );
242 } else {
243 asm ("mult %[a], %[b] \t\n"
244 "li %[tmp],1 \t\n"
245 "sll %[tmp],%[tmp],%[shiftm1] \t\n"
246 "mflo %[res] \t\n"
247 "addu %[tmp1],%[tmp],%[res] \t\n"
248 "sltu %[tmp1],%[tmp1],%[tmp] \t\n" /*obit?*/
249 "sra %[tmp2],%[tmp],0x1f \t\n"
250 "addu %[res],%[res],%[tmp] \t\n"
251 "mfhi %[tmp] \t\n"
252 "addu %[tmp],%[tmp],%[tmp2] \t\n"
253 "addu %[tmp],%[tmp],%[tmp1] \t\n" /*tmp=hi*/
254 "srl %[tmp2],%[res],%[rshift] \t\n"
255 "srav %[res], %[tmp],%[rshift]\t\n"
256 "sll %[tmp],%[tmp],1 \t\n"
257 "sll %[tmp],%[tmp],%[norbits] \t\n"
258 "or %[tmp],%[tmp],%[tmp2] \t\n"
259 "movz %[res],%[tmp],%[bit5] \t\n"
260 : [res]"=&r"(result),[tmp]"=&r"(tmp),[tmp1]"=&r"(tmp1),[tmp2]"=&r"(tmp2)
261 : [a]"r"(a),[b]"r"(b),[norbits]"I"(~(shift)),[rshift]"I"(shift),[shiftm1] "I"(shift-1),[bit5]"I"(shift & 0x20)
262 : "%hi","%lo"
263 );
264 }
265 } else {
266 asm ("mult %[a], %[b] \t\n"
267 "li %[tmp],1 \t\n"
268 "sll %[tmp],%[tmp],%[shiftm1] \t\n"
269 "mflo %[res] \t\n"
270 "addu %[tmp1],%[tmp],%[res] \t\n"
271 "sltu %[tmp1],%[tmp1],%[tmp] \t\n" /*obit?*/
272 "sra %[tmp2],%[tmp],0x1f \t\n"
273 "addu %[res],%[res],%[tmp] \t\n"
274 "mfhi %[tmp] \t\n"
275 "addu %[tmp],%[tmp],%[tmp2] \t\n"
276 "addu %[tmp],%[tmp],%[tmp1] \t\n" /*tmp=hi*/
277 "srl %[tmp2],%[res],%[rshift] \t\n"
278 "srav %[res], %[tmp],%[rshift]\t\n"
279 "sll %[tmp],%[tmp],1 \t\n"
280 "sll %[tmp],%[tmp],%[norbits] \t\n"
281 "or %[tmp],%[tmp],%[tmp2] \t\n"
282 "movz %[res],%[tmp],%[bit5] \t\n"
283 : [res]"=&r"(result),[tmp]"=&r"(tmp),[tmp1]"=&r"(tmp1),[tmp2]"=&r"(tmp2)
284 : [a]"r"(a),[b]"r"(b),[norbits]"r"(~(shift)),[rshift] "r"(shift),[shiftm1]"r"(shift-1),[bit5] "r"(shift & 0x20)
285 : "%hi","%lo"
286 );
287 }
288
289 return result;
290}
291
292inline GGLfixed gglMulAddx(GGLfixed a, GGLfixed b, GGLfixed c, int shift) CONST;
293inline GGLfixed gglMulAddx(GGLfixed a, GGLfixed b, GGLfixed c, int shift) {
294 GGLfixed result,t,tmp1,tmp2;
295
296 if (__builtin_constant_p(shift)) {
297 if (shift == 0) {
298 asm ("mult %[a], %[b] \t\n"
299 "mflo %[lo] \t\n"
300 "addu %[lo],%[lo],%[c] \t\n"
301 : [lo]"=&r"(result)
302 : [a]"r"(a),[b]"r"(b),[c]"r"(c)
303 : "%hi","%lo"
304 );
305 } else if (shift == 32) {
306 asm ("mult %[a], %[b] \t\n"
307 "mfhi %[lo] \t\n"
308 "addu %[lo],%[lo],%[c] \t\n"
309 : [lo]"=&r"(result)
310 : [a]"r"(a),[b]"r"(b),[c]"r"(c)
311 : "%hi","%lo"
312 );
313 } else if ((shift>0) && (shift<32)) {
314 asm ("mult %[a], %[b] \t\n"
315 "mflo %[res] \t\n"
316 "mfhi %[t] \t\n"
317 "srl %[res],%[res],%[rshift] \t\n"
318 "sll %[t],%[t],%[lshift] \t\n"
319 "or %[res],%[res],%[t] \t\n"
320 "addu %[res],%[res],%[c] \t\n"
321 : [res]"=&r"(result),[t]"=&r"(t)
322 : [a]"r"(a),[b]"r"(b),[c]"r"(c),[lshift]"I"(32-shift),[rshift]"I"(shift)
323 : "%hi","%lo"
324 );
325 } else {
326 asm ("mult %[a], %[b] \t\n"
327 "nor %[tmp1],$zero,%[shift]\t\n"
328 "mflo %[res] \t\n"
329 "mfhi %[t] \t\n"
330 "srl %[res],%[res],%[shift] \t\n"
331 "sll %[tmp2],%[t],1 \t\n"
332 "sllv %[tmp2],%[tmp2],%[tmp1] \t\n"
333 "or %[tmp1],%[tmp2],%[res] \t\n"
334 "srav %[res],%[t],%[shift] \t\n"
335 "andi %[tmp2],%[shift],0x20\t\n"
336 "movz %[res],%[tmp1],%[tmp2]\t\n"
337 "addu %[res],%[res],%[c] \t\n"
338 : [res]"=&r"(result),[t]"=&r"(t),[tmp1]"=&r"(tmp1),[tmp2]"=&r"(tmp2)
339 : [a]"r"(a),[b]"r"(b),[c]"r"(c),[shift]"I"(shift)
340 : "%hi","%lo"
341 );
342 }
343 } else {
344 asm ("mult %[a], %[b] \t\n"
345 "nor %[tmp1],$zero,%[shift]\t\n"
346 "mflo %[res] \t\n"
347 "mfhi %[t] \t\n"
348 "srl %[res],%[res],%[shift] \t\n"
349 "sll %[tmp2],%[t],1 \t\n"
350 "sllv %[tmp2],%[tmp2],%[tmp1] \t\n"
351 "or %[tmp1],%[tmp2],%[res] \t\n"
352 "srav %[res],%[t],%[shift] \t\n"
353 "andi %[tmp2],%[shift],0x20\t\n"
354 "movz %[res],%[tmp1],%[tmp2]\t\n"
355 "addu %[res],%[res],%[c] \t\n"
356 : [res]"=&r"(result),[t]"=&r"(t),[tmp1]"=&r"(tmp1),[tmp2]"=&r"(tmp2)
357 : [a]"r"(a),[b]"r"(b),[c]"r"(c),[shift]"r"(shift)
358 : "%hi","%lo"
359 );
360 }
361 return result;
362}
363
364inline GGLfixed gglMulSubx(GGLfixed a, GGLfixed b, GGLfixed c, int shift) CONST;
365inline GGLfixed gglMulSubx(GGLfixed a, GGLfixed b, GGLfixed c, int shift) {
366 GGLfixed result,t,tmp1,tmp2;
367
368 if (__builtin_constant_p(shift)) {
369 if (shift == 0) {
370 asm ("mult %[a], %[b] \t\n"
371 "mflo %[lo] \t\n"
372 "subu %[lo],%[lo],%[c] \t\n"
373 : [lo]"=&r"(result)
374 : [a]"r"(a),[b]"r"(b),[c]"r"(c)
375 : "%hi","%lo"
376 );
377 } else if (shift == 32) {
378 asm ("mult %[a], %[b] \t\n"
379 "mfhi %[lo] \t\n"
380 "subu %[lo],%[lo],%[c] \t\n"
381 : [lo]"=&r"(result)
382 : [a]"r"(a),[b]"r"(b),[c]"r"(c)
383 : "%hi","%lo"
384 );
385 } else if ((shift>0) && (shift<32)) {
386 asm ("mult %[a], %[b] \t\n"
387 "mflo %[res] \t\n"
388 "mfhi %[t] \t\n"
389 "srl %[res],%[res],%[rshift] \t\n"
390 "sll %[t],%[t],%[lshift] \t\n"
391 "or %[res],%[res],%[t] \t\n"
392 "subu %[res],%[res],%[c] \t\n"
393 : [res]"=&r"(result),[t]"=&r"(t)
394 : [a]"r"(a),[b]"r"(b),[c]"r"(c),[lshift]"I"(32-shift),[rshift]"I"(shift)
395 : "%hi","%lo"
396 );
397 } else {
398 asm ("mult %[a], %[b] \t\n"
399 "nor %[tmp1],$zero,%[shift]\t\n"
400 "mflo %[res] \t\n"
401 "mfhi %[t] \t\n"
402 "srl %[res],%[res],%[shift] \t\n"
403 "sll %[tmp2],%[t],1 \t\n"
404 "sllv %[tmp2],%[tmp2],%[tmp1] \t\n"
405 "or %[tmp1],%[tmp2],%[res] \t\n"
406 "srav %[res],%[t],%[shift] \t\n"
407 "andi %[tmp2],%[shift],0x20\t\n"
408 "movz %[res],%[tmp1],%[tmp2]\t\n"
409 "subu %[res],%[res],%[c] \t\n"
410 : [res]"=&r"(result),[t]"=&r"(t),[tmp1]"=&r"(tmp1),[tmp2]"=&r"(tmp2)
411 : [a]"r"(a),[b]"r"(b),[c]"r"(c),[shift]"I"(shift)
412 : "%hi","%lo"
413 );
414 }
415 } else {
416 asm ("mult %[a], %[b] \t\n"
417 "nor %[tmp1],$zero,%[shift]\t\n"
418 "mflo %[res] \t\n"
419 "mfhi %[t] \t\n"
420 "srl %[res],%[res],%[shift] \t\n"
421 "sll %[tmp2],%[t],1 \t\n"
422 "sllv %[tmp2],%[tmp2],%[tmp1] \t\n"
423 "or %[tmp1],%[tmp2],%[res] \t\n"
424 "srav %[res],%[t],%[shift] \t\n"
425 "andi %[tmp2],%[shift],0x20\t\n"
426 "movz %[res],%[tmp1],%[tmp2]\t\n"
427 "subu %[res],%[res],%[c] \t\n"
428 : [res]"=&r"(result),[t]"=&r"(t),[tmp1]"=&r"(tmp1),[tmp2]"=&r"(tmp2)
429 : [a]"r"(a),[b]"r"(b),[c]"r"(c),[shift]"r"(shift)
430 : "%hi","%lo"
431 );
432 }
433 return result;
434}
435
436inline int64_t gglMulii(int32_t x, int32_t y) CONST;
437inline int64_t gglMulii(int32_t x, int32_t y) {
438 union {
439 struct {
440#if defined(__MIPSEL__)
441 int32_t lo;
442 int32_t hi;
443#elif defined(__MIPSEB__)
444 int32_t hi;
445 int32_t lo;
446#endif
447 } s;
448 int64_t res;
449 }u;
450 asm("mult %2, %3 \t\n"
451 "mfhi %1 \t\n"
452 "mflo %0 \t\n"
453 : "=r"(u.s.lo), "=&r"(u.s.hi)
454 : "%r"(x), "r"(y)
455 : "%hi","%lo"
456 );
457 return u.res;
458}
459
460#elif defined(__aarch64__)
461
462// inline AArch64 implementations
463
464inline GGLfixed gglMulx(GGLfixed x, GGLfixed y, int shift) CONST;
465inline GGLfixed gglMulx(GGLfixed x, GGLfixed y, int shift)
466{
467 GGLfixed result;
468 GGLfixed round;
469
470 asm("mov %x[round], #1 \n"
471 "lsl %x[round], %x[round], %x[shift] \n"
472 "lsr %x[round], %x[round], #1 \n"
473 "smaddl %x[result], %w[x], %w[y],%x[round] \n"
474 "lsr %x[result], %x[result], %x[shift] \n"
475 : [round]"=&r"(round), [result]"=&r"(result) \
476 : [x]"r"(x), [y]"r"(y), [shift] "r"(shift) \
477 :
478 );
479 return result;
480}
481inline GGLfixed gglMulAddx(GGLfixed x, GGLfixed y, GGLfixed a, int shift) CONST;
482inline GGLfixed gglMulAddx(GGLfixed x, GGLfixed y, GGLfixed a, int shift)
483{
484 GGLfixed result;
485 asm("smull %x[result], %w[x], %w[y] \n"
486 "lsr %x[result], %x[result], %x[shift] \n"
487 "add %w[result], %w[result], %w[a] \n"
488 : [result]"=&r"(result) \
489 : [x]"r"(x), [y]"r"(y), [a]"r"(a), [shift] "r"(shift) \
490 :
491 );
492 return result;
493}
494
495inline GGLfixed gglMulSubx(GGLfixed x, GGLfixed y, GGLfixed a, int shift) CONST;
496inline GGLfixed gglMulSubx(GGLfixed x, GGLfixed y, GGLfixed a, int shift)
497{
498
499 GGLfixed result;
500 int rshift;
501
502 asm("smull %x[result], %w[x], %w[y] \n"
503 "lsr %x[result], %x[result], %x[shift] \n"
504 "sub %w[result], %w[result], %w[a] \n"
505 : [result]"=&r"(result) \
506 : [x]"r"(x), [y]"r"(y), [a]"r"(a), [shift] "r"(shift) \
507 :
508 );
509 return result;
510}
511inline int64_t gglMulii(int32_t x, int32_t y) CONST;
512inline int64_t gglMulii(int32_t x, int32_t y)
513{
514 int64_t res;
515 asm("smull %x0, %w1, %w2 \n"
516 : "=r"(res)
517 : "%r"(x), "r"(y)
518 :
519 );
520 return res;
521}
522
523#else // ----------------------------------------------------------------------
524
525inline GGLfixed gglMulx(GGLfixed a, GGLfixed b, int shift) CONST;
526inline GGLfixed gglMulx(GGLfixed a, GGLfixed b, int shift) {
527 return GGLfixed((int64_t(a)*b + (1<<(shift-1)))>>shift);
528}
529inline GGLfixed gglMulAddx(GGLfixed a, GGLfixed b, GGLfixed c, int shift) CONST;
530inline GGLfixed gglMulAddx(GGLfixed a, GGLfixed b, GGLfixed c, int shift) {
531 return GGLfixed((int64_t(a)*b)>>shift) + c;
532}
533inline GGLfixed gglMulSubx(GGLfixed a, GGLfixed b, GGLfixed c, int shift) CONST;
534inline GGLfixed gglMulSubx(GGLfixed a, GGLfixed b, GGLfixed c, int shift) {
535 return GGLfixed((int64_t(a)*b)>>shift) - c;
536}
537inline int64_t gglMulii(int32_t a, int32_t b) CONST;
538inline int64_t gglMulii(int32_t a, int32_t b) {
539 return int64_t(a)*b;
540}
541
542#endif
543
544// ------------------------------------------------------------------------
545
546inline GGLfixed gglMulx(GGLfixed a, GGLfixed b) CONST;
547inline GGLfixed gglMulx(GGLfixed a, GGLfixed b) {
548 return gglMulx(a, b, 16);
549}
550inline GGLfixed gglMulAddx(GGLfixed a, GGLfixed b, GGLfixed c) CONST;
551inline GGLfixed gglMulAddx(GGLfixed a, GGLfixed b, GGLfixed c) {
552 return gglMulAddx(a, b, c, 16);
553}
554inline GGLfixed gglMulSubx(GGLfixed a, GGLfixed b, GGLfixed c) CONST;
555inline GGLfixed gglMulSubx(GGLfixed a, GGLfixed b, GGLfixed c) {
556 return gglMulSubx(a, b, c, 16);
557}
558
559// ------------------------------------------------------------------------
560
561inline int32_t gglClz(int32_t x) CONST;
562inline int32_t gglClz(int32_t x)
563{
564#if (defined(__arm__) && !defined(__thumb__)) || defined(__mips__) || defined(__aarch64__)
565 return __builtin_clz(x);
566#else
567 if (!x) return 32;
568 int32_t exp = 31;
569 if (x & 0xFFFF0000) { exp -=16; x >>= 16; }
570 if (x & 0x0000ff00) { exp -= 8; x >>= 8; }
571 if (x & 0x000000f0) { exp -= 4; x >>= 4; }
572 if (x & 0x0000000c) { exp -= 2; x >>= 2; }
573 if (x & 0x00000002) { exp -= 1; }
574 return exp;
575#endif
576}
577
578// ------------------------------------------------------------------------
579
580int32_t gglDivQ(GGLfixed n, GGLfixed d, int32_t i) CONST;
581
582inline int32_t gglDivQ16(GGLfixed n, GGLfixed d) CONST;
583inline int32_t gglDivQ16(GGLfixed n, GGLfixed d) {
584 return gglDivQ(n, d, 16);
585}
586
587inline int32_t gglDivx(GGLfixed n, GGLfixed d) CONST;
588inline int32_t gglDivx(GGLfixed n, GGLfixed d) {
589 return gglDivQ(n, d, 16);
590}
591
592// ------------------------------------------------------------------------
593
594inline GGLfixed gglRecipFast(GGLfixed x) CONST;
595inline GGLfixed gglRecipFast(GGLfixed x)
596{
597 // This is a really bad approximation of 1/x, but it's also
598 // very fast. x must be strictly positive.
599 // if x between [0.5, 1[ , then 1/x = 3-2*x
600 // (we use 2.30 fixed-point)
601 const int32_t lz = gglClz(x);
602 return (0xC0000000 - (x << (lz - 1))) >> (30-lz);
603}
604
605// ------------------------------------------------------------------------
606
607inline GGLfixed gglClampx(GGLfixed c) CONST;
608inline GGLfixed gglClampx(GGLfixed c)
609{
610#if defined(__thumb__)
611 // clamp without branches
612 c &= ~(c>>31); c = FIXED_ONE - c;
613 c &= ~(c>>31); c = FIXED_ONE - c;
614#else
615#if defined(__arm__)
616 // I don't know why gcc thinks its smarter than me! The code below
617 // clamps to zero in one instruction, but gcc won't generate it and
618 // replace it by a cmp + movlt (it's quite amazing actually).
619 asm("bic %0, %1, %1, asr #31\n" : "=r"(c) : "r"(c));
620#elif defined(__aarch64__)
621 asm("bic %w0, %w1, %w1, asr #31\n" : "=r"(c) : "r"(c));
622#else
623 c &= ~(c>>31);
624#endif
625 if (c>FIXED_ONE)
626 c = FIXED_ONE;
627#endif
628 return c;
629}
630
631// ------------------------------------------------------------------------
632
633#endif // ANDROID_GGL_FIXED_H
diff --git a/libpixelflinger/tests/arch-arm64/assembler/Android.mk b/libpixelflinger/tests/arch-arm64/assembler/Android.mk
index 448d2980e..961f323de 100644
--- a/libpixelflinger/tests/arch-arm64/assembler/Android.mk
+++ b/libpixelflinger/tests/arch-arm64/assembler/Android.mk
@@ -13,7 +13,7 @@ LOCAL_SHARED_LIBRARIES := \
13 libpixelflinger 13 libpixelflinger
14 14
15LOCAL_C_INCLUDES := \ 15LOCAL_C_INCLUDES := \
16 $(LOCAL_PATH)/../../.. 16 system/core/libpixelflinger
17 17
18LOCAL_MODULE:= test-pixelflinger-arm64-assembler-test 18LOCAL_MODULE:= test-pixelflinger-arm64-assembler-test
19 19
diff --git a/libpixelflinger/tests/arch-arm64/disassembler/Android.mk b/libpixelflinger/tests/arch-arm64/disassembler/Android.mk
index d8f7e699f..8f62f0975 100644
--- a/libpixelflinger/tests/arch-arm64/disassembler/Android.mk
+++ b/libpixelflinger/tests/arch-arm64/disassembler/Android.mk
@@ -7,6 +7,9 @@ LOCAL_SRC_FILES:= \
7 7
8LOCAL_SHARED_LIBRARIES := 8LOCAL_SHARED_LIBRARIES :=
9 9
10LOCAL_C_INCLUDES := \
11 system/core/libpixelflinger/codeflinger
12
10LOCAL_MODULE:= test-pixelflinger-arm64-disassembler-test 13LOCAL_MODULE:= test-pixelflinger-arm64-disassembler-test
11 14
12LOCAL_MODULE_TAGS := tests 15LOCAL_MODULE_TAGS := tests
diff --git a/libpixelflinger/tests/codegen/Android.mk b/libpixelflinger/tests/codegen/Android.mk
index 2f9ca2f9a..bc0701559 100644
--- a/libpixelflinger/tests/codegen/Android.mk
+++ b/libpixelflinger/tests/codegen/Android.mk
@@ -9,7 +9,7 @@ LOCAL_SHARED_LIBRARIES := \
9 libpixelflinger 9 libpixelflinger
10 10
11LOCAL_C_INCLUDES := \ 11LOCAL_C_INCLUDES := \
12 $(LOCAL_PATH)/../.. 12 system/core/libpixelflinger
13 13
14LOCAL_MODULE:= test-opengl-codegen 14LOCAL_MODULE:= test-opengl-codegen
15 15
diff --git a/libpixelflinger/tests/gglmul/Android.mk b/libpixelflinger/tests/gglmul/Android.mk
index 75bd39ef5..f479fa1e8 100644
--- a/libpixelflinger/tests/gglmul/Android.mk
+++ b/libpixelflinger/tests/gglmul/Android.mk
@@ -7,7 +7,7 @@ LOCAL_SRC_FILES:= \
7LOCAL_SHARED_LIBRARIES := 7LOCAL_SHARED_LIBRARIES :=
8 8
9LOCAL_C_INCLUDES := \ 9LOCAL_C_INCLUDES := \
10 $(LOCAL_PATH)/../../include 10 system/core/libpixelflinger
11 11
12LOCAL_MODULE:= test-pixelflinger-gglmul 12LOCAL_MODULE:= test-pixelflinger-gglmul
13 13