~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/dmx/dmx_glxvisuals.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
** License Applicability. Except to the extent portions of this file are
 
3
** made subject to an alternative license as permitted in the SGI Free
 
4
** Software License B, Version 1.1 (the "License"), the contents of this
 
5
** file are subject only to the provisions of the License. You may not use
 
6
** this file except in compliance with the License. You may obtain a copy
 
7
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
 
8
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
 
9
**
 
10
** http://oss.sgi.com/projects/FreeB
 
11
**
 
12
** Note that, as provided in the License, the Software is distributed on an
 
13
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
 
14
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
 
15
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
 
16
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
 
17
**
 
18
** Original Code. The Original Code is: OpenGL Sample Implementation,
 
19
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
 
20
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
 
21
** Copyright in any portions created by third parties is as indicated
 
22
** elsewhere herein. All Rights Reserved.
 
23
**
 
24
** Additional Notice Provisions: The application programming interfaces
 
25
** established by SGI in conjunction with the Original Code are The
 
26
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
 
27
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
 
28
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
 
29
** Window System(R) (Version 1.3), released October 19, 1998. This software
 
30
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
 
31
** published by SGI, but has not been independently verified as being
 
32
** compliant with the OpenGL(R) version 1.2.1 Specification.
 
33
**
 
34
*/
 
35
 
 
36
#ifdef HAVE_DMX_CONFIG_H
 
37
#include <dmx-config.h>
 
38
#endif
 
39
 
 
40
#include "dmx.h"
 
41
#include <GL/glx.h>
 
42
#include <GL/glxproto.h>
 
43
#include <X11/extensions/Xext.h>
 
44
#include <X11/extensions/extutil.h>
 
45
 
 
46
#include "dmx_glxvisuals.h"
 
47
 
 
48
__GLXvisualConfig *GetGLXVisualConfigs(Display *dpy, int screen, int *nconfigs)
 
49
{
 
50
    xGLXGetVisualConfigsReq *req;
 
51
    xGLXGetVisualConfigsReply reply;
 
52
    __GLXvisualConfig *config, *configs;
 
53
    GLint i, j, nvisuals, nprops;
 
54
    INT32 *props, *p;
 
55
    int   majorOpcode, dummy;
 
56
    int   num_good_visuals;
 
57
 
 
58
    if (!XQueryExtension(dpy, "GLX", &majorOpcode, &dummy, &dummy)) {
 
59
       return(NULL);
 
60
    }
 
61
 
 
62
    /* Send the glXGetVisualConfigs request */
 
63
    LockDisplay(dpy);
 
64
    GetReq(GLXGetVisualConfigs,req);
 
65
    req->reqType = majorOpcode;
 
66
    req->glxCode = X_GLXGetVisualConfigs;
 
67
    req->screen = screen;
 
68
    if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
 
69
        /* Something is busted. Punt. */
 
70
        UnlockDisplay(dpy);
 
71
        SyncHandle();
 
72
        return NULL;
 
73
    }
 
74
 
 
75
    nvisuals = (int)reply.numVisuals;
 
76
    if (!nvisuals) {
 
77
        /* This screen does not support GL rendering */
 
78
        UnlockDisplay(dpy);
 
79
        SyncHandle();
 
80
        return NULL;
 
81
    }
 
82
 
 
83
    /* Check number of properties per visual */
 
84
    nprops = (int)reply.numProps;
 
85
    if (nprops < __GLX_MIN_CONFIG_PROPS)  {
 
86
        /* Huh?  Not in protocol defined limits.  Punt */
 
87
        UnlockDisplay(dpy);
 
88
        SyncHandle();
 
89
        return NULL;
 
90
    }
 
91
    props = (INT32*) Xmalloc(nprops * __GLX_SIZE_CARD32);
 
92
    if (!props) {
 
93
        UnlockDisplay(dpy);
 
94
        SyncHandle();
 
95
        return NULL;
 
96
    }
 
97
 
 
98
    /* Allocate memory for our config structure */
 
99
    config = (__GLXvisualConfig*)
 
100
        Xmalloc(nvisuals * sizeof(__GLXvisualConfig));
 
101
    if (!config) {
 
102
        Xfree(props);
 
103
        UnlockDisplay(dpy);
 
104
        SyncHandle();
 
105
        return NULL;
 
106
    }
 
