[PATCH:xf86-video-siliconmotion 1/2] Fix endian detection on NetBSD.

Thomas Klausner wiz at NetBSD.org
Mon Sep 14 11:46:01 PDT 2015


On Mon, Sep 14, 2015 at 10:22:06AM -0700, Alan Coopersmith wrote:
> On 09/14/15 09:39 AM, Thomas Klausner wrote:
> >NetBSD provides BYTE_ENDIAN, but this driver looks for __BYTE_ENDIAN.
> >---
> >  src/smi.h | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> >diff --git a/src/smi.h b/src/smi.h
> >index 5e44892..f3227e0 100644
> >--- a/src/smi.h
> >+++ b/src/smi.h
> >@@ -67,6 +67,12 @@ authorization from the XFree86 Project and Silicon Motion.
> >  /*			D E F I N I T I O N S				      */
> >  /******************************************************************************/
> >
> >+#ifdef __NetBSD__
> >+#define __BYTE_ORDER BYTE_ORDER
> >+#define __LITTLE_ENDIAN LITTLE_ENDIAN
> >+#define __BIG_ENDIAN BIG_ENDIAN
> >+#endif
> >+
> 
> Should it be including <X11/Xarch.h> instead?   (Actual question - I don't know
> the answer, just know that's an already existing definition of those symbols.)

Sure, that sounds fine to me. Thanks, new patch attached.
 Thomas
-------------- next part --------------
>From 85e6afee301c72e14ca0a37252160b546703f65f Mon Sep 17 00:00:00 2001
From: Thomas Klausner <wiz at NetBSD.org>
Date: Mon, 14 Sep 2015 18:36:32 +0200
Subject: [PATCH:xf86-video-siliconmotion 2/2] Use X11/Xarch.h for endian
 detection.

---
 src/smi.h        |  1 +
 src/smi_driver.c |  2 +-
 src/smi_xaa.c    | 18 +++++++++---------
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/smi.h b/src/smi.h
index 5e44892..2742c8d 100644
--- a/src/smi.h
+++ b/src/smi.h
@@ -34,6 +34,7 @@ authorization from the XFree86 Project and Silicon Motion.
 
 #include <string.h>
 #include <stdio.h>
+#include <X11/Xarch.h>
 
 #include "xf86.h"
 #include "xf86_OSproc.h"
diff --git a/src/smi_driver.c b/src/smi_driver.c
index 59e6d15..997daf4 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -487,7 +487,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
     if (pScrn->depth > 8) {
 	/* The defaults are OK for us */
 	rgb zeros = {0, 0, 0};
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if X_BYTE_ORDER == X_BIG_ENDIAN
 	rgb masks = {0xff00,0xff0000,0xff000000};
 #else
 	rgb masks = {0, 0, 0};
diff --git a/src/smi_xaa.c b/src/smi_xaa.c
index a878098..cd861a1 100644
--- a/src/smi_xaa.c
+++ b/src/smi_xaa.c
@@ -211,7 +211,7 @@ SMI_SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop,
     ENTER();
     DEBUG("xdir=%d ydir=%d rop=%02X trans=%08X\n", xdir, ydir, rop, trans);
 
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if X_BYTE_ORDER == X_BIG_ENDIAN
     if (pScrn->depth >= 24)
 	trans = lswapl(trans);
 #endif
@@ -296,7 +296,7 @@ SMI_SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
 		   | SMI_BITBLT
 		   | SMI_START_ENGINE;
 
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if X_BYTE_ORDER == X_BIG_ENDIAN
     if (pScrn->depth >= 24) {
 	/* because of the BGR values are in the MSB bytes,
 	 * 'white' is not possible and -1 has a different meaning.
@@ -408,7 +408,7 @@ SMI_SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg,
     ENTER();
     DEBUG("fg=%08X bg=%08X rop=%02X\n", fg, bg, rop);
 
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if X_BYTE_ORDER == X_BIG_ENDIAN
     if (pScrn->depth >= 24) {
 	/* see remark elswere */
 	if (fg == 0x7FFFFFFF)
@@ -431,7 +431,7 @@ SMI_SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg,
 	WRITE_DPR(pSmi, 0x18, ~fg);
 	WRITE_DPR(pSmi, 0x20, fg);
     } else {
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if X_BYTE_ORDER == X_BIG_ENDIAN
 	if (bg == 0xFFFFFF7F)
 	    bg = -1;
 #endif
@@ -498,7 +498,7 @@ SMI_SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int fg,
     DEBUG("patx=%08X paty=%08X fg=%08X bg=%08X rop=%02X\n",
 	  patx, paty, fg, bg, rop);
 
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if X_BYTE_ORDER == X_BIG_ENDIAN
     if (pScrn->depth >= 24) {
 	if (fg == 0x7FFFFFFF)
 	    fg = -1;
@@ -524,7 +524,7 @@ SMI_SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int fg,
 	WRITE_DPR(pSmi, 0x34, patx);
 	WRITE_DPR(pSmi, 0x38, paty);
     } else {
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if X_BYTE_ORDER == X_BIG_ENDIAN
 	if (bg == 0xFFFFFF7F)
 	    bg = -1;
 #endif
@@ -582,7 +582,7 @@ SMI_SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int rop,
 		   | SMI_COLOR_PATTERN
 		   | SMI_START_ENGINE;
 
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if X_BYTE_ORDER == X_BIG_ENDIAN
     if (pScrn->depth >= 24)
 	trans_color = lswapl(trans_color);
 #endif
@@ -666,7 +666,7 @@ SMI_SetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask,
     DEBUG("rop=%02X trans_color=%08X bpp=%d depth=%d\n",
 	  rop, trans_color, bpp, depth);
 
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if X_BYTE_ORDER == X_BIG_ENDIAN
     if (pScrn->depth >= 24)
 	trans_color = lswapl(trans_color);
 #endif
@@ -675,7 +675,7 @@ SMI_SetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask,
 		   | SMI_START_ENGINE;
 
     if (trans_color != -1) {
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if X_BYTE_ORDER == X_BIG_ENDIAN
 	if (trans_color == 0xFFFFFF7F)
 	    trans_color = -1;
 #endif
-- 
2.5.2



More information about the xorg-devel mailing list