aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/sysfillrect.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/sysfillrect.c')
-rw-r--r--drivers/video/sysfillrect.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/video/sysfillrect.c b/drivers/video/sysfillrect.c
index f94d6b6e29ee..33ee3d34f9d2 100644
--- a/drivers/video/sysfillrect.c
+++ b/drivers/video/sysfillrect.c
@@ -124,7 +124,7 @@ bitfill_unaligned(struct fb_info *p, unsigned long *dst, int dst_idx,
124 124
125 /* Trailing bits */ 125 /* Trailing bits */
126 if (last) 126 if (last)
127 *dst = comp(pat, *dst, first); 127 *dst = comp(pat, *dst, last);
128 } 128 }
129} 129}
130 130
@@ -242,7 +242,7 @@ bitfill_unaligned_rev(struct fb_info *p, unsigned long *dst, int dst_idx,
242 242
243void sys_fillrect(struct fb_info *p, const struct fb_fillrect *rect) 243void sys_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
244{ 244{
245 unsigned long pat, fg; 245 unsigned long pat, pat2, fg;
246 unsigned long width = rect->width, height = rect->height; 246 unsigned long width = rect->width, height = rect->height;
247 int bits = BITS_PER_LONG, bytes = bits >> 3; 247 int bits = BITS_PER_LONG, bytes = bits >> 3;
248 u32 bpp = p->var.bits_per_pixel; 248 u32 bpp = p->var.bits_per_pixel;
@@ -292,17 +292,16 @@ void sys_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
292 dst_idx += p->fix.line_length*8; 292 dst_idx += p->fix.line_length*8;
293 } 293 }
294 } else { 294 } else {
295 int right; 295 int right, r;
296 int r;
297 int rot = (left-dst_idx) % bpp;
298 void (*fill_op)(struct fb_info *p, unsigned long *dst, 296 void (*fill_op)(struct fb_info *p, unsigned long *dst,
299 int dst_idx, unsigned long pat, int left, 297 int dst_idx, unsigned long pat, int left,
300 int right, unsigned n, int bits) = NULL; 298 int right, unsigned n, int bits) = NULL;
301 299#ifdef __LITTLE_ENDIAN
302 /* rotate pattern to correct start position */ 300 right = left;
303 pat = pat << rot | pat >> (bpp-rot); 301 left = bpp - right;
304 302#else
305 right = bpp-left; 303 right = bpp - left;
304#endif
306 switch (rect->rop) { 305 switch (rect->rop) {
307 case ROP_XOR: 306 case ROP_XOR:
308 fill_op = bitfill_unaligned_rev; 307 fill_op = bitfill_unaligned_rev;
@@ -311,18 +310,19 @@ void sys_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
311 fill_op = bitfill_unaligned; 310 fill_op = bitfill_unaligned;
312 break; 311 break;
313 default: 312 default:
314 printk(KERN_ERR "cfb_fillrect(): unknown rop, " 313 printk(KERN_ERR "sys_fillrect(): unknown rop, "
315 "defaulting to ROP_COPY\n"); 314 "defaulting to ROP_COPY\n");
316 fill_op = bitfill_unaligned; 315 fill_op = bitfill_unaligned;
317 break; 316 break;
318 } 317 }
319 while (height--) { 318 while (height--) {
320 dst += dst_idx >> (ffs(bits) - 1); 319 dst += dst_idx / bits;
321 dst_idx &= (bits - 1); 320 dst_idx &= (bits - 1);
322 fill_op(p, dst, dst_idx, pat, left, right, 321 r = dst_idx % bpp;
322 /* rotate pattern to the correct start position */
323 pat2 = le_long_to_cpu(rolx(cpu_to_le_long(pat), r, bpp));
324 fill_op(p, dst, dst_idx, pat2, left, right,
323 width*bpp, bits); 325 width*bpp, bits);
324 r = (p->fix.line_length*8) % bpp;
325 pat = pat << (bpp-r) | pat >> r;
326 dst_idx += p->fix.line_length*8; 326 dst_idx += p->fix.line_length*8;
327 } 327 }
328 } 328 }