Commit 743b21c5 authored by David S. Miller's avatar David S. Miller

[FRAMEBUFFER]: cfbcopyarea accesses fb without using FB_{READ,WRITE}L.

parent ecac8e31
......@@ -65,14 +65,14 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src,
// Single word
if (last)
first &= last;
FB_WRITEL((*src & first) | (FB_READL(dst) & ~first),
FB_WRITEL((FB_READL(src) & first) | (FB_READL(dst) & ~first),
dst);
} else {
// Multiple destination words
// Leading bits
if (first) {
FB_WRITEL((*src & first) | (FB_READL(dst) &
FB_WRITEL((FB_READL(src) & first) | (FB_READL(dst) &
~first), dst);
dst++;
src++;
......@@ -82,21 +82,21 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src,
// Main chunk
n /= BITS_PER_LONG;
while (n >= 8) {
FB_WRITEL(*src++, dst++);
FB_WRITEL(*src++, dst++);
FB_WRITEL(*src++, dst++);
FB_WRITEL(*src++, dst++);
FB_WRITEL(*src++, dst++);
FB_WRITEL(*src++, dst++);
FB_WRITEL(*src++, dst++);
FB_WRITEL(*src++, dst++);
FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(FB_READL(src++), dst++);
n -= 8;
}
while (n--)
FB_WRITEL(*src++, dst++);
FB_WRITEL(FB_READL(src++), dst++);
// Trailing bits
if (last)
FB_WRITEL((*src & last) | (FB_READL(dst) &
FB_WRITEL((FB_READL(src) & last) | (FB_READL(dst) &
~last), dst);
}
} else {
......@@ -111,22 +111,22 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src,
first &= last;
if (shift > 0) {
// Single source word
FB_WRITEL(((*src >> right) & first) |
FB_WRITEL(((FB_READL(src) >> right) & first) |
(FB_READL(dst) & ~first), dst);
} else if (src_idx+n <= BITS_PER_LONG) {
// Single source word
FB_WRITEL(((*src << left) & first) |
FB_WRITEL(((FB_READL(src) << left) & first) |
(FB_READL(dst) & ~first), dst);
} else {
// 2 source words
d0 = *src++;
d1 = *src;
d0 = FB_READL(src++);
d1 = FB_READL(src);
FB_WRITEL(((d0<<left | d1>>right) & first) |
(FB_READL(dst) & ~first), dst);
}
} else {
// Multiple destination words
d0 = *src++;
d0 = FB_READL(src++);
// Leading bits
if (shift > 0) {
// Single source word
......@@ -136,7 +136,7 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src,
n -= BITS_PER_LONG-dst_idx;
} else {
// 2 source words
d1 = *src++;
d1 = FB_READL(src++);
FB_WRITEL(((d0<<left | d1>>right) & first) |
(FB_READL(dst) & ~first), dst);
d0 = d1;
......@@ -148,22 +148,22 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src,
m = n % BITS_PER_LONG;
n /= BITS_PER_LONG;
while (n >= 4) {
d1 = *src++;
d1 = FB_READL(src++);
FB_WRITEL(d0 << left | d1 >> right, dst++);
d0 = d1;
d1 = *src++;
d1 = FB_READL(src++);
FB_WRITEL(d0 << left | d1 >> right, dst++);
d0 = d1;
d1 = *src++;
d1 = FB_READL(src++);
FB_WRITEL(d0 << left | d1 >> right, dst++);
d0 = d1;
d1 = *src++;
d1 = FB_READL(src++);
FB_WRITEL(d0 << left | d1 >> right, dst++);
d0 = d1;
n -= 4;
}
while (n--) {
d1 = *src++;
d1 = FB_READL(src++);
FB_WRITEL(d0 << left | d1 >> right, dst++);
d0 = d1;
}
......@@ -177,7 +177,7 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src,
dst);
} else {
// 2 source words
d1 = *src;
d1 = FB_READL(src);
FB_WRITEL(((d0<<left | d1>>right) &
last) | (FB_READL(dst) &
~last), dst);
......@@ -220,13 +220,13 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx,
// Single word
if (last)
first &= last;
FB_WRITEL((*src & first) | (FB_READL(dst) & ~first),
FB_WRITEL((FB_READL(src) & first) | (FB_READL(dst) & ~first),
dst);
} else {
// Multiple destination words
// Leading bits
if (first) {
FB_WRITEL((*src & first) | (FB_READL(dst) &
FB_WRITEL((FB_READL(src) & first) | (FB_READL(dst) &
~first), dst);
dst--;
src--;
......@@ -236,22 +236,22 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx,
// Main chunk
n /= BITS_PER_LONG;
while (n >= 8) {
FB_WRITEL(*src--, dst--);
FB_WRITEL(*src--, dst--);
FB_WRITEL(*src--, dst--);
FB_WRITEL(*src--, dst--);
FB_WRITEL(*src--, dst--);
FB_WRITEL(*src--, dst--);
FB_WRITEL(*src--, dst--);
FB_WRITEL(*src--, dst--);
FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(FB_READL(src--), dst--);
n -= 8;
}
while (n--)
FB_WRITEL(*src--, dst--);
FB_WRITEL(FB_READL(src--), dst--);
// Trailing bits
if (last)
FB_WRITEL((*src & last) | (FB_READL(dst) &
FB_WRITEL((FB_READL(src) & last) | (FB_READL(dst) &
~last), dst);
}
} else {
......@@ -266,22 +266,22 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx,
first &= last;
if (shift < 0) {
// Single source word
FB_WRITEL((*src << left & first) |
FB_WRITEL((FB_READL(src) << left & first) |
(FB_READL(dst) & ~first), dst);
} else if (1+(unsigned long)src_idx >= n) {
// Single source word
FB_WRITEL(((*src >> right) & first) |
FB_WRITEL(((FB_READL(src) >> right) & first) |
(FB_READL(dst) & ~first), dst);
} else {
// 2 source words
d0 = *src--;
d1 = *src;
d0 = FB_READL(src--);
d1 = FB_READL(src);
FB_WRITEL(((d0>>right | d1<<left) & first) |
(FB_READL(dst) & ~first), dst);
}
} else {
// Multiple destination words
d0 = *src--;
d0 = FB_READL(src--);
// Leading bits
if (shift < 0) {
// Single source word
......@@ -291,7 +291,7 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx,
n -= dst_idx+1;
} else {
// 2 source words
d1 = *src--;
d1 = FB_READL(src--);
FB_WRITEL(((d0>>right | d1<<left) & first) |
(FB_READL(dst) & ~first), dst);
d0 = d1;
......@@ -303,22 +303,22 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx,
m = n % BITS_PER_LONG;
n /= BITS_PER_LONG;
while (n >= 4) {
d1 = *src--;
d1 = FB_READL(src--);
FB_WRITEL(d0 >> right | d1 << left, dst--);
d0 = d1;
d1 = *src--;
d1 = FB_READL(src--);
FB_WRITEL(d0 >> right | d1 << left, dst--);
d0 = d1;
d1 = *src--;
d1 = FB_READL(src--);
FB_WRITEL(d0 >> right | d1 << left, dst--);
d0 = d1;
d1 = *src--;
d1 = FB_READL(src--);
FB_WRITEL(d0 >> right | d1 << left, dst--);
d0 = d1;
n -= 4;
}
while (n--) {
d1 = *src--;
d1 = FB_READL(src--);
FB_WRITEL(d0 >> right | d1 << left, dst--);
d0 = d1;
}
......@@ -332,7 +332,7 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx,
dst);
} else {
// 2 source words
d1 = *src;
d1 = FB_READL(src);
FB_WRITEL(((d0>>right | d1<<left) &
last) | (FB_READL(dst) &
~last), dst);
......@@ -410,8 +410,8 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
dst_idx &= (BYTES_PER_LONG-1);
src += src_idx >> SHIFT_PER_LONG;
src_idx &= (BYTES_PER_LONG-1);
bitcpy_rev((unsigned long*)dst, dst_idx,
(unsigned long *)src, src_idx,
bitcpy_rev(dst, dst_idx,
src, src_idx,
area->width*p->var.bits_per_pixel);
}
} else {
......@@ -420,8 +420,8 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
dst_idx &= (BYTES_PER_LONG-1);
src += src_idx >> SHIFT_PER_LONG;
src_idx &= (BYTES_PER_LONG-1);
bitcpy((unsigned long*)dst, dst_idx,
(unsigned long *)src, src_idx,
bitcpy(dst, dst_idx,
src, src_idx,
area->width*p->var.bits_per_pixel);
dst_idx += next_line*8;
src_idx += next_line*8;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment