[Intel-gfx] [PATCH] i810: Make XAA optional

Daniel Stone daniel at fooishbar.org
Tue Jul 10 01:32:13 CEST 2012


Don't build XAA when it's not available, or when we don't want it.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 configure.ac                  |   24 +++++++++++++++++++++++-
 src/legacy/i810/Makefile.am   |    6 +++++-
 src/legacy/i810/i810.h        |    4 ++++
 src/legacy/i810/i810_dga.c    |   15 ++++++++++++---
 src/legacy/i810/i810_dri.c    |    4 ++++
 src/legacy/i810/i810_driver.c |   11 +++++++++++
 src/legacy/i810/i810_video.c  |    2 --
 7 files changed, 59 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7ab7ab8..b6e8b34 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,6 +158,29 @@ if test "x$GLAMOR" != "xno"; then
 	AC_DEFINE(USE_GLAMOR, 1, [Enable glamor acceleration])
 fi
 
+
+PKG_CHECK_MODULES(XORG, [xorg-server >= $required_xorg_xserver_version xproto fontsproto pixman-1 >= $required_pixman_version $REQUIRED_MODULES])
+
+
+AC_MSG_CHECKING([whether to include XAA support])
+AC_ARG_ENABLE(uxa,
+	      AS_HELP_STRING([--enable-xaa],
+			     [Enable legacy X Acceleration Architecture (XAA) [default=auto]]),
+	      [XAA="$enableval"],
+	      [XAA=auto])
+AC_MSG_RESULT([$XAA])
+AM_CONDITIONAL(XAA, test "x$XAA" != xno)
+if test "x$XAA" != xno; then
+        save_CFLAGS=$CFLAGS
+        CFLAGS=$XSERVER_CFLAGS
+	AC_CHECK_HEADERS([xaa.h], XAA=yes, XAA=no)
+        CFLAGS=$save_CFLAGS
+fi
+if test "x$XAA" = xyes; then
+	AC_DEFINE(USE_XAA, 1, [Enable XAA support])
+fi
+AM_CONDITIONAL(XAA, test "x$XAA" = xyes)
+
 AC_ARG_WITH(default-accel,
 	    AS_HELP_STRING([--with-default-accel],
 			   [Select the default acceleration method [default=uxa if enabled, otherwise sna]]),
@@ -247,7 +270,6 @@ XORG_DRIVER_CHECK_EXT(XF86DRI, xextproto x11)
 XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
 
 # Obtain compiler/linker options for the driver dependencies
-PKG_CHECK_MODULES(XORG, [xorg-server >= $required_xorg_xserver_version xproto fontsproto pixman-1 >= $required_pixman_version $REQUIRED_MODULES])
 PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.24]) # libdrm_intel is checked separately
 PKG_CHECK_MODULES(DRI, [xf86driproto], , DRI=no)
 PKG_CHECK_MODULES(DRI2, [dri2proto >= 2.6],, DRI2=no)
diff --git a/src/legacy/i810/Makefile.am b/src/legacy/i810/Makefile.am
index e7fa04f..01cc218 100644
--- a/src/legacy/i810/Makefile.am
+++ b/src/legacy/i810/Makefile.am
@@ -8,7 +8,6 @@ AM_CFLAGS = @CWARNFLAGS@ @XORG_CFLAGS@ @DRM_CFLAGS@ @DRI_CFLAGS@ @PCIACCESS_CFLA
 	    $(NULL)
 
 liblegacy_i810_la_SOURCES = \
-         i810_accel.c \
          i810_common.h \
          i810_cursor.c \
          i810_dga.c \
@@ -20,6 +19,11 @@ liblegacy_i810_la_SOURCES = \
          i810_video.c \
          i810_wmark.c
 
+if XAA
+liblegacy_i810_la_SOURCES += \
+         i810_accel.c
+endif
+
 if DRI
 liblegacy_i810_la_SOURCES +=\
          i810_dri.c \
diff --git a/src/legacy/i810/i810.h b/src/legacy/i810/i810.h
index 874551b..512d07e 100644
--- a/src/legacy/i810/i810.h
+++ b/src/legacy/i810/i810.h
@@ -42,7 +42,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "compiler.h"
 #include "xf86Pci.h"
 #include "i810_reg.h"
+#ifdef HAVE_XAA
 #include "xaa.h"
+#endif
 #include "xf86Cursor.h"
 #include "xf86xv.h"
 #include "vbe.h"
@@ -202,7 +204,9 @@ typedef struct _I810Rec {
    I810RegRec SavedReg;
    I810RegRec ModeReg;
 
+#ifdef XAA
    XAAInfoRecPtr AccelInfoRec;
+#endif
    xf86CursorInfoPtr CursorInfoRec;
    CloseScreenProcPtr CloseScreen;
    ScreenBlockHandlerProcPtr BlockHandler;
diff --git a/src/legacy/i810/i810_dga.c b/src/legacy/i810/i810_dga.c
index 336588c..e258360 100644
--- a/src/legacy/i810/i810_dga.c
+++ b/src/legacy/i810/i810_dga.c
@@ -29,8 +29,6 @@
 #include "xf86.h"
 #include "xf86_OSproc.h"
 #include "xf86Pci.h"
-#include "xaa.h"
-#include "xaalocal.h"
 #include "i810.h"
 #include "i810_reg.h"
 #include "dgaproc.h"
@@ -39,11 +37,14 @@
 static Bool I810_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
 				 int *, int *, int *);
 static Bool I810_SetMode(ScrnInfoPtr, DGAModePtr);
-static void I810_Sync(ScrnInfoPtr);
 static int I810_GetViewport(ScrnInfoPtr);
 static void I810_SetViewport(ScrnInfoPtr, int, int, int);
