aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/sysfillrect.c
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2008-04-28 05:14:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:35 -0400
commite4c690e061b909127ab0f12e929f82f3f39ec953 (patch)
treeb798bbda541f615cd4830cad96ed3f58db1fd19c /drivers/video/sysfillrect.c
parent6b745b6fd02213f4b2fef2f2635985929fc5b8cc (diff)
fb: add support for foreign endianness
Add support for the framebuffers with non-native endianness. This is done via FBINFO_FOREIGN_ENDIAN flag that will be used by the drivers. Depending on the host endianness this flag will be overwritten by FBINFO_BE_MATH internal flag, or cleared. Tested to work on MPC8360E-RDK (BE) + Fujitsu MINT framebuffer (LE). Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: <Valdis.Kletnieks@vt.edu> Cc: Clemens Koller <clemens.koller@anagramm.de> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/sysfillrect.c')
-rw-r--r--drivers/video/sysfillrect.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/drivers/video/sysfillrect.c b/drivers/video/sysfillrect.c
index a261e9e6a675..f94d6b6e29ee 100644
--- a/drivers/video/sysfillrect.c
+++ b/drivers/video/sysfillrect.c
@@ -22,16 +22,16 @@
22 */ 22 */
23 23
24static void 24static void
25bitfill_aligned(unsigned long *dst, int dst_idx, unsigned long pat, 25bitfill_aligned(struct fb_info *p, unsigned long *dst, int dst_idx,
26 unsigned n, int bits) 26 unsigned long pat, unsigned n, int bits)
27{ 27{
28 unsigned long first, last; 28 unsigned long first, last;
29 29
30 if (!n) 30 if (!n)
31 return; 31 return;
32 32
33 first = FB_SHIFT_HIGH(~0UL, dst_idx); 33 first = FB_SHIFT_HIGH(p, ~0UL, dst_idx);
34 last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); 34 last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits));
35 35
36 if (dst_idx+n <= bits) { 36 if (dst_idx+n <= bits) {
37 /* Single word */ 37 /* Single word */
@@ -78,16 +78,16 @@ bitfill_aligned(unsigned long *dst, int dst_idx, unsigned long pat,
78 */ 78 */
79 79
80static void 80static void
81bitfill_unaligned(unsigned long *dst, int dst_idx, unsigned long pat, 81bitfill_unaligned(struct fb_info *p, unsigned long *dst, int dst_idx,
82 int left, int right, unsigned n, int bits) 82 unsigned long pat, int left, int right, unsigned n, int bits)
83{ 83{
84 unsigned long first, last; 84 unsigned long first, last;
85 85
86 if (!n) 86 if (!n)
87 return; 87 return;
88 88
89 first = FB_SHIFT_HIGH(~0UL, dst_idx); 89 first = FB_SHIFT_HIGH(p, ~0UL, dst_idx);
90 last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); 90 last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits));
91 91
92 if (dst_idx+n <= bits) { 92 if (dst_idx+n <= bits) {
93 /* Single word */ 93 /* Single word */
@@ -132,8 +132,8 @@ bitfill_unaligned(unsigned long *dst, int dst_idx, unsigned long pat,
132 * Aligned pattern invert using 32/64-bit memory accesses 132 * Aligned pattern invert using 32/64-bit memory accesses
133 */ 133 */
134static void 134static void
135bitfill_aligned_rev(unsigned long *dst, int dst_idx, unsigned long pat, 135bitfill_aligned_rev(struct fb_info *p, unsigned long *dst, int dst_idx,
136 unsigned n, int bits) 136 unsigned long pat, unsigned n, int bits)
137{ 137{
138 unsigned long val = pat; 138 unsigned long val = pat;
139 unsigned long first, last; 139 unsigned long first, last;
@@ -141,8 +141,8 @@ bitfill_aligned_rev(unsigned long *dst, int dst_idx, unsigned long pat,
141 if (!n) 141 if (!n)
142 return; 142 return;
143 143
144 first = FB_SHIFT_HIGH(~0UL, dst_idx); 144 first = FB_SHIFT_HIGH(p, ~0UL, dst_idx);
145 last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); 145 last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits));
146 146
147 if (dst_idx+n <= bits) { 147 if (dst_idx+n <= bits) {
148 /* Single word */ 148 /* Single word */
@@ -188,16 +188,17 @@ bitfill_aligned_rev(unsigned long *dst, int dst_idx, unsigned long pat,
188 */ 188 */
189 189
190static void 190static void
191bitfill_unaligned_rev(unsigned long *dst, int dst_idx, unsigned long pat, 191bitfill_unaligned_rev(struct fb_info *p, unsigned long *dst, int dst_idx,
192 int left, int right, unsigned n, int bits) 192 unsigned long pat, int left, int right, unsigned n,
193 int bits)
193{ 194{
194 unsigned long first, last; 195 unsigned long first, last;
195 196
196 if (!n) 197 if (!n)
197 return; 198 return;
198 199
199 first = FB_SHIFT_HIGH(~0UL, dst_idx); 200 first = FB_SHIFT_HIGH(p, ~0UL, dst_idx);
200 last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); 201 last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits));
201 202
202 if (dst_idx+n <= bits) { 203 if (dst_idx+n <= bits) {
203 /* Single word */ 204 /* Single word */
@@ -267,9 +268,9 @@ void sys_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
267 if (p->fbops->fb_sync) 268 if (p->fbops->fb_sync)
268 p->fbops->fb_sync(p); 269 p->fbops->fb_sync(p);
269 if (!left) { 270 if (!left) {
270 void (*fill_op32)(unsigned long *dst, int dst_idx, 271 void (*fill_op32)(struct fb_info *p, unsigned long *dst,
271 unsigned long pat, unsigned n, int bits) = 272 int dst_idx, unsigned long pat, unsigned n,
272 NULL; 273 int bits) = NULL;
273 274
274 switch (rect->rop) { 275 switch (rect->rop) {
275 case ROP_XOR: 276 case ROP_XOR:
@@ -287,16 +288,16 @@ void sys_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
287 while (height--) { 288 while (height--) {
288 dst += dst_idx >> (ffs(bits) - 1); 289 dst += dst_idx >> (ffs(bits) - 1);
289 dst_idx &= (bits - 1); 290 dst_idx &= (bits - 1);
290 fill_op32(dst, dst_idx, pat, width*bpp, bits); 291 fill_op32(p, dst, dst_idx, pat, width*bpp, bits);
291 dst_idx += p->fix.line_length*8; 292 dst_idx += p->fix.line_length*8;
292 } 293 }
293 } else { 294 } else {
294 int right; 295 int right;
295 int r; 296 int r;
296 int rot = (left-dst_idx) % bpp; 297 int rot = (left-dst_idx) % bpp;
297 void (*fill_op)(unsigned long *dst, int dst_idx, 298 void (*fill_op)(struct fb_info *p, unsigned long *dst,
298 unsigned long pat, int left, int right, 299 int dst_idx, unsigned long pat, int left,
299 unsigned n, int bits) = NULL; 300 int right, unsigned n, int bits) = NULL;
300 301
301 /* rotate pattern to correct start position */ 302 /* rotate pattern to correct start position */
302 pat = pat << rot | pat >> (bpp-rot); 303 pat = pat << rot | pat >> (bpp-rot);
@@ -318,7 +319,7 @@ void sys_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
318 while (height--) { 319 while (height--) {
319 dst += dst_idx >> (ffs(bits) - 1); 320 dst += dst_idx >> (ffs(bits) - 1);
320 dst_idx &= (bits - 1); 321 dst_idx &= (bits - 1);
321 fill_op(dst, dst_idx, pat, left, right, 322 fill_op(p, dst, dst_idx, pat, left, right,
322 width*bpp, bits); 323 width*bpp, bits);
323 r = (p->fix.line_length*8) % bpp; 324 r = (p->fix.line_length*8) % bpp;
324 pat = pat << (bpp-r) | pat >> r; 325 pat = pat << (bpp-r) | pat >> r;