diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2005-11-08 21:39:17 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 07:56:36 -0800 |
commit | 81d3e147ec9ffc6ef04b5f05afa4bef22487b32b (patch) | |
tree | 68f3e0779b1bc45aa639d977ce0c36db4228fa4c /drivers/video | |
parent | 120ddb41f18c2d41702af561f4acfbcbd8d6fb46 (diff) | |
download | linux-stable-81d3e147ec9ffc6ef04b5f05afa4bef22487b32b.tar.gz linux-stable-81d3e147ec9ffc6ef04b5f05afa4bef22487b32b.tar.bz2 linux-stable-81d3e147ec9ffc6ef04b5f05afa4bef22487b32b.zip |
[PATCH] fbdev: Possible endian fix in cfbimageblit
Fix possible endian bug(?) when bit testing in slow_imageblit(). This
function is rarely called (only if (width * bpp) % 32 != 0) thus the bug is
not triggered.
However, if the console is rotated at 90 or 270 degrees, the height becomes
the width, and a variety of fonts have heights that will force a call to
slow_imageblit().
Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/cfbimgblt.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c index da664cea7eca..a7770c4f17d0 100644 --- a/drivers/video/cfbimgblt.c +++ b/drivers/video/cfbimgblt.c @@ -80,10 +80,12 @@ static u32 cfb_tab32[] = { #define LEFT_POS(bpp) (32 - bpp) #define SHIFT_HIGH(val, bits) ((val) >> (bits)) #define SHIFT_LOW(val, bits) ((val) << (bits)) +#define BIT_NR(b) (7 - (b)) #else #define LEFT_POS(bpp) (0) #define SHIFT_HIGH(val, bits) ((val) << (bits)) #define SHIFT_LOW(val, bits) ((val) >> (bits)) +#define BIT_NR(b) (b) #endif static inline void color_imageblit(const struct fb_image *image, @@ -177,7 +179,7 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info * while (j--) { l--; - color = (*s & (1 << l)) ? fgcolor : bgcolor; + color = (*s & 1 << (BIT_NR(l))) ? fgcolor : bgcolor; color <<= LEFT_POS(bpp); val |= SHIFT_HIGH(color, shift); |