[PATCH xf86-video-r128] Untangle XF86DRI from the driver-specific DRI define

Peter Hutterer peter.hutterer at who-t.net
Mon Jan 16 21:35:38 PST 2012


XF86DRI is defined by xorg-server.h, so --disable-dri in the driver
itself does exactly nothing other than not fill in the CFLAGS and thus stop
the driver from compiling.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 configure.ac      |    4 ++--
 src/r128.h        |   14 +++++++++-----
 src/r128_accel.c  |   18 +++++++++---------
 src/r128_dga.c    |   10 +++++-----
 src/r128_driver.c |   32 ++++++++++++++++----------------
 src/r128_video.c  |    8 ++++----
 6 files changed, 45 insertions(+), 41 deletions(-)

diff --git a/configure.ac b/configure.ac
index d5a0821..4ba44db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,8 +106,8 @@ AC_MSG_RESULT([$DRI])
 AM_CONDITIONAL(DRI, test x$DRI = xyes)
 if test "$DRI" = yes; then
 	PKG_CHECK_MODULES(DRI, [libdrm >= 2.2 xf86driproto])
-        AC_DEFINE(XF86DRI,1,[Enable DRI driver support])
-        AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
+        AC_DEFINE(R128DRI,1,[Enable DRI driver support])
+        AC_DEFINE(R128DRI_DEVEL,1,[Enable developmental DRI driver support])
 fi
 
 SAVE_CPPFLAGS="$CPPFLAGS"
diff --git a/src/r128.h b/src/r128.h
index 1205245..fcef00c 100644
--- a/src/r128.h
+++ b/src/r128.h
@@ -56,7 +56,11 @@
 #include "r128_probe.h"
 
 				/* DRI support */
-#ifdef XF86DRI
+#ifndef XF86DRI
+#undef R128DRI
+#endif
+
+#if R128DRI
 #define _XF86DRI_SERVER_
 #include "r128_dripriv.h"
 #include "dri.h"
@@ -303,14 +307,14 @@ typedef struct {
     int               scanline_y;
     int               scanline_w;
     int               scanline_h;
-#ifdef XF86DRI
+#ifdef R128DRI
     int               scanline_hpass;
     int               scanline_x1clip;
     int               scanline_x2clip;
     int               scanline_rop;
     int               scanline_fg;
     int               scanline_bg;
-#endif /* XF86DRI */
+#endif /* R128DRI */
     int               scanline_words;
     int               scanline_direct;
     int               scanline_bpp; /* Only used for ImageWrite */
@@ -322,7 +326,7 @@ typedef struct {
     DGAFunctionRec    DGAFuncs;
 
     R128FBLayout      CurrentLayout;
-#ifdef XF86DRI
+#ifdef R128DRI
     Bool              directRenderingEnabled;
     DRIInfoPtr        pDRIInfo;
     int               drmFD;
@@ -474,7 +478,7 @@ extern int         R128MinBits(int val);
 
 extern void        R128InitVideo(ScreenPtr pScreen);
 
-#ifdef XF86DRI
+#ifdef R128DRI
 extern Bool        R128DRIScreenInit(ScreenPtr pScreen);
 extern void        R128DRICloseScreen(ScreenPtr pScreen);
 extern Bool        R128DRIFinishScreenInit(ScreenPtr pScreen);
diff --git a/src/r128_accel.c b/src/r128_accel.c
index e383cfa..056b0b3 100644
--- a/src/r128_accel.c
+++ b/src/r128_accel.c
@@ -88,7 +88,7 @@
 #include "r128.h"
 #include "r128_reg.h"
 #include "r128_probe.h"
-#ifdef XF86DRI
+#ifdef R128DRI
 #include "r128_sarea.h"
 #define _XF86DRI_SERVER_
 #include "r128_dri.h"
@@ -187,7 +187,7 @@ void R128WaitForFifoFunction(ScrnInfoPtr pScrn, int entries)
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		   "FIFO timed out, resetting engine...\n");
 	R128EngineReset(pScrn);
-#ifdef XF86DRI
+#ifdef R128DRI
 	R128CCE_RESET(pScrn, info);
 	if (info->directRenderingEnabled) {
 	    R128CCE_START(pScrn, info);
@@ -220,11 +220,11 @@ void R128WaitForIdle(ScrnInfoPtr pScrn)
 		   INREG(R128_GUI_PROBE)));
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		   "Idle timed out, resetting engine...\n");
-#ifdef XF86DRI
+#ifdef R128DRI
         R128CCE_STOP(pScrn, info);
 #endif
 	R128EngineReset(pScrn);
