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 
38 #include "extension_string.h"
39 #include "glxvndabi.h"
40 
41 typedef struct __GLXconfig __GLXconfig;
42 struct __GLXconfig {
43     /* Management */
44     __GLXconfig *next;
45 #ifdef COMPOSITE
46     GLboolean duplicatedForComp;
47 #endif
48     GLuint doubleBufferMode;
49     GLuint stereoMode;
50 
51     GLint redBits, greenBits, blueBits, alphaBits;      /* bits per comp */
52     GLuint redMask, greenMask, blueMask, alphaMask;
53     GLint rgbBits;              /* total bits for rgb */
54     GLint indexBits;            /* total bits for colorindex */
55 
56     GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
57     GLint depthBits;
58     GLint stencilBits;
59 
60     GLint numAuxBuffers;
61 
62     GLint level;
63 
64     /* GLX */
65     GLint visualID;
66     GLint visualType;     /**< One of the GLX X visual types. (i.e.,
67 			   * \c GLX_TRUE_COLOR, etc.)
68 			   */
69 
70     /* EXT_visual_rating / GLX 1.2 */
71     GLint visualRating;
72 
73     /* EXT_visual_info / GLX 1.2 */
74     GLint transparentPixel;
75     /*    colors are floats scaled to ints */
76     GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
77     GLint transparentIndex;
78 
79     /* ARB_multisample / SGIS_multisample */
80     GLint sampleBuffers;
81     GLint samples;
82 
83     /* SGIX_fbconfig / GLX 1.3 */
84     GLint drawableType;
85     GLint renderType;
86     GLint fbconfigID;
87 
88     /* SGIX_pbuffer / GLX 1.3 */
89     GLint maxPbufferWidth;
90     GLint maxPbufferHeight;
91     GLint maxPbufferPixels;
92     GLint optimalPbufferWidth;  /* Only for SGIX_pbuffer. */
93     GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */
94 
95     /* SGIX_visual_select_group */
96     GLint visualSelectGroup;
97 
98     /* OML_swap_method */
99     GLint swapMethod;
100 
101     /* EXT_texture_from_pixmap */
102     GLint bindToTextureRgb;
103     GLint bindToTextureRgba;
104     GLint bindToMipmapTexture;
105     GLint bindToTextureTargets;
106     GLint yInverted;
107 
108     /* ARB_framebuffer_sRGB */
109     GLint sRGBCapable;
110 };
111 
112 GLint glxConvertToXVisualType(int visualType);
113 
114 /*
115 ** Screen dependent data.  These methods are the interface between the DIX
116 ** and DDX layers of the GLX server extension.  The methods provide an
117 ** interface for context management on a screen.
118 */
119 typedef struct __GLXscreen __GLXscreen;
120 struct __GLXscreen {
121     void (*destroy) (__GLXscreen * screen);
122 
123     __GLXcontext *(*createContext) (__GLXscreen * screen,
124                                     __GLXconfig * modes,
125                                     __GLXcontext * shareContext,
126                                     unsigned num_attribs,
127                                     const uint32_t *attribs,
128                                     int *error);
129 
130     __GLXdrawable *(*createDrawable) (ClientPtr client,
131                                       __GLXscreen * context,
132                                       DrawablePtr pDraw,
133                                       XID drawId,
134                                       int type,
135                                       XID glxDrawId, __GLXconfig * modes);
136     int (*swapInterval) (__GLXdrawable * drawable, int interval);
137 
138     ScreenPtr pScreen;
139 
140     /* Linked list of valid fbconfigs for this screen. */
141     __GLXconfig *fbconfigs;
142     int numFBConfigs;
143 
144     /* Subset of fbconfigs that are exposed as GLX visuals. */
145     __GLXconfig **visuals;
146     GLint numVisuals;
147 
148     char *GLextensions;
149     char *GLXextensions;
150     char *glvnd;
151     unsigned char glx_enable_bits[__GLX_EXT_BYTES];
152 
153     Bool (*CloseScreen) (ScreenPtr pScreen);
154 };
155 
156 void __glXScreenInit(__GLXscreen * screen, ScreenPtr pScreen);
157 void __glXScreenDestroy(__GLXscreen * screen);
158 
159 #endif                          /* !__GLX_screens_h__ */
160