Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 94136
b: refs/heads/master
c: e4c690e
h: refs/heads/master
v: v3
  • Loading branch information
Anton Vorontsov authored and Linus Torvalds committed Apr 28, 2008
1 parent 5ec9894 commit 8ef3369
Show file tree
Hide file tree
Showing 11 changed files with 229 additions and 141 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6b745b6fd02213f4b2fef2f2635985929fc5b8cc
refs/heads/master: e4c690e061b909127ab0f12e929f82f3f39ec953
24 changes: 24 additions & 0 deletions trunk/drivers/video/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,30 @@ config FB_SYS_IMAGEBLIT
blitting. This is used by drivers that don't provide their own
(accelerated) version and the framebuffer is in system RAM.

menuconfig FB_FOREIGN_ENDIAN
bool "Framebuffer foreign endianness support"
depends on FB
---help---
This menu will let you enable support for the framebuffers with
non-native endianness (e.g. Little-Endian framebuffer on a
Big-Endian machine). Most probably you don't have such hardware,
so it's safe to say "n" here.

choice
prompt "Choice endianness support"
depends on FB_FOREIGN_ENDIAN

config FB_BOTH_ENDIAN
bool "Support for Big- and Little-Endian framebuffers"

config FB_BIG_ENDIAN
bool "Support for Big-Endian framebuffers only"

config FB_LITTLE_ENDIAN
bool "Support for Little-Endian framebuffers only"

endchoice

config FB_SYS_FOPS
tristate
depends on FB
Expand Down
23 changes: 13 additions & 10 deletions trunk/drivers/video/cfbcopyarea.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@
*/

static void
bitcpy(unsigned long __iomem *dst, int dst_idx, const unsigned long __iomem *src,
int src_idx, int bits, unsigned n, u32 bswapmask)
bitcpy(struct fb_info *p, unsigned long __iomem *dst, int dst_idx,
const unsigned long __iomem *src, int src_idx, int bits,
unsigned n, u32 bswapmask)
{
unsigned long first, last;
int const shift = dst_idx-src_idx;
int left, right;

first = fb_shifted_pixels_mask_long(dst_idx, bswapmask);
last = ~fb_shifted_pixels_mask_long((dst_idx+n) % bits, bswapmask);
first = fb_shifted_pixels_mask_long(p, dst_idx, bswapmask);
last = ~fb_shifted_pixels_mask_long(p, (dst_idx+n) % bits, bswapmask);

if (!shift) {
// Same alignment for source and dest
Expand Down Expand Up @@ -202,8 +203,9 @@ bitcpy(unsigned long __iomem *dst, int dst_idx, const unsigned long __iomem *src
*/

static void
bitcpy_rev(unsigned long __iomem *dst, int dst_idx, const unsigned long __iomem *src,
int src_idx, int bits, unsigned n, u32 bswapmask)
bitcpy_rev(struct fb_info *p, unsigned long __iomem *dst, int dst_idx,
const unsigned long __iomem *src, int src_idx, int bits,
unsigned n, u32 bswapmask)
{
unsigned long first, last;
int shift;
Expand All @@ -221,8 +223,9 @@ bitcpy_rev(unsigned long __iomem *dst, int dst_idx, const unsigned long __iomem

shift = dst_idx-src_idx;

first = fb_shifted_pixels_mask_long(bits - 1 - dst_idx, bswapmask);
last = ~fb_shifted_pixels_mask_long(bits - 1 - ((dst_idx-n) % bits), bswapmask);
first = fb_shifted_pixels_mask_long(p, bits - 1 - dst_idx, bswapmask);
last = ~fb_shifted_pixels_mask_long(p, bits - 1 - ((dst_idx-n) % bits),
bswapmask);

if (!shift) {
// Same alignment for source and dest
Expand Down Expand Up @@ -404,7 +407,7 @@ void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area)
dst_idx &= (bytes - 1);
src += src_idx >> (ffs(bits) - 1);
src_idx &= (bytes - 1);
bitcpy_rev(dst, dst_idx, src, src_idx, bits,
bitcpy_rev(p, dst, dst_idx, src, src_idx, bits,
width*p->var.bits_per_pixel, bswapmask);
}
} else {
Expand All @@ -413,7 +416,7 @@ void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area)
dst_idx &= (bytes - 1);
src += src_idx >> (ffs(bits) - 1);
src_idx &= (bytes - 1);
bitcpy(dst, dst_idx, src, src_idx, bits,
bitcpy(p, dst, dst_idx, src, src_idx, bits,
width*p->var.bits_per_pixel, bswapmask);
dst_idx += bits_per_line;
src_idx += bits_per_line;
Expand Down
48 changes: 26 additions & 22 deletions trunk/drivers/video/cfbfillrect.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@
*/

static void
bitfill_aligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
unsigned n, int bits, u32 bswapmask)
bitfill_aligned(struct fb_info *p, unsigned long __iomem *dst, int dst_idx,
unsigned long pat, unsigned n, int bits, u32 bswapmask)
{
unsigned long first, last;

if (!n)
return;

first = fb_shifted_pixels_mask_long(dst_idx, bswapmask);
last = ~fb_shifted_pixels_mask_long((dst_idx+n) % bits, bswapmask);
first = fb_shifted_pixels_mask_long(p, dst_idx, bswapmask);
last = ~fb_shifted_pixels_mask_long(p, (dst_idx+n) % bits, bswapmask);

if (dst_idx+n <= bits) {
// Single word
Expand Down Expand Up @@ -93,16 +93,16 @@ bitfill_aligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
*/

static void
bitfill_unaligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
int left, int right, unsigned n, int bits)
bitfill_unaligned(struct fb_info *p, unsigned long __iomem *dst, int dst_idx,
unsigned long pat, int left, int right, unsigned n, int bits)
{
unsigned long first, last;

if (!n)
return;

first = FB_SHIFT_HIGH(~0UL, dst_idx);
last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits));
first = FB_SHIFT_HIGH(p, ~0UL, dst_idx);
last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits));

if (dst_idx+n <= bits) {
// Single word
Expand Down Expand Up @@ -147,17 +147,18 @@ bitfill_unaligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
* Aligned pattern invert using 32/64-bit memory accesses
*/
static void
bitfill_aligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
unsigned n, int bits, u32 bswapmask)
bitfill_aligned_rev(struct fb_info *p, unsigned long __iomem *dst,
int dst_idx, unsigned long pat, unsigned n, int bits,
u32 bswapmask)
{
unsigned long val = pat, dat;
unsigned long first, last;

if (!n)
return;

first = fb_shifted_pixels_mask_long(dst_idx, bswapmask);
last = ~fb_shifted_pixels_mask_long((dst_idx+n) % bits, bswapmask);
first = fb_shifted_pixels_mask_long(p, dst_idx, bswapmask);
last = ~fb_shifted_pixels_mask_long(p, (dst_idx+n) % bits, bswapmask);

if (dst_idx+n <= bits) {
// Single word
Expand Down Expand Up @@ -217,16 +218,17 @@ bitfill_aligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
*/

static void
bitfill_unaligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat,
int left, int right, unsigned n, int bits)
bitfill_unaligned_rev(struct fb_info *p, unsigned long __iomem *dst,
int dst_idx, unsigned long pat, int left, int right,
unsigned n, int bits)
{
unsigned long first, last, dat;

if (!n)
return;

first = FB_SHIFT_HIGH(~0UL, dst_idx);
last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits));
first = FB_SHIFT_HIGH(p, ~0UL, dst_idx);
last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits));

