xf86-video-nv: configure.ac src/g80_driver.c src/g80_type.h src/g80_xaa.c src/nv_dga.c src/nv_driver.c src/nv_include.h src/nv_type.h src/nv_video.c src/nv_xaa.c src/riva_dga.c src/riva_driver.c src/riva_include.h src/riva_type.h src/riva_xaa.c

Dave Airlie airlied at kemper.freedesktop.org
Mon Jul 16 01:49:04 PDT 2012


 configure.ac       |   18 ++++++++++++++++++
 src/g80_driver.c   |   15 +++++++++++++--
 src/g80_type.h     |    7 ++++++-
 src/g80_xaa.c      |    7 ++++++-
 src/nv_dga.c       |   13 ++++++++++++-
 src/nv_driver.c    |    2 ++
 src/nv_include.h   |    2 ++
 src/nv_type.h      |    4 ++--
 src/nv_video.c     |    5 ++---
 src/nv_xaa.c       |    9 ++++++++-
 src/riva_dga.c     |   14 ++++++++++++--
 src/riva_driver.c  |    2 ++
 src/riva_include.h |    2 ++
 src/riva_type.h    |    4 ++++
 src/riva_xaa.c     |   15 ++++++++++++---
 15 files changed, 103 insertions(+), 16 deletions(-)

New commits:
commit e5e3e733d933fc3accdd6c3c7a02df5950530cae
Author: Dave Airlie <airlied at gmail.com>
Date:   Mon Jul 16 18:48:32 2012 +1000

    nv: make XAA optional.
    
    This allows nv to build without XAA.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/configure.ac b/configure.ac
index cf1a4cb..05d34f9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,6 +84,24 @@ fi
 
 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)
+AC_MSG_RESULT([$XAA])
+
 # Substitutions
 AC_SUBST([moduledir])
 
diff --git a/src/g80_driver.c b/src/g80_driver.c
index c666977..cc4e197 100644
--- a/src/g80_driver.c
+++ b/src/g80_driver.c
@@ -107,7 +107,11 @@ G80ResizeScreen(ScrnInfoPtr pScrn, int width, int height)
     pScrn->virtualY = height;
 
     /* Can resize if XAA is disabled or EXA is enabled */
