Hi,

I attached a patch that eliminates the dependency of xmlconfig.o on the
symbol __driConfigOptions in the DRI drivers. Keith, how do you like it?

I wasn't aware that I do need Mesa CVS write access for changes in the
DRI drivers before now. :-/ Brian, could you give me CVS write access
please. My sf account name is fxkuehl.

Regards,
  Felix

P.S.: I noticed that SIS supports configuration now too. Cool. :) BTW,
I'm just changing the snapshot scripts to include SIS in the trunk
snapshots.

------------    __\|/__    ___     ___       -------------------------
 Felix       ___\_e -_/___/ __\___/ __\_____   You can do anything,
   Kühling  (_____\Ä/____/ /_____/ /________)  just not everything
 [EMAIL PROTECTED]       \___/   \___/   U        at the same time.
? configsyms.diff
Index: common/xmlconfig.c
===================================================================
RCS file: /cvsroot/mesa3d/Mesa-newtree/src/mesa/drivers/dri/common/xmlconfig.c,v
retrieving revision 1.1
diff -u -r1.1 xmlconfig.c
--- common/xmlconfig.c  21 Oct 2003 06:05:41 -0000      1.1
+++ common/xmlconfig.c  11 Dec 2003 23:01:22 -0000
@@ -504,16 +504,17 @@
     }
 }
 
-void driParseOptionInfo (driOptionCache *info) {
+void driParseOptionInfo (driOptionCache *info,
+                        const char *configOptions, GLuint nConfigOptions) {
     XML_Parser p;
     int status;
     struct OptInfoData userData;
     struct OptInfoData *data = &userData;
-    GLuint nOptions;
+    GLuint realNoptions;
 
   /* determine hash table size and allocate memory */
     GLuint size, log2size;
-    for (size = 1, log2size = 0; size < __driNConfigOptions*3/2;
+    for (size = 1, log2size = 0; size < nConfigOptions*3/2;
         size <<= 1, ++log2size);
     info->tableSize = log2size;
     info->info = CALLOC (size * sizeof (driOptionInfo));
@@ -537,21 +538,21 @@
     userData.inEnum = GL_FALSE;
     userData.curOption = -1;
 
-    status = XML_Parse (p, __driConfigOptions, strlen (__driConfigOptions), 1);
+    status = XML_Parse (p, configOptions, strlen (configOptions), 1);
     if (!status)
        XML_FATAL ("%s.", XML_ErrorString(XML_GetErrorCode(p)));
 
     XML_ParserFree (p);
 
-  /* Check if the actual number of options matches __driNConfigOptions.
+  /* Check if the actual number of options matches nConfigOptions.
    * A mismatch is not fatal (a hash table overflow would be) but we
    * want the driver developer's attention anyway. */
-    nOptions = countOptions (info);
-    if (nOptions != __driNConfigOptions) {
+    realNoptions = countOptions (info);
+    if (realNoptions != nConfigOptions) {
        fprintf (stderr,
-                "Error: __driNConfigOptions (%u) does not match the actual number of 
options in\n"
+                "Error: nConfigOptions (%u) does not match the actual number of 
options in\n"
                 "       __driConfigOptions (%u).\n",
-                __driNConfigOptions, nOptions);
+                nConfigOptions, realNoptions);
     }
 }
 
Index: common/xmlconfig.h
===================================================================
RCS file: /cvsroot/mesa3d/Mesa-newtree/src/mesa/drivers/dri/common/xmlconfig.h,v
retrieving revision 1.1
diff -u -r1.1 xmlconfig.h
--- common/xmlconfig.h  21 Oct 2003 06:05:41 -0000      1.1
+++ common/xmlconfig.h  11 Dec 2003 23:01:22 -0000
@@ -81,21 +81,20 @@
    * The value is the same in the screen and all contexts. */
 } driOptionCache;
 
-/** \brief XML document describing available options
+/** \brief Parse XML option info from configOptions
  *
- * This must be defined in a driver-specific soure file. xmlpool.h
- * defines helper macros and common options. */
-extern const char __driConfigOptions[];
-/** \brief The number of options supported by a driver
+ * To be called in <driver>CreateScreen 
  *
- * This is used to choose an appropriate hash table size. So any value
- * larger than the actual number of options will work. */
-extern const GLuint __driNConfigOptions;
-
-/** \brief Parse XML option info from __driConfigOptions
+ * \param info    pointer to a driOptionCache that will store the option info
+ * \param configOptions   XML document describing available configuration opts
+ * \param nConfigOptions  number of options, used to choose a hash table size
  *
- * To be called in <driver>CreateScreen */
-void driParseOptionInfo (driOptionCache *info);
+ * For the option information to be available to external configuration tools
+ * it must be a public symbol __driConfigOptions. It is also passed as a
+ * parameter to driParseOptionInfo in order to avoid driver-independent code
+ * depending on symbols in driver-specific code. */
+void driParseOptionInfo (driOptionCache *info,
+                        const char *configOptions, GLuint nConfigOptions);
 /** \brief Initialize option cache from info and parse configuration files
  *
  * To be called in <driver>CreateContext. screenNum and driverName select
Index: mga/mga_xmesa.c
===================================================================
RCS file: /cvsroot/mesa3d/Mesa-newtree/src/mesa/drivers/dri/mga/mga_xmesa.c,v
retrieving revision 1.7
diff -u -r1.7 mga_xmesa.c
--- mga/mga_xmesa.c     8 Dec 2003 22:43:11 -0000       1.7
+++ mga/mga_xmesa.c     11 Dec 2003 23:01:25 -0000
@@ -73,7 +73,7 @@
         DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
     DRI_CONF_SECTION_END
 DRI_CONF_END;
-const GLuint __driNConfigOptions = 3;
+static const GLuint __driNConfigOptions = 3;
 
 #ifndef MGA_DEBUG
 int MGA_DEBUG = 0;
@@ -241,7 +241,8 @@
    mgaScreen->sarea_priv_offset = serverInfo->sarea_priv_offset;
 
    /* parse information in __driConfigOptions */
-   driParseOptionInfo (&mgaScreen->optionCache);
+   driParseOptionInfo (&mgaScreen->optionCache,
+                      __driConfigOptions, __driNConfigOptions);
 
    return GL_TRUE;
 }
