~ubuntu-branches/ubuntu/intrepid/xulrunner-1.9/intrepid

« back to all changes in this revision

Viewing changes to mozilla/gfx/cairo/glitz/src/glx/glitz_glx_format.c

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack, Alexander Sack, Fabien Tassin
  • Date: 2008-02-13 11:47:21 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080213114721-7om0mgzngvuk9czv
Tags: 1.9~b3+nobinonly-0ubuntu1
* release FIREFOX_3_0b3_RELEASE

[ Alexander Sack ]
* submit patch that ships xpcshell to bugzilla
  - rename debian/patches/ship_xpcshell.patch =>
           debian/patches/bz410617_att295212_ship_xpcshell.patch
  - update debian/patches/series
* fix tooltip in epiphany: previously displayed out of screen bounds
  (LP: #37507)
  - add debian/patches/bz233371_att297343_fix_outofscreen_embed_tooltip.patch
  - update debian/patches/series
* use default upstream gcc tweaks for improved performance - especially of the
  javascript engine
  - update debian/rules
* update global extension/plugin patch to apply cleanly against latest code
  - update debian/patches/bzXXX_gre_extension_plugin_support.patch
* fix pyxpcom build failure introduced by recent commit
  - add debian/patches/bzXXX_fix_pyxpcom_build_failure.patch
  - update debian/patches/series
* add distro independent global install locations for extensions,
  /usr/lib/mozilla/extensions and /usr/share/mozilla/extensions
  - update debian/xulrunner-1.9.dirs
* support embedded tarball layout when either there is a *.tar.bz2 in orig tarball
  or if DEBIAN_MOZCLIENT_EMBEDDED is not unset (you will need this to produce embedded
  tarballs during |get-orig-source|
  - update debian/rules
* bump minimum libnss3-dev build requirements to >= 3.12.0~1.9b3
  - update debian/control
* bump minimum libnspr4-dev build requirements to >= 4.7.0~1.9b3
  - update debian/control

[ Fabien Tassin ]
* Drop patches applied upstream
  - drop debian/patches/bz410617_att295212_ship_xpcshell.patch
  - drop debian/patches/bz404634_att294921.patch
  - drop debian/patches/bz386610_python2.5_ftbfs_amd64.patch
  - drop debian/patches/bz373918_att295042.patch
  - drop debian/patches/bz408062_unstable_pc.patch
  - drop debian/patches/bz384304_fix_recursive_symlinks.patch
  - update debian/patches/series
* Refresh diverged patches:
  - update debian/patches/bzXXX_pc_honour_system_nspr_nss.patch
  - update debian/patches/rename_venkman_addon.patch
  - update debian/patches/bz344818_cairo_xrender.patch
* Install links for all .so libs in the -dev package
  - update debian/patches/dont_install_so_in_dev.patch
* Bump gtk requirement to 2.12 as per Mozilla bug 412432
  - update debian/control
* Add #DEBHELPER# token to postinst/prerm scripts
  - update debian/xulrunner-1.9.{postinst,prerm}
* Install previously missed libdbusservice.so
  - update debian/xulrunner-1.9.install
* Update venkman patch to also rename locales
  - update debian/patches/rename_venkman_addon.patch
* Bump requirement for system cairo to >= 1.5.8 as we now need
  the newly added cairo_path_extents()
  - update debian/rules
* Include mozilla-devscripts file using -include so ifneq could be omitted
  - update debian/rules
* Fix missing .so symlinks regression
  - update debian/patches/dont_install_so_in_dev.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2004 David Reveman
3
 
 *
4
 
 * Permission to use, copy, modify, distribute, and sell this software
5
 
 * and its documentation for any purpose is hereby granted without
6
 
 * fee, provided that the above copyright notice appear in all copies
7
 
 * and that both that copyright notice and this permission notice
8
 
 * appear in supporting documentation, and that the name of
9
 
 * David Reveman not be used in advertising or publicity pertaining to
10
 
 * distribution of the software without specific, written prior permission.
11
 
 * David Reveman makes no representations about the suitability of this
12
 
 * software for any purpose. It is provided "as is" without express or
13
 
 * implied warranty.
14
 
 *
15
 
 * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16
 
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17
 
 * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18
 
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19
 
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20
 
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21
 
 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22
 
 *
23
 
 * Author: David Reveman <davidr@novell.com>
24
 
 */
25
 
 
26
 
#ifdef HAVE_CONFIG_H
27
 
#  include "../config.h"
28
 
#endif
29
 
 
30
 
#include "glitz_glxint.h"
31
 
 
32
 
#include <stdlib.h>
33
 
#include <string.h>
34
 
 
35
 
static int
36
 
_glitz_glx_format_compare (const void *elem1,
37
 
                           const void *elem2)
38
 
{
39
 
    glitz_int_drawable_format_t *format[2];
40
 
    int                         i, score[2];
41
 
 
42
 
    format[0] = (glitz_int_drawable_format_t *) elem1;
43
 
    format[1] = (glitz_int_drawable_format_t *) elem2;
44
 
    i = score[0] = score[1] = 0;
45
 
 
46
 
    for (; i < 2; i++)
47
 
    {
48
 
        if (format[i]->d.color.fourcc != GLITZ_FOURCC_RGB)
49
 
            score[i] -= 1000;
50
 
 
51
 
        if (format[i]->d.color.red_size)
52
 
        {
53
 
            if (format[i]->d.color.red_size >= 8)
54
 
                score[i] += 5;
55
 
 
56
 
            score[i] += 10;
57
 
        }
58
 
 
59
 
        if (format[i]->d.color.alpha_size)
60
 
        {
61
 
            if (format[i]->d.color.alpha_size >= 8)
62
 
                score[i] += 5;
63
 
 
64
 
            score[i] += 10;
65
 
        }
66
 
 
67
 
        if (format[i]->d.stencil_size)
68
 
            score[i] += 5;
69
 
 
70
 
        if (format[i]->d.depth_size)
71
 
            score[i] += 5;
72
 
 
73
 
        if (format[i]->d.doublebuffer)
74
 
            score[i] += 10;
75
 
 
76
 
        if (format[i]->d.samples > 1)
77
 
            score[i] -= (20 - format[i]->d.samples);
78
 
 
79
 
        if (format[i]->types & GLITZ_DRAWABLE_TYPE_WINDOW_MASK)
80
 
            score[i] += 10;
81
 
 
82
 
        if (format[i]->types & GLITZ_DRAWABLE_TYPE_PBUFFER_MASK)
83
 
            score[i] += 10;
84
 
 
85
 
        if (format[i]->caveat)
86
 
            score[i] -= 1000;
87
 
    }
88
 
 
89
 
    return score[1] - score[0];
90
 
}
91
 
 
92
 
static void
93
 
_glitz_add_format (glitz_glx_screen_info_t     *screen_info,
94
 
                   glitz_int_drawable_format_t *format)
95
 
{
96
 
    int n = screen_info->n_formats;
97
 
 
98
 
    screen_info->formats =
99
 
        realloc (screen_info->formats,
100
 
                 sizeof (glitz_int_drawable_format_t) * (n + 1));
101
 
    if (screen_info->formats)
102
 
    {
103
 
        screen_info->formats[n] = *format;
104
 
        screen_info->formats[n].d.id = n;
105
 
        screen_info->n_formats++;
106
 
    }
107
 
}
108
 
 
109
 
static void
110
 
_glitz_glx_query_formats (glitz_glx_screen_info_t *screen_info)
111
 
{
112
 
    Display                     *display;
113
 
    glitz_int_drawable_format_t format;
114
 
    XVisualInfo                 visual_templ;
115
 
    XVisualInfo                 *visuals;
116
 
    int                         i, num_visuals;
117
 
 
118
 
    display = screen_info->display_info->display;
119
 
 
120
 
    visual_templ.screen = screen_info->screen;
121
 
    visuals = XGetVisualInfo (display, VisualScreenMask,
122
 
                              &visual_templ, &num_visuals);
123
 
 
124
 
    /* No pbuffers without fbconfigs */
125
 
    format.types          = GLITZ_DRAWABLE_TYPE_WINDOW_MASK;
126
 
    format.d.id           = 0;
127
 
    format.d.color.fourcc = GLITZ_FOURCC_RGB;
128
 
 
129
 
    for (i = 0; i < num_visuals; i++)
130
 
    {
131
 
        int value;
132
 
 
133
 
        if ((glXGetConfig (display, &visuals[i], GLX_USE_GL, &value) != 0) ||
134
 
            (value == 0))
135
 
            continue;
136
 
 
137
 
        glXGetConfig (display, &visuals[i], GLX_RGBA, &value);
138
 
        if (value == 0)
139
 
            continue;
140
 
 
141
 
        /* Stereo is not supported yet */
142
 
        glXGetConfig (display, &visuals[i], GLX_STEREO, &value);
143
 
        if (value != 0)
144
 
            continue;
145
 
 
146
 
        glXGetConfig (display, &visuals[i], GLX_RED_SIZE, &value);
147
 
        format.d.color.red_size = (unsigned short) value;
148
 
        glXGetConfig (display, &visuals[i], GLX_GREEN_SIZE, &value);
149
 
        format.d.color.green_size = (unsigned short) value;
150
 
        glXGetConfig (display, &visuals[i], GLX_BLUE_SIZE, &value);
151
 
        format.d.color.blue_size = (unsigned short) value;
152
 
        glXGetConfig (display, &visuals[i], GLX_ALPHA_SIZE, &value);
153
 
        format.d.color.alpha_size = (unsigned short) value;
154
 
        glXGetConfig (display, &visuals[i], GLX_DEPTH_SIZE, &value);
155
 
        format.d.depth_size = (unsigned short) value;
156
 
        glXGetConfig (display, &visuals[i], GLX_STENCIL_SIZE, &value);
157
 
        format.d.stencil_size = (unsigned short) value;
158
 
        glXGetConfig (display, &visuals[i], GLX_DOUBLEBUFFER, &value);
159
 
        format.d.doublebuffer = (value) ? 1: 0;
160
 
 
161
 
        if (screen_info->glx_feature_mask &
162
 
            GLITZ_GLX_FEATURE_VISUAL_RATING_MASK)
163
 
        {
164
 
            glXGetConfig (display, &visuals[i], GLX_VISUAL_CAVEAT_EXT, &value);
165
 
            switch (value) {
166
 
            case GLX_SLOW_VISUAL_EXT:
167
 
            case GLX_NON_CONFORMANT_VISUAL_EXT:
168
 
                format.caveat = 1;
169
 
                break;
170
 
            default:
171
 
                format.caveat = 0;
172
 
                break;
173
 
            }
174
 
        }
175
 
        else
176
 
            format.caveat = 0;
177
 
 
178
 
        if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_MULTISAMPLE_MASK)
179
 
        {
180
 
            glXGetConfig (display, &visuals[i], GLX_SAMPLE_BUFFERS_ARB,
181
 
                          &value);
182
 
            if (value)
183
 
            {
184
 
                glXGetConfig (display, &visuals[i], GLX_SAMPLES_ARB, &value);
185
 
                format.d.samples = (unsigned short) (value > 1)? value: 1;
186
 
            }
187
 
            else
188
 
                format.d.samples = 1;
189
 
        }
190
 
        else
191
 
            format.d.samples = 1;
192
 
 
193
 
        format.u.uval = visuals[i].visualid;
194
 
 
195
 
        _glitz_add_format (screen_info, &format);
196
 
    }
197
 
 
198
 
    if (visuals)
199
 
        XFree (visuals);
200
 
}
201
 
 
202
 
static glitz_status_t
203
 
_glitz_glx_query_formats_using_fbconfigs (glitz_glx_screen_info_t *screen_info)
204
 
{
205
 
    glitz_glx_static_proc_address_list_t *glx = &screen_info->glx;
206
 
    Display                              *display;
207
 
    glitz_int_drawable_format_t          format;
208
 
    GLXFBConfig                          *fbconfigs;
209
 
    int                                  i, num_configs;
210
 
 
211
 
    display = screen_info->display_info->display;
212
 
 
213
 
    fbconfigs = glx->get_fbconfigs (display, screen_info->screen,
214
 
                                    &num_configs);
215
 
    if (!fbconfigs)
216
 
    {
217
 
        /* fbconfigs are not supported, falling back to visuals */
218
 
        screen_info->glx_feature_mask &= ~GLITZ_GLX_FEATURE_FBCONFIG_MASK;
219
 
        screen_info->glx_feature_mask &= ~GLITZ_GLX_FEATURE_PBUFFER_MASK;
220
 
 
221
 
        return GLITZ_STATUS_NOT_SUPPORTED;
222
 
    }
223
 
 
224
 
    for (i = 0; i < num_configs; i++)
225
 
    {
226
 
        int value;
227
 
 
228
 
        if ((glx->get_fbconfig_attrib (display, fbconfigs[i],
229
 
                                       GLX_RENDER_TYPE, &value) != 0) ||
230
 
            (!(value & GLX_RGBA_BIT)))
231
 
            continue;
232
 
 
233
 
        /* Stereo is not supported yet */
234
 
        glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_STEREO, &value);
235
 
        if (value != 0)
236
 
            continue;
237
 
 
238
 
        glx->get_fbconfig_attrib (display, fbconfigs[i],
239
 
                                  GLX_DRAWABLE_TYPE, &value);
240
 
        if (!((value & GLX_WINDOW_BIT) || (value & GLX_PBUFFER_BIT)))
241
 
            continue;
242
 
 
243
 
        format.types = 0;
244
 
        if (value & GLX_WINDOW_BIT)
245
 
            format.types |= GLITZ_DRAWABLE_TYPE_WINDOW_MASK;
246
 
 
247
 
        if (value & GLX_PBUFFER_BIT)
248
 
            format.types |= GLITZ_DRAWABLE_TYPE_PBUFFER_MASK;
249
 
 
250
 
        format.d.id           = 0;
251
 
        format.d.color.fourcc = GLITZ_FOURCC_RGB;
252
 
 
253
 
        glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_FBCONFIG_ID,
254
 
                                  &value);
255
 
        format.u.uval = value;
256
 
 
257
 
        glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_RED_SIZE, &value);
