X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fvideo%2Fcfbfillrect.c;h=71623b4f8ca26581dbf4f8258734685fbd55e079;hb=c685ce059d42ebda7822786498dfd366695457f6;hp=167d9314e6eb49c6ae25683e940563ef92f6ca1c;hpb=89de09a9ba9ce293228b1f1aa3c68b5af33a70ce;p=powerpc.git diff --git a/drivers/video/cfbfillrect.c b/drivers/video/cfbfillrect.c index 167d9314e6..71623b4f8c 100644 --- a/drivers/video/cfbfillrect.c +++ b/drivers/video/cfbfillrect.c @@ -17,11 +17,11 @@ * the native cpu endians. I also need to deal with MSB position in the word. * */ -#include #include #include #include #include +#include "fb_draw.h" #if BITS_PER_LONG == 32 # define FB_WRITEL fb_writel @@ -29,73 +29,6 @@ #else # define FB_WRITEL fb_writeq # define FB_READL fb_readq -#endif - - /* - * Compose two values, using a bitmask as decision value - * This is equivalent to (a & mask) | (b & ~mask) - */ - -static inline unsigned long -comp(unsigned long a, unsigned long b, unsigned long mask) -{ - return ((a ^ b) & mask) ^ b; -} - - /* - * Create a pattern with the given pixel's color - */ - -#if BITS_PER_LONG == 64 -static inline unsigned long -pixel_to_pat( u32 bpp, u32 pixel) -{ - switch (bpp) { - case 1: - return 0xfffffffffffffffful*pixel; - case 2: - return 0x5555555555555555ul*pixel; - case 4: - return 0x1111111111111111ul*pixel; - case 8: - return 0x0101010101010101ul*pixel; - case 12: - return 0x0001001001001001ul*pixel; - case 16: - return 0x0001000100010001ul*pixel; - case 24: - return 0x0000000001000001ul*pixel; - case 32: - return 0x0000000100000001ul*pixel; - default: - panic("pixel_to_pat(): unsupported pixelformat\n"); - } -} -#else -static inline unsigned long -pixel_to_pat( u32 bpp, u32 pixel) -{ - switch (bpp) { - case 1: - return 0xfffffffful*pixel; - case 2: - return 0x55555555ul*pixel; - case 4: - return 0x11111111ul*pixel; - case 8: - return 0x01010101ul*pixel; - case 12: - return 0x00001001ul*pixel; - case 16: - return 0x00010001ul*pixel; - case 24: - return 0x00000001ul*pixel; - case 32: - return 0x00000001ul*pixel; - default: - panic("pixel_to_pat(): unsupported pixelformat\n"); - } -} #endif /* @@ -110,8 +43,8 @@ bitfill_aligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat, unsi if (!n) return; - first = ~0UL >> dst_idx; - last = ~(~0UL >> ((dst_idx+n) % bits)); + first = FB_SHIFT_HIGH(~0UL, dst_idx); + last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); if (dst_idx+n <= bits) { // Single word @@ -167,8 +100,8 @@ bitfill_unaligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat, if (!n) return; - first = ~0UL >> dst_idx; - last = ~(~0UL >> ((dst_idx+n) % bits)); + first = FB_SHIFT_HIGH(~0UL, dst_idx); + last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); if (dst_idx+n <= bits) { // Single word @@ -221,8 +154,8 @@ bitfill_aligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat, if (!n) return; - first = ~0UL >> dst_idx; - last = ~(~0UL >> ((dst_idx+n) % bits)); + first = FB_SHIFT_HIGH(~0UL, dst_idx); + last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); if (dst_idx+n <= bits) { // Single word @@ -290,8 +223,8 @@ bitfill_unaligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat if (!n) return; - first = ~0UL >> dst_idx; - last = ~(~0UL >> ((dst_idx+n) % bits)); + first = FB_SHIFT_HIGH(~0UL, dst_idx); + last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); if (dst_idx+n <= bits) { // Single word