xref: /OK3568_Linux_fs/external/xserver/glx/glxcontext.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun #ifdef HAVE_DIX_CONFIG_H
2*4882a593Smuzhiyun #include <dix-config.h>
3*4882a593Smuzhiyun #endif
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun #ifndef _GLX_context_h_
6*4882a593Smuzhiyun #define _GLX_context_h_
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun /*
9*4882a593Smuzhiyun  * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
10*4882a593Smuzhiyun  * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * Permission is hereby granted, free of charge, to any person obtaining a
13*4882a593Smuzhiyun  * copy of this software and associated documentation files (the "Software"),
14*4882a593Smuzhiyun  * to deal in the Software without restriction, including without limitation
15*4882a593Smuzhiyun  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16*4882a593Smuzhiyun  * and/or sell copies of the Software, and to permit persons to whom the
17*4882a593Smuzhiyun  * Software is furnished to do so, subject to the following conditions:
18*4882a593Smuzhiyun  *
19*4882a593Smuzhiyun  * The above copyright notice including the dates of first publication and
20*4882a593Smuzhiyun  * either this permission notice or a reference to
21*4882a593Smuzhiyun  * http://oss.sgi.com/projects/FreeB/
22*4882a593Smuzhiyun  * shall be included in all copies or substantial portions of the Software.
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25*4882a593Smuzhiyun  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26*4882a593Smuzhiyun  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27*4882a593Smuzhiyun  * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28*4882a593Smuzhiyun  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
29*4882a593Smuzhiyun  * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30*4882a593Smuzhiyun  * SOFTWARE.
31*4882a593Smuzhiyun  *
32*4882a593Smuzhiyun  * Except as contained in this notice, the name of Silicon Graphics, Inc.
33*4882a593Smuzhiyun  * shall not be used in advertising or otherwise to promote the sale, use or
34*4882a593Smuzhiyun  * other dealings in this Software without prior written authorization from
35*4882a593Smuzhiyun  * Silicon Graphics, Inc.
36*4882a593Smuzhiyun  */
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun struct __GLXcontext {
39*4882a593Smuzhiyun     void (*destroy) (__GLXcontext * context);
40*4882a593Smuzhiyun     int (*makeCurrent) (__GLXcontext * context);
41*4882a593Smuzhiyun     int (*loseCurrent) (__GLXcontext * context);
42*4882a593Smuzhiyun     int (*copy) (__GLXcontext * dst, __GLXcontext * src, unsigned long mask);
43*4882a593Smuzhiyun     Bool (*wait) (__GLXcontext * context, __GLXclientState * cl, int *error);
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun     /* EXT_texture_from_pixmap */
46*4882a593Smuzhiyun     int (*bindTexImage) (__GLXcontext * baseContext,
47*4882a593Smuzhiyun                          int buffer, __GLXdrawable * pixmap);
48*4882a593Smuzhiyun     int (*releaseTexImage) (__GLXcontext * baseContext,
49*4882a593Smuzhiyun                             int buffer, __GLXdrawable * pixmap);
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun     /*
52*4882a593Smuzhiyun      ** list of context structs
53*4882a593Smuzhiyun      */
54*4882a593Smuzhiyun     __GLXcontext *next;
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun     /*
57*4882a593Smuzhiyun      ** config struct for this context
58*4882a593Smuzhiyun      */
59*4882a593Smuzhiyun     __GLXconfig *config;
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun     /*
62*4882a593Smuzhiyun      ** Pointer to screen info data for this context.  This is set
63*4882a593Smuzhiyun      ** when the context is created.
64*4882a593Smuzhiyun      */
65*4882a593Smuzhiyun     __GLXscreen *pGlxScreen;
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun     /*
68*4882a593Smuzhiyun      ** If this context is current for a client, this will be that client
69*4882a593Smuzhiyun      */
70*4882a593Smuzhiyun     ClientPtr currentClient;
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun     /*
73*4882a593Smuzhiyun      ** The XID of this context.
74*4882a593Smuzhiyun      */
75*4882a593Smuzhiyun     XID id;
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun     /*
78*4882a593Smuzhiyun      ** The XID of the shareList context.
79*4882a593Smuzhiyun      */
80*4882a593Smuzhiyun     XID share_id;
81*4882a593Smuzhiyun 
82*4882a593Smuzhiyun     /*
83*4882a593Smuzhiyun      ** Whether this context's ID still exists.
84*4882a593Smuzhiyun      */
85*4882a593Smuzhiyun     GLboolean idExists;
86*4882a593Smuzhiyun 
87*4882a593Smuzhiyun     /*
88*4882a593Smuzhiyun      ** Whether this context is a direct rendering context.
89*4882a593Smuzhiyun      */
90*4882a593Smuzhiyun     GLboolean isDirect;
91*4882a593Smuzhiyun 
92*4882a593Smuzhiyun     /*
93*4882a593Smuzhiyun      ** Current rendering mode for this context.
94*4882a593Smuzhiyun      */
95*4882a593Smuzhiyun     GLenum renderMode;
96*4882a593Smuzhiyun 
97*4882a593Smuzhiyun     /**
98*4882a593Smuzhiyun      * Reset notification strategy used when a GPU reset occurs.
99*4882a593Smuzhiyun      */
100*4882a593Smuzhiyun     GLenum resetNotificationStrategy;
101*4882a593Smuzhiyun 
102*4882a593Smuzhiyun     /**
103*4882a593Smuzhiyun      * Context release behavior
104*4882a593Smuzhiyun      */
105*4882a593Smuzhiyun     GLenum releaseBehavior;
106*4882a593Smuzhiyun 
107*4882a593Smuzhiyun     /*
108*4882a593Smuzhiyun      ** Buffers for feedback and selection.
109*4882a593Smuzhiyun      */
110*4882a593Smuzhiyun     GLfloat *feedbackBuf;
111*4882a593Smuzhiyun     GLint feedbackBufSize;      /* number of elements allocated */
112*4882a593Smuzhiyun     GLuint *selectBuf;
113*4882a593Smuzhiyun     GLint selectBufSize;        /* number of elements allocated */
114*4882a593Smuzhiyun 
115*4882a593Smuzhiyun     /*
116*4882a593Smuzhiyun      ** Keep track of large rendering commands, which span multiple requests.
117*4882a593Smuzhiyun      */
118*4882a593Smuzhiyun     GLint largeCmdBytesSoFar;   /* bytes received so far        */
119*4882a593Smuzhiyun     GLint largeCmdBytesTotal;   /* total bytes expected         */
120*4882a593Smuzhiyun     GLint largeCmdRequestsSoFar;        /* requests received so far     */
121*4882a593Smuzhiyun     GLint largeCmdRequestsTotal;        /* total requests expected      */
122*4882a593Smuzhiyun     GLbyte *largeCmdBuf;
123*4882a593Smuzhiyun     GLint largeCmdBufSize;
124*4882a593Smuzhiyun 
125*4882a593Smuzhiyun     /*
126*4882a593Smuzhiyun      ** The drawable private this context is bound to
127*4882a593Smuzhiyun      */
128*4882a593Smuzhiyun     __GLXdrawable *drawPriv;
129*4882a593Smuzhiyun     __GLXdrawable *readPriv;
130*4882a593Smuzhiyun };
131*4882a593Smuzhiyun 
132*4882a593Smuzhiyun void __glXContextDestroy(__GLXcontext * context);
133*4882a593Smuzhiyun 
134*4882a593Smuzhiyun extern int validGlxScreen(ClientPtr client, int screen,
135*4882a593Smuzhiyun                           __GLXscreen ** pGlxScreen, int *err);
136*4882a593Smuzhiyun 
137*4882a593Smuzhiyun extern int validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen,
138*4882a593Smuzhiyun                             XID id, __GLXconfig ** config, int *err);
139*4882a593Smuzhiyun 
140*4882a593Smuzhiyun extern int validGlxContext(ClientPtr client, XID id, int access_mode,
141*4882a593Smuzhiyun                            __GLXcontext ** context, int *err);
142*4882a593Smuzhiyun 
143*4882a593Smuzhiyun extern __GLXcontext *__glXdirectContextCreate(__GLXscreen * screen,
144*4882a593Smuzhiyun                                               __GLXconfig * modes,
145*4882a593Smuzhiyun                                               __GLXcontext * shareContext);
146*4882a593Smuzhiyun 
147*4882a593Smuzhiyun #endif                          /* !__GLX_context_h__ */
148