258
 
        format.d.color.red_size = (unsigned short) value;
259
 
        glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_GREEN_SIZE,
260
 
                                  &value);
261
 
        format.d.color.green_size = (unsigned short) value;
262
 
        glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_BLUE_SIZE,
263
 
                                  &value);
264
 
        format.d.color.blue_size = (unsigned short) value;
265
 
        glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_ALPHA_SIZE,
266
 
                                  &value);
267
 
        format.d.color.alpha_size = (unsigned short) value;
268
 
        glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_DEPTH_SIZE,
269
 
                                  &value);
270
 
        format.d.depth_size = (unsigned short) value;
271
 
        glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_STENCIL_SIZE,
272
 
                                  &value);
273
 
        format.d.stencil_size = (unsigned short) value;
274
 
        glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_DOUBLEBUFFER,
275
 
                                  &value);
276
 
        format.d.doublebuffer = (value)? 1: 0;
277
 
        glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_CONFIG_CAVEAT,
278
 
                                  &value);
279
 
        switch (value) {
280
 
        case GLX_SLOW_VISUAL_EXT:
281
 
        case GLX_NON_CONFORMANT_VISUAL_EXT:
282
 
            format.caveat = 1;
283
 
            break;
284
 
        default:
285
 
            format.caveat = 0;
286
 
            break;
287
 
        }
