glxscreens.h revision 706f2543
1#ifdef HAVE_DIX_CONFIG_H
2#include <dix-config.h>
3#endif
4
5#ifndef _GLX_screens_h_
6#define _GLX_screens_h_
7
8/*
9 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
10 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice including the dates of first publication and
20 * either this permission notice or a reference to
21 * http://oss.sgi.com/projects/FreeB/
22 * shall be included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
29 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 *
32 * Except as contained in this notice, the name of Silicon Graphics, Inc.
33 * shall not be used in advertising or otherwise to promote the sale, use or
34 * other dealings in this Software without prior written authorization from
35 * Silicon Graphics, Inc.
36 */
37
38typedef struct __GLXconfig __GLXconfig;
39struct __GLXconfig {
40    __GLXconfig *next;
41    GLuint doubleBufferMode;
42    GLuint stereoMode;
43
44    GLint redBits, greenBits, blueBits, alphaBits;	/* bits per comp */
45    GLuint redMask, greenMask, blueMask, alphaMask;
46    GLint rgbBits;		/* total bits for rgb */
47    GLint indexBits;		/* total bits for colorindex */
48
49    GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
50    GLint depthBits;
51    GLint stencilBits;
52
53    GLint numAuxBuffers;
54
55    GLint level;
56
57    GLint pixmapMode;
58
59    /* GLX */
60    GLint visualID;
61    GLint visualType;     /**< One of the GLX X visual types. (i.e.,
62			   * \c GLX_TRUE_COLOR, etc.)
63			   */
64
65    /* EXT_visual_rating / GLX 1.2 */
66    GLint visualRating;
67
68    /* EXT_visual_info / GLX 1.2 */
69    GLint transparentPixel;
70				/*    colors are floats scaled to ints */
71    GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
72    GLint transparentIndex;
73
74    /* ARB_multisample / SGIS_multisample */
75    GLint sampleBuffers;
76    GLint samples;
77
78    /* SGIX_fbconfig / GLX 1.3 */
79    GLint drawableType;
80    GLint renderType;
81    GLint xRenderable;
82    GLint fbconfigID;
83
84    /* SGIX_pbuffer / GLX 1.3 */
85    GLint maxPbufferWidth;
86    GLint maxPbufferHeight;
87    GLint maxPbufferPixels;
88    GLint optimalPbufferWidth;   /* Only for SGIX_pbuffer. */
89    GLint optimalPbufferHeight;  /* Only for SGIX_pbuffer. */
90
91    /* SGIX_visual_select_group */
92    GLint visualSelectGroup;
93
94    /* OML_swap_method */
95    GLint swapMethod;
96
97    GLint screen;
98
99    /* EXT_texture_from_pixmap */
100    GLint bindToTextureRgb;
101    GLint bindToTextureRgba;
102    GLint bindToMipmapTexture;
103    GLint bindToTextureTargets;
104    GLint yInverted;
105};
106
107GLint glxConvertToXVisualType(int visualType);
108
109/*
110** Screen dependent data.  These methods are the interface between the DIX
111** and DDX layers of the GLX server extension.  The methods provide an
112** interface for context management on a screen.
113*/
114typedef struct __GLXscreen __GLXscreen;
115struct __GLXscreen {
116    void          (*destroy)       (__GLXscreen *screen);
117
118    __GLXcontext *(*createContext) (__GLXscreen *screen,
119				    __GLXconfig *modes,
120				    __GLXcontext *shareContext);
121
122    __GLXdrawable *(*createDrawable)(ClientPtr client,
123				     __GLXscreen *context,
124				     DrawablePtr pDraw,
125				     XID drawId,
126				     int type,
127				     XID glxDrawId,
128				     __GLXconfig *modes);
129    int            (*swapInterval)  (__GLXdrawable *drawable,
130				     int interval);
131
132    ScreenPtr pScreen;
133
134    /* Linked list of valid fbconfigs for this screen. */
135    __GLXconfig *fbconfigs;
136    int numFBConfigs;
137
138    /* Subset of fbconfigs that are exposed as GLX visuals. */
139    __GLXconfig **visuals;
140    GLint numVisuals;
141
142    char *GLextensions;
143
144    char *GLXvendor;
145    char *GLXextensions;
146
147    /**
148     * \name GLX version supported by this screen.
149     *
150     * Since the GLX version advertised by the server is for the whole server,
151     * the GLX protocol code uses the minimum version supported on all screens.
152     */
153    /*@{*/
154    unsigned GLXmajor;
155    unsigned GLXminor;
156    /*@}*/
157
158    Bool (*CloseScreen)(int index, ScreenPtr pScreen);
159};
160
161
162void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen);
163void __glXScreenDestroy(__GLXscreen *screen);
164
165#endif /* !__GLX_screens_h__ */
166