15 #include <linux/module.h>
16 #include <linux/kernel.h>
17 #include <linux/string.h>
19 #include <asm/types.h>
28 bitcpy(
struct fb_info *
p,
unsigned long *
dst,
int dst_idx,
29 const unsigned long *
src,
int src_idx,
int bits,
unsigned n)
32 int const shift = dst_idx-src_idx;
40 if (dst_idx+n <= bits) {
44 *dst = comp(*src, *dst, first);
49 *dst = comp(*src, *dst, first);
73 *dst = comp(*src, *dst, last);
80 right = shift & (bits - 1);
81 left = -shift & (bits - 1);
83 if (dst_idx+n <= bits) {
89 *dst = comp(*src >> right, *dst, first);
90 }
else if (src_idx+n <= bits) {
92 *dst = comp(*src << left, *dst, first);
97 *dst = comp(d0 << left | d1 >> right, *dst,
112 *dst = comp(d0 >> right, *dst, first);
118 *dst = comp(d0 << left | *dst >> right, *dst, first);
129 *dst++ = d0 << left | d1 >>
right;
132 *dst++ = d0 << left | d1 >>
right;
135 *dst++ = d0 << left | d1 >>
right;
138 *dst++ = d0 << left | d1 >>
right;
144 *dst++ = d0 << left | d1 >>
right;
152 *dst = comp(d0 << left, *dst, last);
156 *dst = comp(d0 << left | d1 >> right,
169 bitcpy_rev(
struct fb_info *p,
unsigned long *dst,
int dst_idx,
170 const unsigned long *src,
int src_idx,
int bits,
unsigned n)
172 unsigned long first, last;
178 dst_idx += (n-1) % bits;
179 dst += dst_idx >> (
ffs(bits) - 1);
181 src_idx += (n-1) % bits;
182 src += src_idx >> (
ffs(bits) - 1);
186 shift = dst_idx-src_idx;
193 if ((
unsigned long)dst_idx+1 >=
n) {
197 *dst = comp(*src, *dst, first);
203 *dst = comp(*src, *dst, first);
226 *dst = comp(*src, *dst, last);
231 int const left = -shift & (bits-1);
232 int const right = shift & (bits-1);
234 if ((
unsigned long)dst_idx+1 >=
n) {
240 *dst = comp(*src << left, *dst, first);
241 }
else if (1+(
unsigned long)src_idx >= n) {
243 *dst = comp(*src >> right, *dst, first);
246 *dst = comp(*src >> right | *(src-1) << left,
257 unsigned long d0,
d1;
264 *dst = comp(d0 << left, *dst, first);
268 *dst = comp(d0 >> right | d1 << left, *dst,
280 *dst-- = d0 >> right | d1 <<
left;
283 *dst-- = d0 >> right | d1 <<
left;
286 *dst-- = d0 >> right | d1 <<
left;
289 *dst-- = d0 >> right | d1 <<
left;
295 *dst-- = d0 >> right | d1 <<
left;
303 *dst = comp(d0 >> right, *dst, last);
307 *dst = comp(d0 >> right | d1 << left,
317 u32 dx = area->
dx, dy = area->
dy,
sx = area->
sx, sy = area->
sy;
319 unsigned long const bits_per_line = p->
fix.line_length*8
u;
320 unsigned long *dst =
NULL, *src =
NULL;
322 int dst_idx = 0, src_idx = 0, rev_copy = 0;
329 if ((dy == sy && dx >
sx) || (dy > sy)) {
337 dst = src = (
unsigned long *)((
unsigned long)p->
screen_base &
341 dst_idx += dy*bits_per_line + dx*p->
var.bits_per_pixel;
342 src_idx += sy*bits_per_line +
sx*p->
var.bits_per_pixel;
344 if (p->
fbops->fb_sync)
345 p->
fbops->fb_sync(p);
349 dst_idx -= bits_per_line;
350 src_idx -= bits_per_line;
351 dst += dst_idx >> (
ffs(bits) - 1);
352 dst_idx &= (bytes - 1);
353 src += src_idx >> (
ffs(bits) - 1);
354 src_idx &= (bytes - 1);
355 bitcpy_rev(p, dst, dst_idx, src, src_idx, bits,
360 dst += dst_idx >> (
ffs(bits) - 1);
361 dst_idx &= (bytes - 1);
362 src += src_idx >> (
ffs(bits) - 1);
363 src_idx &= (bytes - 1);
364 bitcpy(p, dst, dst_idx, src, src_idx, bits,
366 dst_idx += bits_per_line;
367 src_idx += bits_per_line;