summaryrefslogtreecommitdiff
path: root/src/mesa/glapi/glapi.c
AgeCommit message (Collapse)Author
2009-02-26mesa: Resurrect SPARC asm code.David S. Miller
This rewrites the sparc GLAPI code so that it's PIC friendly and works with all of the TLS/PTHREADS/64-bit/32-bit combinations properly. As a result we can turn SPARC asm back on. Currently it's only enabled on Linux, as that's the only place where I can test this stuff out. For the moment the cliptest SPARC asm routines are disabled as they are non-working. The problem is that they use register %g7 as a temporary which is where the threading libraries store the thread pointer on SPARC. I will fix that code up in a future change as it's a pretty important routine to optimize. Like x86 we do the runtime patch as a pthread once-invoked initializer in init_glapi_relocs(). Unlike x86, however, our GLAPI stubs on SPARC are just two instruction sequences that branch to a trampoline and put the GLAPI offset into a register. The trampoline is what we run-time patch. The stubs thus all look like: glFoo: ba __glapi_sparc_foo_stub sethi GLAPI_OFFSET(glFOO) * PTR_SIZE, %g3 This actually makes generate_entrypoint() a lot simpler on SPARC. For this case in generate_entrypoint() we generate stubs using a 'call' instead of the 'ba' above to make sure it can reach. In order to get a proper tail call going here, in the unpatched case, we do several tricks. To get the current PC, for example, we save the return address register into a temporary, do a call, save the return address register written by the call to another temporary, then restore the original return address register value. This is to avoid having to allocate a stack frame. This is necessary for PIC address formation. This new GLAPI scheme lets us get rid of the ugly SPARC GLAPI hacks in __glXInitialize() and one_time_init(). Signed-off-by: David S. Miller <davem@davemloft.net>
2009-02-22mesa: move a bunch of compiler-related stuff into new compiler.h headerBrian Paul
This trims down and cleans up imports.h and glheader.h quite a bit.
2008-10-10Merge commit 'origin/master' into gallium-0.2Keith Whitwell
Conflicts: src/mesa/glapi/descrip.mms src/mesa/shader/grammar/descrip.mms
2008-09-27glapi: add DISPATCH_FUNCTION_SIZETobias Jakobi
2008-09-27glapi: add gl_dispatch_functions_start and endTobias Jakobi
2008-09-23mesa: refactor: move GetProcAddress code from glapi.c into new ↵Brian Paul
glapi_getproc.c file
2008-09-21Merge branch 'master' into gallium-0.2Keith Whitwell
Conflicts: include/GLES/egl.h include/GLES/egltypes.h src/egl/main/eglconfig.c src/egl/main/eglconfig.h src/glu/sgi/libnurbs/interface/bezierEval.h src/glu/sgi/libnurbs/interface/bezierPatch.h src/glu/sgi/libnurbs/interface/bezierPatchMesh.h src/glu/sgi/libnurbs/internals/dataTransform.h src/glu/sgi/libnurbs/internals/displaymode.h src/glu/sgi/libnurbs/internals/sorter.h src/glu/sgi/libnurbs/nurbtess/definitions.h src/glu/sgi/libnurbs/nurbtess/directedLine.h src/glu/sgi/libnurbs/nurbtess/gridWrap.h src/glu/sgi/libnurbs/nurbtess/monoChain.h src/glu/sgi/libnurbs/nurbtess/monoPolyPart.h src/glu/sgi/libnurbs/nurbtess/monoTriangulation.h src/glu/sgi/libnurbs/nurbtess/partitionX.h src/glu/sgi/libnurbs/nurbtess/partitionY.h src/glu/sgi/libnurbs/nurbtess/polyDBG.h src/glu/sgi/libnurbs/nurbtess/polyUtil.h src/glu/sgi/libnurbs/nurbtess/primitiveStream.h src/glu/sgi/libnurbs/nurbtess/quicksort.h src/glu/sgi/libnurbs/nurbtess/rectBlock.h src/glu/sgi/libnurbs/nurbtess/sampleComp.h src/glu/sgi/libnurbs/nurbtess/sampleCompBot.h src/glu/sgi/libnurbs/nurbtess/sampleCompRight.h src/glu/sgi/libnurbs/nurbtess/sampleCompTop.h src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.h src/glu/sgi/libnurbs/nurbtess/sampledLine.h src/glu/sgi/libnurbs/nurbtess/searchTree.h src/glu/sgi/libnurbs/nurbtess/zlassert.h src/glu/sgi/libutil/error.c src/glu/sgi/libutil/glue.c src/glu/sgi/libutil/gluint.h src/glu/sgi/libutil/project.c src/glu/sgi/libutil/registry.c src/glx/x11/Makefile src/glx/x11/glxclient.h src/glx/x11/glxext.c src/mesa/drivers/dri/ffb/ffb_dd.h src/mesa/drivers/dri/ffb/ffb_points.h src/mesa/drivers/dri/gamma/gamma_context.h src/mesa/drivers/dri/gamma/gamma_macros.h src/mesa/drivers/dri/i810/i810context.h src/mesa/drivers/dri/r128/r128_dd.h src/mesa/drivers/dri/r128/r128_tex.h src/mesa/drivers/dri/tdfx/tdfx_dd.h src/mesa/drivers/x11/xm_buffer.c src/mesa/glapi/glapi.c src/mesa/main/dispatch.c src/mesa/main/state.c src/mesa/main/texstate.c src/mesa/shader/arbprogparse.c src/mesa/shader/arbprogram.c src/mesa/shader/nvfragparse.c src/mesa/shader/nvprogram.c src/mesa/shader/shader_api.c src/mesa/sources src/mesa/swrast/s_aaline.c src/mesa/swrast/s_aaline.h src/mesa/swrast/s_aatriangle.h src/mesa/swrast/s_accum.c src/mesa/swrast/s_alpha.h src/mesa/swrast/s_bitmap.c src/mesa/swrast/s_blend.h src/mesa/swrast/s_context.c src/mesa/swrast/s_copypix.c src/mesa/swrast/s_depth.c src/mesa/swrast/s_depth.h src/mesa/swrast/s_drawpix.c src/mesa/swrast/s_drawpix.h src/mesa/swrast/s_feedback.c src/mesa/swrast/s_feedback.h src/mesa/swrast/s_fog.h src/mesa/swrast/s_lines.h src/mesa/swrast/s_logic.h src/mesa/swrast/s_masking.h src/mesa/swrast/s_points.c src/mesa/swrast/s_points.h src/mesa/swrast/s_readpix.c src/mesa/swrast/s_span.c src/mesa/swrast/s_span.h src/mesa/swrast/s_stencil.h src/mesa/swrast/s_texcombine.c src/mesa/swrast/s_texcombine.h src/mesa/swrast/s_texfilter.c src/mesa/swrast/s_texfilter.h src/mesa/swrast/s_texstore.c src/mesa/swrast/s_triangle.c src/mesa/swrast/s_triangle.h src/mesa/swrast/s_zoom.h src/mesa/swrast_setup/ss_context.c src/mesa/swrast_setup/ss_triangle.h src/mesa/tnl/t_draw.c src/mesa/tnl/t_vb_light.c src/mesa/tnl/t_vertex_generic.c src/mesa/tnl/t_vertex_sse.c src/mesa/tnl/t_vp_build.h src/mesa/tnl/tnl.h src/mesa/x86/common_x86.c
2008-09-18mesa: prefix a bunch of #include lines with "main/".Brian Paul
This is another step toward removing a whole bunch of -I flags from the cc commands. Still need to address driver code...
2008-09-11tree buildsAlan Hourihane
2008-09-11Merge branch 'gallium-0.1' into gallium-0.2Keith Whitwell
A first attempt at moving gallium onto a branch directly off master... It will be interesting to see how much work this takes to get running. Have resolved the conflicts semi-arbitarily, not compiled or tested. Conflicts: .gitignore Makefile configs/config.mgw configs/darwin configs/darwin-x86ppc configs/default configs/freebsd-dri configs/linux-dri configs/linux-dri-xcb configs/linux-fbdev configs/linux-static configs/linux-x86-64-static configs/linux-x86-static doxygen/Makefile include/GL/gl.h progs/demos/Makefile progs/demos/descrip.mms progs/demos/texenv.c progs/egl/.gitignore progs/egl/Makefile progs/glsl/.gitignore progs/glsl/Makefile progs/glsl/convolutions.c progs/samples/Makefile.mgw progs/tests/.gitignore progs/trivial/.gitignore progs/trivial/point-param.c progs/trivial/tri.c progs/xdemos/.gitignore progs/xdemos/glthreads.c src/egl/drivers/demo/Makefile src/egl/drivers/dri/Makefile src/egl/main/Makefile src/glu/Makefile src/glu/sgi/Makefile src/glu/sgi/Makefile.mgw src/glut/glx/Makefile.mgw src/glut/os2/WarpWin.cpp src/glut/os2/glut_cindex.cpp src/glut/os2/glut_gamemode.cpp src/glut/os2/glut_win.cpp src/glut/os2/glut_winmisc.cpp src/glut/os2/os2_glx.cpp src/glut/os2/os2_menu.cpp src/glut/os2/os2_winproc.cpp src/glw/Makefile src/glx/x11/dri_glx.c src/glx/x11/glxext.c src/mesa/Makefile src/mesa/Makefile.mgw src/mesa/descrip.mms src/mesa/drivers/beos/Makefile src/mesa/drivers/common/descrip.mms src/mesa/drivers/common/driverfuncs.c src/mesa/drivers/directfb/Makefile src/mesa/drivers/dri/Makefile.template src/mesa/drivers/dri/common/dri_bufmgr.c src/mesa/drivers/dri/common/dri_bufmgr.h src/mesa/drivers/dri/common/dri_util.c src/mesa/drivers/dri/common/extension_helper.h src/mesa/drivers/dri/common/mmio.h src/mesa/drivers/dri/common/utils.c src/mesa/drivers/dri/common/utils.h src/mesa/drivers/dri/glcore/Makefile src/mesa/drivers/dri/i810/i810screen.c src/mesa/drivers/dri/i915/intel_ioctl.c src/mesa/drivers/dri/i915/intel_ioctl.h src/mesa/drivers/dri/i915/intel_screen.c src/mesa/drivers/dri/i915/server/i830_common.h src/mesa/drivers/dri/i915/server/i830_dri.h src/mesa/drivers/dri/i965/intel_screen.c src/mesa/drivers/dri/i965/server/i830_common.h src/mesa/drivers/dri/i965/server/i830_dri.h src/mesa/drivers/dri/mach64/mach64_screen.c src/mesa/drivers/dri/nouveau/nouveau_context.h src/mesa/drivers/dri/nouveau/nouveau_fifo.c src/mesa/drivers/dri/nouveau/nouveau_fifo.h src/mesa/drivers/dri/nouveau/nouveau_screen.c src/mesa/drivers/dri/nouveau/nouveau_screen.h src/mesa/drivers/dri/r128/r128_tex.h src/mesa/drivers/dri/savage/savageioctl.h src/mesa/drivers/fbdev/Makefile src/mesa/drivers/osmesa/Makefile src/mesa/drivers/osmesa/descrip.mms src/mesa/drivers/x11/Makefile src/mesa/drivers/x11/descrip.mms src/mesa/drivers/x11/xm_dd.c src/mesa/glapi/glapi.c src/mesa/glapi/glthread.c src/mesa/main/api_validate.c src/mesa/main/attrib.c src/mesa/main/bufferobj.c src/mesa/main/bufferobj.h src/mesa/main/buffers.c src/mesa/main/config.h src/mesa/main/context.c src/mesa/main/descrip.mms src/mesa/main/drawpix.c src/mesa/main/enums.c src/mesa/main/fbobject.c src/mesa/main/glheader.h src/mesa/main/imports.c src/mesa/main/mipmap.c src/mesa/main/mm.c src/mesa/main/mm.h src/mesa/main/mtypes.h src/mesa/main/points.c src/mesa/main/sources src/mesa/main/state.c src/mesa/main/texcompress_fxt1.c src/mesa/main/texenvprogram.c src/mesa/main/texobj.c src/mesa/main/texstate.c src/mesa/main/texstore.c src/mesa/math/descrip.mms src/mesa/shader/arbprogram.c src/mesa/shader/descrip.mms src/mesa/shader/prog_execute.c src/mesa/shader/prog_statevars.c src/mesa/shader/prog_statevars.h src/mesa/shader/prog_uniform.c src/mesa/shader/program.c src/mesa/shader/program.h src/mesa/shader/shader_api.c src/mesa/shader/slang/descrip.mms src/mesa/shader/slang/library/slang_vertex_builtin_gc.h src/mesa/sources src/mesa/swrast/descrip.mms src/mesa/swrast/s_drawpix.c src/mesa/swrast/s_fragprog.c src/mesa/swrast/s_readpix.c src/mesa/swrast/s_span.c src/mesa/swrast_setup/descrip.mms src/mesa/tnl/descrip.mms src/mesa/tnl/t_context.h src/mesa/tnl/t_vp_build.c src/mesa/tnl/tnl.h src/mesa/vbo/descrip.mms src/mesa/vbo/vbo_context.c src/mesa/vbo/vbo_exec_array.c src/mesa/x86-64/xform4.S src/mesa/x86/rtasm/x86sse.c src/mesa/x86/rtasm/x86sse.h windows/VC6/progs/glut/glut.dsp windows/VC7/mesa/gdi/gdi.vcproj windows/VC7/mesa/glu/glu.vcproj windows/VC7/mesa/mesa.sln windows/VC7/mesa/mesa/mesa.vcproj windows/VC7/mesa/osmesa/osmesa.vcproj windows/VC7/progs/glut/glut.vcproj windows/VC8/mesa/gdi/gdi.vcproj windows/VC8/mesa/glu/glu.vcproj windows/VC8/mesa/mesa.sln windows/VC8/mesa/mesa/mesa.vcproj windows/VC8/progs/glut/glut.vcproj
2008-07-24mesa: Prefix main includes with dir to avoid conflicts.José Fonseca
Some of the headers in src/mesa/main have pretty common names which easily conflict with third-party code, e.g. config.h
2008-07-09mesa: return -1, not GL_FALSE if _glapi_add_dispatch() fails name sanity checkBrian Paul
2008-07-02Bring over commit 8d4d0b47a07a298a20ffae9fefe96c8c7ca9dccc from xserver treePaulo Cesar Pereira de Andrade
2008-06-24mesa: No getenv on WinCE.José Fonseca
2008-06-18mesa: refactor: move GetProcAddress code from glapi.c into new ↵Brian Paul
glapi_getproc.c file
2008-05-21Make the shared glapi files not include glheader.h.Kristian Høgsberg
2008-04-23glcore: build from mesaGeorge Sapountzis
2007-06-12Fix TEXREL issues when using GLX_USE_TLS (see bug 7459).Brian
2007-04-02Call _glapi_set_context(NULL) in _glapi_check_multithread() to make sure the ↵Brian
_glapi_Context global gets cleared properly.
2007-02-20Delete two invalid assertions.Ian Romanick
These two assertions are invalid for a couple reasons. Primarily, when this code is compiled into the X-server, the symbols "glSecondaryColor3fEXT" and "glPointParameterivNV" do not exist.
2006-10-13Fix dumb build errors.Ian Romanick
I always build with -DGLX_USE_TLS, so I never hit these paths. glapi.h is required in some places because _glapi_Dispatch is declared there, but _glapi_tls_Dispatch is declared in glthread.h.
2006-10-12remove some debug code invalidated by prev check-inBrian Paul
2006-10-11Fix bug #4681.Ian Romanick
glDeleteTextures and glDeleteTexturesEXT were erroneously listed as aliases of each other. For anything /except/ GLX protocol they are aliases. This set of changes allows functions that are functionally identical but have different GLX protocol to be listed as aliases. When building with GLX_INDIRECT_RENDERING set, different static functions are used. These functions determine whether the current context is direct rendering or not. If the context is direct rendering, the aliased function (e.g., glDeleteTextures in the case of glDeleteTexturesEXT) is called. If the context is not direct rendering, the correct GLX protocol is sent. For a deeper explanation of what is changed, please see: http://dri.freedesktop.org/wiki/PartiallyAliasedFunctions
2006-08-29remove assertion that referenced &glSetFenceNV for debug testBrian Paul
2006-08-22The TLS dispatch functions for x86-64 are fixed-size, just like onIan Romanick
x86. This means that the position of each dispatch function can be calculated as (dispatch_offset * size_of_function) + glNewList. This allows us to not store the function pointers in glprocs_table_t. This same optimization has been done for quite some time on x86. We could probably also do this for some cases of the SPARC dispatch as well.
2006-08-22Add new attribute called static_dispatch to the <function> element. ThisIan Romanick
boolean attribute, which defaults to true, determines whether or not a static dispatch function is available in libGL for applications to link against. Ideally, any new functions that are not part of the ABI should not have directly accessable dispatch functions. This forces applications to use glXGetProcAddress to access these functions. By doing this we can gracefully remove functions from libGL without breaking the linkage of applications. Note that the static dispatch functions are still generated. However, they are given names like gl_dispatch_stub_820 and are marked with the "hidden" linker attribute. All extension functions added since the previous Mesa release (6.5) have been marked as 'static_dispatch="false"'.
2006-06-16Thread safety for Win32. SourceForge bug #1507315.Brian Paul
2006-04-13added 'const' (Dan Schikore)Brian Paul
2006-03-29Fixes to silence warnings in code generated by glapi scripts.Kristian Høgsberg
2006-03-15assorted code clean-ups, comments, etc.Brian Paul
2006-03-15remove invalid assertion in _glapi_get_dispatch(), fixes additional thread ↵Brian Paul
safety problem
2006-03-15Need to include glthread.h in glapi.h, not glapi.c so that GET_CURRENT_CONTEXTBrian Paul
is properly defined. Fixes long-standing, but unnoticed thread safety failure. Also, updated comments.
2006-02-10commit to fixup MGL namespacing for XGLDave Airlie
2005-10-11ifdef out some code to make glapi.c linkable in libglx.so (on theIan Romanick
server). This isn't strictly needed yet, but it doesn't hurt anything either. However, the patches for fd.o bug #2996 require this to build.
2005-08-10Remove _glapi_check_multithread from the interface exported by the loader toIan Romanick
the driver. The loader now takes care of this for the driver. Remove _glapi_DispatchTSD and give _glapi_Dispatch its semantic (i.e., having a NULL value means that the application is multithreaded and _glapi_get_dispatch must be called). Gut all of the dispatch override code. This removes _glapi_RealDispatch, _glapi_tls_RealDispatch, _glapi_begin_dispatch_override, _glapi_end_dispatch_override, and _glapi_get_override_dispatch. Remove _glapi_get_proc_address, _glapi_get_proc_name, _glapi_get_version, and _glapi_check_table from the loader / driver interface. Reviewed by: Brian Paul
2005-07-28Major rip-up of internal function insertion interface. The oldIan Romanick
_glapi_add_entrypoint has been replaced by a new routine called _glapi_add_dispatch. This new routine dynamically assignes dispatch offsets to functions added. This allows IHVs to add support for extension functions that do not have assigned dispatch offsets. It also means that a driver has no idea what offset will be assigned to a function. The vast majority of the changes in this commit account for that. An additional table, driDispatchRemapTable, is added. Functions not in the Linux OpenGL ABI (i.e., anything not in GL 1.2 + ARB_multitexture) has a fixed offset in this new table. The entry in this table specifies the offset in of the function in the real dispatch table. The internal interface was also bumped from version 20050725 to 20050727. This has been tested with various programs in progs/demos on: radeon (Radeon Mobility M6) r128 (Rage 128 Pro) mga (G400)
2005-07-28Fix SPARC assembly for 64-bitIan Romanick
- The test for whether or not we're building for 64-bit is '#ifdef __arch64__'. This appears to be correct on both Linux and Solaris. - The test for Solaris is now '#if defined(SVR4) || defined(__SVR4) || defined(__svr4__)'. GCC 3.4.0 has all three defined on Solaris 9. - Enables assembly language clip routines. - Fixes to make GLSL code build on Solaris. - Update gl_SPARC_asm.py.
2005-04-28Stop gcc-4.0 complaining about "type qualifiers ignored on functionKeith Whitwell
return type".
2005-04-15Reverted the last change back to fix bug 3035Ben Crossman
2005-04-14A few getenv() that werent using the mesa wrapper versionBen Crossman
2005-04-13Add TLS support to libGL and, by virtue of using glthread.h and GL_CALL, allIan Romanick
DRI drivers. A TLS enabled libGL can load a TLS or a non-TLS DRI driver, but a TLS DRI driver requires a TLS enabled libGL. This fixes bug #1822.
2004-12-15_glapi_* is effectively PUBLIC API for the DRI drivers.Adam Jackson
2004-12-03silence a variety of warnings found with g++ 3.4.2Brian Paul
2004-11-27make get_static_proc_address() return a _glapi_procBrian Paul
2004-11-27Use new _glapi_proc typedef instead of void * for function pointers.Brian Paul
Misc clean-ups in glapi.c
2004-11-22applied SPARC patch (freedesktop bug 1898)Brian Paul
2004-11-05shorter error messages when calling a GL function without a bound context ↵Brian Paul
(FDO bug 1775)
2004-08-25Silence gcc 3.4 warnings on ReactOS. Mostly unused var warnings. (patch ↵Brian Paul
1015696)
2004-07-06correct X86_DISPATCH_FUNCTION_SIZE if THREADS is definedRoland Scheidegger
2004-07-05Fix typos in comments.Ian Romanick