aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/cfbimgblt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/cfbimgblt.c')
-rw-r--r--drivers/video/cfbimgblt.c35
1 files changed, 12 insertions, 23 deletions
diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c
index a7770c4f17d0..910e2338a27e 100644
--- a/drivers/video/cfbimgblt.c
+++ b/drivers/video/cfbimgblt.c
@@ -76,18 +76,6 @@ static u32 cfb_tab32[] = {
76#define FB_WRITEL fb_writel 76#define FB_WRITEL fb_writel
77#define FB_READL fb_readl 77#define FB_READL fb_readl
78 78
79#if defined (__BIG_ENDIAN)
80#define LEFT_POS(bpp) (32 - bpp)
81#define SHIFT_HIGH(val, bits) ((val) >> (bits))
82#define SHIFT_LOW(val, bits) ((val) << (bits))
83#define BIT_NR(b) (7 - (b))
84#else
85#define LEFT_POS(bpp) (0)
86#define SHIFT_HIGH(val, bits) ((val) << (bits))
87#define SHIFT_LOW(val, bits) ((val) >> (bits))
88#define BIT_NR(b) (b)
89#endif
90
91static inline void color_imageblit(const struct fb_image *image, 79static inline void color_imageblit(const struct fb_image *image,
92 struct fb_info *p, u8 __iomem *dst1, 80 struct fb_info *p, u8 __iomem *dst1,
93 u32 start_index, 81 u32 start_index,
@@ -109,7 +97,7 @@ static inline void color_imageblit(const struct fb_image *image,
109 val = 0; 97 val = 0;
110 98
111 if (start_index) { 99 if (start_index) {
112 u32 start_mask = ~(SHIFT_HIGH(~(u32)0, start_index)); 100 u32 start_mask = ~(FB_SHIFT_HIGH(~(u32)0, start_index));
113 val = FB_READL(dst) & start_mask; 101 val = FB_READL(dst) & start_mask;
114 shift = start_index; 102 shift = start_index;
115 } 103 }
@@ -119,20 +107,20 @@ static inline void color_imageblit(const struct fb_image *image,
119 color = palette[*src]; 107 color = palette[*src];
120 else 108 else
121 color = *src; 109 color = *src;
122 color <<= LEFT_POS(bpp); 110 color <<= FB_LEFT_POS(bpp);
123 val |= SHIFT_HIGH(color, shift); 111 val |= FB_SHIFT_HIGH(color, shift);
124 if (shift >= null_bits) { 112 if (shift >= null_bits) {
125 FB_WRITEL(val, dst++); 113 FB_WRITEL(val, dst++);
126 114
127 val = (shift == null_bits) ? 0 : 115 val = (shift == null_bits) ? 0 :
128 SHIFT_LOW(color, 32 - shift); 116 FB_SHIFT_LOW(color, 32 - shift);
129 } 117 }
130 shift += bpp; 118 shift += bpp;
131 shift &= (32 - 1); 119 shift &= (32 - 1);
132 src++; 120 src++;
133 } 121 }
134 if (shift) { 122 if (shift) {
135 u32 end_mask = SHIFT_HIGH(~(u32)0, shift); 123 u32 end_mask = FB_SHIFT_HIGH(~(u32)0, shift);
136 124
137 FB_WRITEL((FB_READL(dst) & end_mask) | val, dst); 125 FB_WRITEL((FB_READL(dst) & end_mask) | val, dst);
138 } 126 }
@@ -162,6 +150,8 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info *
162 u32 i, j, l; 150 u32 i, j, l;
163 151
164 dst2 = (u32 __iomem *) dst1; 152 dst2 = (u32 __iomem *) dst1;
153 fgcolor <<= FB_LEFT_POS(bpp);
154 bgcolor <<= FB_LEFT_POS(bpp);
165 155
166 for (i = image->height; i--; ) { 156 for (i = image->height; i--; ) {
167 shift = val = 0; 157 shift = val = 0;
@@ -172,22 +162,21 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info *
172 162
173 /* write leading bits */ 163 /* write leading bits */
174 if (start_index) { 164 if (start_index) {
175 u32 start_mask = ~(SHIFT_HIGH(~(u32)0, start_index)); 165 u32 start_mask = ~(FB_SHIFT_HIGH(~(u32)0,start_index));
176 val = FB_READL(dst) & start_mask; 166 val = FB_READL(dst) & start_mask;
177 shift = start_index; 167 shift = start_index;
178 } 168 }
179 169
180 while (j--) { 170 while (j--) {
181 l--; 171 l--;
182 color = (*s & 1 << (BIT_NR(l))) ? fgcolor : bgcolor; 172 color = (*s & 1 << (FB_BIT_NR(l))) ? fgcolor : bgcolor;
183 color <<= LEFT_POS(bpp); 173 val |= FB_SHIFT_HIGH(color, shift);
184 val |= SHIFT_HIGH(color, shift);
185 174
186 /* Did the bitshift spill bits to the next long? */ 175 /* Did the bitshift spill bits to the next long? */
187 if (shift >= null_bits) { 176 if (shift >= null_bits) {
188 FB_WRITEL(val, dst++); 177 FB_WRITEL(val, dst++);
189 val = (shift == null_bits) ? 0 : 178 val = (shift == null_bits) ? 0 :
190 SHIFT_LOW(color,32 - shift); 179 FB_SHIFT_LOW(color,32 - shift);
191 } 180 }
192 shift += bpp; 181 shift += bpp;
193 shift &= (32 - 1); 182 shift &= (32 - 1);
@@ -196,7 +185,7 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info *
196 185
197 /* write trailing bits */ 186 /* write trailing bits */
198 if (shift) { 187 if (shift) {
199 u32 end_mask = SHIFT_HIGH(~(u32)0, shift); 188 u32 end_mask = FB_SHIFT_HIGH(~(u32)0, shift);
200 189
201 FB_WRITEL((FB_READL(dst) & end_mask) | val, dst); 190 FB_WRITEL((FB_READL(dst) & end_mask) | val, dst);
202 } 191 }