aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/cfbfillrect.c
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2007-10-16 04:29:21 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:19 -0400
commit779121e9f17525769c04a00475fd85600c8c04eb (patch)
tree757aad067bed869bfdd2dc2eb2f652a7f4e5e071 /drivers/video/cfbfillrect.c
parent3c03ec209af1dd8223888630482f1b2353dc6284 (diff)
fbdev: Support for byte-reversed framebuffer formats
Allow generic frame-buffer code to correctly write texts and blit images for 1, 2 and 4 bit per pixel frame-buffer organizations when pixels in bytes are organized to in opposite order than bytes in long type. Overhead should be reasonable. If option is not selected, than compiler should eliminate completely all overhead. The feature is disabled at compile time if CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set. [adaplas] Convert helper functions to macros if feature is not enabled. Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz> Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/cfbfillrect.c')
-rw-r--r--drivers/video/cfbfillrect.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/video/cfbfillrect.c b/drivers/video/cfbfillrect.c
index 71623b4f8ca2..23d70a12e4da 100644
--- a/drivers/video/cfbfillrect.c
+++ b/drivers/video/cfbfillrect.c
@@ -36,15 +36,16 @@
36 */ 36 */
37 37
38static void 38static void
39bitfill_aligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat, unsigned n, int bits) 39bitfill_aligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
40 unsigned n, int bits, u32 bswapmask)
40{ 41{
41 unsigned long first, last; 42 unsigned long first, last;
42 43
43 if (!n) 44 if (!n)
44 return; 45 return;
45 46
46 first = FB_SHIFT_HIGH(~0UL, dst_idx); 47 first = fb_shifted_pixels_mask_long(dst_idx, bswapmask);
47 last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); 48 last = ~fb_shifted_pixels_mask_long((dst_idx+n) % bits, bswapmask);
48 49
49 if (dst_idx+n <= bits) { 50 if (dst_idx+n <= bits) {
50 // Single word 51 // Single word
@@ -146,7 +147,8 @@ bitfill_unaligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
146 * Aligned pattern invert using 32/64-bit memory accesses 147 * Aligned pattern invert using 32/64-bit memory accesses
147 */ 148 */
148static void 149static void
149bitfill_aligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat, unsigned n, int bits) 150bitfill_aligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
151 unsigned n, int bits, u32 bswapmask)
150{ 152{
151 unsigned long val = pat, dat; 153 unsigned long val = pat, dat;
152 unsigned long first, last; 154 unsigned long first, last;
@@ -154,8 +156,8 @@ bitfill_aligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
154 if (!n) 156 if (!n)
155 return; 157 return;
156 158
157 first = FB_SHIFT_HIGH(~0UL, dst_idx); 159 first = fb_shifted_pixels_mask_long(dst_idx, bswapmask);
158 last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); 160 last = ~fb_shifted_pixels_mask_long((dst_idx+n) % bits, bswapmask);
159 161
160 if (dst_idx+n <= bits) { 162 if (dst_idx+n <= bits) {
161 // Single word 163 // Single word
@@ -303,8 +305,10 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
303 if (p->fbops->fb_sync) 305 if (p->fbops->fb_sync)
304 p->fbops->fb_sync(p); 306 p->fbops->fb_sync(p);
305 if (!left) { 307 if (!left) {
308 u32 bswapmask = fb_compute_bswapmask(p);
306 void (*fill_op32)(unsigned long __iomem *dst, int dst_idx, 309 void (*fill_op32)(unsigned long __iomem *dst, int dst_idx,
307 unsigned long pat, unsigned n, int bits) = NULL; 310 unsigned long pat, unsigned n, int bits,
311 u32 bswapmask) = NULL;
308 312
309 switch (rect->rop) { 313 switch (rect->rop) {
310 case ROP_XOR: 314 case ROP_XOR:
@@ -321,7 +325,7 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
321 while (height--) { 325 while (height--) {
322 dst += dst_idx >> (ffs(bits) - 1); 326 dst += dst_idx >> (ffs(bits) - 1);
323 dst_idx &= (bits - 1); 327 dst_idx &= (bits - 1);
324 fill_op32(dst, dst_idx, pat, width*bpp, bits); 328 fill_op32(dst, dst_idx, pat, width*bpp, bits, bswapmask);
325 dst_idx += p->fix.line_length*8; 329 dst_idx += p->fix.line_length*8;
326 } 330 }
327 } else { 331 } else {