-#ifdef XF86DRI
+#ifdef R128DRI
 	R128CCE_RESET(pScrn, info);
 	if (info->directRenderingEnabled) {
 	    R128CCE_START(pScrn, info);
@@ -233,7 +233,7 @@ void R128WaitForIdle(ScrnInfoPtr pScrn)
     }
 }
 
-#ifdef XF86DRI
+#ifdef R128DRI
 /* Wait until the CCE is completely idle: the FIFO has drained and the
  * CCE is idle.
  */
@@ -1069,7 +1069,7 @@ void R128EngineInit(ScrnInfoPtr pScrn)
     /* FIXME: this is a kludge for texture uploads in the 3D driver. Look at
      * how the radeon driver handles HOST_DATA_SWAP if you want to implement
      * CCE ImageWrite acceleration or anything needing this bit */
-#ifdef XF86DRI
+#ifdef R128DRI
     if (info->directRenderingEnabled)
 	OUTREGP(R128_DP_DATATYPE, 0, ~R128_HOST_BIG_ENDIAN_EN);
     else
@@ -1080,7 +1080,7 @@ void R128EngineInit(ScrnInfoPtr pScrn)
     OUTREGP(R128_DP_DATATYPE, 0, ~R128_HOST_BIG_ENDIAN_EN);
 #endif
 
-#ifdef XF86DRI
+#ifdef R128DRI
     info->sc_left         = 0x00000000;
     info->sc_right        = R128_DEFAULT_SC_RIGHT_MAX;
     info->sc_top          = 0x00000000;
@@ -1096,7 +1096,7 @@ void R128EngineInit(ScrnInfoPtr pScrn)
     R128WaitForIdle(pScrn);
 }
 
