From be0d9b6c7aeaad1683059c00131cabd4c894c17c Mon Sep 17 00:00:00 2001 From: "Antonino A. Daplas" Date: Mon, 12 Dec 2005 22:17:21 -0800 Subject: [PATCH] fbdev: Fix incorrect unaligned access in little-endian machines The drawing function cfbfillrect does not work correctly when access is not unsigned-long aligned. It manifests as extra lines of pixels that are not complete drawn. Reversing the shift operator solves the problem, so I would presume that this bug would manifest only on little endian machines. The function cfbcopyarea may also have this bug. Aligned access should present no problems. Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/fb.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/linux') diff --git a/include/linux/fb.h b/include/linux/fb.h index dab3a4d..a973be2 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -835,6 +835,18 @@ struct fb_info { #endif +#if defined (__BIG_ENDIAN) +#define FB_LEFT_POS(bpp) (32 - bpp) +#define FB_SHIFT_HIGH(val, bits) ((val) >> (bits)) +#define FB_SHIFT_LOW(val, bits) ((val) << (bits)) +#define FB_BIT_NR(b) (7 - (b)) +#else +#define FB_LEFT_POS(bpp) (0) +#define FB_SHIFT_HIGH(val, bits) ((val) << (bits)) +#define FB_SHIFT_LOW(val, bits) ((val) >> (bits)) +#define FB_BIT_NR(b) (b) +#endif + /* * `Generic' versions of the frame buffer device operations */ -- cgit v1.1