Index: r128/r128_context.c
===================================================================
RCS file: /cvsroot/mesa3d/Mesa-newtree/src/mesa/drivers/dri/r128/r128_context.c,v
retrieving revision 1.4
diff -u -r1.4 r128_context.c
--- r128/r128_context.c 8 Dec 2003 22:43:11 -0000       1.4
+++ r128/r128_context.c 11 Dec 2003 23:01:25 -0000
@@ -59,30 +59,7 @@
 #include "vblank.h"
 #include "utils.h"
 #include "texmem.h"
-
-/* R128 configuration
- */
-#include "xmlpool.h"
-
-const char __driConfigOptions[] =
-DRI_CONF_BEGIN
-    DRI_CONF_SECTION_PERFORMANCE
-        DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
-    DRI_CONF_SECTION_END
-    DRI_CONF_SECTION_QUALITY
-        DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
-    DRI_CONF_SECTION_END
-#if ENABLE_PERF_BOXES
-    DRI_CONF_SECTION_DEBUG
-        DRI_CONF_PERFORMANCE_BOXES(false)
-    DRI_CONF_SECTION_END
-#endif
-DRI_CONF_END;
-#if ENABLE_PERF_BOXES
-const GLuint __driNConfigOptions = 3;
-#else
-const GLuint __driNConfigOptions = 2;
-#endif
+#include "xmlpool.h" /* for symbolic values of enum-type options */
 
 #ifndef R128_DEBUG
 int R128_DEBUG = 0;
Index: r128/r128_screen.c
===================================================================
RCS file: /cvsroot/mesa3d/Mesa-newtree/src/mesa/drivers/dri/r128/r128_screen.c,v
retrieving revision 1.2
diff -u -r1.2 r128_screen.c
--- r128/r128_screen.c  21 Oct 2003 06:05:45 -0000      1.2
+++ r128/r128_screen.c  11 Dec 2003 23:01:26 -0000
@@ -50,6 +50,30 @@
 #include "glxextensions.h"
 #endif
 
+/* R128 configuration
+ */
+#include "xmlpool.h"
+
+const char __driConfigOptions[] =
+DRI_CONF_BEGIN
+    DRI_CONF_SECTION_PERFORMANCE
+        DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
+    DRI_CONF_SECTION_END
+    DRI_CONF_SECTION_QUALITY
+        DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
+    DRI_CONF_SECTION_END
+#if ENABLE_PERF_BOXES
+    DRI_CONF_SECTION_DEBUG
+        DRI_CONF_PERFORMANCE_BOXES(false)
+    DRI_CONF_SECTION_END
+#endif
+DRI_CONF_END;
+#if ENABLE_PERF_BOXES
+static const GLuint __driNConfigOptions = 3;
+#else
+static const GLuint __driNConfigOptions = 2;
+#endif
+
 #if 1
 /* Including xf86PciInfo.h introduces a bunch of errors...
  */
@@ -80,7 +104,8 @@
    if ( !r128Screen ) return NULL;
 
    /* parse information in __driConfigOptions */
