2 * EGL Configuration (pixel format) functions.
10 #include "eglconfig.h"
11 #include "egldisplay.h"
12 #include "egldriver.h"
13 #include "eglglobals.h"
16 #define MIN2(A, B) (((A) < (B)) ? (A) : (B))
20 * Convert an _EGLConfig to a __GLcontextModes object.
23 _eglConfigToContextModesRec(const _EGLConfig
*config
, __GLcontextModes
*mode
)
25 memset(mode
, 0, sizeof(*mode
));
27 mode
->rgbMode
= GL_TRUE
; /* no color index */
28 mode
->colorIndexMode
= GL_FALSE
;
29 mode
->doubleBufferMode
= GL_TRUE
;
30 mode
->stereoMode
= GL_FALSE
;
32 mode
->redBits
= GET_CONFIG_ATTRIB(config
, EGL_RED_SIZE
);
33 mode
->greenBits
= GET_CONFIG_ATTRIB(config
, EGL_GREEN_SIZE
);
34 mode
->blueBits
= GET_CONFIG_ATTRIB(config
, EGL_BLUE_SIZE
);
35 mode
->alphaBits
= GET_CONFIG_ATTRIB(config
, EGL_ALPHA_SIZE
);
36 mode
->rgbBits
= mode
->redBits
+ mode
->greenBits
37 + mode
->blueBits
+ mode
->alphaBits
;
39 mode
->depthBits
= GET_CONFIG_ATTRIB(config
, EGL_DEPTH_SIZE
);
40 mode
->haveDepthBuffer
= mode
->depthBits
> 0;
42 mode
->stencilBits
= GET_CONFIG_ATTRIB(config
, EGL_STENCIL_SIZE
);
43 mode
->haveStencilBuffer
= mode
->stencilBits
> 0;
45 mode
->level
= GET_CONFIG_ATTRIB(config
, EGL_LEVEL
);
46 mode
->samples
= GET_CONFIG_ATTRIB(config
, EGL_SAMPLES
);
47 mode
->sampleBuffers
= GET_CONFIG_ATTRIB(config
, EGL_SAMPLE_BUFFERS
);
53 _eglSetConfigAttrib(_EGLConfig
*config
, EGLint attr
, EGLint val
)
55 config
->Attrib
[attr
- FIRST_ATTRIB
] = val
;
59 config
->glmode
.rgbBits
= val
;
62 config
->glmode
.alphaBits
= val
;
65 config
->glmode
.blueBits
= val
;
68 config
->glmode
.greenBits
= val
;
71 config
->glmode
.redBits
= val
;
74 config
->glmode
.depthBits
= val
;
76 case EGL_STENCIL_SIZE
:
77 config
->glmode
.stencilBits
= val
;
79 case EGL_CONFIG_CAVEAT
:
85 case EGL_MAX_PBUFFER_HEIGHT
:
87 case EGL_MAX_PBUFFER_PIXELS
:
89 case EGL_MAX_PBUFFER_WIDTH
:
91 case EGL_NATIVE_RENDERABLE
:
93 case EGL_NATIVE_VISUAL_ID
:
95 case EGL_NATIVE_VISUAL_TYPE
:
99 case EGL_SAMPLE_BUFFERS
:
101 case EGL_SURFACE_TYPE
:
102 config
->glmode
.drawableType
= val
;
104 case EGL_TRANSPARENT_TYPE
:
106 case EGL_TRANSPARENT_BLUE_VALUE
:
108 case EGL_TRANSPARENT_GREEN_VALUE
:
110 case EGL_TRANSPARENT_RED_VALUE
:
114 case EGL_BIND_TO_TEXTURE_RGB
:
116 case EGL_BIND_TO_TEXTURE_RGBA
:
118 case EGL_MIN_SWAP_INTERVAL
:
120 case EGL_MAX_SWAP_INTERVAL
:
129 * Init the given _EGLconfig to default values.
130 * \param id the configuration's ID.
133 _eglInitConfig(_EGLConfig
*config
, EGLint id
)
135 memset(config
, 0, sizeof(*config
));
137 _eglSetConfigAttrib(config
, EGL_CONFIG_ID
, id
);
138 _eglSetConfigAttrib(config
, EGL_BIND_TO_TEXTURE_RGB
, EGL_DONT_CARE
);
139 _eglSetConfigAttrib(config
, EGL_BIND_TO_TEXTURE_RGBA
, EGL_DONT_CARE
);
140 _eglSetConfigAttrib(config
, EGL_CONFIG_CAVEAT
, EGL_DONT_CARE
);
141 _eglSetConfigAttrib(config
, EGL_NATIVE_RENDERABLE
, EGL_DONT_CARE
);
142 _eglSetConfigAttrib(config
, EGL_NATIVE_VISUAL_TYPE
, EGL_DONT_CARE
);
143 _eglSetConfigAttrib(config
, EGL_MIN_SWAP_INTERVAL
, EGL_DONT_CARE
);
144 _eglSetConfigAttrib(config
, EGL_MAX_SWAP_INTERVAL
, EGL_DONT_CARE
);
145 _eglSetConfigAttrib(config
, EGL_SURFACE_TYPE
,
146 EGL_SCREEN_BIT_MESA
| EGL_PBUFFER_BIT
|
147 EGL_PIXMAP_BIT
| EGL_WINDOW_BIT
);
148 _eglSetConfigAttrib(config
, EGL_TRANSPARENT_TYPE
, EGL_NONE
);
149 _eglSetConfigAttrib(config
, EGL_TRANSPARENT_RED_VALUE
, EGL_DONT_CARE
);
150 _eglSetConfigAttrib(config
, EGL_TRANSPARENT_GREEN_VALUE
, EGL_DONT_CARE
);
151 _eglSetConfigAttrib(config
, EGL_TRANSPARENT_BLUE_VALUE
, EGL_DONT_CARE
);
156 * Given an EGLConfig handle, return the corresponding _EGLConfig object.
159 _eglLookupConfig(_EGLDriver
*drv
, EGLDisplay dpy
, EGLConfig config
)
162 _EGLDisplay
*disp
= _eglLookupDisplay(dpy
);
163 for (i
= 0; i
< disp
->NumConfigs
; i
++) {
164 if (disp
->Configs
[i
].Handle
== config
) {
165 return disp
->Configs
+ i
;
173 * Add the given _EGLConifg to the given display.
176 _eglAddConfig(_EGLDisplay
*display
, const _EGLConfig
*config
)
178 _EGLConfig
*newConfigs
;
181 n
= display
->NumConfigs
;
183 newConfigs
= (_EGLConfig
*) realloc(display
->Configs
,
184 (n
+ 1) * sizeof(_EGLConfig
));
186 display
->Configs
= newConfigs
;
187 display
->Configs
[n
] = *config
; /* copy struct */
188 display
->Configs
[n
].Handle
= n
;
189 display
->NumConfigs
++;
190 return display
->Configs
+ n
;
199 * Parse the attrib_list to fill in the fields of the given _egl_config
200 * Return EGL_FALSE if any errors, EGL_TRUE otherwise.
203 _eglParseConfigAttribs(_EGLConfig
*config
, const EGLint
*attrib_list
)
207 /* XXX set all config attribs to EGL_DONT_CARE */
209 for (i
= 0; attrib_list
&& attrib_list
[i
] != EGL_NONE
; i
++) {
210 EGLint k
= attrib_list
[i
] - FIRST_ATTRIB
;
211 if (k
>= 0 && k
< MAX_ATTRIBS
) {
212 config
->Attrib
[k
] = attrib_list
[++i
];
215 _eglError(EGL_BAD_ATTRIBUTE
, "eglChooseConfig");
232 EGLint MatchCriteria
;
236 /* This encodes the info from Table 3.5 of the EGL spec, ordered by
239 static struct sort_info SortInfo
[] = {
240 { EGL_CONFIG_CAVEAT
, EXACT
, SPECIAL
},
241 { EGL_RED_SIZE
, ATLEAST
, SPECIAL
},
242 { EGL_GREEN_SIZE
, ATLEAST
, SPECIAL
},
243 { EGL_BLUE_SIZE
, ATLEAST
, SPECIAL
},
244 { EGL_ALPHA_SIZE
, ATLEAST
, SPECIAL
},
245 { EGL_BUFFER_SIZE
, ATLEAST
, SMALLER
},
246 { EGL_SAMPLE_BUFFERS
, ATLEAST
, SMALLER
},
247 { EGL_SAMPLES
, ATLEAST
, SMALLER
},
248 { EGL_DEPTH_SIZE
, ATLEAST
, SMALLER
},
249 { EGL_STENCIL_SIZE
, ATLEAST
, SMALLER
},
250 { EGL_NATIVE_VISUAL_TYPE
, EXACT
, SPECIAL
},
251 { EGL_CONFIG_ID
, EXACT
, SMALLER
},
252 { EGL_BIND_TO_TEXTURE_RGB
, EXACT
, NONE
},
253 { EGL_BIND_TO_TEXTURE_RGBA
, EXACT
, NONE
},
254 { EGL_LEVEL
, EXACT
, NONE
},
255 { EGL_NATIVE_RENDERABLE
, EXACT
, NONE
},
256 { EGL_MAX_SWAP_INTERVAL
, EXACT
, NONE
},
257 { EGL_MIN_SWAP_INTERVAL
, EXACT
, NONE
},
258 { EGL_SURFACE_TYPE
, MASK
, NONE
},
259 { EGL_TRANSPARENT_TYPE
, EXACT
, NONE
},
260 { EGL_TRANSPARENT_RED_VALUE
, EXACT
, NONE
},
261 { EGL_TRANSPARENT_GREEN_VALUE
, EXACT
, NONE
},
262 { EGL_TRANSPARENT_BLUE_VALUE
, EXACT
, NONE
},
268 * Return EGL_TRUE if the attributes of c meet or exceed the minimums
272 _eglConfigQualifies(const _EGLConfig
*c
, const _EGLConfig
*min
)
275 for (i
= 0; SortInfo
[i
].Attribute
!= 0; i
++) {
276 const EGLint mv
= GET_CONFIG_ATTRIB(min
, SortInfo
[i
].Attribute
);
277 if (mv
!= EGL_DONT_CARE
) {
278 const EGLint cv
= GET_CONFIG_ATTRIB(c
, SortInfo
[i
].Attribute
);
279 if (SortInfo
[i
].MatchCriteria
== EXACT
) {
284 else if (SortInfo
[i
].MatchCriteria
== ATLEAST
) {
290 assert(SortInfo
[i
].MatchCriteria
== MASK
);
291 if ((mv
& cv
) != mv
) {
302 * Compare configs 'a' and 'b' and return -1 if a belongs before b,
303 * 1 if a belongs after b, or 0 if they're equal.
306 _eglCompareConfigs(const _EGLConfig
*a
, const _EGLConfig
*b
)
309 for (i
= 0; SortInfo
[i
].Attribute
!= 0; i
++) {
310 const EGLint av
= GET_CONFIG_ATTRIB(a
, SortInfo
[i
].Attribute
);
311 const EGLint bv
= GET_CONFIG_ATTRIB(b
, SortInfo
[i
].Attribute
);
312 if (SortInfo
[i
].SortOrder
== SMALLER
) {
317 /* else, continue examining attribute values */
319 else if (SortInfo
[i
].SortOrder
== SPECIAL
) {
320 if (SortInfo
[i
].Attribute
== EGL_CONFIG_CAVEAT
) {
321 /* values are EGL_NONE, SLOW_CONFIG, or NON_CONFORMANT_CONFIG */
327 else if (SortInfo
[i
].Attribute
== EGL_RED_SIZE
||
328 SortInfo
[i
].Attribute
== EGL_GREEN_SIZE
||
329 SortInfo
[i
].Attribute
== EGL_BLUE_SIZE
||
330 SortInfo
[i
].Attribute
== EGL_ALPHA_SIZE
) {
337 assert(SortInfo
[i
].Attribute
== EGL_NATIVE_VISUAL_TYPE
);
345 assert(SortInfo
[i
].SortOrder
== NONE
);
346 /* continue examining attribute values */
354 * Typical fallback routine for eglChooseConfig
357 _eglChooseConfig(_EGLDriver
*drv
, EGLDisplay dpy
, const EGLint
*attrib_list
, EGLConfig
*configs
, EGLint config_size
, EGLint
*num_config
)
359 _EGLDisplay
*disp
= _eglLookupDisplay(dpy
);
363 /* parse the attrib_list to initialize criteria */
364 if (!_eglParseConfigAttribs(&criteria
, attrib_list
)) {
369 for (i
= 0; i
< disp
->NumConfigs
; i
++) {
370 const _EGLConfig
*conf
= disp
->Configs
+ i
;
371 if (_eglConfigQualifies(conf
, &criteria
)) {
372 if (*num_config
< config_size
) {
374 configs
[*num_config
] = conf
->Handle
;
383 /* XXX sort the list here */
390 * Fallback for eglGetConfigAttrib.
393 _eglGetConfigAttrib(_EGLDriver
*drv
, EGLDisplay dpy
, EGLConfig config
, EGLint attribute
, EGLint
*value
)
395 const _EGLConfig
*conf
= _eglLookupConfig(drv
, dpy
, config
);
396 const EGLint k
= attribute
- FIRST_ATTRIB
;
397 if (k
>= 0 && k
< MAX_ATTRIBS
) {
398 *value
= conf
->Attrib
[k
];
402 _eglError(EGL_BAD_ATTRIBUTE
, "eglGetConfigAttrib");
409 * Fallback for eglGetConfigs.
412 _eglGetConfigs(_EGLDriver
*drv
, EGLDisplay dpy
, EGLConfig
*configs
, EGLint config_size
, EGLint
*num_config
)
414 _EGLDisplay
*disp
= _eglLookupDisplay(dpy
);
416 if (!drv
->Initialized
) {
417 _eglError(EGL_NOT_INITIALIZED
, "eglGetConfigs");
423 *num_config
= MIN2(disp
->NumConfigs
, config_size
);
424 for (i
= 0; i
< *num_config
; i
++) {
425 configs
[i
] = disp
->Configs
[i
].Handle
;
428 *num_config
= disp
->NumConfigs
;
435 * Creates a set of \c __GLcontextModes that a driver will expose.
437 * A set of \c __GLcontextModes will be created based on the supplied
438 * parameters. The number of modes processed will be 2 *
439 * \c num_depth_stencil_bits * \c num_db_modes.
441 * For the most part, data is just copied from \c depth_bits, \c stencil_bits,
442 * \c db_modes, and \c visType into each \c __GLcontextModes element.
443 * However, the meanings of \c fb_format and \c fb_type require further
444 * explanation. The \c fb_format specifies which color components are in
445 * each pixel and what the default order is. For example, \c GL_RGB specifies
446 * that red, green, blue are available and red is in the "most significant"
447 * position and blue is in the "least significant". The \c fb_type specifies
448 * the bit sizes of each component and the actual ordering. For example, if
449 * \c GL_UNSIGNED_SHORT_5_6_5_REV is specified with \c GL_RGB, bits [15:11]
450 * are the blue value, bits [10:5] are the green value, and bits [4:0] are
453 * One sublte issue is the combination of \c GL_RGB or \c GL_BGR and either
454 * of the \c GL_UNSIGNED_INT_8_8_8_8 modes. The resulting mask values in the
455 * \c __GLcontextModes structure is \b identical to the \c GL_RGBA or
456 * \c GL_BGRA case, except the \c alphaMask is zero. This means that, as
457 * far as this routine is concerned, \c GL_RGB with \c GL_UNSIGNED_INT_8_8_8_8
458 * still uses 32-bits.
460 * If in doubt, look at the tables used in the function.
462 * \param ptr_to_modes Pointer to a pointer to a linked list of
463 * \c __GLcontextModes. Upon completion, a pointer to
464 * the next element to be process will be stored here.
465 * If the function fails and returns \c GL_FALSE, this
466 * value will be unmodified, but some elements in the
467 * linked list may be modified.
468 * \param fb_format Format of the framebuffer. Currently only \c GL_RGB,
469 * \c GL_RGBA, \c GL_BGR, and \c GL_BGRA are supported.
470 * \param fb_type Type of the pixels in the framebuffer. Currently only
471 * \c GL_UNSIGNED_SHORT_5_6_5,
472 * \c GL_UNSIGNED_SHORT_5_6_5_REV,
473 * \c GL_UNSIGNED_INT_8_8_8_8, and
474 * \c GL_UNSIGNED_INT_8_8_8_8_REV are supported.
475 * \param depth_bits Array of depth buffer sizes to be exposed.
476 * \param stencil_bits Array of stencil buffer sizes to be exposed.
477 * \param num_depth_stencil_bits Number of entries in both \c depth_bits and
479 * \param db_modes Array of buffer swap modes. If an element has a
480 * value of \c GLX_NONE, then it represents a
481 * single-buffered mode. Other valid values are
482 * \c GLX_SWAP_EXCHANGE_OML, \c GLX_SWAP_COPY_OML, and
483 * \c GLX_SWAP_UNDEFINED_OML. See the
484 * GLX_OML_swap_method extension spec for more details.
485 * \param num_db_modes Number of entries in \c db_modes.
486 * \param visType GLX visual type. Usually either \c GLX_TRUE_COLOR or
487 * \c GLX_DIRECT_COLOR.
490 * \c GL_TRUE on success or \c GL_FALSE on failure. Currently the only
491 * cause of failure is a bad parameter (i.e., unsupported \c fb_format or
495 * There is currently no way to support packed RGB modes (i.e., modes with
496 * exactly 3 bytes per pixel) or floating-point modes. This could probably
497 * be done by creating some new, private enums with clever names likes
498 * \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32,
499 * \c GL_4HALF_16_16_16_16, etc. We can cross that bridge when we come to it.
502 _eglFillInConfigs(_EGLConfig
* configs
,
503 GLenum fb_format
, GLenum fb_type
,
504 const u_int8_t
* depth_bits
, const u_int8_t
* stencil_bits
,
505 unsigned num_depth_stencil_bits
,
506 const GLenum
* db_modes
, unsigned num_db_modes
,
508 static const u_int8_t bits_table
[3][4] = {
510 { 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */
511 { 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */
512 { 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */
515 /* The following arrays are all indexed by the fb_type masked with 0x07.
516 * Given the four supported fb_type values, this results in valid array
517 * indices of 3, 4, 5, and 7.
519 static const u_int32_t masks_table_rgb
[8][4] = {
520 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
521 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
522 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
523 {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5 */
524 {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5_REV */
525 {0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000}, /* 8_8_8_8 */
526 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
527 {0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000} /* 8_8_8_8_REV */
530 static const u_int32_t masks_table_rgba
[8][4] = {
531 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
532 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
533 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
534 {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5 */
535 {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5_REV */
536 {0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF}, /* 8_8_8_8 */
537 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
538 {0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000}, /* 8_8_8_8_REV */
541 static const u_int32_t masks_table_bgr
[8][4] = {
542 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
543 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
544 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
545 {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5 */
546 {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5_REV */
547 {0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000}, /* 8_8_8_8 */
548 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
549 {0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000}, /* 8_8_8_8_REV */
552 static const u_int32_t masks_table_bgra
[8][4] = {
553 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
554 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
555 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
556 {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5 */
557 {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5_REV */
558 {0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF}, /* 8_8_8_8 */
559 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
560 {0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000}, /* 8_8_8_8_REV */
563 static const u_int8_t bytes_per_pixel
[8] = {
564 0, 0, 0, 2, 2, 4, 0, 4
567 const u_int8_t
* bits
;
568 const u_int32_t
* masks
;
569 const int index
= fb_type
& 0x07;
575 if ( bytes_per_pixel
[index
] == 0 ) {
576 fprintf(stderr
, "[%s:%u] Framebuffer type 0x%04x has 0 bytes per pixel.\n",
577 __FUNCTION__
, __LINE__
, fb_type
);
581 /* Valid types are GL_UNSIGNED_SHORT_5_6_5 and GL_UNSIGNED_INT_8_8_8_8 and
584 * Valid formats are GL_RGBA, GL_RGB, and GL_BGRA.
586 switch ( fb_format
) {
588 bits
= (bytes_per_pixel
[index
] == 2) ? bits_table
[0] : bits_table
[1];
589 masks
= masks_table_rgb
[index
];
593 bits
= (bytes_per_pixel
[index
] == 2) ? bits_table
[0] : bits_table
[2];
594 masks
= masks_table_rgba
[index
];
598 bits
= (bytes_per_pixel
[index
] == 2) ? bits_table
[0] : bits_table
[1];
599 masks
= masks_table_bgr
[index
];
603 bits
= (bytes_per_pixel
[index
] == 2) ? bits_table
[0] : bits_table
[2];
604 masks
= masks_table_bgra
[index
];
608 fprintf(stderr
, "[%s:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.\n",
609 __FUNCTION__
, __LINE__
, fb_format
);
614 for (k
= 0; k
< num_depth_stencil_bits
; k
++) {
615 for (i
= 0; i
< num_db_modes
; i
++) {
616 for (j
= 0; j
< 2; j
++) {
618 _eglSetConfigAttrib(config
, EGL_RED_SIZE
, bits
[0]);
619 _eglSetConfigAttrib(config
, EGL_GREEN_SIZE
, bits
[1]);
620 _eglSetConfigAttrib(config
, EGL_BLUE_SIZE
, bits
[2]);
621 _eglSetConfigAttrib(config
, EGL_ALPHA_SIZE
, bits
[3]);
622 config
->glmode
.redMask
= masks
[0];
623 config
->glmode
.greenMask
= masks
[1];
624 config
->glmode
.blueMask
= masks
[2];
625 config
->glmode
.alphaMask
= masks
[3];
626 _eglSetConfigAttrib(config
, EGL_BUFFER_SIZE
,
627 config
->glmode
.redBits
+ config
->glmode
.greenBits
+
628 config
->glmode
.blueBits
+ config
->glmode
.alphaBits
);
630 config
->glmode
.accumRedBits
= 16 * j
;
631 config
->glmode
.accumGreenBits
= 16 * j
;
632 config
->glmode
.accumBlueBits
= 16 * j
;
633 config
->glmode
.accumAlphaBits
= (masks
[3] != 0) ? 16 * j
: 0;
634 config
->glmode
.visualRating
= (j
== 0) ? GLX_NONE
: GLX_SLOW_CONFIG
;
636 _eglSetConfigAttrib(config
, EGL_STENCIL_SIZE
, stencil_bits
[k
]);
637 _eglSetConfigAttrib(config
, EGL_DEPTH_SIZE
, depth_bits
[i
]);
639 config
->glmode
.visualType
= visType
;
640 config
->glmode
.renderType
= GLX_RGBA_BIT
;
641 _eglSetConfigAttrib(config
, EGL_SURFACE_TYPE
, EGL_SCREEN_BIT_MESA
|
642 EGL_PBUFFER_BIT
| EGL_PIXMAP_BIT
| EGL_WINDOW_BIT
);
644 config
->glmode
.rgbMode
= GL_TRUE
;
646 if (db_modes
[i
] == GLX_NONE
) {
647 config
->glmode
.doubleBufferMode
= GL_FALSE
;
649 config
->glmode
.doubleBufferMode
= GL_TRUE
;
650 config
->glmode
.swapMethod
= db_modes
[i
];
653 config
->glmode
.haveAccumBuffer
= ((config
->glmode
.accumRedBits
+
654 config
->glmode
.accumGreenBits
+
655 config
->glmode
.accumBlueBits
+
656 config
->glmode
.accumAlphaBits
) > 0);
657 config
->glmode
.haveDepthBuffer
= (config
->glmode
.depthBits
> 0);
658 config
->glmode
.haveStencilBuffer
= (config
->glmode
.stencilBits
> 0);