Compare commits
	
		
			219 Commits
		
	
	
		
			mesa-13.0.
			...
			mesa_6_4_2
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 3b0c8dcaa3 | ||
|  | d8a6ef40a6 | ||
|  | 7a79373adc | ||
|  | 69dd5a749a | ||
|  | c76125ef03 | ||
|  | 020fa49e9c | ||
|  | 89cc04d6bd | ||
|  | c3104ab838 | ||
|  | 5f7f146ec2 | ||
|  | 4161495074 | ||
|  | 61c58fce3d | ||
|  | ba5e587f1d | ||
|  | cbdfd0d112 | ||
|  | 965e888f49 | ||
|  | 89f3e7f749 | ||
|  | d2e735f2e7 | ||
|  | 5879d1be61 | ||
|  | 546f85daa0 | ||
|  | a47358ce09 | ||
|  | 318e1adaa6 | ||
|  | 2dfa8a9c0b | ||
|  | 333e14b066 | ||
|  | 52c07cddd5 | ||
|  | 978d0eb71b | ||
|  | e26c934961 | ||
|  | 7e76e05f0b | ||
|  | 4fc07ba779 | ||
|  | a8c469c3b6 | ||
|  | 919b606a94 | ||
|  | 112180c2d8 | ||
|  | eccccc8940 | ||
|  | fcb01c7127 | ||
|  | 366d6600d0 | ||
|  | 98ac241a4e | ||
|  | f3cb488333 | ||
|  | 53e595017e | ||
|  | f8be78367d | ||
|  | 89568e0509 | ||
|  | 149675017f | ||
|  | 4d87d19a60 | ||
|  | 7a46bf5e1b | ||
|  | c2cabc6755 | ||
|  | 3fa7668f99 | ||
|  | 2370d426cf | ||
|  | d8eb2d49dd | ||
|  | fcda7131b4 | ||
|  | 6ff7b66f4a | ||
|  | e037150407 | ||
|  | c2e6917e14 | ||
|  | 2048fabe04 | ||
|  | b7da962caf | ||
|  | 040bdbe2e6 | ||
|  | 471c17cc84 | ||
|  | ad9a205ba8 | ||
|  | 45c30dbead | ||
|  | eeb4f1aff9 | ||
|  | 1ea4669fce | ||
|  | a110f0f407 | ||
|  | 4f42aa83f1 | ||
|  | eb72779ef1 | ||
|  | 47604ffc2f | ||
|  | 5889e4b775 | ||
|  | f9d66b2a44 | ||
|  | 2119711dac | ||
|  | fcc21abbc6 | ||
|  | c331aef105 | ||
|  | 2fc89f126a | ||
|  | 22c8686dad | ||
|  | 7a12ad5a08 | ||
|  | c6165ec3b3 | ||
|  | 67ef9d76e7 | ||
|  | aa5f5d54a8 | ||
|  | c18fd3a3bf | ||
|  | d799fbf78e | ||
|  | 48d7f01740 | ||
|  | 59f84d5723 | ||
|  | 6f9ff2af81 | ||
|  | 4591406e21 | ||
|  | 2c6cf3d0aa | ||
|  | 154a8be6a7 | ||
|  | db03e55efa | ||
|  | d038563a60 | ||
|  | 469bd21184 | ||
|  | 13a5235305 | ||
|  | 4e4f6a29f3 | ||
|  | 87855fd59b | ||
|  | 546b020144 | ||
|  | 84663e12d0 | ||
|  | c16bb264e8 | ||
|  | 8ef980af6e | ||
|  | 7cd7a78d72 | ||
|  | 5c57efd6b4 | ||
|  | ea9ed5849f | ||
|  | 1ef0939a64 | ||
|  | d0f9c2887c | ||
|  | ed75287003 | ||
|  | c01c2fb542 | ||
|  | e1d7297812 | ||
|  | b4227f0d98 | ||
|  | c868c1ee14 | ||
|  | a1dcb43658 | ||
|  | cc7b6810e2 | ||
|  | 7b9fecee10 | ||
|  | 8856180e4f | ||
|  | df51dfbdc3 | ||
|  | 2fd1ed1b45 | ||
|  | 66b928e95e | ||
|  | d5e9cca0b2 | ||
|  | c072c17a8c | ||
|  | 8367420be9 | ||
|  | e2a2ed06b2 | ||
|  | 0cc3703188 | ||
|  | fb6c1492fb | ||
|  | 89ad797f9a | ||
|  | fa67028ae7 | ||
|  | 8e1724dfe9 | ||
|  | fbdb5c9b14 | ||
|  | 4b2728f95c | ||
|  | 3a7437399f | ||
|  | 3338f04be7 | ||
|  | 047f7bb11c | ||
|  | 5b25acdac7 | ||
|  | cb16208ec0 | ||
|  | 88107bea56 | ||
|  | b4d25157f2 | ||
|  | c6d1f32ebe | ||
|  | 281f388e03 | ||
|  | c0a0dfeb96 | ||
|  | ab07593563 | ||
|  | 5b08058604 | ||
|  | 3bf13d3c4b | ||
|  | 2b05784084 | ||
|  | 2292262de4 | ||
|  | a9358bb3b0 | ||
|  | b9d111f202 | ||
|  | 20fd105e2a | ||
|  | 1faaa0090a | ||
|  | 23803bd5fb | ||
|  | c000250504 | ||
|  | b854297bab | ||
|  | 3c1b44ad55 | ||
|  | bdab2cc216 | ||
|  | 91ade9ad68 | ||
|  | 7355bbce55 | ||
|  | 1d2671e6cb | ||
|  | 0a405dcc5f | ||
|  | b210ffaadf | ||
|  | b1e8471898 | ||
|  | aefe0dabec | ||
|  | 758c5b9a7e | ||
|  | 44db6d7cb8 | ||
|  | 04f1fdc755 | ||
|  | b181773d02 | ||
|  | 4218cddfb1 | ||
|  | a4e35c21d2 | ||
|  | 5d63323d34 | ||
|  | 419a350499 | ||
|  | db78ec7018 | ||
|  | 291911aeb5 | ||
|  | e15a7d4883 | ||
|  | 2e95fdc5d8 | ||
|  | 6e03f6ed43 | ||
|  | 97790948f6 | ||
|  | a882648023 | ||
|  | b7f8d69bb3 | ||
|  | 5bad790e56 | ||
|  | 382b00f483 | ||
|  | 718bd385ed | ||
|  | 402ca8903f | ||
|  | 25a9c9f370 | ||
|  | d73a838f01 | ||
|  | c72b2fb2db | ||
|  | 5a6ce051ef | ||
|  | e7c2fa9cff | ||
|  | 5919aec5c3 | ||
|  | f5a6175d83 | ||
|  | e41ea35fee | ||
|  | 38cf2b14f4 | ||
|  | 66725dca81 | ||
|  | 59ad040754 | ||
|  | 5e16f314d6 | ||
|  | 2376438410 | ||
|  | 1be13df2c3 | ||
|  | 1f6892527b | ||
|  | e5f6f26c87 | ||
|  | e14b3baca0 | ||
|  | 5eb129de76 | ||
|  | 3f27b6ffeb | ||
|  | 270572e543 | ||
|  | 7b56e1a443 | ||
|  | cfaac5dc4f | ||
|  | 1e5c3e977f | ||
|  | 831b4143f7 | ||
|  | b26b565f91 | ||
|  | f4d1dafc18 | ||
|  | db70c3f9b6 | ||
|  | 384b1d03e4 | ||
|  | e3c1b594ae | ||
|  | 453eb90128 | ||
|  | cb505bf744 | ||
|  | 133112c71a | ||
|  | a66eebc579 | ||
|  | 89ea47182d | ||
|  | 2efe639f26 | ||
|  | 39e4095560 | ||
|  | b19ec5009f | ||
|  | afed3e55ba | ||
|  | 46cf4fa1bd | ||
|  | b4198e821a | ||
|  | 5a1fb7db0e | ||
|  | f16fbf03bd | ||
|  | ec0c42a3be | ||
|  | a4c1895d07 | ||
|  | b2971358ad | ||
|  | 24a36c26fa | ||
|  | 247e27d0b8 | ||
|  | 912bcb2386 | ||
|  | cee416863f | ||
|  | 8e946792dc | 
							
								
								
									
										49
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								Makefile
									
									
									
									
									
								
							| @@ -134,9 +134,10 @@ ultrix-gcc: | ||||
|  | ||||
| # Rules for making release tarballs | ||||
|  | ||||
| DIRECTORY = Mesa-6.5 | ||||
| LIB_NAME = MesaLib-6.5 | ||||
| DEMO_NAME = MesaDemos-6.5 | ||||
| DIRECTORY = Mesa-6.4.2 | ||||
| LIB_NAME = MesaLib-6.4.2 | ||||
| DEMO_NAME = MesaDemos-6.4.2 | ||||
| GLUT_NAME = MesaGLUT-6.4.2 | ||||
|  | ||||
| MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/Makefile*						\ | ||||
| @@ -165,6 +166,7 @@ MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/include/GL/glx.h					\ | ||||
| 	$(DIRECTORY)/include/GL/glxext.h				\ | ||||
| 	$(DIRECTORY)/include/GL/glx_mangle.h				\ | ||||
| 	$(DIRECTORY)/include/GL/glfbdev.h				\ | ||||
| 	$(DIRECTORY)/include/GL/mesa_wgl.h				\ | ||||
| 	$(DIRECTORY)/include/GL/mglmesa.h				\ | ||||
| 	$(DIRECTORY)/include/GL/osmesa.h				\ | ||||
| @@ -213,7 +215,6 @@ MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/directfb/*.[ch]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/directfb/Makefile			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dos/*.[chS]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/common/*.[ch]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/glide/*.[ch]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/ggi/*.[ch]			\ | ||||
| @@ -260,16 +261,15 @@ MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/windows/VC7/mesa/osmesa/osmesa.vcproj | ||||
|  | ||||
| DRI_FILES = \ | ||||
| 	$(DIRECTORY)/include/GL/internal/*.h				\ | ||||
| 	$(DIRECTORY)/include/GL/internal/dri_interface.h		\ | ||||
| 	$(DIRECTORY)/include/GL/internal/sarea.h			\ | ||||
| 	$(DIRECTORY)/src/glx/Makefile					\ | ||||
| 	$(DIRECTORY)/src/glx/x11/Makefile				\ | ||||
| 	$(DIRECTORY)/src/glx/x11/*.[ch]					\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/Makefile			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/Makefile.template		\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/common/*.[ch]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.[ch]		\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po		\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/dri_client/imports/*.h	\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/*/Makefile			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile			\ | ||||
| @@ -312,7 +312,7 @@ GLW_FILES = \ | ||||
| 	$(DIRECTORY)/src/glw/README			\ | ||||
| 	$(DIRECTORY)/src/glw/depend | ||||
|  | ||||
| PROG_FILES = \ | ||||
| DEMO_FILES = \ | ||||
| 	$(DIRECTORY)/progs/beos/*.cpp			\ | ||||
| 	$(DIRECTORY)/progs/beos/Makefile		\ | ||||
| 	$(DIRECTORY)/progs/images/*.rgb			\ | ||||
| @@ -323,6 +323,8 @@ PROG_FILES = \ | ||||
| 	$(DIRECTORY)/progs/demos/*.cxx			\ | ||||
| 	$(DIRECTORY)/progs/demos/*.dat			\ | ||||
| 	$(DIRECTORY)/progs/demos/README			\ | ||||
| 	$(DIRECTORY)/progs/osdemos/Makefile		\ | ||||
| 	$(DIRECTORY)/progs/osdemos/*.c			\ | ||||
| 	$(DIRECTORY)/progs/xdemos/Makefile*		\ | ||||
| 	$(DIRECTORY)/progs/xdemos/descrip.mms		\ | ||||
| 	$(DIRECTORY)/progs/xdemos/*.[chf]		\ | ||||
| @@ -337,10 +339,8 @@ PROG_FILES = \ | ||||
| 	$(DIRECTORY)/progs/windml/*.bmp			\ | ||||
| 	$(DIRECTORY)/progs/ggi/*.c			\ | ||||
| 	$(DIRECTORY)/windows/VC6/progs/demos/*.dsp	\ | ||||
| 	$(DIRECTORY)/windows/VC6/progs/glut/glut.dsp	\ | ||||
| 	$(DIRECTORY)/windows/VC6/progs/progs.dsw	\ | ||||
| 	$(DIRECTORY)/windows/VC7/progs/demos/*.vcproj	\ | ||||
| 	$(DIRECTORY)/windows/VC7/progs/glut/glut.vcproj	\ | ||||
| 	$(DIRECTORY)/windows/VC7/progs/progs.sln | ||||
|  | ||||
| GLUT_FILES = \ | ||||
| @@ -359,7 +359,9 @@ GLUT_FILES = \ | ||||
| 	$(DIRECTORY)/src/glut/dos/Makefile.DJ		\ | ||||
| 	$(DIRECTORY)/src/glut/dos/PC_HW/*.[chS]		\ | ||||
| 	$(DIRECTORY)/src/glut/ggi/*.[ch]		\ | ||||
| 	$(DIRECTORY)/src/glut/ggi/Makefile | ||||
| 	$(DIRECTORY)/src/glut/ggi/Makefile		\ | ||||
| 	$(DIRECTORY)/windows/VC6/progs/glut/glut.dsp	\ | ||||
| 	$(DIRECTORY)/windows/VC7/progs/glut/glut.vcproj | ||||
|  | ||||
| DEPEND_FILES = \ | ||||
| 	$(TOP)/src/mesa/depend		\ | ||||
| @@ -370,11 +372,9 @@ DEPEND_FILES = \ | ||||
|  | ||||
| LIB_FILES = $(MAIN_FILES) $(DRI_FILES) $(SGI_GLU_FILES) $(GLW_FILES) | ||||
|  | ||||
| DEMO_FILES = $(PROG_FILES) $(GLUT_FILES) | ||||
|  | ||||
|  | ||||
| # Everything for new a Mesa release: | ||||
| tarballs: rm_depend lib_gz demo_gz lib_bz2 demo_bz2 lib_zip demo_zip md5 | ||||
| tarballs: rm_depend lib_gz demo_gz glut_gz lib_bz2 demo_bz2 glut_bz2 lib_zip demo_zip glut_zip md5 | ||||
|  | ||||
|  | ||||
| rm_depend: | ||||
| @@ -396,6 +396,12 @@ demo_gz: | ||||
| 	gzip $(DEMO_NAME).tar ; \ | ||||
| 	mv $(DEMO_NAME).tar.gz $(DIRECTORY) | ||||
|  | ||||
| glut_gz: | ||||
| 	cd .. ; \ | ||||
| 	tar -cf $(GLUT_NAME).tar $(GLUT_FILES) ; \ | ||||
| 	gzip $(GLUT_NAME).tar ; \ | ||||
| 	mv $(GLUT_NAME).tar.gz $(DIRECTORY) | ||||
|  | ||||
| lib_bz2: | ||||
| 	rm -f configs/current ; \ | ||||
| 	cd .. ; \ | ||||
| @@ -409,6 +415,12 @@ demo_bz2: | ||||
| 	bzip2 $(DEMO_NAME).tar ; \ | ||||
| 	mv $(DEMO_NAME).tar.bz2 $(DIRECTORY) | ||||
|  | ||||
| glut_bz2: | ||||
| 	cd .. ; \ | ||||
| 	tar -cf $(GLUT_NAME).tar $(GLUT_FILES) ; \ | ||||
| 	bzip2 $(GLUT_NAME).tar ; \ | ||||
| 	mv $(GLUT_NAME).tar.bz2 $(DIRECTORY) | ||||
|  | ||||
| lib_zip: | ||||
| 	rm -f configs/current ; \ | ||||
| 	rm -f $(LIB_NAME).zip ; \ | ||||
| @@ -422,6 +434,12 @@ demo_zip: | ||||
| 	zip -qr $(DEMO_NAME).zip $(DEMO_FILES) ; \ | ||||
| 	mv $(DEMO_NAME).zip $(DIRECTORY) | ||||
|  | ||||
| glut_zip: | ||||
| 	rm -f $(GLUT_NAME).zip ; \ | ||||
| 	cd .. ; \ | ||||
| 	zip -qr $(GLUT_NAME).zip $(GLUT_FILES) ; \ | ||||
| 	mv $(GLUT_NAME).zip $(DIRECTORY) | ||||
|  | ||||
| md5: | ||||
| 	@-md5sum $(LIB_NAME).tar.gz | ||||
| 	@-md5sum $(LIB_NAME).tar.bz2 | ||||
| @@ -429,3 +447,6 @@ md5: | ||||
| 	@-md5sum $(DEMO_NAME).tar.gz | ||||
| 	@-md5sum $(DEMO_NAME).tar.bz2 | ||||
| 	@-md5sum $(DEMO_NAME).zip | ||||
| 	@-md5sum $(GLUT_NAME).tar.gz | ||||
| 	@-md5sum $(GLUT_NAME).tar.bz2 | ||||
| 	@-md5sum $(GLUT_NAME).zip | ||||
|   | ||||
| @@ -12,7 +12,7 @@ TOP=. | ||||
| INCLUDE_DIR="/usr/local/include" | ||||
| LIB_DIR="/usr/local/lib" | ||||
|  | ||||
| if [ x$# == "x0" ] ; then | ||||
| if [ "x$#" = "x0" ] ; then | ||||
| echo | ||||
| echo "***** Mesa installation - You may need root privileges to do this *****" | ||||
| echo | ||||
| @@ -20,7 +20,7 @@ echo "Default directory for header files is:" ${INCLUDE_DIR} | ||||
| echo "Enter new directory or press <Enter> to accept this default." | ||||
|  | ||||
| read INPUT | ||||
| if [ x${INPUT} != "x" ] ; then | ||||
| if [ "x${INPUT}" != "x" ] ; then | ||||
| 	INCLUDE_DIR=${INPUT} | ||||
| fi | ||||
|  | ||||
| @@ -29,7 +29,7 @@ echo "Default directory for library files is:" ${LIB_DIR} | ||||
| echo "Enter new directory or press <Enter> to accept this default." | ||||
|  | ||||
| read INPUT | ||||
| if [ x${INPUT} != "x" ] ; then | ||||
| if [ "x${INPUT}" != "x" ] ; then | ||||
| 	LIB_DIR=${INPUT} | ||||
| fi | ||||
|  | ||||
| @@ -47,7 +47,16 @@ fi | ||||
|  | ||||
| # flags: | ||||
| #  -f = force | ||||
| #  -d = preserve symlinks | ||||
| #  -d = preserve symlinks (does not work on BSD) | ||||
|  | ||||
| if [ `uname` = "FreeBSD" ] ; then | ||||
| 	CP_FLAGS="-f" | ||||
| elif [ `uname` = "Darwin" ] ; then | ||||
| 	CP_FLAGS="-f" | ||||
| else | ||||
| 	CP_FLAGS="-fd" | ||||
| fi | ||||
|  | ||||
|  | ||||
| set -v | ||||
|  | ||||
| @@ -56,7 +65,8 @@ mkdir ${INCLUDE_DIR}/GL | ||||
| mkdir ${INCLUDE_DIR}/GLES | ||||
| mkdir ${LIB_DIR} | ||||
| cp -f ${TOP}/include/GL/*.h ${INCLUDE_DIR}/GL | ||||
| cp -f ${TOP}/include/GLES/*.h ${INCLUDE_DIR}/GLES | ||||
| cp -fd ${TOP}/lib*/lib* ${LIB_DIR} | ||||
| cp -f ${TOP}/src/glw/*.h ${INCLUDE_DIR}/GL | ||||
| # NOT YET: cp -f ${TOP}/include/GLES/*.h ${INCLUDE_DIR}/GLES | ||||
| cp ${CP_FLAGS} ${TOP}/lib*/lib* ${LIB_DIR} | ||||
|  | ||||
| echo "Done." | ||||
|   | ||||
							
								
								
									
										25
									
								
								bin/mklib
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								bin/mklib
									
									
									
									
									
								
							| @@ -309,11 +309,23 @@ case $ARCH in | ||||