288
 
 
289
 
        if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_MULTISAMPLE_MASK)
290
 
        {
291
 
            glx->get_fbconfig_attrib (display, fbconfigs[i],
292
 
                                      GLX_SAMPLE_BUFFERS_ARB, &value);
293
 
            if (value)
294
 
            {
295
 
                glx->get_fbconfig_attrib (display, fbconfigs[i],
296
 
                                          GLX_SAMPLES_ARB, &value);
297
 
                format.d.samples = (unsigned short) (value > 1)? value: 1;
298
 
                if (format.d.samples > 1)
299
 
                {
300
 
                    if (!(screen_info->glx_feature_mask &
301
 
                          GLITZ_GLX_FEATURE_PBUFFER_MULTISAMPLE_MASK))
302
 
                        format.types &= ~GLITZ_DRAWABLE_TYPE_PBUFFER_MASK;
303
 
                }
304
 
            }
305
 
            else
306
 
                format.d.samples = 1;
307
 
        }
308
 
        else
309
 
            format.d.samples = 1;
310
 
 
311
 
        _glitz_add_format (screen_info, &format);
312
 
    }
313
 
 
314
 
    if (fbconfigs)
315
 
        XFree (fbconfigs);
316
 
 
317
 
    return GLITZ_STATUS_SUCCESS;