107
    memset(config, 0, nvisuals * sizeof(__GLXvisualConfig));
 
108
    configs = config;
 
109
    num_good_visuals = 0;
 
110
 
 
111
    /* Convert config structure into our format */
 
112
    for (i=0; i<nvisuals; i++) {
 
113
 
 
114
        /* Read config structure */
 
115
        _XRead(dpy, (char *)props, (nprops * __GLX_SIZE_CARD32));
 
116
 
 
117
        /* fill in default values */
 
118
        config->visualRating = GLX_NONE_EXT;
 
119
        config->transparentPixel = GLX_NONE_EXT;
 
120
 
 
121
        /* Copy in the first set of properties */
 
122
        config->vid = props[0];
 
123
        config->class = props[1];
 
124
 
 
125
        config->rgba = (Bool) props[2];
 
126
 
 
127
        config->redSize = props[3];
 
128
        config->greenSize = props[4];
 
129
        config->blueSize = props[5];
 
130
        config->alphaSize = props[6];
 
131
 
 
132
        config->accumRedSize = props[7];
 
133
        config->accumGreenSize = props[8];
 
134
        config->accumBlueSize = props[9];
 
135
        config->accumAlphaSize = props[10];
 
136
 
 
137
        config->doubleBuffer = (Bool) props[11];
 
138
        config->stereo = (Bool) props[12];
 
139
 
 
140
        config->bufferSize = props[13];
 
141
        config->depthSize = props[14];
 
142
        config->stencilSize = props[15];
 
143
 
 
144
        config->auxBuffers = props[16];
 
145
        config->level = props[17];
 
146
 
 
147
        /* Process remaining properties */
 
148
        p = &props[18];
 
149
        for (j=__GLX_MIN_CONFIG_PROPS; j<nprops; j+=2) {
 
150
            int property = *p++;
 
151
            int value = *p++;
 
152
 
 
153
            switch (property) {
 
154
              case GLX_SAMPLES_SGIS:
 
155
                config->multiSampleSize = value;
 
156
                break;
 
157
              case GLX_SAMPLE_BUFFERS_SGIS:
 
158
                config->nMultiSampleBuffers = value;
 
159
                break;
 
160
 
 
161
              case GLX_TRANSPARENT_TYPE_EXT:
 
162
                config->transparentPixel = value;
 
163
                break;
 
164
              case GLX_TRANSPARENT_INDEX_VALUE_EXT:
 
165
                config->transparentIndex = value;
 
166
                break;
 
167
              case GLX_TRANSPARENT_RED_VALUE_EXT:
 
168
                config->transparentRed = value;
 
169
                break;
 
170
              case GLX_TRANSPARENT_GREEN_VALUE_EXT:
 
171
                config->transparentGreen = value;
 
172
                break;
 
173
              case GLX_TRANSPARENT_BLUE_VALUE_EXT:
 
174
                config->transparentBlue = value;
 
175
                break;
 
176
              case GLX_TRANSPARENT_ALPHA_VALUE_EXT:
 
177
                config->transparentAlpha = value;
 
178
                break;
 
179
 
 
180
              case GLX_VISUAL_CAVEAT_EXT:
 
181
                config->visualRating = value;
 
182
                break;
 
183
 
 
184
              /* visualSelectGroup is an internal used property */
 
185
              case GLX_VISUAL_SELECT_GROUP_SGIX:
 
186
                config->visualSelectGroup = value;
 
187
                break;
 
188
 
 
189
              default :
 
190
                /* Ignore properties we don't recognize */
 
191
                break;
 
192
            }
 
193
        } /* for j */
 
194
 
 
195
        /*
 
196
        // filter out overlay visuals (dmx does not support overlays)
 
197
        */
 
198
        if (config->level == 0) {
 
199
           config++;
 
200
           num_good_visuals++;
 
201
        }
 
202
 
 
203
    } /* for i */
 
204
 
 
205
    UnlockDisplay(dpy);
 
206
 
 
207
    nvisuals = num_good_visuals;
 
208
 
 
209
    config = configs;
 
