aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/cfbimgblt.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/cfbimgblt.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/cfbimgblt.c')
-rw-r--r--drivers/video/cfbimgblt.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c
index 261004473c8e..f598907b42ad 100644
--- a/drivers/video/cfbimgblt.c
+++ b/drivers/video/cfbimgblt.c
@@ -33,6 +33,7 @@
33#include <linux/string.h> 33#include <linux/string.h>
34#include <linux/fb.h> 34#include <linux/fb.h>
35#include <asm/types.h> 35#include <asm/types.h>
36#include "fb_draw.h"
36 37
37#define DEBUG 38#define DEBUG
38 39
@@ -87,6 +88,7 @@ static inline void color_imageblit(const struct fb_image *image,
87 u32 null_bits = 32 - bpp; 88 u32 null_bits = 32 - bpp;
88 u32 *palette = (u32 *) p->pseudo_palette; 89 u32 *palette = (u32 *) p->pseudo_palette;
89 const u8 *src = image->data; 90 const u8 *src = image->data;
91 u32 bswapmask = fb_compute_bswapmask(p);
90 92
91 dst2 = (u32 __iomem *) dst1; 93 dst2 = (u32 __iomem *) dst1;
92 for (i = image->height; i--; ) { 94 for (i = image->height; i--; ) {
@@ -96,7 +98,7 @@ static inline void color_imageblit(const struct fb_image *image,
96 val = 0; 98 val = 0;
97 99
98 if (start_index) { 100 if (start_index) {
99 u32 start_mask = ~(FB_SHIFT_HIGH(~(u32)0, start_index)); 101 u32 start_mask = ~fb_shifted_pixels_mask_u32(start_index, bswapmask);
100 val = FB_READL(dst) & start_mask; 102 val = FB_READL(dst) & start_mask;
101 shift = start_index; 103 shift = start_index;
102 } 104 }
@@ -107,7 +109,7 @@ static inline void color_imageblit(const struct fb_image *image,
107 else 109 else
108 color = *src; 110 color = *src;
109 color <<= FB_LEFT_POS(bpp); 111 color <<= FB_LEFT_POS(bpp);
110 val |= FB_SHIFT_HIGH(color, shift); 112 val |= FB_SHIFT_HIGH(color, shift ^ bswapmask);
111 if (shift >= null_bits) { 113 if (shift >= null_bits) {
112 FB_WRITEL(val, dst++); 114 FB_WRITEL(val, dst++);
113 115
@@ -119,7 +121,7 @@ static inline void color_imageblit(const struct fb_image *image,
119 src++; 121 src++;
120 } 122 }
121 if (shift) { 123 if (shift) {
122 u32 end_mask = FB_SHIFT_HIGH(~(u32)0, shift); 124 u32 end_mask = fb_shifted_pixels_mask_u32(shift, bswapmask);
123 125
124 FB_WRITEL((FB_READL(dst) & end_mask) | val, dst); 126 FB_WRITEL((FB_READL(dst) & end_mask) | val, dst);
125 } 127 }
@@ -147,7 +149,8 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info *
147 u32 spitch = (image->width+7)/8; 149 u32 spitch = (image->width+7)/8;
148 const u8 *src = image->data, *s; 150 const u8 *src = image->data, *s;
149 u32 i, j, l; 151 u32 i, j, l;
150 152 u32 bswapmask = fb_compute_bswapmask(p);
153
151 dst2 = (u32 __iomem *) dst1; 154 dst2 = (u32 __iomem *) dst1;
152 fgcolor <<= FB_LEFT_POS(bpp); 155 fgcolor <<= FB_LEFT_POS(bpp);
153 bgcolor <<= FB_LEFT_POS(bpp); 156 bgcolor <<= FB_LEFT_POS(bpp);
@@ -161,7 +164,7 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info *
161 164
162 /* write leading bits */ 165 /* write leading bits */
163 if (start_index) { 166 if (start_index) {
164 u32 start_mask = ~(FB_SHIFT_HIGH(~(u32)0,start_index)); 167 u32 start_mask = ~fb_shifted_pixels_mask_u32(start_index, bswapmask);
165 val = FB_READL(dst) & start_mask; 168 val = FB_READL(dst) & start_mask;
166 shift = start_index; 169 shift = start_index;
167 } 170 }
@@ -169,7 +172,7 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info *
169 while (j--) { 172 while (j--) {
170 l--; 173 l--;
171 color = (*s & (1 << l)) ? fgcolor : bgcolor; 174 color = (*s & (1 << l)) ? fgcolor : bgcolor;
172 val |= FB_SHIFT_HIGH(color, shift); 175 val |= FB_SHIFT_HIGH(color, shift ^ bswapmask);
173 176
174 /* Did the bitshift spill bits to the next long? */ 177 /* Did the bitshift spill bits to the next long? */
175 if (shift >= null_bits) { 178 if (shift >= null_bits) {
@@ -184,7 +187,7 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info *
184 187
185 /* write trailing bits */ 188 /* write trailing bits */
186 if (shift) { 189 if (shift) {
187 u32 end_mask = FB_SHIFT_HIGH(~(u32)0, shift); 190 u32 end_mask = fb_shifted_pixels_mask_u32(shift, bswapmask);
188 191
189 FB_WRITEL((FB_READL(dst) & end_mask) | val, dst); 192 FB_WRITEL((FB_READL(dst) & end_mask) | val, dst);
190 } 193 }