diff options
| author | Mihai Moldovan <ionic@ionic.de> | 2017-12-15 12:55:17 +0100 |
|---|---|---|
| committer | Mihai Moldovan <ionic@ionic.de> | 2017-12-15 12:55:17 +0100 |
| commit | 1dad092caf01d733990648e6df64cbf964df5143 (patch) | |
| tree | 39de0e643e76754a3e23ca9dd0350b8ba4f76250 /nx-X11/programs/Xserver/GL | |
| parent | 6d70b9e3c47f27a166f4aacb522c5c1e49092dd9 (diff) | |
| parent | 2b9025f797ee322e21077e100c2ee27c2e7fa0e0 (diff) | |
| download | nx-libs-1dad092caf01d733990648e6df64cbf964df5143.tar.gz nx-libs-1dad092caf01d733990648e6df64cbf964df5143.tar.bz2 nx-libs-1dad092caf01d733990648e6df64cbf964df5143.zip | |
Merge branch '3.6.x'
Diffstat (limited to 'nx-X11/programs/Xserver/GL')
123 files changed, 2504 insertions, 17075 deletions
diff --git a/nx-X11/programs/Xserver/GL/.gitignore b/nx-X11/programs/Xserver/GL/.gitignore new file mode 100644 index 000000000..5231f1978 --- /dev/null +++ b/nx-X11/programs/Xserver/GL/.gitignore @@ -0,0 +1,341 @@ +glx/DONE +glx/glcontextmodes.c +glx/glcontextmodes.h +glx/indirect_size.c +glx/indirect_size.h +mesa/X/DONE +mesa/X/compsize.c +mesa/X/driverfuncs.c +mesa/X/driverfuncs.h +mesa/X/xm_api.c +mesa/X/xm_buffer.c +mesa/X/xm_dd.c +mesa/X/xm_line.c +mesa/X/xm_span.c +mesa/X/xm_tri.c +mesa/array_cache/DONE +mesa/array_cache/ac_context.c +mesa/array_cache/ac_context.h +mesa/array_cache/ac_import.c +mesa/array_cache/acache.h +mesa/main/DONE +mesa/main/accum.c +mesa/main/accum.h +mesa/main/api_arrayelt.c +mesa/main/api_arrayelt.h +mesa/main/api_eval.h +mesa/main/api_loopback.c +mesa/main/api_loopback.h +mesa/main/api_noop.c +mesa/main/api_noop.h +mesa/main/api_validate.c +mesa/main/api_validate.h +mesa/main/attrib.c +mesa/main/attrib.h +mesa/main/blend.c +mesa/main/blend.h +mesa/main/bufferobj.c +mesa/main/bufferobj.h +mesa/main/buffers.c +mesa/main/buffers.h +mesa/main/clip.c +mesa/main/clip.h +mesa/main/colormac.h +mesa/main/colortab.c +mesa/main/colortab.h +mesa/main/config.h +mesa/main/context.c +mesa/main/context.h +mesa/main/convolve.c +mesa/main/convolve.h +mesa/main/dd.h +mesa/main/debug.c +mesa/main/debug.h +mesa/main/depth.c +mesa/main/depth.h +mesa/main/dispatch.c +mesa/main/dlist.c +mesa/main/dlist.h +mesa/main/drawpix.c +mesa/main/drawpix.h +mesa/main/enable.c +mesa/main/enable.h +mesa/main/enums.c +mesa/main/enums.h +mesa/main/eval.c +mesa/main/eval.h +mesa/main/execmem.c +mesa/main/extensions.c +mesa/main/extensions.h +mesa/main/fbobject.c +mesa/main/fbobject.h +mesa/main/feedback.c +mesa/main/feedback.h +mesa/main/fog.c +mesa/main/fog.h +mesa/main/framebuffer.c +mesa/main/framebuffer.h +mesa/main/get.c +mesa/main/get.h +mesa/main/getstring.c +mesa/main/glapi.c +mesa/main/glheader.h +mesa/main/glthread.c +mesa/main/hash.c +mesa/main/hash.h +mesa/main/hint.c +mesa/main/hint.h +mesa/main/histogram.c +mesa/main/histogram.h +mesa/main/image.c +mesa/main/image.h +mesa/main/imports.c +mesa/main/imports.h +mesa/main/light.c +mesa/main/light.h +mesa/main/lines.c +mesa/main/lines.h +mesa/main/macros.h +mesa/main/matrix.c +mesa/main/matrix.h +mesa/main/mm.c +mesa/main/mm.h +mesa/main/mtypes.h +mesa/main/occlude.c +mesa/main/occlude.h +mesa/main/pixel.c +mesa/main/pixel.h +mesa/main/points.c +mesa/main/points.h +mesa/main/polygon.c +mesa/main/polygon.h +mesa/main/rastpos.c +mesa/main/rastpos.h +mesa/main/renderbuffer.c +mesa/main/renderbuffer.h +mesa/main/simple_list.h +mesa/main/state.c +mesa/main/state.h +mesa/main/stencil.c +mesa/main/stencil.h +mesa/main/texcompress.c +mesa/main/texcompress.h +mesa/main/texcompress_fxt1.c +mesa/main/texcompress_s3tc.c +mesa/main/texenvprogram.c +mesa/main/texenvprogram.h +mesa/main/texformat.c +mesa/main/texformat.h +mesa/main/texformat_tmp.h +mesa/main/teximage.c +mesa/main/teximage.h +mesa/main/texobj.c +mesa/main/texobj.h +mesa/main/texrender.c +mesa/main/texrender.h +mesa/main/texstate.c +mesa/main/texstate.h +mesa/main/texstore.c +mesa/main/texstore.h +mesa/main/varray.c +mesa/main/varray.h +mesa/main/version.h +mesa/main/vtxfmt.c +mesa/main/vtxfmt.h +mesa/main/vtxfmt_tmp.h +mesa/math/DONE +mesa/math/m_clip_tmp.h +mesa/math/m_copy_tmp.h +mesa/math/m_debug.h +mesa/math/m_debug_clip.c +mesa/math/m_debug_norm.c +mesa/math/m_debug_util.h +mesa/math/m_debug_xform.c +mesa/math/m_dotprod_tmp.h +mesa/math/m_eval.c +mesa/math/m_eval.h +mesa/math/m_matrix.c +mesa/math/m_matrix.h +mesa/math/m_norm_tmp.h +mesa/math/m_trans_tmp.h +mesa/math/m_translate.c +mesa/math/m_translate.h +mesa/math/m_vector.c +mesa/math/m_vector.h +mesa/math/m_xform.c +mesa/math/m_xform.h +mesa/math/m_xform_tmp.h +mesa/math/mathmod.h +mesa/shader/DONE +mesa/shader/arbfragparse.c +mesa/shader/arbfragparse.h +mesa/shader/arbprogparse.c +mesa/shader/arbprogparse.h +mesa/shader/arbprogram.c +mesa/shader/arbprogram.h +mesa/shader/arbprogram_syn.h +mesa/shader/arbvertparse.c +mesa/shader/arbvertparse.h +mesa/shader/atifragshader.c +mesa/shader/atifragshader.h +mesa/shader/grammar/DONE +mesa/shader/grammar/grammar.c +mesa/shader/grammar/grammar.h +mesa/shader/grammar/grammar_mesa.c +mesa/shader/grammar/grammar_mesa.h +mesa/shader/grammar/grammar_syn.h +mesa/shader/nvfragparse.c +mesa/shader/nvfragparse.h +mesa/shader/nvfragprog.h +mesa/shader/nvprogram.c +mesa/shader/nvprogram.h +mesa/shader/nvvertexec.c +mesa/shader/nvvertexec.h +mesa/shader/nvvertparse.c +mesa/shader/nvvertparse.h +mesa/shader/nvvertprog.h +mesa/shader/program.c +mesa/shader/program.h +mesa/shader/shaderobjects.c +mesa/shader/shaderobjects.h +mesa/shader/shaderobjects_3dlabs.c +mesa/shader/shaderobjects_3dlabs.h +mesa/shader/slang/DONE +mesa/shader/slang/library/slang_common_builtin_gc.h +mesa/shader/slang/library/slang_common_builtin_gc_bin.h +mesa/shader/slang/library/slang_core_gc.h +mesa/shader/slang/library/slang_core_gc_bin.h +mesa/shader/slang/library/slang_fragment_builtin_gc.h +mesa/shader/slang/library/slang_fragment_builtin_gc_bin.h +mesa/shader/slang/library/slang_shader_syn.h +mesa/shader/slang/library/slang_version_syn.h +mesa/shader/slang/library/slang_vertex_builtin_gc.h +mesa/shader/slang/library/slang_vertex_builtin_gc_bin.h +mesa/shader/slang/slang_assemble.c +mesa/shader/slang/slang_assemble.h +mesa/shader/slang/slang_assemble_assignment.c +mesa/shader/slang/slang_assemble_assignment.h +mesa/shader/slang/slang_assemble_conditional.c +mesa/shader/slang/slang_assemble_conditional.h +mesa/shader/slang/slang_assemble_constructor.c +mesa/shader/slang/slang_assemble_constructor.h +mesa/shader/slang/slang_assemble_typeinfo.c +mesa/shader/slang/slang_assemble_typeinfo.h +mesa/shader/slang/slang_compile.c +mesa/shader/slang/slang_compile.h +mesa/shader/slang/slang_execute.c +mesa/shader/slang/slang_execute.h +mesa/shader/slang/slang_preprocess.c +mesa/shader/slang/slang_preprocess.h +mesa/shader/slang/slang_storage.c +mesa/shader/slang/slang_storage.h +mesa/shader/slang/slang_utility.c +mesa/shader/slang/slang_utility.h +mesa/shader/slang/traverse_wrap.h +mesa/swrast/DONE +mesa/swrast/s_aaline.c +mesa/swrast/s_aaline.h +mesa/swrast/s_aalinetemp.h +mesa/swrast/s_aatriangle.c +mesa/swrast/s_aatriangle.h +mesa/swrast/s_aatritemp.h +mesa/swrast/s_accum.c +mesa/swrast/s_accum.h +mesa/swrast/s_alpha.c +mesa/swrast/s_alpha.h +mesa/swrast/s_atifragshader.c +mesa/swrast/s_atifragshader.h +mesa/swrast/s_bitmap.c +mesa/swrast/s_blend.c +mesa/swrast/s_blend.h +mesa/swrast/s_buffers.c +mesa/swrast/s_context.c +mesa/swrast/s_context.h +mesa/swrast/s_copypix.c +mesa/swrast/s_depth.c +mesa/swrast/s_depth.h +mesa/swrast/s_drawpix.c +mesa/swrast/s_drawpix.h +mesa/swrast/s_feedback.c +mesa/swrast/s_feedback.h +mesa/swrast/s_fog.c +mesa/swrast/s_fog.h +mesa/swrast/s_imaging.c +mesa/swrast/s_lines.c +mesa/swrast/s_lines.h +mesa/swrast/s_linetemp.h +mesa/swrast/s_logic.c +mesa/swrast/s_logic.h +mesa/swrast/s_masking.c +mesa/swrast/s_masking.h +mesa/swrast/s_nvfragprog.c +mesa/swrast/s_nvfragprog.h +mesa/swrast/s_pixeltex.c +mesa/swrast/s_pixeltex.h +mesa/swrast/s_points.c +mesa/swrast/s_points.h +mesa/swrast/s_pointtemp.h +mesa/swrast/s_readpix.c +mesa/swrast/s_span.c +mesa/swrast/s_span.h +mesa/swrast/s_spantemp.h +mesa/swrast/s_stencil.c +mesa/swrast/s_stencil.h +mesa/swrast/s_texstore.c +mesa/swrast/s_texture.c +mesa/swrast/s_texture.h +mesa/swrast/s_triangle.c +mesa/swrast/s_triangle.h +mesa/swrast/s_trispan.h +mesa/swrast/s_tritemp.h +mesa/swrast/s_zoom.c +mesa/swrast/s_zoom.h +mesa/swrast/swrast.h +mesa/swrast_setup/DONE +mesa/swrast_setup/ss_context.c +mesa/swrast_setup/ss_context.h +mesa/swrast_setup/ss_triangle.c +mesa/swrast_setup/ss_triangle.h +mesa/swrast_setup/ss_tritmp.h +mesa/swrast_setup/swrast_setup.h +mesa/tnl/DONE +mesa/tnl/t_array_api.c +mesa/tnl/t_array_api.h +mesa/tnl/t_array_import.c +mesa/tnl/t_array_import.h +mesa/tnl/t_context.c +mesa/tnl/t_context.h +mesa/tnl/t_pipeline.c +mesa/tnl/t_pipeline.h +mesa/tnl/t_save_api.c +mesa/tnl/t_save_api.h +mesa/tnl/t_save_loopback.c +mesa/tnl/t_save_playback.c +mesa/tnl/t_vb_arbprogram.c +mesa/tnl/t_vb_arbprogram.h +mesa/tnl/t_vb_arbprogram_sse.c +mesa/tnl/t_vb_cliptmp.h +mesa/tnl/t_vb_cull.c +mesa/tnl/t_vb_fog.c +mesa/tnl/t_vb_light.c +mesa/tnl/t_vb_lighttmp.h +mesa/tnl/t_vb_normals.c +mesa/tnl/t_vb_points.c +mesa/tnl/t_vb_program.c +mesa/tnl/t_vb_render.c +mesa/tnl/t_vb_rendertmp.h +mesa/tnl/t_vb_texgen.c +mesa/tnl/t_vb_texmat.c +mesa/tnl/t_vb_vertex.c +mesa/tnl/t_vertex.c +mesa/tnl/t_vertex.h +mesa/tnl/t_vertex_generic.c +mesa/tnl/t_vertex_sse.c +mesa/tnl/t_vp_build.c +mesa/tnl/t_vp_build.h +mesa/tnl/t_vtx_api.c +mesa/tnl/t_vtx_api.h +mesa/tnl/t_vtx_eval.c +mesa/tnl/t_vtx_exec.c +mesa/tnl/t_vtx_generic.c +mesa/tnl/tnl.h diff --git a/nx-X11/programs/Xserver/GL/Imakefile b/nx-X11/programs/Xserver/GL/Imakefile index 47134e0a1..19b5902a5 100644 --- a/nx-X11/programs/Xserver/GL/Imakefile +++ b/nx-X11/programs/Xserver/GL/Imakefile @@ -1,33 +1,12 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/Imakefile,v 1.12 2003/08/06 14:04:01 eich Exp $ - #define IHaveModules #include <Server.tmpl> #define IHaveSubdirs -#if GlxUseSGISI - CORE_SUBDIR = /* opengl */ -#elif defined(DarwinArchitecture) && DarwinQuartzSupport - CORE_SUBDIR = apple mesa -#elif defined(cygwinArchitecture) && GlxUseWindows - CORE_SUBDIR = windows mesa -#elif defined(Win32Architecture) && GlxUseWindows - CORE_SUBDIR = windows -#else CORE_SUBDIR = mesa -#endif -#if BuildXF86DRI && ((defined(XF86Server) && XF86Server) \ - || (defined(XorgServer) && XorgServer)) -DRI_SUBDIR = dri -#endif - -SUBDIRS = glx $(DRI_SUBDIR) $(CORE_SUBDIR) +SUBDIRS = glx $(CORE_SUBDIR) -#if DoLoadableServer -MSRCS = glxmodule.c -MOBJS = glxmodule.o -#endif #if BuildModuleInSubdir SRCS = glx/module/?*.c $(MSRCS) @@ -39,7 +18,7 @@ OBJS = glx/?*.o $(MOBJS) DONES = glx/DONE -INCLUDES = -Iinclude -Idri -I$(SERVERSRC)/include -I$(SERVERSRC)/mi \ +INCLUDES = -Iinclude -I$(SERVERSRC)/include -I$(SERVERSRC)/mi \ -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(XF86OSSRC) DEPEND_DEFINES = $(EXT_DEFINES) DependDefines DEFINES = $(GLX_DEFINES) diff --git a/nx-X11/programs/Xserver/GL/apple/Imakefile b/nx-X11/programs/Xserver/GL/apple/Imakefile deleted file mode 100644 index 36b780c73..000000000 --- a/nx-X11/programs/Xserver/GL/apple/Imakefile +++ /dev/null @@ -1,49 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/apple/Imakefile,v 1.2 2003/09/16 00:36:11 torrey Exp $ - -#include <Server.tmpl> - - XPRDIR = $(SERVERSRC)/hw/darwin/quartz/xpr - -LinkSourceFile(x-list.c,$(XPRDIR)) -LinkSourceFile(x-list.h,$(XPRDIR)) -LinkSourceFile(x-hash.c,$(XPRDIR)) -LinkSourceFile(x-hash.h,$(XPRDIR)) -LinkSourceFile(compsize.c,$(MESASRCDIR)/src/glx/x11) - - BASE_SRCS = compsize.c - BASE_OBJS = compsize.o - - AGL_SRCS = aglGlx.c - AGL_OBJS = aglGlx.o - -#if HasXplugin - GL_SRCS = indirect.c x-hash.c x-list.c - GL_OBJS = indirect.o x-hash.o x-list.o - - AS = /System/Library/Frameworks/ApplicationServices.framework - - GL_INCLUDES = -I$(LIBSRC)/GL/apple -I$(XPRDIR) -I$(XPINCDIR) \ - -F$(AS)/Frameworks -#endif - - SRCS = $(BASE_SRCS) $(AGL_SRCS) $(GL_SRCS) - OBJS = $(BASE_OBJS) $(AGL_OBJS) $(GL_OBJS) - - INCLUDES = -I. -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \ - -I$(LIBSRC)/GL/glx -I$(LIBSRC)/GL/include \ - -I$(SERVERSRC)/mi -I$(SERVERSRC)/include -I$(FONTINCSRC) \ - -I$(SERVERSRC)/render -I$(SERVERSRC)/GL/include \ - -I$(SERVERSRC)/GL/glx -I$(SERVERSRC)/hw/darwin/quartz/cr \ - -I$(SERVERSRC)/hw/darwin/quartz $(GL_INCLUDES) \ - -I$(MESASRCDIR)/include -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(XF86OSSRC) - - DEFINES = $(GLX_DEFINES) - -NormalLibraryTarget(AGLcore,$(AGL_OBJS) $(BASE_OBJS)) -#if HasXplugin -NormalLibraryTarget(CGLcore,$(GL_OBJS) $(BASE_OBJS)) -#endif -NormalLibraryObjectRule() - -DependTarget() diff --git a/nx-X11/programs/Xserver/GL/apple/aglGlx.c b/nx-X11/programs/Xserver/GL/apple/aglGlx.c deleted file mode 100644 index be846be83..000000000 --- a/nx-X11/programs/Xserver/GL/apple/aglGlx.c +++ /dev/null @@ -1,1355 +0,0 @@ -/* - * GLX implementation that uses Apple's AGL.framework for OpenGL - * - * FIXME: This file and indirect.c are very similar. The two should be - * merged by introducing suitable abstractions. - */ -/* - * Copyright (c) 2002 Greg Parker. All Rights Reserved. - * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. - * - * Large portions of this file are copied from Mesa's xf86glx.c, - * which contains the following copyright: - * - * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/GL/apple/aglGlx.c,v 1.2 2003/09/16 00:36:11 torrey Exp $ */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "quartzCommon.h" -#include <AGL/agl.h> -#include "cr.h" - -// X11 and X11's glx -#undef BOOL -#define BOOL xBOOL -#include "quartz.h" -#include <miscstruct.h> -#include <windowstr.h> -#include <resource.h> -#include <GL/glxint.h> -#include <GL/glxtokens.h> -#include <scrnintstr.h> -#include <glxserver.h> -#include <glxscreens.h> -#include <glxdrawable.h> -#include <glxcontext.h> -#include <glxext.h> -#include <glxutil.h> -#include <glxscreens.h> -#include <GL/internal/glcore.h> -#undef BOOL - -#include "glcontextmodes.h" - -// ggs: needed to call back to glx with visual configs -extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs); - -// Write debugging output, or not -#ifdef GLAQUA_DEBUG -#define GLAQUA_DEBUG_MSG ErrorF -#else -#define GLAQUA_DEBUG_MSG(a, ...) -#endif - - -// The following GL functions don't have an EXT suffix in OpenGL.framework. -GLboolean glAreTexturesResidentEXT (GLsizei a, const GLuint *b, GLboolean *c) { - return glAreTexturesResident(a, b, c); -} -void glDeleteTexturesEXT (GLsizei d, const GLuint *e) { - glDeleteTextures(d, e); -} -void glGenTexturesEXT (GLsizei f, GLuint *g) { - glGenTextures(f, g); -} -GLboolean glIsTextureEXT (GLuint h) { - return glIsTexture(h); -} - - -// some prototypes -static Bool glAquaScreenProbe(int screen); -static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB); -static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates); -static __GLinterface *glAquaCreateContext(__GLimports *imports, - __GLcontextModes *mode, - __GLinterface *shareGC); -static void glAquaCreateBuffer(__GLXdrawablePrivate *glxPriv); -static void glAquaResetExtension(void); - - -/* - * This structure is statically allocated in the __glXScreens[] - * structure. This struct is not used anywhere other than in - * __glXScreenInit to initialize each of the active screens - * (__glXActiveScreens[]). Several of the fields must be initialized by - * the screenProbe routine before they are copied to the active screens - * struct. In particular, the contextCreate, modes, numVisuals, - * and numUsableVisuals fields must be initialized. - */ -static __GLXscreenInfo __glDDXScreenInfo = { - glAquaScreenProbe, /* Must be generic and handle all screens */ - glAquaCreateContext, /* Substitute screen's createContext routine */ - glAquaCreateBuffer, /* Substitute screen's createBuffer routine */ - NULL, /* Set up modes in probe */ - NULL, /* Set up pVisualPriv in probe */ - 0, /* Set up numVisuals in probe */ - 0, /* Set up numUsableVisuals in probe */ - "Vendor String", /* GLXvendor is overwritten by __glXScreenInit */ - "Version String", /* GLXversion is overwritten by __glXScreenInit */ - "Extensions String", /* GLXextensions is overwritten by __glXScreenInit */ - NULL /* WrappedPositionWindow is overwritten */ -}; - -void *__glXglDDXScreenInfo(void) { - return &__glDDXScreenInfo; -} - -static __GLXextensionInfo __glDDXExtensionInfo = { - GL_CORE_APPLE, - glAquaResetExtension, - glAquaInitVisuals, - glAquaSetVisualConfigs -}; - -void *__glXglDDXExtensionInfo(void) { - return &__glDDXExtensionInfo; -} - -// prototypes - -static GLboolean glAquaDestroyContext(__GLcontext *gc); -static GLboolean glAquaLoseCurrent(__GLcontext *gc); -static GLboolean glAquaMakeCurrent(__GLcontext *gc); -static GLboolean glAquaShareContext(__GLcontext *gc, __GLcontext *gcShare); -static GLboolean glAquaCopyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask); -static GLboolean glAquaForceCurrent(__GLcontext *gc); - -/* Drawing surface notification callbacks */ -static GLboolean glAquaNotifyResize(__GLcontext *gc); -static void glAquaNotifyDestroy(__GLcontext *gc); -static void glAquaNotifySwapBuffers(__GLcontext *gc); - -/* Dispatch table override control for external agents like libGLS */ -static struct __GLdispatchStateRec* glAquaDispatchExec(__GLcontext *gc); -static void glAquaBeginDispatchOverride(__GLcontext *gc); -static void glAquaEndDispatchOverride(__GLcontext *gc); - - -static __GLexports glAquaExports = { - glAquaDestroyContext, - glAquaLoseCurrent, - glAquaMakeCurrent, - glAquaShareContext, - glAquaCopyContext, - glAquaForceCurrent, - - glAquaNotifyResize, - glAquaNotifyDestroy, - glAquaNotifySwapBuffers, - - glAquaDispatchExec, - glAquaBeginDispatchOverride, - glAquaEndDispatchOverride -}; - - -typedef struct { - int num_vis; - __GLcontextModes *modes; - void **priv; - - // wrapped screen functions - RealizeWindowProcPtr RealizeWindow; - UnrealizeWindowProcPtr UnrealizeWindow; -} glAquaScreenRec; - -static glAquaScreenRec glAquaScreens[MAXSCREENS]; - - -// __GLdrawablePrivate->private -typedef struct { - GLboolean (*resize)(__GLdrawableBuffer *buf, GLint x, GLint y, - GLuint width, GLuint height, - __GLdrawablePrivate *glPriv, - GLuint bufferMask); -} GLAquaDrawableRec; - -struct __GLcontextRec { - struct __GLinterfaceRec interface; // required to be first - - AGLContext ctx; - AGLPixelFormat pixelFormat; - - Bool isAttached; // TRUE if ctx is really attached to a window -}; - - -// Context manipulation; return GL_FALSE on failure -static GLboolean glAquaDestroyContext(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("glAquaDestroyContext (ctx 0x%x)\n", gc->ctx); - - if (gc) { - if (gc->ctx) aglDestroyContext(gc->ctx); - if (gc->pixelFormat) aglDestroyPixelFormat(gc->pixelFormat); - free(gc); - } - - return GL_TRUE; -} - - -static GLboolean glAquaLoseCurrent(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%x)\n", gc->ctx); - - aglSetCurrentContext(NULL); - __glXLastContext = NULL; // Mesa does this; why? - gc->isAttached = FALSE; - - return GL_TRUE; -} - - -/* - * Attach a GL context to a GL drawable - * If glPriv is NULL, the context is detached. - */ -static void attach(__GLcontext *gc, __GLdrawablePrivate *glPriv) -{ - __GLXdrawablePrivate *glxPriv; - - if (glPriv == NULL) { - // attaching to nothing - GLAQUA_DEBUG_MSG("unattaching\n"); - aglSetDrawable(gc->ctx, NULL); - gc->isAttached = FALSE; - return; - } - - // Note that when resizing, the X11 WindowPtr already has its - // new size and position, but the Aqua window does not. - - glxPriv = (__GLXdrawablePrivate *)glPriv->other; - - if (glxPriv->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr) glxPriv->pDraw; - WindowPtr topWin = quartzProcs->TopLevelParent(pWin); - CRWindowPtr crWinPtr; - AGLDrawable newPort; - - if (glPriv->width <= 0 || glPriv->height <= 0) { - // attach to zero size drawable - will really attach later - GLAQUA_DEBUG_MSG("couldn't attach to zero size drawable\n"); - aglSetDrawable(gc->ctx, NULL); - gc->isAttached = FALSE; - return; - } - - crWinPtr = (CRWindowPtr) quartzProcs->FrameForWindow(pWin, FALSE); - - if (crWinPtr) { - newPort = (AGLDrawable) crWinPtr->port; - } else { - newPort = NULL; - } - - if (newPort) { - // FIXME: won't be a CGrafPtr if currently offscreen or fullscreen - AGLDrawable oldPort = aglGetDrawable(gc->ctx); - // AGLDrawable newPort = GetWindowPort(window); - - // Frame is GLdrawable in X11 global coordinates - // FIXME: Does this work for multiple screens? - GLint frame[4] = {glPriv->xOrigin, glPriv->yOrigin, glPriv->width, glPriv->height}; - GLAQUA_DEBUG_MSG("global size %d %d %d %d\n", - frame[0], frame[1], frame[2], frame[3]); - - // Convert to window-local coordinates - frame[0] -= topWin->drawable.x - topWin->borderWidth; - frame[1] -= topWin->drawable.y - topWin->borderWidth; - - // AGL uses flipped coordinates - frame[1] = topWin->drawable.height + 2*topWin->borderWidth - - frame[1] - frame[3]; - - GLAQUA_DEBUG_MSG("local size %d %d %d %d\n", - frame[0], frame[1], frame[2], frame[3]); - - if (oldPort != newPort) { - // FIXME: retain/release windows - if (!aglSetDrawable(gc->ctx, newPort)) return; - } - if (!aglSetInteger(gc->ctx, AGL_BUFFER_RECT, frame)) return; - if (!aglEnable(gc->ctx, AGL_BUFFER_RECT)) return; - if (!aglSetInteger(gc->ctx, AGL_SWAP_RECT, frame)) return; - if (!aglEnable(gc->ctx, AGL_SWAP_RECT)) return; - if (!aglUpdateContext(gc->ctx)) return; - - gc->isAttached = TRUE; - GLAQUA_DEBUG_MSG("attached context 0x%x to window 0x%x\n", gc->ctx, - pWin->drawable.id); - } else { - // attach to not-yet-realized window - will really attach later - GLAQUA_DEBUG_MSG("couldn't attach to unrealized window\n"); - aglSetDrawable(gc->ctx, NULL); - gc->isAttached = FALSE; - } - } else { - GLAQUA_DEBUG_MSG("attach: attach to non-window unimplemented\n"); - aglSetDrawable(gc->ctx, NULL); - gc->isAttached = FALSE; - } -} - -static GLboolean glAquaMakeCurrent(__GLcontext *gc) -{ - __GLdrawablePrivate *glPriv = gc->interface.imports.getDrawablePrivate(gc); - - GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%x)\n", gc->ctx); - - if (!gc->isAttached) { - attach(gc, glPriv); - } - - return aglSetCurrentContext(gc->ctx); -} - -static GLboolean glAquaShareContext(__GLcontext *gc, __GLcontext *gcShare) -{ - GLAQUA_DEBUG_MSG("glAquaShareContext unimplemented\n"); - - return GL_TRUE; -} - - -static GLboolean glAquaCopyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask) -{ - GLAQUA_DEBUG_MSG("glAquaCopyContext\n"); - - return aglCopyContext(src->ctx, dst->ctx, mask); -} - -static GLboolean glAquaForceCurrent(__GLcontext *gc) -{ - // GLAQUA_DEBUG_MSG("glAquaForceCurrent (ctx 0x%x)\n", gc->ctx); - return aglSetCurrentContext(gc->ctx); -} - -/* Drawing surface notification callbacks */ - -static GLboolean glAquaNotifyResize(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaNotifyResize"); - return GL_TRUE; -} - -static void glAquaNotifyDestroy(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaNotifyDestroy"); -} - -static void glAquaNotifySwapBuffers(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaNotifySwapBuffers"); -} - -/* Dispatch table override control for external agents like libGLS */ -static struct __GLdispatchStateRec* glAquaDispatchExec(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaDispatchExec"); - return NULL; -} - -static void glAquaBeginDispatchOverride(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaBeginDispatchOverride"); -} - -static void glAquaEndDispatchOverride(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaEndDispatchOverride"); -} - - -static AGLPixelFormat makeFormat(__GLcontextModes *mode) -{ - int i; - GLint attr[64]; // currently uses max of 30 - AGLPixelFormat result; - - GLAQUA_DEBUG_MSG("makeFormat\n"); - - i = 0; - - // attr [i++] = AGL_ACCELERATED; // require hwaccel - BAD for multiscreen - // attr [i++] = AGL_NO_RECOVERY; // disable fallback renderers - BAD - - if (mode->stereoMode) { - attr[i++] = AGL_STEREO; - } - if (mode->doubleBufferMode) { - attr[i++] = AGL_DOUBLEBUFFER; - } - - if (mode->colorIndexMode) { - attr[i++] = AGL_BUFFER_SIZE; - attr[i++] = mode->indexBits; - } - - if (mode->rgbMode) { - attr[i++] = AGL_RGBA; - attr[i++] = AGL_RED_SIZE; - attr[i++] = mode->redBits; - attr[i++] = AGL_GREEN_SIZE; - attr[i++] = mode->greenBits; - attr[i++] = AGL_BLUE_SIZE; - attr[i++] = mode->blueBits; - attr[i++] = AGL_ALPHA_SIZE; - attr[i++] = mode->alphaBits; - } - - if (mode->haveAccumBuffer) { - attr[i++] = AGL_ACCUM_RED_SIZE; - attr[i++] = mode->accumRedBits; - attr[i++] = AGL_ACCUM_GREEN_SIZE; - attr[i++] = mode->accumGreenBits; - attr[i++] = AGL_ACCUM_BLUE_SIZE; - attr[i++] = mode->accumBlueBits; - attr[i++] = AGL_ACCUM_ALPHA_SIZE; - attr[i++] = mode->accumAlphaBits; - } - if (mode->haveDepthBuffer) { - attr[i++] = AGL_DEPTH_SIZE; - attr[i++] = mode->depthBits; - } - if (mode->haveStencilBuffer) { - attr[i++] = AGL_STENCIL_SIZE; - attr[i++] = mode->stencilBits; - } - - attr[i++] = AGL_AUX_BUFFERS; - attr[i++] = mode->numAuxBuffers; - - attr[i++] = AGL_LEVEL; - attr[i++] = mode->level; - - // mode->pixmapMode ? - - attr[i++] = AGL_NONE; // end of option list - - GLAQUA_DEBUG_MSG("makeFormat almost done\n"); - result = aglChoosePixelFormat(NULL, 0, attr); - GLAQUA_DEBUG_MSG("makeFormat done (0x%x)\n", result); - return result; -} - -static __GLinterface *glAquaCreateContext(__GLimports *imports, - __GLcontextModes *mode, - __GLinterface *shareGC) -{ - __GLcontext *result; - __GLcontext *sharectx = (__GLcontext *)shareGC; - - GLAQUA_DEBUG_MSG("glAquaCreateContext\n"); - - result = (__GLcontext *)calloc(1, sizeof(__GLcontext)); - if (!result) return NULL; - - result->interface.imports = *imports; - result->interface.exports = glAquaExports; - - result->pixelFormat = makeFormat(mode); - if (!result->pixelFormat) { - free(result); - return NULL; - } - - result->ctx = aglCreateContext(result->pixelFormat, - (sharectx && sharectx->ctx) ? sharectx->ctx : NULL); - - if (!result->ctx) { - aglDestroyPixelFormat(result->pixelFormat); - free(result); - return NULL; - } - - result->isAttached = FALSE; - - GLAQUA_DEBUG_MSG("glAquaCreateContext done\n"); - return (__GLinterface *)result; -} - - -Bool -glAquaRealizeWindow(WindowPtr pWin) -{ - // If this window has GL contexts, tell them to reattach - Bool result; - ScreenPtr pScreen = pWin->drawable.pScreen; - glAquaScreenRec *screenPriv = &glAquaScreens[pScreen->myNum]; - __GLXdrawablePrivate *glxPriv; - - GLAQUA_DEBUG_MSG("glAquaRealizeWindow\n"); - - // Allow the window to be created (RootlessRealizeWindow is inside our wrap) - pScreen->RealizeWindow = screenPriv->RealizeWindow; - result = pScreen->RealizeWindow(pWin); - pScreen->RealizeWindow = glAquaRealizeWindow; - - // The Aqua window will already have been created (windows are - // realized from top down) - - // Re-attach this window's GL contexts, if any. - glxPriv = __glXFindDrawablePrivate(pWin->drawable.id); - if (glxPriv) { - __GLXcontext *gx; - __GLcontext *gc; - __GLdrawablePrivate *glPriv = &glxPriv->glPriv; - GLAQUA_DEBUG_MSG("glAquaRealizeWindow is GL drawable!\n"); - - // GL contexts bound to this window for drawing - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->nextDrawPriv) { - gc = (__GLcontext *)gx->gc; - attach(gc, glPriv); - } - - // GL contexts bound to this window for reading - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->nextReadPriv) { - gc = (__GLcontext *)gx->gc; - attach(gc, glPriv); - } - } - - return result; -} - -Bool -glAquaUnrealizeWindow(WindowPtr pWin) -{ - // If this window has GL contexts, tell them to unattach - Bool result; - ScreenPtr pScreen = pWin->drawable.pScreen; - glAquaScreenRec *screenPriv = &glAquaScreens[pScreen->myNum]; - __GLXdrawablePrivate *glxPriv; - - GLAQUA_DEBUG_MSG("glAquaUnrealizeWindow\n"); - - // The Aqua window may have already been destroyed (windows - // are unrealized from top down) - - // Unattach this window's GL contexts, if any. - glxPriv = __glXFindDrawablePrivate(pWin->drawable.id); - if (glxPriv) { - __GLXcontext *gx; - __GLcontext *gc; - GLAQUA_DEBUG_MSG("glAquaUnealizeWindow is GL drawable!\n"); - - // GL contexts bound to this window for drawing - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->nextDrawPriv) { - gc = (__GLcontext *)gx->gc; - attach(gc, NULL); - } - - // GL contexts bound to this window for reading - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->nextReadPriv) { - gc = (__GLcontext *)gx->gc; - attach(gc, NULL); - } - } - - pScreen->UnrealizeWindow = screenPriv->UnrealizeWindow; - result = pScreen->UnrealizeWindow(pWin); - pScreen->UnrealizeWindow = glAquaUnrealizeWindow; - - return result; -} - - -// Originally copied from Mesa - -static int numConfigs = 0; -static __GLXvisualConfig *visualConfigs = NULL; -static void **visualPrivates = NULL; - -/* - * In the case the driver defines no GLX visuals we'll use these. - * Note that for TrueColor and DirectColor visuals, bufferSize is the - * sum of redSize, greenSize, blueSize and alphaSize, which may be larger - * than the nplanes/rootDepth of the server's X11 visuals - */ -#define NUM_FALLBACK_CONFIGS 5 -static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { - /* [0] = RGB, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [1] = RGB, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 16, 16, 16, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [4] = CI, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - False, /* rgba? (false = color index) */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, -}; - -static __GLXvisualConfig NullConfig = { - -1, /* vid */ - -1, /* class */ - False, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE_EXT, /* visualRating */ - 0, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ -}; - - -static int count_bits(unsigned int n) -{ - int bits = 0; - - while (n > 0) { - if (n & 1) bits++; - n >>= 1; - } - return bits; -} - - -static Bool init_visuals(int *nvisualp, VisualPtr *visualp, - VisualID *defaultVisp, - int ndepth, DepthPtr pdepth, - int rootDepth) -{ - int numRGBconfigs; - int numCIconfigs; - int numVisuals = *nvisualp; - int numNewVisuals; - int numNewConfigs; - VisualPtr pVisual = *visualp; - VisualPtr pVisualNew = NULL; - VisualID *orig_vid = NULL; - __GLcontextModes *modes; - __GLXvisualConfig *pNewVisualConfigs = NULL; - void **glXVisualPriv; - void **pNewVisualPriv; - int found_default; - int i, j, k; - - GLAQUA_DEBUG_MSG("init_visuals\n"); - - if (numConfigs > 0) - numNewConfigs = numConfigs; - else - numNewConfigs = NUM_FALLBACK_CONFIGS; - - /* Alloc space for the list of new GLX visuals */ - pNewVisualConfigs = (__GLXvisualConfig *) - __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); - if (!pNewVisualConfigs) { - return FALSE; - } - - /* Alloc space for the list of new GLX visual privates */ - pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); - if (!pNewVisualPriv) { - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* - ** If SetVisualConfigs was not called, then use default GLX - ** visual configs. - */ - if (numConfigs == 0) { - memcpy(pNewVisualConfigs, FallbackConfigs, - NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); - memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); - } - else { - /* copy driver's visual config info */ - for (i = 0; i < numConfigs; i++) { - pNewVisualConfigs[i] = visualConfigs[i]; - pNewVisualPriv[i] = visualPrivates[i]; - } - } - - /* Count the number of RGB and CI visual configs */ - numRGBconfigs = 0; - numCIconfigs = 0; - for (i = 0; i < numNewConfigs; i++) { - if (pNewVisualConfigs[i].rgba) - numRGBconfigs++; - else - numCIconfigs++; - } - - /* Count the total number of visuals to compute */ - numNewVisuals = 0; - for (i = 0; i < numVisuals; i++) { - int count; - - count = ((pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor) - ? numRGBconfigs : numCIconfigs); - if (count == 0) - count = 1; /* preserve the existing visual */ - - numNewVisuals += count; - } - - /* Reset variables for use with the next screen/driver's visual configs */ - visualConfigs = NULL; - numConfigs = 0; - - /* Alloc temp space for the list of orig VisualIDs for each new visual */ - orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); - if (!orig_vid) { - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisuals */ - modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); - if (modes == NULL) { - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisualPrivates */ - glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); - if (!glXVisualPriv) { - _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the new list of the X server's visuals */ - pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); - if (!pVisualNew) { - __glXFree(glXVisualPriv); - _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Initialize the new visuals */ - found_default = FALSE; - glAquaScreens[screenInfo.numScreens-1].modes = modes; - for (i = j = 0; i < numVisuals; i++) { - int is_rgb = (pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor); - - if (!is_rgb) - { - /* We don't support non-rgb visuals for GL. But we don't - want to remove them either, so just pass them through - with null glX configs */ - - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & NullConfig ); - modes->visualID = pVisualNew[j].vid; - - j++; - - continue; - } - - for (k = 0; k < numNewConfigs; k++) { - if (pNewVisualConfigs[k].rgba != is_rgb) - continue; - - assert( modes != NULL ); - - /* Initialize the new visual */ - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); - modes->visualID = pVisualNew[j].vid; - - /* - * If the class is -1, then assume the X visual information - * is identical to what GLX needs, and take them from the X - * visual. NOTE: if class != -1, then all other fields MUST - * be initialized. - */ - if (modes->visualType == GLX_NONE) { - modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); - modes->redBits = count_bits(pVisual[i].redMask); - modes->greenBits = count_bits(pVisual[i].greenMask); - modes->blueBits = count_bits(pVisual[i].blueMask); - modes->alphaBits = modes->alphaBits; - modes->redMask = pVisual[i].redMask; - modes->greenMask = pVisual[i].greenMask; - modes->blueMask = pVisual[i].blueMask; - modes->alphaMask = modes->alphaMask; - modes->rgbBits = (is_rgb) - ? (modes->redBits + modes->greenBits + - modes->blueBits + modes->alphaBits) - : rootDepth; - } - - /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pNewVisualPriv[k]; - - j++; - modes = modes->next; - } - } - - assert(j <= numNewVisuals); - - /* Save the GLX visuals in the screen structure */ - glAquaScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; - glAquaScreens[screenInfo.numScreens-1].priv = glXVisualPriv; - - /* Set up depth's VisualIDs */ - for (i = 0; i < ndepth; i++) { - int numVids = 0; - VisualID *pVids = NULL; - int k, n = 0; - - /* Count the new number of VisualIDs at this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - numVids++; - - /* Allocate a new list of VisualIDs for this depth */ - pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); - - /* Initialize the new list of VisualIDs for this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - pVids[n++] = pVisualNew[k].vid; - - /* Update this depth's list of VisualIDs */ - __glXFree(pdepth[i].vids); - pdepth[i].vids = pVids; - pdepth[i].numVids = numVids; - } - - /* Update the X server's visuals */ - *nvisualp = numNewVisuals; - *visualp = pVisualNew; - - /* Free the old list of the X server's visuals */ - __glXFree(pVisual); - - /* Clean up temporary allocations */ - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - - /* Free the private list created by DDX HW driver */ - if (visualPrivates) - xfree(visualPrivates); - visualPrivates = NULL; - - return TRUE; -} - -/* based on code in i830_dri.c - This ends calling glAquaSetVisualConfigs to set the static - numconfigs, etc. */ -static void -glAquaInitVisualConfigs(void) -{ - int lclNumConfigs = 0; - __GLXvisualConfig *lclVisualConfigs = NULL; - void **lclVisualPrivates = NULL; - - int depth, aux, buffers, stencil, accum; - int i = 0; - - GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs "); - - /* count num configs: - 2 Z buffer (0, 24 bit) - 2 AUX buffer (0, 2) - 2 buffers (single, double) - 2 stencil (0, 8 bit) - 2 accum (0, 64 bit) - = 32 configs */ - - lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */ - - /* alloc */ - lclVisualConfigs = xcalloc(sizeof(__GLXvisualConfig), lclNumConfigs); - lclVisualPrivates = xcalloc(sizeof(void *), lclNumConfigs); - - /* fill in configs */ - if (NULL != lclVisualConfigs) { - i = 0; /* current buffer */ - for (depth = 0; depth < 2; depth++) { - for (aux = 0; aux < 2; aux++) { - for (buffers = 0; buffers < 2; buffers++) { - for (stencil = 0; stencil < 2; stencil++) { - for (accum = 0; accum < 2; accum++) { - lclVisualConfigs[i].vid = -1; - lclVisualConfigs[i].class = -1; - lclVisualConfigs[i].rgba = TRUE; - lclVisualConfigs[i].redSize = -1; - lclVisualConfigs[i].greenSize = -1; - lclVisualConfigs[i].blueSize = -1; - lclVisualConfigs[i].redMask = -1; - lclVisualConfigs[i].greenMask = -1; - lclVisualConfigs[i].blueMask = -1; - lclVisualConfigs[i].alphaMask = 0; - if (accum) { - lclVisualConfigs[i].accumRedSize = 16; - lclVisualConfigs[i].accumGreenSize = 16; - lclVisualConfigs[i].accumBlueSize = 16; - lclVisualConfigs[i].accumAlphaSize = 16; - } - else { - lclVisualConfigs[i].accumRedSize = 0; - lclVisualConfigs[i].accumGreenSize = 0; - lclVisualConfigs[i].accumBlueSize = 0; - lclVisualConfigs[i].accumAlphaSize = 0; - } - lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE; - lclVisualConfigs[i].stereo = FALSE; - lclVisualConfigs[i].bufferSize = -1; - - lclVisualConfigs[i].depthSize = depth? 24 : 0; - lclVisualConfigs[i].stencilSize = stencil ? 8 : 0; - lclVisualConfigs[i].auxBuffers = aux ? 2 : 0; - lclVisualConfigs[i].level = 0; - lclVisualConfigs[i].visualRating = GLX_NONE_EXT; - lclVisualConfigs[i].transparentPixel = 0; - lclVisualConfigs[i].transparentRed = 0; - lclVisualConfigs[i].transparentGreen = 0; - lclVisualConfigs[i].transparentBlue = 0; - lclVisualConfigs[i].transparentAlpha = 0; - lclVisualConfigs[i].transparentIndex = 0; - i++; - } - } - } - } - } - } - if (i != lclNumConfigs) - GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs failed to alloc visual configs"); - - GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates); -} - - -static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates) -{ - GLAQUA_DEBUG_MSG("glAquaSetVisualConfigs\n"); - - numConfigs = nconfigs; - visualConfigs = configs; - visualPrivates = privates; -} - -static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB) -{ - GLAQUA_DEBUG_MSG("glAquaInitVisuals\n"); - - if (numConfigs == 0) /* if no configs */ - glAquaInitVisualConfigs(); /* ensure the visual configs are setup */ - - /* - * Setup the visuals supported by this particular screen. - */ - return init_visuals(nvisualp, visualp, defaultVisp, - *ndepthp, *depthp, *rootDepthp); -} - - -static void fixup_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - glAquaScreenRec *pScr = &glAquaScreens[screen]; - int j; - __GLcontextModes *modes; - - GLAQUA_DEBUG_MSG("fixup_visuals\n"); - - for ( modes = pScr->modes ; modes != NULL ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - /* Find a visual that matches the GLX visual's class and size */ - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes) { - - /* Fixup the masks */ - modes->redMask = pVis[j].redMask; - modes->greenMask = pVis[j].greenMask; - modes->blueMask = pVis[j].blueMask; - - /* Recalc the sizes */ - modes->redBits = count_bits(modes->redMask); - modes->greenBits = count_bits(modes->greenMask); - modes->blueBits = count_bits(modes->blueMask); - } - } - } -} - -static void init_screen_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - __GLcontextModes *modes; - int *used; - int i, j; - - GLAQUA_DEBUG_MSG("init_screen_visuals\n"); - - /* FIXME: Change 'used' to be a array of bits (rather than of ints), - * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less - * FIXME: than 64 or 128 the stack array can be used instead of calling - * FIXME: __glXMalloc / __glXFree. If nothing else, convert 'used' to - * FIXME: array of bytes instead of ints! - */ - used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int)); - __glXMemset(used, 0, pScreen->numVisuals * sizeof(int)); - - i = 0; - for ( modes = glAquaScreens[screen].modes - ; modes != NULL - ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes && - pVis[j].redMask == modes->redMask && - pVis[j].greenMask == modes->greenMask && - pVis[j].blueMask == modes->blueMask && - !used[j]) { - - /* Set the VisualID */ - modes->visualID = pVis[j].vid; - - /* Mark this visual used */ - used[j] = 1; - break; - } - } - if ( j == pScreen->numVisuals ) { - ErrorF("No matching visual for __GLcontextMode with " - "visual class = %d (%d), nplanes = %u\n", - vis_class, - (int)modes->visualType, - (unsigned int)(modes->rgbBits - modes->alphaBits) ); - } - else if ( modes->visualID == -1 ) { - FatalError( "Matching visual found, but visualID still -1!\n" ); - } - - i++; - } - - __glXFree(used); -} - -static Bool glAquaScreenProbe(int screen) -{ - ScreenPtr pScreen; - glAquaScreenRec *screenPriv; - - GLAQUA_DEBUG_MSG("glAquaScreenProbe\n"); - - /* - * Set up the current screen's visuals. - */ - __glDDXScreenInfo.modes = glAquaScreens[screen].modes; - __glDDXScreenInfo.pVisualPriv = glAquaScreens[screen].priv; - __glDDXScreenInfo.numVisuals = - __glDDXScreenInfo.numUsableVisuals = glAquaScreens[screen].num_vis; - - /* - * Set the current screen's createContext routine. This could be - * wrapped by a DDX GLX context creation routine. - */ - __glDDXScreenInfo.createContext = glAquaCreateContext; - - /* - * The ordering of the rgb compenents might have been changed by the - * driver after mi initialized them. - */ - fixup_visuals(screen); - - /* - * Find the GLX visuals that are supported by this screen and create - * XMesa's visuals. - */ - init_screen_visuals(screen); - - /* - * Wrap RealizeWindow and UnrealizeWindow on this screen - */ - pScreen = screenInfo.screens[screen]; - screenPriv = &glAquaScreens[screen]; - screenPriv->RealizeWindow = pScreen->RealizeWindow; - pScreen->RealizeWindow = glAquaRealizeWindow; - screenPriv->UnrealizeWindow = pScreen->UnrealizeWindow; - pScreen->UnrealizeWindow = glAquaUnrealizeWindow; - - return TRUE; -} - - -static GLboolean glAquaResizeBuffers(__GLdrawableBuffer *buffer, - GLint x, GLint y, - GLuint width, GLuint height, - __GLdrawablePrivate *glPriv, - GLuint bufferMask) -{ - GLAquaDrawableRec *aquaPriv = (GLAquaDrawableRec *)glPriv->private; - __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other; - __GLXcontext *gx; - __GLcontext *gc; - - GLAQUA_DEBUG_MSG("glAquaResizeBuffers to (%d %d %d %d)\n", x, y, width, height); - - // update all contexts that point at this drawable for drawing (hack?) - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->nextDrawPriv) { - gc = (__GLcontext *)gx->gc; - attach(gc, glPriv); - } - - // update all contexts that point at this drawable for reading (hack?) - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->nextReadPriv) { - gc = (__GLcontext *)gx->gc; - attach(gc, glPriv); - } - - return aquaPriv->resize(buffer, x, y, width, height, glPriv, bufferMask); -} - - -static GLboolean glAquaSwapBuffers(__GLXdrawablePrivate *glxPriv) -{ - // fixme AGL software renderer will use properties of current QD port (bad) - - // swap buffers on only *one* of the contexts - // (e.g. the last one for drawing) - __GLcontext *gc = (__GLcontext *)glxPriv->drawGlxc->gc; - if (gc && gc->ctx) aglSwapBuffers(gc->ctx); - - return GL_TRUE; -} - -static void glAquaDestroyDrawablePrivate(__GLdrawablePrivate *glPriv) -{ - GLAQUA_DEBUG_MSG("glAquaDestroyDrawablePrivate\n"); - - free(glPriv->private); - glPriv->private = NULL; -} - -static void glAquaCreateBuffer(__GLXdrawablePrivate *glxPriv) -{ - GLAquaDrawableRec *aquaPriv = malloc(sizeof(GLAquaDrawableRec)); - __GLdrawablePrivate *glPriv = &glxPriv->glPriv; - - GLAQUA_DEBUG_MSG("glAquaCreateBuffer\n"); - - // replace swapBuffers (original is never called) - glxPriv->swapBuffers = glAquaSwapBuffers; - - // wrap front buffer resize - aquaPriv->resize = glPriv->frontBuffer.resize; - glPriv->frontBuffer.resize = glAquaResizeBuffers; - - // stash private data - glPriv->private = aquaPriv; - glPriv->freePrivate = glAquaDestroyDrawablePrivate; -} - - -static void glAquaResetExtension(void) -{ - GLAQUA_DEBUG_MSG("glAquaResetExtension\n"); - aglResetLibrary(); -} - - - -// Extra goodies for glx - -GLuint __glFloorLog2(GLuint val) -{ - int c = 0; - - while (val > 1) { - c++; - val >>= 1; - } - return c; -} diff --git a/nx-X11/programs/Xserver/GL/apple/indirect.c b/nx-X11/programs/Xserver/GL/apple/indirect.c deleted file mode 100644 index 448b1f76a..000000000 --- a/nx-X11/programs/Xserver/GL/apple/indirect.c +++ /dev/null @@ -1,1380 +0,0 @@ -/* - * GLX implementation that uses Apple's OpenGL.framework - * (Indirect rendering path) - */ -/* - * Copyright (c) 2002 Greg Parker. All Rights Reserved. - * Copyright (c) 2002 Apple Computer, Inc. - * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. - * - * Portions of this file are copied from Mesa's xf86glx.c, - * which contains the following copyright: - * - * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/GL/apple/indirect.c,v 1.2 2003/09/16 00:36:11 torrey Exp $ */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "dri.h" -#include "quartz.h" - -#include <CoreGraphics/CoreGraphics.h> -#include <OpenGL/OpenGL.h> -#include <OpenGL/CGLContext.h> - -// X11 and X11's glx -#include <miscstruct.h> -#include <windowstr.h> -#include <resource.h> -#include <GL/glxint.h> -#include <GL/glxtokens.h> -#include <scrnintstr.h> -#include <glxserver.h> -#include <glxscreens.h> -#include <glxdrawable.h> -#include <glxcontext.h> -#include <glxext.h> -#include <glxutil.h> -#include <glxscreens.h> -#include <GL/internal/glcore.h> -#include "x-hash.h" -#include "x-list.h" - -#include "glcontextmodes.h" - -// ggs: needed to call back to glx with visual configs -extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs); - - -// Write debugging output, or not -#ifdef GLAQUA_DEBUG -#define GLAQUA_DEBUG_MSG ErrorF -#else -#define GLAQUA_DEBUG_MSG(a, ...) -#endif - - -// The following GL functions don't have an EXT suffix in OpenGL.framework. -GLboolean glAreTexturesResidentEXT(GLsizei a, const GLuint *b, GLboolean *c) { - return glAreTexturesResident(a, b, c); -} -void glDeleteTexturesEXT(GLsizei d, const GLuint *e) { - glDeleteTextures(d, e); -} -void glGenTexturesEXT(GLsizei f, GLuint *g) { - glGenTextures(f, g); -} -GLboolean glIsTextureEXT(GLuint h) { - return glIsTexture(h); -} - -// some prototypes -static Bool glAquaScreenProbe(int screen); -static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB); -static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates); -static __GLinterface *glAquaCreateContext(__GLimports *imports, - __GLcontextModes *mode, - __GLinterface *shareGC); -static void glAquaCreateBuffer(__GLXdrawablePrivate *glxPriv); -static void glAquaResetExtension(void); - -/* - * This structure is statically allocated in the __glXScreens[] - * structure. This struct is not used anywhere other than in - * __glXScreenInit to initialize each of the active screens - * (__glXActiveScreens[]). Several of the fields must be initialized by - * the screenProbe routine before they are copied to the active screens - * struct. In particular, the contextCreate, modes, numVisuals, - * and numUsableVisuals fields must be initialized. - */ -static __GLXscreenInfo __glDDXScreenInfo = { - glAquaScreenProbe, /* Must be generic and handle all screens */ - glAquaCreateContext, /* Substitute screen's createContext routine */ - glAquaCreateBuffer, /* Substitute screen's createBuffer routine */ - NULL, /* Set up modes in probe */ - NULL, /* Set up pVisualPriv in probe */ - 0, /* Set up numVisuals in probe */ - 0, /* Set up numUsableVisuals in probe */ - "Vendor String", /* GLXvendor is overwritten by __glXScreenInit */ - "Version String", /* GLXversion is overwritten by __glXScreenInit */ - "Extensions String", /* GLXextensions is overwritten by __glXScreenInit */ - NULL /* WrappedPositionWindow is overwritten */ -}; - -void *__glXglDDXScreenInfo(void) { - return &__glDDXScreenInfo; -} - -static __GLXextensionInfo __glDDXExtensionInfo = { - GL_CORE_APPLE, - glAquaResetExtension, - glAquaInitVisuals, - glAquaSetVisualConfigs -}; - -void *__glXglDDXExtensionInfo(void) { - return &__glDDXExtensionInfo; -} - -// prototypes - -static GLboolean glAquaDestroyContext(__GLcontext *gc); -static GLboolean glAquaLoseCurrent(__GLcontext *gc); -static GLboolean glAquaMakeCurrent(__GLcontext *gc); -static GLboolean glAquaShareContext(__GLcontext *gc, __GLcontext *gcShare); -static GLboolean glAquaCopyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask); -static GLboolean glAquaForceCurrent(__GLcontext *gc); - -/* Drawing surface notification callbacks */ -static GLboolean glAquaNotifyResize(__GLcontext *gc); -static void glAquaNotifyDestroy(__GLcontext *gc); -static void glAquaNotifySwapBuffers(__GLcontext *gc); - -/* Dispatch table override control for external agents like libGLS */ -static struct __GLdispatchStateRec* glAquaDispatchExec(__GLcontext *gc); -static void glAquaBeginDispatchOverride(__GLcontext *gc); -static void glAquaEndDispatchOverride(__GLcontext *gc); - -static __GLexports glAquaExports = { - glAquaDestroyContext, - glAquaLoseCurrent, - glAquaMakeCurrent, - glAquaShareContext, - glAquaCopyContext, - glAquaForceCurrent, - - glAquaNotifyResize, - glAquaNotifyDestroy, - glAquaNotifySwapBuffers, - - glAquaDispatchExec, - glAquaBeginDispatchOverride, - glAquaEndDispatchOverride -}; - -typedef struct { - int num_vis; - __GLcontextModes *modes; - void **priv; - - // wrapped screen functions - RealizeWindowProcPtr RealizeWindow; - UnrealizeWindowProcPtr UnrealizeWindow; -} glAquaScreenRec; - -static glAquaScreenRec glAquaScreens[MAXSCREENS]; - -// __GLdrawablePrivate->private -typedef struct { - DrawablePtr pDraw; - xp_surface_id sid; -} GLAquaDrawableRec; - -struct __GLcontextRec { - struct __GLinterfaceRec interface; // required to be first - - CGLContextObj ctx; - CGLPixelFormatObj pixelFormat; - - /* set when attached */ - xp_surface_id sid; - - unsigned isAttached :1; -}; - -/* maps from surface id -> list of __GLcontext */ -static x_hash_table *surface_hash; - - -// Context manipulation; return GL_FALSE on failure -static GLboolean glAquaDestroyContext(__GLcontext *gc) -{ - x_list *lst; - - GLAQUA_DEBUG_MSG("glAquaDestroyContext (ctx 0x%x)\n", - (unsigned int) gc->ctx); - - if (gc != NULL) - { - if (gc->sid != 0 && surface_hash != NULL) - { - lst = x_hash_table_lookup(surface_hash, (void *) gc->sid, NULL); - lst = x_list_remove(lst, gc); - x_hash_table_insert(surface_hash, (void *) gc->sid, lst); - } - - if (gc->ctx != NULL) - CGLDestroyContext(gc->ctx); - - if (gc->pixelFormat != NULL) - CGLDestroyPixelFormat(gc->pixelFormat); - - free(gc); - } - - return GL_TRUE; -} - -static GLboolean glAquaLoseCurrent(__GLcontext *gc) -{ - CGLError gl_err; - - GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%x)\n", (unsigned int) gc->ctx); - - gl_err = CGLSetCurrentContext(NULL); - if (gl_err != 0) - ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); - - __glXLastContext = NULL; // Mesa does this; why? - - return GL_TRUE; -} - -/* Called when a surface is destroyed as a side effect of destroying - the window it's attached to. */ -static void surface_notify(void *_arg, void *data) -{ - DRISurfaceNotifyArg *arg = _arg; - GLAquaDrawableRec *aquaPriv = data; - __GLcontext *gc; - x_list *lst; - - switch (arg->kind) - { - case AppleDRISurfaceNotifyDestroyed: - if (surface_hash != NULL) - x_hash_table_remove(surface_hash, (void *) arg->id); - - aquaPriv->pDraw = NULL; - aquaPriv->sid = 0; - break; - - case AppleDRISurfaceNotifyChanged: - if (surface_hash != NULL) - { - lst = x_hash_table_lookup(surface_hash, (void *) arg->id, NULL); - for (; lst != NULL; lst = lst->next) - { - gc = lst->data; - xp_update_gl_context(gc->ctx); - } - } - break; - } -} - -static void unattach(__GLcontext *gc) -{ - x_list *lst; - - if (gc->isAttached) - { - GLAQUA_DEBUG_MSG("unattaching\n"); - - if (surface_hash != NULL) - { - lst = x_hash_table_lookup(surface_hash, (void *) gc->sid, NULL); - lst = x_list_remove(lst, gc); - x_hash_table_insert(surface_hash, (void *) gc->sid, lst); - } - - CGLClearDrawable(gc->ctx); - gc->isAttached = FALSE; - gc->sid = 0; - } -} - -static void attach(__GLcontext *gc, __GLdrawablePrivate *glPriv) -{ - __GLXdrawablePrivate *glxPriv; - GLAquaDrawableRec *aquaPriv; - DrawablePtr pDraw; - - glxPriv = (__GLXdrawablePrivate *)glPriv->other; - aquaPriv = (GLAquaDrawableRec *)glPriv->private; - pDraw = glxPriv->pDraw; - - if (aquaPriv->sid == 0) - { - if (!quartzProcs->CreateSurface(pDraw->pScreen, pDraw->id, pDraw, - 0, &aquaPriv->sid, NULL, - surface_notify, aquaPriv)) - { - return; - } - aquaPriv->pDraw = pDraw; - } - - if (!gc->isAttached || gc->sid != aquaPriv->sid) - { - x_list *lst; - - if (xp_attach_gl_context(gc->ctx, aquaPriv->sid) != Success) - { - quartzProcs->DestroySurface(pDraw->pScreen, pDraw->id, pDraw, - surface_notify, aquaPriv); - if (surface_hash != NULL) - x_hash_table_remove(surface_hash, (void *) aquaPriv->sid); - - aquaPriv->sid = 0; - return; - } - - gc->isAttached = TRUE; - gc->sid = aquaPriv->sid; - - if (surface_hash == NULL) - surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL); - - lst = x_hash_table_lookup(surface_hash, (void *) gc->sid, NULL); - if (x_list_find(lst, gc) == NULL) - { - lst = x_list_prepend(lst, gc); - x_hash_table_insert(surface_hash, (void *) gc->sid, lst); - } - - GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", (unsigned int) pDraw->id, - (unsigned int) aquaPriv->sid); - } -} - -static GLboolean glAquaMakeCurrent(__GLcontext *gc) -{ - __GLdrawablePrivate *glPriv = gc->interface.imports.getDrawablePrivate(gc); - CGLError gl_err; - - GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%x)\n", (unsigned int) gc->ctx); - - attach(gc, glPriv); - - gl_err = CGLSetCurrentContext(gc->ctx); - if (gl_err != 0) - ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); - - return gl_err == 0; -} - -static GLboolean glAquaShareContext(__GLcontext *gc, __GLcontext *gcShare) -{ - GLAQUA_DEBUG_MSG("glAquaShareContext unimplemented\n"); - - return GL_TRUE; -} - -static GLboolean glAquaCopyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask) -{ - CGLError gl_err; - - GLAQUA_DEBUG_MSG("glAquaCopyContext\n"); - - gl_err = CGLCopyContext(src->ctx, dst->ctx, mask); - if (gl_err != 0) - ErrorF("CGLCopyContext error: %s\n", CGLErrorString(gl_err)); - - return gl_err == 0; -} - -static GLboolean glAquaForceCurrent(__GLcontext *gc) -{ - CGLError gl_err; - - GLAQUA_DEBUG_MSG("glAquaForceCurrent (ctx 0x%x)\n", - (unsigned int) gc->ctx); - - gl_err = CGLSetCurrentContext(gc->ctx); - if (gl_err != 0) - ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); - - return gl_err == 0; -} - -/* Drawing surface notification callbacks */ - -static GLboolean glAquaNotifyResize(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaNotifyResize"); - return GL_TRUE; -} - -static void glAquaNotifyDestroy(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaNotifyDestroy"); -} - -static void glAquaNotifySwapBuffers(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaNotifySwapBuffers"); -} - -/* Dispatch table override control for external agents like libGLS */ -static struct __GLdispatchStateRec* glAquaDispatchExec(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaDispatchExec"); - return NULL; -} - -static void glAquaBeginDispatchOverride(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaBeginDispatchOverride"); -} - -static void glAquaEndDispatchOverride(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaEndDispatchOverride"); -} - -static CGLPixelFormatObj makeFormat(__GLcontextModes *mode) -{ - int i; - CGLPixelFormatAttribute attr[64]; // currently uses max of 30 - CGLPixelFormatObj result; - long n_formats; - CGLError gl_err; - - GLAQUA_DEBUG_MSG("makeFormat\n"); - - if (!mode->rgbMode) - return NULL; - - i = 0; - - // attr [i++] = kCGLPFAAcelerated; // require hwaccel - BAD for multiscreen - // attr [i++] = kCGLPFANoRecovery; // disable fallback renderers - BAD - - if (mode->stereoMode) { - attr[i++] = kCGLPFAStereo; - } - if (mode->doubleBufferMode) { - attr[i++] = kCGLPFADoubleBuffer; - } - - if (mode->colorIndexMode) { - /* ignored */ - } - - if (mode->rgbMode) { - attr[i++] = kCGLPFAColorSize; - attr[i++] = mode->redBits + mode->greenBits + mode->blueBits; - attr[i++] = kCGLPFAAlphaSize; - attr[i++] = 1; /* FIXME: ignoring mode->alphaBits which is always 0 */ - } - - if (mode->haveAccumBuffer) { - attr[i++] = kCGLPFAAccumSize; - attr[i++] = mode->accumRedBits + mode->accumGreenBits - + mode->accumBlueBits + mode->accumAlphaBits; - } - if (mode->haveDepthBuffer) { - attr[i++] = kCGLPFADepthSize; - attr[i++] = mode->depthBits; - } - if (mode->haveStencilBuffer) { - attr[i++] = kCGLPFAStencilSize; - attr[i++] = mode->stencilBits; - } - - attr[i++] = kCGLPFAAuxBuffers; - attr[i++] = mode->numAuxBuffers; - - /* mode->level ignored */ - - /* mode->pixmapMode ? */ - - attr[i++] = 0; - - GLAQUA_DEBUG_MSG("makeFormat almost done\n"); - - result = NULL; - gl_err = CGLChoosePixelFormat(attr, &result, &n_formats); - if (gl_err != 0) - ErrorF("CGLChoosePixelFormat error: %s\n", CGLErrorString(gl_err)); - - GLAQUA_DEBUG_MSG("makeFormat done (0x%x)\n", (unsigned int) result); - - return result; -} - -static __GLinterface *glAquaCreateContext(__GLimports *imports, - __GLcontextModes *mode, - __GLinterface *shareGC) -{ - __GLcontext *result; - __GLcontext *sharectx = (__GLcontext *)shareGC; - CGLError gl_err; - - GLAQUA_DEBUG_MSG("glAquaCreateContext\n"); - - result = (__GLcontext *)calloc(1, sizeof(__GLcontext)); - if (!result) return NULL; - - result->interface.imports = *imports; - result->interface.exports = glAquaExports; - - result->pixelFormat = makeFormat(mode); - if (!result->pixelFormat) { - free(result); - return NULL; - } - - result->ctx = NULL; - gl_err = CGLCreateContext(result->pixelFormat, - sharectx ? sharectx->ctx : NULL, - &result->ctx); - - if (gl_err != 0) { - ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err)); - CGLDestroyPixelFormat(result->pixelFormat); - free(result); - return NULL; - } - - GLAQUA_DEBUG_MSG("glAquaCreateContext done\n"); - return (__GLinterface *)result; -} - -Bool -glAquaRealizeWindow(WindowPtr pWin) -{ - // If this window has GL contexts, tell them to reattach - Bool result; - ScreenPtr pScreen = pWin->drawable.pScreen; - glAquaScreenRec *screenPriv = &glAquaScreens[pScreen->myNum]; - __GLXdrawablePrivate *glxPriv; - - GLAQUA_DEBUG_MSG("glAquaRealizeWindow\n"); - - // Allow the window to be created (RootlessRealizeWindow is inside our wrap) - pScreen->RealizeWindow = screenPriv->RealizeWindow; - result = pScreen->RealizeWindow(pWin); - pScreen->RealizeWindow = glAquaRealizeWindow; - - // The Aqua window will already have been created (windows are - // realized from top down) - - // Re-attach this window's GL contexts, if any. - glxPriv = __glXFindDrawablePrivate(pWin->drawable.id); - if (glxPriv) { - __GLXcontext *gx; - __GLcontext *gc; - __GLdrawablePrivate *glPriv = &glxPriv->glPriv; - GLAQUA_DEBUG_MSG("glAquaRealizeWindow is GL drawable!\n"); - - // GL contexts bound to this window for drawing - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) { - gc = (__GLcontext *)gx->gc; - attach(gc, glPriv); - } - - // GL contexts bound to this window for reading - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) { - gc = (__GLcontext *)gx->gc; - attach(gc, glPriv); - } - } - - return result; -} - -Bool -glAquaUnrealizeWindow(WindowPtr pWin) -{ - // If this window has GL contexts, tell them to unattach - Bool result; - ScreenPtr pScreen = pWin->drawable.pScreen; - glAquaScreenRec *screenPriv = &glAquaScreens[pScreen->myNum]; - __GLXdrawablePrivate *glxPriv; - - GLAQUA_DEBUG_MSG("glAquaUnrealizeWindow\n"); - - // The Aqua window may have already been destroyed (windows - // are unrealized from top down) - - // Unattach this window's GL contexts, if any. - glxPriv = __glXFindDrawablePrivate(pWin->drawable.id); - if (glxPriv) { - __GLXcontext *gx; - __GLcontext *gc; - GLAQUA_DEBUG_MSG("glAquaUnealizeWindow is GL drawable!\n"); - - // GL contexts bound to this window for drawing - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) { - gc = (__GLcontext *)gx->gc; - unattach(gc); - } - - // GL contexts bound to this window for reading - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) { - gc = (__GLcontext *)gx->gc; - unattach(gc); - } - } - - pScreen->UnrealizeWindow = screenPriv->UnrealizeWindow; - result = pScreen->UnrealizeWindow(pWin); - pScreen->UnrealizeWindow = glAquaUnrealizeWindow; - - return result; -} - - -// Originally copied from Mesa - -static int numConfigs = 0; -static __GLXvisualConfig *visualConfigs = NULL; -static void **visualPrivates = NULL; - -/* - * In the case the driver defines no GLX visuals we'll use these. - * Note that for TrueColor and DirectColor visuals, bufferSize is the - * sum of redSize, greenSize, blueSize and alphaSize, which may be larger - * than the nplanes/rootDepth of the server's X11 visuals - */ -#define NUM_FALLBACK_CONFIGS 5 -static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { - /* [0] = RGB, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [1] = RGB, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 16, 16, 16, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [4] = CI, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - False, /* rgba? (false = color index) */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, -}; - -static __GLXvisualConfig NullConfig = { - -1, /* vid */ - -1, /* class */ - False, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE_EXT, /* visualRating */ - 0, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ -}; - - -static inline int count_bits(uint32_t x) -{ - x = x - ((x >> 1) & 0x55555555); - x = (x & 0x33333333) + ((x >> 2) & 0x33333333); - x = (x + (x >> 4)) & 0x0f0f0f0f; - x = x + (x >> 8); - x = x + (x >> 16); - return x & 63; -} - - -static Bool init_visuals(int *nvisualp, VisualPtr *visualp, - VisualID *defaultVisp, - int ndepth, DepthPtr pdepth, - int rootDepth) -{ - int numRGBconfigs; - int numCIconfigs; - int numVisuals = *nvisualp; - int numNewVisuals; - int numNewConfigs; - VisualPtr pVisual = *visualp; - VisualPtr pVisualNew = NULL; - VisualID *orig_vid = NULL; - __GLcontextModes *modes; - __GLXvisualConfig *pNewVisualConfigs = NULL; - void **glXVisualPriv; - void **pNewVisualPriv; - int found_default; - int i, j, k; - - GLAQUA_DEBUG_MSG("init_visuals\n"); - - if (numConfigs > 0) - numNewConfigs = numConfigs; - else - numNewConfigs = NUM_FALLBACK_CONFIGS; - - /* Alloc space for the list of new GLX visuals */ - pNewVisualConfigs = (__GLXvisualConfig *) - __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); - if (!pNewVisualConfigs) { - return FALSE; - } - - /* Alloc space for the list of new GLX visual privates */ - pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); - if (!pNewVisualPriv) { - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* - ** If SetVisualConfigs was not called, then use default GLX - ** visual configs. - */ - if (numConfigs == 0) { - memcpy(pNewVisualConfigs, FallbackConfigs, - NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); - memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); - } - else { - /* copy driver's visual config info */ - for (i = 0; i < numConfigs; i++) { - pNewVisualConfigs[i] = visualConfigs[i]; - pNewVisualPriv[i] = visualPrivates[i]; - } - } - - /* Count the number of RGB and CI visual configs */ - numRGBconfigs = 0; - numCIconfigs = 0; - for (i = 0; i < numNewConfigs; i++) { - if (pNewVisualConfigs[i].rgba) - numRGBconfigs++; - else - numCIconfigs++; - } - - /* Count the total number of visuals to compute */ - numNewVisuals = 0; - for (i = 0; i < numVisuals; i++) { - int count; - - count = ((pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor) - ? numRGBconfigs : numCIconfigs); - if (count == 0) - count = 1; /* preserve the existing visual */ - - numNewVisuals += count; - } - - /* Reset variables for use with the next screen/driver's visual configs */ - visualConfigs = NULL; - numConfigs = 0; - - /* Alloc temp space for the list of orig VisualIDs for each new visual */ - orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); - if (!orig_vid) { - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisuals */ - modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); - if (modes == NULL) { - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisualPrivates */ - glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); - if (!glXVisualPriv) { - _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the new list of the X server's visuals */ - pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); - if (!pVisualNew) { - __glXFree(glXVisualPriv); - _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Initialize the new visuals */ - found_default = FALSE; - glAquaScreens[screenInfo.numScreens-1].modes = modes; - for (i = j = 0; i < numVisuals; i++) { - int is_rgb = (pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor); - - if (!is_rgb) - { - /* We don't support non-rgb visuals for GL. But we don't - want to remove them either, so just pass them through - with null glX configs */ - - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & NullConfig ); - modes->visualID = pVisualNew[j].vid; - - j++; - - continue; - } - - for (k = 0; k < numNewConfigs; k++) { - if (pNewVisualConfigs[k].rgba != is_rgb) - continue; - - assert( modes != NULL ); - - /* Initialize the new visual */ - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); - modes->visualID = pVisualNew[j].vid; - - /* - * If the class is -1, then assume the X visual information - * is identical to what GLX needs, and take them from the X - * visual. NOTE: if class != -1, then all other fields MUST - * be initialized. - */ - if (modes->visualType == GLX_NONE) { - modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); - modes->redBits = count_bits(pVisual[i].redMask); - modes->greenBits = count_bits(pVisual[i].greenMask); - modes->blueBits = count_bits(pVisual[i].blueMask); - modes->alphaBits = modes->alphaBits; - modes->redMask = pVisual[i].redMask; - modes->greenMask = pVisual[i].greenMask; - modes->blueMask = pVisual[i].blueMask; - modes->alphaMask = modes->alphaMask; - modes->rgbBits = (is_rgb) - ? (modes->redBits + modes->greenBits + - modes->blueBits + modes->alphaBits) - : rootDepth; - } - - /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pNewVisualPriv[k]; - - j++; - modes = modes->next; - } - } - - assert(j <= numNewVisuals); - - /* Save the GLX visuals in the screen structure */ - glAquaScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; - glAquaScreens[screenInfo.numScreens-1].priv = glXVisualPriv; - - /* Set up depth's VisualIDs */ - for (i = 0; i < ndepth; i++) { - int numVids = 0; - VisualID *pVids = NULL; - int k, n = 0; - - /* Count the new number of VisualIDs at this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - numVids++; - - /* Allocate a new list of VisualIDs for this depth */ - pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); - - /* Initialize the new list of VisualIDs for this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - pVids[n++] = pVisualNew[k].vid; - - /* Update this depth's list of VisualIDs */ - __glXFree(pdepth[i].vids); - pdepth[i].vids = pVids; - pdepth[i].numVids = numVids; - } - - /* Update the X server's visuals */ - *nvisualp = numNewVisuals; - *visualp = pVisualNew; - - /* Free the old list of the X server's visuals */ - __glXFree(pVisual); - - /* Clean up temporary allocations */ - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - - /* Free the private list created by DDX HW driver */ - if (visualPrivates) - xfree(visualPrivates); - visualPrivates = NULL; - - return TRUE; -} - -/* based on code in i830_dri.c - This ends calling glAquaSetVisualConfigs to set the static - numconfigs, etc. */ -static void -glAquaInitVisualConfigs(void) -{ - int lclNumConfigs = 0; - __GLXvisualConfig *lclVisualConfigs = NULL; - void **lclVisualPrivates = NULL; - - int depth, aux, buffers, stencil, accum; - int i = 0; - - GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs "); - - /* count num configs: - 2 Z buffer (0, 24 bit) - 2 AUX buffer (0, 2) - 2 buffers (single, double) - 2 stencil (0, 8 bit) - 2 accum (0, 64 bit) - = 32 configs */ - - lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */ - - /* alloc */ - lclVisualConfigs = xcalloc(sizeof(__GLXvisualConfig), lclNumConfigs); - lclVisualPrivates = xcalloc(sizeof(void *), lclNumConfigs); - - /* fill in configs */ - if (NULL != lclVisualConfigs) { - i = 0; /* current buffer */ - for (depth = 0; depth < 2; depth++) { - for (aux = 0; aux < 2; aux++) { - for (buffers = 0; buffers < 2; buffers++) { - for (stencil = 0; stencil < 2; stencil++) { - for (accum = 0; accum < 2; accum++) { - lclVisualConfigs[i].vid = -1; - lclVisualConfigs[i].class = -1; - lclVisualConfigs[i].rgba = TRUE; - lclVisualConfigs[i].redSize = -1; - lclVisualConfigs[i].greenSize = -1; - lclVisualConfigs[i].blueSize = -1; - lclVisualConfigs[i].redMask = -1; - lclVisualConfigs[i].greenMask = -1; - lclVisualConfigs[i].blueMask = -1; - lclVisualConfigs[i].alphaMask = 0; - if (accum) { - lclVisualConfigs[i].accumRedSize = 16; - lclVisualConfigs[i].accumGreenSize = 16; - lclVisualConfigs[i].accumBlueSize = 16; - lclVisualConfigs[i].accumAlphaSize = 16; - } - else { - lclVisualConfigs[i].accumRedSize = 0; - lclVisualConfigs[i].accumGreenSize = 0; - lclVisualConfigs[i].accumBlueSize = 0; - lclVisualConfigs[i].accumAlphaSize = 0; - } - lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE; - lclVisualConfigs[i].stereo = FALSE; - lclVisualConfigs[i].bufferSize = -1; - - lclVisualConfigs[i].depthSize = depth? 24 : 0; - lclVisualConfigs[i].stencilSize = stencil ? 8 : 0; - lclVisualConfigs[i].auxBuffers = aux ? 2 : 0; - lclVisualConfigs[i].level = 0; - lclVisualConfigs[i].visualRating = GLX_NONE_EXT; - lclVisualConfigs[i].transparentPixel = 0; - lclVisualConfigs[i].transparentRed = 0; - lclVisualConfigs[i].transparentGreen = 0; - lclVisualConfigs[i].transparentBlue = 0; - lclVisualConfigs[i].transparentAlpha = 0; - lclVisualConfigs[i].transparentIndex = 0; - i++; - } - } - } - } - } - } - if (i != lclNumConfigs) - GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs failed to alloc visual configs"); - - GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates); -} - - -static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates) -{ - GLAQUA_DEBUG_MSG("glAquaSetVisualConfigs\n"); - - numConfigs = nconfigs; - visualConfigs = configs; - visualPrivates = privates; -} - -static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB) -{ - GLAQUA_DEBUG_MSG("glAquaInitVisuals\n"); - - if (numConfigs == 0) /* if no configs */ - glAquaInitVisualConfigs(); /* ensure the visual configs are setup */ - - /* - * Setup the visuals supported by this particular screen. - */ - return init_visuals(nvisualp, visualp, defaultVisp, - *ndepthp, *depthp, *rootDepthp); -} - - -static void fixup_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - glAquaScreenRec *pScr = &glAquaScreens[screen]; - int j; - __GLcontextModes *modes; - - GLAQUA_DEBUG_MSG("fixup_visuals\n"); - - for ( modes = pScr->modes ; modes != NULL ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - /* Find a visual that matches the GLX visual's class and size */ - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes) { - - /* Fixup the masks */ - modes->redMask = pVis[j].redMask; - modes->greenMask = pVis[j].greenMask; - modes->blueMask = pVis[j].blueMask; - - /* Recalc the sizes */ - modes->redBits = count_bits(modes->redMask); - modes->greenBits = count_bits(modes->greenMask); - modes->blueBits = count_bits(modes->blueMask); - } - } - } -} - -static void init_screen_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - __GLcontextModes *modes; - int *used; - int i, j; - - GLAQUA_DEBUG_MSG("init_screen_visuals\n"); - - /* FIXME: Change 'used' to be a array of bits (rather than of ints), - * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less - * FIXME: than 64 or 128 the stack array can be used instead of calling - * FIXME: __glXMalloc / __glXFree. If nothing else, convert 'used' to - * FIXME: array of bytes instead of ints! - */ - used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int)); - __glXMemset(used, 0, pScreen->numVisuals * sizeof(int)); - - i = 0; - for ( modes = glAquaScreens[screen].modes - ; modes != NULL - ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes && - pVis[j].redMask == modes->redMask && - pVis[j].greenMask == modes->greenMask && - pVis[j].blueMask == modes->blueMask && - !used[j]) { - - /* Set the VisualID */ - modes->visualID = pVis[j].vid; - - /* Mark this visual used */ - used[j] = 1; - break; - } - } - if ( j == pScreen->numVisuals ) { - ErrorF("No matching visual for __GLcontextMode with " - "visual class = %d (%d), nplanes = %u\n", - vis_class, - (int)modes->visualType, - (unsigned int)(modes->rgbBits - modes->alphaBits) ); - } - else if ( modes->visualID == -1 ) { - FatalError( "Matching visual found, but visualID still -1!\n" ); - } - - i++; - } - - __glXFree(used); -} - -static Bool glAquaScreenProbe(int screen) -{ - ScreenPtr pScreen; - glAquaScreenRec *screenPriv; - - GLAQUA_DEBUG_MSG("glAquaScreenProbe\n"); - - /* - * Set up the current screen's visuals. - */ - __glDDXScreenInfo.modes = glAquaScreens[screen].modes; - __glDDXScreenInfo.pVisualPriv = glAquaScreens[screen].priv; - __glDDXScreenInfo.numVisuals = - __glDDXScreenInfo.numUsableVisuals = glAquaScreens[screen].num_vis; - - /* - * Set the current screen's createContext routine. This could be - * wrapped by a DDX GLX context creation routine. - */ - __glDDXScreenInfo.createContext = glAquaCreateContext; - - /* - * The ordering of the rgb compenents might have been changed by the - * driver after mi initialized them. - */ - fixup_visuals(screen); - - /* - * Find the GLX visuals that are supported by this screen and create - * XMesa's visuals. - */ - init_screen_visuals(screen); - - /* - * Wrap RealizeWindow and UnrealizeWindow on this screen - */ - pScreen = screenInfo.screens[screen]; - screenPriv = &glAquaScreens[screen]; - screenPriv->RealizeWindow = pScreen->RealizeWindow; - pScreen->RealizeWindow = glAquaRealizeWindow; - screenPriv->UnrealizeWindow = pScreen->UnrealizeWindow; - pScreen->UnrealizeWindow = glAquaUnrealizeWindow; - - return TRUE; -} - -static GLboolean glAquaSwapBuffers(__GLXdrawablePrivate *glxPriv) -{ - // swap buffers on only *one* of the contexts - // (e.g. the last one for drawing) - __GLcontext *gc = (__GLcontext *)glxPriv->drawGlxc->gc; - CGLError gl_err; - - GLAQUA_DEBUG_MSG("glAquaSwapBuffers\n"); - - if (gc != NULL && gc->ctx != NULL) - { - gl_err = CGLFlushDrawable(gc->ctx); - if (gl_err != 0) - ErrorF("CGLFlushDrawable error: %s\n", CGLErrorString(gl_err)); - } - - return GL_TRUE; -} - -static void glAquaDestroyDrawablePrivate(__GLdrawablePrivate *glPriv) -{ - GLAQUA_DEBUG_MSG("glAquaDestroyDrawablePrivate\n"); - - /* It doesn't work to call DRIDestroySurface here, the drawable's - already gone.. But dri.c notices the window destruction and - frees the surface itself. */ - - free(glPriv->private); - glPriv->private = NULL; -} - -static void glAquaCreateBuffer(__GLXdrawablePrivate *glxPriv) -{ - GLAquaDrawableRec *aquaPriv = malloc(sizeof(GLAquaDrawableRec)); - __GLdrawablePrivate *glPriv = &glxPriv->glPriv; - - aquaPriv->sid = 0; - aquaPriv->pDraw = NULL; - - GLAQUA_DEBUG_MSG("glAquaCreateBuffer\n"); - - // replace swapBuffers (original is never called) - glxPriv->swapBuffers = glAquaSwapBuffers; - - // stash private data - glPriv->private = aquaPriv; - glPriv->freePrivate = glAquaDestroyDrawablePrivate; -} - -static void glAquaResetExtension(void) -{ - GLAQUA_DEBUG_MSG("glAquaResetExtension\n"); - CGLSetOption(kCGLGOResetLibrary, GL_TRUE); -} - -// Extra goodies for glx - -GLuint __glFloorLog2(GLuint val) -{ - int c = 0; - - while (val > 1) { - c++; - val >>= 1; - } - return c; -} diff --git a/nx-X11/programs/Xserver/GL/dri/Imakefile b/nx-X11/programs/Xserver/GL/dri/Imakefile deleted file mode 100644 index 8ea938f8c..000000000 --- a/nx-X11/programs/Xserver/GL/dri/Imakefile +++ /dev/null @@ -1,35 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/dri/Imakefile,v 1.6 2001/04/28 13:55:36 dawes Exp $ - -#define IHaveModules -#include <Server.tmpl> - -#if DoLoadableServer -MSRC = drimodule.c -MOBJ = drimodule.o -#endif - - SRCS = xf86dri.c dri.c $(MSRC) - OBJS = xf86dri.o dri.o $(MOBJ) - - INCLUDES = -I$(SERVERSRC)/include -I$(INCLUDESRC) -I$(XINCLUDESRC) \ - -I$(EXTINCSRC) -I$(MESASRCDIR)/include \ - -I$(XF86OSSRC) -I$(XF86COMSRC) \ - -I../include -I../glx -I$(LIBSRC)/GL/include \ - -I$(DRMSRCDIR)/shared-core \ - -I$(SERVERSRC)/mi -I$(FONTINCSRC) - DEFINES = $(GLX_DEFINES) - -LinkSourceFile(xf86dri.h,$(MESASRCDIR)/src/glx/x11) -LinkSourceFile(xf86dristr.h,$(MESASRCDIR)/src/glx/x11) - -ModuleObjectRule() -LibraryModuleTarget(dri,$(OBJS)) -InstallLibraryModule(dri,$(MODULEDIR),extensions) - -DependTarget() - -InstallDriverSDKLibraryModule(dri,$(DRIVERSDKMODULEDIR),extensions) - -InstallDriverSDKNonExecFile(dri.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(sarea.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86dri.h,$(DRIVERSDKINCLUDEDIR)) diff --git a/nx-X11/programs/Xserver/GL/dri/Imakefile.NX.reference b/nx-X11/programs/Xserver/GL/dri/Imakefile.NX.reference deleted file mode 100644 index 59fb0af84..000000000 --- a/nx-X11/programs/Xserver/GL/dri/Imakefile.NX.reference +++ /dev/null @@ -1,35 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/dri/Imakefile,v 1.7 2003/02/11 21:34:04 tsi Exp $ - -#define IHaveModules -#include <Server.tmpl> - -#if DoLoadableServer -MSRC = drimodule.c -MOBJ = drimodule.o -#endif - - SRCS = xf86dri.c dri.c $(MSRC) - OBJS = xf86dri.o dri.o $(MOBJ) - - INCLUDES = -I$(SERVERSRC)/include -I$(INCLUDESRC) -I$(XINCLUDESRC) \ - -I$(EXTINCSRC) \ - -I$(XF86OSSRC) -I$(XF86COMSRC) \ - -I../include -I../glx -I$(LIBSRC)/GL/include \ - -I$(SERVERSRC)/mi -I$(FONTINCSRC) \ - -I../../hw/xfree86/os-support/bus - DEFINES = $(GLX_DEFINES) - -LinkSourceFile(xf86dri.h,$(LIBSRC)/GL/dri) -LinkSourceFile(xf86dristr.h,$(LIBSRC)/GL/dri) - -ModuleObjectRule() -LibraryModuleTarget(dri,$(OBJS)) -InstallLibraryModule(dri,$(MODULEDIR),extensions) - -DependTarget() - -InstallDriverSDKLibraryModule(dri,$(DRIVERSDKMODULEDIR),extensions) - -InstallDriverSDKNonExecFile(dri.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(sarea.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86dri.h,$(DRIVERSDKINCLUDEDIR)) diff --git a/nx-X11/programs/Xserver/GL/dri/Imakefile.XF86.reference b/nx-X11/programs/Xserver/GL/dri/Imakefile.XF86.reference deleted file mode 100644 index c8770f6d8..000000000 --- a/nx-X11/programs/Xserver/GL/dri/Imakefile.XF86.reference +++ /dev/null @@ -1,34 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/dri/Imakefile,v 1.7 2003/02/11 21:34:04 tsi Exp $ - -#define IHaveModules -#include <Server.tmpl> - -#if DoLoadableServer -MSRC = drimodule.c -MOBJ = drimodule.o -#endif - - SRCS = xf86dri.c dri.c $(MSRC) - OBJS = xf86dri.o dri.o $(MOBJ) - - INCLUDES = -I$(SERVERSRC)/include -I$(INCLUDESRC) -I$(XINCLUDESRC) \ - -I$(EXTINCSRC) \ - -I$(XF86OSSRC) -I$(XF86COMSRC) \ - -I../include -I../glx -I$(LIBSRC)/GL/include \ - -I$(SERVERSRC)/mi -I$(FONTINCSRC) - DEFINES = $(GLX_DEFINES) - -LinkSourceFile(xf86dri.h,$(LIBSRC)/GL/dri) -LinkSourceFile(xf86dristr.h,$(LIBSRC)/GL/dri) - -ModuleObjectRule() -LibraryModuleTarget(dri,$(OBJS)) -InstallLibraryModule(dri,$(MODULEDIR),extensions) - -DependTarget() - -InstallDriverSDKLibraryModule(dri,$(DRIVERSDKMODULEDIR),extensions) - -InstallDriverSDKNonExecFile(dri.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(sarea.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86dri.h,$(DRIVERSDKINCLUDEDIR)) diff --git a/nx-X11/programs/Xserver/GL/dri/dri-def.cpp b/nx-X11/programs/Xserver/GL/dri/dri-def.cpp deleted file mode 100644 index 0d1ab6872..000000000 --- a/nx-X11/programs/Xserver/GL/dri/dri-def.cpp +++ /dev/null @@ -1,50 +0,0 @@ -LIBRARY DRI -VERSION LIBRARY_VERSION -EXPORTS - -XFree86DRIExtensionInit -DRIAuthConnection -DRIBlockHandler -DRIClipNotify -DRICloseConnection -DRICloseScreen -DRIContextPrivDelete -DRICopyWindow -DRICreateContext -DRICreateContextPriv -DRICreateContextPrivFromHandle -DRICreateDrawable -DRICreateInfoRec -DRIDestroyContext -DRIDestroyContextPriv -DRIDestroyDrawable -DRIDestroyInfoRec -DRIDoBlockHandler -DRIDoWakeupHandler -DRIDrawablePrivDelete -DRIExtensionInit -DRIFinishScreenInit -DRIGetClientDriverName -DRIGetContext -DRIGetContextStore -DRIGetDeviceInfo -DRIGetDrawableIndex -DRIGetDrawableInfo -DRIGetDrawableStamp -DRIGetSAREAPrivate -DRIGetWrappedFuncs -DRILock -DRIOpenConnection -DRIPaintWindow -DRIPostValidateTree -DRIPrintDrawableLock -DRIQueryDirectRenderingCapable -DRIQueryVersion -DRIReset -DRIScreenInit -DRISwapContext -DRIUnlock -DRIValidateTree -DRIWakeupHandler - -/* $XFree86$ */ diff --git a/nx-X11/programs/Xserver/GL/dri/dri.c b/nx-X11/programs/Xserver/GL/dri/dri.c deleted file mode 100644 index 424a21c68..000000000 --- a/nx-X11/programs/Xserver/GL/dri/dri.c +++ /dev/null @@ -1,2109 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/dri.c,v 1.39 2003/11/10 18:21:41 tsi Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Jens Owen <jens@tungstengraphics.com> - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86.h" -#ifdef XFree86LOADER -#include "xf86_ansic.h" -#else -#include <sys/time.h> -#include <unistd.h> -#endif - -#define NEED_REPLIES -#define NEED_EVENTS -#include <X11/X.h> -#include <X11/Xproto.h> -#include "misc.h" -#include "dixstruct.h" -#include "extnsionst.h" -#include "colormapst.h" -#include "cursorstr.h" -#include "scrnintstr.h" -#include "windowstr.h" -#include "servermd.h" -#define _XF86DRI_SERVER_ -#include "xf86dristr.h" -#include "swaprep.h" -#include "xf86str.h" -#include "dri.h" -#include "sarea.h" -#include "dristruct.h" -#include "xf86.h" -#include "xf86drm.h" -#include "glxserver.h" -#include "mi.h" -#include "mipointer.h" - -#if defined(XFree86LOADER) && !defined(PANORAMIX) -extern Bool noPanoramiXExtension; -#endif - -static int DRIScreenPrivIndex = -1; -static int DRIWindowPrivIndex = -1; -static unsigned long DRIGeneration = 0; -static unsigned int DRIDrawableValidationStamp = 0; - -static RESTYPE DRIDrawablePrivResType; -static RESTYPE DRIContextPrivResType; -static void DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv); - - /* Wrapper just like xf86DrvMsg, but - without the verbosity level checking. - This will make it easy to turn off some - messages later, based on verbosity - level. */ - -/* - * Since we're already referencing things from the XFree86 common layer in - * this file, we'd might as well just call xf86VDrvMsgVerb, and have - * consistent message formatting. The verbosity of these messages can be - * easily changed here. - */ -#define DRI_MSG_VERBOSITY 1 -static void -DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - xf86VDrvMsgVerb(scrnIndex, type, DRI_MSG_VERBOSITY, format, ap); - va_end(ap); -} - -Bool -DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) -{ - DRIScreenPrivPtr pDRIPriv; - drm_context_t * reserved; - int reserved_count; - int i, fd, drmWasAvailable; - Bool xineramaInCore = FALSE; - int err = 0; - char *openbusid; - drmVersionPtr drmlibv; - int drmlibmajor, drmlibminor, drmdimajor, drmdiminor; - - if (DRIGeneration != serverGeneration) { - if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - DRIGeneration = serverGeneration; - } - - /* If the DRI extension is disabled, do not initialize the DRI */ - if (noXFree86DRIExtension) { - DRIDrvMsg(pScreen->myNum, X_WARNING, - "Direct rendering has been disabled.\n"); - return FALSE; - } - - /* - * If Xinerama is on, don't allow DRI to initialise. It won't be usable - * anyway. - */ -#if defined(PANORAMIX) && !defined(XFree86LOADER) - xineramaInCore = TRUE; -#elif defined(XFree86LOADER) - if (xf86LoaderCheckSymbol("noPanoramiXExtension")) - xineramaInCore = TRUE; -#endif - -#if defined(PANORAMIX) || defined(XFree86LOADER) - if (xineramaInCore) { - if (!noPanoramiXExtension) { - DRIDrvMsg(pScreen->myNum, X_WARNING, - "Direct rendering is not supported when Xinerama is enabled\n"); - return FALSE; - } - } -#endif - - drmWasAvailable = drmAvailable(); - - /* Check the DRM lib version. - * drmGetLibVersion was not supported in version 1.0, so check for - * symbol first to avoid possible crash or hang. - */ - drmlibmajor = 1; - drmlibminor = 0; - if (xf86LoaderCheckSymbol("drmGetLibVersion")) { - drmlibv = drmGetLibVersion(-1); - if (drmlibv != NULL) { - drmlibmajor = drmlibv->version_major; - drmlibminor = drmlibv->version_minor; - drmFreeVersion(drmlibv); - } - } - - /* Check if the libdrm can handle falling back to loading based on name - * if a busid string is passed. - */ - if (drmlibmajor == 1 && drmlibminor >= 2) - openbusid = pDRIInfo->busIdString; - else - openbusid = NULL; - - /* Note that drmOpen will try to load the kernel module, if needed. */ - fd = drmOpen(pDRIInfo->drmDriverName, openbusid); - if (fd < 0) { - /* failed to open DRM */ - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] drmOpen failed\n"); - return FALSE; - } - - if (!drmWasAvailable) { - /* drmOpen loaded the kernel module, print a message to say so */ - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] loaded kernel module for \"%s\" driver\n", - pDRIInfo->drmDriverName); - } - - pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec)); - if (!pDRIPriv) { - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; - return FALSE; - } - - pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv; - pDRIPriv->drmFD = fd; - pDRIPriv->directRenderingSupport = TRUE; - pDRIPriv->pDriverInfo = pDRIInfo; - pDRIPriv->nrWindows = 0; - pDRIPriv->fullscreen = NULL; - - pDRIPriv->createDummyCtx = pDRIInfo->createDummyCtx; - pDRIPriv->createDummyCtxPriv = pDRIInfo->createDummyCtxPriv; - - pDRIPriv->grabbedDRILock = FALSE; - pDRIPriv->drmSIGIOHandlerInstalled = FALSE; - - if (drmlibmajor == 1 && drmlibminor >= 2) { - drmSetVersion sv; - - /* Get the interface version, asking for 1.1. */ - sv.drm_di_major = 1; - sv.drm_di_minor = 1; - sv.drm_dd_major = -1; - err = drmSetInterfaceVersion(pDRIPriv->drmFD, &sv); - if (err == 0) { - drmdimajor = sv.drm_di_major; - drmdiminor = sv.drm_di_minor; - } else { - /* failure, so set it to 1.0.0. */ - drmdimajor = 1; - drmdiminor = 0; - } - } - else { - /* We can't check the DI DRM interface version, so set it to 1.0.0. */ - drmdimajor = 1; - drmdiminor = 0; - } - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] DRM interface version %d.%d\n", drmdimajor, drmdiminor); - - /* If the interface minor number is 1.1, then we've opened a DRM device - * that already had the busid set through drmOpen. - */ - if (drmdimajor == 1 && drmdiminor >= 1) - err = 0; - else - err = drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString); - - if (err < 0) { - pDRIPriv->directRenderingSupport = FALSE; - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; - drmClose(pDRIPriv->drmFD); - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] drmSetBusid failed (%d, %s), %s\n", - pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString, strerror(-err)); - return FALSE; - } - - *pDRMFD = pDRIPriv->drmFD; - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] created \"%s\" driver at busid \"%s\"\n", - pDRIPriv->pDriverInfo->drmDriverName, - pDRIPriv->pDriverInfo->busIdString); - - if (drmAddMap( pDRIPriv->drmFD, - 0, - pDRIPriv->pDriverInfo->SAREASize, - DRM_SHM, - DRM_CONTAINS_LOCK, - &pDRIPriv->hSAREA) < 0) - { - pDRIPriv->directRenderingSupport = FALSE; - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; - drmClose(pDRIPriv->drmFD); - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] drmAddMap failed\n"); - return FALSE; - } - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] added %d byte SAREA at %p\n", - pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA); - - if (drmMap( pDRIPriv->drmFD, - pDRIPriv->hSAREA, - pDRIPriv->pDriverInfo->SAREASize, - (drmAddressPtr)(&pDRIPriv->pSAREA)) < 0) - { - pDRIPriv->directRenderingSupport = FALSE; - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; - drmClose(pDRIPriv->drmFD); - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] drmMap failed\n"); - return FALSE; - } - memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize); - DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n", - pDRIPriv->hSAREA, pDRIPriv->pSAREA); - - if (drmAddMap( pDRIPriv->drmFD, - (drm_handle_t)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress, - pDRIPriv->pDriverInfo->frameBufferSize, - DRM_FRAME_BUFFER, - 0, - &pDRIPriv->hFrameBuffer) < 0) - { - pDRIPriv->directRenderingSupport = FALSE; - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; - drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize); - drmClose(pDRIPriv->drmFD); - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] drmAddMap failed\n"); - return FALSE; - } - DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n", - pDRIPriv->hFrameBuffer); - - /* Add tags for reserved contexts */ - if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD, - &reserved_count))) { - int i; - void *tag; - - for (i = 0; i < reserved_count; i++) { - tag = DRICreateContextPrivFromHandle(pScreen, - reserved[i], - DRI_CONTEXT_RESERVED); - drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag); - } - drmFreeReservedContextList(reserved); - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] added %d reserved context%s for kernel\n", - reserved_count, reserved_count > 1 ? "s" : ""); - } - - /* validate max drawable table entry set by driver */ - if ((pDRIPriv->pDriverInfo->maxDrawableTableEntry <= 0) || - (pDRIPriv->pDriverInfo->maxDrawableTableEntry > SAREA_MAX_DRAWABLES)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, - "Invalid max drawable table size set by driver: %d\n", - pDRIPriv->pDriverInfo->maxDrawableTableEntry); - } - - /* Initialize drawable tables (screen private and SAREA) */ - for( i=0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) { - pDRIPriv->DRIDrawables[i] = NULL; - pDRIPriv->pSAREA->drawableTable[i].stamp = 0; - pDRIPriv->pSAREA->drawableTable[i].flags = 0; - } - - return TRUE; -} - -Bool -DRIFinishScreenInit(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - DRIContextFlags flags = 0; - DRIContextPrivPtr pDRIContextPriv; - - /* Set up flags for DRICreateContextPriv */ - switch (pDRIInfo->driverSwapMethod) { - case DRI_KERNEL_SWAP: flags = DRI_CONTEXT_2DONLY; break; - case DRI_HIDE_X_CONTEXT: flags = DRI_CONTEXT_PRESERVED; break; - } - - if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, - &pDRIPriv->myContext, - flags))) { - DRIDrvMsg(pScreen->myNum, X_ERROR, - "failed to create server context\n"); - return FALSE; - } - pDRIPriv->myContextPriv = pDRIContextPriv; - - DRIDrvMsg(pScreen->myNum, X_INFO, - "X context handle = %p\n", pDRIPriv->myContext); - - /* Now that we have created the X server's context, we can grab the - * hardware lock for the X server. - */ - DRILock(pScreen, 0); - pDRIPriv->grabbedDRILock = TRUE; - - /* pointers so that we can prevent memory leaks later */ - pDRIPriv->hiddenContextStore = NULL; - pDRIPriv->partial3DContextStore = NULL; - - switch(pDRIInfo->driverSwapMethod) { - case DRI_HIDE_X_CONTEXT: - /* Server will handle 3D swaps, and hide 2D swaps from kernel. - * Register server context as a preserved context. - */ - - /* allocate memory for hidden context store */ - pDRIPriv->hiddenContextStore - = (void *)xcalloc(1, pDRIInfo->contextSize); - if (!pDRIPriv->hiddenContextStore) { - DRIDrvMsg(pScreen->myNum, X_ERROR, - "failed to allocate hidden context\n"); - DRIDestroyContextPriv(pDRIContextPriv); - return FALSE; - } - - /* allocate memory for partial 3D context store */ - pDRIPriv->partial3DContextStore - = (void *)xcalloc(1, pDRIInfo->contextSize); - if (!pDRIPriv->partial3DContextStore) { - DRIDrvMsg(pScreen->myNum, X_ERROR, - "[DRI] failed to allocate partial 3D context\n"); - xfree(pDRIPriv->hiddenContextStore); - DRIDestroyContextPriv(pDRIContextPriv); - return FALSE; - } - - /* save initial context store */ - if (pDRIInfo->SwapContext) { - (*pDRIInfo->SwapContext)( - pScreen, - DRI_NO_SYNC, - DRI_2D_CONTEXT, - pDRIPriv->hiddenContextStore, - DRI_NO_CONTEXT, - NULL); - } - /* fall through */ - - case DRI_SERVER_SWAP: - /* For swap methods of DRI_SERVER_SWAP and DRI_HIDE_X_CONTEXT - * setup signal handler for receiving swap requests from kernel - */ - if (!(pDRIPriv->drmSIGIOHandlerInstalled = - drmInstallSIGIOHandler(pDRIPriv->drmFD, DRISwapContext))) { - DRIDrvMsg(pScreen->myNum, X_ERROR, - "[drm] failed to setup DRM signal handler\n"); - if (pDRIPriv->hiddenContextStore) - xfree(pDRIPriv->hiddenContextStore); - if (pDRIPriv->partial3DContextStore) - xfree(pDRIPriv->partial3DContextStore); - DRIDestroyContextPriv(pDRIContextPriv); - return FALSE; - } else { - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] installed DRM signal handler\n"); - } - - default: - break; - } - - /* Wrap DRI support */ - if (pDRIInfo->wrap.ValidateTree) { - pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree; - pScreen->ValidateTree = pDRIInfo->wrap.ValidateTree; - } - if (pDRIInfo->wrap.PostValidateTree) { - pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree; - pScreen->PostValidateTree = pDRIInfo->wrap.PostValidateTree; - } - if (pDRIInfo->wrap.WindowExposures) { - pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures; - pScreen->WindowExposures = pDRIInfo->wrap.WindowExposures; - } - if (pDRIInfo->wrap.CopyWindow) { - pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow; - pScreen->CopyWindow = pDRIInfo->wrap.CopyWindow; - } - if (pDRIInfo->wrap.ClipNotify) { - pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify; - pScreen->ClipNotify = pDRIInfo->wrap.ClipNotify; - } - if (pDRIInfo->wrap.AdjustFrame) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame; - pScrn->AdjustFrame = pDRIInfo->wrap.AdjustFrame; - } - pDRIPriv->wrapped = TRUE; - - DRIDrvMsg(pScreen->myNum, X_INFO, "[DRI] installation complete\n"); - - return TRUE; -} - -void -DRICloseScreen(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIInfoPtr pDRIInfo; - drm_context_t * reserved; - int reserved_count; - - if (pDRIPriv && pDRIPriv->directRenderingSupport) { - - pDRIInfo = pDRIPriv->pDriverInfo; - - if (pDRIPriv->wrapped) { - /* Unwrap DRI Functions */ - if (pDRIInfo->wrap.ValidateTree) { - pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree; - pDRIPriv->wrap.ValidateTree = NULL; - } - if (pDRIInfo->wrap.PostValidateTree) { - pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree; - pDRIPriv->wrap.PostValidateTree = NULL; - } - if (pDRIInfo->wrap.WindowExposures) { - pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures; - pDRIPriv->wrap.WindowExposures = NULL; - } - if (pDRIInfo->wrap.CopyWindow) { - pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow; - pDRIPriv->wrap.CopyWindow = NULL; - } - if (pDRIInfo->wrap.ClipNotify) { - pScreen->ClipNotify = pDRIPriv->wrap.ClipNotify; - pDRIPriv->wrap.ClipNotify = NULL; - } - if (pDRIInfo->wrap.AdjustFrame) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; - pDRIPriv->wrap.AdjustFrame = NULL; - } - pDRIPriv->wrapped = FALSE; - } - - if (pDRIPriv->drmSIGIOHandlerInstalled) { - if (!drmRemoveSIGIOHandler(pDRIPriv->drmFD)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, - "[drm] failed to remove DRM signal handler\n"); - } - } - - if (pDRIPriv->dummyCtxPriv && pDRIPriv->createDummyCtx) { - DRIDestroyDummyContext(pScreen, pDRIPriv->createDummyCtxPriv); - } - - if (!DRIDestroyContextPriv(pDRIPriv->myContextPriv)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, - "failed to destroy server context\n"); - } - - /* Remove tags for reserved contexts */ - if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD, - &reserved_count))) { - int i; - - for (i = 0; i < reserved_count; i++) { - DRIDestroyContextPriv(drmGetContextTag(pDRIPriv->drmFD, - reserved[i])); - } - drmFreeReservedContextList(reserved); - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] removed %d reserved context%s for kernel\n", - reserved_count, reserved_count > 1 ? "s" : ""); - } - - /* Make sure signals get unblocked etc. */ - drmUnlock(pDRIPriv->drmFD, pDRIPriv->myContext); - pDRIPriv->lockRefCount = 0; - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] unmapping %d bytes of SAREA %p at %p\n", - pDRIInfo->SAREASize, - pDRIPriv->hSAREA, - pDRIPriv->pSAREA); - if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, - "[drm] unable to unmap %d bytes" - " of SAREA %p at %p\n", - pDRIInfo->SAREASize, - pDRIPriv->hSAREA, - pDRIPriv->pSAREA); - } - - drmClose(pDRIPriv->drmFD); - - xfree(pDRIPriv); - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; - } -} - -Bool -DRIExtensionInit(void) -{ - int i; - ScreenPtr pScreen; - - if (DRIScreenPrivIndex < 0) { - return FALSE; - } - - /* Allocate a window private index with a zero sized private area for - * each window, then should a window become a DRI window, we'll hang - * a DRIWindowPrivateRec off of this private index. - */ - if ((DRIWindowPrivIndex = AllocateWindowPrivateIndex()) < 0) - return FALSE; - - DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete); - DRIContextPrivResType = CreateNewResourceType(DRIContextPrivDelete); - - for (i = 0; i < screenInfo.numScreens; i++) - { - pScreen = screenInfo.screens[i]; - if (!AllocateWindowPrivate(pScreen, DRIWindowPrivIndex, 0)) - return FALSE; - } - - RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL); - - return TRUE; -} - -void -DRIReset(void) -{ - /* - * This stub routine is called when the X Server recycles, resources - * allocated by DRIExtensionInit need to be managed here. - * - * Currently this routine is a stub because all the interesting resources - * are managed via the screen init process. - */ -} - -Bool -DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool* isCapable) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - if (pDRIPriv) - *isCapable = pDRIPriv->directRenderingSupport; - else - *isCapable = FALSE; - - return TRUE; -} - -Bool -DRIOpenConnection(ScreenPtr pScreen, drm_handle_t * hSAREA, char **busIdString) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - *hSAREA = pDRIPriv->hSAREA; - *busIdString = pDRIPriv->pDriverInfo->busIdString; - - return TRUE; -} - -Bool -DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - if (drmAuthMagic(pDRIPriv->drmFD, magic)) return FALSE; - return TRUE; -} - -Bool -DRICloseConnection(ScreenPtr pScreen) -{ - return TRUE; -} - -Bool -DRIGetClientDriverName(ScreenPtr pScreen, - int *ddxDriverMajorVersion, - int *ddxDriverMinorVersion, - int *ddxDriverPatchVersion, - char **clientDriverName) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - *ddxDriverMajorVersion = pDRIPriv->pDriverInfo->ddxDriverMajorVersion; - *ddxDriverMinorVersion = pDRIPriv->pDriverInfo->ddxDriverMinorVersion; - *ddxDriverPatchVersion = pDRIPriv->pDriverInfo->ddxDriverPatchVersion; - *clientDriverName = pDRIPriv->pDriverInfo->clientDriverName; - - return TRUE; -} - -/* DRICreateContextPriv and DRICreateContextPrivFromHandle are helper - functions that layer on drmCreateContext and drmAddContextTag. - - DRICreateContextPriv always creates a kernel drm_context_t and then calls - DRICreateContextPrivFromHandle to create a DRIContextPriv structure for - DRI tracking. For the SIGIO handler, the drm_context_t is associated with - DRIContextPrivPtr. Any special flags are stored in the DRIContextPriv - area and are passed to the kernel (if necessary). - - DRICreateContextPriv returns a pointer to newly allocated - DRIContextPriv, and returns the kernel drm_context_t in pHWContext. */ - -DRIContextPrivPtr -DRICreateContextPriv(ScreenPtr pScreen, - drm_context_t * pHWContext, - DRIContextFlags flags) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - if (drmCreateContext(pDRIPriv->drmFD, pHWContext)) { - return NULL; - } - - return DRICreateContextPrivFromHandle(pScreen, *pHWContext, flags); -} - -DRIContextPrivPtr -DRICreateContextPrivFromHandle(ScreenPtr pScreen, - drm_context_t hHWContext, - DRIContextFlags flags) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIContextPrivPtr pDRIContextPriv; - int contextPrivSize; - - contextPrivSize = sizeof(DRIContextPrivRec) + - pDRIPriv->pDriverInfo->contextSize; - if (!(pDRIContextPriv = xcalloc(1, contextPrivSize))) { - return NULL; - } - pDRIContextPriv->pContextStore = (void *)(pDRIContextPriv + 1); - - drmAddContextTag(pDRIPriv->drmFD, hHWContext, pDRIContextPriv); - - pDRIContextPriv->hwContext = hHWContext; - pDRIContextPriv->pScreen = pScreen; - pDRIContextPriv->flags = flags; - pDRIContextPriv->valid3D = FALSE; - - if (flags & DRI_CONTEXT_2DONLY) { - if (drmSetContextFlags(pDRIPriv->drmFD, - hHWContext, - DRM_CONTEXT_2DONLY)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, - "[drm] failed to set 2D context flag\n"); - DRIDestroyContextPriv(pDRIContextPriv); - return NULL; - } - } - if (flags & DRI_CONTEXT_PRESERVED) { - if (drmSetContextFlags(pDRIPriv->drmFD, - hHWContext, - DRM_CONTEXT_PRESERVED)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, - "[drm] failed to set preserved flag\n"); - DRIDestroyContextPriv(pDRIContextPriv); - return NULL; - } - } - return pDRIContextPriv; -} - -Bool -DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv) -{ - DRIScreenPrivPtr pDRIPriv; - - if (!pDRIContextPriv) return TRUE; - - pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen); - - if (!(pDRIContextPriv->flags & DRI_CONTEXT_RESERVED)) { - /* Don't delete reserved contexts from - kernel area -- the kernel manages its - reserved contexts itself. */ - if (drmDestroyContext(pDRIPriv->drmFD, pDRIContextPriv->hwContext)) - return FALSE; - } - - /* Remove the tag last to prevent a race - condition where the context has pending - buffers. The context can't be re-used - while in this thread, but buffers can be - dispatched asynchronously. */ - drmDelContextTag(pDRIPriv->drmFD, pDRIContextPriv->hwContext); - xfree(pDRIContextPriv); - return TRUE; -} - -static Bool -DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - __GLXscreenInfo *pGLXScreen = __glXgetActiveScreen(pScreen->myNum); - __GLcontextModes *modes = pGLXScreen->modes; - void **pVisualConfigPriv = pGLXScreen->pVisualPriv; - DRIContextPrivPtr pDRIContextPriv; - void *contextStore; - VisualPtr visual; - int visNum; - - visual = pScreen->visuals; - - /* Find the X visual that corresponds the the first GLX visual */ - for (visNum = 0; - visNum < pScreen->numVisuals; - visNum++, visual++) { - if (modes->visualID == visual->vid) - break; - } - if (visNum == pScreen->numVisuals) return FALSE; - - if (!(pDRIContextPriv = - DRICreateContextPriv(pScreen, - &pDRIPriv->pSAREA->dummy_context, 0))) { - return FALSE; - } - - contextStore = DRIGetContextStore(pDRIContextPriv); - if (pDRIPriv->pDriverInfo->CreateContext && needCtxPriv) { - if (!pDRIPriv->pDriverInfo->CreateContext(pScreen, visual, - pDRIPriv->pSAREA->dummy_context, - *pVisualConfigPriv, - (DRIContextType)(long)contextStore)) { - DRIDestroyContextPriv(pDRIContextPriv); - return FALSE; - } - } - - pDRIPriv->dummyCtxPriv = pDRIContextPriv; - return TRUE; -} - -static void -DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIContextPrivPtr pDRIContextPriv = pDRIPriv->dummyCtxPriv; - void *contextStore; - - if (!pDRIContextPriv) return; - if (pDRIPriv->pDriverInfo->DestroyContext && hasCtxPriv) { - contextStore = DRIGetContextStore(pDRIContextPriv); - pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen, - pDRIContextPriv->hwContext, - (DRIContextType)(long)contextStore); - } - - DRIDestroyContextPriv(pDRIPriv->dummyCtxPriv); - pDRIPriv->dummyCtxPriv = NULL; -} - -Bool -DRICreateContext(ScreenPtr pScreen, VisualPtr visual, - XID context, drm_context_t * pHWContext) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - __GLXscreenInfo *pGLXScreen = __glXgetActiveScreen(pScreen->myNum); - __GLcontextModes *modes = pGLXScreen->modes; - void **pVisualConfigPriv = pGLXScreen->pVisualPriv; - DRIContextPrivPtr pDRIContextPriv; - void *contextStore; - - if (pDRIPriv->createDummyCtx && !pDRIPriv->dummyCtxPriv) { - if (!DRICreateDummyContext(pScreen, pDRIPriv->createDummyCtxPriv)) { - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] Could not create dummy context\n"); - return FALSE; - } - } - - /* Find the GLX visual associated with the one requested */ - for (modes = pGLXScreen->modes; modes != NULL; modes = modes->next) { - if (modes->visualID == visual->vid) - break; - pVisualConfigPriv++; - } - - if (modes == NULL) { - /* No matching GLX visual found */ - return FALSE; - } - - if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, pHWContext, 0))) { - return FALSE; - } - - contextStore = DRIGetContextStore(pDRIContextPriv); - if (pDRIPriv->pDriverInfo->CreateContext) { - if (!((*pDRIPriv->pDriverInfo->CreateContext)(pScreen, visual, - *pHWContext, *pVisualConfigPriv, - (DRIContextType)(long)contextStore))) { - DRIDestroyContextPriv(pDRIContextPriv); - return FALSE; - } - } - - /* track this in case the client dies before cleanup */ - AddResource(context, DRIContextPrivResType, (pointer)pDRIContextPriv); - - return TRUE; -} - -Bool -DRIDestroyContext(ScreenPtr pScreen, XID context) -{ - FreeResourceByType(context, DRIContextPrivResType, FALSE); - - return TRUE; -} - -/* DRIContextPrivDelete is called by the resource manager. */ -Bool -DRIContextPrivDelete(pointer pResource, XID id) -{ - DRIContextPrivPtr pDRIContextPriv = (DRIContextPrivPtr)pResource; - DRIScreenPrivPtr pDRIPriv; - void *contextStore; - - pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen); - if (pDRIPriv->pDriverInfo->DestroyContext) { - contextStore = DRIGetContextStore(pDRIContextPriv); - pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen, - pDRIContextPriv->hwContext, - (DRIContextType)(long)contextStore); - } - return DRIDestroyContextPriv(pDRIContextPriv); -} - - -/* This walks the drawable timestamp array and invalidates all of them - * in the case of transition from private to shared backbuffers. It's - * not necessary for correctness, because DRIClipNotify gets called in - * time to prevent any conflict, but the transition from - * shared->private is sometimes missed if we don't do this. - */ -static void -DRIClipNotifyAllDrawables(ScreenPtr pScreen) -{ - int i; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - for( i=0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) { - pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; - } -} - - -static void -DRITransitionToSharedBuffers(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - - DRIClipNotifyAllDrawables( pScreen ); - - if (pDRIInfo->TransitionSingleToMulti3D) - pDRIInfo->TransitionSingleToMulti3D( pScreen ); -} - - -static void -DRITransitionToPrivateBuffers(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - - DRIClipNotifyAllDrawables( pScreen ); - - if (pDRIInfo->TransitionMultiToSingle3D) - pDRIInfo->TransitionMultiToSingle3D( pScreen ); -} - - -static void -DRITransitionTo3d(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - - DRIClipNotifyAllDrawables( pScreen ); - - if (pDRIInfo->TransitionTo3d) - pDRIInfo->TransitionTo3d( pScreen ); -} - -static void -DRITransitionTo2d(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - - DRIClipNotifyAllDrawables( pScreen ); - - if (pDRIInfo->TransitionTo2d) - pDRIInfo->TransitionTo2d( pScreen ); -} - - -Bool -DRICreateDrawable(ScreenPtr pScreen, Drawable id, - DrawablePtr pDrawable, drm_drawable_t * hHWDrawable) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIDrawablePrivPtr pDRIDrawablePriv; - WindowPtr pWin; - - if (pDrawable->type == DRAWABLE_WINDOW) { - pWin = (WindowPtr)pDrawable; - if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) { - pDRIDrawablePriv->refCount++; - } - else { - /* allocate a DRI Window Private record */ - if (!(pDRIDrawablePriv = xalloc(sizeof(DRIDrawablePrivRec)))) { - return FALSE; - } - - /* Only create a drm_drawable_t once */ - if (drmCreateDrawable(pDRIPriv->drmFD, hHWDrawable)) { - xfree(pDRIDrawablePriv); - return FALSE; - } - - /* add it to the list of DRI drawables for this screen */ - pDRIDrawablePriv->hwDrawable = *hHWDrawable; - pDRIDrawablePriv->pScreen = pScreen; - pDRIDrawablePriv->refCount = 1; - pDRIDrawablePriv->drawableIndex = -1; - - /* save private off of preallocated index */ - pWin->devPrivates[DRIWindowPrivIndex].ptr = - (pointer)pDRIDrawablePriv; - - switch (++pDRIPriv->nrWindows) { - case 1: - DRITransitionTo3d( pScreen ); - break; - case 2: - DRITransitionToSharedBuffers( pScreen ); - break; - default: - break; - } - - /* track this in case this window is destroyed */ - AddResource(id, DRIDrawablePrivResType, (pointer)pWin); - } - } - else { /* pixmap (or for GLX 1.3, a PBuffer) */ - /* NOT_DONE */ - return FALSE; - } - - return TRUE; -} - -Bool -DRIDestroyDrawable(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable) -{ - DRIDrawablePrivPtr pDRIDrawablePriv; - WindowPtr pWin; - - - if (pDrawable->type == DRAWABLE_WINDOW) { - pWin = (WindowPtr)pDrawable; - pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); - pDRIDrawablePriv->refCount--; - if (pDRIDrawablePriv->refCount <= 0) { - /* This calls back DRIDrawablePrivDelete which frees private area */ - FreeResourceByType(id, DRIDrawablePrivResType, FALSE); - } - } - else { /* pixmap (or for GLX 1.3, a PBuffer) */ - /* NOT_DONE */ - return FALSE; - } - - return TRUE; -} - -Bool -DRIDrawablePrivDelete(pointer pResource, XID id) -{ - DrawablePtr pDrawable = (DrawablePtr)pResource; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen); - DRIDrawablePrivPtr pDRIDrawablePriv; - WindowPtr pWin; - - if (pDrawable->type == DRAWABLE_WINDOW) { - pWin = (WindowPtr)pDrawable; - pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); - - if (pDRIDrawablePriv->drawableIndex != -1) { - /* bump stamp to force outstanding 3D requests to resync */ - pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp - = DRIDrawableValidationStamp++; - - /* release drawable table entry */ - pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL; - } - - if (drmDestroyDrawable(pDRIPriv->drmFD, - pDRIDrawablePriv->hwDrawable)) { - return FALSE; - } - xfree(pDRIDrawablePriv); - pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL; - - switch (--pDRIPriv->nrWindows) { - case 0: - DRITransitionTo2d( pDrawable->pScreen ); - break; - case 1: - DRITransitionToPrivateBuffers( pDrawable->pScreen ); - break; - default: - break; - } - } - else { /* pixmap (or for GLX 1.3, a PBuffer) */ - /* NOT_DONE */ - return FALSE; - } - - return TRUE; -} - -Bool -DRIGetDrawableInfo(ScreenPtr pScreen, - DrawablePtr pDrawable, - unsigned int* index, - unsigned int* stamp, - int* X, - int* Y, - int* W, - int* H, - int* numClipRects, - drm_clip_rect_t ** pClipRects, - int* backX, - int* backY, - int* numBackClipRects, - drm_clip_rect_t ** pBackClipRects) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIDrawablePrivPtr pDRIDrawablePriv, pOldDrawPriv; - WindowPtr pWin, pOldWin; - int i; - - printf("maxDrawableTableEntry = %d\n", pDRIPriv->pDriverInfo->maxDrawableTableEntry); - - if (pDrawable->type == DRAWABLE_WINDOW) { - pWin = (WindowPtr)pDrawable; - if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) { - - /* Manage drawable table */ - if (pDRIDrawablePriv->drawableIndex == -1) { /* load SAREA table */ - - /* Search table for empty entry */ - i = 0; - while (i < pDRIPriv->pDriverInfo->maxDrawableTableEntry) { - if (!(pDRIPriv->DRIDrawables[i])) { - pDRIPriv->DRIDrawables[i] = pDrawable; - pDRIDrawablePriv->drawableIndex = i; - pDRIPriv->pSAREA->drawableTable[i].stamp = - DRIDrawableValidationStamp++; - break; - } - i++; - } - - /* Search table for oldest entry */ - if (i == pDRIPriv->pDriverInfo->maxDrawableTableEntry) { - unsigned int oldestStamp = ~0; - int oldestIndex = 0; - i = pDRIPriv->pDriverInfo->maxDrawableTableEntry; - while (i--) { - if (pDRIPriv->pSAREA->drawableTable[i].stamp < - oldestStamp) { - oldestIndex = i; - oldestStamp = - pDRIPriv->pSAREA->drawableTable[i].stamp; - } - } - pDRIDrawablePriv->drawableIndex = oldestIndex; - - /* release oldest drawable table entry */ - pOldWin = (WindowPtr)pDRIPriv->DRIDrawables[oldestIndex]; - pOldDrawPriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pOldWin); - pOldDrawPriv->drawableIndex = -1; - - /* claim drawable table entry */ - pDRIPriv->DRIDrawables[oldestIndex] = pDrawable; - - /* validate SAREA entry */ - pDRIPriv->pSAREA->drawableTable[oldestIndex].stamp = - DRIDrawableValidationStamp++; - - /* check for stamp wrap around */ - if (oldestStamp > DRIDrawableValidationStamp) { - - /* walk SAREA table and invalidate all drawables */ - for( i=0; - i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; - i++) { - pDRIPriv->pSAREA->drawableTable[i].stamp = - DRIDrawableValidationStamp++; - } - } - } - - /* If the driver wants to be notified when the index is - * set for a drawable, let it know now. - */ - if (pDRIPriv->pDriverInfo->SetDrawableIndex) - pDRIPriv->pDriverInfo->SetDrawableIndex(pWin, - pDRIDrawablePriv->drawableIndex); - - /* reinit drawable ID if window is visible */ - if ((pWin->viewable) && - (pDRIPriv->pDriverInfo->bufferRequests != DRI_NO_WINDOWS)) - { - (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, - &pWin->clipList, pDRIDrawablePriv->drawableIndex); - } - } - - *index = pDRIDrawablePriv->drawableIndex; - *stamp = pDRIPriv->pSAREA->drawableTable[*index].stamp; - *X = (int)(pWin->drawable.x); - *Y = (int)(pWin->drawable.y); -#if 0 - *W = (int)(pWin->winSize.extents.x2 - pWin->winSize.extents.x1); - *H = (int)(pWin->winSize.extents.y2 - pWin->winSize.extents.y1); -#endif - *W = (int)(pWin->drawable.width); - *H = (int)(pWin->drawable.height); - *numClipRects = REGION_NUM_RECTS(&pWin->clipList); - *pClipRects = (drm_clip_rect_t *)REGION_RECTS(&pWin->clipList); - - if (!*numClipRects && pDRIPriv->fullscreen) { - /* use fake full-screen clip rect */ - pDRIPriv->fullscreen_rect.x1 = *X; - pDRIPriv->fullscreen_rect.y1 = *Y; - pDRIPriv->fullscreen_rect.x2 = *X + *W; - pDRIPriv->fullscreen_rect.y2 = *Y + *H; - - *numClipRects = 1; - *pClipRects = &pDRIPriv->fullscreen_rect; - } - - *backX = *X; - *backY = *Y; - - if (pDRIPriv->nrWindows == 1 && *numClipRects) { - /* Use a single cliprect. */ - - int x0 = *X; - int y0 = *Y; - int x1 = x0 + *W; - int y1 = y0 + *H; - - if (x0 < 0) x0 = 0; - if (y0 < 0) y0 = 0; - if (x1 > pScreen->width) x1 = pScreen->width; - if (y1 > pScreen->height) y1 = pScreen->height; - - pDRIPriv->private_buffer_rect.x1 = x0; - pDRIPriv->private_buffer_rect.y1 = y0; - pDRIPriv->private_buffer_rect.x2 = x1; - pDRIPriv->private_buffer_rect.y2 = y1; - - *numBackClipRects = 1; - *pBackClipRects = &(pDRIPriv->private_buffer_rect); - } else { - /* Use the frontbuffer cliprects for back buffers. */ - *numBackClipRects = 0; - *pBackClipRects = 0; - } - } - else { - /* Not a DRIDrawable */ - return FALSE; - } - } - else { /* pixmap (or for GLX 1.3, a PBuffer) */ - /* NOT_DONE */ - return FALSE; - } - - return TRUE; -} - -Bool -DRIGetDeviceInfo(ScreenPtr pScreen, - drm_handle_t * hFrameBuffer, - int* fbOrigin, - int* fbSize, - int* fbStride, - int* devPrivateSize, - void** pDevPrivate) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - *hFrameBuffer = pDRIPriv->hFrameBuffer; - *fbOrigin = 0; - *fbSize = pDRIPriv->pDriverInfo->frameBufferSize; - *fbStride = pDRIPriv->pDriverInfo->frameBufferStride; - *devPrivateSize = pDRIPriv->pDriverInfo->devPrivateSize; - *pDevPrivate = pDRIPriv->pDriverInfo->devPrivate; - - return TRUE; -} - -DRIInfoPtr -DRICreateInfoRec(void) -{ - DRIInfoPtr inforec = (DRIInfoPtr)xcalloc(1, sizeof(DRIInfoRec)); - if (!inforec) return NULL; - - /* Initialize defaults */ - inforec->busIdString = NULL; - - /* Wrapped function defaults */ - inforec->wrap.WakeupHandler = DRIDoWakeupHandler; - inforec->wrap.BlockHandler = DRIDoBlockHandler; - inforec->wrap.WindowExposures = DRIWindowExposures; - inforec->wrap.CopyWindow = DRICopyWindow; - inforec->wrap.ValidateTree = DRIValidateTree; - inforec->wrap.PostValidateTree = DRIPostValidateTree; - inforec->wrap.ClipNotify = DRIClipNotify; - inforec->wrap.AdjustFrame = DRIAdjustFrame; - - inforec->TransitionTo2d = 0; - inforec->TransitionTo3d = 0; - inforec->SetDrawableIndex = 0; - - return inforec; -} - -void -DRIDestroyInfoRec(DRIInfoPtr DRIInfo) -{ - if (DRIInfo->busIdString) xfree(DRIInfo->busIdString); - xfree((char*)DRIInfo); -} - - -void -DRIWakeupHandler(pointer wakeupData, int result, pointer pReadmask) -{ - int i; - - for (i = 0; i < screenInfo.numScreens; i++) { - ScreenPtr pScreen = screenInfo.screens[i]; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - if (pDRIPriv && - pDRIPriv->pDriverInfo->wrap.WakeupHandler) - (*pDRIPriv->pDriverInfo->wrap.WakeupHandler)(i, wakeupData, - result, pReadmask); - } -} - -void -DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) -{ - int i; - - for (i = 0; i < screenInfo.numScreens; i++) { - ScreenPtr pScreen = screenInfo.screens[i]; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - if (pDRIPriv && - pDRIPriv->pDriverInfo->wrap.BlockHandler) - (*pDRIPriv->pDriverInfo->wrap.BlockHandler)(i, blockData, - pTimeout, pReadmask); - } -} - -void -DRIDoWakeupHandler(int screenNum, pointer wakeupData, - unsigned long result, pointer pReadmask) -{ - ScreenPtr pScreen = screenInfo.screens[screenNum]; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - DRILock(pScreen, 0); - if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { - /* hide X context by swapping 2D component here */ - (*pDRIPriv->pDriverInfo->SwapContext)(pScreen, - DRI_3D_SYNC, - DRI_2D_CONTEXT, - pDRIPriv->partial3DContextStore, - DRI_2D_CONTEXT, - pDRIPriv->hiddenContextStore); - } -} - -void -DRIDoBlockHandler(int screenNum, pointer blockData, - pointer pTimeout, pointer pReadmask) -{ - ScreenPtr pScreen = screenInfo.screens[screenNum]; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { - /* hide X context by swapping 2D component here */ - (*pDRIPriv->pDriverInfo->SwapContext)(pScreen, - DRI_2D_SYNC, - DRI_NO_CONTEXT, - NULL, - DRI_2D_CONTEXT, - pDRIPriv->partial3DContextStore); - } - DRIUnlock(pScreen); -} - -void -DRISwapContext(int drmFD, void *oldctx, void *newctx) -{ - DRIContextPrivPtr oldContext = (DRIContextPrivPtr)oldctx; - DRIContextPrivPtr newContext = (DRIContextPrivPtr)newctx; - ScreenPtr pScreen = newContext->pScreen; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - void* oldContextStore = NULL; - DRIContextType oldContextType; - void* newContextStore = NULL; - DRIContextType newContextType; - DRISyncType syncType; -#ifdef DEBUG - static int count = 0; -#endif - - if (!newContext) { - DRIDrvMsg(pScreen->myNum, X_ERROR, - "[DRI] Context Switch Error: oldContext=%x, newContext=%x\n", - oldContext, newContext); - return; - } - -#ifdef DEBUG - /* usefull for debugging, just print out after n context switches */ - if (!count || !(count % 1)) { - DRIDrvMsg(pScreen->myNum, X_INFO, - "[DRI] Context switch %5d from %p/0x%08x (%d)\n", - count, - oldContext, - oldContext ? oldContext->flags : 0, - oldContext ? oldContext->hwContext : -1); - DRIDrvMsg(pScreen->myNum, X_INFO, - "[DRI] Context switch %5d to %p/0x%08x (%d)\n", - count, - newContext, - newContext ? newContext->flags : 0, - newContext ? newContext->hwContext : -1); - } - ++count; -#endif - - if (!pDRIPriv->pDriverInfo->SwapContext) { - DRIDrvMsg(pScreen->myNum, X_ERROR, - "[DRI] DDX driver missing context swap call back\n"); - return; - } - - if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { - - /* only 3D contexts are swapped in this case */ - if (oldContext) { - oldContextStore = DRIGetContextStore(oldContext); - oldContext->valid3D = TRUE; - oldContextType = DRI_3D_CONTEXT; - } else { - oldContextType = DRI_NO_CONTEXT; - } - newContextStore = DRIGetContextStore(newContext); - if ((newContext->valid3D) && - (newContext->hwContext != pDRIPriv->myContext)) { - newContextType = DRI_3D_CONTEXT; - } - else { - newContextType = DRI_2D_CONTEXT; - } - syncType = DRI_3D_SYNC; - } - else /* default: driverSwapMethod == DRI_SERVER_SWAP */ { - - /* optimize 2D context swaps */ - - if (newContext->flags & DRI_CONTEXT_2DONLY) { - /* go from 3D context to 2D context and only save 2D - * subset of 3D state - */ - oldContextStore = DRIGetContextStore(oldContext); - oldContextType = DRI_2D_CONTEXT; - newContextStore = DRIGetContextStore(newContext); - newContextType = DRI_2D_CONTEXT; - syncType = DRI_3D_SYNC; - pDRIPriv->lastPartial3DContext = oldContext; - } - else if (oldContext->flags & DRI_CONTEXT_2DONLY) { - if (pDRIPriv->lastPartial3DContext == newContext) { - /* go from 2D context back to previous 3D context and - * only restore 2D subset of previous 3D state - */ - oldContextStore = DRIGetContextStore(oldContext); - oldContextType = DRI_2D_CONTEXT; - newContextStore = DRIGetContextStore(newContext); - newContextType = DRI_2D_CONTEXT; - syncType = DRI_2D_SYNC; - } - else { - /* go from 2D context to a different 3D context */ - - /* call DDX driver to do partial restore */ - oldContextStore = DRIGetContextStore(oldContext); - newContextStore = - DRIGetContextStore(pDRIPriv->lastPartial3DContext); - (*pDRIPriv->pDriverInfo->SwapContext)(pScreen, - DRI_2D_SYNC, - DRI_2D_CONTEXT, - oldContextStore, - DRI_2D_CONTEXT, - newContextStore); - - /* now setup for a complete 3D swap */ - oldContextStore = newContextStore; - oldContext->valid3D = TRUE; - oldContextType = DRI_3D_CONTEXT; - newContextStore = DRIGetContextStore(newContext); - if ((newContext->valid3D) && - (newContext->hwContext != pDRIPriv->myContext)) { - newContextType = DRI_3D_CONTEXT; - } - else { - newContextType = DRI_2D_CONTEXT; - } - syncType = DRI_NO_SYNC; - } - } - else { - /* now setup for a complete 3D swap */ - oldContextStore = newContextStore; - oldContext->valid3D = TRUE; - oldContextType = DRI_3D_CONTEXT; - newContextStore = DRIGetContextStore(newContext); - if ((newContext->valid3D) && - (newContext->hwContext != pDRIPriv->myContext)) { - newContextType = DRI_3D_CONTEXT; - } - else { - newContextType = DRI_2D_CONTEXT; - } - syncType = DRI_3D_SYNC; - } - } - - /* call DDX driver to perform the swap */ - (*pDRIPriv->pDriverInfo->SwapContext)(pScreen, - syncType, - oldContextType, - oldContextStore, - newContextType, - newContextStore); -} - -void* -DRIGetContextStore(DRIContextPrivPtr context) -{ - return((void *)context->pContextStore); -} - -void -DRIWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr bsreg) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); - - if(pDRIDrawablePriv) { - (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn, - pDRIDrawablePriv->drawableIndex); - } - - /* call lower wrapped functions */ - if (pDRIPriv && pDRIPriv->wrap.WindowExposures) { - - /* unwrap */ - pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures; - - /* call lower layers */ - (*pScreen->WindowExposures)(pWin, prgn, bsreg); - - /* rewrap */ - pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures; - pScreen->WindowExposures = DRIWindowExposures; - } -} - - -static int -DRITreeTraversal(WindowPtr pWin, pointer data) -{ - DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); - - if(pDRIDrawablePriv) { - ScreenPtr pScreen = pWin->drawable.pScreen; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - RegionPtr reg = (RegionPtr)data; - - REGION_UNION(pScreen, reg, reg, &(pWin->clipList)); - - if(pDRIPriv->nrWindows == 1) - return WT_STOPWALKING; - } - return WT_WALKCHILDREN; -} - -void -DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - if(!pDRIPriv) return; - - if(pDRIPriv->nrWindows > 0) { - RegionRec reg; - - REGION_NULL(pScreen, ®); - TraverseTree(pWin, DRITreeTraversal, (pointer)(®)); - - if(REGION_NOTEMPTY(pScreen, ®)) { - REGION_TRANSLATE(pScreen, ®, ptOldOrg.x - pWin->drawable.x, - ptOldOrg.y - pWin->drawable.y); - REGION_INTERSECT(pScreen, ®, ®, prgnSrc); - - /* The MoveBuffers interface is not ideal */ - (*pDRIPriv->pDriverInfo->MoveBuffers)(pWin, ptOldOrg, ®, - pDRIPriv->pDriverInfo->ddxDrawableTableEntry); - } - - REGION_UNINIT(pScreen, ®); - } - - /* call lower wrapped functions */ - if(pDRIPriv->wrap.CopyWindow) { - /* unwrap */ - pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow; - - /* call lower layers */ - (*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc); - - /* rewrap */ - pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow; - pScreen->CopyWindow = DRICopyWindow; - } -} - -static void -DRIGetSecs(long *secs, long *usecs) -{ -#ifdef XFree86LOADER - getsecs(secs,usecs); -#else - struct timeval tv; - - gettimeofday(&tv, NULL); - - *secs = tv.tv_sec; - *usecs = tv.tv_usec; -#endif -} - -static unsigned long -DRIComputeMilliSeconds(unsigned long s_secs, unsigned long s_usecs, - unsigned long f_secs, unsigned long f_usecs) -{ - if (f_usecs < s_usecs) { - --f_secs; - f_usecs += 1000000; - } - return (f_secs - s_secs) * 1000 + (f_usecs - s_usecs) / 1000; -} - -static void -DRISpinLockTimeout(drmLock *lock, int val, unsigned long timeout /* in mS */) -{ - int count = 10000; -#if !defined(__alpha__) && !defined(__powerpc__) - char ret; -#else - int ret; -#endif - long s_secs, s_usecs; - long f_secs, f_usecs; - long msecs; - long prev = 0; - - DRIGetSecs(&s_secs, &s_usecs); - - do { - DRM_SPINLOCK_COUNT(lock, val, count, ret); - if (!ret) return; /* Got lock */ - DRIGetSecs(&f_secs, &f_usecs); - msecs = DRIComputeMilliSeconds(s_secs, s_usecs, f_secs, f_usecs); - if (msecs - prev < 250) count *= 2; /* Not more than 0.5S */ - } while (msecs < timeout); - - /* Didn't get lock, so take it. The worst - that can happen is that there is some - garbage written to the wrong part of the - framebuffer that a refresh will repair. - That's undesirable, but better than - locking the server. This should be a - very rare event. */ - DRM_SPINLOCK_TAKE(lock, val); -} - -static void -DRILockTree(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - if(!pDRIPriv) return; - - /* Restore the last known 3D context if the X context is hidden */ - if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { - (*pDRIPriv->pDriverInfo->SwapContext)(pScreen, - DRI_2D_SYNC, - DRI_NO_CONTEXT, - NULL, - DRI_2D_CONTEXT, - pDRIPriv->partial3DContextStore); - } - - /* Call kernel to release lock */ - DRIUnlock(pScreen); - - /* Grab drawable spin lock: a time out between 10 and 30 seconds is - appropriate, since this should never time out except in the case of - client death while the lock is being held. The timeout must be - greater than any reasonable rendering time. */ - DRISpinLockTimeout(&pDRIPriv->pSAREA->drawable_lock, 1, 10000); /*10 secs*/ - - /* Call kernel flush outstanding buffers and relock */ - DRILock(pScreen, DRM_LOCK_QUIESCENT|DRM_LOCK_FLUSH_ALL); - - /* Switch back to our 2D context if the X context is hidden */ - if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { - /* hide X context by swapping 2D component here */ - (*pDRIPriv->pDriverInfo->SwapContext)(pScreen, - DRI_3D_SYNC, - DRI_2D_CONTEXT, - pDRIPriv->partial3DContextStore, - DRI_2D_CONTEXT, - pDRIPriv->hiddenContextStore); - } -} - -/* It appears that somebody is relying on the lock being set even - if we aren't touching 3D windows */ - -#define DRI_BROKEN - -static Bool DRIWindowsTouched = FALSE; - -int -DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) -{ - ScreenPtr pScreen = pParent->drawable.pScreen; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - int returnValue = 1; /* always return 1, not checked by dix/window.c */ - - if(!pDRIPriv) return returnValue; - - DRIWindowsTouched = FALSE; - -#ifdef DRI_BROKEN - if(!DRIWindowsTouched) { - DRILockTree(pScreen); - DRIWindowsTouched = TRUE; - } -#endif - - /* call lower wrapped functions */ - if(pDRIPriv->wrap.ValidateTree) { - /* unwrap */ - pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree; - - /* call lower layers */ - returnValue = (*pScreen->ValidateTree)(pParent, pChild, kind); - - /* rewrap */ - pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree; - pScreen->ValidateTree = DRIValidateTree; - } - - return returnValue; -} - -void -DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) -{ - ScreenPtr pScreen; - DRIScreenPrivPtr pDRIPriv; - - if (pParent) { - pScreen = pParent->drawable.pScreen; - } else { - pScreen = pChild->drawable.pScreen; - } - if(!(pDRIPriv = DRI_SCREEN_PRIV(pScreen))) return; - - if (pDRIPriv->wrap.PostValidateTree) { - /* unwrap */ - pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree; - - /* call lower layers */ - (*pScreen->PostValidateTree)(pParent, pChild, kind); - - /* rewrap */ - pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree; - pScreen->PostValidateTree = DRIPostValidateTree; - } - - if (DRIWindowsTouched) { - /* Release spin lock */ - DRM_SPINUNLOCK(&pDRIPriv->pSAREA->drawable_lock, 1); - DRIWindowsTouched = FALSE; - } -} - -void -DRIClipNotify(WindowPtr pWin, int dx, int dy) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIDrawablePrivPtr pDRIDrawablePriv; - - if(!pDRIPriv) return; - - if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) { - -#ifndef DRI_BROKEN - if(!DRIWindowsTouched) { - DRILockTree(pScreen); - DRIWindowsTouched = TRUE; - } -#endif - - pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp - = DRIDrawableValidationStamp++; - } - - /* call lower wrapped functions */ - if(pDRIPriv->wrap.ClipNotify) { - - /* unwrap */ - pScreen->ClipNotify = pDRIPriv->wrap.ClipNotify; - - /* call lower layers */ - (*pScreen->ClipNotify)(pWin, dx, dy); - - /* rewrap */ - pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify; - pScreen->ClipNotify = DRIClipNotify; - } -} - -CARD32 -DRIGetDrawableIndex(WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); - CARD32 index; - - if (pDRIDrawablePriv) { - index = pDRIDrawablePriv->drawableIndex; - } - else { - index = pDRIPriv->pDriverInfo->ddxDrawableTableEntry; - } - - return index; -} - -unsigned int -DRIGetDrawableStamp(ScreenPtr pScreen, CARD32 drawable_index) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - return pDRIPriv->pSAREA->drawableTable[drawable_index].stamp; -} - - -void -DRIPrintDrawableLock(ScreenPtr pScreen, char *msg) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - ErrorF("%s: %d\n", msg, pDRIPriv->pSAREA->drawable_lock.lock); -} - -void -DRILock(ScreenPtr pScreen, int flags) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - if(!pDRIPriv) return; - - if (!pDRIPriv->lockRefCount) - DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext, flags); - pDRIPriv->lockRefCount++; -} - -void -DRIUnlock(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - if(!pDRIPriv) return; - - if (pDRIPriv->lockRefCount > 0) { - pDRIPriv->lockRefCount--; - } - else { - ErrorF("DRIUnlock called when not locked\n"); - return; - } - if (!pDRIPriv->lockRefCount) - DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext); -} - -void * -DRIGetSAREAPrivate(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - if (!pDRIPriv) return 0; - - return (void *)(((char*)pDRIPriv->pSAREA)+sizeof(XF86DRISAREARec)); -} - -drm_context_t -DRIGetContext(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - if (!pDRIPriv) return 0; - - return pDRIPriv->myContext; -} - -/* This lets get at the unwrapped functions so that they can correctly - * call the lowerlevel functions, and choose whether they will be - * called at every level of recursion (eg in validatetree). - */ -DRIWrappedFuncsRec * -DRIGetWrappedFuncs(ScreenPtr pScreen) -{ - return &(DRI_SCREEN_PRIV(pScreen)->wrap); -} - -/* note that this returns the library version, not the protocol version */ -void -DRIQueryVersion(int *majorVersion, - int *minorVersion, - int *patchVersion) -{ - *majorVersion = DRIINFO_MAJOR_VERSION; - *minorVersion = DRIINFO_MINOR_VERSION; - *patchVersion = DRIINFO_PATCH_VERSION; -} - -static void -_DRIAdjustFrame(ScrnInfoPtr pScrn, DRIScreenPrivPtr pDRIPriv, int x, int y) -{ - pDRIPriv->pSAREA->frame.x = x; - pDRIPriv->pSAREA->frame.y = y; - pDRIPriv->pSAREA->frame.width = pScrn->frameX1 - x + 1; - pDRIPriv->pSAREA->frame.height = pScrn->frameY1 - y + 1; -} - -void -DRIAdjustFrame(int scrnIndex, int x, int y, int flags) -{ - ScreenPtr pScreen = screenInfo.screens[scrnIndex]; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - int px, py; - - if (!pDRIPriv || !pDRIPriv->pSAREA) { - DRIDrvMsg(scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n", - pDRIPriv, pDRIPriv ? pDRIPriv->pSAREA : NULL); - return; - } - - if (pDRIPriv->fullscreen) { - /* Fix up frame */ - pScrn->frameX0 = pDRIPriv->pSAREA->frame.x; - pScrn->frameY0 = pDRIPriv->pSAREA->frame.y; - pScrn->frameX1 = pScrn->frameX0 + pDRIPriv->pSAREA->frame.width - 1; - pScrn->frameY1 = pScrn->frameY0 + pDRIPriv->pSAREA->frame.height - 1; - - /* Fix up cursor */ - miPointerPosition(&px, &py); - if (px < pScrn->frameX0) px = pScrn->frameX0; - if (px > pScrn->frameX1) px = pScrn->frameX1; - if (py < pScrn->frameY0) py = pScrn->frameY0; - if (py > pScrn->frameY1) py = pScrn->frameY1; - pScreen->SetCursorPosition(pScreen, px, py, TRUE); - return; - } - - if (pDRIPriv->wrap.AdjustFrame) { - /* unwrap */ - pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; - /* call lower layers */ - (*pScrn->AdjustFrame)(scrnIndex, x, y, flags); - /* rewrap */ - pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame; - pScrn->AdjustFrame = DRIAdjustFrame; - } - - _DRIAdjustFrame(pScrn, pDRIPriv, x, y); -} - -/* - * DRIMoveBuffersHelper swaps the regions rects in place leaving you - * a region with the rects in the order that you need to blit them, - * but it is possibly (likely) an invalid region afterwards. If you - * need to use the region again for anything you have to call - * REGION_VALIDATE on it, or better yet, save a copy first. - */ - -void -DRIMoveBuffersHelper( - ScreenPtr pScreen, - int dx, - int dy, - int *xdir, - int *ydir, - RegionPtr reg -) -{ - BoxPtr extents, pbox, firstBox, lastBox; - BoxRec tmpBox; - int y, nbox; - - extents = REGION_EXTENTS(pScreen, reg); - nbox = REGION_NUM_RECTS(reg); - pbox = REGION_RECTS(reg); - - if((dy > 0) && (dy < (extents->y2 - extents->y1))) { - *ydir = -1; - if(nbox > 1) { - firstBox = pbox; - lastBox = pbox + nbox - 1; - while((unsigned long)firstBox < (unsigned long)lastBox) { - tmpBox = *firstBox; - *firstBox = *lastBox; - *lastBox = tmpBox; - firstBox++; - lastBox--; - } - } - } else *ydir = 1; - - if((dx > 0) && (dx < (extents->x2 - extents->x1))) { - *xdir = -1; - if(nbox > 1) { - firstBox = lastBox = pbox; - y = pbox->y1; - while(--nbox) { - pbox++; - if(pbox->y1 == y) lastBox++; - else { - while((unsigned long)firstBox < (unsigned long)lastBox) { - tmpBox = *firstBox; - *firstBox = *lastBox; - *lastBox = tmpBox; - firstBox++; - lastBox--; - } - - firstBox = lastBox = pbox; - y = pbox->y1; - } - } - while((unsigned long)firstBox < (unsigned long)lastBox) { - tmpBox = *firstBox; - *firstBox = *lastBox; - *lastBox = tmpBox; - firstBox++; - lastBox--; - } - } - } else *xdir = 1; - -} - -char * -DRICreatePCIBusID(pciVideoPtr PciInfo) -{ - char *busID; - int domain; - PCITAG tag; - - busID = xalloc(20); - if (busID == NULL) - return NULL; - - tag = pciTag(PciInfo->bus, PciInfo->device, PciInfo->func); - domain = xf86GetPciDomain(tag); - snprintf(busID, 20, "pci:%04x:%02x:%02x.%d", domain, PciInfo->bus, - PciInfo->device, PciInfo->func); - return busID; -} diff --git a/nx-X11/programs/Xserver/GL/dri/dri.h b/nx-X11/programs/Xserver/GL/dri/dri.h deleted file mode 100644 index 312e8a8bb..000000000 --- a/nx-X11/programs/Xserver/GL/dri/dri.h +++ /dev/null @@ -1,345 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/dri.h,v 1.18 2001/03/21 16:21:40 dawes Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Jens Owen <jens@tungstengraphics.com> - * - */ - -/* Prototypes for DRI functions */ - -#ifndef _DRI_H_ - -#include "scrnintstr.h" -#include "xf86dri.h" - -typedef int DRISyncType; - -#define DRI_NO_SYNC 0 -#define DRI_2D_SYNC 1 -#define DRI_3D_SYNC 2 - -typedef int DRIContextType; - -typedef struct _DRIContextPrivRec DRIContextPrivRec, *DRIContextPrivPtr; - -typedef enum _DRIContextFlags -{ - DRI_CONTEXT_2DONLY = 0x01, - DRI_CONTEXT_PRESERVED = 0x02, - DRI_CONTEXT_RESERVED = 0x04 /* DRI Only -- no kernel equivalent */ -} DRIContextFlags; - -#define DRI_NO_CONTEXT 0 -#define DRI_2D_CONTEXT 1 -#define DRI_3D_CONTEXT 2 - -typedef int DRISwapMethod; - -#define DRI_HIDE_X_CONTEXT 0 -#define DRI_SERVER_SWAP 1 -#define DRI_KERNEL_SWAP 2 - -typedef int DRIWindowRequests; - -#define DRI_NO_WINDOWS 0 -#define DRI_3D_WINDOWS_ONLY 1 -#define DRI_ALL_WINDOWS 2 - - -typedef void (*ClipNotifyPtr)( WindowPtr, int, int ); -typedef void (*AdjustFramePtr)(int scrnIndex, int x, int y, int flags); - - -/* - * These functions can be wrapped by the DRI. Each of these have - * generic default funcs (initialized in DRICreateInfoRec) and can be - * overridden by the driver in its [driver]DRIScreenInit function. - */ -typedef struct { - ScreenWakeupHandlerProcPtr WakeupHandler; - ScreenBlockHandlerProcPtr BlockHandler; - WindowExposuresProcPtr WindowExposures; - CopyWindowProcPtr CopyWindow; - ValidateTreeProcPtr ValidateTree; - PostValidateTreeProcPtr PostValidateTree; - ClipNotifyProcPtr ClipNotify; - AdjustFramePtr AdjustFrame; -} DRIWrappedFuncsRec, *DRIWrappedFuncsPtr; - - -/* - * Prior to Xorg 6.8.99.8, the DRIInfoRec structure was implicitly versioned - * by the XF86DRI_*_VERSION defines in xf86dristr.h. These numbers were also - * being used to version the XFree86-DRI protocol. Bugs #3066 and #3163 - * showed that this was inadequate. The DRIInfoRec structure is now versioned - * by the DRIINFO_*_VERSION defines in this file. - ajax, 2005-05-18. - * - * Revision history: - * 4.1.0 and earlier: DRIQueryVersion returns XF86DRI_*_VERSION. - * 4.2.0: DRIQueryVersion begins returning DRIINFO_*_VERSION. - * 5.0.0: frameBufferPhysicalAddress changed from CARD32 to pointer. - */ - -#define DRIINFO_MAJOR_VERSION 5 -#define DRIINFO_MINOR_VERSION 0 -#define DRIINFO_PATCH_VERSION 0 - -typedef struct { - /* driver call back functions - * - * New fields should be added at the end for backwards compatibility. - * Bump the DRIINFO patch number to indicate bugfixes. - * Bump the DRIINFO minor number to indicate new fields. - * Bump the DRIINFO major number to indicate binary-incompatible changes. - */ - Bool (*CreateContext)(ScreenPtr pScreen, - VisualPtr visual, - drm_context_t hHWContext, - void* pVisualConfigPriv, - DRIContextType context); - void (*DestroyContext)(ScreenPtr pScreen, - drm_context_t hHWContext, - DRIContextType context); - void (*SwapContext)(ScreenPtr pScreen, - DRISyncType syncType, - DRIContextType readContextType, - void* readContextStore, - DRIContextType writeContextType, - void* writeContextStore); - void (*InitBuffers)(WindowPtr pWin, - RegionPtr prgn, - CARD32 indx); - void (*MoveBuffers)(WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc, - CARD32 indx); - void (*TransitionTo3d)(ScreenPtr pScreen); - void (*TransitionTo2d)(ScreenPtr pScreen); - - void (*SetDrawableIndex)(WindowPtr pWin, CARD32 indx); - Bool (*OpenFullScreen)(ScreenPtr pScreen); - Bool (*CloseFullScreen)(ScreenPtr pScreen); - - /* wrapped functions */ - DRIWrappedFuncsRec wrap; - - /* device info */ - char* drmDriverName; - char* clientDriverName; - char* busIdString; - int ddxDriverMajorVersion; - int ddxDriverMinorVersion; - int ddxDriverPatchVersion; - pointer frameBufferPhysicalAddress; - long frameBufferSize; - long frameBufferStride; - long SAREASize; - int maxDrawableTableEntry; - int ddxDrawableTableEntry; - long contextSize; - DRISwapMethod driverSwapMethod; - DRIWindowRequests bufferRequests; - int devPrivateSize; - void* devPrivate; - Bool createDummyCtx; - Bool createDummyCtxPriv; - - /* New with DRI version 4.1.0 */ - void (*TransitionSingleToMulti3D)(ScreenPtr pScreen); - void (*TransitionMultiToSingle3D)(ScreenPtr pScreen); -} DRIInfoRec, *DRIInfoPtr; - - -extern Bool DRIScreenInit(ScreenPtr pScreen, - DRIInfoPtr pDRIInfo, - int *pDRMFD); - -extern void DRICloseScreen(ScreenPtr pScreen); - -extern Bool DRIExtensionInit(void); - -extern void DRIReset(void); - -extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen, - Bool *isCapable); - -extern Bool DRIOpenConnection(ScreenPtr pScreen, - drm_handle_t * hSAREA, - char **busIdString); - -extern Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic); - -extern Bool DRICloseConnection(ScreenPtr pScreen); - -extern Bool DRIGetClientDriverName(ScreenPtr pScreen, - int* ddxDriverMajorVersion, - int* ddxDriverMinorVersion, - int* ddxDriverPatchVersion, - char** clientDriverName); - -extern Bool DRICreateContext(ScreenPtr pScreen, - VisualPtr visual, - XID context, - drm_context_t * pHWContext); - -extern Bool DRIDestroyContext(ScreenPtr pScreen, XID context); - -extern Bool DRIContextPrivDelete(pointer pResource, XID id); - -extern Bool DRICreateDrawable(ScreenPtr pScreen, - Drawable id, - DrawablePtr pDrawable, - drm_drawable_t * hHWDrawable); - -extern Bool DRIDestroyDrawable(ScreenPtr pScreen, - Drawable id, - DrawablePtr pDrawable); - -extern Bool DRIDrawablePrivDelete(pointer pResource, - XID id); - -extern Bool DRIGetDrawableInfo(ScreenPtr pScreen, - DrawablePtr pDrawable, - unsigned int* indx, - unsigned int* stamp, - int* X, - int* Y, - int* W, - int* H, - int* numClipRects, - drm_clip_rect_t ** pClipRects, - int* backX, - int* backY, - int* numBackClipRects, - drm_clip_rect_t ** pBackClipRects); - -extern Bool DRIGetDeviceInfo(ScreenPtr pScreen, - drm_handle_t * hFrameBuffer, - int* fbOrigin, - int* fbSize, - int* fbStride, - int* devPrivateSize, - void** pDevPrivate); - -extern DRIInfoPtr DRICreateInfoRec(void); - -extern void DRIDestroyInfoRec(DRIInfoPtr DRIInfo); - -extern Bool DRIFinishScreenInit(ScreenPtr pScreen); - -extern void DRIWakeupHandler(pointer wakeupData, - int result, - pointer pReadmask); - -extern void DRIBlockHandler(pointer blockData, - OSTimePtr pTimeout, - pointer pReadmask); - -extern void DRIDoWakeupHandler(int screenNum, - pointer wakeupData, - unsigned long result, - pointer pReadmask); - -extern void DRIDoBlockHandler(int screenNum, - pointer blockData, - pointer pTimeout, - pointer pReadmask); - -extern void DRISwapContext(int drmFD, - void *oldctx, - void *newctx); - -extern void *DRIGetContextStore(DRIContextPrivPtr context); - -extern void DRIWindowExposures(WindowPtr pWin, - RegionPtr prgn, - RegionPtr bsreg); - -extern void DRICopyWindow(WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc); - -extern int DRIValidateTree(WindowPtr pParent, - WindowPtr pChild, - VTKind kind); - -extern void DRIPostValidateTree(WindowPtr pParent, - WindowPtr pChild, - VTKind kind); - -extern void DRIClipNotify(WindowPtr pWin, - int dx, - int dy); - -extern CARD32 DRIGetDrawableIndex(WindowPtr pWin); - -extern void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg); - -extern void DRILock(ScreenPtr pScreen, int flags); - -extern void DRIUnlock(ScreenPtr pScreen); - -extern DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen); - -extern void *DRIGetSAREAPrivate(ScreenPtr pScreen); - -extern unsigned int DRIGetDrawableStamp(ScreenPtr pScreen, - CARD32 drawable_index); - -extern DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen, - drm_context_t * pHWContext, - DRIContextFlags flags); - -extern DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen, - drm_context_t hHWContext, - DRIContextFlags flags); - -extern Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv); - -extern drm_context_t DRIGetContext(ScreenPtr pScreen); - -extern void DRIQueryVersion(int *majorVersion, - int *minorVersion, - int *patchVersion); - -extern void DRIAdjustFrame(int scrnIndex, int x, int y, int flags); - -extern void DRIMoveBuffersHelper(ScreenPtr pScreen, - int dx, - int dy, - int *xdir, - int *ydir, - RegionPtr reg); - -extern char *DRICreatePCIBusID(pciVideoPtr PciInfo); - -#define _DRI_H_ - -#endif diff --git a/nx-X11/programs/Xserver/GL/dri/drimodule.c b/nx-X11/programs/Xserver/GL/dri/drimodule.c deleted file mode 100644 index 922c6f40e..000000000 --- a/nx-X11/programs/Xserver/GL/dri/drimodule.c +++ /dev/null @@ -1,127 +0,0 @@ -/* $XdotOrg: xc/programs/Xserver/GL/dri/drimodule.c,v 1.6 2005/11/02 15:53:57 kem Exp $ */ -/************************************************************************** - -Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ -/* $XFree86: xc/programs/Xserver/GL/dri/drimodule.c,v 1.5 2001/06/15 21:22:39 dawes Exp $ */ - -/* - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Rickard E. Faith <faith@precisioninsight.com> - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86Module.h" -#include "globals.h" - -static MODULESETUPPROTO(driSetup); - -static XF86ModuleVersionInfo VersRec = -{ - "dri", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_EXTENSION, - ABI_EXTENSION_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} -}; - -extern void XFree86DRIExtensionInit(INITARGS); -#define _XF86DRI_SERVER_ -#include "xf86dristr.h" - -ExtensionModule XF86DRIExt = -{ - XFree86DRIExtensionInit, - XF86DRINAME, - &noXFree86DRIExtension, - NULL, - NULL -}; - -static const char *drmSymbols[] = { - "drmAddContextTag", - "drmAddMap", - "drmAuthMagic", - "drmAvailable", - "drmClose", - "drmCreateContext", - "drmCreateDrawable", - "drmDelContextTag", - "drmDestroyContext", - "drmDestroyDrawable", - "drmFreeReservedContextList", - "drmGetContextTag", - "drmGetLock", - "drmGetReservedContextList", - "drmInstallSIGIOHandler", - "drmMap", - "drmOpen", - "drmRemoveSIGIOHandler", - "drmSetBusid", - "drmSetContextFlags", - "drmUnlock", - "drmUnmap", - NULL -}; - -XF86ModuleData driModuleData = { &VersRec, driSetup, NULL }; - -static pointer -driSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - static Bool setupDone = FALSE; - pointer drm = NULL; - - if (!setupDone) { - setupDone = TRUE; - - drm = - LoadSubModule(module, "drm", NULL, NULL, NULL, NULL, errmaj, errmin); - - if (!drm) { - if (errmaj) *errmaj = LDR_NOSUBENT; - } - else { - LoaderReqSymLists(drmSymbols, NULL); - LoaderRefSymbols("noPanoramiXExtension", NULL); - LoadExtension(&XF86DRIExt, FALSE); - } - } else { - if (errmaj) *errmaj = LDR_ONCEONLY; - } - /* Need a non-NULL return value to indicate success */ - return drm; -} - diff --git a/nx-X11/programs/Xserver/GL/dri/dristruct.h b/nx-X11/programs/Xserver/GL/dri/dristruct.h deleted file mode 100644 index b47afba3a..000000000 --- a/nx-X11/programs/Xserver/GL/dri/dristruct.h +++ /dev/null @@ -1,105 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/dristruct.h,v 1.12 2002/10/30 12:52:03 alanh Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Jens Owen <jens@tungstengraphics.com> - * - */ - -#ifndef DRI_STRUCT_H -#define DRI_STRUCT_H - -#include "xf86drm.h" - - -#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) \ - ((DRIWindowPrivIndex < 0) ? \ - NULL : \ - ((DRIDrawablePrivPtr)((pWin)->devPrivates[DRIWindowPrivIndex].ptr))) - -#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) \ - ((DRIPixmapPrivIndex < 0) ? \ - NULL : \ - ((DRIDrawablePrivPtr)((pPix)->devPrivates[DRIWindowPrivIndex].ptr))) - -typedef struct _DRIDrawablePrivRec -{ - drm_drawable_t hwDrawable; - int drawableIndex; - ScreenPtr pScreen; - int refCount; -} DRIDrawablePrivRec, *DRIDrawablePrivPtr; - -struct _DRIContextPrivRec -{ - drm_context_t hwContext; - ScreenPtr pScreen; - Bool valid3D; - DRIContextFlags flags; - void** pContextStore; -}; - -#define DRI_SCREEN_PRIV(pScreen) \ - ((DRIScreenPrivIndex < 0) ? \ - NULL : \ - ((DRIScreenPrivPtr)((pScreen)->devPrivates[DRIScreenPrivIndex].ptr))) - -#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \ - (screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr)) - - -typedef struct _DRIScreenPrivRec -{ - Bool directRenderingSupport; - int drmFD; /* File descriptor for /dev/video/? */ - drm_handle_t hSAREA; /* Handle to SAREA, for mapping */ - XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */ - drm_handle_t hFrameBuffer; /* Handle to framebuffer, for mapping */ - drm_context_t myContext; /* DDX Driver's context */ - DRIContextPrivPtr myContextPriv;/* Pointer to server's private area */ - DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */ - void** hiddenContextStore; /* hidden X context */ - void** partial3DContextStore; /* parital 3D context */ - DRIInfoPtr pDriverInfo; - int nrWindows; - drm_clip_rect_t private_buffer_rect; /* management of private buffers */ - DrawablePtr fullscreen; /* pointer to fullscreen drawable */ - drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */ - DRIWrappedFuncsRec wrap; - DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES]; - DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */ - Bool createDummyCtx; - Bool createDummyCtxPriv; - Bool grabbedDRILock; - Bool drmSIGIOHandlerInstalled; - Bool wrapped; - int lockRefCount; -} DRIScreenPrivRec, *DRIScreenPrivPtr; - -#endif /* DRI_STRUCT_H */ diff --git a/nx-X11/programs/Xserver/GL/dri/sarea.h b/nx-X11/programs/Xserver/GL/dri/sarea.h deleted file mode 100644 index 77c16e0ef..000000000 --- a/nx-X11/programs/Xserver/GL/dri/sarea.h +++ /dev/null @@ -1,94 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/sarea.h,v 1.11 2002/10/30 12:52:03 alanh Exp $ */ -/** - * \file sarea.h - * SAREA definitions. - * - * \author Kevin E. Martin <kevin@precisioninsight.com> - * \author Jens Owen <jens@tungstengraphics.com> - * \author Rickard E. (Rik) Faith <faith@valinux.com> - */ - -/* - * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* $XFree86: xc/programs/Xserver/GL/dri/sarea.h,v 1.11 2002/10/30 12:52:03 alanh Exp $ */ - -#ifndef _SAREA_H_ -#define _SAREA_H_ - -#include "xf86drm.h" - -/* SAREA area needs to be at least a page */ -#if defined(__alpha__) -#define SAREA_MAX 0x2000 -#elif defined(__ia64__) -#define SAREA_MAX 0x10000 /* 64kB */ -#else -/* Intel 830M driver needs at least 8k SAREA */ -#define SAREA_MAX 0x2000 -#endif - -#define SAREA_MAX_DRAWABLES 256 - -#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000 - -/** - * SAREA per drawable information. - * - * \sa _XF86DRISAREA. - */ -typedef struct _XF86DRISAREADrawable { - unsigned int stamp; - unsigned int flags; -} XF86DRISAREADrawableRec, *XF86DRISAREADrawablePtr; - -/** - * SAREA frame information. - * - * \sa _XF86DRISAREA. - */ -typedef struct _XF86DRISAREAFrame { - unsigned int x; - unsigned int y; - unsigned int width; - unsigned int height; - unsigned int fullscreen; -} XF86DRISAREAFrameRec, *XF86DRISAREAFramePtr; - -/** - * SAREA definition. - */ -typedef struct _XF86DRISAREA { - /** first thing is always the DRM locking structure */ - drmLock lock; - /** \todo Use readers/writer lock for drawable_lock */ - drmLock drawable_lock; - XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES]; - XF86DRISAREAFrameRec frame; - drm_context_t dummy_context; -} XF86DRISAREARec, *XF86DRISAREAPtr; - -#endif diff --git a/nx-X11/programs/Xserver/GL/dri/xf86dri.c b/nx-X11/programs/Xserver/GL/dri/xf86dri.c deleted file mode 100644 index 273ccda1b..000000000 --- a/nx-X11/programs/Xserver/GL/dri/xf86dri.c +++ /dev/null @@ -1,649 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/xf86dri.c,v 1.12 2002/12/14 01:36:08 dawes Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin <martin@valinux.com> - * Jens Owen <jens@tungstengraphics.com> - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86.h" -#ifdef XFree86LOADER -#include "xf86_ansic.h" -#endif - -#define NEED_REPLIES -#define NEED_EVENTS -#include <X11/X.h> -#include <X11/Xproto.h> -#include "misc.h" -#include "dixstruct.h" -#include "extnsionst.h" -#include "colormapst.h" -#include "cursorstr.h" -#include "scrnintstr.h" -#include "servermd.h" -#define _XF86DRI_SERVER_ -#include "xf86dristr.h" -#include "swaprep.h" -#include "xf86str.h" -#include "dri.h" -#include "sarea.h" -#include "dristruct.h" -#include "xf86.h" -#include "xf86drm.h" - -static int DRIErrorBase; - -static DISPATCH_PROC(ProcXF86DRIQueryVersion); -static DISPATCH_PROC(ProcXF86DRIQueryDirectRenderingCapable); -static DISPATCH_PROC(ProcXF86DRIOpenConnection); -static DISPATCH_PROC(ProcXF86DRICloseConnection); -static DISPATCH_PROC(ProcXF86DRIGetClientDriverName); -static DISPATCH_PROC(ProcXF86DRICreateContext); -static DISPATCH_PROC(ProcXF86DRIDestroyContext); -static DISPATCH_PROC(ProcXF86DRICreateDrawable); -static DISPATCH_PROC(ProcXF86DRIDestroyDrawable); -static DISPATCH_PROC(ProcXF86DRIGetDrawableInfo); -static DISPATCH_PROC(ProcXF86DRIGetDeviceInfo); -static DISPATCH_PROC(ProcXF86DRIDispatch); -static DISPATCH_PROC(ProcXF86DRIAuthConnection); - -static DISPATCH_PROC(SProcXF86DRIQueryVersion); -static DISPATCH_PROC(SProcXF86DRIDispatch); - -static void XF86DRIResetProc(ExtensionEntry* extEntry); - -static unsigned char DRIReqCode = 0; - -extern void XFree86DRIExtensionInit(void); - -void -XFree86DRIExtensionInit(void) -{ - ExtensionEntry* extEntry; - -#ifdef XF86DRI_EVENTS - EventType = CreateNewResourceType(XF86DRIFreeEvents); -#endif - - if ( - DRIExtensionInit() && -#ifdef XF86DRI_EVENTS - EventType && ScreenPrivateIndex != -1 && -#endif - (extEntry = AddExtension(XF86DRINAME, - XF86DRINumberEvents, - XF86DRINumberErrors, - ProcXF86DRIDispatch, - SProcXF86DRIDispatch, - XF86DRIResetProc, - StandardMinorOpcode))) { - DRIReqCode = (unsigned char)extEntry->base; - DRIErrorBase = extEntry->errorBase; - } -} - -/*ARGSUSED*/ -static void -XF86DRIResetProc ( - ExtensionEntry* extEntry -) -{ - DRIReset(); -} - -static int -ProcXF86DRIQueryVersion( - register ClientPtr client -) -{ - xXF86DRIQueryVersionReply rep; - register int n; - - REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = XF86DRI_MAJOR_VERSION; - rep.minorVersion = XF86DRI_MINOR_VERSION; - rep.patchVersion = XF86DRI_PATCH_VERSION; - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - } - WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *)&rep); - return (client->noClientException); -} - -static int -ProcXF86DRIQueryDirectRenderingCapable( - register ClientPtr client -) -{ - xXF86DRIQueryDirectRenderingCapableReply rep; - Bool isCapable; - - REQUEST(xXF86DRIQueryDirectRenderingCapableReq); - REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq); - if (stuff->screen >= screenInfo.numScreens) { - client->errorValue = stuff->screen; - return BadValue; - } - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - if (!DRIQueryDirectRenderingCapable( screenInfo.screens[stuff->screen], - &isCapable)) { - return BadValue; - } - rep.isCapable = isCapable; - - if (!LocalClient(client)) - rep.isCapable = 0; - - WriteToClient(client, - sizeof(xXF86DRIQueryDirectRenderingCapableReply), (char *)&rep); - return (client->noClientException); -} - -static int -ProcXF86DRIOpenConnection( - register ClientPtr client -) -{ - xXF86DRIOpenConnectionReply rep; - drm_handle_t hSAREA; - char* busIdString; - - REQUEST(xXF86DRIOpenConnectionReq); - REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq); - if (stuff->screen >= screenInfo.numScreens) { - client->errorValue = stuff->screen; - return BadValue; - } - - if (!DRIOpenConnection( screenInfo.screens[stuff->screen], - &hSAREA, - &busIdString)) { - return BadValue; - } - - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.busIdStringLength = 0; - if (busIdString) - rep.busIdStringLength = strlen(busIdString); - rep.length = (SIZEOF(xXF86DRIOpenConnectionReply) - SIZEOF(xGenericReply) + - ((rep.busIdStringLength + 3) & ~3)) >> 2; - - rep.hSAREALow = (CARD32)(hSAREA & 0xffffffff); -#if defined(LONG64) && !defined(__linux__) - rep.hSAREAHigh = (CARD32)(hSAREA >> 32); -#else - rep.hSAREAHigh = 0; -#endif - - WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *)&rep); - if (rep.busIdStringLength) - WriteToClient(client, rep.busIdStringLength, busIdString); - return (client->noClientException); -} - -static int -ProcXF86DRIAuthConnection( - register ClientPtr client -) -{ - xXF86DRIAuthConnectionReply rep; - - REQUEST(xXF86DRIAuthConnectionReq); - REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq); - if (stuff->screen >= screenInfo.numScreens) { - client->errorValue = stuff->screen; - return BadValue; - } - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.authenticated = 1; - - if (!DRIAuthConnection( screenInfo.screens[stuff->screen], stuff->magic)) { - ErrorF("Failed to authenticate %lu\n", (unsigned long)stuff->magic); - rep.authenticated = 0; - } - WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *)&rep); - return (client->noClientException); -} - -static int -ProcXF86DRICloseConnection( - register ClientPtr client -) -{ - REQUEST(xXF86DRICloseConnectionReq); - REQUEST_SIZE_MATCH(xXF86DRICloseConnectionReq); - if (stuff->screen >= screenInfo.numScreens) { - client->errorValue = stuff->screen; - return BadValue; - } - - DRICloseConnection( screenInfo.screens[stuff->screen]); - - return (client->noClientException); -} - -static int -ProcXF86DRIGetClientDriverName( - register ClientPtr client -) -{ - xXF86DRIGetClientDriverNameReply rep; - char* clientDriverName; - - REQUEST(xXF86DRIGetClientDriverNameReq); - REQUEST_SIZE_MATCH(xXF86DRIGetClientDriverNameReq); - if (stuff->screen >= screenInfo.numScreens) { - client->errorValue = stuff->screen; - return BadValue; - } - - DRIGetClientDriverName( screenInfo.screens[stuff->screen], - (int *)&rep.ddxDriverMajorVersion, - (int *)&rep.ddxDriverMinorVersion, - (int *)&rep.ddxDriverPatchVersion, - &clientDriverName); - - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.clientDriverNameLength = 0; - if (clientDriverName) - rep.clientDriverNameLength = strlen(clientDriverName); - rep.length = (SIZEOF(xXF86DRIGetClientDriverNameReply) - - SIZEOF(xGenericReply) + - ((rep.clientDriverNameLength + 3) & ~3)) >> 2; - - WriteToClient(client, - sizeof(xXF86DRIGetClientDriverNameReply), (char *)&rep); - if (rep.clientDriverNameLength) - WriteToClient(client, - rep.clientDriverNameLength, - clientDriverName); - return (client->noClientException); -} - -static int -ProcXF86DRICreateContext( - register ClientPtr client -) -{ - xXF86DRICreateContextReply rep; - ScreenPtr pScreen; - VisualPtr visual; - int i; - - REQUEST(xXF86DRICreateContextReq); - REQUEST_SIZE_MATCH(xXF86DRICreateContextReq); - if (stuff->screen >= screenInfo.numScreens) { - client->errorValue = stuff->screen; - return BadValue; - } - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - pScreen = screenInfo.screens[stuff->screen]; - visual = pScreen->visuals; - - /* Find the requested X visual */ - for (i = 0; i < pScreen->numVisuals; i++, visual++) - if (visual->vid == stuff->visual) - break; - if (i == pScreen->numVisuals) { - /* No visual found */ - return BadValue; - } - - if (!DRICreateContext( pScreen, - visual, - stuff->context, - (drm_context_t *)&rep.hHWContext)) { - return BadValue; - } - - WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *)&rep); - return (client->noClientException); -} - -static int -ProcXF86DRIDestroyContext( - register ClientPtr client -) -{ - REQUEST(xXF86DRIDestroyContextReq); - REQUEST_SIZE_MATCH(xXF86DRIDestroyContextReq); - if (stuff->screen >= screenInfo.numScreens) { - client->errorValue = stuff->screen; - return BadValue; - } - - if (!DRIDestroyContext( screenInfo.screens[stuff->screen], - stuff->context)) { - return BadValue; - } - - return (client->noClientException); -} - -static int -ProcXF86DRICreateDrawable( - ClientPtr client -) -{ - xXF86DRICreateDrawableReply rep; - DrawablePtr pDrawable; - - REQUEST(xXF86DRICreateDrawableReq); - REQUEST_SIZE_MATCH(xXF86DRICreateDrawableReq); - if (stuff->screen >= screenInfo.numScreens) { - client->errorValue = stuff->screen; - return BadValue; - } - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( - (Drawable)stuff->drawable, - client, - SecurityReadAccess))) { - return BadValue; - } - - if (!DRICreateDrawable( screenInfo.screens[stuff->screen], - (Drawable)stuff->drawable, - pDrawable, - (drm_drawable_t *)&rep.hHWDrawable)) { - return BadValue; - } - - WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *)&rep); - return (client->noClientException); -} - -static int -ProcXF86DRIDestroyDrawable( - register ClientPtr client -) -{ - REQUEST(xXF86DRIDestroyDrawableReq); - DrawablePtr pDrawable; - REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq); - if (stuff->screen >= screenInfo.numScreens) { - client->errorValue = stuff->screen; - return BadValue; - } - - if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( - (Drawable)stuff->drawable, - client, - SecurityReadAccess))) { - return BadValue; - } - - if (!DRIDestroyDrawable( screenInfo.screens[stuff->screen], - (Drawable)stuff->drawable, - pDrawable)) { - return BadValue; - } - - return (client->noClientException); -} - -static int -ProcXF86DRIGetDrawableInfo( - register ClientPtr client -) -{ - xXF86DRIGetDrawableInfoReply rep; - DrawablePtr pDrawable; - int X, Y, W, H; - drm_clip_rect_t * pClipRects; - drm_clip_rect_t * pBackClipRects; - int backX, backY; - - REQUEST(xXF86DRIGetDrawableInfoReq); - REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq); - if (stuff->screen >= screenInfo.numScreens) { - client->errorValue = stuff->screen; - return BadValue; - } - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( - (Drawable)stuff->drawable, - client, - SecurityReadAccess))) { - return BadValue; - } - - if (!DRIGetDrawableInfo( screenInfo.screens[stuff->screen], - pDrawable, - (unsigned int*)&rep.drawableTableIndex, - (unsigned int*)&rep.drawableTableStamp, - (int*)&X, - (int*)&Y, - (int*)&W, - (int*)&H, - (int*)&rep.numClipRects, - &pClipRects, - &backX, - &backY, - (int*)&rep.numBackClipRects, - &pBackClipRects)) { - return BadValue; - } - - rep.drawableX = X; - rep.drawableY = Y; - rep.drawableWidth = W; - rep.drawableHeight = H; - rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) - - SIZEOF(xGenericReply)); - - rep.backX = backX; - rep.backY = backY; - - if (rep.numBackClipRects) - rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects; - - if (rep.numClipRects) - rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects; - - rep.length = ((rep.length + 3) & ~3) >> 2; - - WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *)&rep); - - if (rep.numClipRects) { - WriteToClient(client, - sizeof(drm_clip_rect_t) * rep.numClipRects, - (char *)pClipRects); - } - - if (rep.numBackClipRects) { - WriteToClient(client, - sizeof(drm_clip_rect_t) * rep.numBackClipRects, - (char *)pBackClipRects); - } - - return (client->noClientException); -} - -static int -ProcXF86DRIGetDeviceInfo( - register ClientPtr client -) -{ - xXF86DRIGetDeviceInfoReply rep; - drm_handle_t hFrameBuffer; - void *pDevPrivate; - - REQUEST(xXF86DRIGetDeviceInfoReq); - REQUEST_SIZE_MATCH(xXF86DRIGetDeviceInfoReq); - if (stuff->screen >= screenInfo.numScreens) { - client->errorValue = stuff->screen; - return BadValue; - } - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - if (!DRIGetDeviceInfo( screenInfo.screens[stuff->screen], - &hFrameBuffer, - (int*)&rep.framebufferOrigin, - (int*)&rep.framebufferSize, - (int*)&rep.framebufferStride, - (int*)&rep.devPrivateSize, - &pDevPrivate)) { - return BadValue; - } - - rep.hFrameBufferLow = (CARD32)(hFrameBuffer & 0xffffffff); -#if defined(LONG64) && !defined(__linux__) - rep.hFrameBufferHigh = (CARD32)(hFrameBuffer >> 32); -#else - rep.hFrameBufferHigh = 0; -#endif - - rep.length = 0; - if (rep.devPrivateSize) { - rep.length = (SIZEOF(xXF86DRIGetDeviceInfoReply) - - SIZEOF(xGenericReply) + - ((rep.devPrivateSize + 3) & ~3)) >> 2; - } - - WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *)&rep); - if (rep.length) { - WriteToClient(client, rep.devPrivateSize, (char *)pDevPrivate); - } - return (client->noClientException); -} - -static int -ProcXF86DRIDispatch ( - register ClientPtr client -) -{ - REQUEST(xReq); - - switch (stuff->data) - { - case X_XF86DRIQueryVersion: - return ProcXF86DRIQueryVersion(client); - case X_XF86DRIQueryDirectRenderingCapable: - return ProcXF86DRIQueryDirectRenderingCapable(client); - } - - if (!LocalClient(client)) - return DRIErrorBase + XF86DRIClientNotLocal; - - switch (stuff->data) - { - case X_XF86DRIOpenConnection: - return ProcXF86DRIOpenConnection(client); - case X_XF86DRICloseConnection: - return ProcXF86DRICloseConnection(client); - case X_XF86DRIGetClientDriverName: - return ProcXF86DRIGetClientDriverName(client); - case X_XF86DRICreateContext: - return ProcXF86DRICreateContext(client); - case X_XF86DRIDestroyContext: - return ProcXF86DRIDestroyContext(client); - case X_XF86DRICreateDrawable: - return ProcXF86DRICreateDrawable(client); - case X_XF86DRIDestroyDrawable: - return ProcXF86DRIDestroyDrawable(client); - case X_XF86DRIGetDrawableInfo: - return ProcXF86DRIGetDrawableInfo(client); - case X_XF86DRIGetDeviceInfo: - return ProcXF86DRIGetDeviceInfo(client); - case X_XF86DRIAuthConnection: - return ProcXF86DRIAuthConnection(client); - /* {Open,Close}FullScreen are deprecated now */ - default: - return BadRequest; - } -} - -static int -SProcXF86DRIQueryVersion( - register ClientPtr client -) -{ - register int n; - REQUEST(xXF86DRIQueryVersionReq); - swaps(&stuff->length, n); - return ProcXF86DRIQueryVersion(client); -} - -static int -SProcXF86DRIDispatch ( - register ClientPtr client -) -{ - REQUEST(xReq); - - /* It is bound to be non-local when there is byte swapping */ - if (!LocalClient(client)) - return DRIErrorBase + XF86DRIClientNotLocal; - - /* only local clients are allowed DRI access */ - switch (stuff->data) - { - case X_XF86DRIQueryVersion: - return SProcXF86DRIQueryVersion(client); - default: - return BadRequest; - } -} diff --git a/nx-X11/programs/Xserver/GL/glx/Imakefile b/nx-X11/programs/Xserver/GL/glx/Imakefile index 5283e2286..2ee2d17e6 100644 --- a/nx-X11/programs/Xserver/GL/glx/Imakefile +++ b/nx-X11/programs/Xserver/GL/glx/Imakefile @@ -1,13 +1,5 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/glx/Imakefile,v 1.11 2004/01/28 18:11:50 alanh Exp $ +NULL = -#if DoLoadableServer -# if !BuildModuleInSubdir -# define IHaveModules -# elif !defined(IHaveModules) -# define IHaveSubdirs -SUBDIRS = module -# endif -#endif /* Large PIC tables needed for SPARC builds */ #if defined(sparc) || defined(SparcArchitecture) @@ -22,28 +14,97 @@ LinkSourceFile(glcontextmodes.h, $(MESASRCDIR)/src/mesa/drivers/dri/common) LinkSourceFile(indirect_size.c, $(MESASRCDIR)/src/glx/x11) LinkSourceFile(indirect_size.h, $(MESASRCDIR)/src/glx/x11) - SRCS = global.c glxbuf.c glxcmds.c glxcmdsswap.c glxext.c \ - glxfb.c glximports.c glxmem.c glxpix.c glxscreens.c \ - glxutil.c render2.c render2swap.c renderpix.c \ - renderpixswap.c rensize.c rensizetab.c single2.c \ - single2swap.c singlepix.c singlepixswap.c \ - singlesize.c xfont.c g_disptab.c g_disptab_EXT.c \ - g_render.c g_renderswap.c g_single.c g_singleswap.c \ - glcontextmodes.c indirect_size.c $(MSRCS) +#if (!(defined(NXAgentServer) && NXAgentServer)) +NXAGENT_SKIP_SRCS = \ + glxext.c \ + $(NULL) +NXAGENT_SKIP_OBJS = \ + glxext.o \ + $(NULL) +#else + NX_DEFINES = -DNXAGENT_SERVER +#endif + + SRCS = global.c \ + glxbuf.c \ + glxcmds.c \ + glxcmdsswap.c \ + glxfb.c \ + glximports.c \ + glxmem.c \ + glxpix.c \ + glxscreens.c \ + glxutil.c \ + render2.c \ + render2swap.c \ + renderpix.c \ + renderpixswap.c \ + rensize.c \ + rensizetab.c \ + single2.c \ + single2swap.c \ + singlepix.c \ + singlepixswap.c \ + singlesize.c \ + xfont.c \ + g_disptab.c \ + g_disptab_EXT.c \ + g_render.c \ + g_renderswap.c \ + g_single.c \ + g_singleswap.c \ + glcontextmodes.c \ + indirect_size.c \ + $(MSRCS) \ + $(NXAGENT_SKIP_SRCS) \ + $(NULL) - OBJS = global.o glxbuf.o glxcmds.o glxcmdsswap.o glxext.o \ - glxfb.o glximports.o glxmem.o glxpix.o glxscreens.o \ - glxutil.o render2.o render2swap.o renderpix.o \ - renderpixswap.o rensize.o rensizetab.o single2.o \ - single2swap.o singlepix.o singlepixswap.o \ - singlesize.o xfont.o g_disptab.o g_disptab_EXT.o \ - g_render.o g_renderswap.o g_single.o g_singleswap.o \ - glcontextmodes.o indirect_size.o $(MOBJS) + OBJS = global.o \ + glxbuf.o \ + glxcmds.o \ + glxcmdsswap.o \ + glxfb.o \ + glximports.o \ + glxmem.o \ + glxpix.o \ + glxscreens.o \ + glxutil.o \ + render2.o \ + render2swap.o \ + renderpix.o \ + renderpixswap.o \ + rensize.o \ + rensizetab.o \ + single2.o \ + single2swap.o \ + singlepix.o \ + singlepixswap.o \ + singlesize.o \ + xfont.o \ + g_disptab.o \ + g_disptab_EXT.o \ + g_render.o \ + g_renderswap.o \ + g_single.o \ + g_singleswap.o \ + glcontextmodes.o \ + indirect_size.o \ + $(MOBJS) \ + $(NXAGENT_SKIP_OBJS) \ + $(NULL) - INCLUDES = -I$(SERVERSRC)/GL/glx -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/include -I$(INCLUDESRC) -I$(MESASRCDIR)/include \ - -I$(XINCLUDESRC) -I$(SERVERSRC)/mi \ - -I$(EXTINCSRC) -I$(FONTINCSRC) -I$(LIBSRC)/GL/include \ - -I$(XF86SRC) + INCLUDES = -I$(SERVERSRC)/GL/glx \ + -I$(SERVERSRC)/GL/include \ + -I$(SERVERSRC)/include \ + -I$(INCLUDESRC) \ + -I$(MESASRCDIR)/include \ + -I$(XINCLUDESRC) \ + -I$(SERVERSRC)/mi \ + -I$(EXTINCSRC) \ + -I$(LIBSRC)/GL/include \ + -I$(XF86SRC) \ + `pkg-config --cflags-only-I pixman-1` \ + $(NULL) #if defined(DarwinArchitecture) && ((OSMajorVersion == 6 && OSMinorVersion < 3) || OSMajorVersion < 6) NO_EXT_DEFS = -DMISSING_GL_EXTS @@ -55,13 +116,13 @@ LinkSourceFile(indirect_size.h, $(MESASRCDIR)/src/glx/x11) XCOMM If you add "-DDEBUG" in DEFINES, then make sure you also XCOMM add DEBUG to the define in ../mesa/src/X/xf86glx.c - DEFINES = $(GLX_DEFINES) $(NO_EXT_DEFS) $(APIENTRY_DEFS) + DEFINES = \ + $(GLX_DEFINES) \ + $(NO_EXT_DEFS) \ + $(APIENTRY_DEFS) \ + $(NX_DEFINES) \ + $(NULL) - -#ifdef IHaveModules -ModuleObjectRule() -LibraryModuleTarget(glx,$(OBJS)) -#else NormalLibraryObjectRule() NormalLibraryTarget(glx,$(OBJS)) #if defined(GlxUseWindows) && GlxUseWindows @@ -72,7 +133,6 @@ includes:: SpecialObjectRule(stdcall/%.o,%.c,-DUSE_OPENGL32 -o $@) NormalLibraryTarget(glx_stdcall,$(foreach obj,$(OBJS), stdcall/$(obj))) #endif -#endif SubdirLibraryRule($(OBJS)) LintLibraryTarget(glx,$(SRCS)) diff --git a/nx-X11/programs/Xserver/GL/glx/g_disptab.c b/nx-X11/programs/Xserver/GL/glx/g_disptab.c index 93a9d628d..533bc6c9d 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_disptab.c +++ b/nx-X11/programs/Xserver/GL/glx/g_disptab.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.c,v 1.5 2004/01/28 18:11:50 alanh Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* ** License Applicability. Except to the extent portions of this file are diff --git a/nx-X11/programs/Xserver/GL/glx/g_disptab.h b/nx-X11/programs/Xserver/GL/glx/g_disptab.h index 0580b5529..85906cb43 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_disptab.h +++ b/nx-X11/programs/Xserver/GL/glx/g_disptab.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.h,v 1.4 2003/09/28 20:15:42 alanh Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> diff --git a/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.c b/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.c index d837c64d9..754e9854d 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.c +++ b/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.c,v 1.5 2004/01/28 18:11:50 alanh Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* ** License Applicability. Except to the extent portions of this file are diff --git a/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.h b/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.h index 3def7f1c5..3c1872f09 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.h +++ b/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.h,v 1.5 2004/01/28 18:11:50 alanh Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> diff --git a/nx-X11/programs/Xserver/GL/glx/g_render.c b/nx-X11/programs/Xserver/GL/glx/g_render.c index 24c64897e..ae3416bed 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_render.c +++ b/nx-X11/programs/Xserver/GL/glx/g_render.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_render.c,v 1.8 2004/02/03 21:34:36 alanh Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* ** License Applicability. Except to the extent portions of this file are @@ -29,7 +28,6 @@ ** version 1.2.1 Specification. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/g_renderswap.c b/nx-X11/programs/Xserver/GL/glx/g_renderswap.c index f485a2690..38b1497f1 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_renderswap.c +++ b/nx-X11/programs/Xserver/GL/glx/g_renderswap.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_renderswap.c,v 1.8 2004/01/28 18:11:50 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -28,7 +27,6 @@ ** version 1.2.1 Specification. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/g_single.c b/nx-X11/programs/Xserver/GL/glx/g_single.c index a60bf44c1..486ae7a25 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_single.c +++ b/nx-X11/programs/Xserver/GL/glx/g_single.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_single.c,v 1.5tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -28,7 +27,6 @@ ** version 1.2.1 Specification. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/g_singleswap.c b/nx-X11/programs/Xserver/GL/glx/g_singleswap.c index 026530374..7ec32dd96 100644 --- a/nx-X11/programs/Xserver/GL/glx/g_singleswap.c +++ b/nx-X11/programs/Xserver/GL/glx/g_singleswap.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_singleswap.c,v 1.4tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -28,7 +27,6 @@ ** version 1.2.1 Specification. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/global.c b/nx-X11/programs/Xserver/GL/glx/global.c index 18cd5edc2..2ce275ba3 100644 --- a/nx-X11/programs/Xserver/GL/glx/global.c +++ b/nx-X11/programs/Xserver/GL/glx/global.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glx-def.cpp b/nx-X11/programs/Xserver/GL/glx/glx-def.cpp deleted file mode 100644 index a653f4cb7..000000000 --- a/nx-X11/programs/Xserver/GL/glx/glx-def.cpp +++ /dev/null @@ -1,662 +0,0 @@ -LIBRARY GLX -VERSION LIBRARY_VERSION -EXPORTS -__glXFBInitDrawable -__glXFreeBuffers -__glXPixInitDrawable -__glXResizeBuffers -__glXClientInfo -__glXCopyContext -__glXCreateContext -__glXCreateGLXPixmap -__glXDestroyContext -__glXDestroyGLXPixmap -__glXGetVisualConfigs -__glXIsDirect -__glXLookupContextByTag -__glXMakeCurrent -__glXQueryContextInfoEXT -__glXQueryExtensionsString -__glXQueryServerString -__glXQueryVersion -__glXRender -__glXRenderLarge -__glXSwapBuffers -__glXVendorPrivate -__glXVendorPrivateWithReply -__glXWaitGL -__glXWaitX -__glXSwapClientInfo -__glXSwapCopyContext -__glXSwapCreateContext -__glXSwapCreateGLXPixmap -__glXSwapDestroyContext -__glXSwapDestroyGLXPixmap -__glXSwapGetVisualConfigs -__glXSwapIsDirect -__glXSwapIsDirectReply -__glXSwapMakeCurrent -__glXSwapMakeCurrentReply -__glXSwapQueryContextInfoEXT -__glXSwapQueryContextInfoEXTReply -__glXSwapQueryExtensionsString -__glXSwapQueryServerString -__glXSwapQueryVersion -__glXSwapQueryVersionReply -__glXSwapRender -__glXSwapRenderLarge -__glXSwapSwapBuffers -__glXSwapUseXFont -__glXSwapVendorPrivate -__glXSwapVendorPrivateWithReply -__glXSwapWaitGL -__glXSwapWaitX -glxSwapQueryExtensionsStringReply -glxSwapQueryServerStringReply -GlxExtensionInit -GlxInitVisuals -GlxSetVisualConfigs -GlxWrapInitVisuals -__glXClearErrorOccured -__glXCoreType -__glXErrorCallBack -__glXErrorOccured -__glXFlushContextCache -__glXForceCurrent -__glXFreeContext -__glXNoSuchRenderOpcode -__glXNoSuchSingleOpcode -__glXResetLargeCommandStatus -__glXFBGetGC -__glXFBMemSwapBuffers -__glXInitFB -__glXImpCalloc -__glXImpFatal -__glXImpFclose -__glXImpFopen -__glXImpFprintf -__glXImpFree -__glXImpGetDrawablePrivate -__glXImpGetenv -__glXImpMalloc -__glXImpRealloc -__glXImpSprintf -__glXImpWarning -__glXInitMem -__glXInitPix -__glXScreenInit -__glXAssociateContext -__glXCacheDrawableSize -__glXCalloc -__glXCreateDrawablePrivate -__glXDeassociateContext -__glXDestroyDrawablePrivate -__glXFindDrawablePrivate -__glXFree -__glXGetDrawablePrivate -__glXGetDrawableSize -__glXMalloc -__glXNop -__glXRealloc -__glXRefDrawablePrivate -__glXResizeDrawable -__glXResizeDrawableBuffers -__glXUnrefDrawablePrivate -__glXDisp_CallLists -__glXDisp_DrawArrays -__glXDisp_Map1d -__glXDisp_Map1f -__glXDisp_Map2d -__glXDisp_Map2f -__glXDispSwap_CallLists -__glXDispSwap_DrawArrays -__glXDispSwap_Map1d -__glXDispSwap_Map1f -__glXDispSwap_Map2d -__glXDispSwap_Map2f -__glXDisp_Bitmap -__glXDisp_DrawPixels -__glXDisp_PolygonStipple -__glXDisp_TexImage1D -__glXDisp_TexImage2D -__glXDisp_TexSubImage1D -__glXDisp_TexSubImage2D -__glXDispSwap_Bitmap -__glXDispSwap_DrawPixels -__glXDispSwap_PolygonStipple -__glXDispSwap_TexImage1D -__glXDispSwap_TexImage2D -__glXDispSwap_TexSubImage1D -__glXDispSwap_TexSubImage2D -__glXBitmapReqSize -__glXCallListsReqSize -__glXDrawArraysSize -__glXDrawPixelsReqSize -__glXFogfvReqSize -__glXFogivReqSize -__glXLightModelfvReqSize -__glXLightModelivReqSize -__glXLightfvReqSize -__glXLightivReqSize -__glXMap1dReqSize -__glXMap1fReqSize -__glXMap2dReqSize -__glXMap2fReqSize -__glXMaterialfvReqSize -__glXMaterialivReqSize -__glXPixelMapfvReqSize -__glXPixelMapuivReqSize -__glXPixelMapusvReqSize -__glXPrioritizeTexturesReqSize -__glXTexEnvfvReqSize -__glXTexEnvivReqSize -__glXTexGendvReqSize -__glXTexGenfvReqSize -__glXTexGenivReqSize -__glXTexImage1DReqSize -__glXTexImage2DReqSize -__glXTexParameterfvReqSize -__glXTexParameterivReqSize -__glXTexSubImage1DReqSize -__glXTexSubImage2DReqSize -__glXTypeSize -__glXDisp_FeedbackBuffer -__glXDisp_Finish -__glXDisp_Flush -__glXDisp_GetClipPlane -__glXDisp_GetString -__glXDisp_RenderMode -__glXDisp_SelectBuffer -__glXcombine_strings -__glXDispSwap_FeedbackBuffer -__glXDispSwap_Finish -__glXDispSwap_Flush -__glXDispSwap_GetClipPlane -__glXDispSwap_GetString -__glXDispSwap_RenderMode -__glXDispSwap_SelectBuffer -__glXDisp_GetPolygonStipple -__glXDisp_GetTexImage -__glXDisp_ReadPixels -__glXDispSwap_GetPolygonStipple -__glXDispSwap_GetTexImage -__glXDispSwap_ReadPixels -__glGetBooleanv_size -__glGetDoublev_size -__glGetFloatv_size -__glGetIntegerv_size -__glGetLightfv_size -__glGetLightiv_size -__glGetMap_size -__glGetMapdv_size -__glGetMapfv_size -__glGetMapiv_size -__glGetMaterialfv_size -__glGetMaterialiv_size -__glGetPixelMap_size -__glGetPixelMapfv_size -__glGetPixelMapuiv_size -__glGetPixelMapusv_size -__glGetTexEnvfv_size -__glGetTexEnviv_size -__glGetTexGendv_size -__glGetTexGenfv_size -__glGetTexGeniv_size -__glGetTexImage_size -__glGetTexLevelParameterfv_size -__glGetTexLevelParameteriv_size -__glGetTexParameterfv_size -__glGetTexParameteriv_size -__glGet_size -__glReadPixels_size -__glXUseXFont -__glXDisp_Accum -__glXDisp_AlphaFunc -__glXDisp_Begin -__glXDisp_BindTexture -__glXDisp_BlendFunc -__glXDisp_CallList -__glXDisp_Clear -__glXDisp_ClearAccum -__glXDisp_ClearColor -__glXDisp_ClearDepth -__glXDisp_ClearIndex -__glXDisp_ClearStencil -__glXDisp_ClipPlane -__glXDisp_Color3bv -__glXDisp_Color3dv -__glXDisp_Color3fv -__glXDisp_Color3iv -__glXDisp_Color3sv -__glXDisp_Color3ubv -__glXDisp_Color3uiv -__glXDisp_Color3usv -__glXDisp_Color4bv -__glXDisp_Color4dv -__glXDisp_Color4fv -__glXDisp_Color4iv -__glXDisp_Color4sv -__glXDisp_Color4ubv -__glXDisp_Color4uiv -__glXDisp_Color4usv -__glXDisp_ColorMask -__glXDisp_ColorMaterial -__glXDisp_CopyPixels -__glXDisp_CopyTexImage1D -__glXDisp_CopyTexImage2D -__glXDisp_CopyTexSubImage1D -__glXDisp_CopyTexSubImage2D -__glXDisp_CullFace -__glXDisp_DepthFunc -__glXDisp_DepthMask -__glXDisp_DepthRange -__glXDisp_Disable -__glXDisp_DrawBuffer -__glXDisp_EdgeFlagv -__glXDisp_Enable -__glXDisp_End -__glXDisp_EvalCoord1dv -__glXDisp_EvalCoord1fv -__glXDisp_EvalCoord2dv -__glXDisp_EvalCoord2fv -__glXDisp_EvalMesh1 -__glXDisp_EvalMesh2 -__glXDisp_EvalPoint1 -__glXDisp_EvalPoint2 -__glXDisp_Fogf -__glXDisp_Fogfv -__glXDisp_Fogi -__glXDisp_Fogiv -__glXDisp_FrontFace -__glXDisp_Frustum -__glXDisp_Hint -__glXDisp_IndexMask -__glXDisp_Indexdv -__glXDisp_Indexfv -__glXDisp_Indexiv -__glXDisp_Indexsv -__glXDisp_Indexubv -__glXDisp_InitNames -__glXDisp_LightModelf -__glXDisp_LightModelfv -__glXDisp_LightModeli -__glXDisp_LightModeliv -__glXDisp_Lightf -__glXDisp_Lightfv -__glXDisp_Lighti -__glXDisp_Lightiv -__glXDisp_LineStipple -__glXDisp_LineWidth -__glXDisp_ListBase -__glXDisp_LoadIdentity -__glXDisp_LoadMatrixd -__glXDisp_LoadMatrixf -__glXDisp_LoadName -__glXDisp_LogicOp -__glXDisp_MapGrid1d -__glXDisp_MapGrid1f -__glXDisp_MapGrid2d -__glXDisp_MapGrid2f -__glXDisp_Materialf -__glXDisp_Materialfv -__glXDisp_Materiali -__glXDisp_Materialiv -__glXDisp_MatrixMode -__glXDisp_MultMatrixd -__glXDisp_MultMatrixf -__glXDisp_Normal3bv -__glXDisp_Normal3dv -__glXDisp_Normal3fv -__glXDisp_Normal3iv -__glXDisp_Normal3sv -__glXDisp_Ortho -__glXDisp_PassThrough -__glXDisp_PixelMapfv -__glXDisp_PixelMapuiv -__glXDisp_PixelMapusv -__glXDisp_PixelTransferf -__glXDisp_PixelTransferi -__glXDisp_PixelZoom -__glXDisp_PointSize -__glXDisp_PolygonMode -__glXDisp_PolygonOffset -__glXDisp_PopAttrib -__glXDisp_PopMatrix -__glXDisp_PopName -__glXDisp_PrioritizeTextures -__glXDisp_PushAttrib -__glXDisp_PushMatrix -__glXDisp_PushName -__glXDisp_RasterPos2dv -__glXDisp_RasterPos2fv -__glXDisp_RasterPos2iv -__glXDisp_RasterPos2sv -__glXDisp_RasterPos3dv -__glXDisp_RasterPos3fv -__glXDisp_RasterPos3iv -__glXDisp_RasterPos3sv -__glXDisp_RasterPos4dv -__glXDisp_RasterPos4fv -__glXDisp_RasterPos4iv -__glXDisp_RasterPos4sv -__glXDisp_ReadBuffer -__glXDisp_Rectdv -__glXDisp_Rectfv -__glXDisp_Rectiv -__glXDisp_Rectsv -__glXDisp_Rotated -__glXDisp_Rotatef -__glXDisp_Scaled -__glXDisp_Scalef -__glXDisp_Scissor -__glXDisp_ShadeModel -__glXDisp_StencilFunc -__glXDisp_StencilMask -__glXDisp_StencilOp -__glXDisp_TexCoord1dv -__glXDisp_TexCoord1fv -__glXDisp_TexCoord1iv -__glXDisp_TexCoord1sv -__glXDisp_TexCoord2dv -__glXDisp_TexCoord2fv -__glXDisp_TexCoord2iv -__glXDisp_TexCoord2sv -__glXDisp_TexCoord3dv -__glXDisp_TexCoord3fv -__glXDisp_TexCoord3iv -__glXDisp_TexCoord3sv -__glXDisp_TexCoord4dv -__glXDisp_TexCoord4fv -__glXDisp_TexCoord4iv -__glXDisp_TexCoord4sv -__glXDisp_TexEnvf -__glXDisp_TexEnvfv -__glXDisp_TexEnvi -__glXDisp_TexEnviv -__glXDisp_TexGend -__glXDisp_TexGendv -__glXDisp_TexGenf -__glXDisp_TexGenfv -__glXDisp_TexGeni -__glXDisp_TexGeniv -__glXDisp_TexParameterf -__glXDisp_TexParameterfv -__glXDisp_TexParameteri -__glXDisp_TexParameteriv -__glXDisp_Translated -__glXDisp_Translatef -__glXDisp_Vertex2dv -__glXDisp_Vertex2fv -__glXDisp_Vertex2iv -__glXDisp_Vertex2sv -__glXDisp_Vertex3dv -__glXDisp_Vertex3fv -__glXDisp_Vertex3iv -__glXDisp_Vertex3sv -__glXDisp_Vertex4dv -__glXDisp_Vertex4fv -__glXDisp_Vertex4iv -__glXDisp_Vertex4sv -__glXDisp_Viewport -__glXDispSwap_Accum -__glXDispSwap_AlphaFunc -__glXDispSwap_Begin -__glXDispSwap_BindTexture -__glXDispSwap_BlendFunc -__glXDispSwap_CallList -__glXDispSwap_Clear -__glXDispSwap_ClearAccum -__glXDispSwap_ClearColor -__glXDispSwap_ClearDepth -__glXDispSwap_ClearIndex -__glXDispSwap_ClearStencil -__glXDispSwap_ClipPlane -__glXDispSwap_Color3bv -__glXDispSwap_Color3dv -__glXDispSwap_Color3fv -__glXDispSwap_Color3iv -__glXDispSwap_Color3sv -__glXDispSwap_Color3ubv -__glXDispSwap_Color3uiv -__glXDispSwap_Color3usv -__glXDispSwap_Color4bv -__glXDispSwap_Color4dv -__glXDispSwap_Color4fv -__glXDispSwap_Color4iv -__glXDispSwap_Color4sv -__glXDispSwap_Color4ubv -__glXDispSwap_Color4uiv -__glXDispSwap_Color4usv -__glXDispSwap_ColorMask -__glXDispSwap_ColorMaterial -__glXDispSwap_CopyPixels -__glXDispSwap_CopyTexImage1D -__glXDispSwap_CopyTexImage2D -__glXDispSwap_CopyTexSubImage1D -__glXDispSwap_CopyTexSubImage2D -__glXDispSwap_CullFace -__glXDispSwap_DepthFunc -__glXDispSwap_DepthMask -__glXDispSwap_DepthRange -__glXDispSwap_Disable -__glXDispSwap_DrawBuffer -__glXDispSwap_EdgeFlagv -__glXDispSwap_Enable -__glXDispSwap_End -__glXDispSwap_EvalCoord1dv -__glXDispSwap_EvalCoord1fv -__glXDispSwap_EvalCoord2dv -__glXDispSwap_EvalCoord2fv -__glXDispSwap_EvalMesh1 -__glXDispSwap_EvalMesh2 -__glXDispSwap_EvalPoint1 -__glXDispSwap_EvalPoint2 -__glXDispSwap_Fogf -__glXDispSwap_Fogfv -__glXDispSwap_Fogi -__glXDispSwap_Fogiv -__glXDispSwap_FrontFace -__glXDispSwap_Frustum -__glXDispSwap_Hint -__glXDispSwap_IndexMask -__glXDispSwap_Indexdv -__glXDispSwap_Indexfv -__glXDispSwap_Indexiv -__glXDispSwap_Indexsv -__glXDispSwap_Indexubv -__glXDispSwap_InitNames -__glXDispSwap_LightModelf -__glXDispSwap_LightModelfv -__glXDispSwap_LightModeli -__glXDispSwap_LightModeliv -__glXDispSwap_Lightf -__glXDispSwap_Lightfv -__glXDispSwap_Lighti -__glXDispSwap_Lightiv -__glXDispSwap_LineStipple -__glXDispSwap_LineWidth -__glXDispSwap_ListBase -__glXDispSwap_LoadIdentity -__glXDispSwap_LoadMatrixd -__glXDispSwap_LoadMatrixf -__glXDispSwap_LoadName -__glXDispSwap_LogicOp -__glXDispSwap_MapGrid1d -__glXDispSwap_MapGrid1f -__glXDispSwap_MapGrid2d -__glXDispSwap_MapGrid2f -__glXDispSwap_Materialf -__glXDispSwap_Materialfv -__glXDispSwap_Materiali -__glXDispSwap_Materialiv -__glXDispSwap_MatrixMode -__glXDispSwap_MultMatrixd -__glXDispSwap_MultMatrixf -__glXDispSwap_Normal3bv -__glXDispSwap_Normal3dv -__glXDispSwap_Normal3fv -__glXDispSwap_Normal3iv -__glXDispSwap_Normal3sv -__glXDispSwap_Ortho -__glXDispSwap_PassThrough -__glXDispSwap_PixelMapfv -__glXDispSwap_PixelMapuiv -__glXDispSwap_PixelMapusv -__glXDispSwap_PixelTransferf -__glXDispSwap_PixelTransferi -__glXDispSwap_PixelZoom -__glXDispSwap_PointSize -__glXDispSwap_PolygonMode -__glXDispSwap_PolygonOffset -__glXDispSwap_PopAttrib -__glXDispSwap_PopMatrix -__glXDispSwap_PopName -__glXDispSwap_PrioritizeTextures -__glXDispSwap_PushAttrib -__glXDispSwap_PushMatrix -__glXDispSwap_PushName -__glXDispSwap_RasterPos2dv -__glXDispSwap_RasterPos2fv -__glXDispSwap_RasterPos2iv -__glXDispSwap_RasterPos2sv -__glXDispSwap_RasterPos3dv -__glXDispSwap_RasterPos3fv -__glXDispSwap_RasterPos3iv -__glXDispSwap_RasterPos3sv -__glXDispSwap_RasterPos4dv -__glXDispSwap_RasterPos4fv -__glXDispSwap_RasterPos4iv -__glXDispSwap_RasterPos4sv -__glXDispSwap_ReadBuffer -__glXDispSwap_Rectdv -__glXDispSwap_Rectfv -__glXDispSwap_Rectiv -__glXDispSwap_Rectsv -__glXDispSwap_Rotated -__glXDispSwap_Rotatef -__glXDispSwap_Scaled -__glXDispSwap_Scalef -__glXDispSwap_Scissor -__glXDispSwap_ShadeModel -__glXDispSwap_StencilFunc -__glXDispSwap_StencilMask -__glXDispSwap_StencilOp -__glXDispSwap_TexCoord1dv -__glXDispSwap_TexCoord1fv -__glXDispSwap_TexCoord1iv -__glXDispSwap_TexCoord1sv -__glXDispSwap_TexCoord2dv -__glXDispSwap_TexCoord2fv -__glXDispSwap_TexCoord2iv -__glXDispSwap_TexCoord2sv -__glXDispSwap_TexCoord3dv -__glXDispSwap_TexCoord3fv -__glXDispSwap_TexCoord3iv -__glXDispSwap_TexCoord3sv -__glXDispSwap_TexCoord4dv -__glXDispSwap_TexCoord4fv -__glXDispSwap_TexCoord4iv -__glXDispSwap_TexCoord4sv -__glXDispSwap_TexEnvf -__glXDispSwap_TexEnvfv -__glXDispSwap_TexEnvi -__glXDispSwap_TexEnviv -__glXDispSwap_TexGend -__glXDispSwap_TexGendv -__glXDispSwap_TexGenf -__glXDispSwap_TexGenfv -__glXDispSwap_TexGeni -__glXDispSwap_TexGeniv -__glXDispSwap_TexParameterf -__glXDispSwap_TexParameterfv -__glXDispSwap_TexParameteri -__glXDispSwap_TexParameteriv -__glXDispSwap_Translated -__glXDispSwap_Translatef -__glXDispSwap_Vertex2dv -__glXDispSwap_Vertex2fv -__glXDispSwap_Vertex2iv -__glXDispSwap_Vertex2sv -__glXDispSwap_Vertex3dv -__glXDispSwap_Vertex3fv -__glXDispSwap_Vertex3iv -__glXDispSwap_Vertex3sv -__glXDispSwap_Vertex4dv -__glXDispSwap_Vertex4fv -__glXDispSwap_Vertex4iv -__glXDispSwap_Vertex4sv -__glXDispSwap_Viewport -__glXDisp_AreTexturesResident -__glXDisp_DeleteLists -__glXDisp_DeleteTextures -__glXDisp_EndList -__glXDisp_GenLists -__glXDisp_GenTextures -__glXDisp_GetBooleanv -__glXDisp_GetDoublev -__glXDisp_GetError -__glXDisp_GetFloatv -__glXDisp_GetIntegerv -__glXDisp_GetLightfv -__glXDisp_GetLightiv -__glXDisp_GetMapdv -__glXDisp_GetMapfv -__glXDisp_GetMapiv -__glXDisp_GetMaterialfv -__glXDisp_GetMaterialiv -__glXDisp_GetPixelMapfv -__glXDisp_GetPixelMapuiv -__glXDisp_GetPixelMapusv -__glXDisp_GetTexEnvfv -__glXDisp_GetTexEnviv -__glXDisp_GetTexGendv -__glXDisp_GetTexGenfv -__glXDisp_GetTexGeniv -__glXDisp_GetTexLevelParameterfv -__glXDisp_GetTexLevelParameteriv -__glXDisp_GetTexParameterfv -__glXDisp_GetTexParameteriv -__glXDisp_IsEnabled -__glXDisp_IsList -__glXDisp_IsTexture -__glXDisp_NewList -__glXDisp_PixelStoref -__glXDisp_PixelStorei -__glXDispSwap_AreTexturesResident -__glXDispSwap_DeleteLists -__glXDispSwap_DeleteTextures -__glXDispSwap_EndList -__glXDispSwap_GenLists -__glXDispSwap_GenTextures -__glXDispSwap_GetBooleanv -__glXDispSwap_GetDoublev -__glXDispSwap_GetError -__glXDispSwap_GetFloatv -__glXDispSwap_GetIntegerv -__glXDispSwap_GetLightfv -__glXDispSwap_GetLightiv -__glXDispSwap_GetMapdv -__glXDispSwap_GetMapfv -__glXDispSwap_GetMapiv -__glXDispSwap_GetMaterialfv -__glXDispSwap_GetMaterialiv -__glXDispSwap_GetPixelMapfv -__glXDispSwap_GetPixelMapuiv -__glXDispSwap_GetPixelMapusv -__glXDispSwap_GetTexEnvfv -__glXDispSwap_GetTexEnviv -__glXDispSwap_GetTexGendv -__glXDispSwap_GetTexGenfv -__glXDispSwap_GetTexGeniv -__glXDispSwap_GetTexLevelParameterfv -__glXDispSwap_GetTexLevelParameteriv -__glXDispSwap_GetTexParameterfv -__glXDispSwap_GetTexParameteriv -__glXDispSwap_IsEnabled -__glXDispSwap_IsList -__glXDispSwap_IsTexture -__glXDispSwap_NewList -__glXDispSwap_PixelStoref -__glXDispSwap_PixelStorei - -/* $XFree86$ */ diff --git a/nx-X11/programs/Xserver/GL/glx/glxbuf.c b/nx-X11/programs/Xserver/GL/glx/glxbuf.c index 44be53614..047bc569e 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxbuf.c +++ b/nx-X11/programs/Xserver/GL/glx/glxbuf.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.c,v 1.6 2001/03/25 05:32:01 tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free diff --git a/nx-X11/programs/Xserver/GL/glx/glxbuf.h b/nx-X11/programs/Xserver/GL/glx/glxbuf.h index 88b04e8bd..9354dc4f8 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxbuf.h +++ b/nx-X11/programs/Xserver/GL/glx/glxbuf.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxcmds.c b/nx-X11/programs/Xserver/GL/glx/glxcmds.c index ca5eee82a..602b79099 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxcmds.c +++ b/nx-X11/programs/Xserver/GL/glx/glxcmds.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcmds.c,v 1.12 2004/01/28 18:11:50 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,12 +33,14 @@ ** */ -#define NEED_REPLIES #define FONT_PCF #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif +#include <string.h> +#include <assert.h> + #include "glxserver.h" #include <GL/glxtokens.h> #include <unpack.h> @@ -50,7 +51,6 @@ #include "glximports.h" #include "glxutil.h" #include "glxext.h" -#include "GL/glx_ansic.h" #include "glcontextmodes.h" /************************************************************************/ @@ -193,11 +193,11 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, /* ** Allocate memory for the new context */ - glxc = (__GLXcontext *) __glXMalloc(sizeof(__GLXcontext)); + glxc = (__GLXcontext *) malloc(sizeof(__GLXcontext)); if (!glxc) { return BadAlloc; } - __glXMemset(glxc, 0, sizeof(__GLXcontext)); + memset(glxc, 0, sizeof(__GLXcontext)); /* ** Initially, setup the part of the context that could be used by @@ -216,7 +216,7 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, imports.other = (void *)glxc; glxc->gc = (*pGlxScreen->createContext)(&imports, glxc->modes, shareGC); if (!glxc->gc) { - __glXFree(glxc); + free(glxc); client->errorValue = gcId; return BadAlloc; } @@ -229,11 +229,11 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, /* ** Register this context as a resource. */ - if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) { + if (!AddResource(gcId, __glXContextRes, (void *)glxc)) { if (!isDirect) { (*glxc->gc->exports.destroyContext)((__GLcontext *)glxc->gc); } - __glXFree(glxc); + free(glxc); client->errorValue = gcId; return BadAlloc; } @@ -335,9 +335,9 @@ static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc) ** Didn't find a free slot, so we'll have to grow the table. */ if (!num) { - table = (__GLXcontext **) __glXMalloc(sizeof(__GLXcontext *)); + table = (__GLXcontext **) malloc(sizeof(__GLXcontext *)); } else { - table = (__GLXcontext **) __glXRealloc(table, + table = (__GLXcontext **) realloc(table, (num+1)*sizeof(__GLXcontext *)); } table[num] = glxc; @@ -685,7 +685,7 @@ int DoMakeCurrent( __GLXclientState *cl, ** refcount of the X pixmap and free only if it's zero. */ (*prevglxc->readPixmap->pScreen->DestroyPixmap)(pPixmap); - __glXFree(prevglxc->readPixmap); + free(prevglxc->readPixmap); } } @@ -701,7 +701,7 @@ int DoMakeCurrent( __GLXclientState *cl, ** refcount of the X pixmap and free only if it's zero. */ (*prevglxc->drawPixmap->pScreen->DestroyPixmap)(pPixmap); - __glXFree(prevglxc->drawPixmap); + free(prevglxc->drawPixmap); } prevglxc->drawPixmap = NULL; @@ -736,7 +736,7 @@ int DoMakeCurrent( __GLXclientState *cl, if (client->swapped) { __glXSwapMakeCurrentReply(client, &reply); } else { - WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)&reply); + WriteToClient(client, sz_xGLXMakeCurrentReply, &reply); } return Success; } @@ -765,7 +765,7 @@ int __glXIsDirect(__GLXclientState *cl, GLbyte *pc) if (client->swapped) { __glXSwapIsDirectReply(client, &reply); } else { - WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply); + WriteToClient(client, sz_xGLXIsDirectReply, &reply); } return Success; @@ -783,6 +783,8 @@ int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc) (void)major; (void)minor; + memset(&reply, 0, sizeof(xGLXQueryVersionReply)); + /* ** Server should take into consideration the version numbers sent by the ** client if it wants to work with older clients; however, in this @@ -797,7 +799,7 @@ int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc) if (client->swapped) { __glXSwapQueryVersionReply(client, &reply); } else { - WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply); + WriteToClient(client, sz_xGLXQueryVersionReply, &reply); } return Success; } @@ -948,7 +950,7 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, __GLX_SWAP_INT(&reply.numProps); } - WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply); + WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply); for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) { if (modes->visualID == 0) { @@ -999,7 +1001,7 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); } WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, - (char *)buf); + buf); } return Success; } @@ -1056,7 +1058,7 @@ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap) __GLX_SWAP_INT(&reply.numAttribs); } - WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply); + WriteToClient(client, sz_xGLXGetFBConfigsReply, &reply); for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) { if (modes->visualID == 0) { @@ -1108,7 +1110,7 @@ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap) __GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH); } WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_FBCONFIG_ATTRIBS_LENGTH, - (char *)buf); + buf); } return Success; } @@ -1192,7 +1194,7 @@ int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual, return BadValue; } - pGlxPixmap = (__GLXpixmap *) __glXMalloc(sizeof(__GLXpixmap)); + pGlxPixmap = (__GLXpixmap *) malloc(sizeof(__GLXpixmap)); if (!pGlxPixmap) { return BadAlloc; } @@ -1382,7 +1384,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) reply.n = nProps; nReplyBytes = reply.length << 2; - sendBuf = (int *)__glXMalloc((size_t)nReplyBytes); + sendBuf = (int *)malloc((size_t)nReplyBytes); if (sendBuf == NULL) { return __glXBadContext; /* XXX: Is this correct? */ } @@ -1397,10 +1399,10 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) if (client->swapped) { __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf); } else { - WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply); - WriteToClient(client, nReplyBytes, (char *)sendBuf); + WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply); + WriteToClient(client, nReplyBytes, sendBuf); } - __glXFree((char *)sendBuf); + free((char *)sendBuf); return Success; } @@ -1443,7 +1445,7 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc) left = (req->length << 2) - sz_xGLXRenderReq; while (left > 0) { __GLXrenderSizeData *entry; - int extra; + int extra = 0; void (* proc)(GLbyte *); /* @@ -1454,6 +1456,9 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc) cmdlen = hdr->length; opcode = hdr->opcode; + if (left < cmdlen) + return BadLength; + /* ** Check for core opcodes and grab entry data. */ @@ -1480,22 +1485,19 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc) client->errorValue = commandsDone; return __glXBadRenderRequest; } + + if (cmdlen < entry->bytes) { + return BadLength; + } + if (entry->varsize) { /* variable size command */ - extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, False); + extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, False, left - __GLX_RENDER_HDR_SIZE); if (extra < 0) { - extra = 0; - } - if (cmdlen != __GLX_PAD(entry->bytes + extra)) { - return BadLength; - } - } else { - /* constant size command */ - if (cmdlen != __GLX_PAD(entry->bytes)) { return BadLength; } } - if (left < cmdlen) { + if (cmdlen != safe_pad(safe_add(entry->bytes, extra))) { return BadLength; } @@ -1535,6 +1537,8 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) ** duplicated there. */ + REQUEST_AT_LEAST_SIZE(xGLXRenderLargeReq); + req = (xGLXRenderLargeReq *) pc; glxc = __glXForceCurrent(cl, req->contextTag, &error); if (!glxc) { @@ -1542,12 +1546,15 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) __glXResetLargeCommandStatus(cl); return error; } + if (safe_pad(req->dataBytes) < 0) + return BadLength; + dataBytes = req->dataBytes; /* ** Check the request length. */ - if ((req->length << 2) != __GLX_PAD(dataBytes) + sz_xGLXRenderLargeReq) { + if ((req->length << 2) != safe_pad(dataBytes) + sz_xGLXRenderLargeReq) { client->errorValue = req->length; /* Reset in case this isn't 1st request. */ __glXResetLargeCommandStatus(cl); @@ -1557,7 +1564,8 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) if (cl->largeCmdRequestsSoFar == 0) { __GLXrenderSizeData *entry; - int extra, cmdlen; + int extra = 0, cmdlen; + int left = (req->length << 2) - sz_xGLXRenderLargeReq; /* ** This is the first request of a multi request command. ** Make enough space in the buffer, then copy the entire request. @@ -1567,9 +1575,13 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) return __glXBadLargeRequest; } + if (dataBytes < __GLX_RENDER_LARGE_HDR_SIZE) + return BadLength; + hdr = (__GLXrenderLargeHeader *) pc; - cmdlen = hdr->length; opcode = hdr->opcode; + if ((cmdlen = safe_pad(hdr->length)) < 0) + return BadLength; /* ** Check for core opcodes and grab entry data. @@ -1599,36 +1611,34 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) ** be computed from its parameters), all the parameters needed ** will be in the 1st request, so it's okay to do this. */ - extra = (*entry->varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE, False); + extra = (*entry->varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE, False, + left - __GLX_RENDER_LARGE_HDR_SIZE); if (extra < 0) { - extra = 0; - } - /* large command's header is 4 bytes longer, so add 4 */ - if (cmdlen != __GLX_PAD(entry->bytes + 4 + extra)) { - return BadLength; - } - } else { - /* constant size command */ - if (cmdlen != __GLX_PAD(entry->bytes + 4)) { - return BadLength; + return BadLength; } } + + /* the +4 is safe because we know entry.bytes is small */ + if (cmdlen != safe_pad(safe_add(entry->bytes + 4, extra))) { + return BadLength; + } + /* ** Make enough space in the buffer, then copy the entire request. */ if (cl->largeCmdBufSize < cmdlen) { if (!cl->largeCmdBuf) { - cl->largeCmdBuf = (GLbyte *) __glXMalloc((size_t)cmdlen); + cl->largeCmdBuf = (GLbyte *) malloc((size_t)cmdlen); } else { - cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf, - (size_t)cmdlen); + cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, + (size_t)cmdlen); } if (!cl->largeCmdBuf) { return BadAlloc; } cl->largeCmdBufSize = cmdlen; } - __glXMemcpy(cl->largeCmdBuf, pc, dataBytes); + memcpy(cl->largeCmdBuf, pc, dataBytes); cl->largeCmdBytesSoFar = dataBytes; cl->largeCmdBytesTotal = cmdlen; @@ -1641,6 +1651,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) ** We are receiving subsequent (i.e. not the first) requests of a ** multi request command. */ + int bytesSoFar; /* including this packet */ /* ** Check the request number and the total request count. @@ -1659,12 +1670,18 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) /* ** Check that we didn't get too much data. */ - if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) { + if ((bytesSoFar = safe_add(cl->largeCmdBytesSoFar, dataBytes)) < 0) { + client->errorValue = dataBytes; + __glXResetLargeCommandStatus(cl); + return __glXBadLargeRequest; + } + + if (bytesSoFar > cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } - __glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); + memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); cl->largeCmdBytesSoFar += dataBytes; cl->largeCmdRequestsSoFar++; @@ -1673,17 +1690,16 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) ** This is the last request; it must have enough bytes to complete ** the command. */ - /* NOTE: the two pad macros have been added below; they are needed - ** because the client library pads the total byte count, but not - ** the per-request byte counts. The Protocol Encoding says the - ** total byte count should not be padded, so a proposal will be - ** made to the ARB to relax the padding constraint on the total - ** byte count, thus preserving backward compatibility. Meanwhile, - ** the padding done below fixes a bug that did not allow - ** large commands of odd sizes to be accepted by the server. + /* NOTE: the pad macro below is needed because the client library + ** pads the total byte count, but not the per-request byte counts. + ** The Protocol Encoding says the total byte count should not be + ** padded, so a proposal will be made to the ARB to relax the + ** padding constraint on the total byte count, thus preserving + ** backward compatibility. Meanwhile, the padding done below + ** fixes a bug that did not allow large commands of odd sizes to + ** be accepted by the server. */ - if (__GLX_PAD(cl->largeCmdBytesSoFar) != - __GLX_PAD(cl->largeCmdBytesTotal)) { + if (safe_pad(cl->largeCmdBytesSoFar) != cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; @@ -1746,7 +1762,7 @@ static int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) if (ret == Success) { if (barrier) /* add source for cleanup when drawable is gone */ - AddResource(drawable, __glXSwapBarrierRes, (pointer)screen); + AddResource(drawable, __glXSwapBarrierRes, (void *)(intptr_t)screen); else /* delete source */ FreeResourceByType(drawable, __glXSwapBarrierRes, FALSE); @@ -1784,7 +1800,7 @@ static int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc) } WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, - (char *) &reply); + &reply); return Success; } @@ -1823,9 +1839,9 @@ static int __glxQueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&reply.npipes); } WriteToClient(client, sz_xGLXQueryHyperpipeNetworkSGIXReply, - (char *) &reply); + &reply); - WriteToClient(client, length << 2, (char *)rdata); + WriteToClient(client, length << 2, rdata); return Success; } @@ -1861,7 +1877,7 @@ static int __glxDestroyHyperpipeConfigSGIX (__GLXclientState *cl, GLbyte *pc) } WriteToClient(client, sz_xGLXDestroyHyperpipeConfigSGIXReply, - (char *) &reply); + &reply); return Success; } @@ -1902,9 +1918,9 @@ static int __glxQueryHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc) } WriteToClient(client, sz_xGLXQueryHyperpipeConfigSGIXReply, - (char *) &reply); + &reply); - WriteToClient(client, length << 2, (char *)rdata); + WriteToClient(client, length << 2, rdata); return Success; } @@ -1947,7 +1963,7 @@ static int __glxHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc) } WriteToClient(client, sz_xGLXHyperpipeConfigSGIXReply, - (char *) &reply); + &reply); return Success; } @@ -2060,26 +2076,27 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) ptr = __glXActiveScreens[screen].GLXextensions; - n = __glXStrlen(ptr) + 1; + n = strlen(ptr) + 1; length = __GLX_PAD(n) >> 2; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.length = length; reply.n = n; - if ((buf = (char *) __glXMalloc(length << 2)) == NULL) { + /* Allocate buffer to make sure it's a multiple of 4 bytes big.*/ + buf = (char *) malloc(length << 2); + if (buf == NULL) return BadAlloc; - } - __glXStrncpy(buf, ptr, n); + memcpy(buf, ptr, n); if (client->swapped) { glxSwapQueryExtensionsStringReply(client, &reply, buf); } else { - WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply); - WriteToClient(client, (int)(length << 2), (char *)buf); + WriteToClient(client, sz_xGLXQueryExtensionsStringReply,&reply); + WriteToClient(client, (int)(length << 2), buf); } - __glXFree(buf); + free(buf); return Success; } @@ -2117,26 +2134,26 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc) return BadValue; } - n = __glXStrlen(ptr) + 1; + n = strlen(ptr) + 1; length = __GLX_PAD(n) >> 2; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.length = length; reply.n = n; - if ((buf = (char *) Xalloc(length << 2)) == NULL) { + if ((buf = (char *) malloc(length << 2)) == NULL) { return BadAlloc; } - __glXStrncpy(buf, ptr, n); + memcpy(buf, ptr, n); if (client->swapped) { glxSwapQueryServerStringReply(client, &reply, buf); } else { - WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply); + WriteToClient(client, sz_xGLXQueryServerStringReply, &reply); WriteToClient(client, (int)(length << 2), buf); } - __glXFree(buf); + free(buf); return Success; } @@ -2147,9 +2164,10 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc) cl->GLClientmajorVersion = req->major; cl->GLClientminorVersion = req->minor; - if (cl->GLClientextensions) __glXFree(cl->GLClientextensions); + if (cl->GLClientextensions) + free(cl->GLClientextensions); buf = (const char *)(req+1); - cl->GLClientextensions = __glXStrdup(buf); + cl->GLClientextensions = xstrdup(buf); return Success; } diff --git a/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c b/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c index 595e814e5..98acfe5af 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c +++ b/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcmdsswap.c,v 1.10 2004/01/28 18:11:50 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #define FONT_PCF #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -49,7 +47,6 @@ #include <pixmapstr.h> #include <windowstr.h> #include "glxext.h" -#include "GL/glx_ansic.h" static int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); static int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); @@ -397,7 +394,7 @@ void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReply *reply) __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->contextTag); - WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)reply); + WriteToClient(client, sz_xGLXMakeCurrentReply, reply); } void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply) @@ -405,7 +402,7 @@ void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply) __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); - WriteToClient(client, sz_xGLXIsDirectReply, (char *)reply); + WriteToClient(client, sz_xGLXIsDirectReply, reply); } void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply) @@ -415,7 +412,7 @@ void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply) __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->majorVersion); __GLX_SWAP_INT(&reply->minorVersion); - WriteToClient(client, sz_xGLXQueryVersionReply, (char *)reply); + WriteToClient(client, sz_xGLXQueryVersionReply, reply); } void glxSwapQueryExtensionsStringReply(ClientPtr client, @@ -427,7 +424,7 @@ void glxSwapQueryExtensionsStringReply(ClientPtr client, __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *)reply); + WriteToClient(client, sz_xGLXQueryExtensionsStringReply, reply); __GLX_SWAP_INT_ARRAY((int *)buf, length); WriteToClient(client, length << 2, buf); } @@ -440,7 +437,7 @@ void glxSwapQueryServerStringReply(ClientPtr client, __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)reply); + WriteToClient(client, sz_xGLXQueryServerStringReply, reply); /** no swap is needed for an array of chars **/ /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */ WriteToClient(client, length << 2, buf); @@ -454,9 +451,9 @@ void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXT __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply); + WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, reply); __GLX_SWAP_INT_ARRAY((int *)buf, length); - WriteToClient(client, length << 2, (char *)buf); + WriteToClient(client, length << 2, buf); } @@ -498,7 +495,7 @@ int __glXSwapRender(__GLXclientState *cl, GLbyte *pc) left = (req->length << 2) - sz_xGLXRenderReq; while (left > 0) { __GLXrenderSizeData *entry; - int extra; + int extra = 0; void (* proc)(GLbyte *); /* @@ -511,6 +508,9 @@ int __glXSwapRender(__GLXclientState *cl, GLbyte *pc) cmdlen = hdr->length; opcode = hdr->opcode; + if (left < cmdlen) + return BadLength; + if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && (opcode <= __GLX_MAX_RENDER_OPCODE) ) { entry = &__glXRenderSizeTable[opcode]; @@ -531,22 +531,20 @@ int __glXSwapRender(__GLXclientState *cl, GLbyte *pc) client->errorValue = commandsDone; return __glXBadRenderRequest; } + + if (cmdlen < entry->bytes) { + return BadLength; + } + if (entry->varsize) { /* variable size command */ - extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, True); + extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, True, + left - __GLX_RENDER_HDR_SIZE); if (extra < 0) { - extra = 0; - } - if (cmdlen != __GLX_PAD(entry->bytes + extra)) { - return BadLength; - } - } else { - /* constant size command */ - if (cmdlen != __GLX_PAD(entry->bytes)) { return BadLength; } } - if (left < cmdlen) { + if (cmdlen != safe_pad(safe_add(entry->bytes, extra))) { return BadLength; } @@ -587,6 +585,8 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) ** duplicated there. */ + REQUEST_AT_LEAST_SIZE(xGLXRenderLargeReq); + req = (xGLXRenderLargeReq *) pc; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -599,12 +599,15 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) __glXResetLargeCommandStatus(cl); return error; } + if (safe_pad(req->dataBytes) < 0) + return BadLength; + dataBytes = req->dataBytes; /* ** Check the request length. */ - if ((req->length << 2) != __GLX_PAD(dataBytes) + sz_xGLXRenderLargeReq) { + if ((req->length << 2) != safe_pad(dataBytes) + sz_xGLXRenderLargeReq) { client->errorValue = req->length; /* Reset in case this isn't 1st request. */ __glXResetLargeCommandStatus(cl); @@ -614,7 +617,8 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) if (cl->largeCmdRequestsSoFar == 0) { __GLXrenderSizeData *entry; - int extra; + int extra = 0; + int left = (req->length << 2) - sz_xGLXRenderLargeReq; size_t cmdlen; /* ** This is the first request of a multi request command. @@ -624,12 +628,17 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) client->errorValue = req->requestNumber; return __glXBadLargeRequest; } + if (dataBytes < __GLX_RENDER_LARGE_HDR_SIZE) + return BadLength; + hdr = (__GLXrenderLargeHeader *) pc; __GLX_SWAP_INT(&hdr->length); __GLX_SWAP_INT(&hdr->opcode); - cmdlen = hdr->length; opcode = hdr->opcode; + if ((cmdlen = safe_pad(hdr->length)) < 0) + return BadLength; + if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && (opcode <= __GLX_MAX_RENDER_OPCODE) ) { entry = &__glXRenderSizeTable[opcode]; @@ -657,35 +666,32 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) ** be computed from its parameters), all the parameters needed ** will be in the 1st request, so it's okay to do this. */ - extra = (*entry->varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE, True); + extra = (*entry->varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE, True, + left - __GLX_RENDER_LARGE_HDR_SIZE); if (extra < 0) { - extra = 0; - } - /* large command's header is 4 bytes longer, so add 4 */ - if (cmdlen != __GLX_PAD(entry->bytes + 4 + extra)) { - return BadLength; - } - } else { - /* constant size command */ - if (cmdlen != __GLX_PAD(entry->bytes + 4)) { return BadLength; } } + /* the +4 is safe because we know entry->bytes is small */ + if (cmdlen != safe_pad(safe_add(entry->bytes + 4, extra))) { + return BadLength; + } + /* ** Make enough space in the buffer, then copy the entire request. */ if (cl->largeCmdBufSize < cmdlen) { if (!cl->largeCmdBuf) { - cl->largeCmdBuf = (GLbyte *) __glXMalloc(cmdlen); + cl->largeCmdBuf = (GLbyte *) malloc(cmdlen); } else { - cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf, cmdlen); + cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen); } if (!cl->largeCmdBuf) { return BadAlloc; } cl->largeCmdBufSize = cmdlen; } - __glXMemcpy(cl->largeCmdBuf, pc, dataBytes); + memcpy(cl->largeCmdBuf, pc, dataBytes); cl->largeCmdBytesSoFar = dataBytes; cl->largeCmdBytesTotal = cmdlen; @@ -698,6 +704,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) ** We are receiving subsequent (i.e. not the first) requests of a ** multi request command. */ + int bytesSoFar; /* including this packet */ /* ** Check the request number and the total request count. @@ -716,12 +723,18 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) /* ** Check that we didn't get too much data. */ - if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) { + if ((bytesSoFar = safe_add(cl->largeCmdBytesSoFar, dataBytes)) < 0) { + client->errorValue = dataBytes; + __glXResetLargeCommandStatus(cl); + return __glXBadLargeRequest; + } + + if (bytesSoFar > cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } - __glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); + memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); cl->largeCmdBytesSoFar += dataBytes; cl->largeCmdRequestsSoFar++; @@ -730,17 +743,17 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) ** This is the last request; it must have enough bytes to complete ** the command. */ - /* NOTE: the two pad macros have been added below; they are needed - ** because the client library pads the total byte count, but not - ** the per-request byte counts. The Protocol Encoding says the - ** total byte count should not be padded, so a proposal will be - ** made to the ARB to relax the padding constraint on the total - ** byte count, thus preserving backward compatibility. Meanwhile, - ** the padding done below fixes a bug that did not allow - ** large commands of odd sizes to be accepted by the server. + /* NOTE: the pad macro below is needed because the client library + ** pads the total byte count, but not the per-request byte counts. + ** The Protocol Encoding says the total byte count should not be + ** padded, so a proposal will be made to the ARB to relax the + ** padding constraint on the total byte count, thus preserving + ** backward compatibility. Meanwhile, the padding done below + ** fixes a bug that did not allow large commands of odd sizes to + ** be accepted by the server. */ - if (__GLX_PAD(cl->largeCmdBytesSoFar) != - __GLX_PAD(cl->largeCmdBytesTotal)) { + + if (safe_pad(cl->largeCmdBytesSoFar) != cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; @@ -797,10 +810,12 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXVendorPrivateReq *req; GLint vendorcode; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq); req = (xGLXVendorPrivateReq *) pc; __GLX_SWAP_SHORT(&req->length); @@ -835,10 +850,12 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXVendorPrivateWithReplyReq *req; GLint vendorcode; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateWithReplyReq); req = (xGLXVendorPrivateWithReplyReq *) pc; __GLX_SWAP_SHORT(&req->length); diff --git a/nx-X11/programs/Xserver/GL/glx/glxcontext.h b/nx-X11/programs/Xserver/GL/glx/glxcontext.h index 18d8b44c2..25f8daf44 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxcontext.h +++ b/nx-X11/programs/Xserver/GL/glx/glxcontext.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcontext.h,v 1.4 2002/02/22 21:45:07 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxdrawable.h b/nx-X11/programs/Xserver/GL/glx/glxdrawable.h index 38a05bfeb..a7c975a44 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxdrawable.h +++ b/nx-X11/programs/Xserver/GL/glx/glxdrawable.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxdrawable.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxerror.h b/nx-X11/programs/Xserver/GL/glx/glxerror.h index 2c6d6d863..44973fccb 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxerror.h +++ b/nx-X11/programs/Xserver/GL/glx/glxerror.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxext.c b/nx-X11/programs/Xserver/GL/glx/glxext.c index fa1382983..e92e605fa 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxext.c +++ b/nx-X11/programs/Xserver/GL/glx/glxext.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.9 2003/09/28 20:15:43 alanh Exp $ +/* ** The contents of this file are subject to the GLX Public License Version 1.0 ** (the "License"). You may not use this file except in compliance with the ** License. You may obtain a copy of the License at Silicon Graphics, Inc., @@ -18,7 +18,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -43,7 +42,6 @@ static __GLXextensionInfo *__glXExt /* = &__glDDXExtensionInfo */; /* ** Forward declarations. */ -static int __glXSwapDispatch(ClientPtr); static int __glXDispatch(ClientPtr); /* @@ -63,17 +61,18 @@ static void ResetClientState(int clientIndex) { __GLXclientState *cl = __glXClients[clientIndex]; - if (cl->returnBuf) __glXFree(cl->returnBuf); - if (cl->largeCmdBuf) __glXFree(cl->largeCmdBuf); - if (cl->currentContexts) __glXFree(cl->currentContexts); - __glXMemset(cl, 0, sizeof(__GLXclientState)); + if (cl->returnBuf) free(cl->returnBuf); + if (cl->largeCmdBuf) free(cl->largeCmdBuf); + if (cl->currentContexts) free(cl->currentContexts); + memset(cl, 0, sizeof(__GLXclientState)); /* ** By default, assume that the client supports ** GLX major version 1 minor version 0 protocol. */ cl->GLClientmajorVersion = 1; cl->GLClientminorVersion = 0; - if (cl->GLClientextensions) __glXFree(cl->GLClientextensions); + if (cl->GLClientextensions) + free(cl->GLClientextensions); } @@ -152,7 +151,7 @@ static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id) ** only if it's zero. */ (*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap); - __glXFree(pGlxPixmap); + free(pGlxPixmap); } return True; @@ -170,9 +169,9 @@ GLboolean __glXFreeContext(__GLXcontext *cx) return GL_FALSE; } } - if (cx->feedbackBuf) __glXFree(cx->feedbackBuf); - if (cx->selectBuf) __glXFree(cx->selectBuf); - __glXFree(cx); + if (cx->feedbackBuf) free(cx->feedbackBuf); + if (cx->selectBuf) free(cx->selectBuf); + free(cx); if (cx == __glXLastContext) { __glXFlushContextCache(); } @@ -246,7 +245,7 @@ void GlxExtensionInit(void) */ extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS, __GLX_NUMBER_ERRORS, __glXDispatch, - __glXSwapDispatch, ResetExtension, + __glXDispatch, ResetExtension, StandardMinorOpcode); if (!extEntry) { FatalError("__glXExtensionInit: AddExtensions failed\n"); @@ -390,6 +389,8 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag, /************************************************************************/ +#ifndef NXAGENT_SERVER + /* ** Top level dispatcher; all commands are executed from here down. */ @@ -403,12 +404,12 @@ static int __glXDispatch(ClientPtr client) opcode = stuff->glxCode; cl = __glXClients[client->index]; if (!cl) { - cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState)); + cl = (__GLXclientState *) malloc(sizeof(__GLXclientState)); __glXClients[client->index] = cl; if (!cl) { return BadAlloc; } - __glXMemset(cl, 0, sizeof(__GLXclientState)); + memset(cl, 0, sizeof(__GLXclientState)); } if (!cl->inUse) { @@ -417,7 +418,7 @@ static int __glXDispatch(ClientPtr client) ** with the client so we will be notified when the client dies. */ XID xid = FakeClientID(client->index); - if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) { + if (!AddResource( xid, __glXClientRes, (void *)(long)client->index)) { return BadAlloc; } ResetClientState(client->index); @@ -443,55 +444,15 @@ static int __glXDispatch(ClientPtr client) /* ** Use the opcode to index into the procedure table. */ - proc = __glXSingleTable[opcode]; + if (client->swapped) + proc = __glXSwapSingleTable[opcode]; + else + proc = __glXSingleTable[opcode]; return (*proc)(cl, (GLbyte *) stuff); } -static int __glXSwapDispatch(ClientPtr client) -{ - REQUEST(xGLXSingleReq); - CARD8 opcode; - int (*proc)(__GLXclientState *cl, GLbyte *pc); - __GLXclientState *cl; +#endif /* NXAGENT_SERVER */ - opcode = stuff->glxCode; - cl = __glXClients[client->index]; - if (!cl) { - cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState)); - __glXClients[client->index] = cl; - if (!cl) { - return BadAlloc; - } - __glXMemset(cl, 0, sizeof(__GLXclientState)); - } - - if (!cl->inUse) { - /* - ** This is first request from this client. Associate a resource - ** with the client so we will be notified when the client dies. - */ - XID xid = FakeClientID(client->index); - if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) { - return BadAlloc; - } - ResetClientState(client->index); - cl->inUse = GL_TRUE; - cl->client = client; - } - - /* - ** Check for valid opcode. - */ - if (opcode >= __GLX_SINGLE_TABLE_SIZE) { - return BadRequest; - } - - /* - ** Use the opcode to index into the procedure table. - */ - proc = __glXSwapSingleTable[opcode]; - return (*proc)(cl, (GLbyte *) stuff); -} int __glXNoSuchSingleOpcode(__GLXclientState *cl, GLbyte *pc) { diff --git a/nx-X11/programs/Xserver/GL/glx/glxext.h b/nx-X11/programs/Xserver/GL/glx/glxext.h index 5d569899f..edb65a5f3 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxext.h +++ b/nx-X11/programs/Xserver/GL/glx/glxext.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxext.h,v 1.7 2003/11/17 22:20:26 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxfb.c b/nx-X11/programs/Xserver/GL/glx/glxfb.c index 0d433d25d..13f02d448 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxfb.c +++ b/nx-X11/programs/Xserver/GL/glx/glxfb.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -130,7 +129,7 @@ Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) FreeScratchGC(bufferInfo->pGC); } - __glXFree(bufferInfo); + free(bufferInfo); buf->other = NULL; } @@ -173,7 +172,7 @@ __glXInitFB(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits) buf->free = Free; /* allocate local information */ - bufferInfo = (__GLFBbufferInfo *) __glXMalloc(sizeof(__GLFBbufferInfo)); + bufferInfo = (__GLFBbufferInfo *) malloc(sizeof(__GLFBbufferInfo)); buf->other = (void *) bufferInfo; pGC = CreateScratchGC(glxPriv->pDraw->pScreen, diff --git a/nx-X11/programs/Xserver/GL/glx/glxfb.h b/nx-X11/programs/Xserver/GL/glx/glxfb.h index 325146d43..f414728f3 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxfb.h +++ b/nx-X11/programs/Xserver/GL/glx/glxfb.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glximports.c b/nx-X11/programs/Xserver/GL/glx/glximports.c index fae2346b9..fb4d508a9 100644 --- a/nx-X11/programs/Xserver/GL/glx/glximports.c +++ b/nx-X11/programs/Xserver/GL/glx/glximports.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glximports.c,v 1.5 2001/03/21 16:29:36 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -38,10 +37,13 @@ #include <dix-config.h> #endif +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + #include "glxserver.h" #include "glxcontext.h" #include "glximports.h" -#include "GL/glx_ansic.h" void *__glXImpMalloc(__GLcontext *gc, size_t size) { @@ -50,7 +52,7 @@ void *__glXImpMalloc(__GLcontext *gc, size_t size) if (size == 0) { return NULL; } - addr = xalloc(size); + addr = malloc(size); if (addr == NULL) { /* XXX: handle out of memory error */ return NULL; @@ -67,13 +69,13 @@ void *__glXImpCalloc(__GLcontext *gc, size_t numElements, size_t elementSize) return NULL; } size = numElements * elementSize; - addr = xalloc(size); + addr = malloc(size); if (addr == NULL) { /* XXX: handle out of memory error */ return NULL; } /* zero out memory */ - __glXMemset(addr, 0, size); + memset(addr, 0, size); return addr; } @@ -81,7 +83,7 @@ void *__glXImpCalloc(__GLcontext *gc, size_t numElements, size_t elementSize) void __glXImpFree(__GLcontext *gc, void *addr) { if (addr) { - xfree(addr); + free(addr); } } @@ -91,15 +93,15 @@ void *__glXImpRealloc(__GLcontext *gc, void *addr, size_t newSize) if (addr) { if (newSize == 0) { - xfree(addr); + free(addr); return NULL; } - newAddr = xrealloc(addr, newSize); + newAddr = realloc(addr, newSize); } else { if (newSize == 0) { return NULL; } - newAddr = xalloc(newSize); + newAddr = malloc(newSize); } if (newAddr == NULL) { return NULL; /* XXX: out of memory error */ @@ -110,23 +112,23 @@ void *__glXImpRealloc(__GLcontext *gc, void *addr, size_t newSize) void __glXImpWarning(__GLcontext *gc, char *msg) { - ErrorF((char *)msg); + ErrorF("%s",(char *)msg); } void __glXImpFatal(__GLcontext *gc, char *msg) { - ErrorF((char *)msg); - __glXAbort(); + ErrorF("%s",(char *)msg); + abort(); } char *__glXImpGetenv(__GLcontext *gc, const char *var) { - return __glXGetenv(var); + return getenv(var); } int __glXImpAtoi(__GLcontext *gc, const char *str) { - return __glXAtoi(str); + return atoi(str); } int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...) @@ -136,7 +138,7 @@ int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...) /* have to deal with var args */ va_start(ap, fmt); - ret = __glXVsprintf(str, fmt, ap); + ret = vsprintf(str, fmt, ap); va_end(ap); return ret; @@ -144,12 +146,12 @@ int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...) void *__glXImpFopen(__GLcontext *gc, const char *path, const char *mode) { - return (void *) __glXFopen(path, mode); + return (void *) fopen(path, mode); } int __glXImpFclose(__GLcontext *gc, void *stream) { - return __glXFclose((FILE *)stream); + return fclose((FILE *)stream); } int __glXImpFprintf(__GLcontext *gc, void *stream, const char *fmt, ...) @@ -159,7 +161,7 @@ int __glXImpFprintf(__GLcontext *gc, void *stream, const char *fmt, ...) /* have to deal with var args */ va_start(ap, fmt); - ret = __glXVfprintf((FILE *)stream, fmt, ap); + ret = vfprintf((FILE *)stream, fmt, ap); va_end(ap); return ret; diff --git a/nx-X11/programs/Xserver/GL/glx/glximports.h b/nx-X11/programs/Xserver/GL/glx/glximports.h index ef485822e..f57004b34 100644 --- a/nx-X11/programs/Xserver/GL/glx/glximports.h +++ b/nx-X11/programs/Xserver/GL/glx/glximports.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glximports.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxmem.c b/nx-X11/programs/Xserver/GL/glx/glxmem.c index 21a7c7962..e1487da94 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxmem.c +++ b/nx-X11/programs/Xserver/GL/glx/glxmem.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.c,v 1.6 2001/10/31 22:50:27 tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free diff --git a/nx-X11/programs/Xserver/GL/glx/glxmem.h b/nx-X11/programs/Xserver/GL/glx/glxmem.h index 06720dfdf..b4116dfa9 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxmem.h +++ b/nx-X11/programs/Xserver/GL/glx/glxmem.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxpix.c b/nx-X11/programs/Xserver/GL/glx/glxpix.c index 98c033c98..81e29a9c5 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxpix.c +++ b/nx-X11/programs/Xserver/GL/glx/glxpix.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.c,v 1.3 2000/09/26 15:57:02 tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -96,7 +95,7 @@ Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) FreeScratchGC(bufferInfo->pGC); } - __glXFree(bufferInfo); + free(bufferInfo); buf->other = NULL; } @@ -124,7 +123,7 @@ __glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, buf->free = Free; /* allocate local information */ - bufferInfo = (__GLPixBufferInfo *) __glXMalloc(sizeof(__GLPixBufferInfo)); + bufferInfo = (__GLPixBufferInfo *) malloc(sizeof(__GLPixBufferInfo)); buf->other = (void *) bufferInfo; bufferInfo->pGC = CreateScratchGC(pGlxPixmap->pDraw->pScreen, diff --git a/nx-X11/programs/Xserver/GL/glx/glxpix.h b/nx-X11/programs/Xserver/GL/glx/glxpix.h index 4b16352b4..285cf490c 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxpix.h +++ b/nx-X11/programs/Xserver/GL/glx/glxpix.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/glxscreens.c b/nx-X11/programs/Xserver/GL/glx/glxscreens.c index 58b38b1a2..1bff4bc3a 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxscreens.c +++ b/nx-X11/programs/Xserver/GL/glx/glxscreens.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.14 2004/02/09 23:46:31 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -38,12 +37,8 @@ #include <dix-config.h> #endif -#ifdef IN_MODULE -#include <xf86_ansic.h> -#else #include <string.h> #include <signal.h> -#endif #include <windowstr.h> @@ -293,7 +288,7 @@ static void wrapPositionWindow(int screen) void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs) { if (__glXNumHyperpipeFuncs < screen + 1) { - __glXHyperpipeFuncs = __glXRealloc(__glXHyperpipeFuncs, + __glXHyperpipeFuncs = realloc(__glXHyperpipeFuncs, (screen+1) * sizeof(__GLXHyperpipeExtensionFuncs)); __glXNumHyperpipeFuncs = screen + 1; } @@ -311,7 +306,7 @@ void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs) void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs) { if (__glXNumSwapBarrierFuncs < screen + 1) { - __glXSwapBarrierFuncs = __glXRealloc(__glXSwapBarrierFuncs, + __glXSwapBarrierFuncs = realloc(__glXSwapBarrierFuncs, (screen+1) * sizeof(__GLXSwapBarrierExtensionFuncs)); __glXNumSwapBarrierFuncs = screen + 1; } @@ -332,7 +327,7 @@ void __glXScreenInit(GLint numscreens) ** This alloc has to work or else the server might as well core dump. */ __glXActiveScreens = - (__GLXscreenInfo *) __glXMalloc(sizeof(__GLXscreenInfo) * numscreens); + (__GLXscreenInfo *) malloc(sizeof(__GLXscreenInfo) * numscreens); for (i=0; i < numscreens; i++) { /* @@ -343,10 +338,10 @@ void __glXScreenInit(GLint numscreens) __glXActiveScreens[i] = *__glXScreens[j]; __glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals; - __glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions); - __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName); - __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion); - __glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions); + __glXActiveScreens[i].GLextensions = strdup(GLServerExtensions); + __glXActiveScreens[i].GLXvendor = strdup(GLXServerVendorName); + __glXActiveScreens[i].GLXversion = strdup(GLXServerVersion); + __glXActiveScreens[i].GLXextensions = strdup(GLXServerExtensions); __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone); wrapPositionWindow(i); @@ -361,14 +356,14 @@ void __glXScreenReset(void) int i; for (i = 0; i < __glXNumActiveScreens; i++) { - __glXFree(__glXActiveScreens[i].GLXvendor); - __glXFree(__glXActiveScreens[i].GLXversion); - __glXFree(__glXActiveScreens[i].GLXextensions); - __glXFree(__glXActiveScreens[i].GLextensions); + free(__glXActiveScreens[i].GLXvendor); + free(__glXActiveScreens[i].GLXversion); + free(__glXActiveScreens[i].GLXextensions); + free(__glXActiveScreens[i].GLextensions); } - xfree(__glXActiveScreens); - xfree(__glXHyperpipeFuncs); - xfree(__glXSwapBarrierFuncs); + free(__glXActiveScreens); + free(__glXHyperpipeFuncs); + free(__glXSwapBarrierFuncs); __glXNumHyperpipeFuncs = 0; __glXNumSwapBarrierFuncs = 0; __glXHyperpipeFuncs = NULL; diff --git a/nx-X11/programs/Xserver/GL/glx/glxscreens.h b/nx-X11/programs/Xserver/GL/glx/glxscreens.h index 2d68c8b60..dae21e9c9 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxscreens.h +++ b/nx-X11/programs/Xserver/GL/glx/glxscreens.h @@ -5,7 +5,6 @@ #ifndef _GLX_screens_h_ #define _GLX_screens_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.h,v 1.4 2001/03/21 16:29:37 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free diff --git a/nx-X11/programs/Xserver/GL/glx/glxserver.h b/nx-X11/programs/Xserver/GL/glx/glxserver.h index e8449b2bb..2debc8435 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxserver.h +++ b/nx-X11/programs/Xserver/GL/glx/glxserver.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxserver.h,v 1.5 2003/09/28 20:15:43 alanh Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -41,9 +40,9 @@ ** */ -#include <X11/X.h> -#include <X11/Xproto.h> -#include <X11/Xmd.h> +#include <nx-X11/X.h> +#include <nx-X11/Xproto.h> +#include <nx-X11/Xmd.h> #include <misc.h> #include <dixstruct.h> #include <pixmapstr.h> @@ -51,9 +50,9 @@ #include <extnsionst.h> #include <resource.h> #include <scrnintstr.h> -#include "GL/glx_ansic.h" - +#include "protocol-versions.h" +#include <limits.h> /* ** The X header misc.h defines these math functions. */ @@ -74,8 +73,8 @@ typedef struct __GLXdrawablePrivateRec __GLXdrawablePrivate; #include "glxerror.h" -#define GLX_SERVER_MAJOR_VERSION 1 -#define GLX_SERVER_MINOR_VERSION 2 +#define GLX_SERVER_MAJOR_VERSION SERVER_GLX_MAJOR_VERSION +#define GLX_SERVER_MINOR_VERSION SERVER_GLX_MINOR_VERSION #ifndef True #define True 1 @@ -178,7 +177,7 @@ extern __GLXprocPtr __glXProcTable[]; */ typedef struct { int bytes; - int (*varsize)(GLbyte *pc, Bool swap); + int (*varsize)(GLbyte *pc, Bool swap, int left); } __GLXrenderSizeData; extern __GLXrenderSizeData __glXRenderSizeTable[]; extern __GLXrenderSizeData __glXRenderSizeTable_EXT[]; @@ -223,6 +222,46 @@ extern void glxSwapQueryServerStringReply(ClientPtr client, /* * Routines for computing the size of variably-sized rendering commands. */ +static __inline__ int +safe_add(int a, int b) +{ + if (a < 0 || b < 0) + return -1; + + if (INT_MAX - a < b) + return -1; + + return a + b; +} + +static __inline__ int +safe_mul(int a, int b) +{ + if (a < 0 || b < 0) + return -1; + + if (a == 0 || b == 0) + return 0; + + if (a > INT_MAX / b) + return -1; + + return a * b; +} + +static __inline__ int +safe_pad(int a) +{ + int ret; + + if (a < 0) + return -1; + + if ((ret = safe_add(a, 3)) < 0) + return -1; + + return ret & (GLuint)~3; +} extern int __glXTypeSize(GLenum enm); extern int __glXImageSize(GLenum format, GLenum type, @@ -230,48 +269,48 @@ extern int __glXImageSize(GLenum format, GLenum type, GLint imageHeight, GLint rowLength, GLint skipImages, GLint skipRows, GLint alignment); -extern int __glXCallListsReqSize(GLbyte *pc, Bool swap); -extern int __glXBitmapReqSize(GLbyte *pc, Bool swap); -extern int __glXFogfvReqSize(GLbyte *pc, Bool swap); -extern int __glXFogivReqSize(GLbyte *pc, Bool swap); -extern int __glXLightfvReqSize(GLbyte *pc, Bool swap); -extern int __glXLightivReqSize(GLbyte *pc, Bool swap); -extern int __glXLightModelfvReqSize(GLbyte *pc, Bool swap); -extern int __glXLightModelivReqSize(GLbyte *pc, Bool swap); -extern int __glXMaterialfvReqSize(GLbyte *pc, Bool swap); -extern int __glXMaterialivReqSize(GLbyte *pc, Bool swap); -extern int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap); -extern int __glXTexParameterivReqSize(GLbyte *pc, Bool swap); -extern int __glXTexImage1DReqSize(GLbyte *pc, Bool swap); -extern int __glXTexImage2DReqSize(GLbyte *pc, Bool swap); -extern int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap); -extern int __glXTexEnvivReqSize(GLbyte *pc, Bool swap); -extern int __glXTexGendvReqSize(GLbyte *pc, Bool swap); -extern int __glXTexGenfvReqSize(GLbyte *pc, Bool swap); -extern int __glXTexGenivReqSize(GLbyte *pc, Bool swap); -extern int __glXMap1dReqSize(GLbyte *pc, Bool swap); -extern int __glXMap1fReqSize(GLbyte *pc, Bool swap); -extern int __glXMap2dReqSize(GLbyte *pc, Bool swap); -extern int __glXMap2fReqSize(GLbyte *pc, Bool swap); -extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap); -extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap); -extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap); -extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap); -extern int __glXDrawArraysSize(GLbyte *pc, Bool swap); -extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap); -extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap); -extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap); -extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap ); -extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap); -extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap); -extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap); -extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap); -extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap); -extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap); -extern int __glXColorTableReqSize(GLbyte *pc, Bool swap); -extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap); -extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap); -extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap); +extern int __glXCallListsReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXBitmapReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXFogfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXFogivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXLightfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXLightivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXLightModelfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXLightModelivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXMaterialfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXMaterialivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexParameterivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexImage1DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexImage2DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexEnvivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexGendvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexGenfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexGenivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXMap1dReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXMap1fReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXMap2dReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXMap2fReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXDrawArraysSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap, int reqlen ); +extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXColorTableReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap, int reqlen); /* * Routines for computing the size of returned data. @@ -281,7 +320,7 @@ extern int __glXConvolutionParameterfvSize(GLenum pname); extern int __glXColorTableParameterfvSize(GLenum pname); extern int __glXColorTableParameterivSize(GLenum pname); -extern int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap); -extern int __glXPointParameterivReqSize(GLbyte *pc, Bool swap); +extern int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap, int reqlen); +extern int __glXPointParameterivReqSize(GLbyte *pc, Bool swap, int reqlen); #endif /* !__GLX_server_h__ */ diff --git a/nx-X11/programs/Xserver/GL/glx/glxutil.c b/nx-X11/programs/Xserver/GL/glx/glxutil.c index 03bc19f63..b4cd10a84 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxutil.c +++ b/nx-X11/programs/Xserver/GL/glx/glxutil.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,12 +33,13 @@ ** */ -#define NEED_REPLIES #define FONT_PCF #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif +#include <string.h> + #include "glxserver.h" #include <GL/glxtokens.h> #include <unpack.h> @@ -47,7 +47,6 @@ #include <windowstr.h> #include "glxutil.h" #include "glxbuf.h" -#include "GL/glx_ansic.h" #include "GL/internal/glcore.h" #include "GL/glxint.h" #include "glcontextmodes.h" @@ -58,81 +57,8 @@ void __glXNop(void) {} /************************************************************************/ -/* Memory Allocation for GLX */ - -void * -__glXMalloc(size_t size) -{ - void *addr; - - if (size == 0) { - return NULL; - } - addr = (void *) xalloc(size); - if (addr == NULL) { - /* XXX: handle out of memory error */ - return NULL; - } - return addr; -} - -void * -__glXCalloc(size_t numElements, size_t elementSize) -{ - void *addr; - size_t size; - - if ((numElements == 0) || (elementSize == 0)) { - return NULL; - } - size = numElements * elementSize; - addr = (void *) xalloc(size); - if (addr == NULL) { - /* XXX: handle out of memory error */ - return NULL; - } - __glXMemset(addr, 0, size); - return addr; -} - -void * -__glXRealloc(void *addr, size_t newSize) -{ - void *newAddr; - - if (addr) { - if (newSize == 0) { - xfree(addr); - return NULL; - } else { - newAddr = xrealloc(addr, newSize); - } - } else { - if (newSize == 0) { - return NULL; - } else { - newAddr = xalloc(newSize); - } - } - if (newAddr == NULL) { - return NULL; /* XXX: out of memory */ - } - - return newAddr; -} - -void -__glXFree(void *addr) -{ - if (addr) { - xfree(addr); - } -} - -/************************************************************************/ /* Context stuff */ - /* ** associate a context with a drawable */ @@ -299,8 +225,8 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId, __GLdrawablePrivate *glPriv; __GLXscreenInfo *pGlxScreen; - glxPriv = (__GLXdrawablePrivate *) __glXMalloc(sizeof(*glxPriv)); - __glXMemset(glxPriv, 0, sizeof(__GLXdrawablePrivate)); + glxPriv = (__GLXdrawablePrivate *) malloc(sizeof(*glxPriv)); + memset(glxPriv, 0, sizeof(__GLXdrawablePrivate)); glxPriv->type = pDraw->type; glxPriv->pDraw = pDraw; @@ -312,18 +238,18 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId, /* since we are creating the drawablePrivate, drawId should be new */ if (!AddResource(drawId, __glXDrawableRes, glxPriv)) { /* oops! */ - __glXFree(glxPriv); + free(glxPriv); return NULL; } /* fill up glPriv */ glPriv = &glxPriv->glPriv; - glPriv->modes = (__GLcontextModes *) __glXMalloc(sizeof(__GLcontextModes)); + glPriv->modes = (__GLcontextModes *) malloc(sizeof(__GLcontextModes)); *glPriv->modes = *modes; - glPriv->malloc = __glXMalloc; - glPriv->calloc = __glXCalloc; - glPriv->realloc = __glXRealloc; - glPriv->free = __glXFree; + glPriv->malloc = malloc; + glPriv->calloc = calloc; + glPriv->realloc = realloc; + glPriv->free = free; glPriv->addSwapRect = NULL; glPriv->setClipRect = (void (*)(__GLdrawablePrivate *, GLint, GLint, GLsizei, GLsizei)) __glXNop; glPriv->lockDP = LockDP; @@ -334,7 +260,7 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId, /* allocate a one-rect ownership region */ glPriv->ownershipRegion.rects = - (__GLregionRect *)__glXCalloc(1, sizeof(__GLregionRect)); + (__GLregionRect *)calloc(1, sizeof(__GLregionRect)); glPriv->ownershipRegion.numRects = 1; glxPriv->freeBuffers = __glXFreeBuffers; @@ -377,9 +303,9 @@ __glXDestroyDrawablePrivate(__GLXdrawablePrivate *glxPriv) } /* Free the drawable Private */ - __glXFree(glxPriv->glPriv.modes); - __glXFree(glxPriv->glPriv.ownershipRegion.rects); - __glXFree(glxPriv); + free(glxPriv->glPriv.modes); + free(glxPriv->glPriv.ownershipRegion.rects); + free(glxPriv); return GL_TRUE; } diff --git a/nx-X11/programs/Xserver/GL/glx/glxutil.h b/nx-X11/programs/Xserver/GL/glx/glxutil.h index 2c3090a46..a0a2e57b7 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxutil.h +++ b/nx-X11/programs/Xserver/GL/glx/glxutil.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.h,v 1.3 2001/03/21 16:29:37 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -43,12 +42,6 @@ extern void __glXNop(void); -/* memory management */ -extern void *__glXMalloc(size_t size); -extern void *__glXCalloc(size_t numElements, size_t elementSize); -extern void *__glXRealloc(void *addr, size_t newSize); -extern void __glXFree(void *ptr); - /* relate contexts with drawables */ extern void __glXAssociateContext(__GLXcontext *glxc); extern void __glXDeassociateContext(__GLXcontext *glxc); diff --git a/nx-X11/programs/Xserver/GL/glx/impsize.h b/nx-X11/programs/Xserver/GL/glx/impsize.h index 0eaebb6d5..53777c6e3 100644 --- a/nx-X11/programs/Xserver/GL/glx/impsize.h +++ b/nx-X11/programs/Xserver/GL/glx/impsize.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/impsize.h,v 1.4 2003/09/28 20:15:43 alanh Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/module/Imakefile b/nx-X11/programs/Xserver/GL/glx/module/Imakefile deleted file mode 100644 index d063bc28d..000000000 --- a/nx-X11/programs/Xserver/GL/glx/module/Imakefile +++ /dev/null @@ -1,4 +0,0 @@ -#define IHaveModules -#define LinkDirectory .. - -#include "../Imakefile" diff --git a/nx-X11/programs/Xserver/GL/glx/render2.c b/nx-X11/programs/Xserver/GL/glx/render2.c index f4491b276..1336e2591 100644 --- a/nx-X11/programs/Xserver/GL/glx/render2.c +++ b/nx-X11/programs/Xserver/GL/glx/render2.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.8 2004/02/03 23:04:08 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -/* #define NEED_REPLIES */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/render2.c.NX.original b/nx-X11/programs/Xserver/GL/glx/render2.c.NX.original deleted file mode 100644 index f4491b276..000000000 --- a/nx-X11/programs/Xserver/GL/glx/render2.c.NX.original +++ /dev/null @@ -1,271 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.8 2004/02/03 23:04:08 alanh Exp $ */ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -*/ - -/* #define NEED_REPLIES */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <glxserver.h> -#include "unpack.h" -#include "g_disptab.h" -#include "g_disptab_EXT.h" -#include "indirect_size.h" - -void __glXDisp_Map1f(GLbyte *pc) -{ - GLint order, k; - GLfloat u1, u2, *points; - GLenum target; - - target = *(GLenum *)(pc + 0); - order = *(GLint *)(pc + 12); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - points = (GLfloat *)(pc + 16); - k = __glMap1f_size(target); - - glMap1f(target, u1, u2, k, order, points); -} - -void __glXDisp_Map2f(GLbyte *pc) -{ - GLint uorder, vorder, ustride, vstride, k; - GLfloat u1, u2, v1, v2, *points; - GLenum target; - - target = *(GLenum *)(pc + 0); - uorder = *(GLint *)(pc + 12); - vorder = *(GLint *)(pc + 24); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - v1 = *(GLfloat *)(pc + 16); - v2 = *(GLfloat *)(pc + 20); - points = (GLfloat *)(pc + 28); - - k = __glMap2f_size(target); - ustride = vorder * k; - vstride = k; - - glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDisp_Map1d(GLbyte *pc) -{ - GLint order, k; -#ifdef __GLX_ALIGN64 - GLint compsize; -#endif - GLenum target; - GLdouble u1, u2, *points; - - target = *(GLenum*) (pc + 16); - order = *(GLint*) (pc + 20); - k = __glMap1d_size(target); - -#ifdef __GLX_ALIGN64 - if (order < 0 || k < 0) { - compsize = 0; - } else { - compsize = order * k; - } -#endif - - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - pc += 24; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap1d(target, u1, u2, k, order, points); -} - -void __glXDisp_Map2d(GLbyte *pc) -{ - GLdouble u1, u2, v1, v2, *points; - GLint uorder, vorder, ustride, vstride, k; -#ifdef __GLX_ALIGN64 - GLint compsize; -#endif - GLenum target; - - target = *(GLenum *)(pc + 32); - uorder = *(GLint *)(pc + 36); - vorder = *(GLint *)(pc + 40); - k = __glMap2d_size(target); - -#ifdef __GLX_ALIGN64 - if (vorder < 0 || uorder < 0 || k < 0) { - compsize = 0; - } else { - compsize = uorder * vorder * k; - } -#endif - - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - __GLX_GET_DOUBLE(v1,pc+16); - __GLX_GET_DOUBLE(v2,pc+24); - pc += 44; - - ustride = vorder * k; - vstride = k; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDisp_CallLists(GLbyte *pc) -{ - GLenum type; - GLsizei n; - - type = *(GLenum *)(pc + 4); - n = *(GLsizei *)(pc + 0); - glCallLists(n, type, pc + 8); -} - -void __glXDisp_DrawArrays(GLbyte *pc) -{ - __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc; - __GLXdispatchDrawArraysComponentHeader *compHeader; - GLint numVertexes = hdr->numVertexes; - GLint numComponents = hdr->numComponents; - GLenum primType = hdr->primType; - GLint stride = 0; - int i; - - pc += sizeof(__GLXdispatchDrawArraysHeader); - compHeader = (__GLXdispatchDrawArraysComponentHeader *)pc; - - /* compute stride (same for all component arrays) */ - for (i = 0; i < numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - - stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); - - /* set up component arrays */ - for (i = 0; i < numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - GLenum component = compHeader[i].component; - - switch (component) { - case GL_VERTEX_ARRAY: - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(numVals, datatype, stride, pc); - break; - case GL_NORMAL_ARRAY: - glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(datatype, stride, pc); - break; - case GL_COLOR_ARRAY: - glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(numVals, datatype, stride, pc); - break; - case GL_INDEX_ARRAY: - glEnableClientState(GL_INDEX_ARRAY); - glIndexPointer(datatype, stride, pc); - break; - case GL_TEXTURE_COORD_ARRAY: - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(numVals, datatype, stride, pc); - break; - case GL_EDGE_FLAG_ARRAY: - glEnableClientState(GL_EDGE_FLAG_ARRAY); - glEdgeFlagPointer(stride, (const GLboolean *)pc); - break; - case GL_SECONDARY_COLOR_ARRAY: - glEnableClientState(GL_SECONDARY_COLOR_ARRAY); - glSecondaryColorPointer(numVals, datatype, stride, pc); - break; - case GL_FOG_COORD_ARRAY: - glEnableClientState(GL_FOG_COORD_ARRAY); - glFogCoordPointer(datatype, stride, pc); - break; - default: - break; - } - - pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - glDrawArrays(primType, 0, numVertexes); - - /* turn off anything we might have turned on */ - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - glDisableClientState(GL_INDEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_EDGE_FLAG_ARRAY); - glDisableClientState(GL_SECONDARY_COLOR_ARRAY); - glDisableClientState(GL_FOG_COORD_ARRAY); -} - -void __glXDisp_DrawArraysEXT(GLbyte *pc) -{ - __glXDisp_DrawArrays(pc); -} diff --git a/nx-X11/programs/Xserver/GL/glx/render2.c.X.original b/nx-X11/programs/Xserver/GL/glx/render2.c.X.original deleted file mode 100644 index 39d0c132a..000000000 --- a/nx-X11/programs/Xserver/GL/glx/render2.c.X.original +++ /dev/null @@ -1,271 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.8 2004/02/03 23:04:08 alanh Exp $ */ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -*/ - -/* #define NEED_REPLIES */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <glxserver.h> -#include "unpack.h" -#include "g_disptab.h" -#include "g_disptab_EXT.h" - - -void __glXDisp_Map1f(GLbyte *pc) -{ - GLint order, k; - GLfloat u1, u2, *points; - GLenum target; - - target = *(GLenum *)(pc + 0); - order = *(GLint *)(pc + 12); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - points = (GLfloat *)(pc + 16); - k = __glMap1f_size(target); - - glMap1f(target, u1, u2, k, order, points); -} - -void __glXDisp_Map2f(GLbyte *pc) -{ - GLint uorder, vorder, ustride, vstride, k; - GLfloat u1, u2, v1, v2, *points; - GLenum target; - - target = *(GLenum *)(pc + 0); - uorder = *(GLint *)(pc + 12); - vorder = *(GLint *)(pc + 24); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - v1 = *(GLfloat *)(pc + 16); - v2 = *(GLfloat *)(pc + 20); - points = (GLfloat *)(pc + 28); - - k = __glMap2f_size(target); - ustride = vorder * k; - vstride = k; - - glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDisp_Map1d(GLbyte *pc) -{ - GLint order, k; -#ifdef __GLX_ALIGN64 - GLint compsize; -#endif - GLenum target; - GLdouble u1, u2, *points; - - target = *(GLenum*) (pc + 16); - order = *(GLint*) (pc + 20); - k = __glMap1d_size(target); - -#ifdef __GLX_ALIGN64 - if (order < 0 || k < 0) { - compsize = 0; - } else { - compsize = order * k; - } -#endif - - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - pc += 24; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap1d(target, u1, u2, k, order, points); -} - -void __glXDisp_Map2d(GLbyte *pc) -{ - GLdouble u1, u2, v1, v2, *points; - GLint uorder, vorder, ustride, vstride, k; -#ifdef __GLX_ALIGN64 - GLint compsize; -#endif - GLenum target; - - target = *(GLenum *)(pc + 32); - uorder = *(GLint *)(pc + 36); - vorder = *(GLint *)(pc + 40); - k = __glMap2d_size(target); - -#ifdef __GLX_ALIGN64 - if (vorder < 0 || uorder < 0 || k < 0) { - compsize = 0; - } else { - compsize = uorder * vorder * k; - } -#endif - - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - __GLX_GET_DOUBLE(v1,pc+16); - __GLX_GET_DOUBLE(v2,pc+24); - pc += 44; - - ustride = vorder * k; - vstride = k; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDisp_CallLists(GLbyte *pc) -{ - GLenum type; - GLsizei n; - - type = *(GLenum *)(pc + 4); - n = *(GLsizei *)(pc + 0); - glCallLists(n, type, pc + 8); -} - -void __glXDisp_DrawArrays(GLbyte *pc) -{ - __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc; - __GLXdispatchDrawArraysComponentHeader *compHeader; - GLint numVertexes = hdr->numVertexes; - GLint numComponents = hdr->numComponents; - GLenum primType = hdr->primType; - GLint stride = 0; - int i; - - pc += sizeof(__GLXdispatchDrawArraysHeader); - compHeader = (__GLXdispatchDrawArraysComponentHeader *)pc; - - /* compute stride (same for all component arrays) */ - for (i = 0; i < numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - - stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); - - /* set up component arrays */ - for (i = 0; i < numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - GLenum component = compHeader[i].component; - - switch (component) { - case GL_VERTEX_ARRAY: - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(numVals, datatype, stride, pc); - break; - case GL_NORMAL_ARRAY: - glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(datatype, stride, pc); - break; - case GL_COLOR_ARRAY: - glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(numVals, datatype, stride, pc); - break; - case GL_INDEX_ARRAY: - glEnableClientState(GL_INDEX_ARRAY); - glIndexPointer(datatype, stride, pc); - break; - case GL_TEXTURE_COORD_ARRAY: - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(numVals, datatype, stride, pc); - break; - case GL_EDGE_FLAG_ARRAY: - glEnableClientState(GL_EDGE_FLAG_ARRAY); - glEdgeFlagPointer(stride, (const GLboolean *)pc); - break; - case GL_SECONDARY_COLOR_ARRAY: - glEnableClientState(GL_SECONDARY_COLOR_ARRAY); - glSecondaryColorPointer(numVals, datatype, stride, pc); - break; - case GL_FOG_COORD_ARRAY: - glEnableClientState(GL_FOG_COORD_ARRAY); - glFogCoordPointer(datatype, stride, pc); - break; - default: - break; - } - - pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - glDrawArrays(primType, 0, numVertexes); - - /* turn off anything we might have turned on */ - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - glDisableClientState(GL_INDEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_EDGE_FLAG_ARRAY); - glDisableClientState(GL_SECONDARY_COLOR_ARRAY); - glDisableClientState(GL_FOG_COORD_ARRAY); -} - -void __glXDisp_DrawArraysEXT(GLbyte *pc) -{ - __glXDisp_DrawArrays(pc); -} diff --git a/nx-X11/programs/Xserver/GL/glx/render2swap.c b/nx-X11/programs/Xserver/GL/glx/render2swap.c index 0225970cb..ea35d514d 100644 --- a/nx-X11/programs/Xserver/GL/glx/render2swap.c +++ b/nx-X11/programs/Xserver/GL/glx/render2swap.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.6 2002/01/14 22:47:08 tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -/* #define NEED_REPLIES */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/render2swap.c.NX.original b/nx-X11/programs/Xserver/GL/glx/render2swap.c.NX.original deleted file mode 100644 index 0225970cb..000000000 --- a/nx-X11/programs/Xserver/GL/glx/render2swap.c.NX.original +++ /dev/null @@ -1,393 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.6 2002/01/14 22:47:08 tsi Exp $ */ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -*/ - -/* #define NEED_REPLIES */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "glxserver.h" -#include "unpack.h" -#include "g_disptab.h" -#include "g_disptab_EXT.h" -#include "indirect_size.h" - -void __glXDispSwap_Map1f(GLbyte *pc) -{ - GLint order, k; - GLfloat u1, u2, *points; - GLenum target; - GLint compsize; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - - target = *(GLenum *)(pc + 0); - order = *(GLint *)(pc + 12); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - points = (GLfloat *)(pc + 16); - k = __glMap1f_size(target); - - if (order <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = order * k; - } - __GLX_SWAP_FLOAT_ARRAY(points, compsize); - - glMap1f(target, u1, u2, k, order, points); -} - -void __glXDispSwap_Map2f(GLbyte *pc) -{ - GLint uorder, vorder, ustride, vstride, k; - GLfloat u1, u2, v1, v2, *points; - GLenum target; - GLint compsize; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 24); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - __GLX_SWAP_FLOAT(pc + 16); - __GLX_SWAP_FLOAT(pc + 20); - - target = *(GLenum *)(pc + 0); - uorder = *(GLint *)(pc + 12); - vorder = *(GLint *)(pc + 24); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - v1 = *(GLfloat *)(pc + 16); - v2 = *(GLfloat *)(pc + 20); - points = (GLfloat *)(pc + 28); - - k = __glMap2f_size(target); - ustride = vorder * k; - vstride = k; - - if (vorder <= 0 || uorder <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = uorder * vorder * k; - } - __GLX_SWAP_FLOAT_ARRAY(points, compsize); - - glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDispSwap_Map1d(GLbyte *pc) -{ - GLint order, k, compsize; - GLenum target; - GLdouble u1, u2, *points; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_INT(pc + 16); - __GLX_SWAP_INT(pc + 20); - - target = *(GLenum*) (pc + 16); - order = *(GLint*) (pc + 20); - k = __glMap1d_size(target); - if (order <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = order * k; - } - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - __GLX_SWAP_DOUBLE_ARRAY(pc+24, compsize); - pc += 24; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap1d(target, u1, u2, k, order, points); -} - -void __glXDispSwap_Map2d(GLbyte *pc) -{ - GLdouble u1, u2, v1, v2, *points; - GLint uorder, vorder, ustride, vstride, k, compsize; - GLenum target; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_DOUBLE(pc + 16); - __GLX_SWAP_DOUBLE(pc + 24); - __GLX_SWAP_INT(pc + 32); - __GLX_SWAP_INT(pc + 36); - __GLX_SWAP_INT(pc + 40); - - target = *(GLenum *)(pc + 32); - uorder = *(GLint *)(pc + 36); - vorder = *(GLint *)(pc + 40); - k = __glMap2d_size(target); - if (vorder <= 0 || uorder <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = uorder * vorder * k; - } - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - __GLX_GET_DOUBLE(v1,pc+16); - __GLX_GET_DOUBLE(v2,pc+24); - __GLX_SWAP_DOUBLE_ARRAY(pc+44, compsize); - pc += 44; - ustride = vorder * k; - vstride = k; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDispSwap_CallLists(GLbyte *pc) -{ - GLenum type; - GLsizei n; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 0); - type = *(GLenum *)(pc + 4); - n = *(GLsizei *)(pc + 0); - - switch (type) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - case GL_2_BYTES: - case GL_3_BYTES: - case GL_4_BYTES: - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - __GLX_SWAP_SHORT_ARRAY(pc+8, n); - break; - case GL_INT: - case GL_UNSIGNED_INT: - __GLX_SWAP_INT_ARRAY(pc+8, n); - break; - case GL_FLOAT: - __GLX_SWAP_FLOAT_ARRAY(pc+8, n); - break; - } - - glCallLists(n, type, pc+8); -} - -static void swapArray(GLint numVals, GLenum datatype, - GLint stride, GLint numVertexes, GLbyte *pc) -{ - int i,j; - __GLX_DECLARE_SWAP_VARIABLES; - - switch (datatype) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - /* don't need to swap */ - return; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - for (i=0; i<numVertexes; i++) { - GLshort *pVal = (GLshort *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_SHORT(&pVal[j]); - } - pc += stride; - } - break; - case GL_INT: - case GL_UNSIGNED_INT: - for (i=0; i<numVertexes; i++) { - GLint *pVal = (GLint *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_INT(&pVal[j]); - } - pc += stride; - } - break; - case GL_FLOAT: - for (i=0; i<numVertexes; i++) { - GLfloat *pVal = (GLfloat *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_FLOAT(&pVal[j]); - } - pc += stride; - } - break; - case GL_DOUBLE: - for (i=0; i<numVertexes; i++) { - GLdouble *pVal = (GLdouble *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_DOUBLE(&pVal[j]); - } - pc += stride; - } - break; - default: - return; - } -} - -void __glXDispSwap_DrawArrays(GLbyte *pc) -{ - __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc; - __GLXdispatchDrawArraysComponentHeader *compHeader; - GLint numVertexes = hdr->numVertexes; - GLint numComponents = hdr->numComponents; - GLenum primType = hdr->primType; - GLint stride = 0; - int i; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(&numVertexes); - __GLX_SWAP_INT(&numComponents); - __GLX_SWAP_INT(&primType); - - pc += sizeof(__GLXdispatchDrawArraysHeader); - compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; - - /* compute stride (same for all component arrays) */ - for (i=0; i<numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - GLenum component = compHeader[i].component; - - __GLX_SWAP_INT(&datatype); - __GLX_SWAP_INT(&numVals); - __GLX_SWAP_INT(&component); - - stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); - - /* set up component arrays */ - for (i=0; i<numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - GLenum component = compHeader[i].component; - - swapArray(numVals, datatype, stride, numVertexes, pc); - - switch (component) { - case GL_VERTEX_ARRAY: - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(numVals, datatype, stride, pc); - break; - case GL_NORMAL_ARRAY: - glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(datatype, stride, pc); - break; - case GL_COLOR_ARRAY: - glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(numVals, datatype, stride, pc); - break; - case GL_INDEX_ARRAY: - glEnableClientState(GL_INDEX_ARRAY); - glIndexPointer(datatype, stride, pc); - break; - case GL_TEXTURE_COORD_ARRAY: - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(numVals, datatype, stride, pc); - break; - case GL_EDGE_FLAG_ARRAY: - glEnableClientState(GL_EDGE_FLAG_ARRAY); - glEdgeFlagPointer(stride, (const GLboolean *)pc); - break; - default: - break; - } - - pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - glDrawArrays(primType, 0, numVertexes); - - /* turn off anything we might have turned on */ - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - glDisableClientState(GL_INDEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_EDGE_FLAG_ARRAY); -} - -void __glXDispSwap_DrawArraysEXT(GLbyte *pc) -{ - __glXDispSwap_DrawArrays(pc); -} diff --git a/nx-X11/programs/Xserver/GL/glx/render2swap.c.X.original b/nx-X11/programs/Xserver/GL/glx/render2swap.c.X.original deleted file mode 100644 index 65ac5e18a..000000000 --- a/nx-X11/programs/Xserver/GL/glx/render2swap.c.X.original +++ /dev/null @@ -1,393 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.6 2002/01/14 22:47:08 tsi Exp $ */ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -*/ - -/* #define NEED_REPLIES */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "glxserver.h" -#include "unpack.h" -#include "g_disptab.h" -#include "g_disptab_EXT.h" - - -void __glXDispSwap_Map1f(GLbyte *pc) -{ - GLint order, k; - GLfloat u1, u2, *points; - GLenum target; - GLint compsize; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - - target = *(GLenum *)(pc + 0); - order = *(GLint *)(pc + 12); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - points = (GLfloat *)(pc + 16); - k = __glMap1f_size(target); - - if (order <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = order * k; - } - __GLX_SWAP_FLOAT_ARRAY(points, compsize); - - glMap1f(target, u1, u2, k, order, points); -} - -void __glXDispSwap_Map2f(GLbyte *pc) -{ - GLint uorder, vorder, ustride, vstride, k; - GLfloat u1, u2, v1, v2, *points; - GLenum target; - GLint compsize; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 24); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - __GLX_SWAP_FLOAT(pc + 16); - __GLX_SWAP_FLOAT(pc + 20); - - target = *(GLenum *)(pc + 0); - uorder = *(GLint *)(pc + 12); - vorder = *(GLint *)(pc + 24); - u1 = *(GLfloat *)(pc + 4); - u2 = *(GLfloat *)(pc + 8); - v1 = *(GLfloat *)(pc + 16); - v2 = *(GLfloat *)(pc + 20); - points = (GLfloat *)(pc + 28); - - k = __glMap2f_size(target); - ustride = vorder * k; - vstride = k; - - if (vorder <= 0 || uorder <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = uorder * vorder * k; - } - __GLX_SWAP_FLOAT_ARRAY(points, compsize); - - glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDispSwap_Map1d(GLbyte *pc) -{ - GLint order, k, compsize; - GLenum target; - GLdouble u1, u2, *points; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_INT(pc + 16); - __GLX_SWAP_INT(pc + 20); - - target = *(GLenum*) (pc + 16); - order = *(GLint*) (pc + 20); - k = __glMap1d_size(target); - if (order <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = order * k; - } - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - __GLX_SWAP_DOUBLE_ARRAY(pc+24, compsize); - pc += 24; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap1d(target, u1, u2, k, order, points); -} - -void __glXDispSwap_Map2d(GLbyte *pc) -{ - GLdouble u1, u2, v1, v2, *points; - GLint uorder, vorder, ustride, vstride, k, compsize; - GLenum target; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_DOUBLE(pc + 16); - __GLX_SWAP_DOUBLE(pc + 24); - __GLX_SWAP_INT(pc + 32); - __GLX_SWAP_INT(pc + 36); - __GLX_SWAP_INT(pc + 40); - - target = *(GLenum *)(pc + 32); - uorder = *(GLint *)(pc + 36); - vorder = *(GLint *)(pc + 40); - k = __glMap2d_size(target); - if (vorder <= 0 || uorder <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } else { - compsize = uorder * vorder * k; - } - __GLX_GET_DOUBLE(u1,pc); - __GLX_GET_DOUBLE(u2,pc+8); - __GLX_GET_DOUBLE(v1,pc+16); - __GLX_GET_DOUBLE(v2,pc+24); - __GLX_SWAP_DOUBLE_ARRAY(pc+44, compsize); - pc += 44; - ustride = vorder * k; - vstride = k; - -#ifdef __GLX_ALIGN64 - if (((unsigned long)pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc-4, pc, compsize*8); - points = (GLdouble*) (pc - 4); - } else { - points = (GLdouble*) pc; - } -#else - points = (GLdouble*) pc; -#endif - glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -void __glXDispSwap_CallLists(GLbyte *pc) -{ - GLenum type; - GLsizei n; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 0); - type = *(GLenum *)(pc + 4); - n = *(GLsizei *)(pc + 0); - - switch (type) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - case GL_2_BYTES: - case GL_3_BYTES: - case GL_4_BYTES: - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - __GLX_SWAP_SHORT_ARRAY(pc+8, n); - break; - case GL_INT: - case GL_UNSIGNED_INT: - __GLX_SWAP_INT_ARRAY(pc+8, n); - break; - case GL_FLOAT: - __GLX_SWAP_FLOAT_ARRAY(pc+8, n); - break; - } - - glCallLists(n, type, pc+8); -} - -static void swapArray(GLint numVals, GLenum datatype, - GLint stride, GLint numVertexes, GLbyte *pc) -{ - int i,j; - __GLX_DECLARE_SWAP_VARIABLES; - - switch (datatype) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - /* don't need to swap */ - return; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - for (i=0; i<numVertexes; i++) { - GLshort *pVal = (GLshort *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_SHORT(&pVal[j]); - } - pc += stride; - } - break; - case GL_INT: - case GL_UNSIGNED_INT: - for (i=0; i<numVertexes; i++) { - GLint *pVal = (GLint *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_INT(&pVal[j]); - } - pc += stride; - } - break; - case GL_FLOAT: - for (i=0; i<numVertexes; i++) { - GLfloat *pVal = (GLfloat *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_FLOAT(&pVal[j]); - } - pc += stride; - } - break; - case GL_DOUBLE: - for (i=0; i<numVertexes; i++) { - GLdouble *pVal = (GLdouble *) pc; - for (j=0; j<numVals; j++) { - __GLX_SWAP_DOUBLE(&pVal[j]); - } - pc += stride; - } - break; - default: - return; - } -} - -void __glXDispSwap_DrawArrays(GLbyte *pc) -{ - __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc; - __GLXdispatchDrawArraysComponentHeader *compHeader; - GLint numVertexes = hdr->numVertexes; - GLint numComponents = hdr->numComponents; - GLenum primType = hdr->primType; - GLint stride = 0; - int i; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(&numVertexes); - __GLX_SWAP_INT(&numComponents); - __GLX_SWAP_INT(&primType); - - pc += sizeof(__GLXdispatchDrawArraysHeader); - compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; - - /* compute stride (same for all component arrays) */ - for (i=0; i<numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - GLenum component = compHeader[i].component; - - __GLX_SWAP_INT(&datatype); - __GLX_SWAP_INT(&numVals); - __GLX_SWAP_INT(&component); - - stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); - - /* set up component arrays */ - for (i=0; i<numComponents; i++) { - GLenum datatype = compHeader[i].datatype; - GLint numVals = compHeader[i].numVals; - GLenum component = compHeader[i].component; - - swapArray(numVals, datatype, stride, numVertexes, pc); - - switch (component) { - case GL_VERTEX_ARRAY: - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(numVals, datatype, stride, pc); - break; - case GL_NORMAL_ARRAY: - glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(datatype, stride, pc); - break; - case GL_COLOR_ARRAY: - glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(numVals, datatype, stride, pc); - break; - case GL_INDEX_ARRAY: - glEnableClientState(GL_INDEX_ARRAY); - glIndexPointer(datatype, stride, pc); - break; - case GL_TEXTURE_COORD_ARRAY: - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(numVals, datatype, stride, pc); - break; - case GL_EDGE_FLAG_ARRAY: - glEnableClientState(GL_EDGE_FLAG_ARRAY); - glEdgeFlagPointer(stride, (const GLboolean *)pc); - break; - default: - break; - } - - pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); - } - - glDrawArrays(primType, 0, numVertexes); - - /* turn off anything we might have turned on */ - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - glDisableClientState(GL_INDEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_EDGE_FLAG_ARRAY); -} - -void __glXDispSwap_DrawArraysEXT(GLbyte *pc) -{ - __glXDispSwap_DrawArrays(pc); -} diff --git a/nx-X11/programs/Xserver/GL/glx/renderpix.c b/nx-X11/programs/Xserver/GL/glx/renderpix.c index fe508e299..d1997b5ad 100644 --- a/nx-X11/programs/Xserver/GL/glx/renderpix.c +++ b/nx-X11/programs/Xserver/GL/glx/renderpix.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/renderpixswap.c b/nx-X11/programs/Xserver/GL/glx/renderpixswap.c index 9c3100fb3..a527a859a 100644 --- a/nx-X11/programs/Xserver/GL/glx/renderpixswap.c +++ b/nx-X11/programs/Xserver/GL/glx/renderpixswap.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/rensize.c b/nx-X11/programs/Xserver/GL/glx/rensize.c index 7ab02d257..d3a819cd5 100644 --- a/nx-X11/programs/Xserver/GL/glx/rensize.c +++ b/nx-X11/programs/Xserver/GL/glx/rensize.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/rensize.c,v 1.6 2003/09/28 20:15:43 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -48,7 +47,7 @@ (((a & 0xff000000U)>>24) | ((a & 0xff0000U)>>8) | \ ((a & 0xff00U)<<8) | ((a & 0xffU)<<24)) -int __glXCallListsReqSize(GLbyte *pc, Bool swap ) +int __glXCallListsReqSize(GLbyte *pc, Bool swap, int reqlen) { GLsizei n = *(GLsizei *)(pc + 0); GLenum type = *(GLenum *)(pc + 4); @@ -60,7 +59,7 @@ int __glXCallListsReqSize(GLbyte *pc, Bool swap ) return n * __glCallLists_size( type ); } -int __glXFogivReqSize(GLbyte *pc, Bool swap ) +int __glXFogivReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 0); if (swap) { @@ -69,12 +68,12 @@ int __glXFogivReqSize(GLbyte *pc, Bool swap ) return 4 * __glFogiv_size( pname ); /* defined in samplegl lib */ } -int __glXFogfvReqSize(GLbyte *pc, Bool swap ) +int __glXFogfvReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXFogivReqSize( pc, swap ); + return __glXFogivReqSize( pc, swap, reqlen); } -int __glXLightfvReqSize(GLbyte *pc, Bool swap ) +int __glXLightfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -83,12 +82,12 @@ int __glXLightfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glLightfv_size( pname ); /* defined in samplegl lib */ } -int __glXLightivReqSize(GLbyte *pc, Bool swap ) +int __glXLightivReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXLightfvReqSize( pc, swap ); + return __glXLightfvReqSize( pc, swap, reqlen); } -int __glXLightModelfvReqSize(GLbyte *pc, Bool swap ) +int __glXLightModelfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 0); if (swap) { @@ -97,12 +96,12 @@ int __glXLightModelfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glLightModelfv_size( pname ); /* defined in samplegl lib */ } -int __glXLightModelivReqSize(GLbyte *pc, Bool swap ) +int __glXLightModelivReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXLightModelfvReqSize( pc, swap ); + return __glXLightModelfvReqSize( pc, swap, reqlen); } -int __glXMaterialfvReqSize(GLbyte *pc, Bool swap ) +int __glXMaterialfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -111,12 +110,12 @@ int __glXMaterialfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glMaterialfv_size( pname ); /* defined in samplegl lib */ } -int __glXMaterialivReqSize(GLbyte *pc, Bool swap ) +int __glXMaterialivReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXMaterialfvReqSize( pc, swap ); + return __glXMaterialfvReqSize( pc, swap, reqlen); } -int __glXTexGendvReqSize(GLbyte *pc, Bool swap ) +int __glXTexGendvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -125,7 +124,7 @@ int __glXTexGendvReqSize(GLbyte *pc, Bool swap ) return 8 * __glTexGendv_size( pname ); /* defined in samplegl lib */ } -int __glXTexGenfvReqSize(GLbyte *pc, Bool swap ) +int __glXTexGenfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -134,12 +133,12 @@ int __glXTexGenfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glTexGenfv_size( pname ); /* defined in samplegl lib */ } -int __glXTexGenivReqSize(GLbyte *pc, Bool swap ) +int __glXTexGenivReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXTexGenfvReqSize( pc, swap ); + return __glXTexGenfvReqSize( pc, swap, reqlen); } -int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap ) +int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -148,12 +147,12 @@ int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glTexParameterfv_size( pname ); /* defined in samplegl lib */ } -int __glXTexParameterivReqSize(GLbyte *pc, Bool swap ) +int __glXTexParameterivReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXTexParameterfvReqSize( pc, swap ); + return __glXTexParameterfvReqSize( pc, swap, reqlen); } -int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap ) +int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -162,21 +161,15 @@ int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glTexEnvfv_size( pname ); /* defined in samplegl lib */ } -int __glXTexEnvivReqSize(GLbyte *pc, Bool swap ) +int __glXTexEnvivReqSize(GLbyte *pc, Bool swap, int reqlen ) { - return __glXTexEnvfvReqSize( pc, swap ); + return __glXTexEnvfvReqSize( pc, swap, reqlen); } -static int Map1Size( GLint k, GLint order) -{ - if (order <= 0 || k < 0) return -1; - return k * order; -} - -int __glXMap1dReqSize(GLbyte *pc, Bool swap ) +int __glXMap1dReqSize(GLbyte *pc, Bool swap, int reqlen ) { GLenum target; - GLint order, k; + GLint order; target = *(GLenum*) (pc + 16); order = *(GLint*) (pc + 20); @@ -184,14 +177,15 @@ int __glXMap1dReqSize(GLbyte *pc, Bool swap ) target = SWAPL( target ); order = SWAPL( order ); } - k = __glMap1d_size( target ); - return 8 * Map1Size( k, order ); + if (order < 1) + return -1; + return safe_mul(8, safe_mul(__glMap1d_size(target), order)); } -int __glXMap1fReqSize(GLbyte *pc, Bool swap ) +int __glXMap1fReqSize(GLbyte *pc, Bool swap, int reqlen ) { GLenum target; - GLint order, k; + GLint order; target = *(GLenum *)(pc + 0); order = *(GLint *)(pc + 12); @@ -199,20 +193,21 @@ int __glXMap1fReqSize(GLbyte *pc, Bool swap ) target = SWAPL( target ); order = SWAPL( order ); } - k = __glMap1f_size(target); - return 4 * Map1Size(k, order); + if (order < 1) + return -1; + return safe_mul(4, safe_mul(__glMap1f_size(target), order)); } static int Map2Size(int k, int majorOrder, int minorOrder) { - if (majorOrder <= 0 || minorOrder <= 0 || k < 0) return -1; - return k * majorOrder * minorOrder; + if (majorOrder < 1 || minorOrder < 1) return -1; + return safe_mul(k, safe_mul(majorOrder, minorOrder)); } -int __glXMap2dReqSize(GLbyte *pc, Bool swap ) +int __glXMap2dReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum target; - GLint uorder, vorder, k; + GLint uorder, vorder; target = *(GLenum *)(pc + 32); uorder = *(GLint *)(pc + 36); @@ -222,14 +217,13 @@ int __glXMap2dReqSize(GLbyte *pc, Bool swap ) uorder = SWAPL( uorder ); vorder = SWAPL( vorder ); } - k = __glMap2d_size( target ); - return 8 * Map2Size( k, uorder, vorder ); + return safe_mul(8, Map2Size(__glMap2d_size(target), uorder, vorder)); } -int __glXMap2fReqSize(GLbyte *pc, Bool swap ) +int __glXMap2fReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum target; - GLint uorder, vorder, k; + GLint uorder, vorder; target = *(GLenum *)(pc + 0); uorder = *(GLint *)(pc + 12); @@ -239,11 +233,10 @@ int __glXMap2fReqSize(GLbyte *pc, Bool swap ) uorder = SWAPL( uorder ); vorder = SWAPL( vorder ); } - k = __glMap2f_size( target ); - return 4 * Map2Size( k, uorder, vorder ); + return safe_mul(4, Map2Size(__glMap2f_size(target), uorder, vorder)); } -int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap ) +int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLint mapsize; mapsize = *(GLint *)(pc + 4); @@ -253,12 +246,12 @@ int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap ) return 4 * mapsize; } -int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap ) +int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXPixelMapfvReqSize( pc, swap ); + return __glXPixelMapfvReqSize( pc, swap, reqlen); } -int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap ) +int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLint mapsize; mapsize = *(GLint *)(pc + 4); @@ -315,13 +308,16 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target, GLint bytesPerElement, elementsPerGroup, groupsPerRow; GLint groupSize, rowSize, padding, imageSize; + if (w == 0 || h == 0 || d == 0) + return 0; + if (w < 0 || h < 0 || d < 0 || (type == GL_BITMAP && (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) { return -1; } - if (w==0 || h==0 || d == 0) return 0; + /* proxy targets have no data */ switch( target ) { case GL_PROXY_TEXTURE_1D: case GL_PROXY_TEXTURE_2D: @@ -338,6 +334,12 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target, return 0; } + /* real data has to have real sizes */ + if (imageHeight < 0 || rowLength < 0 || skipImages < 0 || skipRows < 0) + return -1; + if (alignment != 1 && alignment != 2 && alignment != 4 && alignment != 8) + return -1; + if (type == GL_BITMAP) { if (rowLength > 0) { groupsPerRow = rowLength; @@ -345,11 +347,13 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target, groupsPerRow = w; } rowSize = (groupsPerRow + 7) >> 3; + if (rowSize < 0) + return -1; padding = (rowSize % alignment); if (padding) { rowSize += alignment - padding; } - return ((h + skipRows) * rowSize); + return safe_mul(safe_add(h, skipRows), rowSize); } else { switch(format) { case GL_COLOR_INDEX: @@ -430,28 +434,30 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target, default: return -1; } + /* known safe by the switches above, not checked */ groupSize = bytesPerElement * elementsPerGroup; if (rowLength > 0) { groupsPerRow = rowLength; } else { groupsPerRow = w; } - rowSize = groupsPerRow * groupSize; + if ((rowSize = safe_mul(groupsPerRow, groupSize)) < 0) + return -1; padding = (rowSize % alignment); if (padding) { rowSize += alignment - padding; } - if (imageHeight > 0) { - imageSize = (imageHeight + skipRows) * rowSize; - } else { - imageSize = (h + skipRows) * rowSize; - } - return ((d + skipImages) * imageSize); + if (imageHeight > 0) + h = imageHeight; + h = safe_add(h, skipRows); + + imageSize = safe_mul(h, rowSize); + return safe_mul(safe_add(d, skipImages), imageSize); } } -int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap ) +int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; GLenum format = hdr->format; @@ -475,7 +481,7 @@ int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, skipRows, alignment ); } -int __glXBitmapReqSize(GLbyte *pc, Bool swap ) +int __glXBitmapReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc; GLint w = hdr->width; @@ -495,7 +501,7 @@ int __glXBitmapReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, skipRows, alignment ); } -int __glXTexImage1DReqSize(GLbyte *pc, Bool swap ) +int __glXTexImage1DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; GLenum target = hdr->target; @@ -524,7 +530,7 @@ int __glXTexImage1DReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, skipRows, alignment ); } -int __glXTexImage2DReqSize(GLbyte *pc, Bool swap ) +int __glXTexImage2DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; GLenum target = hdr->target; @@ -571,13 +577,14 @@ int __glXTypeSize(GLenum enm) } } -int __glXDrawArraysSize( GLbyte *pc, Bool swap ) +int __glXDrawArraysSize( GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc; __GLXdispatchDrawArraysComponentHeader *compHeader; GLint numVertexes = hdr->numVertexes; GLint numComponents = hdr->numComponents; GLint arrayElementSize = 0; + GLint x, size; int i; if (swap) { @@ -586,6 +593,13 @@ int __glXDrawArraysSize( GLbyte *pc, Bool swap ) } pc += sizeof(__GLXdispatchDrawArraysHeader); + reqlen -= sizeof(__GLXdispatchDrawArraysHeader); + + size = safe_mul(sizeof(__GLXdispatchDrawArraysComponentHeader), + numComponents); + if (size < 0 || reqlen < 0 || reqlen < size) + return -1; + compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; for (i=0; i<numComponents; i++) { @@ -629,23 +643,24 @@ int __glXDrawArraysSize( GLbyte *pc, Bool swap ) return -1; } - arrayElementSize += __GLX_PAD(numVals * __glXTypeSize(datatype)); + x = safe_pad(safe_mul(numVals, __glXTypeSize(datatype))); + if ((arrayElementSize = safe_add(arrayElementSize, x)) < 0) + return -1; pc += sizeof(__GLXdispatchDrawArraysComponentHeader); } - return ((numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader)) + - (numVertexes * arrayElementSize)); + return safe_add(size, safe_mul(numVertexes, arrayElementSize)); } -int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap ) +int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap, int reqlen) { GLint n = *(GLsizei *)(pc + 0); if (swap) n = SWAPL(n); return(8*n); /* 4*n for textures, 4*n for priorities */ } -int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap ) +int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; GLenum format = hdr->format; @@ -667,7 +682,7 @@ int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, skipRows, alignment ); } -int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap ) +int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; GLenum format = hdr->format; @@ -691,7 +706,7 @@ int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, skipRows, alignment ); } -int __glXTexImage3DReqSize(GLbyte *pc, Bool swap ) +int __glXTexImage3DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; GLenum target = hdr->target; @@ -728,7 +743,7 @@ int __glXTexImage3DReqSize(GLbyte *pc, Bool swap ) } } -int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap ) +int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexSubImage3DHeader *hdr = (__GLXdispatchTexSubImage3DHeader *) pc; @@ -765,7 +780,7 @@ int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap ) } } -int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap ) +int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; @@ -788,7 +803,7 @@ int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, 0, alignment ); } -int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap ) +int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; @@ -834,7 +849,7 @@ int __glXConvolutionParameterfvSize(GLenum pname) return __glXConvolutionParameterivSize(pname); } -int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap ) +int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -843,12 +858,12 @@ int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap ) return 4 * __glXConvolutionParameterivSize( pname ); } -int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap ) +int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen) { - return __glXConvolutionParameterivReqSize( pc, swap ); + return __glXConvolutionParameterivReqSize( pc, swap, reqlen); } -int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap ) +int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; @@ -873,10 +888,9 @@ int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap ) /* XXX Should rowLength be used for either or both image? */ image1size = __glXImageSize( format, type, 0, w, 1, 1, 0, rowLength, 0, 0, alignment ); - image1size = __GLX_PAD(image1size); image2size = __glXImageSize( format, type, 0, h, 1, 1, 0, rowLength, 0, 0, alignment ); - return image1size + image2size; + return safe_add(safe_pad(image1size), image2size); } @@ -898,7 +912,7 @@ int __glXColorTableParameterivSize(GLenum pname) return __glXColorTableParameterfvSize(pname); } -int __glXColorTableReqSize(GLbyte *pc, Bool swap ) +int __glXColorTableReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchColorTableHeader *hdr = (__GLXdispatchColorTableHeader *) pc; @@ -933,7 +947,7 @@ int __glXColorTableReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, 0, alignment ); } -int __glXColorSubTableReqSize(GLbyte *pc, Bool swap ) +int __glXColorSubTableReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchColorSubTableHeader *hdr = (__GLXdispatchColorSubTableHeader *) pc; @@ -956,7 +970,7 @@ int __glXColorSubTableReqSize(GLbyte *pc, Bool swap ) 0, rowLength, 0, 0, alignment ); } -int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap ) +int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { @@ -965,13 +979,13 @@ int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap ) return 4 * __glXColorTableParameterfvSize(pname); } -int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap ) +int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap, int reqlen) { /* no difference between fv and iv versions */ - return __glXColorTableParameterfvReqSize(pc, swap); + return __glXColorTableParameterfvReqSize(pc, swap, reqlen); } -int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap ) +int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 0); if (swap) { @@ -980,8 +994,8 @@ int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap ) return 4 * __glPointParameterfvEXT_size( pname ); } -int __glXPointParameterivReqSize(GLbyte *pc, Bool swap ) +int __glXPointParameterivReqSize(GLbyte *pc, Bool swap, int reqlen) { /* no difference between fv and iv versions */ - return __glXPointParameterfvARBReqSize(pc, swap); + return __glXPointParameterfvARBReqSize(pc, swap, reqlen); } diff --git a/nx-X11/programs/Xserver/GL/glx/rensizetab.c b/nx-X11/programs/Xserver/GL/glx/rensizetab.c index 41656890c..9d5abe844 100644 --- a/nx-X11/programs/Xserver/GL/glx/rensizetab.c +++ b/nx-X11/programs/Xserver/GL/glx/rensizetab.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/rensizetab.c,v 1.5 2004/01/28 18:11:53 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free diff --git a/nx-X11/programs/Xserver/GL/glx/single2.c b/nx-X11/programs/Xserver/GL/glx/single2.c index 9fee5ff49..47ba628af 100644 --- a/nx-X11/programs/Xserver/GL/glx/single2.c +++ b/nx-X11/programs/Xserver/GL/glx/single2.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/single2.c,v 1.8 2004/02/10 22:54:15 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,25 +33,30 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif +#include <string.h> +#include <stdio.h> +#include <stdlib.h> + #include "glxserver.h" #include "glxutil.h" #include "glxext.h" #include "unpack.h" #include "g_disptab.h" -#include "GL/glx_ansic.h" int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; GLsizei size; GLenum type; __GLXcontext *cx; int error; + REQUEST_FIXED_SIZE(xGLXSingleReq, 8); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -62,7 +66,7 @@ int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) size = *(GLsizei *)(pc+0); type = *(GLenum *)(pc+4); if (cx->feedbackBufSize < size) { - cx->feedbackBuf = (GLfloat *) __glXRealloc(cx->feedbackBuf, + cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf, (size_t)size * __GLX_SIZE_FLOAT32); if (!cx->feedbackBuf) { @@ -78,10 +82,12 @@ int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; __GLXcontext *cx; GLsizei size; int error; + REQUEST_FIXED_SIZE(xGLXSingleReq, 4); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -90,7 +96,7 @@ int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc) pc += __GLX_SINGLE_HDR_SIZE; size = *(GLsizei *)(pc+0); if (cx->selectBufSize < size) { - cx->selectBuf = (GLuint *) __glXRealloc(cx->selectBuf, + cx->selectBuf = (GLuint *) realloc(cx->selectBuf, (size_t) size * __GLX_SIZE_CARD32); if (!cx->selectBuf) { @@ -106,7 +112,7 @@ int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc) int __glXDisp_RenderMode(__GLXclientState *cl, GLbyte *pc) { - ClientPtr client; + ClientPtr client = cl->client; xGLXRenderModeReply reply; __GLXcontext *cx; GLint nitems=0, retBytes=0, retval, newModeCheck; @@ -114,6 +120,8 @@ int __glXDisp_RenderMode(__GLXclientState *cl, GLbyte *pc) GLenum newMode; int error; + REQUEST_FIXED_SIZE(xGLXSingleReq, 4); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -188,25 +196,26 @@ int __glXDisp_RenderMode(__GLXclientState *cl, GLbyte *pc) ** selection array, as per the API for glRenderMode itself. */ noChangeAllowed:; - client = cl->client; reply.length = nitems; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.retval = retval; reply.size = nitems; reply.newMode = newMode; - WriteToClient(client, sz_xGLXRenderModeReply, (char *)&reply); + WriteToClient(client, sz_xGLXRenderModeReply, &reply); if (retBytes) { - WriteToClient(client, retBytes, (char *)retBuffer); + WriteToClient(client, retBytes, retBuffer); } return Success; } int __glXDisp_Flush(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; __GLXcontext *cx; int error; + REQUEST_SIZE_MATCH(xGLXSingleReq); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -219,10 +228,11 @@ int __glXDisp_Flush(__GLXclientState *cl, GLbyte *pc) int __glXDisp_Finish(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; __GLXcontext *cx; - ClientPtr client; int error; + REQUEST_SIZE_MATCH(xGLXSingleReq); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -233,7 +243,6 @@ int __glXDisp_Finish(__GLXclientState *cl, GLbyte *pc) __GLX_NOTE_FLUSHED_CMDS(cx); /* Send empty reply packet to indicate finish is finished */ - client = cl->client; __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); return Success; @@ -258,24 +267,30 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string) ** pull tokens out of shortest string ** include space in combo_string for final separator and null terminator */ - if ( (clen = __glXStrlen(cext_string)) > (slen = __glXStrlen(sext_string)) ) { - combo_string = (char *) __glXMalloc(slen + 2); - s1 = (char *) __glXMalloc(slen + 2); __glXStrcpy(s1, sext_string); + clen = strlen(cext_string); + slen = strlen(sext_string); + if (clen > slen) { + combo_string = (char *) malloc(slen + 2); + s1 = (char *) malloc(slen + 2); + strcpy(s1, sext_string); s2 = cext_string; } else { - combo_string = (char *) __glXMalloc(clen + 2); - s1 = (char *) __glXMalloc(clen + 2); __glXStrcpy(s1, cext_string); + combo_string = (char *) malloc(clen + 2); + s1 = (char *) malloc(clen + 2); + strcpy(s1, cext_string); s2 = sext_string; } if (!combo_string || !s1) { - if (combo_string) __glXFree(combo_string); - if (s1) __glXFree(s1); + if (combo_string) + free(combo_string); + if (s1) + free(s1); return NULL; } combo_string[0] = '\0'; /* Get first extension token */ - token = __glXStrtok( s1, SEPARATOR); + token = strtok( s1, SEPARATOR); while ( token != NULL ) { /* @@ -283,26 +298,26 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string) ** beware of extension names which are prefixes of other extension names */ const char *p = s2; - end = p + __glXStrlen(p); + end = p + strlen(p); while (p < end) { - size_t n = __glXStrcspn(p, SEPARATOR); - if ((__glXStrlen(token) == n) && (__glXStrncmp(token, p, n) == 0)) { - combo_string = __glXStrcat( combo_string, token); - combo_string = __glXStrcat( combo_string, SEPARATOR); + size_t n = strcspn(p, SEPARATOR); + if ((strlen(token) == n) && (strncmp(token, p, n) == 0)) { + combo_string = strcat(combo_string, token); + combo_string = strcat(combo_string, SEPARATOR); } p += (n + 1); } /* Get next extension token */ - token = __glXStrtok( NULL, SEPARATOR); + token = strtok( NULL, SEPARATOR); } - __glXFree(s1); + free(s1); return combo_string; } int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) { - ClientPtr client; + ClientPtr client = cl->client; __GLXcontext *cx; GLenum name; const char *string; @@ -311,6 +326,8 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) char *buf = NULL, *buf1 = NULL; GLint length = 0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 4); + /* If the client has the opposite byte order, swap the contextTag and * the name. */ @@ -327,7 +344,6 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) pc += __GLX_SINGLE_HDR_SIZE; name = *(GLenum *)(pc + 0); string = (const char *)glGetString(name); - client = cl->client; /* ** Restrict extensions to those that are supported by both the @@ -340,26 +356,24 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) buf = __glXcombine_strings(buf1, cx->pGlxScreen->GLextensions); if (buf1 != NULL) { - __glXFree(buf1); + free(buf1); } string = buf; } else if ( name == GL_VERSION ) { if ( atof( string ) > atof( GLServerVersion ) ) { - buf = __glXMalloc( __glXStrlen( string ) - + __glXStrlen( GLServerVersion ) - + 4 ); + buf = malloc( strlen( string ) + strlen( GLServerVersion ) + 4 ); if ( buf == NULL ) { string = GLServerVersion; } else { - __glXSprintf( buf, "%s (%s)", GLServerVersion, string ); + sprintf( buf, "%s (%s)", GLServerVersion, string ); string = buf; } } } if (string) { - length = __glXStrlen((const char *) string) + 1; + length = strlen((const char *) string) + 1; } __GLX_BEGIN_REPLY(length); @@ -371,9 +385,9 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) } __GLX_SEND_HEADER(); - WriteToClient(client, length, (char *) string); + WriteToClient(client, length, string); if (buf != NULL) { - __glXFree(buf); + free(buf); } return Success; } diff --git a/nx-X11/programs/Xserver/GL/glx/single2swap.c b/nx-X11/programs/Xserver/GL/glx/single2swap.c index dab98ade9..6fdc7e7f2 100644 --- a/nx-X11/programs/Xserver/GL/glx/single2swap.c +++ b/nx-X11/programs/Xserver/GL/glx/single2swap.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/single2swap.c,v 1.7 2002/01/14 22:47:08 tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -44,16 +42,17 @@ #include "glxext.h" #include "unpack.h" #include "g_disptab.h" -#include "GL/glx_ansic.h" int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; GLsizei size; GLenum type; __GLX_DECLARE_SWAP_VARIABLES; __GLXcontext *cx; int error; + REQUEST_FIXED_SIZE(xGLXSingleReq, 8); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -66,7 +65,7 @@ int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) size = *(GLsizei *)(pc+0); type = *(GLenum *)(pc+4); if (cx->feedbackBufSize < size) { - cx->feedbackBuf = (GLfloat *) __glXRealloc(cx->feedbackBuf, + cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf, (size_t) size * __GLX_SIZE_FLOAT32); if (!cx->feedbackBuf) { @@ -82,11 +81,13 @@ int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; __GLXcontext *cx; GLsizei size; __GLX_DECLARE_SWAP_VARIABLES; int error; + REQUEST_FIXED_SIZE(xGLXSingleReq, 4); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -97,7 +98,7 @@ int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(pc+0); size = *(GLsizei *)(pc+0); if (cx->selectBufSize < size) { - cx->selectBuf = (GLuint *) __glXRealloc(cx->selectBuf, + cx->selectBuf = (GLuint *) realloc(cx->selectBuf, (size_t) size * __GLX_SIZE_CARD32); if (!cx->selectBuf) { @@ -113,7 +114,7 @@ int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_RenderMode(__GLXclientState *cl, GLbyte *pc) { - ClientPtr client; + ClientPtr client = cl->client; __GLXcontext *cx; xGLXRenderModeReply reply; GLint nitems=0, retBytes=0, retval, newModeCheck; @@ -123,6 +124,8 @@ int __glXDispSwap_RenderMode(__GLXclientState *cl, GLbyte *pc) __GLX_DECLARE_SWAP_ARRAY_VARIABLES; int error; + REQUEST_FIXED_SIZE(xGLXSingleReq, 4); + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -201,7 +204,6 @@ int __glXDispSwap_RenderMode(__GLXclientState *cl, GLbyte *pc) ** selection array, as per the API for glRenderMode itself. */ noChangeAllowed:; - client = cl->client; reply.length = nitems; reply.type = X_Reply; reply.sequenceNumber = client->sequence; @@ -213,19 +215,21 @@ int __glXDispSwap_RenderMode(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&reply.retval); __GLX_SWAP_INT(&reply.size); __GLX_SWAP_INT(&reply.newMode); - WriteToClient(client, sz_xGLXRenderModeReply, (char *)&reply); + WriteToClient(client, sz_xGLXRenderModeReply, &reply); if (retBytes) { - WriteToClient(client, retBytes, (char *)retBuffer); + WriteToClient(client, retBytes, retBuffer); } return Success; } int __glXDispSwap_Flush(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; __GLXcontext *cx; int error; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXSingleReq); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -239,11 +243,12 @@ int __glXDispSwap_Flush(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_Finish(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; __GLXcontext *cx; - ClientPtr client; int error; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXSingleReq); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -255,7 +260,6 @@ int __glXDispSwap_Finish(__GLXclientState *cl, GLbyte *pc) __GLX_NOTE_FLUSHED_CMDS(cx); /* Send empty reply packet to indicate finish is finished */ - client = cl->client; __GLX_BEGIN_REPLY(0); __GLX_PUT_RETVAL(0); __GLX_SWAP_REPLY_HEADER(); diff --git a/nx-X11/programs/Xserver/GL/glx/singlepix.c b/nx-X11/programs/Xserver/GL/glx/singlepix.c index 845c46a64..9e3e36333 100644 --- a/nx-X11/programs/Xserver/GL/glx/singlepix.c +++ b/nx-X11/programs/Xserver/GL/glx/singlepix.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -57,6 +55,8 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) int error; char *answer, answerBuffer[200]; + REQUEST_FIXED_SIZE(xGLXSingleReq, 28); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -70,7 +70,7 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) swapBytes = *(GLboolean *)(pc + 24); lsbFirst = *(GLboolean *)(pc + 25); compsize = __glReadPixels_size(format,type,width,height); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); @@ -108,6 +108,7 @@ int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0, height=0, depth=1; + REQUEST_FIXED_SIZE(xGLXSingleReq, 20); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -130,7 +131,7 @@ int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width, height, and depth would still be zero anyway. */ compsize = __glGetTexImage_size(target,level,format,type,width,height,depth); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -204,6 +205,7 @@ int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0, height=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -227,13 +229,11 @@ int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) compsize = __glGetTexImage_size(target,1,format,type,width,1,1); compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1); - if (compsize < 0) compsize = 0; - if (compsize2 < 0) compsize2 = 0; - compsize = __GLX_PAD(compsize); - compsize2 = __GLX_PAD(compsize2); + if ((compsize = safe_pad(compsize)) < 0) return BadLength; + if ((compsize2 = safe_pad(compsize2)) < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); - __GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1); + __GLX_GET_ANSWER_BUFFER(answer,cl,safe_add(compsize, compsize2),1); __glXClearErrorOccured(); glGetSeparableFilter( *(GLenum *)(pc + 0), @@ -269,6 +269,7 @@ int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0, height=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -291,7 +292,7 @@ int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width and height would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,height,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -328,6 +329,8 @@ int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -346,7 +349,7 @@ int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -376,6 +379,8 @@ int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc) int error; char *answer, answerBuffer[200]; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -389,7 +394,7 @@ int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc) reset = *(GLboolean *)(pc + 13); compsize = __glGetTexImage_size(target,1,format,type,2,1,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -419,6 +424,8 @@ int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -436,7 +443,7 @@ int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); diff --git a/nx-X11/programs/Xserver/GL/glx/singlepixswap.c b/nx-X11/programs/Xserver/GL/glx/singlepixswap.c index ff68ecedf..f029fd602 100644 --- a/nx-X11/programs/Xserver/GL/glx/singlepixswap.c +++ b/nx-X11/programs/Xserver/GL/glx/singlepixswap.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -58,6 +56,8 @@ int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc) int error; char *answer, answerBuffer[200]; + REQUEST_FIXED_SIZE(xGLXSingleReq, 28); + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -79,7 +79,7 @@ int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc) swapBytes = *(GLboolean *)(pc + 24); lsbFirst = *(GLboolean *)(pc + 25); compsize = __glReadPixels_size(format,type,width,height); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); @@ -120,6 +120,7 @@ int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0, height=0, depth=1; + REQUEST_FIXED_SIZE(xGLXSingleReq, 24); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -148,7 +149,7 @@ int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width, height, and depth would still be zero anyway. */ compsize = __glGetTexImage_size(target,level,format,type,width,height,depth); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -190,6 +191,7 @@ int __glXDispSwap_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) char *answer; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_FIXED_SIZE(xGLXSingleReq, 4); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -230,6 +232,7 @@ int __glXDispSwap_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0, height=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -257,13 +260,11 @@ int __glXDispSwap_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) compsize = __glGetTexImage_size(target,1,format,type,width,1,1); compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1); - if (compsize < 0) compsize = 0; - if (compsize2 < 0) compsize2 = 0; - compsize = __GLX_PAD(compsize); - compsize2 = __GLX_PAD(compsize2); + if ((compsize = safe_pad(compsize)) < 0) return BadLength; + if ((compsize2 = safe_pad(compsize2)) < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); - __GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1); + __GLX_GET_ANSWER_BUFFER(answer,cl,safe_add(compsize, compsize2),1); __glXClearErrorOccured(); glGetSeparableFilter( *(GLenum *)(pc + 0), @@ -302,6 +303,7 @@ int __glXDispSwap_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0, height=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -328,7 +330,7 @@ int __glXDispSwap_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width and height would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,height,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -368,6 +370,7 @@ int __glXDispSwap_GetHistogram(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -390,7 +393,7 @@ int __glXDispSwap_GetHistogram(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -422,6 +425,7 @@ int __glXDispSwap_GetMinmax(__GLXclientState *cl, GLbyte *pc) __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -439,7 +443,7 @@ int __glXDispSwap_GetMinmax(__GLXclientState *cl, GLbyte *pc) reset = *(GLboolean *)(pc + 13); compsize = __glGetTexImage_size(target,1,format,type,2,1,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); @@ -470,6 +474,7 @@ int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc) char *answer, answerBuffer[200]; GLint width=0; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -491,7 +496,7 @@ int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc) * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); - if (compsize < 0) compsize = 0; + if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); diff --git a/nx-X11/programs/Xserver/GL/glx/singlesize.c b/nx-X11/programs/Xserver/GL/glx/singlesize.c index 7ed5fe3ef..6d77f8be9 100644 --- a/nx-X11/programs/Xserver/GL/glx/singlesize.c +++ b/nx-X11/programs/Xserver/GL/glx/singlesize.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.c,v 1.7tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free diff --git a/nx-X11/programs/Xserver/GL/glx/singlesize.h b/nx-X11/programs/Xserver/GL/glx/singlesize.h index 4804a9982..7cd52eae8 100644 --- a/nx-X11/programs/Xserver/GL/glx/singlesize.h +++ b/nx-X11/programs/Xserver/GL/glx/singlesize.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/nx-X11/programs/Xserver/GL/glx/unpack.h b/nx-X11/programs/Xserver/GL/glx/unpack.h index 723fb85f3..9554ba4b9 100644 --- a/nx-X11/programs/Xserver/GL/glx/unpack.h +++ b/nx-X11/programs/Xserver/GL/glx/unpack.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.4 2002/01/14 22:47:08 tsi Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -53,7 +52,7 @@ ** Fetch a double from potentially unaligned memory. */ #ifdef __GLX_ALIGN64 -#define __GLX_MEM_COPY(dst,src,n) if (src && dst) memcpy(dst,src,n) +#define __GLX_MEM_COPY(dst,src,n) memmove(dst,src,n) #define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8) #else #define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src)) @@ -69,7 +68,7 @@ extern xGLXSingleReply __glXReply; __glXReply.sequenceNumber = client->sequence; #define __GLX_SEND_HEADER() \ - WriteToClient( client, sz_xGLXSingleReply, (char *)&__glXReply); + WriteToClient( client, sz_xGLXSingleReply, &__glXReply); #define __GLX_PUT_RETVAL(a) \ __glXReply.retval = (a); @@ -89,10 +88,11 @@ extern xGLXSingleReply __glXReply; ** pointer. */ #define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \ - if ((size) > sizeof(answerBuffer)) { \ + if (size < 0) return BadLength; \ + else if ((size) > sizeof(answerBuffer)) { \ int bump; \ if ((cl)->returnBufSize < (size)+(align)) { \ - (cl)->returnBuf = (GLbyte*)Xrealloc((cl)->returnBuf, \ + (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf, \ (size)+(align)); \ if (!(cl)->returnBuf) { \ return BadAlloc; \ @@ -122,19 +122,19 @@ extern xGLXSingleReply __glXReply; *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer #define __GLX_SEND_BYTE_ARRAY(len) \ - WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), (char *)answer) + WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), answer) #define __GLX_SEND_SHORT_ARRAY(len) \ - WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), (char *)answer) + WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), answer) #define __GLX_SEND_INT_ARRAY(len) \ - WriteToClient(client, (len)*__GLX_SIZE_INT32, (char *)answer) + WriteToClient(client, (len)*__GLX_SIZE_INT32, answer) #define __GLX_SEND_FLOAT_ARRAY(len) \ - WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, (char *)answer) + WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, answer) #define __GLX_SEND_DOUBLE_ARRAY(len) \ - WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, (char *)answer) + WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, answer) #define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) diff --git a/nx-X11/programs/Xserver/GL/glx/xfont.c b/nx-X11/programs/Xserver/GL/glx/xfont.c index c4995e272..780183609 100644 --- a/nx-X11/programs/Xserver/GL/glx/xfont.c +++ b/nx-X11/programs/Xserver/GL/glx/xfont.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -34,7 +33,6 @@ ** */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -78,7 +76,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci) p = buf; allocbuf = 0; } else { - p = (unsigned char *) __glXMalloc(allocBytes); + p = (unsigned char *) malloc(allocBytes); if (!p) return BadAlloc; allocbuf = p; @@ -100,7 +98,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci) pci->metrics.characterWidth, 0, allocbuf ? allocbuf : buf); if (allocbuf) { - __glXFree(allocbuf); + free(allocbuf); } return Success; #undef __GL_CHAR_BUF_SIZE diff --git a/nx-X11/programs/Xserver/GL/glxmodule.c b/nx-X11/programs/Xserver/GL/glxmodule.c deleted file mode 100644 index f8c03913e..000000000 --- a/nx-X11/programs/Xserver/GL/glxmodule.c +++ /dev/null @@ -1,1270 +0,0 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ -/* $XFree86: xc/programs/Xserver/GL/glxmodule.c,v 1.11 2001/06/15 21:22:38 dawes Exp $ */ - -/* - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86Module.h" -#include "colormap.h" -#include "micmap.h" -#include "globals.h" - -static MODULESETUPPROTO(glxSetup); - -extern void GlxExtensionInit(INITARGS); -extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); -extern void InitGlxWrapInitVisuals(void (*f)(miInitVisualsProcPtr *)); - -static const char *initdeps[] = { "DOUBLE-BUFFER", NULL }; - -ExtensionModule GLXExt = -{ - GlxExtensionInit, - "GLX", - &noGlxExtension, - NULL, - initdeps -}; - -static const char *glcoreSymbols[] = { - "__glCallLists_size", - "__glColorTableParameterfv_size", - "__glColorTableParameteriv_size", - "__glConvolutionParameterfv_size", - "__glConvolutionParameteriv_size", - "__glDDXExtensionInfo", - "__glDDXScreenInfo", - "__glFloorLog2", - "__glFogfv_size", - "__glFogiv_size", - "__glGetBooleanv_size", - "__glGetColorTableParameterfv_size", - "__glGetColorTableParameteriv_size", - "__glGetConvolutionParameterfv_size", - "__glGetConvolutionParameteriv_size", - "__glGetDoublev_size", - "__glGetFloatv_size", - "__glGetHistogramParameterfv_size", - "__glGetHistogramParameteriv_size", - "__glGetIntegerv_size", - "__glGetLightfv_size", - "__glGetLightiv_size", - "__glGetMapdv_size", - "__glGetMapfv_size", - "__glGetMapiv_size", - "__glGetMaterialfv_size", - "__glGetMaterialiv_size", - "__glGetMinmaxParameterfv_size", - "__glGetMinmaxParameteriv_size", - "__glGetPixelMapfv_size", - "__glGetPixelMapuiv_size", - "__glGetPixelMapusv_size", - "__glGetTexEnvfv_size", - "__glGetTexEnviv_size", - "__glGetTexGendv_size", - "__glGetTexGenfv_size", - "__glGetTexGeniv_size", - "__glGetTexImage_size", - "__glGetTexLevelParameterfv_size", - "__glGetTexLevelParameteriv_size", - "__glGetTexParameterfv_size", - "__glGetTexParameteriv_size", - "__glLightModelfv_size", - "__glLightModeliv_size", - "__glLightfv_size", - "__glLightiv_size", - "__glMaterialfv_size", - "__glMaterialiv_size", - "__glPointParameterfvARB_size", - "__glReadPixels_size", - "__glTexEnvfv_size", - "__glTexEnviv_size", - "__glTexGendv_size", - "__glTexGenfv_size", - "__glTexGeniv_size", - "__glTexParameterfv_size", - "__glTexParameteriv_size", - "__glXglDDXExtensionInfo", - "__glXglDDXScreenInfo", - "__glXActiveScreens", - "__glXAssociateContext", - "__glXBadContext", - "__glXBadContextState", - "__glXBadContextTag", - "__glXBadCurrentWindow", - "__glXBadDrawable", - "__glXBadLargeRequest", - "__glXBadPixmap", - "__glXBadRenderRequest", - "__glXBitmapReqSize", - "__glXCacheDrawableSize", - "__glXCallListsReqSize", - "__glXClearErrorOccured", - "__glXClientInfo", - "__glXClientRes", - "__glXClients", - "__glXColorSubTableReqSize", - "__glXColorTableParameterfvReqSize", - "__glXColorTableParameterivReqSize", - "__glXColorTableReqSize", - "__glXContextRes", - "__glXConvolutionFilter1DReqSize", - "__glXConvolutionFilter2DReqSize", - "__glXConvolutionParameterfvReqSize", - "__glXConvolutionParameterivReqSize", - "__glXCopyContext", - "__glXCoreType", - "__glXCreateContext", - "__glXCreateGLXPixmap", - "__glXDeassociateContext", - "__glXDestroyContext", - "__glXDestroyGLXPixmap", - "__glXDispSwap_Accum", - "__glXDispSwap_ActiveStencilFaceEXT", - "__glXDispSwap_ActiveTextureARB", - "__glXDispSwap_AlphaFunc", - "__glXDispSwap_AreTexturesResident", - "__glXDispSwap_AreTexturesResidentEXT", - "__glXDispSwap_Begin", - "__glXDispSwap_BindTexture", - "__glXDispSwap_Bitmap", - "__glXDispSwap_BlendColor", - "__glXDispSwap_BlendEquation", - "__glXDispSwap_BlendFunc", - "__glXDispSwap_CallList", - "__glXDispSwap_CallLists", - "__glXDispSwap_Clear", - "__glXDispSwap_ClearAccum", - "__glXDispSwap_ClearColor", - "__glXDispSwap_ClearDepth", - "__glXDispSwap_ClearIndex", - "__glXDispSwap_ClearStencil", - "__glXDispSwap_ClipPlane", - "__glXDispSwap_Color3bv", - "__glXDispSwap_Color3dv", - "__glXDispSwap_Color3fv", - "__glXDispSwap_Color3iv", - "__glXDispSwap_Color3sv", - "__glXDispSwap_Color3ubv", - "__glXDispSwap_Color3uiv", - "__glXDispSwap_Color3usv", - "__glXDispSwap_Color4bv", - "__glXDispSwap_Color4dv", - "__glXDispSwap_Color4fv", - "__glXDispSwap_Color4iv", - "__glXDispSwap_Color4sv", - "__glXDispSwap_Color4ubv", - "__glXDispSwap_Color4uiv", - "__glXDispSwap_Color4usv", - "__glXDispSwap_ColorMask", - "__glXDispSwap_ColorMaterial", - "__glXDispSwap_ColorSubTable", - "__glXDispSwap_ColorTable", - "__glXDispSwap_ColorTableParameterfv", - "__glXDispSwap_ColorTableParameteriv", - "__glXDispSwap_ConvolutionFilter1D", - "__glXDispSwap_ConvolutionFilter2D", - "__glXDispSwap_ConvolutionParameterf", - "__glXDispSwap_ConvolutionParameterfv", - "__glXDispSwap_ConvolutionParameteri", - "__glXDispSwap_ConvolutionParameteriv", - "__glXDispSwap_CopyColorSubTable", - "__glXDispSwap_CopyColorTable", - "__glXDispSwap_CopyConvolutionFilter1D", - "__glXDispSwap_CopyConvolutionFilter2D", - "__glXDispSwap_CopyPixels", - "__glXDispSwap_CopyTexImage1D", - "__glXDispSwap_CopyTexImage2D", - "__glXDispSwap_CopyTexSubImage1D", - "__glXDispSwap_CopyTexSubImage2D", - "__glXDispSwap_CopyTexSubImage3D", - "__glXDispSwap_CullFace", - "__glXDispSwap_DeleteLists", - "__glXDispSwap_DeleteTextures", - "__glXDispSwap_DeleteTexturesEXT", - "__glXDispSwap_DepthFunc", - "__glXDispSwap_DepthMask", - "__glXDispSwap_DepthRange", - "__glXDispSwap_Disable", - "__glXDispSwap_DrawArrays", - "__glXDispSwap_DrawArraysEXT", - "__glXDispSwap_DrawBuffer", - "__glXDispSwap_DrawPixels", - "__glXDispSwap_EdgeFlagv", - "__glXDispSwap_Enable", - "__glXDispSwap_End", - "__glXDispSwap_EndList", - "__glXDispSwap_EvalCoord1dv", - "__glXDispSwap_EvalCoord1fv", - "__glXDispSwap_EvalCoord2dv", - "__glXDispSwap_EvalCoord2fv", - "__glXDispSwap_EvalMesh1", - "__glXDispSwap_EvalMesh2", - "__glXDispSwap_EvalPoint1", - "__glXDispSwap_EvalPoint2", - "__glXDispSwap_FeedbackBuffer", - "__glXDispSwap_Finish", - "__glXDispSwap_Flush", - "__glXDispSwap_Fogf", - "__glXDispSwap_Fogfv", - "__glXDispSwap_Fogi", - "__glXDispSwap_Fogiv", - "__glXDispSwap_FrontFace", - "__glXDispSwap_Frustum", - "__glXDispSwap_GenLists", - "__glXDispSwap_GenTextures", - "__glXDispSwap_GenTexturesEXT", - "__glXDispSwap_GetBooleanv", - "__glXDispSwap_GetClipPlane", - "__glXDispSwap_GetColorTable", - "__glXDispSwap_GetColorTableParameterfv", - "__glXDispSwap_GetColorTableParameteriv", - "__glXDispSwap_GetConvolutionFilter", - "__glXDispSwap_GetConvolutionParameterfv", - "__glXDispSwap_GetConvolutionParameteriv", - "__glXDispSwap_GetDoublev", - "__glXDispSwap_GetError", - "__glXDispSwap_GetFloatv", - "__glXDispSwap_GetHistogram", - "__glXDispSwap_GetHistogramParameterfv", - "__glXDispSwap_GetHistogramParameteriv", - "__glXDispSwap_GetIntegerv", - "__glXDispSwap_GetLightfv", - "__glXDispSwap_GetLightiv", - "__glXDispSwap_GetMapdv", - "__glXDispSwap_GetMapfv", - "__glXDispSwap_GetMapiv", - "__glXDispSwap_GetMaterialfv", - "__glXDispSwap_GetMaterialiv", - "__glXDispSwap_GetMinmax", - "__glXDispSwap_GetMinmaxParameterfv", - "__glXDispSwap_GetMinmaxParameteriv", - "__glXDispSwap_GetPixelMapfv", - "__glXDispSwap_GetPixelMapuiv", - "__glXDispSwap_GetPixelMapusv", - "__glXDispSwap_GetPolygonStipple", - "__glXDispSwap_GetSeparableFilter", - "__glXDispSwap_GetString", - "__glXDispSwap_GetTexEnvfv", - "__glXDispSwap_GetTexEnviv", - "__glXDispSwap_GetTexGendv", - "__glXDispSwap_GetTexGenfv", - "__glXDispSwap_GetTexGeniv", - "__glXDispSwap_GetTexImage", - "__glXDispSwap_GetTexLevelParameterfv", - "__glXDispSwap_GetTexLevelParameteriv", - "__glXDispSwap_GetTexParameterfv", - "__glXDispSwap_GetTexParameteriv", - "__glXDispSwap_Hint", - "__glXDispSwap_Histogram", - "__glXDispSwap_IndexMask", - "__glXDispSwap_Indexdv", - "__glXDispSwap_Indexfv", - "__glXDispSwap_Indexiv", - "__glXDispSwap_Indexsv", - "__glXDispSwap_Indexubv", - "__glXDispSwap_InitNames", - "__glXDispSwap_IsEnabled", - "__glXDispSwap_IsList", - "__glXDispSwap_IsTexture", - "__glXDispSwap_IsTextureEXT", - "__glXDispSwap_LightModelf", - "__glXDispSwap_LightModelfv", - "__glXDispSwap_LightModeli", - "__glXDispSwap_LightModeliv", - "__glXDispSwap_Lightf", - "__glXDispSwap_Lightfv", - "__glXDispSwap_Lighti", - "__glXDispSwap_Lightiv", - "__glXDispSwap_LineStipple", - "__glXDispSwap_LineWidth", - "__glXDispSwap_ListBase", - "__glXDispSwap_LoadIdentity", - "__glXDispSwap_LoadMatrixd", - "__glXDispSwap_LoadMatrixf", - "__glXDispSwap_LoadName", - "__glXDispSwap_LogicOp", - "__glXDispSwap_Map1d", - "__glXDispSwap_Map1f", - "__glXDispSwap_Map2d", - "__glXDispSwap_Map2f", - "__glXDispSwap_MapGrid1d", - "__glXDispSwap_MapGrid1f", - "__glXDispSwap_MapGrid2d", - "__glXDispSwap_MapGrid2f", - "__glXDispSwap_Materialf", - "__glXDispSwap_Materialfv", - "__glXDispSwap_Materiali", - "__glXDispSwap_Materialiv", - "__glXDispSwap_MatrixMode", - "__glXDispSwap_Minmax", - "__glXDispSwap_MultMatrixd", - "__glXDispSwap_MultMatrixf", - "__glXDispSwap_MultiTexCoord1dvARB", - "__glXDispSwap_MultiTexCoord1fvARB", - "__glXDispSwap_MultiTexCoord1ivARB", - "__glXDispSwap_MultiTexCoord1svARB", - "__glXDispSwap_MultiTexCoord2dvARB", - "__glXDispSwap_MultiTexCoord2fvARB", - "__glXDispSwap_MultiTexCoord2ivARB", - "__glXDispSwap_MultiTexCoord2svARB", - "__glXDispSwap_MultiTexCoord3dvARB", - "__glXDispSwap_MultiTexCoord3fvARB", - "__glXDispSwap_MultiTexCoord3ivARB", - "__glXDispSwap_MultiTexCoord3svARB", - "__glXDispSwap_MultiTexCoord4dvARB", - "__glXDispSwap_MultiTexCoord4fvARB", - "__glXDispSwap_MultiTexCoord4ivARB", - "__glXDispSwap_MultiTexCoord4svARB", - "__glXDispSwap_NewList", - "__glXDispSwap_Normal3bv", - "__glXDispSwap_Normal3dv", - "__glXDispSwap_Normal3fv", - "__glXDispSwap_Normal3iv", - "__glXDispSwap_Normal3sv", - "__glXDispSwap_Ortho", - "__glXDispSwap_PassThrough", - "__glXDispSwap_PixelMapfv", - "__glXDispSwap_PixelMapuiv", - "__glXDispSwap_PixelMapusv", - "__glXDispSwap_PixelStoref", - "__glXDispSwap_PixelStorei", - "__glXDispSwap_PixelTransferf", - "__glXDispSwap_PixelTransferi", - "__glXDispSwap_PixelZoom", - "__glXDispSwap_PointParameterfARB", - "__glXDispSwap_PointParameterfvARB", - "__glXDispSwap_PointSize", - "__glXDispSwap_PolygonMode", - "__glXDispSwap_PolygonOffset", - "__glXDispSwap_PolygonStipple", - "__glXDispSwap_PopAttrib", - "__glXDispSwap_PopMatrix", - "__glXDispSwap_PopName", - "__glXDispSwap_PrioritizeTextures", - "__glXDispSwap_PushAttrib", - "__glXDispSwap_PushMatrix", - "__glXDispSwap_PushName", - "__glXDispSwap_RasterPos2dv", - "__glXDispSwap_RasterPos2fv", - "__glXDispSwap_RasterPos2iv", - "__glXDispSwap_RasterPos2sv", - "__glXDispSwap_RasterPos3dv", - "__glXDispSwap_RasterPos3fv", - "__glXDispSwap_RasterPos3iv", - "__glXDispSwap_RasterPos3sv", - "__glXDispSwap_RasterPos4dv", - "__glXDispSwap_RasterPos4fv", - "__glXDispSwap_RasterPos4iv", - "__glXDispSwap_RasterPos4sv", - "__glXDispSwap_ReadBuffer", - "__glXDispSwap_ReadPixels", - "__glXDispSwap_Rectdv", - "__glXDispSwap_Rectfv", - "__glXDispSwap_Rectiv", - "__glXDispSwap_Rectsv", - "__glXDispSwap_RenderMode", - "__glXDispSwap_ResetHistogram", - "__glXDispSwap_ResetMinmax", - "__glXDispSwap_Rotated", - "__glXDispSwap_Rotatef", - "__glXDispSwap_Scaled", - "__glXDispSwap_Scalef", - "__glXDispSwap_Scissor", - "__glXDispSwap_SelectBuffer", - "__glXDispSwap_SeparableFilter2D", - "__glXDispSwap_ShadeModel", - "__glXDispSwap_StencilFunc", - "__glXDispSwap_StencilMask", - "__glXDispSwap_StencilOp", - "__glXDispSwap_TexCoord1dv", - "__glXDispSwap_TexCoord1fv", - "__glXDispSwap_TexCoord1iv", - "__glXDispSwap_TexCoord1sv", - "__glXDispSwap_TexCoord2dv", - "__glXDispSwap_TexCoord2fv", - "__glXDispSwap_TexCoord2iv", - "__glXDispSwap_TexCoord2sv", - "__glXDispSwap_TexCoord3dv", - "__glXDispSwap_TexCoord3fv", - "__glXDispSwap_TexCoord3iv", - "__glXDispSwap_TexCoord3sv", - "__glXDispSwap_TexCoord4dv", - "__glXDispSwap_TexCoord4fv", - "__glXDispSwap_TexCoord4iv", - "__glXDispSwap_TexCoord4sv", - "__glXDispSwap_TexEnvf", - "__glXDispSwap_TexEnvfv", - "__glXDispSwap_TexEnvi", - "__glXDispSwap_TexEnviv", - "__glXDispSwap_TexGend", - "__glXDispSwap_TexGendv", - "__glXDispSwap_TexGenf", - "__glXDispSwap_TexGenfv", - "__glXDispSwap_TexGeni", - "__glXDispSwap_TexGeniv", - "__glXDispSwap_TexImage1D", - "__glXDispSwap_TexImage2D", - "__glXDispSwap_TexImage3D", - "__glXDispSwap_TexParameterf", - "__glXDispSwap_TexParameterfv", - "__glXDispSwap_TexParameteri", - "__glXDispSwap_TexParameteriv", - "__glXDispSwap_TexSubImage1D", - "__glXDispSwap_TexSubImage2D", - "__glXDispSwap_TexSubImage3D", - "__glXDispSwap_Translated", - "__glXDispSwap_Translatef", - "__glXDispSwap_Vertex2dv", - "__glXDispSwap_Vertex2fv", - "__glXDispSwap_Vertex2iv", - "__glXDispSwap_Vertex2sv", - "__glXDispSwap_Vertex3dv", - "__glXDispSwap_Vertex3fv", - "__glXDispSwap_Vertex3iv", - "__glXDispSwap_Vertex3sv", - "__glXDispSwap_Vertex4dv", - "__glXDispSwap_Vertex4fv", - "__glXDispSwap_Vertex4iv", - "__glXDispSwap_Vertex4sv", - "__glXDispSwap_Viewport", - "__glXDispSwap_WindowPos3fARB", - "__glXDisp_Accum", - "__glXDisp_ActiveStencilFaceEXT", - "__glXDisp_ActiveTextureARB", - "__glXDisp_AlphaFunc", - "__glXDisp_AreTexturesResident", - "__glXDisp_AreTexturesResidentEXT", - "__glXDisp_Begin", - "__glXDisp_BindTexture", - "__glXDisp_Bitmap", - "__glXDisp_BlendColor", - "__glXDisp_BlendEquation", - "__glXDisp_BlendFunc", - "__glXDisp_CallList", - "__glXDisp_CallLists", - "__glXDisp_Clear", - "__glXDisp_ClearAccum", - "__glXDisp_ClearColor", - "__glXDisp_ClearDepth", - "__glXDisp_ClearIndex", - "__glXDisp_ClearStencil", - "__glXDisp_ClipPlane", - "__glXDisp_Color3bv", - "__glXDisp_Color3dv", - "__glXDisp_Color3fv", - "__glXDisp_Color3iv", - "__glXDisp_Color3sv", - "__glXDisp_Color3ubv", - "__glXDisp_Color3uiv", - "__glXDisp_Color3usv", - "__glXDisp_Color4bv", - "__glXDisp_Color4dv", - "__glXDisp_Color4fv", - "__glXDisp_Color4iv", - "__glXDisp_Color4sv", - "__glXDisp_Color4ubv", - "__glXDisp_Color4uiv", - "__glXDisp_Color4usv", - "__glXDisp_ColorMask", - "__glXDisp_ColorMaterial", - "__glXDisp_ColorSubTable", - "__glXDisp_ColorTable", - "__glXDisp_ColorTableParameterfv", - "__glXDisp_ColorTableParameteriv", - "__glXDisp_ConvolutionFilter1D", - "__glXDisp_ConvolutionFilter2D", - "__glXDisp_ConvolutionParameterf", - "__glXDisp_ConvolutionParameterfv", - "__glXDisp_ConvolutionParameteri", - "__glXDisp_ConvolutionParameteriv", - "__glXDisp_CopyColorSubTable", - "__glXDisp_CopyColorTable", - "__glXDisp_CopyConvolutionFilter1D", - "__glXDisp_CopyConvolutionFilter2D", - "__glXDisp_CopyPixels", - "__glXDisp_CopyTexImage1D", - "__glXDisp_CopyTexImage2D", - "__glXDisp_CopyTexSubImage1D", - "__glXDisp_CopyTexSubImage2D", - "__glXDisp_CopyTexSubImage3D", - "__glXDisp_CullFace", - "__glXDisp_DeleteLists", - "__glXDisp_DeleteTextures", - "__glXDisp_DeleteTexturesEXT", - "__glXDisp_DepthFunc", - "__glXDisp_DepthMask", - "__glXDisp_DepthRange", - "__glXDisp_Disable", - "__glXDisp_DrawArrays", - "__glXDisp_DrawArraysEXT", - "__glXDisp_DrawBuffer", - "__glXDisp_DrawPixels", - "__glXDisp_EdgeFlagv", - "__glXDisp_Enable", - "__glXDisp_End", - "__glXDisp_EndList", - "__glXDisp_EvalCoord1dv", - "__glXDisp_EvalCoord1fv", - "__glXDisp_EvalCoord2dv", - "__glXDisp_EvalCoord2fv", - "__glXDisp_EvalMesh1", - "__glXDisp_EvalMesh2", - "__glXDisp_EvalPoint1", - "__glXDisp_EvalPoint2", - "__glXDisp_FeedbackBuffer", - "__glXDisp_Finish", - "__glXDisp_Flush", - "__glXDisp_Fogf", - "__glXDisp_Fogfv", - "__glXDisp_Fogi", - "__glXDisp_Fogiv", - "__glXDisp_FrontFace", - "__glXDisp_Frustum", - "__glXDisp_GenLists", - "__glXDisp_GenTextures", - "__glXDisp_GenTexturesEXT", - "__glXDisp_GetBooleanv", - "__glXDisp_GetClipPlane", - "__glXDisp_GetColorTable", - "__glXDisp_GetColorTableParameterfv", - "__glXDisp_GetColorTableParameteriv", - "__glXDisp_GetConvolutionFilter", - "__glXDisp_GetConvolutionParameterfv", - "__glXDisp_GetConvolutionParameteriv", - "__glXDisp_GetDoublev", - "__glXDisp_GetError", - "__glXDisp_GetFloatv", - "__glXDisp_GetHistogram", - "__glXDisp_GetHistogramParameterfv", - "__glXDisp_GetHistogramParameteriv", - "__glXDisp_GetIntegerv", - "__glXDisp_GetLightfv", - "__glXDisp_GetLightiv", - "__glXDisp_GetMapdv", - "__glXDisp_GetMapfv", - "__glXDisp_GetMapiv", - "__glXDisp_GetMaterialfv", - "__glXDisp_GetMaterialiv", - "__glXDisp_GetMinmax", - "__glXDisp_GetMinmaxParameterfv", - "__glXDisp_GetMinmaxParameteriv", - "__glXDisp_GetPixelMapfv", - "__glXDisp_GetPixelMapuiv", - "__glXDisp_GetPixelMapusv", - "__glXDisp_GetPolygonStipple", - "__glXDisp_GetSeparableFilter", - "__glXDisp_GetString", - "__glXDisp_GetTexEnvfv", - "__glXDisp_GetTexEnviv", - "__glXDisp_GetTexGendv", - "__glXDisp_GetTexGenfv", - "__glXDisp_GetTexGeniv", - "__glXDisp_GetTexImage", - "__glXDisp_GetTexLevelParameterfv", - "__glXDisp_GetTexLevelParameteriv", - "__glXDisp_GetTexParameterfv", - "__glXDisp_GetTexParameteriv", - "__glXDisp_Hint", - "__glXDisp_Histogram", - "__glXDisp_IndexMask", - "__glXDisp_Indexdv", - "__glXDisp_Indexfv", - "__glXDisp_Indexiv", - "__glXDisp_Indexsv", - "__glXDisp_Indexubv", - "__glXDisp_InitNames", - "__glXDisp_IsEnabled", - "__glXDisp_IsList", - "__glXDisp_IsTexture", - "__glXDisp_IsTextureEXT", - "__glXDisp_LightModelf", - "__glXDisp_LightModelfv", - "__glXDisp_LightModeli", - "__glXDisp_LightModeliv", - "__glXDisp_Lightf", - "__glXDisp_Lightfv", - "__glXDisp_Lighti", - "__glXDisp_Lightiv", - "__glXDisp_LineStipple", - "__glXDisp_LineWidth", - "__glXDisp_ListBase", - "__glXDisp_LoadIdentity", - "__glXDisp_LoadMatrixd", - "__glXDisp_LoadMatrixf", - "__glXDisp_LoadName", - "__glXDisp_LogicOp", - "__glXDisp_Map1d", - "__glXDisp_Map1f", - "__glXDisp_Map2d", - "__glXDisp_Map2f", - "__glXDisp_MapGrid1d", - "__glXDisp_MapGrid1f", - "__glXDisp_MapGrid2d", - "__glXDisp_MapGrid2f", - "__glXDisp_Materialf", - "__glXDisp_Materialfv", - "__glXDisp_Materiali", - "__glXDisp_Materialiv", - "__glXDisp_MatrixMode", - "__glXDisp_Minmax", - "__glXDisp_MultMatrixd", - "__glXDisp_MultMatrixf", - "__glXDisp_MultiTexCoord1dvARB", - "__glXDisp_MultiTexCoord1fvARB", - "__glXDisp_MultiTexCoord1ivARB", - "__glXDisp_MultiTexCoord1svARB", - "__glXDisp_MultiTexCoord2dvARB", - "__glXDisp_MultiTexCoord2fvARB", - "__glXDisp_MultiTexCoord2ivARB", - "__glXDisp_MultiTexCoord2svARB", - "__glXDisp_MultiTexCoord3dvARB", - "__glXDisp_MultiTexCoord3fvARB", - "__glXDisp_MultiTexCoord3ivARB", - "__glXDisp_MultiTexCoord3svARB", - "__glXDisp_MultiTexCoord4dvARB", - "__glXDisp_MultiTexCoord4fvARB", - "__glXDisp_MultiTexCoord4ivARB", - "__glXDisp_MultiTexCoord4svARB", - "__glXDisp_NewList", - "__glXDisp_Normal3bv", - "__glXDisp_Normal3dv", - "__glXDisp_Normal3fv", - "__glXDisp_Normal3iv", - "__glXDisp_Normal3sv", - "__glXDisp_Ortho", - "__glXDisp_PassThrough", - "__glXDisp_PixelMapfv", - "__glXDisp_PixelMapuiv", - "__glXDisp_PixelMapusv", - "__glXDisp_PixelStoref", - "__glXDisp_PixelStorei", - "__glXDisp_PixelTransferf", - "__glXDisp_PixelTransferi", - "__glXDisp_PixelZoom", - "__glXDisp_PointParameterfARB", - "__glXDisp_PointParameterfvARB", - "__glXDisp_PointSize", - "__glXDisp_PolygonMode", - "__glXDisp_PolygonOffset", - "__glXDisp_PolygonStipple", - "__glXDisp_PopAttrib", - "__glXDisp_PopMatrix", - "__glXDisp_PopName", - "__glXDisp_PrioritizeTextures", - "__glXDisp_PushAttrib", - "__glXDisp_PushMatrix", - "__glXDisp_PushName", - "__glXDisp_RasterPos2dv", - "__glXDisp_RasterPos2fv", - "__glXDisp_RasterPos2iv", - "__glXDisp_RasterPos2sv", - "__glXDisp_RasterPos3dv", - "__glXDisp_RasterPos3fv", - "__glXDisp_RasterPos3iv", - "__glXDisp_RasterPos3sv", - "__glXDisp_RasterPos4dv", - "__glXDisp_RasterPos4fv", - "__glXDisp_RasterPos4iv", - "__glXDisp_RasterPos4sv", - "__glXDisp_ReadBuffer", - "__glXDisp_ReadPixels", - "__glXDisp_Rectdv", - "__glXDisp_Rectfv", - "__glXDisp_Rectiv", - "__glXDisp_Rectsv", - "__glXDisp_RenderMode", - "__glXDisp_ResetHistogram", - "__glXDisp_ResetMinmax", - "__glXDisp_Rotated", - "__glXDisp_Rotatef", - "__glXDisp_Scaled", - "__glXDisp_Scalef", - "__glXDisp_Scissor", - "__glXDisp_SelectBuffer", - "__glXDisp_SeparableFilter2D", - "__glXDisp_ShadeModel", - "__glXDisp_StencilFunc", - "__glXDisp_StencilMask", - "__glXDisp_StencilOp", - "__glXDisp_TexCoord1dv", - "__glXDisp_TexCoord1fv", - "__glXDisp_TexCoord1iv", - "__glXDisp_TexCoord1sv", - "__glXDisp_TexCoord2dv", - "__glXDisp_TexCoord2fv", - "__glXDisp_TexCoord2iv", - "__glXDisp_TexCoord2sv", - "__glXDisp_TexCoord3dv", - "__glXDisp_TexCoord3fv", - "__glXDisp_TexCoord3iv", - "__glXDisp_TexCoord3sv", - "__glXDisp_TexCoord4dv", - "__glXDisp_TexCoord4fv", - "__glXDisp_TexCoord4iv", - "__glXDisp_TexCoord4sv", - "__glXDisp_TexEnvf", - "__glXDisp_TexEnvfv", - "__glXDisp_TexEnvi", - "__glXDisp_TexEnviv", - "__glXDisp_TexGend", - "__glXDisp_TexGendv", - "__glXDisp_TexGenf", - "__glXDisp_TexGenfv", - "__glXDisp_TexGeni", - "__glXDisp_TexGeniv", - "__glXDisp_TexImage1D", - "__glXDisp_TexImage2D", - "__glXDisp_TexImage3D", - "__glXDisp_TexParameterf", - "__glXDisp_TexParameterfv", - "__glXDisp_TexParameteri", - "__glXDisp_TexParameteriv", - "__glXDisp_TexSubImage1D", - "__glXDisp_TexSubImage2D", - "__glXDisp_TexSubImage3D", - "__glXDisp_Translated", - "__glXDisp_Translatef", - "__glXDisp_Vertex2dv", - "__glXDisp_Vertex2fv", - "__glXDisp_Vertex2iv", - "__glXDisp_Vertex2sv", - "__glXDisp_Vertex3dv", - "__glXDisp_Vertex3fv", - "__glXDisp_Vertex3iv", - "__glXDisp_Vertex3sv", - "__glXDisp_Vertex4dv", - "__glXDisp_Vertex4fv", - "__glXDisp_Vertex4iv", - "__glXDisp_Vertex4sv", - "__glXDisp_Viewport", - "__glXDisp_WindowPos3fARB", - "__glXDrawArraysSize", - "__glXDrawPixelsReqSize", - "__glXDrawableRes", - "__glXErrorOccured", - "__glXFBInitDrawable", - "__glXFBMemSwapBuffers", - "__glXFindDrawablePrivate", - "__glXFogfvReqSize", - "__glXFogivReqSize", - "__glXForceCurrent", - "__glXFree", - "__glXFreeBuffers", - "__glXFreeContext", - "__glXGetDrawablePrivate", - "__glXGetVisualConfigs", - "__glXImageSize", - "__glXImpAtoi", - "__glXImpCalloc", - "__glXImpFatal", - "__glXImpFclose", - "__glXImpFopen", - "__glXImpFprintf", - "__glXImpFree", - "__glXImpGetDrawablePrivate", - "__glXImpGetenv", - "__glXImpMalloc", - "__glXImpRealloc", - "__glXImpSprintf", - "__glXImpWarning", - "__glXInitFB", - "__glXInitMem", - "__glXInitPix", - "__glXIsDirect", - "__glXLastContext", - "__glXLightModelfvReqSize", - "__glXLightModelivReqSize", - "__glXLightfvReqSize", - "__glXLightivReqSize", - "__glXLookupContextByTag", - "__glXMakeCurrent", - "__glXMalloc", - "__glXMap1dReqSize", - "__glXMap1fReqSize", - "__glXMap2dReqSize", - "__glXMap2fReqSize", - "__glXMaterialfvReqSize", - "__glXMaterialivReqSize", - "__glXNoSuchRenderOpcode", - "__glXNoSuchSingleOpcode", - "__glXNop", - "__glXPixInitDrawable", - "__glXPixelMapfvReqSize", - "__glXPixelMapuivReqSize", - "__glXPixelMapusvReqSize", - "__glXPixmapRes", - "__glXPrioritizeTexturesReqSize", - "__glXQueryContextInfoEXT", - "__glXQueryExtensionsString", - "__glXQueryServerString", - "__glXQueryVersion", - "__glXRealloc", - "__glXRender", - "__glXRenderLarge", - "__glXRenderSizeTable", - "__glXRenderSizeTable_EXT", - "__glXRenderTable", - "__glXRenderTable_EXT", - "__glXReply", - "__glXResetLargeCommandStatus", - "__glXResizeBuffers", - "__glXResizeDrawableBuffers", - "__glXScreenInit", - "__glXScreenReset", - "__glXSeparableFilter2DReqSize", - "__glXSingleTable", - "__glXSwapBuffers", - "__glXSwapClientInfo", - "__glXSwapCopyContext", - "__glXSwapCreateContext", - "__glXSwapCreateGLXPixmap", - "__glXSwapDestroyContext", - "__glXSwapDestroyGLXPixmap", - "__glXSwapGetVisualConfigs", - "__glXSwapIsDirect", - "__glXSwapIsDirectReply", - "__glXSwapMakeCurrent", - "__glXSwapMakeCurrentReply", - "__glXSwapQueryContextInfoEXTReply", - "__glXSwapQueryExtensionsString", - "__glXSwapQueryServerString", - "__glXSwapQueryVersion", - "__glXSwapQueryVersionReply", - "__glXSwapRender", - "__glXSwapRenderLarge", - "__glXSwapRenderTable", - "__glXSwapRenderTable_EXT", - "__glXSwapSingleTable", - "__glXSwapSwapBuffers", - "__glXSwapUseXFont", - "__glXSwapVendorPrivTable_EXT", - "__glXSwapVendorPrivate", - "__glXSwapVendorPrivateWithReply", - "__glXSwapWaitGL", - "__glXSwapWaitX", - "__glXTexEnvfvReqSize", - "__glXTexEnvivReqSize", - "__glXTexGendvReqSize", - "__glXTexGenfvReqSize", - "__glXTexGenivReqSize", - "__glXTexImage1DReqSize", - "__glXTexImage2DReqSize", - "__glXTexImage3DReqSize", - "__glXTexParameterfvReqSize", - "__glXTexParameterivReqSize", - "__glXTexSubImage1DReqSize", - "__glXTexSubImage2DReqSize", - "__glXTexSubImage3DReqSize", - "__glXTypeSize", - "__glXUnrefDrawablePrivate", - "__glXUnsupportedPrivateRequest", - "__glXUseXFont", - "__glXVendorPrivTable_EXT", - "__glXVendorPrivate", - "__glXVendorPrivateWithReply", - "__glXWaitGL", - "__glXWaitX", - "__glXcombine_strings", - "glAccum", - "glActiveStencilFaceEXT", - "glActiveTextureARB", - "glAlphaFunc", - "glAreTexturesResident", - "glAreTexturesResidentEXT", - "glBegin", - "glBindTexture", - "glBitmap", - "glBlendColor", - "glBlendEquation", - "glBlendFunc", - "glCallList", - "glCallLists", - "glClear", - "glClearAccum", - "glClearColor", - "glClearDepth", - "glClearIndex", - "glClearStencil", - "glClipPlane", - "glColor3bv", - "glColor3dv", - "glColor3fv", - "glColor3iv", - "glColor3sv", - "glColor3ubv", - "glColor3uiv", - "glColor3usv", - "glColor4bv", - "glColor4dv", - "glColor4fv", - "glColor4iv", - "glColor4sv", - "glColor4ubv", - "glColor4uiv", - "glColor4usv", - "glColorMask", - "glColorMaterial", - "glColorPointer", - "glColorSubTable", - "glColorTable", - "glColorTableParameterfv", - "glColorTableParameteriv", - "glConvolutionFilter1D", - "glConvolutionFilter2D", - "glConvolutionParameterf", - "glConvolutionParameterfv", - "glConvolutionParameteri", - "glConvolutionParameteriv", - "glCopyColorSubTable", - "glCopyColorTable", - "glCopyConvolutionFilter1D", - "glCopyConvolutionFilter2D", - "glCopyPixels", - "glCopyTexImage1D", - "glCopyTexImage2D", - "glCopyTexSubImage1D", - "glCopyTexSubImage2D", - "glCopyTexSubImage3D", - "glCullFace", - "glDeleteLists", - "glDeleteTextures", - "glDeleteTexturesEXT", - "glDepthFunc", - "glDepthMask", - "glDepthRange", - "glDisable", - "glDisableClientState", - "glDrawArrays", - "glDrawBuffer", - "glDrawPixels", - "glEdgeFlagPointer", - "glEdgeFlagv", - "glEnable", - "glEnableClientState", - "glEnd", - "glEndList", - "glEvalCoord1dv", - "glEvalCoord1fv", - "glEvalCoord2dv", - "glEvalCoord2fv", - "glEvalMesh1", - "glEvalMesh2", - "glEvalPoint1", - "glEvalPoint2", - "glFeedbackBuffer", - "glFinish", - "glFlush", - "glFogf", - "glFogfv", - "glFogi", - "glFogiv", - "glFrontFace", - "glFrustum", - "glGenLists", - "glGenTextures", - "glGenTexturesEXT", - "glGetBooleanv", - "glGetClipPlane", - "glGetColorTable", - "glGetColorTableParameterfv", - "glGetColorTableParameteriv", - "glGetConvolutionFilter", - "glGetConvolutionParameterfv", - "glGetConvolutionParameteriv", - "glGetDoublev", - "glGetError", - "glGetFloatv", - "glGetHistogram", - "glGetHistogramParameterfv", - "glGetHistogramParameteriv", - "glGetIntegerv", - "glGetLightfv", - "glGetLightiv", - "glGetMapdv", - "glGetMapfv", - "glGetMapiv", - "glGetMaterialfv", - "glGetMaterialiv", - "glGetMinmax", - "glGetMinmaxParameterfv", - "glGetMinmaxParameteriv", - "glGetPixelMapfv", - "glGetPixelMapuiv", - "glGetPixelMapusv", - "glGetPolygonStipple", - "glGetSeparableFilter", - "glGetString", - "glGetTexEnvfv", - "glGetTexEnviv", - "glGetTexGendv", - "glGetTexGenfv", - "glGetTexGeniv", - "glGetTexImage", - "glGetTexLevelParameterfv", - "glGetTexLevelParameteriv", - "glGetTexParameterfv", - "glGetTexParameteriv", - "glHint", - "glHistogram", - "glIndexMask", - "glIndexPointer", - "glIndexdv", - "glIndexfv", - "glIndexiv", - "glIndexsv", - "glIndexubv", - "glInitNames", - "glIsEnabled", - "glIsList", - "glIsTexture", - "glIsTextureEXT", - "glLightModelf", - "glLightModelfv", - "glLightModeli", - "glLightModeliv", - "glLightf", - "glLightfv", - "glLighti", - "glLightiv", - "glLineStipple", - "glLineWidth", - "glListBase", - "glLoadIdentity", - "glLoadMatrixd", - "glLoadMatrixf", - "glLoadName", - "glLogicOp", - "glMap1d", - "glMap1f", - "glMap2d", - "glMap2f", - "glMapGrid1d", - "glMapGrid1f", - "glMapGrid2d", - "glMapGrid2f", - "glMaterialf", - "glMaterialfv", - "glMateriali", - "glMaterialiv", - "glMatrixMode", - "glMinmax", - "glMultMatrixd", - "glMultMatrixf", - "glMultiTexCoord1dvARB", - "glMultiTexCoord1fvARB", - "glMultiTexCoord1ivARB", - "glMultiTexCoord1svARB", - "glMultiTexCoord2dvARB", - "glMultiTexCoord2fvARB", - "glMultiTexCoord2ivARB", - "glMultiTexCoord2svARB", - "glMultiTexCoord3dvARB", - "glMultiTexCoord3fvARB", - "glMultiTexCoord3ivARB", - "glMultiTexCoord3svARB", - "glMultiTexCoord4dvARB", - "glMultiTexCoord4fvARB", - "glMultiTexCoord4ivARB", - "glMultiTexCoord4svARB", - "glNewList", - "glNormal3bv", - "glNormal3dv", - "glNormal3fv", - "glNormal3iv", - "glNormal3sv", - "glNormalPointer", - "glOrtho", - "glPassThrough", - "glPixelMapfv", - "glPixelMapuiv", - "glPixelMapusv", - "glPixelStoref", - "glPixelStorei", - "glPixelTransferf", - "glPixelTransferi", - "glPixelZoom", - "glPointParameterfARB", - "glPointParameterfvARB", - "glPointSize", - "glPolygonMode", - "glPolygonOffset", - "glPolygonStipple", - "glPopAttrib", - "glPopMatrix", - "glPopName", - "glPrioritizeTextures", - "glPushAttrib", - "glPushMatrix", - "glPushName", - "glRasterPos2dv", - "glRasterPos2fv", - "glRasterPos2iv", - "glRasterPos2sv", - "glRasterPos3dv", - "glRasterPos3fv", - "glRasterPos3iv", - "glRasterPos3sv", - "glRasterPos4dv", - "glRasterPos4fv", - "glRasterPos4iv", - "glRasterPos4sv", - "glReadBuffer", - "glReadPixels", - "glRectdv", - "glRectfv", - "glRectiv", - "glRectsv", - "glRenderMode", - "glResetHistogram", - "glResetMinmax", - "glRotated", - "glRotatef", - "glScaled", - "glScalef", - "glScissor", - "glSelectBuffer", - "glSeparableFilter2D", - "glShadeModel", - "glStencilFunc", - "glStencilMask", - "glStencilOp", - "glTexCoord1dv", - "glTexCoord1fv", - "glTexCoord1iv", - "glTexCoord1sv", - "glTexCoord2dv", - "glTexCoord2fv", - "glTexCoord2iv", - "glTexCoord2sv", - "glTexCoord3dv", - "glTexCoord3fv", - "glTexCoord3iv", - "glTexCoord3sv", - "glTexCoord4dv", - "glTexCoord4fv", - "glTexCoord4iv", - "glTexCoord4sv", - "glTexCoordPointer", - "glTexEnvf", - "glTexEnvfv", - "glTexEnvi", - "glTexEnviv", - "glTexGend", - "glTexGendv", - "glTexGenf", - "glTexGenfv", - "glTexGeni", - "glTexGeniv", - "glTexImage1D", - "glTexImage2D", - "glTexImage3D", - "glTexParameterf", - "glTexParameterfv", - "glTexParameteri", - "glTexParameteriv", - "glTexSubImage1D", - "glTexSubImage2D", - "glTexSubImage3D", - "glTranslated", - "glTranslatef", - "glVertex2dv", - "glVertex2fv", - "glVertex2iv", - "glVertex2sv", - "glVertex3dv", - "glVertex3fv", - "glVertex3iv", - "glVertex3sv", - "glVertex4dv", - "glVertex4fv", - "glVertex4iv", - "glVertex4sv", - "glVertexPointer", - "glViewport", - "glWindowPos3fARB", - "glxSwapQueryExtensionsStringReply", - "glxSwapQueryServerStringReply", - NULL -}; - -static XF86ModuleVersionInfo VersRec = -{ - "glx", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_EXTENSION, - ABI_EXTENSION_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} -}; - -XF86ModuleData glxModuleData = { &VersRec, glxSetup, NULL }; - -static pointer -glxSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - static Bool setupDone = FALSE; - pointer GLcore = NULL; -#ifdef GLX_USE_SGI_SI - char GLcoreName[] = "GL"; -#else - char GLcoreName[] = "GLcore"; -#endif - - if (!setupDone) { - setupDone = TRUE; - - GLcore = LoadSubModule(module, GLcoreName, NULL, NULL, NULL, NULL, - errmaj, errmin); - if (!GLcore) { - if (errmaj) *errmaj = LDR_NOSUBENT; - } else { - LoaderReqSymLists(glcoreSymbols, NULL); - LoadExtension(&GLXExt, FALSE); - /* Wrap the init visuals routine in micmap.c */ - GlxWrapInitVisuals(&miInitVisualsProc); - /* Make sure this gets wrapped each time InitVisualWrap is called */ - miHookInitVisuals(NULL, GlxWrapInitVisuals); - } - } else { - if (errmaj) *errmaj = LDR_ONCEONLY; - } - /* Need a non-NULL return value to indicate success */ - return GLcore; -} diff --git a/nx-X11/programs/Xserver/GL/include/GL/glx_ansic.h b/nx-X11/programs/Xserver/GL/include/GL/glx_ansic.h index c94393fd1..2f7cff193 100644 --- a/nx-X11/programs/Xserver/GL/include/GL/glx_ansic.h +++ b/nx-X11/programs/Xserver/GL/include/GL/glx_ansic.h @@ -1,115 +1,5 @@ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif +/* no-op file to make current Mesa happy */ #ifndef _glx_ansic_h_ #define _glx_ansic_h_ - -/* $XFree86: xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.5 2001/03/21 20:49:08 dawes Exp $ */ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -*/ - -/* -** this needs to check whether we're using XFree86 at all, and then -** which version we're using. Use these macros if version is 3.9+, else -** use normal commands below. -*/ - -/* -** turns out this include file only exists for XFree86 3.9+ -** I notice that not having it is not an error and does not stop the build, -** but having it will allow opengl and glx to be built for 3.9+. We no longer -** need an explicit define in the Makefile, just point to the correct X source -** tree and all should be taken care of. -*/ - -#ifdef XFree86Server - -#ifdef XFree86LOADER -#include "xf86_ansic.h" -#endif -#ifndef assert -#define assert(a) #endif - -#else - -#if defined(Lynx) && defined(__assert_h) -#undef __assert_h -#endif -#ifdef assert -#undef assert -#endif -#include <assert.h> - -#endif - - -#define GLX_STDOUT stdout -#define GLX_STDERR stderr -#define __glXPrintf printf -#define __glXFprintf fprintf -#define __glXSprintf sprintf -#define __glXVfprintf vfprintf -#define __glXVsprintf vsprintf -#define __glXFopen fopen -#define __glXFclose fclose -#define __glXCos(x) cos(x) -#define __glXSin(x) sin(x) -#define __glXAtan(x) atan(x) -#define __glXAbs(x) abs(x) -#define __glXLog(x) log(x) -#define __glXCeil(x) ceil(x) -#define __glXFloor(x) floor(x) -#define __glXSqrt(x) sqrt(x) -#define __glXPow(x, y) pow(x, y) -#define __glXMemmove(dest, src, n) memmove(dest, src, n) -#define __glXMemcpy(dest, src, n) memcpy(dest, src, n) -#define __glXMemset(s, c, n) memset(s, c, n) -#define __glXStrdup(str) xstrdup(str) -#define __glXStrcpy(dest, src) strcpy(dest, src) -#define __glXStrncpy(dest, src, n) strncpy(dest, src, n) -#define __glXStrcat(dest, src) strcat(dest, src) -#define __glXStrncat(dest, src, n) strncat(dest, src, n) -#define __glXStrcmp(s1, s2) strcmp(s1, s2) -#define __glXStrncmp(s1, s2, n) strncmp(s1, s2, n) -#define __glXStrlen(str) strlen(str) -#define __glXAbort() abort() -#define __glXStrtok(s, delim) strtok(s, delim) -#define __glXStrcspn(s, reject) strcspn(s, reject) -#define __glXGetenv(a) getenv(a) -#define __glXAtoi(a) atoi(a) - -#endif /* _glx_ansic_h_ */ - diff --git a/nx-X11/programs/Xserver/GL/include/GL/xf86glx.h b/nx-X11/programs/Xserver/GL/include/GL/xf86glx.h index 66f096a98..5ddc70a15 100644 --- a/nx-X11/programs/Xserver/GL/include/GL/xf86glx.h +++ b/nx-X11/programs/Xserver/GL/include/GL/xf86glx.h @@ -1,43 +1 @@ -/* $XFree86: xc/programs/Xserver/GL/include/GL/xf86glx.h,v 1.3 1999/06/14 07:31:41 dawes Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "miscstruct.h" - -#ifdef XFree86LOADER -#include "xf86_ansic.h" -#endif +/* no-op file to make current Mesa happy */ diff --git a/nx-X11/programs/Xserver/GL/mesa/GLcore/GLcore-def.cpp b/nx-X11/programs/Xserver/GL/mesa/GLcore/GLcore-def.cpp deleted file mode 100644 index 6fca465cd..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/GLcore/GLcore-def.cpp +++ /dev/null @@ -1,1462 +0,0 @@ -LIBRARY GLcore -VERSION LIBRARY_VERSION -EXPORTS - -_mesa_set_aa_triangle_function -_mesa_Accum -_mesa_ClearAccum -_mesa_alloc_accum_buffer -_mesa_clear_accum_buffer -_mesa_AlphaFunc -_mesa_alpha_test -_mesa_alloc_alpha_buffers -_mesa_clear_alpha_buffers -_mesa_read_alpha_pixels -_mesa_read_alpha_span -_mesa_write_alpha_pixels -_mesa_write_alpha_span -_mesa_write_mono_alpha_pixels -_mesa_write_mono_alpha_span -_mesa_PopAttrib -_mesa_PopClientAttrib -_mesa_PushAttrib -_mesa_PushClientAttrib -_mesa_Bitmap -_mesa_BlendColor -_mesa_BlendEquation -_mesa_BlendFunc -_mesa_BlendFuncSeparateEXT -_mesa_blend_pixels -_mesa_blend_span -_mesa_Clear -_mesa_ClearColor -_mesa_ClearIndex -_mesa_DrawBuffer -_mesa_ReadBuffer -_mesa_ResizeBuffersMESA -_mesa_ClipPlane -_mesa_GetClipPlane -gl_init_clip -gl_update_clipmask -gl_update_userclip -gl_user_cliptest -gl_userclip_point -gl_viewclip_point -_mesa_ColorSubTable -_mesa_ColorTable -_mesa_ColorTableParameterfv -_mesa_ColorTableParameteriv -_mesa_CopyColorSubTable -_mesa_CopyColorTable -_mesa_GetColorTable -_mesa_GetColorTableParameterfv -_mesa_GetColorTableParameteriv -_mesa_free_colortable_data -_mesa_init_colortable -gl_read_config_file -gl_register_config_var -_mesa_Finish -_mesa_Flush -_mesa_create_visual -_mesa_destroy_visual -_mesa_get_dispatch -_mesa_initialize_context -_mesa_initialize_framebuffer -_mesa_initialize_visual -_mesa_swapbuffers -gl_compile_error -gl_context_initialize -gl_copy_context -gl_create_context -gl_create_framebuffer -gl_create_visual -gl_destroy_context -gl_destroy_framebuffer -gl_destroy_visual -gl_error -gl_free_context_data -gl_get_current_context -gl_make_current -gl_make_current2 -gl_problem -gl_warning -_mesa_CopyPixels -_mesa_LockArraysEXT -_mesa_UnlockArraysEXT -gl_alloc_cva_store -gl_cva_compile_cassette -gl_cva_force_precalc -gl_cva_init -gl_free_cva_store -gl_merge_cva -gl_prepare_arrays_cva -gl_rescue_cva -_mesa_ClearDepth -_mesa_DepthFunc -_mesa_DepthMask -_mesa_alloc_depth_buffer -_mesa_clear_depth_buffer -_mesa_depth_test_pixels -_mesa_depth_test_span -_mesa_read_depth_span -_mesa_read_depth_span_float -_mesa_zbuffer_address -glAccum -glActiveTextureARB -glAlphaFunc -glAreTexturesResident -glAreTexturesResidentEXT -glArrayElement -glArrayElementEXT -glBegin -glBindTexture -glBindTextureEXT -glBitmap -glBlendColor -glBlendColorEXT -glBlendEquation -glBlendEquationEXT -glBlendFunc -glBlendFuncSeparateEXT -glBlendFuncSeparateINGR -glCallList -glCallLists -glClear -glClearAccum -glClearColor -glClearDepth -glClearIndex -glClearStencil -glClientActiveTextureARB -glClipPlane -glColor3b -glColor3bv -glColor3d -glColor3dv -glColor3f -glColor3fv -glColor3i -glColor3iv -glColor3s -glColor3sv -glColor3ub -glColor3ubv -glColor3ui -glColor3uiv -glColor3us -glColor3usv -glColor4b -glColor4bv -glColor4d -glColor4dv -glColor4f -glColor4fv -glColor4i -glColor4iv -glColor4s -glColor4sv -glColor4ub -glColor4ubv -glColor4ui -glColor4uiv -glColor4us -glColor4usv -glColorMask -glColorMaterial -glColorPointer -glColorPointerEXT -glColorSubTable -glColorSubTableEXT -glColorTable -glColorTableEXT -glColorTableParameterfv -glColorTableParameterfvSGI -glColorTableParameteriv -glColorTableParameterivSGI -glColorTableSGI -glCombinerInputNV -glCombinerOutputNV -glCombinerParameterfNV -glCombinerParameterfvNV -glCombinerParameteriNV -glCombinerParameterivNV -glCompressedTexImage1DARB -glCompressedTexImage2DARB -glCompressedTexImage3DARB -glCompressedTexSubImage1DARB -glCompressedTexSubImage2DARB -glCompressedTexSubImage3DARB -glConvolutionFilter1D -glConvolutionFilter1DEXT -glConvolutionFilter2D -glConvolutionFilter2DEXT -glConvolutionParameterf -glConvolutionParameterfEXT -glConvolutionParameterfv -glConvolutionParameterfvEXT -glConvolutionParameteri -glConvolutionParameteriEXT -glConvolutionParameteriv -glConvolutionParameterivEXT -glCopyColorSubTable -glCopyColorSubTableEXT -glCopyColorTable -glCopyColorTableSGI -glCopyConvolutionFilter1D -glCopyConvolutionFilter1DEXT -glCopyConvolutionFilter2D -glCopyConvolutionFilter2DEXT -glCopyPixels -glCopyTexImage1D -glCopyTexImage1DEXT -glCopyTexImage2D -glCopyTexImage2DEXT -glCopyTexSubImage1D -glCopyTexSubImage1DEXT -glCopyTexSubImage2D -glCopyTexSubImage2DEXT -glCopyTexSubImage3D -glCopyTexSubImage3DEXT -glCullFace -glCullParameterdvEXT -glCullParameterfvEXT -glDeleteLists -glDeleteTextures -glDeleteTexturesEXT -glDepthFunc -glDepthMask -glDepthRange -glDetailTexFuncSGIS -glDisable -glDisableClientState -glDrawArrays -glDrawArraysEXT -glDrawBuffer -glDrawElements -glDrawPixels -glDrawRangeElements -glDrawRangeElementsEXT -glEdgeFlag -glEdgeFlagPointer -glEdgeFlagPointerEXT -glEdgeFlagv -glEnable -glEnableClientState -glEnd -glEndList -glEvalCoord1d -glEvalCoord1dv -glEvalCoord1f -glEvalCoord1fv -glEvalCoord2d -glEvalCoord2dv -glEvalCoord2f -glEvalCoord2fv -glEvalMesh1 -glEvalMesh2 -glEvalPoint1 -glEvalPoint2 -glFeedbackBuffer -glFinalCombinerInputNV -glFinish -glFlush -glFlushRasterSGIX -glFlushVertexArrayRangeNV -glFogCoordPointerEXT -glFogCoorddEXT -glFogCoorddvEXT -glFogCoordfEXT -glFogCoordfvEXT -glFogf -glFogfv -glFogi -glFogiv -glFragmentColorMaterialSGIX -glFragmentLightModelfSGIX -glFragmentLightModelfvSGIX -glFragmentLightModeliSGIX -glFragmentLightModelivSGIX -glFragmentLightfSGIX -glFragmentLightfvSGIX -glFragmentLightiSGIX -glFragmentLightivSGIX -glFragmentMaterialfSGIX -glFragmentMaterialfvSGIX -glFragmentMaterialiSGIX -glFragmentMaterialivSGIX -glFrameZoomSGIX -glFrontFace -glFrustum -glGenLists -glGenTextures -glGenTexturesEXT -glGetBooleanv -glGetClipPlane -glGetColorTable -glGetColorTableEXT -glGetColorTableParameterfv -glGetColorTableParameterfvEXT -glGetColorTableParameterfvSGI -glGetColorTableParameteriv -glGetColorTableParameterivEXT -glGetColorTableParameterivSGI -glGetColorTableSGI -glGetCombinerInputParameterfvNV -glGetCombinerInputParameterivNV -glGetCombinerOutputParameterfvNV -glGetCombinerOutputParameterivNV -glGetCompressedTexImageARB -glGetConvolutionFilter -glGetConvolutionFilterEXT -glGetConvolutionParameterfv -glGetConvolutionParameterfvEXT -glGetConvolutionParameteriv -glGetConvolutionParameterivEXT -glGetDetailTexFuncSGIS -glGetDoublev -glGetError -glGetFinalCombinerInputParameterfvNV -glGetFinalCombinerInputParameterivNV -glGetFloatv -glGetFragmentLightfvSGIX -glGetFragmentLightivSGIX -glGetFragmentMaterialfvSGIX -glGetFragmentMaterialivSGIX -glGetHistogram -glGetHistogramEXT -glGetHistogramParameterfv -glGetHistogramParameterfvEXT -glGetHistogramParameteriv -glGetHistogramParameterivEXT -glGetInstrumentsSGIX -glGetIntegerv -glGetLightfv -glGetLightiv -glGetListParameterfvSGIX -glGetListParameterivSGIX -glGetMapdv -glGetMapfv -glGetMapiv -glGetMaterialfv -glGetMaterialiv -glGetMinmax -glGetMinmaxEXT -glGetMinmaxParameterfv -glGetMinmaxParameterfvEXT -glGetMinmaxParameteriv -glGetMinmaxParameterivEXT -glGetPixelMapfv -glGetPixelMapuiv -glGetPixelMapusv -glGetPixelTexGenParameterfvSGIS -glGetPixelTexGenParameterivSGIS -glGetPointerv -glGetPointervEXT -glGetPolygonStipple -glGetSeparableFilter -glGetSeparableFilterEXT -glGetSharpenTexFuncSGIS -glGetString -glGetTexEnvfv -glGetTexEnviv -glGetTexFilterFuncSGIS -glGetTexGendv -glGetTexGenfv -glGetTexGeniv -glGetTexImage -glGetTexLevelParameterfv -glGetTexLevelParameteriv -glGetTexParameterfv -glGetTexParameteriv -glHint -glHintPGI -glHistogram -glHistogramEXT -glIndexFuncEXT -glIndexMask -glIndexMaterialEXT -glIndexPointer -glIndexPointerEXT -glIndexd -glIndexdv -glIndexf -glIndexfv -glIndexi -glIndexiv -glIndexs -glIndexsv -glIndexub -glIndexubv -glInitNames -glInstrumentsBufferSGIX -glInterleavedArrays -glIsEnabled -glIsList -glIsTexture -glIsTextureEXT -glLightEnviSGIX -glLightModelf -glLightModelfv -glLightModeli -glLightModeliv -glLightf -glLightfv -glLighti -glLightiv -glLineStipple -glLineWidth -glListBase -glListParameterfSGIX -glListParameterfvSGIX -glListParameteriSGIX -glListParameterivSGIX -glLoadIdentity -glLoadMatrixd -glLoadMatrixf -glLoadName -glLoadTransposeMatrixdARB -glLoadTransposeMatrixfARB -glLockArraysEXT -glLogicOp -glMap1d -glMap1f -glMap2d -glMap2f -glMapGrid1d -glMapGrid1f -glMapGrid2d -glMapGrid2f -glMaterialf -glMaterialfv -glMateriali -glMaterialiv -glMatrixMode -glMinmax -glMinmaxEXT -glMultMatrixd -glMultMatrixf -glMultTransposeMatrixdARB -glMultTransposeMatrixfARB -glMultiTexCoord1dARB -glMultiTexCoord1dvARB -glMultiTexCoord1fARB -glMultiTexCoord1fvARB -glMultiTexCoord1iARB -glMultiTexCoord1ivARB -glMultiTexCoord1sARB -glMultiTexCoord1svARB -glMultiTexCoord2dARB -glMultiTexCoord2dvARB -glMultiTexCoord2fARB -glMultiTexCoord2fvARB -glMultiTexCoord2iARB -glMultiTexCoord2ivARB -glMultiTexCoord2sARB -glMultiTexCoord2svARB -glMultiTexCoord3dARB -glMultiTexCoord3dvARB -glMultiTexCoord3fARB -glMultiTexCoord3fvARB -glMultiTexCoord3iARB -glMultiTexCoord3ivARB -glMultiTexCoord3sARB -glMultiTexCoord3svARB -glMultiTexCoord4dARB -glMultiTexCoord4dvARB -glMultiTexCoord4fARB -glMultiTexCoord4fvARB -glMultiTexCoord4iARB -glMultiTexCoord4ivARB -glMultiTexCoord4sARB -glMultiTexCoord4svARB -glNewList -glNormal3b -glNormal3bv -glNormal3d -glNormal3dv -glNormal3f -glNormal3fv -glNormal3i -glNormal3iv -glNormal3s -glNormal3sv -glNormalPointer -glNormalPointerEXT -glOrtho -glPassThrough -glPixelMapfv -glPixelMapuiv -glPixelMapusv -glPixelStoref -glPixelStorei -glPixelTexGenParameterfSGIS -glPixelTexGenParameterfvSGIS -glPixelTexGenParameteriSGIS -glPixelTexGenParameterivSGIS -glPixelTexGenSGIX -glPixelTransferf -glPixelTransferi -glPixelZoom -glPointParameterfEXT -glPointParameterfSGIS -glPointParameterfvEXT -glPointParameterfvSGIS -glPointSize -glPollInstrumentsSGIX -glPolygonMode -glPolygonOffset -glPolygonOffsetEXT -glPolygonStipple -glPopAttrib -glPopClientAttrib -glPopMatrix -glPopName -glPrioritizeTextures -glPrioritizeTexturesEXT -glPushAttrib -glPushClientAttrib -glPushMatrix -glPushName -glRasterPos2d -glRasterPos2dv -glRasterPos2f -glRasterPos2fv -glRasterPos2i -glRasterPos2iv -glRasterPos2s -glRasterPos2sv -glRasterPos3d -glRasterPos3dv -glRasterPos3f -glRasterPos3fv -glRasterPos3i -glRasterPos3iv -glRasterPos3s -glRasterPos3sv -glRasterPos4d -glRasterPos4dv -glRasterPos4f -glRasterPos4fv -glRasterPos4i -glRasterPos4iv -glRasterPos4s -glRasterPos4sv -glReadBuffer -glReadInstrumentsSGIX -glReadPixels -glRectd -glRectdv -glRectf -glRectfv -glRecti -glRectiv -glRects -glRectsv -glReferencePlaneSGIX -glRenderMode -glResetHistogram -glResetHistogramEXT -glResetMinmax -glResetMinmaxEXT -glResizeBuffersMESA -glRotated -glRotatef -glSampleCoverageARB -glSampleMaskEXT -glSampleMaskSGIS -glSamplePassARB -glSamplePatternEXT -glSamplePatternSGIS -glScaled -glScalef -glScissor -glSelectBuffer -glSeparableFilter2D -glSeparableFilter2DEXT -glShadeModel -glSharpenTexFuncSGIS -glSpriteParameterfSGIX -glSpriteParameterfvSGIX -glSpriteParameteriSGIX -glSpriteParameterivSGIX -glStartInstrumentsSGIX -glStencilFunc -glStencilMask -glStencilOp -glStopInstrumentsSGIX -glTagSampleBufferSGIX -glTbufferMask3DFX -glTexCoord1d -glTexCoord1dv -glTexCoord1f -glTexCoord1fv -glTexCoord1i -glTexCoord1iv -glTexCoord1s -glTexCoord1sv -glTexCoord2d -glTexCoord2dv -glTexCoord2f -glTexCoord2fv -glTexCoord2i -glTexCoord2iv -glTexCoord2s -glTexCoord2sv -glTexCoord3d -glTexCoord3dv -glTexCoord3f -glTexCoord3fv -glTexCoord3i -glTexCoord3iv -glTexCoord3s -glTexCoord3sv -glTexCoord4d -glTexCoord4dv -glTexCoord4f -glTexCoord4fv -glTexCoord4i -glTexCoord4iv -glTexCoord4s -glTexCoord4sv -glTexCoordPointer -glTexCoordPointerEXT -glTexEnvf -glTexEnvfv -glTexEnvi -glTexEnviv -glTexFilterFuncSGIS -glTexGend -glTexGendv -glTexGenf -glTexGenfv -glTexGeni -glTexGeniv -glTexImage1D -glTexImage2D -glTexImage3D -glTexImage3DEXT -glTexImage4DSGIS -glTexParameterf -glTexParameterfv -glTexParameteri -glTexParameteriv -glTexSubImage1D -glTexSubImage1DEXT -glTexSubImage2D -glTexSubImage2DEXT -glTexSubImage3D -glTexSubImage3DEXT -glTexSubImage4DSGIS -glTranslated -glTranslatef -glUnlockArraysEXT -glVertex2d -glVertex2dv -glVertex2f -glVertex2fv -glVertex2i -glVertex2iv -glVertex2s -glVertex2sv -glVertex3d -glVertex3dv -glVertex3f -glVertex3fv -glVertex3i -glVertex3iv -glVertex3s -glVertex3sv -glVertex4d -glVertex4dv -glVertex4f -glVertex4fv -glVertex4i -glVertex4iv -glVertex4s -glVertex4sv -glVertexArrayRangeNV -glVertexPointer -glVertexPointerEXT -glVertexWeightPointerEXT -glVertexWeightfEXT -glVertexWeightfvEXT -glViewport -glWindowPos2dMESA -glWindowPos2dvMESA -glWindowPos2fMESA -glWindowPos2fvMESA -glWindowPos2iMESA -glWindowPos2ivMESA -glWindowPos2sMESA -glWindowPos2svMESA -glWindowPos3dMESA -glWindowPos3dvMESA -glWindowPos3fMESA -glWindowPos3fvMESA -glWindowPos3iMESA -glWindowPos3ivMESA -glWindowPos3sMESA -glWindowPos3svMESA -glWindowPos4dMESA -glWindowPos4dvMESA -glWindowPos4fMESA -glWindowPos4fvMESA -glWindowPos4iMESA -glWindowPos4ivMESA -glWindowPos4sMESA -glWindowPos4svMESA -_mesa_CallList -_mesa_CallLists -_mesa_DeleteLists -_mesa_EndList -_mesa_GenLists -_mesa_IsList -_mesa_ListBase -_mesa_NewList -_mesa_init_dlist_table -gl_compile_cassette -gl_destroy_list -gl_init_lists -gl_save_error -mesa_print_display_list -_mesa_DrawPixels -_mesa_clip_pixelrect -_mesa_Disable -_mesa_DisableClientState -_mesa_Enable -_mesa_EnableClientState -_mesa_IsEnabled -_mesa_set_enable -gl_lookup_enum_by_name -gl_lookup_enum_by_nr -_mesa_EvalCoord1d -_mesa_EvalCoord1dv -_mesa_EvalCoord1f -_mesa_EvalCoord1fv -_mesa_EvalCoord2d -_mesa_EvalCoord2dv -_mesa_EvalCoord2f -_mesa_EvalCoord2fv -_mesa_EvalMesh1 -_mesa_EvalMesh2 -_mesa_EvalPoint1 -_mesa_EvalPoint2 -_mesa_GetMapdv -_mesa_GetMapfv -_mesa_GetMapiv -_mesa_Map1d -_mesa_Map1f -_mesa_Map2d -_mesa_Map2f -_mesa_MapGrid1d -_mesa_MapGrid1f -_mesa_MapGrid2d -_mesa_MapGrid2f -_mesa_evaluator_components -gl_copy_map_points1d -gl_copy_map_points1f -gl_copy_map_points2d -gl_copy_map_points2f -gl_eval_vb -gl_init_eval -gl_extension_is_enabled -gl_extensions_add -gl_extensions_ctr -gl_extensions_disable -gl_extensions_dtr -gl_extensions_enable -gl_extensions_get_string -_mesa_FeedbackBuffer -_mesa_InitNames -_mesa_LoadName -_mesa_PassThrough -_mesa_PopName -_mesa_PushName -_mesa_RenderMode -_mesa_SelectBuffer -gl_feedback_line -gl_feedback_points -gl_feedback_triangle -gl_feedback_vertex -gl_select_line -gl_select_points -gl_select_triangle -gl_update_hitflag -_mesa_Fogf -_mesa_Fogfv -_mesa_Fogi -_mesa_Fogiv -_mesa_fog_ci_pixels -_mesa_fog_rgba_pixels -_mesa_fog_vertices -_mesa_init_fog -_mesa_GetBooleanv -_mesa_GetDoublev -_mesa_GetError -_mesa_GetFloatv -_mesa_GetIntegerv -_mesa_GetPointerv -_mesa_GetString -_glapi_add_entrypoint -_glapi_check_multithread -_glapi_check_table -_glapi_get_context -_glapi_get_dispatch -_glapi_get_dispatch_table_size -_glapi_get_proc_address -_glapi_get_proc_name -_glapi_get_proc_offset -_glapi_get_version -_glapi_set_context -_glapi_set_dispatch -_glapi_noop_enable_warnings -_glthread_GetID -_glthread_GetTSD -_glthread_InitTSD -_glthread_SetTSD -_mesa_DeleteHashTable -_mesa_HashFindFreeKeyBlock -_mesa_HashFirstEntry -_mesa_HashInsert -_mesa_HashLookup -_mesa_HashPrint -_mesa_HashRemove -_mesa_NewHashTable -_mesa_Hint -_mesa_HintPGI -_mesa_try_Hint -_mesa_bytes_per_pixel -_mesa_components_in_format -_mesa_image_address -_mesa_image_row_stride -_mesa_is_legal_format_and_type -_mesa_native_packing -_mesa_pack_bitmap -_mesa_pack_polygon_stipple -_mesa_pack_rgba_span -_mesa_sizeof_packed_type -_mesa_sizeof_type -_mesa_swap2 -_mesa_swap4 -_mesa_unpack_bitmap -_mesa_unpack_depth_span -_mesa_unpack_float_color_span -_mesa_unpack_image -_mesa_unpack_index_span -_mesa_unpack_polygon_stipple -_mesa_unpack_stencil_span -_mesa_unpack_ubyte_color_span -_mesa_ConvolutionFilter1D -_mesa_ConvolutionFilter2D -_mesa_ConvolutionParameterf -_mesa_ConvolutionParameterfv -_mesa_ConvolutionParameteri -_mesa_ConvolutionParameteriv -_mesa_CopyConvolutionFilter1D -_mesa_CopyConvolutionFilter2D -_mesa_GetConvolutionFilter -_mesa_GetConvolutionParameterfv -_mesa_GetConvolutionParameteriv -_mesa_GetHistogram -_mesa_GetHistogramParameterfv -_mesa_GetHistogramParameteriv -_mesa_GetMinmax -_mesa_GetMinmaxParameterfv -_mesa_GetMinmaxParameteriv -_mesa_GetSeparableFilter -_mesa_Histogram -_mesa_Minmax -_mesa_ResetHistogram -_mesa_ResetMinmax -_mesa_SeparableFilter2D -_mesa_update_histogram -_mesa_update_minmax -_mesa_ColorMaterial -_mesa_GetLightfv -_mesa_GetLightiv -_mesa_GetMaterialfv -_mesa_GetMaterialiv -_mesa_LightModelf -_mesa_LightModelfv -_mesa_LightModeli -_mesa_LightModeliv -_mesa_Lightf -_mesa_Lightfv -_mesa_Lighti -_mesa_Lightiv -_mesa_Materialf -_mesa_Materialfv -_mesa_Materiali -_mesa_Materialiv -_mesa_ShadeModel -gl_compute_light_positions -gl_compute_shine_table -gl_compute_spot_exp_table -gl_material_bitmask -gl_update_color_material -gl_update_lighting -gl_update_material -gl_update_normal_transform -_mesa_LineStipple -_mesa_LineWidth -gl_set_line_function -_mesa_LogicOp -_mesa_logicop_ci_pixels -_mesa_logicop_ci_span -_mesa_logicop_rgba_pixels -_mesa_logicop_rgba_span -_mesa_ColorMask -_mesa_IndexMask -_mesa_mask_index_pixels -_mesa_mask_index_span -_mesa_mask_rgba_pixels -_mesa_mask_rgba_span -_mesa_DepthRange -_mesa_Frustum -_mesa_LoadIdentity -_mesa_LoadMatrixd -_mesa_LoadMatrixf -_mesa_LoadTransposeMatrixdARB -_mesa_LoadTransposeMatrixfARB -_mesa_MatrixMode -_mesa_MultMatrixd -_mesa_MultMatrixf -_mesa_MultTransposeMatrixdARB -_mesa_MultTransposeMatrixfARB -_mesa_Ortho -_mesa_PopMatrix -_mesa_PushMatrix -_mesa_Rotated -_mesa_Rotatef -_mesa_Scaled -_mesa_Scalef -_mesa_Translated -_mesa_Translatef -_mesa_Viewport -gl_Viewport -gl_calculate_model_project_matrix -gl_mat_mul_floats -gl_mat_mul_mat -gl_matrix_alloc_inv -gl_matrix_analyze -gl_matrix_copy -gl_matrix_ctr -gl_matrix_dtr -gl_matrix_invert -gl_matrix_mul -gl_matrix_transposed -gl_matrix_transposef -gl_print_matrix -gl_rotation_matrix -_mesa_calloc -_mesa_free -_mesa_malloc -_mesa_bitcount -_mesa_init_math -gl_sqrt -gl_alloc_pb -gl_flush_pb -gl_build_immediate_pipeline -gl_build_precalc_pipeline -gl_pipeline_init -gl_print_active_pipeline -gl_print_pipe_ops -gl_print_pipeline -gl_print_tri_caps -gl_print_vert_flags -gl_reset_cva_vb -gl_run_pipeline -gl_update_pipelines -_mesa_GetPixelMapfv -_mesa_GetPixelMapuiv -_mesa_GetPixelMapusv -_mesa_PixelMapfv -_mesa_PixelMapuiv -_mesa_PixelMapusv -_mesa_PixelStoref -_mesa_PixelStorei -_mesa_PixelTransferf -_mesa_PixelTransferi -_mesa_PixelZoom -_mesa_lookup_rgba -_mesa_map_ci -_mesa_map_ci8_to_rgba -_mesa_map_ci_to_rgba -_mesa_map_ci_to_rgba_ubyte -_mesa_map_rgba -_mesa_map_stencil -_mesa_scale_and_bias_rgba -_mesa_shift_and_offset_ci -_mesa_shift_and_offset_stencil -_mesa_transform_rgba -_mesa_GetPixelTexGenParameterfvSGIS -_mesa_GetPixelTexGenParameterivSGIS -_mesa_PixelTexGenParameterfSGIS -_mesa_PixelTexGenParameterfvSGIS -_mesa_PixelTexGenParameteriSGIS -_mesa_PixelTexGenParameterivSGIS -_mesa_PixelTexGenSGIX -_mesa_pixeltexgen -_mesa_PointParameterfEXT -_mesa_PointParameterfvEXT -_mesa_PointSize -gl_set_point_function -_mesa_CullFace -_mesa_FrontFace -_mesa_GetPolygonStipple -_mesa_PolygonMode -_mesa_PolygonOffset -_mesa_PolygonOffsetEXT -_mesa_PolygonStipple -gl_set_quad_function -_mesa_RasterPos2d -_mesa_RasterPos2dv -_mesa_RasterPos2f -_mesa_RasterPos2fv -_mesa_RasterPos2i -_mesa_RasterPos2iv -_mesa_RasterPos2s -_mesa_RasterPos2sv -_mesa_RasterPos3d -_mesa_RasterPos3dv -_mesa_RasterPos3f -_mesa_RasterPos3fv -_mesa_RasterPos3i -_mesa_RasterPos3iv -_mesa_RasterPos3s -_mesa_RasterPos3sv -_mesa_RasterPos4d -_mesa_RasterPos4dv -_mesa_RasterPos4f -_mesa_RasterPos4fv -_mesa_RasterPos4i -_mesa_RasterPos4iv -_mesa_RasterPos4s -_mesa_RasterPos4sv -_mesa_ReadPixels -_mesa_Rectd -_mesa_Rectdv -_mesa_Rectf -_mesa_Rectfv -_mesa_Recti -_mesa_Rectiv -_mesa_Rects -_mesa_Rectsv -_mesa_Scissor -gl_scissor_pixels -gl_scissor_span -gl_init_shade -gl_shade_rastpos -gl_update_lighting_function -gl_read_index_span -gl_read_rgba_span -gl_write_index_span -gl_write_monocolor_span -gl_write_monoindex_span -gl_write_multitexture_span -gl_write_rgba_span -gl_write_texture_span -gl_clean_color -gl_default_nr_stages -gl_default_pipeline -gl_import_client_data -gl_init_vbxform -gl_update_materials -_mesa_init_exec_table -_mesa_init_no_op_table -gl_print_enable_flags -gl_print_state -gl_update_state -_mesa_ClearStencil -_mesa_StencilFunc -_mesa_StencilMask -_mesa_StencilOp -_mesa_alloc_stencil_buffer -_mesa_clear_stencil_buffer -_mesa_read_stencil_span -_mesa_stencil_and_ztest_pixels -_mesa_stencil_and_ztest_span -_mesa_write_stencil_span -_mesa_CompressedTexImage1DARB -_mesa_CompressedTexImage2DARB -_mesa_CompressedTexImage3DARB -_mesa_CompressedTexSubImage1DARB -_mesa_CompressedTexSubImage2DARB -_mesa_CompressedTexSubImage3DARB -_mesa_CopyTexImage1D -_mesa_CopyTexImage2D -_mesa_CopyTexSubImage1D -_mesa_CopyTexSubImage2D -_mesa_CopyTexSubImage3D -_mesa_GetCompressedTexImageARB -_mesa_GetTexImage -_mesa_TexImage1D -_mesa_TexImage2D -_mesa_TexImage3D -_mesa_TexImage3DEXT -_mesa_TexSubImage1D -_mesa_TexSubImage2D -_mesa_TexSubImage3D -_mesa_alloc_texture_image -_mesa_base_tex_format -_mesa_compressed_image_size -_mesa_free_texture_image -_mesa_get_teximage_from_driver -_mesa_select_tex_image -_mesa_select_tex_object -_mesa_AreTexturesResident -_mesa_BindTexture -_mesa_DeleteTextures -_mesa_GenTextures -_mesa_IsTexture -_mesa_PrioritizeTextures -_mesa_test_texobj_completeness -gl_alloc_texture_object -gl_free_texture_object -_mesa_ActiveTextureARB -_mesa_ClientActiveTextureARB -_mesa_GetTexEnvfv -_mesa_GetTexEnviv -_mesa_GetTexGendv -_mesa_GetTexGenfv -_mesa_GetTexGeniv -_mesa_GetTexLevelParameterfv -_mesa_GetTexLevelParameteriv -_mesa_GetTexParameterfv -_mesa_GetTexParameteriv -_mesa_TexEnvf -_mesa_TexEnvfv -_mesa_TexEnvi -_mesa_TexEnviv -_mesa_TexGend -_mesa_TexGendv -_mesa_TexGenf -_mesa_TexGenfv -_mesa_TexGeni -_mesa_TexGeniv -_mesa_TexParameterf -_mesa_TexParameterfv -_mesa_TexParameteri -_mesa_TexParameteriv -gl_put_texobj_on_dirty_list -gl_remove_texobj_from_dirty_list -gl_update_dirty_texobjs -_mesa_set_texture_sampler -gl_init_texture -gl_texture_pixels -gl_update_texture_unit -gl_init_translate -gl_cull_triangle -gl_set_triangle_function -_mesa_ArrayElement -_mesa_ColorPointer -_mesa_ColorPointerEXT -_mesa_DrawArrays -_mesa_DrawElements -_mesa_DrawRangeElements -_mesa_EdgeFlagPointer -_mesa_EdgeFlagPointerEXT -_mesa_IndexPointer -_mesa_IndexPointerEXT -_mesa_InterleavedArrays -_mesa_NormalPointer -_mesa_NormalPointerEXT -_mesa_TexCoordPointer -_mesa_TexCoordPointerEXT -_mesa_VertexPointer -_mesa_VertexPointerEXT -gl_exec_array_elements -gl_update_client_state -gl_immediate_alloc -gl_immediate_free -gl_vb_create_for_cva -gl_vb_create_for_immediate -gl_vb_free -gl_cull_vb -gl_dont_cull_vb -gl_fast_copy_vb -gl_make_normal_cullmask -gl_purge_vertices -_mesa_Begin -_mesa_Color3b -_mesa_Color3bv -_mesa_Color3d -_mesa_Color3dv -_mesa_Color3f -_mesa_Color3fv -_mesa_Color3i -_mesa_Color3iv -_mesa_Color3s -_mesa_Color3sv -_mesa_Color3ub -_mesa_Color3ubv -_mesa_Color3ui -_mesa_Color3uiv -_mesa_Color3us -_mesa_Color3usv -_mesa_Color4b -_mesa_Color4bv -_mesa_Color4d -_mesa_Color4dv -_mesa_Color4f -_mesa_Color4fv -_mesa_Color4i -_mesa_Color4iv -_mesa_Color4s -_mesa_Color4sv -_mesa_Color4ub -_mesa_Color4ubv -_mesa_Color4ui -_mesa_Color4uiv -_mesa_Color4us -_mesa_Color4usv -_mesa_EdgeFlag -_mesa_EdgeFlagv -_mesa_End -_mesa_Indexd -_mesa_Indexdv -_mesa_Indexf -_mesa_Indexfv -_mesa_Indexi -_mesa_Indexiv -_mesa_Indexs -_mesa_Indexsv -_mesa_Indexub -_mesa_Indexubv -_mesa_MultiTexCoord1dARB -_mesa_MultiTexCoord1dvARB -_mesa_MultiTexCoord1fARB -_mesa_MultiTexCoord1fvARB -_mesa_MultiTexCoord1iARB -_mesa_MultiTexCoord1ivARB -_mesa_MultiTexCoord1sARB -_mesa_MultiTexCoord1svARB -_mesa_MultiTexCoord2dARB -_mesa_MultiTexCoord2dvARB -_mesa_MultiTexCoord2fARB -_mesa_MultiTexCoord2fvARB -_mesa_MultiTexCoord2iARB -_mesa_MultiTexCoord2ivARB -_mesa_MultiTexCoord2sARB -_mesa_MultiTexCoord2svARB -_mesa_MultiTexCoord3dARB -_mesa_MultiTexCoord3dvARB -_mesa_MultiTexCoord3fARB -_mesa_MultiTexCoord3fvARB -_mesa_MultiTexCoord3iARB -_mesa_MultiTexCoord3ivARB -_mesa_MultiTexCoord3sARB -_mesa_MultiTexCoord3svARB -_mesa_MultiTexCoord4dARB -_mesa_MultiTexCoord4dvARB -_mesa_MultiTexCoord4fARB -_mesa_MultiTexCoord4fvARB -_mesa_MultiTexCoord4iARB -_mesa_MultiTexCoord4ivARB -_mesa_MultiTexCoord4sARB -_mesa_MultiTexCoord4svARB -_mesa_Normal3b -_mesa_Normal3bv -_mesa_Normal3d -_mesa_Normal3dv -_mesa_Normal3f -_mesa_Normal3fv -_mesa_Normal3i -_mesa_Normal3iv -_mesa_Normal3s -_mesa_Normal3sv -_mesa_TexCoord1d -_mesa_TexCoord1dv -_mesa_TexCoord1f -_mesa_TexCoord1fv -_mesa_TexCoord1i -_mesa_TexCoord1iv -_mesa_TexCoord1s -_mesa_TexCoord1sv -_mesa_TexCoord2d -_mesa_TexCoord2dv -_mesa_TexCoord2f -_mesa_TexCoord2fv -_mesa_TexCoord2i -_mesa_TexCoord2iv -_mesa_TexCoord2s -_mesa_TexCoord2sv -_mesa_TexCoord3d -_mesa_TexCoord3dv -_mesa_TexCoord3f -_mesa_TexCoord3fv -_mesa_TexCoord3i -_mesa_TexCoord3iv -_mesa_TexCoord3s -_mesa_TexCoord3sv -_mesa_TexCoord4d -_mesa_TexCoord4dv -_mesa_TexCoord4f -_mesa_TexCoord4fv -_mesa_TexCoord4i -_mesa_TexCoord4iv -_mesa_TexCoord4s -_mesa_TexCoord4sv -_mesa_Vertex2d -_mesa_Vertex2dv -_mesa_Vertex2f -_mesa_Vertex2fv -_mesa_Vertex2i -_mesa_Vertex2iv -_mesa_Vertex2s -_mesa_Vertex2sv -_mesa_Vertex3d -_mesa_Vertex3dv -_mesa_Vertex3f -_mesa_Vertex3fv -_mesa_Vertex3i -_mesa_Vertex3iv -_mesa_Vertex3s -_mesa_Vertex3sv -_mesa_Vertex4d -_mesa_Vertex4dv -_mesa_Vertex4f -_mesa_Vertex4fv -_mesa_Vertex4i -_mesa_Vertex4iv -_mesa_Vertex4s -_mesa_Vertex4sv -gl_Begin -gl_End -gl_Vertex2f -gl_render_elts -gl_render_vb_indirect -gl_init_vbrender -gl_reduced_prim_change -gl_render_clipped_line -gl_render_clipped_triangle -gl_render_vb -gl_set_render_vb_function -RESET_IMMEDIATE -gl_compute_orflag -gl_copy_prev_vertices -gl_copy_to_current -gl_execute_cassette -gl_fixup_cassette -gl_fixup_input -gl_flush_vb -gl_internal_flush -gl_maybe_transform_vb -gl_print_cassette -gl_print_cassette_flags -gl_reset_input -gl_reset_vb -gl_texcoord_size -gl_vector1ub_alloc -gl_vector1ub_free -gl_vector1ub_init -gl_vector1ui_alloc -gl_vector1ui_free -gl_vector1ui_init -gl_vector3f_alloc -gl_vector3f_free -gl_vector3f_init -gl_vector3f_print -gl_vector4f_alloc -gl_vector4f_clean_elem -gl_vector4f_free -gl_vector4f_init -gl_vector4f_print -gl_vector4ub_alloc -gl_vector4ub_free -gl_vector4ub_init -gl_init_vertices -_mesa_WindowPos2dMESA -_mesa_WindowPos2dvMESA -_mesa_WindowPos2fMESA -_mesa_WindowPos2fvMESA -_mesa_WindowPos2iMESA -_mesa_WindowPos2ivMESA -_mesa_WindowPos2sMESA -_mesa_WindowPos2svMESA -_mesa_WindowPos3dMESA -_mesa_WindowPos3dvMESA -_mesa_WindowPos3fMESA -_mesa_WindowPos3fvMESA -_mesa_WindowPos3iMESA -_mesa_WindowPos3ivMESA -_mesa_WindowPos3sMESA -_mesa_WindowPos3svMESA -_mesa_WindowPos4dMESA -_mesa_WindowPos4dvMESA -_mesa_WindowPos4fMESA -_mesa_WindowPos4fvMESA -_mesa_WindowPos4iMESA -_mesa_WindowPos4ivMESA -_mesa_WindowPos4sMESA -_mesa_WindowPos4svMESA -gl_init_transformation -gl_project_points -gl_transform_point_sz -gl_transform_vector -gl_write_zoomed_index_span -gl_write_zoomed_rgb_span -gl_write_zoomed_rgba_span -gl_write_zoomed_stencil_span -__MESA_beginDispatchOverride -__MESA_copyContext -__MESA_createBuffer -__MESA_createContext -__MESA_destroyBuffer -__MESA_destroyContext -__MESA_dispatchExec -__MESA_endDispatchOverride -__MESA_forceCurrent -__MESA_initVisuals -__MESA_loseCurrent -__MESA_makeCurrent -__MESA_notifyDestroy -__MESA_notifyResize -__MESA_notifySwapBuffers -__MESA_resetExtension -__MESA_resizeBuffers -__MESA_screenProbe -__MESA_setVisualConfigs -__MESA_shareContext -__MESA_swapBuffers -__glFloorLog2 -XMesaCreateImage -XMesaDestroyImage -XMesaGetPixel -XMesaPutImageHelper -XMesaCopySubBuffer -XMesaCreateContext -XMesaCreatePixmapBuffer -XMesaCreateVisual -XMesaCreateWindowBuffer -XMesaCreateWindowBuffer2 -XMesaDestroyBuffer -XMesaDestroyContext -XMesaDestroyVisual -XMesaDitherColor -XMesaFindBuffer -XMesaFlush -XMesaForceCurrent -XMesaGarbageCollect -XMesaGetBackBuffer -XMesaGetCurrentBuffer -XMesaGetCurrentContext -XMesaGetCurrentReadBuffer -XMesaGetDepthBuffer -XMesaGetString -XMesaLoseCurrent -XMesaMakeCurrent -XMesaMakeCurrent2 -XMesaReset -XMesaSetFXmode -XMesaSetVisualDisplay -XMesaSwapBuffers -XMesaUnbindContext -xmesa_alloc_back_buffer -xmesa_color_to_pixel -xmesa_update_state -xmesa_get_line_func -xmesa_get_points_func -xmesa_get_triangle_func - -/* $XFree86: xc/programs/Xserver/GL/mesa/src/GLcore-def.cpp,v 1.1 2000/08/10 17:40:29 dawes Exp $ */ diff --git a/nx-X11/programs/Xserver/GL/mesa/GLcore/GLcoremodule.c b/nx-X11/programs/Xserver/GL/mesa/GLcore/GLcoremodule.c deleted file mode 100644 index 4e03b59fe..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/GLcore/GLcoremodule.c +++ /dev/null @@ -1,64 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/mesa/src/GLcoremodule.c,v 1.5 2000/02/23 04:46:55 martin Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86Module.h" - -static MODULESETUPPROTO(GLcoreSetup); - -static XF86ModuleVersionInfo VersRec = -{ - "GLcore", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_EXTENSION, - ABI_EXTENSION_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} -}; - -XF86ModuleData GLcoreModuleData = { &VersRec, GLcoreSetup, NULL }; - -static pointer -GLcoreSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - /* Need a non-NULL return value to indicate success */ - return (pointer)1; -} diff --git a/nx-X11/programs/Xserver/GL/mesa/GLcore/Imakefile b/nx-X11/programs/Xserver/GL/mesa/GLcore/Imakefile index 154a5c1a0..5fb93b364 100644 --- a/nx-X11/programs/Xserver/GL/mesa/GLcore/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/GLcore/Imakefile @@ -1,14 +1,3 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/GLcore/Imakefile,v 1.3 2002/05/31 18:12:36 dawes Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - #include <Server.tmpl> #define NeedAllMesaSrc @@ -24,22 +13,17 @@ SUBDIRS = module #define MesaSlangBuildDir ../shader/slang/ #define MesaXBuildDir ../X/ -#include "../../../../../lib/GL/mesa/array_cache/Imakefile.inc" -#include "../../../../../lib/GL/mesa/swrast/Imakefile.inc" -#include "../../../../../lib/GL/mesa/swrast_setup/Imakefile.inc" -#include "../../../../../lib/GL/mesa/tnl/Imakefile.inc" -#include "../../../../../lib/GL/mesa/main/Imakefile.inc" -#include "../../../../../lib/GL/mesa/math/Imakefile.inc" -#include "../../../../../lib/GL/mesa/shader/Imakefile.inc" -#include "../../../../../lib/GL/mesa/shader/grammar/Imakefile.inc" -#include "../../../../../lib/GL/mesa/shader/slang/Imakefile.inc" -#include "../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc" -#include "../../../../../lib/GL/mesa/Imakefile.inc" - -#ifdef IHaveModules - MSRCS = GLcoremodule.c - MOBJS = GLcoremodule.o -#endif +#include "../array_cache/Imakefile.inc" +#include "../swrast/Imakefile.inc" +#include "../swrast_setup/Imakefile.inc" +#include "../tnl/Imakefile.inc" +#include "../main/Imakefile.inc" +#include "../math/Imakefile.inc" +#include "../shader/Imakefile.inc" +#include "../shader/grammar/Imakefile.inc" +#include "../shader/slang/Imakefile.inc" +#include "../X/Imakefile.inc" +#include "../Imakefile.inc" XOBJS = ../X/?*.o @@ -51,22 +35,14 @@ SUBDIRS = module ../shader/slang/DONE INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \ - -I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include \ + -I$(MESASRCDIR)/include \ -I$(MESASRCDIR)/src/mesa \ -I$(SERVERSRC)/include DEFINES = $(GLX_DEFINES) -#ifdef IHaveModules -ModuleObjectRule() - -DepLibraryModuleTarget(GLcore, $(DONES) $(OBJS),$(OBJS) $(XOBJS)) -InstallLibraryModule(GLcore,$(MODULEDIR),extensions) - -#else NormalDepLibraryTarget(GLcore, $(DONES) $(OBJS), $(OBJS) $(XOBJS)) NormalLibraryObjectRule() -#endif InstallDriverSDKLibraryModule(GLcore,$(DRIVERSDKMODULEDIR),extensions) @@ -74,4 +50,3 @@ InstallDriverSDKLibraryModule(GLcore,$(DRIVERSDKMODULEDIR),extensions) MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif - diff --git a/nx-X11/programs/Xserver/GL/mesa/GLcore/module/Imakefile b/nx-X11/programs/Xserver/GL/mesa/GLcore/module/Imakefile deleted file mode 100644 index 18dcdf0a1..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/GLcore/module/Imakefile +++ /dev/null @@ -1,53 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/GLcore/Imakefile,v 1.2 2002/02/25 18:00:38 dawes Exp $ - -#define IHaveModules -#include <Server.tmpl> - -#define NeedAllMesaSrc -#define MesaInXServer -#define MesaBuildDir ../../main/module/ -#define MesaACBuildDir ../../array_cache/module/ -#define MesaMathBuildDir ../../math/module/ -#define MesaSwrastBuildDir ../../swrast/module/ -#define MesaSwrastSetupBuildDir ../../swrast_setup/module/ -#define MesaTnlBuildDir ../../tnl/module/ -#define MesaXBuildDir ../../X/module/ - -#include "../../../../../../lib/GL/mesa/array_cache/Imakefile.inc" -#include "../../../../../../lib/GL/mesa/swrast/Imakefile.inc" -#include "../../../../../../lib/GL/mesa/swrast_setup/Imakefile.inc" -#include "../../../../../../lib/GL/mesa/tnl/Imakefile.inc" -#include "../../../../../../lib/GL/mesa/math/Imakefile.inc" -#include "../../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc" -#include "../../../../../../lib/GL/mesa/Imakefile.inc" - -#if DoLoadableServer - MSRCS = GLcoremodule.c - MOBJS = GLcoremodule.o -#endif - - XOBJS = ../../X/module/?*.o - - OBJS = $(COREMESAOBJS) $(MOBJS) - - DONES = ../../module/DONE ../../X/module/DONE \ - ../../array_cache/module/DONE ../../math/module/DONE \ - ../../swrast/module/DONE \ - ../../swrast_setup/module/DONE ../../tnl/module/DONE - - INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \ - -I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include \ - -I$(MESASRCDIR)/src/mesa \ - -I$(SERVERSRC)/include - - DEFINES = $(GLX_DEFINES) - -ModuleObjectRule() - -DepLibraryModuleTarget(GLcore, $(DONES) $(OBJS),$(OBJS) $(XOBJS)) -InstallLibraryModule(GLcore,$(MODULEDIR),extensions) - -InstallDriverSDKLibraryModule(GLcore,$(DRIVERSDKMODULEDIR),extensions) - -LinkSourceFile(GLcoremodule.c,..) - diff --git a/nx-X11/programs/Xserver/GL/mesa/Imakefile b/nx-X11/programs/Xserver/GL/mesa/Imakefile index ea7d18aa2..f1dbbe101 100644 --- a/nx-X11/programs/Xserver/GL/mesa/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/Imakefile @@ -1,17 +1,5 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.23 2002/11/22 22:56:00 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) - MODSUBDIR = module -#endif -#endif - -#if !defined(IHaveModules) || !BuildModuleInSubdir #define IHaveSubdirs SUBDIRS = main math array_cache swrast swrast_setup tnl shader X GLcore $(MODSUBDIR) -#endif #include <Server.tmpl> @@ -19,11 +7,7 @@ XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.23 2002/11/22 22:5 #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../lib/GL/mesa/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/Imakefile.inc" -#endif +#include "Imakefile.inc" INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \ -I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include \ @@ -32,11 +16,7 @@ XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.23 2002/11/22 22:5 DEFINES = $(GLX_DEFINES) -#ifdef IHaveModules -ModuleObjectRule() -#else NormalLibraryObjectRule() -#endif #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) @@ -44,4 +24,3 @@ DependSubdirs($(SUBDIRS)) #endif DependTarget() - diff --git a/nx-X11/programs/Xserver/GL/mesa/Imakefile.inc b/nx-X11/programs/Xserver/GL/mesa/Imakefile.inc new file mode 100644 index 000000000..1bff5782e --- /dev/null +++ b/nx-X11/programs/Xserver/GL/mesa/Imakefile.inc @@ -0,0 +1,51 @@ +MESABUILDDIR = MesaBuildDir + +COREMESASRCS = $(COREMESABASESRCS) \ + $(MESA_AC_SRCS) \ + $(MESA_MATH_SRCS) \ + $(MESA_SWRAST_SRCS) \ + $(MESA_SWR_SETUP_SRCS) \ + $(MESA_TNL_SRCS) \ + $(MESA_SHADER_SRCS) \ + $(MESA_GRAMMAR_SRCS) \ + $(MESA_SLANG_SRCS) + +COREMESAOBJS = $(COREMESABASEOBJS) \ + $(MESA_AC_OBJS) \ + $(MESA_MATH_OBJS) \ + $(MESA_SWRAST_OBJS) \ + $(MESA_SWR_SETUP_OBJS) \ + $(MESA_TNL_OBJS) \ + $(MESA_SHADER_OBJS) \ + $(MESA_GRAMMAR_OBJS) \ + $(MESA_SLANG_OBJS) + +COREMESAUOBJS = $(COREMESABASEUOBJS) \ + $(MESA_AC_UOBJS) \ + $(MESA_MATH_UOBJS) \ + $(MESA_SWRAST_UOBJS) \ + $(MESA_SWR_SETUP_UOBJS) \ + $(MESA_TNL_UOBJS) \ + $(MESA_SHADER_UOBJS) \ + $(MESA_GRAMMAR_UOBJS) \ + $(MESA_SLANG_UOBJS) + +COREMESADOBJS = $(COREMESABASEDOBJS) \ + $(MESA_AC_DOBJS) \ + $(MESA_MATH_DOBJS) \ + $(MESA_SWRAST_DOBJS) \ + $(MESA_SWR_SETUP_DOBJS) \ + $(MESA_TNL_DOBJS) \ + $(MESA_SHADER_DOBJS) \ + $(MESA_GRAMMAR_DOBJS) \ + $(MESA_SLANG_DOBJS) + +COREMESAPOBJS = $(COREMESABASEPOBJS) \ + $(MESA_AC_POBJS) \ + $(MESA_MATH_POBJS) \ + $(MESA_SWRAST_POBJS) \ + $(MESA_SWR_SETUP_POBJS) \ + $(MESA_TNL_POBJS) \ + $(MESA_SHADER_POBJS) \ + $(MESA_GRAMMAR_POBJS) \ + $(MESA_SLANG_POBJS) diff --git a/nx-X11/programs/Xserver/GL/mesa/X/Imakefile b/nx-X11/programs/Xserver/GL/mesa/X/Imakefile index f0e722f00..f8812e096 100644 --- a/nx-X11/programs/Xserver/GL/mesa/X/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/X/Imakefile @@ -1,25 +1,10 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/X/Imakefile,v 1.16 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - #include <Server.tmpl> #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaXBuildDir /**/ #define MesaInXServer -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc" -#endif +#include "Imakefile.inc" LinkSourceFile(compsize.c,$(MESASRCDIR)/src/glx/x11) @@ -30,13 +15,6 @@ LinkSourceFile(compsize.c,$(MESASRCDIR)/src/glx/x11) COMMON_SRCS = driverfuncs.c COMMON_OBJS = driverfuncs.o -#ifndef XFree86Version - -/* This appears to be the quickest way to build a non-XFree86 server */ -GLXSRV_DEFINES = -DXFree86Server - -#endif - GLX_SRCS = xf86glx.c xf86glx_util.c compsize.c GLX_OBJS = xf86glx.o xf86glx_util.o compsize.o @@ -55,19 +33,15 @@ GLXSRV_DEFINES = -DXFree86Server -I$(SERVERSRC)/include -I$(SERVERSRC)/GL/include \ -I$(SERVERSRC)/GL/glx \ -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core + -I$(DRMSRCDIR)/shared-core \ + `pkg-config --cflags-only-I pixman-1` DEFINES = $(GLX_DEFINES) $(GLXSRV_DEFINES) -DNXAGENT_SERVER /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ -#ifdef IHaveModules -ModuleObjectRule() -#else NormalLibraryObjectRule() -#endif SubdirLibraryRule($(OBJS)) -LintLibraryTarget(dri,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() @@ -77,10 +51,6 @@ MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif -#if defined(IHaveModules) && BuildModuleInSubdir -LinkSourceFile(xf86glx.c,..) -LinkSourceFile(xf86glx_util.c,..) -#endif #ifndef MesaDrvSrcDir #define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri diff --git a/nx-X11/programs/Xserver/GL/mesa/X/Imakefile.NX.original b/nx-X11/programs/Xserver/GL/mesa/X/Imakefile.NX.original deleted file mode 100644 index f0e722f00..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/X/Imakefile.NX.original +++ /dev/null @@ -1,93 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/X/Imakefile,v 1.16 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - -#include <Server.tmpl> - -#define NeedAllMesaSrc -#define NeedToLinkMesaSrc -#define MesaXBuildDir /**/ -#define MesaInXServer -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc" -#endif - - -LinkSourceFile(compsize.c,$(MESASRCDIR)/src/glx/x11) - - DRIVER_SRCS = $(XMESA_SRCS) - DRIVER_OBJS = $(XMESA_OBJS) - - COMMON_SRCS = driverfuncs.c - COMMON_OBJS = driverfuncs.o - -#ifndef XFree86Version - -/* This appears to be the quickest way to build a non-XFree86 server */ -GLXSRV_DEFINES = -DXFree86Server - -#endif - - GLX_SRCS = xf86glx.c xf86glx_util.c compsize.c - GLX_OBJS = xf86glx.o xf86glx_util.o compsize.o - - SRCS = $(DRIVER_SRCS) $(GLX_SRCS) $(COMMON_SRCS) - OBJS = $(DRIVER_OBJS) $(GLX_OBJS) $(COMMON_OBJS) - - INCLUDES = -I$(SERVERSRC)/GL/mesa/X -I$(XINCLUDESRC) \ - -I$(EXTINCSRC) \ - -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/src -I$(MESASRCDIR)/src/mesa/drivers/x11 \ - -I$(MESASRCDIR)/include \ - -I$(LIBSRC)/GL/glx -I$(LIBSRC)/GL/include \ - -I$(SERVERSRC)/include -I$(SERVERSRC)/GL/include \ - -I$(SERVERSRC)/GL/glx \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core - - DEFINES = $(GLX_DEFINES) $(GLXSRV_DEFINES) -DNXAGENT_SERVER /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ - -#ifdef IHaveModules -ModuleObjectRule() -#else -NormalLibraryObjectRule() -#endif - -SubdirLibraryRule($(OBJS)) - -LintLibraryTarget(dri,$(SRCS)) -NormalLintTarget($(SRCS)) - -DependTarget() - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - -#if defined(IHaveModules) && BuildModuleInSubdir -LinkSourceFile(xf86glx.c,..) -LinkSourceFile(xf86glx_util.c,..) -#endif - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - - -LinkSourceFile(driverfuncs.c, $(MESADRVSRCDIR)/../common) -LinkSourceFile(driverfuncs.h, $(MESADRVSRCDIR)/../common) diff --git a/nx-X11/programs/Xserver/GL/mesa/X/Imakefile.X.original b/nx-X11/programs/Xserver/GL/mesa/X/Imakefile.X.original deleted file mode 100644 index 57fb7ff36..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/X/Imakefile.X.original +++ /dev/null @@ -1,93 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/X/Imakefile,v 1.16 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - -#include <Server.tmpl> - -#define NeedAllMesaSrc -#define NeedToLinkMesaSrc -#define MesaXBuildDir /**/ -#define MesaInXServer -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc" -#endif - - -LinkSourceFile(compsize.c,$(MESASRCDIR)/src/glx/x11) - - DRIVER_SRCS = $(XMESA_SRCS) - DRIVER_OBJS = $(XMESA_OBJS) - - COMMON_SRCS = driverfuncs.c - COMMON_OBJS = driverfuncs.o - -#ifndef XFree86Version - -/* This appears to be the quickest way to build a non-XFree86 server */ -GLXSRV_DEFINES = -DXFree86Server - -#endif - - GLX_SRCS = xf86glx.c xf86glx_util.c compsize.c - GLX_OBJS = xf86glx.o xf86glx_util.o compsize.o - - SRCS = $(DRIVER_SRCS) $(GLX_SRCS) $(COMMON_SRCS) - OBJS = $(DRIVER_OBJS) $(GLX_OBJS) $(COMMON_OBJS) - - INCLUDES = -I$(SERVERSRC)/GL/mesa/X -I$(XINCLUDESRC) \ - -I$(EXTINCSRC) \ - -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/src -I$(MESASRCDIR)/src/mesa/drivers/x11 \ - -I$(MESASRCDIR)/include \ - -I$(LIBSRC)/GL/glx -I$(LIBSRC)/GL/include \ - -I$(SERVERSRC)/include -I$(SERVERSRC)/GL/include \ - -I$(SERVERSRC)/GL/glx \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core - - DEFINES = $(GLX_DEFINES) $(GLXSRV_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ - -#ifdef IHaveModules -ModuleObjectRule() -#else -NormalLibraryObjectRule() -#endif - -SubdirLibraryRule($(OBJS)) - -LintLibraryTarget(dri,$(SRCS)) -NormalLintTarget($(SRCS)) - -DependTarget() - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - -#if defined(IHaveModules) && BuildModuleInSubdir -LinkSourceFile(xf86glx.c,..) -LinkSourceFile(xf86glx_util.c,..) -#endif - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - - -LinkSourceFile(driverfuncs.c, $(MESADRVSRCDIR)/../common) -LinkSourceFile(driverfuncs.h, $(MESADRVSRCDIR)/../common) diff --git a/nx-X11/programs/Xserver/GL/mesa/X/Imakefile.inc b/nx-X11/programs/Xserver/GL/mesa/X/Imakefile.inc new file mode 100644 index 000000000..67eaf7804 --- /dev/null +++ b/nx-X11/programs/Xserver/GL/mesa/X/Imakefile.inc @@ -0,0 +1,98 @@ +MESAXBUILDDIR = MesaXBuildDir + +#ifndef MesaInXServer +XMESA_GLX_SRCS = $(MESAXBUILDDIR)fakeglx.c \ + $(MESAXBUILDDIR)glxapi.c \ + $(MESAXBUILDDIR)realglx.c \ + $(MESAXBUILDDIR)xfonts.c +#endif + + XMESA_SRCS = $(XMESA_GLX_SRCS) \ + $(MESAXBUILDDIR)xm_api.c \ + $(MESAXBUILDDIR)xm_buffer.c \ + $(MESAXBUILDDIR)xm_dd.c \ + $(MESAXBUILDDIR)xm_line.c \ + $(MESAXBUILDDIR)xm_span.c \ + $(MESAXBUILDDIR)xm_tri.c + +#ifdef NeedToLinkMesaSrc +#ifndef MesaInXServer +LinkSourceFile(fakeglx.c, $(MESASRCDIR)/src/mesa/drivers/x11) +LinkSourceFile(glxapi.c, $(MESASRCDIR)/src/mesa/drivers/x11) +LinkSourceFile(glxapi.h, $(MESASRCDIR)/src/mesa/drivers/x11) +LinkSourceFile(realglx.c, $(MESASRCDIR)/src/mesa/drivers/x11) +LinkSourceFile(xfonts.c, $(MESASRCDIR)/src/mesa/drivers/x11) +#endif +LinkSourceFile(xm_api.c, $(MESASRCDIR)/src/mesa/drivers/x11) +LinkSourceFile(xm_buffer.c, $(MESASRCDIR)/src/mesa/drivers/x11) +LinkSourceFile(xm_dd.c, $(MESASRCDIR)/src/mesa/drivers/x11) +LinkSourceFile(xm_line.c, $(MESASRCDIR)/src/mesa/drivers/x11) +LinkSourceFile(xm_span.c, $(MESASRCDIR)/src/mesa/drivers/x11) +LinkSourceFile(xm_tri.c, $(MESASRCDIR)/src/mesa/drivers/x11) +#endif + +#ifndef MesaInXServer +XMESA_GLX_OBJS = $(MESAXBUILDDIR)fakeglx.o \ + $(MESAXBUILDDIR)glxapi.o \ + $(MESAXBUILDDIR)realglx.o \ + $(MESAXBUILDDIR)xfonts.o +#endif + + XMESA_OBJS = $(XMESA_GLX_OBJS) \ + $(MESAXBUILDDIR)xm_api.o \ + $(MESAXBUILDDIR)xm_buffer.o \ + $(MESAXBUILDDIR)xm_dd.o \ + $(MESAXBUILDDIR)xm_line.o \ + $(MESAXBUILDDIR)xm_span.o \ + $(MESAXBUILDDIR)xm_tri.o + +#if defined(DoSharedLib) && DoSharedLib +#ifndef MesaInXServer +XMESA_GLX_UOBJS = $(MESAXBUILDDIR)unshared/fakeglx.o \ + $(MESAXBUILDDIR)unshared/glxapi.o \ + $(MESAXBUILDDIR)unshared/realglx.o \ + $(MESAXBUILDDIR)unshared/xfonts.o +#endif + + XMESA_UOBJS = $(XMESA_GLX_UOBJS) \ + $(MESAXBUILDDIR)unshared/xm_api.o \ + $(MESAXBUILDDIR)unshared/xm_buffer.o \ + $(MESAXBUILDDIR)unshared/xm_dd.o \ + $(MESAXBUILDDIR)unshared/xm_line.o \ + $(MESAXBUILDDIR)unshared/xm_span.o \ + $(MESAXBUILDDIR)unshared/xm_tri.o +#else +XMESA_GLX_UOBJS = $(XMESA_GLX_OBJS) + XMESA_UOBJS = $(XMESA_OBJS) +#endif + +#ifndef MesaInXServer +XMESA_GLX_DOBJS = $(MESAXBUILDDIR)debugger/fakeglx.o \ + $(MESAXBUILDDIR)debugger/glxapi.o \ + $(MESAXBUILDDIR)debugger/realglx.o \ + $(MESAXBUILDDIR)debugger/xfonts.o +#endif + + XMESA_DOBJS = $(XMESA_GLX_DOBJS) \ + $(MESAXBUILDDIR)debugger/xm_api.o \ + $(MESAXBUILDDIR)debugger/xm_buffer.o \ + $(MESAXBUILDDIR)debugger/xm_dd.o \ + $(MESAXBUILDDIR)debugger/xm_line.o \ + $(MESAXBUILDDIR)debugger/xm_span.o \ + $(MESAXBUILDDIR)debugger/xm_tri.o + +#ifndef MesaInXServer +XMESA_GLX_POBJS = $(MESAXBUILDDIR)profiled/fakeglx.o \ + $(MESAXBUILDDIR)profiled/glxapi.o \ + $(MESAXBUILDDIR)profiled/realglx.o \ + $(MESAXBUILDDIR)profiled/xfonts.o +#endif + + XMESA_POBJS = $(XMESA_GLX_POBJS) \ + $(MESAXBUILDDIR)profiled/xm_api.o \ + $(MESAXBUILDDIR)profiled/xm_buffer.o \ + $(MESAXBUILDDIR)profiled/xm_dd.o \ + $(MESAXBUILDDIR)profiled/xm_line.o \ + $(MESAXBUILDDIR)profiled/xm_span.o \ + $(MESAXBUILDDIR)profiled/xm_tri.o + diff --git a/nx-X11/programs/Xserver/GL/mesa/X/module/Imakefile b/nx-X11/programs/Xserver/GL/mesa/X/module/Imakefile deleted file mode 100644 index eee4c7556..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/X/module/Imakefile +++ /dev/null @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/X/module/Imakefile,v 1.1 2002/05/31 18:12:38 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - diff --git a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c index 19b5be637..da0e77134 100644 --- a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c +++ b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx.c,v 1.19 2003/07/16 01:38:27 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -53,7 +52,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xf86glxint.h" #include "context.h" #include "xmesaP.h" -#include <GL/xf86glx.h> #include "context.h" /* @@ -320,15 +318,15 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, /* Alloc space for the list of new GLX visuals */ pNewVisualConfigs = (__GLXvisualConfig *) - __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); + malloc(numNewConfigs * sizeof(__GLXvisualConfig)); if (!pNewVisualConfigs) { return FALSE; } /* Alloc space for the list of new GLX visual privates */ - pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); + pNewVisualPriv = (void **) malloc(numNewConfigs * sizeof(void *)); if (!pNewVisualPriv) { - __glXFree(pNewVisualConfigs); + free(pNewVisualConfigs); return FALSE; } @@ -372,40 +370,40 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, numConfigs = 0; /* Alloc temp space for the list of orig VisualIDs for each new visual */ - orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); + orig_vid = (VisualID *)malloc(numNewVisuals * sizeof(VisualID)); if (!orig_vid) { - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); + free(pNewVisualPriv); + free(pNewVisualConfigs); return FALSE; } /* Alloc space for the list of glXVisuals */ modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); if (modes == NULL) { - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); + free(orig_vid); + free(pNewVisualPriv); + free(pNewVisualConfigs); return FALSE; } /* Alloc space for the list of glXVisualPrivates */ - glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); + glXVisualPriv = (void **)malloc(numNewVisuals * sizeof(void *)); if (!glXVisualPriv) { _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); + free(orig_vid); + free(pNewVisualPriv); + free(pNewVisualConfigs); return FALSE; } /* Alloc space for the new list of the X server's visuals */ - pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); + pVisualNew = (VisualPtr)malloc(numNewVisuals * sizeof(VisualRec)); if (!pVisualNew) { - __glXFree(glXVisualPriv); + free(glXVisualPriv); _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); + free(orig_vid); + free(pNewVisualPriv); + free(pNewVisualConfigs); return FALSE; } @@ -488,7 +486,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, numVids++; /* Allocate a new list of VisualIDs for this depth */ - pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); + pVids = (VisualID *)malloc(numVids * sizeof(VisualID)); /* Initialize the new list of VisualIDs for this depth */ for (j = 0; j < pdepth[i].numVids; j++) @@ -497,7 +495,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, pVids[n++] = pVisualNew[k].vid; /* Update this depth's list of VisualIDs */ - __glXFree(pdepth[i].vids); + free(pdepth[i].vids); pdepth[i].vids = pVids; pdepth[i].numVids = numVids; } @@ -507,16 +505,16 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, *visualp = pVisualNew; /* Free the old list of the X server's visuals */ - __glXFree(pVisual); + free(pVisual); /* Clean up temporary allocations */ - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); + free(orig_vid); + free(pNewVisualPriv); + free(pNewVisualConfigs); /* Free the private list created by DDX HW driver */ if (visualPrivates) - xfree(visualPrivates); + free(visualPrivates); visualPrivates = NULL; return TRUE; @@ -582,19 +580,19 @@ static void init_screen_visuals(int screen) int i, j; /* Alloc space for the list of XMesa visuals */ - pXMesaVisual = (XMesaVisual *)__glXMalloc(MESAScreens[screen].num_vis * + pXMesaVisual = (XMesaVisual *)malloc(MESAScreens[screen].num_vis * sizeof(XMesaVisual)); - __glXMemset(pXMesaVisual, 0, + memset(pXMesaVisual, 0, MESAScreens[screen].num_vis * sizeof(XMesaVisual)); /* FIXME: Change 'used' to be a array of bits (rather than of ints), * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less * FIXME: than 64 or 128 the stack array can be used instead of calling - * FIXME: __glXMalloc / __glXFree. If nothing else, convert 'used' to + * FIXME: malloc / free. If nothing else, convert 'used' to * FIXME: array of bytes instead of ints! */ - used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int)); - __glXMemset(used, 0, pScreen->numVisuals * sizeof(int)); + used = (int *)malloc(pScreen->numVisuals * sizeof(int)); + memset(used, 0, pScreen->numVisuals * sizeof(int)); i = 0; for ( modes = MESAScreens[screen].modes @@ -653,7 +651,7 @@ static void init_screen_visuals(int screen) i++; } - __glXFree(used); + free(used); MESAScreens[screen].xm_vis = pXMesaVisual; } @@ -704,9 +702,9 @@ extern void __MESA_resetExtension(void) } _gl_context_modes_destroy( MESAScreens[i].modes ); MESAScreens[i].modes = NULL; - __glXFree(MESAScreens[i].private); + free(MESAScreens[i].private); MESAScreens[i].private = NULL; - __glXFree(MESAScreens[i].xm_vis); + free(MESAScreens[i].xm_vis); MESAScreens[i].xm_vis = NULL; MESAScreens[i].num_vis = 0; } @@ -726,7 +724,7 @@ void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv) ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n", glxPriv->modes->visualID); } - buf = (__MESA_buffer)__glXMalloc(sizeof(struct __MESA_bufferRec)); + buf = (__MESA_buffer)malloc(sizeof(struct __MESA_bufferRec)); /* Create Mesa's buffers */ if (glxPriv->type == DRAWABLE_WINDOW) { @@ -794,7 +792,7 @@ void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv) glxPriv->swapBuffers = buf->fbswap; glPriv->frontBuffer.resize = buf->fbresize; - __glXFree(glPriv->private); + free(glPriv->private); glPriv->private = NULL; } diff --git a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c.NX.original b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c.NX.original deleted file mode 100644 index 19b5be637..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c.NX.original +++ /dev/null @@ -1,952 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx.c,v 1.19 2003/07/16 01:38:27 dawes Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Brian E. Paul <brian@precisioninsight.com> - * - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <regionstr.h> -#include <resource.h> -#include <GL/gl.h> -#include <GL/glxint.h> -#include <GL/glxtokens.h> -#include <scrnintstr.h> -#include <config.h> -#include <glxserver.h> -#include <glxscreens.h> -#include <glxdrawable.h> -#include <glxcontext.h> -#include <glxext.h> -#include <glxutil.h> -#include "xf86glxint.h" -#include "context.h" -#include "xmesaP.h" -#include <GL/xf86glx.h> -#include "context.h" - -/* - * This define is for the glcore.h header file. - * If you add it here, then make sure you also add it in - * ../../../glx/Imakefile. - */ -#if 0 -#define DEBUG -#include <GL/internal/glcore.h> -#undef DEBUG -#else -#include <GL/internal/glcore.h> -#endif - -#include "glcontextmodes.h" - -#ifdef NXAGENT_SERVER -#include "../main/WSDrawBuffer.h" -#endif - -/* - * This structure is statically allocated in the __glXScreens[] - * structure. This struct is not used anywhere other than in - * __glXScreenInit to initialize each of the active screens - * (__glXActiveScreens[]). Several of the fields must be initialized by - * the screenProbe routine before they are copied to the active screens - * struct. In particular, the contextCreate, pGlxVisual, numVisuals, - * and numUsableVisuals fields must be initialized. - */ -static __GLXscreenInfo __glDDXScreenInfo = { - __MESA_screenProbe, /* Must be generic and handle all screens */ - __MESA_createContext, /* Substitute screen's createContext routine */ - __MESA_createBuffer, /* Substitute screen's createBuffer routine */ - NULL, /* Set up modes in probe */ - NULL, /* Set up pVisualPriv in probe */ - 0, /* Set up numVisuals in probe */ - 0, /* Set up numUsableVisuals in probe */ - NULL, /* GLextensions is overwritten by __glXScreenInit */ - "Vendor String", /* GLXvendor is overwritten by __glXScreenInit */ - "Version String", /* GLXversion is overwritten by __glXScreenInit */ - "Extensions String", /* GLXextensions is overwritten by __glXScreenInit */ - NULL /* WrappedPositionWindow is overwritten */ -}; - -#ifdef NXAGENT_SERVER -WSDrawBufferPtr pWSDrawBuffer = NULL; - -void AddWSDrawBuffer(GLframebuffer *mesa_buffer) -{ - WSDrawBufferPtr prevWSDB; - WSDrawBufferPtr newWSDB; - WSDrawBufferPtr p; - - prevWSDB = NULL; - newWSDB = NULL; - p = pWSDrawBuffer; - while (p != NULL) { - prevWSDB = p; - if (prevWSDB -> DrawBuffer == mesa_buffer) { - return; - } - p = p -> next; - } - newWSDB = malloc(sizeof(WSDrawBufferRec)); - newWSDB -> DrawBuffer = mesa_buffer; - newWSDB -> next = NULL; - - if (pWSDrawBuffer == NULL) - pWSDrawBuffer = newWSDB; - else - prevWSDB -> next = newWSDB; -} -#endif - -void *__glXglDDXScreenInfo(void) { - return &__glDDXScreenInfo; -} - -static __GLXextensionInfo __glDDXExtensionInfo = { - GL_CORE_MESA, - __MESA_resetExtension, - __MESA_initVisuals, - __MESA_setVisualConfigs -}; - -void *__glXglDDXExtensionInfo(void) { - return &__glDDXExtensionInfo; -} - -static __MESA_screen MESAScreens[MAXSCREENS]; -static __GLcontext *MESA_CC = NULL; - -static int numConfigs = 0; -static __GLXvisualConfig *visualConfigs = NULL; -static void **visualPrivates = NULL; - - -static int count_bits(unsigned int n) -{ - int bits = 0; - - while (n > 0) { - if (n & 1) bits++; - n >>= 1; - } - return bits; -} - - -static XMesaVisual find_mesa_visual(int screen, VisualID vid) -{ - __MESA_screen * const pMScr = &MESAScreens[screen]; - const __GLcontextModes *modes; - unsigned i = 0; - - for ( modes = pMScr->modes ; modes != NULL ; modes = modes->next ) { - if ( modes->visualID == vid ) { - break; - } - - i++; - } - - return (modes != NULL) ? pMScr->xm_vis[i] : NULL; -} - - -/* - * In the case the driver defines no GLX visuals we'll use these. - * Note that for TrueColor and DirectColor visuals, bufferSize is the - * sum of redSize, greenSize, blueSize and alphaSize, which may be larger - * than the nplanes/rootDepth of the server's X11 visuals - */ -#define NUM_FALLBACK_CONFIGS 5 -static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { - /* [0] = RGB, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [1] = RGB, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 16, 16, 16, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [4] = CI, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - False, /* rgba? (false = color index) */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, -}; - - -static Bool init_visuals(int *nvisualp, VisualPtr *visualp, - VisualID *defaultVisp, - int ndepth, DepthPtr pdepth, - int rootDepth) -{ - int numRGBconfigs; - int numCIconfigs; - int numVisuals = *nvisualp; - int numNewVisuals; - int numNewConfigs; - VisualPtr pVisual = *visualp; - VisualPtr pVisualNew = NULL; - VisualID *orig_vid = NULL; - __GLcontextModes *modes; - __GLXvisualConfig *pNewVisualConfigs = NULL; - void **glXVisualPriv; - void **pNewVisualPriv; - int found_default; - int i, j, k; - - if (numConfigs > 0) - numNewConfigs = numConfigs; - else - numNewConfigs = NUM_FALLBACK_CONFIGS; - - /* Alloc space for the list of new GLX visuals */ - pNewVisualConfigs = (__GLXvisualConfig *) - __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); - if (!pNewVisualConfigs) { - return FALSE; - } - - /* Alloc space for the list of new GLX visual privates */ - pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); - if (!pNewVisualPriv) { - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* - ** If SetVisualConfigs was not called, then use default GLX - ** visual configs. - */ - if (numConfigs == 0) { - memcpy(pNewVisualConfigs, FallbackConfigs, - NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); - memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); - } - else { - /* copy driver's visual config info */ - for (i = 0; i < numConfigs; i++) { - pNewVisualConfigs[i] = visualConfigs[i]; - pNewVisualPriv[i] = visualPrivates[i]; - } - } - - /* Count the number of RGB and CI visual configs */ - numRGBconfigs = 0; - numCIconfigs = 0; - for (i = 0; i < numNewConfigs; i++) { - if (pNewVisualConfigs[i].rgba) - numRGBconfigs++; - else - numCIconfigs++; - } - - /* Count the total number of visuals to compute */ - numNewVisuals = 0; - for (i = 0; i < numVisuals; i++) { - numNewVisuals += - (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor) - ? numRGBconfigs : numCIconfigs; - } - - /* Reset variables for use with the next screen/driver's visual configs */ - visualConfigs = NULL; - numConfigs = 0; - - /* Alloc temp space for the list of orig VisualIDs for each new visual */ - orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); - if (!orig_vid) { - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisuals */ - modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); - if (modes == NULL) { - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisualPrivates */ - glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); - if (!glXVisualPriv) { - _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the new list of the X server's visuals */ - pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); - if (!pVisualNew) { - __glXFree(glXVisualPriv); - _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Initialize the new visuals */ - found_default = FALSE; - MESAScreens[screenInfo.numScreens-1].modes = modes; - for (i = j = 0; i < numVisuals; i++) { - int is_rgb = (pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor); - - for (k = 0; k < numNewConfigs; k++) { - if (pNewVisualConfigs[k].rgba != is_rgb) - continue; - - assert( modes != NULL ); - - /* Initialize the new visual */ - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); - modes->visualID = pVisualNew[j].vid; - - /* - * If the class is -1, then assume the X visual information - * is identical to what GLX needs, and take them from the X - * visual. NOTE: if class != -1, then all other fields MUST - * be initialized. - */ - if (modes->visualType == GLX_NONE) { - modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); - modes->redBits = count_bits(pVisual[i].redMask); - modes->greenBits = count_bits(pVisual[i].greenMask); - modes->blueBits = count_bits(pVisual[i].blueMask); - modes->alphaBits = modes->alphaBits; - modes->redMask = pVisual[i].redMask; - modes->greenMask = pVisual[i].greenMask; - modes->blueMask = pVisual[i].blueMask; - modes->alphaMask = modes->alphaMask; - modes->rgbBits = (is_rgb) - ? (modes->redBits + modes->greenBits + - modes->blueBits + modes->alphaBits) - : rootDepth; - } - - /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pNewVisualPriv[k]; - - j++; - modes = modes->next; - } - } - - assert(j <= numNewVisuals); - - /* Save the GLX visuals in the screen structure */ - MESAScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; - MESAScreens[screenInfo.numScreens-1].private = glXVisualPriv; - - /* Set up depth's VisualIDs */ - for (i = 0; i < ndepth; i++) { - int numVids = 0; - VisualID *pVids = NULL; - int k, n = 0; - - /* Count the new number of VisualIDs at this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - numVids++; - - /* Allocate a new list of VisualIDs for this depth */ - pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); - - /* Initialize the new list of VisualIDs for this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - pVids[n++] = pVisualNew[k].vid; - - /* Update this depth's list of VisualIDs */ - __glXFree(pdepth[i].vids); - pdepth[i].vids = pVids; - pdepth[i].numVids = numVids; - } - - /* Update the X server's visuals */ - *nvisualp = numNewVisuals; - *visualp = pVisualNew; - - /* Free the old list of the X server's visuals */ - __glXFree(pVisual); - - /* Clean up temporary allocations */ - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - - /* Free the private list created by DDX HW driver */ - if (visualPrivates) - xfree(visualPrivates); - visualPrivates = NULL; - - return TRUE; -} - -void __MESA_setVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates) -{ - numConfigs = nconfigs; - visualConfigs = configs; - visualPrivates = privates; -} - -Bool __MESA_initVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, int *rootDepthp, - VisualID *defaultVisp, unsigned long sizes, - int bitsPerRGB) -{ - /* - * Setup the visuals supported by this particular screen. - */ - return init_visuals(nvisualp, visualp, defaultVisp, - *ndepthp, *depthp, *rootDepthp); -} - -static void fixup_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - __MESA_screen *pMScr = &MESAScreens[screen]; - int j; - __GLcontextModes *modes; - - for ( modes = pMScr->modes ; modes != NULL ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - /* Find a visual that matches the GLX visual's class and size */ - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes) { - - /* Fixup the masks */ - modes->redMask = pVis[j].redMask; - modes->greenMask = pVis[j].greenMask; - modes->blueMask = pVis[j].blueMask; - - /* Recalc the sizes */ - modes->redBits = count_bits(modes->redMask); - modes->greenBits = count_bits(modes->greenMask); - modes->blueBits = count_bits(modes->blueMask); - } - } - } -} - -static void init_screen_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - __GLcontextModes *modes; - XMesaVisual *pXMesaVisual; - int *used; - int i, j; - - /* Alloc space for the list of XMesa visuals */ - pXMesaVisual = (XMesaVisual *)__glXMalloc(MESAScreens[screen].num_vis * - sizeof(XMesaVisual)); - __glXMemset(pXMesaVisual, 0, - MESAScreens[screen].num_vis * sizeof(XMesaVisual)); - - /* FIXME: Change 'used' to be a array of bits (rather than of ints), - * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less - * FIXME: than 64 or 128 the stack array can be used instead of calling - * FIXME: __glXMalloc / __glXFree. If nothing else, convert 'used' to - * FIXME: array of bytes instead of ints! - */ - used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int)); - __glXMemset(used, 0, pScreen->numVisuals * sizeof(int)); - - i = 0; - for ( modes = MESAScreens[screen].modes - ; modes != NULL - ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes && - pVis[j].redMask == modes->redMask && - pVis[j].greenMask == modes->greenMask && - pVis[j].blueMask == modes->blueMask && - !used[j]) { - - /* Create the XMesa visual */ - pXMesaVisual[i] = - XMesaCreateVisual(pScreen, - pVis, - modes->rgbMode, - (modes->alphaBits > 0), - modes->doubleBufferMode, - modes->stereoMode, - GL_TRUE, /* ximage_flag */ - modes->depthBits, - modes->stencilBits, - modes->accumRedBits, - modes->accumGreenBits, - modes->accumBlueBits, - modes->accumAlphaBits, - modes->samples, - modes->level, - modes->visualRating); - /* Set the VisualID */ - modes->visualID = pVis[j].vid; - - /* Mark this visual used */ - used[j] = 1; - break; - } - } - - if ( j == pScreen->numVisuals ) { - ErrorF("No matching visual for __GLcontextMode with " - "visual class = %d (%d), nplanes = %u\n", - vis_class, - modes->visualType, - (modes->rgbBits - modes->alphaBits) ); - } - else if ( modes->visualID == -1 ) { - FatalError( "Matching visual found, but visualID still -1!\n" ); - } - - i++; - } - - __glXFree(used); - - MESAScreens[screen].xm_vis = pXMesaVisual; -} - -Bool __MESA_screenProbe(int screen) -{ - /* - * Set up the current screen's visuals. - */ - __glDDXScreenInfo.modes = MESAScreens[screen].modes; - __glDDXScreenInfo.pVisualPriv = MESAScreens[screen].private; - __glDDXScreenInfo.numVisuals = - __glDDXScreenInfo.numUsableVisuals = MESAScreens[screen].num_vis; - - /* - * Set the current screen's createContext routine. This could be - * wrapped by a DDX GLX context creation routine. - */ - __glDDXScreenInfo.createContext = __MESA_createContext; - - /* - * The ordering of the rgb compenents might have been changed by the - * driver after mi initialized them. - */ - fixup_visuals(screen); - - /* - * Find the GLX visuals that are supported by this screen and create - * XMesa's visuals. - */ - init_screen_visuals(screen); - - return TRUE; -} - -extern void __MESA_resetExtension(void) -{ - int i, j; - - XMesaReset(); - - for (i = 0; i < screenInfo.numScreens; i++) { - for (j = 0; j < MESAScreens[i].num_vis; j++) { - if (MESAScreens[i].xm_vis[j]) { - XMesaDestroyVisual(MESAScreens[i].xm_vis[j]); - MESAScreens[i].xm_vis[j] = NULL; - } - } - _gl_context_modes_destroy( MESAScreens[i].modes ); - MESAScreens[i].modes = NULL; - __glXFree(MESAScreens[i].private); - MESAScreens[i].private = NULL; - __glXFree(MESAScreens[i].xm_vis); - MESAScreens[i].xm_vis = NULL; - MESAScreens[i].num_vis = 0; - } - __glDDXScreenInfo.modes = NULL; - MESA_CC = NULL; -} - -void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv) -{ - DrawablePtr pDraw = glxPriv->pDraw; - XMesaVisual xm_vis = find_mesa_visual(pDraw->pScreen->myNum, - glxPriv->modes->visualID); - __GLdrawablePrivate *glPriv = &glxPriv->glPriv; - __MESA_buffer buf; - - if (xm_vis == NULL) { - ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n", - glxPriv->modes->visualID); - } - buf = (__MESA_buffer)__glXMalloc(sizeof(struct __MESA_bufferRec)); - - /* Create Mesa's buffers */ - if (glxPriv->type == DRAWABLE_WINDOW) { - buf->xm_buf = (void *)XMesaCreateWindowBuffer(xm_vis, - (WindowPtr)pDraw); - } else { - buf->xm_buf = (void *)XMesaCreatePixmapBuffer(xm_vis, - (PixmapPtr)pDraw, 0); - } - - /* Wrap the front buffer's resize routine */ - buf->fbresize = glPriv->frontBuffer.resize; - glPriv->frontBuffer.resize = __MESA_resizeBuffers; - - /* Wrap the swap buffers routine */ - buf->fbswap = glxPriv->swapBuffers; - glxPriv->swapBuffers = __MESA_swapBuffers; - - /* Save Mesa's private buffer structure */ - glPriv->private = (void *)buf; - glPriv->freePrivate = __MESA_destroyBuffer; -} - -GLboolean __MESA_resizeBuffers(__GLdrawableBuffer *buffer, - GLint x, GLint y, - GLuint width, GLuint height, - __GLdrawablePrivate *glPriv, - GLuint bufferMask) -{ - __MESA_buffer buf = (__MESA_buffer)glPriv->private; - - if (buf->xm_buf) - XMesaResizeBuffers(buf->xm_buf); - - return (*buf->fbresize)(buffer, x, y, width, height, glPriv, bufferMask); -} - -GLboolean __MESA_swapBuffers(__GLXdrawablePrivate *glxPriv) -{ - __MESA_buffer buf = (__MESA_buffer)glxPriv->glPriv.private; - - /* - ** Do not call the wrapped swap buffers routine since Mesa has - ** already done the swap. - */ - XMesaSwapBuffers(buf->xm_buf); - - return GL_TRUE; -} - -void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv) -{ - __MESA_buffer buf = (__MESA_buffer)glPriv->private; - __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other; - -#ifdef NXAGENT_SERVER - AddWSDrawBuffer(& (buf -> xm_buf -> mesa_buffer) ); -#endif - - /* Destroy Mesa's buffers */ - if (buf->xm_buf) - XMesaDestroyBuffer(buf->xm_buf); - - /* Unwrap these routines */ - glxPriv->swapBuffers = buf->fbswap; - glPriv->frontBuffer.resize = buf->fbresize; - - __glXFree(glPriv->private); - glPriv->private = NULL; -} - -__GLinterface *__MESA_createContext(__GLimports *imports, - __GLcontextModes *modes, - __GLinterface *shareGC) -{ - __GLcontext *gl_ctx = NULL; - __GLcontext *m_share = NULL; - __GLXcontext *glxc = (__GLXcontext *)imports->other; - XMesaVisual xm_vis; - - if (shareGC) - m_share = (__GLcontext *)shareGC; - - xm_vis = find_mesa_visual(glxc->pScreen->myNum, glxc->modes->visualID); - if (xm_vis) { - XMesaContext xmshare = m_share ? m_share->DriverCtx : 0; - XMesaContext xmctx = XMesaCreateContext(xm_vis, xmshare); - gl_ctx = xmctx ? &xmctx->mesa : 0; - } - else { - ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n", - glxc->modes->visualID); - } - - - if (!gl_ctx) - return NULL; - - gl_ctx->imports = *imports; - gl_ctx->exports.destroyContext = __MESA_destroyContext; - gl_ctx->exports.loseCurrent = __MESA_loseCurrent; - gl_ctx->exports.makeCurrent = __MESA_makeCurrent; - gl_ctx->exports.shareContext = __MESA_shareContext; - gl_ctx->exports.copyContext = __MESA_copyContext; - gl_ctx->exports.forceCurrent = __MESA_forceCurrent; - gl_ctx->exports.notifyResize = __MESA_notifyResize; - gl_ctx->exports.notifyDestroy = __MESA_notifyDestroy; - gl_ctx->exports.notifySwapBuffers = __MESA_notifySwapBuffers; - gl_ctx->exports.dispatchExec = __MESA_dispatchExec; - gl_ctx->exports.beginDispatchOverride = __MESA_beginDispatchOverride; - gl_ctx->exports.endDispatchOverride = __MESA_endDispatchOverride; - - return (__GLinterface *)gl_ctx; -} - -GLboolean __MESA_destroyContext(__GLcontext *gc) -{ - XMesaContext xmesa = (XMesaContext) gc->DriverCtx; - XMesaDestroyContext( xmesa ); - return GL_TRUE; -} - -GLboolean __MESA_loseCurrent(__GLcontext *gc) -{ - XMesaContext xmesa = (XMesaContext) gc->DriverCtx; - MESA_CC = NULL; - __glXLastContext = NULL; - return XMesaLoseCurrent(xmesa); -} - -GLboolean __MESA_makeCurrent(__GLcontext *gc) -{ - __GLdrawablePrivate *drawPriv = gc->imports.getDrawablePrivate( gc ); - __MESA_buffer drawBuf = (__MESA_buffer)drawPriv->private; - __GLdrawablePrivate *readPriv = gc->imports.getReadablePrivate( gc ); - __MESA_buffer readBuf = (__MESA_buffer)readPriv->private; - XMesaContext xmesa = (XMesaContext) gc->DriverCtx; - - MESA_CC = gc; - return XMesaMakeCurrent2(xmesa, drawBuf->xm_buf, readBuf->xm_buf); -} - -GLboolean __MESA_shareContext(__GLcontext *gc, __GLcontext *gcShare) -{ - /* NOT_DONE */ - /* XXX I don't see where/how this could ever be called */ - ErrorF("__MESA_shareContext\n"); - return GL_FALSE; -} - -GLboolean __MESA_copyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask) -{ - XMesaContext xm_dst = (XMesaContext) dst->DriverCtx; - const XMesaContext xm_src = (const XMesaContext) src->DriverCtx; - _mesa_copy_context(&xm_src->mesa, &xm_dst->mesa, mask); - return GL_TRUE; -} - -GLboolean __MESA_forceCurrent(__GLcontext *gc) -{ - XMesaContext xmesa = (XMesaContext) gc->DriverCtx; - MESA_CC = gc; - return XMesaForceCurrent(xmesa); -} - -GLboolean __MESA_notifyResize(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_notifyResize\n"); - return GL_FALSE; -} - -void __MESA_notifyDestroy(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_notifyDestroy\n"); - return; -} - -void __MESA_notifySwapBuffers(__GLcontext *gc) -{ - _mesa_notifySwapBuffers(gc); -} - -struct __GLdispatchStateRec *__MESA_dispatchExec(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_dispatchExec\n"); - return NULL; -} - -void __MESA_beginDispatchOverride(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_beginDispatchOverride\n"); - return; -} - -void __MESA_endDispatchOverride(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_endDispatchOverride\n"); - return; -} - - -/* - * Server-side GLX uses these functions which are normally defined - * in the OpenGL SI. - */ - -GLuint __glFloorLog2(GLuint val) -{ - int c = 0; - - while (val > 1) { - c++; - val >>= 1; - } - return c; -} - diff --git a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c.X.original b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c.X.original deleted file mode 100644 index 5dd4e7c37..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c.X.original +++ /dev/null @@ -1,914 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx.c,v 1.19 2003/07/16 01:38:27 dawes Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Brian E. Paul <brian@precisioninsight.com> - * - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <regionstr.h> -#include <resource.h> -#include <GL/gl.h> -#include <GL/glxint.h> -#include <GL/glxtokens.h> -#include <scrnintstr.h> -#include <config.h> -#include <glxserver.h> -#include <glxscreens.h> -#include <glxdrawable.h> -#include <glxcontext.h> -#include <glxext.h> -#include <glxutil.h> -#include "xf86glxint.h" -#include "context.h" -#include "xmesaP.h" -#include <GL/xf86glx.h> -#include "context.h" - -/* - * This define is for the glcore.h header file. - * If you add it here, then make sure you also add it in - * ../../../glx/Imakefile. - */ -#if 0 -#define DEBUG -#include <GL/internal/glcore.h> -#undef DEBUG -#else -#include <GL/internal/glcore.h> -#endif - -#include "glcontextmodes.h" - -/* - * This structure is statically allocated in the __glXScreens[] - * structure. This struct is not used anywhere other than in - * __glXScreenInit to initialize each of the active screens - * (__glXActiveScreens[]). Several of the fields must be initialized by - * the screenProbe routine before they are copied to the active screens - * struct. In particular, the contextCreate, pGlxVisual, numVisuals, - * and numUsableVisuals fields must be initialized. - */ -static __GLXscreenInfo __glDDXScreenInfo = { - __MESA_screenProbe, /* Must be generic and handle all screens */ - __MESA_createContext, /* Substitute screen's createContext routine */ - __MESA_createBuffer, /* Substitute screen's createBuffer routine */ - NULL, /* Set up modes in probe */ - NULL, /* Set up pVisualPriv in probe */ - 0, /* Set up numVisuals in probe */ - 0, /* Set up numUsableVisuals in probe */ - NULL, /* GLextensions is overwritten by __glXScreenInit */ - "Vendor String", /* GLXvendor is overwritten by __glXScreenInit */ - "Version String", /* GLXversion is overwritten by __glXScreenInit */ - "Extensions String", /* GLXextensions is overwritten by __glXScreenInit */ - NULL /* WrappedPositionWindow is overwritten */ -}; - -void *__glXglDDXScreenInfo(void) { - return &__glDDXScreenInfo; -} - -static __GLXextensionInfo __glDDXExtensionInfo = { - GL_CORE_MESA, - __MESA_resetExtension, - __MESA_initVisuals, - __MESA_setVisualConfigs -}; - -void *__glXglDDXExtensionInfo(void) { - return &__glDDXExtensionInfo; -} - -static __MESA_screen MESAScreens[MAXSCREENS]; -static __GLcontext *MESA_CC = NULL; - -static int numConfigs = 0; -static __GLXvisualConfig *visualConfigs = NULL; -static void **visualPrivates = NULL; - - -static int count_bits(unsigned int n) -{ - int bits = 0; - - while (n > 0) { - if (n & 1) bits++; - n >>= 1; - } - return bits; -} - - -static XMesaVisual find_mesa_visual(int screen, VisualID vid) -{ - __MESA_screen * const pMScr = &MESAScreens[screen]; - const __GLcontextModes *modes; - unsigned i = 0; - - for ( modes = pMScr->modes ; modes != NULL ; modes = modes->next ) { - if ( modes->visualID == vid ) { - break; - } - - i++; - } - - return (modes != NULL) ? pMScr->xm_vis[i] : NULL; -} - - -/* - * In the case the driver defines no GLX visuals we'll use these. - * Note that for TrueColor and DirectColor visuals, bufferSize is the - * sum of redSize, greenSize, blueSize and alphaSize, which may be larger - * than the nplanes/rootDepth of the server's X11 visuals - */ -#define NUM_FALLBACK_CONFIGS 5 -static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { - /* [0] = RGB, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [1] = RGB, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 16, 16, 16, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [4] = CI, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - False, /* rgba? (false = color index) */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, -}; - - -static Bool init_visuals(int *nvisualp, VisualPtr *visualp, - VisualID *defaultVisp, - int ndepth, DepthPtr pdepth, - int rootDepth) -{ - int numRGBconfigs; - int numCIconfigs; - int numVisuals = *nvisualp; - int numNewVisuals; - int numNewConfigs; - VisualPtr pVisual = *visualp; - VisualPtr pVisualNew = NULL; - VisualID *orig_vid = NULL; - __GLcontextModes *modes; - __GLXvisualConfig *pNewVisualConfigs = NULL; - void **glXVisualPriv; - void **pNewVisualPriv; - int found_default; - int i, j, k; - - if (numConfigs > 0) - numNewConfigs = numConfigs; - else - numNewConfigs = NUM_FALLBACK_CONFIGS; - - /* Alloc space for the list of new GLX visuals */ - pNewVisualConfigs = (__GLXvisualConfig *) - __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); - if (!pNewVisualConfigs) { - return FALSE; - } - - /* Alloc space for the list of new GLX visual privates */ - pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); - if (!pNewVisualPriv) { - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* - ** If SetVisualConfigs was not called, then use default GLX - ** visual configs. - */ - if (numConfigs == 0) { - memcpy(pNewVisualConfigs, FallbackConfigs, - NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); - memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); - } - else { - /* copy driver's visual config info */ - for (i = 0; i < numConfigs; i++) { - pNewVisualConfigs[i] = visualConfigs[i]; - pNewVisualPriv[i] = visualPrivates[i]; - } - } - - /* Count the number of RGB and CI visual configs */ - numRGBconfigs = 0; - numCIconfigs = 0; - for (i = 0; i < numNewConfigs; i++) { - if (pNewVisualConfigs[i].rgba) - numRGBconfigs++; - else - numCIconfigs++; - } - - /* Count the total number of visuals to compute */ - numNewVisuals = 0; - for (i = 0; i < numVisuals; i++) { - numNewVisuals += - (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor) - ? numRGBconfigs : numCIconfigs; - } - - /* Reset variables for use with the next screen/driver's visual configs */ - visualConfigs = NULL; - numConfigs = 0; - - /* Alloc temp space for the list of orig VisualIDs for each new visual */ - orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); - if (!orig_vid) { - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisuals */ - modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); - if (modes == NULL) { - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisualPrivates */ - glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); - if (!glXVisualPriv) { - _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the new list of the X server's visuals */ - pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); - if (!pVisualNew) { - __glXFree(glXVisualPriv); - _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Initialize the new visuals */ - found_default = FALSE; - MESAScreens[screenInfo.numScreens-1].modes = modes; - for (i = j = 0; i < numVisuals; i++) { - int is_rgb = (pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor); - - for (k = 0; k < numNewConfigs; k++) { - if (pNewVisualConfigs[k].rgba != is_rgb) - continue; - - assert( modes != NULL ); - - /* Initialize the new visual */ - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); - modes->visualID = pVisualNew[j].vid; - - /* - * If the class is -1, then assume the X visual information - * is identical to what GLX needs, and take them from the X - * visual. NOTE: if class != -1, then all other fields MUST - * be initialized. - */ - if (modes->visualType == GLX_NONE) { - modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); - modes->redBits = count_bits(pVisual[i].redMask); - modes->greenBits = count_bits(pVisual[i].greenMask); - modes->blueBits = count_bits(pVisual[i].blueMask); - modes->alphaBits = modes->alphaBits; - modes->redMask = pVisual[i].redMask; - modes->greenMask = pVisual[i].greenMask; - modes->blueMask = pVisual[i].blueMask; - modes->alphaMask = modes->alphaMask; - modes->rgbBits = (is_rgb) - ? (modes->redBits + modes->greenBits + - modes->blueBits + modes->alphaBits) - : rootDepth; - } - - /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pNewVisualPriv[k]; - - j++; - modes = modes->next; - } - } - - assert(j <= numNewVisuals); - - /* Save the GLX visuals in the screen structure */ - MESAScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; - MESAScreens[screenInfo.numScreens-1].private = glXVisualPriv; - - /* Set up depth's VisualIDs */ - for (i = 0; i < ndepth; i++) { - int numVids = 0; - VisualID *pVids = NULL; - int k, n = 0; - - /* Count the new number of VisualIDs at this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - numVids++; - - /* Allocate a new list of VisualIDs for this depth */ - pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); - - /* Initialize the new list of VisualIDs for this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - pVids[n++] = pVisualNew[k].vid; - - /* Update this depth's list of VisualIDs */ - __glXFree(pdepth[i].vids); - pdepth[i].vids = pVids; - pdepth[i].numVids = numVids; - } - - /* Update the X server's visuals */ - *nvisualp = numNewVisuals; - *visualp = pVisualNew; - - /* Free the old list of the X server's visuals */ - __glXFree(pVisual); - - /* Clean up temporary allocations */ - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - - /* Free the private list created by DDX HW driver */ - if (visualPrivates) - xfree(visualPrivates); - visualPrivates = NULL; - - return TRUE; -} - -void __MESA_setVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates) -{ - numConfigs = nconfigs; - visualConfigs = configs; - visualPrivates = privates; -} - -Bool __MESA_initVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, int *rootDepthp, - VisualID *defaultVisp, unsigned long sizes, - int bitsPerRGB) -{ - /* - * Setup the visuals supported by this particular screen. - */ - return init_visuals(nvisualp, visualp, defaultVisp, - *ndepthp, *depthp, *rootDepthp); -} - -static void fixup_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - __MESA_screen *pMScr = &MESAScreens[screen]; - int j; - __GLcontextModes *modes; - - for ( modes = pMScr->modes ; modes != NULL ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - /* Find a visual that matches the GLX visual's class and size */ - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes) { - - /* Fixup the masks */ - modes->redMask = pVis[j].redMask; - modes->greenMask = pVis[j].greenMask; - modes->blueMask = pVis[j].blueMask; - - /* Recalc the sizes */ - modes->redBits = count_bits(modes->redMask); - modes->greenBits = count_bits(modes->greenMask); - modes->blueBits = count_bits(modes->blueMask); - } - } - } -} - -static void init_screen_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - __GLcontextModes *modes; - XMesaVisual *pXMesaVisual; - int *used; - int i, j; - - /* Alloc space for the list of XMesa visuals */ - pXMesaVisual = (XMesaVisual *)__glXMalloc(MESAScreens[screen].num_vis * - sizeof(XMesaVisual)); - __glXMemset(pXMesaVisual, 0, - MESAScreens[screen].num_vis * sizeof(XMesaVisual)); - - /* FIXME: Change 'used' to be a array of bits (rather than of ints), - * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less - * FIXME: than 64 or 128 the stack array can be used instead of calling - * FIXME: __glXMalloc / __glXFree. If nothing else, convert 'used' to - * FIXME: array of bytes instead of ints! - */ - used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int)); - __glXMemset(used, 0, pScreen->numVisuals * sizeof(int)); - - i = 0; - for ( modes = MESAScreens[screen].modes - ; modes != NULL - ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes && - pVis[j].redMask == modes->redMask && - pVis[j].greenMask == modes->greenMask && - pVis[j].blueMask == modes->blueMask && - !used[j]) { - - /* Create the XMesa visual */ - pXMesaVisual[i] = - XMesaCreateVisual(pScreen, - pVis, - modes->rgbMode, - (modes->alphaBits > 0), - modes->doubleBufferMode, - modes->stereoMode, - GL_TRUE, /* ximage_flag */ - modes->depthBits, - modes->stencilBits, - modes->accumRedBits, - modes->accumGreenBits, - modes->accumBlueBits, - modes->accumAlphaBits, - modes->samples, - modes->level, - modes->visualRating); - /* Set the VisualID */ - modes->visualID = pVis[j].vid; - - /* Mark this visual used */ - used[j] = 1; - break; - } - } - - if ( j == pScreen->numVisuals ) { - ErrorF("No matching visual for __GLcontextMode with " - "visual class = %d (%d), nplanes = %u\n", - vis_class, - modes->visualType, - (modes->rgbBits - modes->alphaBits) ); - } - else if ( modes->visualID == -1 ) { - FatalError( "Matching visual found, but visualID still -1!\n" ); - } - - i++; - } - - __glXFree(used); - - MESAScreens[screen].xm_vis = pXMesaVisual; -} - -Bool __MESA_screenProbe(int screen) -{ - /* - * Set up the current screen's visuals. - */ - __glDDXScreenInfo.modes = MESAScreens[screen].modes; - __glDDXScreenInfo.pVisualPriv = MESAScreens[screen].private; - __glDDXScreenInfo.numVisuals = - __glDDXScreenInfo.numUsableVisuals = MESAScreens[screen].num_vis; - - /* - * Set the current screen's createContext routine. This could be - * wrapped by a DDX GLX context creation routine. - */ - __glDDXScreenInfo.createContext = __MESA_createContext; - - /* - * The ordering of the rgb compenents might have been changed by the - * driver after mi initialized them. - */ - fixup_visuals(screen); - - /* - * Find the GLX visuals that are supported by this screen and create - * XMesa's visuals. - */ - init_screen_visuals(screen); - - return TRUE; -} - -extern void __MESA_resetExtension(void) -{ - int i, j; - - XMesaReset(); - - for (i = 0; i < screenInfo.numScreens; i++) { - for (j = 0; j < MESAScreens[i].num_vis; j++) { - if (MESAScreens[i].xm_vis[j]) { - XMesaDestroyVisual(MESAScreens[i].xm_vis[j]); - MESAScreens[i].xm_vis[j] = NULL; - } - } - _gl_context_modes_destroy( MESAScreens[i].modes ); - MESAScreens[i].modes = NULL; - __glXFree(MESAScreens[i].private); - MESAScreens[i].private = NULL; - __glXFree(MESAScreens[i].xm_vis); - MESAScreens[i].xm_vis = NULL; - MESAScreens[i].num_vis = 0; - } - __glDDXScreenInfo.modes = NULL; - MESA_CC = NULL; -} - -void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv) -{ - DrawablePtr pDraw = glxPriv->pDraw; - XMesaVisual xm_vis = find_mesa_visual(pDraw->pScreen->myNum, - glxPriv->modes->visualID); - __GLdrawablePrivate *glPriv = &glxPriv->glPriv; - __MESA_buffer buf; - - if (xm_vis == NULL) { - ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n", - glxPriv->modes->visualID); - } - buf = (__MESA_buffer)__glXMalloc(sizeof(struct __MESA_bufferRec)); - - /* Create Mesa's buffers */ - if (glxPriv->type == DRAWABLE_WINDOW) { - buf->xm_buf = (void *)XMesaCreateWindowBuffer(xm_vis, - (WindowPtr)pDraw); - } else { - buf->xm_buf = (void *)XMesaCreatePixmapBuffer(xm_vis, - (PixmapPtr)pDraw, 0); - } - - /* Wrap the front buffer's resize routine */ - buf->fbresize = glPriv->frontBuffer.resize; - glPriv->frontBuffer.resize = __MESA_resizeBuffers; - - /* Wrap the swap buffers routine */ - buf->fbswap = glxPriv->swapBuffers; - glxPriv->swapBuffers = __MESA_swapBuffers; - - /* Save Mesa's private buffer structure */ - glPriv->private = (void *)buf; - glPriv->freePrivate = __MESA_destroyBuffer; -} - -GLboolean __MESA_resizeBuffers(__GLdrawableBuffer *buffer, - GLint x, GLint y, - GLuint width, GLuint height, - __GLdrawablePrivate *glPriv, - GLuint bufferMask) -{ - __MESA_buffer buf = (__MESA_buffer)glPriv->private; - - if (buf->xm_buf) - XMesaResizeBuffers(buf->xm_buf); - - return (*buf->fbresize)(buffer, x, y, width, height, glPriv, bufferMask); -} - -GLboolean __MESA_swapBuffers(__GLXdrawablePrivate *glxPriv) -{ - __MESA_buffer buf = (__MESA_buffer)glxPriv->glPriv.private; - - /* - ** Do not call the wrapped swap buffers routine since Mesa has - ** already done the swap. - */ - XMesaSwapBuffers(buf->xm_buf); - - return GL_TRUE; -} - -void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv) -{ - __MESA_buffer buf = (__MESA_buffer)glPriv->private; - __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other; - - /* Destroy Mesa's buffers */ - if (buf->xm_buf) - XMesaDestroyBuffer(buf->xm_buf); - - /* Unwrap these routines */ - glxPriv->swapBuffers = buf->fbswap; - glPriv->frontBuffer.resize = buf->fbresize; - - __glXFree(glPriv->private); - glPriv->private = NULL; -} - -__GLinterface *__MESA_createContext(__GLimports *imports, - __GLcontextModes *modes, - __GLinterface *shareGC) -{ - __GLcontext *gl_ctx = NULL; - __GLcontext *m_share = NULL; - __GLXcontext *glxc = (__GLXcontext *)imports->other; - XMesaVisual xm_vis; - - if (shareGC) - m_share = (__GLcontext *)shareGC; - - xm_vis = find_mesa_visual(glxc->pScreen->myNum, glxc->modes->visualID); - if (xm_vis) { - XMesaContext xmshare = m_share ? m_share->DriverCtx : 0; - XMesaContext xmctx = XMesaCreateContext(xm_vis, xmshare); - gl_ctx = xmctx ? &xmctx->mesa : 0; - } - else { - ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n", - glxc->modes->visualID); - } - - - if (!gl_ctx) - return NULL; - - gl_ctx->imports = *imports; - gl_ctx->exports.destroyContext = __MESA_destroyContext; - gl_ctx->exports.loseCurrent = __MESA_loseCurrent; - gl_ctx->exports.makeCurrent = __MESA_makeCurrent; - gl_ctx->exports.shareContext = __MESA_shareContext; - gl_ctx->exports.copyContext = __MESA_copyContext; - gl_ctx->exports.forceCurrent = __MESA_forceCurrent; - gl_ctx->exports.notifyResize = __MESA_notifyResize; - gl_ctx->exports.notifyDestroy = __MESA_notifyDestroy; - gl_ctx->exports.notifySwapBuffers = __MESA_notifySwapBuffers; - gl_ctx->exports.dispatchExec = __MESA_dispatchExec; - gl_ctx->exports.beginDispatchOverride = __MESA_beginDispatchOverride; - gl_ctx->exports.endDispatchOverride = __MESA_endDispatchOverride; - - return (__GLinterface *)gl_ctx; -} - -GLboolean __MESA_destroyContext(__GLcontext *gc) -{ - XMesaContext xmesa = (XMesaContext) gc->DriverCtx; - XMesaDestroyContext( xmesa ); - return GL_TRUE; -} - -GLboolean __MESA_loseCurrent(__GLcontext *gc) -{ - XMesaContext xmesa = (XMesaContext) gc->DriverCtx; - MESA_CC = NULL; - __glXLastContext = NULL; - return XMesaLoseCurrent(xmesa); -} - -GLboolean __MESA_makeCurrent(__GLcontext *gc) -{ - __GLdrawablePrivate *drawPriv = gc->imports.getDrawablePrivate( gc ); - __MESA_buffer drawBuf = (__MESA_buffer)drawPriv->private; - __GLdrawablePrivate *readPriv = gc->imports.getReadablePrivate( gc ); - __MESA_buffer readBuf = (__MESA_buffer)readPriv->private; - XMesaContext xmesa = (XMesaContext) gc->DriverCtx; - - MESA_CC = gc; - return XMesaMakeCurrent2(xmesa, drawBuf->xm_buf, readBuf->xm_buf); -} - -GLboolean __MESA_shareContext(__GLcontext *gc, __GLcontext *gcShare) -{ - /* NOT_DONE */ - /* XXX I don't see where/how this could ever be called */ - ErrorF("__MESA_shareContext\n"); - return GL_FALSE; -} - -GLboolean __MESA_copyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask) -{ - XMesaContext xm_dst = (XMesaContext) dst->DriverCtx; - const XMesaContext xm_src = (const XMesaContext) src->DriverCtx; - _mesa_copy_context(&xm_src->mesa, &xm_dst->mesa, mask); - return GL_TRUE; -} - -GLboolean __MESA_forceCurrent(__GLcontext *gc) -{ - XMesaContext xmesa = (XMesaContext) gc->DriverCtx; - MESA_CC = gc; - return XMesaForceCurrent(xmesa); -} - -GLboolean __MESA_notifyResize(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_notifyResize\n"); - return GL_FALSE; -} - -void __MESA_notifyDestroy(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_notifyDestroy\n"); - return; -} - -void __MESA_notifySwapBuffers(__GLcontext *gc) -{ - _mesa_notifySwapBuffers(gc); -} - -struct __GLdispatchStateRec *__MESA_dispatchExec(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_dispatchExec\n"); - return NULL; -} - -void __MESA_beginDispatchOverride(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_beginDispatchOverride\n"); - return; -} - -void __MESA_endDispatchOverride(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_endDispatchOverride\n"); - return; -} - - -/* - * Server-side GLX uses these functions which are normally defined - * in the OpenGL SI. - */ - -GLuint __glFloorLog2(GLuint val) -{ - int c = 0; - - while (val > 1) { - c++; - val >>= 1; - } - return c; -} - diff --git a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c index 6441a4b4f..fad84ec7e 100644 --- a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c +++ b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c,v 1.5 2000/03/02 16:07:39 martin Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -36,11 +35,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <dix-config.h> #endif +#include <stdlib.h> + #include <gcstruct.h> #include "pixmapstr.h" #include "xf86glx_util.h" -#include <X11/Xmd.h> -#include "GL/xf86glx.h" +#include <nx-X11/Xmd.h> #ifdef ROUNDUP #undef ROUNDUP @@ -52,7 +52,7 @@ XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height, char *data { XMesaImage *image; - image = (XMesaImage *)xalloc(sizeof(XMesaImage)); + image = (XMesaImage *)malloc(sizeof(XMesaImage)); if (image) { image->width = width; @@ -70,7 +70,7 @@ void XMesaDestroyImage(XMesaImage *image) { if (image->data) free(image->data); - xfree(image); + free(image); } unsigned long XMesaGetPixel(XMesaImage *image, int x, int y) diff --git a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.h b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.h index 809c1550f..bb314128d 100644 --- a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.h +++ b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h,v 1.5 2000/08/10 17:40:29 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. diff --git a/nx-X11/programs/Xserver/GL/mesa/X/xf86glxint.h b/nx-X11/programs/Xserver/GL/mesa/X/xf86glxint.h index 974ff0364..4784566a4 100644 --- a/nx-X11/programs/Xserver/GL/mesa/X/xf86glxint.h +++ b/nx-X11/programs/Xserver/GL/mesa/X/xf86glxint.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h,v 1.4 2002/02/22 21:45:08 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. diff --git a/nx-X11/programs/Xserver/GL/mesa/array_cache/Imakefile b/nx-X11/programs/Xserver/GL/mesa/array_cache/Imakefile index 8126c3f30..474710747 100644 --- a/nx-X11/programs/Xserver/GL/mesa/array_cache/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/array_cache/Imakefile @@ -1,24 +1,9 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/array_cache/Imakefile,v 1.8 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - #include <Server.tmpl> #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaACBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../lib/GL/mesa/array_cache/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/array_cache/Imakefile.inc" -#endif +#include "Imakefile.inc" SRCS = $(MESA_AC_SRCS) OBJS = $(MESA_AC_OBJS) @@ -36,15 +21,10 @@ SUBDIRS = module DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ -#ifdef IHaveModules -ModuleObjectRule() -#else NormalLibraryObjectRule() -#endif SubdirLibraryRule($(OBJS)) -LintLibraryTarget(dri,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() diff --git a/nx-X11/programs/Xserver/GL/mesa/array_cache/Imakefile.inc b/nx-X11/programs/Xserver/GL/mesa/array_cache/Imakefile.inc new file mode 100644 index 000000000..39f6e2400 --- /dev/null +++ b/nx-X11/programs/Xserver/GL/mesa/array_cache/Imakefile.inc @@ -0,0 +1,28 @@ +MESAACBUILDDIR = MesaACBuildDir + + MESA_AC_SRCS = $(MESAACBUILDDIR)ac_context.c \ + $(MESAACBUILDDIR)ac_import.c + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(acache.h, $(MESASRCDIR)/src/mesa/array_cache) +LinkSourceFile(ac_context.c, $(MESASRCDIR)/src/mesa/array_cache) +LinkSourceFile(ac_context.h, $(MESASRCDIR)/src/mesa/array_cache) +LinkSourceFile(ac_import.c, $(MESASRCDIR)/src/mesa/array_cache) +#endif + + MESA_AC_OBJS = $(MESAACBUILDDIR)ac_context.o \ + $(MESAACBUILDDIR)ac_import.o + +#if defined(DoSharedLib) && DoSharedLib + MESA_AC_UOBJS = $(MESAACBUILDDIR)unshared/ac_context.o \ + $(MESAACBUILDDIR)unshared/ac_import.o +#else + MESA_AC_UOBJS = $(MESA_AC_OBJS) +#endif + + MESA_AC_DOBJS = $(MESAACBUILDDIR)debugger/ac_context.o \ + $(MESAACBUILDDIR)debugger/ac_import.o + + MESA_AC_POBJS = $(MESAACBUILDDIR)profiled/ac_context.o \ + $(MESAACBUILDDIR)profiled/ac_import.o + diff --git a/nx-X11/programs/Xserver/GL/mesa/array_cache/module/Imakefile b/nx-X11/programs/Xserver/GL/mesa/array_cache/module/Imakefile deleted file mode 100644 index 86c585012..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/array_cache/module/Imakefile +++ /dev/null @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/array_cache/module/Imakefile,v 1.1 2002/05/31 18:12:39 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - diff --git a/nx-X11/programs/Xserver/GL/mesa/main/Imakefile b/nx-X11/programs/Xserver/GL/mesa/main/Imakefile index 6287b92de..d6e914b89 100644 --- a/nx-X11/programs/Xserver/GL/mesa/main/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/main/Imakefile @@ -1,15 +1,3 @@ -XCOMM $XdotOrg: xc/programs/Xserver/GL/mesa/main/Imakefile,v 1.2 2004/08/19 07:34:43 kem Exp $ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/math/Imakefile,v 1.8 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - /* Large PIC tables needed for Solaris/SPARC builds */ #if defined(SunArchitecture) && defined(SparcArchitecture) && defined(LargePositionIndependentCFlags) PICFLAGS = LargePositionIndependentCFlags @@ -20,11 +8,7 @@ SUBDIRS = module #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../lib/GL/mesa/main/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/main/Imakefile.inc" -#endif +#include "Imakefile.inc" SRCS = $(COREMESABASESRCS) OBJS = $(COREMESABASEOBJS) @@ -41,15 +25,10 @@ SUBDIRS = module DEFINES = $(GLX_DEFINES) -DNXAGENT_SERVER /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ -#ifdef IHaveModules -ModuleObjectRule() -#else NormalLibraryObjectRule() -#endif SubdirLibraryRule($(OBJS)) -LintLibraryTarget(dri,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() diff --git a/nx-X11/programs/Xserver/GL/mesa/main/Imakefile.NX.original b/nx-X11/programs/Xserver/GL/mesa/main/Imakefile.NX.original deleted file mode 100644 index 6287b92de..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/main/Imakefile.NX.original +++ /dev/null @@ -1,61 +0,0 @@ -XCOMM $XdotOrg: xc/programs/Xserver/GL/mesa/main/Imakefile,v 1.2 2004/08/19 07:34:43 kem Exp $ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/math/Imakefile,v 1.8 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - -/* Large PIC tables needed for Solaris/SPARC builds */ -#if defined(SunArchitecture) && defined(SparcArchitecture) && defined(LargePositionIndependentCFlags) - PICFLAGS = LargePositionIndependentCFlags -#endif - -#include <Server.tmpl> - -#define NeedAllMesaSrc -#define NeedToLinkMesaSrc -#define MesaBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../lib/GL/mesa/main/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/main/Imakefile.inc" -#endif - - SRCS = $(COREMESABASESRCS) - OBJS = $(COREMESABASEOBJS) - - INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/include \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ - -I$(LIBSRC)/GL/include \ - -I$(XF86SRC) -I$(INCLUDESRC) - - DEFINES = $(GLX_DEFINES) -DNXAGENT_SERVER /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ - -#ifdef IHaveModules -ModuleObjectRule() -#else -NormalLibraryObjectRule() -#endif - -SubdirLibraryRule($(OBJS)) - -LintLibraryTarget(dri,$(SRCS)) -NormalLintTarget($(SRCS)) - -DependTarget() - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - diff --git a/nx-X11/programs/Xserver/GL/mesa/main/Imakefile.X.original b/nx-X11/programs/Xserver/GL/mesa/main/Imakefile.X.original deleted file mode 100644 index 463812236..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/main/Imakefile.X.original +++ /dev/null @@ -1,61 +0,0 @@ -XCOMM $XdotOrg: xc/programs/Xserver/GL/mesa/main/Imakefile,v 1.2 2004/08/19 07:34:43 kem Exp $ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/math/Imakefile,v 1.8 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - -/* Large PIC tables needed for Solaris/SPARC builds */ -#if defined(SunArchitecture) && defined(SparcArchitecture) && defined(LargePositionIndependentCFlags) - PICFLAGS = LargePositionIndependentCFlags -#endif - -#include <Server.tmpl> - -#define NeedAllMesaSrc -#define NeedToLinkMesaSrc -#define MesaBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../lib/GL/mesa/main/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/main/Imakefile.inc" -#endif - - SRCS = $(COREMESABASESRCS) - OBJS = $(COREMESABASEOBJS) - - INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/include \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ - -I$(LIBSRC)/GL/include \ - -I$(XF86SRC) -I$(INCLUDESRC) - - DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ - -#ifdef IHaveModules -ModuleObjectRule() -#else -NormalLibraryObjectRule() -#endif - -SubdirLibraryRule($(OBJS)) - -LintLibraryTarget(dri,$(SRCS)) -NormalLintTarget($(SRCS)) - -DependTarget() - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - diff --git a/nx-X11/programs/Xserver/GL/mesa/main/Imakefile.inc b/nx-X11/programs/Xserver/GL/mesa/main/Imakefile.inc new file mode 100644 index 000000000..3e98f9149 --- /dev/null +++ b/nx-X11/programs/Xserver/GL/mesa/main/Imakefile.inc @@ -0,0 +1,481 @@ +/* gcc on ppc64 defines this, causes macro recursion with pixel below */ +#undef pixel + +MESABUILDDIR = MesaBuildDir + +#ifdef NeedAllMesaSrc + DISPATCHSRCS = $(MESABUILDDIR)dispatch.c + GLAPISRCS = $(MESABUILDDIR)glapi.c + GLTHREADSRCS = $(MESABUILDDIR)glthread.c +#endif + +MESA_CORE_INCLUDES = -I$(MESASRCDIR)/src/array_cache \ + -I$(MESASRCDIR)/src/math -I$(MESASRCDIR)/src/shader \ + -I$(MESASRCDIR)/src/swrast -I$(MESASRCDIR)/src/swrast_setup \ + -I$(MESASRCDIR)/src/tnl -I$(MESASRCDIR)/src/tnl_dd + +COREMESABASESRCS = \ + $(MESABUILDDIR)api_arrayelt.c \ + $(MESABUILDDIR)api_loopback.c \ + $(MESABUILDDIR)api_noop.c \ + $(MESABUILDDIR)api_validate.c \ + $(MESABUILDDIR)accum.c \ + $(MESABUILDDIR)attrib.c \ + $(MESABUILDDIR)blend.c \ + $(MESABUILDDIR)bufferobj.c \ + $(MESABUILDDIR)buffers.c \ + $(MESABUILDDIR)clip.c \ + $(MESABUILDDIR)colortab.c \ + $(MESABUILDDIR)context.c \ + $(MESABUILDDIR)convolve.c \ + $(MESABUILDDIR)debug.c \ + $(MESABUILDDIR)depth.c \ + $(MESABUILDDIR)dlist.c \ + $(MESABUILDDIR)drawpix.c \ + $(MESABUILDDIR)enable.c \ + $(MESABUILDDIR)enums.c \ + $(MESABUILDDIR)eval.c \ + $(MESABUILDDIR)execmem.c \ + $(MESABUILDDIR)extensions.c \ + $(MESABUILDDIR)feedback.c \ + $(MESABUILDDIR)fbobject.c \ + $(MESABUILDDIR)fog.c \ + $(MESABUILDDIR)framebuffer.c \ + $(MESABUILDDIR)get.c \ + $(MESABUILDDIR)getstring.c \ + $(MESABUILDDIR)hash.c \ + $(MESABUILDDIR)hint.c \ + $(MESABUILDDIR)histogram.c \ + $(MESABUILDDIR)image.c \ + $(MESABUILDDIR)imports.c \ + $(MESABUILDDIR)light.c \ + $(MESABUILDDIR)lines.c \ + $(MESABUILDDIR)matrix.c \ + $(MESABUILDDIR)mm.c \ + $(MESABUILDDIR)occlude.c \ + $(MESABUILDDIR)pixel.c \ + $(MESABUILDDIR)points.c \ + $(MESABUILDDIR)polygon.c \ + $(MESABUILDDIR)rastpos.c \ + $(MESABUILDDIR)renderbuffer.c \ + $(MESABUILDDIR)state.c \ + $(MESABUILDDIR)stencil.c \ + $(MESABUILDDIR)texcompress.c \ + $(MESABUILDDIR)texcompress_fxt1.c \ + $(MESABUILDDIR)texcompress_s3tc.c \ + $(MESABUILDDIR)texenvprogram.c \ + $(MESABUILDDIR)texformat.c \ + $(MESABUILDDIR)teximage.c \ + $(MESABUILDDIR)texobj.c \ + $(MESABUILDDIR)texrender.c \ + $(MESABUILDDIR)texstate.c \ + $(MESABUILDDIR)texstore.c \ + $(MESABUILDDIR)varray.c \ + $(MESABUILDDIR)vtxfmt.c + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(api_arrayelt.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(api_arrayelt.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(api_eval.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(api_loopback.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(api_loopback.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(api_noop.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(api_noop.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(api_validate.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(api_validate.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(accum.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(accum.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(attrib.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(attrib.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(blend.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(blend.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(bufferobj.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(bufferobj.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(buffers.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(buffers.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(clip.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(clip.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(colormac.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(colortab.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(colortab.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(config.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(context.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(context.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(convolve.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(convolve.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(dd.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(debug.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(debug.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(depth.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(depth.h, $(MESASRCDIR)/src/mesa/main) +#ifdef NeedAllMesaSrc +LinkSourceFile(dispatch.c, $(MESASRCDIR)/src/mesa/main) +#endif +LinkSourceFile(dlist.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(dlist.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(drawpix.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(drawpix.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(enable.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(enable.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(enums.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(enums.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(eval.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(eval.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(execmem.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(extensions.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(extensions.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(fbobject.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(fbobject.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(feedback.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(feedback.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(fog.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(fog.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(framebuffer.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(framebuffer.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(get.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(get.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(getstring.c, $(MESASRCDIR)/src/mesa/main) +#ifdef NeedAllMesaSrc +LinkSourceFile(glapi.c, $(MESASRCDIR)/src/mesa/glapi) +LinkSourceFile(glthread.c, $(MESASRCDIR)/src/mesa/glapi) +#endif +LinkSourceFile(glheader.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(hash.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(hash.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(hint.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(hint.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(histogram.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(histogram.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(image.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(image.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(imports.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(imports.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(light.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(light.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(lines.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(lines.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(macros.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(matrix.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(matrix.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(mm.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(mm.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(mtypes.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(occlude.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(occlude.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(pixel.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(pixel.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(points.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(points.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(polygon.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(polygon.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(rastpos.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(rastpos.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(renderbuffer.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(renderbuffer.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(simple_list.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(state.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(state.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(stencil.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(stencil.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texcompress.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texcompress_fxt1.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texcompress_s3tc.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texcompress.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texenvprogram.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texenvprogram.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texformat.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texformat.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texformat_tmp.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(teximage.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(teximage.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texobj.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texobj.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texrender.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texrender.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texstate.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texstate.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texstore.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(texstore.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(varray.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(varray.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(version.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(vtxfmt.c, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(vtxfmt.h, $(MESASRCDIR)/src/mesa/main) +LinkSourceFile(vtxfmt_tmp.h, $(MESASRCDIR)/src/mesa/main) +#endif + +#ifdef NeedAllMesaSrc + DISPATCHOBJS = $(MESABUILDDIR)dispatch.o + GLAPIOBJS = $(MESABUILDDIR)glapi.o + GLTHREADOBJS = $(MESABUILDDIR)glthread.o +#endif + +COREMESABASEOBJS = \ + $(DISPATCHOBJS) \ + $(GLAPIOBJS) \ + $(GLTHREADOBJS) \ + $(MESABUILDDIR)api_arrayelt.o \ + $(MESABUILDDIR)api_loopback.o \ + $(MESABUILDDIR)api_noop.o \ + $(MESABUILDDIR)api_validate.o \ + $(MESABUILDDIR)accum.o \ + $(MESABUILDDIR)attrib.o \ + $(MESABUILDDIR)blend.o \ + $(MESABUILDDIR)bufferobj.o \ + $(MESABUILDDIR)buffers.o \ + $(MESABUILDDIR)clip.o \ + $(MESABUILDDIR)colortab.o \ + $(MESABUILDDIR)context.o \ + $(MESABUILDDIR)convolve.o \ + $(MESABUILDDIR)debug.o \ + $(MESABUILDDIR)depth.o \ + $(MESABUILDDIR)dlist.o \ + $(MESABUILDDIR)drawpix.o \ + $(MESABUILDDIR)enable.o \ + $(MESABUILDDIR)enums.o \ + $(MESABUILDDIR)eval.o \ + $(MESABUILDDIR)execmem.o \ + $(MESABUILDDIR)extensions.o \ + $(MESABUILDDIR)fbobject.o \ + $(MESABUILDDIR)feedback.o \ + $(MESABUILDDIR)fog.o \ + $(MESABUILDDIR)framebuffer.o \ + $(MESABUILDDIR)get.o \ + $(MESABUILDDIR)getstring.o \ + $(MESABUILDDIR)hash.o \ + $(MESABUILDDIR)hint.o \ + $(MESABUILDDIR)histogram.o \ + $(MESABUILDDIR)image.o \ + $(MESABUILDDIR)imports.o \ + $(MESABUILDDIR)light.o \ + $(MESABUILDDIR)lines.o \ + $(MESABUILDDIR)matrix.o \ + $(MESABUILDDIR)mm.o \ + $(MESABUILDDIR)occlude.o \ + $(MESABUILDDIR)pixel.o \ + $(MESABUILDDIR)points.o \ + $(MESABUILDDIR)polygon.o \ + $(MESABUILDDIR)rastpos.o \ + $(MESABUILDDIR)renderbuffer.o \ + $(MESABUILDDIR)state.o \ + $(MESABUILDDIR)stencil.o \ + $(MESABUILDDIR)texcompress.o \ + $(MESABUILDDIR)texcompress_fxt1.o \ + $(MESABUILDDIR)texcompress_s3tc.o \ + $(MESABUILDDIR)texenvprogram.o \ + $(MESABUILDDIR)texformat.o \ + $(MESABUILDDIR)teximage.o \ + $(MESABUILDDIR)texrender.o \ + $(MESABUILDDIR)texobj.o \ + $(MESABUILDDIR)texstate.o \ + $(MESABUILDDIR)texstore.o \ + $(MESABUILDDIR)varray.o \ + $(MESABUILDDIR)vtxfmt.o + +#ifdef NeedAllMesaSrc + DISPATCHUOBJS = $(MESABUILDDIR)unshared/dispatch.o + GLAPIUOBJS = $(MESABUILDDIR)unshared/glapi.o + GLTHREADUOBJS = $(MESABUILDDIR)unshared/glthread.o +#endif + +#if defined(DoSharedLib) && DoSharedLib +COREMESABASEUOBJS = \ + $(DISPATCHUOBJS) \ + $(GLAPIUOBJS) \ + $(GLTHREADUOBJS) \ + $(MESABUILDDIR)unshared/api_arrayelt.o \ + $(MESABUILDDIR)unshared/api_loopback.o \ + $(MESABUILDDIR)unshared/api_noop.o \ + $(MESABUILDDIR)unshared/api_validate.o \ + $(MESABUILDDIR)unshared/accum.o \ + $(MESABUILDDIR)unshared/attrib.o \ + $(MESABUILDDIR)unshared/blend.o \ + $(MESABUILDDIR)unshared/bufferobj.o \ + $(MESABUILDDIR)unshared/buffers.o \ + $(MESABUILDDIR)unshared/clip.o \ + $(MESABUILDDIR)unshared/colortab.o \ + $(MESABUILDDIR)unshared/context.o \ + $(MESABUILDDIR)unshared/convolve.o \ + $(MESABUILDDIR)unshared/debug.o \ + $(MESABUILDDIR)unshared/depth.o \ + $(MESABUILDDIR)unshared/dlist.o \ + $(MESABUILDDIR)unshared/drawpix.o \ + $(MESABUILDDIR)unshared/enable.o \ + $(MESABUILDDIR)unshared/enums.o \ + $(MESABUILDDIR)unshared/eval.o \ + $(MESABUILDDIR)unshared/execmem.o \ + $(MESABUILDDIR)unshared/extensions.o \ + $(MESABUILDDIR)unshared/fbobject.o \ + $(MESABUILDDIR)unshared/feedback.o \ + $(MESABUILDDIR)unshared/fog.o \ + $(MESABUILDDIR)unshared/framebuffer.o \ + $(MESABUILDDIR)unshared/get.o \ + $(MESABUILDDIR)unshared/getstring.o \ + $(MESABUILDDIR)unshared/hash.o \ + $(MESABUILDDIR)unshared/hint.o \ + $(MESABUILDDIR)unshared/histogram.o \ + $(MESABUILDDIR)unshared/image.o \ + $(MESABUILDDIR)unshared/imports.o \ + $(MESABUILDDIR)unshared/light.o \ + $(MESABUILDDIR)unshared/lines.o \ + $(MESABUILDDIR)unshared/matrix.o \ + $(MESABUILDDIR)unshared/mm.o \ + $(MESABUILDDIR)unshared/occlude.o \ + $(MESABUILDDIR)unshared/pixel.o \ + $(MESABUILDDIR)unshared/points.o \ + $(MESABUILDDIR)unshared/polygon.o \ + $(MESABUILDDIR)unshared/rastpos.o \ + $(MESABUILDDIR)unshared/renderbuffer.o \ + $(MESABUILDDIR)unshared/state.o \ + $(MESABUILDDIR)unshared/stencil.o \ + $(MESABUILDDIR)unshared/texcompress.o \ + $(MESABUILDDIR)unshared/texcompress_fxt1.o \ + $(MESABUILDDIR)unshared/texcompress_s3tc.o \ + $(MESABUILDDIR)unshared/texenvprogram.o \ + $(MESABUILDDIR)unshared/texformat.o \ + $(MESABUILDDIR)unshared/teximage.o \ + $(MESABUILDDIR)unshared/texobj.o \ + $(MESABUILDDIR)unshared/texrender.o \ + $(MESABUILDDIR)unshared/texstate.o \ + $(MESABUILDDIR)unshared/texstore.o \ + $(MESABUILDDIR)unshared/varray.o \ + $(MESABUILDDIR)unshared/vtxfmt.o +#else +COREMESABASEUOBJS = $(COREMESABASEOBJS) +#endif + +#ifdef NeedAllMesaSrc + DISPATCHDOBJS = $(MESABUILDDIR)debugger/dispatch.o + GLAPIDOBJS = $(MESABUILDDIR)debugger/glapi.o + GLTHREADDOBJS = $(MESABUILDDIR)debugger/glthread.o +#endif + +COREMESABASEDOBJS = \ + $(DISPATCHDOBJS) \ + $(GLAPIDOBJS) \ + $(GLTHREADDOBJS) \ + $(MESABUILDDIR)debugger/api_arrayelt.o \ + $(MESABUILDDIR)debugger/api_loopback.o \ + $(MESABUILDDIR)debugger/api_noop.o \ + $(MESABUILDDIR)debugger/api_validate.o \ + $(MESABUILDDIR)debugger/accum.o \ + $(MESABUILDDIR)debugger/attrib.o \ + $(MESABUILDDIR)debugger/blend.o \ + $(MESABUILDDIR)debugger/bufferobj.o \ + $(MESABUILDDIR)debugger/buffers.o \ + $(MESABUILDDIR)debugger/clip.o \ + $(MESABUILDDIR)debugger/colortab.o \ + $(MESABUILDDIR)debugger/context.o \ + $(MESABUILDDIR)debugger/convolve.o \ + $(MESABUILDDIR)debugger/debug.o \ + $(MESABUILDDIR)debugger/depth.o \ + $(MESABUILDDIR)debugger/dlist.o \ + $(MESABUILDDIR)debugger/drawpix.o \ + $(MESABUILDDIR)debugger/enable.o \ + $(MESABUILDDIR)debugger/enums.o \ + $(MESABUILDDIR)debugger/eval.o \ + $(MESABUILDDIR)debugger/execmem.o \ + $(MESABUILDDIR)debugger/extensions.o \ + $(MESABUILDDIR)debugger/fbobject.o \ + $(MESABUILDDIR)debugger/feedback.o \ + $(MESABUILDDIR)debugger/fog.o \ + $(MESABUILDDIR)debugger/framebuffer.o \ + $(MESABUILDDIR)debugger/get.o \ + $(MESABUILDDIR)debugger/getstring.o \ + $(MESABUILDDIR)debugger/hash.o \ + $(MESABUILDDIR)debugger/hint.o \ + $(MESABUILDDIR)debugger/histogram.o \ + $(MESABUILDDIR)debugger/image.o \ + $(MESABUILDDIR)debugger/imports.o \ + $(MESABUILDDIR)debugger/light.o \ + $(MESABUILDDIR)debugger/lines.o \ + $(MESABUILDDIR)debugger/matrix.o \ + $(MESABUILDDIR)debugger/mm.o \ + $(MESABUILDDIR)debugger/occlude.o \ + $(MESABUILDDIR)debugger/pixel.o \ + $(MESABUILDDIR)debugger/points.o \ + $(MESABUILDDIR)debugger/polygon.o \ + $(MESABUILDDIR)debugger/rastpos.o \ + $(MESABUILDDIR)debugger/renderbuffer.o \ + $(MESABUILDDIR)debugger/state.o \ + $(MESABUILDDIR)debugger/stencil.o \ + $(MESABUILDDIR)debugger/texcompress.o \ + $(MESABUILDDIR)debugger/texcompress_fxt1.o \ + $(MESABUILDDIR)debugger/texcompress_s3tc.o \ + $(MESABUILDDIR)debugger/texenvprogram.o \ + $(MESABUILDDIR)debugger/texformat.o \ + $(MESABUILDDIR)debugger/teximage.o \ + $(MESABUILDDIR)debugger/texobj.o \ + $(MESABUILDDIR)debugger/texrender.o \ + $(MESABUILDDIR)debugger/texstate.o \ + $(MESABUILDDIR)debugger/texstore.o \ + $(MESABUILDDIR)debugger/varray.o \ + $(MESABUILDDIR)debugger/vtxfmt.o + +#ifdef NeedAllMesaSrc + DISPATCHPOBJS = $(MESABUILDDIR)profiled/dispatch.o + GLAPIPOBJS = $(MESABUILDDIR)profiled/glapi.o + GLTHREADPOBJS = $(MESABUILDDIR)profiled/glthread.o +#endif + +COREMESABASEPOBJS = \ + $(DISPATCHPOBJS) \ + $(GLAPIPOBJS) \ + $(GLTHREADPOBJS) \ + $(MESABUILDDIR)profiled/api_arrayelt.o \ + $(MESABUILDDIR)profiled/api_loopback.o \ + $(MESABUILDDIR)profiled/api_noop.o \ + $(MESABUILDDIR)profiled/api_validate.o \ + $(MESABUILDDIR)profiled/accum.o \ + $(MESABUILDDIR)profiled/attrib.o \ + $(MESABUILDDIR)profiled/blend.o \ + $(MESABUILDDIR)profiled/bufferobj.o \ + $(MESABUILDDIR)profiled/buffers.o \ + $(MESABUILDDIR)profiled/clip.o \ + $(MESABUILDDIR)profiled/colortab.o \ + $(MESABUILDDIR)profiled/context.o \ + $(MESABUILDDIR)profiled/convolve.o \ + $(MESABUILDDIR)profiled/debug.o \ + $(MESABUILDDIR)profiled/depth.o \ + $(MESABUILDDIR)profiled/dlist.o \ + $(MESABUILDDIR)profiled/drawpix.o \ + $(MESABUILDDIR)profiled/enable.o \ + $(MESABUILDDIR)profiled/enums.o \ + $(MESABUILDDIR)profiled/eval.o \ + $(MESABUILDDIR)profiled/execmem.o \ + $(MESABUILDDIR)profiled/extensions.o \ + $(MESABUILDDIR)profiled/fbobject.o \ + $(MESABUILDDIR)profiled/feedback.o \ + $(MESABUILDDIR)profiled/fog.o \ + $(MESABUILDDIR)profiled/framebuffer.o \ + $(MESABUILDDIR)profiled/get.o \ + $(MESABUILDDIR)profiled/getstring.o \ + $(MESABUILDDIR)profiled/hash.o \ + $(MESABUILDDIR)profiled/hint.o \ + $(MESABUILDDIR)profiled/histogram.o \ + $(MESABUILDDIR)profiled/image.o \ + $(MESABUILDDIR)profiled/imports.o \ + $(MESABUILDDIR)profiled/light.o \ + $(MESABUILDDIR)profiled/lines.o \ + $(MESABUILDDIR)profiled/matrix.o \ + $(MESABUILDDIR)profiled/mm.o \ + $(MESABUILDDIR)profiled/occlude.o \ + $(MESABUILDDIR)profiled/pixel.o \ + $(MESABUILDDIR)profiled/points.o \ + $(MESABUILDDIR)profiled/polygon.o \ + $(MESABUILDDIR)profiled/rastpos.o \ + $(MESABUILDDIR)profiled/renderbuffer.o \ + $(MESABUILDDIR)profiled/state.o \ + $(MESABUILDDIR)profiled/stencil.o \ + $(MESABUILDDIR)profiled/texcompress.o \ + $(MESABUILDDIR)profiled/texcompress_fxt1.o \ + $(MESABUILDDIR)profiled/texcompress_s3tc.o \ + $(MESABUILDDIR)profiled/texenvprogram.o \ + $(MESABUILDDIR)profiled/texformat.o \ + $(MESABUILDDIR)profiled/teximage.o \ + $(MESABUILDDIR)profiled/texobj.o \ + $(MESABUILDDIR)profiled/texrender.o \ + $(MESABUILDDIR)profiled/texstate.o \ + $(MESABUILDDIR)profiled/texstore.o \ + $(MESABUILDDIR)profiled/varray.o \ + $(MESABUILDDIR)profiled/vtxfmt.o diff --git a/nx-X11/programs/Xserver/GL/mesa/main/WSDrawBuffer.h b/nx-X11/programs/Xserver/GL/mesa/main/WSDrawBuffer.h new file mode 100644 index 000000000..bf6ea040c --- /dev/null +++ b/nx-X11/programs/Xserver/GL/mesa/main/WSDrawBuffer.h @@ -0,0 +1,27 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */ +/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/ +/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */ +/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXAGENT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/**************************************************************************/ + +typedef struct _WSDrawBufferRec { + GLframebuffer *DrawBuffer; + struct _WSDrawBufferRec *next; +} WSDrawBufferRec, *WSDrawBufferPtr; + +WSDrawBufferPtr pWSDrawBuffer; + diff --git a/nx-X11/programs/Xserver/GL/mesa/main/module/Imakefile b/nx-X11/programs/Xserver/GL/mesa/main/module/Imakefile deleted file mode 100644 index e21afd5e5..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/main/module/Imakefile +++ /dev/null @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/math/module/Imakefile,v 1.1 2002/05/31 18:12:40 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - diff --git a/nx-X11/programs/Xserver/GL/mesa/math/Imakefile b/nx-X11/programs/Xserver/GL/mesa/math/Imakefile index 49720974c..6af3a0a0c 100644 --- a/nx-X11/programs/Xserver/GL/mesa/math/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/math/Imakefile @@ -1,24 +1,9 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/math/Imakefile,v 1.8 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - #include <Server.tmpl> #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaMathBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../lib/GL/mesa/math/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/math/Imakefile.inc" -#endif +#include "Imakefile.inc" SRCS = $(MESA_MATH_SRCS) OBJS = $(MESA_MATH_OBJS) @@ -35,15 +20,10 @@ SUBDIRS = module DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ -#ifdef IHaveModules -ModuleObjectRule() -#else NormalLibraryObjectRule() -#endif SubdirLibraryRule($(OBJS)) -LintLibraryTarget(dri,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() diff --git a/nx-X11/programs/Xserver/GL/mesa/math/Imakefile.inc b/nx-X11/programs/Xserver/GL/mesa/math/Imakefile.inc new file mode 100644 index 000000000..bc9a1f326 --- /dev/null +++ b/nx-X11/programs/Xserver/GL/mesa/math/Imakefile.inc @@ -0,0 +1,76 @@ +MESAMATHBUILDDIR = MesaMathBuildDir + + MESA_MATH_SRCS = $(MESAMATHBUILDDIR)m_debug_clip.c \ + $(MESAMATHBUILDDIR)m_debug_norm.c \ + $(MESAMATHBUILDDIR)m_debug_xform.c \ + $(MESAMATHBUILDDIR)m_eval.c \ + $(MESAMATHBUILDDIR)m_matrix.c \ + $(MESAMATHBUILDDIR)m_translate.c \ + $(MESAMATHBUILDDIR)m_vector.c \ + $(MESAMATHBUILDDIR)m_xform.c + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(mathmod.h, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_clip_tmp.h, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_copy_tmp.h, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_debug_clip.c, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_debug.h, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_debug_util.h, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_debug_norm.c, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_debug_xform.c, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_dotprod_tmp.h, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_eval.c, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_eval.h, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_matrix.c, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_matrix.h, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_norm_tmp.h, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_translate.c, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_translate.h, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_trans_tmp.h, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_vector.c, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_vector.h, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_xform.c, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_xform.h, $(MESASRCDIR)/src/mesa/math) +LinkSourceFile(m_xform_tmp.h, $(MESASRCDIR)/src/mesa/math) +#endif + + MESA_MATH_OBJS = $(MESAMATHBUILDDIR)m_debug_clip.o \ + $(MESAMATHBUILDDIR)m_debug_norm.o \ + $(MESAMATHBUILDDIR)m_debug_xform.o \ + $(MESAMATHBUILDDIR)m_eval.o \ + $(MESAMATHBUILDDIR)m_matrix.o \ + $(MESAMATHBUILDDIR)m_translate.o \ + $(MESAMATHBUILDDIR)m_vector.o \ + $(MESAMATHBUILDDIR)m_xform.o + +#if defined(DoSharedLib) && DoSharedLib + MESA_MATH_UOBJS = $(MESAMATHBUILDDIR)unshared/m_debug_clip.o \ + $(MESAMATHBUILDDIR)unshared/m_debug_norm.o \ + $(MESAMATHBUILDDIR)unshared/m_debug_xform.o \ + $(MESAMATHBUILDDIR)unshared/m_eval.o \ + $(MESAMATHBUILDDIR)unshared/m_matrix.o \ + $(MESAMATHBUILDDIR)unshared/m_translate.o \ + $(MESAMATHBUILDDIR)unshared/m_vector.o \ + $(MESAMATHBUILDDIR)unshared/m_xform.o +#else + MATH_MESA_UOBJS = $(MESA_MATH_OBJS) +#endif + + MESA_MATH_DOBJS = $(MESAMATHBUILDDIR)debugger/m_debug_clip.o \ + $(MESAMATHBUILDDIR)debugger/m_debug_norm.o \ + $(MESAMATHBUILDDIR)debugger/m_debug_xform.o \ + $(MESAMATHBUILDDIR)debugger/m_eval.o \ + $(MESAMATHBUILDDIR)debugger/m_matrix.o \ + $(MESAMATHBUILDDIR)debugger/m_translate.o \ + $(MESAMATHBUILDDIR)debugger/m_vector.o \ + $(MESAMATHBUILDDIR)debugger/m_xform.o + + MESA_MATH_POBJS = $(MESAMATHBUILDDIR)profiled/m_debug_clip.o \ + $(MESAMATHBUILDDIR)profiled/m_debug_norm.o \ + $(MESAMATHBUILDDIR)profiled/m_debug_xform.o \ + $(MESAMATHBUILDDIR)profiled/m_eval.o \ + $(MESAMATHBUILDDIR)profiled/m_matrix.o \ + $(MESAMATHBUILDDIR)profiled/m_translate.o \ + $(MESAMATHBUILDDIR)profiled/m_vector.o \ + $(MESAMATHBUILDDIR)profiled/m_xform.o + diff --git a/nx-X11/programs/Xserver/GL/mesa/math/module/Imakefile b/nx-X11/programs/Xserver/GL/mesa/math/module/Imakefile deleted file mode 100644 index e21afd5e5..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/math/module/Imakefile +++ /dev/null @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/math/module/Imakefile,v 1.1 2002/05/31 18:12:40 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - diff --git a/nx-X11/programs/Xserver/GL/mesa/shader/Imakefile b/nx-X11/programs/Xserver/GL/mesa/shader/Imakefile index 7b14ab7b9..bf3acd4f6 100644 --- a/nx-X11/programs/Xserver/GL/mesa/shader/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/shader/Imakefile @@ -1,27 +1,13 @@ -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif -#if !defined(IHaveModules) || !BuildModuleInSubdir #define IHaveSubdirs SUBDIRS = grammar slang -#endif #include <Server.tmpl> #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaShaderBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../lib/GL/mesa/shader/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/shader/Imakefile.inc" -#endif +#include "Imakefile.inc" SRCS = $(MESA_SHADER_SRCS) OBJS = $(MESA_SHADER_OBJS) @@ -40,15 +26,10 @@ SUBDIRS = module DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ -#ifdef IHaveModules -ModuleObjectRule() -#else NormalLibraryObjectRule() -#endif SubdirLibraryRule($(OBJS)) -LintLibraryTarget(dri,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() diff --git a/nx-X11/programs/Xserver/GL/mesa/shader/Imakefile.inc b/nx-X11/programs/Xserver/GL/mesa/shader/Imakefile.inc new file mode 100644 index 000000000..185103996 --- /dev/null +++ b/nx-X11/programs/Xserver/GL/mesa/shader/Imakefile.inc @@ -0,0 +1,100 @@ +MESASHADERBUILDDIR = MesaShaderBuildDir + + MESA_SHADER_SRCS = $(MESASHADERBUILDDIR)arbprogparse.c \ + $(MESASHADERBUILDDIR)arbprogram.c \ + $(MESASHADERBUILDDIR)arbfragparse.c \ + $(MESASHADERBUILDDIR)arbvertparse.c \ + $(MESASHADERBUILDDIR)atifragshader.c \ + $(MESASHADERBUILDDIR)nvprogram.c \ + $(MESASHADERBUILDDIR)nvfragparse.c \ + $(MESASHADERBUILDDIR)nvvertexec.c \ + $(MESASHADERBUILDDIR)nvvertparse.c \ + $(MESASHADERBUILDDIR)program.c \ + $(MESASHADERBUILDDIR)shaderobjects.c \ + $(MESASHADERBUILDDIR)shaderobjects_3dlabs.c + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(arbprogparse.c, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(arbprogram.c, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(arbfragparse.c, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(arbvertparse.c, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(arbfragparse.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(arbprogparse.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(arbprogram.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(arbprogram_syn.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(arbvertparse.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(atifragshader.c, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(atifragshader.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(nvfragparse.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(nvfragprog.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(nvprogram.c, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(nvprogram.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(nvfragparse.c, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(nvvertexec.c, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(nvvertexec.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(nvvertparse.c, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(nvvertparse.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(nvvertprog.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(program.c, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(program.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(shaderobjects.c, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(shaderobjects.h, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(shaderobjects_3dlabs.c, $(MESASRCDIR)/src/mesa/shader) +LinkSourceFile(shaderobjects_3dlabs.h, $(MESASRCDIR)/src/mesa/shader) +#endif + + MESA_SHADER_OBJS = $(MESASHADERBUILDDIR)arbprogparse.o \ + $(MESASHADERBUILDDIR)arbprogram.o \ + $(MESASHADERBUILDDIR)arbfragparse.o \ + $(MESASHADERBUILDDIR)arbvertparse.o \ + $(MESASHADERBUILDDIR)atifragshader.o \ + $(MESASHADERBUILDDIR)nvprogram.o \ + $(MESASHADERBUILDDIR)nvfragparse.o \ + $(MESASHADERBUILDDIR)nvvertexec.o \ + $(MESASHADERBUILDDIR)nvvertparse.o \ + $(MESASHADERBUILDDIR)program.o \ + $(MESASHADERBUILDDIR)shaderobjects.o \ + $(MESASHADERBUILDDIR)shaderobjects_3dlabs.o + +#if defined(DoSharedLib) && DoSharedLib + MESA_SHADER_UOBJS = $(MESASHADERBUILDDIR)unshared/arbprogparse.o \ + $(MESASHADERBUILDDIR)unshared/arbprogram.o \ + $(MESASHADERBUILDDIR)unshared/arbfragparse.o \ + $(MESASHADERBUILDDIR)unshared/arbvertparse.o \ + $(MESASHADERBUILDDIR)unshared/atifragshader.o \ + $(MESASHADERBUILDDIR)unshared/nvprogram.o \ + $(MESASHADERBUILDDIR)unshared/nvfragparse.o \ + $(MESASHADERBUILDDIR)unshared/nvvertexec.o \ + $(MESASHADERBUILDDIR)unshared/nvvertparse.o \ + $(MESASHADERBUILDDIR)unshared/program.o \ + $(MESASHADERBUILDDIR)unshared/shaderobjects.o \ + $(MESASHADERBUILDDIR)unshared/shaderobjects_3dlabs.o +#else + MESA_SHADER_UOBJS = $(MESA_SHADER_OBJS) +#endif + + MESA_SHADER_DOBJS = $(MESASHADERBUILDDIR)debugger/arbprogparse.o \ + $(MESASHADERBUILDDIR)debugger/arbprogram.o \ + $(MESASHADERBUILDDIR)debugger/arbfragparse.o \ + $(MESASHADERBUILDDIR)debugger/arbvertparse.o \ + $(MESASHADERBUILDDIR)debugger/atifragshader.o \ + $(MESASHADERBUILDDIR)debugger/nvprogram.o \ + $(MESASHADERBUILDDIR)debugger/nvfragparse.o \ + $(MESASHADERBUILDDIR)debugger/nvvertexec.o \ + $(MESASHADERBUILDDIR)debugger/nvvertparse.o \ + $(MESASHADERBUILDDIR)debugger/program.o \ + $(MESASHADERBUILDDIR)debugger/shaderobjects.o \ + $(MESASHADERBUILDDIR)debugger/shaderobjects_3dlabs.o + + MESA_SHADER_POBJS = $(MESASHADERBUILDDIR)profiled/arbprogparse.o \ + $(MESASHADERBUILDDIR)profiled/arbprogram.o \ + $(MESASHADERBUILDDIR)profiled/arbfragparse.o \ + $(MESASHADERBUILDDIR)profiled/arbvertparse.o \ + $(MESASHADERBUILDDIR)profiled/atifragshader.o \ + $(MESASHADERBUILDDIR)profiled/nvprogram.o \ + $(MESASHADERBUILDDIR)profiled/nvfragparse.o \ + $(MESASHADERBUILDDIR)profiled/nvvertexec.o \ + $(MESASHADERBUILDDIR)profiled/nvvertparse.o \ + $(MESASHADERBUILDDIR)profiled/program.o \ + $(MESASHADERBUILDDIR)profiled/shaderobjects.o \ + $(MESASHADERBUILDDIR)profiled/shaderobjects_3dlabs.o diff --git a/nx-X11/programs/Xserver/GL/mesa/shader/grammar/Imakefile b/nx-X11/programs/Xserver/GL/mesa/shader/grammar/Imakefile index c16b3ddad..3fe604f2e 100644 --- a/nx-X11/programs/Xserver/GL/mesa/shader/grammar/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/shader/grammar/Imakefile @@ -1,22 +1,10 @@ -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif #include <Server.tmpl> #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaGrammarBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../../lib/GL/mesa/shader/grammar/Imakefile.inc" -#else -#include "../../../../../../../lib/GL/mesa/shader/grammar/Imakefile.inc" -#endif +#include "Imakefile.inc" SRCS = $(MESA_GRAMMAR_SRCS) OBJS = $(MESA_GRAMMAR_OBJS) @@ -34,15 +22,10 @@ SUBDIRS = module DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ -#ifdef IHaveModules -ModuleObjectRule() -#else NormalLibraryObjectRule() -#endif SubdirLibraryRule($(OBJS)) -LintLibraryTarget(dri,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() diff --git a/nx-X11/programs/Xserver/GL/mesa/shader/grammar/Imakefile.inc b/nx-X11/programs/Xserver/GL/mesa/shader/grammar/Imakefile.inc new file mode 100644 index 000000000..4f91af9c1 --- /dev/null +++ b/nx-X11/programs/Xserver/GL/mesa/shader/grammar/Imakefile.inc @@ -0,0 +1,23 @@ +MESAGRAMMARBUILDDIR=MesaGrammarBuildDir + + MESA_GRAMMAR_SRCS = $(MESAGRAMMARBUILDDIR)grammar_mesa.c + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(grammar.c, $(MESASRCDIR)/src/mesa/shader/grammar) +LinkSourceFile(grammar.h, $(MESASRCDIR)/src/mesa/shader/grammar) +LinkSourceFile(grammar_syn.h, $(MESASRCDIR)/src/mesa/shader/grammar) +LinkSourceFile(grammar_mesa.c, $(MESASRCDIR)/src/mesa/shader/grammar) +LinkSourceFile(grammar_mesa.h, $(MESASRCDIR)/src/mesa/shader/grammar) +#endif + + MESA_GRAMMAR_OBJS = $(MESAGRAMMARBUILDDIR)grammar_mesa.o + +#if defined(DoSharedLib) && DoSharedLib + MESA_GRAMMAR_UOBJS = $(MESAGRAMMARBUILDDIR)unshared/grammar_mesa.o +#else + MESA_GRAMMAR_UOBJS = $(MESA_GRAMMAR_OBJS) +#endif + + MESA_GRAMMAR_DOBJS = $(MESAGRAMMARBUILDDIR)debugger/grammar_mesa.o + + MESA_GRAMMAR_POBJS = $(MESAGRAMMARBUILDDIR)profiled/grammar_mesa.o diff --git a/nx-X11/programs/Xserver/GL/mesa/shader/slang/Imakefile b/nx-X11/programs/Xserver/GL/mesa/shader/slang/Imakefile index 0bee2b774..d5ec4d6cf 100644 --- a/nx-X11/programs/Xserver/GL/mesa/shader/slang/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/shader/slang/Imakefile @@ -1,27 +1,13 @@ -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif -#if !defined(IHaveModules) || !BuildModuleInSubdir #define IHaveSubdirs SUBDIRS = library -#endif #include <Server.tmpl> #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaSlangBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../../lib/GL/mesa/shader/slang/Imakefile.inc" -#else -#include "../../../../../../../lib/GL/mesa/shader/slang/Imakefile.inc" -#endif +#include "Imakefile.inc" SRCS = $(MESA_SLANG_SRCS) OBJS = $(MESA_SLANG_OBJS) @@ -39,15 +25,10 @@ SUBDIRS = module DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ -#ifdef IHaveModules -ModuleObjectRule() -#else NormalLibraryObjectRule() -#endif SubdirLibraryRule($(OBJS)) -LintLibraryTarget(dri,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() diff --git a/nx-X11/programs/Xserver/GL/mesa/shader/slang/Imakefile.inc b/nx-X11/programs/Xserver/GL/mesa/shader/slang/Imakefile.inc new file mode 100644 index 000000000..6757e2e50 --- /dev/null +++ b/nx-X11/programs/Xserver/GL/mesa/shader/slang/Imakefile.inc @@ -0,0 +1,84 @@ +MESASLANGBUILDDIR=MesaSlangBuildDir + + MESA_SLANG_SRCS = $(MESASLANGBUILDDIR)slang_assemble_assignment.c \ + $(MESASLANGBUILDDIR)slang_assemble.c \ + $(MESASLANGBUILDDIR)slang_assemble_conditional.c \ + $(MESASLANGBUILDDIR)slang_assemble_constructor.c \ + $(MESASLANGBUILDDIR)slang_assemble_typeinfo.c \ + $(MESASLANGBUILDDIR)slang_compile.c \ + $(MESASLANGBUILDDIR)slang_execute.c \ + $(MESASLANGBUILDDIR)slang_preprocess.c \ + $(MESASLANGBUILDDIR)slang_storage.c \ + $(MESASLANGBUILDDIR)slang_utility.c + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(slang_assemble_assignment.c, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_assemble_assignment.h, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_assemble.c, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_assemble.h, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_assemble_conditional.c, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_assemble_conditional.h, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_assemble_constructor.c, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_assemble_constructor.h, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_assemble_typeinfo.c, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_assemble_typeinfo.h, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_compile.c, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_compile.h, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_execute.c, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_execute.h, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_preprocess.c, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_preprocess.h, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_storage.c, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_storage.h, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_utility.c, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(slang_utility.h, $(MESASRCDIR)/src/mesa/shader/slang) +LinkSourceFile(traverse_wrap.h, $(MESASRCDIR)/src/mesa/shader/slang) +#endif + + MESA_SLANG_OBJS = $(MESASLANGBUILDDIR)slang_assemble_assignment.o \ + $(MESASLANGBUILDDIR)slang_assemble.o \ + $(MESASLANGBUILDDIR)slang_assemble_conditional.o \ + $(MESASLANGBUILDDIR)slang_assemble_constructor.o \ + $(MESASLANGBUILDDIR)slang_assemble_typeinfo.o \ + $(MESASLANGBUILDDIR)slang_compile.o \ + $(MESASLANGBUILDDIR)slang_execute.o \ + $(MESASLANGBUILDDIR)slang_preprocess.o \ + $(MESASLANGBUILDDIR)slang_storage.o \ + $(MESASLANGBUILDDIR)slang_utility.o + +#if defined(DoSharedLib) && DoSharedLib + MESA_SLANG_UOBJS = $(MESASLANGBUILDDIR)unshared/slang_assemble_assignment.o \ + $(MESASLANGBUILDDIR)unshared/slang_assemble.o \ + $(MESASLANGBUILDDIR)unshared/slang_assemble_conditional.o \ + $(MESASLANGBUILDDIR)unshared/slang_assemble_constructor.o \ + $(MESASLANGBUILDDIR)unshared/slang_assemble_typeinfo.o \ + $(MESASLANGBUILDDIR)unshared/slang_compile.o \ + $(MESASLANGBUILDDIR)unshared/slang_execute.o \ + $(MESASLANGBUILDDIR)unshared/slang_preprocess.o \ + $(MESASLANGBUILDDIR)unshared/slang_storage.o \ + $(MESASLANGBUILDDIR)unshared/slang_utility.o +#else + MESA_SLANG_UOBJS = $(MESA_SLANG_OBJS) +#endif + + MESA_SLANG_DOBJS = $(MESASLANGBUILDDIR)debugger/slang_assemble_assignment.o \ + $(MESASLANGBUILDDIR)debugger/slang_assemble.o \ + $(MESASLANGBUILDDIR)debugger/slang_assemble_conditional.o \ + $(MESASLANGBUILDDIR)debugger/slang_assemble_constructor.o \ + $(MESASLANGBUILDDIR)debugger/slang_assemble_typeinfo.o \ + $(MESASLANGBUILDDIR)debugger/slang_compile.o \ + $(MESASLANGBUILDDIR)debugger/slang_execute.o \ + $(MESASLANGBUILDDIR)debugger/slang_preprocess.o \ + $(MESASLANGBUILDDIR)debugger/slang_storage.o \ + $(MESASLANGBUILDDIR)debugger/slang_utility.o + + MESA_SLANG_POBJS = $(MESASLANGBUILDDIR)profiled/slang_assemble_assignment.o \ + $(MESASLANGBUILDDIR)profiled/slang_assemble.o \ + $(MESASLANGBUILDDIR)profiled/slang_assemble_conditional.o \ + $(MESASLANGBUILDDIR)profiled/slang_assemble_constructor.o \ + $(MESASLANGBUILDDIR)profiled/slang_assemble_typeinfo.o \ + $(MESASLANGBUILDDIR)profiled/slang_compile.o \ + $(MESASLANGBUILDDIR)profiled/slang_execute.o \ + $(MESASLANGBUILDDIR)profiled/slang_preprocess.o \ + $(MESASLANGBUILDDIR)profiled/slang_storage.o \ + $(MESASLANGBUILDDIR)profiled/slang_utility.o diff --git a/nx-X11/programs/Xserver/GL/mesa/shader/slang/library/Imakefile b/nx-X11/programs/Xserver/GL/mesa/shader/slang/library/Imakefile index e332121c9..8c216804d 100644 --- a/nx-X11/programs/Xserver/GL/mesa/shader/slang/library/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/shader/slang/library/Imakefile @@ -1,22 +1,10 @@ -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif #include <Server.tmpl> #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaLibraryBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../../../lib/GL/mesa/shader/slang/library/Imakefile.inc" -#else -#include "../../../../../../../../lib/GL/mesa/shader/slang/library/Imakefile.inc" -#endif +#include "Imakefile.inc" INCLUDES = -I$(MESASRCDIR)/src/mesa \ -I$(MESASRCDIR)/src/mesa/shader \ @@ -31,11 +19,7 @@ SUBDIRS = module DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ -#ifdef IHaveModules -ModuleObjectRule() -#else NormalLibraryObjectRule() -#endif DependTarget() diff --git a/nx-X11/programs/Xserver/GL/mesa/shader/slang/library/Imakefile.inc b/nx-X11/programs/Xserver/GL/mesa/shader/slang/library/Imakefile.inc new file mode 100644 index 000000000..06b530063 --- /dev/null +++ b/nx-X11/programs/Xserver/GL/mesa/shader/slang/library/Imakefile.inc @@ -0,0 +1,12 @@ +#ifdef NeedToLinkMesaSrc +LinkSourceFile(slang_common_builtin_gc_bin.h, $(MESASRCDIR)/src/mesa/shader/slang/library) +LinkSourceFile(slang_common_builtin_gc.h, $(MESASRCDIR)/src/mesa/shader/slang/library) +LinkSourceFile(slang_core_gc_bin.h, $(MESASRCDIR)/src/mesa/shader/slang/library) +LinkSourceFile(slang_core_gc.h, $(MESASRCDIR)/src/mesa/shader/slang/library) +LinkSourceFile(slang_fragment_builtin_gc_bin.h, $(MESASRCDIR)/src/mesa/shader/slang/library) +LinkSourceFile(slang_fragment_builtin_gc.h, $(MESASRCDIR)/src/mesa/shader/slang/library) +LinkSourceFile(slang_shader_syn.h, $(MESASRCDIR)/src/mesa/shader/slang/library) +LinkSourceFile(slang_version_syn.h, $(MESASRCDIR)/src/mesa/shader/slang/library) +LinkSourceFile(slang_vertex_builtin_gc_bin.h, $(MESASRCDIR)/src/mesa/shader/slang/library) +LinkSourceFile(slang_vertex_builtin_gc.h, $(MESASRCDIR)/src/mesa/shader/slang/library) +#endif diff --git a/nx-X11/programs/Xserver/GL/mesa/swrast/Imakefile b/nx-X11/programs/Xserver/GL/mesa/swrast/Imakefile index 817fead69..df47a1caa 100644 --- a/nx-X11/programs/Xserver/GL/mesa/swrast/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/swrast/Imakefile @@ -1,14 +1,3 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/swrast/Imakefile,v 1.8 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - /* Large PIC tables needed for Solaris/SPARC builds */ #if defined(SunArchitecture) && defined(SparcArchitecture) && defined(LargePositionIndependentCFlags) PICFLAGS = LargePositionIndependentCFlags @@ -19,11 +8,7 @@ SUBDIRS = module #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaSwrastBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../lib/GL/mesa/swrast/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/swrast/Imakefile.inc" -#endif +#include "Imakefile.inc" SRCS = $(MESA_SWRAST_SRCS) @@ -43,15 +28,10 @@ SUBDIRS = module DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ -#ifdef IHaveModules -ModuleObjectRule() -#else NormalLibraryObjectRule() -#endif SubdirLibraryRule($(OBJS)) -LintLibraryTarget(dri,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() @@ -60,4 +40,3 @@ DependTarget() MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif - diff --git a/nx-X11/programs/Xserver/GL/mesa/swrast/Imakefile.inc b/nx-X11/programs/Xserver/GL/mesa/swrast/Imakefile.inc new file mode 100644 index 000000000..f573098c1 --- /dev/null +++ b/nx-X11/programs/Xserver/GL/mesa/swrast/Imakefile.inc @@ -0,0 +1,212 @@ +MESASWRASTBUILDDIR = MesaSwrastBuildDir + + MESA_SWRAST_SRCS = $(MESASWRASTBUILDDIR)s_aaline.c \ + $(MESASWRASTBUILDDIR)s_aatriangle.c \ + $(MESASWRASTBUILDDIR)s_accum.c \ + $(MESASWRASTBUILDDIR)s_alpha.c \ + $(MESASWRASTBUILDDIR)s_atifragshader.c \ + $(MESASWRASTBUILDDIR)s_bitmap.c \ + $(MESASWRASTBUILDDIR)s_blend.c \ + $(MESASWRASTBUILDDIR)s_buffers.c \ + $(MESASWRASTBUILDDIR)s_context.c \ + $(MESASWRASTBUILDDIR)s_copypix.c \ + $(MESASWRASTBUILDDIR)s_depth.c \ + $(MESASWRASTBUILDDIR)s_drawpix.c \ + $(MESASWRASTBUILDDIR)s_feedback.c \ + $(MESASWRASTBUILDDIR)s_fog.c \ + $(MESASWRASTBUILDDIR)s_imaging.c \ + $(MESASWRASTBUILDDIR)s_lines.c \ + $(MESASWRASTBUILDDIR)s_logic.c \ + $(MESASWRASTBUILDDIR)s_masking.c \ + $(MESASWRASTBUILDDIR)s_nvfragprog.c \ + $(MESASWRASTBUILDDIR)s_pixeltex.c \ + $(MESASWRASTBUILDDIR)s_points.c \ + $(MESASWRASTBUILDDIR)s_readpix.c \ + $(MESASWRASTBUILDDIR)s_span.c \ + $(MESASWRASTBUILDDIR)s_stencil.c \ + $(MESASWRASTBUILDDIR)s_texstore.c \ + $(MESASWRASTBUILDDIR)s_texture.c \ + $(MESASWRASTBUILDDIR)s_triangle.c \ + $(MESASWRASTBUILDDIR)s_zoom.c + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(s_aaline.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_aaline.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_aalinetemp.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_aatriangle.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_aatriangle.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_aatritemp.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_accum.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_accum.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_alpha.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_alpha.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_atifragshader.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_atifragshader.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_bitmap.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_blend.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_blend.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_buffers.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_context.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_context.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_copypix.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_depth.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_depth.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_drawpix.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_drawpix.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_feedback.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_feedback.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_fog.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_fog.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_imaging.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_lines.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_lines.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_linetemp.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_logic.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_logic.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_masking.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_masking.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_nvfragprog.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_nvfragprog.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_pixeltex.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_pixeltex.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_points.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_points.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_pointtemp.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_readpix.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_span.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_span.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_spantemp.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_stencil.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_stencil.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_texstore.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_texture.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_texture.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_triangle.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_triangle.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_trispan.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_tritemp.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_zoom.c, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(s_zoom.h, $(MESASRCDIR)/src/mesa/swrast) +LinkSourceFile(swrast.h, $(MESASRCDIR)/src/mesa/swrast) +#endif + + MESA_SWRAST_OBJS = $(MESASWRASTBUILDDIR)s_aaline.o \ + $(MESASWRASTBUILDDIR)s_aatriangle.o \ + $(MESASWRASTBUILDDIR)s_accum.o \ + $(MESASWRASTBUILDDIR)s_alpha.o \ + $(MESASWRASTBUILDDIR)s_atifragshader.o \ + $(MESASWRASTBUILDDIR)s_bitmap.o \ + $(MESASWRASTBUILDDIR)s_blend.o \ + $(MESASWRASTBUILDDIR)s_buffers.o \ + $(MESASWRASTBUILDDIR)s_context.o \ + $(MESASWRASTBUILDDIR)s_copypix.o \ + $(MESASWRASTBUILDDIR)s_depth.o \ + $(MESASWRASTBUILDDIR)s_drawpix.o \ + $(MESASWRASTBUILDDIR)s_feedback.o \ + $(MESASWRASTBUILDDIR)s_fog.o \ + $(MESASWRASTBUILDDIR)s_imaging.o \ + $(MESASWRASTBUILDDIR)s_lines.o \ + $(MESASWRASTBUILDDIR)s_logic.o \ + $(MESASWRASTBUILDDIR)s_masking.o \ + $(MESASWRASTBUILDDIR)s_nvfragprog.o \ + $(MESASWRASTBUILDDIR)s_pixeltex.o \ + $(MESASWRASTBUILDDIR)s_points.o \ + $(MESASWRASTBUILDDIR)s_readpix.o \ + $(MESASWRASTBUILDDIR)s_span.o \ + $(MESASWRASTBUILDDIR)s_stencil.o \ + $(MESASWRASTBUILDDIR)s_texstore.o \ + $(MESASWRASTBUILDDIR)s_texture.o \ + $(MESASWRASTBUILDDIR)s_triangle.o \ + $(MESASWRASTBUILDDIR)s_zoom.o + +#if defined(DoSharedLib) && DoSharedLib + MESA_SWRAST_UOBJS = $(MESASWRASTBUILDDIR)unshared/s_aaline.o \ + $(MESASWRASTBUILDDIR)unshared/s_aatriangle.o \ + $(MESASWRASTBUILDDIR)unshared/s_accum.o \ + $(MESASWRASTBUILDDIR)unshared/s_alpha.o \ + $(MESASWRASTBUILDDIR)unshared/s_atifragshader.o \ + $(MESASWRASTBUILDDIR)unshared/s_bitmap.o \ + $(MESASWRASTBUILDDIR)unshared/s_blend.o \ + $(MESASWRASTBUILDDIR)unshared/s_buffers.o \ + $(MESASWRASTBUILDDIR)unshared/s_context.o \ + $(MESASWRASTBUILDDIR)unshared/s_copypix.o \ + $(MESASWRASTBUILDDIR)unshared/s_depth.o \ + $(MESASWRASTBUILDDIR)unshared/s_drawpix.o \ + $(MESASWRASTBUILDDIR)unshared/s_feedback.o \ + $(MESASWRASTBUILDDIR)unshared/s_fog.o \ + $(MESASWRASTBUILDDIR)unshared/s_imaging.o \ + $(MESASWRASTBUILDDIR)unshared/s_lines.o \ + $(MESASWRASTBUILDDIR)unshared/s_logic.o \ + $(MESASWRASTBUILDDIR)unshared/s_masking.o \ + $(MESASWRASTBUILDDIR)unshared/s_nvfragprog.o \ + $(MESASWRASTBUILDDIR)unshared/s_pixeltex.o \ + $(MESASWRASTBUILDDIR)unshared/s_points.o \ + $(MESASWRASTBUILDDIR)unshared/s_readpix.o \ + $(MESASWRASTBUILDDIR)unshared/s_span.o \ + $(MESASWRASTBUILDDIR)unshared/s_stencil.o \ + $(MESASWRASTBUILDDIR)unshared/s_texstore.o \ + $(MESASWRASTBUILDDIR)unshared/s_texture.o \ + $(MESASWRASTBUILDDIR)unshared/s_triangle.o \ + $(MESASWRASTBUILDDIR)unshared/s_zoom.o +#else + MESA_SWRAST_UOBJS = $(MESA_SWRAST_OBJS) +#endif + + MESA_SWRAST_DOBJS = $(MESASWRASTBUILDDIR)debugger/s_aaline.o \ + $(MESASWRASTBUILDDIR)debugger/s_aatriangle.o \ + $(MESASWRASTBUILDDIR)debugger/s_accum.o \ + $(MESASWRASTBUILDDIR)debugger/s_alpha.o \ + $(MESASWRASTBUILDDIR)debugger/s_atifragshader.o \ + $(MESASWRASTBUILDDIR)debugger/s_bitmap.o \ + $(MESASWRASTBUILDDIR)debugger/s_blend.o \ + $(MESASWRASTBUILDDIR)debugger/s_buffers.o \ + $(MESASWRASTBUILDDIR)debugger/s_context.o \ + $(MESASWRASTBUILDDIR)debugger/s_copypix.o \ + $(MESASWRASTBUILDDIR)debugger/s_depth.o \ + $(MESASWRASTBUILDDIR)debugger/s_drawpix.o \ + $(MESASWRASTBUILDDIR)debugger/s_feedback.o \ + $(MESASWRASTBUILDDIR)debugger/s_fog.o \ + $(MESASWRASTBUILDDIR)debugger/s_imaging.o \ + $(MESASWRASTBUILDDIR)debugger/s_lines.o \ + $(MESASWRASTBUILDDIR)debugger/s_logic.o \ + $(MESASWRASTBUILDDIR)debugger/s_masking.o \ + $(MESASWRASTBUILDDIR)debugger/s_nvfragprog.o \ + $(MESASWRASTBUILDDIR)debugger/s_pixeltex.o \ + $(MESASWRASTBUILDDIR)debugger/s_points.o \ + $(MESASWRASTBUILDDIR)debugger/s_readpix.o \ + $(MESASWRASTBUILDDIR)debugger/s_span.o \ + $(MESASWRASTBUILDDIR)debugger/s_stencil.o \ + $(MESASWRASTBUILDDIR)debugger/s_texstore.o \ + $(MESASWRASTBUILDDIR)debugger/s_texture.o \ + $(MESASWRASTBUILDDIR)debugger/s_triangle.o \ + $(MESASWRASTBUILDDIR)debugger/s_zoom.o + + MESA_SWRAST_POBJS = $(MESASWRASTBUILDDIR)profiled/s_aaline.o \ + $(MESASWRASTBUILDDIR)profiled/s_aatriangle.o \ + $(MESASWRASTBUILDDIR)profiled/s_accum.o \ + $(MESASWRASTBUILDDIR)profiled/s_alpha.o \ + $(MESASWRASTBUILDDIR)profiled/s_atifragshader.o \ + $(MESASWRASTBUILDDIR)profiled/s_bitmap.o \ + $(MESASWRASTBUILDDIR)profiled/s_blend.o \ + $(MESASWRASTBUILDDIR)profiled/s_buffers.o \ + $(MESASWRASTBUILDDIR)profiled/s_context.o \ + $(MESASWRASTBUILDDIR)profiled/s_copypix.o \ + $(MESASWRASTBUILDDIR)profiled/s_depth.o \ + $(MESASWRASTBUILDDIR)profiled/s_drawpix.o \ + $(MESASWRASTBUILDDIR)profiled/s_feedback.o \ + $(MESASWRASTBUILDDIR)profiled/s_fog.o \ + $(MESASWRASTBUILDDIR)profiled/s_imaging.o \ + $(MESASWRASTBUILDDIR)profiled/s_lines.o \ + $(MESASWRASTBUILDDIR)profiled/s_logic.o \ + $(MESASWRASTBUILDDIR)profiled/s_masking.o \ + $(MESASWRASTBUILDDIR)profiled/s_nvfragprog.o \ + $(MESASWRASTBUILDDIR)profiled/s_pixeltex.o \ + $(MESASWRASTBUILDDIR)profiled/s_points.o \ + $(MESASWRASTBUILDDIR)profiled/s_readpix.o \ + $(MESASWRASTBUILDDIR)profiled/s_span.o \ + $(MESASWRASTBUILDDIR)profiled/s_stencil.o \ + $(MESASWRASTBUILDDIR)profiled/s_texstore.o \ + $(MESASWRASTBUILDDIR)profiled/s_texture.o \ + $(MESASWRASTBUILDDIR)profiled/s_triangle.o \ + $(MESASWRASTBUILDDIR)profiled/s_zoom.o + diff --git a/nx-X11/programs/Xserver/GL/mesa/swrast/module/Imakefile b/nx-X11/programs/Xserver/GL/mesa/swrast/module/Imakefile deleted file mode 100644 index 7d9974ed0..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/swrast/module/Imakefile +++ /dev/null @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/swrast/module/Imakefile,v 1.1 2002/05/31 18:12:40 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - diff --git a/nx-X11/programs/Xserver/GL/mesa/swrast_setup/Imakefile b/nx-X11/programs/Xserver/GL/mesa/swrast_setup/Imakefile index b530457e9..be2ce62a4 100644 --- a/nx-X11/programs/Xserver/GL/mesa/swrast_setup/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/swrast_setup/Imakefile @@ -1,24 +1,9 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/swrast_setup/Imakefile,v 1.8 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - #include <Server.tmpl> #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaSwrastSetupBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../lib/GL/mesa/swrast_setup/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/swrast_setup/Imakefile.inc" -#endif +#include "Imakefile.inc" SRCS = $(MESA_SWR_SETUP_SRCS) OBJS = $(MESA_SWR_SETUP_OBJS) @@ -35,15 +20,10 @@ SUBDIRS = module DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ -#ifdef IHaveModules -ModuleObjectRule() -#else NormalLibraryObjectRule() -#endif SubdirLibraryRule($(OBJS)) -LintLibraryTarget(dri,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() @@ -52,4 +32,3 @@ DependTarget() MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif - diff --git a/nx-X11/programs/Xserver/GL/mesa/swrast_setup/Imakefile.inc b/nx-X11/programs/Xserver/GL/mesa/swrast_setup/Imakefile.inc new file mode 100644 index 000000000..567ad65b8 --- /dev/null +++ b/nx-X11/programs/Xserver/GL/mesa/swrast_setup/Imakefile.inc @@ -0,0 +1,30 @@ +MESASWRSETUPDIR = MesaSwrastSetupBuildDir + + MESA_SWR_SETUP_SRCS = $(MESASWRSETUPDIR)ss_context.c \ + $(MESASWRSETUPDIR)ss_triangle.c + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(ss_context.c, $(MESASRCDIR)/src/mesa/swrast_setup) +LinkSourceFile(ss_context.h, $(MESASRCDIR)/src/mesa/swrast_setup) +LinkSourceFile(ss_triangle.c, $(MESASRCDIR)/src/mesa/swrast_setup) +LinkSourceFile(ss_triangle.h, $(MESASRCDIR)/src/mesa/swrast_setup) +LinkSourceFile(ss_tritmp.h, $(MESASRCDIR)/src/mesa/swrast_setup) +LinkSourceFile(swrast_setup.h, $(MESASRCDIR)/src/mesa/swrast_setup) +#endif + + MESA_SWR_SETUP_OBJS = $(MESASWRSETUPDIR)ss_context.o \ + $(MESASWRSETUPDIR)ss_triangle.o + +#if defined(DoSharedLib) && DoSharedLib +MESA_SWR_SETUP_UOBJS = $(MESASWRSETUPDIR)unshared/ss_context.o \ + $(MESASWRSETUPDIR)unshared/ss_triangle.o +#else +MESA_SWR_SETUP_UOBJS = $(MESA_SWR_SETUP_OBJS) +#endif + +MESA_SWR_SETUP_DOBJS = $(MESASWRSETUPDIR)debugger/ss_context.o \ + $(MESASWRSETUPDIR)debugger/ss_triangle.o + +MESA_SWR_SETUP_POBJS = $(MESASWRSETUPDIR)profiled/ss_context.o \ + $(MESASWRSETUPDIR)profiled/ss_triangle.o + diff --git a/nx-X11/programs/Xserver/GL/mesa/swrast_setup/module/Imakefile b/nx-X11/programs/Xserver/GL/mesa/swrast_setup/module/Imakefile deleted file mode 100644 index 5221debc0..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/swrast_setup/module/Imakefile +++ /dev/null @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/swrast_setup/module/Imakefile,v 1.1 2002/05/31 18:12:41 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - diff --git a/nx-X11/programs/Xserver/GL/mesa/tnl/Imakefile b/nx-X11/programs/Xserver/GL/mesa/tnl/Imakefile index c52696e4f..b36454259 100644 --- a/nx-X11/programs/Xserver/GL/mesa/tnl/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/tnl/Imakefile @@ -1,15 +1,3 @@ -XCOMM $XdotOrg: xc/programs/Xserver/GL/mesa/tnl/Imakefile,v 1.2 2004/08/19 07:34:44 kem Exp $ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/tnl/Imakefile,v 1.8 2002/11/22 22:56:02 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - /* Large PIC tables needed for Solaris/SPARC builds */ #if defined(SunArchitecture) && defined(SparcArchitecture) && defined(LargePositionIndependentCFlags) PICFLAGS = LargePositionIndependentCFlags @@ -21,11 +9,7 @@ SUBDIRS = module #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaTnlBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../lib/GL/mesa/tnl/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/tnl/Imakefile.inc" -#endif +#include "Imakefile.inc" SRCS = $(MESA_TNL_SRCS) @@ -46,15 +30,10 @@ SUBDIRS = module DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ -#ifdef IHaveModules -ModuleObjectRule() -#else NormalLibraryObjectRule() -#endif SubdirLibraryRule($(OBJS)) -LintLibraryTarget(dri,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() diff --git a/nx-X11/programs/Xserver/GL/mesa/tnl/Imakefile.inc b/nx-X11/programs/Xserver/GL/mesa/tnl/Imakefile.inc new file mode 100644 index 000000000..a6c8f923e --- /dev/null +++ b/nx-X11/programs/Xserver/GL/mesa/tnl/Imakefile.inc @@ -0,0 +1,219 @@ +MESATNLBUILDDIR = MesaTnlBuildDir + + MESA_TNL_SRCS = $(MESATNLBUILDDIR)t_array_api.c \ + $(MESATNLBUILDDIR)t_array_import.c \ + $(MESATNLBUILDDIR)t_context.c \ + $(MESATNLBUILDDIR)t_pipeline.c \ + $(MESATNLBUILDDIR)t_save_api.c \ + $(MESATNLBUILDDIR)t_save_loopback.c \ + $(MESATNLBUILDDIR)t_save_playback.c \ + $(MESATNLBUILDDIR)t_vb_arbprogram.c \ + $(MESATNLBUILDDIR)t_vb_arbprogram_sse.c \ + $(MESATNLBUILDDIR)t_vb_fog.c \ + $(MESATNLBUILDDIR)t_vb_cull.c \ + $(MESATNLBUILDDIR)t_vb_light.c \ + $(MESATNLBUILDDIR)t_vb_normals.c \ + $(MESATNLBUILDDIR)t_vb_points.c \ + $(MESATNLBUILDDIR)t_vb_program.c \ + $(MESATNLBUILDDIR)t_vb_render.c \ + $(MESATNLBUILDDIR)t_vb_texgen.c \ + $(MESATNLBUILDDIR)t_vb_texmat.c \ + $(MESATNLBUILDDIR)t_vb_vertex.c \ + $(MESATNLBUILDDIR)t_vertex.c \ + $(MESATNLBUILDDIR)t_vertex_generic.c \ + $(MESATNLBUILDDIR)t_vertex_sse.c \ + $(MESATNLBUILDDIR)t_vp_build.c \ + $(MESATNLBUILDDIR)t_vtx_api.c \ + $(MESATNLBUILDDIR)t_vtx_eval.c \ + $(MESATNLBUILDDIR)t_vtx_exec.c \ + $(MESATNLBUILDDIR)t_vtx_generic.c + +#if defined(i386Architecture) && MesaUseX86Asm + MESA_TNL_SRCS += MesaTnlAsmSrcs $(MESATNLBUILDDIR)t_vtx_x86.c \ + $(MESATNLBUILDDIR)t_vtx_x86_gcc.S +#endif + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(t_array_api.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_array_api.h, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_array_import.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_array_import.h, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_context.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_context.h, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(tnl.h, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_pipeline.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_pipeline.h, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_save_api.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_save_api.h, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_save_loopback.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_save_playback.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_arbprogram.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_arbprogram.h, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_arbprogram_sse.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_cliptmp.h, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_fog.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_cull.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_light.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_lighttmp.h, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_normals.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_points.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_program.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_render.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_rendertmp.h, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_texgen.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_texmat.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vb_vertex.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vertex.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vertex.h, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vertex_generic.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vertex_sse.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vp_build.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vp_build.h, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vtx_api.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vtx_api.h, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vtx_eval.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vtx_exec.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vtx_generic.c, $(MESASRCDIR)/src/mesa/tnl) +#if defined(i386Architecture) && MesaUseX86Asm +LinkSourceFile(t_vtx_x86.c, $(MESASRCDIR)/src/mesa/tnl) +LinkSourceFile(t_vtx_x86_gcc.S, $(MESASRCDIR)/src/mesa/tnl) +#endif +#endif + + MESA_TNL_OBJS = $(MESATNLBUILDDIR)t_array_api.o \ + $(MESATNLBUILDDIR)t_array_import.o \ + $(MESATNLBUILDDIR)t_context.o \ + $(MESATNLBUILDDIR)t_pipeline.o \ + $(MESATNLBUILDDIR)t_save_api.o \ + $(MESATNLBUILDDIR)t_save_loopback.o \ + $(MESATNLBUILDDIR)t_save_playback.o \ + $(MESATNLBUILDDIR)t_vb_arbprogram.o \ + $(MESATNLBUILDDIR)t_vb_arbprogram_sse.o \ + $(MESATNLBUILDDIR)t_vb_fog.o \ + $(MESATNLBUILDDIR)t_vb_cull.o \ + $(MESATNLBUILDDIR)t_vb_light.o \ + $(MESATNLBUILDDIR)t_vb_normals.o \ + $(MESATNLBUILDDIR)t_vb_points.o \ + $(MESATNLBUILDDIR)t_vb_program.o \ + $(MESATNLBUILDDIR)t_vb_render.o \ + $(MESATNLBUILDDIR)t_vb_texgen.o \ + $(MESATNLBUILDDIR)t_vb_texmat.o \ + $(MESATNLBUILDDIR)t_vb_vertex.o \ + $(MESATNLBUILDDIR)t_vertex.o \ + $(MESATNLBUILDDIR)t_vertex_generic.o \ + $(MESATNLBUILDDIR)t_vertex_sse.o \ + $(MESATNLBUILDDIR)t_vp_build.o \ + $(MESATNLBUILDDIR)t_vtx_api.o \ + $(MESATNLBUILDDIR)t_vtx_eval.o \ + $(MESATNLBUILDDIR)t_vtx_exec.o \ + $(MESATNLBUILDDIR)t_vtx_generic.o + +#if defined(i386Architecture) && MesaUseX86Asm + MESA_TNL_OBJS += $(MESATNLBUILDDIR)t_vtx_x86.o \ + $(MESATNLBUILDDIR)t_vtx_x86_gcc.o +#endif + +#if defined(DoSharedLib) && DoSharedLib + MESA_TNL_UOBJS = $(MESATNLBUILDDIR)unshared/t_array_api.o \ + $(MESATNLBUILDDIR)unshared/t_array_import.o \ + $(MESATNLBUILDDIR)unshared/t_context.o \ + $(MESATNLBUILDDIR)unshared/t_pipeline.o \ + $(MESATNLBUILDDIR)unshared/t_save_api.o \ + $(MESATNLBUILDDIR)unshared/t_save_loopback.o \ + $(MESATNLBUILDDIR)unshared/t_save_playback.o \ + $(MESATNLBUILDDIR)unshared/t_vb_arbprogram.o \ + $(MESATNLBUILDDIR)unshared/t_vb_arbprogram_sse.o \ + $(MESATNLBUILDDIR)unshared/t_vb_fog.o \ + $(MESATNLBUILDDIR)unshared/t_vb_cull.o \ + $(MESATNLBUILDDIR)unshared/t_vb_light.o \ + $(MESATNLBUILDDIR)unshared/t_vb_normals.o \ + $(MESATNLBUILDDIR)unshared/t_vb_points.o \ + $(MESATNLBUILDDIR)unshared/t_vb_program.o \ + $(MESATNLBUILDDIR)unshared/t_vb_render.o \ + $(MESATNLBUILDDIR)unshared/t_vb_texgen.o \ + $(MESATNLBUILDDIR)unshared/t_vb_texmat.o \ + $(MESATNLBUILDDIR)unshared/t_vb_vertex.o \ + $(MESATNLBUILDDIR)unshared/t_vertex.o \ + $(MESATNLBUILDDIR)unshared/t_vertex_generic.o \ + $(MESATNLBUILDDIR)unshared/t_vertex_sse.o \ + $(MESATNLBUILDDIR)unshared/t_vp_build.o \ + $(MESATNLBUILDDIR)unshared/t_vtx_api.o \ + $(MESATNLBUILDDIR)unshared/t_vtx_eval.o \ + $(MESATNLBUILDDIR)unshared/t_vtx_exec.o \ + $(MESATNLBUILDDIR)unshared/t_vtx_generic.o + +#if defined(i386Architecture) && MesaUseX86Asm + MESA_TNL_UOBJS += $(MESATNLBUILDDIR)unshared/t_vtx_x86.o \ + $(MESATNLBUILDDIR)t_vtx_x86_gcc.o +#endif + +#else + MESA_TNL_UOBJS = $(MESA_TNL_OBJS) +#endif + + MESA_TNL_DOBJS = $(MESATNLBUILDDIR)debugger/t_array_api.o \ + $(MESATNLBUILDDIR)debugger/t_array_import.o \ + $(MESATNLBUILDDIR)debugger/t_context.o \ + $(MESATNLBUILDDIR)debugger/t_pipeline.o \ + $(MESATNLBUILDDIR)debugger/t_save_api.o \ + $(MESATNLBUILDDIR)debugger/t_save_loopback.o \ + $(MESATNLBUILDDIR)debugger/t_save_playback.o \ + $(MESATNLBUILDDIR)debugger/t_vb_arbprogram.o \ + $(MESATNLBUILDDIR)debugger/t_vb_arbprogram_sse.o \ + $(MESATNLBUILDDIR)debugger/t_vb_fog.o \ + $(MESATNLBUILDDIR)debugger/t_vb_cull.o \ + $(MESATNLBUILDDIR)debugger/t_vb_light.o \ + $(MESATNLBUILDDIR)debugger/t_vb_normals.o \ + $(MESATNLBUILDDIR)debugger/t_vb_points.o \ + $(MESATNLBUILDDIR)debugger/t_vb_program.o \ + $(MESATNLBUILDDIR)debugger/t_vb_render.o \ + $(MESATNLBUILDDIR)debugger/t_vb_texgen.o \ + $(MESATNLBUILDDIR)debugger/t_vb_texmat.o \ + $(MESATNLBUILDDIR)debugger/t_vb_vertex.o \ + $(MESATNLBUILDDIR)debugger/t_vertex.o \ + $(MESATNLBUILDDIR)debugger/t_vertex_generic.o \ + $(MESATNLBUILDDIR)debugger/t_vertex_sse.o \ + $(MESATNLBUILDDIR)debugger/t_vp_build.o \ + $(MESATNLBUILDDIR)debugger/t_vtx_api.o \ + $(MESATNLBUILDDIR)debugger/t_vtx_eval.o \ + $(MESATNLBUILDDIR)debugger/t_vtx_exec.o \ + $(MESATNLBUILDDIR)debugger/t_vtx_generic.o + +#if defined(i386Architecture) && MesaUseX86Asm + MESA_TNL_DOBJS += $(MESATNLBUILDDIR)debugger/t_vtx_x86.o \ + $(MESATNLBUILDDIR)debugger/t_vtx_x86_gcc.o +#endif + + MESA_TNL_POBJS = $(MESATNLBUILDDIR)profiled/t_array_api.o \ + $(MESATNLBUILDDIR)profiled/t_array_import.o \ + $(MESATNLBUILDDIR)profiled/t_context.o \ + $(MESATNLBUILDDIR)profiled/t_pipeline.o \ + $(MESATNLBUILDDIR)profiled/t_save_api.o \ + $(MESATNLBUILDDIR)profiled/t_save_loopback.o \ + $(MESATNLBUILDDIR)profiled/t_save_playback.o \ + $(MESATNLBUILDDIR)profiled/t_vb_arbprogram.o \ + $(MESATNLBUILDDIR)profiled/t_vb_arbprogram_sse.o \ + $(MESATNLBUILDDIR)profiled/t_vb_fog.o \ + $(MESATNLBUILDDIR)profiled/t_vb_cull.o \ + $(MESATNLBUILDDIR)profiled/t_vb_light.o \ + $(MESATNLBUILDDIR)profiled/t_vb_normals.o \ + $(MESATNLBUILDDIR)profiled/t_vb_points.o \ + $(MESATNLBUILDDIR)profiled/t_vb_program.o \ + $(MESATNLBUILDDIR)profiled/t_vb_render.o \ + $(MESATNLBUILDDIR)profiled/t_vb_texgen.o \ + $(MESATNLBUILDDIR)profiled/t_vb_texmat.o \ + $(MESATNLBUILDDIR)profiled/t_vb_vertex.o \ + $(MESATNLBUILDDIR)profiled/t_vertex.o \ + $(MESATNLBUILDDIR)profiled/t_vertex_generic.o \ + $(MESATNLBUILDDIR)profiled/t_vertex_sse.o \ + $(MESATNLBUILDDIR)profiled/t_vp_build.o \ + $(MESATNLBUILDDIR)profiled/t_vtx_api.o \ + $(MESATNLBUILDDIR)profiled/t_vtx_eval.o \ + $(MESATNLBUILDDIR)profiled/t_vtx_exec.o \ + $(MESATNLBUILDDIR)profiled/t_vtx_generic.o + +#if defined(i386Architecture) && MesaUseX86Asm + MESA_TNL_POBJS += $(MESATNLBUILDDIR)profiled/t_vtx_x86.o \ + $(MESATNLBUILDDIR)profiled/t_vtx_x86_gcc.o +#endif + diff --git a/nx-X11/programs/Xserver/GL/mesa/tnl/module/Imakefile b/nx-X11/programs/Xserver/GL/mesa/tnl/module/Imakefile deleted file mode 100644 index 5d2a4489d..000000000 --- a/nx-X11/programs/Xserver/GL/mesa/tnl/module/Imakefile +++ /dev/null @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/tnl/module/Imakefile,v 1.1 2002/05/31 18:12:42 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - diff --git a/nx-X11/programs/Xserver/GL/opengl/Imakefile b/nx-X11/programs/Xserver/GL/opengl/Imakefile deleted file mode 100644 index 420405d9c..000000000 --- a/nx-X11/programs/Xserver/GL/opengl/Imakefile +++ /dev/null @@ -1,140 +0,0 @@ -XCOMM $XFree86$ - -XCOMM The contents of this file are subject to the GLX Public License Version 1.0 -XCOMM (the "License"). You may not use this file except in compliance with the -XCOMM License. You may obtain a copy of the License at Silicon Graphics, Inc., -XCOMM attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -XCOMM or at http://www.sgi.com/software/opensource/glx/license.html. -XCOMM -XCOMM Software distributed under the License is distributed on an "AS IS" -XCOMM basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -XCOMM IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -XCOMM PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -XCOMM language governing rights and limitations under the License. -XCOMM -XCOMM The Original Software is GLX version 1.2 source code, released February, -XCOMM 1999. The developer of the Original Software is Silicon Graphics, Inc. -XCOMM Those portions of the Subject Software created by Silicon Graphics, Inc. -XCOMM are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. - -#include <Library.tmpl> - -OBJS = \ - ddxci.o \ - ddxcx.o \ - ddxrgb.o \ - ddxscreens.o \ - dl_block.o \ - dl_heap.o \ - dl_init.o \ - dl_list.o \ - dl_mopt.o \ - dl_opt.o \ - dl_pplst.o \ - dl_splc.o \ - dl_splst.o \ - dl_table.o \ - g_api.o \ - g_disp.o \ - g_lcmpex.o \ - g_lcomp.o \ - g_lexec.o \ - g_ltab.o \ - g_noptab.o \ - g_splcmp.o \ - px_api.o \ - px_mod.o \ - px_pack.o \ - px_paths.o \ - px_read.o \ - px_rend.o \ - px_upack.o \ - s_accum.o \ - s_atest.o \ - s_attrib.o \ - s_bitmap.o \ - s_blend.o \ - s_btdraw.o \ - s_buffer.o \ - s_capi.o \ - s_ci.o \ - s_clear.o \ - s_clip.o \ - s_contxt.o \ - s_cpydsp.o \ - s_ctable.o \ - s_depth.o \ - s_dlist.o \ - s_eval.o \ - s_export.o \ - s_feed.o \ - s_finish.o \ - s_fog.o \ - s_get.o \ - s_global.o \ - s_image.o \ - s_lcache.o \ - s_lcomp.o \ - s_light.o \ - s_lnclip.o \ - s_lndraw.o \ - s_lnfast.o \ - s_lnfin.o \ - s_lnspan.o \ - s_math.o \ - s_memmgr.o \ - s_names.o \ - s_napi.o \ - s_pgaa.o \ - s_pgclip.o \ - s_pgdraw.o \ - s_pgfin.o \ - s_pgmode.o \ - s_pgspan.o \ - s_pick.o \ - s_prim.o \ - s_ptaa.o \ - s_ptdraw.o \ - s_ptfin.o \ - s_rapi.o \ - s_rect.o \ - s_rgb.o \ - s_rpos.o \ - s_select.o \ - s_size.o \ - s_span.o \ - s_sten.o \ - s_store.o \ - s_tapi.o \ - s_tex.o \ - s_texel.o \ - s_texmgr.o \ - s_trap.o \ - s_vapi.o \ - s_varray.o \ - s_vertex.o \ - s_xform.o \ - s_zfuncs.o \ - vc_cache.o \ - vc_line.o \ - vc_point.o \ - vc_poly.o - -INCLUDES = \ - -I. \ - -I.. \ - -Iinclude \ - -I$(TOP)/server/include \ - -I$(TOP)/programs/Xserver/include \ - -I$(TOP)/include \ - -I$(TOP)/include/GL \ - -I$(INCLUDESRC) - -DEFINES = \ - -D_LANGUAGE_C \ - -Dunix - -NormalLibraryTarget(GL, $(OBJS)) -NormalLibraryObjectRule() - -DependTarget() diff --git a/nx-X11/programs/Xserver/GL/windows/ChangeLog b/nx-X11/programs/Xserver/GL/windows/ChangeLog deleted file mode 100644 index 43a817d6a..000000000 --- a/nx-X11/programs/Xserver/GL/windows/ChangeLog +++ /dev/null @@ -1,64 +0,0 @@ -2005-09-27 Ian Romanick <idr@us.ibm.com> - - * indirect.c: - Remove __glEvalComputeK. It is no longer used. - - -2005-04-09 Alexander Gottwald <ago at freedesktop dot org> - - * indirect.c: - Fix passing of non-RGB visuals. The old code did not initialize the - structure properly which lead to a crash in 8bpp mode - -2005-03-01 Alexander Gottwald <ago at freedesktop dot org> - - * indirect.c: - * glwindows.h: - If a context is already attached copy it instead of reattaching to keep - displaylists and share displaylists - Enable tracing of often called functions with GLWIN_ENABLE_TRACE - ForceCurrent is a no-op now - -2005-02-02 Alexander Gottwald <ago at freedesktop dot org> - - * Imakefile: - Bugzilla #1866 (https://bugs.freedesktop.org/show_bug.cgi?id=1866) - attachment #1819 (https://bugs.freedesktop.org/attachment.cgi?id=1819): - Define APIENTRY on windows to prevent <GL/gl.h> from loading <windows.h> - -2005-02-02 Alexander Gottwald <ago at freedesktop dot org> - - * glwrap.c: - * glwindows.h: - Bugzilla #1866 (https://bugs.freedesktop.org/show_bug.cgi?id=1866) - attachment #1818 (https://bugs.freedesktop.org/attachment.cgi?id=1818): - Include Xwindows.h before GL/gl.h to prevent loading windows.h which - pollutes our namespace with some symbols. - -2005-01-27 Alexander Gottwald <ago at freedesktop dot org> - - * glwrap.c: - Functions like glGenTextures and glBindTexture are in OpenGL 1.1 - and can be resolved at linktime. - -2004-11-15 Alexander Gottwald <ago at freedesktop dot org> - - * indirect.c: - Bugzilla #1802, http://freedesktop.org/bugzilla/show_bug.cgi?id=1802 - Added mingw (Win32) port - -2004-08-13 Alexander Gottwald <ago@freedesktop.org> - - * Imakefile: Added $(MESASRCDIR)/src/mesa/glapi to INCLUDES. - Removed $(SERVERSRC)/mi from INCLUDES. - Rearranged INCLUDES for better readability. - * glwindows.h: Removed mipointrst.h and miscstruct.h from #include - since they are not used anymore. - -2004-05-27 Alexander Gottwald <ago@freedesktop.org> - - * glwindows.h: write current function and line in debug output - * indirect.c: moved actual setup and creation of windows GL context to - glWinCreateContextReal. - * indirect.c (glWinCreateContext): Deferred context creation to attach. - * indirect.c (glWinMakeCurrent): Check if context is NULL. Fixes segfault. diff --git a/nx-X11/programs/Xserver/GL/windows/Imakefile b/nx-X11/programs/Xserver/GL/windows/Imakefile deleted file mode 100755 index 2b3ddeb12..000000000 --- a/nx-X11/programs/Xserver/GL/windows/Imakefile +++ /dev/null @@ -1,36 +0,0 @@ -#include <Server.tmpl> - -LinkSourceFile(compsize.c,$(MESASRCDIR)/src/glx/x11) - - SRCS = compsize.c indirect.c glwrap.c - OBJS = compsize.o indirect.o glwrap.o - - INCLUDES = -I. \ - -I$(INCLUDESRC) \ - -I$(XINCLUDESRC) \ - -I$(EXTINCSRC) \ - -I$(SERVERSRC)/include \ - -I$(SERVERSRC)/render \ - -I$(SERVERSRC)/hw/xwin \ - -I$(SERVERSRC)/GL/include \ - -I$(SERVERSRC)/GL/glx \ - -I$(LIBSRC)/GL/glx \ - -I$(LIBSRC)/GL/include \ - -I$(MESASRCDIR)/include \ - -I$(MESASRCDIR)/src \ - -I$(MESASRCDIR)/src/mesa/glapi \ - $(GL_INCLUDES) - -#if defined(GlxUseWindows) && GlxUseWindows - CYGWIN_GL_DEFINES = -DUSE_OPENGL32 -#endif -#if defined(Win32Architecture) -# undef __stdcall - APIENTRY_DEFS = -DAPIENTRY=__stdcall -#endif - DEFINES = $(GLX_DEFINES) $(CYGWIN_GL_DEFINES) $(APIENTRY_DEFS) - -NormalLibraryTarget(GLcore,$(OBJS)) -NormalLibraryObjectRule() - -DependTarget() diff --git a/nx-X11/programs/Xserver/GL/windows/glwindows.h b/nx-X11/programs/Xserver/GL/windows/glwindows.h deleted file mode 100644 index 74e81f24f..000000000 --- a/nx-X11/programs/Xserver/GL/windows/glwindows.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <X11/Xwindows.h> -#include <GL/gl.h> -#include <GL/glext.h> - -#include <glxserver.h> -#include <glxext.h> - -#include <windowstr.h> -#include <resource.h> -#include <GL/glxint.h> -#include <GL/glxtokens.h> -#include <scrnintstr.h> -#include <glxserver.h> -#include <glxscreens.h> -#include <glxdrawable.h> -#include <glxcontext.h> -#include <glxext.h> -#include <glxutil.h> -#include <glxscreens.h> -#include <GL/internal/glcore.h> -#include <stdlib.h> - - -typedef struct { - unsigned enableDebug : 1; - unsigned enableTrace : 1; - unsigned dumpPFD : 1; - unsigned dumpHWND : 1; - unsigned dumpDC : 1; -} glWinDebugSettingsRec, *glWinDebugSettingsPtr; -extern glWinDebugSettingsRec glWinDebugSettings; - -typedef struct { - int num_vis; - __GLcontextModes *modes; - void **priv; - - /* wrapped screen functions */ - RealizeWindowProcPtr RealizeWindow; - UnrealizeWindowProcPtr UnrealizeWindow; - CopyWindowProcPtr CopyWindow; -} glWinScreenRec; - -extern glWinScreenRec glWinScreens[MAXSCREENS]; - -#define glWinGetScreenPriv(pScreen) &glWinScreens[pScreen->myNum] -#define glWinScreenPriv(pScreen) glWinScreenRec *pScreenPriv = glWinGetScreenPriv(pScreen); - -#if 1 -#define GLWIN_TRACE() if (glWinDebugSettings.enableTrace) ErrorF("%s:%d: Trace\n", __FUNCTION__, __LINE__ ) -#define GLWIN_TRACE_MSG(msg, args...) if (glWinDebugSettings.enableTrace) ErrorF("%s:%d: " msg, __FUNCTION__, __LINE__, ##args ) -#define GLWIN_DEBUG_MSG(msg, args...) if (glWinDebugSettings.enableDebug) ErrorF("%s:%d: " msg, __FUNCTION__, __LINE__, ##args ) -#define GLWIN_DEBUG_MSG2(msg, args...) if (glWinDebugSettings.enableDebug) ErrorF(msg, ##args ) -#else -#define GLWIN_TRACE() -#define GLWIN_TRACE_MSG(a, ...) -#define GLWIN_DEBUG_MSG(a, ...) -#define GLWIN_DEBUG_MSG2(a, ...) -#endif - diff --git a/nx-X11/programs/Xserver/GL/windows/glwrap.c b/nx-X11/programs/Xserver/GL/windows/glwrap.c deleted file mode 100755 index f0b38b228..000000000 --- a/nx-X11/programs/Xserver/GL/windows/glwrap.c +++ /dev/null @@ -1,583 +0,0 @@ -/* - * GLX implementation that uses Win32's OpenGL - * Wrapper functions for Win32's OpenGL - * - * Authors: Alexander Gottwald - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <X11/Xwindows.h> -#include <GL/gl.h> -#include <GL/glext.h> -#include <glxserver.h> -#include <glxext.h> - -#define RESOLVE_RET(procname, symbol, retval) \ - static Bool init = TRUE; \ - static procname proc = NULL; \ - if (init) { \ - proc = (procname)wglGetProcAddress(symbol); \ - init = FALSE; \ - if (proc == NULL) { \ - ErrorF("glwrap: Can't resolve \"%s\"\n", symbol); \ - } else \ - ErrorF("glwrap: resolved \"%s\"\n", symbol); \ - } \ - if (proc == NULL) { \ - __glXErrorCallBack(NULL, 0); \ - return retval; \ - } -#define RESOLVE(procname, symbol) RESOLVE_RET(procname, symbol,) - - -/* - * GL_ARB_imaging - */ - - -GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat, - GLsizei width, GLenum format, - GLenum type, const GLvoid *table ) -{ - RESOLVE(PFNGLCOLORTABLEPROC, "glColorTable"); - proc(target, internalformat, width, format, type, table); -} - -GLAPI void GLAPIENTRY glColorSubTable( GLenum target, - GLsizei start, GLsizei count, - GLenum format, GLenum type, - const GLvoid *data ) -{ - RESOLVE(PFNGLCOLORSUBTABLEPROC, "glColorSubTable"); - proc(target, start, count, format, type, data); -} - -GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname, - const GLint *params) -{ - RESOLVE(PFNGLCOLORTABLEPARAMETERIVPROC, "glColorTableParameteriv"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname, - const GLfloat *params) -{ - RESOLVE(PFNGLCOLORTABLEPARAMETERFVPROC, "glColorTableParameterfv"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start, - GLint x, GLint y, GLsizei width ) -{ - RESOLVE(PFNGLCOPYCOLORSUBTABLEPROC, "glCopyColorSubTable"); - proc(target, start, x, y, width); -} - -GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat, - GLint x, GLint y, GLsizei width ) -{ - RESOLVE(PFNGLCOPYCOLORTABLEPROC, "glCopyColorTable"); - proc(target, internalformat, x, y, width); -} - - -GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format, - GLenum type, GLvoid *table ) -{ - RESOLVE(PFNGLGETCOLORTABLEPROC, "glGetColorTable"); - proc(target, format, type, table); -} - -GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname, - GLfloat *params ) -{ - RESOLVE(PFNGLGETCOLORTABLEPARAMETERFVPROC, "glGetColorTableParameterfv"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname, - GLint *params ) -{ - RESOLVE(PFNGLGETCOLORTABLEPARAMETERIVPROC, "glGetColorTableParameteriv"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glBlendEquation( GLenum mode ) -{ - RESOLVE(PFNGLBLENDEQUATIONPROC, "glBlendEquation"); - proc(mode); -} - -GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green, - GLclampf blue, GLclampf alpha ) -{ - RESOLVE(PFNGLBLENDCOLORPROC, "glBlendColor"); - proc(red, green, blue, alpha); -} - -GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width, - GLenum internalformat, GLboolean sink ) -{ - RESOLVE(PFNGLHISTOGRAMPROC, "glHistogram"); - proc(target, width, internalformat, sink); -} - -GLAPI void GLAPIENTRY glResetHistogram( GLenum target ) -{ - RESOLVE(PFNGLRESETHISTOGRAMPROC, "glResetHistogram"); - proc(target); -} - -GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset, - GLenum format, GLenum type, - GLvoid *values ) -{ - RESOLVE(PFNGLGETHISTOGRAMPROC, "glGetHistogram"); - proc(target, reset, format, type, values); -}; - -GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname, - GLfloat *params ) -{ - RESOLVE(PFNGLGETHISTOGRAMPARAMETERFVPROC, "glGetHistogramParameterfv"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname, - GLint *params ) -{ - RESOLVE(PFNGLGETHISTOGRAMPARAMETERIVPROC, "glGetHistogramParameteriv"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat, - GLboolean sink ) -{ - RESOLVE(PFNGLMINMAXPROC, "glMinmax"); - proc(target, internalformat, sink); -} - -GLAPI void GLAPIENTRY glResetMinmax( GLenum target ) -{ - RESOLVE(PFNGLRESETMINMAXPROC, "glResetMinmax"); - proc(target); -} - -GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset, - GLenum format, GLenum types, - GLvoid *values ) -{ - RESOLVE(PFNGLGETMINMAXPROC, "glGetMinmax"); - proc(target, reset, format, types, values); -} - -GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname, - GLfloat *params ) -{ - RESOLVE(PFNGLGETMINMAXPARAMETERFVPROC, "glGetMinmaxParameterfv"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname, - GLint *params ) -{ - RESOLVE(PFNGLGETMINMAXPARAMETERIVPROC, "glGetMinmaxParameteriv"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target, - GLenum internalformat, GLsizei width, GLenum format, GLenum type, - const GLvoid *image ) -{ - RESOLVE(PFNGLCONVOLUTIONFILTER1DPROC, "glConvolutionFilter1D"); - proc(target, internalformat, width, format, type, image); -} - -GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target, - GLenum internalformat, GLsizei width, GLsizei height, GLenum format, - GLenum type, const GLvoid *image ) -{ - RESOLVE(PFNGLCONVOLUTIONFILTER2DPROC, "glConvolutionFilter2D"); - proc(target, internalformat, width, height, format, type, image); -} - -GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname, - GLfloat params ) -{ - RESOLVE(PFNGLCONVOLUTIONPARAMETERFPROC, "glConvolutionParameterf"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname, - const GLfloat *params ) -{ - RESOLVE(PFNGLCONVOLUTIONPARAMETERFVPROC, "glConvolutionParameterfv"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname, - GLint params ) -{ - RESOLVE(PFNGLCONVOLUTIONPARAMETERIPROC, "glConvolutionParameteri"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname, - const GLint *params ) -{ - RESOLVE(PFNGLCONVOLUTIONPARAMETERIVPROC, "glConvolutionParameteriv"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target, - GLenum internalformat, GLint x, GLint y, GLsizei width ) -{ - RESOLVE(PFNGLCOPYCONVOLUTIONFILTER1DPROC, "glCopyConvolutionFilter1D"); - proc(target, internalformat, x, y, width); -} - -GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target, - GLenum internalformat, GLint x, GLint y, GLsizei width, - GLsizei height) -{ - RESOLVE(PFNGLCOPYCONVOLUTIONFILTER2DPROC, "glCopyConvolutionFilter2D"); - proc(target, internalformat, x, y, width, height); -} - -GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format, - GLenum type, GLvoid *image ) -{ - RESOLVE(PFNGLGETCONVOLUTIONFILTERPROC, "glGetConvolutionFilter"); - proc(target, format, type, image); -} - -GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname, - GLfloat *params ) -{ - RESOLVE(PFNGLGETCONVOLUTIONPARAMETERFVPROC, "glGetConvolutionParameterfv"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname, - GLint *params ) -{ - RESOLVE(PFNGLGETCONVOLUTIONPARAMETERIVPROC, "glGetConvolutionParameteriv"); - proc(target, pname, params); -} - -GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target, - GLenum internalformat, GLsizei width, GLsizei height, GLenum format, - GLenum type, const GLvoid *row, const GLvoid *column ) -{ - RESOLVE(PFNGLSEPARABLEFILTER2DPROC, "glSeparableFilter2D"); - proc(target, internalformat, width, height, format, type, row, column); -} - -GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, - GLenum type, GLvoid *row, GLvoid *column, GLvoid *span ) -{ - RESOLVE(PFNGLGETSEPARABLEFILTERPROC, "glGetSeparableFilter"); - proc(target, format, type, row, column, span); -} - -/* - * OpenGL 1.2 - */ - -GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level, - GLint internalFormat, - GLsizei width, GLsizei height, - GLsizei depth, GLint border, - GLenum format, GLenum type, - const GLvoid *pixels ) -{ - RESOLVE(PFNGLTEXIMAGE3DPROC, "glTexImage3D"); - proc(target, level, internalFormat, width, height, depth, border, format, type, pixels); -} - -GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLint zoffset, GLsizei width, - GLsizei height, GLsizei depth, - GLenum format, - GLenum type, const GLvoid *pixels) -{ - RESOLVE(PFNGLTEXSUBIMAGE3DPROC, "glTexSubImage3D"); - proc(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); -} - -GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLint zoffset, GLint x, - GLint y, GLsizei width, - GLsizei height ) -{ - RESOLVE(PFNGLCOPYTEXSUBIMAGE3DPROC, "glCopyTexSubImage3D"); - proc(target, level, xoffset, yoffset, zoffset, x, y, width, height); -} - - -/* - * 20. GL_EXT_texture_object - */ -GLAPI void GLAPIENTRY glGenTexturesEXT( GLsizei n, GLuint *textures ) -{ - glGenTextures(n, textures); -} - -GLAPI void GLAPIENTRY glDeleteTexturesEXT( GLsizei n, const GLuint *textures) -{ - glDeleteTextures(n, textures); -} - -GLAPI void GLAPIENTRY glBindTextureEXT( GLenum target, GLuint texture ) -{ - glBindTexture(target, target); -} - -GLAPI void GLAPIENTRY glPrioritizeTexturesEXT( GLsizei n, const GLuint *textures, const GLclampf *priorities ) -{ - glPrioritizeTextures(n, textures, priorities); -} - -GLAPI GLboolean GLAPIENTRY glAreTexturesResidentEXT( GLsizei n, const GLuint *textures, GLboolean *residences ) -{ - return glAreTexturesResident(n, textures, residences); -} - -GLAPI GLboolean GLAPIENTRY glIsTextureEXT( GLuint texture ) -{ - return glIsTexture(texture); -} - -/* - * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) - */ - -GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture) -{ - RESOLVE(PFNGLACTIVETEXTUREARBPROC, "glActiveTextureARB"); - proc(texture); -} - -GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v) -{ - RESOLVE(PFNGLMULTITEXCOORD1DVARBPROC, "glMultiTexCoord1dvARB"); - proc(target, v); -} - -GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v) -{ - RESOLVE(PFNGLMULTITEXCOORD1FVARBPROC, "glMultiTexCoord1fvARB"); - proc(target, v); -} - -GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v) -{ - RESOLVE(PFNGLMULTITEXCOORD1IVARBPROC, "glMultiTexCoord1ivARB"); - proc(target, v); -} - -GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v) -{ - RESOLVE(PFNGLMULTITEXCOORD1SVARBPROC, "glMultiTexCoord1svARB"); - proc(target, v); -} -GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v) -{ - RESOLVE(PFNGLMULTITEXCOORD2DVARBPROC, "glMultiTexCoord2dvARB"); - proc(target, v); -} -GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v) -{ - RESOLVE(PFNGLMULTITEXCOORD2FVARBPROC, "glMultiTexCoord2fvARB"); - proc(target, v); -} -GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v) -{ - RESOLVE(PFNGLMULTITEXCOORD2IVARBPROC, "glMultiTexCoord2ivARB"); - proc(target, v); -} -GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v) -{ - RESOLVE(PFNGLMULTITEXCOORD1SVARBPROC, "glMultiTexCoord1svARB"); - proc(target, v); -} -GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v) -{ - RESOLVE(PFNGLMULTITEXCOORD3DVARBPROC, "glMultiTexCoord3dvARB"); - proc(target, v); -} -GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v) -{ - RESOLVE(PFNGLMULTITEXCOORD3FVARBPROC, "glMultiTexCoord3fvARB"); - proc(target, v); -} -GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v) -{ - RESOLVE(PFNGLMULTITEXCOORD3IVARBPROC, "glMultiTexCoord3ivARB"); - proc(target, v); -} -GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v) -{ - RESOLVE(PFNGLMULTITEXCOORD1SVARBPROC, "glMultiTexCoord1svARB"); - proc(target, v); -} -GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v) -{ - RESOLVE(PFNGLMULTITEXCOORD4DVARBPROC, "glMultiTexCoord4dvARB"); - proc(target, v); -} -GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v) -{ - RESOLVE(PFNGLMULTITEXCOORD4FVARBPROC, "glMultiTexCoord4fvARB"); - proc(target, v); -} -GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v) -{ - RESOLVE(PFNGLMULTITEXCOORD4IVARBPROC, "glMultiTexCoord4ivARB"); - proc(target, v); -} -GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v) -{ - RESOLVE(PFNGLMULTITEXCOORD1SVARBPROC, "glMultiTexCoord1svARB"); - proc(target, v); -} - - -GLAPI void GLAPIENTRY glActiveStencilFaceEXT(GLenum face) -{ - RESOLVE(PFNGLACTIVESTENCILFACEEXTPROC, "glActiveStencilFaceEXT"); - proc(face); -} - -GLAPI void APIENTRY glPointParameterfARB(GLenum pname, GLfloat param) -{ - RESOLVE(PFNGLPOINTPARAMETERFARBPROC, "glPointParameterfARB"); - proc(pname, param); -} - -GLAPI void APIENTRY glPointParameterfvARB(GLenum pname, const GLfloat *params) -{ - RESOLVE(PFNGLPOINTPARAMETERFVARBPROC, "glPointParameterfvARB"); - proc(pname, params); -} - - -GLAPI void APIENTRY glWindowPos3fARB(GLfloat x, GLfloat y, GLfloat z) -{ - RESOLVE(PFNGLWINDOWPOS3FARBPROC, "glWindowPos3fARB"); - proc(x, y, z); -} - -GLAPI void APIENTRY glPointParameteri(GLenum pname, GLint param) -{ - RESOLVE(PFNGLPOINTPARAMETERIPROC, "glPointParameteri"); - proc(pname, param); -} - -GLAPI void APIENTRY glPointParameteriv(GLenum pname, const GLint *params) -{ - RESOLVE(PFNGLPOINTPARAMETERIVPROC, "glPointParameteriv"); - proc(pname, params); -} - -GLAPI void APIENTRY glPointParameteriNV(GLenum pname, GLint param) -{ - RESOLVE(PFNGLPOINTPARAMETERINVPROC, "glPointParameteriNV"); - proc(pname, param); -} - -GLAPI void APIENTRY glPointParameterivNV(GLenum pname, const GLint *params) -{ - RESOLVE(PFNGLPOINTPARAMETERIVNVPROC, "glPointParameterivNV"); - proc(pname, params); -} - -GLAPI void APIENTRY glSecondaryColor3bv(const GLbyte *v) -{ - RESOLVE(PFNGLSECONDARYCOLOR3BVPROC, "glSecondaryColor3bv"); - proc(v); -} -GLAPI void APIENTRY glSecondaryColor3dv(const GLdouble *v) -{ - RESOLVE(PFNGLSECONDARYCOLOR3DVPROC, "glSecondaryColor3dv"); - proc(v); -} -GLAPI void APIENTRY glSecondaryColor3fv(const GLfloat *v) -{ - RESOLVE(PFNGLSECONDARYCOLOR3FVPROC, "glSecondaryColor3fv"); - proc(v); -} -GLAPI void APIENTRY glSecondaryColor3iv(const GLint *v) -{ - RESOLVE(PFNGLSECONDARYCOLOR3IVPROC, "glSecondaryColor3iv"); - proc(v); -} -GLAPI void APIENTRY glSecondaryColor3sv(const GLshort *v) -{ - RESOLVE(PFNGLSECONDARYCOLOR3SVPROC, "glSecondaryColor3sv"); - proc(v); -} -GLAPI void APIENTRY glSecondaryColor3ubv(const GLubyte *v) -{ - RESOLVE(PFNGLSECONDARYCOLOR3UBVPROC, "glSecondaryColor3ubv"); - proc(v); -} -GLAPI void APIENTRY glSecondaryColor3uiv(const GLuint *v) -{ - RESOLVE(PFNGLSECONDARYCOLOR3UIVPROC, "glSecondaryColor3uiv"); - proc(v); -} -GLAPI void APIENTRY glSecondaryColor3usv(const GLushort *v) -{ - RESOLVE(PFNGLSECONDARYCOLOR3USVPROC, "glSecondaryColor3usv"); - proc(v); -} -GLAPI void APIENTRY glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -{ - RESOLVE(PFNGLSECONDARYCOLORPOINTERPROC, "glSecondaryColorPointer"); - proc(size, type, stride, pointer); -} - - -GLAPI void APIENTRY glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) -{ - RESOLVE(PFNGLBLENDFUNCSEPARATEPROC, "glBlendFuncSeparate"); - proc(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); -} -GLAPI void APIENTRY glFogCoordfv(const GLfloat *coord) -{ - RESOLVE(PFNGLFOGCOORDFVPROC, "glFogCoordfv"); - proc(coord); -} -GLAPI void APIENTRY glFogCoorddv(const GLdouble *coord) -{ - RESOLVE(PFNGLFOGCOORDDVPROC, "glFogCoorddv"); - proc(coord); -} -GLAPI void APIENTRY glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer) -{ - RESOLVE(PFNGLFOGCOORDPOINTERPROC, "glFogCoordPointer"); - proc(type, stride, pointer); -} - - -GLAPI void APIENTRY glSampleCoverageARB(GLclampf value, GLboolean invert) -{ - RESOLVE(PFNGLSAMPLECOVERAGEARBPROC, "glSampleCoverageARB"); - proc(value, invert); -} -GLAPI void APIENTRY glSampleMaskSGIS(GLclampf value, GLboolean invert) -{ - RESOLVE(PFNGLSAMPLEMASKSGISPROC, "glSampleMaskSGIS"); - proc(value, invert); -} -GLAPI void APIENTRY glSamplePatternSGIS(GLenum pattern) -{ - RESOLVE(PFNGLSAMPLEPATTERNSGISPROC, "glSamplePatternSGIS"); - proc(pattern); -} diff --git a/nx-X11/programs/Xserver/GL/windows/indirect.c b/nx-X11/programs/Xserver/GL/windows/indirect.c deleted file mode 100755 index 5e12022f4..000000000 --- a/nx-X11/programs/Xserver/GL/windows/indirect.c +++ /dev/null @@ -1,1605 +0,0 @@ -/* - * GLX implementation that uses Windows OpenGL library - * (Indirect rendering path) - * - * Authors: Alexander Gottwald - */ -/* - * Portions of this file are copied from GL/apple/indirect.c, - * which contains the following copyright: - * - * Copyright (c) 2002 Greg Parker. All Rights Reserved. - * Copyright (c) 2002 Apple Computer, Inc. - * - * Portions of this file are copied from xf86glx.c, - * which contains the following copyright: - * - * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - - - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "glwindows.h" -#include <glcontextmodes.h> -#include <stdint.h> - -#include <winpriv.h> - -#define GLWIN_DEBUG_HWND(hwnd) \ - if (glWinDebugSettings.dumpHWND) { \ - char buffer[1024]; \ - if (GetWindowText(hwnd, buffer, sizeof(buffer))==0) *buffer=0; \ - GLWIN_DEBUG_MSG("Got HWND %s (%p)\n", buffer, hwnd); \ - } - - -/* ggs: needed to call back to glx with visual configs */ -extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs); - -glWinDebugSettingsRec glWinDebugSettings = { 1, 0, 0, 0, 0}; - -static void glWinInitDebugSettings(void) -{ - char *envptr; - - envptr = getenv("GLWIN_ENABLE_DEBUG"); - if (envptr != NULL) - glWinDebugSettings.enableDebug = (atoi(envptr) == 1); - - envptr = getenv("GLWIN_ENABLE_TRACE"); - if (envptr != NULL) - glWinDebugSettings.enableTrace = (atoi(envptr) == 1); - - envptr = getenv("GLWIN_DUMP_PFD"); - if (envptr != NULL) - glWinDebugSettings.dumpPFD = (atoi(envptr) == 1); - - envptr = getenv("GLWIN_DUMP_HWND"); - if (envptr != NULL) - glWinDebugSettings.dumpHWND = (atoi(envptr) == 1); - - envptr = getenv("GLWIN_DUMP_DC"); - if (envptr != NULL) - glWinDebugSettings.dumpDC = (atoi(envptr) == 1); -} - -static char errorbuffer[1024]; -const char *glWinErrorMessage(void) -{ - if (!FormatMessage( - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &errorbuffer, - sizeof(errorbuffer), - NULL )) - { - snprintf(errorbuffer, sizeof(errorbuffer), "Unknown error in FormatMessage: %08x!\n", (unsigned)GetLastError()); - } - return errorbuffer; -} - -/* - * GLX implementation that uses Win32's OpenGL - */ - -/* - * Server-side GLX uses these functions which are normally defined - * in the OpenGL SI. - */ - -GLuint __glFloorLog2(GLuint val) -{ - int c = 0; - - while (val > 1) { - c++; - val >>= 1; - } - return c; -} - -/* some prototypes */ -static Bool glWinScreenProbe(int screen); -static Bool glWinInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB); -static void glWinSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates); -static __GLinterface *glWinCreateContext(__GLimports *imports, - __GLcontextModes *mode, - __GLinterface *shareGC); -static void glWinCreateBuffer(__GLXdrawablePrivate *glxPriv); -static void glWinResetExtension(void); - -/* - * This structure is statically allocated in the __glXScreens[] - * structure. This struct is not used anywhere other than in - * __glXScreenInit to initialize each of the active screens - * (__glXActiveScreens[]). Several of the fields must be initialized by - * the screenProbe routine before they are copied to the active screens - * struct. In particular, the contextCreate, pGlxVisual, numVisuals, - * and numUsableVisuals fields must be initialized. - */ -static __GLXscreenInfo __glDDXScreenInfo = { - glWinScreenProbe, /* Must be generic and handle all screens */ - glWinCreateContext, /* Substitute screen's createContext routine */ - glWinCreateBuffer, /* Substitute screen's createBuffer routine */ - NULL, /* Set up pGlxVisual in probe */ - NULL, /* Set up pVisualPriv in probe */ - 0, /* Set up numVisuals in probe */ - 0, /* Set up numUsableVisuals in probe */ - "Vendor String", /* GLXvendor is overwritten by __glXScreenInit */ - "Version String", /* GLXversion is overwritten by __glXScreenInit */ - "Extensions String", /* GLXextensions is overwritten by __glXScreenInit */ - NULL /* WrappedPositionWindow is overwritten */ -}; - -void *__glXglDDXScreenInfo(void) { - return &__glDDXScreenInfo; -} - -static __GLXextensionInfo __glDDXExtensionInfo = { - GL_CORE_WINDOWS, - glWinResetExtension, - glWinInitVisuals, - glWinSetVisualConfigs -}; - -void *__glXglDDXExtensionInfo(void) { - return &__glDDXExtensionInfo; -} - -/* prototypes */ - -static GLboolean glWinDestroyContext(__GLcontext *gc); -static GLboolean glWinLoseCurrent(__GLcontext *gc); -static GLboolean glWinMakeCurrent(__GLcontext *gc); -static GLboolean glWinShareContext(__GLcontext *gc, __GLcontext *gcShare); -static GLboolean glWinCopyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask); -static GLboolean glWinForceCurrent(__GLcontext *gc); - -/* Drawing surface notification callbacks */ -static GLboolean glWinNotifyResize(__GLcontext *gc); -static void glWinNotifyDestroy(__GLcontext *gc); -static void glWinNotifySwapBuffers(__GLcontext *gc); - -/* Dispatch table override control for external agents like libGLS */ -static struct __GLdispatchStateRec* glWinDispatchExec(__GLcontext *gc); -static void glWinBeginDispatchOverride(__GLcontext *gc); -static void glWinEndDispatchOverride(__GLcontext *gc); - -/* Debug output */ -static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd); - -static __GLexports glWinExports = { - glWinDestroyContext, - glWinLoseCurrent, - glWinMakeCurrent, - glWinShareContext, - glWinCopyContext, - glWinForceCurrent, - - glWinNotifyResize, - glWinNotifyDestroy, - glWinNotifySwapBuffers, - - glWinDispatchExec, - glWinBeginDispatchOverride, - glWinEndDispatchOverride -}; - -glWinScreenRec glWinScreens[MAXSCREENS]; - -/* __GLdrawablePrivate->private */ -typedef struct { - DrawablePtr pDraw; - /* xp_surface_id sid; */ -} GLWinDrawableRec; - -struct __GLcontextRec { - struct __GLinterfaceRec interface; /* required to be first */ - - HGLRC ctx; /* Windows GL Context */ - - HDC dc; /* Windows Device Context */ - winWindowInfoRec winInfo; /* Window info from XWin */ - - PIXELFORMATDESCRIPTOR pfd; /* Pixelformat flags */ - int pixelFormat; /* Pixelformat index */ - - unsigned isAttached :1; /* Flag to track if context is attached */ -}; - -static HDC glWinMakeDC(__GLcontext *gc) -{ - HDC dc; - - /*if (gc->winInfo.hrgn == NULL) - { - GLWIN_DEBUG_MSG("Creating region from RECT(%ld,%ld,%ld,%ld):", - gc->winInfo.rect.left, - gc->winInfo.rect.top, - gc->winInfo.rect.right, - gc->winInfo.rect.bottom); - gc->winInfo.hrgn = CreateRectRgnIndirect(&gc->winInfo.rect); - GLWIN_DEBUG_MSG2("%p\n", gc->winInfo.hrgn); - }*/ - - if (glWinDebugSettings.enableTrace) - GLWIN_DEBUG_HWND(gc->winInfo.hwnd); - - dc = GetDC(gc->winInfo.hwnd); - /*dc = GetDCEx(gc->winInfo.hwnd, gc->winInfo.hrgn, - DCX_WINDOW | DCX_NORESETATTRS ); */ - - if (dc == NULL) - ErrorF("GetDC error: %s\n", glWinErrorMessage()); - return dc; -} - -static void unattach(__GLcontext *gc) -{ - BOOL ret; - GLWIN_DEBUG_MSG("unattach (ctx %p)\n", gc->ctx); - if (!gc->isAttached) - { - ErrorF("called unattach on an unattached context\n"); - return; - } - - if (gc->ctx) - { - ret = wglDeleteContext(gc->ctx); - if (!ret) - ErrorF("wglDeleteContext error: %s\n", glWinErrorMessage()); - gc->ctx = NULL; - } - - if (gc->winInfo.hrgn) - { - ret = DeleteObject(gc->winInfo.hrgn); - if (!ret) - ErrorF("DeleteObject error: %s\n", glWinErrorMessage()); - gc->winInfo.hrgn = NULL; - } - - gc->isAttached = 0; -} - -static BOOL glWinAdjustHWND(__GLcontext *gc, WindowPtr pWin) -{ - HDC dc; - BOOL ret; - HGLRC newctx; - HWND oldhwnd; - - GLWIN_DEBUG_MSG("glWinAdjustHWND (ctx %p, pWin %p)\n", gc->ctx, pWin); - - if (pWin == NULL) - { - GLWIN_DEBUG_MSG("Deferring until window is created\n"); - return FALSE; - } - - oldhwnd = gc->winInfo.hwnd; - winGetWindowInfo(pWin, &gc->winInfo); - - GLWIN_DEBUG_HWND(gc->winInfo.hwnd); - if (gc->winInfo.hwnd == NULL) - { - GLWIN_DEBUG_MSG("Deferring until window is created\n"); - return FALSE; - } - - dc = glWinMakeDC(gc); - - if (glWinDebugSettings.dumpDC) - GLWIN_DEBUG_MSG("Got HDC %p\n", dc); - - gc->pixelFormat = ChoosePixelFormat(dc, &gc->pfd); - if (gc->pixelFormat == 0) - { - ErrorF("ChoosePixelFormat error: %s\n", glWinErrorMessage()); - ReleaseDC(gc->winInfo.hwnd, dc); - return FALSE; - } - - ret = SetPixelFormat(dc, gc->pixelFormat, &gc->pfd); - if (!ret) { - ErrorF("SetPixelFormat error: %s\n", glWinErrorMessage()); - ReleaseDC(gc->winInfo.hwnd, dc); - return FALSE; - } - - newctx = wglCreateContext(dc); - if (newctx == NULL) { - ErrorF("wglCreateContext error: %s\n", glWinErrorMessage()); - ReleaseDC(gc->winInfo.hwnd, dc); - return FALSE; - } - - GLWIN_DEBUG_MSG("wglCreateContext (ctx %p)\n", newctx); - - if (!wglShareLists(gc->ctx, newctx)) - { - ErrorF("wglShareLists error: %s\n", glWinErrorMessage()); - ReleaseDC(gc->winInfo.hwnd, dc); - return FALSE; - } - - if (oldhwnd != gc->winInfo.hwnd) - { - GLWIN_DEBUG_MSG("Trying wglCopyContext\n"); - if (!wglCopyContext(gc->ctx, newctx, GL_ALL_ATTRIB_BITS)) - { - ErrorF("wglCopyContext error: %s\n", glWinErrorMessage()); - ReleaseDC(gc->winInfo.hwnd, dc); - return FALSE; - } - } - - if (!wglDeleteContext(gc->ctx)) - { - ErrorF("wglDeleteContext error: %s\n", glWinErrorMessage()); - } - - gc->ctx = newctx; - - if (!wglMakeCurrent(dc, gc->ctx)) { - ErrorF("glMakeCurrent error: %s\n", glWinErrorMessage()); - ReleaseDC(gc->winInfo.hwnd, dc); - return FALSE; - } - - ReleaseDC(gc->winInfo.hwnd, dc); - - return TRUE; -} - -static BOOL glWinCreateContextReal(__GLcontext *gc, WindowPtr pWin) -{ - HDC dc; - BOOL ret; - - GLWIN_DEBUG_MSG("glWinCreateContextReal (pWin %p)\n", pWin); - - if (pWin == NULL) - { - GLWIN_DEBUG_MSG("Deferring until window is created\n"); - return FALSE; - } - - winGetWindowInfo(pWin, &gc->winInfo); - - GLWIN_DEBUG_HWND(gc->winInfo.hwnd); - if (gc->winInfo.hwnd == NULL) - { - GLWIN_DEBUG_MSG("Deferring until window is created\n"); - return FALSE; - } - - - dc = glWinMakeDC(gc); - - if (glWinDebugSettings.dumpDC) - GLWIN_DEBUG_MSG("Got HDC %p\n", dc); - - gc->pixelFormat = ChoosePixelFormat(dc, &gc->pfd); - if (gc->pixelFormat == 0) - { - ErrorF("ChoosePixelFormat error: %s\n", glWinErrorMessage()); - ReleaseDC(gc->winInfo.hwnd, dc); - return FALSE; - } - - ret = SetPixelFormat(dc, gc->pixelFormat, &gc->pfd); - if (!ret) { - ErrorF("SetPixelFormat error: %s\n", glWinErrorMessage()); - ReleaseDC(gc->winInfo.hwnd, dc); - return FALSE; - } - - gc->ctx = wglCreateContext(dc); - if (gc->ctx == NULL) { - ErrorF("wglCreateContext error: %s\n", glWinErrorMessage()); - ReleaseDC(gc->winInfo.hwnd, dc); - return FALSE; - } - - GLWIN_DEBUG_MSG("glWinCreateContextReal (ctx %p)\n", gc->ctx); - - if (!wglMakeCurrent(dc, gc->ctx)) { - ErrorF("glMakeCurrent error: %s\n", glWinErrorMessage()); - ReleaseDC(gc->winInfo.hwnd, dc); - return FALSE; - } - - ReleaseDC(gc->winInfo.hwnd, dc); - - return TRUE; -} - -static void attach(__GLcontext *gc, __GLdrawablePrivate *glPriv) -{ - __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other; - - GLWIN_DEBUG_MSG("attach (ctx %p)\n", gc->ctx); - - if (gc->isAttached) - { - ErrorF("called attach on an attached context\n"); - return; - } - - if (glxPriv->type == DRAWABLE_WINDOW) - { - WindowPtr pWin = (WindowPtr) glxPriv->pDraw; - if (pWin == NULL) - { - GLWIN_DEBUG_MSG("Deferring ChoosePixelFormat until window is created\n"); - } else - { - if (glWinCreateContextReal(gc, pWin)) - { - gc->isAttached = TRUE; - GLWIN_DEBUG_MSG("attached\n"); - } - } - } -} - -static GLboolean glWinLoseCurrent(__GLcontext *gc) -{ - GLWIN_TRACE_MSG("glWinLoseCurrent (ctx %p)\n", gc->ctx); - - __glXLastContext = NULL; /* Mesa does this; why? */ - - return GL_TRUE; -} - -/* Context manipulation; return GL_FALSE on failure */ -static GLboolean glWinDestroyContext(__GLcontext *gc) -{ - GLWIN_DEBUG_MSG("glWinDestroyContext (ctx %p)\n", gc->ctx); - - if (gc != NULL) - { - if (gc->isAttached) - unattach(gc); - if (gc->dc != NULL) - DeleteDC(gc->dc); - free(gc); - } - - return GL_TRUE; -} - -static GLboolean glWinMakeCurrent(__GLcontext *gc) -{ - __GLdrawablePrivate *glPriv = gc->interface.imports.getDrawablePrivate(gc); - BOOL ret; - HDC dc; - - GLWIN_TRACE_MSG(" (ctx %p)\n", gc->ctx); - - if (!gc->isAttached) - attach(gc, glPriv); - - if (gc->ctx == NULL) { - ErrorF("Context is NULL\n"); - return GL_FALSE; - } - - dc = glWinMakeDC(gc); - ret = wglMakeCurrent(dc, gc->ctx); - if (!ret) - ErrorF("glMakeCurrent error: %s\n", glWinErrorMessage()); - ReleaseDC(gc->winInfo.hwnd, dc); - - return ret?GL_TRUE:GL_FALSE; -} - -static GLboolean glWinShareContext(__GLcontext *gc, __GLcontext *gcShare) -{ - GLWIN_DEBUG_MSG("glWinShareContext unimplemented\n"); - - return GL_TRUE; -} - -static GLboolean glWinCopyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask) -{ - BOOL ret; - - GLWIN_DEBUG_MSG("glWinCopyContext\n"); - - ret = wglCopyContext(src->ctx, dst->ctx, mask); - if (!ret) - { - ErrorF("wglCopyContext error: %s\n", glWinErrorMessage()); - return GL_FALSE; - } - - return GL_TRUE; -} - -static GLboolean glWinForceCurrent(__GLcontext *gc) -{ - GLWIN_TRACE_MSG(" (ctx %p)\n", gc->ctx); - - return GL_TRUE; -} - -/* Drawing surface notification callbacks */ - -static GLboolean glWinNotifyResize(__GLcontext *gc) -{ - GLWIN_DEBUG_MSG("unimplemented glWinNotifyResize"); - return GL_TRUE; -} - -static void glWinNotifyDestroy(__GLcontext *gc) -{ - GLWIN_DEBUG_MSG("unimplemented glWinNotifyDestroy"); -} - -static void glWinNotifySwapBuffers(__GLcontext *gc) -{ - GLWIN_DEBUG_MSG("unimplemented glWinNotifySwapBuffers"); -} - -/* Dispatch table override control for external agents like libGLS */ -static struct __GLdispatchStateRec* glWinDispatchExec(__GLcontext *gc) -{ - GLWIN_DEBUG_MSG("unimplemented glWinDispatchExec"); - return NULL; -} - -static void glWinBeginDispatchOverride(__GLcontext *gc) -{ - GLWIN_DEBUG_MSG("unimplemented glWinBeginDispatchOverride"); -} - -static void glWinEndDispatchOverride(__GLcontext *gc) -{ - GLWIN_DEBUG_MSG("unimplemented glWinEndDispatchOverride"); -} - -#define DUMP_PFD_FLAG(flag) \ - if (pfd->dwFlags & flag) { \ - ErrorF("%s%s", pipesym, #flag); \ - pipesym = " | "; \ - } - -static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd) -{ - const char *pipesym = ""; /* will be set after first flag dump */ - ErrorF("PIXELFORMATDESCRIPTOR:\n"); - ErrorF("nSize = %u\n", pfd->nSize); - ErrorF("nVersion = %u\n", pfd->nVersion); - ErrorF("dwFlags = %lu = {", pfd->dwFlags); - DUMP_PFD_FLAG(PFD_MAIN_PLANE); - DUMP_PFD_FLAG(PFD_OVERLAY_PLANE); - DUMP_PFD_FLAG(PFD_UNDERLAY_PLANE); - DUMP_PFD_FLAG(PFD_DOUBLEBUFFER); - DUMP_PFD_FLAG(PFD_STEREO); - DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW); - DUMP_PFD_FLAG(PFD_DRAW_TO_BITMAP); - DUMP_PFD_FLAG(PFD_SUPPORT_GDI); - DUMP_PFD_FLAG(PFD_SUPPORT_OPENGL); - DUMP_PFD_FLAG(PFD_GENERIC_FORMAT); - DUMP_PFD_FLAG(PFD_NEED_PALETTE); - DUMP_PFD_FLAG(PFD_NEED_SYSTEM_PALETTE); - DUMP_PFD_FLAG(PFD_SWAP_EXCHANGE); - DUMP_PFD_FLAG(PFD_SWAP_COPY); - DUMP_PFD_FLAG(PFD_SWAP_LAYER_BUFFERS); - DUMP_PFD_FLAG(PFD_GENERIC_ACCELERATED); - DUMP_PFD_FLAG(PFD_DEPTH_DONTCARE); - DUMP_PFD_FLAG(PFD_DOUBLEBUFFER_DONTCARE); - DUMP_PFD_FLAG(PFD_STEREO_DONTCARE); - ErrorF("}\n"); - - ErrorF("iPixelType = %hu = %s\n", pfd->iPixelType, - (pfd->iPixelType == PFD_TYPE_RGBA ? "PFD_TYPE_RGBA" : "PFD_TYPE_COLORINDEX")); - ErrorF("cColorBits = %hhu\n", pfd->cColorBits); - ErrorF("cRedBits = %hhu\n", pfd->cRedBits); - ErrorF("cRedShift = %hhu\n", pfd->cRedShift); - ErrorF("cGreenBits = %hhu\n", pfd->cGreenBits); - ErrorF("cGreenShift = %hhu\n", pfd->cGreenShift); - ErrorF("cBlueBits = %hhu\n", pfd->cBlueBits); - ErrorF("cBlueShift = %hhu\n", pfd->cBlueShift); - ErrorF("cAlphaBits = %hhu\n", pfd->cAlphaBits); - ErrorF("cAlphaShift = %hhu\n", pfd->cAlphaShift); - ErrorF("cAccumBits = %hhu\n", pfd->cAccumBits); - ErrorF("cAccumRedBits = %hhu\n", pfd->cAccumRedBits); - ErrorF("cAccumGreenBits = %hhu\n", pfd->cAccumGreenBits); - ErrorF("cAccumBlueBits = %hhu\n", pfd->cAccumBlueBits); - ErrorF("cAccumAlphaBits = %hhu\n", pfd->cAccumAlphaBits); - ErrorF("cDepthBits = %hhu\n", pfd->cDepthBits); - ErrorF("cStencilBits = %hhu\n", pfd->cStencilBits); - ErrorF("cAuxBuffers = %hhu\n", pfd->cAuxBuffers); - ErrorF("iLayerType = %hhu\n", pfd->iLayerType); - ErrorF("bReserved = %hhu\n", pfd->bReserved); - ErrorF("dwLayerMask = %lu\n", pfd->dwLayerMask); - ErrorF("dwVisibleMask = %lu\n", pfd->dwVisibleMask); - ErrorF("dwDamageMask = %lu\n", pfd->dwDamageMask); - ErrorF("\n"); -} - -static int makeFormat(__GLcontextModes *mode, PIXELFORMATDESCRIPTOR *pfdret) -{ - PIXELFORMATDESCRIPTOR pfd = { - sizeof(PIXELFORMATDESCRIPTOR), /* size of this pfd */ - 1, /* version number */ - PFD_DRAW_TO_WINDOW | /* support window */ - PFD_SUPPORT_OPENGL, /* support OpenGL */ - PFD_TYPE_RGBA, /* RGBA type */ - 24, /* 24-bit color depth */ - 0, 0, 0, 0, 0, 0, /* color bits ignored */ - 0, /* no alpha buffer */ - 0, /* shift bit ignored */ - 0, /* no accumulation buffer */ - 0, 0, 0, 0, /* accum bits ignored */ - 0, /* 32-bit z-buffer */ - 0, /* no stencil buffer */ - 0, /* no auxiliary buffer */ - PFD_MAIN_PLANE, /* main layer */ - 0, /* reserved */ - 0, 0, 0 /* layer masks ignored */ - }, *result = &pfd; - - /* disable anything but rgba. must get rgba to work first */ - if (!mode->rgbMode) - return -1; - - if (mode->stereoMode) { - result->dwFlags |= PFD_STEREO; - } - if (mode->doubleBufferMode) { - result->dwFlags |= PFD_DOUBLEBUFFER; - } - - if (mode->colorIndexMode) { - /* ignored, see above */ - result->iPixelType = PFD_TYPE_COLORINDEX; - result->cColorBits = mode->redBits + mode->greenBits + mode->blueBits; - result->cRedBits = mode->redBits; - result->cRedShift = 0; /* FIXME */ - result->cGreenBits = mode->greenBits; - result->cGreenShift = 0; /* FIXME */ - result->cBlueBits = mode->blueBits; - result->cBlueShift = 0; /* FIXME */ - result->cAlphaBits = mode->alphaBits; - result->cAlphaShift = 0; /* FIXME */ - } - - if (mode->rgbMode) { - result->iPixelType = PFD_TYPE_RGBA; - result->cColorBits = mode->redBits + mode->greenBits + mode->blueBits; - result->cRedBits = mode->redBits; - result->cRedShift = 0; /* FIXME */ - result->cGreenBits = mode->greenBits; - result->cGreenShift = 0; /* FIXME */ - result->cBlueBits = mode->blueBits; - result->cBlueShift = 0; /* FIXME */ - result->cAlphaBits = mode->alphaBits; - result->cAlphaShift = 0; /* FIXME */ - } - - if (mode->haveAccumBuffer) { - result->cAccumBits = mode->accumRedBits + mode->accumGreenBits - + mode->accumBlueBits + mode->accumAlphaBits; - result->cAccumRedBits = mode->accumRedBits; - result->cAccumGreenBits = mode->accumGreenBits; - result->cAccumBlueBits = mode->accumBlueBits; - result->cAccumAlphaBits = mode->accumAlphaBits; - } - - if (mode->haveDepthBuffer) { - result->cDepthBits = mode->depthBits; - } - if (mode->haveStencilBuffer) { - result->cStencilBits = mode->stencilBits; - } - - /* result->cAuxBuffers = mode->numAuxBuffers; */ - - /* mode->level ignored */ - - /* mode->pixmapMode ? */ - - *pfdret = pfd; - - return 0; -} - -static __GLinterface *glWinCreateContext(__GLimports *imports, - __GLcontextModes *mode, - __GLinterface *shareGC) -{ - __GLcontext *result; - - GLWIN_DEBUG_MSG("glWinCreateContext\n"); - - result = (__GLcontext *)calloc(1, sizeof(__GLcontext)); - if (!result) - return NULL; - - result->interface.imports = *imports; - result->interface.exports = glWinExports; - - if (makeFormat(mode, &result->pfd)) - { - ErrorF("makeFormat failed\n"); - free(result); - return NULL; - } - - if (glWinDebugSettings.dumpPFD) - pfdOut(&result->pfd); - - GLWIN_DEBUG_MSG("glWinCreateContext done\n"); - return (__GLinterface *)result; -} - -Bool -glWinRealizeWindow(WindowPtr pWin) -{ - /* If this window has GL contexts, tell them to reattach */ - /* reattaching is bad: display lists and parameters get lost */ - Bool result; - ScreenPtr pScreen = pWin->drawable.pScreen; - glWinScreenRec *screenPriv = &glWinScreens[pScreen->myNum]; - __GLXdrawablePrivate *glxPriv; - - GLWIN_DEBUG_MSG("glWinRealizeWindow\n"); - - /* Allow the window to be created (RootlessRealizeWindow is inside our wrap) */ - pScreen->RealizeWindow = screenPriv->RealizeWindow; - result = pScreen->RealizeWindow(pWin); - pScreen->RealizeWindow = glWinRealizeWindow; - - /* Re-attach this window's GL contexts, if any. */ - glxPriv = __glXFindDrawablePrivate(pWin->drawable.id); - if (glxPriv) { - __GLXcontext *gx; - __GLcontext *gc; - __GLdrawablePrivate *glPriv = &glxPriv->glPriv; - GLWIN_DEBUG_MSG("glWinRealizeWindow is GL drawable!\n"); - - /* GL contexts bound to this window for drawing */ - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) { - gc = (__GLcontext *)gx->gc; - if (gc->isAttached) -#if 1 - { - GLWIN_DEBUG_MSG("context is already bound! Adjusting HWND.\n"); - glWinAdjustHWND(gc, pWin); - continue; - } -#else - unattach(gc); -#endif - attach(gc, glPriv); - } - - /* GL contexts bound to this window for reading */ - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) { - gc = (__GLcontext *)gx->gc; - if (gc->isAttached) -#if 1 - { - GLWIN_DEBUG_MSG("context is already bound! Adjusting HWND.\n"); - glWinAdjustHWND(gc, pWin); - continue; - } -#else - unattach(gc); -#endif - attach(gc, glPriv); - } - } - - return result; -} - - -void -glWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - glWinScreenRec *screenPriv = &glWinScreens[pScreen->myNum]; - __GLXdrawablePrivate *glxPriv; - - GLWIN_TRACE_MSG(" (pWindow %p)\n", pWindow); - - /* Check if the window is attached and discard any drawing request */ - glxPriv = __glXFindDrawablePrivate(pWindow->drawable.id); - if (glxPriv) { - __GLXcontext *gx; - - /* GL contexts bound to this window for drawing */ - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) { -/* - GLWIN_DEBUG_MSG("glWinCopyWindow - calling glDrawBuffer\n"); - glDrawBuffer(GL_FRONT); - */ - - return; - } - - /* GL contexts bound to this window for reading */ - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) { - return; - } - } - - GLWIN_DEBUG_MSG("glWinCopyWindow - passing to hw layer\n"); - - pScreen->CopyWindow = screenPriv->CopyWindow; - pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc); - pScreen->CopyWindow = glWinCopyWindow; -} - -Bool -glWinUnrealizeWindow(WindowPtr pWin) -{ - /* If this window has GL contexts, tell them to unattach */ - Bool result; - ScreenPtr pScreen = pWin->drawable.pScreen; - glWinScreenRec *screenPriv = &glWinScreens[pScreen->myNum]; - __GLXdrawablePrivate *glxPriv; - - GLWIN_DEBUG_MSG("glWinUnrealizeWindow\n"); - - /* The Aqua window may have already been destroyed (windows - * are unrealized from top down) - */ - - /* Unattach this window's GL contexts, if any. */ - glxPriv = __glXFindDrawablePrivate(pWin->drawable.id); - if (glxPriv) { - __GLXcontext *gx; - __GLcontext *gc; - GLWIN_DEBUG_MSG("glWinUnealizeWindow is GL drawable!\n"); - - /* GL contexts bound to this window for drawing */ - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) { - gc = (__GLcontext *)gx->gc; - unattach(gc); - } - - /* GL contexts bound to this window for reading */ - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) { - gc = (__GLcontext *)gx->gc; - unattach(gc); - } - } - - pScreen->UnrealizeWindow = screenPriv->UnrealizeWindow; - result = pScreen->UnrealizeWindow(pWin); - pScreen->UnrealizeWindow = glWinUnrealizeWindow; - - return result; -} - - -/* - * In the case the driver has no GLX visuals we'll use these. - * [0] = RGB, double buffered - * [1] = RGB, double buffered, stencil, accum - */ -/* Originally copied from Mesa */ - -static int numConfigs = 0; -static __GLXvisualConfig *visualConfigs = NULL; -static void **visualPrivates = NULL; - -#define NUM_FALLBACK_CONFIGS 2 -static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE_EXT, /* visualRating */ - 0, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 16, 16, 16, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE_EXT, /* visualRating */ - 0, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - } -}; - -static __GLXvisualConfig NullConfig = { - -1, /* vid */ - -1, /* class */ - False, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE_EXT, /* visualRating */ - 0, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ -}; - -static inline int count_bits(uint32_t x) -{ - x = x - ((x >> 1) & 0x55555555); - x = (x & 0x33333333) + ((x >> 2) & 0x33333333); - x = (x + (x >> 4)) & 0x0f0f0f0f; - x = x + (x >> 8); - x = x + (x >> 16); - return x & 63; -} - -/* Mostly copied from Mesa's xf86glx.c */ -static Bool init_visuals(int *nvisualp, VisualPtr *visualp, - VisualID *defaultVisp, - int ndepth, DepthPtr pdepth, - int rootDepth) -{ - int numRGBconfigs; - int numCIconfigs; - int numVisuals = *nvisualp; - int numNewVisuals; - int numNewConfigs; - VisualPtr pVisual = *visualp; - VisualPtr pVisualNew = NULL; - VisualID *orig_vid = NULL; - __GLcontextModes *modes = NULL; - __GLXvisualConfig *pNewVisualConfigs = NULL; - void **glXVisualPriv; - void **pNewVisualPriv; - int found_default; - int i, j, k; - - GLWIN_DEBUG_MSG("init_visuals\n"); - - if (numConfigs > 0) - numNewConfigs = numConfigs; - else - numNewConfigs = NUM_FALLBACK_CONFIGS; - - /* Alloc space for the list of new GLX visuals */ - pNewVisualConfigs = (__GLXvisualConfig *) - __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); - if (!pNewVisualConfigs) { - return FALSE; - } - - /* Alloc space for the list of new GLX visual privates */ - pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); - if (!pNewVisualPriv) { - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* - ** If SetVisualConfigs was not called, then use default GLX - ** visual configs. - */ - if (numConfigs == 0) { - memcpy(pNewVisualConfigs, FallbackConfigs, - NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); - memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); - } - else { - /* copy driver's visual config info */ - for (i = 0; i < numConfigs; i++) { - pNewVisualConfigs[i] = visualConfigs[i]; - pNewVisualPriv[i] = visualPrivates[i]; - } - } - - /* Count the number of RGB and CI visual configs */ - numRGBconfigs = 0; - numCIconfigs = 0; - for (i = 0; i < numNewConfigs; i++) { - if (pNewVisualConfigs[i].rgba) - numRGBconfigs++; - else - numCIconfigs++; - } - - /* Count the total number of visuals to compute */ - numNewVisuals = 0; - for (i = 0; i < numVisuals; i++) { - int count; - - count = ((pVisual[i].class == TrueColor - || pVisual[i].class == DirectColor) - ? numRGBconfigs : numCIconfigs); - if (count == 0) - count = 1; /* preserve the existing visual */ - - numNewVisuals += count; - } - - /* Reset variables for use with the next screen/driver's visual configs */ - visualConfigs = NULL; - numConfigs = 0; - - /* Alloc temp space for the list of orig VisualIDs for each new visual */ - orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); - if (!orig_vid) { - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisuals */ - modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); - if (modes == NULL) { - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisualPrivates */ - glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); - if (!glXVisualPriv) { - _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the new list of the X server's visuals */ - pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); - if (!pVisualNew) { - __glXFree(glXVisualPriv); - _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Initialize the new visuals */ - found_default = FALSE; - glWinScreens[screenInfo.numScreens-1].modes = modes; - for (i = j = 0; i < numVisuals; i++) { - int is_rgb = (pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor); - - if (!is_rgb) - { - /* We don't support non-rgb visuals for GL. But we don't - want to remove them either, so just pass them through - with null glX configs */ - - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & NullConfig ); - modes->visualID = pVisualNew[j].vid; - - j++; - - continue; - } - - for (k = 0; k < numNewConfigs; k++) { - if (pNewVisualConfigs[k].rgba != is_rgb) - continue; - - assert( modes != NULL ); - - /* Initialize the new visual */ - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); - modes->visualID = pVisualNew[j].vid; - - /* - * If the class is -1, then assume the X visual information - * is identical to what GLX needs, and take them from the X - * visual. NOTE: if class != -1, then all other fields MUST - * be initialized. - */ - if (modes->visualType == GLX_NONE) { - modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); - modes->redBits = count_bits(pVisual[i].redMask); - modes->greenBits = count_bits(pVisual[i].greenMask); - modes->blueBits = count_bits(pVisual[i].blueMask); - modes->alphaBits = modes->alphaBits; - modes->redMask = pVisual[i].redMask; - modes->greenMask = pVisual[i].greenMask; - modes->blueMask = pVisual[i].blueMask; - modes->alphaMask = modes->alphaMask; - modes->rgbBits = (is_rgb) - ? (modes->redBits + modes->greenBits + - modes->blueBits + modes->alphaBits) - : rootDepth; - } - - /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pNewVisualPriv[k]; - - j++; - modes = modes->next; - } - } - - assert(j <= numNewVisuals); - - /* Save the GLX visuals in the screen structure */ - glWinScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; - glWinScreens[screenInfo.numScreens-1].priv = glXVisualPriv; - - /* Set up depth's VisualIDs */ - for (i = 0; i < ndepth; i++) { - int numVids = 0; - VisualID *pVids = NULL; - int k, n = 0; - - /* Count the new number of VisualIDs at this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - numVids++; - - /* Allocate a new list of VisualIDs for this depth */ - pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); - - /* Initialize the new list of VisualIDs for this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - pVids[n++] = pVisualNew[k].vid; - - /* Update this depth's list of VisualIDs */ - __glXFree(pdepth[i].vids); - pdepth[i].vids = pVids; - pdepth[i].numVids = numVids; - } - - /* Update the X server's visuals */ - *nvisualp = numNewVisuals; - *visualp = pVisualNew; - - /* Free the old list of the X server's visuals */ - __glXFree(pVisual); - - /* Clean up temporary allocations */ - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - - /* Free the private list created by DDX HW driver */ - if (visualPrivates) - xfree(visualPrivates); - visualPrivates = NULL; - - return TRUE; -} - - -static void fixup_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - glWinScreenRec *pScr = &glWinScreens[screen]; - __GLcontextModes *modes; - int j; - - GLWIN_DEBUG_MSG("fixup_visuals\n"); - - for (modes = pScr->modes; modes != NULL; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - VisualPtr pVis = pScreen->visuals; - - /* Find a visual that matches the GLX visual's class and size */ - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes) { - - /* Fixup the masks */ - modes->redMask = pVis[j].redMask; - modes->greenMask = pVis[j].greenMask; - modes->blueMask = pVis[j].blueMask; - - /* Recalc the sizes */ - modes->redBits = count_bits(modes->redMask); - modes->greenBits = count_bits(modes->greenMask); - modes->blueBits = count_bits(modes->blueMask); - } - } - } -} - -static void init_screen_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - __GLcontextModes *modes; - int *used; - int i, j; - - GLWIN_DEBUG_MSG("init_screen_visuals\n"); - - used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int)); - __glXMemset(used, 0, pScreen->numVisuals * sizeof(int)); - - i = 0; - for ( modes = glWinScreens[screen].modes - ; modes != NULL - ; modes = modes->next) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - for (j = 0; j < pScreen->numVisuals; j++) { - - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes && - pVis[j].redMask == modes->redMask && - pVis[j].greenMask == modes->greenMask && - pVis[j].blueMask == modes->blueMask && - !used[j]) { - -#if 0 - /* Create the XMesa visual */ - pXMesaVisual[i] = - XMesaCreateVisual(pScreen, - pVis, - modes->rgbMode, - (modes->alphaBits > 0), - modes->doubleBufferMode, - modes->stereoMode, - GL_TRUE, /* ximage_flag */ - modes->depthBits, - modes->stencilBits, - modes->accumRedBits, - modes->accumGreenBits, - modes->accumBlueBits, - modes->accumAlphaBits, - modes->samples, - modes->level, - modes->visualRating); -#endif - - /* Set the VisualID */ - modes->visualID = pVis[j].vid; - - /* Mark this visual used */ - used[j] = 1; - break; - } - } - - if ( j == pScreen->numVisuals ) { - ErrorF("No matching visual for __GLcontextMode with " - "visual class = %d (%d), nplanes = %u\n", - vis_class, - modes->visualType, - (modes->rgbBits - modes->alphaBits) ); - } - else if ( modes->visualID == -1 ) { - FatalError( "Matching visual found, but visualID still -1!\n" ); - } - - i++; - - } - - __glXFree(used); - - /* glWinScreens[screen].xm_vis = pXMesaVisual; */ -} - -static Bool glWinScreenProbe(int screen) -{ - ScreenPtr pScreen; - glWinScreenRec *screenPriv; - - GLWIN_DEBUG_MSG("glWinScreenProbe\n"); - - /* - * Set up the current screen's visuals. - */ - __glDDXScreenInfo.modes = glWinScreens[screen].modes; - __glDDXScreenInfo.pVisualPriv = glWinScreens[screen].priv; - __glDDXScreenInfo.numVisuals = - __glDDXScreenInfo.numUsableVisuals = glWinScreens[screen].num_vis; - - /* - * Set the current screen's createContext routine. This could be - * wrapped by a DDX GLX context creation routine. - */ - __glDDXScreenInfo.createContext = glWinCreateContext; - - /* - * The ordering of the rgb compenents might have been changed by the - * driver after mi initialized them. - */ - fixup_visuals(screen); - - /* - * Find the GLX visuals that are supported by this screen and create - * XMesa's visuals. - */ - init_screen_visuals(screen); - - /* Wrap RealizeWindow and UnrealizeWindow on this screen */ - pScreen = screenInfo.screens[screen]; - screenPriv = &glWinScreens[screen]; - screenPriv->RealizeWindow = pScreen->RealizeWindow; - pScreen->RealizeWindow = glWinRealizeWindow; - screenPriv->UnrealizeWindow = pScreen->UnrealizeWindow; - pScreen->UnrealizeWindow = glWinUnrealizeWindow; - screenPriv->CopyWindow = pScreen->CopyWindow; - pScreen->CopyWindow = glWinCopyWindow; - - return TRUE; -} - -static GLboolean glWinSwapBuffers(__GLXdrawablePrivate *glxPriv) -{ - /* swap buffers on only *one* of the contexts - * (e.g. the last one for drawing) - */ - __GLcontext *gc = (__GLcontext *)glxPriv->drawGlxc->gc; - HDC dc; - BOOL ret; - - GLWIN_TRACE_MSG("glWinSwapBuffers (ctx %p)\n", (gc!=NULL?gc->ctx:NULL)); - - if (gc != NULL && gc->ctx != NULL) - { - dc = glWinMakeDC(gc); - if (dc == NULL) - return GL_FALSE; - - ret = SwapBuffers(dc); - if (!ret) - ErrorF("SwapBuffers failed: %s\n", glWinErrorMessage()); - - ReleaseDC(gc->winInfo.hwnd, dc); - if (!ret) - return GL_FALSE; - } - - return GL_TRUE; -} - -static void glWinDestroyDrawablePrivate(__GLdrawablePrivate *glPriv) -{ - GLWIN_DEBUG_MSG("glWinDestroyDrawablePrivate\n"); - - /* It doesn't work to call DRIDestroySurface here, the drawable's - already gone.. But dri.c notices the window destruction and - frees the surface itself. */ - - free(glPriv->private); - glPriv->private = NULL; -} - - -static void glWinCreateBuffer(__GLXdrawablePrivate *glxPriv) -{ - GLWinDrawableRec *winPriv = malloc(sizeof(GLWinDrawableRec)); - __GLdrawablePrivate *glPriv = &glxPriv->glPriv; - - /*winPriv->sid = 0; */ - winPriv->pDraw = NULL; - - GLWIN_DEBUG_MSG("glWinCreateBuffer\n"); - - /* replace swapBuffers (original is never called) */ - glxPriv->swapBuffers = glWinSwapBuffers; - - /* stash private data */ - glPriv->private = winPriv; - glPriv->freePrivate = glWinDestroyDrawablePrivate; -} - -static void glWinResetExtension(void) -{ - GLWIN_DEBUG_MSG("glWinResetExtension\n"); -} - -/* based on code in apples/indirect.c which is based on i830_dri.c */ -static void -glWinInitVisualConfigs(void) -{ - int lclNumConfigs = 0; - __GLXvisualConfig *lclVisualConfigs = NULL; - void **lclVisualPrivates = NULL; - - int depth, aux, buffers, stencil, accum; - int i = 0; - - GLWIN_DEBUG_MSG("glWinInitVisualConfigs "); - - /* count num configs: - 2 Z buffer (0, 24 bit) - 2 AUX buffer (0, 2) - 2 buffers (single, double) - 2 stencil (0, 8 bit) - 2 accum (0, 64 bit) - = 32 configs */ - - lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */ - - /* alloc */ - lclVisualConfigs = xcalloc(sizeof(__GLXvisualConfig), lclNumConfigs); - lclVisualPrivates = xcalloc(sizeof(void *), lclNumConfigs); - - /* fill in configs */ - if (NULL != lclVisualConfigs) { - i = 0; /* current buffer */ - for (depth = 0; depth < 2; depth++) { - for (aux = 0; aux < 2; aux++) { - for (buffers = 0; buffers < 2; buffers++) { - for (stencil = 0; stencil < 2; stencil++) { - for (accum = 0; accum < 2; accum++) { - lclVisualConfigs[i].vid = -1; - lclVisualConfigs[i].class = -1; - lclVisualConfigs[i].rgba = TRUE; - lclVisualConfigs[i].redSize = -1; - lclVisualConfigs[i].greenSize = -1; - lclVisualConfigs[i].blueSize = -1; - lclVisualConfigs[i].redMask = -1; - lclVisualConfigs[i].greenMask = -1; - lclVisualConfigs[i].blueMask = -1; - lclVisualConfigs[i].alphaMask = 0; - if (accum) { - lclVisualConfigs[i].accumRedSize = 16; - lclVisualConfigs[i].accumGreenSize = 16; - lclVisualConfigs[i].accumBlueSize = 16; - lclVisualConfigs[i].accumAlphaSize = 16; - } - else { - lclVisualConfigs[i].accumRedSize = 0; - lclVisualConfigs[i].accumGreenSize = 0; - lclVisualConfigs[i].accumBlueSize = 0; - lclVisualConfigs[i].accumAlphaSize = 0; - } - lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE; - lclVisualConfigs[i].stereo = FALSE; - lclVisualConfigs[i].bufferSize = -1; - - lclVisualConfigs[i].depthSize = depth? 24 : 0; - lclVisualConfigs[i].stencilSize = stencil ? 8 : 0; - lclVisualConfigs[i].auxBuffers = aux ? 2 : 0; - lclVisualConfigs[i].level = 0; - lclVisualConfigs[i].visualRating = GLX_NONE_EXT; - lclVisualConfigs[i].transparentPixel = 0; - lclVisualConfigs[i].transparentRed = 0; - lclVisualConfigs[i].transparentGreen = 0; - lclVisualConfigs[i].transparentBlue = 0; - lclVisualConfigs[i].transparentAlpha = 0; - lclVisualConfigs[i].transparentIndex = 0; - i++; - } - } - } - } - } - } - if (i != lclNumConfigs) - GLWIN_DEBUG_MSG("glWinInitVisualConfigs failed to alloc visual configs"); - - GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates); -} - -/* Copied from Mesa */ -static void glWinSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates) -{ - GLWIN_DEBUG_MSG("glWinSetVisualConfigs\n"); - - numConfigs = nconfigs; - visualConfigs = configs; - visualPrivates = privates; -} - -/* Copied from Mesa */ -static Bool glWinInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB) -{ - glWinInitDebugSettings(); - - GLWIN_DEBUG_MSG("glWinInitVisuals\n"); - - if (0 == numConfigs) /* if no configs */ - glWinInitVisualConfigs(); /* ensure the visula configs are setup */ - - /* - * Setup the visuals supported by this particular screen. - */ - return init_visuals(nvisualp, visualp, defaultVisp, - *ndepthp, *depthp, *rootDepthp); -} |
