aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/syscopyarea.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/syscopyarea.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/syscopyarea.c')
-rw-r--r--drivers/video/syscopyarea.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/video/syscopyarea.c b/drivers/video/syscopyarea.c
index 37af10ab8f52..a352d5f46bbf 100644
--- a/drivers/video/syscopyarea.c
+++ b/drivers/video/syscopyarea.c
@@ -26,15 +26,15 @@
26 */ 26 */
27 27
28static void 28static void
29bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, 29bitcpy(struct fb_info *p, unsigned long *dst, int dst_idx,
30 int src_idx, int bits, unsigned n) 30 const unsigned long *src, int src_idx, int bits, unsigned n)
31{ 31{
32 unsigned long first, last; 32 unsigned long first, last;
33 int const shift = dst_idx-src_idx; 33 int const shift = dst_idx-src_idx;
34 int left, right; 34 int left, right;
35 35
36 first = FB_SHIFT_HIGH(~0UL, dst_idx); 36 first = FB_SHIFT_HIGH(p, ~0UL, dst_idx);
37 last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); 37 last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits));
38 38
39 if (!shift) { 39 if (!shift) {
40 /* Same alignment for source and dest */ 40 /* Same alignment for source and dest */
@@ -167,8 +167,8 @@ bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src,
167 */ 167 */
168 168
169static void 169static void
170bitcpy_rev(unsigned long *dst, int dst_idx, const unsigned long *src, 170bitcpy_rev(struct fb_info *p, unsigned long *dst, int dst_idx,
171 int src_idx, int bits, unsigned n) 171 const unsigned long *src, int src_idx, int bits, unsigned n)
172{ 172{
173 unsigned long first, last; 173 unsigned long first, last;
174 int shift; 174 int shift;
@@ -186,8 +186,8 @@ bitcpy_rev(unsigned long *dst, int dst_idx, const unsigned long *src,
186 186
187 shift = dst_idx-src_idx; 187 shift = dst_idx-src_idx;
188 188
189 first = FB_SHIFT_LOW(~0UL, bits - 1 - dst_idx); 189 first = FB_SHIFT_LOW(p, ~0UL, bits - 1 - dst_idx);
190 last = ~(FB_SHIFT_LOW(~0UL, bits - 1 - ((dst_idx-n) % bits))); 190 last = ~(FB_SHIFT_LOW(p, ~0UL, bits - 1 - ((dst_idx-n) % bits)));
191 191
192 if (!shift) { 192 if (!shift) {
193 /* Same alignment for source and dest */ 193 /* Same alignment for source and dest */
@@ -353,7 +353,7 @@ void sys_copyarea(struct fb_info *p, const struct fb_copyarea *area)
353 dst_idx &= (bytes - 1); 353 dst_idx &= (bytes - 1);
354 src += src_idx >> (ffs(bits) - 1); 354 src += src_idx >> (ffs(bits) - 1);
355 src_idx &= (bytes - 1); 355 src_idx &= (bytes - 1);
356 bitcpy_rev(dst, dst_idx, src, src_idx, bits, 356 bitcpy_rev(p, dst, dst_idx, src, src_idx, bits,
357 width*p->var.bits_per_pixel); 357 width*p->var.bits_per_pixel);
358 } 358 }
359 } else { 359 } else {
@@ -362,7 +362,7 @@ void sys_copyarea(struct fb_info *p, const struct fb_copyarea *area)
362 dst_idx &= (bytes - 1); 362 dst_idx &= (bytes - 1);
363 src += src_idx >> (ffs(bits) - 1); 363 src += src_idx >> (ffs(bits) - 1);
364 src_idx &= (bytes - 1); 364 src_idx &= (bytes - 1);
365 bitcpy(dst, dst_idx, src, src_idx, bits, 365 bitcpy(p, dst, dst_idx, src, src_idx, bits,
366 width*p->var.bits_per_pixel); 366 width*p->var.bits_per_pixel);
367 dst_idx += bits_per_line; 367 dst_idx += bits_per_line;
368 src_idx += bits_per_line; 368 src_idx += bits_per_line;