aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/fb_draw.h
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/fb_draw.h
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/fb_draw.h')
-rw-r--r--drivers/video/fb_draw.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/video/fb_draw.h b/drivers/video/fb_draw.h
index a2a0618d86a5..1db622192bde 100644
--- a/drivers/video/fb_draw.h
+++ b/drivers/video/fb_draw.h
@@ -94,41 +94,44 @@ static inline unsigned long fb_rev_pixels_in_long(unsigned long val,
94 return val; 94 return val;
95} 95}
96 96
97static inline u32 fb_shifted_pixels_mask_u32(u32 index, u32 bswapmask) 97static inline u32 fb_shifted_pixels_mask_u32(struct fb_info *p, u32 index,
98 u32 bswapmask)
98{ 99{
99 u32 mask; 100 u32 mask;
100 101
101 if (!bswapmask) { 102 if (!bswapmask) {
102 mask = FB_SHIFT_HIGH(~(u32)0, index); 103 mask = FB_SHIFT_HIGH(p, ~(u32)0, index);
103 } else { 104 } else {
104 mask = 0xff << FB_LEFT_POS(8); 105 mask = 0xff << FB_LEFT_POS(p, 8);
105 mask = FB_SHIFT_LOW(mask, index & (bswapmask)) & mask; 106 mask = FB_SHIFT_LOW(p, mask, index & (bswapmask)) & mask;
106 mask = FB_SHIFT_HIGH(mask, index & ~(bswapmask)); 107 mask = FB_SHIFT_HIGH(p, mask, index & ~(bswapmask));
107#if defined(__i386__) || defined(__x86_64__) 108#if defined(__i386__) || defined(__x86_64__)
108 /* Shift argument is limited to 0 - 31 on x86 based CPU's */ 109 /* Shift argument is limited to 0 - 31 on x86 based CPU's */
109 if(index + bswapmask < 32) 110 if(index + bswapmask < 32)
110#endif 111#endif
111 mask |= FB_SHIFT_HIGH(~(u32)0, 112 mask |= FB_SHIFT_HIGH(p, ~(u32)0,
112 (index + bswapmask) & ~(bswapmask)); 113 (index + bswapmask) & ~(bswapmask));
113 } 114 }
114 return mask; 115 return mask;
115} 116}
116 117
117static inline unsigned long fb_shifted_pixels_mask_long(u32 index, u32 bswapmask) 118static inline unsigned long fb_shifted_pixels_mask_long(struct fb_info *p,
119 u32 index,
120 u32 bswapmask)
118{ 121{
119 unsigned long mask; 122 unsigned long mask;
120 123
121 if (!bswapmask) { 124 if (!bswapmask) {
122 mask = FB_SHIFT_HIGH(~0UL, index); 125 mask = FB_SHIFT_HIGH(p, ~0UL, index);
123 } else { 126 } else {
124 mask = 0xff << FB_LEFT_POS(8); 127 mask = 0xff << FB_LEFT_POS(p, 8);
125 mask = FB_SHIFT_LOW(mask, index & (bswapmask)) & mask; 128 mask = FB_SHIFT_LOW(p, mask, index & (bswapmask)) & mask;
126 mask = FB_SHIFT_HIGH(mask, index & ~(bswapmask)); 129 mask = FB_SHIFT_HIGH(p, mask, index & ~(bswapmask));
127#if defined(__i386__) || defined(__x86_64__) 130#if defined(__i386__) || defined(__x86_64__)
128 /* Shift argument is limited to 0 - 31 on x86 based CPU's */ 131 /* Shift argument is limited to 0 - 31 on x86 based CPU's */
129 if(index + bswapmask < BITS_PER_LONG) 132 if(index + bswapmask < BITS_PER_LONG)
130#endif 133#endif
131 mask |= FB_SHIFT_HIGH(~0UL, 134 mask |= FB_SHIFT_HIGH(p, ~0UL,
132 (index + bswapmask) & ~(bswapmask)); 135 (index + bswapmask) & ~(bswapmask));
133 } 136 }
134 return mask; 137 return mask;
@@ -158,8 +161,8 @@ static inline unsigned long fb_rev_pixels_in_long(unsigned long val,
158 return val; 161 return val;
159} 162}
160 163
161#define fb_shifted_pixels_mask_u32(i, b) FB_SHIFT_HIGH(~(u32)0, (i)) 164#define fb_shifted_pixels_mask_u32(p, i, b) FB_SHIFT_HIGH((p), ~(u32)0, (i))
162#define fb_shifted_pixels_mask_long(i, b) FB_SHIFT_HIGH(~0UL, (i)) 165#define fb_shifted_pixels_mask_long(p, i, b) FB_SHIFT_HIGH((p), ~0UL, (i))
163#define fb_compute_bswapmask(...) 0 166#define fb_compute_bswapmask(...) 0
164 167
165#endif /* CONFIG_FB_CFB_REV_PIXELS_IN_BYTE */ 168#endif /* CONFIG_FB_CFB_REV_PIXELS_IN_BYTE */