}
}
-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));
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);
}
}
* 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
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;
mgaScreen->sarea_priv_offset = serverInfo->sarea_priv_offset;
/* parse information in __driConfigOptions */
- driParseOptionInfo (&mgaScreen->optionCache);
+ driParseOptionInfo (&mgaScreen->optionCache,
+ __driConfigOptions, __driNConfigOptions);
return GL_TRUE;
}
#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;
#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...
*/
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.
#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.
*/
static void r200GetBufferSize( GLframebuffer *buffer,
#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...
*/
}
/* 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.
#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.
*/
static void radeonGetBufferSize( GLframebuffer *buffer,
#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...
*/
}
/* 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.
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",
#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
sisScreen->driScreen = sPriv;
/* parse information in __driConfigOptions */
- driParseOptionInfo(&sisScreen->optionCache);
+ driParseOptionInfo(&sisScreen->optionCache,
+ __driConfigOptions, __driNConfigOptions);
return sisScreen;
}