X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fvideo%2Fcfbimgblt.c;h=f598907b42adfa71adaa5f237e07e7ab8cd1757d;hb=9f1ef3f8f5f8ade2561d969181b152c225b82a3e;hp=910e2338a27e3a38c7c182bcfcfe6f7e9d9c2864;hpb=be0d9b6c7aeaad1683059c00131cabd4c894c17c;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c index 910e233..f598907 100644 --- a/drivers/video/cfbimgblt.c +++ b/drivers/video/cfbimgblt.c @@ -29,11 +29,11 @@ * Also need to add code to deal with cards endians that are different than * the native cpu endians. I also need to deal with MSB position in the word. */ -#include #include #include #include #include +#include "fb_draw.h" #define DEBUG @@ -43,7 +43,7 @@ #define DPRINTK(fmt, args...) #endif -static u32 cfb_tab8[] = { +static const u32 cfb_tab8[] = { #if defined(__BIG_ENDIAN) 0x00000000,0x000000ff,0x0000ff00,0x0000ffff, 0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff, @@ -59,7 +59,7 @@ static u32 cfb_tab8[] = { #endif }; -static u32 cfb_tab16[] = { +static const u32 cfb_tab16[] = { #if defined(__BIG_ENDIAN) 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff #elif defined(__LITTLE_ENDIAN) @@ -69,7 +69,7 @@ static u32 cfb_tab16[] = { #endif }; -static u32 cfb_tab32[] = { +static const u32 cfb_tab32[] = { 0x00000000, 0xffffffff }; @@ -88,6 +88,7 @@ static inline void color_imageblit(const struct fb_image *image, u32 null_bits = 32 - bpp; u32 *palette = (u32 *) p->pseudo_palette; const u8 *src = image->data; + u32 bswapmask = fb_compute_bswapmask(p); dst2 = (u32 __iomem *) dst1; for (i = image->height; i--; ) { @@ -97,7 +98,7 @@ static inline void color_imageblit(const struct fb_image *image, val = 0; if (start_index) { - u32 start_mask = ~(FB_SHIFT_HIGH(~(u32)0, start_index)); + u32 start_mask = ~fb_shifted_pixels_mask_u32(start_index, bswapmask); val = FB_READL(dst) & start_mask; shift = start_index; } @@ -108,7 +109,7 @@ static inline void color_imageblit(const struct fb_image *image, else color = *src; color <<= FB_LEFT_POS(bpp); - val |= FB_SHIFT_HIGH(color, shift); + val |= FB_SHIFT_HIGH(color, shift ^ bswapmask); if (shift >= null_bits) { FB_WRITEL(val, dst++); @@ -120,7 +121,7 @@ static inline void color_imageblit(const struct fb_image *image, src++; } if (shift) { - u32 end_mask = FB_SHIFT_HIGH(~(u32)0, shift); + u32 end_mask = fb_shifted_pixels_mask_u32(shift, bswapmask); FB_WRITEL((FB_READL(dst) & end_mask) | val, dst); } @@ -148,7 +149,8 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info * u32 spitch = (image->width+7)/8; const u8 *src = image->data, *s; u32 i, j, l; - + u32 bswapmask = fb_compute_bswapmask(p); + dst2 = (u32 __iomem *) dst1; fgcolor <<= FB_LEFT_POS(bpp); bgcolor <<= FB_LEFT_POS(bpp); @@ -162,15 +164,15 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info * /* write leading bits */ if (start_index) { - u32 start_mask = ~(FB_SHIFT_HIGH(~(u32)0,start_index)); + u32 start_mask = ~fb_shifted_pixels_mask_u32(start_index, bswapmask); val = FB_READL(dst) & start_mask; shift = start_index; } while (j--) { l--; - color = (*s & 1 << (FB_BIT_NR(l))) ? fgcolor : bgcolor; - val |= FB_SHIFT_HIGH(color, shift); + color = (*s & (1 << l)) ? fgcolor : bgcolor; + val |= FB_SHIFT_HIGH(color, shift ^ bswapmask); /* Did the bitshift spill bits to the next long? */ if (shift >= null_bits) { @@ -185,7 +187,7 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info * /* write trailing bits */ if (shift) { - u32 end_mask = FB_SHIFT_HIGH(~(u32)0, shift); + u32 end_mask = fb_shifted_pixels_mask_u32(shift, bswapmask); FB_WRITEL((FB_READL(dst) & end_mask) | val, dst); } @@ -219,7 +221,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info * u32 bit_mask, end_mask, eorx, shift; const char *s = image->data, *src; u32 __iomem *dst; - u32 *tab = NULL; + const u32 *tab = NULL; int i, j, k; switch (bpp) { @@ -230,6 +232,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info * tab = cfb_tab16; break; case 32: + default: tab = cfb_tab32; break; }