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