210
    for (i=0; i<nvisuals; i++) {
 
211
        /* XXX hack to fill-in mask info (need a better way to do this) */
 
212
        {
 
213
            XVisualInfo *vis, template;
 
214
            int n;
 
215
 
 
216
            template.screen = screen;
 
217
            template.visualid = config->vid;
 
218
            vis = XGetVisualInfo(dpy, VisualScreenMask|VisualIDMask,
 
219
                                 &template, &n);
 
220
 
 
221
            if (vis != NULL) {
 
222
                config->redMask = vis->red_mask;
 
223
                config->greenMask = vis->green_mask;
 
224
                config->blueMask = vis->blue_mask;
 
225
                config->alphaMask = 0;  /* XXX */
 
226
                free(vis);
 
227
            }
 
228
        }
 
229
        config++;
 
230
    } /* for i */
 
231
 
 
232
    XFree(props);
 
233
    SyncHandle();
 
234
 
 
235
    *nconfigs = nvisuals;
 
236
    return( configs );
 
237
}
 
238
 
 
239
 
 
240
__GLXFBConfig *GetGLXFBConfigs(Display *dpy, int glxMajorOpcode, int *nconfigs)
 
241
{
 
242
    xGLXGetFBConfigsReq *req;
 
243
    xGLXGetFBConfigsReply reply;
 
244
    __GLXFBConfig *config, *fbconfigs;
 
245
    GLint i, j, numFBConfigs, numAttribs;
 
246
    INT32 *attrs, *p;
 
247
    int screen = DefaultScreen( dpy );
 
248
    int numValidConfigs = 0;
 
249
 
 
250
    /* Send the glXGetFBConfigs request */
 
251
    LockDisplay(dpy);
 
252
    GetReq(GLXGetFBConfigs, req);
 
253
    req->reqType = glxMajorOpcode;
 
254
    req->glxCode = X_GLXGetFBConfigs;
 
255
    req->screen = screen;
 
256
 
 
257
    *nconfigs = 0;
 
258
 
 
259
    if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
 
260
        /* Something is busted. Punt. */
 
261
        UnlockDisplay(dpy);
 
262
        SyncHandle();
 
263
        return NULL;
 
264
    }
 
265
 
 
266
    numFBConfigs = (int)reply.numFBConfigs;
 
267
    if (!numFBConfigs) {
 
268
        /* This screen does not support GL rendering */
 
269
        UnlockDisplay(dpy);
 
270
        SyncHandle();
 
271
        return NULL;            
 
272
    }
 
273
 
 
274
    numAttribs = (int)reply.numAttribs;
 
275
    if (!numAttribs)  {
 
276
        UnlockDisplay(dpy);
 
277
        SyncHandle();
 
278
        return NULL;
 
279
    }
 
280
 
 
281
    attrs = (INT32*) Xmalloc(2*numAttribs * __GLX_SIZE_CARD32);
 
282
    if (!attrs) {
 
283
        UnlockDisplay(dpy);
 
284
        SyncHandle();
 
285
        return NULL;
 
286
    }
 
287
 
 
288
    /* Allocate memory for our config structure */
 
289
    config = (__GLXFBConfig*)
 
290
        Xmalloc(numFBConfigs * sizeof(__GLXFBConfig));
 
291
    if (!config) {
 
292
        Xfree(attrs);
 
293
        UnlockDisplay(dpy);
 
294
        SyncHandle();
 
295
        return NULL;
 
296
    }
 
297
    memset(config, 0, numFBConfigs * sizeof(__GLXFBConfig));
 
298
    fbconfigs = config;
 
299
 
 
300
    /* Convert attribute list into our format */
 
