xserver

xserver with xephyr scale patch
git clone https://git.neptards.moe/u3shit/xserver.git
Log | Files | Refs | README | LICENSE

glxserver.h (5552B)


      1 #ifdef HAVE_DIX_CONFIG_H
      2 #include <dix-config.h>
      3 #endif
      4 
      5 #ifndef _GLX_server_h_
      6 #define _GLX_server_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 <X11/X.h>
     39 #include <X11/Xproto.h>
     40 #include <X11/Xmd.h>
     41 #include <misc.h>
     42 #include <dixstruct.h>
     43 #include <pixmapstr.h>
     44 #include <gcstruct.h>
     45 #include <extnsionst.h>
     46 #include <resource.h>
     47 #include <scrnintstr.h>
     48 
     49 #include <GL/gl.h>
     50 #include <GL/glext.h>
     51 #include <GL/glxproto.h>
     52 
     53 #ifndef GLX_CONTEXT_OPENGL_NO_ERROR_ARB
     54 #define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3
     55 #endif
     56 
     57 /*
     58 ** GLX resources.
     59 */
     60 typedef XID GLXContextID;
     61 typedef XID GLXDrawable;
     62 
     63 typedef struct __GLXclientStateRec __GLXclientState;
     64 typedef struct __GLXdrawable __GLXdrawable;
     65 typedef struct __GLXcontext __GLXcontext;
     66 
     67 #include "glxscreens.h"
     68 #include "glxdrawable.h"
     69 #include "glxcontext.h"
     70 #include "glx_extinit.h"
     71 
     72 extern __GLXscreen *glxGetScreen(ScreenPtr pScreen);
     73 extern __GLXclientState *glxGetClient(ClientPtr pClient);
     74 
     75 /************************************************************************/
     76 
     77 void __glXScreenInitVisuals(__GLXscreen * screen);
     78 
     79 /*
     80 ** The last context used (from the server's persective) is cached.
     81 */
     82 extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag,
     83                                        int *);
     84 
     85 int __glXError(int error);
     86 
     87 /************************************************************************/
     88 
     89 enum {
     90     GLX_MINIMAL_VISUALS,
     91     GLX_TYPICAL_VISUALS,
     92     GLX_ALL_VISUALS
     93 };
     94 
     95 void glxSuspendClients(void);
     96 void glxResumeClients(void);
     97 
     98 typedef void (*glx_func_ptr)(void);
     99 typedef glx_func_ptr (*glx_gpa_proc)(const char *);
    100 void __glXsetGetProcAddress(glx_gpa_proc get_proc_address);
    101 void *__glGetProcAddress(const char *);
    102 
    103 void
    104 __glXsendSwapEvent(__GLXdrawable *drawable, int type, CARD64 ust,
    105                    CARD64 msc, CARD32 sbc);
    106 
    107 #if PRESENT
    108 void
    109 __glXregisterPresentCompleteNotify(void);
    110 #endif
    111 
    112 /*
    113 ** State kept per client.
    114 */
    115 struct __GLXclientStateRec {
    116     /*
    117      ** Buffer for returned data.
    118      */
    119     GLbyte *returnBuf;
    120     GLint returnBufSize;
    121 
    122     /* Back pointer to X client record */
    123     ClientPtr client;
    124 
    125     char *GLClientextensions;
    126 };
    127 
    128 /************************************************************************/
    129 
    130 /*
    131 ** Dispatch tables.
    132 */
    133 typedef void (*__GLXdispatchRenderProcPtr) (GLbyte *);
    134 typedef int (*__GLXdispatchSingleProcPtr) (__GLXclientState *, GLbyte *);
    135 typedef int (*__GLXdispatchVendorPrivProcPtr) (__GLXclientState *, GLbyte *);
    136 
    137 /*
    138  * Tables for computing the size of each rendering command.
    139  */
    140 typedef int (*gl_proto_size_func) (const GLbyte *, Bool, int);
    141 
    142 typedef struct {
    143     int bytes;
    144     gl_proto_size_func varsize;
    145 } __GLXrenderSizeData;
    146 
    147 /************************************************************************/
    148 
    149 /*
    150 ** X resources.
    151 */
    152 extern RESTYPE __glXContextRes;
    153 extern RESTYPE __glXClientRes;
    154 extern RESTYPE __glXDrawableRes;
    155 
    156 /************************************************************************/
    157 
    158 /*
    159  * Routines for computing the size of variably-sized rendering commands.
    160  */
    161 
    162 static _X_INLINE int
    163 safe_add(int a, int b)
    164 {
    165     if (a < 0 || b < 0)
    166         return -1;
    167 
    168     if (INT_MAX - a < b)
    169         return -1;
    170 
    171     return a + b;
    172 }
    173 
    174 static _X_INLINE int
    175 safe_mul(int a, int b)
    176 {
    177     if (a < 0 || b < 0)
    178         return -1;
    179 
    180     if (a == 0 || b == 0)
    181         return 0;
    182 
    183     if (a > INT_MAX / b)
    184         return -1;
    185 
    186     return a * b;
    187 }
    188 
    189 static _X_INLINE int
    190 safe_pad(int a)
    191 {
    192     int ret;
    193 
    194     if (a < 0)
    195         return -1;
    196 
    197     if ((ret = safe_add(a, 3)) < 0)
    198         return -1;
    199 
    200     return ret & (GLuint)~3;
    201 }
    202 
    203 extern int __glXTypeSize(GLenum enm);
    204 extern int __glXImageSize(GLenum format, GLenum type,
    205                           GLenum target, GLsizei w, GLsizei h, GLsizei d,
    206                           GLint imageHeight, GLint rowLength, GLint skipImages,
    207                           GLint skipRows, GLint alignment);
    208 
    209 extern unsigned glxMajorVersion;
    210 extern unsigned glxMinorVersion;
    211 
    212 extern int __glXEventBase;
    213 
    214 #endif                          /* !__GLX_server_h__ */