25 #include <linux/module.h>
26 #include <linux/kernel.h>
27 #include <linux/string.h>
29 #include <asm/types.h>
33 #if BITS_PER_LONG == 32
34 # define FB_WRITEL fb_writel
35 # define FB_READL fb_readl
37 # define FB_WRITEL fb_writeq
38 # define FB_READL fb_readq
48 unsigned n,
u32 bswapmask)
51 int const shift = dst_idx-src_idx;
60 if (dst_idx+n <= bits) {
101 right = shift & (bits - 1);
102 left = -shift & (bits - 1);
105 if (dst_idx+n <= bits) {
110 d0 = fb_rev_pixels_in_long(d0, bswapmask);
114 }
else if (src_idx+n <= bits) {
120 d1 = fb_rev_pixels_in_long(d1, bswapmask);
121 d0 = d0<<left | d1>>
right;
123 d0 = fb_rev_pixels_in_long(d0, bswapmask);
133 d0 = fb_rev_pixels_in_long(d0, bswapmask);
144 d1 = fb_rev_pixels_in_long(d1, bswapmask);
146 d0 = d0<<left | d1>>
right;
150 d0 = fb_rev_pixels_in_long(d0, bswapmask);
157 while ((n >= 4) && !bswapmask) {
159 FB_WRITEL(d0 << left | d1 >> right, dst++);
162 FB_WRITEL(d0 << left | d1 >> right, dst++);
165 FB_WRITEL(d0 << left | d1 >> right, dst++);
168 FB_WRITEL(d0 << left | d1 >> right, dst++);
174 d1 = fb_rev_pixels_in_long(d1, bswapmask);
175 d0 = d0 << left | d1 >>
right;
176 d0 = fb_rev_pixels_in_long(d0, bswapmask);
189 d1 = fb_rev_pixels_in_long(d1,
191 d0 = d0<<left | d1>>
right;
193 d0 = fb_rev_pixels_in_long(d0, bswapmask);
207 unsigned n,
u32 bswapmask)
215 dst_idx += (n-1) % bits;
216 dst += dst_idx >> (
ffs(bits) - 1);
218 src_idx += (n-1) % bits;
219 src += src_idx >> (
ffs(bits) - 1);
223 shift = dst_idx-src_idx;
232 if ((
unsigned long)dst_idx+1 >= n) {
270 unsigned long d0,
d1;
273 int const left = -shift & (bits-1);
274 int const right = shift & (bits-1);
277 if ((
unsigned long)dst_idx+1 >=
n) {
285 }
else if (1+(
unsigned long)src_idx >= n) {
291 d1 = fb_rev_pixels_in_long(d1, bswapmask);
292 d0 = d0>>right | d1<<
left;
294 d0 = fb_rev_pixels_in_long(d0, bswapmask);
305 d0 = fb_rev_pixels_in_long(d0, bswapmask);
314 d1 = fb_rev_pixels_in_long(d1, bswapmask);
315 d0 = d0>>right | d1<<
left;
317 d0 = fb_rev_pixels_in_long(d0, bswapmask);
326 while ((n >= 4) && !bswapmask) {
328 FB_WRITEL(d0 >> right | d1 << left, dst--);
331 FB_WRITEL(d0 >> right | d1 << left, dst--);
334 FB_WRITEL(d0 >> right | d1 << left, dst--);
337 FB_WRITEL(d0 >> right | d1 << left, dst--);
343 d1 = fb_rev_pixels_in_long(d1, bswapmask);
344 d0 = d0 >> right | d1 <<
left;
345 d0 = fb_rev_pixels_in_long(d0, bswapmask);
358 d1 = fb_rev_pixels_in_long(d1,
360 d0 = d0>>right | d1<<
left;
362 d0 = fb_rev_pixels_in_long(d0, bswapmask);
371 u32 dx = area->
dx, dy = area->
dy,
sx = area->
sx, sy = area->
sy;
373 unsigned long const bits_per_line = p->
fix.line_length*8
u;
376 int dst_idx = 0, src_idx = 0, rev_copy = 0;
384 if ((dy == sy && dx >
sx) || (dy > sy)) {
395 dst_idx += dy*bits_per_line + dx*p->
var.bits_per_pixel;
396 src_idx += sy*bits_per_line +
sx*p->
var.bits_per_pixel;
398 if (p->
fbops->fb_sync)
399 p->
fbops->fb_sync(p);
403 dst_idx -= bits_per_line;
404 src_idx -= bits_per_line;
405 dst += dst_idx >> (
ffs(bits) - 1);
406 dst_idx &= (bytes - 1);
407 src += src_idx >> (
ffs(bits) - 1);
408 src_idx &= (bytes - 1);
409 bitcpy_rev(p, dst, dst_idx, src, src_idx, bits,
410 width*p->
var.bits_per_pixel, bswapmask);
414 dst += dst_idx >> (
ffs(bits) - 1);
415 dst_idx &= (bytes - 1);
416 src += src_idx >> (
ffs(bits) - 1);
417 src_idx &= (bytes - 1);
418 bitcpy(p, dst, dst_idx, src, src_idx, bits,
419 width*p->
var.bits_per_pixel, bswapmask);
420 dst_idx += bits_per_line;
421 src_idx += bits_per_line;