301
    for (i=0; i<numFBConfigs; i++) {
 
302
 
 
303
        /* Fill in default properties */
 
304
        config->transparentType = GLX_NONE_EXT;
 
305
        config->visualCaveat = GLX_NONE_EXT;
 
306
        config->minRed = 0.;
 
307
        config->maxRed = 1.;
 
308
        config->minGreen = 0.;
 
309
        config->maxGreen = 1.;
 
310
        config->minBlue = 0.;
 
311
        config->maxBlue = 1.;
 
312
        config->minAlpha = 0.;
 
313
        config->maxAlpha = 1.;
 
314
 
 
315
        /* Read attribute list */
 
316
        _XRead(dpy, (char *)attrs, (2*numAttribs * __GLX_SIZE_CARD32));
 
317
 
 
318
        p = attrs;
 
319
        for (j=0; j<numAttribs; j++) {
 
320
            int attribute = *p++;
 
321
            int value = *p++;
 
322
 
 
323
            switch (attribute) {
 
324
              /* core attributes */
 
325
              case GLX_FBCONFIG_ID:
 
326
                config->id = value;
 
327
                break;
 
328
              case GLX_BUFFER_SIZE:
 
329
                config->indexBits = value;
 
330
                break;
 
331
              case GLX_LEVEL:
 
332
                config->level = value;
 
333
                break;
 
334
              case GLX_DOUBLEBUFFER:
 
335
                config->doubleBufferMode = value;
 
336
                break;
 
337
              case GLX_STEREO:
 
338
                config->stereoMode = value;
 
339
                break;
 
340
              case GLX_AUX_BUFFERS:
 
341
                config->maxAuxBuffers = value;
 
342
                break;
 
343
              case GLX_RED_SIZE:
 
344
                config->redBits = value;
 
345
                break;
 
346
              case GLX_GREEN_SIZE:
 
347
                config->greenBits = value;
 
348
                break;
 
349
              case GLX_BLUE_SIZE:
 
350
                config->blueBits = value;
 
351
                break;
 
352
              case GLX_ALPHA_SIZE:
 
353
                config->alphaBits = value;
 
354
                break;
 
355
              case GLX_DEPTH_SIZE:
 
356
                config->depthBits = value;
 
357
                break;
 
358
              case GLX_STENCIL_SIZE:
 
359
                config->stencilBits = value;
 
360
                break;
 
361
              case GLX_ACCUM_RED_SIZE:
 
362
                config->accumRedBits = value;
 
363
                break;
 
364
              case GLX_ACCUM_GREEN_SIZE:
 
365
                config->accumGreenBits = value;
 
366
                break;
 
367
              case GLX_ACCUM_BLUE_SIZE:
 
368
                config->accumBlueBits = value;
 
369
                break;
 
370
              case GLX_ACCUM_ALPHA_SIZE:
 
371
                config->accumAlphaBits = value;
 
372
                break;
 
373
              case GLX_RENDER_TYPE:
 
374
                config->renderType = value;
 
375
                break;
 
376
              case GLX_DRAWABLE_TYPE:
 
377
                config->drawableType = value;
 
378
                break;
 
379
              case GLX_X_VISUAL_TYPE:
 
380
                config->visualType = value;
 
381
                break;
 
382
              case GLX_CONFIG_CAVEAT:
 
383
                config->visualCaveat = value;
 
384
                break;
 
385
              case GLX_TRANSPARENT_TYPE:
 
386
                config->transparentType = value;
 
387
                break;
 
388
              case GLX_TRANSPARENT_INDEX_VALUE:
 
389
                config->transparentIndex = value;
 
390
                break;
 
391
              case GLX_TRANSPARENT_RED_VALUE:
 
392
                config->transparentRed = value;
 
393
                break;
 
394
              case GLX_TRANSPARENT_GREEN_VALUE:
 
395
                config->transparentGreen = value;
 
396
                break;
 
397
              case GLX_TRANSPARENT_BLUE_VALUE:
 
398
                config->transparentBlue = value;
 
399
                break;
 
400
              case GLX_TRANSPARENT_ALPHA_VALUE:
 
401
                config->transparentAlpha = value;
 
402
                break;
 
403
              case GLX_MAX_PBUFFER_WIDTH:
 
404
                config->maxPbufferWidth = value;
 
405
                break;
 
406
              case GLX_MAX_PBUFFER_HEIGHT:
 
407
                config->maxPbufferHeight = value;
 
408
                break;
 
409
              case GLX_MAX_PBUFFER_PIXELS:
 
410
                config->maxPbufferPixels = value;
 
411
                break;
 
412
              case GLX_VISUAL_ID:       
 
413
                config->associatedVisualId = value;
 
414
                break;
 
415
 
 
416
              /* visualSelectGroup is an internal used property */
 
417
              case GLX_VISUAL_SELECT_GROUP_SGIX:
 
418
                config->visualSelectGroup = value;
 
419
                break;
 
420
 
 
421
              /* SGIS_multisample attributes */
 
422
              case GLX_SAMPLES_SGIS:
 
423
                config->multiSampleSize = value;
 
424
                break;
 
425
              case GLX_SAMPLE_BUFFERS_SGIS:
 
426
                config->nMultiSampleBuffers = value;
 
427
                break;
 
428
 
 
429
              /* SGIX_pbuffer specific attributes */
 
430
              case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
 
431
                config->optimalPbufferWidth = value;
 
432
                break;
 
433
              case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
 
434
                config->optimalPbufferHeight = value;
 
435
                break;
 
436
 
 
437
              default:
 
438
                /* Ignore attributes we don't recognize */
 
439
                break;
 
440
            }
 
441
        } /* for j */
 
442
 
 
443
        /* Fill in derived values */
 
444
        config->screen = screen;
 
445
 
 
446
        config->rgbMode = config->renderType & GLX_RGBA_BIT;
 
447
        config->colorIndexMode = !config->rgbMode;
 
448
 
 
449
        config->haveAccumBuffer =
 
450
            config->accumRedBits > 0 ||
 
451
            config->accumGreenBits > 0 ||
 
452
            config->accumBlueBits > 0;
 
453
            /* Can't have alpha without color */
 
454
 
 
455
        config->haveDepthBuffer = config->depthBits > 0;
 
456
        config->haveStencilBuffer =  config->stencilBits > 0;
 
457
 
 
458
        /* overlay visuals are not valid for now */
 
459
        if (!config->level) {
 
460
           config++;
 
461
           numValidConfigs++;
 
462
        }
 
463
 
 
464
    } /* for i */
 
