applied Felix's patch for configuration system

This commit is contained in:
Brian Paul 2003-12-12 16:38:57 +00:00
parent 177db2bc9b
commit d450d0b0e2
11 changed files with 121 additions and 113 deletions

View file

@ -504,16 +504,17 @@ static void optInfoEndElem (void *userData, const XML_Char *name) {
}
}
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 @@ void driParseOptionInfo (driOptionCache *info) {
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);
}
}

View file

@ -81,21 +81,20 @@ typedef struct driOptionCache {
* 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

View file

@ -73,7 +73,7 @@ DRI_CONF_BEGIN
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 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
mgaScreen->sarea_priv_offset = serverInfo->sarea_priv_offset;
/* parse information in __driConfigOptions */
driParseOptionInfo (&mgaScreen->optionCache);
driParseOptionInfo (&mgaScreen->optionCache,
__driConfigOptions, __driNConfigOptions);
return GL_TRUE;
}

View file

@ -59,30 +59,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#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;

View file

@ -50,6 +50,30 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#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 @@ r128CreateScreen( __DRIscreenPrivate *sPriv )
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.

View file

@ -64,35 +64,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#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,

View file

@ -50,6 +50,30 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#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 @@ r200CreateScreen( __DRIscreenPrivate *sPriv )
}
/* 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.

View file

@ -64,34 +64,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#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,

View file

@ -50,6 +50,29 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#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 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv )
}
/* 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.

View file

@ -59,21 +59,6 @@ int GlobalCurrentHwcx = -1;
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",

View file

@ -39,6 +39,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#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 @@ sisCreateScreen( __DRIscreenPrivate *sPriv )
sisScreen->driScreen = sPriv;
/* parse information in __driConfigOptions */
driParseOptionInfo(&sisScreen->optionCache);
driParseOptionInfo(&sisScreen->optionCache,
__driConfigOptions, __driNConfigOptions);
return sisScreen;
}