-#ifdef XF86DRI
+#ifdef R128DRI
 
 /* Setup for XAA SolidFill. */
 static void R128CCESetupForSolidFill(ScrnInfoPtr pScrn,
@@ -1871,7 +1871,7 @@ Bool R128AccelInit(ScreenPtr pScreen)
 
     if (!(a = info->accel = XAACreateInfoRec())) return FALSE;
 
-#ifdef XF86DRI
+#ifdef R128DRI
     if (info->directRenderingEnabled)
 	R128CCEAccelInit(pScrn, a);
     else
diff --git a/src/r128_dga.c b/src/r128_dga.c
index 1e493ee..1c8a8dd 100644
--- a/src/r128_dga.c
+++ b/src/r128_dga.c
@@ -20,7 +20,7 @@
 				/* DGA support */
 #include "dgaproc.h"
 
-#ifdef XF86DRI
+#ifdef R128DRI
 #include "r128_common.h"
 #endif
 
@@ -244,14 +244,14 @@ R128_SetMode(
 	pScrn->currentMode = info->CurrentLayout.mode;
 
 	pScrn->SwitchMode(indx, pScrn->currentMode, 0);
-#ifdef XF86DRI
+#ifdef R128DRI
 	if (info->directRenderingEnabled) {
 	    R128CCE_STOP(pScrn, info);
 	}
 #endif
 	if (info->accelOn)
 	    R128EngineInit(pScrn);
-#ifdef XF86DRI
+#ifdef R128DRI
 	if (info->directRenderingEnabled) {
 	    R128CCE_START(pScrn, info);
 	}
@@ -276,14 +276,14 @@ R128_SetMode(
 
 	pScrn->SwitchMode(indx, pMode->mode, 0);
 
-#ifdef XF86DRI
+#ifdef R128DRI
 	if (info->directRenderingEnabled) {
 	    R128CCE_STOP(pScrn, info);
 	}
 #endif
 	if (info->accelOn)
 		R128EngineInit(pScrn);
-#ifdef XF86DRI
+#ifdef R128DRI
 	if (info->directRenderingEnabled) {
 	    R128CCE_START(pScrn, info);
 	}
diff --git a/src/r128_driver.c b/src/r128_driver.c
index 4887727..dc83076 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -71,7 +71,7 @@
 #include "r128_reg.h"
 #include "r128_version.h"
 
-#ifdef XF86DRI
+#ifdef R128DRI
 #define _XF86DRI_SERVER_
 #include "r128_dri.h"
 #include "r128_common.h"
@@ -133,7 +133,7 @@ typedef enum {
   OPTION_SW_CURSOR,
   OPTION_DAC_6BIT,
   OPTION_DAC_8BIT,
-#ifdef XF86DRI
+#ifdef R128DRI
   OPTION_XV_DMA,
   OPTION_IS_PCI,
   OPTION_CCE_PIO,
@@ -164,7 +164,7 @@ static const OptionInfoRec R128Options[] = {
   { OPTION_SW_CURSOR,    "SWcursor",         OPTV_BOOLEAN, {0}, FALSE },
   { OPTION_DAC_6BIT,     "Dac6Bit",          OPTV_BOOLEAN, {0}, FALSE },
   { OPTION_DAC_8BIT,     "Dac8Bit",          OPTV_BOOLEAN, {0}, TRUE  },
-#ifdef XF86DRI
+#ifdef R128DRI
   { OPTION_XV_DMA,       "DMAForXv",         OPTV_BOOLEAN, {0}, FALSE },
   { OPTION_IS_PCI,       "ForcePCIMode",     OPTV_BOOLEAN, {0}, FALSE },
   { OPTION_CCE_PIO,      "CCEPIOMode",       OPTV_BOOLEAN, {0}, FALSE },
@@ -1175,7 +1175,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
 	}
     }
 
-#ifdef XF86DRI
+#ifdef R128DRI
 				/* DMA for Xv */
     info->DMAForXv = xf86ReturnOptValBool(info->Options, OPTION_XV_DMA, FALSE);
     if (info->DMAForXv) {
@@ -1766,7 +1766,7 @@ static Bool R128PreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10)
     return TRUE;
 }
 
-#ifdef XF86DRI
+#ifdef R128DRI
 static Bool R128PreInitDRI(ScrnInfoPtr pScrn)
 {
     R128InfoPtr   info = R128PTR(pScrn);
@@ -2065,7 +2065,7 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
 
     if (!R128PreInitCursor(pScrn))             goto fail;
 
-#ifdef XF86DRI
+#ifdef R128DRI
     if (!R128PreInitDRI(pScrn))                goto fail;
 #endif
 
@@ -2171,7 +2171,7 @@ R128BlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
     ScrnInfoPtr pScrn   = xf86Screens[i];
     R128InfoPtr info    = R128PTR(pScrn);
 
-#ifdef XF86DRI
+#ifdef R128DRI
     if (info->directRenderingEnabled)
         FLUSH_RING();
 #endif
@@ -2197,7 +2197,7 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
 
     R128TRACE(("R128ScreenInit %x %d\n", pScrn->memPhysBase, pScrn->fbOffset));
 
-#ifdef XF86DRI
+#ifdef R128DRI
 				/* Turn off the CCE for now. */
     info->CCEInUse     = FALSE;
     info->indirectBuffer = NULL;
@@ -2206,7 +2206,7 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
     if (!R128MapMem(pScrn)) return FALSE;
     pScrn->fbOffset    = 0;
     if(info->IsSecondary) pScrn->fbOffset = pScrn->videoRam * 1024;
-#ifdef XF86DRI
+#ifdef R128DRI
     info->fbX          = 0;
     info->fbY          = 0;
     info->frontOffset  = 0;
@@ -2235,7 +2235,7 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
 
     noAccel = xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE);
 
-#ifdef XF86DRI
+#ifdef R128DRI
 				/* Setup DRI after visuals have been
 				   established, but before fbScreenInit is
 				   called.  fbScreenInit will eventually
@@ -2320,7 +2320,7 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
     fbPictureInit (pScreen, 0, 0);
 
 				/* Memory manager setup */
-#ifdef XF86DRI
+#ifdef R128DRI
     if (info->directRenderingEnabled) {
 	FBAreaPtr fbarea;
 	int width_bytes = (pScrn->displayWidth *
@@ -2622,7 +2622,7 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
     if (serverGeneration == 1)
 	xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
 
-#ifdef XF86DRI
+#ifdef R128DRI
 				/* DRI finalization */
     if (info->directRenderingEnabled) {
 				/* Now that mi, fb, drm and others have
@@ -3351,7 +3351,7 @@ static void R128InitCommonRegisters(R128SavePtr save, R128InfoPtr info)
     save->subpic_cntl        = 0;
     save->viph_control       = 0;
     save->i2c_cntl_1         = 0;
-#ifdef XF86DRI
+#ifdef R128DRI
     save->gen_int_cntl       = info->gen_int_cntl;
 #else
     save->gen_int_cntl       = 0;
@@ -4234,7 +4234,7 @@ Bool R128EnterVT(int scrnIndex, int flags)
     if (info->accelOn)
 	R128EngineInit(pScrn);
 
-#ifdef XF86DRI
+#ifdef R128DRI
     if (info->directRenderingEnabled) {
 	if (info->irq) {
 	    /* Need to make sure interrupts are enabled */
@@ -4261,7 +4261,7 @@ void R128LeaveVT(int scrnIndex, int flags)
     R128SavePtr save  = &info->ModeReg;
 
     R128TRACE(("R128LeaveVT\n"));
-#ifdef XF86DRI
+#ifdef R128DRI
     if (info->directRenderingEnabled) {
 	DRILock(pScrn->pScreen, 0);
 	R128CCE_STOP(pScrn, info);
@@ -4286,7 +4286,7 @@ static Bool R128CloseScreen(int scrnIndex, ScreenPtr pScreen)
 
     R128TRACE(("R128CloseScreen\n"));
 
-#ifdef XF86DRI
+#ifdef R128DRI
 				/* Disable direct rendering */
     if (info->directRenderingEnabled) {
 	R128DRICloseScreen(pScreen);
diff --git a/src/r128_video.c b/src/r128_video.c
index ec22ee1..11bb9bd 100644
--- a/src/r128_video.c
+++ b/src/r128_video.c
@@ -8,7 +8,7 @@
 #include "r128.h"
 #include "r128_reg.h"
 
-#ifdef XF86DRI
+#ifdef R128DRI
 #include "r128_common.h"
 #include "r128_sarea.h"
 #endif
@@ -392,7 +392,7 @@ R128DMA(
   int w
 ){
 
-#ifdef XF86DRI
+#ifdef R128DRI
 
 #define BUFSIZE (R128_BUFFER_SIZE - R128_HOSTDATA_BLIT_OFFSET)
 #define MAXPASSES (MAXHEIGHT/(BUFSIZE/(MAXWIDTH*2))+1)
@@ -481,10 +481,10 @@ R128DMA(
 
 #else
 
-    /* This is to avoid cluttering the rest of the code with '#ifdef XF86DRI' */
+    /* This is to avoid cluttering the rest of the code with '#ifdef R128DRI' */
     return FALSE;
 
-#endif	/* XF86DRI */
+#endif	/* R128DRI */
 
 }
 
-- 
1.7.7.5



More information about the xorg-devel mailing list