aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/cfbfillrect.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/cfbfillrect.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/cfbfillrect.c')
-rw-r--r--drivers/video/cfbfillrect.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/drivers/video/cfbfillrect.c b/drivers/video/cfbfillrect.c
index 23d70a12e4da..64b35766b2a2 100644
--- a/drivers/video/cfbfillrect.c
+++ b/drivers/video/cfbfillrect.c
@@ -36,16 +36,16 @@
36 */ 36 */
37 37
38static void 38static void
39bitfill_aligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat, 39bitfill_aligned(struct fb_info *p, unsigned long __iomem *dst, int dst_idx,
40 unsigned n, int bits, u32 bswapmask) 40 unsigned long pat, unsigned n, int bits, u32 bswapmask)
41{ 41{
42 unsigned long first, last; 42 unsigned long first, last;
43 43
44 if (!n) 44 if (!n)
45 return; 45 return;
46 46
47 first = fb_shifted_pixels_mask_long(dst_idx, bswapmask); 47 first = fb_shifted_pixels_mask_long(p, dst_idx, bswapmask);
48 last = ~fb_shifted_pixels_mask_long((dst_idx+n) % bits, bswapmask); 48 last = ~fb_shifted_pixels_mask_long(p, (dst_idx+n) % bits, bswapmask);
49 49
50 if (dst_idx+n <= bits) { 50 if (dst_idx+n <= bits) {
51 // Single word 51 // Single word
@@ -93,16 +93,16 @@ bitfill_aligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
93 */ 93 */
94 94
95static void 95static void
96bitfill_unaligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat, 96bitfill_unaligned(struct fb_info *p, unsigned long __iomem *dst, int dst_idx,
97 int left, int right, unsigned n, int bits) 97 unsigned long pat, int left, int right, unsigned n, int bits)
98{ 98{
99 unsigned long first, last; 99 unsigned long first, last;
100 100
101 if (!n) 101 if (!n)
102 return; 102 return;
103 103
104 first = FB_SHIFT_HIGH(~0UL, dst_idx); 104 first = FB_SHIFT_HIGH(p, ~0UL, dst_idx);
105 last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); 105 last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits));
106 106
107 if (dst_idx+n <= bits) { 107 if (dst_idx+n <= bits) {
108 // Single word 108 // Single word
@@ -147,8 +147,9 @@ bitfill_unaligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
147 * Aligned pattern invert using 32/64-bit memory accesses 147 * Aligned pattern invert using 32/64-bit memory accesses
148 */ 148 */
149static void 149static void
150bitfill_aligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat, 150bitfill_aligned_rev(struct fb_info *p, unsigned long __iomem *dst,
151 unsigned n, int bits, u32 bswapmask) 151 int dst_idx, unsigned long pat, unsigned n, int bits,
152 u32 bswapmask)
152{ 153{
153 unsigned long val = pat, dat; 154 unsigned long val = pat, dat;
154 unsigned long first, last; 155 unsigned long first, last;
@@ -156,8 +157,8 @@ bitfill_aligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
156 if (!n) 157 if (!n)
157 return; 158 return;
158 159
159 first = fb_shifted_pixels_mask_long(dst_idx, bswapmask); 160 first = fb_shifted_pixels_mask_long(p, dst_idx, bswapmask);
160 last = ~fb_shifted_pixels_mask_long((dst_idx+n) % bits, bswapmask); 161 last = ~fb_shifted_pixels_mask_long(p, (dst_idx+n) % bits, bswapmask);
161 162
162 if (dst_idx+n <= bits) { 163 if (dst_idx+n <= bits) {
163 // Single word 164 // Single word
@@ -217,16 +218,17 @@ bitfill_aligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
217 */ 218 */
218 219
219static void 220static void
220bitfill_unaligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat, 221bitfill_unaligned_rev(struct fb_info *p, unsigned long __iomem *dst,
221 int left, int right, unsigned n, int bits) 222 int dst_idx, unsigned long pat, int left, int right,
223 unsigned n, int bits)
222{ 224{
223 unsigned long first, last, dat; 225 unsigned long first, last, dat;
224 226
225 if (!n) 227 if (!n)
226 return; 228 return;
227 229
228 first = FB_SHIFT_HIGH(~0UL, dst_idx); 230 first = FB_SHIFT_HIGH(p, ~0UL, dst_idx);
229 last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); 231 last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits));
230 232
231 if (dst_idx+n <= bits) { 233 if (dst_idx+n <= bits) {
232 // Single word 234 // Single word
@@ -306,7 +308,8 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
306 p->fbops->fb_sync(p); 308 p->fbops->fb_sync(p);
307 if (!left) { 309 if (!left) {
308 u32 bswapmask = fb_compute_bswapmask(p); 310 u32 bswapmask = fb_compute_bswapmask(p);
309 void (*fill_op32)(unsigned long __iomem *dst, int dst_idx, 311 void (*fill_op32)(struct fb_info *p,
312 unsigned long __iomem *dst, int dst_idx,
310 unsigned long pat, unsigned n, int bits, 313 unsigned long pat, unsigned n, int bits,
311 u32 bswapmask) = NULL; 314 u32 bswapmask) = NULL;
312 315
@@ -325,16 +328,17 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
325 while (height--) { 328 while (height--) {
326 dst += dst_idx >> (ffs(bits) - 1); 329 dst += dst_idx >> (ffs(bits) - 1);
327 dst_idx &= (bits - 1); 330 dst_idx &= (bits - 1);
328 fill_op32(dst, dst_idx, pat, width*bpp, bits, bswapmask); 331 fill_op32(p, dst, dst_idx, pat, width*bpp, bits,
332 bswapmask);
329 dst_idx += p->fix.line_length*8; 333 dst_idx += p->fix.line_length*8;
330 } 334 }
331 } else { 335 } else {
332 int right; 336 int right;
333 int r; 337 int r;
334 int rot = (left-dst_idx) % bpp; 338 int rot = (left-dst_idx) % bpp;
335 void (*fill_op)(unsigned long __iomem *dst, int dst_idx, 339 void (*fill_op)(struct fb_info *p, unsigned long __iomem *dst,
336 unsigned long pat, int left, int right, 340 int dst_idx, unsigned long pat, int left,
337 unsigned n, int bits) = NULL; 341 int right, unsigned n, int bits) = NULL;
338 342
339 /* rotate pattern to correct start position */ 343 /* rotate pattern to correct start position */
340 pat = pat << rot | pat >> (bpp-rot); 344 pat = pat << rot | pat >> (bpp-rot);
@@ -355,7 +359,7 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
355 while (height--) { 359 while (height--) {
356 dst += dst_idx >> (ffs(bits) - 1); 360 dst += dst_idx >> (ffs(bits) - 1);
357 dst_idx &= (bits - 1); 361 dst_idx &= (bits - 1);
358 fill_op(dst, dst_idx, pat, left, right, 362 fill_op(p, dst, dst_idx, pat, left, right,
359 width*bpp, bits); 363 width*bpp, bits);
360 r = (p->fix.line_length*8) % bpp; 364 r = (p->fix.line_length*8) % bpp;
361 pat = pat << (bpp-r) | pat >> r; 365 pat = pat << (bpp-r) | pat >> r;