| 	;; | ||||
|  | ||||
|     'FreeBSD') | ||||
| 	# we assume gcc | ||||
|  | ||||
| 	if [ "x$LINK" = "x" ] ; then | ||||
| 	    # -linker was not specified so set default link command now | ||||
|             if [ $CPLUSPLUS = 1 ] ; then | ||||
|                 LINK=g++ | ||||
|             else | ||||
|                 LINK=gcc | ||||
|             fi | ||||
| 	fi | ||||
|  | ||||
| 	if [ $NOPREFIX = 1 ] ; then | ||||
| 	    # No "lib" or ".so" part | ||||
| 	    echo "mklib: Making FreeBSD shared library: " ${LIBNAME} | ||||
| 	    OPTS="-shared" | ||||
| 	    rm -f ${LIBNAME} | ||||
| 	    ld -Bshareable -o ${LIBNAME} ${OBJECTS} | ||||
| 	    ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} | ||||
| 	    FINAL_LIBS=${LIBNAME} | ||||
|         elif [ $STATIC = 1 ] ; then | ||||
| 	    STLIB="lib${LIBNAME}.a" | ||||
| @@ -323,12 +335,13 @@ case $ARCH in | ||||
| 	    ranlib ${STLIB} | ||||
| 	    FINAL_LIBS=${STLIB} | ||||
| 	else | ||||
| 	    SHLIB="lib${LIBNAME}.so.${MAJOR}.${MINOR}" | ||||
| 	    SHLIB="lib${LIBNAME}.so.${MAJOR}" | ||||
| 	    OPTS="-shared -Wl,-soname,${SHLIB}" | ||||
| 	    echo "mklib: Making FreeBSD shared library: " ${SHLIB} | ||||
| 	    rm -f ${SHLIB} | ||||
| 	    ld -Bshareable -o ${SHLIB} ${OBJECTS} | ||||
| 	    # XXX make lib${LIBNAME}.so.${MAJOR} symlink? | ||||
| 	    FINAL_LIBS=${SHLIB} | ||||
| 	    ${LINK} ${OPTS} -o ${SHLIB} ${OBJECTS} ${DEPS} | ||||
| 	    ln -sf ${SHLIB} "lib${LIBNAME}.so" | ||||
| 	    FINAL_LIBS="${SHLIB} lib${LIBNAME}.so" | ||||
| 	fi | ||||
| 	;; | ||||
|  | ||||
| @@ -492,7 +505,7 @@ case $ARCH in | ||||
|         else | ||||
|             LIBNAME="lib${LIBNAME}.dylib" | ||||
|             echo "mklib: Making Darwin shared library: " ${LIBNAME} | ||||
|             FLAGS="-dynamiclib -multiply_defined suppress" | ||||
|             FLAGS="-dynamiclib -multiply_defined suppress -current_version ${MAJOR}.${MINOR}.0 -compatibility_version ${MAJOR}.${MINOR}.0" | ||||
| 	    if [ $CPLUSPLUS = 1 ] ; then | ||||
| 		LINK="g++" | ||||
| 	    else | ||||
|   | ||||
| @@ -7,7 +7,7 @@ CONFIG_NAME = default | ||||
|  | ||||
| # Version info | ||||
| MESA_MAJOR=6 | ||||
| MESA_MINOR=3 | ||||
| MESA_MINOR=4 | ||||
| MESA_TINY=2 | ||||
|  | ||||
| # external projects.  This should be useless now that we use libdrm. | ||||
|   | ||||
| @@ -13,5 +13,4 @@ CFLAGS = -O2 -fPIC -pedantic -I/usr/X11R6/include -DUSE_XSHM -DHZ=100 | ||||
| CXXFLAGS = -O2 -fPIC -pedantic | ||||
| GLUT_CFLAGS = -fexceptions | ||||
|  | ||||
| APP_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 -lm | ||||
|  | ||||
| APP_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lXext -lXmu -lXi -lX11 -lm | ||||
|   | ||||
| @@ -31,7 +31,7 @@ GLW_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -lGL -lXt -lXm -lX11 | ||||
|  | ||||
|  | ||||
| # Directories | ||||
| SRC_DIRS = mesa glu glut/glx glw glx/x11 | ||||
| SRC_DIRS = glx/x11 mesa glu glut/glx glw | ||||
| DRIVER_DIRS = dri | ||||
| PROGRAM_DIRS =  | ||||
| WINDOW_SYSTEM=dri | ||||
|   | ||||
| @@ -26,3 +26,7 @@ On Alpha platforms at default a sharable images for the libraries are created. | ||||
| To get a static library make it by typing MMS/MACRO=(NOSHARE=1). | ||||
| On VAX platforms only static libraries can be build. | ||||
|  | ||||
|  | ||||
| You may want to compile Mesa to use IEEE floating point arithmetic, instead | ||||
| of VAX floating point by specifying the /float=IEEE flag to the compiler. | ||||
| For more information see https://bugs.freedesktop.org/show_bug.cgi?id=4270 | ||||
|   | ||||
							
								
								
									
										50
									
								
								docs/RELNOTES-6.4
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								docs/RELNOTES-6.4
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
|  | ||||
| 		        Mesa 6.4 Release Notes | ||||
|  | ||||
| 			   October 24, 2005 | ||||
|  | ||||
|  | ||||
|  | ||||
| Introduction | ||||
| ------------ | ||||
|  | ||||
| Mesa uses an even/odd version number scheme like the Linux kernel. | ||||
| Odd numbered versions (such as 6.3) designate new developmental releases. | ||||
| Even numbered versions (such as 6.4) designate stable releases. | ||||
|  | ||||
|  | ||||
| 6.4 is a bug-fix release.  See the VERSIONS file for details. | ||||
|  | ||||
|  | ||||
|  | ||||
| GLUT tarball | ||||
| ------------ | ||||
|  | ||||
| Starting with 6.4, the GLUT library sources are distributed in a separate | ||||
| tarball.  This was done at the request of Linux distro vendors who prefer | ||||
| to use freeglut. | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| Driver			Status | ||||
| ----------------------	---------------------- | ||||
| DRI drivers		varies with the driver | ||||
| XMesa (Xlib)		implements OpenGL 1.5 | ||||
| OSMesa (off-screen)	implements OpenGL 1.5 | ||||
| Windows/Win32		implements OpenGL 1.5 | ||||
| Glide (3dfx Voodoo1/2)  requires updates	 | ||||
| SVGA			requires updates | ||||
| DJGPP			requires updates | ||||
| GGI			requires updates | ||||
| BeOS			requires updates | ||||
| Allegro			requires updates | ||||
| D3D			requires updates | ||||
|  | ||||
| The drivers which require updates mostly need to be updated to work | ||||
| with the new gl_renderbuffer / gl_framebuffer infrastructure introduced | ||||
| in Mesa 6.3. | ||||
|  | ||||
|  | ||||
| ---------------------------------------------------------------------- | ||||
| $Id: RELNOTES-6.4,v 1.1.2.5 2005/10/24 23:12:29 brianp Exp $ | ||||
							
								
								
									
										47
									
								
								docs/RELNOTES-6.4.1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								docs/RELNOTES-6.4.1
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,47 @@ | ||||
|  | ||||
| 		        Mesa 6.4.1 Release Notes | ||||
|  | ||||
|  | ||||
| Introduction | ||||
| ------------ | ||||
|  | ||||
| Mesa uses an even/odd version number scheme like the Linux kernel. | ||||
| Odd numbered versions (such as 6.3) designate new developmental releases. | ||||
| Even numbered versions (such as 6.4) designate stable releases. | ||||
|  | ||||
|  | ||||
| 6.4.1 is a bug-fix release.  See the VERSIONS file for details. | ||||
|  | ||||
|  | ||||
|  | ||||
| GLUT tarball | ||||
| ------------ | ||||
|  | ||||
| Starting with 6.4, the GLUT library sources are distributed in a separate | ||||
| tarball.  This was done at the request of Linux distro vendors who prefer | ||||
| to use freeglut. | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| Driver			Status | ||||
| ----------------------	---------------------- | ||||
| DRI drivers		varies with the driver | ||||
| XMesa (Xlib)		implements OpenGL 1.5 | ||||
| OSMesa (off-screen)	implements OpenGL 1.5 | ||||
| Windows/Win32		implements OpenGL 1.5 | ||||
| Glide (3dfx Voodoo1/2)  requires updates	 | ||||
| SVGA			requires updates | ||||
| DJGPP			requires updates | ||||
| GGI			requires updates | ||||
| BeOS			requires updates | ||||
| Allegro			requires updates | ||||
| D3D			requires updates | ||||
|  | ||||
| The drivers which require updates mostly need to be updated to work | ||||
| with the new gl_renderbuffer / gl_framebuffer infrastructure introduced | ||||
| in Mesa 6.3. | ||||
|  | ||||
|  | ||||
| ---------------------------------------------------------------------- | ||||
| $Id: RELNOTES-6.4.1,v 1.1.2.1 2005/11/30 01:15:15 brianp Exp $ | ||||
							
								
								
									
										47
									
								
								docs/RELNOTES-6.4.2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								docs/RELNOTES-6.4.2
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,47 @@ | ||||
|  | ||||
| 		        Mesa 6.4.2 Release Notes | ||||
|  | ||||
|  | ||||
| Introduction | ||||
| ------------ | ||||
|  | ||||
| Mesa uses an even/odd version number scheme like the Linux kernel. | ||||
| Odd numbered versions (such as 6.3) designate new developmental releases. | ||||
| Even numbered versions (such as 6.4) designate stable releases. | ||||
|  | ||||
|  | ||||
| 6.4.2 is a minor bug-fix release.  See the VERSIONS file for details. | ||||
|  | ||||
|  | ||||
|  | ||||
| GLUT tarball | ||||
| ------------ | ||||
|  | ||||
| Starting with 6.4, the GLUT library sources are distributed in a separate | ||||
| tarball.  This was done at the request of Linux distro vendors who prefer | ||||
| to use freeglut. | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| Driver			Status | ||||
| ----------------------	---------------------- | ||||
| DRI drivers		varies with the driver | ||||
| XMesa (Xlib)		implements OpenGL 1.5 | ||||
| OSMesa (off-screen)	implements OpenGL 1.5 | ||||
| Windows/Win32		implements OpenGL 1.5 | ||||
| Glide (3dfx Voodoo1/2)  requires updates	 | ||||
| SVGA			requires updates | ||||
| DJGPP			requires updates | ||||
| GGI			requires updates | ||||
| BeOS			requires updates | ||||
| Allegro			requires updates | ||||
| D3D			requires updates | ||||
|  | ||||
| The drivers which require updates mostly need to be updated to work | ||||
| with the new gl_renderbuffer / gl_framebuffer infrastructure introduced | ||||
| in Mesa 6.3. | ||||
|  | ||||
|  | ||||
| ---------------------------------------------------------------------- | ||||
| $Id: RELNOTES-6.4.2,v 1.1.2.1 2006/02/01 18:05:08 brianp Exp $ | ||||
| @@ -1372,3 +1372,63 @@ Mesa Version History | ||||
| 	- wglGetProcAddress() didn't handle wgl-functions | ||||
| 	- fixed glxext.h cross-compile issue (Colin Harrison) | ||||
| 	- assorted DRI driver fixes | ||||
|  | ||||
|  | ||||
| 6.4  October 24, 2005 | ||||
|     New: | ||||
| 	- Added a fast XOR line drawing function in Xlib driver | ||||
| 	- Added support for GL_ARB_texture_mirrored_repeat to savage | ||||
| 	  driver (supported only on Savage4 hardware). | ||||
|     Changes: | ||||
| 	- Mesa now packaged in three parts: Library, Demos and GLUT | ||||
|     Bug fixes: | ||||
| 	- GLX_X_RENDERABLE token wasn't accepted by glXChooseFBConfig | ||||
| 	- Some files were present multiple times in the 6.3.2 tarballs | ||||
| 	- r200_vtxtmp_x86.S file was missing from 6.3.2 tarball (bug 4207) | ||||
| 	- glxgears_fbconfig demo didn't work (bug 4237) | ||||
| 	- fixed bug when bilinear sampling 2d textures with borders | ||||
| 	- glXCreatePbuffer() could segfault instead of returning 0 (bug 4235) | ||||
| 	- fixed undefined frexp and rand in X.org libGLcore.a (bug 4242) | ||||
| 	- fixed a few problems with proxy color tables (bug 4270) | ||||
| 	- fixed precision problem in Z clearing (bug 4395) | ||||
| 	- glBitmap, glDraw/CopyPixels mistakenly generated selection hits | ||||
| 	- fixed potential segfault caused by reading pixels outside | ||||
| 	  of renderbuffer bounds | ||||
| 	- glGetTexLevelParameter didn't accept GL_TEXTURE_DEPTH_SIZE_ARB | ||||
| 	- fixed memory corruption bug involving software alpha buffers | ||||
| 	- glReadPixels clipped by window bounds was sometimes broken | ||||
| 	- glDraw/CopyPixels of stencil data ignored the stencil write mask | ||||
| 	- glReadPixels from a texture bound to a framebuffer object didn't work | ||||
| 	- glIsRender/FramebufferEXT weren't totally correct | ||||
| 	- fixed a number of point size attenuation/fade bugs | ||||
| 	- fixed glFogCoord bug 4729 | ||||
| 	- GLX encoding for transpose matrix functions was broken | ||||
| 	- fixed broken fragment program KIL and SWZ instructions | ||||
| 	- fragment programs that wrote result.depth.z didn't work | ||||
|  | ||||
|  | ||||
| 6.4.1  November 30, 2005 | ||||
|     Bug fixes: | ||||
| 	- redefining a vertex program string didn't take effect in TNL module | ||||
| 	- fixed occasional segfault upon vertex/fragment parsing error | ||||
| 	- vertex program LIT instruction didn't handle 0^0=1 correctly | ||||
| 	- fragment program fog option didn't work with glDrawPixels, glBitmap | ||||
| 	- USE_MGL_NAMESPACE didn't work for x86-64 | ||||
| 	- OSMesa demos were missing from previous release tarballs | ||||
| 	- fixed problem with float->ushort conversion in glClear (bug 4992) | ||||
| 	- popping of GL_EYE_PLANE texgen state was broken (bug 4996) | ||||
| 	- popping of GL_SPOT_DIRECTION light state was broken (bug 5005) | ||||
| 	- fixed occasional triangle color interpolation problem on VMS | ||||
| 	- work around invalid free() call (bug 5131) | ||||
| 	- fixed BSD X server compilation problem by including stdint.h | ||||
|  | ||||
|  | ||||
| 6.4.2  February 2, 2006 | ||||
|     New: | ||||
| 	- added OSMesaColorClamp() function/feature | ||||
| 	- added wglGetExtensionStringARB() function | ||||
|     Bug fixes: | ||||
| 	- fixed some problems when building on Windows | ||||
| 	- GLw header files weren't installed by installmesa script (bug 5396) | ||||
| 	- GL/glfbdev.h file was missing from tarballs | ||||
| 	- fixed TNL initialization bug which could lead to crash (bug 5791) | ||||
|   | ||||
| @@ -37,8 +37,6 @@ a:visited { | ||||
|  | ||||
| <b>Download / Install</b> | ||||
| <ul> | ||||
| <li><a href="http://www.sourceforge.net/projects/mesa3d" target="_parent">Stable Release (6.2.1)</a> | ||||
| <li><a href="http://www.sourceforge.net/projects/mesa3d" target="_parent">Devel Release (6.3.2)</a> | ||||
| <li><a href="download.html" target="MainFrame">Downloading/Unpacking</a> | ||||
| <li><a href="install.html" target="MainFrame">Compilation/Installation</a> | ||||
| <li><a href="glu.html" target="MainFrame">SGI's GLU</a> | ||||
| @@ -91,9 +89,13 @@ a:visited { | ||||
| <li><a href="demos.html" target="MainFrame">Demos / other</a> | ||||
| </ul> | ||||
|  | ||||
| <b>Hosted by:</b> | ||||
| <br> | ||||
| <blockquote> | ||||
| <A HREF="http://sourceforge.net" | ||||
| target="_parent"><IMG SRC="http://sourceforge.net/sflogo.php?group_id=3&type=1" | ||||
| WIDTH="88" HEIGHT="31" ALIGN="BOTTOM" ALT="Sourceforge.net" BORDER="0"></A> | ||||
| </blockquote> | ||||
|  | ||||
| </body> | ||||
| </html> | ||||
| @@ -6,101 +6,125 @@ | ||||
|  | ||||
| <BODY> | ||||
|  | ||||
| <H1>Downloading / Unpacking</H1> | ||||
| <H1>Downloading</H1> | ||||
|  | ||||
| <p> | ||||
| Mesa can be downloaded from the | ||||
| <a href="http://www.sourceforge.net/projects/mesa3d" target="_parent"> | ||||
| SourceForge download area</A>. | ||||
| Current stable release: <b>6.4.2</b> | ||||
| </p> | ||||
|  | ||||
| <p> | ||||
| Since version 2.3, Mesa is distributed in two pieces:  main library code | ||||
| and demos.  If you're upgrading from a previous version of Mesa or you're not | ||||
| interested in the demos you can just download the core Mesa archive file. | ||||
| Primary download site: | ||||
| <a href="http://sourceforge.net/project/showfiles.php?group_id=3" | ||||
| target="_parent">SourceForge</a> | ||||
| </p> | ||||
|  | ||||
|  | ||||
| <p> | ||||
| Mesa is distributed in several parts: | ||||
| </p> | ||||
| <ul> | ||||
| <li><b>MesaLib-x.y.z</b> - the main Mesa library source code, drivers | ||||
|     and documentation. | ||||
| </li> | ||||
| <li><b>MesaDemos-x.y.z</b> - OpenGL demonstration and test programs. | ||||
|     Most of the programs require GLUT (either the | ||||
|     <a href="http://www.opengl.org/resources/libraries/glut.html" | ||||
|     target="_parent">original GLUT by Mark Kilgard</a> or | ||||
|     <a href="http://freeglut.sourceforge.net" target="_parent">freeglut</a> or | ||||
|     <a href="http://freeglut.sourceforge.net" target="_parent">OpenGLUT</a>). | ||||
| </li> | ||||
| <li><b>MesaGLUT-x.y.z</b> - Mark Kilgard's GLUT, easily compiled and used | ||||
|     with Mesa.  Plus, other implementation of GLUT for DOS, OS/2, BeOS, etc. | ||||
| </li> | ||||
| </ul> | ||||
|  | ||||
| <p> | ||||
| If you're not interested in running the demos, you'll only need the first | ||||
| package. | ||||
| </p> | ||||
|  | ||||
| <p> | ||||
| Mesa is available in at least three archive formats: | ||||
| The packages are available in .tar.gz, .tar.bz2 and .zip formats. | ||||
| Other organizations might offer additional package formats. | ||||
| </p> | ||||
|  | ||||
| <H1>Unpacking</H1> | ||||
|  | ||||
| <p> | ||||
| All the packages should be in the same directory prior to unpacking. | ||||
| </p> | ||||
|  | ||||
| <ul> | ||||
| <li>To unpack .tar.gz files: | ||||
| <pre> | ||||
| 1. GNU zip/tar | ||||
|  | ||||
| 	Download MesaLib-X.Y.tar.gz and optionally MesaDemos-X.Y.tar.gz | ||||
| 	Unpack with: | ||||
| 		gzcat MesaLib-X.Y.tar.gz | tar xf - | ||||
| 		gzcat MesaDemos-X.Y.tar.gz | tar xf - | ||||
| 	or | ||||
| 		gunzip MesaLib-X.Y.tar.gz ; tar xf MesaLib-X.Y.tar | ||||
| 		gunzip MesaDemos-X.Y.tar.gz ; tar xf MesaLib-X.Y.tar | ||||
| 	or | ||||
| 	tar zxf MesaLib-X.Y.tar.gz | ||||
| 	tar zxf MesaDemos-X.Y.tar.gz | ||||
|  | ||||
| 	If you don't have gzcat try zcat instead. | ||||
|  | ||||
| 2. Unix compressed/tar | ||||
|  | ||||
| 	Download MesaLib-X.Y.tar.Z and optionally MesaDemos-X.Y.tar.Z | ||||
| 	Unpack with: | ||||
| 		zcat MesaLib-X.Y.tar.Z | tar xf - | ||||
| 		zcat MesaDemos-X.Y.tar.Z | tar xf - | ||||
|  | ||||
| 3. ZIP format | ||||
|  | ||||
| 	Download MesaLib-X.Y.zip and optionally MesaDemos-X.Y.zip | ||||
| 	Unpack with: | ||||
| 	tar zxf MesaGLUT-X.Y.tar.gz | ||||
| </pre> | ||||
| or | ||||
| <pre> | ||||
| 	gzcat MesaLib-X.Y.tar.gz | tar xf - | ||||
| 	gzcat MesaDemos-X.Y.tar.gz | tar xf - | ||||
| 	gzcat MesaGLUT-X.Y.tar.gz | tar xf - | ||||
| </pre> | ||||
| or | ||||
| <pre> | ||||
| 	gunzip MesaLib-X.Y.tar.gz ; tar xf MesaLib-X.Y.tar | ||||
| 	gunzip MesaDemos-X.Y.tar.gz ; tar xf MesaDemos-X.Y.tar | ||||
| 	gunzip MesaGLUT-X.Y.tar.gz ; tar xf MesaGLUT-X.Y.tar | ||||
| </pre> | ||||
| <li>To unpack .tar.bz2 files: | ||||
| <pre> | ||||
| 	bunzip2 -c MesaLib-X.Y.tar.gz | tar xf - | ||||
| 	bunzip2 -c MesaDemos-X.Y.tar.gz | tar xf - | ||||
| 	bunzip2 -c MesaGLUT-X.Y.tar.gz | tar xf - | ||||
| </pre> | ||||
| <li>To unpack .zip files: | ||||
| <pre> | ||||
| 	unzip MesaLib-X.Y.zip | ||||
| 	unzip MesaDemos-X.Y.zip | ||||
| 	unzip MesaGLUT-X.Y.zip | ||||
| </pre> | ||||
| </ul> | ||||
|  | ||||
|  | ||||
| <h1>Contents</h1> | ||||
|  | ||||
| <p> | ||||
| After unpacking you'll have these directories (and more): | ||||
| After unpacking you'll have these directories: | ||||
| </p> | ||||
| <pre> | ||||
| Makefile.X11	- top-level Makefile for X11-based systems | ||||
| Make-config	- system configurations used by the Makefile.X11 | ||||
| Makefile	- top-level Makefile for most systems | ||||
| configs/	- makefile parameter files for various systems | ||||
| include/	- GL header (include) files | ||||
| bin/		- shell scripts for making shared libraries, etc | ||||
| lib/		- final client libraries, created during compilation | ||||
| docs/		- documentation | ||||
| src/		- source code for libraries | ||||
| src/mesa	- sources for the main Mesa library and device drivers | ||||
| src/glu		- libGLU source code | ||||
| src/glw		- Xt/Motif/OpenGL widget code | ||||
| </pre> | ||||
|  | ||||
| If you downloaded and unpacked the MesaDemos.X.Y package: | ||||
|  | ||||
| and if you downloaded and unpacked the MesaDemos.X.Y archive: | ||||
|  | ||||
| src/glut	- GLUT source code | ||||
| progs/		- OpenGL programs | ||||
| <pre> | ||||
| progs/demos	- original Mesa demos | ||||
| progs/xdemos	- GLX OpenGL/Mesa demos | ||||
| progs/redbook	- examples from the OpenGL Programming Guide | ||||
| progs/samples	- examples from SGI | ||||
| progs/images/	- image files | ||||
| </pre> | ||||
|  | ||||
| If you downloaded and unpacked the MesaGLUT.X.Y package: | ||||
| <pre> | ||||
| src/glut	- GLUT library source code | ||||
| </pre> | ||||
|  | ||||
| <p> | ||||
| Proceed to <a href="install.html">compilation and installation | ||||
| Proceed to the <a href="install.html">compilation and installation | ||||
| instructions</a>. | ||||
| </p> | ||||
|  | ||||
| <H1>GLUT</H1> | ||||
|  | ||||
| <p> | ||||
| Mesa 2.5 and later includes Mark Kilgard's GLUT library (GL Utility Toolkit). | ||||
| GLUT is built automatically on systems which support it. | ||||
| </p> | ||||
| <p> | ||||
| The GLUT tests, demos, examples, etc are not included, just the main library. | ||||
| To obtain the latest complete release of GLUT please visit the | ||||
| <a href="http://www.opengl.org/resources/libraries/glut.html" | ||||
| target ="_parent">GLUT page</a> on www.opengl.org. | ||||
| </p> | ||||
|  | ||||
|  | ||||
| </BODY> | ||||
| </HTML> | ||||
|   | ||||
| @@ -24,15 +24,17 @@ generate exceptions. | ||||
|  | ||||
| <p> | ||||
| The following environment variables are only applicable to the Xlib/X11 | ||||
| software driver: | ||||
| software driver. | ||||
| See the <A HREF="README.X11">README.X11</A> file for details. | ||||
| </p> | ||||
| <ul> | ||||
| <li>MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode (X only) | ||||
| <li>MESA_CI_VISUAL - specifies the X visual and depth for CI mode (X only) | ||||
| <li>MESA_BACK_BUFFER - specifies how to implement the back color buffer (X only) | ||||
| <li>MESA_GAMMA - gamma correction coefficients (X only) | ||||
| <li>MESA_XSYNC - enable synchronous X behavior (for X debugging only) | ||||
| <li>MESA_GLX_FORCE_CI - if set, force GLX to treak 8bpp visuals as CI visuals | ||||
| <li>MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode | ||||
| <li>MESA_CI_VISUAL - specifies the X visual and depth for CI mode | ||||
| <li>MESA_BACK_BUFFER - specifies how to implement the back color buffer, | ||||
|     either "pixmap" or "ximage" | ||||
| <li>MESA_GAMMA - gamma correction coefficients for red, green, blue channels | ||||
| <li>MESA_XSYNC - enable synchronous X behavior (for debugging only) | ||||
| <li>MESA_GLX_FORCE_CI - if set, force GLX to treat 8bpp visuals as CI visuals | ||||
| <li>MESA_GLX_FX - set to either "fullscreen" for full-screen rendering, | ||||
|   "window" to render into a window, or "disable" to disable the Glide driver. | ||||
| <li>MESA_GLX_FORCE_ALPHA - if set, forces RGB windows to have an alpha channel. | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| <center> | ||||
| <h1>Mesa Frequently Asked Questions</h1> | ||||
| Last updated: 17 November 2004 | ||||
| Last updated: 21 October 2004 | ||||
| </center> | ||||
|  | ||||
| <br> | ||||
| @@ -39,14 +39,14 @@ See the </a><a href="http://www.opengl.org/">OpenGL website</a> for more | ||||
| information. | ||||
| </p> | ||||
| <p> | ||||
| Mesa 5.x supports the OpenGL 1.4 specification. | ||||
| Mesa 6.x supports the OpenGL 1.5 specification. | ||||
| </p> | ||||
|  | ||||
|  | ||||
| <h2>1.2 Does Mesa support/use graphics hardware?</h2> | ||||
| <p> | ||||
| Yes.  Specifically, Mesa serves as the OpenGL core for the open-source | ||||
| XFree86/DRI OpenGL drivers.  See the <a href="http://dri.sf.net/">DRI | ||||
| Yes.  Specifically, Mesa serves as the OpenGL core for the open-source DRI | ||||
| drivers for XFree86/X.org.  See the <a href="http://dri.sf.net/">DRI | ||||
| website</a> for more information. | ||||
| </p> | ||||
| <p> | ||||
| @@ -62,7 +62,8 @@ operating systems today. | ||||
| Still, Mesa serves at least these purposes: | ||||
| </p> | ||||
| <ul> | ||||
| <li>Mesa is used as the core of the open-source XFree86/DRI hardware drivers. | ||||
| <li>Mesa is used as the core of the open-source XFree86/X.org DRI | ||||
|     hardware drivers. | ||||
| </li> | ||||
| <li>Mesa is quite portable and allows OpenGL to be used on systems | ||||
|     that have no other OpenGL solution. | ||||
| @@ -86,8 +87,8 @@ Still, Mesa serves at least these purposes: | ||||
| <h2>1.4 What's the difference between"Stand-Alone" Mesa and the DRI drivers?</h2> | ||||
| <p> | ||||
| <em>Stand-alone Mesa</em> is the original incarnation of Mesa. | ||||
| On systems running the X Window System, it does all its rendering through | ||||
| the Xlib API. | ||||
| On systems running the X Window System it does all its rendering through | ||||
| the Xlib API: | ||||
| <ul> | ||||
| <li>The GLX API is supported, but it's really just an emulation of the | ||||
|      real thing. | ||||
| @@ -116,21 +117,10 @@ within the DRI (Direct Rendering Infrastructure): | ||||
|  | ||||
| <h2>1.5 How do I upgrade my DRI installation to use a new Mesa release?</h2> | ||||
| <p> | ||||
| You don't!  A copy of the Mesa source code lives inside the XFree86/DRI source | ||||
| tree and gets compiled into the individual DRI driver modules. | ||||
| If you try to install Mesa over an XFree86/DRI installation, you'll lose | ||||
| hardware rendering (because stand-alone Mesa's libGL.so is different than | ||||
| the XFree86 libGL.so). | ||||
| </p> | ||||
| <p> | ||||
| The DRI developers will incorporate the latest release of Mesa into the | ||||
| DRI drivers when the time is right. | ||||
| </p> | ||||
| <p> | ||||
| To upgrade, either look for a new release of <a href="http://www.xfree86.org" | ||||
| target="_parent">XFree86</a> or visit the | ||||
| <a href="http://dri.sf.net" target="_parent">DRI website</a> to see | ||||
| if there's newer drivers. | ||||
| This wasn't easy in the past. | ||||
| Now, the DRI drivers are included in the Mesa tree and can be compiled | ||||
| separately from the X server. | ||||
| Just follow the Mesa <a href="install.html">compilation instructions</a>. | ||||
| </p> | ||||
|  | ||||
|  | ||||
| @@ -201,7 +191,7 @@ Mesa no longer supports GNU autoconf/automake.  Why? | ||||
| </ul> | ||||
|  | ||||
| <p> | ||||
| Now, Mesa again uses a conventional Makefile system (as it did originally). | ||||
| Now Mesa again uses a conventional Makefile system (as it did originally). | ||||
| Basically, each Makefile in the tree includes one of the configuration | ||||
| files from the config/ directory. | ||||
| The config files specify all the variables for a variety of popular systems. | ||||
| @@ -219,9 +209,9 @@ Mesa's not the solution. | ||||
|  | ||||
| <h2><a name="part2">2.4 Where is the GLUT library?</a></h2> | ||||
| <p> | ||||
| <a name="part2">GLUT (OpenGL Utility Toolkit) is in the separate MesaDemos-x.y.z.tar.gz file. | ||||
| If you don't already have GLUT installed, you should grab the MesaDemos | ||||
| package and unpack it before compiling Mesa. | ||||
| <a name="part2">GLUT (OpenGL Utility Toolkit) is in the separate MesaGLUT-x.y.z.tar.gz file. | ||||
| If you don't already have GLUT installed, you should grab the MesaGLUT | ||||
| package and compile it with the rest of Mesa. | ||||
| </a></p> | ||||
|  | ||||
|  | ||||
| @@ -250,7 +240,7 @@ Mesa version number. | ||||
| version number. | ||||
| </li></ul> | ||||
| <p> | ||||
| After installing XFree86 and the DRI drivers, some of these files | ||||
| After installing XFree86/X.org and the DRI drivers, some of these files | ||||
| may be symlinks into the /usr/X11R6/ tree. | ||||
| </p> | ||||
| <p> | ||||
|   | ||||
| @@ -32,7 +32,7 @@ | ||||
| 	- VRML viewer | ||||
| 	</li><li><a href="http://aig.cs.man.ac.uk/systems/Maverik/" target="_parent">Maverik</a> | ||||
| 	- VR graphics and interaction system | ||||
| 	</li><li><a href="http://www.swissquake.ch/chumb.alum-soft" target="_parent">MD2 Viewer</a> | ||||
| 	</li><li><a href="http://www.swissquake.ch/chumbalum-soft/md2v" target="_parent">MD2 Viewer</a> | ||||
| 	- View .MD2 files | ||||
| 	</li><li><a href="http://www.megacads.dlr.de/" target="_parent">MegaCads</a> | ||||
| 	- Multiblock-Elliptic-Grid-Generation-And-CAD-System | ||||
|   | ||||
							
								
								
									
										111
									
								
								docs/news.html
									
									
									
									
									
								
							
							
						
						
									
										111
									
								
								docs/news.html
									
									
									
									
									
								
							| @@ -11,6 +11,115 @@ | ||||
| <H1>News</H1> | ||||
|  | ||||
|  | ||||
| <h2>February 2, 2006</h2> | ||||
| <p> | ||||
| Mesa 6.4.2 has been released.  This is primarily a bug-fix release. | ||||
| </p> | ||||
| <pre> | ||||
|     New items: | ||||
| 	- added OSMesaColorClamp() function/feature | ||||
| 	- added wglGetExtensionStringARB() function | ||||
|     Bug fixes: | ||||
| 	- fixed some problems when building on Windows | ||||
| 	- GLw header files weren't installed by installmesa script (bug 5396) | ||||
| 	- GL/glfbdev.h file was missing from tarballs | ||||
| </pre> | ||||
| <p> | ||||
| The MD5 checksums are: | ||||
| </p> | ||||
| <pre> | ||||
| TBD | ||||
| </pre> | ||||
|  | ||||
|  | ||||
| <h2>November 29, 2005</h2> | ||||
| <p> | ||||
| Mesa 6.4.1 has been released.  This is a stable, bug-fix release. | ||||
| </p> | ||||
| <pre> | ||||
|     Bug fixes: | ||||
| 	- redefining a vertex program string didn't take effect in TNL module | ||||
| 	- fixed occasional segfault upon vertex/fragment parsing error | ||||
| 	- vertex program LIT instruction didn't handle 0^0=1 correctly | ||||
| 	- fragment program fog option didn't work with glDrawPixels, glBitmap | ||||
| 	- USE_MGL_NAMESPACE didn't work for x86-64 | ||||
| 	- OSMesa demos were missing from previous release tarballs | ||||
| 	- fixed problem with float->ushort conversion in glClear (bug 4992) | ||||
| 	- popping of GL_EYE_PLANE texgen state was broken (bug 4996) | ||||
| 	- popping of GL_SPOT_DIRECTION light state was broken (bug 5005) | ||||
| 	- fixed occasional triangle color interpolation problem on VMS | ||||
| 	- work around invalid free() call (bug 5131) | ||||
| 	- fixed BSD X server compilation problem by including stdint.h | ||||
| </pre> | ||||
| <p> | ||||
| The MD5 checksums are: | ||||
| </p> | ||||
| <pre> | ||||
| 698ceb574cf882b0226761f5913c0da9  MesaLib-6.4.1.tar.gz | ||||
| ea148c828ec6f645526451db1b8556f1  MesaLib-6.4.1.tar.bz2 | ||||
| 42e93279468975ed2bf3111b8721e5d9  MesaLib-6.4.1.zip | ||||
| e3b0d50807fd2bdcd1a95aaddd786f13  MesaDemos-6.4.1.tar.gz | ||||
| 99df1fdcb98d391666b476ca6f1dda8a  MesaDemos-6.4.1.tar.bz2 | ||||
| b999d2c6d92fb4b7740a3dbd889348e3  MesaDemos-6.4.1.zip | ||||
| eadfe01fe5ddfb1eb8227dd567b31635  MesaGLUT-6.4.1.tar.gz | ||||
| bd003bb4f981a4f91dee4c38644d4f3f  MesaGLUT-6.4.1.tar.bz2 | ||||
| 71c401c037088bf688a88afdaeb3420f  MesaGLUT-6.4.1.zip | ||||
| </pre> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <h2>October 24, 2005</h2> | ||||
| <p> | ||||
| Mesa 6.4 has been released.  This is a stable, bug-fix release. | ||||
| </p> | ||||
| <pre> | ||||
|     New: | ||||
| 	- Added a fast XOR line drawing function in Xlib driver | ||||
| 	- Added support for GL_ARB_texture_mirrored_repeat to savage | ||||
| 	  driver (supported only on Savage4 hardware). | ||||
|     Changes: | ||||
| 	- Mesa now packaged in three parts: Library, Demos and GLUT | ||||
|     Bug fixes: | ||||
| 	- GLX_X_RENDERABLE token wasn't accepted by glXChooseFBConfig | ||||
| 	- Some files were present multiple times in the 6.3.2 tarballs | ||||
| 	- r200_vtxtmp_x86.S file was missing from 6.3.2 tarball (bug 4207) | ||||
| 	- glxgears_fbconfig demo didn't work (bug 4237) | ||||
| 	- fixed bug when bilinear sampling 2d textures with borders | ||||
| 	- glXCreatePbuffer() could segfault instead of returning 0 (bug 4235) | ||||
| 	- fixed undefined frexp and rand in X.org libGLcore.a (bug 4242) | ||||
| 	- fixed a few problems with proxy color tables (bug 4270) | ||||
| 	- fixed precision problem in Z clearing (bug 4395) | ||||
| 	- glBitmap, glDraw/CopyPixels mistakenly generated selection hits | ||||
| 	- fixed potential segfault caused by reading pixels outside | ||||
| 	  of renderbuffer bounds | ||||
| 	- glGetTexLevelParameter didn't accept GL_TEXTURE_DEPTH_SIZE_ARB | ||||
| 	- fixed memory corruption bug involving software alpha buffers | ||||
| 	- glReadPixels clipped by window bounds was sometimes broken | ||||
| 	- glDraw/CopyPixels of stencil data ignored the stencil write mask | ||||
| 	- glReadPixels from a texture bound to a framebuffer object didn't work | ||||
| 	- glIsRender/FramebufferEXT weren't totally correct | ||||
| 	- fixed a number of point size attenuation/fade bugs | ||||
| 	- fixed glFogCoord bug 4729 | ||||
| 	- GLX encoding for transpose matrix functions was broken | ||||
| 	- fixed broken fragment program KIL and SWZ instructions | ||||
| </pre> | ||||
| <p> | ||||
| The MD5 checksums are: | ||||
| </p> | ||||
| <pre> | ||||
| 1cce0c1eb4fd15e9dfe837a1ce0c9812  MesaLib-6.4.tar.gz | ||||
| 85a84e47a3f718f752f306b9e0954ef6  MesaLib-6.4.tar.bz2 | ||||
| b976fea4f3ee06354c53f91b6e3f2ffc  MesaLib-6.4.zip | ||||
| d8734f2c69bcf7ef9f5ae454a85743ba  MesaDemos-6.4.tar.gz | ||||
| 1a8c4d4fc699233f5fdb902b8753099e  MesaDemos-6.4.tar.bz2 | ||||
| 607ab7c7a7de0cc5febbdde2bfa03098  MesaDemos-6.4.zip | ||||
| 3260156f66174322a092be0767962d34  MesaGLUT-6.4.tar.gz | ||||
| 0465d053f83775f44a12dec4050dfd78  MesaGLUT-6.4.tar.bz2 | ||||
| 02abfcdcdf72ba938ae00f6e3b70fbe0  MesaGLUT-6.4.zip | ||||
| </pre> | ||||
|  | ||||
|  | ||||
| <h2>August 19, 2005</h2> | ||||
| <p> | ||||
| Mesa 6.3.2 has been released. | ||||
| @@ -1051,6 +1160,6 @@ source code</a>.</p> | ||||
|  | ||||
|  | ||||
| <hr> | ||||
| $Id: news.html,v 3.24 2005/08/19 23:42:29 brianp Exp $ | ||||
| $Id: news.html,v 3.24.2.6 2006/02/01 18:08:25 brianp Exp $ | ||||
| </body> | ||||
| </html> | ||||
|   | ||||
| @@ -13,6 +13,9 @@ The release notes summarize what's new or changed in each Mesa release. | ||||
| </p> | ||||
|  | ||||
| <UL> | ||||
| <LI><A HREF="RELNOTES-6.4.2">RELNOTES-6.4.2</A> | ||||
| <LI><A HREF="RELNOTES-6.4.1">RELNOTES-6.4.1</A> | ||||
| <LI><A HREF="RELNOTES-6.4">RELNOTES-6.4</A> | ||||
| <LI><A HREF="RELNOTES-6.3.2">RELNOTES-6.3.2</A> | ||||
| <LI><A HREF="RELNOTES-6.3">RELNOTES-6.3</A> | ||||
| <LI><A HREF="RELNOTES-6.2.1">RELNOTES-6.2.1</A> | ||||
|   | ||||
| @@ -39,7 +39,6 @@ | ||||
| #define DRI_INTERFACE_H | ||||
|  | ||||
| #include <GL/internal/glcore.h> | ||||
| #include <xf86drm.h> | ||||
| #include <drm.h> | ||||
|  | ||||
| /** | ||||
|   | ||||
| @@ -111,6 +111,15 @@ WGLAPI int   GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDE | ||||
| WGLAPI int   GLAPIENTRY GetPixelFormat(HDC); | ||||
| WGLAPI int   GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *); | ||||
|  | ||||
|  | ||||
| #ifndef WGL_ARB_extensions_string | ||||
| #define WGL_ARB_extensions_string 1 | ||||
|  | ||||
| WGLAPI const char * GLAPIENTRY wglGetExtensionsStringARB(HDC hdc); | ||||
|  | ||||
| #endif /* WGL_ARB_extensions_string */ | ||||
|  | ||||
|  | ||||
| #ifdef _MSC_VER | ||||
| #  pragma warning( pop ) | ||||
| #endif | ||||
|   | ||||
| @@ -61,8 +61,8 @@ extern "C" { | ||||
|  | ||||
|  | ||||
| #define OSMESA_MAJOR_VERSION 6 | ||||
| #define OSMESA_MINOR_VERSION 3 | ||||
| #define OSMESA_PATCH_VERSION 0 | ||||
| #define OSMESA_MINOR_VERSION 4 | ||||
| #define OSMESA_PATCH_VERSION 2 | ||||
|  | ||||
|  | ||||
|  | ||||
| @@ -267,6 +267,15 @@ GLAPI OSMESAproc GLAPIENTRY | ||||
| OSMesaGetProcAddress( const char *funcName ); | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Enable/disable color clamping, off by default. | ||||
|  * New in Mesa 6.4.2 | ||||
|  */ | ||||
| GLAPI void GLAPIENTRY | ||||
| OSMesaColorClamp(GLboolean enable); | ||||
|  | ||||
|  | ||||
| #if defined(__BEOS__) || defined(__QUICKDRAW__) | ||||
| #pragma export off | ||||
| #endif | ||||
|   | ||||
| @@ -78,7 +78,7 @@ typedef struct wmesa_context *WMesaContext; | ||||
|  * appropriate colormap. | ||||
|  * | ||||
|  * Input: | ||||
|  *         hWnd - Window handle | ||||
|  *         hDC - Windows device or memory context | ||||
|  *         Pal  - Palette to use | ||||
|  *         rgb_flag - GL_TRUE = RGB mode, | ||||
|  *                    GL_FALSE = color index mode | ||||
| @@ -91,7 +91,7 @@ typedef struct wmesa_context *WMesaContext; | ||||
|  * | ||||
|  * Return:  a WMesa_context or NULL if error. | ||||
|  */ | ||||
| extern WMesaContext WMesaCreateContext(HWND hWnd,HPALETTE* pPal, | ||||
| extern WMesaContext WMesaCreateContext(HDC hDC,HPALETTE* pPal, | ||||
|                                        GLboolean rgb_flag, | ||||
|                                        GLboolean db_flag, | ||||
|                                        GLboolean alpha_flag); | ||||
|   | ||||
| @@ -71,7 +71,9 @@ static void Display( void ) | ||||
|    glDisable(GL_SCISSOR_TEST); | ||||
|    glDisable(GL_FOG); | ||||
|  | ||||
|    if (!DrawFront) | ||||
|    if (DrawFront) | ||||
|       glFinish(); | ||||
|    else | ||||
|       glutSwapBuffers(); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -234,7 +234,9 @@ idle(void) | ||||
|   dt = t - t0; | ||||
|   t0 = t; | ||||
|  | ||||
|   angle += 70.0 * dt;  /* 90 degrees per second */ | ||||
|   angle += 70.0 * dt;  /* 70 degrees per second */ | ||||
|   angle = fmod(angle, 360.0); /* prevents eventual overflow */ | ||||
|  | ||||
|   glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -186,11 +186,12 @@ Display( void ) | ||||
|    else { | ||||
|       /* clear the temporary image to white (helpful for debugging */ | ||||
|       memset(TempImage, 255, ImgWidth * ImgHeight * 4); | ||||
| #if 0 | ||||
|       /* you might use this when debugging */ | ||||
| #if 1 | ||||
|       glReadPixels(APosX, APosY, ImgWidth, ImgHeight, | ||||
|                    ReadFormat, ReadType, TempImage); | ||||
|       (void) ComplexReadPixels; | ||||
| #else | ||||
|       /* you might use this when debugging */ | ||||
|       ComplexReadPixels(APosX, APosY, ImgWidth, ImgHeight, | ||||
|                         ReadFormat, ReadType, TempImage); | ||||
| #endif | ||||
|   | ||||
| @@ -71,7 +71,9 @@ Display( void ) | ||||
| static void | ||||
| Reshape( int width, int height ) | ||||
| { | ||||
| #if 0 | ||||
|    float ar = (float) width / (float) height; | ||||
| #endif | ||||
|    glViewport( 0, 0, width, height ); | ||||
|    glMatrixMode( GL_PROJECTION ); | ||||
|    glLoadIdentity(); | ||||
| @@ -117,14 +119,14 @@ Init( void ) | ||||
|  | ||||
|    glGenFramebuffersEXT(1, &MyFB); | ||||
|    assert(MyFB); | ||||
|    assert(glIsFramebufferEXT(MyFB)); | ||||
|    assert(!glIsFramebufferEXT(MyFB)); | ||||
|    glDeleteFramebuffersEXT(1, &MyFB); | ||||
|    assert(!glIsFramebufferEXT(MyFB)); | ||||
|    /* Note, continue to use MyFB below */ | ||||
|  | ||||
|    glGenRenderbuffersEXT(1, &rb); | ||||
|    assert(rb); | ||||
|    assert(glIsRenderbufferEXT(rb)); | ||||
|    assert(!glIsRenderbufferEXT(rb)); | ||||
|    glDeleteRenderbuffersEXT(1, &rb); | ||||
|    assert(!glIsRenderbufferEXT(rb)); | ||||
|    rb = 42; /* an arbitrary ID */ | ||||
| @@ -156,6 +158,12 @@ Init( void ) | ||||
|       glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, | ||||
|                                       GL_RENDERBUFFER_ALPHA_SIZE_EXT, &a); | ||||
|       printf("renderbuffer RGBA sizes = %d %d %d %d\n", r, g, b, a); | ||||
|  | ||||
|       glGetIntegerv(GL_RED_BITS, &r); | ||||
|       glGetIntegerv(GL_GREEN_BITS, &g); | ||||
|       glGetIntegerv(GL_BLUE_BITS, &b); | ||||
|       glGetIntegerv(GL_ALPHA_BITS, &a); | ||||
|       printf("Visual RGBA sizes = %d %d %d %d\n", r, g, b, a); | ||||
|    } | ||||
|  | ||||
|    CheckError(__LINE__); | ||||
|   | ||||
| @@ -56,7 +56,8 @@ RenderTexture(void) | ||||
|    glLoadIdentity(); | ||||
|    glTranslatef(0.0, 0.0, -15.0); | ||||
|  | ||||
|    /* draw to texture */ | ||||
|    /* draw to texture image */ | ||||
|    glBindTexture(GL_TEXTURE_2D, 0); | ||||
|    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); | ||||
|    glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, | ||||
|                              GL_TEXTURE_2D, TexObj, level); | ||||
| @@ -142,6 +143,7 @@ Display(void) | ||||
|    glPushMatrix(); | ||||
|    glRotatef(Rot, 0, 1, 0); | ||||
|    glEnable(GL_TEXTURE_2D); | ||||
|    glBindTexture(GL_TEXTURE_2D, TexObj); | ||||
|    glBegin(GL_POLYGON); | ||||
|    glColor3f(0.25, 0.25, 0.25); | ||||
|    glTexCoord2f(0, 0); | ||||
| @@ -203,10 +205,10 @@ Init(void) | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* make framebuffer */ | ||||
|    /* gen framebuffer id, delete it, do some assertions, just for testing */ | ||||
|    glGenFramebuffersEXT(1, &MyFB); | ||||
|    assert(MyFB); | ||||
|    assert(glIsFramebufferEXT(MyFB)); | ||||
|    assert(!glIsFramebufferEXT(MyFB)); | ||||
|    glDeleteFramebuffersEXT(1, &MyFB); | ||||
|    assert(!glIsFramebufferEXT(MyFB)); | ||||
|    /* Note, continue to use MyFB below */ | ||||
| @@ -219,8 +221,9 @@ Init(void) | ||||
|    /* make depth renderbuffer */ | ||||
|    glGenRenderbuffersEXT(1, &DepthRB); | ||||
|    assert(DepthRB); | ||||
|    assert(glIsRenderbufferEXT(DepthRB)); | ||||
|    assert(!glIsRenderbufferEXT(DepthRB)); | ||||
|    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB); | ||||
|    assert(glIsRenderbufferEXT(DepthRB)); | ||||
|    glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, | ||||
|                             TexWidth, TexHeight); | ||||
|    glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, | ||||
| @@ -231,8 +234,9 @@ Init(void) | ||||
|    /* make stencil renderbuffer */ | ||||
|    glGenRenderbuffersEXT(1, &StencilRB); | ||||
|    assert(StencilRB); | ||||
|    assert(glIsRenderbufferEXT(StencilRB)); | ||||
|    assert(!glIsRenderbufferEXT(StencilRB)); | ||||
|    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, StencilRB); | ||||
|    assert(glIsRenderbufferEXT(StencilRB)); | ||||
|    glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX, | ||||
|                             TexWidth, TexHeight); | ||||
|    glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, | ||||
|   | ||||
| @@ -467,7 +467,7 @@ make_window( Display *dpy, const char *name, | ||||
|                               None, (char **)NULL, 0, &sizehints); | ||||
|    } | ||||
|  | ||||
|    ctx = (*create_new_context)(dpy, fbconfig[0], GLX_RGBA_BIT, NULL, GL_TRUE); | ||||
|    ctx = (*create_new_context)(dpy, fbconfig[0], GLX_RGBA_TYPE, NULL, GL_TRUE); | ||||
|    if (!ctx) { | ||||
|       printf("Error: glXCreateNewContext failed\n"); | ||||
|       exit(1); | ||||
|   | ||||
| @@ -262,6 +262,7 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits) | ||||
|    ctx = glXCreateContext( dpy, visinfo, NULL, allowDirect ); | ||||
|    if (!ctx) { | ||||
|       fprintf(stderr, "Error: glXCreateContext failed\n"); | ||||
|       XFree(visinfo); | ||||
|       XDestroyWindow(dpy, win); | ||||
|       return; | ||||
|    } | ||||
| @@ -336,6 +337,7 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits) | ||||
|    } | ||||
|  | ||||
|    glXDestroyContext(dpy, ctx); | ||||
|    XFree(visinfo); | ||||
|    XDestroyWindow(dpy, win); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -57,7 +57,9 @@ | ||||
|  | ||||
| static void normalize(float vec[3]); | ||||
| static void crossProduct(float x[3], float y[3], float ret[3]); | ||||
| #if 0 // UNUSED | ||||
| static void bezierCurveEvalfast(float u0, float u1, int order, float *ctlpoints, int stride,  int dimension, float u, float retpoint[]); | ||||
| #endif | ||||
|  | ||||
| static float binomialCoefficients[8][8] = { | ||||
|   {1,0,0,0,0,0,0,0}, | ||||
| @@ -91,7 +93,7 @@ void bezierCurveEval(float u0, float u1, int order, float *ctlpoints, int stride | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| #if 0 // UNUSED | ||||
| /*order = degree +1 >=1. | ||||
|  */ | ||||
| void bezierCurveEvalfast(float u0, float u1, int order, float *ctlpoints, int stride,  int dimension, float u, float retpoint[]) | ||||
| @@ -115,7 +117,7 @@ void bezierCurveEvalfast(float u0, float u1, int order, float *ctlpoints, int st | ||||
|   for(j=0; j<dimension; j++) | ||||
|     retpoint[j] = buf[order-1][0][j]; | ||||
| } | ||||
|  | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*order = degree +1 >=1. | ||||
|   | ||||
| @@ -31,10 +31,10 @@ | ||||
| ** published by SGI, but has not been independently verified as being | ||||
| ** compliant with the OpenGL(R) version 1.2.1 Specification. | ||||
| ** | ||||
| ** $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $ | ||||
| ** $Date: 2005/10/28 13:09:08 $ $Revision: 1.1.30.1 $ | ||||
| */ | ||||
| /* | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/dataTransform.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $ | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/dataTransform.cc,v 1.1.30.1 2005/10/28 13:09:08 brianp Exp $ | ||||
| */ | ||||
|  | ||||
| #include <stdlib.h> | ||||
| @@ -47,6 +47,7 @@ | ||||
|  | ||||
| extern directedLine* arcLoopToDLineLoop(Arc_ptr loop); | ||||
|  | ||||
| #if 0 // UNUSED | ||||
| static directedLine* copy_loop(Arc_ptr loop, Real2* vertArray, int& index, directedLine dline_buf[], sampledLine sline_buf[], int& index_dline) | ||||
| { | ||||
|   directedLine *ret; | ||||
| @@ -95,7 +96,9 @@ static directedLine* copy_loop(Arc_ptr loop, Real2* vertArray, int& index, direc | ||||
|     } | ||||
|   return ret; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #if 0 // UNUSED | ||||
| static int num_edges(Bin& bin) | ||||
| { | ||||
|   int sum=0; | ||||
| @@ -103,6 +106,8 @@ static int num_edges(Bin& bin) | ||||
|     sum += jarc->pwlArc->npts-1; | ||||
|   return sum; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| /* | ||||
| directedLine* bin_to_DLineLoops(Bin& bin) | ||||
| { | ||||
|   | ||||
| @@ -35,8 +35,8 @@ | ||||
| /* | ||||
|  * intersect.c++ | ||||
|  * | ||||
|  * $Date: 2004/05/12 15:29:36 $ $Revision: 1.2 $ | ||||
|  * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/intersect.cc,v 1.2 2004/05/12 15:29:36 brianp Exp $ | ||||
|  * $Date: 2005/10/28 13:09:08 $ $Revision: 1.2.8.1 $ | ||||
|  * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/intersect.cc,v 1.2.8.1 2005/10/28 13:09:08 brianp Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "glimports.h" | ||||
| @@ -53,7 +53,9 @@ | ||||
| enum i_result { INTERSECT_VERTEX, INTERSECT_EDGE }; | ||||
|  | ||||
| /* local functions */ | ||||
| #ifndef NDEBUG  // for asserts only | ||||
| static int		arc_classify( Arc_ptr, int, REAL ); | ||||
| #endif | ||||
| static enum i_result	pwlarc_intersect( PwlArc *, int, REAL, int, int[3] ); | ||||
|  | ||||
|  | ||||
| @@ -400,6 +402,7 @@ pwlarc_intersect( | ||||
|  *---------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
| #ifndef NDEBUG  // for asserts only | ||||
| static int | ||||
| arc_classify( Arc_ptr jarc, int param, REAL value ) | ||||
| { | ||||
| @@ -438,6 +441,7 @@ arc_classify( Arc_ptr jarc, int param, REAL value ) | ||||
| 	} | ||||
|     } | ||||
| } | ||||
| #endif | ||||
|  | ||||
| void | ||||
| Subdivider::classify_tailonleft_s( Bin& bin, Bin& in, Bin& out, REAL val ) | ||||
|   | ||||
| @@ -35,8 +35,8 @@ | ||||
| /* | ||||
|  * maplist.c++ | ||||
|  * | ||||
|  * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ | ||||
|  * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/maplist.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ | ||||
|  * $Date: 2005/10/28 13:09:08 $ $Revision: 1.1.30.1 $ | ||||
|  * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/maplist.cc,v 1.1.30.1 2005/10/28 13:09:08 brianp Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "glimports.h" | ||||
| @@ -73,8 +73,10 @@ Maplist::add( long type, int israt, int ncoords ) | ||||
| void  | ||||
| Maplist::define( long type, int israt, int ncoords ) | ||||
| { | ||||
| #ifndef NDEBUG // to avoid warning | ||||
|     Mapdesc *m = locate( type ); | ||||
|     assert( m == NULL || ( m->isrational == israt && m->ncoords == ncoords ) ); | ||||
| #endif | ||||
|     add( type, israt, ncoords ); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -31,10 +31,10 @@ | ||||
| ** published by SGI, but has not been independently verified as being | ||||
| ** compliant with the OpenGL(R) version 1.2.1 Specification. | ||||
| ** | ||||
| ** $Date: 2004/05/12 15:29:36 $ $Revision: 1.2 $ | ||||
| ** $Date: 2005/10/28 13:09:08 $ $Revision: 1.2.8.1 $ | ||||
| */ | ||||
| /* | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/monoTriangulationBackend.cc,v 1.2 2004/05/12 15:29:36 brianp Exp $ | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/monoTriangulationBackend.cc,v 1.2.8.1 2005/10/28 13:09:08 brianp Exp $ | ||||
| */ | ||||
|  | ||||
| #include "monoTriangulation.h" | ||||
| @@ -86,7 +86,7 @@ void reflexChain::processNewVertex(Real v[2], Backend* backend) | ||||
| { | ||||
|   Int i,j,k; | ||||
|   Int isReflex; | ||||
|   TrimVertex trimVert; | ||||
|   /*TrimVertex trimVert;*/ | ||||
|   /*if there are at most one vertex in the queue, then simply insert | ||||
|    */ | ||||
|   if(index_queue <=1){ | ||||
|   | ||||
| @@ -35,8 +35,8 @@ | ||||
| /* | ||||
|  * slicer.c++ | ||||
|  * | ||||
|  * $Date: 2002/11/01 23:35:07 $ $Revision: 1.4 $ | ||||
|  * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/slicer.cc,v 1.4 2002/11/01 23:35:07 brianp Exp $ | ||||
|  * $Date: 2005/10/28 13:09:08 $ $Revision: 1.4.26.1 $ | ||||
|  * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/slicer.cc,v 1.4.26.1 2005/10/28 13:09:08 brianp Exp $ | ||||
|  */ | ||||
|  | ||||
| #include <stdlib.h> | ||||
| @@ -84,6 +84,7 @@ Int num_quads = 0; | ||||
| #define ZERO 0.00001 /*determing whether a loop is a rectngle or not*/ | ||||
| #define equalRect(a,b) ((glu_abs(a-b) <= ZERO)? 1:0) //only used in tessellating a rectangle | ||||
|  | ||||
| #if 0 // UNUSED | ||||
| static Int is_Convex(Arc_ptr loop) | ||||
| { | ||||
|   if(area(loop->tail(), loop->head(), loop->next->head()) <0 ) | ||||
| @@ -95,9 +96,11 @@ static Int is_Convex(Arc_ptr loop) | ||||
|     } | ||||
|   return 1; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| /******triangulate a monotone polygon**************/ | ||||
| #include "monoTriangulation.h" | ||||
| #if 0 // UNUSED | ||||
| static int is_U_monotone(Arc_ptr loop) | ||||
| { | ||||
|   int n_changes=0; | ||||
| @@ -126,6 +129,7 @@ static int is_U_monotone(Arc_ptr loop) | ||||
|   else | ||||
|     return 0; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| inline int compInY(REAL a[2], REAL b[2]) | ||||
| { | ||||
| @@ -259,6 +263,7 @@ if(loop->next->tail()[1] == loop->next->head()[1]) | ||||
|  | ||||
|  | ||||
| //a line with the same u for opt | ||||
| #ifdef USE_OPTTT | ||||
| static void evalLineNOGE_BU(TrimVertex *verts, int n, Backend& backend) | ||||
| { | ||||
|   int i; | ||||
| @@ -266,8 +271,10 @@ static void evalLineNOGE_BU(TrimVertex *verts, int n, Backend& backend) | ||||
|   for(i=0; i<n; i++) | ||||
|     backend.tmeshvertNOGE_BU(&verts[i]); | ||||
| } | ||||
| #endif | ||||
|  | ||||
| //a line with the same v for opt | ||||
| #ifdef USE_OPTTT | ||||
| static void evalLineNOGE_BV(TrimVertex *verts, int n, Backend& backend) | ||||
| { | ||||
|   int i; | ||||
| @@ -276,6 +283,9 @@ static void evalLineNOGE_BV(TrimVertex *verts, int n, Backend& backend) | ||||
|   for(i=0; i<n; i++) | ||||
|     backend.tmeshvertNOGE_BV(&verts[i]); | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #ifdef USE_OPTTT | ||||
| static void evalLineNOGE(TrimVertex *verts, int n, Backend& backend) | ||||
| { | ||||
|  | ||||
| @@ -290,7 +300,7 @@ static void evalLineNOGE(TrimVertex *verts, int n, Backend& backend) | ||||
| 	backend.tmeshvertNOGE(&verts[i]); | ||||
|     } | ||||
| } | ||||
|  | ||||
| #endif | ||||
|  | ||||
| inline void  OPT_OUTVERT(TrimVertex& vv, Backend& backend)  | ||||
| { | ||||
| @@ -861,6 +871,7 @@ return; | ||||
|    | ||||
|  | ||||
| /**********for reading newtess_flag from a file**********/ | ||||
| #ifdef USE_READ_FLAG | ||||
| static Int read_flag(char* name) | ||||
| { | ||||
|   Int ret; | ||||
| @@ -874,7 +885,7 @@ static Int read_flag(char* name) | ||||
|   fclose(fp); | ||||
|   return ret; | ||||
| } | ||||
|    | ||||
| #endif   | ||||
|  | ||||
| /***********nextgen tess****************/ | ||||
| #include "sampleMonoPoly.h" | ||||
|   | ||||
| @@ -35,8 +35,8 @@ | ||||
| /* | ||||
|  * trimline.c++ | ||||
|  * | ||||
|  * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ | ||||
|  * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/trimline.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ | ||||
|  * $Date: 2005/10/28 13:09:08 $ $Revision: 1.1.30.1 $ | ||||
|  * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/trimline.cc,v 1.1.30.1 2005/10/28 13:09:08 brianp Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "glimports.h" | ||||
| @@ -162,10 +162,11 @@ Trimline::getNextPts( Arc_ptr botarc ) | ||||
| { | ||||
|     reset(); swap(); append( tinterp ); | ||||
|  | ||||
| #ifndef NDEBUG | ||||
|     PwlArc *lastpwl = botarc->prev->pwlArc; | ||||
|     TrimVertex *lastpt1 = &lastpwl->pts[lastpwl->npts-1]; | ||||
| #endif | ||||
|     TrimVertex *lastpt2 = botarc->pwlArc->pts; | ||||
|  | ||||
|     register TrimVertex *p = jarcl.getnextpt(); | ||||
|     for( append( p ); p != lastpt2; append( p ) ) { | ||||
| 	assert( p != lastpt1 ); | ||||
| @@ -180,7 +181,9 @@ Trimline::getPrevPts( Arc_ptr botarc ) | ||||
|  | ||||
|     PwlArc *lastpwl = botarc->prev->pwlArc; | ||||
|     TrimVertex *lastpt1 = &lastpwl->pts[lastpwl->npts-1]; | ||||
| #ifndef NDEBUG | ||||
|     TrimVertex *lastpt2 = botarc->pwlArc->pts; | ||||
| #endif | ||||
|  | ||||
|     register TrimVertex *q =  jarcl.getprevpt(); | ||||
|     for( append( q ); q != lastpt1; append( q ) ) { | ||||
|   | ||||
| @@ -31,10 +31,10 @@ | ||||
| ** published by SGI, but has not been independently verified as being | ||||
| ** compliant with the OpenGL(R) version 1.2.1 Specification. | ||||
| ** | ||||
| ** $Date: 2004/05/12 15:29:36 $ $Revision: 1.2 $ | ||||
| ** $Date: 2005/10/28 13:09:08 $ $Revision: 1.2.8.1 $ | ||||
| */ | ||||
| /* | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/monoChain.cc,v 1.2 2004/05/12 15:29:36 brianp Exp $ | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/monoChain.cc,v 1.2.8.1 2005/10/28 13:09:08 brianp Exp $ | ||||
| */ | ||||
|  | ||||
| #include "gluos.h" | ||||
| @@ -61,6 +61,7 @@ extern Int isCusp(directedLine *v); | ||||
| extern Int deleteRepeatDiagonals(Int num_diagonals, directedLine** diagonal_vertices, directedLine** new_vertices); | ||||
|  | ||||
| //for debug purpose only | ||||
| #if 0 // UNUSED | ||||
| static void drawDiagonals(Int num_diagonals, directedLine** diagonal_vertices) | ||||
| { | ||||
|   Int i; | ||||
| @@ -72,6 +73,7 @@ static void drawDiagonals(Int num_diagonals, directedLine** diagonal_vertices) | ||||
|       glEnd(); | ||||
|     } | ||||
| } | ||||
| #endif | ||||
|  | ||||
| /*given (x_1, y_1) and (x_2, y_2), and y | ||||
|  *return x such that (x,y) is on the line | ||||
|   | ||||
| @@ -31,10 +31,10 @@ | ||||
| ** published by SGI, but has not been independently verified as being | ||||
| ** compliant with the OpenGL(R) version 1.2.1 Specification. | ||||
| ** | ||||
| ** $Date: 2004/05/12 15:29:36 $ $Revision: 1.3 $ | ||||
| ** $Date: 2005/10/28 13:09:09 $ $Revision: 1.3.8.1 $ | ||||
| */ | ||||
| /* | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc,v 1.3 2004/05/12 15:29:36 brianp Exp $ | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc,v 1.3.8.1 2005/10/28 13:09:09 brianp Exp $ | ||||
| */ | ||||
|  | ||||
| #include <stdlib.h> | ||||
| @@ -1037,8 +1037,8 @@ void monoTriangulationRec(directedLine* inc_chain, Int inc_index, | ||||
| 			  primStream* pStream) | ||||
| { | ||||
|   Int i; | ||||
|   directedLine *temp, *oldtemp; | ||||
|   Int tempIndex, oldtempIndex; | ||||
|   directedLine *temp, *oldtemp = NULL; | ||||
|   Int tempIndex, oldtempIndex = 0; | ||||
|    | ||||
|   assert(inc_chain != NULL && dec_chain != NULL); | ||||
|    | ||||
|   | ||||
| @@ -621,6 +621,7 @@ directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur) | ||||
| //given a polygon, cut the edges off and finally obtain a | ||||
| //a polygon without intersections. The cut-off edges are | ||||
| //dealloated. The new polygon is returned. | ||||
| #if 0 // UNUSED | ||||
| static directedLine* DBG_cutIntersectionPoly_notwork(directedLine *polygon) | ||||
| { | ||||
|   directedLine *crt;//current polygon | ||||
| @@ -673,6 +674,7 @@ static directedLine* DBG_cutIntersectionPoly_notwork(directedLine *polygon) | ||||
| 	find = 0;    //go to next loop | ||||
| } | ||||
| } | ||||
| #endif | ||||
|  | ||||
| directedLine* DBG_cutIntersectionAllPoly(directedLine* list) | ||||
| { | ||||
|   | ||||
| @@ -31,10 +31,10 @@ | ||||
| ** published by SGI, but has not been independently verified as being | ||||
| ** compliant with the OpenGL(R) version 1.2.1 Specification. | ||||
| ** | ||||
| ** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ | ||||
| ** $Date: 2005/10/28 13:09:09 $ $Revision: 1.1.30.1 $ | ||||
| */ | ||||
| /* | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleComp.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleComp.cc,v 1.1.30.1 2005/10/28 13:09:09 brianp Exp $ | ||||
| */ | ||||
|  | ||||
| #include <stdlib.h> | ||||
| @@ -159,7 +159,7 @@ void sampleCompLeft(Real* topVertex, Real* botVertex, | ||||
|    */ | ||||
|   Int midIndex1; | ||||
|   Int midIndex2; | ||||
|   Int gridMidIndex1, gridMidIndex2; | ||||
|   Int gridMidIndex1 = 0, gridMidIndex2 = 0; | ||||
|   //midIndex1: array[i] <= v, array[i-1] > v | ||||
|   //midIndex2: array[i] >= v, array[i+1] < v | ||||
|   // v(gridMidIndex1) >= v(midindex1) > v(gridMidIndex1+1) | ||||
|   | ||||
| @@ -31,10 +31,10 @@ | ||||
| ** published by SGI, but has not been independently verified as being | ||||
| ** compliant with the OpenGL(R) version 1.2.1 Specification. | ||||
| ** | ||||
| ** $Date: 2001/03/22 11:41:40 $ $Revision: 1.2 $ | ||||
| ** $Date: 2005/10/28 13:09:09 $ $Revision: 1.2.30.1 $ | ||||
| */ | ||||
| /* | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleCompRight.cc,v 1.2 2001/03/22 11:41:40 joukj Exp $ | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleCompRight.cc,v 1.2.30.1 2005/10/28 13:09:09 brianp Exp $ | ||||
| */ | ||||
|  | ||||
| #include <stdlib.h> | ||||
| @@ -72,7 +72,7 @@ void sampleCompRight(Real* topVertex, Real* botVertex, | ||||
|    */ | ||||
|   Int midIndex1; | ||||
|   Int midIndex2; | ||||
|   Int gridMidIndex1, gridMidIndex2; | ||||
|   Int gridMidIndex1, gridMidIndex2 = 0; | ||||
|   //midIndex1: array[i] <= v, array[i+1] > v | ||||
|   //midIndex2: array[i] >= v,  array[i+1] < v | ||||
|   midIndex1 = rightChain->findIndexBelowGen(rightGridChain->get_v_value(gridIndex1), | ||||
|   | ||||
| @@ -31,10 +31,10 @@ | ||||
| ** published by SGI, but has not been independently verified as being | ||||
| ** compliant with the OpenGL(R) version 1.2.1 Specification. | ||||
| ** | ||||
| ** $Date: 2004/05/12 15:29:36 $ $Revision: 1.4 $ | ||||
| ** $Date: 2005/10/28 13:09:09 $ $Revision: 1.4.8.1 $ | ||||
| */ | ||||
| /* | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc,v 1.4 2004/05/12 15:29:36 brianp Exp $ | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc,v 1.4.8.1 2005/10/28 13:09:09 brianp Exp $ | ||||
| */ | ||||
|  | ||||
| #include "gluos.h" | ||||
| @@ -976,7 +976,7 @@ void findNeck(vertexArray *leftChain, Int botLeftIndex, | ||||
| void findLeftGridIndices(directedLine* topEdge, Int firstGridIndex, Int lastGridIndex, gridWrap* grid,  Int* ret_indices, Int* ret_innerIndices) | ||||
| { | ||||
|  | ||||
|   Int i,k,isHoriz; | ||||
|   Int i,k,isHoriz = 0; | ||||
|   Int n_ulines = grid->get_n_ulines(); | ||||
|   Real uMin = grid->get_u_min(); | ||||
|   Real uMax = grid->get_u_max(); | ||||
| @@ -984,7 +984,7 @@ void findLeftGridIndices(directedLine* topEdge, Int firstGridIndex, Int lastGrid | ||||
|   Real vMin = grid->get_v_min(); | ||||
|   Real vMax = grid->get_v_max(); | ||||
|   */ | ||||
|   Real slop, uinterc; | ||||
|   Real slop = 0.0, uinterc; | ||||
|  | ||||
| #ifdef SHORTEN_GRID_LINE | ||||
|   //uintercBuf stores all the interction u value for each grid line | ||||
| @@ -1102,7 +1102,7 @@ void findRightGridIndices(directedLine* topEdge, Int firstGridIndex, Int lastGri | ||||
|   Real vMin = grid->get_v_min(); | ||||
|   Real vMax = grid->get_v_max(); | ||||
|   */ | ||||
|   Real slop, uinterc; | ||||
|   Real slop = 0.0, uinterc; | ||||
|  | ||||
| #ifdef SHORTEN_GRID_LINE | ||||
|   //uintercBuf stores all the interction u value for each grid line | ||||
|   | ||||
| @@ -31,8 +31,8 @@ | ||||
| ** published by SGI, but has not been independently verified as being | ||||
| ** compliant with the OpenGL(R) version 1.2.1 Specification. | ||||
| ** | ||||
| ** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/error.c,v 1.1 2001/03/17 00:25:41 brianp Exp $ | ||||
| ** $Date: 2005/10/05 02:08:30 $ $Revision: 1.1.30.1 $ | ||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/error.c,v 1.1.30.1 2005/10/05 02:08:30 brianp Exp $ | ||||
| */ | ||||
|  | ||||
| #include "gluos.h" | ||||
| @@ -81,6 +81,11 @@ gluErrorString(GLenum errorCode) | ||||
|     if ((errorCode >= GLU_TESS_ERROR1) && (errorCode <= GLU_TESS_ERROR8)) { | ||||
| 	return (const unsigned char *) __gluTessErrorString(errorCode - (GLU_TESS_ERROR1 - 1)); | ||||
|     } | ||||
| #ifdef GL_EXT_framebuffer_object | ||||
|     if (errorCode == GL_INVALID_FRAMEBUFFER_OPERATION_EXT) { | ||||
|        return (const unsigned char *) "invalid framebuffer operation"; | ||||
|     } | ||||
| #endif | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
|   | ||||
| @@ -444,7 +444,7 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, | ||||
|     GLfloat sintemp, costemp; | ||||
|     GLfloat deltaRadius; | ||||
|     GLfloat radiusLow, radiusHigh; | ||||
|     GLfloat texLow, texHigh; | ||||
|     GLfloat texLow = 0.0, texHigh = 0.0; | ||||
|     GLfloat angleOffset; | ||||
|     GLint slices2; | ||||
|     GLint finish; | ||||
| @@ -713,8 +713,8 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks) | ||||
|     GLfloat cosCache3b[CACHE_SIZE]; | ||||
|     GLfloat angle; | ||||
|     GLfloat zLow, zHigh; | ||||
|     GLfloat sintemp1, sintemp2, sintemp3, sintemp4; | ||||
|     GLfloat costemp1, costemp2, costemp3, costemp4; | ||||
|     GLfloat sintemp1, sintemp2, sintemp3 = 0.0, sintemp4 = 0.0; | ||||
|     GLfloat costemp1, costemp2 = 0.0, costemp3 = 0.0, costemp4 = 0.0; | ||||
|     GLboolean needCache2, needCache3; | ||||
|     GLint start, finish; | ||||
|  | ||||
|   | ||||
| @@ -182,9 +182,9 @@ extern void GLwDrawingAreaSwapBuffers(Widget w); | ||||
|  | ||||
| #ifdef __GLX_MOTIF | ||||
| #ifdef _NO_PROTO | ||||
| GLAPI extern Widget GLwCreateMDrawingArea(); | ||||
| GLAPI Widget GLwCreateMDrawingArea(); | ||||
| #else | ||||
| GLAPI extern Widget GLwCreateMDrawingArea(Widget parent,char *name,ArgList arglist,Cardinal argcount); | ||||
| GLAPI Widget GLwCreateMDrawingArea(Widget parent,char *name,ArgList arglist,Cardinal argcount); | ||||
| #endif | ||||
| #endif  | ||||
|  | ||||
|   | ||||
| @@ -59,7 +59,7 @@ typedef struct _GLwMDrawingAreaClassRec { | ||||
|   } GLwMDrawingAreaClassRec; | ||||
|  | ||||
|  | ||||
| GLAPI extern GLwMDrawingAreaClassRec glwMDrawingAreaClassRec; | ||||
| extern GLwMDrawingAreaClassRec glwMDrawingAreaClassRec; | ||||
|  | ||||
|  | ||||
| /* XT */ | ||||
|   | ||||
| @@ -1,451 +0,0 @@ | ||||
| /* | ||||
|  | ||||
|                                 BOILERPLATE | ||||
|  | ||||
|    To get started with mixed model programming with Motif and OpenGL, this | ||||
|    boilerplate `application' might help get you started. | ||||
|  | ||||
|    This program honors two environment variables: | ||||
|  | ||||
|       SETVISUAL <id>    Makes the application use the indicated visual, | ||||
|                         instead of the one chosen by glxChooseVisual. | ||||
|  | ||||
|       SAMEVISUAL        Make the application use the same visual for the | ||||
|                         GUI as for the 3D GL Widget. | ||||
|  | ||||
|    The basic idea is to minimize colormap `flash' on systems with only one | ||||
|    hardware colormap, especially when focus shifts between several | ||||
|    of the application's windows, e.g. the about box. | ||||
|  | ||||
|    If you have suggestions for improvements, please mail to: | ||||
|  | ||||
|  | ||||
|       Jeroen van der Zijp  <jvz@cyberia.cfdrc.com> | ||||
|  | ||||
|  | ||||
|    Feel free to turn this into a useful program!! | ||||
|  | ||||
| */ | ||||
|  | ||||
|  | ||||
| /* | ||||
|  | ||||
|     This code is hereby placed under GNU GENERAL PUBLIC LICENSE. | ||||
|     Copyright (C) 1996 Jeroen van der Zijp <jvz@cyberia.cfdrc.com> | ||||
|  | ||||
|     This program is free software; you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation; either version 2 of the License, or | ||||
|     (at your option) any later version. | ||||
|  | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
|  | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program; if not, write to the Free Software | ||||
|     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
| */ | ||||
|  | ||||
|  | ||||
| /* Include the kitchen sink */ | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <X11/Intrinsic.h> | ||||
| #include <X11/StringDefs.h> | ||||
| #include <X11/cursorfont.h> | ||||
| #include <X11/keysym.h> | ||||
| #include <Xm/Xm.h> | ||||
| #include <Xm/MainW.h> | ||||
| #include <Xm/RowColumn.h> | ||||
| #include <Xm/PushB.h> | ||||
| #include <Xm/CascadeB.h> | ||||
| #include <Xm/BulletinB.h> | ||||
| #include <Xm/DialogS.h> | ||||
| #include <Xm/Frame.h> | ||||
| #include <Xm/MessageB.h> | ||||
| #include <Xm/Form.h> | ||||
| #include <Xm/Separator.h> | ||||
| #include <Xm/MwmUtil.h> | ||||
|  | ||||
| /* Now some good stuff */ | ||||
| #include <GLwMDrawA.h> | ||||
| #include <GL/gl.h> | ||||
| #include <GL/glu.h> | ||||
| #include <GL/glx.h> | ||||
|  | ||||
|  | ||||
| /* Stuff */ | ||||
| Display      *display; | ||||
| Visual       *gui_visual; | ||||
| Colormap      gui_colormap; | ||||
| Colormap      gl_colormap; | ||||
| XVisualInfo  *gl_visualinfo; | ||||
| XtAppContext  app_context; | ||||
| Widget        toplevel; | ||||
| Widget        mainwindow; | ||||
| Widget        menubar; | ||||
| Widget        mainform; | ||||
| Widget        mainframe; | ||||
| Widget        glwidget; | ||||
| Widget        button; | ||||
| Widget        separator; | ||||
| GLXContext    glx_context; | ||||
|  | ||||
| #ifndef __cplusplus | ||||
| #define c_class class | ||||
| #endif | ||||
|  | ||||
| /* Requested attributes; fix as you see fit */ | ||||
| static int glxConfig[]={ | ||||
|   GLX_RGBA, | ||||
|   GLX_DOUBLEBUFFER, | ||||
|   GLX_DEPTH_SIZE,   16, | ||||
|   GLX_RED_SIZE,     1, | ||||
|   GLX_GREEN_SIZE,   1, | ||||
|   GLX_BLUE_SIZE,    1, | ||||
|   None | ||||
|   }; | ||||
|  | ||||
|  | ||||
| /* Forwards */ | ||||
| static void exposeCB(Widget w,XtPointer client_data,GLwDrawingAreaCallbackStruct *cbs); | ||||
| static void initCB(Widget w,XtPointer client_data,GLwDrawingAreaCallbackStruct *cbs); | ||||
| static void resizeCB(Widget w,XtPointer client_data,GLwDrawingAreaCallbackStruct *cbs); | ||||
| static void inputCB(Widget w,XtPointer client_data,GLwDrawingAreaCallbackStruct *cbs); | ||||
| static void byeCB(Widget w,XtPointer client_data,XtPointer call_data); | ||||
| static void aboutCB(Widget w,XtPointer client_data,XtPointer call_data); | ||||
| static char* showvisualclass(int cls); | ||||
|  | ||||
|  | ||||
|  | ||||
| /* Sample application */ | ||||
| int main(int argc, char *argv[]){ | ||||
|   char *thevisual; | ||||
|   XVisualInfo vi; | ||||
|   int nvisinfos,visid,n; | ||||
|   Arg args[30]; | ||||
|   Widget pane,cascade,but; | ||||
|  | ||||
|   /* | ||||
|   ** Initialize toolkit | ||||
|   ** We do *not* use XtAppInitialize as we want to figure visual and | ||||
|   ** colormap BEFORE we create the top level shell!!! | ||||
|   */ | ||||
|   XtToolkitInitialize(); | ||||
|  | ||||
|   /* Make application context */ | ||||
|   app_context=XtCreateApplicationContext(); | ||||
|  | ||||
|   /* Try open display */ | ||||
|   display=XtOpenDisplay(app_context,NULL,"boilerPlate","BoilerPlate",NULL,0,&argc,argv); | ||||
|  | ||||
|   /* Report failure */ | ||||
|   if(!display){ | ||||
|     fprintf(stderr,"Unable to open the specified display.\n"); | ||||
|     fprintf(stderr,"Set your `DISPLAY' environment variable properly or\n"); | ||||
|     fprintf(stderr,"use the `xhost' command to authorize access to the display.\n"); | ||||
|     exit(1); | ||||
|     } | ||||
|  | ||||
|   /* Check for extension; for Mesa, this is always cool */ | ||||
|   if(!glXQueryExtension(display,NULL,NULL)){ | ||||
|     fprintf(stderr,"The specified display does not support the OpenGL extension\n"); | ||||
|     exit(1); | ||||
|     } | ||||
|  | ||||
|   /* Init with default visual and colormap */ | ||||
|   gui_visual=DefaultVisual(display,0); | ||||
|   gui_colormap=DefaultColormap(display,0); | ||||
|   gl_colormap=DefaultColormap(display,0); | ||||
|  | ||||
|   /* User insists on a specific visual */ | ||||
|   if((thevisual=getenv("SETVISUAL"))!=NULL){ | ||||
|     if(sscanf(thevisual,"%x",&visid)==1){ | ||||
|       vi.visualid=visid; | ||||
|       gl_visualinfo=XGetVisualInfo(display,VisualIDMask,&vi,&nvisinfos); | ||||
|       } | ||||
|     else{ | ||||
|       fprintf(stderr,"Please set the `SETVISUAL' variable in hexadecimal\n"); | ||||
|       fprintf(stderr,"Use one of the Visual ID's reported by `xdpyinfo'\n"); | ||||
|       exit(1); | ||||
|       } | ||||
|     } | ||||
|  | ||||
|   /* Find visual the regular way */ | ||||
|   else{ | ||||
|     gl_visualinfo=glXChooseVisual(display,DefaultScreen(display),glxConfig); | ||||
|     } | ||||
|  | ||||
|   /* Make sure we have a visual */ | ||||
|   if(!gl_visualinfo){ | ||||
|     fprintf(stderr,"Unable to obtain visual for graphics\n"); | ||||
|     exit(1); | ||||
|     } | ||||
|  | ||||
|   /* Show what visual is being used */ | ||||
|   fprintf(stderr,"Using the following visual:\n"); | ||||
|   fprintf(stderr,"  visualid: %lx\n",gl_visualinfo->visualid); | ||||
|   fprintf(stderr,"     depth: %d\n",gl_visualinfo->depth); | ||||
|   fprintf(stderr,"    screen: %d\n",gl_visualinfo->screen); | ||||
|   fprintf(stderr,"  bits/rgb: %d\n",gl_visualinfo->bits_per_rgb); | ||||
|   fprintf(stderr,"     class: %s\n",showvisualclass(gl_visualinfo->c_class)); | ||||
|  | ||||
|   /* | ||||
|   ** If not using default visual, we need a colormap for this visual. | ||||
|   ** Yes, the GL widget can allocate one itself, but we want to make | ||||
|   ** sure the GUI and the 3D have the same one (if hardware does not | ||||
|   ** allow more than one simultaneously). | ||||
|   ** This prevents nasty flashing when the window with the 3D widget | ||||
|   ** looses the focus. | ||||
|   */ | ||||
|   if(gl_visualinfo->visual!=DefaultVisual(display,0)){ | ||||
|     fprintf(stderr,"Making another colormap\n"); | ||||
|     gl_colormap=XCreateColormap(display, | ||||
|                                 RootWindow(display,0), | ||||
|                                 gl_visualinfo->visual, | ||||
|                                 AllocNone); | ||||
|     if(!gl_colormap){ | ||||
|       fprintf(stderr,"Unable to create private colormap\n"); | ||||
|       exit(1); | ||||
|       } | ||||
|     } | ||||
|  | ||||
|   /* | ||||
|   ** Use common visual for GUI and GL? | ||||
|   ** Maybe you can invoke some hardware interrogation function and | ||||
|   ** see if more than one hardware map is supported.  For the purpose | ||||
|   ** of this demo, we'll use an environment variable instead. | ||||
|   */ | ||||
|   if(getenv("SAMEVISUAL")!=NULL){ | ||||
|     gui_visual=gl_visualinfo->visual; | ||||
|     gui_colormap=gl_colormap; | ||||
|     } | ||||
|  | ||||
|   fprintf(stderr,"GUI uses visual: %lx\n",XVisualIDFromVisual(gui_visual)); | ||||
|  | ||||
|   /* Create application shell, finally */ | ||||
|   n=0; | ||||
|   XtSetArg(args[n],XmNvisual,gui_visual); n++;  	/* Plug in that visual */ | ||||
|   XtSetArg(args[n],XmNcolormap,gui_colormap); n++;	/* And that colormap */ | ||||
|   toplevel=XtAppCreateShell("boilerPlate","BoilerPlate", | ||||
|                             applicationShellWidgetClass,display,args,n); | ||||
|  | ||||
|  | ||||
|   /* Main window */ | ||||
|   n=0; | ||||
|   mainwindow=XmCreateMainWindow(toplevel,"window",args,n); | ||||
|   XtManageChild(mainwindow); | ||||
|  | ||||
|   /* Make a menu */ | ||||
|   n=0; | ||||
|   XtSetArg(args[n],XmNmarginWidth,0); n++; | ||||
|   XtSetArg(args[n],XmNmarginHeight,0); n++; | ||||
|   menubar=XmCreateMenuBar(mainwindow,"menubar",args,2); | ||||
|   XtManageChild(menubar); | ||||
|  | ||||
|   n=0; | ||||
|   pane=XmCreatePulldownMenu(menubar,"pane",args,n); | ||||
|   n=0; | ||||
|   but=XmCreatePushButton(pane,"Open",args,n); | ||||
|   XtManageChild(but); | ||||
|   but=XmCreatePushButton(pane,"Save",args,n); | ||||
|   XtManageChild(but); | ||||
|   but=XmCreatePushButton(pane,"Save As",args,n); | ||||
|   XtManageChild(but); | ||||
|   but=XmCreatePushButton(pane,"Quit",args,n); | ||||
|   XtAddCallback(but,XmNactivateCallback,byeCB,(XtPointer)NULL); | ||||
|   XtManageChild(but); | ||||
|   XtSetArg(args[0],XmNsubMenuId,pane); | ||||
|   cascade=XmCreateCascadeButton(menubar,"File",args,1); | ||||
|   XtManageChild(cascade); | ||||
|  | ||||
|   n=0; | ||||
|   pane=XmCreatePulldownMenu(menubar,"pane",args,n); | ||||
|   n=0; | ||||
|   but=XmCreatePushButton(pane,"About",args,n); | ||||
|   XtAddCallback(but,XmNactivateCallback,aboutCB,(XtPointer)NULL); | ||||
|   XtManageChild(but); | ||||
|   XtSetArg(args[0],XmNsubMenuId,pane); | ||||
|   cascade=XmCreateCascadeButton(menubar,"Help",args,1); | ||||
|   XtManageChild(cascade); | ||||
|   XtVaSetValues(menubar,XmNmenuHelpWidget,cascade,NULL); | ||||
|  | ||||
|   /* Main window form */ | ||||
|   n=0; | ||||
|   XtSetArg(args[n],XmNmarginWidth,5); n++; | ||||
|   XtSetArg(args[n],XmNmarginHeight,5); n++; | ||||
|   mainform=XmCreateForm(mainwindow,"mainForm",args,n); | ||||
|   XtManageChild(mainform); | ||||
|  | ||||
|   /* Some nice button */ | ||||
|   n=0; | ||||
|   XtSetArg(args[n],XmNbottomAttachment,XmATTACH_FORM); n++; | ||||
|   XtSetArg(args[n],XmNrightAttachment,XmATTACH_FORM); n++; | ||||
|   button=XmCreatePushButton(mainform,"Bye",args,n); | ||||
|   XtAddCallback(button,XmNactivateCallback,byeCB,(XtPointer)NULL); | ||||
|   XtManageChild(button); | ||||
|  | ||||
|   n=0; | ||||
|   XtSetArg(args[n],XmNleftAttachment,XmATTACH_FORM); n++; | ||||
|   XtSetArg(args[n],XmNrightAttachment,XmATTACH_FORM); n++; | ||||
|   XtSetArg(args[n],XmNbottomAttachment,XmATTACH_WIDGET); n++; | ||||
|   XtSetArg(args[n],XmNbottomWidget,button); n++; | ||||
|   XtSetArg(args[n],XmNshadowType,XmSHADOW_ETCHED_IN); n++; | ||||
|   separator=XmCreateSeparator(mainform,"separator",args,n); | ||||
|   XtManageChild(separator); | ||||
|  | ||||
|   /* Main window frame */ | ||||
|   n = 0; | ||||
|   XtSetArg(args[n],XmNleftAttachment,XmATTACH_FORM); n++; | ||||
|   XtSetArg(args[n],XmNrightAttachment,XmATTACH_FORM); n++; | ||||
|   XtSetArg(args[n],XmNtopAttachment,XmATTACH_FORM); n++; | ||||
|   XtSetArg(args[n],XmNbottomAttachment,XmATTACH_WIDGET); n++; | ||||
|   XtSetArg(args[n],XmNbottomWidget,separator); n++; | ||||
|   XtSetArg(args[n],XmNshadowType,XmSHADOW_IN); n++; | ||||
|   mainframe = XmCreateFrame(mainform,"mainFrame",args,n); | ||||
|   XtManageChild(mainframe); | ||||
|  | ||||
|   /* GL drawing area */ | ||||
|   n = 0; | ||||
|   XtSetArg(args[n],XmNcolormap,gl_colormap); n++; | ||||
|   XtSetArg(args[n],GLwNvisualInfo,gl_visualinfo); n++; | ||||
|   XtSetArg(args[n],GLwNinstallColormap,True); n++; | ||||
|   XtSetArg(args[n],XmNtraversalOn,True); n++; | ||||
|   XtSetArg(args[n],XmNwidth,400); n++; | ||||
|   XtSetArg(args[n],XmNheight,300); n++; | ||||
|   glwidget = GLwCreateMDrawingArea(mainframe,"glWidget",args,n); | ||||
|   XtAddCallback(glwidget,GLwNexposeCallback,(XtCallbackProc)exposeCB,(XtPointer)NULL); | ||||
|   XtAddCallback(glwidget,GLwNresizeCallback,(XtCallbackProc)resizeCB,(XtPointer)NULL); | ||||
|   XtAddCallback(glwidget,GLwNginitCallback,(XtCallbackProc)initCB,(XtPointer)NULL); | ||||
|   XtAddCallback(glwidget,GLwNinputCallback,(XtCallbackProc)inputCB,(XtPointer)NULL); | ||||
|   XtManageChild(glwidget); | ||||
|  | ||||
|   /* Set into main window */ | ||||
|   XmMainWindowSetAreas(mainwindow,menubar,NULL,NULL,NULL,mainform); | ||||
|   XtRealizeWidget(toplevel); | ||||
|  | ||||
|   /* Loop until were done */ | ||||
|   XtAppMainLoop(app_context); | ||||
|   return 0; | ||||
|   } | ||||
|  | ||||
|  | ||||
| /* Show visual class */ | ||||
| static char* showvisualclass(int cls){ | ||||
|   if(cls==TrueColor) return "TrueColor"; | ||||
|   if(cls==DirectColor) return "DirectColor"; | ||||
|   if(cls==PseudoColor) return "PseudoColor"; | ||||
|   if(cls==StaticColor) return "StaticColor"; | ||||
|   if(cls==GrayScale) return "GrayScale"; | ||||
|   if(cls==StaticGray) return "StaticGray"; | ||||
|   return "Unknown"; | ||||
|   } | ||||
|  | ||||
|  | ||||
| static void exposeCB(Widget w,XtPointer client_data,GLwDrawingAreaCallbackStruct *cbs){ | ||||
|   GLwDrawingAreaMakeCurrent(glwidget,glx_context); | ||||
|  | ||||
|   glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); | ||||
|   glMatrixMode(GL_PROJECTION); | ||||
|  | ||||
|   glLoadIdentity(); | ||||
|   glOrtho(-1.0,1.0,-1.0,1.0,0.0,1.0); | ||||
|  | ||||
|   glMatrixMode(GL_MODELVIEW); | ||||
|  | ||||
|   glLoadIdentity(); | ||||
|  | ||||
|   glColor3f(1.0,0.0,0.0); | ||||
|   glBegin(GL_LINE_STRIP); | ||||
|   glVertex3f(-1.0,-1.0,0.0); | ||||
|   glVertex3f( 1.0, 1.0,0.0); | ||||
|   glEnd(); | ||||
|   glXSwapBuffers(display,XtWindow(glwidget)); | ||||
|   } | ||||
|  | ||||
|  | ||||
| /* Initialize widget */ | ||||
| static void initCB(Widget w,XtPointer client_data,GLwDrawingAreaCallbackStruct *cbs){ | ||||
|  | ||||
|   /* First, create context. We prefer direct rendering */ | ||||
|   glx_context=glXCreateContext(display,gl_visualinfo,0,TRUE); | ||||
|   if(!glx_context){ | ||||
|     fprintf(stderr,"Unable to create gl context\n"); | ||||
|     exit(1); | ||||
|     } | ||||
|  | ||||
|   /* Make it current */ | ||||
|   GLwDrawingAreaMakeCurrent(glwidget,glx_context); | ||||
|  | ||||
|   /* Set a viewport */ | ||||
|   glViewport(0,0,cbs->width,cbs->height); | ||||
|  | ||||
|   /* You might want to do a lot more here ... */ | ||||
|   glEnable(GL_DEPTH_TEST); | ||||
|   glDepthFunc(GL_LEQUAL); | ||||
|   glClearColor(1.0,1.0,1.0,1.0); | ||||
|   glClearDepth(1.0); | ||||
|  | ||||
|  | ||||
|   } | ||||
|  | ||||
|  | ||||
| /* Widget changed size, so adjust txform */ | ||||
| static void resizeCB(Widget w,XtPointer client_data,GLwDrawingAreaCallbackStruct *cbs){ | ||||
|   GLwDrawingAreaMakeCurrent(glwidget,glx_context); | ||||
|   glViewport(0,0,cbs->width,cbs->height); | ||||
|  | ||||
|   /* blablabla */ | ||||
|   } | ||||
|  | ||||
|  | ||||
| /* Boilerplate event handling */ | ||||
| static void inputCB(Widget w,XtPointer client_data,GLwDrawingAreaCallbackStruct *cbs){ | ||||
|   switch(cbs->event->type){ | ||||
|     case ButtonPress: | ||||
|       switch(cbs->event->xbutton.button){ | ||||
|         case Button1: fprintf(stderr,"Pressed 1\n"); break; | ||||
|         case Button2: fprintf(stderr,"Pressed 2\n"); break; | ||||
|         case Button3: fprintf(stderr,"Pressed 3\n"); break; | ||||
|         } | ||||
|       break; | ||||
|     case ButtonRelease: | ||||
|       switch(cbs->event->xbutton.button){ | ||||
|         case Button1: fprintf(stderr,"Released 1\n"); break; | ||||
|         case Button2: fprintf(stderr,"Released 2\n"); break; | ||||
|         case Button3: fprintf(stderr,"Released 3\n"); break; | ||||
|         } | ||||
|       break; | ||||
|     case MotionNotify: | ||||
|       fprintf(stderr,"Moved mouse to (%d %d)\n", | ||||
|               cbs->event->xbutton.x, | ||||
|               cbs->event->xbutton.y); | ||||
|       break; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|  | ||||
| /* Hasta la vista, baby */ | ||||
| static void byeCB(Widget w,XtPointer client_data,XtPointer call_data){ | ||||
|   exit(0); | ||||
|   } | ||||
|  | ||||
|  | ||||
| /* Pop informative panel */ | ||||
| static void aboutCB(Widget w,XtPointer client_data,XtPointer call_data){ | ||||
|   Arg args[10]; | ||||
|   XmString str; | ||||
|   Widget box; | ||||
|   str=XmStringCreateLtoR("Boilerplate Mixed Model Programming Example\n\n   (C) 1996 Jeroen van der Zijp \n\n    jvz@cyberia.cfdrc.com",XmSTRING_DEFAULT_CHARSET); | ||||
|   XtSetArg(args[0],XmNnoResize,True); | ||||
|   XtSetArg(args[1],XmNautoUnmanage,True); | ||||
|   XtSetArg(args[2],XmNmessageString,str); | ||||
|   XtSetArg(args[3],XmNdefaultPosition,False); | ||||
|   box=XmCreateInformationDialog(toplevel,"About Boilerplate",args,4); | ||||
|   XtManageChild(box); | ||||
|   XtUnmanageChild(XmMessageBoxGetChild(box,XmDIALOG_HELP_BUTTON)); | ||||
|   XtUnmanageChild(XmMessageBoxGetChild(box,XmDIALOG_CANCEL_BUTTON)); | ||||
|   XmStringFree(str); | ||||
|   } | ||||
| @@ -38,7 +38,7 @@ | ||||
|  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| /* $Id: miniglx_events.c,v 1.4 2004/07/16 04:27:00 jonsmirl Exp $ */ | ||||
| /* $Id: miniglx_events.c,v 1.4.8.2 2005/08/31 01:25:24 airlied Exp $ */ | ||||
|  | ||||
|  | ||||
| #include <assert.h> | ||||
| @@ -258,6 +258,7 @@ static int welcome_message_part( Display *dpy, int i, void **msg, int sz ) | ||||
|       if (!*msg) *msg = malloc(sz); | ||||
|       if (!*msg) return False; | ||||
|       if (!blocking_read( dpy, i, *msg, sz )) return False; | ||||
|       return sz; | ||||
|    } | ||||
|    else { | ||||
|       if (!send_msg( dpy, i, &sz, sizeof(sz))) return False; | ||||
| @@ -283,18 +284,21 @@ static int welcome_message( Display *dpy, int i ) | ||||
| { | ||||
|    void *tmp = &dpy->driverContext.shared; | ||||
|    int *clientid = dpy->IsClient ? &dpy->clientID : &i; | ||||
|     | ||||
|    int size; | ||||
|    if (!welcome_message_part( dpy, i, (void **)&clientid, sizeof(*clientid))) | ||||
|       return False; | ||||
|  | ||||
|    if (!welcome_message_part( dpy, i, &tmp, sizeof(dpy->driverContext.shared))) | ||||
|       return False; | ||||
|        | ||||
|    if (!welcome_message_part( dpy, i, | ||||
|    size=welcome_message_part( dpy, i, | ||||
|                               (void **)&dpy->driverContext.driverClientMsg,  | ||||
| 			      dpy->driverContext.driverClientMsgSize )) | ||||
| 			      dpy->driverContext.driverClientMsgSize ); | ||||
|    if (!size) | ||||
|       return False; | ||||
|  | ||||
|    if (dpy->IsClient) { | ||||
|       dpy->driverContext.driverClientMsgSize = size; | ||||
|    } | ||||
|    return True; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -200,9 +200,9 @@ PUBLIC Bool XF86DRIOpenConnection(dpy, screen, hSAREA, busIdString) | ||||
|     } | ||||
|  | ||||
|     *hSAREA = rep.hSAREALow; | ||||
| #ifdef LONG64 | ||||
|     if (sizeof(drm_handle_t) == 8) { | ||||
|        *hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << 32; | ||||
| #endif | ||||
|     } | ||||
|  | ||||
|     if (rep.length) { | ||||
|         if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) { | ||||
| @@ -562,9 +562,9 @@ PUBLIC Bool XF86DRIGetDeviceInfo(dpy, screen, hFrameBuffer, | ||||
|     } | ||||
|  | ||||
|     *hFrameBuffer = rep.hFrameBufferLow; | ||||
| #ifdef LONG64 | ||||
|     if (sizeof(drm_handle_t) == 8) { | ||||
|        *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << 32; | ||||
| #endif | ||||
|     } | ||||
|  | ||||
|     *fbOrigin = rep.framebufferOrigin; | ||||
|     *fbSize = rep.framebufferSize; | ||||
|   | ||||
| @@ -39,7 +39,7 @@ | ||||
|  | ||||
| #define __GLX_PAD(n) (((n) + 3) & ~3) | ||||
|  | ||||
| #  if defined(__i386__) && defined(__GNUC__) | ||||
| #  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) | ||||
| #    define FASTCALL __attribute__((fastcall)) | ||||
| #  else | ||||
| #    define FASTCALL | ||||
|   | ||||
| @@ -37,12 +37,12 @@ | ||||
|  * \author Ian Romanick <idr@us.ibm.com> | ||||
|  */ | ||||
|  | ||||
| #  if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) | ||||
| #  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) | ||||
| #    define HIDDEN  __attribute__((visibility("hidden"))) | ||||
| #  else | ||||
| #    define HIDDEN | ||||
| #  endif | ||||
| #  if defined(__i386__) && defined(__GNUC__) | ||||
| #  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) | ||||
| #    define FASTCALL __attribute__((fastcall)) | ||||
| #  else | ||||
| #    define FASTCALL | ||||
|   | ||||
| @@ -35,19 +35,22 @@ | ||||
| #    define PURE | ||||
| #  endif | ||||
|  | ||||
| #  if defined(__i386__) && defined(__GNUC__) | ||||
| #  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) | ||||
| #    define FASTCALL __attribute__((fastcall)) | ||||
| #  else | ||||
| #    define FASTCALL | ||||
| #  endif | ||||
|  | ||||
| #  if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) | ||||
| #  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) | ||||
| #    define INTERNAL  __attribute__((visibility("internal"))) | ||||
| #  else | ||||
| #    define INTERNAL | ||||
| #  endif | ||||
|  | ||||
|  | ||||
| #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__) | ||||
| #  undef HAVE_ALIAS | ||||
| #endif | ||||
| #ifdef HAVE_ALIAS | ||||
| #  define ALIAS2(from,to) \ | ||||
|     INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \ | ||||
|   | ||||
| @@ -42,13 +42,13 @@ | ||||
| #    define PURE | ||||
| #  endif | ||||
|  | ||||
| #  if defined(__i386__) && defined(__GNUC__) | ||||
| #  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) | ||||
| #    define FASTCALL __attribute__((fastcall)) | ||||
| #  else | ||||
| #    define FASTCALL | ||||
| #  endif | ||||
|  | ||||
| #  if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) | ||||
| #  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) | ||||
| #    define INTERNAL  __attribute__((visibility("internal"))) | ||||
| #  else | ||||
| #    define INTERNAL | ||||
|   | ||||
| @@ -29,7 +29,7 @@ static void TransposeMatrixf(const GLfloat s[16], GLfloat d[16]) | ||||
| { | ||||
|     int i, j; | ||||
|     for (i = 0; i < 4; i++) { | ||||
|         for (j = 0; j < i; j++) { | ||||
|         for (j = 0; j < 4; j++) { | ||||
|             d[i*4+j] = s[j*4+i]; | ||||
|         } | ||||
|     } | ||||
| @@ -39,7 +39,7 @@ static void TransposeMatrixd(const GLdouble s[16], GLdouble d[16]) | ||||
| { | ||||
|     int i, j; | ||||
|     for (i = 0; i < 4; i++) { | ||||
|         for (j = 0; j < i; j++) { | ||||
|         for (j = 0; j < 4; j++) { | ||||
|             d[i*4+j] = s[j*4+i]; | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -94,154 +94,110 @@ void __indirect_glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid | ||||
| { | ||||
|     __GLXcontext *gc = __glXGetCurrentContext(); | ||||
|     __GLXattribute * state = (__GLXattribute *)(gc->client_state_private); | ||||
|     GLboolean tEnable = GL_FALSE, cEnable = GL_FALSE, nEnable = GL_FALSE; | ||||
|     GLenum tType = GL_FLOAT, nType = GL_FLOAT, vType = GL_FLOAT; | ||||
|     GLenum cType = GL_FALSE; | ||||
|     GLint tSize = 0, cSize = 0, nSize = 3, vSize; | ||||
|     int cOffset = 0, nOffset = 0, vOffset = 0; | ||||
|     GLint trueStride, size; | ||||
|  | ||||
|     switch (format) { | ||||
|       case GL_V2F: | ||||
| 	vSize = 2; | ||||
| 	size = __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       case GL_V3F: | ||||
| 	vSize = 3; | ||||
| 	size = __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       case GL_C4UB_V2F: | ||||
| 	cEnable = GL_TRUE; | ||||
| 	cSize = 4; | ||||
| 	cType = GL_UNSIGNED_BYTE; | ||||
| 	vSize = 2; | ||||
| 	vOffset = __glXTypeSize(cType) * cSize; | ||||
| 	size = vOffset + __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       case GL_C4UB_V3F: | ||||
| 	cEnable = GL_TRUE; | ||||
| 	cSize = 4; | ||||
| 	cType = GL_UNSIGNED_BYTE; | ||||
| 	vSize = 3; | ||||
| 	vOffset = __glXTypeSize(vType) * cSize; | ||||
| 	size = vOffset + __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       case GL_C3F_V3F: | ||||
| 	cEnable = GL_TRUE; | ||||
| 	cSize = 3; | ||||
| 	cType = GL_FLOAT; | ||||
| 	vSize = 3; | ||||
| 	vOffset = __glXTypeSize(cType) * cSize; | ||||
| 	size = vOffset + __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       case GL_N3F_V3F: | ||||
| 	nEnable = GL_TRUE; | ||||
| 	vSize = 3; | ||||
| 	vOffset = __glXTypeSize(nType) * nSize; | ||||
| 	size = vOffset + __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       case GL_C4F_N3F_V3F: | ||||
| 	cEnable = GL_TRUE; | ||||
| 	cSize = 4; | ||||
| 	cType = GL_FLOAT; | ||||
| 	nEnable = GL_TRUE; | ||||
| 	nOffset = __glXTypeSize(cType) * cSize; | ||||
| 	vSize = 3; | ||||
| 	vOffset = nOffset + __glXTypeSize(nType) * nSize; | ||||
| 	size = vOffset + __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       case GL_T2F_V3F: | ||||
| 	tEnable = GL_TRUE; | ||||
| 	tSize = 2; | ||||
| 	vSize = 3; | ||||
| 	vOffset = __glXTypeSize(tType) * tSize; | ||||
| 	size = vOffset + __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       case GL_T4F_V4F: | ||||
| 	tEnable = GL_TRUE; | ||||
| 	tSize = 4; | ||||
| 	vSize = 4; | ||||
| 	vOffset = __glXTypeSize(tType) * tSize; | ||||
| 	size = vOffset + __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       case GL_T2F_C4UB_V3F: | ||||
| 	tEnable = GL_TRUE; | ||||
| 	tSize = 2; | ||||
| 	cEnable = GL_TRUE; | ||||
| 	cSize = 4; | ||||
| 	cType = GL_UNSIGNED_BYTE; | ||||
| 	cOffset = __glXTypeSize(tType) * tSize; | ||||
| 	vSize = 3; | ||||
| 	vOffset = cOffset + __glXTypeSize(cType) * cSize; | ||||
| 	size = vOffset + __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       case GL_T2F_C3F_V3F: | ||||
| 	tEnable = GL_TRUE; | ||||
| 	tSize = 2; | ||||
| 	cEnable = GL_TRUE; | ||||
| 	cSize = 3; | ||||
| 	cType = GL_FLOAT; | ||||
| 	cOffset = __glXTypeSize(tType) * tSize; | ||||
| 	vSize = 3; | ||||
| 	vOffset = cOffset + __glXTypeSize(cType) * cSize; | ||||
| 	size = vOffset + __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       case GL_T2F_N3F_V3F: | ||||
| 	tEnable = GL_TRUE; | ||||
| 	tSize = 2; | ||||
| 	nEnable = GL_TRUE; | ||||
| 	nOffset = __glXTypeSize(tType) * tSize; | ||||
| 	vSize = 3; | ||||
| 	vOffset = nOffset + __glXTypeSize(nType) * nSize; | ||||
| 	size = vOffset + __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       case GL_T2F_C4F_N3F_V3F: | ||||
| 	tEnable = GL_TRUE; | ||||
| 	tSize = 2; | ||||
| 	cEnable = GL_TRUE; | ||||
| 	cSize = 4; | ||||
| 	cType = GL_FLOAT; | ||||
| 	cOffset = __glXTypeSize(tType) * tSize; | ||||
| 	nEnable = GL_TRUE; | ||||
| 	nOffset = cOffset + __glXTypeSize(cType) * cSize; | ||||
| 	vSize = 3; | ||||
| 	vOffset = nOffset + __glXTypeSize(nType) * nSize; | ||||
| 	size = vOffset + __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       case GL_T4F_C4F_N3F_V4F: | ||||
| 	tEnable = GL_TRUE; | ||||
| 	tSize = 4; | ||||
| 	cEnable = GL_TRUE; | ||||
| 	cSize = 4; | ||||
| 	cType = GL_FLOAT; | ||||
| 	cOffset = __glXTypeSize(tType) * tSize; | ||||
| 	nEnable = GL_TRUE; | ||||
| 	nOffset = cOffset + __glXTypeSize(cType) * cSize; | ||||
| 	vSize = 4; | ||||
| 	vOffset = nOffset + __glXTypeSize(nType) * nSize; | ||||
| 	size = vOffset + __glXTypeSize(vType) * vSize; | ||||
| 	break; | ||||
|       default: | ||||
| #define NONE  {0, 0, 0} | ||||
| #define F(x)  {GL_FLOAT, x, x * sizeof(GLfloat)} | ||||
| #define UB4   {GL_UNSIGNED_BYTE, 4, 4 * sizeof(GLubyte)} | ||||
|  | ||||
|     /* Each row in this array describes the elements of a particular | ||||
|      * interleaved array mode.  Each column describes, in the order in which | ||||
|      * they appear in the interleaved arrays, one of the four possible types | ||||
|      * of vertex data that can appear in an interleaved array. | ||||
|      */ | ||||
|     struct { | ||||
|         /** | ||||
| 	 * The enum describing the GL type, as would be passed to the | ||||
| 	 * appropriate gl*Pointer function. | ||||
| 	 */ | ||||
| 	GLushort type; | ||||
|  | ||||
|         /** | ||||
| 	 * Number of elements in the subarray, as would be passed (as the | ||||
| 	 * \c size parameter) to the appropriate gl*Pointer function. | ||||
| 	 */ | ||||
|         GLubyte count; | ||||
|         | ||||
|         /** | ||||
| 	 * True size of a single element in the subarray, as would be passed | ||||
| 	 * (as the \c stride parameter) to the appropriate gl*Pointer | ||||
| 	 * function. | ||||
| 	 */ | ||||
|         GLubyte size; | ||||
|     } | ||||
|     static const modes[14][4] = { | ||||
|       /* texture color normal vertex */ | ||||
| 	{NONE,   NONE, NONE,  F(2)}, /* GL_V2F */ | ||||
| 	{NONE,   NONE, NONE,  F(3)}, /* GL_V3F */ | ||||
| 	{NONE,   UB4,  NONE,  F(2)}, /* GL_C4UB_V2F */ | ||||
| 	{NONE,   UB4,  NONE,  F(3)}, /* GL_C4UB_V3F */ | ||||
| 	{NONE,   F(3), NONE,  F(3)}, /* GL_C3F_V3F */ | ||||
| 	{NONE,   NONE, F(3),  F(3)}, /* GL_N3F_V3F */ | ||||
| 	{NONE,   F(4), F(3),  F(3)}, /* GL_C4F_N3F_V3F */ | ||||
| 	{F(2),   NONE, NONE,  F(3)}, /* GL_T2F_V3F */ | ||||
| 	{F(4),   NONE, NONE,  F(4)}, /* GL_T4F_V4F */ | ||||
| 	{F(2),   UB4,  NONE,  F(3)}, /* GL_T2F_C4UB_V3F */ | ||||
| 	{F(2),   F(3), NONE,  F(3)}, /* GL_T2F_C3F_V3F */ | ||||
| 	{F(2),   NONE, F(3),  F(3)}, /* GL_T2F_N3F_V3F */ | ||||
| 	{F(2),   F(4), F(3),  F(3)}, /* GL_T2F_C4F_N3F_V3F */ | ||||
| 	{F(4),   F(4), F(3),  F(4)}, /* GL_T4F_C4F_N3F_V4F */ | ||||
|     }; | ||||
| #undef NONE | ||||
| #undef F | ||||
| #undef UB4 | ||||
|  | ||||
|     GLint trueStride, size; | ||||
|     int offsets[4]; | ||||
|     unsigned i; | ||||
|     const int idx = format - GL_V2F; | ||||
|  | ||||
|     | ||||
|     /* All valid formats are on the range [GL_V2F, GL_V2F+0x0D].  Since idx | ||||
|      * is just the format biased by -GL_V2F, all valid idx values are on the | ||||
|      * range [0, 0x0D]. | ||||
|      */ | ||||
|     if ( (idx < 0) || (idx > 0x0D) ) { | ||||
|         __glXSetError(gc, GL_INVALID_ENUM); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     if ( stride < 0 ) { | ||||
|         __glXSetError(gc, GL_INVALID_VALUE); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     /* If the 'count' for a subarray is non-zero, then the offset of its | ||||
|      * first element is at the currently accumulated 'size'. | ||||
|      */ | ||||
|     size = 0; | ||||
|     for ( i = 0 ; i < 4 ; i++ ) { | ||||
|         offsets[i] = (modes[idx][i].count != 0) ? size : -1; | ||||
|         size += modes[idx][i].size; | ||||
|     } | ||||
|  | ||||
|     trueStride = (stride == 0) ? size : stride; | ||||
|  | ||||
|     __glXArrayDisableAll( state ); | ||||
|  | ||||
|     if (tEnable) { | ||||
|     if ( offsets[0] >= 0 ) { | ||||
| 	__indirect_glEnableClientState(GL_TEXTURE_COORD_ARRAY); | ||||
| 	__indirect_glTexCoordPointer(tSize, tType, trueStride, (const char *)pointer); | ||||
| 	__indirect_glTexCoordPointer( modes[idx][0].count, GL_FLOAT, | ||||
| 				      trueStride,  | ||||
| 				      (const char *) pointer ); | ||||
|     } | ||||
|     if (cEnable) { | ||||
|     if ( offsets[1] >= 0 ) { | ||||
| 	__indirect_glEnableClientState(GL_COLOR_ARRAY); | ||||
| 	__indirect_glColorPointer(cSize, cType, trueStride, (const char *)pointer+cOffset); | ||||
| 	__indirect_glColorPointer( modes[idx][1].count, modes[idx][1].type, | ||||
| 				   trueStride,  | ||||
| 				   (const char *) pointer + offsets[1] ); | ||||
|     } | ||||
|     if (nEnable) { | ||||
|     if ( offsets[2] >= 0 ) { | ||||
| 	__indirect_glEnableClientState(GL_NORMAL_ARRAY); | ||||
| 	__indirect_glNormalPointer(nType, trueStride, (const char *)pointer+nOffset); | ||||
| 	__indirect_glNormalPointer( GL_FLOAT, trueStride, | ||||
| 				    (const char *)pointer + offsets[2] ); | ||||
|     } | ||||
|     __indirect_glEnableClientState(GL_VERTEX_ARRAY); | ||||
|     __indirect_glVertexPointer(vSize, vType, trueStride, (const char *)pointer+vOffset); | ||||
|     __indirect_glVertexPointer( modes[idx][3].count, GL_FLOAT, | ||||
| 				trueStride,  | ||||
| 				(const char *)pointer + offsets[3] ); | ||||
| } | ||||
|   | ||||
| @@ -57,6 +57,9 @@ | ||||
| .INTERMEDIATE: x86/gen_matypes.exe | ||||
| .SUFFIXES: .rc .res | ||||
|  | ||||
| # Set this to the prefix of your build tools, i.e. mingw32- | ||||
| TOOLS_PREFIX = mingw32- | ||||
|  | ||||
| TOP = ../.. | ||||
| GLIDE ?= $(TOP)/glide3 | ||||
| LIBDIR = $(TOP)/lib | ||||
| @@ -70,7 +73,7 @@ endif | ||||
|  | ||||
| LDLIBS = -lgdi32 | ||||
|  | ||||
| CC = mingw32-gcc | ||||
| CC = $(TOOLS_PREFIX)gcc | ||||
| CFLAGS += -DBUILD_GL32 -D_OPENGL32_ | ||||
| CFLAGS += $(INCLUDE_DIRS) | ||||
| CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1 | ||||
| @@ -91,9 +94,11 @@ endif | ||||
| AR = ar | ||||
| ARFLAGS = crus | ||||
|  | ||||
| ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) | ||||
| UNLINK = del $(subst /,\,$(1)) | ||||
| else | ||||
| ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) | ||||
| UNLINK = $(RM) $(1) | ||||
| endif | ||||
| ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),) | ||||
| UNLINK = $(RM) $(1) | ||||
| endif | ||||
|  | ||||
| @@ -142,10 +147,15 @@ RESOURCE = $(GL_RES:.rc=.res) | ||||
| .rc.res: | ||||
| 	windres -o $@ -Irc -Ocoff $< | ||||
|  | ||||
| all: $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP) | ||||
| all: $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP) | ||||
|  | ||||
| $(LIBDIR): | ||||
| 	mkdir -p $(LIBDIR) | ||||
|  | ||||
| $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE) | ||||
| 	dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) --target i386-mingw32 --def $(GL_DEF) $^ $(LDLIBS) | ||||
| 	$(TOOLS_PREFIX)dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) \ | ||||
| 	                       --target i386-mingw32 --def $(GL_DEF) -Wl,-enable-stdcall-fixup \ | ||||
| 	                       $^ $(LDLIBS) | ||||
|  | ||||
| $(X86_OBJECTS): x86/matypes.h | ||||
|  | ||||
| @@ -163,7 +173,7 @@ x86/gen_matypes.exe: x86/gen_matypes.c | ||||
| # with USE_X86_ASM (useful for trace/debug) | ||||
| ifeq (1,1) | ||||
| x86/glapi_x86.o: x86/glapi_x86.S | ||||
| 	$(CC) -o $@ $(CFLAGS) -U__WIN32__ -DSTDCALL_API -c $< | ||||
| 	$(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $< | ||||
| else | ||||
| main/dispatch.o: main/dispatch.c | ||||
| 	$(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $< | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| /* | ||||
|  * Mesa 3-D graphics library | ||||
|  * Version:  6.1 | ||||
|  * Version:  6.4.2 | ||||
|  * | ||||
|  * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved. | ||||
|  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved. | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
| @@ -501,7 +501,7 @@ _ac_import_texcoord( GLcontext *ctx, | ||||
| { | ||||
|    ACcontext *ac = AC_CONTEXT(ctx); | ||||
|  | ||||
|    ASSERT(unit < ctx->Const.MaxTextureCoordUnits); | ||||
|    ASSERT(unit < MAX_TEXTURE_COORD_UNITS); | ||||
|  | ||||
|    /* Can we keep the existing version? | ||||
|     */ | ||||
|   | ||||
| @@ -45,6 +45,7 @@ | ||||
|  | ||||
| #include "driverfuncs.h" | ||||
| #include "swrast/swrast.h" | ||||
| #include "tnl/tnl.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| @@ -222,6 +223,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) | ||||
|    driver->NotifySaveBegin = NULL; | ||||
|    driver->LightingSpaceChange = NULL; | ||||
|    driver->MakeCurrent = NULL; | ||||
|    driver->ProgramStringNotify = _tnl_program_string; | ||||
|  | ||||
|    /* display list */ | ||||
|    driver->NewList = NULL; | ||||
|   | ||||
| @@ -4,7 +4,6 @@ MESA_MODULES = $(TOP)/src/mesa/mesa.a | ||||
|  | ||||
| COMMON_SOURCES = \ | ||||
|         ../../common/driverfuncs.c \ | ||||
|         ../common/mm.c \ | ||||
|         ../common/utils.c \ | ||||
|         ../common/texmem.c \ | ||||
|         ../common/vblank.c \ | ||||
|   | ||||
| @@ -131,9 +131,8 @@ static void __driGarbageCollectDrawables(void *drawHash) | ||||
| 	    __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; | ||||
| 	    dpy = pdp->driScreenPriv->display; | ||||
| 	    if (! (*dri_interface->windowExists)(dpy, draw)) { | ||||
| 		/* Destroy the local drawable data in the hash table, if the | ||||
| 		   drawable no longer exists in the Xserver */ | ||||
| 	        drmHashDelete(drawHash, draw); | ||||
| 		/* Destroy the local drawable data, if the drawable no | ||||
| 		   longer exists in the Xserver */ | ||||
| 		(*pdraw->destroyDrawable)(dpy, pdraw->private); | ||||
| 		_mesa_free(pdraw); | ||||
| 	    } | ||||
| @@ -664,6 +663,7 @@ static void driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate) | ||||
|         (*psp->DriverAPI.DestroyBuffer)(pdp); | ||||
| 	if ((*dri_interface->windowExists)(dpy, pdp->draw)) | ||||
| 	    (void)(*dri_interface->destroyDrawable)(dpy, scrn, pdp->draw); | ||||
| 	drmHashDelete(psp->drawHash, pdp->draw); | ||||
| 	if (pdp->pClipRects) { | ||||
| 	    _mesa_free(pdp->pClipRects); | ||||
| 	    pdp->pClipRects = NULL; | ||||
|   | ||||
| @@ -54,6 +54,7 @@ | ||||
| #include <GL/gl.h> | ||||
| #include "drm.h" | ||||
| #include "drm_sarea.h" | ||||
| #include "xf86drm.h" | ||||
| #include "GL/internal/glcore.h" | ||||
| #include "GL/internal/dri_interface.h" | ||||
|  | ||||
|   | ||||
| @@ -157,8 +157,8 @@ _gl_copy_visual_to_context_mode( __GLcontextModes * mode, | ||||
|     mode->greenMask = config->greenMask; | ||||
|     mode->blueMask = config->blueMask; | ||||
|     mode->alphaMask = config->alphaMask; | ||||
|     mode->rgbBits = config->bufferSize; | ||||
|     mode->indexBits = config->bufferSize; | ||||
|     mode->rgbBits = mode->rgbMode ? config->bufferSize : 0; | ||||
|     mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0; | ||||
|  | ||||
|     mode->accumRedBits = config->accumRedSize; | ||||
|     mode->accumGreenBits = config->accumGreenSize; | ||||
|   | ||||
| @@ -1,60 +0,0 @@ | ||||
| # src/mesa/drivers/dri/gamma/Makefile | ||||
|  | ||||
| TOP = ../../../../.. | ||||
| include $(TOP)/configs/current | ||||
|  | ||||
| # Get rid of this: | ||||
| # | ||||
| DEFINES += -DGLX_DIRECT_RENDERING  | ||||
|  | ||||
| C_SOURCES = \ | ||||
| 	xf86drm.c \ | ||||
| 	xf86drmHash.c \ | ||||
| 	xf86drmRandom.c \ | ||||
| 	xf86drmSL.c \ | ||||
|  | ||||
|  | ||||
|  | ||||
| OBJECTS = $(C_SOURCES:.c=.o)   | ||||
|  | ||||
| INCLUDES = \ | ||||
| 	-I$(TOP)/include \ | ||||
| 	-I$(DRM_SOURCE_PATH)/shared-core \ | ||||
| 	-I$(TOP)/include/GL/internal \ | ||||
| 	-I$(TOP)/src/mesa \ | ||||
| 	-I$(TOP)/src/mesa/main \ | ||||
| 	-I$(TOP)/src/mesa/glapi \ | ||||
| 	-Iimports | ||||
|  | ||||
|  | ||||
| ##### RULES ##### | ||||
|  | ||||
| .c.o: | ||||
| 	$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ | ||||
|  | ||||
|  | ||||
| ##### TARGETS ##### | ||||
|  | ||||
| default: depend dri.a | ||||
|  | ||||
|  | ||||
| # Run 'make dep' to update the dependencies if you change | ||||
| # what's included by any source file. | ||||
| depend: $(C_SOURCES) $(ASM_SOURCES) | ||||
| 	touch depend | ||||
| 	$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) \ | ||||
| 		$(C_SOURCES) $(ASM_SOURCES)  | ||||
|  | ||||
|  | ||||
| dri.a:	$(OBJECTS) | ||||
| 	rm -f $@ | ||||
| 	ar rcv $@ $(OBJECTS) | ||||
| 	ranlib $@ | ||||
|  | ||||
| # Remove .o and backup files | ||||
| clean: | ||||
| 	-rm -f *.o */*.o *~ *.so *.a depend depend.bak | ||||
|  | ||||
| install: | ||||
|  | ||||
| include depend | ||||
| @@ -1,636 +0,0 @@ | ||||
| /** | ||||
|  * \file xf86drm.h  | ||||
|  * OS-independent header for DRM user-level library interface. | ||||
|  * | ||||
|  * \author Rickard E. (Rik) Faith <faith@valinux.com> | ||||
|  */ | ||||
|   | ||||
| /* | ||||
|  * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. | ||||
|  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | ||||
|  * All Rights Reserved. | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice (including the next | ||||
|  * paragraph) shall be included in all copies or substantial portions of the | ||||
|  * Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||
|  * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||||
|  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||||
|  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.26 2003/08/16 19:26:37 dawes Exp $ */ | ||||
|  | ||||
| #ifndef _XF86DRM_H_ | ||||
| #define _XF86DRM_H_ | ||||
|  | ||||
| #include <drm.h> | ||||
|  | ||||
| 				/* Defaults, if nothing set in xf86config */ | ||||
| #define DRM_DEV_UID	 0 | ||||
| #define DRM_DEV_GID	 0 | ||||
| /* Default /dev/dri directory permissions 0755 */ | ||||
| #define DRM_DEV_DIRMODE	 	\ | ||||
| 	(S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) | ||||
| #define DRM_DEV_MODE	 (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) | ||||
|  | ||||
| #define DRM_DIR_NAME  "/dev/dri" | ||||
| #define DRM_DEV_NAME  "%s/card%d" | ||||
| #define DRM_PROC_NAME "/proc/dri/" /* For backward Linux compatibility */ | ||||
|  | ||||
| #define DRM_ERR_NO_DEVICE  (-1001) | ||||
| #define DRM_ERR_NO_ACCESS  (-1002) | ||||
| #define DRM_ERR_NOT_ROOT   (-1003) | ||||
| #define DRM_ERR_INVALID    (-1004) | ||||
| #define DRM_ERR_NO_FD      (-1005) | ||||
|  | ||||
| #define DRM_AGP_NO_HANDLE 0 | ||||
|  | ||||
| typedef unsigned int  drmSize,     *drmSizePtr;	    /**< For mapped regions */ | ||||
| typedef void          *drmAddress, **drmAddressPtr; /**< For mapped regions */ | ||||
|  | ||||
| /** | ||||
|  * Driver version information. | ||||
|  * | ||||
|  * \sa drmGetVersion() and drmSetVersion(). | ||||
|  */ | ||||
| typedef struct _drmVersion { | ||||
|     int     version_major;        /**< Major version */ | ||||
|     int     version_minor;        /**< Minor version */ | ||||
|     int     version_patchlevel;   /**< Patch level */ | ||||
|     int     name_len; 	          /**< Length of name buffer */ | ||||
|     char    *name;	          /**< Name of driver */ | ||||
|     int     date_len;             /**< Length of date buffer */ | ||||
|     char    *date;                /**< User-space buffer to hold date */ | ||||
|     int     desc_len;	          /**< Length of desc buffer */ | ||||
|     char    *desc;                /**< User-space buffer to hold desc */ | ||||
| } drmVersion, *drmVersionPtr; | ||||
|  | ||||
| typedef struct _drmStats { | ||||
|     unsigned long count;	     /**< Number of data */ | ||||
|     struct { | ||||
| 	unsigned long value;	     /**< Value from kernel */ | ||||
| 	const char    *long_format;  /**< Suggested format for long_name */ | ||||
| 	const char    *long_name;    /**< Long name for value */ | ||||
| 	const char    *rate_format;  /**< Suggested format for rate_name */ | ||||
| 	const char    *rate_name;    /**< Short name for value per second */ | ||||
| 	int           isvalue;       /**< True if value (vs. counter) */ | ||||
| 	const char    *mult_names;   /**< Multiplier names (e.g., "KGM") */ | ||||
| 	int           mult;          /**< Multiplier value (e.g., 1024) */ | ||||
| 	int           verbose;       /**< Suggest only in verbose output */ | ||||
|     } data[15]; | ||||
| } drmStatsT; | ||||
|  | ||||
|  | ||||
| 				/* All of these enums *MUST* match with the | ||||
|                                    kernel implementation -- so do *NOT* | ||||
|                                    change them!  (The drmlib implementation | ||||
|                                    will just copy the flags instead of | ||||
|                                    translating them.) */ | ||||
| typedef enum { | ||||
|     DRM_FRAME_BUFFER    = 0,      /**< WC, no caching, no core dump */ | ||||
|     DRM_REGISTERS       = 1,      /**< no caching, no core dump */ | ||||
|     DRM_SHM             = 2,      /**< shared, cached */ | ||||
|     DRM_AGP             = 3,	  /**< AGP/GART */ | ||||
|     DRM_SCATTER_GATHER  = 4	  /**< PCI scatter/gather */ | ||||
| } drmMapType; | ||||
|  | ||||
| typedef enum { | ||||
|     DRM_RESTRICTED      = 0x0001, /**< Cannot be mapped to client-virtual */ | ||||
|     DRM_READ_ONLY       = 0x0002, /**< Read-only in client-virtual */ | ||||
|     DRM_LOCKED          = 0x0004, /**< Physical pages locked */ | ||||
|     DRM_KERNEL          = 0x0008, /**< Kernel requires access */ | ||||
|     DRM_WRITE_COMBINING = 0x0010, /**< Use write-combining, if available */ | ||||
|     DRM_CONTAINS_LOCK   = 0x0020, /**< SHM page that contains lock */ | ||||
|     DRM_REMOVABLE	= 0x0040  /**< Removable mapping */ | ||||
| } drmMapFlags; | ||||
|  | ||||
| /** | ||||
|  * \warning These values *MUST* match drm.h | ||||
|  */ | ||||
| typedef enum { | ||||
|     /** \name Flags for DMA buffer dispatch */ | ||||
|     /*@{*/ | ||||
|     DRM_DMA_BLOCK        = 0x01, /**<  | ||||
| 				  * Block until buffer dispatched. | ||||
| 				  *  | ||||
| 				  * \note the buffer may not yet have been | ||||
| 				  * processed by the hardware -- getting a | ||||
| 				  * hardware lock with the hardware quiescent | ||||
| 				  * will ensure that the buffer has been | ||||
| 				  * processed. | ||||
| 				  */ | ||||
|     DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */ | ||||
|     DRM_DMA_PRIORITY     = 0x04, /**< High priority dispatch */ | ||||
|     /*@}*/ | ||||
|  | ||||
|     /** \name Flags for DMA buffer request */ | ||||
|     /*@{*/ | ||||
|     DRM_DMA_WAIT         = 0x10, /**< Wait for free buffers */ | ||||
|     DRM_DMA_SMALLER_OK   = 0x20, /**< Smaller-than-requested buffers OK */ | ||||
|     DRM_DMA_LARGER_OK    = 0x40  /**< Larger-than-requested buffers OK */ | ||||
|     /*@}*/ | ||||
| } drmDMAFlags; | ||||
|  | ||||
| typedef enum { | ||||
|     DRM_PAGE_ALIGN       = 0x01, | ||||
|     DRM_AGP_BUFFER       = 0x02, | ||||
|     DRM_SG_BUFFER        = 0x04 | ||||
| } drmBufDescFlags; | ||||
|  | ||||
| typedef enum { | ||||
|     DRM_LOCK_READY      = 0x01, /**< Wait until hardware is ready for DMA */ | ||||
|     DRM_LOCK_QUIESCENT  = 0x02, /**< Wait until hardware quiescent */ | ||||
|     DRM_LOCK_FLUSH      = 0x04, /**< Flush this context's DMA queue first */ | ||||
|     DRM_LOCK_FLUSH_ALL  = 0x08, /**< Flush all DMA queues first */ | ||||
| 				/* These *HALT* flags aren't supported yet | ||||
|                                    -- they will be used to support the | ||||
|                                    full-screen DGA-like mode. */ | ||||
|     DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ | ||||
|     DRM_HALT_CUR_QUEUES = 0x20  /**< Halt all current queues */ | ||||
| } drmLockFlags; | ||||
|  | ||||
| typedef enum { | ||||
|     DRM_CONTEXT_PRESERVED = 0x01, /**< This context is preserved and | ||||
| 				     never swapped. */ | ||||
|     DRM_CONTEXT_2DONLY    = 0x02  /**< This context is for 2D rendering only. */ | ||||
| } drm_context_tFlags, *drm_context_tFlagsPtr; | ||||
|  | ||||
| typedef struct _drmBufDesc { | ||||
|     int              count;	  /**< Number of buffers of this size */ | ||||
|     int              size;	  /**< Size in bytes */ | ||||
|     int              low_mark;	  /**< Low water mark */ | ||||
|     int              high_mark;	  /**< High water mark */ | ||||
| } drmBufDesc, *drmBufDescPtr; | ||||
|  | ||||
| typedef struct _drmBufInfo { | ||||
|     int              count;	  /**< Number of buffers described in list */ | ||||
|     drmBufDescPtr    list;	  /**< List of buffer descriptions */ | ||||
| } drmBufInfo, *drmBufInfoPtr; | ||||
|  | ||||
| typedef struct _drmBuf { | ||||
|     int              idx;	  /**< Index into the master buffer list */ | ||||
|     int              total;	  /**< Buffer size */ | ||||
|     int              used;	  /**< Amount of buffer in use (for DMA) */ | ||||
|     drmAddress       address;	  /**< Address */ | ||||
| } drmBuf, *drmBufPtr; | ||||
|  | ||||
| /** | ||||
|  * Buffer mapping information. | ||||
|  * | ||||
|  * Used by drmMapBufs() and drmUnmapBufs() to store information about the | ||||
|  * mapped buffers. | ||||
|  */ | ||||
| typedef struct _drmBufMap { | ||||
|     int              count;	  /**< Number of buffers mapped */ | ||||
|     drmBufPtr        list;	  /**< Buffers */ | ||||
| } drmBufMap, *drmBufMapPtr; | ||||
|  | ||||
| typedef struct _drmLock { | ||||
|     volatile unsigned int lock; | ||||
|     char                      padding[60]; | ||||
|     /* This is big enough for most current (and future?) architectures: | ||||
|        DEC Alpha:              32 bytes | ||||
|        Intel Merced:           ? | ||||
|        Intel P5/PPro/PII/PIII: 32 bytes | ||||
|        Intel StrongARM:        32 bytes | ||||
|        Intel i386/i486:        16 bytes | ||||
|        MIPS:                   32 bytes (?) | ||||
|        Motorola 68k:           16 bytes | ||||
|        Motorola PowerPC:       32 bytes | ||||
|        Sun SPARC:              32 bytes | ||||
|     */ | ||||
| } drmLock, *drmLockPtr; | ||||
|  | ||||
| /** | ||||
|  * Indices here refer to the offset into | ||||
|  * list in drmBufInfo | ||||
|  */ | ||||
| typedef struct _drmDMAReq { | ||||
|     drm_context_t    context;  	  /**< Context handle */ | ||||
|     int           send_count;     /**< Number of buffers to send */ | ||||
|     int           *send_list;     /**< List of handles to buffers */ | ||||
|     int           *send_sizes;    /**< Lengths of data to send, in bytes */ | ||||
|     drmDMAFlags   flags;          /**< Flags */ | ||||
|     int           request_count;  /**< Number of buffers requested */ | ||||
|     int           request_size;	  /**< Desired size of buffers requested */ | ||||
|     int           *request_list;  /**< Buffer information */ | ||||
|     int           *request_sizes; /**< Minimum acceptable sizes */ | ||||
|     int           granted_count;  /**< Number of buffers granted at this size */ | ||||
| } drmDMAReq, *drmDMAReqPtr; | ||||
|  | ||||
| typedef struct _drmRegion { | ||||
|     drm_handle_t     handle; | ||||
|     unsigned int  offset; | ||||
|     drmSize       size; | ||||
|     drmAddress    map; | ||||
| } drmRegion, *drmRegionPtr; | ||||
|  | ||||
| typedef struct _drmTextureRegion { | ||||
|     unsigned char next; | ||||
|     unsigned char prev; | ||||
|     unsigned char in_use; | ||||
|     unsigned char padding;	/**< Explicitly pad this out */ | ||||
|     unsigned int  age; | ||||
| } drmTextureRegion, *drmTextureRegionPtr; | ||||
|  | ||||
|  | ||||
| typedef enum { | ||||
|     DRM_VBLANK_ABSOLUTE = 0x0,	/**< Wait for specific vblank sequence number */ | ||||
|     DRM_VBLANK_RELATIVE = 0x1,	/**< Wait for given number of vblanks */ | ||||
|     DRM_VBLANK_SIGNAL   = 0x40000000	/* Send signal instead of blocking */ | ||||
| } drmVBlankSeqType; | ||||
|  | ||||
| typedef struct _drmVBlankReq { | ||||
| 	drmVBlankSeqType type; | ||||
| 	unsigned int sequence; | ||||
| 	unsigned long signal; | ||||
| } drmVBlankReq, *drmVBlankReqPtr; | ||||
|  | ||||
| typedef struct _drmVBlankReply { | ||||
| 	drmVBlankSeqType type; | ||||
| 	unsigned int sequence; | ||||
| 	long tval_sec; | ||||
| 	long tval_usec; | ||||
| } drmVBlankReply, *drmVBlankReplyPtr; | ||||
|  | ||||
| typedef union _drmVBlank { | ||||
| 	drmVBlankReq request; | ||||
| 	drmVBlankReply reply; | ||||
| } drmVBlank, *drmVBlankPtr; | ||||
|  | ||||
| typedef struct _drmSetVersion { | ||||
| 	int drm_di_major; | ||||
| 	int drm_di_minor; | ||||
| 	int drm_dd_major; | ||||
| 	int drm_dd_minor; | ||||
| } drmSetVersion, *drmSetVersionPtr; | ||||
|  | ||||
|  | ||||
| #define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock) | ||||
|  | ||||
| #define DRM_LOCK_HELD  0x80000000 /**< Hardware lock is held */ | ||||
| #define DRM_LOCK_CONT  0x40000000 /**< Hardware lock is contended */ | ||||
|  | ||||
| #if defined(__GNUC__) && (__GNUC__ >= 2) | ||||
| # if defined(__i386) || defined(__amd64__) | ||||
| 				/* Reflect changes here to drmP.h */ | ||||
| #define DRM_CAS(lock,old,new,__ret)                                    \ | ||||
| 	do {                                                           \ | ||||
|                 int __dummy;	/* Can't mark eax as clobbered */      \ | ||||
| 		__asm__ __volatile__(                                  \ | ||||
| 			"lock ; cmpxchg %4,%1\n\t"                     \ | ||||
|                         "setnz %0"                                     \ | ||||
| 			: "=d" (__ret),                                \ | ||||
|    			  "=m" (__drm_dummy_lock(lock)),               \ | ||||
|                           "=a" (__dummy)                               \ | ||||
| 			: "2" (old),                                   \ | ||||
| 			  "r" (new));                                  \ | ||||
| 	} while (0) | ||||
|  | ||||
| #elif defined(__alpha__) | ||||
|  | ||||
| #define	DRM_CAS(lock, old, new, ret) 		\ | ||||
|  	do {					\ | ||||
|  		int old32;                      \ | ||||
|  		int cur32;			\ | ||||
|  		__asm__ __volatile__(		\ | ||||
|  		"       mb\n"			\ | ||||
|  		"       zap   %4, 0xF0, %0\n"   \ | ||||
|  		"       ldl_l %1, %2\n"		\ | ||||
|  		"       zap   %1, 0xF0, %1\n"   \ | ||||
|                 "       cmpeq %0, %1, %1\n"	\ | ||||
|                 "       beq   %1, 1f\n"		\ | ||||
|  		"       bis   %5, %5, %1\n"	\ | ||||
|                 "       stl_c %1, %2\n"		\ | ||||
|                 "1:     xor   %1, 1, %1\n"	\ | ||||
|                 "       stl   %1, %3"		\ | ||||
|                 : "+r" (old32),                 \ | ||||
| 		  "+&r" (cur32),		\ | ||||
|                    "=m" (__drm_dummy_lock(lock)),\ | ||||
|                    "=m" (ret)			\ | ||||
|  		: "r" (old),			\ | ||||
|  		  "r" (new));			\ | ||||
|  	} while(0) | ||||
|  | ||||
| #elif defined(__sparc__) | ||||
|  | ||||
| #define DRM_CAS(lock,old,new,__ret)				\ | ||||
| do {	register unsigned int __old __asm("o0");		\ | ||||
| 	register unsigned int __new __asm("o1");		\ | ||||
| 	register volatile unsigned int *__lock __asm("o2");	\ | ||||
| 	__old = old;						\ | ||||
| 	__new = new;						\ | ||||
| 	__lock = (volatile unsigned int *)lock;			\ | ||||
| 	__asm__ __volatile__(					\ | ||||
| 		/*"cas [%2], %3, %0"*/				\ | ||||
| 		".word 0xd3e29008\n\t"				\ | ||||
| 		/*"membar #StoreStore | #StoreLoad"*/		\ | ||||
| 		".word 0x8143e00a"				\ | ||||
| 		: "=&r" (__new)					\ | ||||
| 		: "0" (__new),					\ | ||||
| 		  "r" (__lock),					\ | ||||
| 		  "r" (__old)					\ | ||||
| 		: "memory");					\ | ||||
| 	__ret = (__new != __old);				\ | ||||
| } while(0) | ||||
|  | ||||
| #elif defined(__ia64__) | ||||
|  | ||||
| #ifdef __INTEL_COMPILER | ||||
| /* this currently generates bad code (missing stop bits)... */ | ||||
| #include <ia64intrin.h> | ||||
|  | ||||
| #define DRM_CAS(lock,old,new,__ret)					      \ | ||||
| 	do {								      \ | ||||
| 		unsigned long __result, __old = (old) & 0xffffffff;		\ | ||||
| 		__mf();							      	\ | ||||
| 		__result = _InterlockedCompareExchange_acq(&__drm_dummy_lock(lock), (new), __old);\ | ||||
| 		__ret = (__result) != (__old);					\ | ||||
| /*		__ret = (__sync_val_compare_and_swap(&__drm_dummy_lock(lock), \ | ||||
| 						     (old), (new))	      \ | ||||
| 			 != (old));					      */\ | ||||
| 	} while (0) | ||||
|  | ||||
| #else | ||||
| #define DRM_CAS(lock,old,new,__ret)					  \ | ||||
| 	do {								  \ | ||||
| 		unsigned int __result, __old = (old);			  \ | ||||
| 		__asm__ __volatile__(					  \ | ||||
| 			"mf\n"						  \ | ||||
| 			"mov ar.ccv=%2\n"				  \ | ||||
| 			";;\n"						  \ | ||||
| 			"cmpxchg4.acq %0=%1,%3,ar.ccv"			  \ | ||||
| 			: "=r" (__result), "=m" (__drm_dummy_lock(lock))  \ | ||||
| 			: "r" ((unsigned long)__old), "r" (new)			  \ | ||||
| 			: "memory");					  \ | ||||
| 		__ret = (__result) != (__old);				  \ | ||||
| 	} while (0) | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #elif defined(__powerpc__) | ||||
|  | ||||
| #define DRM_CAS(lock,old,new,__ret)			\ | ||||
| 	do {						\ | ||||
| 		__asm__ __volatile__(			\ | ||||
| 			"sync;"				\ | ||||
| 			"0:    lwarx %0,0,%1;"		\ | ||||
| 			"      xor. %0,%3,%0;"		\ | ||||
| 			"      bne 1f;"			\ | ||||
| 			"      stwcx. %2,0,%1;"		\ | ||||
| 			"      bne- 0b;"		\ | ||||
| 			"1:    "			\ | ||||
| 			"sync;"				\ | ||||
| 		: "=&r"(__ret)				\ | ||||
| 		: "r"(lock), "r"(new), "r"(old)		\ | ||||
| 		: "cr0", "memory");			\ | ||||
| 	} while (0) | ||||
|  | ||||
| #endif /* architecture */ | ||||
| #endif /* __GNUC__ >= 2 */ | ||||
|  | ||||
| #ifndef DRM_CAS | ||||
| #define DRM_CAS(lock,old,new,ret) do { ret=1; } while (0) /* FAST LOCK FAILS */ | ||||
| #endif | ||||
|  | ||||
| #if defined(__alpha__) || defined(__powerpc__) | ||||
| #define DRM_CAS_RESULT(_result)		int _result | ||||
| #else | ||||
| #define DRM_CAS_RESULT(_result)		char _result | ||||
| #endif | ||||
|  | ||||
| #define DRM_LIGHT_LOCK(fd,lock,context)                                \ | ||||
| 	do {                                                           \ | ||||
|                 DRM_CAS_RESULT(__ret);                                 \ | ||||
| 		DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret);     \ | ||||
|                 if (__ret) drmGetLock(fd,context,0);                   \ | ||||
|         } while(0) | ||||
|  | ||||
| 				/* This one counts fast locks -- for | ||||
|                                    benchmarking only. */ | ||||
| #define DRM_LIGHT_LOCK_COUNT(fd,lock,context,count)                    \ | ||||
| 	do {                                                           \ | ||||
|                 DRM_CAS_RESULT(__ret);                                 \ | ||||
| 		DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret);     \ | ||||
|                 if (__ret) drmGetLock(fd,context,0);                   \ | ||||
|                 else       ++count;                                    \ | ||||
|         } while(0) | ||||
|  | ||||
| #define DRM_LOCK(fd,lock,context,flags)                                \ | ||||
| 	do {                                                           \ | ||||
| 		if (flags) drmGetLock(fd,context,flags);               \ | ||||
| 		else       DRM_LIGHT_LOCK(fd,lock,context);            \ | ||||
| 	} while(0) | ||||
|  | ||||
| #define DRM_UNLOCK(fd,lock,context)                                    \ | ||||
| 	do {                                                           \ | ||||
|                 DRM_CAS_RESULT(__ret);                                 \ | ||||
| 		DRM_CAS(lock,DRM_LOCK_HELD|context,context,__ret);     \ | ||||
|                 if (__ret) drmUnlock(fd,context);                      \ | ||||
|         } while(0) | ||||
|  | ||||
| 				/* Simple spin locks */ | ||||
| #define DRM_SPINLOCK(spin,val)                                         \ | ||||
| 	do {                                                           \ | ||||
|             DRM_CAS_RESULT(__ret);                                     \ | ||||
| 	    do {                                                       \ | ||||
| 		DRM_CAS(spin,0,val,__ret);                             \ | ||||
| 		if (__ret) while ((spin)->lock);                       \ | ||||
| 	    } while (__ret);                                           \ | ||||
| 	} while(0) | ||||
|  | ||||
| #define DRM_SPINLOCK_TAKE(spin,val)                                    \ | ||||
| 	do {                                                           \ | ||||
|             DRM_CAS_RESULT(__ret);                                     \ | ||||
|             int  cur;                                                  \ | ||||
| 	    do {                                                       \ | ||||
|                 cur = (*spin).lock;                                    \ | ||||
| 		DRM_CAS(spin,cur,val,__ret);                           \ | ||||
| 	    } while (__ret);                                           \ | ||||
| 	} while(0) | ||||
|  | ||||
| #define DRM_SPINLOCK_COUNT(spin,val,count,__ret)                       \ | ||||
| 	do {                                                           \ | ||||
|             int  __i;                                                  \ | ||||
|             __ret = 1;                                                 \ | ||||
|             for (__i = 0; __ret && __i < count; __i++) {               \ | ||||
| 		DRM_CAS(spin,0,val,__ret);                             \ | ||||
| 		if (__ret) for (;__i < count && (spin)->lock; __i++);  \ | ||||
| 	    }                                                          \ | ||||
| 	} while(0) | ||||
|  | ||||
| #define DRM_SPINUNLOCK(spin,val)                                       \ | ||||
| 	do {                                                           \ | ||||
|             DRM_CAS_RESULT(__ret);                                     \ | ||||
|             if ((*spin).lock == val) { /* else server stole lock */    \ | ||||
| 	        do {                                                   \ | ||||
| 		    DRM_CAS(spin,val,0,__ret);                         \ | ||||
| 	        } while (__ret);                                       \ | ||||
|             }                                                          \ | ||||
| 	} while(0) | ||||
|  | ||||
| /* General user-level programmer's API: unprivileged */ | ||||
| extern int           drmAvailable(void); | ||||
| extern int           drmOpen(const char *name, const char *busid); | ||||
| extern int           drmClose(int fd); | ||||
| extern drmVersionPtr drmGetVersion(int fd); | ||||
| extern drmVersionPtr drmGetLibVersion(int fd); | ||||
| extern void          drmFreeVersion(drmVersionPtr); | ||||
| extern int           drmGetMagic(int fd, drm_magic_t * magic); | ||||
| extern char          *drmGetBusid(int fd); | ||||
| extern int           drmGetInterruptFromBusID(int fd, int busnum, int devnum, | ||||
| 					      int funcnum); | ||||
| extern int           drmGetMap(int fd, int idx, drm_handle_t *offset, | ||||
| 			       drmSize *size, drmMapType *type, | ||||
| 			       drmMapFlags *flags, drm_handle_t *handle, | ||||
| 			       int *mtrr); | ||||
| extern int           drmGetClient(int fd, int idx, int *auth, int *pid, | ||||
| 				  int *uid, unsigned long *magic, | ||||
| 				  unsigned long *iocs); | ||||
| extern int           drmGetStats(int fd, drmStatsT *stats); | ||||
| extern int           drmSetInterfaceVersion(int fd, drmSetVersion *version); | ||||
| extern int           drmCommandNone(int fd, unsigned long drmCommandIndex); | ||||
| extern int           drmCommandRead(int fd, unsigned long drmCommandIndex, | ||||
|                                     void *data, unsigned long size); | ||||
| extern int           drmCommandWrite(int fd, unsigned long drmCommandIndex, | ||||
|                                      void *data, unsigned long size); | ||||
| extern int           drmCommandWriteRead(int fd, unsigned long drmCommandIndex, | ||||
|                                          void *data, unsigned long size); | ||||
|  | ||||
| /* General user-level programmer's API: X server (root) only  */ | ||||
| extern void          drmFreeBusid(const char *busid); | ||||
| extern int           drmSetBusid(int fd, const char *busid); | ||||
| extern int           drmAuthMagic(int fd, drm_magic_t magic); | ||||
| extern int           drmAddMap(int fd, | ||||
| 			       drm_handle_t offset, | ||||
| 			       drmSize size, | ||||
| 			       drmMapType type, | ||||
| 			       drmMapFlags flags, | ||||
| 			       drm_handle_t * handle); | ||||
| extern int	     drmRmMap(int fd, drm_handle_t handle); | ||||
| extern int	     drmAddContextPrivateMapping(int fd, drm_context_t ctx_id, | ||||
| 						 drm_handle_t handle); | ||||
|  | ||||
| extern int           drmAddBufs(int fd, int count, int size, | ||||
| 				drmBufDescFlags flags, | ||||
| 				int agp_offset); | ||||
| extern int           drmMarkBufs(int fd, double low, double high); | ||||
| extern int           drmCreateContext(int fd, drm_context_t * handle); | ||||
| extern int           drmSetContextFlags(int fd, drm_context_t context, | ||||
| 					drm_context_tFlags flags); | ||||
| extern int           drmGetContextFlags(int fd, drm_context_t context, | ||||
| 					drm_context_tFlagsPtr flags); | ||||
| extern int           drmAddContextTag(int fd, drm_context_t context, void *tag); | ||||
| extern int           drmDelContextTag(int fd, drm_context_t context); | ||||
| extern void          *drmGetContextTag(int fd, drm_context_t context); | ||||
| extern drm_context_t * drmGetReservedContextList(int fd, int *count); | ||||
| extern void          drmFreeReservedContextList(drm_context_t *); | ||||
| extern int           drmSwitchToContext(int fd, drm_context_t context); | ||||
| extern int           drmDestroyContext(int fd, drm_context_t handle); | ||||
| extern int           drmCreateDrawable(int fd, drm_drawable_t * handle); | ||||
| extern int           drmDestroyDrawable(int fd, drm_drawable_t handle); | ||||
| extern int           drmCtlInstHandler(int fd, int irq); | ||||
| extern int           drmCtlUninstHandler(int fd); | ||||
| extern int           drmInstallSIGIOHandler(int fd, | ||||
| 					    void (*f)(int fd, | ||||
| 						      void *oldctx, | ||||
| 						      void *newctx)); | ||||
| extern int           drmRemoveSIGIOHandler(int fd); | ||||
|  | ||||
| /* General user-level programmer's API: authenticated client and/or X */ | ||||
| extern int           drmMap(int fd, | ||||
| 			    drm_handle_t handle, | ||||
| 			    drmSize size, | ||||
| 			    drmAddressPtr address); | ||||
| extern int           drmUnmap(drmAddress address, drmSize size); | ||||
| extern drmBufInfoPtr drmGetBufInfo(int fd); | ||||
| extern drmBufMapPtr  drmMapBufs(int fd); | ||||
| extern int           drmUnmapBufs(drmBufMapPtr bufs); | ||||
| extern int           drmDMA(int fd, drmDMAReqPtr request); | ||||
| extern int           drmFreeBufs(int fd, int count, int *list); | ||||
| extern int           drmGetLock(int fd, | ||||
| 			        drm_context_t context, | ||||
| 			        drmLockFlags flags); | ||||
| extern int           drmUnlock(int fd, drm_context_t context); | ||||
| extern int           drmFinish(int fd, int context, drmLockFlags flags); | ||||
| extern int	     drmGetContextPrivateMapping(int fd, drm_context_t ctx_id,  | ||||
| 						 drm_handle_t * handle); | ||||
|  | ||||
| /* AGP/GART support: X server (root) only */ | ||||
| extern int           drmAgpAcquire(int fd); | ||||
| extern int           drmAgpRelease(int fd); | ||||
| extern int           drmAgpEnable(int fd, unsigned long mode); | ||||
| extern int           drmAgpAlloc(int fd, unsigned long size, | ||||
| 				 unsigned long type, unsigned long *address, | ||||
| 				 unsigned long *handle); | ||||
| extern int           drmAgpFree(int fd, unsigned long handle); | ||||
| extern int 	     drmAgpBind(int fd, unsigned long handle, | ||||
| 				unsigned long offset); | ||||
| extern int           drmAgpUnbind(int fd, unsigned long handle); | ||||
|  | ||||
| /* AGP/GART info: authenticated client and/or X */ | ||||
| extern int           drmAgpVersionMajor(int fd); | ||||
| extern int           drmAgpVersionMinor(int fd); | ||||
| extern unsigned long drmAgpGetMode(int fd); | ||||
| extern unsigned long drmAgpBase(int fd); /* Physical location */ | ||||
| extern unsigned long drmAgpSize(int fd); /* Bytes */ | ||||
| extern unsigned long drmAgpMemoryUsed(int fd); | ||||
| extern unsigned long drmAgpMemoryAvail(int fd); | ||||
| extern unsigned int  drmAgpVendorId(int fd); | ||||
| extern unsigned int  drmAgpDeviceId(int fd); | ||||
|  | ||||
| /* PCI scatter/gather support: X server (root) only */ | ||||
| extern int           drmScatterGatherAlloc(int fd, unsigned long size, | ||||
| 					   unsigned long *handle); | ||||
| extern int           drmScatterGatherFree(int fd, unsigned long handle); | ||||
|  | ||||
| extern int           drmWaitVBlank(int fd, drmVBlankPtr vbl); | ||||
|  | ||||
| /* Support routines */ | ||||
| extern int           drmError(int err, const char *label); | ||||
| extern void          *drmMalloc(int size); | ||||
| extern void          drmFree(void *pt); | ||||
|  | ||||
| /* Hash table routines */ | ||||
| extern void *drmHashCreate(void); | ||||
| extern int  drmHashDestroy(void *t); | ||||
| extern int  drmHashLookup(void *t, unsigned long key, void **value); | ||||
| extern int  drmHashInsert(void *t, unsigned long key, void *value); | ||||
| extern int  drmHashDelete(void *t, unsigned long key); | ||||
| extern int  drmHashFirst(void *t, unsigned long *key, void **value); | ||||
| extern int  drmHashNext(void *t, unsigned long *key, void **value); | ||||
|  | ||||
| /* PRNG routines */ | ||||
| extern void          *drmRandomCreate(unsigned long seed); | ||||
| extern int           drmRandomDestroy(void *state); | ||||
| extern unsigned long drmRandom(void *state); | ||||
| extern double        drmRandomDouble(void *state); | ||||
|  | ||||
| /* Skip list routines */ | ||||
|  | ||||
| extern void *drmSLCreate(void); | ||||
| extern int  drmSLDestroy(void *l); | ||||
| extern int  drmSLLookup(void *l, unsigned long key, void **value); | ||||
| extern int  drmSLInsert(void *l, unsigned long key, void *value); | ||||
| extern int  drmSLDelete(void *l, unsigned long key); | ||||
| extern int  drmSLNext(void *l, unsigned long *key, void **value); | ||||
| extern int  drmSLFirst(void *l, unsigned long *key, void **value); | ||||
| extern void drmSLDump(void *l); | ||||
| extern int  drmSLLookupNeighbors(void *l, unsigned long key, | ||||
| 				 unsigned long *prev_key, void **prev_value, | ||||
| 				 unsigned long *next_key, void **next_value); | ||||
|  | ||||
| #endif | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,433 +0,0 @@ | ||||
| /* xf86drmHash.c -- Small hash table support for integer -> integer mapping | ||||
|  * Created: Sun Apr 18 09:35:45 1999 by faith@precisioninsight.com | ||||
|  * | ||||
|  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. | ||||
|  * All Rights Reserved. | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice (including the next | ||||
|  * paragraph) shall be included in all copies or substantial portions of the | ||||
|  * Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||
|  * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||||
|  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||||
|  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  * | ||||
|  * Authors: Rickard E. (Rik) Faith <faith@valinux.com> | ||||
|  * | ||||
|  * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.4 2001/03/21 18:08:54 dawes Exp $ | ||||
|  * | ||||
|  * DESCRIPTION | ||||
|  * | ||||
|  * This file contains a straightforward implementation of a fixed-sized | ||||
|  * hash table using self-organizing linked lists [Knuth73, pp. 398-399] for | ||||
|  * collision resolution.  There are two potentially interesting things | ||||
|  * about this implementation: | ||||
|  * | ||||
|  * 1) The table is power-of-two sized.  Prime sized tables are more | ||||
|  * traditional, but do not have a significant advantage over power-of-two | ||||
|  * sized table, especially when double hashing is not used for collision | ||||
|  * resolution. | ||||
|  * | ||||
|  * 2) The hash computation uses a table of random integers [Hanson97, | ||||
|  * pp. 39-41]. | ||||
|  * | ||||
|  * FUTURE ENHANCEMENTS | ||||
|  * | ||||
|  * With a table size of 512, the current implementation is sufficient for a | ||||
|  * few hundred keys.  Since this is well above the expected size of the | ||||
|  * tables for which this implementation was designed, the implementation of | ||||
|  * dynamic hash tables was postponed until the need arises.  A common (and | ||||
|  * naive) approach to dynamic hash table implementation simply creates a | ||||
|  * new hash table when necessary, rehashes all the data into the new table, | ||||
|  * and destroys the old table.  The approach in [Larson88] is superior in | ||||
|  * two ways: 1) only a portion of the table is expanded when needed, | ||||
|  * distributing the expansion cost over several insertions, and 2) portions | ||||
|  * of the table can be locked, enabling a scalable thread-safe | ||||
|  * implementation. | ||||
|  * | ||||
|  * REFERENCES | ||||
|  * | ||||
|  * [Hanson97] David R. Hanson.  C Interfaces and Implementations: | ||||
|  * Techniques for Creating Reusable Software.  Reading, Massachusetts: | ||||
|  * Addison-Wesley, 1997. | ||||
|  * | ||||
|  * [Knuth73] Donald E. Knuth. The Art of Computer Programming.  Volume 3: | ||||
|  * Sorting and Searching.  Reading, Massachusetts: Addison-Wesley, 1973. | ||||
|  * | ||||
|  * [Larson88] Per-Ake Larson. "Dynamic Hash Tables".  CACM 31(4), April | ||||
|  * 1988, pp. 446-457. | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| #define HASH_MAIN 0 | ||||
|  | ||||
| #if HASH_MAIN | ||||
| # include <stdio.h> | ||||
| # include <stdlib.h> | ||||
| #else | ||||
| # include "xf86drm.h" | ||||
| # ifdef XFree86LOADER | ||||
| #  include "xf86.h" | ||||
| #  include "xf86_ansic.h" | ||||
| # else | ||||
| #  include <stdio.h> | ||||
| #  include <stdlib.h> | ||||
| # endif | ||||
| #endif | ||||
|  | ||||
| #define HASH_MAGIC 0xdeadbeef | ||||
| #define HASH_DEBUG 0 | ||||
| #define HASH_SIZE  512		/* Good for about 100 entries */ | ||||
| 				/* If you change this value, you probably | ||||
|                                    have to change the HashHash hashing | ||||
|                                    function! */ | ||||
|  | ||||
| #if HASH_MAIN | ||||
| #define HASH_ALLOC malloc | ||||
| #define HASH_FREE  free | ||||
| #define HASH_RANDOM_DECL | ||||
| #define HASH_RANDOM_INIT(seed)  srandom(seed) | ||||
| #define HASH_RANDOM             random() | ||||
| #else | ||||
| #define HASH_ALLOC drmMalloc | ||||
| #define HASH_FREE  drmFree | ||||
| #define HASH_RANDOM_DECL        void *state | ||||
| #define HASH_RANDOM_INIT(seed)  state = drmRandomCreate(seed) | ||||
| #define HASH_RANDOM             drmRandom(state) | ||||
|  | ||||
| #endif | ||||
|  | ||||
| typedef struct HashBucket { | ||||
|     unsigned long     key; | ||||
|     void              *value; | ||||
|     struct HashBucket *next; | ||||
| } HashBucket, *HashBucketPtr; | ||||
|  | ||||
| typedef struct HashTable { | ||||
|     unsigned long    magic; | ||||
|     unsigned long    entries; | ||||
|     unsigned long    hits;	/* At top of linked list */ | ||||
|     unsigned long    partials;	/* Not at top of linked list */ | ||||
|     unsigned long    misses;	/* Not in table */ | ||||
|     HashBucketPtr    buckets[HASH_SIZE]; | ||||
|     int              p0; | ||||
|     HashBucketPtr    p1; | ||||
| } HashTable, *HashTablePtr; | ||||
|  | ||||
| #if HASH_MAIN | ||||
| extern void *drmHashCreate(void); | ||||
| extern int  drmHashDestroy(void *t); | ||||
| extern int  drmHashLookup(void *t, unsigned long key, unsigned long *value); | ||||
| extern int  drmHashInsert(void *t, unsigned long key, unsigned long value); | ||||
| extern int  drmHashDelete(void *t, unsigned long key); | ||||
| #endif | ||||
|  | ||||
| static unsigned long HashHash(unsigned long key) | ||||
| { | ||||
|     unsigned long        hash = 0; | ||||
|     unsigned long        tmp  = key; | ||||
|     static int           init = 0; | ||||
|     static unsigned long scatter[256]; | ||||
|     int                  i; | ||||
|  | ||||
|     if (!init) { | ||||
| 	HASH_RANDOM_DECL; | ||||
| 	HASH_RANDOM_INIT(37); | ||||
| 	for (i = 0; i < 256; i++) scatter[i] = HASH_RANDOM; | ||||
| 	++init; | ||||
|     } | ||||
|  | ||||
|     while (tmp) { | ||||
| 	hash = (hash << 1) + scatter[tmp & 0xff]; | ||||
| 	tmp >>= 8; | ||||
|     } | ||||
|  | ||||
|     hash %= HASH_SIZE; | ||||
| #if HASH_DEBUG | ||||
|     printf( "Hash(%d) = %d\n", key, hash); | ||||
| #endif | ||||
|     return hash; | ||||
| } | ||||
|  | ||||
| void *drmHashCreate(void) | ||||
| { | ||||
|     HashTablePtr table; | ||||
|     int          i; | ||||
|  | ||||
|     table           = HASH_ALLOC(sizeof(*table)); | ||||
|     if (!table) return NULL; | ||||
|     table->magic    = HASH_MAGIC; | ||||
|     table->entries  = 0; | ||||
|     table->hits     = 0; | ||||
|     table->partials = 0; | ||||
|     table->misses   = 0; | ||||
|  | ||||
|     for (i = 0; i < HASH_SIZE; i++) table->buckets[i] = NULL; | ||||
|     return table; | ||||
| } | ||||
|  | ||||
| int drmHashDestroy(void *t) | ||||
| { | ||||
|     HashTablePtr  table = (HashTablePtr)t; | ||||
|     HashBucketPtr bucket; | ||||
|     HashBucketPtr next; | ||||
|     int           i; | ||||
|  | ||||
|     if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ | ||||
|  | ||||
|     for (i = 0; i < HASH_SIZE; i++) { | ||||
| 	for (bucket = table->buckets[i]; bucket;) { | ||||
| 	    next = bucket->next; | ||||
| 	    HASH_FREE(bucket); | ||||
| 	    bucket = next; | ||||
| 	} | ||||
|     } | ||||
|     HASH_FREE(table); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| /* Find the bucket and organize the list so that this bucket is at the | ||||
|    top. */ | ||||
|  | ||||
| static HashBucketPtr HashFind(HashTablePtr table, | ||||
| 			      unsigned long key, unsigned long *h) | ||||
| { | ||||
|     unsigned long hash = HashHash(key); | ||||
|     HashBucketPtr prev = NULL; | ||||
|     HashBucketPtr bucket; | ||||
|  | ||||
|     if (h) *h = hash; | ||||
|  | ||||
|     for (bucket = table->buckets[hash]; bucket; bucket = bucket->next) { | ||||
| 	if (bucket->key == key) { | ||||
| 	    if (prev) { | ||||
| 				/* Organize */ | ||||
| 		prev->next           = bucket->next; | ||||
| 		bucket->next         = table->buckets[hash]; | ||||
| 		table->buckets[hash] = bucket; | ||||
| 		++table->partials; | ||||
| 	    } else { | ||||
| 		++table->hits; | ||||
| 	    } | ||||
| 	    return bucket; | ||||
| 	} | ||||
| 	prev = bucket; | ||||
|     } | ||||
|     ++table->misses; | ||||
|     return NULL; | ||||
| } | ||||
|  | ||||
| int drmHashLookup(void *t, unsigned long key, void **value) | ||||
| { | ||||
|     HashTablePtr  table = (HashTablePtr)t; | ||||
|     HashBucketPtr bucket; | ||||
|  | ||||
|     if (!table || table->magic != HASH_MAGIC) return -1; /* Bad magic */ | ||||
|  | ||||
|     bucket = HashFind(table, key, NULL); | ||||
|     if (!bucket) return 1;	/* Not found */ | ||||
|     *value = bucket->value; | ||||
|     return 0;			/* Found */ | ||||
| } | ||||
|  | ||||
| int drmHashInsert(void *t, unsigned long key, void *value) | ||||
| { | ||||
|     HashTablePtr  table = (HashTablePtr)t; | ||||
|     HashBucketPtr bucket; | ||||
|     unsigned long hash; | ||||
|  | ||||
|     if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ | ||||
|  | ||||
|     if (HashFind(table, key, &hash)) return 1; /* Already in table */ | ||||
|  | ||||
|     bucket               = HASH_ALLOC(sizeof(*bucket)); | ||||
|     if (!bucket) return -1;	/* Error */ | ||||
|     bucket->key          = key; | ||||
|     bucket->value        = value; | ||||
|     bucket->next         = table->buckets[hash]; | ||||
|     table->buckets[hash] = bucket; | ||||
| #if HASH_DEBUG | ||||
|     printf("Inserted %d at %d/%p\n", key, hash, bucket); | ||||
| #endif | ||||
|     return 0;			/* Added to table */ | ||||
| } | ||||
|  | ||||
| int drmHashDelete(void *t, unsigned long key) | ||||
| { | ||||
|     HashTablePtr  table = (HashTablePtr)t; | ||||
|     unsigned long hash; | ||||
|     HashBucketPtr bucket; | ||||
|  | ||||
|     if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ | ||||
|  | ||||
|     bucket = HashFind(table, key, &hash); | ||||
|  | ||||
|     if (!bucket) return 1;	/* Not found */ | ||||
|  | ||||
|     table->buckets[hash] = bucket->next; | ||||
|     HASH_FREE(bucket); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int drmHashNext(void *t, unsigned long *key, void **value) | ||||
| { | ||||
|     HashTablePtr  table = (HashTablePtr)t; | ||||
|  | ||||
|     for (; table->p0 < HASH_SIZE; | ||||
| 	 ++table->p0, table->p1 = table->buckets[table->p0]) { | ||||
| 	if (table->p1) { | ||||
| 	    *key       = table->p1->key; | ||||
| 	    *value     = table->p1->value; | ||||
| 	    table->p1  = table->p1->next; | ||||
| 	    return 1; | ||||
| 	} | ||||
|     } | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int drmHashFirst(void *t, unsigned long *key, void **value) | ||||
| { | ||||
|     HashTablePtr  table = (HashTablePtr)t; | ||||
|  | ||||
|     if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ | ||||
|  | ||||
|     table->p0 = 0; | ||||
|     table->p1 = table->buckets[0]; | ||||
|     return drmHashNext(table, key, value); | ||||
| } | ||||
|  | ||||
| #if HASH_MAIN | ||||
| #define DIST_LIMIT 10 | ||||
| static int dist[DIST_LIMIT]; | ||||
|  | ||||
| static void clear_dist(void) { | ||||
|     int i; | ||||
|  | ||||
|     for (i = 0; i < DIST_LIMIT; i++) dist[i] = 0; | ||||
| } | ||||
|  | ||||
| static int count_entries(HashBucketPtr bucket) | ||||
| { | ||||
|     int count = 0; | ||||
|  | ||||
|     for (; bucket; bucket = bucket->next) ++count; | ||||
|     return count; | ||||
| } | ||||
|  | ||||
| static void update_dist(int count) | ||||
| { | ||||
|     if (count >= DIST_LIMIT) ++dist[DIST_LIMIT-1]; | ||||
|     else                     ++dist[count]; | ||||
| } | ||||
|  | ||||
| static void compute_dist(HashTablePtr table) | ||||
| { | ||||
|     int           i; | ||||
|     HashBucketPtr bucket; | ||||
|  | ||||
|     printf("Entries = %ld, hits = %ld, partials = %ld, misses = %ld\n", | ||||
| 	   table->entries, table->hits, table->partials, table->misses); | ||||
|     clear_dist(); | ||||
|     for (i = 0; i < HASH_SIZE; i++) { | ||||
| 	bucket = table->buckets[i]; | ||||
| 	update_dist(count_entries(bucket)); | ||||
|     } | ||||
|     for (i = 0; i < DIST_LIMIT; i++) { | ||||
| 	if (i != DIST_LIMIT-1) printf("%5d %10d\n", i, dist[i]); | ||||
| 	else                   printf("other %10d\n", dist[i]); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static void check_table(HashTablePtr table, | ||||
| 			unsigned long key, unsigned long value) | ||||
| { | ||||
|     unsigned long retval  = 0; | ||||
|     int           retcode = drmHashLookup(table, key, &retval); | ||||
|  | ||||
|     switch (retcode) { | ||||
|     case -1: | ||||
| 	printf("Bad magic = 0x%08lx:" | ||||
| 	       " key = %lu, expected = %lu, returned = %lu\n", | ||||
| 	       table->magic, key, value, retval); | ||||
| 	break; | ||||
|     case 1: | ||||
| 	printf("Not found: key = %lu, expected = %lu returned = %lu\n", | ||||
| 	       key, value, retval); | ||||
| 	break; | ||||
|     case 0: | ||||
| 	if (value != retval) | ||||
| 	    printf("Bad value: key = %lu, expected = %lu, returned = %lu\n", | ||||
| 		   key, value, retval); | ||||
| 	break; | ||||
|     default: | ||||
| 	printf("Bad retcode = %d: key = %lu, expected = %lu, returned = %lu\n", | ||||
| 	       retcode, key, value, retval); | ||||
| 	break; | ||||
|     } | ||||
| } | ||||
|  | ||||
| int main(void) | ||||
| { | ||||
|     HashTablePtr table; | ||||
|     int          i; | ||||
|  | ||||
|     printf("\n***** 256 consecutive integers ****\n"); | ||||
|     table = drmHashCreate(); | ||||
|     for (i = 0; i < 256; i++) drmHashInsert(table, i, i); | ||||
|     for (i = 0; i < 256; i++) check_table(table, i, i); | ||||
|     for (i = 256; i >= 0; i--) check_table(table, i, i); | ||||
|     compute_dist(table); | ||||
|     drmHashDestroy(table); | ||||
|  | ||||
|     printf("\n***** 1024 consecutive integers ****\n"); | ||||
|     table = drmHashCreate(); | ||||
|     for (i = 0; i < 1024; i++) drmHashInsert(table, i, i); | ||||
|     for (i = 0; i < 1024; i++) check_table(table, i, i); | ||||
|     for (i = 1024; i >= 0; i--) check_table(table, i, i); | ||||
|     compute_dist(table); | ||||
|     drmHashDestroy(table); | ||||
|  | ||||
|     printf("\n***** 1024 consecutive page addresses (4k pages) ****\n"); | ||||
|     table = drmHashCreate(); | ||||
|     for (i = 0; i < 1024; i++) drmHashInsert(table, i*4096, i); | ||||
|     for (i = 0; i < 1024; i++) check_table(table, i*4096, i); | ||||
|     for (i = 1024; i >= 0; i--) check_table(table, i*4096, i); | ||||
|     compute_dist(table); | ||||
|     drmHashDestroy(table); | ||||
|  | ||||
|     printf("\n***** 1024 random integers ****\n"); | ||||
|     table = drmHashCreate(); | ||||
|     srandom(0xbeefbeef); | ||||
|     for (i = 0; i < 1024; i++) drmHashInsert(table, random(), i); | ||||
|     srandom(0xbeefbeef); | ||||
|     for (i = 0; i < 1024; i++) check_table(table, random(), i); | ||||
|     srandom(0xbeefbeef); | ||||
|     for (i = 0; i < 1024; i++) check_table(table, random(), i); | ||||
|     compute_dist(table); | ||||
|     drmHashDestroy(table); | ||||
|  | ||||
|     printf("\n***** 5000 random integers ****\n"); | ||||
|     table = drmHashCreate(); | ||||
|     srandom(0xbeefbeef); | ||||
|     for (i = 0; i < 5000; i++) drmHashInsert(table, random(), i); | ||||
|     srandom(0xbeefbeef); | ||||
|     for (i = 0; i < 5000; i++) check_table(table, random(), i); | ||||
|     srandom(0xbeefbeef); | ||||
|     for (i = 0; i < 5000; i++) check_table(table, random(), i); | ||||
|     compute_dist(table); | ||||
|     drmHashDestroy(table); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
| #endif | ||||
| @@ -1,217 +0,0 @@ | ||||
| /* xf86drmRandom.c -- "Minimal Standard" PRNG Implementation | ||||
|  * Created: Mon Apr 19 08:28:13 1999 by faith@precisioninsight.com | ||||
|  * | ||||
|  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. | ||||
|  * All Rights Reserved. | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  *  | ||||
|  * The above copyright notice and this permission notice (including the next | ||||
|  * paragraph) shall be included in all copies or substantial portions of the | ||||
|  * Software. | ||||
|  *  | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||
|  * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||||
|  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||||
|  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  *  | ||||
|  * Authors: Rickard E. (Rik) Faith <faith@valinux.com> | ||||
|  * | ||||
|  * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRandom.c,v 1.4 2000/06/17 00:03:34 martin Exp $ | ||||
|  * | ||||
|  * DESCRIPTION | ||||
|  * | ||||
|  * This file contains a simple, straightforward implementation of the Park | ||||
|  * & Miller "Minimal Standard" PRNG [PM88, PMS93], which is a Lehmer | ||||
|  * multiplicative linear congruential generator (MLCG) with a period of | ||||
|  * 2^31-1. | ||||
|  * | ||||
|  * This implementation is intended to provide a reliable, portable PRNG | ||||
|  * that is suitable for testing a hash table implementation and for | ||||
|  * implementing skip lists. | ||||
|  * | ||||
|  * FUTURE ENHANCEMENTS | ||||
|  * | ||||
|  * If initial seeds are not selected randomly, two instances of the PRNG | ||||
|  * can be correlated.  [Knuth81, pp. 32-33] describes a shuffling technique | ||||
|  * that can eliminate this problem. | ||||
|  * | ||||
|  * If PRNGs are used for simulation, the period of the current | ||||
|  * implementation may be too short.  [LE88] discusses methods of combining | ||||
|  * MLCGs to produce much longer periods, and suggests some alternative | ||||
|  * values for A and M.  [LE90 and Sch92] also provide information on | ||||
|  * long-period PRNGs. | ||||
|  * | ||||
|  * REFERENCES | ||||
|  * | ||||
|  * [Knuth81] Donald E. Knuth. The Art of Computer Programming.  Volume 2: | ||||
|  * Seminumerical Algorithms.  Reading, Massachusetts: Addison-Wesley, 1981. | ||||
|  * | ||||
|  * [LE88] Pierre L'Ecuyer. "Efficient and Portable Combined Random Number | ||||
|  * Generators".  CACM 31(6), June 1988, pp. 742-774. | ||||
|  * | ||||
|  * [LE90] Pierre L'Ecuyer. "Random Numbers for Simulation". CACM 33(10, | ||||
|  * October 1990, pp. 85-97. | ||||
|  * | ||||
|  * [PM88] Stephen K. Park and Keith W. Miller. "Random Number Generators: | ||||
|  * Good Ones are Hard to Find". CACM 31(10), October 1988, pp. 1192-1201. | ||||
|  * | ||||
|  * [Sch92] Bruce Schneier. "Pseudo-Ransom Sequence Generator for 32-Bit | ||||
|  * CPUs".  Dr. Dobb's Journal 17(2), February 1992, pp. 34, 37-38, 40. | ||||
|  * | ||||
|  * [PMS93] Stephen K. Park, Keith W. Miller, and Paul K. Stockmeyer.  In | ||||
|  * "Technical Correspondence: Remarks on Choosing and Implementing Random | ||||
|  * Number Generators". CACM 36(7), July 1993, pp. 105-110. | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| #define RANDOM_MAIN 0 | ||||
|  | ||||
| #if RANDOM_MAIN | ||||
| # include <stdio.h> | ||||
| # include <stdlib.h> | ||||
| #else | ||||
| # include "xf86drm.h" | ||||
| # ifdef XFree86LOADER | ||||
| #  include "xf86.h" | ||||
| #  include "xf86_ansic.h" | ||||
| # else | ||||
| #  include <stdio.h> | ||||
| #  include <stdlib.h> | ||||
| # endif | ||||
| #endif | ||||
|  | ||||
| #define RANDOM_MAGIC 0xfeedbeef | ||||
| #define RANDOM_DEBUG 0 | ||||
|  | ||||
| #if RANDOM_MAIN | ||||
| #define RANDOM_ALLOC malloc | ||||
| #define RANDOM_FREE  free | ||||
| #else | ||||
| #define RANDOM_ALLOC drmMalloc | ||||
| #define RANDOM_FREE  drmFree | ||||
| #endif | ||||
|  | ||||
| typedef struct RandomState { | ||||
|     unsigned long magic; | ||||
|     unsigned long a; | ||||
|     unsigned long m; | ||||
|     unsigned long q;		/* m div a */ | ||||
|     unsigned long r;		/* m mod a */ | ||||
|     unsigned long check; | ||||
|     long          seed; | ||||
| } RandomState; | ||||
|  | ||||
| #if RANDOM_MAIN | ||||
| extern void          *drmRandomCreate(unsigned long seed); | ||||
| extern int           drmRandomDestroy(void *state); | ||||
| extern unsigned long drmRandom(void *state); | ||||
| extern double        drmRandomDouble(void *state); | ||||
| #endif | ||||
|  | ||||
| void *drmRandomCreate(unsigned long seed) | ||||
| { | ||||
|     RandomState  *state; | ||||
|  | ||||
|     state           = RANDOM_ALLOC(sizeof(*state)); | ||||
|     if (!state) return NULL; | ||||
|     state->magic    = RANDOM_MAGIC; | ||||
| #if 0 | ||||
| 				/* Park & Miller, October 1988 */ | ||||
|     state->a        = 16807; | ||||
|     state->m        = 2147483647; | ||||
|     state->check    = 1043618065; /* After 10000 iterations */ | ||||
| #else | ||||
| 				/* Park, Miller, and Stockmeyer, July 1993 */ | ||||
|     state->a        = 48271; | ||||
|     state->m        = 2147483647; | ||||
|     state->check    = 399268537; /* After 10000 iterations */ | ||||
| #endif | ||||
|     state->q        = state->m / state->a; | ||||
|     state->r        = state->m % state->a; | ||||
|  | ||||
|     state->seed     = seed; | ||||
| 				/* Check for illegal boundary conditions, | ||||
|                                    and choose closest legal value. */ | ||||
|     if (state->seed <= 0)        state->seed = 1; | ||||
|     if (state->seed >= state->m) state->seed = state->m - 1; | ||||
|  | ||||
|     return state; | ||||
| } | ||||
|  | ||||
| int drmRandomDestroy(void *state) | ||||
| { | ||||
|     RANDOM_FREE(state); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| unsigned long drmRandom(void *state) | ||||
| { | ||||
|     RandomState   *s = (RandomState *)state; | ||||
|     long          hi; | ||||
|     long          lo; | ||||
|  | ||||
|     hi      = s->seed / s->q; | ||||
|     lo      = s->seed % s->q; | ||||
|     s->seed = s->a * lo - s->r * hi; | ||||
|     if (s->seed <= 0) s->seed += s->m; | ||||
|  | ||||
|     return s->seed; | ||||
| } | ||||
|  | ||||
| double drmRandomDouble(void *state) | ||||
| { | ||||
|     RandomState *s = (RandomState *)state; | ||||
|      | ||||
|     return (double)drmRandom(state)/(double)s->m; | ||||
| } | ||||
|  | ||||
| #if RANDOM_MAIN | ||||
| static void check_period(long seed) | ||||
| { | ||||
|     unsigned long count = 0; | ||||
|     unsigned long initial; | ||||
|     void          *state; | ||||
|      | ||||
|     state = drmRandomCreate(seed); | ||||
|     initial = drmRandom(state); | ||||
|     ++count; | ||||
|     while (initial != drmRandom(state)) { | ||||
| 	if (!++count) break; | ||||
|     } | ||||
|     printf("With seed of %10ld, period = %10lu (0x%08lx)\n", | ||||
| 	   seed, count, count); | ||||
|     drmRandomDestroy(state); | ||||
| } | ||||
|  | ||||
| int main(void) | ||||
| { | ||||
|     RandomState   *state; | ||||
|     int           i; | ||||
|     unsigned long rand; | ||||
|  | ||||
|     state = drmRandomCreate(1); | ||||
|     for (i = 0; i < 10000; i++) { | ||||
| 	rand = drmRandom(state); | ||||
|     } | ||||
|     printf("After 10000 iterations: %lu (%lu expected): %s\n", | ||||
| 	   rand, state->check, | ||||
| 	   rand - state->check ? "*INCORRECT*" : "CORRECT"); | ||||
|     drmRandomDestroy(state); | ||||
|  | ||||
|     printf("Checking periods...\n"); | ||||
|     check_period(1); | ||||
|     check_period(2); | ||||
|     check_period(31415926); | ||||
|      | ||||
|     return 0; | ||||
| } | ||||
| #endif | ||||
| @@ -1,488 +0,0 @@ | ||||
| /* xf86drmSL.c -- Skip list support | ||||
|  * Created: Mon May 10 09:28:13 1999 by faith@precisioninsight.com | ||||
|  * | ||||
|  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. | ||||
|  * All Rights Reserved. | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  *  | ||||
|  * The above copyright notice and this permission notice (including the next | ||||
|  * paragraph) shall be included in all copies or substantial portions of the | ||||
|  * Software. | ||||
|  *  | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||
|  * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||||
|  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||||
|  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  *  | ||||
|  * Authors: Rickard E. (Rik) Faith <faith@valinux.com> | ||||
|  * | ||||
|  * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSL.c,v 1.3 2000/06/17 00:03:34 martin Exp $ | ||||
|  * | ||||
|  * DESCRIPTION | ||||
|  * | ||||
|  * This file contains a straightforward skip list implementation.n | ||||
|  * | ||||
|  * FUTURE ENHANCEMENTS | ||||
|  * | ||||
|  * REFERENCES | ||||
|  * | ||||
|  * [Pugh90] William Pugh.  Skip Lists: A Probabilistic Alternative to | ||||
|  * Balanced Trees. CACM 33(6), June 1990, pp. 668-676. | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| #define SL_MAIN 0 | ||||
|  | ||||
| #if SL_MAIN | ||||
| # include <stdio.h> | ||||
| # include <stdlib.h> | ||||
| #  include <sys/time.h> | ||||
| #else | ||||
| # include "xf86drm.h" | ||||
| # ifdef XFree86LOADER | ||||
| #  include "xf86.h" | ||||
| #  include "xf86_ansic.h" | ||||
| # else | ||||
| #  include <stdio.h> | ||||
| #  include <stdlib.h> | ||||
| # endif | ||||
| #endif | ||||
|  | ||||
| #define SL_LIST_MAGIC  0xfacade00LU | ||||
| #define SL_ENTRY_MAGIC 0x00fab1edLU | ||||
| #define SL_FREED_MAGIC 0xdecea5edLU | ||||
| #define SL_MAX_LEVEL   16 | ||||
| #define SL_DEBUG       0 | ||||
| #define SL_RANDOM_SEED 0xc01055a1LU | ||||
|  | ||||
| #if SL_MAIN | ||||
| #define SL_ALLOC malloc | ||||
| #define SL_FREE  free | ||||
| #define SL_RANDOM_DECL        static int state = 0; | ||||
| #define SL_RANDOM_INIT(seed)  if (!state) { srandom(seed); ++state; } | ||||
| #define SL_RANDOM             random() | ||||
| #else | ||||
| #define SL_ALLOC drmMalloc | ||||
| #define SL_FREE  drmFree | ||||
| #define SL_RANDOM_DECL        static void *state = NULL | ||||
| #define SL_RANDOM_INIT(seed)  if (!state) state = drmRandomCreate(seed) | ||||
| #define SL_RANDOM             drmRandom(state) | ||||
|  | ||||
| #endif | ||||
|  | ||||
| typedef struct SLEntry { | ||||
|     unsigned long     magic;	   /* SL_ENTRY_MAGIC */ | ||||
|     unsigned long     key; | ||||
|     void              *value; | ||||
|     int               levels; | ||||
|     struct SLEntry    *forward[1]; /* variable sized array */ | ||||
| } SLEntry, *SLEntryPtr; | ||||
|  | ||||
| typedef struct SkipList { | ||||
|     unsigned long    magic;	/* SL_LIST_MAGIC */ | ||||
|     int              level; | ||||
|     int              count; | ||||
|     SLEntryPtr       head; | ||||
|     SLEntryPtr       p0;	/* Position for iteration */ | ||||
| } SkipList, *SkipListPtr; | ||||
|  | ||||
| #if SL_MAIN | ||||
| extern void *drmSLCreate(void); | ||||
| extern int  drmSLDestroy(void *l); | ||||
| extern int  drmSLLookup(void *l, unsigned long key, void **value); | ||||
| extern int  drmSLInsert(void *l, unsigned long key, void *value); | ||||
| extern int  drmSLDelete(void *l, unsigned long key); | ||||
| extern int  drmSLNext(void *l, unsigned long *key, void **value); | ||||
| extern int  drmSLFirst(void *l, unsigned long *key, void **value); | ||||
| extern void drmSLDump(void *l); | ||||
| extern int  drmSLLookupNeighbors(void *l, unsigned long key, | ||||
| 				 unsigned long *prev_key, void **prev_value, | ||||
| 				 unsigned long *next_key, void **next_value); | ||||
| #endif | ||||
|  | ||||
| static SLEntryPtr SLCreateEntry(int max_level, unsigned long key, void *value) | ||||
| { | ||||
|     SLEntryPtr entry; | ||||
|      | ||||
|     if (max_level < 0 || max_level > SL_MAX_LEVEL) max_level = SL_MAX_LEVEL; | ||||
|  | ||||
|     entry         = SL_ALLOC(sizeof(*entry) | ||||
| 			     + (max_level + 1) * sizeof(entry->forward[0])); | ||||
|     if (!entry) return NULL; | ||||
|     entry->magic  = SL_ENTRY_MAGIC; | ||||
|     entry->key    = key; | ||||
|     entry->value  = value; | ||||
|     entry->levels = max_level + 1; | ||||
|  | ||||
|     return entry; | ||||
| } | ||||
|  | ||||
| static int SLRandomLevel(void) | ||||
| { | ||||
|     int level = 1; | ||||
|     SL_RANDOM_DECL; | ||||
|  | ||||
|     SL_RANDOM_INIT(SL_RANDOM_SEED); | ||||
|      | ||||
|     while ((SL_RANDOM & 0x01) && level < SL_MAX_LEVEL) ++level; | ||||
|     return level; | ||||
| } | ||||
|  | ||||
| void *drmSLCreate(void) | ||||
| { | ||||
|     SkipListPtr  list; | ||||
|     int          i; | ||||
|  | ||||
|     list           = SL_ALLOC(sizeof(*list)); | ||||
|     if (!list) return NULL; | ||||
|     list->magic    = SL_LIST_MAGIC; | ||||
|     list->level    = 0; | ||||
|     list->head     = SLCreateEntry(SL_MAX_LEVEL, 0, NULL); | ||||
|     list->count    = 0; | ||||
|  | ||||
|     for (i = 0; i <= SL_MAX_LEVEL; i++) list->head->forward[i] = NULL; | ||||
|      | ||||
|     return list; | ||||
| } | ||||
|  | ||||
| int drmSLDestroy(void *l) | ||||
| { | ||||
|     SkipListPtr   list  = (SkipListPtr)l; | ||||
|     SLEntryPtr    entry; | ||||
|     SLEntryPtr    next; | ||||
|  | ||||
|     if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ | ||||
|  | ||||
|     for (entry = list->head; entry; entry = next) { | ||||
| 	if (entry->magic != SL_ENTRY_MAGIC) return -1; /* Bad magic */ | ||||
| 	next         = entry->forward[0]; | ||||
| 	entry->magic = SL_FREED_MAGIC; | ||||
| 	SL_FREE(entry); | ||||
|     } | ||||
|  | ||||
|     list->magic = SL_FREED_MAGIC; | ||||
|     SL_FREE(list); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| static SLEntryPtr SLLocate(void *l, unsigned long key, SLEntryPtr *update) | ||||
| { | ||||
|     SkipListPtr   list  = (SkipListPtr)l; | ||||
|     SLEntryPtr    entry; | ||||
|     int           i; | ||||
|  | ||||
|     if (list->magic != SL_LIST_MAGIC) return NULL; | ||||
|  | ||||
|     for (i = list->level, entry = list->head; i >= 0; i--) { | ||||
| 	while (entry->forward[i] && entry->forward[i]->key < key) | ||||
| 	    entry = entry->forward[i]; | ||||
| 	update[i] = entry; | ||||
|     } | ||||
|  | ||||
|     return entry->forward[0]; | ||||
| } | ||||
|  | ||||
| int drmSLInsert(void *l, unsigned long key, void *value) | ||||
| { | ||||
|     SkipListPtr   list  = (SkipListPtr)l; | ||||
|     SLEntryPtr    entry; | ||||
|     SLEntryPtr    update[SL_MAX_LEVEL + 1]; | ||||
|     int           level; | ||||
|     int           i; | ||||
|  | ||||
|     if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ | ||||
|  | ||||
|     entry = SLLocate(list, key, update); | ||||
|  | ||||
|     if (entry && entry->key == key) return 1; /* Already in list */ | ||||
|  | ||||
|  | ||||
|     level = SLRandomLevel(); | ||||
|     if (level > list->level) { | ||||
| 	level = ++list->level; | ||||
| 	update[level] = list->head; | ||||
|     } | ||||
|  | ||||
|     entry = SLCreateEntry(level, key, value); | ||||
|  | ||||
| 				/* Fix up forward pointers */ | ||||
|     for (i = 0; i <= level; i++) { | ||||
| 	entry->forward[i]     = update[i]->forward[i]; | ||||
| 	update[i]->forward[i] = entry; | ||||
|     } | ||||
|  | ||||
|     ++list->count; | ||||
|     return 0;			/* Added to table */ | ||||
| } | ||||
|  | ||||
| int drmSLDelete(void *l, unsigned long key) | ||||
| { | ||||
|     SkipListPtr   list = (SkipListPtr)l; | ||||
|     SLEntryPtr    update[SL_MAX_LEVEL + 1]; | ||||
|     SLEntryPtr    entry; | ||||
|     int           i; | ||||
|  | ||||
|     if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ | ||||
|  | ||||
|     entry = SLLocate(list, key, update); | ||||
|  | ||||
|     if (!entry || entry->key != key) return 1; /* Not found */ | ||||
|  | ||||
| 				/* Fix up forward pointers */ | ||||
|     for (i = 0; i <= list->level; i++) { | ||||
| 	if (update[i]->forward[i] == entry) | ||||
| 	    update[i]->forward[i] = entry->forward[i]; | ||||
|     } | ||||
|  | ||||
|     entry->magic = SL_FREED_MAGIC; | ||||
|     SL_FREE(entry); | ||||
|  | ||||
|     while (list->level && !list->head->forward[list->level]) --list->level; | ||||
|     --list->count; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int drmSLLookup(void *l, unsigned long key, void **value) | ||||
| { | ||||
|     SkipListPtr   list = (SkipListPtr)l; | ||||
|     SLEntryPtr    update[SL_MAX_LEVEL + 1]; | ||||
|     SLEntryPtr    entry; | ||||
|  | ||||
|     entry = SLLocate(list, key, update); | ||||
|  | ||||
|     if (entry && entry->key == key) { | ||||
| 	*value = entry; | ||||
| 	return 0; | ||||
|     } | ||||
|     *value = NULL; | ||||
|     return -1; | ||||
| } | ||||
|  | ||||
| int drmSLLookupNeighbors(void *l, unsigned long key, | ||||
| 			 unsigned long *prev_key, void **prev_value, | ||||
| 			 unsigned long *next_key, void **next_value) | ||||
| { | ||||
|     SkipListPtr   list = (SkipListPtr)l; | ||||
|     SLEntryPtr    update[SL_MAX_LEVEL + 1]; | ||||
|     SLEntryPtr    entry; | ||||
|     int           retcode = 0; | ||||
|  | ||||
|     entry = SLLocate(list, key, update); | ||||
|  | ||||
|     *prev_key   = *next_key   = key; | ||||
|     *prev_value = *next_value = NULL; | ||||
| 	 | ||||
|     if (update[0]) { | ||||
| 	*prev_key   = update[0]->key; | ||||
| 	*prev_value = update[0]->value; | ||||
| 	++retcode; | ||||
| 	if (update[0]->forward[0]) { | ||||
| 	    *next_key   = update[0]->forward[0]->key; | ||||
| 	    *next_value = update[0]->forward[0]->value; | ||||
| 	    ++retcode; | ||||
| 	} | ||||
|     } | ||||
|     return retcode; | ||||
| } | ||||
|  | ||||
| int drmSLNext(void *l, unsigned long *key, void **value) | ||||
| { | ||||
|     SkipListPtr   list = (SkipListPtr)l; | ||||
|     SLEntryPtr    entry; | ||||
|      | ||||
|     if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ | ||||
|  | ||||
|     entry    = list->p0; | ||||
|  | ||||
|     if (entry) { | ||||
| 	list->p0 = entry->forward[0]; | ||||
| 	*key     = entry->key; | ||||
| 	*value   = entry->value; | ||||
| 	return 1; | ||||
|     } | ||||
|     list->p0 = NULL; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int drmSLFirst(void *l, unsigned long *key, void **value) | ||||
| { | ||||
|     SkipListPtr   list = (SkipListPtr)l; | ||||
|      | ||||
|     if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ | ||||
|      | ||||
|     list->p0 = list->head->forward[0]; | ||||
|     return drmSLNext(list, key, value); | ||||
| } | ||||
|  | ||||
| /* Dump internal data structures for debugging. */ | ||||
| void drmSLDump(void *l) | ||||
| { | ||||
|     SkipListPtr   list = (SkipListPtr)l; | ||||
|     SLEntryPtr    entry; | ||||
|     int           i; | ||||
|      | ||||
|     if (list->magic != SL_LIST_MAGIC) { | ||||
| 	printf("Bad magic: 0x%08lx (expected 0x%08lx)\n", | ||||
| 	       list->magic, SL_LIST_MAGIC); | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     printf("Level = %d, count = %d\n", list->level, list->count); | ||||
|     for (entry = list->head; entry; entry = entry->forward[0]) { | ||||
| 	if (entry->magic != SL_ENTRY_MAGIC) { | ||||
| 	    printf("Bad magic: 0x%08lx (expected 0x%08lx)\n", | ||||
| 		   list->magic, SL_ENTRY_MAGIC); | ||||
| 	} | ||||
| 	printf("\nEntry %p <0x%08lx, %p> has %2d levels\n", | ||||
| 	       entry, entry->key, entry->value, entry->levels); | ||||
| 	for (i = 0; i < entry->levels; i++) { | ||||
| 	    if (entry->forward[i]) { | ||||
| 		printf("   %2d: %p <0x%08lx, %p>\n", | ||||
| 		       i, | ||||
| 		       entry->forward[i], | ||||
| 		       entry->forward[i]->key, | ||||
| 		       entry->forward[i]->value); | ||||
| 	    } else { | ||||
| 		printf("   %2d: %p\n", i, entry->forward[i]); | ||||
| 	    } | ||||
| 	} | ||||
|     } | ||||
| } | ||||
|  | ||||
| #if SL_MAIN | ||||
| static void print(SkipListPtr list) | ||||
| { | ||||
|     unsigned long key; | ||||
|     void          *value; | ||||
|      | ||||
|     if (drmSLFirst(list, &key, &value)) { | ||||
| 	do { | ||||
| 	    printf("key = %5lu, value = %p\n", key, value); | ||||
| 	} while (drmSLNext(list, &key, &value)); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static double do_time(int size, int iter) | ||||
| { | ||||
|     SkipListPtr    list; | ||||
|     int            i, j; | ||||
|     unsigned long  keys[1000000]; | ||||
|     unsigned long  previous; | ||||
|     unsigned long  key; | ||||
|     void           *value; | ||||
|     struct timeval start, stop; | ||||
|     double         usec; | ||||
|     SL_RANDOM_DECL; | ||||
|  | ||||
|     SL_RANDOM_INIT(12345); | ||||
|      | ||||
|     list = drmSLCreate(); | ||||
|  | ||||
|     for (i = 0; i < size; i++) { | ||||
| 	keys[i] = SL_RANDOM; | ||||
| 	drmSLInsert(list, keys[i], NULL); | ||||
|     } | ||||
|  | ||||
|     previous = 0; | ||||
|     if (drmSLFirst(list, &key, &value)) { | ||||
| 	do { | ||||
| 	    if (key <= previous) { | ||||
| 		printf( "%lu !< %lu\n", previous, key); | ||||
| 	    } | ||||
| 	    previous = key; | ||||
| 	} while (drmSLNext(list, &key, &value)); | ||||
|     } | ||||
|      | ||||
|     gettimeofday(&start, NULL); | ||||
|     for (j = 0; j < iter; j++) { | ||||
| 	for (i = 0; i < size; i++) { | ||||
| 	    if (drmSLLookup(list, keys[i], &value)) | ||||
| 		printf("Error %lu %d\n", keys[i], i); | ||||
| 	} | ||||
|     } | ||||
|     gettimeofday(&stop, NULL); | ||||
|      | ||||
|     usec = (double)(stop.tv_sec * 1000000 + stop.tv_usec | ||||
| 		    - start.tv_sec * 1000000 - start.tv_usec) / (size * iter); | ||||
|      | ||||
|     printf("%0.2f microseconds for list length %d\n", usec, size); | ||||
|  | ||||
|     drmSLDestroy(list); | ||||
|      | ||||
|     return usec; | ||||
| } | ||||
|  | ||||
| static void print_neighbors(void *list, unsigned long key) | ||||
| { | ||||
|     unsigned long prev_key = 0; | ||||
|     unsigned long next_key = 0; | ||||
|     void          *prev_value; | ||||
|     void          *next_value; | ||||
|     int           retval; | ||||
|  | ||||
|     retval = drmSLLookupNeighbors(list, key, | ||||
| 				  &prev_key, &prev_value, | ||||
| 				  &next_key, &next_value); | ||||
|     printf("Neighbors of %5lu: %d %5lu %5lu\n", | ||||
| 	   key, retval, prev_key, next_key); | ||||
| } | ||||
|  | ||||
| int main(void) | ||||
| { | ||||
|     SkipListPtr    list; | ||||
|     double         usec, usec2, usec3, usec4; | ||||
|  | ||||
|     list = drmSLCreate(); | ||||
|     printf( "list at %p\n", list); | ||||
|  | ||||
|     print(list); | ||||
|     printf("\n==============================\n\n"); | ||||
|  | ||||
|     drmSLInsert(list, 123, NULL); | ||||
|     drmSLInsert(list, 213, NULL); | ||||
|     drmSLInsert(list, 50, NULL); | ||||
|     print(list); | ||||
|     printf("\n==============================\n\n"); | ||||
|      | ||||
|     print_neighbors(list, 0); | ||||
|     print_neighbors(list, 50); | ||||
|     print_neighbors(list, 51); | ||||
|     print_neighbors(list, 123); | ||||
|     print_neighbors(list, 200); | ||||
|     print_neighbors(list, 213); | ||||
|     print_neighbors(list, 256); | ||||
|     printf("\n==============================\n\n");     | ||||
|      | ||||
|     drmSLDelete(list, 50); | ||||
|     print(list); | ||||
|     printf("\n==============================\n\n"); | ||||
|  | ||||
|     drmSLDump(list); | ||||
|     drmSLDestroy(list); | ||||
|     printf("\n==============================\n\n"); | ||||
|  | ||||
|     usec  = do_time(100, 10000); | ||||
|     usec2 = do_time(1000, 500); | ||||
|     printf("Table size increased by %0.2f, search time increased by %0.2f\n", | ||||
| 	   1000.0/100.0, usec2 / usec); | ||||
|      | ||||
|     usec3 = do_time(10000, 50); | ||||
|     printf("Table size increased by %0.2f, search time increased by %0.2f\n", | ||||
| 	   10000.0/100.0, usec3 / usec); | ||||
|      | ||||
|     usec4 = do_time(100000, 4); | ||||
|     printf("Table size increased by %0.2f, search time increased by %0.2f\n", | ||||
| 	   100000.0/100.0, usec4 / usec); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
| #endif | ||||
| @@ -157,9 +157,9 @@ static GLuint get_result_vector( struct i915_fragment_program *p, | ||||
|    switch (inst->DstReg.File) { | ||||
|    case PROGRAM_OUTPUT: | ||||
|       switch (inst->DstReg.Index) { | ||||
|       case 0:  | ||||
|       case FRAG_OUTPUT_COLR:  | ||||
| 	 return UREG(REG_TYPE_OC, 0); | ||||
|       case 1:  | ||||
|       case FRAG_OUTPUT_DEPR:  | ||||
| 	 p->depth_written = 1; | ||||
| 	 return UREG(REG_TYPE_OD, 0); | ||||
|       default:  | ||||
|   | ||||
| @@ -206,6 +206,7 @@ static const struct tnl_pipeline_stage *intel_pipeline[] = { | ||||
|    &_tnl_texgen_stage, | ||||
|    &_tnl_texture_transform_stage, | ||||
|    &_tnl_point_attenuation_stage, | ||||
|    &_tnl_arb_vertex_program_stage, | ||||
|    &_tnl_vertex_program_stage, | ||||
| #if 1 | ||||
|    &_intel_render_stage,     /* ADD: unclipped rastersetup-to-dma */ | ||||
|   | ||||
| @@ -79,7 +79,7 @@ static const struct dri_debug_control debug_control[] = | ||||
|     { NULL,    0 } | ||||
| }; | ||||
|  | ||||
| static const struct dri_extension card_extensions[] = | ||||
| const struct dri_extension card_extensions[] = | ||||
| { | ||||
|     { "GL_ARB_multisample",                GL_ARB_multisample_functions }, | ||||
|     { "GL_ARB_multitexture",               NULL }, | ||||
|   | ||||
| @@ -39,7 +39,7 @@ | ||||
| #include "utils.h" | ||||
| #include "framebuffer.h" | ||||
|  | ||||
| #define DRIVER_DATE	"20030502" | ||||
| #define DRIVER_DATE	"20051019" | ||||
|  | ||||
| /* Return the current color buffer size. | ||||
|  */ | ||||
|   | ||||
| @@ -67,6 +67,7 @@ static const GLuint __driNConfigOptions = 3; | ||||
| static const GLuint __driNConfigOptions = 2; | ||||
| #endif | ||||
|  | ||||
| extern const struct dri_extension card_extensions[]; | ||||
|  | ||||
| static __GLcontextModes * fill_in_modes( __GLcontextModes * modes, | ||||
| 					 unsigned pixel_bits,  | ||||
| @@ -536,6 +537,16 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc | ||||
| 					 16, | ||||
| 					 0, | ||||
| 					 1); | ||||
|  | ||||
|       /* Calling driInitExtensions here, with a NULL context pointer, does not actually | ||||
|        * enable the extensions.  It just makes sure that all the dispatch offsets for all | ||||
|        * the extensions that *might* be enables are known.  This is needed because the | ||||
|        * dispatch offsets need to be known when _mesa_context_create is called, but we can't | ||||
|        * enable the extensions until we have a context pointer. | ||||
|        * | ||||
|        * Hello chicken.  Hello egg.  How are you two today? | ||||
|        */ | ||||
|       driInitExtensions( NULL, card_extensions, GL_FALSE ); | ||||
|    } | ||||
|  | ||||
|    return (void *) psp; | ||||
|   | ||||
| @@ -370,6 +370,7 @@ static const struct tnl_pipeline_stage *mga_pipeline[] = { | ||||
|    &_tnl_fog_coordinate_stage, | ||||
|    &_tnl_texgen_stage,  | ||||
|    &_tnl_texture_transform_stage,  | ||||
|    &_tnl_arb_vertex_program_stage, | ||||
|    &_tnl_vertex_program_stage, | ||||
|  | ||||
| 				/* REMOVE: point attenuation stage */ | ||||
|   | ||||
| @@ -198,11 +198,19 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) | ||||
|    r128Screen->depthPitch	= r128DRIPriv->depthPitch; | ||||
|    r128Screen->spanOffset	= r128DRIPriv->spanOffset; | ||||
|  | ||||
|    if ( r128DRIPriv->textureSize == 0 ) { | ||||
|       r128Screen->texOffset[R128_LOCAL_TEX_HEAP] = | ||||
| 	 r128DRIPriv->agpTexOffset + R128_AGP_TEX_OFFSET; | ||||
|       r128Screen->texSize[R128_LOCAL_TEX_HEAP] = r128DRIPriv->agpTexMapSize; | ||||
|       r128Screen->logTexGranularity[R128_LOCAL_TEX_HEAP] = | ||||
| 	 r128DRIPriv->log2AGPTexGran; | ||||
|    } else { | ||||
|       r128Screen->texOffset[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureOffset; | ||||
|       r128Screen->texSize[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureSize; | ||||
|       r128Screen->logTexGranularity[R128_LOCAL_TEX_HEAP] = r128DRIPriv->log2TexGran; | ||||
|    } | ||||
|  | ||||
|    if ( r128Screen->IsPCI ) { | ||||
|    if ( !r128Screen->agpTextures.map || r128DRIPriv->textureSize == 0 ) { | ||||
|       r128Screen->numTexHeaps = R128_NR_TEX_HEAPS - 1; | ||||
|       r128Screen->texOffset[R128_AGP_TEX_HEAP] = 0; | ||||
|       r128Screen->texSize[R128_AGP_TEX_HEAP] = 0; | ||||
|   | ||||
| @@ -193,6 +193,7 @@ static const struct tnl_pipeline_stage *r200_pipeline[] = { | ||||
|    &_tnl_fog_coordinate_stage, | ||||
|    &_tnl_texgen_stage, | ||||
|    &_tnl_texture_transform_stage, | ||||
|    &_tnl_arb_vertex_program_stage, | ||||
|    &_tnl_vertex_program_stage, | ||||
|  | ||||
|    /* Try again to go to tcl?  | ||||
|   | ||||
| @@ -84,7 +84,7 @@ DRI_CONF_BEGIN | ||||
|         DRI_CONF_NO_RAST(false) | ||||
|     DRI_CONF_SECTION_END | ||||
|     DRI_CONF_SECTION_SOFTWARE | ||||
|         DRI_CONF_ARB_VERTEX_PROGRAM(true) | ||||
|         DRI_CONF_ARB_VERTEX_PROGRAM(false) | ||||
|         DRI_CONF_NV_VERTEX_PROGRAM(false) | ||||
|     DRI_CONF_SECTION_END | ||||
| DRI_CONF_END; | ||||
| @@ -445,13 +445,20 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) | ||||
|    screen->depthOffset	= dri_priv->depthOffset; | ||||
|    screen->depthPitch	= dri_priv->depthPitch; | ||||
|  | ||||
|    if ( dri_priv->textureSize == 0 ) { | ||||
|       screen->texOffset[RADEON_LOCAL_TEX_HEAP] = screen->gart_texture_offset; | ||||
|       screen->texSize[RADEON_GART_TEX_HEAP] = dri_priv->gartTexMapSize; | ||||
|       screen->logTexGranularity[RADEON_GART_TEX_HEAP] = | ||||
| 	 dri_priv->log2GARTTexGran; | ||||
|    } else { | ||||
|       screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset | ||||
| 				               + screen->fbLocation; | ||||
|       screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize; | ||||
|       screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] = | ||||
| 	 dri_priv->log2TexGran; | ||||
|    } | ||||
|  | ||||
|    if ( !screen->gartTextures.map ) { | ||||
|    if ( !screen->gartTextures.map || dri_priv->textureSize == 0 ) { | ||||
|       screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1; | ||||
|       screen->texOffset[RADEON_GART_TEX_HEAP] = 0; | ||||
|       screen->texSize[RADEON_GART_TEX_HEAP] = 0; | ||||
|   | ||||
| @@ -2092,7 +2092,7 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state ) | ||||
|       break; | ||||
|  | ||||
|    case GL_VERTEX_PROGRAM_ARB: | ||||
|       TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_TCL_DISABLE, state); | ||||
|       TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_VERTEX_PROGRAM, state); | ||||
|       break; | ||||
|  | ||||
|    default: | ||||
|   | ||||
| @@ -219,6 +219,8 @@ void r200ChooseVertexState( GLcontext *ctx ) | ||||
| { | ||||
|    r200ContextPtr rmesa = R200_CONTEXT( ctx ); | ||||
|    TNLcontext *tnl = TNL_CONTEXT(ctx); | ||||
|    GLuint vte; | ||||
|    GLuint vap; | ||||
|  | ||||
|    /* We must ensure that we don't do _tnl_need_projected_coords while in a | ||||
|     * rasterization fallback.  As this function will be called again when we | ||||
| @@ -227,8 +229,8 @@ void r200ChooseVertexState( GLcontext *ctx ) | ||||
|    if (rmesa->Fallback != 0) | ||||
|       return; | ||||
|  | ||||
|    GLuint vte = rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL]; | ||||
|    GLuint vap = rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL]; | ||||
|    vte = rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL]; | ||||
|    vap = rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL]; | ||||
|  | ||||
|    /* HW perspective divide is a win, but tiny vertex formats are a | ||||
|     * bigger one. | ||||
|   | ||||
| @@ -540,7 +540,8 @@ static char *fallbackStrings[] = { | ||||
|    "Texgen unit 4", | ||||
|    "Texgen unit 5", | ||||
|    "User disable", | ||||
|    "Bitmap as points" | ||||
|    "Bitmap as points", | ||||
|    "Vertex program" | ||||
| }; | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1171,8 +1171,8 @@ static void free_funcs( struct dynfn *l ) | ||||
|    struct dynfn *f, *tmp; | ||||
|    foreach_s (f, tmp, l) { | ||||
|       remove_from_list( f ); | ||||
|       ALIGN_FREE( f->code ); | ||||
|       FREE( f ); | ||||
|       _mesa_exec_free( f->code ); | ||||
|       _mesa_free( f ); | ||||
|    } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -59,8 +59,8 @@ do {							\ | ||||
|    insert_at_head( &CACHE, dfn );			\ | ||||
|    dfn->key[0] = key[0];				\ | ||||
|    dfn->key[1] = key[1];				\ | ||||
|    dfn->code = ALIGN_MALLOC( end - start, 16 );		\ | ||||
|    memcpy (dfn->code, start, end - start);		\ | ||||
|    dfn->code = _mesa_exec_malloc(end - start);		\ | ||||
|    _mesa_memcpy(dfn->code, start, end - start);		\ | ||||
| }							\ | ||||
| while ( 0 ) | ||||
|  | ||||
|   | ||||
| @@ -626,12 +626,13 @@ void r300EmitWait(r300ContextPtr rmesa, GLuint flags) | ||||
|  | ||||
| void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) | ||||
| { | ||||
| 	if (RADEON_DEBUG & DEBUG_VERTS) | ||||
| 	    fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __func__, nr, offset); | ||||
|     int sz = 1 + (nr >> 1) * 3 + (nr & 1) * 2; | ||||
|     int i; | ||||
|     LOCAL_VARS | ||||
|  | ||||
|     if (RADEON_DEBUG & DEBUG_VERTS) | ||||
| 	fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __func__, nr, offset); | ||||
|  | ||||
|     start_packet3(RADEON_CP_PACKET3_3D_LOAD_VBPNTR, sz-1); | ||||
|     e32(nr); | ||||
|     for(i=0;i+1<nr;i+=2){ | ||||
|   | ||||
| @@ -135,6 +135,7 @@ static const struct tnl_pipeline_stage *r300_pipeline[] = { | ||||
| 	&_tnl_fog_coordinate_stage, | ||||
| 	&_tnl_texgen_stage, | ||||
| 	&_tnl_texture_transform_stage, | ||||
| 	&_tnl_arb_vertex_program_stage, | ||||
| 	&_tnl_vertex_program_stage, | ||||
|  | ||||
| 	/* Try again to go to tcl? | ||||
|   | ||||
| @@ -277,9 +277,9 @@ static void free_temp(struct r300_fragment_program *rp, pfs_reg_t r) | ||||
| static pfs_reg_t emit_param4fv(struct r300_fragment_program *rp, GLfloat *values) | ||||
| { | ||||
| 	pfs_reg_t r = pfs_default_reg; | ||||
| 		r.type = REG_TYPE_CONST; | ||||
| 	int pidx; | ||||
|  | ||||
| 	r.type = REG_TYPE_CONST; | ||||
| 	pidx = rp->param_nr++; | ||||
| 	r.index = rp->const_nr++; | ||||
| 	if (pidx >= PFS_NUM_CONST_REGS || r.index >= PFS_NUM_CONST_REGS) { | ||||
| @@ -626,6 +626,7 @@ static void emit_arith(struct r300_fragment_program *rp, int op, | ||||
| 	int argc; | ||||
| 	int vop, sop; | ||||
| 	int i; | ||||
| 	int str; | ||||
| 	 | ||||
| 	if (!dest.valid || !src0.valid || !src1.valid || !src2.valid) { | ||||
| 		ERROR("invalid register.  dest/src0/src1/src2 valid = %d/%d/%d/%d\n", | ||||
| @@ -657,7 +658,6 @@ static void emit_arith(struct r300_fragment_program *rp, int op, | ||||
| 		return; | ||||
| 	} | ||||
| 	 | ||||
| 	int str; | ||||
| 	for (i=0;i<3;i++) { | ||||
| 		if (i<argc) { | ||||
| 			hwsrc = t_hw_src(rp, src[i]); | ||||
|   | ||||
| @@ -562,13 +562,20 @@ static radeonScreenPtr radeonCreateScreen(__DRIscreenPrivate * sPriv) | ||||
| 	screen->depthOffset = dri_priv->depthOffset; | ||||
| 	screen->depthPitch = dri_priv->depthPitch; | ||||
|  | ||||
| 	if ( dri_priv->textureSize == 0 ) { | ||||
| 	    screen->texOffset[RADEON_LOCAL_TEX_HEAP] = screen->gart_texture_offset; | ||||
| 	    screen->texSize[RADEON_GART_TEX_HEAP] = dri_priv->gartTexMapSize; | ||||
| 	    screen->logTexGranularity[RADEON_GART_TEX_HEAP] = | ||||
| 		dri_priv->log2GARTTexGran; | ||||
| 	} else { | ||||
| 	    screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset | ||||
| 		+ screen->fbLocation; | ||||
| 	    screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize; | ||||
| 	    screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] = | ||||
| 		dri_priv->log2TexGran; | ||||
| 	} | ||||
|  | ||||
| 	if (!screen->gartTextures.map) { | ||||
| 	if (!screen->gartTextures.map || dri_priv->textureSize == 0) { | ||||
| 		screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1; | ||||
| 		screen->texOffset[RADEON_GART_TEX_HEAP] = 0; | ||||
| 		screen->texSize[RADEON_GART_TEX_HEAP] = 0; | ||||
|   | ||||
| @@ -375,13 +375,20 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv ) | ||||
|    screen->depthHasSurface = ((sPriv->ddxMajor > 4) && | ||||
|       (screen->chipset & RADEON_CHIPSET_TCL)); | ||||
|  | ||||
|    if ( dri_priv->textureSize == 0 ) { | ||||
|       screen->texOffset[RADEON_LOCAL_TEX_HEAP] = screen->gart_texture_offset; | ||||
|       screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->gartTexMapSize; | ||||
|       screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] = | ||||
| 	 dri_priv->log2GARTTexGran; | ||||
|    } else { | ||||
|       screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset | ||||
| 				               + screen->fbLocation; | ||||
|       screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize; | ||||
|       screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] = | ||||
| 	 dri_priv->log2TexGran; | ||||
|    } | ||||
|  | ||||
|    if ( !screen->gartTextures.map | ||||
|    if ( !screen->gartTextures.map || dri_priv->textureSize == 0 | ||||
| 	|| getenv( "RADEON_GARTTEXTURING_FORCE_DISABLE" ) ) { | ||||
|       screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1; | ||||
|       screen->texOffset[RADEON_GART_TEX_HEAP] = 0; | ||||
|   | ||||
| @@ -385,7 +385,7 @@ static __inline void radeonDmaPrimitive( radeonContextPtr rmesa, GLenum prim ) | ||||
|    assert(rmesa->dma.current.ptr == rmesa->dma.current.start); | ||||
| } | ||||
|  | ||||
| #define LOCAL_VARS radeonContextPtr rmesa = RADEON_CONTEXT(ctx); (void)rmesa | ||||
| #define LOCAL_VARS radeonContextPtr rmesa = RADEON_CONTEXT(ctx) | ||||
| #define INIT( prim ) radeonDmaPrimitive( rmesa, prim ) | ||||
| #define FLUSH()  RADEON_NEWPRIM( rmesa ) | ||||
| #define GET_CURRENT_VB_MAX_VERTS() \ | ||||
|   | ||||
| @@ -1046,8 +1046,8 @@ static void free_funcs( struct dynfn *l ) | ||||
|    struct dynfn *f, *tmp; | ||||
|    foreach_s (f, tmp, l) { | ||||
|       remove_from_list( f ); | ||||
|       ALIGN_FREE( f->code ); | ||||
|       FREE( f ); | ||||
|       _mesa_exec_free( f->code ); | ||||
|       _mesa_free( f ); | ||||
|    } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -56,8 +56,8 @@ do {							\ | ||||
|    char *end = (char *)&FUNC##_end;			\ | ||||
|    insert_at_head( &CACHE, dfn );			\ | ||||
|    dfn->key = key;					\ | ||||
|    dfn->code = ALIGN_MALLOC( end - start, 16 );		\ | ||||
|    memcpy (dfn->code, start, end - start);		\ | ||||
|    dfn->code = _mesa_exec_malloc( end - start );	\ | ||||
|    _mesa_memcpy(dfn->code, start, end - start);		\ | ||||
| }							\ | ||||
| while ( 0 ) | ||||
|  | ||||
|   | ||||
| @@ -17,7 +17,8 @@ | ||||
|         int start02, end01; \ | ||||
|         int ystart, y01y12; \ | ||||
|         int i, tmp, tmp2, tmp3; \ | ||||
|         GLfloat ydiff, fy[3]; \ | ||||
|         GLfloat ydiff, fy[3] | ||||
| #define LINE_VERT_VARS_VOIDS \ | ||||
|         (void) v; (void) vvv; (void) x; (void) y; (void) z; (void) idx; \ | ||||
|         (void) dx01; (void) dy01; (void) delt02; (void) deltzy; \ | ||||
|         (void) zstart; (void) start02; (void) ystart; (void) y01y12; \ | ||||
| @@ -26,7 +27,8 @@ | ||||
| #define LINE_FLAT_VARS \ | ||||
|         int arstart, gbstart; \ | ||||
|         int deltarx, deltgbx, deltary, deltgby; \ | ||||
|         GLubyte *(col)[3]; \ | ||||
|         GLubyte *(col)[3] | ||||
| #define LINE_FLAT_VARS_VOIDS \ | ||||
|         (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \ | ||||
|         (void) deltary; (void) deltgby; (void) col | ||||
|  | ||||
| @@ -34,7 +36,8 @@ | ||||
|         int arstart, gbstart; \ | ||||
|         int deltary, deltgby; \ | ||||
|         int ctmp, ctmp2, ctmp3, ctmp4; \ | ||||
|         GLubyte *(col)[3]; \ | ||||
|         GLubyte *(col)[3] | ||||
| #define LINE_GOURAUD_VARS_VOIDS \ | ||||
|         (void) arstart; (void) gbstart; (void) deltary; (void) deltgby; \ | ||||
|         (void) ctmp; (void) ctmp2; (void) ctmp3; (void) ctmp4; (void) col | ||||
|  | ||||
| @@ -207,7 +210,8 @@ do { \ | ||||
|         int start02, end01, end12; \ | ||||
|         int ystart, y01y12; \ | ||||
|         int i, tmp, lr; \ | ||||
|         GLfloat ydiff, fy[3]; \ | ||||
|         GLfloat ydiff, fy[3] | ||||
| #define VERT_VARS_VOIDS \ | ||||
|         (void) v; (void) x; (void) y; (void) z; (void) idx; (void) dx01; \ | ||||
|         (void) dy01; (void) dx02; (void) dy02; (void) dx12; (void) dy12; \ | ||||
|         (void) delt01; (void) delt02; (void) delt12; (void) deltzx; \ | ||||
| @@ -219,7 +223,8 @@ do { \ | ||||
|         int arstart, gbstart; \ | ||||
|         int deltarx, deltgbx, deltary, deltgby; \ | ||||
|         int ctmp, ctmp2, ctmp3, ctmp4; \ | ||||
|         GLubyte *(col)[3]; \ | ||||
|         GLubyte *(col)[3] | ||||
| #define GOURAUD_VARS_VOIDS \ | ||||
|         (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \ | ||||
|         (void) deltary; (void) deltgby; (void) ctmp; (void) ctmp2; \ | ||||
|         (void) ctmp3; (void) ctmp4; (void) col | ||||
| @@ -227,7 +232,8 @@ do { \ | ||||
| #define FLAT_VARS \ | ||||
|         int arstart, gbstart; \ | ||||
|         int deltarx, deltgbx, deltary, deltgby; \ | ||||
|         GLubyte *(col)[3]; \ | ||||
|         GLubyte *(col)[3] | ||||
| #define FLAT_VARS_VOIDS \ | ||||
|         (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \ | ||||
|         (void) deltary; (void) deltgby; (void) col | ||||
|  | ||||
| @@ -245,7 +251,8 @@ do { \ | ||||
|         int rbaseu, rbasev; \ | ||||
|         int dstart, ustart, wstart, vstart; \ | ||||
|         static int stmp = 0; \ | ||||
|         s3vTextureObjectPtr t; \ | ||||
|         s3vTextureObjectPtr t | ||||
| #define TEX_VARS_VOIDS \ | ||||
|         (void) u0; (void) u1; (void) u2; (void) ru0; (void) ru1; (void) ru2; \ | ||||
|         (void) v0; (void) v1; (void) v2; (void) rv0; (void) rv1; (void) rv2; \ | ||||
|         (void) w0; (void) w1; (void) w2; (void) rw0; (void) rw1; (void) rw2; \ | ||||
| @@ -620,6 +627,12 @@ static void TAG(s3v_line)( s3vContextPtr vmesa, | ||||
| 	GLfloat cull; | ||||
|         (void) cull; | ||||
| #endif | ||||
| 	LINE_VERT_VARS_VOIDS; | ||||
| #if (IND & S3V_RAST_FLAT_BIT) | ||||
| 	LINE_FLAT_VARS_VOIDS; | ||||
| #else | ||||
| 	LINE_GOURAUD_VARS_VOIDS; | ||||
| #endif | ||||
|  | ||||
| 	DEBUG(("*** s3v_line: ")); | ||||
| #if (IND & S3V_RAST_CULL_BIT) | ||||
| @@ -684,6 +697,15 @@ static void TAG(s3v_triangle)( s3vContextPtr vmesa, | ||||
| #if (IND & S3V_RAST_CULL_BIT) | ||||
| 	GLfloat cull; | ||||
| #endif | ||||
| 	VERT_VARS_VOIDS; | ||||
| #if (IND & S3v_RAST_FLAT_BIT) | ||||
| 	FLAT_VARS_VOIDS; | ||||
| #else | ||||
| 	GOURAUD_VARS_VOIDS; | ||||
| #endif | ||||
| #if (IND & S3V_RAST_TEX_BIT) | ||||
| 	TEX_VARS_VOIDS; | ||||
| #endif | ||||
|  | ||||
| 	DEBUG(("*** s3v_triangle: ")); | ||||
| #if (IND & S3V_RAST_CULL_BIT) | ||||
| @@ -774,6 +796,15 @@ static void TAG(s3v_quad)( s3vContextPtr vmesa, | ||||
| #if (IND & S3V_RAST_CULL_BIT) | ||||
|         GLfloat cull; | ||||
| #endif | ||||
|         VERT_VARS_VOIDS; | ||||
| #if (IND & S3v_RAST_FLAT_BIT) | ||||
|         FLAT_VARS_VOIDS; | ||||
| #else | ||||
|         GOURAUD_VARS_VOIDS; | ||||
| #endif | ||||
| #if (IND & S3V_RAST_TEX_BIT) | ||||
|         TEX_VARS_VOIDS; | ||||
| #endif | ||||
|  | ||||
| 	DEBUG(("*** s3v_quad: ")); | ||||
| #if (IND & S3V_RAST_CULL_BIT) | ||||
|   | ||||
| @@ -141,6 +141,7 @@ static const struct dri_extension card_extensions[] = | ||||
| static const struct dri_extension s4_extensions[] = | ||||
| { | ||||
|     { "GL_ARB_texture_env_add",            NULL }, | ||||
|     { "GL_ARB_texture_mirrored_repeat",    NULL }, | ||||
|     { NULL,                                NULL } | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -42,7 +42,7 @@ | ||||
| #include "utils.h" | ||||
|  | ||||
|  | ||||
| #define DRIVER_DATE "20050501" | ||||
| #define DRIVER_DATE "20050829" | ||||
|  | ||||
| /*************************************** | ||||
|  * Mesa's Driver Functions | ||||
|   | ||||
| @@ -632,18 +632,18 @@ void savageFlushCmdBuf( savageContextPtr imesa, GLboolean discard ) | ||||
|  | ||||
| static void savageDDFlush( GLcontext *ctx ) | ||||
| { | ||||
|     savageContextPtr imesa = SAVAGE_CONTEXT(ctx); | ||||
|     if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) | ||||
| 	fprintf (stderr, "%s\n", __FUNCTION__); | ||||
|     savageContextPtr imesa = SAVAGE_CONTEXT(ctx); | ||||
|     savageFlushVertices (imesa); | ||||
|     savageFlushCmdBuf(imesa, GL_FALSE); | ||||
| } | ||||
|  | ||||
| static void savageDDFinish( GLcontext *ctx  )  | ||||
| { | ||||
|     savageContextPtr imesa = SAVAGE_CONTEXT(ctx); | ||||
|     if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) | ||||
| 	fprintf (stderr, "%s\n", __FUNCTION__); | ||||
|     savageContextPtr imesa = SAVAGE_CONTEXT(ctx); | ||||
|     savageFlushVertices (imesa); | ||||
|     savageFlushCmdBuf(imesa, GL_FALSE); | ||||
|     WAIT_IDLE_EMPTY(imesa); | ||||
|   | ||||
| @@ -246,21 +246,22 @@ static GLboolean run_texnorm_stage( GLcontext *ctx, | ||||
|       return GL_TRUE; | ||||
|  | ||||
|    for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { | ||||
|       const GLbitfield reallyEnabled = ctx->Texture.Unit[i]._ReallyEnabled; | ||||
|       if (reallyEnabled) { | ||||
|          const struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current; | ||||
|          const GLboolean normalizeS = (texObj->WrapS == GL_REPEAT); | ||||
|          const GLboolean normalizeT = (reallyEnabled & TEXTURE_2D_BIT) && | ||||
|             (texObj->WrapT == GL_REPEAT); | ||||
|          const GLfloat *in = (GLfloat *)VB->TexCoordPtr[i]->data; | ||||
|          const GLint instride = VB->TexCoordPtr[i]->stride; | ||||
|          GLfloat (*out)[4] = store->texcoord[i].data; | ||||
|          GLint j; | ||||
|  | ||||
|          if (!ctx->Texture.Unit[i]._ReallyEnabled || | ||||
|              VB->TexCoordPtr[i]->size == 4) | ||||
|             /* Never try to normalize homogenous tex coords! */ | ||||
|             continue; | ||||
|  | ||||
|       GLuint reallyEnabled = ctx->Texture.Unit[i]._ReallyEnabled; | ||||
|       struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current; | ||||
|       GLboolean normalizeS = (texObj->WrapS == GL_REPEAT); | ||||
|       GLboolean normalizeT = (reallyEnabled & TEXTURE_2D_BIT) && | ||||
| 	 (texObj->WrapT == GL_REPEAT); | ||||
|       GLfloat *in = (GLfloat *)VB->TexCoordPtr[i]->data; | ||||
|       GLint instride = VB->TexCoordPtr[i]->stride; | ||||
|       GLfloat (*out)[4] = store->texcoord[i].data; | ||||
|       GLint j; | ||||
|  | ||||
|          if (normalizeS && normalizeT) { | ||||
|             /* take first texcoords as rough estimate of mean value */ | ||||
|             GLfloat correctionS = -floor(in[0]+0.5); | ||||
| @@ -298,6 +299,7 @@ static GLboolean run_texnorm_stage( GLcontext *ctx, | ||||
|          if (normalizeS || normalizeT) | ||||
|             VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] = &store->texcoord[i]; | ||||
|       } | ||||
|    } | ||||
|  | ||||
|    return GL_TRUE; | ||||
| } | ||||
|   | ||||
| @@ -1086,6 +1086,78 @@ static void savageUploadTexImages( savageContextPtr imesa, savageTexObjPtr t ) | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| savage4_set_wrap_mode( savageContextPtr imesa, unsigned unit, | ||||
| 		      GLenum s_mode, GLenum t_mode ) | ||||
| { | ||||
|     switch( s_mode ) { | ||||
|     case GL_REPEAT: | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.uMode = TAM_Wrap; | ||||
| 	break; | ||||
|     case GL_CLAMP: | ||||
|     case GL_CLAMP_TO_EDGE: | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.uMode = TAM_Clamp; | ||||
| 	break; | ||||
|     case GL_MIRRORED_REPEAT: | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.uMode = TAM_Mirror; | ||||
| 	break; | ||||
|     } | ||||
|  | ||||
|     switch( t_mode ) { | ||||
|     case GL_REPEAT: | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.vMode = TAM_Wrap; | ||||
| 	break; | ||||
|     case GL_CLAMP: | ||||
|     case GL_CLAMP_TO_EDGE: | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.vMode = TAM_Clamp; | ||||
| 	break; | ||||
|     case GL_MIRRORED_REPEAT: | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.vMode = TAM_Mirror; | ||||
| 	break; | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Sets the hardware bits for the specified GL texture filter modes. | ||||
|  *  | ||||
|  * \todo | ||||
|  * Does the Savage4 have the ability to select the magnification filter? | ||||
|  */ | ||||
| static void | ||||
| savage4_set_filter_mode( savageContextPtr imesa, unsigned unit, | ||||
| 			 GLenum minFilter, GLenum magFilter ) | ||||
| { | ||||
|     (void) magFilter; | ||||
|  | ||||
|     switch (minFilter) { | ||||
|     case GL_NEAREST: | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.filterMode   = TFM_Point; | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_FALSE; | ||||
| 	break; | ||||
|  | ||||
|     case GL_LINEAR: | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.filterMode   = TFM_Bilin; | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_FALSE; | ||||
| 	break; | ||||
|  | ||||
|     case GL_NEAREST_MIPMAP_NEAREST: | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.filterMode   = TFM_Point; | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_TRUE; | ||||
| 	break; | ||||
|  | ||||
|     case GL_LINEAR_MIPMAP_NEAREST: | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.filterMode   = TFM_Bilin; | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_TRUE; | ||||
| 	break; | ||||
|  | ||||
|     case GL_NEAREST_MIPMAP_LINEAR: | ||||
|     case GL_LINEAR_MIPMAP_LINEAR: | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.filterMode   = TFM_Trilin; | ||||
| 	imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_TRUE; | ||||
| 	break; | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| static void savageUpdateTex0State_s4( GLcontext *ctx ) | ||||
| @@ -1301,39 +1373,8 @@ static void savageUpdateTex0State_s4( GLcontext *ctx ) | ||||
|       break;			 | ||||
|    } | ||||
|  | ||||
|     imesa->regs.s4.texCtrl[0].ni.uMode = | ||||
| 	t->setup.sWrapMode == GL_REPEAT ? 0 : 1; | ||||
|     imesa->regs.s4.texCtrl[0].ni.vMode =  | ||||
| 	t->setup.tWrapMode == GL_REPEAT ? 0 : 1; | ||||
|  | ||||
|     switch (t->setup.minFilter) | ||||
|     { | ||||
|         case GL_NEAREST: | ||||
|             imesa->regs.s4.texCtrl[0].ni.filterMode   = TFM_Point; | ||||
|             imesa->regs.s4.texCtrl[0].ni.mipmapEnable = GL_FALSE; | ||||
|             break; | ||||
|  | ||||
|         case GL_LINEAR: | ||||
|             imesa->regs.s4.texCtrl[0].ni.filterMode   = TFM_Bilin; | ||||
|             imesa->regs.s4.texCtrl[0].ni.mipmapEnable = GL_FALSE; | ||||
|             break; | ||||
|  | ||||
|         case GL_NEAREST_MIPMAP_NEAREST: | ||||
|             imesa->regs.s4.texCtrl[0].ni.filterMode   = TFM_Point; | ||||
|             imesa->regs.s4.texCtrl[0].ni.mipmapEnable = GL_TRUE; | ||||
|             break; | ||||
|  | ||||
|         case GL_LINEAR_MIPMAP_NEAREST: | ||||
|             imesa->regs.s4.texCtrl[0].ni.filterMode   = TFM_Bilin; | ||||
|             imesa->regs.s4.texCtrl[0].ni.mipmapEnable = GL_TRUE; | ||||
|             break; | ||||
|  | ||||
|         case GL_NEAREST_MIPMAP_LINEAR: | ||||
|         case GL_LINEAR_MIPMAP_LINEAR: | ||||
|             imesa->regs.s4.texCtrl[0].ni.filterMode   = TFM_Trilin; | ||||
|             imesa->regs.s4.texCtrl[0].ni.mipmapEnable = GL_TRUE; | ||||
|             break; | ||||
|     } | ||||
|     savage4_set_wrap_mode( imesa, 0, t->setup.sWrapMode, t->setup.tWrapMode ); | ||||
|     savage4_set_filter_mode( imesa, 0, t->setup.minFilter, t->setup.magFilter ); | ||||
|  | ||||
|     if((ctx->Texture.Unit[0].LodBias !=0.0F) || | ||||
|        (imesa->regs.s4.texCtrl[0].ni.dBias != 0)) | ||||
| @@ -1514,44 +1555,13 @@ static void savageUpdateTex1State_s4( GLcontext *ctx ) | ||||
|       break; | ||||
|  | ||||
|    default: | ||||
|       fprintf(stderr, "unkown tex 1 env mode\n"); | ||||
|       fprintf(stderr, "unknown tex 1 env mode\n"); | ||||
|       exit(1); | ||||
|       break;			 | ||||
|    } | ||||
|  | ||||
|     imesa->regs.s4.texCtrl[1].ni.uMode = | ||||
| 	t->setup.sWrapMode == GL_REPEAT ? 0 : 1; | ||||
|     imesa->regs.s4.texCtrl[1].ni.vMode = | ||||
| 	t->setup.tWrapMode == GL_REPEAT ? 0 : 1; | ||||
|  | ||||
|     switch (t->setup.minFilter) | ||||
|     { | ||||
|         case GL_NEAREST: | ||||
|             imesa->regs.s4.texCtrl[1].ni.filterMode   = TFM_Point; | ||||
|             imesa->regs.s4.texCtrl[1].ni.mipmapEnable = GL_FALSE; | ||||
|             break; | ||||
|  | ||||
|         case GL_LINEAR: | ||||
|             imesa->regs.s4.texCtrl[1].ni.filterMode   = TFM_Bilin; | ||||
|             imesa->regs.s4.texCtrl[1].ni.mipmapEnable = GL_FALSE; | ||||
|             break; | ||||
|  | ||||
|         case GL_NEAREST_MIPMAP_NEAREST: | ||||
|             imesa->regs.s4.texCtrl[1].ni.filterMode   = TFM_Point; | ||||
|             imesa->regs.s4.texCtrl[1].ni.mipmapEnable = GL_TRUE; | ||||
|             break; | ||||
|  | ||||
|         case GL_LINEAR_MIPMAP_NEAREST: | ||||
|             imesa->regs.s4.texCtrl[1].ni.filterMode   = TFM_Bilin; | ||||
|             imesa->regs.s4.texCtrl[1].ni.mipmapEnable = GL_TRUE; | ||||
|             break; | ||||
|  | ||||
|         case GL_NEAREST_MIPMAP_LINEAR: | ||||
|         case GL_LINEAR_MIPMAP_LINEAR: | ||||
|             imesa->regs.s4.texCtrl[1].ni.filterMode   = TFM_Trilin; | ||||
|             imesa->regs.s4.texCtrl[1].ni.mipmapEnable = GL_TRUE; | ||||
|             break; | ||||
|     } | ||||
|     savage4_set_wrap_mode( imesa, 1, t->setup.sWrapMode, t->setup.tWrapMode ); | ||||
|     savage4_set_filter_mode( imesa, 1, t->setup.minFilter, t->setup.magFilter ); | ||||
|  | ||||
|     if((ctx->Texture.Unit[1].LodBias !=0.0F) || | ||||
|        (imesa->regs.s4.texCtrl[1].ni.dBias != 0)) | ||||
| @@ -1650,7 +1660,7 @@ static void savageUpdateTexState_s3d( GLcontext *ctx ) | ||||
| 	imesa->regs.s3d.drawCtrl.ni.texBlendCtrl = SAVAGETBC_MODULATEALPHA_S3D; | ||||
| 	break; | ||||
|     default: | ||||
| 	fprintf(stderr, "unkown tex env mode\n"); | ||||
| 	fprintf(stderr, "unknown tex env mode\n"); | ||||
| 	/*exit(1);*/ | ||||
| 	break;			 | ||||
|     } | ||||
|   | ||||
| @@ -78,7 +78,7 @@ sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z, GLint stencil ) | ||||
|    switch (smesa->zFormat) | ||||
|    { | ||||
|    case SiS_ZFORMAT_Z16: | ||||
|       zPattern = FLOAT_TO_USHORT(z); | ||||
|       CLAMPED_FLOAT_TO_USHORT(zPattern, z); | ||||
|       zPattern |= zPattern << 16; | ||||
|       break; | ||||
|    case SiS_ZFORMAT_S8Z24: | ||||
|   | ||||
| @@ -64,7 +64,7 @@ int GlobalCurrentHwcx = -1; | ||||
| int GlobalHwcxCountBase = 1; | ||||
| int GlobalCmdQueueLen = 0; | ||||
|  | ||||
| const struct dri_extension card_extensions[] = | ||||
| struct dri_extension card_extensions[] = | ||||
| { | ||||
|     { "GL_ARB_multisample",                GL_ARB_multisample_functions }, | ||||
|     { "GL_ARB_multitexture",               NULL }, | ||||
|   | ||||
| @@ -45,7 +45,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||
|  | ||||
| #include "utils.h" | ||||
|  | ||||
| #define DRIVER_DATE	"20041008" | ||||
| #define DRIVER_DATE	"20051019" | ||||
|  | ||||
| /* Return the width and height of the given buffer. | ||||
|  */ | ||||
|   | ||||
| @@ -59,6 +59,7 @@ DRI_CONF_BEGIN | ||||
| DRI_CONF_END; | ||||
| static const GLuint __driNConfigOptions = 2; | ||||
|  | ||||
| extern const struct dri_extension card_extensions[]; | ||||
|  | ||||
| static __GLcontextModes * | ||||
| sisFillInModes(int bpp) | ||||
| @@ -205,6 +206,7 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv, | ||||
|                  GLboolean isPixmap ) | ||||
| { | ||||
|    sisScreenPtr screen = (sisScreenPtr) driScrnPriv->private; | ||||
|    struct gl_framebuffer *fb; | ||||
|  | ||||
|    if (isPixmap) | ||||
|       return GL_FALSE; /* not implemented */ | ||||
| @@ -217,7 +219,7 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv, | ||||
| 				 mesaVis->accumRedBits > 0, | ||||
| 				 mesaVis->alphaBits > 0 ); /* XXX */ | ||||
| #else | ||||
|       struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); | ||||
|       fb = _mesa_create_framebuffer(mesaVis); | ||||
|  | ||||
|       /* XXX double-check the Offset/Pitch parameters! */ | ||||
|       { | ||||
| @@ -450,6 +452,16 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, | ||||
|    if (psp != NULL) { | ||||
|       SISDRIPtr dri_priv = (SISDRIPtr)psp->pDevPriv; | ||||
|       *driver_modes = sisFillInModes(dri_priv->bytesPerPixel * 8); | ||||
|  | ||||
|       /* Calling driInitExtensions here, with a NULL context pointer, does not actually | ||||
|        * enable the extensions.  It just makes sure that all the dispatch offsets for all | ||||
|        * the extensions that *might* be enables are known.  This is needed because the | ||||
|        * dispatch offsets need to be known when _mesa_context_create is called, but we can't | ||||
|        * enable the extensions until we have a context pointer. | ||||
|        * | ||||
|        * Hello chicken.  Hello egg.  How are you two today? | ||||
|        */ | ||||
|       driInitExtensions( NULL, card_extensions, GL_FALSE ); | ||||
|    } | ||||
|  | ||||
|    return (void *)psp; | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user