-   driParseOptionInfo (&r128Screen->optionCache);
+   driParseOptionInfo (&r128Screen->optionCache,
+                      __driConfigOptions, __driNConfigOptions);
 
    /* This is first since which regions we map depends on whether or
     * not we are using a PCI card.
Index: r200/r200_context.c
===================================================================
RCS file: /cvsroot/mesa3d/Mesa-newtree/src/mesa/drivers/dri/r200/r200_context.c,v
retrieving revision 1.8
diff -u -r1.8 r200_context.c
--- r200/r200_context.c 8 Dec 2003 22:43:11 -0000       1.8
+++ r200/r200_context.c 11 Dec 2003 23:01:27 -0000
@@ -64,33 +64,10 @@
 
 #include "vblank.h"
 #include "utils.h"
+#include "xmlpool.h" /* for symbolic values of enum-type options */
 #ifndef R200_DEBUG
 int R200_DEBUG = (0);
 #endif
-
-
-/* R200 configuration
- */
-#include "xmlpool.h"
-
-const char __driConfigOptions[] =
-DRI_CONF_BEGIN
-    DRI_CONF_SECTION_PERFORMANCE
-        DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
-        DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
-        DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
-    DRI_CONF_SECTION_END
-    DRI_CONF_SECTION_QUALITY
-        DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
-        DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
-        DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
-        DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
-    DRI_CONF_SECTION_END
-    DRI_CONF_SECTION_DEBUG
-        DRI_CONF_NO_RAST(false)
-    DRI_CONF_SECTION_END
-DRI_CONF_END;
-const GLuint __driNConfigOptions = 8;
 
 
 /* Return the width and height of the given buffer.
Index: r200/r200_screen.c
===================================================================
RCS file: /cvsroot/mesa3d/Mesa-newtree/src/mesa/drivers/dri/r200/r200_screen.c,v
retrieving revision 1.4
diff -u -r1.4 r200_screen.c
--- r200/r200_screen.c  7 Dec 2003 23:47:56 -0000       1.4
+++ r200/r200_screen.c  11 Dec 2003 23:01:29 -0000
@@ -50,6 +50,30 @@
 #ifndef _SOLO
 #include "glxextensions.h"
 #endif
+
+/* R200 configuration
+ */
+#include "xmlpool.h"
+
+const char __driConfigOptions[] =
+DRI_CONF_BEGIN
+    DRI_CONF_SECTION_PERFORMANCE
+        DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
+        DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
+        DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
+    DRI_CONF_SECTION_END
+    DRI_CONF_SECTION_QUALITY
+        DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
+        DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
+        DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
+        DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
+    DRI_CONF_SECTION_END
+    DRI_CONF_SECTION_DEBUG
+        DRI_CONF_NO_RAST(false)
+    DRI_CONF_SECTION_END
+DRI_CONF_END;
+static const GLuint __driNConfigOptions = 8;
+
 #if 1
 /* Including xf86PciInfo.h introduces a bunch of errors...
  */
@@ -109,7 +133,8 @@
    }
 
    /* parse information in __driConfigOptions */
-   driParseOptionInfo (&screen->optionCache);
+   driParseOptionInfo (&screen->optionCache,
+                      __driConfigOptions, __driNConfigOptions);
 
    /* This is first since which regions we map depends on whether or
     * not we are using a PCI card.
Index: radeon/radeon_context.c
===================================================================
RCS file: /cvsroot/mesa3d/Mesa-newtree/src/mesa/drivers/dri/radeon/radeon_context.c,v
retrieving revision 1.7
diff -u -r1.7 radeon_context.c
--- radeon/radeon_context.c     8 Dec 2003 22:43:11 -0000       1.7
+++ radeon/radeon_context.c     11 Dec 2003 23:01:30 -0000
@@ -64,33 +64,11 @@
 
 #include "vblank.h"
 #include "utils.h"
+#include "xmlpool.h" /* for symbolic values of enum-type options */
 #ifndef RADEON_DEBUG
 int RADEON_DEBUG = (0);
 #endif
 
-
-/* Radeon configuration
- */
-#include "xmlpool.h"
-
-const char __driConfigOptions[] =
-DRI_CONF_BEGIN
-    DRI_CONF_SECTION_PERFORMANCE
-        DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
-        DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
-        DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
-    DRI_CONF_SECTION_END
-    DRI_CONF_SECTION_QUALITY
-        DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
-        DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
-        DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
-        DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
-    DRI_CONF_SECTION_END
-    DRI_CONF_SECTION_DEBUG
-        DRI_CONF_NO_RAST(false)
-    DRI_CONF_SECTION_END
-DRI_CONF_END;
-const GLuint __driNConfigOptions = 8;
 
 /* Return the width and height of the given buffer.
  */