465
    UnlockDisplay(dpy);
 
466
 
 
467
    config = fbconfigs;
 
468
    for (i=0; i<numValidConfigs; i++) {
 
469
 
 
470
        /* XXX hack to fill-in mask info (need a better way to do this) */
 
471
        if (config->associatedVisualId != 0) {
 
472
            XVisualInfo *vis, template;
 
473
            int n;
 
474
 
 
475
            template.screen = screen;
 
476
            template.visualid = config->associatedVisualId;
 
477
            vis = XGetVisualInfo(dpy, VisualScreenMask|VisualIDMask,
 
478
                                 &template, &n);
 
479
 
 
480
            if (vis != NULL) {
 
481
                config->redMask = (GLuint)vis->red_mask;
 
482
                config->greenMask = (GLuint)vis->green_mask;
 
483
                config->blueMask = (GLuint)vis->blue_mask;
 
484
                config->alphaMask = 0;  /* XXX */
 
485
                free(vis);
 
486
            }
 
487
        }
 
488
 
 
489
        config++;
 
490
    } /* for i */
 
491
 
 
492
    XFree(attrs);
 
493
    SyncHandle();
 
494
 
 
495
    *nconfigs = numValidConfigs;
 
496
    return fbconfigs;
 
497
}
 
498
 
 
499
__GLXvisualConfig *
 
500
GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig *fbconfigs, int nfbconfigs, 
 
501
                                 XVisualInfo *visuals, int nvisuals,
 
502
                                 __GLXvisualConfig *glxConfigs, int nGlxConfigs,
 
503
                                 int *nconfigs)
 