318
 
}
319
 
 
320
 
void
321
 
glitz_glx_query_formats (glitz_glx_screen_info_t *screen_info)
322
 
{
323
 
    glitz_status_t status = GLITZ_STATUS_NOT_SUPPORTED;
324
 
    int            i;
325
 
 
326
 
    if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_FBCONFIG_MASK)
327
 
        status = _glitz_glx_query_formats_using_fbconfigs (screen_info);
328
 
 
329
 
    if (status)
330
 
        _glitz_glx_query_formats (screen_info);
331
 
 
332
 
    if (!screen_info->n_formats)
333
 
        return;
334
 
 
335
 
    qsort (screen_info->formats, screen_info->n_formats,
336
 
           sizeof (glitz_int_drawable_format_t), _glitz_glx_format_compare);
337
 
 
338
 
    for (i = 0; i < screen_info->n_formats; i++)
339
 
        screen_info->formats[i].d.id = i;
340
 
}
341
 
 
342
 
glitz_drawable_format_t *
343
 
glitz_glx_find_window_format (Display                       *display,
344
 
                              int                           screen,
345
 
                              unsigned long                 mask,
346
 
                              const glitz_drawable_format_t *templ,
347
 
                              int                           count)
348
 
{
349
 
    glitz_int_drawable_format_t itempl;
350
 
    glitz_glx_screen_info_t *screen_info =
351
 
        glitz_glx_screen_info_get (display, screen);
352
 
 
353
 
    glitz_drawable_format_copy (templ, &itempl.d, mask);
354
 
 
355
 
    itempl.types = GLITZ_DRAWABLE_TYPE_WINDOW_MASK;
356
 
    mask |= GLITZ_INT_FORMAT_WINDOW_MASK;
357
 
 
358
 
    return glitz_drawable_format_find (screen_info->formats,
359
 
                                       screen_info->n_formats,
360
 
                                       mask, &itempl, count);
361
 
}
362
 
