Re: 2 more fbcon rotation bugs
flat view
From: "Antonino A. Daplas" <adaplas@gmail.com>
Date: 2005-11-20 03:48:53
Subsystem:
framebuffer layer, the rest · Maintainers:
Helge Deller, Linus Torvalds
Knut Petersen wrote:
Antonino A. Daplas schrieb:
New bug: Vesafb & rotation does show a bug that is not present using cyblafb & rotation and the 16x30 bitstream font: When I start my favourite text editor sedt, the top row is coloured and contains some status information. Line two is in a different colour. Those areas of line 1 drawn with the bitblit functions are ok, but those areas drawn with the fillrect function are not completely coloured, the last (maybe the 2 last, don´t know) pixel rows of the area that should be coloured are still black.
It seems that cfbfillrect and cfbcopyarea were written in a big-endian machine (if I'm not mistaken, by Geert on m68k?) as unaligned access in little endian produces this bug. Try this patch and let me know if this solves your problem. Tony
diff --git a/drivers/video/cfbcopyarea.c b/drivers/video/cfbcopyarea.c
index cdc7157..dc7e210 100644
--- a/drivers/video/cfbcopyarea.c
+++ b/drivers/video/cfbcopyarea.c@@ -64,8 +64,8 @@ bitcpy(unsigned long __iomem *dst, int d int const shift = dst_idx-src_idx; int left, right; - first = ~0UL >> dst_idx; - last = ~(~0UL >> ((dst_idx+n) % bits)); + first = SHIFT_HIGH(~0UL, dst_idx); + last = ~(SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); if (!shift) { // Same alignment for source and dest
@@ -216,8 +216,8 @@ bitcpy_rev(unsigned long __iomem *dst, i shift = dst_idx-src_idx; - first = ~0UL << (bits - 1 - dst_idx); - last = ~(~0UL << (bits - 1 - ((dst_idx-n) % bits))); + first = SHIFT_LOW(~0UL, bits - 1 - dst_idx); + last = ~(SHIFT_LOW(~0UL, bits - 1 - ((dst_idx-n) % bits))); if (!shift) { // Same alignment for source and dest
diff --git a/drivers/video/cfbfillrect.c b/drivers/video/cfbfillrect.c
index 167d931..495cdaf 100644
--- a/drivers/video/cfbfillrect.c
+++ b/drivers/video/cfbfillrect.c@@ -110,8 +110,8 @@ bitfill_aligned(unsigned long __iomem *d if (!n) return; - first = ~0UL >> dst_idx; - last = ~(~0UL >> ((dst_idx+n) % bits)); + first = SHIFT_HIGH(~0UL, dst_idx); + last = ~(SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); if (dst_idx+n <= bits) { // Single word
@@ -167,8 +167,8 @@ bitfill_unaligned(unsigned long __iomem if (!n) return; - first = ~0UL >> dst_idx; - last = ~(~0UL >> ((dst_idx+n) % bits)); + first = SHIFT_HIGH(~0UL, dst_idx); + last = ~(SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); if (dst_idx+n <= bits) { // Single word
@@ -221,8 +221,8 @@ bitfill_aligned_rev(unsigned long __iome if (!n) return; - first = ~0UL >> dst_idx; - last = ~(~0UL >> ((dst_idx+n) % bits)); + first = SHIFT_HIGH(~0UL, dst_idx); + last = ~(SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); if (dst_idx+n <= bits) { // Single word
@@ -290,8 +290,8 @@ bitfill_unaligned_rev(unsigned long __io if (!n) return; - first = ~0UL >> dst_idx; - last = ~(~0UL >> ((dst_idx+n) % bits)); + first = SHIFT_HIGH(~0UL, dst_idx); + last = ~(SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); if (dst_idx+n <= bits) { // Single word
diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c
index 7a01742..6a78340 100644
--- a/drivers/video/cfbimgblt.c
+++ b/drivers/video/cfbimgblt.c@@ -76,18 +76,6 @@ static u32 cfb_tab32[] = { #define FB_WRITEL fb_writel #define FB_READL fb_readl -#if defined (__BIG_ENDIAN) -#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, struct fb_info *p, u8 __iomem *dst1, u32 start_index,
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 04a58f3..e44950e 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h@@ -817,6 +817,18 @@ struct fb_info { #endif +#if defined (__BIG_ENDIAN) +#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 + /* * `Generic' versions of the frame buffer device operations */ -------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit: http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click