Convert miniglx to use Ian's fancy new driver config code.

This removes the miniglx driver function InitContextModes().
All of the server directories were edited to remove the implementations.
This commit is contained in:
Jon Smirl
2004-07-05 23:42:02 +00:00
parent 10b3bf6013
commit 5500094413
11 changed files with 18 additions and 319 deletions
+2 -2
View File
@@ -28,5 +28,5 @@ SRC_DIRS = mesa glx glu glut/mini
DRIVER_DIRS = dri
PROGRAM_DIRS = miniglx
#DRI_DIRS = fb ffb gamma i810 i830 mach64 mga r128 r200 radeon sis savage tdfx unichrome
DRI_DIRS = i810 i830 mach64 mga r128 r200 radeon tdfx unichrome
#DRI_DIRS = fb ffb gamma sis savage
DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 radeon tdfx unichrome
-5
View File
@@ -124,11 +124,6 @@ typedef struct DRIDriverContextRec {
* initialization and take down routines.
*/
typedef struct DRIDriverRec {
/**
* \brief Get the list of supported gl context modes.
*/
int (*initContextModes)( const DRIDriverContext *context,
int *numModes, const __GLcontextModes **modes );
/**
* \brief Validate the framebuffer device mode
*/
+15 -53
View File
@@ -1014,10 +1014,6 @@ __miniglx_StartServer( const char *display_name )
return NULL;
}
/* Ask the driver for a list of supported configs:
*/
dpy->driver->initContextModes( &dpy->driverContext, &dpy->numModes, &dpy->modes );
/* Perform the initialization normally done in the X server
*/
if (!dpy->driver->initFBDev( &dpy->driverContext )) {
@@ -1063,8 +1059,6 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
drm_handle_t hSAREA;
drmAddress pSAREA;
const char *BusID;
__GLcontextModes *modes;
__GLcontextModes *temp;
int i;
__DRIversion ddx_version;
__DRIversion dri_version;
@@ -1078,28 +1072,6 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
drm_handle_t hFB;
int junk;
/* Create the linked list of context modes, and populate it with the
* GLX visual information passed in by libGL.
*/
modes = _gl_context_modes_create( dpy->numModes, sizeof(__GLcontextModes) );
if ( modes == NULL ) {
return NULL;
}
temp = modes;
for ( i = 0 ; i < dpy->numModes ; i++ ) {
__GLcontextModes * next;
assert( temp != NULL );
next = temp->next;
*temp = dpy->modes[i];
temp->next = next;
temp->screen = scrn;
temp = temp->next;
}
err_msg = "XF86DRIOpenConnection";
err_extra = NULL;
@@ -1194,7 +1166,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
err_msg = "InitDriver";
err_extra = NULL;
psp = dpy->createNewScreen(dpy, scrn, psc, modes,
psp = dpy->createNewScreen(dpy, scrn, psc, NULL,
& ddx_version,
& dri_version,
& drm_version,
@@ -1203,13 +1175,6 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
fd,
(get_ver != NULL) ? (*get_ver)() : 20040602,
(__GLcontextModes **) &dpy->driver_modes);
if (dpy->driver_modes == NULL) {
dpy->driver_modes = modes;
}
else {
_gl_context_modes_destroy(modes);
modes = NULL;
}
}
done:
@@ -1230,10 +1195,6 @@ done:
(void)drmClose(fd);
}
if ( modes != NULL ) {
_gl_context_modes_destroy( modes );
}
if ( err_extra != NULL ) {
fprintf(stderr, "libGL error: %s failed (%s)\n", err_msg,
err_extra);
@@ -1306,10 +1267,6 @@ XOpenDisplay( const char *display_name )
return NULL;
}
/* Ask the driver for a list of supported configs:
*/
dpy->driver->initContextModes( &dpy->driverContext, &dpy->numModes, &dpy->modes );
/* Perform the client-side initialization.
*
* Clearly there is a limit of one on the number of windows in
@@ -1631,6 +1588,7 @@ XFree( void *data )
XVisualInfo *
XGetVisualInfo( Display *dpy, long vinfo_mask, XVisualInfo *vinfo_template, int *nitens_return )
{
const __GLcontextModes *mode;
XVisualInfo *results;
Visual *visResults;
int i, n;
@@ -1638,7 +1596,10 @@ XGetVisualInfo( Display *dpy, long vinfo_mask, XVisualInfo *vinfo_template, int
ASSERT(vinfo_mask == VisualScreenMask);
ASSERT(vinfo_template.screen == 0);
n = dpy->numModes;
n = 0;
for ( mode = dpy->driver_modes ; mode != NULL ; mode = mode->next )
n++;
results = (XVisualInfo *)calloc(1, n * sizeof(XVisualInfo));
if (!results) {
*nitens_return = 0;
@@ -1652,8 +1613,8 @@ XGetVisualInfo( Display *dpy, long vinfo_mask, XVisualInfo *vinfo_template, int
return NULL;
}
for (i = 0; i < n; i++) {
visResults[i].mode = dpy->modes + i;
for ( mode = dpy->driver_modes, i = 0 ; mode != NULL ; mode = mode->next, i++ ) {
visResults[i].mode = mode;
visResults[i].visInfo = results + i;
visResults[i].dpy = dpy;
@@ -1669,10 +1630,10 @@ XGetVisualInfo( Display *dpy, long vinfo_mask, XVisualInfo *vinfo_template, int
#else
results[i].class = TrueColor;
#endif
results[i].depth = dpy->modes[i].redBits +
dpy->modes[i].redBits +
dpy->modes[i].redBits +
dpy->modes[i].redBits;
results[i].depth = mode->redBits +
mode->redBits +
mode->redBits +
mode->redBits;
results[i].bits_per_rgb = dpy->driverContext.bpp;
}
*nitens_return = n;
@@ -1734,6 +1695,7 @@ XGetVisualInfo( Display *dpy, long vinfo_mask, XVisualInfo *vinfo_template, int
XVisualInfo*
glXChooseVisual( Display *dpy, int screen, int *attribList )
{
const __GLcontextModes *mode;
Visual *vis;
XVisualInfo *visInfo;
const int *attrib;
@@ -1834,8 +1796,7 @@ glXChooseVisual( Display *dpy, int screen, int *attribList )
(void) blueBits;
(void) alphaBits;
(void) stereoFlag;
for (i = 0; i < dpy->numModes; i++) {
const __GLcontextModes *mode = dpy->modes + i;
for ( mode = dpy->driver_modes ; mode != NULL ; mode = mode->next ) {
if (mode->rgbMode == rgbFlag &&
mode->redBits >= redBits &&
mode->greenBits >= greenBits &&
@@ -2278,6 +2239,7 @@ void (*glXGetProcAddress(const GLubyte *procname))( void )
{ "__glXCreateContextWithConfig", (void *) __glXCreateContextWithConfig },
{ "__glXGetDrawableInfo", (void *) __glXGetDrawableInfo },
{ "__glXWindowExists", (void *) __glXWindowExists },
{ "__glXCreateContextModes", (void *) _gl_context_modes_create },
{ NULL, NULL }
};
const struct name_address *entry;
-2
View File
@@ -151,8 +151,6 @@ struct MiniGLXDisplayRec {
* Visuals (configs) in this screen.
*/
/*@{*/
int numModes; /**< \brief Number of modes. */
const __GLcontextModes *modes; /**< \brief Modes list pointer. */
const __GLcontextModes *driver_modes; /**< \brief Modes filtered by driver. */
/*@}*/
@@ -861,40 +861,6 @@ static int I810ScreenInit( DRIDriverContext *ctx, I810Ptr info )
}
/**
* \brief Establish the set of modes available for the display.
*
* \param ctx display handle.
* \param numModes will receive the number of supported modes.
* \param modes will point to the list of supported modes.
*
* \return one on success, or zero on failure.
*
* Allocates a single visual and fills it with information according to the
* display bit depth. Supports only 16 and 32 bpp bit depths, aborting
* otherwise.
*/
const __GLcontextModes __glModes[] = {
/* 16 bit, RGB Depth=16 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_FALSE,
.redBits = 5, .greenBits = 6, .blueBits = 5, .alphaBits = 0,
.redMask = 0xf800, .greenMask = 0x07e0, .blueMask = 0x001f, .alphaMask = 0x0,
.rgbBits = 16, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 16, .stencilBits = 0,
.numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
};
static int i810InitContextModes( const DRIDriverContext *ctx,
int *numModes, const __GLcontextModes **modes)
{
*numModes = sizeof(__glModes)/sizeof(__GLcontextModes *);
*modes = &__glModes[0];
return 1;
}
/**
* \brief Validate the fbdev mode.
*
@@ -1005,7 +971,6 @@ extern void i810NotifyFocus( int );
* \sa DRIDriverRec.
*/
const struct DRIDriverRec __driDriver = {
i810InitContextModes,
i810ValidateMode,
i810PostValidateMode,
i810InitFBDev,
+1
View File
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <sched.h>
#include "mtypes.h"
#include "context.h"
-45
View File
@@ -876,50 +876,6 @@ static int MGAScreenInit( struct DRIDriverContextRec *ctx, MGAPtr pMga )
}
/**
* \brief Establish the set of modes available for the display.
*
* \param ctx display handle.
* \param numModes will receive the number of supported modes.
* \param modes will point to the list of supported modes.
*
* \return one on success, or zero on failure.
*
* Allocates a single visual and fills it with information according to the
* display bit depth. Supports only 16 and 32 bpp bit depths, aborting
* otherwise.
*/
const __GLcontextModes __glModes[] = {
/* 32 bit, RGBA Depth=24 Stencil=8 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_TRUE,
.redBits = 8, .greenBits = 8, .blueBits = 8, .alphaBits = 8,
.redMask = 0xff0000, .greenMask = 0xff00, .blueMask = 0xff, .alphaMask = 0xff000000,
.rgbBits = 32, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 24, .stencilBits = 8,
.numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
/* 16 bit, RGB Depth=16 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_FALSE,
.redBits = 5, .greenBits = 6, .blueBits = 5, .alphaBits = 0,
.redMask = 0xf800, .greenMask = 0x07e0, .blueMask = 0x001f, .alphaMask = 0x0,
.rgbBits = 16, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 16, .stencilBits = 0,
.numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
};
static int mgaInitContextModes( const DRIDriverContext *ctx,
int *numModes, const __GLcontextModes **modes)
{
*numModes = sizeof(__glModes)/sizeof(__GLcontextModes *);
*modes = &__glModes[0];
return 1;
}
/**
* \brief Validate the fbdev mode.
*
@@ -1043,7 +999,6 @@ static int mgaEngineRestore( const DRIDriverContext *ctx )
* \sa DRIDriverRec.
*/
struct DRIDriverRec __driDriver = {
mgaInitContextModes,
mgaValidateMode,
mgaPostValidateMode,
mgaInitFBDev,
@@ -66,49 +66,6 @@
# define DRM_PAGE_SIZE 4096
#endif
/**
* \brief Establish the set of modes available for the display.
*
* \param ctx display handle.
* \param numModes will receive the number of supported modes.
* \param modes will point to the list of supported modes.
*
* \return one on success, or zero on failure.
*
* Allocates a single visual and fills it with information according to the
* display bit depth. Supports only 16 and 32 bpp bit depths, aborting
* otherwise.
*/
const __GLcontextModes __glModes[] = {
/* 32 bit, RGBA Depth=24 Stencil=8 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_TRUE,
.redBits = 8, .greenBits = 8, .blueBits = 8, .alphaBits = 8,
.redMask = 0xff0000, .greenMask = 0xff00, .blueMask = 0xff, .alphaMask = 0xff000000,
.rgbBits = 32, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 24, .stencilBits = 8,
.numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
/* 16 bit, RGB Depth=16 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_FALSE,
.redBits = 5, .greenBits = 6, .blueBits = 5, .alphaBits = 0,
.redMask = 0xf800, .greenMask = 0x07e0, .blueMask = 0x001f, .alphaMask = 0x0,
.rgbBits = 16, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 16, .stencilBits = 0,
.numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
};
static int R128InitContextModes( const DRIDriverContext *ctx,
int *numModes, const __GLcontextModes **modes)
{
*numModes = sizeof(__glModes)/sizeof(__GLcontextModes *);
*modes = &__glModes[0];
return 1;
}
/* Compute log base 2 of val. */
static int R128MinBits(int val)
{
@@ -1153,7 +1110,6 @@ static int R128EngineRestore( const DRIDriverContext *ctx )
* \sa DRIDriverRec.
*/
const struct DRIDriverRec __driDriver = {
R128InitContextModes,
R128ValidateMode,
R128PostValidateMode,
R128InitFBDev,
@@ -1027,50 +1027,6 @@ static int get_chipfamily_from_chipset( RADEONInfoPtr info )
}
/**
* \brief Establish the set of modes available for the display.
*
* \param ctx display handle.
* \param numModes will receive the number of supported modes.
* \param modes will point to the list of supported modes.
*
* \return one on success, or zero on failure.
*
* Allocates a single visual and fills it with information according to the
* display bit depth. Supports only 16 and 32 bpp bit depths, aborting
* otherwise.
*/
const __GLcontextModes __glModes[] = {
/* 32 bit, RGBA Depth=24 Stencil=8 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_TRUE,
.redBits = 8, .greenBits = 8, .blueBits = 8, .alphaBits = 8,
.redMask = 0xff0000, .greenMask = 0xff00, .blueMask = 0xff, .alphaMask = 0xff000000,
.rgbBits = 32, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 24, .stencilBits = 8,
.numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
/* 16 bit, RGB Depth=16 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_FALSE,
.redBits = 5, .greenBits = 6, .blueBits = 5, .alphaBits = 0,
.redMask = 0xf800, .greenMask = 0x07e0, .blueMask = 0x001f, .alphaMask = 0x0,
.rgbBits = 16, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 16, .stencilBits = 0,
.numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
};
static int radeonInitContextModes( const DRIDriverContext *ctx,
int *numModes, const __GLcontextModes **modes)
{
*numModes = sizeof(__glModes)/sizeof(__GLcontextModes *);
*modes = &__glModes[0];
return 1;
}
/**
* \brief Validate the fbdev mode.
*
@@ -1204,7 +1160,6 @@ extern void radeonNotifyFocus( int );
* \sa DRIDriverRec.
*/
const struct DRIDriverRec __driDriver = {
radeonInitContextModes,
radeonValidateMode,
radeonPostValidateMode,
radeonInitFBDev,
@@ -326,59 +326,6 @@ static int createScreen (DRIDriverContext *ctx, TDFXDRIPtr pTDFX)
}
/**
* \brief Establish the set of modes available for the display.
*
* \param ctx display handle.
* \param numModes will receive the number of supported modes.
* \param modes will point to the list of supported modes.
*
* \return one on success, or zero on failure.
*
* Allocates a single visual and fills it with information according to the
* display bit depth. Supports only 16 and 32 bpp bit depths, aborting
* otherwise.
*/
const __GLcontextModes __glModes[] = {
/* 32 bit, RGBA Depth=24 Stencil=8 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_TRUE,
.redBits = 8, .greenBits = 8, .blueBits = 8, .alphaBits = 8,
.redMask = 0xff0000, .greenMask = 0xff00, .blueMask = 0xff, .alphaMask = 0xff000000,
.rgbBits = 32, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 24, .stencilBits = 8,
.numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
/* 16 bit, RGB Depth=16 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_FALSE,
.redBits = 5, .greenBits = 6, .blueBits = 5, .alphaBits = 0,
.redMask = 0xf800, .greenMask = 0x07e0, .blueMask = 0x001f, .alphaMask = 0x0,
.rgbBits = 16, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 16, .stencilBits = 0,
.numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
};
static int tdfxInitContextModes( const DRIDriverContext *ctx,
int *numModes, const __GLcontextModes **modes)
{
int n = sizeof(__glModes)/sizeof(__glModes[0]);
const __GLcontextModes *m = &__glModes[0];
if (ctx->chipset < PCI_CHIP_VOODOO4) {
n /= 2;
m += n;
}
*numModes = n;
*modes = m;
return 1;
}
/**
* \brief Validate the fbdev mode.
*
@@ -514,7 +461,6 @@ static int tdfxEngineRestore( const DRIDriverContext *ctx )
* \sa DRIDriverRec.
*/
struct DRIDriverRec __driDriver = {
tdfxInitContextModes,
tdfxValidateMode,
tdfxPostValidateMode,
tdfxInitFBDev,
@@ -407,39 +407,6 @@ static int VIADRIMapInit(DRIDriverContext * ctx, VIAPtr pVia)
return GL_TRUE;
}
const __GLcontextModes __glModes[] =
{
/* 32 bit, RGBA Depth=16 Stencil=8 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_TRUE,
.redBits = 8, .greenBits = 8, .blueBits = 8, .alphaBits = 8,
.redMask = 0xff0000, .greenMask = 0xff00, .blueMask = 0xff, .alphaMask = 0xff000000,
.rgbBits = 32, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 16, .stencilBits = 8,
.numAuxBuffers= 0, .level = 0, .pixmapMode = GL_TRUE, },
#if 0
/* 16 bit, RGB Depth=16 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_FALSE,
.redBits = 5, .greenBits = 6, .blueBits = 5, .alphaBits = 0,
.redMask = 0xf800, .greenMask = 0x07e0, .blueMask = 0x001f, .alphaMask = 0x0,
.rgbBits = 16, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 16, .stencilBits = 0,
.numAuxBuffers= 0, .level = 0, .pixmapMode = GL_TRUE, },
#endif
};
static int viaInitContextModes(const DRIDriverContext *ctx,
int *numModes, const __GLcontextModes **modes)
{
*numModes = sizeof(__glModes)/sizeof(__glModes[0]);
*modes = &__glModes[0];
return 1;
}
static int viaValidateMode(const DRIDriverContext *ctx)
{
VIAPtr pVia = VIAPTR(ctx);
@@ -1134,7 +1101,6 @@ static int viaEngineRestore(const DRIDriverContext *ctx)
const struct DRIDriverRec __driDriver =
{
viaInitContextModes,
viaValidateMode,
viaPostValidateMode,
viaInitFBDev,