diff options
author | vandrove@vc.cvut.cz <vandrove@vc.cvut.cz> | 2005-03-31 08:48:52 -0800 |
---|---|---|
committer | <chrisw@vas.sous-sol.org> | 2005-05-26 21:20:05 -0700 |
commit | de116e6f648b419fc9fe5cebda8b2c3f90ab1206 (patch) | |
tree | dec31b90ef825dfc3b28af0f85e2dee22c10b1dd | |
parent | 2a678e09a966a0ad20aab2f761c37f0b29b40e71 (diff) | |
download | linux-stable-de116e6f648b419fc9fe5cebda8b2c3f90ab1206.tar.gz linux-stable-de116e6f648b419fc9fe5cebda8b2c3f90ab1206.tar.bz2 linux-stable-de116e6f648b419fc9fe5cebda8b2c3f90ab1206.zip |
[PATCH] Fix matroxfb on big-endian hardware
There was too much/too few byteswapping done by driver and hardware in
matroxfb on big endian hardware. Change fixes mirrored/split/corrupted
letters seen on screen when using accelerated matroxfb mode.
Patch was tested on Mips (by Peter) and x86-64 (by Petr).
Signed-off-by: Peter 'p2' De Schrijver <p2@mind.be>
Signed-off-by: Petr Vandrovec <vandrove@vc.cvut.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Chris Wright <chrisw@osdl.org>
-rw-r--r-- | drivers/video/matrox/matroxfb_accel.c | 14 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_base.h | 4 |
2 files changed, 13 insertions, 5 deletions
diff --git a/drivers/video/matrox/matroxfb_accel.c b/drivers/video/matrox/matroxfb_accel.c index 8f14c9b300c2..c7f3e1321224 100644 --- a/drivers/video/matrox/matroxfb_accel.c +++ b/drivers/video/matrox/matroxfb_accel.c @@ -438,13 +438,21 @@ static void matroxfb_1bpp_imageblit(WPMINFO u_int32_t fgx, u_int32_t bgx, } else if (step == 1) { /* Special case for 1..8bit widths */ while (height--) { - mga_writel(mmio, 0, *chardata); +#if defined(__BIG_ENDIAN) + fb_writel((*chardata) << 24, mmio.vaddr); +#else + fb_writel(*chardata, mmio.vaddr); +#endif chardata++; } } else if (step == 2) { /* Special case for 9..15bit widths */ while (height--) { - mga_writel(mmio, 0, *(u_int16_t*)chardata); +#if defined(__BIG_ENDIAN) + fb_writel((*(u_int16_t*)chardata) << 16, mmio.vaddr); +#else + fb_writel(*(u_int16_t*)chardata, mmio.vaddr); +#endif chardata += 2; } } else { @@ -454,7 +462,7 @@ static void matroxfb_1bpp_imageblit(WPMINFO u_int32_t fgx, u_int32_t bgx, for (i = 0; i < step; i += 4) { /* Hope that there are at least three readable bytes beyond the end of bitmap */ - mga_writel(mmio, 0, get_unaligned((u_int32_t*)(chardata + i))); + fb_writel(get_unaligned((u_int32_t*)(chardata + i)),mmio.vaddr); } chardata += step; } diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index a98de7952868..1021f3cf5322 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h @@ -170,14 +170,14 @@ static inline void mga_memcpy_toio(vaddr_t va, const void* src, int len) { if ((unsigned long)src & 3) { while (len >= 4) { - writel(get_unaligned((u32 *)src), addr); + fb_writel(get_unaligned((u32 *)src), addr); addr++; len -= 4; src += 4; } } else { while (len >= 4) { - writel(*(u32 *)src, addr); + fb_writel(*(u32 *)src, addr); addr++; len -= 4; src += 4; |