[PATCH mach64] mach64: add a "DRI" option

Mika Blanc mika.blanc at gmail.com
Fri Jul 15 04:52:29 PDT 2011


This patch adds a boolean "DRI" option to the mach64 driver. Direct
rendering can be either enabled (default) or disabled with this option.

Signed-off-by: Mika Blanc <mika.blanc at gmail.com>
---
 src/aticonfig.c |   10 ++++++++++
 src/atidri.c    |    7 +++++++
 src/atioption.h |    1 +
 src/atistruct.h |    1 +
 4 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/aticonfig.c b/src/aticonfig.c
index 621e79e..23837e2 100644
--- a/src/aticonfig.c
+++ b/src/aticonfig.c
@@ -103,6 +103,13 @@ static const OptionInfoRec ATIPublicOptions[] =
 #ifdef XF86DRI_DEVEL
 
     {
+        ATI_OPTION_DRI,
+        "DRI",
+        OPTV_BOOLEAN,
+        {0, },
+        FALSE,
+    },
+    {
         ATI_OPTION_IS_PCI,
         "force_pci_mode",
         OPTV_BOOLEAN,
@@ -323,6 +330,7 @@ ATIProcessOptions
 
 #ifdef XF86DRI_DEVEL
 
+#   define DRI         PublicOption[ATI_OPTION_DRI].value.bool
 #   define IsPCI       PublicOption[ATI_OPTION_IS_PCI].value.bool
 #   define DMAMode     PublicOption[ATI_OPTION_DMA_MODE].value.str
 #   define AGPMode     PublicOption[ATI_OPTION_AGP_MODE].value.num
@@ -368,6 +376,7 @@ ATIProcessOptions
 #endif
 
 #ifdef XF86DRI_DEVEL
+    DRI = TRUE;
     DMAMode = "async";
 #endif
 
@@ -428,6 +437,7 @@ ATIProcessOptions
 
 #ifdef XF86DRI_DEVEL
 
+    pATI->OptionDRI = DRI;
     pATI->OptionIsPCI = IsPCI;
     pATI->OptionAGPMode = AGPMode;
     pATI->OptionAGPSize = AGPSize;
diff --git a/src/atidri.c b/src/atidri.c
index 9c6719b..8274d67 100644
--- a/src/atidri.c
+++ b/src/atidri.c
@@ -1181,6 +1181,13 @@ Bool ATIDRIScreenInit( ScreenPtr pScreen )
    drmVersionPtr version;
    int major, minor, patch;
 
+   /* Disable DRI if explicitly requested by configuration */
+   if ( !pATI->OptionDRI ) {
+      xf86DrvMsg( pScreen->myNum, X_INFO,
+		  "[dri] Direct rendering forced off\n" );
+      return FALSE;
+   }
+
    /* Check that the GLX, DRI, and DRM modules have been loaded by testing
     * for known symbols in each module.
     */
diff --git a/src/atioption.h b/src/atioption.h
index 37303ef..0e83782 100644
--- a/src/atioption.h
+++ b/src/atioption.h
@@ -41,6 +41,7 @@ typedef enum
 
 #ifdef XF86DRI_DEVEL
 
+    ATI_OPTION_DRI,
     ATI_OPTION_IS_PCI,
     ATI_OPTION_DMA_MODE,
     ATI_OPTION_AGP_MODE,
diff --git a/src/atistruct.h b/src/atistruct.h
index 5225256..a0b8054 100644
--- a/src/atistruct.h
+++ b/src/atistruct.h
@@ -508,6 +508,7 @@ typedef struct _ATIRec
     int               depthTexLines;
     FBAreaPtr         depthTexArea;
 #endif
+    CARD8 OptionDRI;             /* Direct rendering */
     CARD8 OptionIsPCI;           /* Force PCI mode */
     CARD8 OptionDMAMode;         /* async, sync, mmio */
     CARD8 OptionAGPMode;         /* AGP mode */
-- 
1.7.6



More information about the xorg-devel mailing list