504
{
 
505
    __GLXvisualConfig *configs = NULL;
 
506
    int i;
 
507
    
 
508
    if (!fbconfigs || !nfbconfigs || !nconfigs) return(NULL);
 
509
    *nconfigs = 0;
 
510
 
 
511
    /* Allocate memory for our config structure */
 
512
    configs = (__GLXvisualConfig*)
 
513
        Xmalloc(nfbconfigs * sizeof(__GLXvisualConfig));
 
514
    if (!configs) {
 
515
        return NULL;
 
516
    }
 
517
    memset(configs, 0, nfbconfigs * sizeof(__GLXvisualConfig));
 
518
 
 
519
    for (i=0; i<nfbconfigs; i++) {
 
520
       __GLXFBConfig *fbcfg = &fbconfigs[i];
 
521
 
 
522
       if (fbcfg->associatedVisualId > 0) {
 
523
          __GLXvisualConfig *cfg = configs + (*nconfigs);
 
524
          int j;
 
525
          XVisualInfo *vinfo = NULL;
 
526
 
 
527
          for (j=0; j<nvisuals; j++) {
 
528
             if (visuals[j].visualid == fbcfg->associatedVisualId) {
 
529
                vinfo = &visuals[j];
 
530
                break;
 
531
             }
 
532
          }
 
533
          if (!vinfo) continue;
 
534
 
 
535
          /* skip 16 bit colormap visuals */
 
536
          if (vinfo->depth == 16 &&
 
537
              vinfo->class != TrueColor &&
 
538
              vinfo->class != DirectColor ) {
 
539
             continue;
 
540
          }
 
541
 
 
542
          (*nconfigs)++;
 
543
 
 
544
          /*
 
545
           * if the same visualid exists in the glx configs,
 
546
           * copy the glx attributes from the glx config
 
547
           */
 
548
          for (j=0; j<nGlxConfigs; j++) {
 
549
             if (glxConfigs[j].vid == vinfo->visualid) 
 
550
                break;
 
551
          }
 
552
          if (j < nGlxConfigs) {
 
553
             memcpy(cfg, &glxConfigs[j], sizeof(__GLXvisualConfig) );
 
554
             continue;
 
555
          }
 
556
 
 
557
          /*
 
558
           * make glx attributes from the FB config attributes
 
559
           */
 
560
          cfg->vid = fbcfg->associatedVisualId;
 
561
          cfg->class = vinfo->class;
 
562
          cfg->rgba = !(fbcfg->renderType & GLX_COLOR_INDEX_BIT_SGIX);
 
563
          cfg->redSize = fbcfg->redBits;
 
564
          cfg->greenSize = fbcfg->greenBits;
 
565
          cfg->blueSize = fbcfg->blueBits;
 
566
          cfg->alphaSize = fbcfg->alphaBits;
 
567
          cfg->redMask = fbcfg->redMask;
 
568
          cfg->greenMask = fbcfg->greenMask;
 
569
          cfg->blueMask = fbcfg->blueMask;
 
570
          cfg->alphaMask = fbcfg->alphaMask;
 
571
          cfg->accumRedSize = fbcfg->accumRedBits;
 
572
          cfg->accumGreenSize = fbcfg->accumGreenBits;
 
573
          cfg->accumBlueSize = fbcfg->accumBlueBits;
 
574
          cfg->accumAlphaSize = fbcfg->accumAlphaBits;
 
575
          cfg->doubleBuffer = fbcfg->doubleBufferMode;
 
576
          cfg->stereo = fbcfg->stereoMode;
 
577
          if (vinfo->class == TrueColor || vinfo->class == DirectColor) {
 
578
             cfg->bufferSize = (fbcfg->rgbMode ? (fbcfg->redBits +
 
579
                                               fbcfg->greenBits +
 
580
                                               fbcfg->blueBits +
 
581
                                               fbcfg->alphaBits)
 
582
                                            : fbcfg->indexBits );
 
583
          }
 
584
          else {
 
585
             cfg->bufferSize = vinfo->depth;
 
586
          }
 
587
          cfg->depthSize = fbcfg->depthBits;
 
588
          cfg->stencilSize = fbcfg->stencilBits;
 
589
          cfg->auxBuffers = fbcfg->maxAuxBuffers;
 
590
          cfg->level = fbcfg->level;
 
591
          cfg->visualRating = fbcfg->visualCaveat;
 
592
          cfg->transparentPixel = fbcfg->transparentType;
 
593
          cfg->transparentRed = fbcfg->transparentRed;
 
594
          cfg->transparentGreen = fbcfg->transparentGreen;
 
595
          cfg->transparentBlue = fbcfg->transparentBlue;
 
596
          cfg->transparentAlpha = fbcfg->transparentAlpha;
 
597
          cfg->transparentIndex = fbcfg->transparentIndex;
 
598
          cfg->multiSampleSize = fbcfg->multiSampleSize;
 
599
          cfg->nMultiSampleBuffers = fbcfg->nMultiSampleBuffers;
 
600
          cfg->visualSelectGroup = fbcfg->visualSelectGroup;
 
601
       }
 
602
    }
 
603
 
 
604
    return( configs );
 
605
}
 
606