summaryrefslogtreecommitdiff
path: root/src/glx/mini/miniglx.c
diff options
context:
space:
mode:
authorJon Smirl <jonsmirl@gmail.com>2004-07-05 23:42:02 +0000
committerJon Smirl <jonsmirl@gmail.com>2004-07-05 23:42:02 +0000
commit550009441375e55bda3896eba7375b9228c7fdec (patch)
treecacc259a1d4111d41fb189c7769adff7a270ea83 /src/glx/mini/miniglx.c
parent10b3bf60137b1f5faae46d2266f54faa89798570 (diff)
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.
Diffstat (limited to 'src/glx/mini/miniglx.c')
-rw-r--r--src/glx/mini/miniglx.c68
1 files changed, 15 insertions, 53 deletions
diff --git a/src/glx/mini/miniglx.c b/src/glx/mini/miniglx.c
index 1a0acf832f..6596c107b7 100644
--- a/src/glx/mini/miniglx.c
+++ b/src/glx/mini/miniglx.c
@@ -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;