Index: radeon/radeon_screen.c
===================================================================
RCS file: /cvsroot/mesa3d/Mesa-newtree/src/mesa/drivers/dri/radeon/radeon_screen.c,v
retrieving revision 1.4
diff -u -r1.4 radeon_screen.c
--- radeon/radeon_screen.c      7 Dec 2003 23:53:32 -0000       1.4
+++ radeon/radeon_screen.c      11 Dec 2003 23:01:31 -0000
@@ -50,6 +50,29 @@
 #include "glxextensions.h"
 #endif
 
+/* Radeon configuration
+ */
+#include "xmlpool.h"
+
+const char __driConfigOptions[] =
+DRI_CONF_BEGIN
+    DRI_CONF_SECTION_PERFORMANCE
+        DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
+        DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
+        DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
+    DRI_CONF_SECTION_END
+    DRI_CONF_SECTION_QUALITY
+        DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
+        DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
+        DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
+        DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
+    DRI_CONF_SECTION_END
+    DRI_CONF_SECTION_DEBUG
+        DRI_CONF_NO_RAST(false)
+    DRI_CONF_SECTION_END
+DRI_CONF_END;
+static const GLuint __driNConfigOptions = 8;
+
 #if 1
 /* Including xf86PciInfo.h introduces a bunch of errors...
  */
@@ -91,7 +114,8 @@
    }
 
    /* parse information in __driConfigOptions */
-   driParseOptionInfo (&screen->optionCache);
+   driParseOptionInfo (&screen->optionCache,
+                      __driConfigOptions, __driNConfigOptions);
 
    /* This is first since which regions we map depends on whether or
     * not we are using a PCI card.
Index: sis/sis_context.c
===================================================================
RCS file: /cvsroot/mesa3d/Mesa-newtree/src/mesa/drivers/dri/sis/sis_context.c,v
retrieving revision 1.3
diff -u -r1.3 sis_context.c
--- sis/sis_context.c   9 Dec 2003 00:00:40 -0000       1.3
+++ sis/sis_context.c   11 Dec 2003 23:01:32 -0000
@@ -59,21 +59,6 @@
 int GlobalHwcxCountBase = 1;
 int GlobalCmdQueueLen = 0;
 
-#include "xmlpool.h"
-
-const char __driConfigOptions[] =
-DRI_CONF_BEGIN
-       DRI_CONF_SECTION_DEBUG
-               DRI_CONF_OPT_BEGIN(agp_disable,bool,false)
-               DRI_CONF_DESC(en,"Disable AGP vertex dispatch")
-               DRI_CONF_OPT_END
-               DRI_CONF_OPT_BEGIN(fallback_force,bool,false)
-               DRI_CONF_DESC(en,"Force software fallback")
-               DRI_CONF_OPT_END
-       DRI_CONF_SECTION_END
-DRI_CONF_END;
-const GLuint __driNConfigOptions = 2;
-
 static const char * const card_extensions[] =
 {
    "GL_ARB_multitexture",
Index: sis/sis_screen.c
===================================================================
RCS file: /cvsroot/mesa3d/Mesa-newtree/src/mesa/drivers/dri/sis/sis_screen.c,v
retrieving revision 1.4
diff -u -r1.4 sis_screen.c
--- sis/sis_screen.c    9 Dec 2003 00:00:40 -0000       1.4
+++ sis/sis_screen.c    11 Dec 2003 23:01:33 -0000
@@ -39,6 +39,21 @@
 #include "sis_dri.h"
 #include "sis_lock.h"
 
+#include "xmlpool.h"
+
+const char __driConfigOptions[] =
+DRI_CONF_BEGIN
+       DRI_CONF_SECTION_DEBUG
+               DRI_CONF_OPT_BEGIN(agp_disable,bool,false)
+               DRI_CONF_DESC(en,"Disable AGP vertex dispatch")
+               DRI_CONF_OPT_END
+               DRI_CONF_OPT_BEGIN(fallback_force,bool,false)
+               DRI_CONF_DESC(en,"Force software fallback")
+               DRI_CONF_OPT_END
+       DRI_CONF_SECTION_END
+DRI_CONF_END;
+static const GLuint __driNConfigOptions = 2;
+
 /* Create the device specific screen private data struct.
  */
 static sisScreenPtr
@@ -86,7 +101,8 @@
    sisScreen->driScreen = sPriv;
 
    /* parse information in __driConfigOptions */
-   driParseOptionInfo(&sisScreen->optionCache);
+   driParseOptionInfo(&sisScreen->optionCache,
+                     __driConfigOptions, __driNConfigOptions);
 
    return sisScreen;
 }

Reply via email to