slim_hidden_def(glitz_glx_find_window_format);
363
 
 
364
 
glitz_drawable_format_t *
365
 
glitz_glx_find_pbuffer_format (Display                       *display,
366
 
                               int                           screen,
367
 
                               unsigned long                 mask,
368
 
                               const glitz_drawable_format_t *templ,
369
 
                               int                           count)
370
 
{
371
 
    glitz_int_drawable_format_t itempl;
372
 
    glitz_glx_screen_info_t *screen_info =
373
 
        glitz_glx_screen_info_get (display, screen);
374
 
 
375
 
    glitz_drawable_format_copy (templ, &itempl.d, mask);
376
 
 
377
 
    itempl.types = GLITZ_DRAWABLE_TYPE_PBUFFER_MASK;
378
 
    mask |= GLITZ_INT_FORMAT_PBUFFER_MASK;
379
 
 
380
 
    return glitz_drawable_format_find (screen_info->formats,
381
 
                                       screen_info->n_formats,
382
 
                                       mask, &itempl, count);
383
 
}
384
 
slim_hidden_def(glitz_glx_find_pbuffer_format);
385
 
 
386
 
glitz_drawable_format_t *
387
 
glitz_glx_find_drawable_format_for_visual (Display  *display,
388
 
                                           int       screen,
389
 
                                           VisualID  visual_id)
390
 
