root / hw / pxa2xx_template.h @ 5439779e
History | View | Annotate | Download (11.2 kB)
1 | a171fe39 | balrog | /*
|
---|---|---|---|
2 | a171fe39 | balrog | * Intel XScale PXA255/270 LCDC emulation.
|
3 | a171fe39 | balrog | *
|
4 | a171fe39 | balrog | * Copyright (c) 2006 Openedhand Ltd.
|
5 | a171fe39 | balrog | * Written by Andrzej Zaborowski <balrog@zabor.org>
|
6 | a171fe39 | balrog | *
|
7 | a171fe39 | balrog | * This code is licensed under the GPLv2.
|
8 | a171fe39 | balrog | *
|
9 | a171fe39 | balrog | * Framebuffer format conversion routines.
|
10 | a171fe39 | balrog | */
|
11 | a171fe39 | balrog | |
12 | a171fe39 | balrog | # define SKIP_PIXEL(to) to += deststep
|
13 | a171fe39 | balrog | #if BITS == 8 |
14 | a171fe39 | balrog | # define COPY_PIXEL(to, from) *to = from; SKIP_PIXEL(to)
|
15 | a171fe39 | balrog | #elif BITS == 15 || BITS == 16 |
16 | a171fe39 | balrog | # define COPY_PIXEL(to, from) *(uint16_t *) to = from; SKIP_PIXEL(to)
|
17 | 5fafdf24 | ths | #elif BITS == 24 |
18 | a171fe39 | balrog | # define COPY_PIXEL(to, from) \
|
19 | a171fe39 | balrog | *(uint16_t *) to = from; *(to + 2) = (from) >> 16; SKIP_PIXEL(to) |
20 | a171fe39 | balrog | #elif BITS == 32 |
21 | a171fe39 | balrog | # define COPY_PIXEL(to, from) *(uint32_t *) to = from; SKIP_PIXEL(to)
|
22 | a171fe39 | balrog | #else
|
23 | a171fe39 | balrog | # error unknown bit depth
|
24 | a171fe39 | balrog | #endif
|
25 | a171fe39 | balrog | |
26 | a171fe39 | balrog | #ifdef WORDS_BIGENDIAN
|
27 | a171fe39 | balrog | # define SWAP_WORDS 1 |
28 | a171fe39 | balrog | #endif
|
29 | a171fe39 | balrog | |
30 | a171fe39 | balrog | #define FN_2(x) FN(x + 1) FN(x) |
31 | a171fe39 | balrog | #define FN_4(x) FN_2(x + 2) FN_2(x) |
32 | a171fe39 | balrog | |
33 | a171fe39 | balrog | static void glue(pxa2xx_draw_line2_, BITS)(uint32_t *palette, |
34 | a171fe39 | balrog | uint8_t *dest, const uint8_t *src, int width, int deststep) |
35 | a171fe39 | balrog | { |
36 | a171fe39 | balrog | uint32_t data; |
37 | a171fe39 | balrog | while (width > 0) { |
38 | a171fe39 | balrog | data = *(uint32_t *) src; |
39 | a171fe39 | balrog | #define FN(x) COPY_PIXEL(dest, palette[(data >> ((x) * 2)) & 3]); |
40 | a171fe39 | balrog | #ifdef SWAP_WORDS
|
41 | a171fe39 | balrog | FN_4(12)
|
42 | a171fe39 | balrog | FN_4(8)
|
43 | a171fe39 | balrog | FN_4(4)
|
44 | a171fe39 | balrog | FN_4(0)
|
45 | a171fe39 | balrog | #else
|
46 | a171fe39 | balrog | FN_4(0)
|
47 | a171fe39 | balrog | FN_4(4)
|
48 | a171fe39 | balrog | FN_4(8)
|
49 | a171fe39 | balrog | FN_4(12)
|
50 | a171fe39 | balrog | #endif
|
51 | a171fe39 | balrog | #undef FN
|
52 | a171fe39 | balrog | width -= 16;
|
53 | a171fe39 | balrog | src += 4;
|
54 | a171fe39 | balrog | } |
55 | a171fe39 | balrog | } |
56 | a171fe39 | balrog | |
57 | a171fe39 | balrog | static void glue(pxa2xx_draw_line4_, BITS)(uint32_t *palette, |
58 | a171fe39 | balrog | uint8_t *dest, const uint8_t *src, int width, int deststep) |
59 | a171fe39 | balrog | { |
60 | a171fe39 | balrog | uint32_t data; |
61 | a171fe39 | balrog | while (width > 0) { |
62 | a171fe39 | balrog | data = *(uint32_t *) src; |
63 | a171fe39 | balrog | #define FN(x) COPY_PIXEL(dest, palette[(data >> ((x) * 4)) & 0xf]); |
64 | a171fe39 | balrog | #ifdef SWAP_WORDS
|
65 | a171fe39 | balrog | FN_2(6)
|
66 | a171fe39 | balrog | FN_2(4)
|
67 | a171fe39 | balrog | FN_2(2)
|
68 | a171fe39 | balrog | FN_2(0)
|
69 | a171fe39 | balrog | #else
|
70 | a171fe39 | balrog | FN_2(0)
|
71 | a171fe39 | balrog | FN_2(2)
|
72 | a171fe39 | balrog | FN_2(4)
|
73 | a171fe39 | balrog | FN_2(6)
|
74 | a171fe39 | balrog | #endif
|
75 | a171fe39 | balrog | #undef FN
|
76 | a171fe39 | balrog | width -= 8;
|
77 | a171fe39 | balrog | src += 4;
|
78 | a171fe39 | balrog | } |
79 | a171fe39 | balrog | } |
80 | a171fe39 | balrog | |
81 | a171fe39 | balrog | static void glue(pxa2xx_draw_line8_, BITS)(uint32_t *palette, |
82 | a171fe39 | balrog | uint8_t *dest, const uint8_t *src, int width, int deststep) |
83 | a171fe39 | balrog | { |
84 | a171fe39 | balrog | uint32_t data; |
85 | a171fe39 | balrog | while (width > 0) { |
86 | a171fe39 | balrog | data = *(uint32_t *) src; |
87 | a171fe39 | balrog | #define FN(x) COPY_PIXEL(dest, palette[(data >> (x)) & 0xff]); |
88 | a171fe39 | balrog | #ifdef SWAP_WORDS
|
89 | a171fe39 | balrog | FN(24)
|
90 | a171fe39 | balrog | FN(16)
|
91 | a171fe39 | balrog | FN(8)
|
92 | a171fe39 | balrog | FN(0)
|
93 | a171fe39 | balrog | #else
|
94 | a171fe39 | balrog | FN(0)
|
95 | a171fe39 | balrog | FN(8)
|
96 | a171fe39 | balrog | FN(16)
|
97 | a171fe39 | balrog | FN(24)
|
98 | a171fe39 | balrog | #endif
|
99 | a171fe39 | balrog | #undef FN
|
100 | a171fe39 | balrog | width -= 4;
|
101 | a171fe39 | balrog | src += 4;
|
102 | a171fe39 | balrog | } |
103 | a171fe39 | balrog | } |
104 | a171fe39 | balrog | |
105 | a171fe39 | balrog | static void glue(pxa2xx_draw_line16_, BITS)(uint32_t *palette, |
106 | a171fe39 | balrog | uint8_t *dest, const uint8_t *src, int width, int deststep) |
107 | a171fe39 | balrog | { |
108 | a171fe39 | balrog | uint32_t data; |
109 | a171fe39 | balrog | unsigned int r, g, b; |
110 | a171fe39 | balrog | while (width > 0) { |
111 | a171fe39 | balrog | data = *(uint32_t *) src; |
112 | a171fe39 | balrog | #ifdef SWAP_WORDS
|
113 | a171fe39 | balrog | data = bswap32(data); |
114 | a171fe39 | balrog | #endif
|
115 | a171fe39 | balrog | b = (data & 0x1f) << 3; |
116 | a171fe39 | balrog | data >>= 5;
|
117 | a171fe39 | balrog | g = (data & 0x3f) << 2; |
118 | a171fe39 | balrog | data >>= 6;
|
119 | a171fe39 | balrog | r = (data & 0x1f) << 3; |
120 | a171fe39 | balrog | data >>= 5;
|
121 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
122 | a171fe39 | balrog | b = (data & 0x1f) << 3; |
123 | a171fe39 | balrog | data >>= 5;
|
124 | a171fe39 | balrog | g = (data & 0x3f) << 2; |
125 | a171fe39 | balrog | data >>= 6;
|
126 | a171fe39 | balrog | r = (data & 0x1f) << 3; |
127 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
128 | a171fe39 | balrog | width -= 2;
|
129 | a171fe39 | balrog | src += 4;
|
130 | a171fe39 | balrog | } |
131 | a171fe39 | balrog | } |
132 | a171fe39 | balrog | |
133 | a171fe39 | balrog | static void glue(pxa2xx_draw_line16t_, BITS)(uint32_t *palette, |
134 | a171fe39 | balrog | uint8_t *dest, const uint8_t *src, int width, int deststep) |
135 | a171fe39 | balrog | { |
136 | a171fe39 | balrog | uint32_t data; |
137 | a171fe39 | balrog | unsigned int r, g, b; |
138 | a171fe39 | balrog | while (width > 0) { |
139 | a171fe39 | balrog | data = *(uint32_t *) src; |
140 | a171fe39 | balrog | #ifdef SWAP_WORDS
|
141 | a171fe39 | balrog | data = bswap32(data); |
142 | a171fe39 | balrog | #endif
|
143 | a171fe39 | balrog | b = (data & 0x1f) << 3; |
144 | a171fe39 | balrog | data >>= 5;
|
145 | a171fe39 | balrog | g = (data & 0x1f) << 3; |
146 | a171fe39 | balrog | data >>= 5;
|
147 | a171fe39 | balrog | r = (data & 0x1f) << 3; |
148 | a171fe39 | balrog | data >>= 5;
|
149 | a171fe39 | balrog | if (data & 1) |
150 | a171fe39 | balrog | SKIP_PIXEL(dest); |
151 | a171fe39 | balrog | else
|
152 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
153 | a171fe39 | balrog | data >>= 1;
|
154 | a171fe39 | balrog | b = (data & 0x1f) << 3; |
155 | a171fe39 | balrog | data >>= 5;
|
156 | a171fe39 | balrog | g = (data & 0x1f) << 3; |
157 | a171fe39 | balrog | data >>= 5;
|
158 | a171fe39 | balrog | r = (data & 0x1f) << 3; |
159 | a171fe39 | balrog | if (data & 1) |
160 | a171fe39 | balrog | SKIP_PIXEL(dest); |
161 | a171fe39 | balrog | else
|
162 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
163 | a171fe39 | balrog | width -= 2;
|
164 | a171fe39 | balrog | src += 4;
|
165 | a171fe39 | balrog | } |
166 | a171fe39 | balrog | } |
167 | a171fe39 | balrog | |
168 | a171fe39 | balrog | static void glue(pxa2xx_draw_line18_, BITS)(uint32_t *palette, |
169 | a171fe39 | balrog | uint8_t *dest, const uint8_t *src, int width, int deststep) |
170 | a171fe39 | balrog | { |
171 | a171fe39 | balrog | uint32_t data; |
172 | a171fe39 | balrog | unsigned int r, g, b; |
173 | a171fe39 | balrog | while (width > 0) { |
174 | a171fe39 | balrog | data = *(uint32_t *) src; |
175 | a171fe39 | balrog | #ifdef SWAP_WORDS
|
176 | a171fe39 | balrog | data = bswap32(data); |
177 | a171fe39 | balrog | #endif
|
178 | a171fe39 | balrog | b = (data & 0x3f) << 2; |
179 | a171fe39 | balrog | data >>= 6;
|
180 | a171fe39 | balrog | g = (data & 0x3f) << 2; |
181 | a171fe39 | balrog | data >>= 6;
|
182 | a171fe39 | balrog | r = (data & 0x3f) << 2; |
183 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
184 | a171fe39 | balrog | width -= 1;
|
185 | a171fe39 | balrog | src += 4;
|
186 | a171fe39 | balrog | } |
187 | a171fe39 | balrog | } |
188 | a171fe39 | balrog | |
189 | a171fe39 | balrog | /* The wicked packed format */
|
190 | a171fe39 | balrog | static void glue(pxa2xx_draw_line18p_, BITS)(uint32_t *palette, |
191 | a171fe39 | balrog | uint8_t *dest, const uint8_t *src, int width, int deststep) |
192 | a171fe39 | balrog | { |
193 | a171fe39 | balrog | uint32_t data[3];
|
194 | a171fe39 | balrog | unsigned int r, g, b; |
195 | a171fe39 | balrog | while (width > 0) { |
196 | a171fe39 | balrog | data[0] = *(uint32_t *) src;
|
197 | a171fe39 | balrog | src += 4;
|
198 | a171fe39 | balrog | data[1] = *(uint32_t *) src;
|
199 | a171fe39 | balrog | src += 4;
|
200 | a171fe39 | balrog | data[2] = *(uint32_t *) src;
|
201 | a171fe39 | balrog | src += 4;
|
202 | a171fe39 | balrog | #ifdef SWAP_WORDS
|
203 | a171fe39 | balrog | data[0] = bswap32(data[0]); |
204 | a171fe39 | balrog | data[1] = bswap32(data[1]); |
205 | a171fe39 | balrog | data[2] = bswap32(data[2]); |
206 | a171fe39 | balrog | #endif
|
207 | a171fe39 | balrog | b = (data[0] & 0x3f) << 2; |
208 | a171fe39 | balrog | data[0] >>= 6; |
209 | a171fe39 | balrog | g = (data[0] & 0x3f) << 2; |
210 | a171fe39 | balrog | data[0] >>= 6; |
211 | a171fe39 | balrog | r = (data[0] & 0x3f) << 2; |
212 | a171fe39 | balrog | data[0] >>= 12; |
213 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
214 | a171fe39 | balrog | b = (data[0] & 0x3f) << 2; |
215 | a171fe39 | balrog | data[0] >>= 6; |
216 | a171fe39 | balrog | g = ((data[1] & 0xf) << 4) | (data[0] << 2); |
217 | a171fe39 | balrog | data[1] >>= 4; |
218 | a171fe39 | balrog | r = (data[1] & 0x3f) << 2; |
219 | a171fe39 | balrog | data[1] >>= 12; |
220 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
221 | a171fe39 | balrog | b = (data[1] & 0x3f) << 2; |
222 | a171fe39 | balrog | data[1] >>= 6; |
223 | a171fe39 | balrog | g = (data[1] & 0x3f) << 2; |
224 | a171fe39 | balrog | data[1] >>= 6; |
225 | a171fe39 | balrog | r = ((data[2] & 0x3) << 6) | (data[1] << 2); |
226 | a171fe39 | balrog | data[2] >>= 8; |
227 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
228 | a171fe39 | balrog | b = (data[2] & 0x3f) << 2; |
229 | a171fe39 | balrog | data[2] >>= 6; |
230 | a171fe39 | balrog | g = (data[2] & 0x3f) << 2; |
231 | a171fe39 | balrog | data[2] >>= 6; |
232 | a171fe39 | balrog | r = data[2] << 2; |
233 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
234 | a171fe39 | balrog | width -= 4;
|
235 | a171fe39 | balrog | } |
236 | a171fe39 | balrog | } |
237 | a171fe39 | balrog | |
238 | a171fe39 | balrog | static void glue(pxa2xx_draw_line19_, BITS)(uint32_t *palette, |
239 | a171fe39 | balrog | uint8_t *dest, const uint8_t *src, int width, int deststep) |
240 | a171fe39 | balrog | { |
241 | a171fe39 | balrog | uint32_t data; |
242 | a171fe39 | balrog | unsigned int r, g, b; |
243 | a171fe39 | balrog | while (width > 0) { |
244 | a171fe39 | balrog | data = *(uint32_t *) src; |
245 | a171fe39 | balrog | #ifdef SWAP_WORDS
|
246 | a171fe39 | balrog | data = bswap32(data); |
247 | a171fe39 | balrog | #endif
|
248 | a171fe39 | balrog | b = (data & 0x3f) << 2; |
249 | a171fe39 | balrog | data >>= 6;
|
250 | a171fe39 | balrog | g = (data & 0x3f) << 2; |
251 | a171fe39 | balrog | data >>= 6;
|
252 | a171fe39 | balrog | r = (data & 0x3f) << 2; |
253 | a171fe39 | balrog | data >>= 6;
|
254 | a171fe39 | balrog | if (data & 1) |
255 | a171fe39 | balrog | SKIP_PIXEL(dest); |
256 | a171fe39 | balrog | else
|
257 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
258 | a171fe39 | balrog | width -= 1;
|
259 | a171fe39 | balrog | src += 4;
|
260 | a171fe39 | balrog | } |
261 | a171fe39 | balrog | } |
262 | a171fe39 | balrog | |
263 | a171fe39 | balrog | /* The wicked packed format */
|
264 | a171fe39 | balrog | static void glue(pxa2xx_draw_line19p_, BITS)(uint32_t *palette, |
265 | a171fe39 | balrog | uint8_t *dest, const uint8_t *src, int width, int deststep) |
266 | a171fe39 | balrog | { |
267 | a171fe39 | balrog | uint32_t data[3];
|
268 | a171fe39 | balrog | unsigned int r, g, b; |
269 | a171fe39 | balrog | while (width > 0) { |
270 | a171fe39 | balrog | data[0] = *(uint32_t *) src;
|
271 | a171fe39 | balrog | src += 4;
|
272 | a171fe39 | balrog | data[1] = *(uint32_t *) src;
|
273 | a171fe39 | balrog | src += 4;
|
274 | a171fe39 | balrog | data[2] = *(uint32_t *) src;
|
275 | a171fe39 | balrog | src += 4;
|
276 | a171fe39 | balrog | # ifdef SWAP_WORDS
|
277 | a171fe39 | balrog | data[0] = bswap32(data[0]); |
278 | a171fe39 | balrog | data[1] = bswap32(data[1]); |
279 | a171fe39 | balrog | data[2] = bswap32(data[2]); |
280 | a171fe39 | balrog | # endif
|
281 | a171fe39 | balrog | b = (data[0] & 0x3f) << 2; |
282 | a171fe39 | balrog | data[0] >>= 6; |
283 | a171fe39 | balrog | g = (data[0] & 0x3f) << 2; |
284 | a171fe39 | balrog | data[0] >>= 6; |
285 | a171fe39 | balrog | r = (data[0] & 0x3f) << 2; |
286 | a171fe39 | balrog | data[0] >>= 6; |
287 | a171fe39 | balrog | if (data[0] & 1) |
288 | a171fe39 | balrog | SKIP_PIXEL(dest); |
289 | a171fe39 | balrog | else
|
290 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
291 | a171fe39 | balrog | data[0] >>= 6; |
292 | a171fe39 | balrog | b = (data[0] & 0x3f) << 2; |
293 | a171fe39 | balrog | data[0] >>= 6; |
294 | a171fe39 | balrog | g = ((data[1] & 0xf) << 4) | (data[0] << 2); |
295 | a171fe39 | balrog | data[1] >>= 4; |
296 | a171fe39 | balrog | r = (data[1] & 0x3f) << 2; |
297 | a171fe39 | balrog | data[1] >>= 6; |
298 | a171fe39 | balrog | if (data[1] & 1) |
299 | a171fe39 | balrog | SKIP_PIXEL(dest); |
300 | a171fe39 | balrog | else
|
301 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
302 | a171fe39 | balrog | data[1] >>= 6; |
303 | a171fe39 | balrog | b = (data[1] & 0x3f) << 2; |
304 | a171fe39 | balrog | data[1] >>= 6; |
305 | a171fe39 | balrog | g = (data[1] & 0x3f) << 2; |
306 | a171fe39 | balrog | data[1] >>= 6; |
307 | a171fe39 | balrog | r = ((data[2] & 0x3) << 6) | (data[1] << 2); |
308 | a171fe39 | balrog | data[2] >>= 2; |
309 | a171fe39 | balrog | if (data[2] & 1) |
310 | a171fe39 | balrog | SKIP_PIXEL(dest); |
311 | a171fe39 | balrog | else
|
312 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
313 | a171fe39 | balrog | data[2] >>= 6; |
314 | a171fe39 | balrog | b = (data[2] & 0x3f) << 2; |
315 | a171fe39 | balrog | data[2] >>= 6; |
316 | a171fe39 | balrog | g = (data[2] & 0x3f) << 2; |
317 | a171fe39 | balrog | data[2] >>= 6; |
318 | a171fe39 | balrog | r = data[2] << 2; |
319 | a171fe39 | balrog | data[2] >>= 6; |
320 | a171fe39 | balrog | if (data[2] & 1) |
321 | a171fe39 | balrog | SKIP_PIXEL(dest); |
322 | a171fe39 | balrog | else
|
323 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
324 | a171fe39 | balrog | width -= 4;
|
325 | a171fe39 | balrog | } |
326 | a171fe39 | balrog | } |
327 | a171fe39 | balrog | |
328 | a171fe39 | balrog | static void glue(pxa2xx_draw_line24_, BITS)(uint32_t *palette, |
329 | a171fe39 | balrog | uint8_t *dest, const uint8_t *src, int width, int deststep) |
330 | a171fe39 | balrog | { |
331 | a171fe39 | balrog | uint32_t data; |
332 | a171fe39 | balrog | unsigned int r, g, b; |
333 | a171fe39 | balrog | while (width > 0) { |
334 | a171fe39 | balrog | data = *(uint32_t *) src; |
335 | a171fe39 | balrog | #ifdef SWAP_WORDS
|
336 | a171fe39 | balrog | data = bswap32(data); |
337 | a171fe39 | balrog | #endif
|
338 | a171fe39 | balrog | b = data & 0xff;
|
339 | a171fe39 | balrog | data >>= 8;
|
340 | a171fe39 | balrog | g = data & 0xff;
|
341 | a171fe39 | balrog | data >>= 8;
|
342 | a171fe39 | balrog | r = data & 0xff;
|
343 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
344 | a171fe39 | balrog | width -= 1;
|
345 | a171fe39 | balrog | src += 4;
|
346 | a171fe39 | balrog | } |
347 | a171fe39 | balrog | } |
348 | a171fe39 | balrog | |
349 | a171fe39 | balrog | static void glue(pxa2xx_draw_line24t_, BITS)(uint32_t *palette, |
350 | a171fe39 | balrog | uint8_t *dest, const uint8_t *src, int width, int deststep) |
351 | a171fe39 | balrog | { |
352 | a171fe39 | balrog | uint32_t data; |
353 | a171fe39 | balrog | unsigned int r, g, b; |
354 | a171fe39 | balrog | while (width > 0) { |
355 | a171fe39 | balrog | data = *(uint32_t *) src; |
356 | a171fe39 | balrog | #ifdef SWAP_WORDS
|
357 | a171fe39 | balrog | data = bswap32(data); |
358 | a171fe39 | balrog | #endif
|
359 | a171fe39 | balrog | b = (data & 0x7f) << 1; |
360 | a171fe39 | balrog | data >>= 7;
|
361 | a171fe39 | balrog | g = data & 0xff;
|
362 | a171fe39 | balrog | data >>= 8;
|
363 | a171fe39 | balrog | r = data & 0xff;
|
364 | a171fe39 | balrog | data >>= 8;
|
365 | a171fe39 | balrog | if (data & 1) |
366 | a171fe39 | balrog | SKIP_PIXEL(dest); |
367 | a171fe39 | balrog | else
|
368 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
369 | a171fe39 | balrog | width -= 1;
|
370 | a171fe39 | balrog | src += 4;
|
371 | a171fe39 | balrog | } |
372 | a171fe39 | balrog | } |
373 | a171fe39 | balrog | |
374 | a171fe39 | balrog | static void glue(pxa2xx_draw_line25_, BITS)(uint32_t *palette, |
375 | a171fe39 | balrog | uint8_t *dest, const uint8_t *src, int width, int deststep) |
376 | a171fe39 | balrog | { |
377 | a171fe39 | balrog | uint32_t data; |
378 | a171fe39 | balrog | unsigned int r, g, b; |
379 | a171fe39 | balrog | while (width > 0) { |
380 | a171fe39 | balrog | data = *(uint32_t *) src; |
381 | a171fe39 | balrog | #ifdef SWAP_WORDS
|
382 | a171fe39 | balrog | data = bswap32(data); |
383 | a171fe39 | balrog | #endif
|
384 | a171fe39 | balrog | b = data & 0xff;
|
385 | a171fe39 | balrog | data >>= 8;
|
386 | a171fe39 | balrog | g = data & 0xff;
|
387 | a171fe39 | balrog | data >>= 8;
|
388 | a171fe39 | balrog | r = data & 0xff;
|
389 | a171fe39 | balrog | data >>= 8;
|
390 | a171fe39 | balrog | if (data & 1) |
391 | a171fe39 | balrog | SKIP_PIXEL(dest); |
392 | a171fe39 | balrog | else
|
393 | a171fe39 | balrog | COPY_PIXEL(dest, glue(rgb_to_pixel, BITS)(r, g, b)); |
394 | a171fe39 | balrog | width -= 1;
|
395 | a171fe39 | balrog | src += 4;
|
396 | a171fe39 | balrog | } |
397 | a171fe39 | balrog | } |
398 | a171fe39 | balrog | |
399 | a171fe39 | balrog | /* Overlay planes disabled, no transparency */
|
400 | a171fe39 | balrog | static drawfn glue(pxa2xx_draw_fn_, BITS)[16] = |
401 | a171fe39 | balrog | { |
402 | a171fe39 | balrog | [0 ... 0xf] = 0, |
403 | a171fe39 | balrog | [pxa_lcdc_2bpp] = glue(pxa2xx_draw_line2_, BITS), |
404 | a171fe39 | balrog | [pxa_lcdc_4bpp] = glue(pxa2xx_draw_line4_, BITS), |
405 | a171fe39 | balrog | [pxa_lcdc_8bpp] = glue(pxa2xx_draw_line8_, BITS), |
406 | a171fe39 | balrog | [pxa_lcdc_16bpp] = glue(pxa2xx_draw_line16_, BITS), |
407 | a171fe39 | balrog | [pxa_lcdc_18bpp] = glue(pxa2xx_draw_line18_, BITS), |
408 | a171fe39 | balrog | [pxa_lcdc_18pbpp] = glue(pxa2xx_draw_line18p_, BITS), |
409 | a171fe39 | balrog | [pxa_lcdc_24bpp] = glue(pxa2xx_draw_line24_, BITS), |
410 | a171fe39 | balrog | }; |
411 | a171fe39 | balrog | |
412 | a171fe39 | balrog | /* Overlay planes enabled, transparency used */
|
413 | a171fe39 | balrog | static drawfn glue(glue(pxa2xx_draw_fn_, BITS), t)[16] = |
414 | a171fe39 | balrog | { |
415 | a171fe39 | balrog | [0 ... 0xf] = 0, |
416 | a171fe39 | balrog | [pxa_lcdc_4bpp] = glue(pxa2xx_draw_line4_, BITS), |
417 | a171fe39 | balrog | [pxa_lcdc_8bpp] = glue(pxa2xx_draw_line8_, BITS), |
418 | a171fe39 | balrog | [pxa_lcdc_16bpp] = glue(pxa2xx_draw_line16t_, BITS), |
419 | a171fe39 | balrog | [pxa_lcdc_19bpp] = glue(pxa2xx_draw_line19_, BITS), |
420 | a171fe39 | balrog | [pxa_lcdc_19pbpp] = glue(pxa2xx_draw_line19p_, BITS), |
421 | a171fe39 | balrog | [pxa_lcdc_24bpp] = glue(pxa2xx_draw_line24t_, BITS), |
422 | a171fe39 | balrog | [pxa_lcdc_25bpp] = glue(pxa2xx_draw_line25_, BITS), |
423 | a171fe39 | balrog | }; |
424 | a171fe39 | balrog | |
425 | a171fe39 | balrog | #undef BITS
|
426 | a171fe39 | balrog | #undef COPY_PIXEL
|
427 | a171fe39 | balrog | #undef SKIP_PIXEL
|
428 | a171fe39 | balrog | |
429 | a171fe39 | balrog | #ifdef SWAP_WORDS
|
430 | a171fe39 | balrog | # undef SWAP_WORDS
|
431 | a171fe39 | balrog | #endif |