-    if(!pNv->xaa || pNv->exa) {
+    if(
+#ifdef HAVE_XAA_H
+       !pNv->xaa ||
+#endif
+       pNv->exa) {
         (*pScrn->pScreen->GetScreenPixmap)(pScrn->pScreen)->devKind = pitch;
         pScrn->displayWidth = pitch / (pScrn->bitsPerPixel / 8);
 
@@ -503,8 +507,10 @@ G80CloseScreen(CLOSE_SCREEN_ARGS_DECL)
     if(pScrn->vtSema)
         ReleaseDisplay(pScrn);
 
+#ifdef HAVE_XAA_H
     if(pNv->xaa)
         XAADestroyInfoRec(pNv->xaa);
+#endif
     if(pNv->exa) {
         if(pNv->exaScreenArea) {
             exaOffscreenFree(pScreen, pNv->exaScreenArea);
@@ -850,6 +856,7 @@ G80ScreenInit(SCREEN_INIT_ARGS_DECL)
 
     xf86DPMSInit(pScreen, xf86DPMSSet, 0);
 
+#ifdef HAVE_XAA_H
     /* Clear the screen */
     if(pNv->xaa) {
         /* Use the acceleration engine */
@@ -857,7 +864,9 @@ G80ScreenInit(SCREEN_INIT_ARGS_DECL)
         pNv->xaa->SubsequentSolidFillRect(pScrn,
             0, 0, pScrn->displayWidth, pNv->offscreenHeight);
         G80DmaKickoff(pNv);
-    } else {
+    } else
+#endif
+    {
         /* Use a slow software clear path */
         memset(pNv->mem, 0, pitch * pNv->offscreenHeight);
     }
@@ -910,8 +919,10 @@ G80EnterVT(VT_FUNC_ARGS_DECL)
     G80Ptr pNv = G80PTR(pScrn);
 
     /* Reinit the hardware */
+#ifdef HAVE_XAA_H
     if(pNv->xaa)
         G80InitHW(pScrn);
+#endif
 
     if(!AcquireDisplay(pScrn))
         return FALSE;
diff --git a/src/g80_type.h b/src/g80_type.h
index e313b45..f4b73a3 100644
--- a/src/g80_type.h
+++ b/src/g80_type.h
@@ -1,4 +1,3 @@
-#include <xaa.h>
 #include <exa.h>
 #include <xf86.h>
 #include <xf86int10.h>
@@ -6,6 +5,10 @@
 #include <xf86DDC.h>
 #include <xf86Crtc.h>
 
+#ifdef HAVE_XAA_H
+#include <xaa.h>
+#endif
+#include <xf86fbman.h>
 #include "compat-api.h"
 #define G80_NUM_I2C_PORTS 10
 
@@ -73,7 +76,9 @@ typedef struct G80Rec {
     Bool                AllowDualLink;
 
     /* XAA */
+#ifdef HAVE_XAA_H
     XAAInfoRecPtr       xaa;
+#endif
     CARD32              currentRop;
 
     /* EXA */
diff --git a/src/g80_xaa.c b/src/g80_xaa.c
index a8ae4ae..f7276f2 100644
--- a/src/g80_xaa.c
+++ b/src/g80_xaa.c
@@ -105,6 +105,7 @@ G80SetClip(G80Ptr pNv, int x, int y, int w, int h)
     G80DmaNext (pNv, h);
 }
 
+#ifdef HAVE_XAA_H
 /* Screen to screen copies */
 
 static void
@@ -481,11 +482,12 @@ G80DisableClipping(ScrnInfoPtr pScrn)
 
     G80SetClip(pNv, 0, 0, 0x7fff, 0x7fff);
 }
-
+#endif
 
 Bool
 G80XAAInit(ScreenPtr pScreen)
 {
+#ifdef HAVE_XAA_H
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     G80Ptr pNv = G80PTR(pScrn);
     XAAInfoRecPtr xaa;
@@ -551,4 +553,7 @@ G80XAAInit(ScreenPtr pScreen)
     miSetZeroLineBias(pScreen, OCTANT1 | OCTANT3 | OCTANT4 | OCTANT6);
 
     return XAAInit(pScreen, xaa);
+#else
+    return FALSE;
+#endif
 }
diff --git a/src/nv_dga.c b/src/nv_dga.c
index 76e5e28..3c9ad11 100644
--- a/src/nv_dga.c
+++ b/src/nv_dga.c
@@ -6,7 +6,9 @@
 #include "nv_include.h"
 #include "nv_type.h"
 #include "nv_proto.h"
+#ifdef HAVE_XAA_H
 #include "xaalocal.h"
+#endif
 #include "dgaproc.h"
 
 
@@ -15,10 +17,12 @@ static Bool NV_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
 static Bool NV_SetMode(ScrnInfoPtr, DGAModePtr);
 static int  NV_GetViewport(ScrnInfoPtr);
 static void NV_SetViewport(ScrnInfoPtr, int, int, int);
+#ifdef HAVE_XAA_H
 static void NV_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
 static void NV_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
 static void NV_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, 
 					unsigned long);
+#endif
 
 static
 DGAFunctionRec NV_DGAFuncs = {
@@ -28,9 +32,13 @@ DGAFunctionRec NV_DGAFuncs = {
    NV_SetViewport,
    NV_GetViewport,
    NVSync,
+#ifdef HAVE_XAA_H
    NV_FillRect,
    NV_BlitRect,
    NV_BlitTransRect
+#else
+   NULL, NULL, NULL
+#endif
 };
 
 
@@ -80,8 +88,10 @@ SECOND_PASS:
 
 	    if(pixmap)
 		mode->flags |= DGA_PIXMAP_AVAILABLE;
+#ifdef HAVE_XAA_H
 	    if(!pNv->NoAccel)
 		mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
+#endif
 	    if(pMode->Flags & V_DBLSCAN)
 		mode->flags |= DGA_DOUBLESCAN;
 	    if(pMode->Flags & V_INTERLACE)
@@ -242,6 +252,7 @@ NV_SetViewport(
    pNv->DGAViewportStatus = 0;  
 }
 
+#ifdef HAVE_XAA_H
 static void 
 NV_FillRect (
    ScrnInfoPtr pScrn, 
@@ -291,7 +302,7 @@ NV_BlitTransRect(
 ){
    /* not implemented */
 }
-
+#endif
 
 static Bool 
 NV_OpenFramebuffer(
diff --git a/src/nv_driver.c b/src/nv_driver.c
index 5e5c1d6..6dad6e5 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -1215,8 +1215,10 @@ NVCloseScreen(CLOSE_SCREEN_ARGS_DECL)
 
     NVUnmapMem(pScrn);
     vgaHWUnmapMem(pScrn);
+#ifdef HAVE_XAA_H
     if (pNv->AccelInfoRec)
         XAADestroyInfoRec(pNv->AccelInfoRec);
+#endif
     if (pNv->CursorInfoRec)
         xf86DestroyCursorInfoRec(pNv->CursorInfoRec);
     if (pNv->ShadowPtr)
diff --git a/src/nv_include.h b/src/nv_include.h
index a40bc7b..9ae1aaa 100644
--- a/src/nv_include.h
+++ b/src/nv_include.h
@@ -40,7 +40,9 @@
 
 #include "fb.h"
 
+#ifdef HAVE_XAA_H
 #include "xaa.h"
+#endif
 #include "xf86cmap.h"
 #include "shadowfb.h"
 #include "fbdevhw.h"
diff --git a/src/nv_type.h b/src/nv_type.h
index f7a32a0..65a6a55 100644
--- a/src/nv_type.h
+++ b/src/nv_type.h
@@ -3,7 +3,6 @@
 
 #include "colormapst.h"
 #include "vgaHW.h"
-#include "xaa.h"
 #include "xf86Cursor.h"
 #include "xf86int10.h"
 
@@ -126,8 +125,9 @@ typedef struct {
     volatile U008 *PDIO0;
     volatile U008 *PDIO;
     volatile U032 *PRAMDAC;
-
+#ifdef HAVE_XAA_H
     XAAInfoRecPtr       AccelInfoRec;
+#endif
     xf86CursorInfoPtr   CursorInfoRec;
     DGAModePtr          DGAModes;
     int                 numDGAModes;
diff --git a/src/nv_video.c b/src/nv_video.c
index 52d651b..0988b0e 100644
--- a/src/nv_video.c
+++ b/src/nv_video.c
@@ -12,8 +12,6 @@
 
 #include "xf86xv.h"
 #include <X11/extensions/Xv.h>
-#include "xaa.h"
-#include "xaalocal.h"
 #include "dixstruct.h"
 #include "fourcc.h"
 
@@ -631,8 +629,9 @@ NVPutBlitImage (
     }
 
     NVDmaKickoff(pNv);
+#ifdef HAVE_XAA_H
     SET_SYNC_FLAG(pNv->AccelInfoRec);
-
+#endif
     pPriv->videoStatus = FREE_TIMER;
     pPriv->videoTime = currentTime.milliseconds + FREE_DELAY;
     pNv->VideoTimerCallback = NVVideoTimerCallback;
diff --git a/src/nv_xaa.c b/src/nv_xaa.c
index c179f1f..bf2b4d2 100644
--- a/src/nv_xaa.c
+++ b/src/nv_xaa.c
@@ -26,7 +26,9 @@
 #endif
 
 #include "nv_include.h"
+#ifdef HAVE_XAA_H
 #include "xaalocal.h"
+#endif
 #include "miline.h"
 #include "nv_dma.h"
 
@@ -298,7 +300,7 @@ NVDMAKickoffCallback (ScrnInfoPtr pScrn)
    pNv->DMAKickoffCallback = NULL;
 }
 
-
+#ifdef HAVE_XAA_H
 static void
 NVSetupForScreenToScreenCopy(
    ScrnInfoPtr pScrn, 
@@ -646,11 +648,13 @@ NVDisableClipping(ScrnInfoPtr pScrn)
     NVDmaNext (pNv, 0x7FFF7FFF);
 }
 
+#endif
 
 /* Initialize XAA acceleration info */
 Bool
 NVAccelInit(ScreenPtr pScreen) 
 {
+#ifdef HAVE_XAA_H
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    NVPtr pNv = NVPTR(pScrn);
    XAAInfoRecPtr accel;
@@ -710,4 +714,7 @@ NVAccelInit(ScreenPtr pScreen)
    miSetZeroLineBias(pScreen, OCTANT1 | OCTANT3 | OCTANT4 | OCTANT6);
 
    return (XAAInit(pScreen, accel));
+#else
+   return FALSE;
+#endif
 }
diff --git a/src/riva_dga.c b/src/riva_dga.c
index 8dc8c72..cbad39f 100644
--- a/src/riva_dga.c
+++ b/src/riva_dga.c
@@ -6,19 +6,22 @@
 #include "riva_include.h"
 #include "riva_type.h"
 #include "riva_proto.h"
+#ifdef HAVE_XAA_H
 #include "xaalocal.h"
+#endif
 #include "dgaproc.h"
 
-
 static Bool Riva_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, 
 					int *, int *, int *);
 static Bool Riva_SetMode(ScrnInfoPtr, DGAModePtr);
 static int  Riva_GetViewport(ScrnInfoPtr);
 static void Riva_SetViewport(ScrnInfoPtr, int, int, int);
+#ifdef HAVE_XAA_H
 static void Riva_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
 static void Riva_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
 static void Riva_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, 
 					unsigned long);
+#endif
 
 static
 DGAFunctionRec Riva_DGAFuncs = {
@@ -28,9 +31,13 @@ DGAFunctionRec Riva_DGAFuncs = {
    Riva_SetViewport,
    Riva_GetViewport,
    RivaSync,
+#ifdef HAVE_XAA_H
    Riva_FillRect,
    Riva_BlitRect,
    Riva_BlitTransRect
+#else
+   NULL, NULL, NULL
+#endif
 };
 
 
@@ -80,8 +87,10 @@ SECOND_PASS:
 
 	    if(pixmap)
 		mode->flags |= DGA_PIXMAP_AVAILABLE;
+#ifdef HAVE_XAA_H
 	    if(!pRiva->NoAccel)
 		mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
+#endif
 	    if(pMode->Flags & V_DBLSCAN)
 		mode->flags |= DGA_DOUBLESCAN;
 	    if(pMode->Flags & V_INTERLACE)
@@ -235,6 +244,7 @@ Riva_SetViewport(
    pRiva->DGAViewportStatus = 0;  
 }
 
+#ifdef HAVE_XAA_H
 static void 
 Riva_FillRect (
    ScrnInfoPtr pScrn, 
@@ -284,7 +294,7 @@ Riva_BlitTransRect(
 ){
    /* not implemented... yet */
 }
-
+#endif
 
 static Bool 
 Riva_OpenFramebuffer(
diff --git a/src/riva_driver.c b/src/riva_driver.c
index b429464..e0667ef 100644
--- a/src/riva_driver.c
+++ b/src/riva_driver.c
@@ -257,8 +257,10 @@ RivaCloseScreen(CLOSE_SCREEN_ARGS_DECL)
 
     RivaUnmapMem(pScrn);
     vgaHWUnmapMem(pScrn);
+#ifdef HAVE_XAA_H
     if (pRiva->AccelInfoRec)
         XAADestroyInfoRec(pRiva->AccelInfoRec);
+#endif
     if (pRiva->CursorInfoRec)
         xf86DestroyCursorInfoRec(pRiva->CursorInfoRec);
     if (pRiva->ShadowPtr)
diff --git a/src/riva_include.h b/src/riva_include.h
index a381e60..4db9577 100644
--- a/src/riva_include.h
+++ b/src/riva_include.h
@@ -39,7 +39,9 @@
 
 #include "fb.h"
 
+#ifdef HAVE_XAA_H
 #include "xaa.h"
+#endif
 #include "xf86cmap.h"
 #include "shadowfb.h"
 #include "fbdevhw.h"
diff --git a/src/riva_type.h b/src/riva_type.h
index 9f0c808..4adeb2b 100644
--- a/src/riva_type.h
+++ b/src/riva_type.h
@@ -4,7 +4,9 @@
 #include "riva_hw.h"
 #include "colormapst.h"
 #include "vgaHW.h"
+#ifdef HAVE_XAA_H
 #include "xaa.h"
+#endif
 #include "xf86Cursor.h"
 #include "xf86int10.h"
 
@@ -77,7 +79,9 @@ typedef struct {
     int                 ShadowPitch;
     int                 MinClock;
     int                 MaxClock;
+#ifdef HAVE_XAA_H
     XAAInfoRecPtr       AccelInfoRec;
+#endif
     xf86CursorInfoPtr   CursorInfoRec;
     DGAModePtr          DGAModes;
     int                 numDGAModes;
diff --git a/src/riva_xaa.c b/src/riva_xaa.c
index ac0a830..3139d07 100644
--- a/src/riva_xaa.c
+++ b/src/riva_xaa.c
@@ -29,9 +29,10 @@
 #endif
 
 #include "riva_include.h"
+#ifdef HAVE_XAA_H
 #include "xaalocal.h"
+#endif
 #include "xaarop.h"
-
 #include "miline.h"
 
 static void
@@ -78,7 +79,9 @@ RivaSetRopSolid(RivaPtr pRiva, int rop)
             RivaSetPattern(pRiva, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
         pRiva->currentRop = rop;
         RIVA_FIFO_FREE(pRiva->riva, Rop, 1);
+#ifdef HAVE_XAA_H
         pRiva->riva.Rop->Rop3 = XAAGetCopyROP(rop);
+#endif
     }
 }
 
@@ -91,7 +94,7 @@ RivaSetRopPattern(RivaPtr pRiva, int rop)
         pRiva->riva.Rop->Rop3 = XAAGetPatternROP(rop);
     }
 }
-
+#ifdef HAVE_XAA_H
 /*
  * Fill solid rectangles.
  */
@@ -192,7 +195,7 @@ RivaSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
     pRiva->riva.Bitmap->UnclippedRectangle[0].WidthHeight = (w << 16) | h;
     write_mem_barrier();
 }
-
+#endif
 
 void
 RivaResetGraphics(ScrnInfoPtr pScrn)
@@ -220,6 +223,7 @@ void RivaSync(ScrnInfoPtr pScrn)
     RIVA_BUSY(pRiva->riva);
 }
 
+#ifdef HAVE_XAA_H
 /* Color expansion */
 static void
 RivaSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
@@ -451,11 +455,13 @@ RivaValidatePolyPoint(
    if(pGC->alu != GXcopy)
         pGC->ops->PolyPoint = miPolyPoint;
 }
+#endif
 
 /* Initialize XAA acceleration info */
 Bool
 RivaAccelInit(ScreenPtr pScreen) 
 {
+#ifdef HAVE_XAA_H
     XAAInfoRecPtr infoPtr;
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     RivaPtr pRiva = RivaPTR(pScrn);
@@ -536,4 +542,7 @@ RivaAccelInit(ScreenPtr pScreen)
     RivaResetGraphics(pScrn);
 
     return(XAAInit(pScreen, infoPtr));
+#else
+    return FALSE;
+#endif
 }


More information about the xorg-commit mailing list