{
391
 
    glitz_drawable_format_t *format = NULL;
392
 
    glitz_glx_screen_info_t *screen_info;
393
 
    int                     i;
394
 
 
395
 
    screen_info = glitz_glx_screen_info_get (display, screen);
396
 
    if (!screen_info)
397
 
        return NULL;
398
 
 
399
 
    if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_FBCONFIG_MASK)
400
 
    {
401
 
        glitz_glx_static_proc_address_list_t *glx = &screen_info->glx;
402
 
        GLXFBConfig                          *fbconfigs;
403
 
        int                                  fid, n_fbconfigs;
404
 
 
405
 
        fid = -1;
406
 
        fbconfigs = glx->get_fbconfigs (display, screen, &n_fbconfigs);
407
 
        for (i = 0; i < n_fbconfigs; i++)
408
 
        {
409
 
            XVisualInfo *visinfo;
410
 
 
411
 
            visinfo = glx->get_visual_from_fbconfig (display, fbconfigs[i]);
412
 
            if (visinfo && visinfo->visualid == visual_id)
413
 
            {
414
 
                int value;
415
 
 
416
 
                glx->get_fbconfig_attrib (display, fbconfigs[i],
417
 
                                          GLX_FBCONFIG_ID, &value);
418
 
                for (fid = 0; fid < screen_info->n_formats; fid++)
419
 
                {
420
 
                    if (screen_info->formats[fid].u.uval == value)
421
 
                    {
422
 
                        format = &screen_info->formats[fid].d;
423
 
                        break;
424
 
                    }
425
 
                }
426
 
 
427
 
                if (format)
428
 
                    break;
429
 
            }
430
 
        }
431
 
 
432
 
        if (fbconfigs)
433
 
            XFree (fbconfigs);
434
 
    }
435
 
    else
436
 
    {
437
 
        for (i = 0; i < screen_info->n_formats; i++)
438
 
        {
439
 
            if (visual_id == screen_info->formats[i].u.uval)
440
 
            {
441
 
                format = &screen_info->formats[i].d;
442
 
                break;
443
 
            }
444
 
        }
445
 
    }
446
 
 
447
 
    return format;
448
 
}
449
 
slim_hidden_def(glitz_glx_find_drawable_format_for_visual);
450
 
 
451
 
XVisualInfo *
452
 
glitz_glx_get_visual_info_from_format (Display                 *display,
453
 
                                       int                     screen,
454
 
                                       glitz_drawable_format_t *format)
455
 
{
456
 
    XVisualInfo *vinfo = NULL;
457
 
    glitz_glx_screen_info_t *screen_info =
458
 
        glitz_glx_screen_info_get (display, screen);
459
 
    glitz_glx_static_proc_address_list_t *glx = &screen_info->glx;
460
 
 
461
 
    if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_FBCONFIG_MASK)
462
 
    {
463
 
        GLXFBConfig *fbconfigs;
464
 
        int         i, n_fbconfigs;
465
 
        int         fbconfigid = screen_info->formats[format->id].u.uval;
466
 
 
467
 
        fbconfigs = glx->get_fbconfigs (display, screen, &n_fbconfigs);
468
 
        for (i = 0; i < n_fbconfigs; i++)
469
 
        {
470
 
            int value;
471
 
 
472
 
            glx->get_fbconfig_attrib (display, fbconfigs[i],
473
 
                                      GLX_FBCONFIG_ID, &value);
474
 
            if (value == fbconfigid)
475
 
                break;
476
 
        }
477
 
 
478
 
        if (i < n_fbconfigs)
479
 
            vinfo = glx->get_visual_from_fbconfig (display, fbconfigs[i]);
480
 
 
481
 
        if (fbconfigs)
482
 
            XFree (fbconfigs);
483
 
 
484
 
    }
485
 
    else
486
 
    {
487
 
        XVisualInfo templ;
488
 
        int         n_items;
489
 
 
490
 
        templ.visualid = screen_info->formats[format->id].u.uval;
491
 
 
492
 
        vinfo = XGetVisualInfo (display, VisualIDMask, &templ, &n_items);
493
 
    }
494
 
 
495
 
    return vinfo;
496
 
}
497
 
slim_hidden_def(glitz_glx_get_visual_info_from_format);