diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2008-04-28 05:14:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:35 -0400 |
commit | e4c690e061b909127ab0f12e929f82f3f39ec953 (patch) | |
tree | b798bbda541f615cd4830cad96ed3f58db1fd19c /drivers/video/cfbcopyarea.c | |
parent | 6b745b6fd02213f4b2fef2f2635985929fc5b8cc (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/cfbcopyarea.c')
-rw-r--r-- | drivers/video/cfbcopyarea.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/video/cfbcopyarea.c b/drivers/video/cfbcopyarea.c index b07e419b12d2..df03f3776dcc 100644 --- a/drivers/video/cfbcopyarea.c +++ b/drivers/video/cfbcopyarea.c | |||
@@ -44,15 +44,16 @@ | |||
44 | */ | 44 | */ |
45 | 45 | ||
46 | static void | 46 | static void |
47 | bitcpy(unsigned long __iomem *dst, int dst_idx, const unsigned long __iomem *src, | 47 | bitcpy(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
48 | int src_idx, int bits, unsigned n, u32 bswapmask) | 48 | const unsigned long __iomem *src, int src_idx, int bits, |
49 | unsigned n, u32 bswapmask) | ||
49 | { | 50 | { |
50 | unsigned long first, last; | 51 | unsigned long first, last; |
51 | int const shift = dst_idx-src_idx; | 52 | int const shift = dst_idx-src_idx; |
52 | int left, right; | 53 | int left, right; |
53 | 54 | ||
54 | first = fb_shifted_pixels_mask_long(dst_idx, bswapmask); | 55 | first = fb_shifted_pixels_mask_long(p, dst_idx, bswapmask); |
55 | last = ~fb_shifted_pixels_mask_long((dst_idx+n) % bits, bswapmask); | 56 | last = ~fb_shifted_pixels_mask_long(p, (dst_idx+n) % bits, bswapmask); |
56 | 57 | ||
57 | if (!shift) { | 58 | if (!shift) { |
58 | // Same alignment for source and dest | 59 | // Same alignment for source and dest |
@@ -202,8 +203,9 @@ bitcpy(unsigned long __iomem *dst, int dst_idx, const unsigned long __iomem *src | |||
202 | */ | 203 | */ |
203 | 204 | ||
204 | static void | 205 | static void |
205 | bitcpy_rev(unsigned long __iomem *dst, int dst_idx, const unsigned long __iomem *src, | 206 | bitcpy_rev(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
206 | int src_idx, int bits, unsigned n, u32 bswapmask) | 207 | const unsigned long __iomem *src, int src_idx, int bits, |
208 | unsigned n, u32 bswapmask) | ||
207 | { | 209 | { |
208 | unsigned long first, last; | 210 | unsigned long first, last; |
209 | int shift; | 211 | int shift; |
@@ -221,8 +223,9 @@ bitcpy_rev(unsigned long __iomem *dst, int dst_idx, const unsigned long __iomem | |||
221 | 223 | ||
222 | shift = dst_idx-src_idx; | 224 | shift = dst_idx-src_idx; |
223 | 225 | ||
224 | first = fb_shifted_pixels_mask_long(bits - 1 - dst_idx, bswapmask); | 226 | first = fb_shifted_pixels_mask_long(p, bits - 1 - dst_idx, bswapmask); |
225 | last = ~fb_shifted_pixels_mask_long(bits - 1 - ((dst_idx-n) % bits), bswapmask); | 227 | last = ~fb_shifted_pixels_mask_long(p, bits - 1 - ((dst_idx-n) % bits), |
228 | bswapmask); | ||
226 | 229 | ||
227 | if (!shift) { | 230 | if (!shift) { |
228 | // Same alignment for source and dest | 231 | // Same alignment for source and dest |
@@ -404,7 +407,7 @@ void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) | |||
404 | dst_idx &= (bytes - 1); | 407 | dst_idx &= (bytes - 1); |
405 | src += src_idx >> (ffs(bits) - 1); | 408 | src += src_idx >> (ffs(bits) - 1); |
406 | src_idx &= (bytes - 1); | 409 | src_idx &= (bytes - 1); |
407 | bitcpy_rev(dst, dst_idx, src, src_idx, bits, | 410 | bitcpy_rev(p, dst, dst_idx, src, src_idx, bits, |
408 | width*p->var.bits_per_pixel, bswapmask); | 411 | width*p->var.bits_per_pixel, bswapmask); |
409 | } | 412 | } |
410 | } else { | 413 | } else { |
@@ -413,7 +416,7 @@ void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) | |||
413 | dst_idx &= (bytes - 1); | 416 | dst_idx &= (bytes - 1); |
414 | src += src_idx >> (ffs(bits) - 1); | 417 | src += src_idx >> (ffs(bits) - 1); |
415 | src_idx &= (bytes - 1); | 418 | src_idx &= (bytes - 1); |
416 | bitcpy(dst, dst_idx, src, src_idx, bits, | 419 | bitcpy(p, dst, dst_idx, src, src_idx, bits, |
417 | width*p->var.bits_per_pixel, bswapmask); | 420 | width*p->var.bits_per_pixel, bswapmask); |
418 | dst_idx += bits_per_line; | 421 | dst_idx += bits_per_line; |
419 | src_idx += bits_per_line; | 422 | src_idx += bits_per_line; |