aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/fb_draw.h
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2007-10-16 04:29:55 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:23 -0400
commit15afdd433610c4ba0edf1f8a59915b3755af7365 (patch)
tree0e59d4eeb2e66af72a4b1a1fead29fa362826792 /drivers/video/fb_draw.h
parentc3ca34f90b44049dcde62a8f97554409112bf376 (diff)
fbdev: copyarea function taught to fully support swapped pixel order in byte
This correct case, when source and destination X coordinates difference is n multiple of pixels in byte. This is probably rare case, but this case should supported for completeness. Reorganization of FB_READL and FB_WRITEL calls results in code size decrease for normal build without swapping support and size with support enabled is reasonable too. [adaplas] Add missing fb_rev_pixels_in_long() prototype. Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz> Signed-off-by: Antonino Daplas <adaplas@gmail.com> [akpm@linux-foundation.org: coding-style fixes] 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.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/video/fb_draw.h b/drivers/video/fb_draw.h
index 816843f06bb7..cdafbe14ef1f 100644
--- a/drivers/video/fb_draw.h
+++ b/drivers/video/fb_draw.h
@@ -72,6 +72,26 @@ pixel_to_pat( u32 bpp, u32 pixel)
72#endif 72#endif
73 73
74#ifdef CONFIG_FB_CFB_REV_PIXELS_IN_BYTE 74#ifdef CONFIG_FB_CFB_REV_PIXELS_IN_BYTE
75#if BITS_PER_LONG == 64
76#define REV_PIXELS_MASK1 0x5555555555555555ul
77#define REV_PIXELS_MASK2 0x3333333333333333ul
78#define REV_PIXELS_MASK4 0x0f0f0f0f0f0f0f0ful
79#else
80#define REV_PIXELS_MASK1 0x55555555ul
81#define REV_PIXELS_MASK2 0x33333333ul
82#define REV_PIXELS_MASK4 0x0f0f0f0ful
83#endif
84
85static inline unsigned long fb_rev_pixels_in_long(unsigned long val,
86 u32 bswapmask)
87{
88 if (bswapmask & 1)
89 val = comp(val >> 1, val << 1, REV_PIXELS_MASK1);
90 if (bswapmask & 2)
91 val = comp(val >> 2, val << 2, REV_PIXELS_MASK2);
92 if (bswapmask & 3)
93 val = comp(val >> 4, val << 4, REV_PIXELS_MASK4);
94}
75 95
76static inline u32 fb_shifted_pixels_mask_u32(u32 index, u32 bswapmask) 96static inline u32 fb_shifted_pixels_mask_u32(u32 index, u32 bswapmask)
77{ 97{
@@ -131,6 +151,12 @@ static inline u32 fb_compute_bswapmask(struct fb_info *info)
131 151
132#else /* CONFIG_FB_CFB_REV_PIXELS_IN_BYTE */ 152#else /* CONFIG_FB_CFB_REV_PIXELS_IN_BYTE */
133 153
154static inline unsigned long fb_rev_pixels_in_long(unsigned long val,
155 u32 bswapmask)
156{
157 return val;
158}
159
134#define fb_shifted_pixels_mask_u32(i, b) FB_SHIFT_HIGH(~(u32)0, (i)) 160#define fb_shifted_pixels_mask_u32(i, b) FB_SHIFT_HIGH(~(u32)0, (i))
135#define fb_shifted_pixels_mask_long(i, b) FB_SHIFT_HIGH(~0UL, (i)) 161#define fb_shifted_pixels_mask_long(i, b) FB_SHIFT_HIGH(~0UL, (i))
136#define fb_compute_bswapmask(...) 0 162#define fb_compute_bswapmask(...) 0