root / hw / pl110_template.h @ 721589dd
History | View | Annotate | Download (9.3 kB)
1 | 5fafdf24 | ths | /*
|
---|---|---|---|
2 | bdd5003a | pbrook | * Arm PrimeCell PL110 Color LCD Controller
|
3 | bdd5003a | pbrook | *
|
4 | bdd5003a | pbrook | * Copyright (c) 2005 CodeSourcery, LLC.
|
5 | bdd5003a | pbrook | * Written by Paul Brook
|
6 | bdd5003a | pbrook | *
|
7 | 8e31bf38 | Matthew Fernandez | * This code is licensed under the GNU LGPL
|
8 | bdd5003a | pbrook | *
|
9 | bdd5003a | pbrook | * Framebuffer format conversion routines.
|
10 | bdd5003a | pbrook | */
|
11 | bdd5003a | pbrook | |
12 | bdd5003a | pbrook | #ifndef ORDER
|
13 | bdd5003a | pbrook | |
14 | bdd5003a | pbrook | #if BITS == 8 |
15 | bdd5003a | pbrook | #define COPY_PIXEL(to, from) *(to++) = from
|
16 | bdd5003a | pbrook | #elif BITS == 15 || BITS == 16 |
17 | bdd5003a | pbrook | #define COPY_PIXEL(to, from) *(uint16_t *)to = from; to += 2; |
18 | 5fafdf24 | ths | #elif BITS == 24 |
19 | bdd5003a | pbrook | #define COPY_PIXEL(to, from) \
|
20 | bdd5003a | pbrook | *(to++) = from; *(to++) = (from) >> 8; *(to++) = (from) >> 16 |
21 | bdd5003a | pbrook | #elif BITS == 32 |
22 | bdd5003a | pbrook | #define COPY_PIXEL(to, from) *(uint32_t *)to = from; to += 4; |
23 | bdd5003a | pbrook | #else
|
24 | bdd5003a | pbrook | #error unknown bit depth
|
25 | bdd5003a | pbrook | #endif
|
26 | bdd5003a | pbrook | |
27 | e9c05b42 | balrog | #undef RGB
|
28 | e9c05b42 | balrog | #define BORDER bgr
|
29 | bdd5003a | pbrook | #define ORDER 0 |
30 | bdd5003a | pbrook | #include "pl110_template.h" |
31 | bdd5003a | pbrook | #define ORDER 1 |
32 | bdd5003a | pbrook | #include "pl110_template.h" |
33 | bdd5003a | pbrook | #define ORDER 2 |
34 | bdd5003a | pbrook | #include "pl110_template.h" |
35 | e9c05b42 | balrog | #undef BORDER
|
36 | e9c05b42 | balrog | #define RGB
|
37 | e9c05b42 | balrog | #define BORDER rgb
|
38 | e9c05b42 | balrog | #define ORDER 0 |
39 | e9c05b42 | balrog | #include "pl110_template.h" |
40 | e9c05b42 | balrog | #define ORDER 1 |
41 | e9c05b42 | balrog | #include "pl110_template.h" |
42 | e9c05b42 | balrog | #define ORDER 2 |
43 | e9c05b42 | balrog | #include "pl110_template.h" |
44 | e9c05b42 | balrog | #undef BORDER
|
45 | bdd5003a | pbrook | |
46 | 4fbf5556 | Peter Maydell | static drawfn glue(pl110_draw_fn_,BITS)[48] = |
47 | bdd5003a | pbrook | { |
48 | e9c05b42 | balrog | glue(pl110_draw_line1_lblp_bgr,BITS), |
49 | e9c05b42 | balrog | glue(pl110_draw_line2_lblp_bgr,BITS), |
50 | e9c05b42 | balrog | glue(pl110_draw_line4_lblp_bgr,BITS), |
51 | e9c05b42 | balrog | glue(pl110_draw_line8_lblp_bgr,BITS), |
52 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line16_555_lblp_bgr,BITS), |
53 | e9c05b42 | balrog | glue(pl110_draw_line32_lblp_bgr,BITS), |
54 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line16_lblp_bgr,BITS), |
55 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line12_lblp_bgr,BITS), |
56 | e9c05b42 | balrog | |
57 | e9c05b42 | balrog | glue(pl110_draw_line1_bbbp_bgr,BITS), |
58 | e9c05b42 | balrog | glue(pl110_draw_line2_bbbp_bgr,BITS), |
59 | e9c05b42 | balrog | glue(pl110_draw_line4_bbbp_bgr,BITS), |
60 | e9c05b42 | balrog | glue(pl110_draw_line8_bbbp_bgr,BITS), |
61 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line16_555_bbbp_bgr,BITS), |
62 | e9c05b42 | balrog | glue(pl110_draw_line32_bbbp_bgr,BITS), |
63 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line16_bbbp_bgr,BITS), |
64 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line12_bbbp_bgr,BITS), |
65 | e9c05b42 | balrog | |
66 | e9c05b42 | balrog | glue(pl110_draw_line1_lbbp_bgr,BITS), |
67 | e9c05b42 | balrog | glue(pl110_draw_line2_lbbp_bgr,BITS), |
68 | e9c05b42 | balrog | glue(pl110_draw_line4_lbbp_bgr,BITS), |
69 | e9c05b42 | balrog | glue(pl110_draw_line8_lbbp_bgr,BITS), |
70 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line16_555_lbbp_bgr,BITS), |
71 | e9c05b42 | balrog | glue(pl110_draw_line32_lbbp_bgr,BITS), |
72 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line16_lbbp_bgr,BITS), |
73 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line12_lbbp_bgr,BITS), |
74 | e9c05b42 | balrog | |
75 | e9c05b42 | balrog | glue(pl110_draw_line1_lblp_rgb,BITS), |
76 | e9c05b42 | balrog | glue(pl110_draw_line2_lblp_rgb,BITS), |
77 | e9c05b42 | balrog | glue(pl110_draw_line4_lblp_rgb,BITS), |
78 | e9c05b42 | balrog | glue(pl110_draw_line8_lblp_rgb,BITS), |
79 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line16_555_lblp_rgb,BITS), |
80 | e9c05b42 | balrog | glue(pl110_draw_line32_lblp_rgb,BITS), |
81 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line16_lblp_rgb,BITS), |
82 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line12_lblp_rgb,BITS), |
83 | e9c05b42 | balrog | |
84 | e9c05b42 | balrog | glue(pl110_draw_line1_bbbp_rgb,BITS), |
85 | e9c05b42 | balrog | glue(pl110_draw_line2_bbbp_rgb,BITS), |
86 | e9c05b42 | balrog | glue(pl110_draw_line4_bbbp_rgb,BITS), |
87 | e9c05b42 | balrog | glue(pl110_draw_line8_bbbp_rgb,BITS), |
88 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line16_555_bbbp_rgb,BITS), |
89 | e9c05b42 | balrog | glue(pl110_draw_line32_bbbp_rgb,BITS), |
90 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line16_bbbp_rgb,BITS), |
91 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line12_bbbp_rgb,BITS), |
92 | e9c05b42 | balrog | |
93 | e9c05b42 | balrog | glue(pl110_draw_line1_lbbp_rgb,BITS), |
94 | e9c05b42 | balrog | glue(pl110_draw_line2_lbbp_rgb,BITS), |
95 | e9c05b42 | balrog | glue(pl110_draw_line4_lbbp_rgb,BITS), |
96 | e9c05b42 | balrog | glue(pl110_draw_line8_lbbp_rgb,BITS), |
97 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line16_555_lbbp_rgb,BITS), |
98 | e9c05b42 | balrog | glue(pl110_draw_line32_lbbp_rgb,BITS), |
99 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line16_lbbp_rgb,BITS), |
100 | 4fbf5556 | Peter Maydell | glue(pl110_draw_line12_lbbp_rgb,BITS), |
101 | bdd5003a | pbrook | }; |
102 | bdd5003a | pbrook | |
103 | bdd5003a | pbrook | #undef BITS
|
104 | bdd5003a | pbrook | #undef COPY_PIXEL
|
105 | bdd5003a | pbrook | |
106 | bdd5003a | pbrook | #else
|
107 | bdd5003a | pbrook | |
108 | bdd5003a | pbrook | #if ORDER == 0 |
109 | e9c05b42 | balrog | #define NAME glue(glue(lblp_, BORDER), BITS)
|
110 | e2542fe2 | Juan Quintela | #ifdef HOST_WORDS_BIGENDIAN
|
111 | bdd5003a | pbrook | #define SWAP_WORDS 1 |
112 | bdd5003a | pbrook | #endif
|
113 | bdd5003a | pbrook | #elif ORDER == 1 |
114 | e9c05b42 | balrog | #define NAME glue(glue(bbbp_, BORDER), BITS)
|
115 | e2542fe2 | Juan Quintela | #ifndef HOST_WORDS_BIGENDIAN
|
116 | bdd5003a | pbrook | #define SWAP_WORDS 1 |
117 | bdd5003a | pbrook | #endif
|
118 | bdd5003a | pbrook | #else
|
119 | bdd5003a | pbrook | #define SWAP_PIXELS 1 |
120 | e9c05b42 | balrog | #define NAME glue(glue(lbbp_, BORDER), BITS)
|
121 | e2542fe2 | Juan Quintela | #ifdef HOST_WORDS_BIGENDIAN
|
122 | bdd5003a | pbrook | #define SWAP_WORDS 1 |
123 | bdd5003a | pbrook | #endif
|
124 | bdd5003a | pbrook | #endif
|
125 | bdd5003a | pbrook | |
126 | bdd5003a | pbrook | #define FN_2(x, y) FN(x, y) FN(x+1, y) |
127 | 1f9519c9 | pbrook | #define FN_4(x, y) FN_2(x, y) FN_2(x+2, y) |
128 | bdd5003a | pbrook | #define FN_8(y) FN_4(0, y) FN_4(4, y) |
129 | bdd5003a | pbrook | |
130 | 714fa308 | pbrook | static void glue(pl110_draw_line1_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep) |
131 | bdd5003a | pbrook | { |
132 | 714fa308 | pbrook | uint32_t *pallette = opaque; |
133 | bdd5003a | pbrook | uint32_t data; |
134 | bdd5003a | pbrook | while (width > 0) { |
135 | bdd5003a | pbrook | data = *(uint32_t *)src; |
136 | bdd5003a | pbrook | #ifdef SWAP_PIXELS
|
137 | bdd5003a | pbrook | #define FN(x, y) COPY_PIXEL(d, pallette[(data >> (y + 7 - (x))) & 1]); |
138 | bdd5003a | pbrook | #else
|
139 | bdd5003a | pbrook | #define FN(x, y) COPY_PIXEL(d, pallette[(data >> ((x) + y)) & 1]); |
140 | bdd5003a | pbrook | #endif
|
141 | be9d3657 | pbrook | #ifdef SWAP_WORDS
|
142 | bdd5003a | pbrook | FN_8(24)
|
143 | bdd5003a | pbrook | FN_8(16)
|
144 | bdd5003a | pbrook | FN_8(8)
|
145 | bdd5003a | pbrook | FN_8(0)
|
146 | bdd5003a | pbrook | #else
|
147 | bdd5003a | pbrook | FN_8(0)
|
148 | bdd5003a | pbrook | FN_8(8)
|
149 | bdd5003a | pbrook | FN_8(16)
|
150 | bdd5003a | pbrook | FN_8(24)
|
151 | bdd5003a | pbrook | #endif
|
152 | bdd5003a | pbrook | #undef FN
|
153 | bdd5003a | pbrook | width -= 32;
|
154 | bdd5003a | pbrook | src += 4;
|
155 | bdd5003a | pbrook | } |
156 | bdd5003a | pbrook | } |
157 | bdd5003a | pbrook | |
158 | 714fa308 | pbrook | static void glue(pl110_draw_line2_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep) |
159 | bdd5003a | pbrook | { |
160 | 714fa308 | pbrook | uint32_t *pallette = opaque; |
161 | bdd5003a | pbrook | uint32_t data; |
162 | bdd5003a | pbrook | while (width > 0) { |
163 | bdd5003a | pbrook | data = *(uint32_t *)src; |
164 | bdd5003a | pbrook | #ifdef SWAP_PIXELS
|
165 | bdd5003a | pbrook | #define FN(x, y) COPY_PIXEL(d, pallette[(data >> (y + 6 - (x)*2)) & 3]); |
166 | bdd5003a | pbrook | #else
|
167 | bdd5003a | pbrook | #define FN(x, y) COPY_PIXEL(d, pallette[(data >> ((x)*2 + y)) & 3]); |
168 | bdd5003a | pbrook | #endif
|
169 | be9d3657 | pbrook | #ifdef SWAP_WORDS
|
170 | bdd5003a | pbrook | FN_4(0, 24) |
171 | bdd5003a | pbrook | FN_4(0, 16) |
172 | bdd5003a | pbrook | FN_4(0, 8) |
173 | bdd5003a | pbrook | FN_4(0, 0) |
174 | bdd5003a | pbrook | #else
|
175 | bdd5003a | pbrook | FN_4(0, 0) |
176 | bdd5003a | pbrook | FN_4(0, 8) |
177 | bdd5003a | pbrook | FN_4(0, 16) |
178 | bdd5003a | pbrook | FN_4(0, 24) |
179 | bdd5003a | pbrook | #endif
|
180 | bdd5003a | pbrook | #undef FN
|
181 | bdd5003a | pbrook | width -= 16;
|
182 | bdd5003a | pbrook | src += 4;
|
183 | bdd5003a | pbrook | } |
184 | bdd5003a | pbrook | } |
185 | bdd5003a | pbrook | |
186 | 714fa308 | pbrook | static void glue(pl110_draw_line4_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep) |
187 | bdd5003a | pbrook | { |
188 | 714fa308 | pbrook | uint32_t *pallette = opaque; |
189 | bdd5003a | pbrook | uint32_t data; |
190 | bdd5003a | pbrook | while (width > 0) { |
191 | bdd5003a | pbrook | data = *(uint32_t *)src; |
192 | bdd5003a | pbrook | #ifdef SWAP_PIXELS
|
193 | bdd5003a | pbrook | #define FN(x, y) COPY_PIXEL(d, pallette[(data >> (y + 4 - (x)*4)) & 0xf]); |
194 | bdd5003a | pbrook | #else
|
195 | bdd5003a | pbrook | #define FN(x, y) COPY_PIXEL(d, pallette[(data >> ((x)*4 + y)) & 0xf]); |
196 | bdd5003a | pbrook | #endif
|
197 | be9d3657 | pbrook | #ifdef SWAP_WORDS
|
198 | bdd5003a | pbrook | FN_2(0, 24) |
199 | bdd5003a | pbrook | FN_2(0, 16) |
200 | bdd5003a | pbrook | FN_2(0, 8) |
201 | bdd5003a | pbrook | FN_2(0, 0) |
202 | bdd5003a | pbrook | #else
|
203 | bdd5003a | pbrook | FN_2(0, 0) |
204 | bdd5003a | pbrook | FN_2(0, 8) |
205 | bdd5003a | pbrook | FN_2(0, 16) |
206 | bdd5003a | pbrook | FN_2(0, 24) |
207 | bdd5003a | pbrook | #endif
|
208 | bdd5003a | pbrook | #undef FN
|
209 | bdd5003a | pbrook | width -= 8;
|
210 | bdd5003a | pbrook | src += 4;
|
211 | bdd5003a | pbrook | } |
212 | bdd5003a | pbrook | } |
213 | bdd5003a | pbrook | |
214 | 714fa308 | pbrook | static void glue(pl110_draw_line8_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep) |
215 | bdd5003a | pbrook | { |
216 | 714fa308 | pbrook | uint32_t *pallette = opaque; |
217 | bdd5003a | pbrook | uint32_t data; |
218 | bdd5003a | pbrook | while (width > 0) { |
219 | bdd5003a | pbrook | data = *(uint32_t *)src; |
220 | bdd5003a | pbrook | #define FN(x) COPY_PIXEL(d, pallette[(data >> (x)) & 0xff]); |
221 | be9d3657 | pbrook | #ifdef SWAP_WORDS
|
222 | bdd5003a | pbrook | FN(24)
|
223 | bdd5003a | pbrook | FN(16)
|
224 | bdd5003a | pbrook | FN(8)
|
225 | bdd5003a | pbrook | FN(0)
|
226 | bdd5003a | pbrook | #else
|
227 | bdd5003a | pbrook | FN(0)
|
228 | bdd5003a | pbrook | FN(8)
|
229 | bdd5003a | pbrook | FN(16)
|
230 | bdd5003a | pbrook | FN(24)
|
231 | bdd5003a | pbrook | #endif
|
232 | bdd5003a | pbrook | #undef FN
|
233 | bdd5003a | pbrook | width -= 4;
|
234 | bdd5003a | pbrook | src += 4;
|
235 | bdd5003a | pbrook | } |
236 | bdd5003a | pbrook | } |
237 | bdd5003a | pbrook | |
238 | 714fa308 | pbrook | static void glue(pl110_draw_line16_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep) |
239 | bdd5003a | pbrook | { |
240 | bdd5003a | pbrook | uint32_t data; |
241 | bdd5003a | pbrook | unsigned int r, g, b; |
242 | bdd5003a | pbrook | while (width > 0) { |
243 | bdd5003a | pbrook | data = *(uint32_t *)src; |
244 | be9d3657 | pbrook | #ifdef SWAP_WORDS
|
245 | bdd5003a | pbrook | data = bswap32(data); |
246 | bdd5003a | pbrook | #endif
|
247 | e9c05b42 | balrog | #ifdef RGB
|
248 | e9c05b42 | balrog | #define LSB r
|
249 | e9c05b42 | balrog | #define MSB b
|
250 | e9c05b42 | balrog | #else
|
251 | e9c05b42 | balrog | #define LSB b
|
252 | e9c05b42 | balrog | #define MSB r
|
253 | e9c05b42 | balrog | #endif
|
254 | bdd5003a | pbrook | #if 0
|
255 | e9c05b42 | balrog | LSB = data & 0x1f;
|
256 | bdd5003a | pbrook | data >>= 5;
|
257 | bdd5003a | pbrook | g = data & 0x3f;
|
258 | bdd5003a | pbrook | data >>= 6;
|
259 | e9c05b42 | balrog | MSB = data & 0x1f;
|
260 | bdd5003a | pbrook | data >>= 5;
|
261 | bdd5003a | pbrook | #else
|
262 | e9c05b42 | balrog | LSB = (data & 0x1f) << 3; |
263 | bdd5003a | pbrook | data >>= 5;
|
264 | bdd5003a | pbrook | g = (data & 0x3f) << 2; |
265 | bdd5003a | pbrook | data >>= 6;
|
266 | e9c05b42 | balrog | MSB = (data & 0x1f) << 3; |
267 | bdd5003a | pbrook | data >>= 5;
|
268 | bdd5003a | pbrook | #endif
|
269 | bdd5003a | pbrook | COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b)); |
270 | e9c05b42 | balrog | LSB = (data & 0x1f) << 3; |
271 | bdd5003a | pbrook | data >>= 5;
|
272 | bdd5003a | pbrook | g = (data & 0x3f) << 2; |
273 | bdd5003a | pbrook | data >>= 6;
|
274 | e9c05b42 | balrog | MSB = (data & 0x1f) << 3; |
275 | bdd5003a | pbrook | data >>= 5;
|
276 | bdd5003a | pbrook | COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b)); |
277 | e9c05b42 | balrog | #undef MSB
|
278 | e9c05b42 | balrog | #undef LSB
|
279 | bdd5003a | pbrook | width -= 2;
|
280 | bdd5003a | pbrook | src += 4;
|
281 | bdd5003a | pbrook | } |
282 | bdd5003a | pbrook | } |
283 | bdd5003a | pbrook | |
284 | 714fa308 | pbrook | static void glue(pl110_draw_line32_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep) |
285 | bdd5003a | pbrook | { |
286 | bdd5003a | pbrook | uint32_t data; |
287 | bdd5003a | pbrook | unsigned int r, g, b; |
288 | bdd5003a | pbrook | while (width > 0) { |
289 | bdd5003a | pbrook | data = *(uint32_t *)src; |
290 | e9c05b42 | balrog | #ifdef RGB
|
291 | e9c05b42 | balrog | #define LSB r
|
292 | e9c05b42 | balrog | #define MSB b
|
293 | e9c05b42 | balrog | #else
|
294 | e9c05b42 | balrog | #define LSB b
|
295 | e9c05b42 | balrog | #define MSB r
|
296 | e9c05b42 | balrog | #endif
|
297 | 399a4e21 | Paul Brook | #ifndef SWAP_WORDS
|
298 | e9c05b42 | balrog | LSB = data & 0xff;
|
299 | bdd5003a | pbrook | g = (data >> 8) & 0xff; |
300 | e9c05b42 | balrog | MSB = (data >> 16) & 0xff; |
301 | bdd5003a | pbrook | #else
|
302 | e9c05b42 | balrog | LSB = (data >> 24) & 0xff; |
303 | bdd5003a | pbrook | g = (data >> 16) & 0xff; |
304 | e9c05b42 | balrog | MSB = (data >> 8) & 0xff; |
305 | bdd5003a | pbrook | #endif
|
306 | bdd5003a | pbrook | COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b)); |
307 | e9c05b42 | balrog | #undef MSB
|
308 | e9c05b42 | balrog | #undef LSB
|
309 | bdd5003a | pbrook | width--; |
310 | bdd5003a | pbrook | src += 4;
|
311 | bdd5003a | pbrook | } |
312 | bdd5003a | pbrook | } |
313 | bdd5003a | pbrook | |
314 | 4fbf5556 | Peter Maydell | static void glue(pl110_draw_line16_555_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep) |
315 | 4fbf5556 | Peter Maydell | { |
316 | 4fbf5556 | Peter Maydell | /* RGB 555 plus an intensity bit (which we ignore) */
|
317 | 4fbf5556 | Peter Maydell | uint32_t data; |
318 | 4fbf5556 | Peter Maydell | unsigned int r, g, b; |
319 | 4fbf5556 | Peter Maydell | while (width > 0) { |
320 | 4fbf5556 | Peter Maydell | data = *(uint32_t *)src; |
321 | 4fbf5556 | Peter Maydell | #ifdef SWAP_WORDS
|
322 | 4fbf5556 | Peter Maydell | data = bswap32(data); |
323 | 4fbf5556 | Peter Maydell | #endif
|
324 | 4fbf5556 | Peter Maydell | #ifdef RGB
|
325 | 4fbf5556 | Peter Maydell | #define LSB r
|
326 | 4fbf5556 | Peter Maydell | #define MSB b
|
327 | 4fbf5556 | Peter Maydell | #else
|
328 | 4fbf5556 | Peter Maydell | #define LSB b
|
329 | 4fbf5556 | Peter Maydell | #define MSB r
|
330 | 4fbf5556 | Peter Maydell | #endif
|
331 | 4fbf5556 | Peter Maydell | LSB = (data & 0x1f) << 3; |
332 | 4fbf5556 | Peter Maydell | data >>= 5;
|
333 | 4fbf5556 | Peter Maydell | g = (data & 0x1f) << 3; |
334 | 4fbf5556 | Peter Maydell | data >>= 5;
|
335 | 4fbf5556 | Peter Maydell | MSB = (data & 0x1f) << 3; |
336 | 4fbf5556 | Peter Maydell | data >>= 5;
|
337 | 4fbf5556 | Peter Maydell | COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b)); |
338 | 4fbf5556 | Peter Maydell | LSB = (data & 0x1f) << 3; |
339 | 4fbf5556 | Peter Maydell | data >>= 5;
|
340 | 4fbf5556 | Peter Maydell | g = (data & 0x1f) << 3; |
341 | 4fbf5556 | Peter Maydell | data >>= 5;
|
342 | 4fbf5556 | Peter Maydell | MSB = (data & 0x1f) << 3; |
343 | 4fbf5556 | Peter Maydell | data >>= 6;
|
344 | 4fbf5556 | Peter Maydell | COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b)); |
345 | 4fbf5556 | Peter Maydell | #undef MSB
|
346 | 4fbf5556 | Peter Maydell | #undef LSB
|
347 | 4fbf5556 | Peter Maydell | width -= 2;
|
348 | 4fbf5556 | Peter Maydell | src += 4;
|
349 | 4fbf5556 | Peter Maydell | } |
350 | 4fbf5556 | Peter Maydell | } |
351 | 4fbf5556 | Peter Maydell | |
352 | 4fbf5556 | Peter Maydell | static void glue(pl110_draw_line12_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep) |
353 | 4fbf5556 | Peter Maydell | { |
354 | 4fbf5556 | Peter Maydell | /* RGB 444 with 4 bits of zeroes at the top of each halfword */
|
355 | 4fbf5556 | Peter Maydell | uint32_t data; |
356 | 4fbf5556 | Peter Maydell | unsigned int r, g, b; |
357 | 4fbf5556 | Peter Maydell | while (width > 0) { |
358 | 4fbf5556 | Peter Maydell | data = *(uint32_t *)src; |
359 | 4fbf5556 | Peter Maydell | #ifdef SWAP_WORDS
|
360 | 4fbf5556 | Peter Maydell | data = bswap32(data); |
361 | 4fbf5556 | Peter Maydell | #endif
|
362 | 4fbf5556 | Peter Maydell | #ifdef RGB
|
363 | 4fbf5556 | Peter Maydell | #define LSB r
|
364 | 4fbf5556 | Peter Maydell | #define MSB b
|
365 | 4fbf5556 | Peter Maydell | #else
|
366 | 4fbf5556 | Peter Maydell | #define LSB b
|
367 | 4fbf5556 | Peter Maydell | #define MSB r
|
368 | 4fbf5556 | Peter Maydell | #endif
|
369 | 4fbf5556 | Peter Maydell | LSB = (data & 0xf) << 4; |
370 | 4fbf5556 | Peter Maydell | data >>= 4;
|
371 | 4fbf5556 | Peter Maydell | g = (data & 0xf) << 4; |
372 | 4fbf5556 | Peter Maydell | data >>= 4;
|
373 | 4fbf5556 | Peter Maydell | MSB = (data & 0xf) << 4; |
374 | 4fbf5556 | Peter Maydell | data >>= 8;
|
375 | 4fbf5556 | Peter Maydell | COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b)); |
376 | 4fbf5556 | Peter Maydell | LSB = (data & 0xf) << 4; |
377 | 4fbf5556 | Peter Maydell | data >>= 4;
|
378 | 4fbf5556 | Peter Maydell | g = (data & 0xf) << 4; |
379 | 4fbf5556 | Peter Maydell | data >>= 4;
|
380 | 4fbf5556 | Peter Maydell | MSB = (data & 0xf) << 4; |
381 | 4fbf5556 | Peter Maydell | data >>= 8;
|
382 | 4fbf5556 | Peter Maydell | COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b)); |
383 | 4fbf5556 | Peter Maydell | #undef MSB
|
384 | 4fbf5556 | Peter Maydell | #undef LSB
|
385 | 4fbf5556 | Peter Maydell | width -= 2;
|
386 | 4fbf5556 | Peter Maydell | src += 4;
|
387 | 4fbf5556 | Peter Maydell | } |
388 | 4fbf5556 | Peter Maydell | } |
389 | 4fbf5556 | Peter Maydell | |
390 | bdd5003a | pbrook | #undef SWAP_PIXELS
|
391 | bdd5003a | pbrook | #undef NAME
|
392 | bdd5003a | pbrook | #undef SWAP_WORDS
|
393 | bdd5003a | pbrook | #undef ORDER
|
394 | bdd5003a | pbrook | |
395 | bdd5003a | pbrook | #endif |