glxscreens.h revision 6747b715
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 {
39    void * (* queryHyperpipeNetworkFunc)(int, int *, int *);
40    void * (* queryHyperpipeConfigFunc)(int, int, int *, int *);
41    int    (* destroyHyperpipeConfigFunc)(int, int);
42    void * (* hyperpipeConfigFunc)(int, int, int *, int *, void *);
43} __GLXHyperpipeExtensionFuncs;
44
45typedef struct {
46    int    (* bindSwapBarrierFunc)(int, XID, int);
47    int    (* queryMaxSwapBarriersFunc)(int);
48} __GLXSwapBarrierExtensionFuncs;
49
50void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs);
51void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs);
52
53typedef struct __GLXconfig __GLXconfig;
54struct __GLXconfig {
55    __GLXconfig *next;
56    GLuint doubleBufferMode;
57    GLuint stereoMode;
58
59    GLint redBits, greenBits, blueBits, alphaBits;	/* bits per comp */
60    GLuint redMask, greenMask, blueMask, alphaMask;
61    GLint rgbBits;		/* total bits for rgb */
62    GLint indexBits;		/* total bits for colorindex */
63
64    GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
65    GLint depthBits;
66    GLint stencilBits;
67
68    GLint numAuxBuffers;
69
70    GLint level;
71
72    GLint pixmapMode;
73
74    /* GLX */
75    GLint visualID;
76    GLint visualType;     /**< One of the GLX X visual types. (i.e.,
77			   * \c GLX_TRUE_COLOR, etc.)
78			   */
79
80    /* EXT_visual_rating / GLX 1.2 */
81    GLint visualRating;
82
83    /* EXT_visual_info / GLX 1.2 */
84    GLint transparentPixel;
85				/*    colors are floats scaled to ints */
86    GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
87    GLint transparentIndex;
88
89    /* ARB_multisample / SGIS_multisample */
90    GLint sampleBuffers;
91    GLint samples;
92
93    /* SGIX_fbconfig / GLX 1.3 */
94    GLint drawableType;
95    GLint renderType;
96    GLint xRenderable;
97    GLint fbconfigID;
98
99    /* SGIX_pbuffer / GLX 1.3 */
100    GLint maxPbufferWidth;
101    GLint maxPbufferHeight;
102    GLint maxPbufferPixels;
103    GLint optimalPbufferWidth;   /* Only for SGIX_pbuffer. */
104    GLint optimalPbufferHeight;  /* Only for SGIX_pbuffer. */
105
106    /* SGIX_visual_select_group */
107    GLint visualSelectGroup;
108
109    /* OML_swap_method */
110    GLint swapMethod;
111
112    GLint screen;
113
114    /* EXT_texture_from_pixmap */
115    GLint bindToTextureRgb;
116    GLint bindToTextureRgba;
117    GLint bindToMipmapTexture;
118    GLint bindToTextureTargets;
119    GLint yInverted;
120};
121
122GLint glxConvertToXVisualType(int visualType);
123
124/*
125** Screen dependent data.  These methods are the interface between the DIX
126** and DDX layers of the GLX server extension.  The methods provide an
127** interface for context management on a screen.
128*/
129typedef struct __GLXscreen __GLXscreen;
130struct __GLXscreen {
131    void          (*destroy)       (__GLXscreen *screen);
132
133    __GLXcontext *(*createContext) (__GLXscreen *screen,
134				    __GLXconfig *modes,
135				    __GLXcontext *shareContext);
136
137    __GLXdrawable *(*createDrawable)(ClientPtr client,
138				     __GLXscreen *context,
139				     DrawablePtr pDraw,
140				     XID drawId,
141				     int type,
142				     XID glxDrawId,
143				     __GLXconfig *modes);
144    int            (*swapInterval)  (__GLXdrawable *drawable,
145				     int interval);
146
147    __GLXHyperpipeExtensionFuncs *hyperpipeFuncs;
148    __GLXSwapBarrierExtensionFuncs *swapBarrierFuncs;
149
150    ScreenPtr pScreen;
151
152    /* Linked list of valid fbconfigs for this screen. */
153    __GLXconfig *fbconfigs;
154    int numFBConfigs;
155
156    /* Subset of fbconfigs that are exposed as GLX visuals. */
157    __GLXconfig **visuals;
158    GLint numVisuals;
159
160    char *GLextensions;
161
162    char *GLXvendor;
163    char *GLXversion;
164    char *GLXextensions;
165
166    /**
167     * \name GLX version supported by this screen.
168     *
169     * Since the GLX version advertised by the server is for the whole server,
170     * the GLX protocol code uses the minimum version supported on all screens.
171     */
172    /*@{*/
173    unsigned GLXmajor;
174    unsigned GLXminor;
175    /*@}*/
176
177    Bool (*CloseScreen)(int index, ScreenPtr pScreen);
178};
179
180
181void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen);
182void __glXScreenDestroy(__GLXscreen *screen);
183
184#endif /* !__GLX_screens_h__ */
185