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, ...@@ -65,14 +65,14 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src,
// Single word // Single word
if (last) if (last)
first &= last; first &= last;
FB_WRITEL((*src & first) | (FB_READL(dst) & ~first), FB_WRITEL((FB_READL(src) & first) | (FB_READL(dst) & ~first),
dst); dst);
} else { } else {
// Multiple destination words // Multiple destination words
// Leading bits // Leading bits
if (first) { if (first) {
FB_WRITEL((*src & first) | (FB_READL(dst) & FB_WRITEL((FB_READL(src) & first) | (FB_READL(dst) &
~first), dst); ~first), dst);
dst++; dst++;
src++; src++;
...@@ -82,21 +82,21 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, ...@@ -82,21 +82,21 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src,
// Main chunk // Main chunk
n /= BITS_PER_LONG; n /= BITS_PER_LONG;
while (n >= 8) { while (n >= 8) {
FB_WRITEL(*src++, dst++); FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(*src++, dst++); FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(*src++, dst++); FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(*src++, dst++); FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(*src++, dst++); FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(*src++, dst++); FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(*src++, dst++); FB_WRITEL(FB_READL(src++), dst++);
FB_WRITEL(*src++, dst++); FB_WRITEL(FB_READL(src++), dst++);
n -= 8; n -= 8;
} }
while (n--) while (n--)
FB_WRITEL(*src++, dst++); FB_WRITEL(FB_READL(src++), dst++);
// Trailing bits // Trailing bits
if (last) if (last)
FB_WRITEL((*src & last) | (FB_READL(dst) & FB_WRITEL((FB_READL(src) & last) | (FB_READL(dst) &
~last), dst); ~last), dst);
} }
} else { } else {
...@@ -111,22 +111,22 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, ...@@ -111,22 +111,22 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src,
first &= last; first &= last;
if (shift > 0) { if (shift > 0) {
// Single source word // Single source word
FB_WRITEL(((*src >> right) & first) | FB_WRITEL(((FB_READL(src) >> right) & first) |
(FB_READL(dst) & ~first), dst); (FB_READL(dst) & ~first), dst);
} else if (src_idx+n <= BITS_PER_LONG) { } else if (src_idx+n <= BITS_PER_LONG) {
// Single source word // Single source word
FB_WRITEL(((*src << left) & first) | FB_WRITEL(((FB_READL(src) << left) & first) |
(FB_READL(dst) & ~first), dst); (FB_READL(dst) & ~first), dst);
} else { } else {
// 2 source words // 2 source words
d0 = *src++; d0 = FB_READL(src++);
d1 = *src; d1 = FB_READL(src);
FB_WRITEL(((d0<<left | d1>>right) & first) | FB_WRITEL(((d0<<left | d1>>right) & first) |
(FB_READL(dst) & ~first), dst); (FB_READL(dst) & ~first), dst);
} }
} else { } else {
// Multiple destination words // Multiple destination words
d0 = *src++; d0 = FB_READL(src++);
// Leading bits // Leading bits
if (shift > 0) { if (shift > 0) {
// Single source word // Single source word
...@@ -136,7 +136,7 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, ...@@ -136,7 +136,7 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src,
n -= BITS_PER_LONG-dst_idx; n -= BITS_PER_LONG-dst_idx;
} else { } else {
// 2 source words // 2 source words
d1 = *src++; d1 = FB_READL(src++);
FB_WRITEL(((d0<<left | d1>>right) & first) | FB_WRITEL(((d0<<left | d1>>right) & first) |
(FB_READL(dst) & ~first), dst); (FB_READL(dst) & ~first), dst);
d0 = d1; d0 = d1;
...@@ -148,22 +148,22 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, ...@@ -148,22 +148,22 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src,
m = n % BITS_PER_LONG; m = n % BITS_PER_LONG;
n /= BITS_PER_LONG; n /= BITS_PER_LONG;
while (n >= 4) { while (n >= 4) {
d1 = *src++; d1 = FB_READL(src++);
FB_WRITEL(d0 << left | d1 >> right, dst++); FB_WRITEL(d0 << left | d1 >> right, dst++);
d0 = d1; d0 = d1;
d1 = *src++; d1 = FB_READL(src++);
FB_WRITEL(d0 << left | d1 >> right, dst++); FB_WRITEL(d0 << left | d1 >> right, dst++);
d0 = d1; d0 = d1;
d1 = *src++; d1 = FB_READL(src++);
FB_WRITEL(d0 << left | d1 >> right, dst++); FB_WRITEL(d0 << left | d1 >> right, dst++);
d0 = d1; d0 = d1;
d1 = *src++; d1 = FB_READL(src++);
FB_WRITEL(d0 << left | d1 >> right, dst++); FB_WRITEL(d0 << left | d1 >> right, dst++);
d0 = d1; d0 = d1;
n -= 4; n -= 4;
} }
while (n--) { while (n--) {
d1 = *src++; d1 = FB_READL(src++);
FB_WRITEL(d0 << left | d1 >> right, dst++); FB_WRITEL(d0 << left | d1 >> right, dst++);
d0 = d1; d0 = d1;
} }
...@@ -177,7 +177,7 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, ...@@ -177,7 +177,7 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src,
dst); dst);
} else { } else {
// 2 source words // 2 source words
d1 = *src; d1 = FB_READL(src);
FB_WRITEL(((d0<<left | d1>>right) & FB_WRITEL(((d0<<left | d1>>right) &
last) | (FB_READL(dst) & last) | (FB_READL(dst) &
~last), dst); ~last), dst);
...@@ -220,13 +220,13 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx, ...@@ -220,13 +220,13 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx,
// Single word // Single word
if (last) if (last)
first &= last; first &= last;
FB_WRITEL((*src & first) | (FB_READL(dst) & ~first), FB_WRITEL((FB_READL(src) & first) | (FB_READL(dst) & ~first),
dst); dst);
} else { } else {
// Multiple destination words // Multiple destination words
// Leading bits // Leading bits
if (first) { if (first) {
FB_WRITEL((*src & first) | (FB_READL(dst) & FB_WRITEL((FB_READL(src) & first) | (FB_READL(dst) &
~first), dst); ~first), dst);
dst--; dst--;
src--; src--;
...@@ -236,22 +236,22 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx, ...@@ -236,22 +236,22 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx,
// Main chunk // Main chunk
n /= BITS_PER_LONG; n /= BITS_PER_LONG;
while (n >= 8) { while (n >= 8) {
FB_WRITEL(*src--, dst--); FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(*src--, dst--); FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(*src--, dst--); FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(*src--, dst--); FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(*src--, dst--); FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(*src--, dst--); FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(*src--, dst--); FB_WRITEL(FB_READL(src--), dst--);
FB_WRITEL(*src--, dst--); FB_WRITEL(FB_READL(src--), dst--);
n -= 8; n -= 8;
} }
while (n--) while (n--)
FB_WRITEL(*src--, dst--); FB_WRITEL(FB_READL(src--), dst--);
// Trailing bits // Trailing bits
if (last) if (last)
FB_WRITEL((*src & last) | (FB_READL(dst) & FB_WRITEL((FB_READL(src) & last) | (FB_READL(dst) &
~last), dst); ~last), dst);
} }
} else { } else {
...@@ -266,22 +266,22 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx, ...@@ -266,22 +266,22 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx,
first &= last; first &= last;
if (shift < 0) { if (shift < 0) {
// Single source word // Single source word
FB_WRITEL((*src << left & first) | FB_WRITEL((FB_READL(src) << left & first) |
(FB_READL(dst) & ~first), dst); (FB_READL(dst) & ~first), dst);
} else if (1+(unsigned long)src_idx >= n) { } else if (1+(unsigned long)src_idx >= n) {
// Single source word // Single source word
FB_WRITEL(((*src >> right) & first) | FB_WRITEL(((FB_READL(src) >> right) & first) |
(FB_READL(dst) & ~first), dst); (FB_READL(dst) & ~first), dst);
} else { } else {
// 2 source words // 2 source words
d0 = *src--; d0 = FB_READL(src--);
d1 = *src; d1 = FB_READL(src);
FB_WRITEL(((d0>>right | d1<<left) & first) | FB_WRITEL(((d0>>right | d1<<left) & first) |
(FB_READL(dst) & ~first), dst); (FB_READL(dst) & ~first), dst);
} }
} else { } else {
// Multiple destination words // Multiple destination words
d0 = *src--; d0 = FB_READL(src--);
// Leading bits // Leading bits
if (shift < 0) { if (shift < 0) {
// Single source word // Single source word
...@@ -291,7 +291,7 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx, ...@@ -291,7 +291,7 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx,
n -= dst_idx+1; n -= dst_idx+1;
} else { } else {
// 2 source words // 2 source words
d1 = *src--; d1 = FB_READL(src--);
FB_WRITEL(((d0>>right | d1<<left) & first) | FB_WRITEL(((d0>>right | d1<<left) & first) |
(FB_READL(dst) & ~first), dst); (FB_READL(dst) & ~first), dst);
d0 = d1; d0 = d1;
...@@ -303,22 +303,22 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx, ...@@ -303,22 +303,22 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx,
m = n % BITS_PER_LONG; m = n % BITS_PER_LONG;
n /= BITS_PER_LONG; n /= BITS_PER_LONG;
while (n >= 4) { while (n >= 4) {
d1 = *src--; d1 = FB_READL(src--);
FB_WRITEL(d0 >> right | d1 << left, dst--); FB_WRITEL(d0 >> right | d1 << left, dst--);
d0 = d1; d0 = d1;
d1 = *src--; d1 = FB_READL(src--);
FB_WRITEL(d0 >> right | d1 << left, dst--); FB_WRITEL(d0 >> right | d1 << left, dst--);
d0 = d1; d0 = d1;
d1 = *src--; d1 = FB_READL(src--);
FB_WRITEL(d0 >> right | d1 << left, dst--); FB_WRITEL(d0 >> right | d1 << left, dst--);
d0 = d1; d0 = d1;
d1 = *src--; d1 = FB_READL(src--);
FB_WRITEL(d0 >> right | d1 << left, dst--); FB_WRITEL(d0 >> right | d1 << left, dst--);
d0 = d1; d0 = d1;
n -= 4; n -= 4;
} }
while (n--) { while (n--) {
d1 = *src--; d1 = FB_READL(src--);
FB_WRITEL(d0 >> right | d1 << left, dst--); FB_WRITEL(d0 >> right | d1 << left, dst--);
d0 = d1; d0 = d1;
} }
...@@ -332,7 +332,7 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx, ...@@ -332,7 +332,7 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx,
dst); dst);
} else { } else {
// 2 source words // 2 source words
d1 = *src; d1 = FB_READL(src);
FB_WRITEL(((d0>>right | d1<<left) & FB_WRITEL(((d0>>right | d1<<left) &
last) | (FB_READL(dst) & last) | (FB_READL(dst) &
~last), dst); ~last), dst);
...@@ -410,8 +410,8 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) ...@@ -410,8 +410,8 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
dst_idx &= (BYTES_PER_LONG-1); dst_idx &= (BYTES_PER_LONG-1);
src += src_idx >> SHIFT_PER_LONG; src += src_idx >> SHIFT_PER_LONG;
src_idx &= (BYTES_PER_LONG-1); src_idx &= (BYTES_PER_LONG-1);
bitcpy_rev((unsigned long*)dst, dst_idx, bitcpy_rev(dst, dst_idx,
(unsigned long *)src, src_idx, src, src_idx,
area->width*p->var.bits_per_pixel); area->width*p->var.bits_per_pixel);
} }
} else { } else {
...@@ -420,8 +420,8 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) ...@@ -420,8 +420,8 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
dst_idx &= (BYTES_PER_LONG-1); dst_idx &= (BYTES_PER_LONG-1);
src += src_idx >> SHIFT_PER_LONG; src += src_idx >> SHIFT_PER_LONG;
src_idx &= (BYTES_PER_LONG-1); src_idx &= (BYTES_PER_LONG-1);
bitcpy((unsigned long*)dst, dst_idx, bitcpy(dst, dst_idx,
(unsigned long *)src, src_idx, src, src_idx,
area->width*p->var.bits_per_pixel); area->width*p->var.bits_per_pixel);
dst_idx += next_line*8; dst_idx += next_line*8;
src_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