[PATCH V2 driver/mga] Disable Linear Expansion on BE

Egbert Eich eich at freedesktop.org
Wed Jul 31 00:34:55 PDT 2013


Linear Expansion doesn't work on BE as the bit order in
a word is reversed. ScreenToScreenColorExpansion allows
to adjust the bit order in a byte, still the bytes have
the wrong order.

Signed-off-by: Egbert Eich <eich at freedesktop.org>
---
v2: Changed logic from '!=' to '==' for preprocessor suggested by
    Walter Harms <wharms at bfs.de>

 src/mga.h       | 5 +++++
 src/mga_storm.c | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/src/mga.h b/src/mga.h
index 34695c1..0c5d71d 100644
--- a/src/mga.h
+++ b/src/mga.h
@@ -688,7 +688,12 @@ extern CARD32 MGAAtypeNoBLK[16];
 #define	NICE_DASH_PATTERN	0x00000020
 #define	TWO_PASS_COLOR_EXPAND	0x00000040
 #define	MGA_NO_PLANEMASK	0x00000080
+/* linear expansion doesn't work on BE due to wrong byte order */
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+#define USE_LINEAR_EXPANSION	0x00000000
+#else
 #define USE_LINEAR_EXPANSION	0x00000100
+#endif
 #define LARGE_ADDRESSES		0x00000200
 
 #define MGAIOMAPSIZE		0x00004000
diff --git a/src/mga_storm.c b/src/mga_storm.c
index fb0e7be..84a4c8c 100644
--- a/src/mga_storm.c
+++ b/src/mga_storm.c
@@ -710,7 +710,11 @@ Bool mgaAccelInit( ScreenPtr pScreen )
     /* screen to screen color expansion */
     if(pMga->AccelFlags & USE_LINEAR_EXPANSION) {
 	infoPtr->ScreenToScreenColorExpandFillFlags =
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+						BIT_ORDER_IN_BYTE_MSBFIRST;
+#else 
 						BIT_ORDER_IN_BYTE_LSBFIRST;
+#endif
 	infoPtr->SetupForScreenToScreenColorExpandFill =
 		mgaSetupForScreenToScreenColorExpandFill;
 	infoPtr->SubsequentScreenToScreenColorExpandFill =
-- 
1.8.1.4



More information about the xorg-devel mailing list