+
+#ifdef HAVE_XAA
+static void I810_Sync(ScrnInfoPtr);
 static void I810_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
 static void I810_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
+#endif
 
 #if 0
 static void I810_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int,
@@ -57,9 +58,15 @@ DGAFunctionRec I810DGAFuncs = {
    I810_SetMode,
    I810_SetViewport,
    I810_GetViewport,
+#ifdef HAVE_XAA
    I810_Sync,
    I810_FillRect,
    I810_BlitRect,
+#else
+   NULL,
+   NULL,
+   NULL,
+#endif
 #if 0
    I810_BlitTransRect
 #else
@@ -186,6 +193,7 @@ I810_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags)
    pI810->DGAViewportStatus = 0;
 }
 
+#ifdef HAVE_XAA
 static void
 I810_FillRect(ScrnInfoPtr pScrn,
 	      int x, int y, int w, int h, unsigned long color)
@@ -226,6 +234,7 @@ I810_BlitRect(ScrnInfoPtr pScrn,
       SET_SYNC_FLAG(pI810->AccelInfoRec);
    }
 }
+#endif
 
 #if 0
 static void
diff --git a/src/legacy/i810/i810_dri.c b/src/legacy/i810/i810_dri.c
index ba11245..0910919 100644
--- a/src/legacy/i810/i810_dri.c
+++ b/src/legacy/i810/i810_dri.c
@@ -1041,8 +1041,10 @@ I810DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
    }
    I810SelectBuffer(pScrn, I810_SELECT_FRONT);
 
+#ifdef HAVE_XAA
    if (pI810->AccelInfoRec)
    	pI810->AccelInfoRec->NeedToSync = TRUE;
+#endif
 }
 
 /* This routine is a modified form of XAADoBitBlt with the calls to
@@ -1201,8 +1203,10 @@ I810DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
       free(pboxNew1);
    }
 
+#ifdef HAVE_XAA
    if (pI810->AccelInfoRec)
 	pI810->AccelInfoRec->NeedToSync = TRUE;
+#endif
 }
 
 
diff --git a/src/legacy/i810/i810_driver.c b/src/legacy/i810/i810_driver.c
index 141c19c..0354a4a 100644
--- a/src/legacy/i810/i810_driver.c
+++ b/src/legacy/i810/i810_driver.c
@@ -68,6 +68,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xf86xv.h"
 #include <X11/extensions/Xv.h>
 #include "vbe.h"
+#include "xf86fbman.h"
 
 #include "i810.h"
 
@@ -1700,6 +1701,7 @@ I810ScreenInit(SCREEN_INIT_ARGS_DECL)
       return FALSE;
    }
 
+#ifdef HAVE_XAA
    if (!xf86ReturnOptValBool(pI810->Options, OPTION_NOACCEL, FALSE)) {
       if (pI810->LpRing->mem.Size != 0) {
 	 I810SetRingRegs(scrn);
@@ -1711,6 +1713,7 @@ I810ScreenInit(SCREEN_INIT_ARGS_DECL)
 	     I810EmitFlush(scrn);
       }
    }
+#endif
 
    miInitializeBackingStore(screen);
    xf86SetBackingStore(screen);
@@ -1938,11 +1941,13 @@ I810LeaveVT(VT_FUNC_ARGS_DECL)
    }
 #endif
 
+#ifdef HAVE_XAA
    if (pI810->AccelInfoRec != NULL) {
       I810RefreshRing(scrn);
       I810Sync(scrn);
       pI810->AccelInfoRec->NeedToSync = FALSE;
    }
+#endif
    I810Restore(scrn);
 
    if (!I810UnbindGARTMemory(scrn))
@@ -1961,14 +1966,18 @@ I810CloseScreen(CLOSE_SCREEN_ARGS_DECL)
    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
    vgaHWPtr hwp = VGAHWPTR(scrn);
    I810Ptr pI810 = I810PTR(scrn);
+#ifdef HAVE_XAA
    XAAInfoRecPtr infoPtr = pI810->AccelInfoRec;
+#endif
 
    if (scrn->vtSema == TRUE) {
+#ifdef HAVE_XAA
       if (pI810->AccelInfoRec != NULL) {
 	 I810RefreshRing(scrn);
 	 I810Sync(scrn);
 	 pI810->AccelInfoRec->NeedToSync = FALSE;
       }
+#endif
       I810Restore(scrn);
       vgaHWLock(hwp);
    }
@@ -1993,12 +2002,14 @@ I810CloseScreen(CLOSE_SCREEN_ARGS_DECL)
       pI810->ScanlineColorExpandBuffers = NULL;
    }
 
+#ifdef HAVE_XAA
    if (infoPtr) {
       if (infoPtr->ScanlineColorExpandBuffers)
 	 free(infoPtr->ScanlineColorExpandBuffers);
       XAADestroyInfoRec(infoPtr);
       pI810->AccelInfoRec = NULL;
    }
+#endif
 
    if (pI810->CursorInfoRec) {
       xf86DestroyCursorInfoRec(pI810->CursorInfoRec);
diff --git a/src/legacy/i810/i810_video.c b/src/legacy/i810/i810_video.c
index 56d04a4..4ebad66 100644
--- a/src/legacy/i810/i810_video.c
+++ b/src/legacy/i810/i810_video.c
@@ -49,8 +49,6 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "i810.h"
 #include "xf86xv.h"
 #include <X11/extensions/Xv.h>
-#include "xaa.h"
-#include "xaalocal.h"
 #include "dixstruct.h"
 #include "fourcc.h"
 
-- 
1.7.10.4




More information about the Intel-gfx mailing list