if (dst_idx+n <= bits) {
// Single word
Expand Down Expand Up @@ -306,7 +308,8 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
p->fbops->fb_sync(p);
if (!left) {
u32 bswapmask = fb_compute_bswapmask(p);
void (*fill_op32)(unsigned long __iomem *dst, int dst_idx,
void (*fill_op32)(struct fb_info *p,
unsigned long __iomem *dst, int dst_idx,
unsigned long pat, unsigned n, int bits,
u32 bswapmask) = NULL;

Expand All @@ -325,16 +328,17 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
while (height--) {
dst += dst_idx >> (ffs(bits) - 1);
dst_idx &= (bits - 1);
fill_op32(dst, dst_idx, pat, width*bpp, bits, bswapmask);
fill_op32(p, dst, dst_idx, pat, width*bpp, bits,
bswapmask);
dst_idx += p->fix.line_length*8;
}
} else {
int right;
int r;
int rot = (left-dst_idx) % bpp;
void (*fill_op)(unsigned long __iomem *dst, int dst_idx,
unsigned long pat, int left, int right,
unsigned n, int bits) = NULL;
void (*fill_op)(struct fb_info *p, unsigned long __iomem *dst,
int dst_idx, unsigned long pat, int left,
int right, unsigned n, int bits) = NULL;

/* rotate pattern to correct start position */
pat = pat << rot | pat >> (bpp-rot);
Expand All @@ -355,7 +359,7 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
while (height--) {
dst += dst_idx >> (ffs(bits) - 1);
dst_idx &= (bits - 1);
fill_op(dst, dst_idx, pat, left, right,
fill_op(p, dst, dst_idx, pat, left, right,
width*bpp, bits);
r = (p->fix.line_length*8) % bpp;
pat = pat << (bpp-r) | pat >> r;
Expand Down
52 changes: 26 additions & 26 deletions trunk/drivers/video/cfbimgblt.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,26 @@
#define DPRINTK(fmt, args...)
#endif

static const u32 cfb_tab8[] = {
#if defined(__BIG_ENDIAN)
static const u32 cfb_tab8_be[] = {
0x00000000,0x000000ff,0x0000ff00,0x0000ffff,
0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff,
0xff000000,0xff0000ff,0xff00ff00,0xff00ffff,
0xffff0000,0xffff00ff,0xffffff00,0xffffffff
#elif defined(__LITTLE_ENDIAN)
};

static const u32 cfb_tab8_le[] = {
0x00000000,0xff000000,0x00ff0000,0xffff0000,
0x0000ff00,0xff00ff00,0x00ffff00,0xffffff00,
0x000000ff,0xff0000ff,0x00ff00ff,0xffff00ff,
0x0000ffff,0xff00ffff,0x00ffffff,0xffffffff
#else
#error FIXME: No endianness??
#endif
};

static const u32 cfb_tab16[] = {
#if defined(__BIG_ENDIAN)
static const u32 cfb_tab16_be[] = {
0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff
#elif defined(__LITTLE_ENDIAN)
};

static const u32 cfb_tab16_le[] = {
0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff
#else
#error FIXME: No endianness??
#endif
};

static const u32 cfb_tab32[] = {
Expand Down Expand Up @@ -98,7 +94,8 @@ static inline void color_imageblit(const struct fb_image *image,
val = 0;

if (start_index) {
u32 start_mask = ~fb_shifted_pixels_mask_u32(start_index, bswapmask);
u32 start_mask = ~fb_shifted_pixels_mask_u32(p,
start_index, bswapmask);
val = FB_READL(dst) & start_mask;
shift = start_index;
}
Expand All @@ -108,20 +105,21 @@ static inline void color_imageblit(const struct fb_image *image,
color = palette[*src];
else
color = *src;
color <<= FB_LEFT_POS(bpp);
val |= FB_SHIFT_HIGH(color, shift ^ bswapmask);
color <<= FB_LEFT_POS(p, bpp);
val |= FB_SHIFT_HIGH(p, color, shift ^ bswapmask);
if (shift >= null_bits) {
FB_WRITEL(val, dst++);

val = (shift == null_bits) ? 0 :
FB_SHIFT_LOW(color, 32 - shift);
FB_SHIFT_LOW(p, color, 32 - shift);
}
shift += bpp;
shift &= (32 - 1);
src++;
}
if (shift) {
u32 end_mask = fb_shifted_pixels_mask_u32(shift, bswapmask);
u32 end_mask = fb_shifted_pixels_mask_u32(p, shift,
bswapmask);

FB_WRITEL((FB_READL(dst) & end_mask) | val, dst);
}
Expand Down Expand Up @@ -152,8 +150,8 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info *
u32 bswapmask = fb_compute_bswapmask(p);

dst2 = (u32 __iomem *) dst1;
fgcolor <<= FB_LEFT_POS(bpp);
bgcolor <<= FB_LEFT_POS(bpp);
fgcolor <<= FB_LEFT_POS(p, bpp);
bgcolor <<= FB_LEFT_POS(p, bpp);

for (i = image->height; i--; ) {
shift = val = 0;
Expand All @@ -164,21 +162,22 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info *

/* write leading bits */
if (start_index) {
u32 start_mask = ~fb_shifted_pixels_mask_u32(start_index, bswapmask);
u32 start_mask = ~fb_shifted_pixels_mask_u32(p,
start_index, bswapmask);
val = FB_READL(dst) & start_mask;
shift = start_index;
}

while (j--) {
l--;
color = (*s & (1 << l)) ? fgcolor : bgcolor;
val |= FB_SHIFT_HIGH(color, shift ^ bswapmask);
val |= FB_SHIFT_HIGH(p, color, shift ^ bswapmask);

/* Did the bitshift spill bits to the next long? */
if (shift >= null_bits) {
FB_WRITEL(val, dst++);
val = (shift == null_bits) ? 0 :
FB_SHIFT_LOW(color,32 - shift);
FB_SHIFT_LOW(p, color, 32 - shift);
}
shift += bpp;
shift &= (32 - 1);
Expand All @@ -187,7 +186,8 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info *

/* write trailing bits */
if (shift) {
u32 end_mask = fb_shifted_pixels_mask_u32(shift, bswapmask);
u32 end_mask = fb_shifted_pixels_mask_u32(p, shift,
bswapmask);

FB_WRITEL((FB_READL(dst) & end_mask) | val, dst);
}
Expand Down Expand Up @@ -223,13 +223,13 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
u32 __iomem *dst;
const u32 *tab = NULL;
int i, j, k;

switch (bpp) {
case 8:
tab = cfb_tab8;
tab = fb_be_math(p) ? cfb_tab8_be : cfb_tab8_le;
break;
case 16:
tab = cfb_tab16;
tab = fb_be_math(p) ? cfb_tab16_be : cfb_tab16_le;
break;
case 32:
default:
Expand Down
Loading

0 comments on commit 8ef3369

Please sign in to comment.