]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/qemu/files/pl110_rgb-r0.patch
updated to qemu 0.82 from oe.dev to familiar with patches to enable building with...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / qemu / files / pl110_rgb-r0.patch
1 Index: qemu/hw/pl110.c
2 ===================================================================
3 --- qemu.orig/hw/pl110.c        2006-04-11 21:49:46.000000000 +0100
4 +++ qemu/hw/pl110.c     2006-05-24 22:53:00.000000000 +0100
5 @@ -10,6 +10,7 @@
6  #include "vl.h"
7  
8  #define PL110_CR_EN   0x001
9 +#define PL110_CR_BGR  0x100
10  #define PL110_CR_BEBO 0x200
11  #define PL110_CR_BEPO 0x400
12  #define PL110_CR_PWR  0x800
13 @@ -115,6 +116,7 @@
14      int first, last = 0;
15      int dirty, new_dirty;
16      int i;
17 +    int bpp_offset;
18  
19      if (!pl110_enabled(s))
20          return;
21 @@ -146,12 +148,17 @@
22          fprintf(stderr, "pl110: Bad color depth\n");
23          exit(1);
24      }
25 +    if (s->cr & PL110_CR_BGR)
26 +       bpp_offset = 0;
27 +    else
28 +       bpp_offset = 18;
29 +
30      if (s->cr & PL110_CR_BEBO)
31 -      fn = fntable[s->bpp + 6];
32 +      fn = fntable[s->bpp + 6 + bpp_offset];
33      else if (s->cr & PL110_CR_BEPO)
34 -      fn = fntable[s->bpp + 12];
35 +      fn = fntable[s->bpp + 12 + bpp_offset];
36      else
37 -      fn = fntable[s->bpp];
38 +      fn = fntable[s->bpp + bpp_offset];
39      
40      src_width = s->cols;
41      switch (s->bpp) {
42 Index: qemu/hw/pl110_template.h
43 ===================================================================
44 --- qemu.orig/hw/pl110_template.h       2006-02-19 12:31:32.000000000 +0000
45 +++ qemu/hw/pl110_template.h    2006-05-24 23:04:03.000000000 +0100
46 @@ -24,6 +24,16 @@
47  #error unknown bit depth
48  #endif
49  
50 +#undef RGB
51 +#define BORDER bgr
52 +#define ORDER 0
53 +#include "pl110_template.h"
54 +#define ORDER 1
55 +#include "pl110_template.h"
56 +#define ORDER 2
57 +#include "pl110_template.h"
58 +#define RGB
59 +#define BORDER rgb
60  #define ORDER 0
61  #include "pl110_template.h"
62  #define ORDER 1
63 @@ -33,26 +43,47 @@
64  
65  static drawfn glue(pl110_draw_fn_,BITS)[18] =
66  {
67 -    glue(pl110_draw_line1_lblp,BITS),
68 -    glue(pl110_draw_line2_lblp,BITS),
69 -    glue(pl110_draw_line4_lblp,BITS),
70 -    glue(pl110_draw_line8_lblp,BITS),
71 -    glue(pl110_draw_line16_lblp,BITS),
72 -    glue(pl110_draw_line32_lblp,BITS),
73 -
74 -    glue(pl110_draw_line1_bbbp,BITS),
75 -    glue(pl110_draw_line2_bbbp,BITS),
76 -    glue(pl110_draw_line4_bbbp,BITS),
77 -    glue(pl110_draw_line8_bbbp,BITS),
78 -    glue(pl110_draw_line16_bbbp,BITS),
79 -    glue(pl110_draw_line32_bbbp,BITS),
80 -
81 -    glue(pl110_draw_line1_lbbp,BITS),
82 -    glue(pl110_draw_line2_lbbp,BITS),
83 -    glue(pl110_draw_line4_lbbp,BITS),
84 -    glue(pl110_draw_line8_lbbp,BITS),
85 -    glue(pl110_draw_line16_lbbp,BITS),
86 -    glue(pl110_draw_line32_lbbp,BITS)
87 +    glue(pl110_draw_line1_lblp_bgr,BITS),
88 +    glue(pl110_draw_line2_lblp_bgr,BITS),
89 +    glue(pl110_draw_line4_lblp_bgr,BITS),
90 +    glue(pl110_draw_line8_lblp_bgr,BITS),
91 +    glue(pl110_draw_line16_lblp_bgr,BITS),
92 +    glue(pl110_draw_line32_lblp_bgr,BITS),
93 +
94 +    glue(pl110_draw_line1_bbbp_bgr,BITS),
95 +    glue(pl110_draw_line2_bbbp_bgr,BITS),
96 +    glue(pl110_draw_line4_bbbp_bgr,BITS),
97 +    glue(pl110_draw_line8_bbbp_bgr,BITS),
98 +    glue(pl110_draw_line16_bbbp_bgr,BITS),
99 +    glue(pl110_draw_line32_bbbp_bgr,BITS),
100 +
101 +    glue(pl110_draw_line1_lbbp_bgr,BITS),
102 +    glue(pl110_draw_line2_lbbp_bgr,BITS),
103 +    glue(pl110_draw_line4_lbbp_bgr,BITS),
104 +    glue(pl110_draw_line8_lbbp_bgr,BITS),
105 +    glue(pl110_draw_line16_lbbp_bgr,BITS),
106 +    glue(pl110_draw_line32_lbbp_bgr,BITS),
107 +
108 +    glue(pl110_draw_line1_lblp_rgb,BITS),
109 +    glue(pl110_draw_line2_lblp_rgb,BITS),
110 +    glue(pl110_draw_line4_lblp_rgb,BITS),
111 +    glue(pl110_draw_line8_lblp_rgb,BITS),
112 +    glue(pl110_draw_line16_lblp_rgb,BITS),
113 +    glue(pl110_draw_line32_lblp_rgb,BITS),
114 +
115 +    glue(pl110_draw_line1_bbbp_rgb,BITS),
116 +    glue(pl110_draw_line2_bbbp_rgb,BITS),
117 +    glue(pl110_draw_line4_bbbp_rgb,BITS),
118 +    glue(pl110_draw_line8_bbbp_rgb,BITS),
119 +    glue(pl110_draw_line16_bbbp_rgb,BITS),
120 +    glue(pl110_draw_line32_bbbp_rgb,BITS),
121 +
122 +    glue(pl110_draw_line1_lbbp_rgb,BITS),
123 +    glue(pl110_draw_line2_lbbp_rgb,BITS),
124 +    glue(pl110_draw_line4_lbbp_rgb,BITS),
125 +    glue(pl110_draw_line8_lbbp_rgb,BITS),
126 +    glue(pl110_draw_line16_lbbp_rgb,BITS),
127 +    glue(pl110_draw_line32_lbbp_rgb,BITS),
128  };
129  
130  #undef BITS
131 @@ -61,18 +92,18 @@
132  #else
133  
134  #if ORDER == 0
135 -#define NAME glue(lblp, BITS)
136 +#define NAME glue(glue(lblp_, BORDER), BITS)
137  #ifdef WORDS_BIGENDIAN
138  #define SWAP_WORDS 1
139  #endif
140  #elif ORDER == 1
141 -#define NAME glue(bbbp, BITS)
142 +#define NAME glue(glue(bbbp_, BORDER), BITS)
143  #ifndef WORDS_BIGENDIAN
144  #define SWAP_WORDS 1
145  #endif
146  #else
147  #define SWAP_PIXELS 1
148 -#define NAME glue(lbbp, BITS)
149 +#define NAME glue(glue(lbbp_, BORDER), BITS)
150  #ifdef WORDS_BIGENDIAN
151  #define SWAP_WORDS 1
152  #endif
153 @@ -195,27 +226,34 @@
154  #ifdef SWAP_WORDS
155          data = bswap32(data);
156  #endif
157 +#ifdef RGB
158 +#define LSB r
159 +#define MSB b
160 +#else
161 +#define LSB b
162 +#define MSB r
163 +#endif
164  #if 0
165 -        r = data & 0x1f;
166 +        LSB = data & 0x1f;
167          data >>= 5;
168          g = data & 0x3f;
169          data >>= 6;
170 -        b = data & 0x1f;
171 +        MSB = data & 0x1f;
172          data >>= 5;
173  #else
174 -        r = (data & 0x1f) << 3;
175 +        LSB = (data & 0x1f) << 3;
176          data >>= 5;
177          g = (data & 0x3f) << 2;
178          data >>= 6;
179 -        b = (data & 0x1f) << 3;
180 +        MSB = (data & 0x1f) << 3;
181          data >>= 5;
182  #endif
183          COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b));
184 -        r = (data & 0x1f) << 3;
185 +        LSB = (data & 0x1f) << 3;
186          data >>= 5;
187          g = (data & 0x3f) << 2;
188          data >>= 6;
189 -        b = (data & 0x1f) << 3;
190 +        MSB = (data & 0x1f) << 3;
191          data >>= 5;
192          COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b));
193          width -= 2;
194 @@ -229,14 +267,21 @@
195      unsigned int r, g, b;
196      while (width > 0) {
197          data = *(uint32_t *)src;
198 +#ifdef RGB
199 +#define LSB r
200 +#define MSB b
201 +#else
202 +#define LSB b
203 +#define MSB r
204 +#endif
205  #ifdef SWAP_WORDS
206 -        r = data & 0xff;
207 +        LSB = data & 0xff;
208          g = (data >> 8) & 0xff;
209 -        b = (data >> 16) & 0xff;
210 +        MSB = (data >> 16) & 0xff;
211  #else
212 -        r = (data >> 24) & 0xff;
213 +        LSB = (data >> 24) & 0xff;
214          g = (data >> 16) & 0xff;
215 -        b = (data >> 8) & 0xff;
216 +        MSB = (data >> 8) & 0xff;
217  #endif
218          COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b));
219          width--;