summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Cristau <[email protected]>2009-12-29 10:16:21 +0000
committerJulien Cristau <[email protected]>2009-12-29 10:16:21 +0000
commit7030b61d99bb557e3a498b43684f13c3a6b6e9ce (patch)
treebd988c677d68166dd6ee6adc62cc9831b5a86acf
parent7f8952d242c0cda6840bb7a2975fd27ec6740dd8 (diff)
parentda876fa3a5df77763fe106b5e0a17b2e672a506c (diff)
Merge branch 'mesa_7_6_branch' of git://anongit.freedesktop.org/mesa/mesa into debian-unstable
Conflicts: progs/tests/bug_texstore_i8.c progs/tests/crossbar.c progs/tests/cva.c progs/tests/fptest1.c progs/tests/invert.c progs/tests/packedpixels.c progs/tests/quads.c progs/tests/scissor-viewport.c progs/tests/scissor.c progs/tests/stencilwrap.c progs/tests/tex1d.c progs/tests/texcomp_image.h progs/tests/unfilledclip.c progs/tests/vpeval.c progs/trivial/clear-fbo-tex.c progs/trivial/createwin.c progs/trivial/dlist-begin-call-end.c progs/trivial/draw2arrays.c progs/trivial/drawarrays.c progs/trivial/tri-blend-max.c progs/trivial/tri-blend-min.c progs/trivial/tri-blend-revsub.c progs/trivial/tri-blend-sub.c progs/trivial/tri-blend.c progs/trivial/tri-fbo-tex.c progs/trivial/tri-fp.c progs/trivial/tri-logicop-none.c progs/trivial/tri-logicop-xor.c progs/trivial/tri-z.c progs/trivial/vbo-drawarrays.c progs/trivial/vbo-noninterleaved.c scons/gallium.py scons/generic.py
-rwxr-xr-xbin/mklib20
-rw-r--r--configs/darwin6
-rw-r--r--configure.ac3
-rw-r--r--docs/news.html2
-rw-r--r--docs/relnotes-7.6.1.html13
-rw-r--r--progs/demos/geartrain.c21
-rw-r--r--progs/demos/isosurf.c8
-rw-r--r--progs/demos/morph3d.c2
-rw-r--r--progs/demos/terrain.c5
-rw-r--r--progs/demos/textures.c2
-rw-r--r--progs/glsl/shtest.c2
-rw-r--r--progs/glsl/texaaline.c4
-rw-r--r--progs/redbook/aaindex.c8
-rw-r--r--progs/redbook/aapoly.c8
-rw-r--r--progs/redbook/aargb.c8
-rw-r--r--progs/redbook/accanti.c8
-rw-r--r--progs/redbook/accpersp.c14
-rw-r--r--progs/redbook/alpha.c6
-rw-r--r--progs/redbook/alpha3D.c8
-rw-r--r--progs/redbook/anti.c6
-rw-r--r--progs/redbook/bezcurve.c8
-rw-r--r--progs/redbook/bezmesh.c8
-rw-r--r--progs/redbook/checker.c8
-rw-r--r--progs/redbook/clip.c8
-rw-r--r--progs/redbook/colormat.c10
-rw-r--r--progs/redbook/cube.c8
-rw-r--r--progs/redbook/depthcue.c6
-rw-r--r--progs/redbook/dof.c12
-rw-r--r--progs/redbook/double.c12
-rw-r--r--progs/redbook/drawf.c8
-rw-r--r--progs/redbook/feedback.c14
-rw-r--r--progs/redbook/fog.c10
-rw-r--r--progs/redbook/fogindex.c6
-rw-r--r--progs/redbook/font.c12
-rw-r--r--progs/redbook/hello.c4
-rw-r--r--progs/redbook/image.c12
-rw-r--r--progs/redbook/light.c8
-rw-r--r--progs/redbook/lines.c8
-rw-r--r--progs/redbook/list.c6
-rw-r--r--progs/redbook/material.c6
-rw-r--r--progs/redbook/mipmap.c8
-rw-r--r--progs/redbook/model.c10
-rw-r--r--progs/redbook/movelight.c10
-rw-r--r--progs/redbook/nurbs.c6
-rw-r--r--progs/redbook/pickdepth.c12
-rw-r--r--progs/redbook/picksquare.c14
-rw-r--r--progs/redbook/plane.c8
-rw-r--r--progs/redbook/planet.c8
-rw-r--r--progs/redbook/polyoff.c25
-rw-r--r--progs/redbook/polys.c4
-rw-r--r--progs/redbook/quadric.c10
-rw-r--r--progs/redbook/robot.c8
-rw-r--r--progs/redbook/sccolorlight.c6
-rw-r--r--progs/redbook/scene.c6
-rw-r--r--progs/redbook/scenebamb.c6
-rw-r--r--progs/redbook/sceneflat.c6
-rw-r--r--progs/redbook/select.c18
-rw-r--r--progs/redbook/smooth.c10
-rw-r--r--progs/redbook/stencil.c6
-rw-r--r--progs/redbook/stroke.c8
-rw-r--r--progs/redbook/surface.c14
-rw-r--r--progs/redbook/teaambient.c6
-rw-r--r--progs/redbook/teapots.c8
-rw-r--r--progs/redbook/tess.c18
-rw-r--r--progs/redbook/tesswind.c18
-rw-r--r--progs/redbook/texbind.c10
-rw-r--r--progs/redbook/texgen.c10
-rw-r--r--progs/redbook/texprox.c6
-rw-r--r--progs/redbook/texsub.c10
-rw-r--r--progs/redbook/texturesurf.c8
-rw-r--r--progs/redbook/torus.c6
-rw-r--r--progs/redbook/trim.c12
-rw-r--r--progs/redbook/unproject.c8
-rw-r--r--progs/redbook/varray.c14
-rw-r--r--progs/redbook/wrap.c10
-rw-r--r--progs/util/readtex.c20
-rw-r--r--progs/xdemos/corender.c2
-rw-r--r--progs/xdemos/glxinfo.c4
-rw-r--r--src/gallium/auxiliary/rbug/rbug_context.h2
-rw-r--r--src/gallium/auxiliary/rbug/rbug_proto.h2
-rw-r--r--src/gallium/auxiliary/util/u_clear.h2
-rw-r--r--src/gallium/auxiliary/util/u_debug.c6
-rw-r--r--src/gallium/auxiliary/util/u_format.h2
-rw-r--r--src/gallium/auxiliary/util/u_network.c6
-rw-r--r--src/gallium/auxiliary/util/u_network.h2
-rw-r--r--src/gallium/auxiliary/util/u_stream_stdc.c2
-rw-r--r--src/gallium/drivers/i915simple/i915_state.c6
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_blend.c3
-rw-r--r--src/gallium/drivers/trace/tr_dump.c4
-rw-r--r--src/gallium/drivers/trace/tr_rbug.c6
-rw-r--r--src/gallium/state_trackers/egl/egl_surface.c4
-rw-r--r--src/gallium/state_trackers/vega/arc.c6
-rw-r--r--src/gallium/state_trackers/vega/bezier.c7
-rw-r--r--src/gallium/state_trackers/vega/vg_context.c3
-rw-r--r--src/gallium/state_trackers/xorg/xorg_crtc.c10
-rw-r--r--src/gallium/state_trackers/xorg/xorg_driver.c10
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_drm_api.c1
-rw-r--r--src/gallium/winsys/xlib/Makefile8
-rw-r--r--src/gallium/winsys/xlib/xlib_brw_context.c4
-rw-r--r--src/glu/sgi/libnurbs/internals/arcsorter.h1
-rw-r--r--src/glu/sgi/libnurbs/internals/subdivider.cc6
-rw-r--r--src/glu/sgi/libnurbs/nurbtess/directedLine.cc2
-rw-r--r--src/glu/sgi/libnurbs/nurbtess/partitionY.cc4
-rw-r--r--src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc4
-rw-r--r--src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc4
-rw-r--r--src/glut/glx/glut_menu.c5
-rw-r--r--src/glx/x11/dri2.c4
-rw-r--r--src/glx/x11/glxext.c5
-rw-r--r--src/glx/x11/xf86dri.h4
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c2
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_tris.c2
-rw-r--r--src/mesa/drivers/dri/i810/i810tris.c3
-rw-r--r--src/mesa/drivers/dri/i915/i915_program.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_disasm.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu_emit.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffers.c11
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_bitmap.c1
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_tris.c3
-rw-r--r--src/mesa/drivers/dri/mga/mgatris.c3
-rw-r--r--src/mesa/drivers/dri/r128/r128_tris.c3
-rw-r--r--src/mesa/drivers/dri/r200/Makefile2
l---------src/mesa/drivers/dri/r200/radeon_bo.c1
l---------src/mesa/drivers/dri/r200/radeon_bo_int_drm.h1
l---------src/mesa/drivers/dri/r200/radeon_cs.c1
l---------src/mesa/drivers/dri/r200/radeon_cs_int_drm.h1
-rw-r--r--src/mesa/drivers/dri/r300/Makefile2
l---------src/mesa/drivers/dri/r300/radeon_bo.c1
l---------src/mesa/drivers/dri/r300/radeon_bo_int_drm.h1
l---------src/mesa/drivers/dri/r300/radeon_cs.c1
l---------src/mesa/drivers/dri/r300/radeon_cs_int_drm.h1
-rw-r--r--src/mesa/drivers/dri/r600/Makefile2
-rw-r--r--src/mesa/drivers/dri/r600/r600_cmdbuf.c216
-rw-r--r--src/mesa/drivers/dri/r600/r600_cmdbuf.h16
-rw-r--r--src/mesa/drivers/dri/r600/r700_state.c13
l---------src/mesa/drivers/dri/r600/radeon_bo.c1
l---------src/mesa/drivers/dri/r600/radeon_bo_int_drm.h1
l---------src/mesa/drivers/dri/r600/radeon_cs.c1
l---------src/mesa/drivers/dri/r600/radeon_cs_int_drm.h1
-rw-r--r--src/mesa/drivers/dri/radeon/Makefile2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_bo.c110
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_bo_drm.h198
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_bo_int_drm.h45
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_bo_legacy.c83
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h3
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common_context.h3
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_cs.c95
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_cs_drm.h215
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_cs_int_drm.h66
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_cs_legacy.c72
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_cs_space_drm.c66
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_dma.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_span.c3
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c4
-rw-r--r--src/mesa/drivers/dri/savage/savageioctl.c2
-rw-r--r--src/mesa/drivers/dri/savage/savagetris.c3
-rw-r--r--src/mesa/drivers/dri/sis/sis_clear.c1
-rw-r--r--src/mesa/drivers/dri/sis/sis_tris.c3
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.c3
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c2
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tris.c3
-rw-r--r--src/mesa/main/compiler.h5
-rw-r--r--src/mesa/main/dlopen.c14
-rw-r--r--src/mesa/main/mtypes.h2
-rw-r--r--src/mesa/main/version.h2
-rw-r--r--src/mesa/shader/lex.yy.c4
-rw-r--r--src/mesa/shader/program_lexer.l4
-rw-r--r--src/mesa/shader/slang/slang_codegen.c2
-rw-r--r--src/mesa/shader/slang/slang_compile.c24
-rw-r--r--src/mesa/shader/slang/slang_compile_operation.c2
-rw-r--r--src/mesa/state_tracker/st_atom.c8
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c2
-rw-r--r--src/mesa/state_tracker/st_draw.c4
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c3
-rw-r--r--src/mesa/swrast/s_atifragshader.c2
-rw-r--r--src/mesa/swrast/s_triangle.c6
-rw-r--r--src/mesa/swrast_setup/ss_tritmp.h6
-rw-r--r--src/mesa/tnl_dd/t_dd_dmatmp.h9
-rw-r--r--src/mesa/tnl_dd/t_dd_dmatmp2.h11
-rw-r--r--src/mesa/tnl_dd/t_dd_tritmp.h4
-rw-r--r--src/mesa/vbo/vbo_exec_array.c2
-rw-r--r--src/mesa/x86/rtasm/x86sse.c2
181 files changed, 1219 insertions, 1014 deletions
diff --git a/bin/mklib b/bin/mklib
index db97087c0a6..3bec160b40c 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -724,22 +724,10 @@ case $ARCH in
# examine first object to determine ABI
set ${OBJECTS}
- ABI_PPC=`file $1 | grep ' ppc'`
- ABI_I386=`file $1 | grep ' i386'`
- ABI_PPC64=`file $1 | grep ' ppc64'`
- ABI_X86_64=`file $1 | grep ' x86_64'`
- if [ "${ABI_PPC}" ] ; then
- OPTS="${OPTS} -arch ppc"
- fi
- if [ "${ABI_I386}" ] ; then
- OPTS="${OPTS} -arch i386"
- fi
- if [ "${ABI_PPC64}" ] ; then
- OPTS="${OPTS} -arch ppc64"
- fi
- if [ "${ABI_X86_64}" ] ; then
- OPTS="${OPTS} -arch x86_64"
- fi
+ ABIS=`lipo -info $1 | sed s/.*://`
+ for ABI in $ABIS; do
+ OPTS="${OPTS} -arch ${ABI}"
+ done
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
diff --git a/configs/darwin b/configs/darwin
index 213c397287e..336b54e0674 100644
--- a/configs/darwin
+++ b/configs/darwin
@@ -12,10 +12,10 @@ X11_DIR = $(INSTALL_DIR)
CC = gcc
CXX = g++
PIC_FLAGS = -fPIC
-DEFINES = -D_DARWIN_C_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L \
- -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS \
+DEFINES = -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \
-DGLX_ALIAS_UNSUPPORTED -DGLX_INDIRECT_RENDERING
+# -D_GNU_SOURCE - for src/mesa/main ...
# -DGLX_DIRECT_RENDERING - pulls in libdrm stuff in glx/x11
# -DGLX_USE_APPLEGL - supposed to be used with GLX_DIRECT_RENDERING to use AGL rather than DRM, but doesn't compile
# -DIN_DRI_DRIVER
@@ -49,7 +49,7 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
# omit glw lib for now:
-SRC_DIRS = glx/x11 mesa glu glut/glx glew
+SRC_DIRS = glx/x11 mesa gallium glu glut/glx glew
GLU_DIRS = sgi
DRIVER_DIRS = osmesa
#DRIVER_DIRS = dri
diff --git a/configure.ac b/configure.ac
index 5fe3a944967..dfc8e1aa7d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,6 +19,7 @@ AC_CANONICAL_HOST
dnl Versions for external dependencies
LIBDRM_REQUIRED=2.4.3
+LIBDRM_RADEON_REQUIRED=2.4.17
DRI2PROTO_REQUIRED=1.99.3
dnl Check for progs
@@ -577,7 +578,7 @@ dri)
GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
- PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no)
+ PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no)
if test "$HAVE_LIBDRM_RADEON" = yes; then
RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
diff --git a/docs/news.html b/docs/news.html
index 2abec2e6354..a7d834e1c74 100644
--- a/docs/news.html
+++ b/docs/news.html
@@ -10,7 +10,7 @@
<H1>News</H1>
-<h2>November XX, 2009</h2>
+<h2>December 21, 2009</h2>
<p>
<a href="relnotes-7.6.1.html">Mesa 7.6.1</a> is released. This is a bug-fix
release fixing issues found in the 7.6 release.
diff --git a/docs/relnotes-7.6.1.html b/docs/relnotes-7.6.1.html
index 7160168d989..1d0ecd2ac09 100644
--- a/docs/relnotes-7.6.1.html
+++ b/docs/relnotes-7.6.1.html
@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
-<H1>Mesa 7.6.1 Release Notes, (date tbd)</H1>
+<H1>Mesa 7.6.1 Release Notes, 21 December 2009</H1>
<p>
Mesa 7.6.1 is a bug-fix release fixing issues since version 7.6.
@@ -26,7 +26,15 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
-tbd
+e80fabad2e3eb7990adae773d6aeacba MesaLib-7.6.1.tar.gz
+7db4617e9e10ad3aca1b64339fd71b7d MesaLib-7.6.1.tar.bz2
+dd3275dbf9833480d2e92d0c69b22abd MesaLib-7.6.1.zip
+f7fdcfe3c0f363e571c60f02f74368fb MesaDemos-7.6.1.tar.gz
+a4226f06732a02556fcf6be290b86dff MesaDemos-7.6.1.tar.bz2
+849425f356bd940726cebedfa79de176 MesaDemos-7.6.1.zip
+d40cc7c5e337a85b674e27a8e494f52f MesaGLUT-7.6.1.tar.gz
+ca9aecb91f05b1da9fd7d5eeb19d47d7 MesaGLUT-7.6.1.tar.bz2
+23fad8398004c977a1d8953079b72ca6 MesaGLUT-7.6.1.zip
</pre>
@@ -59,6 +67,7 @@ tbd
<li>Point sprite fixes for i915/945 driver.
<li>Fixed assorted memory leaks (usually on error paths)
<li>Fixed some GLSL compiler bugs (ex: 25579)
+<li>Assorted build fixes for BlueGene
</ul>
<h2>Changes</h2>
diff --git a/progs/demos/geartrain.c b/progs/demos/geartrain.c
index 8fe405e8076..e6567dd6470 100644
--- a/progs/demos/geartrain.c
+++ b/progs/demos/geartrain.c
@@ -25,6 +25,7 @@
*/
+#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <GL/glut.h>
@@ -129,8 +130,10 @@ Clear_Buffers ()
static void
LoadTriplet (TDA A)
{
+ int result;
Clear_Buffers ();
- fscanf (mainfile, "%s %s %s %s", Buf1, Buf2, Buf3, Buf4);
+ result = fscanf (mainfile, "%s %s %s %s", Buf1, Buf2, Buf3, Buf4);
+ assert(result != EOF);
A[0] = atof (Buf2);
A[1] = atof (Buf3);
A[2] = atof (Buf4);
@@ -140,8 +143,10 @@ LoadTriplet (TDA A)
static void
LoadReal (float *a)
{
+ int result;
Clear_Buffers ();
- fscanf (mainfile, "%s %s", Buf1, Buf2);
+ result = fscanf (mainfile, "%s %s", Buf1, Buf2);
+ assert(result != EOF);
*a = atof (Buf2);
}
@@ -149,8 +154,10 @@ LoadReal (float *a)
static void
LoadInteger (int *a)
{
+ int result;
Clear_Buffers ();
- fscanf (mainfile, "%s %s", Buf1, Buf2);
+ result = fscanf (mainfile, "%s %s", Buf1, Buf2);
+ assert(result != EOF);
*a = atoi (Buf2);
}
@@ -158,8 +165,10 @@ LoadInteger (int *a)
static void
LoadText (char *a)
{
+ int result;
Clear_Buffers ();
- fscanf (mainfile, "%s %s", Buf1, Buf2);
+ result = fscanf (mainfile, "%s %s", Buf1, Buf2);
+ assert(result != EOF);
strcpy (a, Buf2);
}
@@ -177,8 +186,10 @@ getdata (char filename[])
do
{
+ int result;
Clear_Buffers ();
- fscanf (mainfile, "%s", Buf1);
+ result = fscanf (mainfile, "%s", Buf1);
+ (void) result;
if (ferror (mainfile))
{
printf ("\nError opening file !\n");
diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c
index 2e9dff17261..dd5696507bb 100644
--- a/progs/demos/isosurf.c
+++ b/progs/demos/isosurf.c
@@ -132,9 +132,11 @@ static void read_surface( char *filename )
numverts = 0;
while (!feof(f) && numverts<maxverts) {
- fscanf( f, "%f %f %f %f %f %f",
- &data[numverts][0], &data[numverts][1], &data[numverts][2],
- &data[numverts][3], &data[numverts][4], &data[numverts][5] );
+ int result;
+ result = fscanf( f, "%f %f %f %f %f %f",
+ &data[numverts][0], &data[numverts][1], &data[numverts][2],
+ &data[numverts][3], &data[numverts][4], &data[numverts][5] );
+ (void) result;
numverts++;
}
numverts--;
diff --git a/progs/demos/morph3d.c b/progs/demos/morph3d.c
index 6aca8270ff5..70b90d733f9 100644
--- a/progs/demos/morph3d.c
+++ b/progs/demos/morph3d.c
@@ -887,5 +887,5 @@ int main(int argc, char **argv)
glutIdleFunc( idle_ );
glutDisplayFunc( draw );
glutMainLoop();
-
+ return 0;
}
diff --git a/progs/demos/terrain.c b/progs/demos/terrain.c
index be78ea4950f..9ba7b61a63f 100644
--- a/progs/demos/terrain.c
+++ b/progs/demos/terrain.c
@@ -8,6 +8,7 @@
* based on a Mikael SkiZoWalker's (MoDEL) / France ([email protected]) demo
*/
+#include <assert.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
@@ -559,12 +560,14 @@ loadpic(void)
FILE *FilePic;
int i, tmp;
GLenum gluerr;
+ size_t result;
if ((FilePic = fopen("terrain.dat", "r")) == NULL) {
fprintf(stderr, "Error loading terrain.dat\n");
exit(-1);
}
- fread(bufferter, 256 * 256, 1, FilePic);
+ result = fread(bufferter, 256 * 256, 1, FilePic);
+ assert(result == 1);
fclose(FilePic);
for (i = 0; i < (256 * 256); i++) {
diff --git a/progs/demos/textures.c b/progs/demos/textures.c
index b7bf135d219..31e1bbb3db0 100644
--- a/progs/demos/textures.c
+++ b/progs/demos/textures.c
@@ -57,7 +57,7 @@ Idle(void)
{
Xrot = glutGet(GLUT_ELAPSED_TIME) * 0.02;
Yrot = glutGet(GLUT_ELAPSED_TIME) * 0.04;
- //Zrot += 2.0;
+ /* Zrot += 2.0; */
glutPostRedisplay();
}
diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c
index 628a7dd5b98..88315d74614 100644
--- a/progs/glsl/shtest.c
+++ b/progs/glsl/shtest.c
@@ -627,7 +627,7 @@ Init(void)
NumAttribs = GetAttribs(Program, Attribs);
PrintAttribs(Attribs);
- //assert(glGetError() == 0);
+ /* assert(glGetError() == 0); */
glClearColor(0.4f, 0.4f, 0.8f, 0.0f);
diff --git a/progs/glsl/texaaline.c b/progs/glsl/texaaline.c
index 2e4f932ad60..00edab73108 100644
--- a/progs/glsl/texaaline.c
+++ b/progs/glsl/texaaline.c
@@ -310,8 +310,8 @@ MakeMipmap(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
- ////glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5);
+ /* glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4); */
+ /* glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5); */
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
#undef SZ
diff --git a/progs/redbook/aaindex.c b/progs/redbook/aaindex.c
index 7dbc7b4b9b2..6011ec44b67 100644
--- a/progs/redbook/aaindex.c
+++ b/progs/redbook/aaindex.c
@@ -56,7 +56,7 @@ static float rotAngle = 0.;
* at RAMP1START, and a blue color ramp starting
* at RAMP2START. The ramps must be a multiple of 16.
*/
-void init(void)
+static void init(void)
{
int i;
@@ -76,7 +76,7 @@ void init(void)
/* Draw 2 diagonal lines to form an X
*/
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
@@ -101,7 +101,7 @@ void display(void)
glFlush();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -117,7 +117,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 'r':
diff --git a/progs/redbook/aapoly.c b/progs/redbook/aapoly.c
index 757f0f48c43..b7b2b270902 100644
--- a/progs/redbook/aapoly.c
+++ b/progs/redbook/aapoly.c
@@ -59,7 +59,7 @@ static void init(void)
#define NFACE 6
#define NVERT 8
-void drawCube(GLdouble x0, GLdouble x1, GLdouble y0, GLdouble y1,
+static void drawCube(GLdouble x0, GLdouble x1, GLdouble y0, GLdouble y1,
GLdouble z0, GLdouble z1)
{
static GLfloat v[8][3];
@@ -101,7 +101,7 @@ void drawCube(GLdouble x0, GLdouble x1, GLdouble y0, GLdouble y1,
/* Note: polygons must be drawn from front to back
* for proper blending.
*/
-void display(void)
+static void display(void)
{
if (polySmooth) {
glClear (GL_COLOR_BUFFER_BIT);
@@ -126,7 +126,7 @@ void display(void)
glFlush ();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -137,7 +137,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 't':
diff --git a/progs/redbook/aargb.c b/progs/redbook/aargb.c
index f51984170e6..0021b549c2e 100644
--- a/progs/redbook/aargb.c
+++ b/progs/redbook/aargb.c
@@ -51,7 +51,7 @@ static float rotAngle = 0.;
* blending, hint, and line width. Print out implementation
* specific info on line width granularity and width.
*/
-void init(void)
+static void init(void)
{
GLfloat values[2];
glGetFloatv (GL_LINE_WIDTH_GRANULARITY, values);
@@ -72,7 +72,7 @@ void init(void)
/* Draw 2 diagonal lines to form an X
*/
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
@@ -97,7 +97,7 @@ void display(void)
glFlush();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
@@ -113,7 +113,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 'r':
diff --git a/progs/redbook/accanti.c b/progs/redbook/accanti.c
index 12ca16f7a52..d1b25678419 100644
--- a/progs/redbook/accanti.c
+++ b/progs/redbook/accanti.c
@@ -45,7 +45,7 @@
/* Initialize lighting and other values.
*/
-void myinit(void)
+static void myinit(void)
{
GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
@@ -68,7 +68,7 @@ void myinit(void)
glClearAccum(0.0, 0.0, 0.0, 0.0);
}
-void displayObjects(void)
+static void displayObjects(void)
{
GLfloat torus_diffuse[] = { 0.7, 0.7, 0.0, 1.0 };
GLfloat cube_diffuse[] = { 0.0, 0.7, 0.7, 1.0 };
@@ -111,7 +111,7 @@ void displayObjects(void)
#define ACSIZE 8
-void display(void)
+static void display(void)
{
GLint viewport[4];
int jitter;
@@ -137,7 +137,7 @@ void display(void)
glFlush();
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
diff --git a/progs/redbook/accpersp.c b/progs/redbook/accpersp.c
index 46e369ae631..e172d0a917f 100644
--- a/progs/redbook/accpersp.c
+++ b/progs/redbook/accpersp.c
@@ -62,7 +62,7 @@
* probably want to insure that your ModelView matrix has been
* initialized to identity before calling accFrustum().
*/
-void accFrustum(GLdouble left, GLdouble right, GLdouble bottom,
+static void accFrustum(GLdouble left, GLdouble right, GLdouble bottom,
GLdouble top, GLdouble nnear, GLdouble ffar, GLdouble pixdx,
GLdouble pixdy, GLdouble eyedx, GLdouble eyedy, GLdouble focus)
{
@@ -99,7 +99,7 @@ void accFrustum(GLdouble left, GLdouble right, GLdouble bottom,
*
* Note that accPerspective() calls accFrustum().
*/
-void accPerspective(GLdouble fovy, GLdouble aspect,
+static void accPerspective(GLdouble fovy, GLdouble aspect,
GLdouble nnear, GLdouble ffar, GLdouble pixdx, GLdouble pixdy,
GLdouble eyedx, GLdouble eyedy, GLdouble focus)
{
@@ -119,7 +119,7 @@ void accPerspective(GLdouble fovy, GLdouble aspect,
/* Initialize lighting and other values.
*/
-void init(void)
+static void init(void)
{
GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
@@ -141,7 +141,7 @@ void init(void)
glClearAccum(0.0, 0.0, 0.0, 0.0);
}
-void displayObjects(void)
+static void displayObjects(void)
{
GLfloat torus_diffuse[] = { 0.7, 0.7, 0.0, 1.0 };
GLfloat cube_diffuse[] = { 0.0, 0.7, 0.7, 1.0 };
@@ -185,7 +185,7 @@ void displayObjects(void)
#define ACSIZE 8
-void display(void)
+static void display(void)
{
GLint viewport[4];
int jitter;
@@ -205,13 +205,13 @@ void display(void)
glFlush();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/alpha.c b/progs/redbook/alpha.c
index 6eeb45b96f1..b77c65e2c83 100644
--- a/progs/redbook/alpha.c
+++ b/progs/redbook/alpha.c
@@ -80,7 +80,7 @@ static void drawRightTriangle(void)
glEnd();
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
@@ -96,7 +96,7 @@ void display(void)
glFlush();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -108,7 +108,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 't':
diff --git a/progs/redbook/alpha3D.c b/progs/redbook/alpha3D.c
index 6169bd162be..494b1879d22 100644
--- a/progs/redbook/alpha3D.c
+++ b/progs/redbook/alpha3D.c
@@ -80,7 +80,7 @@ static void init(void)
glEndList();
}
-void display(void)
+static void display(void)
{
GLfloat mat_solid[] = { 0.75, 0.75, 0.0, 1.0 };
GLfloat mat_zero[] = { 0.0, 0.0, 0.0, 1.0 };
@@ -113,7 +113,7 @@ void display(void)
glutSwapBuffers();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLint) w, (GLint) h);
glMatrixMode(GL_PROJECTION);
@@ -128,7 +128,7 @@ void reshape(int w, int h)
glLoadIdentity();
}
-void animate(void)
+static void animate(void)
{
static double t0 = -1.;
if (solidZ <= MINZ || transparentZ >= MAXZ)
@@ -150,7 +150,7 @@ void animate(void)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 'a':
diff --git a/progs/redbook/anti.c b/progs/redbook/anti.c
index 9eab0bc3511..a97a3ebc948 100644
--- a/progs/redbook/anti.c
+++ b/progs/redbook/anti.c
@@ -49,7 +49,7 @@
* blending, hint, and line width. Print out implementation
* specific info on line width granularity and width.
*/
-void myinit(void)
+static void myinit(void)
{
GLfloat values[2];
glGetFloatv (GL_LINE_WIDTH_GRANULARITY, values);
@@ -73,7 +73,7 @@ void myinit(void)
/* display() draws an icosahedron with a large alpha value, 1.0.
*/
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor4f (1.0, 1.0, 1.0, 1.0);
@@ -81,7 +81,7 @@ void display(void)
glFlush();
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
diff --git a/progs/redbook/bezcurve.c b/progs/redbook/bezcurve.c
index 5dee440396b..60a9c680802 100644
--- a/progs/redbook/bezcurve.c
+++ b/progs/redbook/bezcurve.c
@@ -45,7 +45,7 @@ GLfloat ctrlpoints[4][3] = {
{ -4.0, -4.0, 0.0}, { -2.0, 4.0, 0.0},
{2.0, -4.0, 0.0}, {4.0, 4.0, 0.0}};
-void init(void)
+static void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT);
@@ -53,7 +53,7 @@ void init(void)
glEnable(GL_MAP1_VERTEX_3);
}
-void display(void)
+static void display(void)
{
int i;
@@ -73,7 +73,7 @@ void display(void)
glFlush();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -89,7 +89,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/bezmesh.c b/progs/redbook/bezmesh.c
index 55e7e827f2b..1abc7488bcb 100644
--- a/progs/redbook/bezmesh.c
+++ b/progs/redbook/bezmesh.c
@@ -68,7 +68,7 @@ GLfloat ctrlpoints[4][4][3] =
{1.5, 1.5, -1.0}}
};
-void
+static void
initlights(void)
{
GLfloat ambient[] =
@@ -93,7 +93,7 @@ initlights(void)
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
}
-void
+static void
display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -104,7 +104,7 @@ display(void)
glFlush();
}
-void
+static void
myinit(void)
{
glClearColor(0.0, 0.0, 0.0, 1.0);
@@ -118,7 +118,7 @@ myinit(void)
initlights(); /* for lighted version only */
}
-void
+static void
myReshape(int w, int h)
{
glViewport(0, 0, w, h);
diff --git a/progs/redbook/checker.c b/progs/redbook/checker.c
index 06cbae7dd7e..60e6f7b60c8 100644
--- a/progs/redbook/checker.c
+++ b/progs/redbook/checker.c
@@ -50,7 +50,7 @@
#define checkImageHeight 64
GLubyte checkImage[checkImageWidth][checkImageHeight][3];
-void makeCheckImage(void)
+static void makeCheckImage(void)
{
int i, j, c;
@@ -64,7 +64,7 @@ void makeCheckImage(void)
}
}
-void myinit(void)
+static void myinit(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glEnable(GL_DEPTH_TEST);
@@ -84,7 +84,7 @@ void myinit(void)
glShadeModel(GL_FLAT);
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_QUADS);
@@ -101,7 +101,7 @@ void display(void)
glutSwapBuffers();
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
diff --git a/progs/redbook/clip.c b/progs/redbook/clip.c
index 90816f2e278..85c464720db 100644
--- a/progs/redbook/clip.c
+++ b/progs/redbook/clip.c
@@ -42,13 +42,13 @@
#include <GL/glut.h>
#include <stdlib.h>
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}
-void display(void)
+static void display(void)
{
GLdouble eqn[4] = {0.0, 1.0, 0.0, 0.0};
GLdouble eqn2[4] = {1.0, 0.0, 0.0, 0.0};
@@ -73,7 +73,7 @@ void display(void)
glFlush ();
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
@@ -83,7 +83,7 @@ void reshape (int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/colormat.c b/progs/redbook/colormat.c
index 9db4491bac5..d77fcb1ed46 100644
--- a/progs/redbook/colormat.c
+++ b/progs/redbook/colormat.c
@@ -49,7 +49,7 @@ GLfloat diffuseMaterial[4] = { 0.5, 0.5, 0.5, 1.0 };
/* Initialize material property, light source, lighting model,
* and depth buffer.
*/
-void init(void)
+static void init(void)
{
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
@@ -68,14 +68,14 @@ void init(void)
glEnable(GL_COLOR_MATERIAL);
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSolidSphere(1.0, 20, 16);
glFlush ();
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
@@ -91,7 +91,7 @@ void reshape (int w, int h)
}
/* ARGSUSED2 */
-void mouse(int button, int state, int x, int y)
+static void mouse(int button, int state, int x, int y)
{
switch (button) {
case GLUT_LEFT_BUTTON:
@@ -127,7 +127,7 @@ void mouse(int button, int state, int x, int y)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/cube.c b/progs/redbook/cube.c
index 5ecc6280f33..3c6becb2157 100644
--- a/progs/redbook/cube.c
+++ b/progs/redbook/cube.c
@@ -44,13 +44,13 @@
#include <GL/glut.h>
#include <stdlib.h>
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}
-void display(void)
+static void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
@@ -62,7 +62,7 @@ void display(void)
glFlush ();
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
@@ -72,7 +72,7 @@ void reshape (int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/depthcue.c b/progs/redbook/depthcue.c
index a3e5b743aa7..d4b604baf13 100644
--- a/progs/redbook/depthcue.c
+++ b/progs/redbook/depthcue.c
@@ -48,7 +48,7 @@
/* Initialize linear fog for depth cueing.
*/
-void myinit(void)
+static void myinit(void)
{
GLfloat fogColor[4] = {0.0, 0.0, 0.0, 1.0};
@@ -67,7 +67,7 @@ void myinit(void)
/* display() draws an icosahedron.
*/
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
@@ -75,7 +75,7 @@ void display(void)
glFlush();
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
diff --git a/progs/redbook/dof.c b/progs/redbook/dof.c
index 6673dc2d54f..8558f02deea 100644
--- a/progs/redbook/dof.c
+++ b/progs/redbook/dof.c
@@ -68,7 +68,7 @@
* probably want to insure that your ModelView matrix has been
* initialized to identity before calling accFrustum().
*/
-void accFrustum(GLdouble left, GLdouble right, GLdouble bottom,
+static void accFrustum(GLdouble left, GLdouble right, GLdouble bottom,
GLdouble top, GLdouble nnear, GLdouble ffar, GLdouble pixdx,
GLdouble pixdy, GLdouble eyedx, GLdouble eyedy, GLdouble focus)
{
@@ -105,7 +105,7 @@ void accFrustum(GLdouble left, GLdouble right, GLdouble bottom,
*
* Note that accPerspective() calls accFrustum().
*/
-void accPerspective(GLdouble fovy, GLdouble aspect,
+static void accPerspective(GLdouble fovy, GLdouble aspect,
GLdouble nnear, GLdouble ffar, GLdouble pixdx, GLdouble pixdy,
GLdouble eyedx, GLdouble eyedy, GLdouble focus)
{
@@ -123,7 +123,7 @@ void accPerspective(GLdouble fovy, GLdouble aspect,
pixdx, pixdy, eyedx, eyedy, focus);
}
-void myinit(void)
+static void myinit(void)
{
GLfloat ambient[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
@@ -155,7 +155,7 @@ void myinit(void)
glClearAccum(0.0, 0.0, 0.0, 0.0);
}
-void renderTeapot (GLfloat x, GLfloat y, GLfloat z,
+static void renderTeapot (GLfloat x, GLfloat y, GLfloat z,
GLfloat ambr, GLfloat ambg, GLfloat ambb,
GLfloat difr, GLfloat difg, GLfloat difb,
GLfloat specr, GLfloat specg, GLfloat specb, GLfloat shine)
@@ -182,7 +182,7 @@ void renderTeapot (GLfloat x, GLfloat y, GLfloat z,
* magnitude of the accPerspective() jitter; in this example, 0.33.
* In this example, the teapots are drawn 8 times. See jitter.h
*/
-void display(void)
+static void display(void)
{
int jitter;
GLint viewport[4];
@@ -214,7 +214,7 @@ void display(void)
glFlush();
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
}
diff --git a/progs/redbook/double.c b/progs/redbook/double.c
index 3153c70cc1d..c4ead224dc8 100644
--- a/progs/redbook/double.c
+++ b/progs/redbook/double.c
@@ -47,7 +47,7 @@
static GLfloat spin = 0.0;
static GLdouble t0 = 0.;
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
@@ -59,12 +59,12 @@ void display(void)
glutSwapBuffers();
}
-GLdouble gettime(void)
+static GLdouble gettime(void)
{
return (GLdouble)(glutGet(GLUT_ELAPSED_TIME)) / 1000.;
}
-void spinDisplay(void)
+static void spinDisplay(void)
{
GLdouble t, dt;
t = gettime();
@@ -76,13 +76,13 @@ void spinDisplay(void)
glutPostRedisplay();
}
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -93,7 +93,7 @@ void reshape(int w, int h)
}
/* ARGSUSED2 */
-void mouse(int button, int state, int x, int y)
+static void mouse(int button, int state, int x, int y)
{
switch (button) {
case GLUT_LEFT_BUTTON:
diff --git a/progs/redbook/drawf.c b/progs/redbook/drawf.c
index 5bcccb6aeac..6c048be7844 100644
--- a/progs/redbook/drawf.c
+++ b/progs/redbook/drawf.c
@@ -48,13 +48,13 @@ GLubyte rasters[24] = {
0xff, 0x00, 0xff, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
0xff, 0xc0, 0xff, 0xc0};
-void init(void)
+static void init(void)
{
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
glClearColor (0.0, 0.0, 0.0, 0.0);
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
@@ -65,7 +65,7 @@ void display(void)
glFlush();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -75,7 +75,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/feedback.c b/progs/redbook/feedback.c
index cc685d55d34..3c8c8cc7eaf 100644
--- a/progs/redbook/feedback.c
+++ b/progs/redbook/feedback.c
@@ -48,7 +48,7 @@
/* Initialize lighting.
*/
-void init(void)
+static void init(void)
{
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
@@ -58,7 +58,7 @@ void init(void)
* be clipped. If in feedback mode, a passthrough token
* is issued between the each primitive.
*/
-void drawGeometry (GLenum mode)
+static void drawGeometry (GLenum mode)
{
glBegin (GL_LINE_STRIP);
glNormal3f (0.0, 0.0, 1.0);
@@ -80,8 +80,8 @@ void drawGeometry (GLenum mode)
}
/* Write contents of one vertex to stdout. */
-void print3DcolorVertex (GLint size, GLint *count,
- GLfloat *buffer)
+static void print3DcolorVertex (GLint size, GLint *count,
+ GLfloat *buffer)
{
int i;
@@ -94,7 +94,7 @@ void print3DcolorVertex (GLint size, GLint *count,
}
/* Write contents of entire buffer. (Parse tokens!) */
-void printBuffer(GLint size, GLfloat *buffer)
+static void printBuffer(GLint size, GLfloat *buffer)
{
GLint count;
GLfloat token;
@@ -124,7 +124,7 @@ void printBuffer(GLint size, GLfloat *buffer)
}
}
-void display(void)
+static void display(void)
{
GLfloat feedBuffer[1024];
GLint size;
@@ -148,7 +148,7 @@ void display(void)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/fog.c b/progs/redbook/fog.c
index 14c7700eccf..4f4b8e3cc0a 100644
--- a/progs/redbook/fog.c
+++ b/progs/redbook/fog.c
@@ -52,7 +52,7 @@
GLint fogMode;
-void
+static void
selectFog(int mode)
{
switch(mode) {
@@ -73,7 +73,7 @@ selectFog(int mode)
/* Initialize z-buffer, projection matrix, light source,
* and lighting model. Do not specify a material property here.
*/
-void
+static void
myinit(void)
{
GLfloat position[] =
@@ -106,7 +106,7 @@ myinit(void)
}
}
-void
+static void
renderRedTeapot(GLfloat x, GLfloat y, GLfloat z)
{
float mat[4];
@@ -133,7 +133,7 @@ renderRedTeapot(GLfloat x, GLfloat y, GLfloat z)
/* display() draws 5 teapots at different z positions.
*/
-void
+static void
display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -145,7 +145,7 @@ display(void)
glFlush();
}
-void
+static void
myReshape(int w, int h)
{
glViewport(0, 0, w, h);
diff --git a/progs/redbook/fogindex.c b/progs/redbook/fogindex.c
index b8bb691e288..6b5aa353caa 100644
--- a/progs/redbook/fogindex.c
+++ b/progs/redbook/fogindex.c
@@ -53,7 +53,7 @@
#define NUM_COLORS 32
#define RAMPSTART 16
-void
+static void
myinit(void)
{
int i;
@@ -77,7 +77,7 @@ myinit(void)
/* display() renders 3 cones at different z positions.
*/
-void
+static void
display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -104,7 +104,7 @@ display(void)
glFlush();
}
-void
+static void
myReshape(int w, int h)
{
glViewport(0, 0, w, h);
diff --git a/progs/redbook/font.c b/progs/redbook/font.c
index 2d92e9b6003..c7a1035aa99 100644
--- a/progs/redbook/font.c
+++ b/progs/redbook/font.c
@@ -80,7 +80,7 @@ GLubyte letters[][13] = {
GLuint fontOffset;
-void makeRasterFont(void)
+static void makeRasterFont(void)
{
GLuint i, j;
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
@@ -96,13 +96,13 @@ void makeRasterFont(void)
glEndList();
}
-void init(void)
+static void init(void)
{
glShadeModel (GL_FLAT);
makeRasterFont();
}
-void printString(char *s)
+static void printString(char *s)
{
glPushAttrib (GL_LIST_BIT);
glListBase(fontOffset);
@@ -115,7 +115,7 @@ void printString(char *s)
* to call makeRasterFont() before you start making
* calls to printString().
*/
-void display(void)
+static void display(void)
{
GLfloat white[3] = { 1.0, 1.0, 1.0 };
@@ -129,7 +129,7 @@ void display(void)
glFlush ();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -139,7 +139,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/hello.c b/progs/redbook/hello.c
index fb3dae13252..84183b25b9f 100644
--- a/progs/redbook/hello.c
+++ b/progs/redbook/hello.c
@@ -42,7 +42,7 @@
#include <stdlib.h>
#include <GL/glut.h>
-void display(void)
+static void display(void)
{
/* clear all pixels */
glClear (GL_COLOR_BUFFER_BIT);
@@ -64,7 +64,7 @@ void display(void)
glFlush ();
}
-void init (void)
+static void init (void)
{
/* select clearing color */
glClearColor (0.0, 0.0, 0.0, 0.0);
diff --git a/progs/redbook/image.c b/progs/redbook/image.c
index dc1a7246eba..fa3b46f5ed4 100644
--- a/progs/redbook/image.c
+++ b/progs/redbook/image.c
@@ -58,7 +58,7 @@ GLubyte checkImage[checkImageHeight][checkImageWidth][3];
static GLdouble zoomFactor = 1.0;
static GLint height;
-void makeCheckImage(void)
+static void makeCheckImage(void)
{
int i, j, c;
@@ -72,7 +72,7 @@ void makeCheckImage(void)
}
}
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT);
@@ -80,7 +80,7 @@ void init(void)
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glRasterPos2i(0, 0);
@@ -89,7 +89,7 @@ void display(void)
glFlush();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
height = (GLint) h;
@@ -100,7 +100,7 @@ void reshape(int w, int h)
glLoadIdentity();
}
-void motion(int x, int y)
+static void motion(int x, int y)
{
static GLint screeny;
@@ -113,7 +113,7 @@ void motion(int x, int y)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 'r':
diff --git a/progs/redbook/light.c b/progs/redbook/light.c
index 0eed85e10c2..9431dce508e 100644
--- a/progs/redbook/light.c
+++ b/progs/redbook/light.c
@@ -47,7 +47,7 @@
/* Initialize material property, light source, lighting model,
* and depth buffer.
*/
-void init(void)
+static void init(void)
{
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat mat_shininess[] = { 50.0 };
@@ -65,14 +65,14 @@ void init(void)
glEnable(GL_DEPTH_TEST);
}
-void display(void)
+static void display(void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSolidSphere (1.0, 20, 16);
glFlush ();
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
@@ -88,7 +88,7 @@ void reshape (int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/lines.c b/progs/redbook/lines.c
index b34d4c418c6..9f12da9acfe 100644
--- a/progs/redbook/lines.c
+++ b/progs/redbook/lines.c
@@ -46,13 +46,13 @@
#define drawOneLine(x1,y1,x2,y2) glBegin(GL_LINES); \
glVertex2f ((x1),(y1)); glVertex2f ((x2),(y2)); glEnd();
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}
-void display(void)
+static void display(void)
{
int i;
@@ -104,7 +104,7 @@ void display(void)
glFlush ();
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
@@ -113,7 +113,7 @@ void reshape (int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/list.c b/progs/redbook/list.c
index 3b4f44bd6da..5dea26fcad1 100644
--- a/progs/redbook/list.c
+++ b/progs/redbook/list.c
@@ -69,7 +69,7 @@ static void drawLine (void)
glEnd ();
}
-void display(void)
+static void display(void)
{
GLuint i;
@@ -82,7 +82,7 @@ void display(void)
glFlush ();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
@@ -97,7 +97,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/material.c b/progs/redbook/material.c
index f9a4fc59288..5edddd9ef84 100644
--- a/progs/redbook/material.c
+++ b/progs/redbook/material.c
@@ -49,7 +49,7 @@
/* Initialize z-buffer, projection matrix, light source,
* and lighting model. Do not specify a material property here.
*/
-void myinit(void)
+static void myinit(void)
{
GLfloat ambient[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
@@ -87,7 +87,7 @@ void myinit(void)
* glTranslatef() is used to move spheres to their appropriate locations.
*/
-void display(void)
+static void display(void)
{
GLfloat no_mat[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat mat_ambient[] = { 0.7, 0.7, 0.7, 1.0 };
@@ -260,7 +260,7 @@ void display(void)
glFlush();
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
diff --git a/progs/redbook/mipmap.c b/progs/redbook/mipmap.c
index d32dd725f4b..dadde055bef 100644
--- a/progs/redbook/mipmap.c
+++ b/progs/redbook/mipmap.c
@@ -54,7 +54,7 @@ GLubyte mipmapImage4[4][4][3];
GLubyte mipmapImage2[2][2][3];
GLubyte mipmapImage1[1][1][3];
-void makeImages(void)
+static void makeImages(void)
{
int i, j;
@@ -98,7 +98,7 @@ void makeImages(void)
mipmapImage1[0][0][2] = 255;
}
-void myinit(void)
+static void myinit(void)
{
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
@@ -128,7 +128,7 @@ void myinit(void)
glEnable(GL_TEXTURE_2D);
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_QUADS);
@@ -140,7 +140,7 @@ void display(void)
glFlush();
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
diff --git a/progs/redbook/model.c b/progs/redbook/model.c
index 8411ef355f1..f7c92f4f87c 100644
--- a/progs/redbook/model.c
+++ b/progs/redbook/model.c
@@ -42,13 +42,13 @@
#include <GL/glut.h>
#include <stdlib.h>
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}
-void draw_triangle(void)
+static void draw_triangle(void)
{
glBegin (GL_LINE_LOOP);
glVertex2f(0.0, 25.0);
@@ -57,7 +57,7 @@ void draw_triangle(void)
glEnd();
}
-void display(void)
+static void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
@@ -86,7 +86,7 @@ void display(void)
glFlush ();
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
@@ -101,7 +101,7 @@ void reshape (int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/movelight.c b/progs/redbook/movelight.c
index a108cad439a..93758a222a4 100644
--- a/progs/redbook/movelight.c
+++ b/progs/redbook/movelight.c
@@ -58,7 +58,7 @@ static int spin = 0;
/* Initialize material property, light source, lighting model,
* and depth buffer.
*/
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_SMOOTH);
@@ -72,7 +72,7 @@ void init(void)
* light at a new position in world coordinates. The cube
* represents the position of the light.
*/
-void display(void)
+static void display(void)
{
GLfloat position[] = { 0.0, 0.0, 1.5, 1.0 };
@@ -96,7 +96,7 @@ void display(void)
glFlush ();
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
@@ -107,7 +107,7 @@ void reshape (int w, int h)
}
/* ARGSUSED2 */
-void mouse(int button, int state, int x, int y)
+static void mouse(int button, int state, int x, int y)
{
switch (button) {
case GLUT_LEFT_BUTTON:
@@ -122,7 +122,7 @@ void mouse(int button, int state, int x, int y)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/nurbs.c b/progs/redbook/nurbs.c
index a7c6f0c696e..fe03ce667ed 100644
--- a/progs/redbook/nurbs.c
+++ b/progs/redbook/nurbs.c
@@ -89,7 +89,7 @@ GLUnurbsObj *theNurb;
/* Initialize material property, light source, lighting model,
* and depth buffer.
*/
-void myinit(void)
+static void myinit(void)
{
GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat mat_diffuse[] = { 1.0, 0.2, 1.0, 1.0 };
@@ -122,7 +122,7 @@ void myinit(void)
gluNurbsProperty(theNurb, GLU_DISPLAY_MODE, GLU_FILL);
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -147,7 +147,7 @@ void display(void)
glFlush();
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
diff --git a/progs/redbook/pickdepth.c b/progs/redbook/pickdepth.c
index ad5bdc81994..91d44a38c0a 100644
--- a/progs/redbook/pickdepth.c
+++ b/progs/redbook/pickdepth.c
@@ -51,7 +51,7 @@
#include <stdio.h>
#include <GL/glut.h>
-void
+static void
myinit(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
@@ -65,7 +65,7 @@ myinit(void)
* each rectangle is given the same name. Note that
* each rectangle is drawn with a different z value.
*/
-void
+static void
drawRects(GLenum mode)
{
if (mode == GL_SELECT)
@@ -100,7 +100,7 @@ drawRects(GLenum mode)
/* processHits() prints out the contents of the
* selection array.
*/
-void
+static void
processHits(GLint hits, GLuint buffer[])
{
GLint i;
@@ -131,7 +131,7 @@ processHits(GLint hits, GLuint buffer[])
*/
#define BUFSIZE 512
-void
+static void
pickRects(int button, int state, int x, int y)
{
GLuint selectBuf[BUFSIZE];
@@ -164,7 +164,7 @@ pickRects(int button, int state, int x, int y)
processHits(hits, selectBuf);
}
-void
+static void
display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -172,7 +172,7 @@ display(void)
glutSwapBuffers();
}
-void
+static void
myReshape(int w, int h)
{
glViewport(0, 0, w, h);
diff --git a/progs/redbook/picksquare.c b/progs/redbook/picksquare.c
index 636edc97b4b..cc092dbf538 100644
--- a/progs/redbook/picksquare.c
+++ b/progs/redbook/picksquare.c
@@ -49,7 +49,7 @@
int board[3][3]; /* amount of color for each square */
/* Clear color value for every square on the board */
-void init(void)
+static void init(void)
{
int i, j;
for (i = 0; i < 3; i++)
@@ -64,7 +64,7 @@ void init(void)
* square is determined by its position on the grid, and
* the value in the board[][] array.
*/
-void drawSquares(GLenum mode)
+static void drawSquares(GLenum mode)
{
GLuint i, j;
for (i = 0; i < 3; i++) {
@@ -85,7 +85,7 @@ void drawSquares(GLenum mode)
/* processHits prints out the contents of the
* selection array.
*/
-void processHits (GLint hits, GLuint buffer[])
+static void processHits (GLint hits, GLuint buffer[])
{
GLint i;
GLuint j, ii = 0, jj = 0, names, *ptr;
@@ -117,7 +117,7 @@ void processHits (GLint hits, GLuint buffer[])
*/
#define BUFSIZE 512
-void pickSquares(int button, int state, int x, int y)
+static void pickSquares(int button, int state, int x, int y)
{
GLuint selectBuf[BUFSIZE];
GLint hits;
@@ -152,14 +152,14 @@ void pickSquares(int button, int state, int x, int y)
glutPostRedisplay();
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
drawSquares (GL_RENDER);
glFlush();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
@@ -170,7 +170,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/plane.c b/progs/redbook/plane.c
index dc17f7b2386..2c2e2d24d93 100644
--- a/progs/redbook/plane.c
+++ b/progs/redbook/plane.c
@@ -47,7 +47,7 @@
/* Initialize material property, light source, and lighting model.
*/
-void myinit(void)
+static void myinit(void)
{
GLfloat mat_ambient[] = { 0.0, 0.0, 0.0, 1.0 };
/* mat_specular and mat_shininess are NOT default values */
@@ -75,7 +75,7 @@ void myinit(void)
glEnable(GL_DEPTH_TEST);
}
-void drawPlane(void)
+static void drawPlane(void)
{
glBegin (GL_QUADS);
glNormal3f (0.0, 0.0, 1.0);
@@ -104,7 +104,7 @@ void drawPlane(void)
glEnd();
}
-void display (void)
+static void display (void)
{
GLfloat infinite_light[] = { 1.0, 1.0, 1.0, 0.0 };
GLfloat local_light[] = { 1.0, 1.0, 1.0, 1.0 };
@@ -125,7 +125,7 @@ void display (void)
glFlush ();
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport (0, 0, w, h);
glMatrixMode (GL_PROJECTION);
diff --git a/progs/redbook/planet.c b/progs/redbook/planet.c
index e13672d3f63..cc428b4e427 100644
--- a/progs/redbook/planet.c
+++ b/progs/redbook/planet.c
@@ -47,13 +47,13 @@
static int year = 0, day = 0;
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}
-void display(void)
+static void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
@@ -68,7 +68,7 @@ void display(void)
glutSwapBuffers();
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
@@ -80,7 +80,7 @@ void reshape (int w, int h)
}
/* ARGSUSED1 */
-void keyboard (unsigned char key, int x, int y)
+static void keyboard (unsigned char key, int x, int y)
{
switch (key) {
case 'd':
diff --git a/progs/redbook/polyoff.c b/progs/redbook/polyoff.c
index de34b2e7675..0e0ce86ec91 100644
--- a/progs/redbook/polyoff.c
+++ b/progs/redbook/polyoff.c
@@ -60,7 +60,7 @@ GLboolean doubleBuffer;
/* display() draws two spheres, one with a gray, diffuse material,
* the other sphere with a magenta material with a specular highlight.
*/
-void display (void)
+static void display (void)
{
GLfloat gray[] = { 0.8, 0.8, 0.8, 1.0 };
GLfloat black[] = { 0.0, 0.0, 0.0, 1.0 };
@@ -108,7 +108,7 @@ void display (void)
* create display list with sphere
* initialize lighting and depth buffer
*/
-void gfxinit (void)
+static void gfxinit (void)
{
GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
@@ -134,7 +134,7 @@ void gfxinit (void)
}
/* call when window is resized */
-void reshape(int width, int height)
+static void reshape(int width, int height)
{
glViewport (0, 0, width, height);
glMatrixMode (GL_PROJECTION);
@@ -176,7 +176,7 @@ static void Benchmark( float xdiff, float ydiff )
/* call when mouse button is pressed */
/* ARGSUSED2 */
-void mouse(int button, int state, int x, int y) {
+static void mouse(int button, int state, int x, int y) {
switch (button) {
case GLUT_LEFT_BUTTON:
switch (state) {
@@ -213,7 +213,7 @@ void mouse(int button, int state, int x, int y) {
}
/* ARGSUSED1 */
-void keyboard (unsigned char key, int x, int y)
+static void keyboard (unsigned char key, int x, int y)
{
switch (key) {
case 't':
@@ -268,20 +268,7 @@ void keyboard (unsigned char key, int x, int y)
fflush(stdout);
}
-static void
-key(unsigned char k, int x, int y)
-{
- switch (k) {
- case 27: /* Escape */
- exit(0);
- break;
- default:
- return;
- }
- glutPostRedisplay();
-}
-
-GLenum Args(int argc, char **argv)
+static GLenum Args(int argc, char **argv)
{
GLint i;
diff --git a/progs/redbook/polys.c b/progs/redbook/polys.c
index 409abd17531..eeffe2301ce 100644
--- a/progs/redbook/polys.c
+++ b/progs/redbook/polys.c
@@ -44,7 +44,7 @@
#include <stdlib.h>
#include <GL/glut.h>
-void display(void)
+static void display(void)
{
GLubyte fly[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x80, 0x01, 0xC0, 0x06, 0xC0, 0x03, 0x60, 0x04, 0x60, 0x06, 0x20,
@@ -89,7 +89,7 @@ void display(void)
glFlush ();
}
-void myinit (void)
+static void myinit (void)
{
/* clear background to black */
glClearColor (0.0, 0.0, 0.0, 0.0);
diff --git a/progs/redbook/quadric.c b/progs/redbook/quadric.c
index 7e99098304a..1cbd395e47b 100644
--- a/progs/redbook/quadric.c
+++ b/progs/redbook/quadric.c
@@ -54,7 +54,7 @@
GLuint startList;
-void CALLBACK errorCallback(GLenum errorCode)
+static void CALLBACK errorCallback(GLenum errorCode)
{
const GLubyte *estring;
@@ -63,7 +63,7 @@ void CALLBACK errorCallback(GLenum errorCode)
exit(0);
}
-void init(void)
+static void init(void)
{
GLUquadricObj *qobj;
GLfloat mat_ambient[] = { 0.5, 0.5, 0.5, 1.0 };
@@ -120,7 +120,7 @@ void init(void)
gluDeleteQuadric(qobj);
}
-void display(void)
+static void display(void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
@@ -150,7 +150,7 @@ void display(void)
glFlush();
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -166,7 +166,7 @@ void reshape (int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/robot.c b/progs/redbook/robot.c
index 94e20ac71eb..c90b72ab3ea 100644
--- a/progs/redbook/robot.c
+++ b/progs/redbook/robot.c
@@ -47,13 +47,13 @@
static int shoulder = 0, elbow = 0;
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}
-void display(void)
+static void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glPushMatrix();
@@ -77,7 +77,7 @@ void display(void)
glutSwapBuffers();
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
@@ -89,7 +89,7 @@ void reshape (int w, int h)
}
/* ARGSUSED1 */
-void keyboard (unsigned char key, int x, int y)
+static void keyboard (unsigned char key, int x, int y)
{
switch (key) {
case 's':
diff --git a/progs/redbook/sccolorlight.c b/progs/redbook/sccolorlight.c
index 0ea750e5846..d9e0a254e90 100644
--- a/progs/redbook/sccolorlight.c
+++ b/progs/redbook/sccolorlight.c
@@ -49,7 +49,7 @@
/* Initialize material property and light source.
*/
-void myinit(void)
+static void myinit(void)
{
GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat light_diffuse[] = { 1.0, 0.0, 1.0, 1.0 };
@@ -68,7 +68,7 @@ void myinit(void)
glEnable(GL_DEPTH_TEST);
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix ();
@@ -95,7 +95,7 @@ void display(void)
glFlush();
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
diff --git a/progs/redbook/scene.c b/progs/redbook/scene.c
index c3abc727b78..6f336a8db46 100644
--- a/progs/redbook/scene.c
+++ b/progs/redbook/scene.c
@@ -48,7 +48,7 @@
/* Initialize material property and light source.
*/
-void myinit (void)
+static void myinit (void)
{
GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
@@ -67,7 +67,7 @@ void myinit (void)
glEnable(GL_DEPTH_TEST);
}
-void display (void)
+static void display (void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -95,7 +95,7 @@ void display (void)
glFlush ();
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport (0, 0, w, h);
glMatrixMode (GL_PROJECTION);
diff --git a/progs/redbook/scenebamb.c b/progs/redbook/scenebamb.c
index e7264d2003f..ea605f8c737 100644
--- a/progs/redbook/scenebamb.c
+++ b/progs/redbook/scenebamb.c
@@ -47,7 +47,7 @@
/* Initialize light source and lighting.
*/
-void myinit(void)
+static void myinit(void)
{
GLfloat light_ambient[] = { 0.0, 0.0, 1.0, 1.0 };
GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
@@ -66,7 +66,7 @@ void myinit(void)
glEnable(GL_DEPTH_TEST);
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -94,7 +94,7 @@ void display(void)
glFlush();
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
diff --git a/progs/redbook/sceneflat.c b/progs/redbook/sceneflat.c
index 10891fb9977..1b277334f5c 100644
--- a/progs/redbook/sceneflat.c
+++ b/progs/redbook/sceneflat.c
@@ -46,7 +46,7 @@
/* Initialize light source and shading model (GL_FLAT).
*/
-void myinit(void)
+static void myinit(void)
{
GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
@@ -66,7 +66,7 @@ void myinit(void)
glShadeModel (GL_FLAT);
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -94,7 +94,7 @@ void display(void)
glFlush();
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
diff --git a/progs/redbook/select.c b/progs/redbook/select.c
index 928373b8796..537d5194d46 100644
--- a/progs/redbook/select.c
+++ b/progs/redbook/select.c
@@ -57,7 +57,7 @@
/* draw a triangle with vertices at (x1, y1), (x2, y2)
* and (x3, y3) at z units away from the origin.
*/
-void drawTriangle (GLfloat x1, GLfloat y1, GLfloat x2,
+static void drawTriangle (GLfloat x1, GLfloat y1, GLfloat x2,
GLfloat y2, GLfloat x3, GLfloat y3, GLfloat z)
{
glBegin (GL_TRIANGLES);
@@ -68,8 +68,8 @@ void drawTriangle (GLfloat x1, GLfloat y1, GLfloat x2,
}
/* draw a rectangular box with these outer x, y, and z values */
-void drawViewVolume (GLfloat x1, GLfloat x2, GLfloat y1,
- GLfloat y2, GLfloat z1, GLfloat z2)
+static void drawViewVolume (GLfloat x1, GLfloat x2, GLfloat y1,
+ GLfloat y2, GLfloat z1, GLfloat z2)
{
glColor3f (1.0, 1.0, 1.0);
glBegin (GL_LINE_LOOP);
@@ -101,7 +101,7 @@ void drawViewVolume (GLfloat x1, GLfloat x2, GLfloat y1,
/* drawScene draws 4 triangles and a wire frame
* which represents the viewing volume.
*/
-void drawScene (void)
+static void drawScene (void)
{
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
@@ -122,7 +122,7 @@ void drawScene (void)
/* processHits prints out the contents of the selection array
*/
-void processHits (GLint hits, GLuint buffer[])
+static void processHits (GLint hits, GLuint buffer[])
{
GLint i;
GLuint j, names, *ptr;
@@ -150,7 +150,7 @@ void processHits (GLint hits, GLuint buffer[])
*/
#define BUFSIZE 512
-void selectObjects(void)
+static void selectObjects(void)
{
GLuint selectBuf[BUFSIZE];
GLint hits;
@@ -181,13 +181,13 @@ void selectObjects(void)
processHits (hits, selectBuf);
}
-void init (void)
+static void init (void)
{
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_FLAT);
}
-void display(void)
+static void display(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -197,7 +197,7 @@ void display(void)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/smooth.c b/progs/redbook/smooth.c
index 9d22fc90251..874033d5adf 100644
--- a/progs/redbook/smooth.c
+++ b/progs/redbook/smooth.c
@@ -43,13 +43,13 @@
#include <GL/glut.h>
#include <stdlib.h>
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_SMOOTH);
}
-void triangle(void)
+static void triangle(void)
{
glBegin (GL_TRIANGLES);
glColor3f (1.0, 0.0, 0.0);
@@ -61,14 +61,14 @@ void triangle(void)
glEnd();
}
-void display(void)
+static void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
triangle ();
glFlush ();
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
@@ -81,7 +81,7 @@ void reshape (int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/stencil.c b/progs/redbook/stencil.c
index b33e40a0307..5325abf8b77 100644
--- a/progs/redbook/stencil.c
+++ b/progs/redbook/stencil.c
@@ -64,7 +64,7 @@
#define YELLOWMAT 1
#define BLUEMAT 2
-void myinit (void)
+static void myinit (void)
{
GLfloat yellow_diffuse[] = { 0.7, 0.7, 0.0, 1.0 };
GLfloat yellow_specular[] = { 1.0, 1.0, 1.0, 1.0 };
@@ -101,7 +101,7 @@ void myinit (void)
/* Draw a sphere in a diamond-shaped section in the
* middle of a window with 2 tori.
*/
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -132,7 +132,7 @@ void display(void)
/* Whenever the window is reshaped, redefine the
* coordinate system and redraw the stencil area.
*/
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
diff --git a/progs/redbook/stroke.c b/progs/redbook/stroke.c
index 19b0391cbae..68b639abf4f 100644
--- a/progs/redbook/stroke.c
+++ b/progs/redbook/stroke.c
@@ -87,7 +87,7 @@ CP Sdata[] = {
/* drawLetter() interprets the instructions from the array
* for that letter and renders the letter with line segments.
*/
-void drawLetter(CP *l)
+static void drawLetter(CP *l)
{
glBegin(GL_LINE_STRIP);
for (;;) {
@@ -111,7 +111,7 @@ void drawLetter(CP *l)
}
/* Create a display list for each of 6 characters */
-void myinit (void)
+static void myinit (void)
{
GLuint base;
@@ -130,13 +130,13 @@ void myinit (void)
char *test1 = "A SPARE SERAPE APPEARS AS";
char *test2 = "APES PREPARE RARE PEPPERS";
-void printStrokedString(char *s)
+static void printStrokedString(char *s)
{
GLsizei len = (GLsizei) strlen(s);
glCallLists(len, GL_BYTE, (GLbyte *)s);
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
diff --git a/progs/redbook/surface.c b/progs/redbook/surface.c
index e33ce14f4fc..f0c5ab0b47c 100644
--- a/progs/redbook/surface.c
+++ b/progs/redbook/surface.c
@@ -53,7 +53,7 @@ GLUnurbsObj *theNurb;
* Initializes the control points of the surface to a small hill.
* The control points range from -3 to +3 in x, y, and z
*/
-void init_surface(void)
+static void init_surface(void)
{
int u, v;
for (u = 0; u < 4; u++) {
@@ -71,7 +71,7 @@ void init_surface(void)
/* Initialize material property and depth buffer.
*/
-void myinit(void)
+static void myinit(void)
{
GLfloat mat_diffuse[] = { 0.7, 0.7, 0.7, 1.0 };
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
@@ -100,7 +100,7 @@ void myinit(void)
glTranslatef (0.0, 0.0, -5.0);
}
-void display(void)
+static void display(void)
{
GLfloat knots[8] = {0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0};
int i, j;
@@ -140,7 +140,7 @@ void display(void)
glutSwapBuffers();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
@@ -150,7 +150,7 @@ void reshape(int w, int h)
glMatrixMode(GL_MODELVIEW);
}
-void
+static void
menu(int value)
{
switch (value) {
@@ -171,7 +171,7 @@ menu(int value)
int down = 0, lastx;
/* ARGSUSED1 */
-void
+static void
motion(int x, int y)
{
if (down) {
@@ -182,7 +182,7 @@ motion(int x, int y)
}
/* ARGSUSED3 */
-void
+static void
mouse(int button, int state, int x, int y)
{
if (button == GLUT_LEFT_BUTTON) {
diff --git a/progs/redbook/teaambient.c b/progs/redbook/teaambient.c
index 53b5111752f..20ff1a4a33b 100644
--- a/progs/redbook/teaambient.c
+++ b/progs/redbook/teaambient.c
@@ -47,7 +47,7 @@
/* Initialize light source and lighting model.
*/
-void
+static void
myinit(void)
{
GLfloat light_ambient[] =
@@ -78,7 +78,7 @@ myinit(void)
glEnable(GL_DEPTH_TEST);
}
-void
+static void
display(void)
{
GLfloat low_ambient[] =
@@ -114,7 +114,7 @@ display(void)
glFlush();
}
-void
+static void
myReshape(int w, int h)
{
glViewport(0, 0, w, h);
diff --git a/progs/redbook/teapots.c b/progs/redbook/teapots.c
index fb7aed380eb..102c18a3e33 100644
--- a/progs/redbook/teapots.c
+++ b/progs/redbook/teapots.c
@@ -49,7 +49,7 @@
* Initialize depth buffer, projection matrix, light source, and lighting
* model. Do not specify a material property here.
*/
-void
+static void
myinit(void)
{
GLfloat ambient[] =
@@ -83,7 +83,7 @@ myinit(void)
* Move object into position. Use 3rd through 12th parameters to specify the
* material property. Draw a teapot.
*/
-void
+static void
renderTeapot(GLfloat x, GLfloat y,
GLfloat ambr, GLfloat ambg, GLfloat ambb,
GLfloat difr, GLfloat difg, GLfloat difb,
@@ -117,7 +117,7 @@ renderTeapot(GLfloat x, GLfloat y,
* 3rd column: black, cyan, green, red, white, yellow plastic
* 4th column: black, cyan, green, red, white, yellow rubber
*/
-void
+static void
display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -173,7 +173,7 @@ display(void)
glFlush();
}
-void
+static void
myReshape(int w, int h)
{
glViewport(0, 0, w, h);
diff --git a/progs/redbook/tess.c b/progs/redbook/tess.c
index 238a469aff2..0bf8a8eb986 100644
--- a/progs/redbook/tess.c
+++ b/progs/redbook/tess.c
@@ -61,7 +61,7 @@
GLuint startList;
-void display (void) {
+static void display (void) {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glCallList(startList);
@@ -69,12 +69,12 @@ void display (void) {
glFlush();
}
-void CALLBACK beginCallback(GLenum which)
+static void CALLBACK beginCallback(GLenum which)
{
glBegin(which);
}
-void CALLBACK errorCallback(GLenum errorCode)
+static void CALLBACK errorCallback(GLenum errorCode)
{
const GLubyte *estring;
@@ -83,12 +83,12 @@ void CALLBACK errorCallback(GLenum errorCode)
exit(0);
}
-void CALLBACK endCallback(void)
+static void CALLBACK endCallback(void)
{
glEnd();
}
-void CALLBACK vertexCallback(GLvoid *vertex)
+static void CALLBACK vertexCallback(GLvoid *vertex)
{
const GLdouble *pointer;
@@ -102,7 +102,7 @@ void CALLBACK vertexCallback(GLvoid *vertex)
* but weight[4] may be used to average color, normal, or texture
* coordinate data. In this program, color is weighted.
*/
-void CALLBACK combineCallback(GLdouble coords[3],
+static void CALLBACK combineCallback(GLdouble coords[3],
GLdouble *vertex_data[4],
GLfloat weight[4], GLdouble **dataOut )
{
@@ -122,7 +122,7 @@ void CALLBACK combineCallback(GLdouble coords[3],
*dataOut = vertex;
}
-void init (void)
+static void init (void)
{
GLUtesselator *tobj;
GLdouble rect[4][3] = {{50.0, 50.0, 0.0},
@@ -199,7 +199,7 @@ void init (void)
gluDeleteTess(tobj);
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -208,7 +208,7 @@ void reshape (int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/tesswind.c b/progs/redbook/tesswind.c
index 7d00c9f907d..4729880a57e 100644
--- a/progs/redbook/tesswind.c
+++ b/progs/redbook/tesswind.c
@@ -61,7 +61,7 @@ GLuint list;
/* Make four display lists,
* each with a different tessellated object.
*/
-void makeNewLists (void) {
+static void makeNewLists (void) {
int i;
static GLdouble rects[12][3] =
{{ 50.0, 50.0, 0.0}, {300.0, 50.0, 0.0},
@@ -153,7 +153,7 @@ void makeNewLists (void) {
glEndList();
}
-void display (void) {
+static void display (void) {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glPushMatrix();
@@ -168,12 +168,12 @@ void display (void) {
glFlush();
}
-void CALLBACK beginCallback(GLenum which)
+static void CALLBACK beginCallback(GLenum which)
{
glBegin(which);
}
-void CALLBACK errorCallback(GLenum errorCode)
+static void CALLBACK errorCallback(GLenum errorCode)
{
const GLubyte *estring;
@@ -182,7 +182,7 @@ void CALLBACK errorCallback(GLenum errorCode)
exit(0);
}
-void CALLBACK endCallback(void)
+static void CALLBACK endCallback(void)
{
glEnd();
}
@@ -193,7 +193,7 @@ void CALLBACK endCallback(void)
* coordinate data.
*/
/* ARGSUSED */
-void CALLBACK combineCallback(GLdouble coords[3], GLdouble *data[4],
+static void CALLBACK combineCallback(GLdouble coords[3], GLdouble *data[4],
GLfloat weight[4], GLdouble **dataOut )
{
GLdouble *vertex;
@@ -205,7 +205,7 @@ void CALLBACK combineCallback(GLdouble coords[3], GLdouble *data[4],
*dataOut = vertex;
}
-void init(void)
+static void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT);
@@ -226,7 +226,7 @@ void init(void)
makeNewLists();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -240,7 +240,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 'w':
diff --git a/progs/redbook/texbind.c b/progs/redbook/texbind.c
index 6a828ab2bdf..b6404b32d8c 100644
--- a/progs/redbook/texbind.c
+++ b/progs/redbook/texbind.c
@@ -52,7 +52,7 @@ static GLubyte otherImage[checkImageHeight][checkImageWidth][4];
static GLuint texName[2];
-void makeCheckImages(void)
+static void makeCheckImages(void)
{
int i, j, c;
@@ -72,7 +72,7 @@ void makeCheckImages(void)
}
}
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT);
@@ -105,7 +105,7 @@ void init(void)
glEnable(GL_TEXTURE_2D);
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBindTexture(GL_TEXTURE_2D, texName[0]);
@@ -125,7 +125,7 @@ void display(void)
glFlush();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -137,7 +137,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/texgen.c b/progs/redbook/texgen.c
index 7c1802a3be9..5cb97e5a43d 100644
--- a/progs/redbook/texgen.c
+++ b/progs/redbook/texgen.c
@@ -60,7 +60,7 @@ GLubyte stripeImage[4*stripeImageWidth];
static GLuint texName;
#endif
-void makeStripeImage(void)
+static void makeStripeImage(void)
{
int j;
@@ -79,7 +79,7 @@ static GLfloat *currentCoeff;
static GLenum currentPlane;
static GLint currentGenMode;
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glEnable(GL_DEPTH_TEST);
@@ -122,7 +122,7 @@ void init(void)
glMaterialf (GL_FRONT, GL_SHININESS, 64.0);
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -136,7 +136,7 @@ void display(void)
glFlush();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -152,7 +152,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard (unsigned char key, int x, int y)
+static void keyboard (unsigned char key, int x, int y)
{
switch (key) {
case 'e':
diff --git a/progs/redbook/texprox.c b/progs/redbook/texprox.c
index 6f1e853facd..c2d699a71b2 100644
--- a/progs/redbook/texprox.c
+++ b/progs/redbook/texprox.c
@@ -53,7 +53,7 @@
#define GL_TEXTURE_INTERNAL_FORMAT GL_TEXTURE_COMPONENTS
#endif
-void init(void)
+static void init(void)
{
GLint proxyComponents;
@@ -84,12 +84,12 @@ void init(void)
putchar('\n');
}
-void display(void)
+static void display(void)
{
exit(0);
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
diff --git a/progs/redbook/texsub.c b/progs/redbook/texsub.c
index 4e829675aba..7827d5a45f3 100644
--- a/progs/redbook/texsub.c
+++ b/progs/redbook/texsub.c
@@ -58,7 +58,7 @@ static GLubyte subImage[subImageHeight][subImageWidth][4];
static GLuint texName;
-void makeCheckImages(void)
+static void makeCheckImages(void)
{
int i, j, c;
@@ -82,7 +82,7 @@ void makeCheckImages(void)
}
}
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT);
@@ -102,7 +102,7 @@ void init(void)
0, GL_RGBA, GL_UNSIGNED_BYTE, checkImage);
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
@@ -123,7 +123,7 @@ void display(void)
glDisable(GL_TEXTURE_2D);
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -135,7 +135,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard (unsigned char key, int x, int y)
+static void keyboard (unsigned char key, int x, int y)
{
switch (key) {
case 's':
diff --git a/progs/redbook/texturesurf.c b/progs/redbook/texturesurf.c
index 0170070eaa5..2023072dba8 100644
--- a/progs/redbook/texturesurf.c
+++ b/progs/redbook/texturesurf.c
@@ -60,7 +60,7 @@ GLfloat ctrlpoints[4][4][3] = {
GLfloat texpts[2][2][2] = {{{0.0, 0.0}, {0.0, 1.0}},
{{1.0, 0.0}, {1.0, 1.0}}};
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
@@ -72,7 +72,7 @@ void display(void)
#define imageHeight 64
GLubyte image[3*imageWidth*imageHeight];
-void makeImage(void)
+static void makeImage(void)
{
int i, j;
float ti, tj;
@@ -89,7 +89,7 @@ void makeImage(void)
}
}
-void myinit(void)
+static void myinit(void)
{
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4,
0, 1, 12, 4, &ctrlpoints[0][0][0]);
@@ -112,7 +112,7 @@ void myinit(void)
glShadeModel (GL_FLAT);
}
-void myReshape(int w, int h)
+static void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
diff --git a/progs/redbook/torus.c b/progs/redbook/torus.c
index 7ae4d41e263..a67d48e0f59 100644
--- a/progs/redbook/torus.c
+++ b/progs/redbook/torus.c
@@ -89,7 +89,7 @@ static void init(void)
}
/* Clear window and draw torus */
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
@@ -98,7 +98,7 @@ void display(void)
}
/* Handle window resize */
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -112,7 +112,7 @@ void reshape(int w, int h)
/* Rotate about x-axis when "x" typed; rotate about y-axis
when "y" typed; "i" returns torus to original view */
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 'x':
diff --git a/progs/redbook/trim.c b/progs/redbook/trim.c
index f17674f6840..216f62a7c2f 100644
--- a/progs/redbook/trim.c
+++ b/progs/redbook/trim.c
@@ -59,7 +59,7 @@ GLUnurbsObj *theNurb;
* Initializes the control points of the surface to a small hill.
* The control points range from -3 to +3 in x, y, and z
*/
-void init_surface(void)
+static void init_surface(void)
{
int u, v;
for (u = 0; u < 4; u++) {
@@ -75,7 +75,7 @@ void init_surface(void)
}
}
-void nurbsError(GLenum errorCode)
+static void nurbsError(GLenum errorCode)
{
const GLubyte *estring;
@@ -86,7 +86,7 @@ void nurbsError(GLenum errorCode)
/* Initialize material property and depth buffer.
*/
-void init(void)
+static void init(void)
{
GLfloat mat_diffuse[] = { 0.7, 0.7, 0.7, 1.0 };
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
@@ -112,7 +112,7 @@ void init(void)
(GLvoid (CALLBACK*) ()) nurbsError);
}
-void display(void)
+static void display(void)
{
GLfloat knots[8] = {0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0};
GLfloat edgePt[5][2] = /* counter clockwise */
@@ -147,7 +147,7 @@ void display(void)
glFlush();
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -160,7 +160,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/unproject.c b/progs/redbook/unproject.c
index 134c361bac5..6d1c7dbeded 100644
--- a/progs/redbook/unproject.c
+++ b/progs/redbook/unproject.c
@@ -45,14 +45,14 @@
#include <stdlib.h>
#include <stdio.h>
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
/* Change these values for a different transformation */
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -62,7 +62,7 @@ void reshape(int w, int h)
glLoadIdentity();
}
-void mouse(int button, int state, int x, int y)
+static void mouse(int button, int state, int x, int y)
{
GLint viewport[4];
GLdouble mvmatrix[16], projmatrix[16];
@@ -98,7 +98,7 @@ void mouse(int button, int state, int x, int y)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/varray.c b/progs/redbook/varray.c
index b22e723e0ec..8ce39d77633 100644
--- a/progs/redbook/varray.c
+++ b/progs/redbook/varray.c
@@ -54,7 +54,7 @@
int setupMethod = POINTER;
int derefMethod = DRAWARRAY;
-void setupPointers(void)
+static void setupPointers(void)
{
static GLint vertices[] = {25, 25,
100, 325,
@@ -76,7 +76,7 @@ void setupPointers(void)
glColorPointer (3, GL_FLOAT, 0, colors);
}
-void setupInterleave(void)
+static void setupInterleave(void)
{
static GLfloat intertwined[] =
{1.0, 0.2, 1.0, 100.0, 100.0, 0.0,
@@ -89,14 +89,14 @@ void setupInterleave(void)
glInterleavedArrays (GL_C3F_V3F, 0, intertwined);
}
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_SMOOTH);
setupPointers ();
}
-void display(void)
+static void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
@@ -117,7 +117,7 @@ void display(void)
glFlush ();
}
-void reshape (int w, int h)
+static void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
@@ -126,7 +126,7 @@ void reshape (int w, int h)
}
/* ARGSUSED2 */
-void mouse (int button, int state, int x, int y)
+static void mouse (int button, int state, int x, int y)
{
switch (button) {
case GLUT_LEFT_BUTTON:
@@ -160,7 +160,7 @@ void mouse (int button, int state, int x, int y)
}
/* ARGSUSED1 */
-void keyboard(unsigned char key, int x, int y)
+static void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
diff --git a/progs/redbook/wrap.c b/progs/redbook/wrap.c
index f9a1f162ab6..67749716e83 100644
--- a/progs/redbook/wrap.c
+++ b/progs/redbook/wrap.c
@@ -59,7 +59,7 @@ static GLubyte checkImage[checkImageHeight][checkImageWidth][4];
static GLuint texName;
#endif
-void makeCheckImage(void)
+static void makeCheckImage(void)
{
int i, j, c;
@@ -74,7 +74,7 @@ void makeCheckImage(void)
}
}
-void init(void)
+static void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT);
@@ -101,7 +101,7 @@ void init(void)
#endif
}
-void display(void)
+static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
@@ -125,7 +125,7 @@ void display(void)
glDisable(GL_TEXTURE_2D);
}
-void reshape(int w, int h)
+static void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
@@ -137,7 +137,7 @@ void reshape(int w, int h)
}
/* ARGSUSED1 */
-void keyboard (unsigned char key, int x, int y)
+static void keyboard (unsigned char key, int x, int y)
{
switch (key) {
case 's':
diff --git a/progs/util/readtex.c b/progs/util/readtex.c
index d1c50a494aa..f6f511481ca 100644
--- a/progs/util/readtex.c
+++ b/progs/util/readtex.c
@@ -9,6 +9,7 @@
#include <GL/gl.h>
#include <GL/glu.h>
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -89,6 +90,7 @@ static rawImageRec *RawImageOpen(const char *fileName)
rawImageRec *raw;
GLenum swapFlag;
int x;
+ size_t result;
endianTest.testWord = 1;
if (endianTest.testByte[0] == 1) {
@@ -114,7 +116,8 @@ static rawImageRec *RawImageOpen(const char *fileName)
}
}
- fread(raw, 1, 12, raw->file);
+ result = fread(raw, 1, 12, raw->file);
+ assert(result == 12);
if (swapFlag) {
ConvertShort(&raw->imagic, 1);
@@ -162,8 +165,10 @@ static rawImageRec *RawImageOpen(const char *fileName)
}
raw->rleEnd = 512 + (2 * x);
fseek(raw->file, 512, SEEK_SET);
- fread(raw->rowStart, 1, x, raw->file);
- fread(raw->rowSize, 1, x, raw->file);
+ result = fread(raw->rowStart, 1, x, raw->file);
+ assert(result == x);
+ result = fread(raw->rowSize, 1, x, raw->file);
+ assert(result == x);
if (swapFlag) {
ConvertLong(raw->rowStart, (long) (x/sizeof(GLuint)));
ConvertLong((GLuint *)raw->rowSize, (long) (x/sizeof(GLint)));
@@ -193,11 +198,13 @@ static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z)
{
unsigned char *iPtr, *oPtr, pixel;
int count, done = 0;
+ size_t result;
if ((raw->type & 0xFF00) == 0x0100) {
fseek(raw->file, (long) raw->rowStart[y+z*raw->sizeY], SEEK_SET);
- fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY],
- raw->file);
+ result = fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY],
+ raw->file);
+ assert(result == (unsigned int)raw->rowSize[y+z*raw->sizeY]);
iPtr = raw->tmp;
oPtr = buf;
@@ -222,7 +229,8 @@ static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z)
} else {
fseek(raw->file, 512+(y*raw->sizeX)+(z*raw->sizeX*raw->sizeY),
SEEK_SET);
- fread(buf, 1, raw->sizeX, raw->file);
+ result = fread(buf, 1, raw->sizeX, raw->file);
+ assert(result == raw->sizeX);
}
}
diff --git a/progs/xdemos/corender.c b/progs/xdemos/corender.c
index 1b18d9f54e7..640c902c136 100644
--- a/progs/xdemos/corender.c
+++ b/progs/xdemos/corender.c
@@ -187,7 +187,7 @@ redraw(Display *dpy)
* Without this glClear(), depth buffer for the second process
* is pretty much broken.
*/
- //glClear(GL_DEPTH_BUFFER_BIT);
+ /* glClear(GL_DEPTH_BUFFER_BIT); */
glPushMatrix();
glTranslatef(1, 0, 0);
diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c
index 23df82f6f90..30cd5680642 100644
--- a/progs/xdemos/glxinfo.c
+++ b/progs/xdemos/glxinfo.c
@@ -116,7 +116,7 @@ print_extension_list(const char *ext)
return;
width = indent;
- printf(indentString);
+ printf("%s", indentString);
i = j = 0;
while (1) {
if (ext[j] == ' ' || ext[j] == 0) {
@@ -126,7 +126,7 @@ print_extension_list(const char *ext)
/* start a new line */
printf("\n");
width = indent;
- printf(indentString);
+ printf("%s", indentString);
}
/* print the extension name between ext[i] and ext[j] */
while (i < j) {
diff --git a/src/gallium/auxiliary/rbug/rbug_context.h b/src/gallium/auxiliary/rbug/rbug_context.h
index da61c2365b0..03126d6b123 100644
--- a/src/gallium/auxiliary/rbug/rbug_context.h
+++ b/src/gallium/auxiliary/rbug/rbug_context.h
@@ -46,7 +46,7 @@ typedef enum
RBUG_BLOCK_BEFORE = 1,
RBUG_BLOCK_AFTER = 2,
RBUG_BLOCK_RULE = 4,
- RBUG_BLOCK_MASK = 7,
+ RBUG_BLOCK_MASK = 7
} rbug_block_t;
struct rbug_proto_context_list
diff --git a/src/gallium/auxiliary/rbug/rbug_proto.h b/src/gallium/auxiliary/rbug/rbug_proto.h
index d273be0166d..4f3eb75dc4d 100644
--- a/src/gallium/auxiliary/rbug/rbug_proto.h
+++ b/src/gallium/auxiliary/rbug/rbug_proto.h
@@ -65,7 +65,7 @@ enum rbug_opcode
RBUG_OP_SHADER_DISABLE = 770,
RBUG_OP_SHADER_REPLACE = 771,
RBUG_OP_SHADER_LIST_REPLY = -768,
- RBUG_OP_SHADER_INFO_REPLY = -769,
+ RBUG_OP_SHADER_INFO_REPLY = -769
};
/**
diff --git a/src/gallium/auxiliary/util/u_clear.h b/src/gallium/auxiliary/util/u_clear.h
index 7c16b32cf9f..7035c68aed0 100644
--- a/src/gallium/auxiliary/util/u_clear.h
+++ b/src/gallium/auxiliary/util/u_clear.h
@@ -45,7 +45,7 @@ util_clear(struct pipe_context *pipe,
{
if (buffers & PIPE_CLEAR_COLOR) {
struct pipe_surface *ps = framebuffer->cbufs[0];
- unsigned color;
+ unsigned color = 0;
util_pack_color(rgba, ps->format, &color);
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color);
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index 96d400c839b..be5eb87e474 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -452,7 +452,8 @@ debug_dump_flags(const struct debug_named_value *names,
util_strncat(output, "|", sizeof(output));
else
first = 0;
- util_strncat(output, names->name, sizeof(output));
+ util_strncat(output, names->name, sizeof(output) - 1);
+ output[sizeof(output) - 1] = '\0';
value &= ~names->value;
}
++names;
@@ -465,7 +466,8 @@ debug_dump_flags(const struct debug_named_value *names,
first = 0;
util_snprintf(rest, sizeof(rest), "0x%08lx", value);
- util_strncat(output, rest, sizeof(output));
+ util_strncat(output, rest, sizeof(output) - 1);
+ output[sizeof(output) - 1] = '\0';
}
if(first)
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index 7b5b7fcda5b..bd27f346924 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -79,7 +79,7 @@ enum util_format_colorspace {
UTIL_FORMAT_COLORSPACE_RGB = 0,
UTIL_FORMAT_COLORSPACE_SRGB = 1,
UTIL_FORMAT_COLORSPACE_YUV = 2,
- UTIL_FORMAT_COLORSPACE_ZS = 3,
+ UTIL_FORMAT_COLORSPACE_ZS = 3
};
diff --git a/src/gallium/auxiliary/util/u_network.c b/src/gallium/auxiliary/util/u_network.c
index bc4b7584067..9eb8f309cd1 100644
--- a/src/gallium/auxiliary/util/u_network.c
+++ b/src/gallium/auxiliary/util/u_network.c
@@ -6,7 +6,7 @@
#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
# include <winsock2.h>
# include <windows.h>
-#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU)
+#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_APPLE)
# include <sys/socket.h>
# include <netinet/in.h>
# include <unistd.h>
@@ -54,7 +54,7 @@ u_socket_close(int s)
if (s < 0)
return;
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_APPLE)
shutdown(s, SHUT_RDWR);
close(s);
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
@@ -169,7 +169,7 @@ u_socket_listen_on_port(uint16_t portnum)
void
u_socket_block(int s, boolean block)
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_APPLE)
int old = fcntl(s, F_GETFL, 0);
if (old == -1)
return;
diff --git a/src/gallium/auxiliary/util/u_network.h b/src/gallium/auxiliary/util/u_network.h
index 8c778f492ca..187dcab86e7 100644
--- a/src/gallium/auxiliary/util/u_network.h
+++ b/src/gallium/auxiliary/util/u_network.h
@@ -6,7 +6,7 @@
#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
# define PIPE_HAVE_SOCKETS
-#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU)
+#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_APPLE)
# define PIPE_HAVE_SOCKETS
#endif
diff --git a/src/gallium/auxiliary/util/u_stream_stdc.c b/src/gallium/auxiliary/util/u_stream_stdc.c
index 5cd05b29047..4d976d6dca4 100644
--- a/src/gallium/auxiliary/util/u_stream_stdc.c
+++ b/src/gallium/auxiliary/util/u_stream_stdc.c
@@ -32,7 +32,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_APPLE)
#include <stdio.h>
diff --git a/src/gallium/drivers/i915simple/i915_state.c b/src/gallium/drivers/i915simple/i915_state.c
index 0087dfa410f..352a4ae2f34 100644
--- a/src/gallium/drivers/i915simple/i915_state.c
+++ b/src/gallium/drivers/i915simple/i915_state.c
@@ -58,8 +58,10 @@ translate_wrap_mode(unsigned wrap)
return TEXCOORDMODE_CLAMP_EDGE;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
return TEXCOORDMODE_CLAMP_BORDER;
-// case PIPE_TEX_WRAP_MIRRORED_REPEAT:
-// return TEXCOORDMODE_MIRROR;
+ /*
+ case PIPE_TEX_WRAP_MIRRORED_REPEAT:
+ return TEXCOORDMODE_MIRROR;
+ */
default:
return TEXCOORDMODE_WRAP;
}
diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c
index b1e18805c70..43ed4c2494f 100644
--- a/src/gallium/drivers/softpipe/sp_quad_blend.c
+++ b/src/gallium/drivers/softpipe/sp_quad_blend.c
@@ -258,7 +258,8 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
/* loop over colorbuffer outputs */
for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) {
- float source[4][QUAD_SIZE], dest[4][QUAD_SIZE];
+ float source[4][QUAD_SIZE] = { { 0 } };
+ float dest[4][QUAD_SIZE];
struct softpipe_cached_tile *tile
= sp_get_cached_tile(softpipe,
softpipe->cbuf_cache[cbuf],
diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
index 7e2ccbcfdc5..0f45e211a32 100644
--- a/src/gallium/drivers/trace/tr_dump.c
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -40,7 +40,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE)
#include <stdlib.h>
#endif
@@ -258,7 +258,7 @@ boolean trace_dump_trace_begin()
trace_dump_writes("<?xml-stylesheet type='text/xsl' href='trace.xsl'?>\n");
trace_dump_writes("<trace version='0.1'>\n");
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE)
/* Linux applications rarely cleanup GL / Gallium resources so catch
* application exit here */
atexit(trace_dump_trace_close);
diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c
index e85ac15edca..0372d92782b 100644
--- a/src/gallium/drivers/trace/tr_rbug.c
+++ b/src/gallium/drivers/trace/tr_rbug.c
@@ -44,7 +44,7 @@
#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
# define sleep Sleep
-#elif defined(PIPE_OS_LINUX)
+#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_APPLE)
void usleep(int);
# define sleep usleep
#else
@@ -179,7 +179,7 @@ static int
trace_rbug_texture_info(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial)
{
struct trace_screen *tr_scr = tr_rbug->tr_scr;
- struct trace_texture *tr_tex;
+ struct trace_texture *tr_tex = NULL;
struct rbug_proto_texture_info *gpti = (struct rbug_proto_texture_info *)header;
struct tr_list *ptr;
struct pipe_texture *t;
@@ -220,7 +220,7 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header,
struct rbug_proto_texture_read *gptr = (struct rbug_proto_texture_read *)header;
struct trace_screen *tr_scr = tr_rbug->tr_scr;
- struct trace_texture *tr_tex;
+ struct trace_texture *tr_tex = NULL;
struct tr_list *ptr;
struct pipe_screen *screen = tr_scr->screen;
diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c
index 69e2d6b7081..277ad9d0eb9 100644
--- a/src/gallium/state_trackers/egl/egl_surface.c
+++ b/src/gallium/state_trackers/egl/egl_surface.c
@@ -141,9 +141,9 @@ drm_takedown_shown_screen(_EGLDisplay *dpy, struct drm_screen *screen)
drmModeSetCrtc(
dev->drmFD,
screen->crtcID,
- 0, // FD
+ 0, /* FD */
0, 0,
- NULL, 0, // List of output ids
+ NULL, 0, /* List of output ids */
NULL);
drmModeRmFB(dev->drmFD, screen->fbID);
diff --git a/src/gallium/state_trackers/vega/arc.c b/src/gallium/state_trackers/vega/arc.c
index e74c7f03345..36cde7ab032 100644
--- a/src/gallium/state_trackers/vega/arc.c
+++ b/src/gallium/state_trackers/vega/arc.c
@@ -537,8 +537,9 @@ static INLINE int num_beziers_needed(struct arc *arc)
double d_eta = (max_eta - min_eta) / n;
if (d_eta <= 0.5 * M_PI) {
double eta_b = min_eta;
+ int i;
found = VG_TRUE;
- for (int i = 0; found && (i < n); ++i) {
+ for (i = 0; found && (i < n); ++i) {
double etaA = eta_b;
eta_b += d_eta;
found = (estimate_error(arc, etaA, eta_b) <= threshold);
@@ -559,6 +560,7 @@ static void arc_to_beziers(struct arc *arc,
sin_eta_b, a_cos_eta_b, b_sin_eta_b, a_sin_eta_b,
b_cos_eta_b, x_b, y_b, x_b_dot, y_b_dot, lx, ly;
double t, alpha;
+ int i;
{ /* always move to the start of the arc */
VGfloat x = arc->x1;
@@ -607,7 +609,7 @@ static void arc_to_beziers(struct arc *arc,
t = tan(0.5 * d_eta);
alpha = sin(d_eta) * (sqrt(4 + 3 * t * t) - 1) / 3;
- for (int i = 0; i < n; ++i) {
+ for (i = 0; i < n; ++i) {
struct bezier bezier;
double xA = x_b;
double yA = y_b;
diff --git a/src/gallium/state_trackers/vega/bezier.c b/src/gallium/state_trackers/vega/bezier.c
index 39a7ade0161..d1ee41ac337 100644
--- a/src/gallium/state_trackers/vega/bezier.c
+++ b/src/gallium/state_trackers/vega/bezier.c
@@ -255,7 +255,8 @@ static enum shift_result good_offset(const struct bezier *b1,
const float max_dist_line = threshold*offset*offset;
const float max_dist_normal = threshold*offset;
const float spacing = 0.25;
- for (float i = spacing; i < 0.99; i += spacing) {
+ float i;
+ for (i = spacing; i < 0.99; i += spacing) {
float p1[2],p2[2], d, l;
float normal[2];
bezier_point_at(b1, i, p1);
@@ -341,6 +342,8 @@ static enum shift_result shift(const struct bezier *orig,
float points_shifted[4][2];
float prev_normal[2];
+ int i;
+
points[np][0] = orig->x1;
points[np][1] = orig->y1;
map[0] = 0;
@@ -404,7 +407,7 @@ static enum shift_result shift(const struct bezier *orig,
points_shifted[0][0] = points[0][0] + offset * prev_normal[0];
points_shifted[0][1] = points[0][1] + offset * prev_normal[1];
- for (int i = 1; i < np - 1; ++i) {
+ for (i = 1; i < np - 1; ++i) {
float normal_sum[2], r;
float next_normal[2];
compute_pt_normal(points[i], points[i + 1], next_normal);
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index e0ff02f3a99..1572c9f3798 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -231,6 +231,7 @@ static void update_clip_state(struct vg_context *ctx)
if (state->scissoring) {
struct pipe_blend_state *blend = &ctx->state.g3d.blend;
struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
+ int i;
dsa->depth.writemask = 1;/*glDepthMask(TRUE);*/
dsa->depth.func = PIPE_FUNC_ALWAYS;
dsa->depth.enabled = 1;
@@ -254,7 +255,7 @@ static void update_clip_state(struct vg_context *ctx)
cso_set_blend(ctx->cso_context, blend);
/* enable scissoring */
- for (int i = 0; i < state->scissor_rects_num; ++i) {
+ for (i = 0; i < state->scissor_rects_num; ++i) {
const float x = state->scissor_rects[i * 4 + 0].f;
const float y = state->scissor_rects[i * 4 + 1].f;
const float width = state->scissor_rects[i * 4 + 2].f;
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index 67fe29a69da..669bb5401ad 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -64,7 +64,7 @@ struct crtc_private
static void
crtc_dpms(xf86CrtcPtr crtc, int mode)
{
- //ScrnInfoPtr pScrn = crtc->scrn;
+ /* ScrnInfoPtr pScrn = crtc->scrn; */
switch (mode) {
case DPMSModeOn:
@@ -141,7 +141,7 @@ crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
static void
crtc_load_lut(xf86CrtcPtr crtc)
{
- //ScrnInfoPtr pScrn = crtc->scrn;
+ /* ScrnInfoPtr pScrn = crtc->scrn; */
}
#endif
@@ -154,7 +154,7 @@ crtc_gamma_set(xf86CrtcPtr crtc, CARD16 * red, CARD16 * green, CARD16 * blue,
static void *
crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
{
- //ScrnInfoPtr pScrn = crtc->scrn;
+ /* ScrnInfoPtr pScrn = crtc->scrn; */
return NULL;
}
@@ -162,7 +162,7 @@ crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
static PixmapPtr
crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
{
- //ScrnInfoPtr pScrn = crtc->scrn;
+ /* ScrnInfoPtr pScrn = crtc->scrn; */
return NULL;
}
@@ -170,7 +170,7 @@ crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
static void
crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
{
- //ScrnInfoPtr pScrn = crtc->scrn;
+ /* ScrnInfoPtr pScrn = crtc->scrn; */
}
static void
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index 643b6b3b9e4..05f14734cd2 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -179,10 +179,12 @@ static Bool
crtc_resize(ScrnInfoPtr pScrn, int width, int height)
{
modesettingPtr ms = modesettingPTR(pScrn);
- //ScreenPtr pScreen = pScrn->pScreen;
- //PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen);
- //Bool fbAccessDisabled;
- //CARD8 *fbstart;
+ /*
+ ScreenPtr pScreen = pScrn->pScreen;
+ PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen);
+ Bool fbAccessDisabled;
+ CARD8 *fbstart;
+ */
if (width == pScrn->virtualX && height == pScrn->virtualY)
return TRUE;
diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c
index 4c5a1d2ea89..01025659b9f 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c
@@ -31,6 +31,7 @@ intel_drm_get_device_id(unsigned int *device_id)
}
shutup_gcc = fgets(path, sizeof(path), file);
+ (void) shutup_gcc;
sscanf(path, "%x", device_id);
fclose(file);
}
diff --git a/src/gallium/winsys/xlib/Makefile b/src/gallium/winsys/xlib/Makefile
index 3a1945d92c5..f34609386dd 100644
--- a/src/gallium/winsys/xlib/Makefile
+++ b/src/gallium/winsys/xlib/Makefile
@@ -87,11 +87,11 @@ depend: $(XLIB_WINSYS_SOURCES)
install: default
- $(INSTALL) -d $(INSTALL_DIR)/include/GL
- $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
- $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(INSTALL_DIR)/include/GL
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(DESTDIR)$(INSTALL_DIR)/include/GL
@if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \
- $(MINSTALL) $(TOP)/$(LIB_DIR)/libGL* $(INSTALL_DIR)/$(LIB_DIR); \
+ $(MINSTALL) $(TOP)/$(LIB_DIR)/libGL* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \
fi
diff --git a/src/gallium/winsys/xlib/xlib_brw_context.c b/src/gallium/winsys/xlib/xlib_brw_context.c
index 09599507f44..fc9addd09e3 100644
--- a/src/gallium/winsys/xlib/xlib_brw_context.c
+++ b/src/gallium/winsys/xlib/xlib_brw_context.c
@@ -33,8 +33,8 @@
*/
-//#include "glxheader.h"
-//#include "xmesaP.h"
+/* #include "glxheader.h" */
+/* #include "xmesaP.h" */
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
diff --git a/src/glu/sgi/libnurbs/internals/arcsorter.h b/src/glu/sgi/libnurbs/internals/arcsorter.h
index d72dd1e86ce..a55df926772 100644
--- a/src/glu/sgi/libnurbs/internals/arcsorter.h
+++ b/src/glu/sgi/libnurbs/internals/arcsorter.h
@@ -37,7 +37,6 @@
#define __gluarcsorter_h_
#include "sorter.h"
-#include "arcsorter.h"
class Arc;
class Subdivider;
diff --git a/src/glu/sgi/libnurbs/internals/subdivider.cc b/src/glu/sgi/libnurbs/internals/subdivider.cc
index cc0b5147065..ccddc270ff9 100644
--- a/src/glu/sgi/libnurbs/internals/subdivider.cc
+++ b/src/glu/sgi/libnurbs/internals/subdivider.cc
@@ -531,16 +531,18 @@ Subdivider::nonSamplingSplit(
patchlist.pspec[param].range[1] ) * 0.5;
split( source, left, right, param, mid );
Patchlist subpatchlist( patchlist, param, mid );
- if( left.isnonempty() )
+ if( left.isnonempty() ) {
if( subpatchlist.cullCheck() == CULL_TRIVIAL_REJECT )
freejarcs( left );
else
nonSamplingSplit( left, subpatchlist, subdivisions-1, param );
- if( right.isnonempty() )
+ }
+ if( right.isnonempty() ) {
if( patchlist.cullCheck() == CULL_TRIVIAL_REJECT )
freejarcs( right );
else
nonSamplingSplit( right, patchlist, subdivisions-1, param );
+ }
} else {
// make bbox calls
diff --git a/src/glu/sgi/libnurbs/nurbtess/directedLine.cc b/src/glu/sgi/libnurbs/nurbtess/directedLine.cc
index 74450352d8c..5be1ae3976a 100644
--- a/src/glu/sgi/libnurbs/nurbtess/directedLine.cc
+++ b/src/glu/sgi/libnurbs/nurbtess/directedLine.cc
@@ -800,7 +800,7 @@ directedLine* readAllPolygons(char* filename)
{
Int nEdges;
fscanf(fp, "%i", &nEdges);
- Real vert[2][2];
+ Real vert[2][2] = { { 0 } };
Real VV[2][2];
/*the first two vertices*/
fscanf(fp, "%f", &(vert[0][0]));
diff --git a/src/glu/sgi/libnurbs/nurbtess/partitionY.cc b/src/glu/sgi/libnurbs/nurbtess/partitionY.cc
index 297c6299766..e097461ac5e 100644
--- a/src/glu/sgi/libnurbs/nurbtess/partitionY.cc
+++ b/src/glu/sgi/libnurbs/nurbtess/partitionY.cc
@@ -111,8 +111,8 @@ Int isCusp(directedLine *v)
else if(A[1] > B[1] && C[1] > B[1])
return 1;
- if(isAbove(v, v) && isAbove(v, v->getPrev()) ||
- isBelow(v, v) && isBelow(v, v->getPrev()))
+ if((isAbove(v, v) && isAbove(v, v->getPrev())) ||
+ (isBelow(v, v) && isBelow(v, v->getPrev())))
return 1;
else
return 0;
diff --git a/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc b/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc
index e12f88bab12..2e70f839363 100644
--- a/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc
+++ b/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc
@@ -207,7 +207,7 @@ void sampleBotRightWithGridLine(Real* botVertex,
return;
}
- Int segIndexMono, segIndexPass;
+ Int segIndexMono = 0, segIndexPass;
findBotRightSegment(rightChain,
rightEnd,
rightCorner,
@@ -293,7 +293,7 @@ void sampleBotLeftWithGridLine(Real* botVertex,
return;
}
- Int segIndexPass, segIndexMono;
+ Int segIndexPass, segIndexMono = 0;
findBotLeftSegment(leftChain, leftEnd, leftCorner, grid->get_u_value(leftU), segIndexMono, segIndexPass);
sampleBotLeftWithGridLinePost(botVertex,
diff --git a/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc b/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc
index b7b929623a2..951e937c45f 100644
--- a/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc
+++ b/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc
@@ -172,7 +172,7 @@ void sampleTopRightWithGridLine(Real* topVertex,
return;
}
- Int segIndexSmall, segIndexLarge;
+ Int segIndexSmall = 0, segIndexLarge;
findTopRightSegment(rightChain,
rightStart,
rightEnd,
@@ -294,7 +294,7 @@ void sampleTopLeftWithGridLine(Real* topVertex,
primStream* pStream
)
{
- Int segIndexSmall, segIndexLarge;
+ Int segIndexSmall = 0, segIndexLarge;
//if left chain is empty, then there is only one top vertex with one grid
// line
if(leftEnd < leftStart) {
diff --git a/src/glut/glx/glut_menu.c b/src/glut/glx/glut_menu.c
index 4c4a5ae7503..d136823c54f 100644
--- a/src/glut/glx/glut_menu.c
+++ b/src/glut/glx/glut_menu.c
@@ -225,6 +225,7 @@ menuVisualSetup(void)
if (!status) {
XFreeColormap(__glutDisplay, menuColormap);
free(placeHolders);
+ placeHolders = NULL;
continue;
}
}
@@ -241,6 +242,7 @@ menuVisualSetup(void)
XFreeColormap(__glutDisplay, menuColormap);
if (placeHolders) {
free(placeHolders);
+ placeHolders = NULL;
}
continue;
}
@@ -252,6 +254,7 @@ menuVisualSetup(void)
XFreeColormap(__glutDisplay, menuColormap);
if (placeHolders) {
free(placeHolders);
+ placeHolders = NULL;
}
continue;
}
@@ -263,6 +266,7 @@ menuVisualSetup(void)
XFreeColormap(__glutDisplay, menuColormap);
if (placeHolders) {
free(placeHolders);
+ placeHolders = NULL;
}
continue;
}
@@ -271,6 +275,7 @@ menuVisualSetup(void)
XFreeColors(__glutDisplay, menuColormap,
placeHolders, numPlaceHolders, 0);
free(placeHolders);
+ placeHolders = NULL;
}
menuWhite = color.pixel;
menuVisual = visual->vinfo.visual;
diff --git a/src/glx/x11/dri2.c b/src/glx/x11/dri2.c
index e144ed3e1f9..dad04470a00 100644
--- a/src/glx/x11/dri2.c
+++ b/src/glx/x11/dri2.c
@@ -31,6 +31,8 @@
*/
+#ifdef GLX_DIRECT_RENDERING
+
#define NEED_REPLIES
#include <X11/Xlibint.h>
#include <X11/extensions/Xext.h>
@@ -377,3 +379,5 @@ DRI2CopyRegion(Display * dpy, XID drawable, XserverRegion region,
UnlockDisplay(dpy);
SyncHandle();
}
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index e5553cbf76c..5633a3e4a29 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -150,8 +150,9 @@ FreeScreenConfigs(__GLXdisplayPrivate * priv)
#ifdef GLX_DIRECT_RENDERING
if (psc->driver_configs) {
- for (unsigned int i = 0; psc->driver_configs[i]; i++)
- free((__DRIconfig *) psc->driver_configs[i]);
+ unsigned int j;
+ for (j = 0; psc->driver_configs[j]; j++)
+ free((__DRIconfig *) psc->driver_configs[j]);
free(psc->driver_configs);
psc->driver_configs = NULL;
}
diff --git a/src/glx/x11/xf86dri.h b/src/glx/x11/xf86dri.h
index f2d0dd54355..ba266003f70 100644
--- a/src/glx/x11/xf86dri.h
+++ b/src/glx/x11/xf86dri.h
@@ -115,6 +115,10 @@ Bool XF86DRIGetDeviceInfo(Display * dpy, int screen,
int *fbSize, int *fbStride, int *devPrivateSize,
void **pDevPrivate);
+Bool XF86DRIOpenFullScreen(Display * dpy, int screen, Drawable drawable);
+
+Bool XF86DRICloseFullScreen(Display * dpy, int screen, Drawable drawable);
+
_XFUNCPROTOEND
#endif /* _XF86DRI_SERVER_ */
#endif /* _XF86DRI_H_ */
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index da81ec9de51..547f18a009e 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -167,7 +167,7 @@ static int driBindContext(__DRIcontext *pcp,
__DRIdrawable *pdp,
__DRIdrawable *prp)
{
- __DRIscreenPrivate *psp;
+ __DRIscreenPrivate *psp = NULL;
/* Bind the drawable to the context */
diff --git a/src/mesa/drivers/dri/ffb/ffb_tris.c b/src/mesa/drivers/dri/ffb/ffb_tris.c
index d785c157181..e7dd960ba16 100644
--- a/src/mesa/drivers/dri/ffb/ffb_tris.c
+++ b/src/mesa/drivers/dri/ffb/ffb_tris.c
@@ -352,7 +352,7 @@ static struct {
#define LOCAL_VARS(n) \
ffbContextPtr fmesa = FFB_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = fmesa->driDrawable; \
- ffb_color color[n]; \
+ ffb_color color[n] = { { 0 } }; \
(void) color; (void) dPriv;
/***********************************************************************
diff --git a/src/mesa/drivers/dri/i810/i810tris.c b/src/mesa/drivers/dri/i810/i810tris.c
index b508496fb69..213ba541cee 100644
--- a/src/mesa/drivers/dri/i810/i810tris.c
+++ b/src/mesa/drivers/dri/i810/i810tris.c
@@ -270,7 +270,8 @@ do { \
#define LOCAL_VARS(n) \
i810ContextPtr imesa = I810_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
+ GLuint color[n] = { 0 }; \
+ GLuint spec[n] = { 0 }; \
GLuint coloroffset = (imesa->vertex_size == 4 ? 3 : 4); \
GLboolean havespec = (imesa->vertex_size > 4); \
(void) color; (void) spec; (void) coloroffset; (void) havespec;
diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c
index e87700f8e0a..ce2c9756116 100644
--- a/src/mesa/drivers/dri/i915/i915_program.c
+++ b/src/mesa/drivers/dri/i915/i915_program.c
@@ -239,7 +239,7 @@ GLuint i915_emit_texld( struct i915_fragment_program *p,
}
else {
assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
- assert(dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)));
+ assert(dest == UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)));
/* Can't use unsaved temps for coords, as the phase boundary would result
* in the contents becoming undefined.
*/
diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c
index 9fef230507f..130bd0f3e5b 100644
--- a/src/mesa/drivers/dri/i965/brw_disasm.c
+++ b/src/mesa/drivers/dri/i965/brw_disasm.c
@@ -365,6 +365,7 @@ static int format (FILE *f, char *format, ...)
va_start (args, format);
vsnprintf (buf, sizeof (buf) - 1, format, args);
+ va_end (args);
string (f, buf);
return 0;
}
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 241cdc33f86..b346277f178 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -852,7 +852,7 @@ void brw_land_fwd_jump(struct brw_compile *p,
jmpi = 2;
assert(jmp_insn->header.opcode == BRW_OPCODE_JMPI);
- assert(jmp_insn->bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE);
+ assert(jmp_insn->bits1.da1.src1_reg_file == BRW_IMMEDIATE_VALUE);
jmp_insn->bits3.ud = jmpi * ((landing - jmp_insn) - 1);
}
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c
index e7357e78c53..4b8ac364f79 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.c
+++ b/src/mesa/drivers/dri/intel/intel_buffers.c
@@ -172,10 +172,15 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
return;
}
- /*
- * How many color buffers are we drawing into?
+ /* How many color buffers are we drawing into?
+ *
+ * If there are zero buffers or the buffer is too big, don't configure any
+ * regions for hardware drawing. We'll fallback to software below. Not
+ * having regions set makes some of the software fallback paths faster.
*/
- if (fb->_NumColorDrawBuffers == 0) {
+ if ((fb->Width > ctx->Const.MaxRenderbufferSize)
+ || (fb->Height > ctx->Const.MaxRenderbufferSize)
+ || (fb->_NumColorDrawBuffers == 0)) {
/* writing to 0 */
colorRegions[0] = NULL;
intel->constant_cliprect = GL_TRUE;
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index 18e6ebd17c6..4a92410615b 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
@@ -32,6 +32,7 @@
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/bufferobj.h"
+#include "main/polygon.h"
#include "main/pixelstore.h"
#include "main/state.h"
#include "main/teximage.h"
diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.c b/src/mesa/drivers/dri/mach64/mach64_tris.c
index f2e8e2e3ae8..c2a0adfef02 100644
--- a/src/mesa/drivers/dri/mach64/mach64_tris.c
+++ b/src/mesa/drivers/dri/mach64/mach64_tris.c
@@ -1297,7 +1297,8 @@ do { \
#define LOCAL_VARS(n) \
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
+ GLuint color[n] = { 0 }; \
+ GLuint spec[n] = { 0 }; \
GLuint vertex_size = mmesa->vertex_size; \
const GLuint xyoffset = 9; \
const GLuint coloroffset = 8; \
diff --git a/src/mesa/drivers/dri/mga/mgatris.c b/src/mesa/drivers/dri/mga/mgatris.c
index b93a21c3acf..c1bcd4b8531 100644
--- a/src/mesa/drivers/dri/mga/mgatris.c
+++ b/src/mesa/drivers/dri/mga/mgatris.c
@@ -397,7 +397,8 @@ do { \
#define LOCAL_VARS(n) \
mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
+ GLuint color[n] = { 0 }; \
+ GLuint spec[n] = { 0 }; \
(void) color; (void) spec;
diff --git a/src/mesa/drivers/dri/r128/r128_tris.c b/src/mesa/drivers/dri/r128/r128_tris.c
index 5b91271d740..82d825b8d28 100644
--- a/src/mesa/drivers/dri/r128/r128_tris.c
+++ b/src/mesa/drivers/dri/r128/r128_tris.c
@@ -216,7 +216,8 @@ do { \
#define LOCAL_VARS(n) \
r128ContextPtr rmesa = R128_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
+ GLuint color[n] = { 0 }; \
+ GLuint spec[n] = { 0 }; \
GLuint coloroffset = rmesa->coloroffset; \
GLuint specoffset = rmesa->specoffset; \
GLboolean havespec = (rmesa->specoffset != 0); \
diff --git a/src/mesa/drivers/dri/r200/Makefile b/src/mesa/drivers/dri/r200/Makefile
index 42635bf9d90..99994e3f785 100644
--- a/src/mesa/drivers/dri/r200/Makefile
+++ b/src/mesa/drivers/dri/r200/Makefile
@@ -14,7 +14,7 @@ EGL_SOURCES = server/radeon_egl.c
endif
ifeq ($(RADEON_LDFLAGS),)
-CS_SOURCES = radeon_cs_space_drm.c
+CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
RADEON_COMMON_SOURCES = \
diff --git a/src/mesa/drivers/dri/r200/radeon_bo.c b/src/mesa/drivers/dri/r200/radeon_bo.c
new file mode 120000
index 00000000000..9448ffee54b
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_bo.c
@@ -0,0 +1 @@
+../radeon/radeon_bo.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r200/radeon_bo_int_drm.h b/src/mesa/drivers/dri/r200/radeon_bo_int_drm.h
new file mode 120000
index 00000000000..029450928be
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_bo_int_drm.h
@@ -0,0 +1 @@
+../radeon/radeon_bo_int_drm.h \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r200/radeon_cs.c b/src/mesa/drivers/dri/r200/radeon_cs.c
new file mode 120000
index 00000000000..66b7ad1eb03
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_cs.c
@@ -0,0 +1 @@
+../radeon/radeon_cs.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r200/radeon_cs_int_drm.h b/src/mesa/drivers/dri/r200/radeon_cs_int_drm.h
new file mode 120000
index 00000000000..462f5245d0e
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_cs_int_drm.h
@@ -0,0 +1 @@
+../radeon/radeon_cs_int_drm.h \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile
index 5d8d6f66589..75426132bfa 100644
--- a/src/mesa/drivers/dri/r300/Makefile
+++ b/src/mesa/drivers/dri/r300/Makefile
@@ -14,7 +14,7 @@ EGL_SOURCES = server/radeon_egl.c
endif
ifeq ($(RADEON_LDFLAGS),)
-CS_SOURCES = radeon_cs_space_drm.c
+CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
COMMON_SOURCES = \
diff --git a/src/mesa/drivers/dri/r300/radeon_bo.c b/src/mesa/drivers/dri/r300/radeon_bo.c
new file mode 120000
index 00000000000..9448ffee54b
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/radeon_bo.c
@@ -0,0 +1 @@
+../radeon/radeon_bo.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/radeon_bo_int_drm.h b/src/mesa/drivers/dri/r300/radeon_bo_int_drm.h
new file mode 120000
index 00000000000..029450928be
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/radeon_bo_int_drm.h
@@ -0,0 +1 @@
+../radeon/radeon_bo_int_drm.h \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/radeon_cs.c b/src/mesa/drivers/dri/r300/radeon_cs.c
new file mode 120000
index 00000000000..66b7ad1eb03
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/radeon_cs.c
@@ -0,0 +1 @@
+../radeon/radeon_cs.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/radeon_cs_int_drm.h b/src/mesa/drivers/dri/r300/radeon_cs_int_drm.h
new file mode 120000
index 00000000000..462f5245d0e
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/radeon_cs_int_drm.h
@@ -0,0 +1 @@
+../radeon/radeon_cs_int_drm.h \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/Makefile b/src/mesa/drivers/dri/r600/Makefile
index d925a2dfe39..d5448dcb6f2 100644
--- a/src/mesa/drivers/dri/r600/Makefile
+++ b/src/mesa/drivers/dri/r600/Makefile
@@ -14,7 +14,7 @@ EGL_SOURCES = server/radeon_egl.c
endif
ifeq ($(RADEON_LDFLAGS),)
-CS_SOURCES = radeon_cs_space_drm.c
+CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
COMMON_SOURCES = \
diff --git a/src/mesa/drivers/dri/r600/r600_cmdbuf.c b/src/mesa/drivers/dri/r600/r600_cmdbuf.c
index d27a3245a39..370bb04f932 100644
--- a/src/mesa/drivers/dri/r600/r600_cmdbuf.c
+++ b/src/mesa/drivers/dri/r600/r600_cmdbuf.c
@@ -52,29 +52,49 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_mipmap_tree.h"
#include "radeon_reg.h"
+#ifdef HAVE_LIBDRM_RADEON
+#include "radeon_cs_int.h"
+#else
+#include "radeon_cs_int_drm.h"
+#endif
+struct r600_cs_manager_legacy
+{
+ struct radeon_cs_manager base;
+ struct radeon_context *ctx;
+ /* hack for scratch stuff */
+ uint32_t pending_age;
+ uint32_t pending_count;
+};
+
+struct r600_cs_reloc_legacy {
+ struct radeon_cs_reloc base;
+ uint32_t cindices;
+ uint32_t *indices;
+ uint32_t *reloc_indices;
+};
-static struct radeon_cs * r600_cs_create(struct radeon_cs_manager *csm,
- uint32_t ndw)
+static struct radeon_cs_int *r600_cs_create(struct radeon_cs_manager *csm,
+ uint32_t ndw)
{
- struct radeon_cs *cs;
+ struct radeon_cs_int *csi;
- cs = (struct radeon_cs*)calloc(1, sizeof(struct radeon_cs));
- if (cs == NULL) {
+ csi = (struct radeon_cs_int*)calloc(1, sizeof(struct radeon_cs_int));
+ if (csi == NULL) {
return NULL;
}
- cs->csm = csm;
- cs->ndw = (ndw + 0x3FF) & (~0x3FF);
- cs->packets = (uint32_t*)malloc(4*cs->ndw);
- if (cs->packets == NULL) {
- free(cs);
+ csi->csm = csm;
+ csi->ndw = (ndw + 0x3FF) & (~0x3FF);
+ csi->packets = (uint32_t*)malloc(4*csi->ndw);
+ if (csi->packets == NULL) {
+ free(csi);
return NULL;
}
- cs->relocs_total_size = 0;
- return cs;
+ csi->relocs_total_size = 0;
+ return csi;
}
-static int r600_cs_write_reloc(struct radeon_cs *cs,
+static int r600_cs_write_reloc(struct radeon_cs_int *csi,
struct radeon_bo *bo,
uint32_t read_domain,
uint32_t write_domain,
@@ -83,7 +103,7 @@ static int r600_cs_write_reloc(struct radeon_cs *cs,
struct r600_cs_reloc_legacy *relocs;
int i;
- relocs = (struct r600_cs_reloc_legacy *)cs->relocs;
+ relocs = (struct r600_cs_reloc_legacy *)csi->relocs;
/* check domains */
if ((read_domain && write_domain) || (!read_domain && !write_domain)) {
/* in one CS a bo can only be in read or write domain but not
@@ -98,7 +118,7 @@ static int r600_cs_write_reloc(struct radeon_cs *cs,
return -EINVAL;
}
/* check if bo is already referenced */
- for(i = 0; i < cs->crelocs; i++) {
+ for(i = 0; i < csi->crelocs; i++) {
uint32_t *indices;
uint32_t *reloc_indices;
@@ -129,109 +149,108 @@ static int r600_cs_write_reloc(struct radeon_cs *cs,
}
relocs[i].indices = indices;
relocs[i].reloc_indices = reloc_indices;
- relocs[i].indices[relocs[i].cindices - 1] = cs->cdw;
- relocs[i].reloc_indices[relocs[i].cindices - 1] = cs->cdw;
- cs->section_cdw += 2;
- cs->cdw += 2;
+ relocs[i].indices[relocs[i].cindices - 1] = csi->cdw;
+ relocs[i].reloc_indices[relocs[i].cindices - 1] = csi->cdw;
+ csi->section_cdw += 2;
+ csi->cdw += 2;
return 0;
}
}
/* add bo to reloc */
relocs = (struct r600_cs_reloc_legacy*)
- realloc(cs->relocs,
- sizeof(struct r600_cs_reloc_legacy) * (cs->crelocs + 1));
+ realloc(csi->relocs,
+ sizeof(struct r600_cs_reloc_legacy) * (csi->crelocs + 1));
if (relocs == NULL) {
return -ENOMEM;
}
- cs->relocs = relocs;
- relocs[cs->crelocs].base.bo = bo;
- relocs[cs->crelocs].base.read_domain = read_domain;
- relocs[cs->crelocs].base.write_domain = write_domain;
- relocs[cs->crelocs].base.flags = flags;
- relocs[cs->crelocs].indices = (uint32_t*)malloc(4);
- relocs[cs->crelocs].reloc_indices = (uint32_t*)malloc(4);
- if ( (relocs[cs->crelocs].indices == NULL) || (relocs[cs->crelocs].reloc_indices == NULL) )
+ csi->relocs = relocs;
+ relocs[csi->crelocs].base.bo = bo;
+ relocs[csi->crelocs].base.read_domain = read_domain;
+ relocs[csi->crelocs].base.write_domain = write_domain;
+ relocs[csi->crelocs].base.flags = flags;
+ relocs[csi->crelocs].indices = (uint32_t*)malloc(4);
+ relocs[csi->crelocs].reloc_indices = (uint32_t*)malloc(4);
+ if ( (relocs[csi->crelocs].indices == NULL) || (relocs[csi->crelocs].reloc_indices == NULL) )
{
return -ENOMEM;
}
- relocs[cs->crelocs].indices[0] = cs->cdw;
- relocs[cs->crelocs].reloc_indices[0] = cs->cdw;
- cs->section_cdw += 2;
- cs->cdw += 2;
- relocs[cs->crelocs].cindices = 1;
- cs->relocs_total_size += radeon_bo_legacy_relocs_size(bo);
- cs->crelocs++;
+ relocs[csi->crelocs].indices[0] = csi->cdw;
+ relocs[csi->crelocs].reloc_indices[0] = csi->cdw;
+ csi->section_cdw += 2;
+ csi->cdw += 2;
+ relocs[csi->crelocs].cindices = 1;
+ csi->relocs_total_size += radeon_bo_legacy_relocs_size(bo);
+ csi->crelocs++;
radeon_bo_ref(bo);
return 0;
}
-static int r600_cs_begin(struct radeon_cs *cs,
+static int r600_cs_begin(struct radeon_cs_int *csi,
uint32_t ndw,
const char *file,
const char *func,
int line)
{
- if (cs->section) {
+ if (csi->section_ndw) {
fprintf(stderr, "CS already in a section(%s,%s,%d)\n",
- cs->section_file, cs->section_func, cs->section_line);
+ csi->section_file, csi->section_func, csi->section_line);
fprintf(stderr, "CS can't start section(%s,%s,%d)\n",
file, func, line);
return -EPIPE;
}
- cs->section = 1;
- cs->section_ndw = ndw;
- cs->section_cdw = 0;
- cs->section_file = file;
- cs->section_func = func;
- cs->section_line = line;
+ csi->section_ndw = ndw;
+ csi->section_cdw = 0;
+ csi->section_file = file;
+ csi->section_func = func;
+ csi->section_line = line;
- if (cs->cdw + ndw > cs->ndw) {
+ if (csi->cdw + ndw > csi->ndw) {
uint32_t tmp, *ptr;
int num = (ndw > 0x400) ? ndw : 0x400;
- tmp = (cs->cdw + num + 0x3FF) & (~0x3FF);
- ptr = (uint32_t*)realloc(cs->packets, 4 * tmp);
+ tmp = (csi->cdw + num + 0x3FF) & (~0x3FF);
+ ptr = (uint32_t*)realloc(csi->packets, 4 * tmp);
if (ptr == NULL) {
return -ENOMEM;
}
- cs->packets = ptr;
- cs->ndw = tmp;
+ csi->packets = ptr;
+ csi->ndw = tmp;
}
return 0;
}
-static int r600_cs_end(struct radeon_cs *cs,
+static int r600_cs_end(struct radeon_cs_int *csi,
const char *file,
const char *func,
int line)
{
- if (!cs->section) {
+ if (!csi->section_ndw) {
fprintf(stderr, "CS no section to end at (%s,%s,%d)\n",
file, func, line);
return -EPIPE;
}
- cs->section = 0;
- if ( cs->section_ndw != cs->section_cdw ) {
+ if ( csi->section_ndw != csi->section_cdw ) {
fprintf(stderr, "CS section size missmatch start at (%s,%s,%d) %d vs %d\n",
- cs->section_file, cs->section_func, cs->section_line, cs->section_ndw, cs->section_cdw);
- fprintf(stderr, "cs->section_ndw = %d, cs->cdw = %d, cs->section_cdw = %d \n",
- cs->section_ndw, cs->cdw, cs->section_cdw);
+ csi->section_file, csi->section_func, csi->section_line, csi->section_ndw, csi->section_cdw);
+ fprintf(stderr, "csi->section_ndw = %d, csi->cdw = %d, csi->section_cdw = %d \n",
+ csi->section_ndw, csi->cdw, csi->section_cdw);
fprintf(stderr, "CS section end at (%s,%s,%d)\n",
file, func, line);
return -EPIPE;
}
+ csi->section_ndw = 0;
- if (cs->cdw > cs->ndw) {
+ if (csi->cdw > csi->ndw) {
fprintf(stderr, "CS section overflow at (%s,%s,%d) cdw %d ndw %d\n",
- cs->section_file, cs->section_func, cs->section_line,cs->cdw,cs->ndw);
+ csi->section_file, csi->section_func, csi->section_line,csi->cdw,csi->ndw);
fprintf(stderr, "CS section end at (%s,%s,%d)\n",
file, func, line);
assert(0);
@@ -240,20 +259,20 @@ static int r600_cs_end(struct radeon_cs *cs,
return 0;
}
-static int r600_cs_process_relocs(struct radeon_cs *cs,
+static int r600_cs_process_relocs(struct radeon_cs_int *csi,
uint32_t * reloc_chunk,
uint32_t * length_dw_reloc_chunk)
{
- struct r600_cs_manager_legacy *csm = (struct r600_cs_manager_legacy*)cs->csm;
+ struct r600_cs_manager_legacy *csm = (struct r600_cs_manager_legacy*)csi->csm;
struct r600_cs_reloc_legacy *relocs;
int i, j, r;
uint32_t offset_dw = 0;
- csm = (struct r600_cs_manager_legacy*)cs->csm;
- relocs = (struct r600_cs_reloc_legacy *)cs->relocs;
+ csm = (struct r600_cs_manager_legacy*)csi->csm;
+ relocs = (struct r600_cs_reloc_legacy *)csi->relocs;
restart:
- for (i = 0; i < cs->crelocs; i++) {
+ for (i = 0; i < csi->crelocs; i++) {
uint32_t soffset, eoffset;
r = radeon_bo_legacy_validate(relocs[i].base.bo,
@@ -269,9 +288,9 @@ restart:
for (j = 0; j < relocs[i].cindices; j++) {
/* pkt3 nop header in ib chunk */
- cs->packets[relocs[i].reloc_indices[j]] = 0xC0001000;
+ csi->packets[relocs[i].reloc_indices[j]] = 0xC0001000;
/* reloc index in ib chunk */
- cs->packets[relocs[i].reloc_indices[j] + 1] = offset_dw;
+ csi->packets[relocs[i].reloc_indices[j] + 1] = offset_dw;
}
/* asic offset in reloc chunk */ /* see alex drm r600_nomm_relocate */
@@ -286,14 +305,14 @@ restart:
return 0;
}
-static int r600_cs_set_age(struct radeon_cs *cs) /* -------------- */
+static int r600_cs_set_age(struct radeon_cs_int *csi) /* -------------- */
{
- struct r600_cs_manager_legacy *csm = (struct r600_cs_manager_legacy*)cs->csm;
+ struct r600_cs_manager_legacy *csm = (struct r600_cs_manager_legacy*)csi->csm;
struct r600_cs_reloc_legacy *relocs;
int i;
- relocs = (struct r600_cs_reloc_legacy *)cs->relocs;
- for (i = 0; i < cs->crelocs; i++) {
+ relocs = (struct r600_cs_reloc_legacy *)csi->relocs;
+ for (i = 0; i < csi->crelocs; i++) {
radeon_bo_legacy_pending(relocs[i].base.bo, csm->pending_age);
radeon_bo_unref(relocs[i].base.bo);
}
@@ -301,21 +320,21 @@ static int r600_cs_set_age(struct radeon_cs *cs) /* -------------- */
}
#if 0
-static void dump_cmdbuf(struct radeon_cs *cs)
+static void dump_cmdbuf(struct radeon_cs_int *csi)
{
int i;
fprintf(stderr,"--start--\n");
- for (i = 0; i < cs->cdw; i++){
- fprintf(stderr,"0x%08x\n", cs->packets[i]);
+ for (i = 0; i < csi->cdw; i++){
+ fprintf(stderr,"0x%08x\n", csi->packets[i]);
}
fprintf(stderr,"--end--\n");
}
#endif
-static int r600_cs_emit(struct radeon_cs *cs)
+static int r600_cs_emit(struct radeon_cs_int *csi)
{
- struct r600_cs_manager_legacy *csm = (struct r600_cs_manager_legacy*)cs->csm;
+ struct r600_cs_manager_legacy *csm = (struct r600_cs_manager_legacy*)csi->csm;
struct drm_radeon_cs cs_cmd;
struct drm_radeon_cs_chunk cs_chunk[2];
uint32_t length_dw_reloc_chunk;
@@ -329,9 +348,9 @@ static int r600_cs_emit(struct radeon_cs *cs)
csm->pending_count = 1;
- reloc_chunk = (uint32_t*)calloc(1, cs->crelocs * 4 * 4);
+ reloc_chunk = (uint32_t*)calloc(1, csi->crelocs * 4 * 4);
- r = r600_cs_process_relocs(cs, reloc_chunk, &length_dw_reloc_chunk);
+ r = r600_cs_process_relocs(csi, reloc_chunk, &length_dw_reloc_chunk);
if (r) {
free(reloc_chunk);
return 0;
@@ -339,8 +358,8 @@ static int r600_cs_emit(struct radeon_cs *cs)
/* raw ib chunk */
cs_chunk[0].chunk_id = RADEON_CHUNK_ID_IB;
- cs_chunk[0].length_dw = cs->cdw;
- cs_chunk[0].chunk_data = (unsigned long)(cs->packets);
+ cs_chunk[0].length_dw = csi->cdw;
+ cs_chunk[0].chunk_data = (unsigned long)(csi->packets);
/* reloc chaunk */
cs_chunk[1].chunk_id = RADEON_CHUNK_ID_RELOCS;
@@ -358,7 +377,7 @@ static int r600_cs_emit(struct radeon_cs *cs)
do
{
- r = drmCommandWriteRead(cs->csm->fd, DRM_RADEON_CS, &cs_cmd, sizeof(cs_cmd));
+ r = drmCommandWriteRead(csi->csm->fd, DRM_RADEON_CS, &cs_cmd, sizeof(cs_cmd));
retry++;
} while (r == -EAGAIN && retry < 1000);
@@ -369,11 +388,11 @@ static int r600_cs_emit(struct radeon_cs *cs)
csm->pending_age = cs_cmd.cs_id;
- r600_cs_set_age(cs);
+ r600_cs_set_age(csi);
- cs->csm->read_used = 0;
- cs->csm->vram_write_used = 0;
- cs->csm->gart_write_used = 0;
+ csi->csm->read_used = 0;
+ csi->csm->vram_write_used = 0;
+ csi->csm->gart_write_used = 0;
free(reloc_chunk);
@@ -393,35 +412,34 @@ static void inline r600_cs_free_reloc(void *relocs_p, int crelocs)
}
}
-static int r600_cs_destroy(struct radeon_cs *cs)
+static int r600_cs_destroy(struct radeon_cs_int *csi)
{
- r600_cs_free_reloc(cs->relocs, cs->crelocs);
- free(cs->relocs);
- free(cs->packets);
- free(cs);
+ r600_cs_free_reloc(csi->relocs, csi->crelocs);
+ free(csi->relocs);
+ free(csi->packets);
+ free(csi);
return 0;
}
-static int r600_cs_erase(struct radeon_cs *cs)
+static int r600_cs_erase(struct radeon_cs_int *csi)
{
- r600_cs_free_reloc(cs->relocs, cs->crelocs);
- free(cs->relocs);
- cs->relocs_total_size = 0;
- cs->relocs = NULL;
- cs->crelocs = 0;
- cs->cdw = 0;
- cs->section = 0;
+ r600_cs_free_reloc(csi->relocs, csi->crelocs);
+ free(csi->relocs);
+ csi->relocs_total_size = 0;
+ csi->relocs = NULL;
+ csi->crelocs = 0;
+ csi->cdw = 0;
return 0;
}
-static int r600_cs_need_flush(struct radeon_cs *cs)
+static int r600_cs_need_flush(struct radeon_cs_int *csi)
{
/* this function used to flush when the BO usage got to
* a certain size, now the higher levels handle this better */
return 0;
}
-static void r600_cs_print(struct radeon_cs *cs, FILE *file)
+static void r600_cs_print(struct radeon_cs_int *csi, FILE *file)
{
}
diff --git a/src/mesa/drivers/dri/r600/r600_cmdbuf.h b/src/mesa/drivers/dri/r600/r600_cmdbuf.h
index eba43d37b6b..dff00096999 100644
--- a/src/mesa/drivers/dri/r600/r600_cmdbuf.h
+++ b/src/mesa/drivers/dri/r600/r600_cmdbuf.h
@@ -118,22 +118,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R600_IT_SET_CTL_CONST 0x00006F00
#define R600_IT_SURFACE_BASE_UPDATE 0x00007300
-struct r600_cs_manager_legacy
-{
- struct radeon_cs_manager base;
- struct radeon_context *ctx;
- /* hack for scratch stuff */
- uint32_t pending_age;
- uint32_t pending_count;
-};
-
-struct r600_cs_reloc_legacy {
- struct radeon_cs_reloc base;
- uint32_t cindices;
- uint32_t *indices;
- uint32_t *reloc_indices;
-};
-
struct radeon_cs_manager * r600_radeon_cs_manager_legacy_ctor(struct radeon_context *ctx);
/**
diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c
index 244a016e07e..9b7f7a7d83a 100644
--- a/src/mesa/drivers/dri/r600/r700_state.c
+++ b/src/mesa/drivers/dri/r600/r700_state.c
@@ -655,6 +655,10 @@ static void r700UpdateCulling(GLcontext * ctx)
CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); /* default: ccw */
break;
}
+
+ /* Winding is inverted when rendering to FBO */
+ if (ctx->DrawBuffer && ctx->DrawBuffer->Name)
+ r700->PA_SU_SC_MODE_CNTL.u32All ^= FACE_bit;
}
static void r700UpdateLineStipple(GLcontext * ctx)
@@ -1164,13 +1168,8 @@ static void r700UpdatePolygonMode(GLcontext * ctx)
/* Handle GL_CW (clock wise and GL_CCW (counter clock wise)
* correctly by selecting the correct front and back face
*/
- if (ctx->Polygon.FrontFace == GL_CCW) {
- f = ctx->Polygon.FrontMode;
- b = ctx->Polygon.BackMode;
- } else {
- f = ctx->Polygon.BackMode;
- b = ctx->Polygon.FrontMode;
- }
+ f = ctx->Polygon.FrontMode;
+ b = ctx->Polygon.BackMode;
/* Enable polygon mode */
SETfield(r700->PA_SU_SC_MODE_CNTL.u32All, X_DUAL_MODE, POLY_MODE_shift, POLY_MODE_mask);
diff --git a/src/mesa/drivers/dri/r600/radeon_bo.c b/src/mesa/drivers/dri/r600/radeon_bo.c
new file mode 120000
index 00000000000..9448ffee54b
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/radeon_bo.c
@@ -0,0 +1 @@
+../radeon/radeon_bo.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/radeon_bo_int_drm.h b/src/mesa/drivers/dri/r600/radeon_bo_int_drm.h
new file mode 120000
index 00000000000..029450928be
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/radeon_bo_int_drm.h
@@ -0,0 +1 @@
+../radeon/radeon_bo_int_drm.h \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/radeon_cs.c b/src/mesa/drivers/dri/r600/radeon_cs.c
new file mode 120000
index 00000000000..66b7ad1eb03
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/radeon_cs.c
@@ -0,0 +1 @@
+../radeon/radeon_cs.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/radeon_cs_int_drm.h b/src/mesa/drivers/dri/r600/radeon_cs_int_drm.h
new file mode 120000
index 00000000000..462f5245d0e
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/radeon_cs_int_drm.h
@@ -0,0 +1 @@
+../radeon/radeon_cs_int_drm.h \ No newline at end of file
diff --git a/src/mesa/drivers/dri/radeon/Makefile b/src/mesa/drivers/dri/radeon/Makefile
index 1f286776b5f..f6b714ba34a 100644
--- a/src/mesa/drivers/dri/radeon/Makefile
+++ b/src/mesa/drivers/dri/radeon/Makefile
@@ -11,7 +11,7 @@ LIBNAME = radeon_dri.so
MINIGLX_SOURCES = server/radeon_dri.c
ifeq ($(RADEON_LDFLAGS),)
-CS_SOURCES = radeon_cs_space_drm.c
+CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
RADEON_COMMON_SOURCES = \
diff --git a/src/mesa/drivers/dri/radeon/radeon_bo.c b/src/mesa/drivers/dri/radeon/radeon_bo.c
new file mode 100644
index 00000000000..393d156cdea
--- /dev/null
+++ b/src/mesa/drivers/dri/radeon/radeon_bo.c
@@ -0,0 +1,110 @@
+#include <radeon_bocs_wrapper.h>
+#include <radeon_bo_int_drm.h>
+
+void radeon_bo_debug(struct radeon_bo *bo,
+ const char *op)
+{
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+
+ fprintf(stderr, "%s %p 0x%08X 0x%08X 0x%08X\n",
+ op, bo, bo->handle, boi->size, boi->cref);
+}
+
+struct radeon_bo *radeon_bo_open(struct radeon_bo_manager *bom,
+ uint32_t handle,
+ uint32_t size,
+ uint32_t alignment,
+ uint32_t domains,
+ uint32_t flags)
+{
+ struct radeon_bo *bo;
+ bo = bom->funcs->bo_open(bom, handle, size, alignment, domains, flags);
+ return bo;
+}
+
+void radeon_bo_ref(struct radeon_bo *bo)
+{
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+ boi->cref++;
+ boi->bom->funcs->bo_ref(boi);
+}
+
+struct radeon_bo *radeon_bo_unref(struct radeon_bo *bo)
+{
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+ boi->cref--;
+ return boi->bom->funcs->bo_unref(boi);
+}
+
+int radeon_bo_map(struct radeon_bo *bo, int write)
+{
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+ return boi->bom->funcs->bo_map(boi, write);
+}
+
+int radeon_bo_unmap(struct radeon_bo *bo)
+{
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+ return boi->bom->funcs->bo_unmap(boi);
+}
+
+int radeon_bo_wait(struct radeon_bo *bo)
+{
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+ if (!boi->bom->funcs->bo_wait)
+ return 0;
+ return boi->bom->funcs->bo_wait(boi);
+}
+
+int radeon_bo_is_busy(struct radeon_bo *bo,
+ uint32_t *domain)
+{
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+ return boi->bom->funcs->bo_is_busy(boi, domain);
+}
+
+int radeon_bo_set_tiling(struct radeon_bo *bo,
+ uint32_t tiling_flags, uint32_t pitch)
+{
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+ return boi->bom->funcs->bo_set_tiling(boi, tiling_flags, pitch);
+}
+
+int radeon_bo_get_tiling(struct radeon_bo *bo,
+ uint32_t *tiling_flags, uint32_t *pitch)
+{
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+ return boi->bom->funcs->bo_get_tiling(boi, tiling_flags, pitch);
+}
+
+int radeon_bo_is_static(struct radeon_bo *bo)
+{
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+ if (boi->bom->funcs->bo_is_static)
+ return boi->bom->funcs->bo_is_static(boi);
+ return 0;
+}
+
+int radeon_bo_is_referenced_by_cs(struct radeon_bo *bo,
+ struct radeon_cs *cs)
+{
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+ return boi->cref > 1;
+}
+
+uint32_t radeon_bo_get_handle(struct radeon_bo *bo)
+{
+ return bo->handle;
+}
+
+uint32_t radeon_bo_get_src_domain(struct radeon_bo *bo)
+{
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+ uint32_t src_domain;
+
+ src_domain = boi->space_accounted & 0xffff;
+ if (!src_domain)
+ src_domain = boi->space_accounted >> 16;
+
+ return src_domain;
+}
diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_drm.h b/src/mesa/drivers/dri/radeon/radeon_bo_drm.h
index 71413716333..beb2369880a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_bo_drm.h
+++ b/src/mesa/drivers/dri/radeon/radeon_bo_drm.h
@@ -32,188 +32,44 @@
#include <stdio.h>
#include <stdint.h>
-//#include "radeon_track.h"
/* bo object */
#define RADEON_BO_FLAGS_MACRO_TILE 1
#define RADEON_BO_FLAGS_MICRO_TILE 2
struct radeon_bo_manager;
+struct radeon_cs;
struct radeon_bo {
- uint32_t alignment;
+ void *ptr;
+ uint32_t flags;
uint32_t handle;
uint32_t size;
- uint32_t domains;
- uint32_t flags;
- unsigned cref;
-#ifdef RADEON_BO_TRACK
- struct radeon_track *track;
-#endif
- void *ptr;
- struct radeon_bo_manager *bom;
- uint32_t space_accounted;
-};
-
-/* bo functions */
-struct radeon_bo_funcs {
- struct radeon_bo *(*bo_open)(struct radeon_bo_manager *bom,
- uint32_t handle,
- uint32_t size,
- uint32_t alignment,
- uint32_t domains,
- uint32_t flags);
- void (*bo_ref)(struct radeon_bo *bo);
- struct radeon_bo *(*bo_unref)(struct radeon_bo *bo);
- int (*bo_map)(struct radeon_bo *bo, int write);
- int (*bo_unmap)(struct radeon_bo *bo);
- int (*bo_wait)(struct radeon_bo *bo);
- int (*bo_is_static)(struct radeon_bo *bo);
- int (*bo_set_tiling)(struct radeon_bo *bo, uint32_t tiling_flags,
- uint32_t pitch);
- int (*bo_get_tiling)(struct radeon_bo *bo, uint32_t *tiling_flags,
- uint32_t *pitch);
- int (*bo_is_busy)(struct radeon_bo *bo, uint32_t *domain);
};
-struct radeon_bo_manager {
- struct radeon_bo_funcs *funcs;
- int fd;
-
-#ifdef RADEON_BO_TRACK
- struct radeon_tracker tracker;
-#endif
-};
-
-static inline void _radeon_bo_debug(struct radeon_bo *bo,
- const char *op,
- const char *file,
- const char *func,
- int line)
-{
- fprintf(stderr, "%s %p 0x%08X 0x%08X 0x%08X [%s %s %d]\n",
- op, bo, bo->handle, bo->size, bo->cref, file, func, line);
-}
-
-static inline struct radeon_bo *_radeon_bo_open(struct radeon_bo_manager *bom,
- uint32_t handle,
- uint32_t size,
- uint32_t alignment,
- uint32_t domains,
- uint32_t flags,
- const char *file,
- const char *func,
- int line)
-{
- struct radeon_bo *bo;
-
- bo = bom->funcs->bo_open(bom, handle, size, alignment, domains, flags);
-
-#ifdef RADEON_BO_TRACK
- if (bo) {
- bo->track = radeon_tracker_add_track(&bom->tracker, bo->handle);
- radeon_track_add_event(bo->track, file, func, "open", line);
- }
-#endif
- return bo;
-}
-
-static inline void _radeon_bo_ref(struct radeon_bo *bo,
- const char *file,
- const char *func,
- int line)
-{
- bo->cref++;
-#ifdef RADEON_BO_TRACK
- radeon_track_add_event(bo->track, file, func, "ref", line);
-#endif
- bo->bom->funcs->bo_ref(bo);
-}
-
-static inline struct radeon_bo *_radeon_bo_unref(struct radeon_bo *bo,
- const char *file,
- const char *func,
- int line)
-{
- bo->cref--;
-#ifdef RADEON_BO_TRACK
- radeon_track_add_event(bo->track, file, func, "unref", line);
- if (bo->cref <= 0) {
- radeon_tracker_remove_track(&bo->bom->tracker, bo->track);
- bo->track = NULL;
- }
-#endif
- return bo->bom->funcs->bo_unref(bo);
-}
-
-static inline int _radeon_bo_map(struct radeon_bo *bo,
- int write,
- const char *file,
- const char *func,
- int line)
-{
- return bo->bom->funcs->bo_map(bo, write);
-}
-
-static inline int _radeon_bo_unmap(struct radeon_bo *bo,
- const char *file,
- const char *func,
- int line)
-{
- return bo->bom->funcs->bo_unmap(bo);
-}
-
-static inline int _radeon_bo_wait(struct radeon_bo *bo,
- const char *file,
- const char *func,
- int line)
-{
- return bo->bom->funcs->bo_wait(bo);
-}
-
-static inline int _radeon_bo_is_busy(struct radeon_bo *bo,
- uint32_t *domain,
- const char *file,
- const char *func,
- int line)
-{
- return bo->bom->funcs->bo_is_busy(bo, domain);
-}
-
-static inline int radeon_bo_set_tiling(struct radeon_bo *bo,
- uint32_t tiling_flags, uint32_t pitch)
-{
- return bo->bom->funcs->bo_set_tiling(bo, tiling_flags, pitch);
-}
-
-static inline int radeon_bo_get_tiling(struct radeon_bo *bo,
- uint32_t *tiling_flags, uint32_t *pitch)
-{
- return bo->bom->funcs->bo_get_tiling(bo, tiling_flags, pitch);
-}
-
-static inline int radeon_bo_is_static(struct radeon_bo *bo)
-{
- if (bo->bom->funcs->bo_is_static)
- return bo->bom->funcs->bo_is_static(bo);
- return 0;
-}
-
-#define radeon_bo_open(bom, h, s, a, d, f)\
- _radeon_bo_open(bom, h, s, a, d, f, __FILE__, __FUNCTION__, __LINE__)
-#define radeon_bo_ref(bo)\
- _radeon_bo_ref(bo, __FILE__, __FUNCTION__, __LINE__)
-#define radeon_bo_unref(bo)\
- _radeon_bo_unref(bo, __FILE__, __FUNCTION__, __LINE__)
-#define radeon_bo_map(bo, w)\
- _radeon_bo_map(bo, w, __FILE__, __FUNCTION__, __LINE__)
-#define radeon_bo_unmap(bo)\
- _radeon_bo_unmap(bo, __FILE__, __FUNCTION__, __LINE__)
-#define radeon_bo_debug(bo, opcode)\
- _radeon_bo_debug(bo, opcode, __FILE__, __FUNCTION__, __LINE__)
-#define radeon_bo_wait(bo) \
- _radeon_bo_wait(bo, __FILE__, __func__, __LINE__)
-#define radeon_bo_is_busy(bo, domain) \
- _radeon_bo_is_busy(bo, domain, __FILE__, __func__, __LINE__)
+struct radeon_bo_manager;
+void radeon_bo_debug(struct radeon_bo *bo,
+ const char *op);
+
+struct radeon_bo *radeon_bo_open(struct radeon_bo_manager *bom,
+ uint32_t handle,
+ uint32_t size,
+ uint32_t alignment,
+ uint32_t domains,
+ uint32_t flags);
+
+void radeon_bo_ref(struct radeon_bo *bo);
+struct radeon_bo *radeon_bo_unref(struct radeon_bo *bo);
+int radeon_bo_map(struct radeon_bo *bo, int write);
+int radeon_bo_unmap(struct radeon_bo *bo);
+int radeon_bo_wait(struct radeon_bo *bo);
+int radeon_bo_is_busy(struct radeon_bo *bo, uint32_t *domain);
+int radeon_bo_set_tiling(struct radeon_bo *bo, uint32_t tiling_flags, uint32_t pitch);
+int radeon_bo_get_tiling(struct radeon_bo *bo, uint32_t *tiling_flags, uint32_t *pitch);
+int radeon_bo_is_static(struct radeon_bo *bo);
+int radeon_bo_is_referenced_by_cs(struct radeon_bo *bo,
+ struct radeon_cs *cs);
+uint32_t radeon_bo_get_handle(struct radeon_bo *bo);
+uint32_t radeon_bo_get_src_domain(struct radeon_bo *bo);
#endif
diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_int_drm.h b/src/mesa/drivers/dri/radeon/radeon_bo_int_drm.h
new file mode 100644
index 00000000000..190c332475b
--- /dev/null
+++ b/src/mesa/drivers/dri/radeon/radeon_bo_int_drm.h
@@ -0,0 +1,45 @@
+#ifndef RADEON_BO_INT
+#define RADEON_BO_INT
+
+struct radeon_bo_manager {
+ struct radeon_bo_funcs *funcs;
+ int fd;
+};
+
+struct radeon_bo_int {
+ void *ptr;
+ uint32_t flags;
+ uint32_t handle;
+ uint32_t size;
+ /* private members */
+ uint32_t alignment;
+ uint32_t domains;
+ unsigned cref;
+ struct radeon_bo_manager *bom;
+ uint32_t space_accounted;
+ uint32_t referenced_in_cs;
+};
+
+/* bo functions */
+struct radeon_bo_funcs {
+ struct radeon_bo *(*bo_open)(struct radeon_bo_manager *bom,
+ uint32_t handle,
+ uint32_t size,
+ uint32_t alignment,
+ uint32_t domains,
+ uint32_t flags);
+ void (*bo_ref)(struct radeon_bo_int *bo);
+ struct radeon_bo *(*bo_unref)(struct radeon_bo_int *bo);
+ int (*bo_map)(struct radeon_bo_int *bo, int write);
+ int (*bo_unmap)(struct radeon_bo_int *bo);
+ int (*bo_wait)(struct radeon_bo_int *bo);
+ int (*bo_is_static)(struct radeon_bo_int *bo);
+ int (*bo_set_tiling)(struct radeon_bo_int *bo, uint32_t tiling_flags,
+ uint32_t pitch);
+ int (*bo_get_tiling)(struct radeon_bo_int *bo, uint32_t *tiling_flags,
+ uint32_t *pitch);
+ int (*bo_is_busy)(struct radeon_bo_int *bo, uint32_t *domain);
+ int (*bo_is_referenced_by_cs)(struct radeon_bo_int *bo, struct radeon_cs *cs);
+};
+
+#endif
diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
index ce60a2f7eae..cf12664bacd 100644
--- a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
@@ -50,6 +50,12 @@
#include "radeon_bocs_wrapper.h"
#include "radeon_macros.h"
+#ifdef HAVE_LIBDRM_RADEON
+#include "radeon_bo_int.h"
+#else
+#include "radeon_bo_int_drm.h"
+#endif
+
/* no seriously texmem.c is this screwed up */
struct bo_legacy_texture_object {
driTextureObject base;
@@ -57,7 +63,7 @@ struct bo_legacy_texture_object {
};
struct bo_legacy {
- struct radeon_bo base;
+ struct radeon_bo_int base;
int map_count;
uint32_t pending;
int is_pending;
@@ -187,10 +193,10 @@ static void legacy_get_current_age(struct bo_manager_legacy *boml)
}
}
-static int legacy_is_pending(struct radeon_bo *bo)
+static int legacy_is_pending(struct radeon_bo_int *boi)
{
- struct bo_manager_legacy *boml = (struct bo_manager_legacy *)bo->bom;
- struct bo_legacy *bo_legacy = (struct bo_legacy*)bo;
+ struct bo_manager_legacy *boml = (struct bo_manager_legacy *)boi->bom;
+ struct bo_legacy *bo_legacy = (struct bo_legacy*)boi;
if (bo_legacy->is_pending <= 0) {
bo_legacy->is_pending = 0;
@@ -204,13 +210,13 @@ static int legacy_is_pending(struct radeon_bo *bo)
if (bo_legacy->pnext) {
bo_legacy->pnext->pprev = bo_legacy->pprev;
}
- assert(bo_legacy->is_pending <= bo->cref);
+ assert(bo_legacy->is_pending <= boi->cref);
while (bo_legacy->is_pending--) {
- bo = radeon_bo_unref(bo);
- if (!bo)
+ boi = (struct radeon_bo_int *)radeon_bo_unref((struct radeon_bo *)boi);
+ if (!boi)
break;
}
- if (bo)
+ if (boi)
bo_legacy->is_pending = 0;
boml->cpendings--;
return 0;
@@ -218,7 +224,7 @@ static int legacy_is_pending(struct radeon_bo *bo)
return 1;
}
-static int legacy_wait_pending(struct radeon_bo *bo)
+static int legacy_wait_pending(struct radeon_bo_int *bo)
{
struct bo_manager_legacy *boml = (struct bo_manager_legacy *)bo->bom;
struct bo_legacy *bo_legacy = (struct bo_legacy*)bo;
@@ -323,7 +329,7 @@ static struct bo_legacy *bo_allocate(struct bo_manager_legacy *boml,
return bo_legacy;
}
-static int bo_dma_alloc(struct radeon_bo *bo)
+static int bo_dma_alloc(struct radeon_bo_int *bo)
{
struct bo_manager_legacy *boml = (struct bo_manager_legacy *)bo->bom;
struct bo_legacy *bo_legacy = (struct bo_legacy*)bo;
@@ -333,7 +339,7 @@ static int bo_dma_alloc(struct radeon_bo *bo)
int r;
/* align size on 4Kb */
- size = (((4 * 1024) - 1) + bo->size) & ~((4 * 1024) - 1);
+ size = (((4 * 1024) - 1) + bo_legacy->base.size) & ~((4 * 1024) - 1);
alloc.region = RADEON_MEM_REGION_GART;
alloc.alignment = bo_legacy->base.alignment;
alloc.size = size;
@@ -355,7 +361,7 @@ static int bo_dma_alloc(struct radeon_bo *bo)
return 0;
}
-static int bo_dma_free(struct radeon_bo *bo)
+static int bo_dma_free(struct radeon_bo_int *bo)
{
struct bo_manager_legacy *boml = (struct bo_manager_legacy *)bo->bom;
struct bo_legacy *bo_legacy = (struct bo_legacy*)bo;
@@ -428,7 +434,7 @@ static struct radeon_bo *bo_open(struct radeon_bo_manager *bom,
bo_legacy = boml->bos.next;
while (bo_legacy) {
if (bo_legacy->base.handle == handle) {
- radeon_bo_ref(&(bo_legacy->base));
+ radeon_bo_ref((struct radeon_bo *)&(bo_legacy->base));
return (struct radeon_bo*)bo_legacy;
}
bo_legacy = bo_legacy->next;
@@ -468,20 +474,20 @@ retry:
return NULL;
}
}
- radeon_bo_ref(&(bo_legacy->base));
+ radeon_bo_ref((struct radeon_bo *)&(bo_legacy->base));
return (struct radeon_bo*)bo_legacy;
}
-static void bo_ref(struct radeon_bo *bo)
+static void bo_ref(struct radeon_bo_int *bo)
{
}
-static struct radeon_bo *bo_unref(struct radeon_bo *bo)
+static struct radeon_bo *bo_unref(struct radeon_bo_int *boi)
{
- struct bo_legacy *bo_legacy = (struct bo_legacy*)bo;
+ struct bo_legacy *bo_legacy = (struct bo_legacy*)boi;
- if (bo->cref <= 0) {
+ if (boi->cref <= 0) {
bo_legacy->prev->next = bo_legacy->next;
if (bo_legacy->next) {
bo_legacy->next->prev = bo_legacy->prev;
@@ -491,10 +497,10 @@ static struct radeon_bo *bo_unref(struct radeon_bo *bo)
}
return NULL;
}
- return bo;
+ return (struct radeon_bo *)boi;
}
-static int bo_map(struct radeon_bo *bo, int write)
+static int bo_map(struct radeon_bo_int *bo, int write)
{
struct bo_manager_legacy *boml = (struct bo_manager_legacy *)bo->bom;
struct bo_legacy *bo_legacy = (struct bo_legacy*)bo;
@@ -528,7 +534,7 @@ static int bo_map(struct radeon_bo *bo, int write)
return 0;
}
-static int bo_unmap(struct radeon_bo *bo)
+static int bo_unmap(struct radeon_bo_int *bo)
{
struct bo_legacy *bo_legacy = (struct bo_legacy*)bo;
@@ -542,7 +548,7 @@ static int bo_unmap(struct radeon_bo *bo)
return 0;
}
-static int bo_is_busy(struct radeon_bo *bo, uint32_t *domain)
+static int bo_is_busy(struct radeon_bo_int *bo, uint32_t *domain)
{
*domain = 0;
if (bo->domains & RADEON_GEM_DOMAIN_GTT)
@@ -555,7 +561,7 @@ static int bo_is_busy(struct radeon_bo *bo, uint32_t *domain)
return 0;
}
-static int bo_is_static(struct radeon_bo *bo)
+static int bo_is_static(struct radeon_bo_int *bo)
{
struct bo_legacy *bo_legacy = (struct bo_legacy*)bo;
return bo_legacy->static_bo;
@@ -574,7 +580,7 @@ static struct radeon_bo_funcs bo_legacy_funcs = {
bo_is_busy
};
-static int bo_vram_validate(struct radeon_bo *bo,
+static int bo_vram_validate(struct radeon_bo_int *bo,
uint32_t *soffset,
uint32_t *eoffset)
{
@@ -700,29 +706,30 @@ int radeon_bo_legacy_validate(struct radeon_bo *bo,
uint32_t *soffset,
uint32_t *eoffset)
{
- struct bo_manager_legacy *boml = (struct bo_manager_legacy *)bo->bom;
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+ struct bo_manager_legacy *boml = (struct bo_manager_legacy *)boi->bom;
struct bo_legacy *bo_legacy = (struct bo_legacy*)bo;
int r;
int retries = 0;
if (bo_legacy->map_count) {
fprintf(stderr, "bo(%p, %d) is mapped (%d) can't valide it.\n",
- bo, bo->size, bo_legacy->map_count);
+ bo, boi->size, bo_legacy->map_count);
return -EINVAL;
}
- if(bo->size == 0) {
+ if(boi->size == 0) {
fprintf(stderr, "bo(%p) has size 0.\n", bo);
return -EINVAL;
}
if (bo_legacy->static_bo || bo_legacy->validated) {
*soffset = bo_legacy->offset;
- *eoffset = bo_legacy->offset + bo->size;
+ *eoffset = bo_legacy->offset + boi->size;
return 0;
}
- if (!(bo->domains & RADEON_GEM_DOMAIN_GTT)) {
+ if (!(boi->domains & RADEON_GEM_DOMAIN_GTT)) {
- r = bo_vram_validate(bo, soffset, eoffset);
+ r = bo_vram_validate(boi, soffset, eoffset);
if (r) {
legacy_track_pending(&boml->base, 0);
legacy_kick_all_buffers(boml);
@@ -736,7 +743,7 @@ int radeon_bo_legacy_validate(struct radeon_bo *bo,
}
}
*soffset = bo_legacy->offset;
- *eoffset = bo_legacy->offset + bo->size;
+ *eoffset = bo_legacy->offset + boi->size;
bo_legacy->validated = 1;
return 0;
@@ -744,7 +751,8 @@ int radeon_bo_legacy_validate(struct radeon_bo *bo,
void radeon_bo_legacy_pending(struct radeon_bo *bo, uint32_t pending)
{
- struct bo_manager_legacy *boml = (struct bo_manager_legacy *)bo->bom;
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
+ struct bo_manager_legacy *boml = (struct bo_manager_legacy *)boi->bom;
struct bo_legacy *bo_legacy = (struct bo_legacy*)bo;
bo_legacy->pending = pending;
@@ -799,7 +807,7 @@ static struct bo_legacy *radeon_legacy_bo_alloc_static(struct bo_manager_legacy
if (bo->base.handle > bom->nhandle) {
bom->nhandle = bo->base.handle + 1;
}
- radeon_bo_ref(&(bo->base));
+ radeon_bo_ref((struct radeon_bo *)&(bo->base));
return bo;
}
@@ -894,12 +902,13 @@ void radeon_bo_legacy_texture_age(struct radeon_bo_manager *bom)
unsigned radeon_bo_legacy_relocs_size(struct radeon_bo *bo)
{
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
struct bo_legacy *bo_legacy = (struct bo_legacy*)bo;
- if (bo_legacy->static_bo || (bo->domains & RADEON_GEM_DOMAIN_GTT)) {
+ if (bo_legacy->static_bo || (boi->domains & RADEON_GEM_DOMAIN_GTT)) {
return 0;
}
- return bo->size;
+ return boi->size;
}
/*
@@ -924,7 +933,7 @@ struct radeon_bo *radeon_legacy_bo_alloc_fake(struct radeon_bo_manager *bom,
if (bo->base.handle > boml->nhandle) {
boml->nhandle = bo->base.handle + 1;
}
- radeon_bo_ref(&(bo->base));
- return &(bo->base);
+ radeon_bo_ref((struct radeon_bo *)&(bo->base));
+ return (struct radeon_bo *)&(bo->base);
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h b/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h
index 4520a7d7d49..6c2648b6bd8 100644
--- a/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h
+++ b/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h
@@ -18,8 +18,11 @@
#define RADEON_TILING_MACRO 0x1
#define RADEON_TILING_MICRO 0x2
#define RADEON_TILING_SWAP 0x4
+
+#ifndef RADEON_TILING_SURFACE
#define RADEON_TILING_SURFACE 0x8 /* this object requires a surface
* when mapped - i.e. front buffer */
+#endif
/* to be used to build locally in mesa with no libdrm bits */
#include "../radeon/radeon_bo_drm.h"
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h
index 0309345393d..fdf5e0757f7 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h
@@ -401,9 +401,6 @@ struct radeon_state {
struct radeon_depthbuffer_state depth;
struct radeon_scissor_state scissor;
struct radeon_stencilbuffer_state stencil;
-
- struct radeon_cs_space_check bos[RADEON_MAX_BOS];
- int validated_bo_count;
};
/**
diff --git a/src/mesa/drivers/dri/radeon/radeon_cs.c b/src/mesa/drivers/dri/radeon/radeon_cs.c
new file mode 100644
index 00000000000..17e74333697
--- /dev/null
+++ b/src/mesa/drivers/dri/radeon/radeon_cs.c
@@ -0,0 +1,95 @@
+
+#include <stdio.h>
+#include <stdint.h>
+#include "drm.h"
+#include "radeon_drm.h"
+#include "radeon_bocs_wrapper.h"
+#include "radeon_cs_int_drm.h"
+
+struct radeon_cs *radeon_cs_create(struct radeon_cs_manager *csm,
+ uint32_t ndw)
+{
+ struct radeon_cs_int *csi = csm->funcs->cs_create(csm, ndw);
+ return (struct radeon_cs *)csi;
+}
+
+int radeon_cs_write_reloc(struct radeon_cs *cs,
+ struct radeon_bo *bo,
+ uint32_t read_domain,
+ uint32_t write_domain,
+ uint32_t flags)
+{
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
+
+ return csi->csm->funcs->cs_write_reloc(csi,
+ bo,
+ read_domain,
+ write_domain,
+ flags);
+}
+
+int radeon_cs_begin(struct radeon_cs *cs,
+ uint32_t ndw,
+ const char *file,
+ const char *func,
+ int line)
+{
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
+ return csi->csm->funcs->cs_begin(csi, ndw, file, func, line);
+}
+
+int radeon_cs_end(struct radeon_cs *cs,
+ const char *file,
+ const char *func,
+ int line)
+{
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
+ return csi->csm->funcs->cs_end(csi, file, func, line);
+}
+
+int radeon_cs_emit(struct radeon_cs *cs)
+{
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
+ return csi->csm->funcs->cs_emit(csi);
+}
+
+int radeon_cs_destroy(struct radeon_cs *cs)
+{
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
+ return csi->csm->funcs->cs_destroy(csi);
+}
+
+int radeon_cs_erase(struct radeon_cs *cs)
+{
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
+ return csi->csm->funcs->cs_erase(csi);
+}
+
+int radeon_cs_need_flush(struct radeon_cs *cs)
+{
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
+ return csi->csm->funcs->cs_need_flush(csi);
+}
+
+void radeon_cs_print(struct radeon_cs *cs, FILE *file)
+{
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
+ csi->csm->funcs->cs_print(csi, file);
+}
+
+void radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit)
+{
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
+ if (domain == RADEON_GEM_DOMAIN_VRAM)
+ csi->csm->vram_limit = limit;
+ else
+ csi->csm->gart_limit = limit;
+}
+
+void radeon_cs_space_set_flush(struct radeon_cs *cs, void (*fn)(void *), void *data)
+{
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
+ csi->space_flush_fn = fn;
+ csi->space_flush_data = data;
+}
+
diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_drm.h b/src/mesa/drivers/dri/radeon/radeon_cs_drm.h
index ab4eca31a3c..a3f1750c6ed 100644
--- a/src/mesa/drivers/dri/radeon/radeon_cs_drm.h
+++ b/src/mesa/drivers/dri/radeon/radeon_cs_drm.h
@@ -36,6 +36,7 @@
#include <string.h>
#include "drm.h"
#include "radeon_drm.h"
+#include "radeon_bo_drm.h"
struct radeon_cs_reloc {
struct radeon_bo *bo;
@@ -49,173 +50,41 @@ struct radeon_cs_reloc {
#define RADEON_CS_SPACE_OP_TO_BIG 1
#define RADEON_CS_SPACE_FLUSH 2
-struct radeon_cs_space_check {
- struct radeon_bo *bo;
- uint32_t read_domains;
- uint32_t write_domain;
- uint32_t new_accounted;
-};
-
-#define MAX_SPACE_BOS (32)
-
-struct radeon_cs_manager;
-
struct radeon_cs {
- struct radeon_cs_manager *csm;
- void *relocs;
- uint32_t *packets;
- unsigned crelocs;
- unsigned relocs_total_size;
- unsigned cdw;
- unsigned ndw;
- int section;
+ uint32_t *packets;
+ unsigned cdw;
+ unsigned ndw;
unsigned section_ndw;
unsigned section_cdw;
- const char *section_file;
- const char *section_func;
- int section_line;
- struct radeon_cs_space_check bos[MAX_SPACE_BOS];
- int bo_count;
- void (*space_flush_fn)(void *);
- void *space_flush_data;
-};
-
-/* cs functions */
-struct radeon_cs_funcs {
- struct radeon_cs *(*cs_create)(struct radeon_cs_manager *csm,
- uint32_t ndw);
- int (*cs_write_reloc)(struct radeon_cs *cs,
- struct radeon_bo *bo,
- uint32_t read_domain,
- uint32_t write_domain,
- uint32_t flags);
- int (*cs_begin)(struct radeon_cs *cs,
- uint32_t ndw,
- const char *file,
- const char *func,
- int line);
- int (*cs_end)(struct radeon_cs *cs,
- const char *file,
- const char *func,
- int line);
- int (*cs_emit)(struct radeon_cs *cs);
- int (*cs_destroy)(struct radeon_cs *cs);
- int (*cs_erase)(struct radeon_cs *cs);
- int (*cs_need_flush)(struct radeon_cs *cs);
- void (*cs_print)(struct radeon_cs *cs, FILE *file);
-};
-
-struct radeon_cs_manager {
- struct radeon_cs_funcs *funcs;
- int fd;
- int32_t vram_limit, gart_limit;
- int32_t vram_write_used, gart_write_used;
- int32_t read_used;
};
-static inline struct radeon_cs *radeon_cs_create(struct radeon_cs_manager *csm,
- uint32_t ndw)
-{
- return csm->funcs->cs_create(csm, ndw);
-}
-
-static inline int radeon_cs_write_reloc(struct radeon_cs *cs,
- struct radeon_bo *bo,
- uint32_t read_domain,
- uint32_t write_domain,
- uint32_t flags)
-{
- return cs->csm->funcs->cs_write_reloc(cs,
- bo,
- read_domain,
- write_domain,
- flags);
-}
-
-static inline int radeon_cs_begin(struct radeon_cs *cs,
- uint32_t ndw,
- const char *file,
- const char *func,
- int line)
-{
- return cs->csm->funcs->cs_begin(cs, ndw, file, func, line);
-}
-
-static inline int radeon_cs_end(struct radeon_cs *cs,
- const char *file,
- const char *func,
- int line)
-{
- return cs->csm->funcs->cs_end(cs, file, func, line);
-}
-
-static inline int radeon_cs_emit(struct radeon_cs *cs)
-{
- return cs->csm->funcs->cs_emit(cs);
-}
-
-static inline int radeon_cs_destroy(struct radeon_cs *cs)
-{
- return cs->csm->funcs->cs_destroy(cs);
-}
-
-static inline int radeon_cs_erase(struct radeon_cs *cs)
-{
- return cs->csm->funcs->cs_erase(cs);
-}
-
-static inline int radeon_cs_need_flush(struct radeon_cs *cs)
-{
- return cs->csm->funcs->cs_need_flush(cs);
-}
-
-static inline void radeon_cs_print(struct radeon_cs *cs, FILE *file)
-{
- cs->csm->funcs->cs_print(cs, file);
-}
-
-static inline void radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit)
-{
-
- if (domain == RADEON_GEM_DOMAIN_VRAM)
- cs->csm->vram_limit = limit;
- else
- cs->csm->gart_limit = limit;
-}
-
-static inline void radeon_cs_write_dword(struct radeon_cs *cs, uint32_t dword)
-{
- cs->packets[cs->cdw++] = dword;
- if (cs->section) {
- cs->section_cdw++;
- }
-}
-
-static inline void radeon_cs_write_qword(struct radeon_cs *cs, uint64_t qword)
-{
-
- memcpy(cs->packets + cs->cdw, &qword, sizeof(qword));
- cs->cdw+=2;
- if (cs->section) {
- cs->section_cdw+=2;
- }
-}
-
-static inline void radeon_cs_write_table(struct radeon_cs *cs, void *data, uint32_t size)
-{
- memcpy(cs->packets + cs->cdw, data, size * 4);
- cs->cdw += size;
- if (cs->section) {
- cs->section_cdw += size;
- }
-}
+#define MAX_SPACE_BOS (32)
-static inline void radeon_cs_space_set_flush(struct radeon_cs *cs, void (*fn)(void *), void *data)
-{
- cs->space_flush_fn = fn;
- cs->space_flush_data = data;
-}
+struct radeon_cs_manager;
+extern struct radeon_cs *radeon_cs_create(struct radeon_cs_manager *csm,
+ uint32_t ndw);
+
+extern int radeon_cs_begin(struct radeon_cs *cs,
+ uint32_t ndw,
+ const char *file,
+ const char *func, int line);
+extern int radeon_cs_end(struct radeon_cs *cs,
+ const char *file,
+ const char *func,
+ int line);
+extern int radeon_cs_emit(struct radeon_cs *cs);
+extern int radeon_cs_destroy(struct radeon_cs *cs);
+extern int radeon_cs_erase(struct radeon_cs *cs);
+extern int radeon_cs_need_flush(struct radeon_cs *cs);
+extern void radeon_cs_print(struct radeon_cs *cs, FILE *file);
+extern void radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit);
+extern void radeon_cs_space_set_flush(struct radeon_cs *cs, void (*fn)(void *), void *data);
+extern int radeon_cs_write_reloc(struct radeon_cs *cs,
+ struct radeon_bo *bo,
+ uint32_t read_domain,
+ uint32_t write_domain,
+ uint32_t flags);
/*
* add a persistent BO to the list
@@ -243,4 +112,30 @@ int radeon_cs_space_check_with_bo(struct radeon_cs *cs,
uint32_t read_domains,
uint32_t write_domain);
+static inline void radeon_cs_write_dword(struct radeon_cs *cs, uint32_t dword)
+{
+ cs->packets[cs->cdw++] = dword;
+ if (cs->section_ndw) {
+ cs->section_cdw++;
+ }
+}
+
+static inline void radeon_cs_write_qword(struct radeon_cs *cs, uint64_t qword)
+{
+ memcpy(cs->packets + cs->cdw, &qword, sizeof(uint64_t));
+ cs->cdw += 2;
+ if (cs->section_ndw) {
+ cs->section_cdw += 2;
+ }
+}
+
+static inline void radeon_cs_write_table(struct radeon_cs *cs,
+ void *data, uint32_t size)
+{
+ memcpy(cs->packets + cs->cdw, data, size * 4);
+ cs->cdw += size;
+ if (cs->section_ndw) {
+ cs->section_cdw += size;
+ }
+}
#endif
diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_int_drm.h b/src/mesa/drivers/dri/radeon/radeon_cs_int_drm.h
new file mode 100644
index 00000000000..8ba76bf9517
--- /dev/null
+++ b/src/mesa/drivers/dri/radeon/radeon_cs_int_drm.h
@@ -0,0 +1,66 @@
+
+#ifndef _RADEON_CS_INT_H_
+#define _RADEON_CS_INT_H_
+
+struct radeon_cs_space_check {
+ struct radeon_bo_int *bo;
+ uint32_t read_domains;
+ uint32_t write_domain;
+ uint32_t new_accounted;
+};
+
+struct radeon_cs_int {
+ /* keep first two in same place */
+ uint32_t *packets;
+ unsigned cdw;
+ unsigned ndw;
+ unsigned section_ndw;
+ unsigned section_cdw;
+ /* private members */
+ struct radeon_cs_manager *csm;
+ void *relocs;
+ unsigned crelocs;
+ unsigned relocs_total_size;
+ const char *section_file;
+ const char *section_func;
+ int section_line;
+ struct radeon_cs_space_check bos[MAX_SPACE_BOS];
+ int bo_count;
+ void (*space_flush_fn)(void *);
+ void *space_flush_data;
+};
+
+/* cs functions */
+struct radeon_cs_funcs {
+ struct radeon_cs_int *(*cs_create)(struct radeon_cs_manager *csm,
+ uint32_t ndw);
+ int (*cs_write_reloc)(struct radeon_cs_int *cs,
+ struct radeon_bo *bo,
+ uint32_t read_domain,
+ uint32_t write_domain,
+ uint32_t flags);
+ int (*cs_begin)(struct radeon_cs_int *cs,
+ uint32_t ndw,
+ const char *file,
+ const char *func,
+ int line);
+ int (*cs_end)(struct radeon_cs_int *cs,
+ const char *file, const char *func,
+ int line);
+
+
+ int (*cs_emit)(struct radeon_cs_int *cs);
+ int (*cs_destroy)(struct radeon_cs_int *cs);
+ int (*cs_erase)(struct radeon_cs_int *cs);
+ int (*cs_need_flush)(struct radeon_cs_int *cs);
+ void (*cs_print)(struct radeon_cs_int *cs, FILE *file);
+};
+
+struct radeon_cs_manager {
+ struct radeon_cs_funcs *funcs;
+ int fd;
+ int32_t vram_limit, gart_limit;
+ int32_t vram_write_used, gart_write_used;
+ int32_t read_used;
+};
+#endif
diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
index f1addb299e2..45b608a1b98 100644
--- a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
@@ -30,10 +30,18 @@
* Jérôme Glisse <[email protected]>
*/
#include <errno.h>
+#include <unistd.h>
+#include <stdint.h>
+#include "drm.h"
+#include "radeon_drm.h"
#include "radeon_bocs_wrapper.h"
#include "radeon_common.h"
-
+#ifdef HAVE_LIBDRM_RADEON
+#include "radeon_cs_int.h"
+#else
+#include "radeon_cs_int_drm.h"
+#endif
struct cs_manager_legacy {
struct radeon_cs_manager base;
struct radeon_context *ctx;
@@ -51,27 +59,27 @@ struct cs_reloc_legacy {
};
-static struct radeon_cs *cs_create(struct radeon_cs_manager *csm,
- uint32_t ndw)
+static struct radeon_cs_int *cs_create(struct radeon_cs_manager *csm,
+ uint32_t ndw)
{
- struct radeon_cs *cs;
+ struct radeon_cs_int *csi;
- cs = (struct radeon_cs*)calloc(1, sizeof(struct radeon_cs));
- if (cs == NULL) {
+ csi = (struct radeon_cs_int*)calloc(1, sizeof(struct radeon_cs_int));
+ if (csi == NULL) {
return NULL;
}
- cs->csm = csm;
- cs->ndw = (ndw + 0x3FF) & (~0x3FF);
- cs->packets = (uint32_t*)malloc(4*cs->ndw);
- if (cs->packets == NULL) {
- free(cs);
+ csi->csm = csm;
+ csi->ndw = (ndw + 0x3FF) & (~0x3FF);
+ csi->packets = (uint32_t*)malloc(4*csi->ndw);
+ if (csi->packets == NULL) {
+ free(csi);
return NULL;
}
- cs->relocs_total_size = 0;
- return cs;
+ csi->relocs_total_size = 0;
+ return csi;
}
-static int cs_write_reloc(struct radeon_cs *cs,
+static int cs_write_reloc(struct radeon_cs_int *cs,
struct radeon_bo *bo,
uint32_t read_domain,
uint32_t write_domain,
@@ -150,20 +158,19 @@ static int cs_write_reloc(struct radeon_cs *cs,
return 0;
}
-static int cs_begin(struct radeon_cs *cs,
+static int cs_begin(struct radeon_cs_int *cs,
uint32_t ndw,
const char *file,
const char *func,
int line)
{
- if (cs->section) {
+ if (cs->section_ndw) {
fprintf(stderr, "CS already in a section(%s,%s,%d)\n",
cs->section_file, cs->section_func, cs->section_line);
fprintf(stderr, "CS can't start section(%s,%s,%d)\n",
file, func, line);
return -EPIPE;
}
- cs->section = 1;
cs->section_ndw = ndw;
cs->section_cdw = 0;
cs->section_file = file;
@@ -187,18 +194,17 @@ static int cs_begin(struct radeon_cs *cs,
return 0;
}
-static int cs_end(struct radeon_cs *cs,
+static int cs_end(struct radeon_cs_int *cs,
const char *file,
const char *func,
int line)
{
- if (!cs->section) {
+ if (!cs->section_ndw) {
fprintf(stderr, "CS no section to end at (%s,%s,%d)\n",
file, func, line);
return -EPIPE;
}
- cs->section = 0;
if (cs->section_ndw != cs->section_cdw) {
fprintf(stderr, "CS section size missmatch start at (%s,%s,%d) %d vs %d\n",
cs->section_file, cs->section_func, cs->section_line, cs->section_ndw, cs->section_cdw);
@@ -206,10 +212,12 @@ static int cs_end(struct radeon_cs *cs,
file, func, line);
return -EPIPE;
}
+ cs->section_ndw = 0;
+
return 0;
}
-static int cs_process_relocs(struct radeon_cs *cs)
+static int cs_process_relocs(struct radeon_cs_int *cs)
{
struct cs_manager_legacy *csm = (struct cs_manager_legacy*)cs->csm;
struct cs_reloc_legacy *relocs;
@@ -254,7 +262,7 @@ restart:
return 0;
}
-static int cs_set_age(struct radeon_cs *cs)
+static int cs_set_age(struct radeon_cs_int *cs)
{
struct cs_manager_legacy *csm = (struct cs_manager_legacy*)cs->csm;
struct cs_reloc_legacy *relocs;
@@ -268,7 +276,7 @@ static int cs_set_age(struct radeon_cs *cs)
return 0;
}
-static int cs_emit(struct radeon_cs *cs)
+static int cs_emit(struct radeon_cs_int *cs)
{
struct cs_manager_legacy *csm = (struct cs_manager_legacy*)cs->csm;
drm_radeon_cmd_buffer_t cmd;
@@ -276,7 +284,7 @@ static int cs_emit(struct radeon_cs *cs)
uint64_t ull;
int r;
- csm->ctx->vtbl.emit_cs_header(cs, csm->ctx);
+ csm->ctx->vtbl.emit_cs_header((struct radeon_cs *)cs, csm->ctx);
/* append buffer age */
if ( IS_R300_CLASS(csm->ctx->radeonScreen) )
@@ -289,9 +297,9 @@ static int cs_emit(struct radeon_cs *cs)
age.scratch.reg = 2;
age.scratch.n_bufs = 1;
age.scratch.flags = 0;
- radeon_cs_write_dword(cs, age.u);
- radeon_cs_write_qword(cs, ull);
- radeon_cs_write_dword(cs, 0);
+ radeon_cs_write_dword((struct radeon_cs *)cs, age.u);
+ radeon_cs_write_qword((struct radeon_cs *)cs, ull);
+ radeon_cs_write_dword((struct radeon_cs *)cs, 0);
}
r = cs_process_relocs(cs);
@@ -342,7 +350,7 @@ static void inline cs_free_reloc(void *relocs_p, int crelocs)
free(relocs[i].indices);
}
-static int cs_destroy(struct radeon_cs *cs)
+static int cs_destroy(struct radeon_cs_int *cs)
{
cs_free_reloc(cs->relocs, cs->crelocs);
free(cs->relocs);
@@ -351,7 +359,7 @@ static int cs_destroy(struct radeon_cs *cs)
return 0;
}
-static int cs_erase(struct radeon_cs *cs)
+static int cs_erase(struct radeon_cs_int *cs)
{
cs_free_reloc(cs->relocs, cs->crelocs);
free(cs->relocs);
@@ -359,18 +367,18 @@ static int cs_erase(struct radeon_cs *cs)
cs->relocs = NULL;
cs->crelocs = 0;
cs->cdw = 0;
- cs->section = 0;
+ cs->section_ndw = 0;
return 0;
}
-static int cs_need_flush(struct radeon_cs *cs)
+static int cs_need_flush(struct radeon_cs_int *cs)
{
/* this function used to flush when the BO usage got to
* a certain size, now the higher levels handle this better */
return 0;
}
-static void cs_print(struct radeon_cs *cs, FILE *file)
+static void cs_print(struct radeon_cs_int *cs, FILE *file)
{
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_space_drm.c b/src/mesa/drivers/dri/radeon/radeon_cs_space_drm.c
index 89cbbb5a6b9..e22b437d561 100644
--- a/src/mesa/drivers/dri/radeon/radeon_cs_space_drm.c
+++ b/src/mesa/drivers/dri/radeon/radeon_cs_space_drm.c
@@ -29,6 +29,8 @@
#include <errno.h>
#include <stdlib.h>
#include "radeon_bocs_wrapper.h"
+#include "radeon_bo_int_drm.h"
+#include "radeon_cs_int_drm.h"
struct rad_sizes {
int32_t op_read;
@@ -39,7 +41,7 @@ struct rad_sizes {
static inline int radeon_cs_setup_bo(struct radeon_cs_space_check *sc, struct rad_sizes *sizes)
{
uint32_t read_domains, write_domain;
- struct radeon_bo *bo;
+ struct radeon_bo_int *bo;
bo = sc->bo;
sc->new_accounted = 0;
@@ -47,7 +49,7 @@ static inline int radeon_cs_setup_bo(struct radeon_cs_space_check *sc, struct ra
write_domain = sc->write_domain;
/* legacy needs a static check */
- if (radeon_bo_is_static(bo)) {
+ if (radeon_bo_is_static((struct radeon_bo *)sc->bo)) {
bo->space_accounted = sc->new_accounted = (read_domains << 16) | write_domain;
return 0;
}
@@ -100,11 +102,11 @@ static inline int radeon_cs_setup_bo(struct radeon_cs_space_check *sc, struct ra
return 0;
}
-static int radeon_cs_do_space_check(struct radeon_cs *cs, struct radeon_cs_space_check *new_tmp)
+static int radeon_cs_do_space_check(struct radeon_cs_int *cs, struct radeon_cs_space_check *new_tmp)
{
struct radeon_cs_manager *csm = cs->csm;
int i;
- struct radeon_bo *bo;
+ struct radeon_bo_int *bo;
struct rad_sizes sizes;
int ret;
@@ -158,25 +160,28 @@ static int radeon_cs_do_space_check(struct radeon_cs *cs, struct radeon_cs_space
void radeon_cs_space_add_persistent_bo(struct radeon_cs *cs, struct radeon_bo *bo, uint32_t read_domains, uint32_t write_domain)
{
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
int i;
- for (i = 0; i < cs->bo_count; i++) {
- if (cs->bos[i].bo == bo &&
- cs->bos[i].read_domains == read_domains &&
- cs->bos[i].write_domain == write_domain)
+ for (i = 0; i < csi->bo_count; i++) {
+ if (csi->bos[i].bo == boi &&
+ csi->bos[i].read_domains == read_domains &&
+ csi->bos[i].write_domain == write_domain)
return;
}
radeon_bo_ref(bo);
- i = cs->bo_count;
- cs->bos[i].bo = bo;
- cs->bos[i].read_domains = read_domains;
- cs->bos[i].write_domain = write_domain;
- cs->bos[i].new_accounted = 0;
- cs->bo_count++;
-
- assert(cs->bo_count < MAX_SPACE_BOS);
+ i = csi->bo_count;
+ csi->bos[i].bo = boi;
+ csi->bos[i].read_domains = read_domains;
+ csi->bos[i].write_domain = write_domain;
+ csi->bos[i].new_accounted = 0;
+ csi->bo_count++;
+
+ assert(csi->bo_count < MAX_SPACE_BOS);
}
-static int radeon_cs_check_space_internal(struct radeon_cs *cs, struct radeon_cs_space_check *tmp_bo)
+static int radeon_cs_check_space_internal(struct radeon_cs_int *cs,
+ struct radeon_cs_space_check *tmp_bo)
{
int ret;
int flushed = 0;
@@ -198,37 +203,42 @@ again:
int radeon_cs_space_check_with_bo(struct radeon_cs *cs,
struct radeon_bo *bo,
uint32_t read_domains, uint32_t write_domain)
-{
+{
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
+ struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
struct radeon_cs_space_check temp_bo;
+
int ret = 0;
if (bo) {
- temp_bo.bo = bo;
+ temp_bo.bo = boi;
temp_bo.read_domains = read_domains;
temp_bo.write_domain = write_domain;
temp_bo.new_accounted = 0;
}
- ret = radeon_cs_check_space_internal(cs, bo ? &temp_bo : NULL);
+ ret = radeon_cs_check_space_internal(csi, bo ? &temp_bo : NULL);
return ret;
}
int radeon_cs_space_check(struct radeon_cs *cs)
{
- return radeon_cs_check_space_internal(cs, NULL);
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
+ return radeon_cs_check_space_internal(csi, NULL);
}
void radeon_cs_space_reset_bos(struct radeon_cs *cs)
{
+ struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
int i;
- for (i = 0; i < cs->bo_count; i++) {
- radeon_bo_unref(cs->bos[i].bo);
- cs->bos[i].bo = NULL;
- cs->bos[i].read_domains = 0;
- cs->bos[i].write_domain = 0;
- cs->bos[i].new_accounted = 0;
+ for (i = 0; i < csi->bo_count; i++) {
+ radeon_bo_unref((struct radeon_bo *)csi->bos[i].bo);
+ csi->bos[i].bo = NULL;
+ csi->bos[i].read_domains = 0;
+ csi->bos[i].write_domain = 0;
+ csi->bos[i].new_accounted = 0;
}
- cs->bo_count = 0;
+ csi->bo_count = 0;
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c
index c9a32c808be..232972d7ec7 100644
--- a/src/mesa/drivers/dri/radeon/radeon_dma.c
+++ b/src/mesa/drivers/dri/radeon/radeon_dma.c
@@ -207,7 +207,6 @@ again_alloc:
counter on unused buffers for later freeing them from
begin of list */
dma_bo = last_elem(&rmesa->dma.free);
- assert(dma_bo->bo->cref == 1);
remove_from_list(dma_bo);
insert_at_head(&rmesa->dma.reserved, dma_bo);
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c
index d603f52df7b..5982ee48265 100644
--- a/src/mesa/drivers/dri/radeon/radeon_span.c
+++ b/src/mesa/drivers/dri/radeon/radeon_span.c
@@ -755,8 +755,7 @@ static void map_unmap_rb(struct gl_renderbuffer *rb, int flag)
return;
if (flag) {
- if (rrb->bo->bom->funcs->bo_wait)
- radeon_bo_wait(rrb->bo);
+ radeon_bo_wait(rrb->bo);
r = radeon_bo_map(rrb->bo, 1);
if (r) {
fprintf(stderr, "(%s) error(%d) mapping buffer.\n",
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index 931ceff0a81..048fbe452c2 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -436,7 +436,7 @@ savageCreateContext( const __GLcontextModes *mesaVis,
if (ctx->Const.MaxTextureLevels <= 6) { /*spec requires at least 64x64*/
__driUtilMessage("Not enough texture memory. "
"Falling back to indirect rendering.");
- Xfree(imesa);
+ _mesa_free(imesa);
return GL_FALSE;
}
@@ -574,7 +574,7 @@ savageDestroyContext(__DRIcontextPrivate *driContextPriv)
_mesa_destroy_context(imesa->glCtx);
/* no longer use vertex_dma_buf*/
- Xfree(imesa);
+ _mesa_free(imesa);
}
}
diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c
index 948ed18419e..77ab8d16e0a 100644
--- a/src/mesa/drivers/dri/savage/savageioctl.c
+++ b/src/mesa/drivers/dri/savage/savageioctl.c
@@ -337,6 +337,8 @@ static void savageDDClear( GLcontext *ctx, GLbitfield mask )
GLint ch = ctx->DrawBuffer->_Ymax - cy;
/* XXX FIX ME: the cx,cy,cw,ch vars are currently ignored! */
+ (void) ch;
+ (void) cw;
if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG)
fprintf (stderr, "%s\n", __FUNCTION__);
diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c
index c04763b40e1..0714101dc05 100644
--- a/src/mesa/drivers/dri/savage/savagetris.c
+++ b/src/mesa/drivers/dri/savage/savagetris.c
@@ -435,7 +435,8 @@ do { \
#define LOCAL_VARS(n) \
savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
+ GLuint color[n] = { 0 }; \
+ GLuint spec[n] = { 0 }; \
GLuint coloroffset = \
((imesa->skip & SAVAGE_SKIP_W) ? 3 : 4); \
GLboolean specoffset = \
diff --git a/src/mesa/drivers/dri/sis/sis_clear.c b/src/mesa/drivers/dri/sis/sis_clear.c
index 323383da62a..d358ef62dc7 100644
--- a/src/mesa/drivers/dri/sis/sis_clear.c
+++ b/src/mesa/drivers/dri/sis/sis_clear.c
@@ -393,7 +393,6 @@ sis_clear_z_stencil_buffer( GLcontext * ctx, GLbitfield mask,
GLint x, GLint y, GLint width, GLint height )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
- int cmd;
mWait3DCmdQueue (8);
MMIO(REG_SRC_PITCH, (smesa->zFormat == SiS_ZFORMAT_Z16) ?
diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c
index 76d12d07b3c..4fa2e41e44f 100644
--- a/src/mesa/drivers/dri/sis/sis_tris.c
+++ b/src/mesa/drivers/dri/sis/sis_tris.c
@@ -430,7 +430,8 @@ do { \
#define LOCAL_VARS(n) \
sisContextPtr smesa = SIS_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
+ GLuint color[n] = { 0 }; \
+ GLuint spec[n] = { 0 }; \
GLuint coloroffset = smesa->coloroffset; \
GLuint specoffset = smesa->specoffset; \
(void) color; (void) spec; (void) coloroffset; (void) specoffset;
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c
index 6746f552ae6..91c94fa377d 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.c
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c
@@ -885,9 +885,6 @@ void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags)
}
else if (vmesa->numClipRects) {
drm_clip_rect_t *pbox = vmesa->pClipRects;
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- struct via_renderbuffer *const vrb =
- (struct via_renderbuffer *) dPriv->driverPrivate;
for (i = 0; i < vmesa->numClipRects; i++) {
drm_clip_rect_t b;
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index 3dbb5705710..54019fd38ed 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -210,7 +210,9 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap)
{
+#if 000
viaScreenPrivate *screen = (viaScreenPrivate *) driScrnPriv->private;
+#endif
GLboolean swStencil = (mesaVis->stencilBits > 0 &&
mesaVis->depthBits != 24);
diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c
index 79e67620c9e..e2f1f02c99e 100644
--- a/src/mesa/drivers/dri/unichrome/via_tris.c
+++ b/src/mesa/drivers/dri/unichrome/via_tris.c
@@ -330,7 +330,8 @@ do { \
#define LOCAL_VARS(n) \
struct via_context *vmesa = VIA_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
+ GLuint color[n] = { 0 }; \
+ GLuint spec[n] = { 0 }; \
GLuint coloroffset = vmesa->coloroffset; \
GLuint specoffset = vmesa->specoffset; \
(void)color; (void)spec; (void)coloroffset; (void)specoffset;
diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 522295a9bfe..4eb249b4af1 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -107,8 +107,7 @@ extern "C" {
/**
* finite macro.
*/
-#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
-# define __WIN32__
+#if defined(_MSC_VER)
# define finite _finite
#elif defined(__WATCOMC__)
# define finite _finite
@@ -235,7 +234,7 @@ extern "C" {
#elif defined(__APPLE__)
#include <CoreFoundation/CFByteOrder.h>
#define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x )
-#elif defined(_AIX)
+#elif (defined(_AIX) || defined(__blrts))
#define CPU_TO_LE32( x ) x = ((x & 0x000000ff) << 24) | \
((x & 0x0000ff00) << 8) | \
((x & 0x00ff0000) >> 8) | \
diff --git a/src/mesa/main/dlopen.c b/src/mesa/main/dlopen.c
index 414cfad8e26..81e032081db 100644
--- a/src/mesa/main/dlopen.c
+++ b/src/mesa/main/dlopen.c
@@ -31,7 +31,7 @@
#include "compiler.h"
#include "dlopen.h"
-#if defined(_GNU_SOURCE) && !defined(__MINGW32__)
+#if defined(_GNU_SOURCE) && !defined(__MINGW32__) && !defined(__blrts)
#include <dlfcn.h>
#endif
#if defined(_WIN32)
@@ -46,7 +46,9 @@
void *
_mesa_dlopen(const char *libname, int flags)
{
-#if defined(_GNU_SOURCE)
+#if defined(__blrts)
+ return NULL;
+#elif defined(_GNU_SOURCE)
flags = RTLD_LAZY | RTLD_GLOBAL; /* Overriding flags at this time */
return dlopen(libname, flags);
#elif defined(__MINGW32__)
@@ -65,7 +67,9 @@ _mesa_dlopen(const char *libname, int flags)
GenericFunc
_mesa_dlsym(void *handle, const char *fname)
{
-#if defined(__DJGPP__)
+#if defined(__blrts)
+ return (GenericFunc) NULL;
+#elif defined(__DJGPP__)
/* need '_' prefix on symbol names */
char fname2[1000];
fname2[0] = '_';
@@ -88,7 +92,9 @@ _mesa_dlsym(void *handle, const char *fname)
void
_mesa_dlclose(void *handle)
{
-#if defined(_GNU_SOURCE)
+#if defined(__blrts)
+ (void) handle;
+#elif defined(_GNU_SOURCE)
dlclose(handle);
#elif defined(__MINGW32__)
FreeLibrary(handle);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index f8e4e41583d..21e3d47f3a7 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3125,7 +3125,7 @@ enum _verbose
VERBOSE_LIGHTING = 0x0200,
VERBOSE_PRIMS = 0x0400,
VERBOSE_VERTS = 0x0800,
- VERBOSE_DISASSEM = 0x1000,
+ VERBOSE_DISASSEM = 0x1000
};
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index 8a2013229a1..84f0dbc96d6 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -32,7 +32,7 @@
#define MESA_MAJOR 7
#define MESA_MINOR 6
#define MESA_PATCH 1
-#define MESA_VERSION_STRING "7.6.1-rc3"
+#define MESA_VERSION_STRING "7.6.1"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c
index fefef573ee5..408ede6eaa7 100644
--- a/src/mesa/shader/lex.yy.c
+++ b/src/mesa/shader/lex.yy.c
@@ -913,6 +913,10 @@ static yyconst flex_int16_t yy_chk[1023] =
#define require_rect (yyextra->option.TexRect)
#define require_texarray (yyextra->option.TexArray)
+#ifndef HAVE_UNISTD_H
+#define YY_NO_UNISTD_H
+#endif
+
#define return_token_or_IDENTIFIER(condition, token) \
do { \
if (condition) { \
diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l
index c2803ff7074..ce4cb42243b 100644
--- a/src/mesa/shader/program_lexer.l
+++ b/src/mesa/shader/program_lexer.l
@@ -35,6 +35,10 @@
#define require_rect (yyextra->option.TexRect)
#define require_texarray (yyextra->option.TexArray)
+#ifndef HAVE_UNISTD_H
+#define YY_NO_UNISTD_H
+#endif
+
#define return_token_or_IDENTIFIER(condition, token) \
do { \
if (condition) { \
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 344dfdc6804..ee5a50ca82e 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -925,7 +925,7 @@ gen_return_with_expression(slang_assemble_ctx *A, slang_operation *oper)
slang_operation_copy(rhs, &oper->children[0]);
}
- ///blockOper->locals->outer_scope = oper->locals->outer_scope;
+ /*blockOper->locals->outer_scope = oper->locals->outer_scope;*/
/*slang_print_tree(blockOper, 0);*/
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index c1b97c7cb70..95c44e30547 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -2738,6 +2738,7 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
slang_info_log info_log;
slang_code_object obj;
slang_unit_type type;
+ GLenum progTarget;
if (shader->Type == GL_VERTEX_SHADER) {
type = SLANG_UNIT_VERTEX_SHADER;
@@ -2754,17 +2755,18 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
shader->Main = GL_FALSE;
- if (!shader->Program) {
- GLenum progTarget;
- if (shader->Type == GL_VERTEX_SHADER)
- progTarget = GL_VERTEX_PROGRAM_ARB;
- else
- progTarget = GL_FRAGMENT_PROGRAM_ARB;
- shader->Program = ctx->Driver.NewProgram(ctx, progTarget, 1);
- shader->Program->Parameters = _mesa_new_parameter_list();
- shader->Program->Varying = _mesa_new_parameter_list();
- shader->Program->Attributes = _mesa_new_parameter_list();
- }
+ /* free the shader's old instructions, etc */
+ _mesa_reference_program(ctx, &shader->Program, NULL);
+
+ /* allocate new GPU program, parameter lists, etc. */
+ if (shader->Type == GL_VERTEX_SHADER)
+ progTarget = GL_VERTEX_PROGRAM_ARB;
+ else
+ progTarget = GL_FRAGMENT_PROGRAM_ARB;
+ shader->Program = ctx->Driver.NewProgram(ctx, progTarget, 1);
+ shader->Program->Parameters = _mesa_new_parameter_list();
+ shader->Program->Varying = _mesa_new_parameter_list();
+ shader->Program->Attributes = _mesa_new_parameter_list();
slang_info_log_construct(&info_log);
_slang_code_object_ctr(&obj);
diff --git a/src/mesa/shader/slang/slang_compile_operation.c b/src/mesa/shader/slang/slang_compile_operation.c
index 3e2bdbc91ff..3a15d9d3ab5 100644
--- a/src/mesa/shader/slang/slang_compile_operation.c
+++ b/src/mesa/shader/slang/slang_compile_operation.c
@@ -46,12 +46,14 @@ slang_operation_construct(slang_operation * oper)
oper->literal_size = 1;
oper->array_constructor = GL_FALSE;
oper->a_id = SLANG_ATOM_NULL;
+ oper->a_obj = SLANG_ATOM_NULL;
oper->locals = _slang_variable_scope_new(NULL);
if (oper->locals == NULL)
return GL_FALSE;
_slang_variable_scope_ctr(oper->locals);
oper->fun = NULL;
oper->var = NULL;
+ oper->label = NULL;
return GL_TRUE;
}
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index ca15ce1b474..d6254aa7637 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -137,7 +137,7 @@ void st_validate_state( struct st_context *st )
if (state->st == 0)
return;
-// _mesa_printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);
+ /* _mesa_printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);*/
if (1) {
/* Debug version which enforces various sanity checks on the
@@ -152,7 +152,7 @@ void st_validate_state( struct st_context *st )
const struct st_tracked_state *atom = atoms[i];
struct st_state_flags generated;
-// _mesa_printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st);
+ /*_mesa_printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st);*/
if (!(atom->dirty.mesa || atom->dirty.st) ||
!atom->update) {
@@ -162,7 +162,7 @@ void st_validate_state( struct st_context *st )
if (check_state(state, &atom->dirty)) {
atoms[i]->update( st );
-// _mesa_printf("after: %x\n", atom->dirty.mesa);
+ /*_mesa_printf("after: %x\n", atom->dirty.mesa);*/
}
accumulate_state(&examined, &atom->dirty);
@@ -175,7 +175,7 @@ void st_validate_state( struct st_context *st )
assert(!check_state(&examined, &generated));
prev = *state;
}
-// _mesa_printf("\n");
+ /*_mesa_printf("\n");*/
}
else {
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 902fb38d1a7..d6ec5dabfa0 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -515,7 +515,7 @@ reset_cache(struct st_context *st)
struct pipe_screen *screen = pipe->screen;
struct bitmap_cache *cache = st->bitmap.cache;
- //memset(cache->buffer, 0xff, sizeof(cache->buffer));
+ /*memset(cache->buffer, 0xff, sizeof(cache->buffer));*/
cache->empty = GL_TRUE;
cache->xmin = 1000000;
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index c76bff91819..6f5248cbe57 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -371,7 +371,7 @@ setup_interleaved_attribs(GLcontext *ctx,
{
struct pipe_context *pipe = ctx->st->pipe;
GLuint attr;
- const GLubyte *offset0;
+ const GLubyte *offset0 = NULL;
for (attr = 0; attr < vp->num_inputs; attr++) {
const GLuint mesaAttr = vp->index_to_input[attr];
@@ -550,7 +550,7 @@ st_draw_vbo(GLcontext *ctx,
GLuint attr;
struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
unsigned num_vbuffers, num_velements;
- GLboolean userSpace;
+ GLboolean userSpace = GL_FALSE;
/* Gallium probably doesn't want this in some cases. */
if (!index_bounds_valid)
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index f75b2348b82..c3bea3172a5 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -215,6 +215,9 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
/* find expected last mipmap level */
lastLevel = compute_num_levels(ctx, texObj, target) - 1;
+ if (lastLevel == 0)
+ return;
+
if (pt->last_level < lastLevel) {
/* The current gallium texture doesn't have space for all the
* mipmap levels we need to generate. So allocate a new texture.
diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c
index 5fefae6c42b..e88ff191239 100644
--- a/src/mesa/swrast/s_atifragshader.c
+++ b/src/mesa/swrast/s_atifragshader.c
@@ -279,7 +279,7 @@ handle_sample_op(GLcontext * ctx, struct atifs_machine *machine,
/* sample from unit idx using texinst->src as coords */
GLuint swizzle = texinst->swizzle;
GLuint coord_source = texinst->src;
- GLfloat tex_coords[4];
+ GLfloat tex_coords[4] = { 0 };
if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) {
coord_source -= GL_TEXTURE0_ARB;
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index 1ab0e19f922..a65b7b3e228 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -540,6 +540,9 @@ affine_span(GLcontext *ctx, SWspan *span,
info.format = obj->Image[0][b]->_BaseFormat; \
info.filter = obj->MinFilter; \
info.envmode = unit->EnvMode; \
+ info.er = 0; \
+ info.eg = 0; \
+ info.eb = 0; \
span.arrayMask |= SPAN_RGBA; \
\
if (info.envmode == GL_BLEND) { \
@@ -809,6 +812,9 @@ fast_persp_span(GLcontext *ctx, SWspan *span,
info.format = obj->Image[0][b]->_BaseFormat; \
info.filter = obj->MinFilter; \
info.envmode = unit->EnvMode; \
+ info.er = 0; \
+ info.eg = 0; \
+ info.eb = 0; \
\
if (info.envmode == GL_BLEND) { \
/* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index 724b5e94fa5..bd20a8d972f 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -41,9 +41,9 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
GLenum mode = GL_FILL;
GLuint facing = 0;
GLchan saved_color[3][4];
- GLfloat saved_col0[3][4];
- GLfloat saved_spec[3][4];
- GLfloat saved_index[3];
+ GLfloat saved_col0[3][4] = { { 0 } };
+ GLfloat saved_spec[3][4] = { { 0 } };
+ GLfloat saved_index[3] = { 0 };
v[0] = &verts[e0];
v[1] = &verts[e1];
diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h
index e4b535fb680..d568bfdb584 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp.h
@@ -241,6 +241,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx,
tmp = ALLOC_VERTS(nr+1);
tmp = TAG(emit_verts)( ctx, j, nr, tmp );
tmp = TAG(emit_verts)( ctx, start, 1, tmp );
+ (void) tmp;
}
else {
TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) );
@@ -254,6 +255,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx,
tmp = ALLOC_VERTS(2);
tmp = TAG(emit_verts)( ctx, start+1, 1, tmp );
tmp = TAG(emit_verts)( ctx, start, 1, tmp );
+ (void) tmp;
}
FLUSH();
@@ -358,6 +360,7 @@ static void TAG(render_tri_fan_verts)( GLcontext *ctx,
tmp = ALLOC_VERTS( nr );
tmp = TAG(emit_verts)( ctx, start, 1, tmp );
tmp = TAG(emit_verts)( ctx, j, nr - 1, tmp );
+ (void) tmp;
currentsz = dmasz;
}
@@ -397,6 +400,7 @@ static void TAG(render_poly_verts)( GLcontext *ctx,
tmp = ALLOC_VERTS( nr );
tmp = TAG(emit_verts)( ctx, start, 1, tmp );
tmp = TAG(emit_verts)( ctx, j, nr - 1, tmp );
+ (void) tmp;
currentsz = dmasz;
}
@@ -634,6 +638,7 @@ static void TAG(render_quads_verts)( GLcontext *ctx,
/* Send v1, v2, v3
*/
tmp = EMIT_VERTS(ctx, j + 1, 3, tmp);
+ (void) tmp;
}
}
else {
@@ -820,6 +825,7 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx,
tmp = ALLOC_ELTS(nr+1);
tmp = TAG(emit_elts)( ctx, elts+j, nr, tmp );
tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp );
+ (void) tmp;
}
else {
TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) );
@@ -833,6 +839,7 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx,
tmp = ALLOC_ELTS(2);
tmp = TAG(emit_elts)( ctx, elts+start+1, 1, tmp );
tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp );
+ (void) tmp;
}
FLUSH();
@@ -946,6 +953,7 @@ static void TAG(render_tri_fan_elts)( GLcontext *ctx,
tmp = ALLOC_ELTS( nr );
tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp );
tmp = TAG(emit_elts)( ctx, elts+j, nr - 1, tmp );
+ (void) tmp;
FLUSH();
currentsz = dmasz;
}
@@ -983,6 +991,7 @@ static void TAG(render_poly_elts)( GLcontext *ctx,
tmp = ALLOC_ELTS( nr );
tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp );
tmp = TAG(emit_elts)( ctx, elts+j, nr - 1, tmp );
+ (void) tmp;
FLUSH();
currentsz = dmasz;
}
diff --git a/src/mesa/tnl_dd/t_dd_dmatmp2.h b/src/mesa/tnl_dd/t_dd_dmatmp2.h
index 2380c49fdf4..cd225b6343e 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp2.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp2.h
@@ -266,6 +266,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx,
if (j + nr < count) {
ELT_TYPE *dest = ALLOC_ELTS( nr );
dest = TAG(emit_consecutive_elts)( ctx, dest, j, nr );
+ (void) dest;
j += nr - 1;
CLOSE_ELTS();
}
@@ -273,6 +274,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx,
ELT_TYPE *dest = ALLOC_ELTS( nr + 1 );
dest = TAG(emit_consecutive_elts)( ctx, dest, j, nr );
dest = TAG(emit_consecutive_elts)( ctx, dest, start, 1 );
+ (void) dest;
j += nr;
CLOSE_ELTS();
}
@@ -554,6 +556,7 @@ static void TAG(render_points_elts)( GLcontext *ctx,
nr = MIN2( dmasz, count - j );
dest = ALLOC_ELTS( nr );
dest = TAG(emit_elts)( ctx, dest, elts+j, nr );
+ (void) dest;
CLOSE_ELTS();
}
}
@@ -590,6 +593,7 @@ static void TAG(render_lines_elts)( GLcontext *ctx,
nr = MIN2( dmasz, count - j );
dest = ALLOC_ELTS( nr );
dest = TAG(emit_elts)( ctx, dest, elts+j, nr );
+ (void) dest;
CLOSE_ELTS();
}
@@ -621,6 +625,7 @@ static void TAG(render_line_strip_elts)( GLcontext *ctx,
nr = MIN2( dmasz, count - j );
dest = ALLOC_ELTS( nr );
dest = TAG(emit_elts)( ctx, dest, elts+j, nr );
+ (void) dest;
CLOSE_ELTS();
}
}
@@ -671,6 +676,7 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx,
j += nr - 1;
if (j + 1 >= count && (flags & PRIM_END)) {
dest = TAG(emit_elts)( ctx, dest, elts+start, 1 );
+ (void) dest;
}
CLOSE_ELTS();
}
@@ -703,6 +709,7 @@ static void TAG(render_triangles_elts)( GLcontext *ctx,
nr = MIN2( dmasz, count - j );
dest = ALLOC_ELTS( nr );
dest = TAG(emit_elts)( ctx, dest, elts+j, nr );
+ (void) dest;
CLOSE_ELTS();
}
}
@@ -734,6 +741,7 @@ static void TAG(render_tri_strip_elts)( GLcontext *ctx,
dest = ALLOC_ELTS( nr );
dest = TAG(emit_elts)( ctx, dest, elts+j, nr );
+ (void) dest;
CLOSE_ELTS();
}
}
@@ -759,6 +767,7 @@ static void TAG(render_tri_fan_elts)( GLcontext *ctx,
dest = ALLOC_ELTS( nr );
dest = TAG(emit_elts)( ctx, dest, elts+start, 1 );
dest = TAG(emit_elts)( ctx, dest, elts+j, nr - 1 );
+ (void) dest;
CLOSE_ELTS();
}
}
@@ -785,6 +794,7 @@ static void TAG(render_poly_elts)( GLcontext *ctx,
dest = ALLOC_ELTS( nr );
dest = TAG(emit_elts)( ctx, dest, elts+start, 1 );
dest = TAG(emit_elts)( ctx, dest, elts+j, nr - 1 );
+ (void) dest;
CLOSE_ELTS();
}
}
@@ -843,6 +853,7 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx,
nr = MIN2( dmasz, count - j );
dest = ALLOC_ELTS( nr );
dest = TAG(emit_elts)( ctx, dest, elts+j, nr );
+ (void) dest;
CLOSE_ELTS();
}
}
diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h
index 1ae70f4059f..c3ba8514c8a 100644
--- a/src/mesa/tnl_dd/t_dd_tritmp.h
+++ b/src/mesa/tnl_dd/t_dd_tritmp.h
@@ -132,7 +132,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
VERTEX *v[3];
GLfloat offset = 0;
- GLfloat z[3];
+ GLfloat z[3] = { 0 };
GLenum mode = GL_FILL;
GLuint facing = 0;
LOCAL_VARS(3);
@@ -395,7 +395,7 @@ static void TAG(quadr)( GLcontext *ctx,
struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
VERTEX *v[4];
GLfloat offset = 0;
- GLfloat z[4];
+ GLfloat z[4] = { 0 };
GLenum mode = GL_FILL;
GLuint facing = 0;
LOCAL_VARS(4);
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 39c2957631a..e59cf77c16f 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -149,7 +149,7 @@ check_array_data(GLcontext *ctx, struct gl_client_array *array,
array->Ptr, array->BufferObj->Name);
f[k] = 1.0; /* XXX replace the bad value! */
}
- //assert(!IS_INF_OR_NAN(f[k]));
+ /*assert(!IS_INF_OR_NAN(f[k]));*/
}
}
break;
diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c
index 5aedf5b04be..647be995c12 100644
--- a/src/mesa/x86/rtasm/x86sse.c
+++ b/src/mesa/x86/rtasm/x86sse.c
@@ -7,10 +7,12 @@
#define DISASSEM 0
#define X86_TWOB 0x0f
+#if 0
static unsigned char *cptr( void (*label)() )
{
return (unsigned char *)(unsigned long)label;
}
+#endif
static void do_realloc( struct x86_function *p )