From 5e96e40232d231c5a106e044e720c5013c3bdc1f Mon Sep 17 00:00:00 2001 From: matthieu Date: Sun, 11 Nov 2012 21:34:15 +0000 Subject: [PATCH] Patch the driver a bit more, to be able to build without XAA. --- driver/xf86-video-openchrome/configure.ac | 21 +++++++++++++++++++ driver/xf86-video-openchrome/src/via_accel.c | 6 ++++++ driver/xf86-video-openchrome/src/via_dga.c | 2 ++ driver/xf86-video-openchrome/src/via_driver.c | 4 ++++ driver/xf86-video-openchrome/src/via_driver.h | 4 ++++ driver/xf86-video-openchrome/src/via_memory.c | 8 +++++-- driver/xf86-video-openchrome/src/via_priv.h | 4 ++++ driver/xf86-video-openchrome/src/via_video.c | 2 ++ 8 files changed, 49 insertions(+), 2 deletions(-) diff --git a/driver/xf86-video-openchrome/configure.ac b/driver/xf86-video-openchrome/configure.ac index 03cd4b072..2ac2495b2 100644 --- a/driver/xf86-video-openchrome/configure.ac +++ b/driver/xf86-video-openchrome/configure.ac @@ -97,6 +97,27 @@ CFLAGS="$XORG_CFLAGS" AC_CHECK_HEADER(xf86Modes.h,[XMODES=yes],[XMODES=no],[#include "xorg-server.h"]) CFLAGS="$save_CFLAGS" +AC_ARG_ENABLE(xaa, + AS_HELP_STRING([--enable-xaa], + [Enable legacy X Acceleration Architecture (XAA) [default=auto]]), + [XAA="$enableval"], + [XAA=auto]) +if test "x$XAA" != xno; then + save_CFLAGS=$CFLAGS + save_CPPFLAGS=$CPPFLAGS + CFLAGS=$XORG_CFLAGS + CPPFLAGS="$XORG_CFLAGS" + AC_CHECK_HEADERS([xaa.h], XAA=yes, XAA=no) + CFLAGS=$save_CFLAGS + CPPFLAGS=$save_CPPFLAGS +fi +AC_MSG_CHECKING([whether to include XAA support]) +AM_CONDITIONAL(XAA, test "x$XAA" = xyes) +if test "x$XAA" = xyes; then + AC_DEFINE(USE_XAA, test "x$XAA" = xyes, [Build support for XAA]) +fi +AC_MSG_RESULT([$XAA]) + AC_CHECK_DECL(XSERVER_LIBPCIACCESS, [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no], [#include "xorg/xorg-server.h"]) diff --git a/driver/xf86-video-openchrome/src/via_accel.c b/driver/xf86-video-openchrome/src/via_accel.c index 28cba70c5..4dee1c9ba 100644 --- a/driver/xf86-video-openchrome/src/via_accel.c +++ b/driver/xf86-video-openchrome/src/via_accel.c @@ -34,7 +34,9 @@ #endif #include +#ifdef USE_XAA #include "xaalocal.h" +#endif #include "miline.h" #include "via.h" @@ -1073,6 +1075,7 @@ viaSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, ADVANCE_RING; } +#ifdef USE_XAA static void viaSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags) @@ -1349,6 +1352,7 @@ viaInitXAA(ScreenPtr pScreen) } +#endif /* * Mark Sync using the 2D blitter for AGP. NoOp for PCI. * In the future one could even launch a NULL PCI DMA command @@ -2594,10 +2598,12 @@ viaExitAccel(ScreenPtr pScreen) pVia->exaDriverPtr = NULL; return; } +#ifdef _USE_XAA if (pVia->AccelInfoRec) { XAADestroyInfoRec(pVia->AccelInfoRec); pVia->AccelInfoRec = NULL; } +#endif } /* diff --git a/driver/xf86-video-openchrome/src/via_dga.c b/driver/xf86-video-openchrome/src/via_dga.c index 6a8729ab5..8fa1b4249 100644 --- a/driver/xf86-video-openchrome/src/via_dga.c +++ b/driver/xf86-video-openchrome/src/via_dga.c @@ -26,7 +26,9 @@ #include "config.h" #endif +#ifdef USE_XAA #include "xaalocal.h" +#endif #include "via_driver.h" #include "dgaproc.h" diff --git a/driver/xf86-video-openchrome/src/via_driver.c b/driver/xf86-video-openchrome/src/via_driver.c index 6bed7ae14..12dd0030e 100644 --- a/driver/xf86-video-openchrome/src/via_driver.c +++ b/driver/xf86-video-openchrome/src/via_driver.c @@ -1218,9 +1218,11 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags) if (!xf86NameCmp(s, "EXA")) { from = X_CONFIG; pVia->useEXA = TRUE; +#ifdef USE_XAA } else if (!xf86NameCmp(s, "XAA")) { from = X_CONFIG; pVia->useEXA = FALSE; +#endif } } xf86DrvMsg(pScrn->scrnIndex, from, @@ -1809,11 +1811,13 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags) VIAFreeRec(pScrn); return FALSE; } +#ifdef USE_XAA } else { if (!xf86LoadSubModule(pScrn, "xaa")) { VIAFreeRec(pScrn); return FALSE; } +#endif } } diff --git a/driver/xf86-video-openchrome/src/via_driver.h b/driver/xf86-video-openchrome/src/via_driver.h index 8a3d97b2e..51f0da8b5 100644 --- a/driver/xf86-video-openchrome/src/via_driver.h +++ b/driver/xf86-video-openchrome/src/via_driver.h @@ -61,7 +61,9 @@ #include "xf86cmap.h" #include "vbe.h" +#ifdef USE_XAA #include "xaa.h" +#endif #include "compat-api.h" #include "via_regs.h" @@ -274,7 +276,9 @@ typedef struct _VIA { void (*PointerMoved)(int index, int x, int y); /* Support for XAA acceleration */ +#ifdef USE_XAA XAAInfoRecPtr AccelInfoRec; +#endif ViaTwodContext td; Via3DState v3d; Via3DState *lastToUpload; diff --git a/driver/xf86-video-openchrome/src/via_memory.c b/driver/xf86-video-openchrome/src/via_memory.c index d6fba3fe7..2b53e326e 100644 --- a/driver/xf86-video-openchrome/src/via_memory.c +++ b/driver/xf86-video-openchrome/src/via_memory.c @@ -74,14 +74,18 @@ VIAFreeLinear(VIAMemPtr mem) if (pVia->useEXA && !pVia->NoAccel) { exaOffscreenFree(mem->pScrn->pScreen, mem->exa); +#ifdef USE_XAA mem->linear = NULL; +#endif mem->pool = 0; return; } } +#ifdef USE_XAA xf86FreeOffscreenLinear(mem->linear); mem->linear = NULL; mem->pool = 0; +#endif return; case 2: #ifdef OPENCHROMEDRI @@ -93,7 +97,6 @@ VIAFreeLinear(VIAMemPtr mem) return; } } - int viaOffScreenLinear(VIAMemPtr mem, ScrnInfoPtr pScrn, unsigned long size) { @@ -113,7 +116,7 @@ viaOffScreenLinear(VIAMemPtr mem, ScrnInfoPtr pScrn, unsigned long size) mem->pScrn = pScrn; return Success; } - +#ifdef USE_XAA mem->linear = xf86AllocateOffscreenLinear(pScrn->pScreen, (size + depth - 1) / depth, 32, NULL, NULL, NULL); @@ -122,6 +125,7 @@ viaOffScreenLinear(VIAMemPtr mem, ScrnInfoPtr pScrn, unsigned long size) mem->base = mem->linear->offset * depth; mem->pool = 1; mem->pScrn = pScrn; +#endif return Success; } diff --git a/driver/xf86-video-openchrome/src/via_priv.h b/driver/xf86-video-openchrome/src/via_priv.h index 6451307e4..5090f09ec 100644 --- a/driver/xf86-video-openchrome/src/via_priv.h +++ b/driver/xf86-video-openchrome/src/via_priv.h @@ -144,7 +144,9 @@ typedef struct { drm_via_mem_t drm; /* DRM management object */ #endif void *pVia; /* VIA driver pointer */ +#ifdef USE_XAA FBLinearPtr linear; /* X linear pool info ptr */ +#endif ExaOffscreenArea *exa; ScrnInfoPtr pScrn; } VIAMem; @@ -172,7 +174,9 @@ typedef struct { OVERLAYRECORD overlayRecordV3; BoxRec AvailFBArea; +#ifdef USE_XAA FBLinearPtr SWOVlinear; +#endif Bool MPEG_ON; Bool SWVideo_ON; diff --git a/driver/xf86-video-openchrome/src/via_video.c b/driver/xf86-video-openchrome/src/via_video.c index 5bcbd1c14..6b896a017 100644 --- a/driver/xf86-video-openchrome/src/via_video.c +++ b/driver/xf86-video-openchrome/src/via_video.c @@ -49,8 +49,10 @@ #include "xf86xv.h" #include +#ifdef USE_XAA #include "xaa.h" #include "xaalocal.h" +#endif USE_XAA #include "dixstruct.h" #include "via_xvpriv.h" #include "via_swov.h"