Compare commits
	
		
			427 Commits
		
	
	
		
			mesa_7_1_r
			...
			mesa_7_1_r
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 2f1b5ffcda | ||
|  | e4d9cc94b8 | ||
|  | ee2a101123 | ||
|  | 7d3feef9d6 | ||
|  | 2be54a8e8c | ||
|  | 44029f15a8 | ||
|  | 6fe7857629 | ||
|  | c71fa34728 | ||
|  | fd6cb1b11d | ||
|  | d14b7890a4 | ||
|  | 477d597df6 | ||
|  | 92c075eeb7 | ||
|  | a36bf890e8 | ||
|  | e6e4f25aa5 | ||
|  | 11ac5b2456 | ||
|  | 056689d457 | ||
|  | 2b2cb56656 | ||
|  | 4746752f16 | ||
|  | 03abd021f2 | ||
|  | 62bccd6df0 | ||
|  | 77fdfaa23a | ||
|  | 364d45a3e1 | ||
|  | dea8719f00 | ||
|  | 85b46fbe9c | ||
|  | 13c44679ad | ||
|  | 09e587fcf3 | ||
|  | 82635aad42 | ||
|  | e187627c1d | ||
|  | 845e3f701d | ||
|  | 1f4d0748ba | ||
|  | e06565b103 | ||
|  | b931a0c1d9 | ||
|  | 9157b1e09a | ||
|  | 0c1e96e6d3 | ||
|  | 530df581dd | ||
|  | 011185396b | ||
|  | 3dc6591a7c | ||
|  | 7acb7c1ac0 | ||
|  | d866cb3712 | ||
|  | 7f4f2ac39d | ||
|  | 6e46c121f9 | ||
|  | 1dc20c7916 | ||
|  | b3e1f9bd52 | ||
|  | 1726b7d1d3 | ||
|  | cb79c5c7c6 | ||
|  | 36a5826411 | ||
|  | a405d69063 | ||
|  | a2cddf58d2 | ||
|  | 918f3b17e5 | ||
|  | 18adc71822 | ||
|  | 5ef4e4ffb8 | ||
|  | 6befdca6a3 | ||
|  | 43346fb1fb | ||
|  | ea190fe050 | ||
|  | abd71144f0 | ||
|  | 21e0d47514 | ||
|  | c52d6ad465 | ||
|  | 028739faed | ||
|  | e19af171cf | ||
|  | 9ae4d778d8 | ||
|  | 32a5c40336 | ||
|  | b2247c7d29 | ||
|  | 011b0e51e4 | ||
|  | 2ce4b985a5 | ||
|  | 634d2af2b0 | ||
|  | d3f7b463c3 | ||
|  | bcc2a3d7e3 | ||
|  | 5cae1b747b | ||
|  | bb1744970d | ||
|  | 23e9b43ce4 | ||
|  | 4002b75e62 | ||
|  | a74d22ba71 | ||
|  | 543893eefd | ||
|  | 0918023c28 | ||
|  | bc775066aa | ||
|  | 6cb1270491 | ||
|  | b429e9b2d7 | ||
|  | f6da1453c5 | ||
|  | 985e1cdfe8 | ||
|  | 3b132b297f | ||
|  | 5174b85a0c | ||
|  | 9a0d773116 | ||
|  | 744357e29c | ||
|  | f5eb62a116 | ||
|  | f23adc504d | ||
|  | 90d33edf37 | ||
|  | eda68cccc0 | ||
|  | 5989098779 | ||
|  | 98fa0aec36 | ||
|  | fe3b62b5b1 | ||
|  | 5aa4d5a87d | ||
|  | 7ec5e6a032 | ||
|  | 71d2578ac5 | ||
|  | ba97ed2b74 | ||
|  | cc96d54920 | ||
|  | 37f19b94ac | ||
|  | 402e7f76b1 | ||
|  | 5ee7b7912c | ||
|  | 055ab81920 | ||
|  | 24197b4901 | ||
|  | 7899270b9f | ||
|  | 2e922b0e35 | ||
|  | 2c1bead069 | ||
|  | 77d917a74a | ||
|  | e1f9adc274 | ||
|  | f30e4af734 | ||
|  | 1043a7c71a | ||
|  | 4ba39c40ae | ||
|  | 3491cbea88 | ||
|  | dc25661099 | ||
|  | b3f1aac95e | ||
|  | 21177c8764 | ||
|  | cf29ab3ba0 | ||
|  | 3e8aadee8b | ||
|  | 3064069540 | ||
|  | 5b5bf21874 | ||
|  | 51ad6e3425 | ||
|  | a1523c61ea | ||
|  | 27b7f896d4 | ||
|  | e9d1889891 | ||
|  | ec2d0decbd | ||
|  | bbce58802d | ||
|  | 588abd6696 | ||
|  | 1738a9a535 | ||
|  | 776580a6af | ||
|  | f7b8a13d65 | ||
|  | 6e6ca40f29 | ||
|  | 4fc66be296 | ||
|  | f1ae5d4b44 | ||
|  | 7413c55d93 | ||
|  | 43da118961 | ||
|  | 825fdfd0c1 | ||
|  | b97e48ffe3 | ||
|  | 69004fb758 | ||
|  | 0a341ef296 | ||
|  | 9704414d13 | ||
|  | a1c0c56d70 | ||
|  | 83ad2a756e | ||
|  | 2882e51625 | ||
|  | e34dc8227c | ||
|  | b5170bc9d3 | ||
|  | e2aa45c2f9 | ||
|  | caeabb1ebe | ||
|  | 4ba1c7d848 | ||
|  | defadd9c03 | ||
|  | b7669e4a86 | ||
|  | 4919cc3a2c | ||
|  | b1056b6127 | ||
|  | 1087cc61b3 | ||
|  | 7ffb1230b3 | ||
|  | 341987f688 | ||
|  | 4297413656 | ||
|  | 95b34baa8f | ||
|  | 928ec5cd3b | ||
|  | 53f5b9741a | ||
|  | effb73befa | ||
|  | 19659a50f9 | ||
|  | 2542c59c55 | ||
|  | 74964ff04d | ||
|  | 0440f5a187 | ||
|  | 41bdb88f27 | ||
|  | 2b0e75ea7a | ||
|  | 3f3e4f645d | ||
|  | 8d976aedc4 | ||
|  | 9563449c14 | ||
|  | c233b4245f | ||
|  | 17ec0dbd75 | ||
|  | fbb96a0301 | ||
|  | a742bed99a | ||
|  | 72f87b6947 | ||
|  | f6246f85d7 | ||
|  | 910b3bfaeb | ||
|  | a80ccaadc7 | ||
|  | 08c07b60be | ||
|  | 376203cff8 | ||
|  | 5cf69fe511 | ||
|  | 906e189bd3 | ||
|  | 0793457039 | ||
|  | 4c7e02298f | ||
|  | 0009973119 | ||
|  | f440b0ddd9 | ||
|  | 28c28f72fd | ||
|  | 21f50818b0 | ||
|  | cb16876608 | ||
|  | 7cb63a25de | ||
|  | 731686b713 | ||
|  | 75bfe630ff | ||
|  | bf1a7c884d | ||
|  | 5e58e5d777 | ||
|  | f39780242e | ||
|  | ae18cbcfc5 | ||
|  | 9286a14fbe | ||
|  | fa1bc0d7d6 | ||
|  | 03a1144cd1 | ||
|  | 665605234d | ||
|  | 0b72fada6a | ||
|  | 1d5b51abc8 | ||
|  | bde6b57e48 | ||
|  | 847f54e2fa | ||
|  | dd750e0763 | ||
|  | 358dcd7178 | ||
|  | 04c6ca99dd | ||
|  | c9739b2055 | ||
|  | f8563ddddb | ||
|  | b55694512a | ||
|  | 4a68b62b86 | ||
|  | e89e94e01a | ||
|  | 2b84b22bad | ||
|  | ea7eb9a374 | ||
|  | bf5e573926 | ||
|  | f8c6b6628d | ||
|  | 18906b7904 | ||
|  | 91b491debe | ||
|  | b2a9788ec6 | ||
|  | 4c7a17c251 | ||
|  | 6d9c3fa0c2 | ||
|  | c35e021f37 | ||
|  | c5342ad0d0 | ||
|  | 028fd5594c | ||
|  | 871125a68d | ||
|  | 0d8676822d | ||
|  | f34767f04c | ||
|  | 9e95fad02e | ||
|  | 0b734bd7cf | ||
|  | f688827ebd | ||
|  | 96adcc2e21 | ||
|  | 934a53eb44 | ||
|  | 7ead1c5d06 | ||
|  | 915e49e0fd | ||
|  | c9ea62444c | ||
|  | d9c7c5f071 | ||
|  | 3225e2cdb6 | ||
|  | 9a34c68faf | ||
|  | bffa0909cb | ||
|  | ea58dceb1c | ||
|  | c9679ce1d2 | ||
|  | 7013eecf28 | ||
|  | a947c1a3fe | ||
|  | 4a69c4173d | ||
|  | ef56a563a1 | ||
|  | 1190261c47 | ||
|  | 645c131264 | ||
|  | a1a0e51043 | ||
|  | 328621509f | ||
|  | 377016d728 | ||
|  | 74a217fbcd | ||
|  | 5adc763898 | ||
|  | 5429d4a04a | ||
|  | 3e6c791390 | ||
|  | 261a15cf63 | ||
|  | 85af4fde7f | ||
|  | 867f5aac53 | ||
|  | 5552500cdf | ||
|  | 8c39e24ec3 | ||
|  | a242b331c6 | ||
|  | 9412aee4dc | ||
|  | eee53dfb22 | ||
|  | 7278266612 | ||
|  | 774b3bc5a5 | ||
|  | 4af22c9076 | ||
|  | 8eb7df6302 | ||
|  | b5372746ff | ||
|  | 9f03e93de9 | ||
|  | 7b88f40116 | ||
|  | 5a5ba35069 | ||
|  | b57ba7c5b0 | ||
|  | 5499685931 | ||
|  | a2db33219d | ||
|  | 21b352bb14 | ||
|  | 27d8fcd506 | ||
|  | f776f693c0 | ||
|  | 594760148c | ||
|  | bd74d2aa26 | ||
|  | 810270ad11 | ||
|  | f1d04cd766 | ||
|  | b6b5190682 | ||
|  | 6f918a9fda | ||
|  | af77de66d9 | ||
|  | e9031d6f63 | ||
|  | 9ab7a2df03 | ||
|  | 30e61500e1 | ||
|  | 34010bcc91 | ||
|  | d4e93864b8 | ||
|  | a01816da59 | ||
|  | 4f9dcdc35b | ||
|  | 0dfbe9cdd7 | ||
|  | d06f4edb14 | ||
|  | 1e2907f170 | ||
|  | bb57c30a53 | ||
|  | b453b0e2e1 | ||
|  | 9ec2b1c83f | ||
|  | 2bda1a9502 | ||
|  | 94994b13c5 | ||
|  | 78fa506059 | ||
|  | f0d76d526b | ||
|  | 2005de48f9 | ||
|  | 282cdc8b5c | ||
|  | 476248befe | ||
|  | 03b3fed8f1 | ||
|  | ac315792bf | ||
|  | 60b8e1f524 | ||
|  | cddab021e3 | ||
|  | c60bdcf8a8 | ||
|  | 2708d7f700 | ||
|  | a6c38f2f64 | ||
|  | 2225b9bdb0 | ||
|  | bdfd5d95c5 | ||
|  | 126673261d | ||
|  | 0910d9d4d6 | ||
|  | c57b3b1d2c | ||
|  | 6dd3c0ed96 | ||
|  | 16cc362f0b | ||
|  | c11a33fe76 | ||
|  | d5aa421661 | ||
|  | 405ee871c5 | ||
|  | 0de02f1716 | ||
|  | d8529d9b00 | ||
|  | 5e075fb809 | ||
|  | ba50c3fed3 | ||
|  | 791c95230c | ||
|  | d6333af7e9 | ||
|  | 9aa62c7238 | ||
|  | 76f32499d2 | ||
|  | a0bc6d2fb2 | ||
|  | 73af48fff5 | ||
|  | c9d5d11d2d | ||
|  | 412c850eab | ||
|  | 350c80fa99 | ||
|  | e1bffd0318 | ||
|  | 10e0a36a49 | ||
|  | 375656440b | ||
|  | f86baae1a7 | ||
|  | de3fc8b1c4 | ||
|  | c5b7a1ee3c | ||
|  | 8d70181b03 | ||
|  | d09aa2138b | ||
|  | 9ef4126d48 | ||
|  | 0cc8ed5ccc | ||
|  | e000f2ab6e | ||
|  | 2a4d1085cb | ||
|  | 3d15280278 | ||
|  | 53a7ccc08b | ||
|  | 1da094c9ad | ||
|  | 49c30ce958 | ||
|  | dc24fb51a3 | ||
|  | 40db59038c | ||
|  | 20baf128ef | ||
|  | 1562dd2c26 | ||
|  | fa465fb2b1 | ||
|  | 171ba1d0d1 | ||
|  | 06e2e1b87c | ||
|  | 66a49df9cb | ||
|  | 697680d687 | ||
|  | 3816ae9ce8 | ||
|  | 1f420b008b | ||
|  | 66a5562ce2 | ||
|  | 63503f2848 | ||
|  | b79a769b2d | ||
|  | 4ef195a369 | ||
|  | 0f07e0aea3 | ||
|  | a03e261193 | ||
|  | d3eb5df259 | ||
|  | 37924cf175 | ||
|  | cea4f1464b | ||
|  | 026ef8111a | ||
|  | e081603850 | ||
|  | 568d369d77 | ||
|  | 92a0e93ac3 | ||
|  | ae09292a6e | ||
|  | 9a82fde43a | ||
|  | 9e7ae34da5 | ||
|  | a94cd0d774 | ||
|  | d5448ceb95 | ||
|  | e61dadf3de | ||
|  | 2bd26f4afa | ||
|  | e3721a3b3f | ||
|  | 831fc138c1 | ||
|  | 28904e54d2 | ||
|  | de9c1c3627 | ||
|  | fbab11e9b0 | ||
|  | 6864220c28 | ||
|  | 3b7c5bfb98 | ||
|  | 6443da0865 | ||
|  | c07534dc71 | ||
|  | c0cb9bc84c | ||
|  | a453b3154e | ||
|  | ed1584aed8 | ||
|  | 5a143e91dc | ||
|  | 8aa98a409b | ||
|  | b15c49e59b | ||
|  | 029cb1fd0f | ||
|  | b5246de562 | ||
|  | 6e96ea535a | ||
|  | c02d1863d1 | ||
|  | d06e61aa80 | ||
|  | a3996ba2d1 | ||
|  | 8e33a83b68 | ||
|  | 70335540c6 | ||
|  | 14c3bdb3f7 | ||
|  | e46c3d7bcf | ||
|  | 99e75135ee | ||
|  | 9d9f66cc8d | ||
|  | a87914993d | ||
|  | 55418dc87d | ||
|  | 2ffa112ed3 | ||
|  | cd66f0e2d9 | ||
|  | 1226aba119 | ||
|  | 25d9f2dd24 | ||
|  | 734ef96d5f | ||
|  | db1fc51ccc | ||
|  | 45077fc323 | ||
|  | 279ea105d8 | ||
|  | f25b37c1da | ||
|  | 44791e2d78 | ||
|  | eff6f12032 | ||
|  | 09df5eaff2 | ||
|  | 9566cf0e2f | ||
|  | 4feac4e40e | ||
|  | 583ed4bde3 | ||
|  | 3eb8e5871f | ||
|  | ed18005a99 | ||
|  | d019f101e8 | ||
|  | 2b8e422b31 | ||
|  | 9e6e4ae49a | ||
|  | 57028236c8 | ||
|  | 1c71ec4d45 | ||
|  | 5da8289e9c | 
							
								
								
									
										14
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								Makefile
									
									
									
									
									
								
							| @@ -174,10 +174,10 @@ ultrix-gcc: | ||||
|  | ||||
| # Rules for making release tarballs | ||||
|  | ||||
| DIRECTORY = Mesa-7.1-rc1 | ||||
| LIB_NAME = MesaLib-7.1-rc1 | ||||
| DEMO_NAME = MesaDemos-7.1-rc1 | ||||
| GLUT_NAME = MesaGLUT-7.1-rc1 | ||||
| DIRECTORY = Mesa-7.1-rc3 | ||||
| LIB_NAME = MesaLib-7.1-rc3 | ||||
| DEMO_NAME = MesaDemos-7.1-rc3 | ||||
| GLUT_NAME = MesaGLUT-7.1-rc3 | ||||
|  | ||||
| MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/Makefile*						\ | ||||
| @@ -192,6 +192,7 @@ MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/bin/install-sh					\ | ||||
| 	$(DIRECTORY)/bin/mklib						\ | ||||
| 	$(DIRECTORY)/bin/minstall					\ | ||||
| 	$(DIRECTORY)/bin/version.mk					\ | ||||
| 	$(DIRECTORY)/configs/[a-z]*					\ | ||||
| 	$(DIRECTORY)/docs/*.html					\ | ||||
| 	$(DIRECTORY)/docs/COPYING					\ | ||||
| @@ -257,6 +258,7 @@ MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/src/mesa/tnl_dd/*.[ch]				\ | ||||
| 	$(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch]				\ | ||||
| 	$(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/Makefile				\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/beos/*.cpp			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/beos/Makefile			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/common/*.[ch]			\ | ||||
| @@ -264,6 +266,7 @@ MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/directfb/*.[ch]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/directfb/Makefile			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dos/*.[chS]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/fbdev/Makefile			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/glide/*.[ch]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/ggi/*.[ch]			\ | ||||
| @@ -273,6 +276,7 @@ MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/ggi/display/*.c			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/ggi/display/fbdev.conf.in		\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/ggi/include/ggi/mesa/*.h		\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.win		\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/osmesa/descrip.mms		\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def			\ | ||||
| @@ -280,6 +284,7 @@ MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/svga/*.[ch]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch]			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/windows/*/*.def			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/x11/Makefile			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/x11/descrip.mms			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/x11/*.[ch]			\ | ||||
| 	$(DIRECTORY)/src/mesa/ppc/*.[ch]				\ | ||||
| @@ -316,6 +321,7 @@ DRI_FILES = \ | ||||
| 	$(DIRECTORY)/src/glx/x11/*.[ch]					\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/Makefile			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/Makefile.template		\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/dri.pc.in			\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.[ch]		\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po		\ | ||||
| 	$(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS]			\ | ||||
|   | ||||
| @@ -42,6 +42,8 @@ if [ $# -ge 2 ] ; then | ||||
| 			exit 0 | ||||
| 		fi | ||||
|  | ||||
| 		PWDSAVE=`pwd` | ||||
|  | ||||
| 		# determine file's type | ||||
| 		if [ -h "$FILE" ] ; then | ||||
| 			#echo $FILE is a symlink | ||||
| @@ -57,7 +59,6 @@ if [ $# -ge 2 ] ; then | ||||
|  | ||||
| 			FILE=`basename "$FILE"` | ||||
| 			# Go to $DEST and make the link | ||||
| 			PWDSAVE="$PWD" | ||||
| 			cd "$DEST"        # pushd | ||||
| 				$RM "$FILE" | ||||
| 				$SYMLINK "$TARGET" "$FILE" | ||||
|   | ||||
							
								
								
									
										18
									
								
								bin/mklib
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								bin/mklib
									
									
									
									
									
								
							| @@ -61,7 +61,8 @@ do | ||||
| 	    echo '  -minor N      specifies minor version number (default is 0)' | ||||
| 	    echo '  -patch N      specifies patch version number (default is 0)' | ||||
| 	    echo '  -lLIBRARY     specifies a dependency on LIBRARY' | ||||
| 	    echo '  -LDIR         search in DIR for library dependencies' | ||||
| 	    echo '  -LDIR         search in DIR for library dependencies at build time' | ||||
| 	    echo '  -RDIR         search in DIR for library dependencies at run time' | ||||
| 	    echo '  -linker L     explicity specify the linker program to use (eg: gcc, g++)' | ||||
| 	    echo '                Not observed on all systems at this time.' | ||||
| 	    echo '  -ldflags OPT  specify any additional linker flags in OPT' | ||||
| @@ -107,6 +108,9 @@ do | ||||
| 	-L*) | ||||
| 	    DEPS="$DEPS $1" | ||||
| 	    ;; | ||||
| 	-R*) | ||||
| 	    DEPS="$DEPS $1" | ||||
| 	    ;; | ||||
| 	-Wl*) | ||||
|             DEPS="$DEPS $1" | ||||
|             ;; | ||||
| @@ -336,7 +340,7 @@ case $ARCH in | ||||
| 			# use g++ | ||||
| 			LINK="g++" | ||||
| 		    else | ||||
| 			echo "mklib: warning: can't find C++ comiler, trying CC." | ||||
| 			echo "mklib: warning: can't find C++ compiler, trying CC." | ||||
| 			LINK="CC" | ||||
| 		    fi | ||||
| 		else | ||||
| @@ -365,9 +369,11 @@ case $ARCH in | ||||
| 	    # Check if objects are SPARC v9 | ||||
| 	    # file says: ELF 64-bit MSB relocatable SPARCV9 Version 1 | ||||
| 	    set ${OBJECTS} | ||||
| 	    SPARCV9=`file $1 | grep SPARCV9` | ||||
| 	    if [ "${SPARCV9}" ] ; then | ||||
| 		OPTS="${OPTS} -xarch=v9" | ||||
| 	    if [ ${LINK} = "cc" -o ${LINK} = "CC" ] ; then | ||||
| 		SPARCV9=`file $1 | grep SPARCV9` | ||||
| 		if [ "${SPARCV9}" ] ; then | ||||
| 		    OPTS="${OPTS} -xarch=v9" | ||||
| 		fi | ||||
| 	    fi | ||||
|             if [ "${ALTOPTS}" ] ; then | ||||
|                 OPTS=${ALTOPTS} | ||||
| @@ -379,7 +385,7 @@ case $ARCH in | ||||
| 		${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} | ||||
| 	    else | ||||
| 		rm -f ${LIBNAME}.${MAJOR} ${LIBNAME} | ||||
| 		${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS} | ||||
| 		${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} -h ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS} | ||||
| 		ln -s ${LIBNAME}.${MAJOR} ${LIBNAME} | ||||
| 	    fi | ||||
| 	    FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}" | ||||
|   | ||||
| @@ -89,12 +89,18 @@ EXPAT_INCLUDES = @EXPAT_INCLUDES@ | ||||
| prefix = @prefix@ | ||||
| exec_prefix = @exec_prefix@ | ||||
| libdir = @libdir@ | ||||
| includedir = @includedir@ | ||||
|  | ||||
| # Installation directories (for make install) | ||||
| INSTALL_DIR = $(prefix) | ||||
| INSTALL_LIB_DIR = $(libdir) | ||||
| INSTALL_INC_DIR = $(includedir) | ||||
|  | ||||
| # DRI installation directories | ||||
| DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@ | ||||
|  | ||||
| # Where libGL will look for DRI hardware drivers | ||||
| DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR) | ||||
|  | ||||
| # Additional per-platform configuration settings | ||||
| @EXTRA_CONFIG_LINES@ | ||||
|   | ||||
| @@ -84,7 +84,9 @@ APP_LIB_DEPS = -lm | ||||
|  | ||||
| # Installation directories (for make install) | ||||
| INSTALL_DIR = /usr/local | ||||
| DRI_DRIVER_INSTALL_DIR = $(INSTALL_DIR)/$(LIB_DIR)/dri | ||||
| INSTALL_LIB_DIR = $(INSTALL_DIR)/$(LIB_DIR) | ||||
| INSTALL_INC_DIR = $(INSTALL_DIR)/include | ||||
| DRI_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/dri | ||||
|  | ||||
| # Where libGL will look for DRI hardware drivers | ||||
| DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR) | ||||
|   | ||||
							
								
								
									
										296
									
								
								configure.ac
									
									
									
									
									
								
							
							
						
						
									
										296
									
								
								configure.ac
									
									
									
									
									
								
							| @@ -29,6 +29,18 @@ AC_CHECK_PROGS([MAKE], [gmake make]) | ||||
| AC_PATH_PROG([MKDEP], [makedepend]) | ||||
| AC_PATH_PROG([SED], [sed]) | ||||
|  | ||||
| dnl Platform-specific program settings | ||||
| EXTRA_CONFIG_LINES="" | ||||
| AC_SUBST([EXTRA_CONFIG_LINES]) | ||||
| case "$host_os" in | ||||
| solaris*) | ||||
|     # Solaris /bin/sh is too old/non-POSIX compliant | ||||
|     AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh]) | ||||
|     EXTRA_CONFIG_LINES="SHELL=$POSIX_SHELL" | ||||
|     ;; | ||||
| esac | ||||
|  | ||||
|  | ||||
| MKDEP_OPTIONS=-fdepend | ||||
| dnl Ask gcc where it's keeping its secret headers | ||||
| if test "x$GCC" = xyes; then | ||||
| @@ -39,11 +51,6 @@ if test "x$GCC" = xyes; then | ||||
| fi | ||||
| AC_SUBST([MKDEP_OPTIONS]) | ||||
|  | ||||
| dnl Check to see if dlopen is in default libraries (like Solaris, which | ||||
| dnl has it in libc), or if libdl is needed to get it. | ||||
| AC_CHECK_FUNC([dlopen], [], | ||||
| 	[AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])]) | ||||
|  | ||||
| dnl Make sure the pkg-config macros are defined | ||||
| m4_ifdef([PKG_PROG_PKG_CONFIG],[],[ | ||||
|     m4_errprint([Error: Could not locate the pkg-config autoconf macros. | ||||
| @@ -78,7 +85,10 @@ linux*) | ||||
| if test "x$GCC" = xyes; then | ||||
|     DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE" | ||||
| fi | ||||
|     DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN" | ||||
|     DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS" | ||||
|     ;; | ||||
| solaris*) | ||||
|     DEFINES="$DEFINES -DPTHREADS -DSVR4" | ||||
|     ;; | ||||
| esac | ||||
|  | ||||
| @@ -230,6 +240,120 @@ AC_SUBST([GLUT_LIB_NAME]) | ||||
| AC_SUBST([GLW_LIB_NAME]) | ||||
| AC_SUBST([OSMESA_LIB_NAME]) | ||||
|  | ||||
| dnl | ||||
| dnl Arch/platform-specific settings | ||||
| dnl | ||||
| AC_ARG_ENABLE([asm], | ||||
|     [AS_HELP_STRING([--disable-asm], | ||||
|         [disable assembly usage @<:@default=enabled on supported plaforms@:>@])], | ||||
|     [enable_asm="$enableval"], | ||||
|     [enable_asm=yes] | ||||
| ) | ||||
| asm_arch="" | ||||
| ASM_FLAGS="" | ||||
| ASM_SOURCES="" | ||||
| ASM_API="" | ||||
| AC_MSG_CHECKING([whether to enable assembly]) | ||||
| test "x$enable_asm" = xno && AC_MSG_RESULT([no]) | ||||
| # disable if cross compiling on x86/x86_64 since we must run gen_matypes | ||||
| if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then | ||||
|     case "$host_cpu" in | ||||
|     i?86 | x86_64) | ||||
|         enable_asm=no | ||||
|         AC_MSG_RESULT([no, cross compiling]) | ||||
|         ;; | ||||
|     esac | ||||
| fi | ||||
| # check for supported arches | ||||
| if test "x$enable_asm" = xyes; then | ||||
|     case "$host_cpu" in | ||||
|     i?86) | ||||
|         case "$host_os" in | ||||
|         linux* | freebsd* | dragonfly*) | ||||
|             test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86 | ||||
|             ;; | ||||
|         esac | ||||
|         ;; | ||||
|     x86_64) | ||||
|         case "$host_os" in | ||||
|         linux* | freebsd* | dragonfly*) | ||||
|             test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64 | ||||
|             ;; | ||||
|         esac | ||||
|         ;; | ||||
|     powerpc) | ||||
|         case "$host_os" in | ||||
|         linux*) | ||||
|             asm_arch=ppc | ||||
|             ;; | ||||
|         esac | ||||
|         ;; | ||||
|     esac | ||||
|  | ||||
|     case "$asm_arch" in | ||||
|     x86) | ||||
|         ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" | ||||
|         ASM_SOURCES='$(X86_SOURCES)' | ||||
|         ASM_API='$(X86_API)' | ||||
|         AC_MSG_RESULT([yes, x86]) | ||||
|         ;; | ||||
|     x86_64) | ||||
|         ASM_FLAGS="-DUSE_X86_64_ASM" | ||||
|         ASM_SOURCES='$(X86-64_SOURCES)' | ||||
|         ASM_API='$(X86-64_API)' | ||||
|         AC_MSG_RESULT([yes, x86_64]) | ||||
|         ;; | ||||
|     ppc) | ||||
|         ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM" | ||||
|         ASM_SOURCES='$(PPC_SOURCES)' | ||||
|         AC_MSG_RESULT([yes, ppc]) | ||||
|         ;; | ||||
|     *) | ||||
|         AC_MSG_RESULT([no, platform not supported]) | ||||
|         ;; | ||||
|     esac | ||||
| fi | ||||
| AC_SUBST([ASM_FLAGS]) | ||||
| AC_SUBST([ASM_SOURCES]) | ||||
| AC_SUBST([ASM_API]) | ||||
|  | ||||
| dnl PIC code macro | ||||
| MESA_PIC_FLAGS | ||||
|  | ||||
| dnl Check to see if dlopen is in default libraries (like Solaris, which | ||||
| dnl has it in libc), or if libdl is needed to get it. | ||||
| AC_CHECK_FUNC([dlopen], [], | ||||
|     [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])]) | ||||
|  | ||||
| dnl See if posix_memalign is available | ||||
| AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"]) | ||||
|  | ||||
| dnl SELinux awareness. | ||||
| AC_ARG_ENABLE([selinux], | ||||
|     [AS_HELP_STRING([--enable-selinux], | ||||
|         [Build SELinux-aware Mesa @<:@default=disabled@:>@])], | ||||
|     [MESA_SELINUX="$enableval"], | ||||
|     [MESA_SELINUX=no]) | ||||
| if test "x$enable_selinux" = "xyes"; then | ||||
|     AC_CHECK_HEADER([selinux/selinux.h],[], | ||||
|                     [AC_MSG_ERROR([SELinux headers not found])]) | ||||
|     AC_CHECK_LIB([selinux],[is_selinux_enabled],[], | ||||
|                  [AC_MSG_ERROR([SELinux library not found])]) | ||||
|     SELINUX_LIBS="-lselinux" | ||||
|     DEFINES="$DEFINES -DMESA_SELINUX" | ||||
| fi | ||||
|  | ||||
| dnl OS-specific libraries | ||||
| OS_LIBS="" | ||||
| case "$host_os" in | ||||
| solaris*) | ||||
|     OS_LIBS="-lc" | ||||
|     if test "x$GXX" != xyes; then | ||||
|         OS_CPLUSPLUS_LIBS="-lCrun $OS_LIBS" | ||||
|     fi | ||||
|     ;; | ||||
| esac | ||||
|  | ||||
| dnl | ||||
| dnl Driver configuration. Options are xlib, dri and osmesa right now. | ||||
| dnl More later: directfb, fbdev, ... | ||||
| @@ -368,21 +492,6 @@ else | ||||
|     enable_xcb=no | ||||
| fi | ||||
|  | ||||
| # SELinux awareness. | ||||
| AC_ARG_ENABLE([selinux], | ||||
|     [AS_HELP_STRING([--enable-selinux], | ||||
|         [Build SELinux-aware Mesa (default: disabled)])], | ||||
|     [MESA_SELINUX="$enableval"], | ||||
|     [MESA_SELINUX=no]) | ||||
| if test "x$enable_selinux" = "xyes"; then | ||||
|     AC_CHECK_HEADER([selinux/selinux.h],[], | ||||
| 		    [AC_MSG_ERROR([SELinux headers not found])]) | ||||
|     AC_CHECK_LIB([selinux],[is_selinux_enabled],[], | ||||
| 		 [AC_MSG_ERROR([SELinux library not found])]) | ||||
|     SELINUX_LIBS="-lselinux" | ||||
|     DEFINES="$DEFINES -DMESA_SELINUX" | ||||
| fi | ||||
|  | ||||
| dnl | ||||
| dnl libGL configuration per driver | ||||
| dnl | ||||
| @@ -397,7 +506,7 @@ xlib) | ||||
|         X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" | ||||
|         GL_LIB_DEPS="$X_LIBS -lX11 -lXext" | ||||
|     fi | ||||
|     GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread" | ||||
|     GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $OS_LIBS" | ||||
|  | ||||
|     # if static, move the external libraries to the programs | ||||
|     # and empty the libraries for libGL | ||||
| @@ -441,11 +550,11 @@ dri) | ||||
|     fi | ||||
|  | ||||
|     # need DRM libs, -lpthread, etc. | ||||
|     GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" | ||||
|     GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS $OS_LIBS" | ||||
|     ;; | ||||
| osmesa) | ||||
|     # No libGL for osmesa | ||||
|     GL_LIB_DEPS="" | ||||
|     GL_LIB_DEPS="$OS_LIBS" | ||||
|     ;; | ||||
| esac | ||||
| AC_SUBST([GL_LIB_DEPS]) | ||||
| @@ -478,11 +587,25 @@ AC_ARG_ENABLE([driglx-direct], | ||||
|         [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])], | ||||
|     [driglx_direct="$enableval"], | ||||
|     [driglx_direct="yes"]) | ||||
| dnl ttm support | ||||
| AC_ARG_ENABLE([ttm-api], | ||||
|     [AS_HELP_STRING([--enable-ttm-api], | ||||
|         [enable TTM API users @<:@default=disabled@:>@])], | ||||
|     [ttmapi="$enableval"], | ||||
|     [ttmapi="no"]) | ||||
|  | ||||
| if test "x$ttmapi" = "xyes"; then | ||||
|     save_CFLAGS=$CFLAGS | ||||
|     CFLAGS=$LIBDRM_CFLAGS | ||||
|     AC_CHECK_HEADERS([xf86mm.h],[],[AC_MSG_ERROR([xf86mm.h required for TTM.])],[#include "stdint.h"\n#include "drm.h"]) | ||||
|     CFLAGS=$save_CFLAGS | ||||
| fi | ||||
|  | ||||
| dnl Which drivers to build - default is chosen by platform | ||||
| AC_ARG_WITH([dri-drivers], | ||||
|     [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@], | ||||
|         [comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])], | ||||
|         [comma delimited DRI drivers list, e.g. | ||||
|         "swrast,i965,radeon,nouveau" @<:@default=auto@:>@])], | ||||
|     [with_dri_drivers="$withval"], | ||||
|     [with_dri_drivers=yes]) | ||||
| if test "x$with_dri_drivers" = x; then | ||||
| @@ -496,7 +619,7 @@ case "$with_dri_drivers" in | ||||
| no|yes) ;; | ||||
| *) | ||||
|     # verify the requested driver directories exist | ||||
|     dri_drivers=`IFS=,; echo $with_dri_drivers` | ||||
|     dri_drivers=`IFS=', '; echo $with_dri_drivers` | ||||
|     for driver in $dri_drivers; do | ||||
|         test -d "$srcdir/src/mesa/drivers/dri/$driver" || \ | ||||
|             AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist]) | ||||
| @@ -516,6 +639,10 @@ if test "$mesa_driver" = dri; then | ||||
|         DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS" | ||||
|     fi | ||||
|  | ||||
|     if test "x$ttmapi" = xyes; then | ||||
|         DEFINES="$DEFINES -DTTM_API" | ||||
|     fi | ||||
|  | ||||
|     if test "x$USING_EGL" = x1; then | ||||
|         PROGRAM_DIRS="egl" | ||||
|     fi | ||||
| @@ -547,6 +674,12 @@ if test "$mesa_driver" = dri; then | ||||
|                 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast" | ||||
|             fi | ||||
|             ;; | ||||
|         sparc*) | ||||
|             # Build only the drivers for cards that exist on sparc` | ||||
|             if test "x$DRI_DIRS" = x; then | ||||
|                 DRI_DIRS="mach64 r128 r200 r300 radeon ffb swrast" | ||||
|             fi | ||||
|             ;; | ||||
|         esac | ||||
|         ;; | ||||
|     freebsd* | dragonfly*) | ||||
| @@ -567,6 +700,13 @@ if test "$mesa_driver" = dri; then | ||||
|                 unichrome savage sis swrast" | ||||
|         fi | ||||
|         ;; | ||||
|     solaris*) | ||||
|         DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" | ||||
|         DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" | ||||
|         if test "x$driglx_direct" = xyes; then | ||||
|             DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" | ||||
|         fi | ||||
|         ;; | ||||
|     esac | ||||
|  | ||||
|     # default drivers | ||||
| @@ -646,7 +786,7 @@ AC_SUBST([OSMESA_LIB]) | ||||
|  | ||||
| case "$mesa_driver" in | ||||
| osmesa) | ||||
|     # only link librararies with osmesa if shared | ||||
|     # only link libraries with osmesa if shared | ||||
|     if test "$enable_static" = no; then | ||||
|         OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS" | ||||
|     else | ||||
| @@ -657,7 +797,7 @@ osmesa) | ||||
| *) | ||||
|     # Link OSMesa to libGL otherwise | ||||
|     OSMESA_LIB_DEPS="" | ||||
|     # only link librararies with osmesa if shared | ||||
|     # only link libraries with osmesa if shared | ||||
|     if test "$enable_static" = no; then | ||||
|         OSMESA_MESA_DEPS='-l$(GL_LIB)' | ||||
|     else | ||||
| @@ -665,6 +805,9 @@ osmesa) | ||||
|     fi | ||||
|     ;; | ||||
| esac | ||||
| if test "$enable_static" = no; then | ||||
|     OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS $OS_LIBS" | ||||
| fi | ||||
| AC_SUBST([OSMESA_LIB_DEPS]) | ||||
| AC_SUBST([OSMESA_MESA_DEPS]) | ||||
|  | ||||
| @@ -708,6 +851,9 @@ if test "x$enable_glu" = xyes; then | ||||
|         ;; | ||||
|     esac | ||||
| fi | ||||
| if test "$enable_static" = no; then | ||||
|     GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS" | ||||
| fi | ||||
| AC_SUBST([GLU_LIB_DEPS]) | ||||
| AC_SUBST([GLU_MESA_DEPS]) | ||||
|  | ||||
| @@ -737,6 +883,7 @@ if test "x$enable_glw" = xyes; then | ||||
|     # If static, empty GLW_LIB_DEPS and add libs for programs to link | ||||
|     if test "$enable_static" = no; then | ||||
|         GLW_MESA_DEPS='-l$(GL_LIB)' | ||||
|         GLW_LIB_DEPS="$GLW_LIB_DEPS $OS_LIBS" | ||||
|     else | ||||
|         APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS" | ||||
|         GLW_LIB_DEPS="" | ||||
| @@ -784,7 +931,7 @@ if test "x$enable_glut" = xyes; then | ||||
|         # should check these... | ||||
|         GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi" | ||||
|     fi | ||||
|     GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm" | ||||
|     GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm $OS_LIBS" | ||||
|  | ||||
|     # If glut is available, we can build most programs | ||||
|     if test "$with_demos" = yes; then | ||||
| @@ -810,91 +957,18 @@ dnl    Only libm is added here if necessary as the libraries should | ||||
| dnl    be pulled in by the linker | ||||
| dnl | ||||
| if test "x$APP_LIB_DEPS" = x; then | ||||
|     APP_LIB_DEPS="-lm" | ||||
|     case "$host_os" in | ||||
|     solaris*) | ||||
|         APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm" | ||||
|         ;; | ||||
|     *) | ||||
|         APP_LIB_DEPS="-lm" | ||||
|         ;; | ||||
|     esac | ||||
| fi | ||||
| AC_SUBST([APP_LIB_DEPS]) | ||||
| AC_SUBST([PROGRAM_DIRS]) | ||||
|  | ||||
| dnl | ||||
| dnl Arch/platform-specific settings | ||||
| dnl | ||||
| AC_ARG_ENABLE([asm], | ||||
|     [AS_HELP_STRING([--disable-asm], | ||||
|         [disable assembly usage @<:@default=enabled on supported plaforms@:>@])], | ||||
|     [enable_asm="$enableval"], | ||||
|     [enable_asm=yes] | ||||
| ) | ||||
| asm_arch="" | ||||
| ASM_FLAGS="" | ||||
| ASM_SOURCES="" | ||||
| ASM_API="" | ||||
| AC_MSG_CHECKING([whether to enable assembly]) | ||||
| test "x$enable_asm" = xno && AC_MSG_RESULT([no]) | ||||
| # disable if cross compiling on x86/x86_64 since we must run gen_matypes | ||||
| if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then | ||||
|     case "$host_cpu" in | ||||
|     i?86 | x86_64) | ||||
|         enable_asm=no | ||||
|         AC_MSG_RESULT([no, cross compiling]) | ||||
|         ;; | ||||
|     esac | ||||
| fi | ||||
| # check for supported arches | ||||
| if test "x$enable_asm" = xyes; then | ||||
|     case "$host_cpu" in | ||||
|     i?86) | ||||
|         case "$host_os" in | ||||
|         linux* | freebsd* | dragonfly*) | ||||
|             test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86 | ||||
|             ;; | ||||
|         esac | ||||
|         ;; | ||||
|     x86_64) | ||||
|         case "$host_os" in | ||||
|         linux* | freebsd* | dragonfly*) | ||||
|             test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64 | ||||
|             ;; | ||||
|         esac | ||||
|         ;; | ||||
|     powerpc) | ||||
|         case "$host_os" in | ||||
|         linux*) | ||||
|             asm_arch=ppc | ||||
|             ;; | ||||
|         esac | ||||
|         ;; | ||||
|     esac | ||||
|  | ||||
|     case "$asm_arch" in | ||||
|     x86) | ||||
|         ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" | ||||
|         ASM_SOURCES='$(X86_SOURCES)' | ||||
|         ASM_API='$(X86_API)' | ||||
|         AC_MSG_RESULT([yes, x86]) | ||||
|         ;; | ||||
|     x86_64) | ||||
|         ASM_FLAGS="-DUSE_X86_64_ASM" | ||||
|         ASM_SOURCES='$(X86-64_SOURCES)' | ||||
|         ASM_API='$(X86-64_API)' | ||||
|         AC_MSG_RESULT([yes, x86_64]) | ||||
|         ;; | ||||
|     ppc) | ||||
|         ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM" | ||||
|         ASM_SOURCES='$(PPC_SOURCES)' | ||||
|         AC_MSG_RESULT([yes, ppc]) | ||||
|         ;; | ||||
|     *) | ||||
|         AC_MSG_RESULT([no, platform not supported]) | ||||
|         ;; | ||||
|     esac | ||||
| fi | ||||
| AC_SUBST([ASM_FLAGS]) | ||||
| AC_SUBST([ASM_SOURCES]) | ||||
| AC_SUBST([ASM_API]) | ||||
|  | ||||
| dnl PIC code macro | ||||
| MESA_PIC_FLAGS | ||||
|  | ||||
|  | ||||
| dnl Restore LDFLAGS and CPPFLAGS | ||||
| LDFLAGS="$_SAVE_LDFLAGS" | ||||
| @@ -920,6 +994,7 @@ echo "" | ||||
| echo "        prefix:          $prefix" | ||||
| echo "        exec_prefix:     $exec_prefix" | ||||
| echo "        libdir:          $libdir" | ||||
| echo "        includedir:      $includedir" | ||||
|  | ||||
| dnl Driver info | ||||
| echo "" | ||||
| @@ -934,6 +1009,7 @@ if test "$mesa_driver" = dri; then | ||||
|     dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/  */ /;s/ *$//'` | ||||
|     echo "        DRI drivers:     $dri_dirs" | ||||
|     echo "        DRI driver dir:  $DRI_DRIVER_INSTALL_DIR" | ||||
|     echo "        TTM API support: $ttmapi" | ||||
| fi | ||||
|  | ||||
| dnl Libraries | ||||
|   | ||||
| @@ -182,11 +182,12 @@ will search for DRI drivers. The default is <code>${libdir}/dri</code>. | ||||
| </li> | ||||
| <li><code>--with-dri-drivers=DRIVER,DRIVER,...</code> - This option | ||||
| allows a specific set of DRI drivers to be built. For example, | ||||
| <code>--with-dri-drivers="i965,radeon,nouveau"</code>. By default, | ||||
| the drivers will be chosen depending on the target platform. See the | ||||
| directory <code>src/mesa/drivers/dri</code> in the source tree for | ||||
| available drivers. | ||||
| </li> | ||||
| <code>--with-dri-drivers="swrast,i965,radeon,nouveau"</code>. By | ||||
| default, the drivers will be chosen depending on the target platform. | ||||
| See the directory <code>src/mesa/drivers/dri</code> in the source tree | ||||
| for available drivers. Beware that the swrast DRI driver is used by both | ||||
| libGL and the X.Org xserver GLX module to do software rendering, so you | ||||
| may run into problems if it is not available.</li> | ||||
| <!-- This explanation might be totally bogus. Kristian? --> | ||||
| <li><code>--disable-driglx-direct</code> - Disable direct rendering in | ||||
| GLX. Normally, direct hardware rendering through the DRI drivers and | ||||
|   | ||||
| @@ -18,6 +18,11 @@ Primary download site: | ||||
| target="_parent">SourceForge</a> | ||||
| </p> | ||||
|  | ||||
| <p> | ||||
| When a new release is coming, release candidates (betas) can be found | ||||
| <a href="http://www.mesa3d.org/beta/">here</a>. | ||||
| </p> | ||||
|  | ||||
|  | ||||
| <p> | ||||
| Mesa is distributed in several parts: | ||||
|   | ||||
| @@ -25,23 +25,12 @@ | ||||
| <h3>1.1 Prerequisites for DRI and Hardware Acceleration</h3> | ||||
|  | ||||
| <p> | ||||
| To build Mesa with DRI-based hardware acceleration you must first have | ||||
| the right version of DRM. | ||||
| To build Mesa 7.1 with DRI-based hardware acceleration you must first have | ||||
| the <a href="http://dri.freedesktop.org/libdrm/" target="_parent">DRM version 2.3.1</a>. | ||||
| </p> | ||||
|  | ||||
| <p> | ||||
| For Mesa 7.1 a particular snapshot of | ||||
| <a href="http://dri.freedesktop.org/libdrm/">DRM</a> from git is required: | ||||
| </p> | ||||
|  | ||||
| <pre> | ||||
| git-clone git://anongit.freedesktop.org/git/mesa/drm | ||||
| git-checkout (XXXX HASH ID TBD) | ||||
| </pre> | ||||
| </li> | ||||
|  | ||||
| <p> | ||||
| You should also be using Xorg server version 1.4 | ||||
| You should also be using the Xorg server version 1.4 or 1.5. | ||||
| </p> | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -26,13 +26,20 @@ TBD | ||||
|  | ||||
| <h2>New features</h2> | ||||
| <ul> | ||||
| <li>autoconf-based configuration | ||||
| <li>autoconf-based configuration (and clean-up of Makefiles) | ||||
| <li>Reduced dependencies between X server and Mesa | ||||
| <li>GL_EXT_texture_from_pixmap extension for Xlib driver | ||||
| <li>Support for the GL shading language with i965 driver (implemented by Intel) | ||||
| </ul> | ||||
|  | ||||
|  | ||||
| <h2>Bug fixes</h2> | ||||
| <ul> | ||||
| <li>Fixed a number of minor GLSL intrinsic function/constructor bugs | ||||
| <li>Fixed some error code/detection bugs in the GLSL-related API functions | ||||
| </ul> | ||||
|  | ||||
|  | ||||
| <h2>To Do (someday) items</h2> | ||||
| <ul> | ||||
| <li>Remove the MEMCPY() and _mesa_memcpy() wrappers and just use memcpy(). | ||||
|   | ||||
| @@ -1,17 +1,17 @@ | ||||
| <html> | ||||
| <head> | ||||
| <title>Mesa Source Code Documentation</title> | ||||
| <link href="doxygen.css" rel="stylesheet" type="text/css"> | ||||
| </head> | ||||
| <body> | ||||
| <div class="qindex"> | ||||
| <a class="qindex" href="../main/index.html">core</a> | | ||||
| <a class="qindex" href="../glapi/index.html">glapi</a> | | ||||
| <a class="qindex" href="../vbo/index.html">vbo</a> | | ||||
| <a class="qindex" href="../math/index.html">math</a> | | ||||
| <a class="qindex" href="../shader/index.html">shader</a> | | ||||
| <a class="qindex" href="../swrast/index.html">swrast</a> | | ||||
| <a class="qindex" href="../swrast_setup/index.html">swrast_setup</a> | | ||||
| <a class="qindex" href="../tnl/index.html">tnl</a> | | ||||
| <a class="qindex" href="../tnl_dd/index.html">tnl_dd</a> | ||||
| </div> | ||||
| <html> | ||||
| <head> | ||||
| <title>Mesa Source Code Documentation</title> | ||||
| <link href="doxygen.css" rel="stylesheet" type="text/css"> | ||||
| </head> | ||||
| <body> | ||||
| <div class="qindex"> | ||||
| <a class="qindex" href="../main/index.html">core</a> | | ||||
| <a class="qindex" href="../glapi/index.html">glapi</a> | | ||||
| <a class="qindex" href="../vbo/index.html">vbo</a> | | ||||
| <a class="qindex" href="../math/index.html">math</a> | | ||||
| <a class="qindex" href="../shader/index.html">shader</a> | | ||||
| <a class="qindex" href="../swrast/index.html">swrast</a> | | ||||
| <a class="qindex" href="../swrast_setup/index.html">swrast_setup</a> | | ||||
| <a class="qindex" href="../tnl/index.html">tnl</a> | | ||||
| <a class="qindex" href="../tnl_dd/index.html">tnl_dd</a> | ||||
| </div> | ||||
|   | ||||
| @@ -1,11 +1,11 @@ | ||||
| <html> | ||||
| <head><title>Mesa Source Code Documentation</title> | ||||
| <link href="doxygen.css" rel="stylesheet" type="text/css"> | ||||
| </head> | ||||
| <body> | ||||
| <div class="qindex"> | ||||
| <a class="qindex" href="../core_subset/index.html">Mesa Core</a> | | ||||
| <a class="qindex" href="../math_subset/index.html">math</a> | | ||||
| <a class="qindex" href="../miniglx/index.html">MiniGLX</a> | | ||||
| <a class="qindex" href="../radeon_subset/index.html">radeon_subset</a> | ||||
| </div> | ||||
| <html> | ||||
| <head><title>Mesa Source Code Documentation</title> | ||||
| <link href="doxygen.css" rel="stylesheet" type="text/css"> | ||||
| </head> | ||||
| <body> | ||||
| <div class="qindex"> | ||||
| <a class="qindex" href="../core_subset/index.html">Mesa Core</a> | | ||||
| <a class="qindex" href="../math_subset/index.html">math</a> | | ||||
| <a class="qindex" href="../miniglx/index.html">MiniGLX</a> | | ||||
| <a class="qindex" href="../radeon_subset/index.html">radeon_subset</a> | ||||
| </div> | ||||
|   | ||||
| @@ -1,76 +0,0 @@ | ||||
| /* | ||||
|  * Mesa 3-D graphics library | ||||
|  * Version:  3.0 | ||||
|  * Copyright (C) 1995-1998  Brian Paul | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Library General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library 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 | ||||
|  * Library General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Library General Public | ||||
|  * License along with this library; if not, write to the Free | ||||
|  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Example Foo/Mesa interface.  See src/ddsample.c for more info. | ||||
|  */ | ||||
|  | ||||
|  | ||||
|  | ||||
| #ifndef FOOMESA_H | ||||
| #define FOOMESA_H | ||||
|  | ||||
|  | ||||
|  | ||||
| typedef struct foo_mesa_visual  *FooMesaVisual; | ||||
|  | ||||
| typedef struct foo_mesa_buffer  *FooMesaBuffer; | ||||
|  | ||||
| typedef struct foo_mesa_context *FooMesaContext; | ||||
|  | ||||
|  | ||||
|  | ||||
| #ifdef BEOS | ||||
| #pragma export on | ||||
| #endif | ||||
|  | ||||
|  | ||||
| extern FooMesaVisual FooMesaChooseVisual( /* your params */ ); | ||||
|  | ||||
| extern void FooMesaDestroyVisual( FooMesaVisual visual ); | ||||
|  | ||||
|  | ||||
| extern FooMesaBuffer FooMesaCreateBuffer( FooMesaVisual visual, | ||||
|                                           void *your_window_id ); | ||||
|  | ||||
| extern void FooMesaDestroyBuffer( FooMesaBuffer buffer ); | ||||
|  | ||||
|  | ||||
| extern FooMesaContext FooMesaCreateContext( FooMesaVisual visual, | ||||
|                                             FooMesaContext sharelist ); | ||||
|  | ||||
| extern void FooMesaDestroyContext( FooMesaContext context ); | ||||
|  | ||||
|  | ||||
| extern void FooMesaMakeCurrent( FooMesaContext context, FooMesaBuffer buffer ); | ||||
|  | ||||
|  | ||||
| extern void FooMesaSwapBuffers( FooMesaBuffer buffer ); | ||||
|  | ||||
|  | ||||
| /* Probably some more functions... */ | ||||
|  | ||||
|  | ||||
| #ifdef BEOS | ||||
| #pragma export off | ||||
| #endif | ||||
|  | ||||
| #endif | ||||
| @@ -130,7 +130,7 @@ extern void WMesaPaletteChange(HPALETTE Pal); | ||||
|  | ||||
| extern void WMesaMove(void); | ||||
|  | ||||
|  | ||||
| void WMesaShareLists(WMesaContext ctx_to_share, WMesaContext ctx); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
|   | ||||
| @@ -955,7 +955,6 @@ Init(void) | ||||
|    glGenTextures(1, &GrayTexture); | ||||
|    glBindTexture(GL_TEXTURE_1D, GrayTexture); | ||||
|    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP); | ||||
|    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP); | ||||
|    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | ||||
|    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | ||||
|    { | ||||
|   | ||||
| @@ -76,6 +76,7 @@ int textureWidth = 64; | ||||
| int textureHeight = 64; | ||||
|  | ||||
| int winWidth = 580, winHeight = 720; | ||||
| int win; | ||||
|  | ||||
| struct formatInfo { | ||||
|    GLenum	baseFormat; | ||||
| @@ -288,6 +289,7 @@ static void keyboard( unsigned char c, int x, int y ) | ||||
|       displayLevelInfo = !displayLevelInfo; | ||||
|       break; | ||||
|    case 27:             /* Escape key should force exit. */ | ||||
|       glutDestroyWindow(win); | ||||
|       exit(0); | ||||
|       break; | ||||
|    default: | ||||
| @@ -785,7 +787,7 @@ int main( int argc, char *argv[] ) | ||||
|  | ||||
|    glutInitWindowSize( winWidth, winHeight ); | ||||
|    glutInitWindowPosition( 0, 0 ); | ||||
|    glutCreateWindow( "Texture Environment Test" ); | ||||
|    win = glutCreateWindow( "Texture Environment Test" ); | ||||
|  | ||||
|    initialize(); | ||||
|    instructions(); | ||||
|   | ||||
							
								
								
									
										3
									
								
								progs/glsl/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								progs/glsl/.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -4,10 +4,13 @@ bump | ||||
| deriv | ||||
| extfuncs.h | ||||
| mandelbrot | ||||
| multitex | ||||
| noise | ||||
| points | ||||
| readtex.c | ||||
| readtex.h | ||||
| shaderutil.c | ||||
| shaderutil.h | ||||
| texdemo1 | ||||
| toyball | ||||
| trirast | ||||
|   | ||||
| @@ -407,7 +407,10 @@ test(GLenum type, GLint bits, const char *filename) | ||||
|    glGetIntegerv(GL_ALPHA_BITS, &cBits); | ||||
|    assert(cBits == bits); | ||||
|  | ||||
|    printf("Rendering %d bit/channel image: %s\n", bits, filename); | ||||
|    if (WriteFiles) | ||||
|       printf("Rendering %d bit/channel image: %s\n", bits, filename); | ||||
|    else | ||||
|       printf("Rendering %d bit/channel image\n", bits); | ||||
|  | ||||
|    OSMesaColorClamp(GL_TRUE); | ||||
|  | ||||
| @@ -458,6 +461,8 @@ main( int argc, char *argv[] ) | ||||
| { | ||||
|    int i; | ||||
|  | ||||
|    printf("Use -f to write image files\n"); | ||||
|  | ||||
|    for (i = 1; i < argc; i++) { | ||||
|       if (strcmp(argv[i], "-f") == 0) | ||||
|          WriteFiles = GL_TRUE; | ||||
|   | ||||
| @@ -16,6 +16,7 @@ | ||||
| static GLfloat Zrot = 0; | ||||
| static GLboolean Anim = GL_TRUE; | ||||
| static GLboolean HaveMultisample = GL_TRUE; | ||||
| static GLboolean DoMultisample = GL_TRUE; | ||||
|  | ||||
|  | ||||
| static void | ||||
| @@ -86,7 +87,10 @@ Display( void ) | ||||
|    glColor3f(1, 1, 1); | ||||
|    if (HaveMultisample) { | ||||
|       glRasterPos2f(-3.1, -1.6); | ||||
|       PrintString("MULTISAMPLE"); | ||||
|       if (DoMultisample) | ||||
|          PrintString("MULTISAMPLE"); | ||||
|       else | ||||
|          PrintString("MULTISAMPLE (off)"); | ||||
|    } | ||||
|    glRasterPos2f(-0.8, -1.6); | ||||
|    PrintString("No antialiasing"); | ||||
| @@ -96,7 +100,8 @@ Display( void ) | ||||
|    /* multisample */ | ||||
|    if (HaveMultisample) { | ||||
|       glEnable(GL_DEPTH_TEST); | ||||
|       glEnable(GL_MULTISAMPLE_ARB); | ||||
|       if (DoMultisample) | ||||
|          glEnable(GL_MULTISAMPLE_ARB); | ||||
|       glPushMatrix(); | ||||
|       glTranslatef(-2.5, 0, 0); | ||||
|       glPushMatrix(); | ||||
| @@ -173,6 +178,9 @@ Key( unsigned char key, int x, int y ) | ||||
|          else | ||||
|             glutIdleFunc(NULL); | ||||
|          break; | ||||
|       case 'm': | ||||
|          DoMultisample = !DoMultisample; | ||||
|          break; | ||||
|       case 'z': | ||||
|          Zrot = (int) (Zrot - step); | ||||
|          break; | ||||
|   | ||||
| @@ -88,12 +88,18 @@ current_time(void) | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /** Event handler results: */ | ||||
| #define NOP 0 | ||||
| #define EXIT 1 | ||||
| #define DRAW 2 | ||||
|  | ||||
| static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0; | ||||
| static GLint gear1, gear2, gear3; | ||||
| static GLfloat angle = 0.0; | ||||
|  | ||||
| static GLboolean fullscreen = GL_FALSE;	/* Create a single fullscreen window */ | ||||
| static GLboolean stereo = GL_FALSE;	/* Enable stereo.  */ | ||||
| static GLboolean animate = GL_TRUE;	/* Animation */ | ||||
| static GLfloat eyesep = 5.0;		/* Eye separation. */ | ||||
| static GLfloat fix_point = 40.0;	/* Fixation point distance.  */ | ||||
| static GLfloat left, right, asp;	/* Stereo frustum params.  */ | ||||
| @@ -239,7 +245,7 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, | ||||
|  | ||||
|  | ||||
| static void | ||||
| do_draw(void) | ||||
| draw(void) | ||||
| { | ||||
|    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | ||||
|  | ||||
| @@ -269,8 +275,9 @@ do_draw(void) | ||||
|    glPopMatrix(); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| draw(void) | ||||
| draw_gears(void) | ||||
| { | ||||
|    if (stereo) { | ||||
|       /* First left eye.  */ | ||||
| @@ -284,7 +291,7 @@ draw(void) | ||||
|  | ||||
|       glPushMatrix(); | ||||
|       glTranslated(+0.5 * eyesep, 0.0, 0.0); | ||||
|       do_draw(); | ||||
|       draw(); | ||||
|       glPopMatrix(); | ||||
|  | ||||
|       /* Then right eye.  */ | ||||
| @@ -298,10 +305,50 @@ draw(void) | ||||
|  | ||||
|       glPushMatrix(); | ||||
|       glTranslated(-0.5 * eyesep, 0.0, 0.0); | ||||
|       do_draw(); | ||||
|       draw(); | ||||
|       glPopMatrix(); | ||||
|    } else | ||||
|       do_draw(); | ||||
|    } | ||||
|    else { | ||||
|       draw(); | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| /** Draw single frame, do SwapBuffers, compute FPS */ | ||||
| static void | ||||
| draw_frame(Display *dpy, Window win) | ||||
| { | ||||
|    static int frames = 0; | ||||
|    static double tRot0 = -1.0, tRate0 = -1.0; | ||||
|    double dt, t = current_time(); | ||||
|  | ||||
|    if (tRot0 < 0.0) | ||||
|       tRot0 = t; | ||||
|    dt = t - tRot0; | ||||
|    tRot0 = t; | ||||
|  | ||||
|    if (animate) { | ||||
|       /* advance rotation for next frame */ | ||||
|       angle += 70.0 * dt;  /* 70 degrees per second */ | ||||
|       if (angle > 3600.0) | ||||
|          angle -= 3600.0; | ||||
|    } | ||||
|  | ||||
|    draw_gears(); | ||||
|    glXSwapBuffers(dpy, win); | ||||
|  | ||||
|    frames++; | ||||
|     | ||||
|    if (tRate0 < 0.0) | ||||
|       tRate0 = t; | ||||
|    if (t - tRate0 >= 5.0) { | ||||
|       GLfloat seconds = t - tRate0; | ||||
|       GLfloat fps = frames / seconds; | ||||
|       printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, | ||||
|              fps); | ||||
|       tRate0 = t; | ||||
|       frames = 0; | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -319,7 +366,8 @@ reshape(int width, int height) | ||||
|  | ||||
|       left = -5.0 * ((w - 0.5 * eyesep) / fix_point); | ||||
|       right = 5.0 * ((w + 0.5 * eyesep) / fix_point); | ||||
|    } else { | ||||
|    } | ||||
|    else { | ||||
|       GLfloat h = (GLfloat) height / (GLfloat) width; | ||||
|  | ||||
|       glMatrixMode(GL_PROJECTION); | ||||
| @@ -430,6 +478,7 @@ make_window( Display *dpy, const char *name, | ||||
|    attr.border_pixel = 0; | ||||
|    attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone); | ||||
|    attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; | ||||
|    /* XXX this is a bad way to get a borderless window! */ | ||||
|    attr.override_redirect = fullscreen; | ||||
|    mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect; | ||||
|  | ||||
| @@ -463,79 +512,70 @@ make_window( Display *dpy, const char *name, | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Handle one X event. | ||||
|  * \return NOP, EXIT or DRAW | ||||
|  */ | ||||
| static int | ||||
| handle_event(Display *dpy, Window win, XEvent *event) | ||||
| { | ||||
|    switch (event->type) { | ||||
|    case Expose: | ||||
|       return DRAW; | ||||
|    case ConfigureNotify: | ||||
|       reshape(event->xconfigure.width, event->xconfigure.height); | ||||
|       break; | ||||
|    case KeyPress: | ||||
|       { | ||||
|          char buffer[10]; | ||||
|          int r, code; | ||||
|          code = XLookupKeysym(&event->xkey, 0); | ||||
|          if (code == XK_Left) { | ||||
|             view_roty += 5.0; | ||||
|          } | ||||
|          else if (code == XK_Right) { | ||||
|             view_roty -= 5.0; | ||||
|          } | ||||
|          else if (code == XK_Up) { | ||||
|             view_rotx += 5.0; | ||||
|          } | ||||
|          else if (code == XK_Down) { | ||||
|             view_rotx -= 5.0; | ||||
|          } | ||||
|          else { | ||||
|             r = XLookupString(&event->xkey, buffer, sizeof(buffer), | ||||
|                               NULL, NULL); | ||||
|             if (buffer[0] == 27) { | ||||
|                /* escape */ | ||||
|                return EXIT; | ||||
|             } | ||||
|             else if (buffer[0] == 'a' || buffer[0] == 'A') { | ||||
|                animate = !animate; | ||||
|             } | ||||
|          } | ||||
|          return DRAW; | ||||
|       } | ||||
|    } | ||||
|    return NOP; | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| event_loop(Display *dpy, Window win) | ||||
| { | ||||
|    while (1) { | ||||
|       while (XPending(dpy) > 0) { | ||||
|       int op; | ||||
|       while (!animate || XPending(dpy) > 0) { | ||||
|          XEvent event; | ||||
|          XNextEvent(dpy, &event); | ||||
|          switch (event.type) { | ||||
| 	 case Expose: | ||||
|             /* we'll redraw below */ | ||||
| 	    break; | ||||
| 	 case ConfigureNotify: | ||||
| 	    reshape(event.xconfigure.width, event.xconfigure.height); | ||||
| 	    break; | ||||
|          case KeyPress: | ||||
|             { | ||||
|                char buffer[10]; | ||||
|                int r, code; | ||||
|                code = XLookupKeysym(&event.xkey, 0); | ||||
|                if (code == XK_Left) { | ||||
|                   view_roty += 5.0; | ||||
|                } | ||||
|                else if (code == XK_Right) { | ||||
|                   view_roty -= 5.0; | ||||
|                } | ||||
|                else if (code == XK_Up) { | ||||
|                   view_rotx += 5.0; | ||||
|                } | ||||
|                else if (code == XK_Down) { | ||||
|                   view_rotx -= 5.0; | ||||
|                } | ||||
|                else { | ||||
|                   r = XLookupString(&event.xkey, buffer, sizeof(buffer), | ||||
|                                     NULL, NULL); | ||||
|                   if (buffer[0] == 27) { | ||||
|                      /* escape */ | ||||
|                      return; | ||||
|                   } | ||||
|                } | ||||
|             } | ||||
|          } | ||||
|          op = handle_event(dpy, win, &event); | ||||
|          if (op == EXIT) | ||||
|             return; | ||||
|          else if (op == DRAW) | ||||
|             break; | ||||
|       } | ||||
|  | ||||
|       { | ||||
|          static int frames = 0; | ||||
|          static double tRot0 = -1.0, tRate0 = -1.0; | ||||
|          double dt, t = current_time(); | ||||
|          if (tRot0 < 0.0) | ||||
|             tRot0 = t; | ||||
|          dt = t - tRot0; | ||||
|          tRot0 = t; | ||||
|  | ||||
|          /* advance rotation for next frame */ | ||||
|          angle += 70.0 * dt;  /* 70 degrees per second */ | ||||
|          if (angle > 3600.0) | ||||
|              angle -= 3600.0; | ||||
|  | ||||
|          draw(); | ||||
|          glXSwapBuffers(dpy, win); | ||||
|  | ||||
|          frames++; | ||||
|  | ||||
|          if (tRate0 < 0.0) | ||||
|             tRate0 = t; | ||||
|          if (t - tRate0 >= 5.0) { | ||||
|             GLfloat seconds = t - tRate0; | ||||
|             GLfloat fps = frames / seconds; | ||||
|             printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, | ||||
|                    fps); | ||||
|             tRate0 = t; | ||||
|             frames = 0; | ||||
|          } | ||||
|       } | ||||
|       draw_frame(dpy, win); | ||||
|    } | ||||
| } | ||||
|  | ||||
| @@ -548,8 +588,7 @@ usage(void) | ||||
|    printf("  -stereo                 run in stereo mode\n"); | ||||
|    printf("  -fullscreen             run in fullscreen mode\n"); | ||||
|    printf("  -info                   display OpenGL renderer info\n"); | ||||
|    printf("  -winwidth <width>       window width (default: 300)\n"); | ||||
|    printf("  -winheight <height>     window height (default: 300)\n"); | ||||
|    printf("  -geometry WxH+X+Y       window geometry\n"); | ||||
| } | ||||
|   | ||||
|  | ||||
|   | ||||
| @@ -21,7 +21,7 @@ subdirs: | ||||
| 		fi \ | ||||
| 	done | ||||
|  | ||||
| install: | ||||
| install: $(TOP)/$(LIB_DIR) | ||||
| 	@for dir in $(SUBDIRS) ; do \ | ||||
| 		if [ -d $$dir ] ; then \ | ||||
| 			(cd $$dir && $(MAKE) install) || exit 1 ; \ | ||||
| @@ -29,7 +29,7 @@ install: | ||||
| 	done | ||||
|  | ||||
| $(TOP)/$(LIB_DIR): | ||||
| 	-mkdir $(TOP)/$(LIB_DIR) | ||||
| 	-@test -d $(TOP)/$(LIB_DIR) || mkdir -p $(TOP)/$(LIB_DIR) | ||||
|  | ||||
|  | ||||
| clean: | ||||
|   | ||||
| @@ -16,16 +16,17 @@ default: $(TOP)/configs/current | ||||
| # GLU pkg-config file | ||||
| pcedit = sed \ | ||||
| 	-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ | ||||
| 	-e 's,@LIB_DIR@,$(LIB_DIR),' \ | ||||
| 	-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ | ||||
| 	-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ | ||||
| 	-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' | ||||
| glu.pc: glu.pc.in | ||||
| 	$(pcedit) $< > $@ | ||||
|  | ||||
| install: glu.pc | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) $(TOP)/$(LIB_DIR)/libGLU.* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 	$(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) $(TOP)/$(LIB_DIR)/libGLU.* $(DESTDIR)$(INSTALL_LIB_DIR) | ||||
| 	$(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig | ||||
|  | ||||
| clean: | ||||
| 	-@for dir in $(SUBDIRS) ; do \ | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| prefix=@INSTALL_DIR@ | ||||
| exec_prefix=${prefix} | ||||
| libdir=${exec_prefix}/@LIB_DIR@ | ||||
| includedir=${prefix}/include | ||||
| libdir=@INSTALL_LIB_DIR@ | ||||
| includedir=@INSTALL_INC_DIR@ | ||||
|  | ||||
| Name: glu | ||||
| Description: Mesa OpenGL Utility library | ||||
|   | ||||
| @@ -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 = 0.0, sintemp4 = 0.0; | ||||
|     GLfloat costemp1, costemp2 = 0.0, costemp3 = 0.0, costemp4 = 0.0; | ||||
|     GLfloat sintemp1 = 0.0, sintemp2 = 0.0, sintemp3 = 0.0, sintemp4 = 0.0; | ||||
|     GLfloat costemp1 = 0.0, costemp2 = 0.0, costemp3 = 0.0, costemp4 = 0.0; | ||||
|     GLboolean needCache2, needCache3; | ||||
|     GLint start, finish; | ||||
|  | ||||
|   | ||||
| @@ -69,10 +69,10 @@ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS) | ||||
| 		$(MKLIB_OPTIONS) $(OBJECTS) | ||||
|  | ||||
| install: | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 	$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL | ||||
| 	$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) | ||||
| 	$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_INC_DIR)/GL | ||||
| 	$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR) | ||||
|  | ||||
| # Run 'make -f Makefile.solo dep' to update the dependencies if you change | ||||
| # what's included by any source file. | ||||
|   | ||||
| @@ -100,18 +100,19 @@ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS) | ||||
| # glut pkgconfig file | ||||
| pcedit = sed \ | ||||
| 	-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ | ||||
| 	-e 's,@LIB_DIR@,$(LIB_DIR),' \ | ||||
| 	-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ | ||||
| 	-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ | ||||
| 	-e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' | ||||
| glut.pc: glut.pc.in | ||||
| 	$(pcedit) $< > $@ | ||||
|  | ||||
| install: glut.pc | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL | ||||
| 	$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 	$(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_INC_DIR)/GL | ||||
| 	$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR) | ||||
| 	$(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig | ||||
|  | ||||
|  | ||||
| clean: | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| prefix=@INSTALL_DIR@ | ||||
| exec_prefix=${prefix} | ||||
| libdir=${exec_prefix}/@LIB_DIR@ | ||||
| includedir=${prefix}/include | ||||
| libdir=@INSTALL_LIB_DIR@ | ||||
| includedir=@INSTALL_INC_DIR@ | ||||
|  | ||||
| Name: glut | ||||
| Description: Mesa OpenGL Utility Toolkit library | ||||
|   | ||||
| @@ -75,18 +75,19 @@ tags: | ||||
| # glut pkgconfig file | ||||
| pcedit = sed \ | ||||
| 	-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ | ||||
| 	-e 's,@LIB_DIR@,$(LIB_DIR),' \ | ||||
| 	-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ | ||||
| 	-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ | ||||
| 	-e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' | ||||
| glut.pc: glut.pc.in | ||||
| 	$(pcedit) $< > $@ | ||||
|  | ||||
| install: glut.pc | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL | ||||
| 	$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 	$(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_INC_DIR)/GL | ||||
| 	$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR) | ||||
| 	$(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig | ||||
|  | ||||
|  | ||||
| # Remove .o and backup files | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| prefix=@INSTALL_DIR@ | ||||
| exec_prefix=${prefix} | ||||
| libdir=${exec_prefix}/@LIB_DIR@ | ||||
| includedir=${prefix}/include | ||||
| libdir=@INSTALL_LIB_DIR@ | ||||
| includedir=@INSTALL_INC_DIR@ | ||||
|  | ||||
| Name: glut | ||||
| Description: Mesa OpenGL Utility Toolkit library | ||||
|   | ||||
| @@ -1,420 +1,420 @@ | ||||
| /* WarpWin.c     */ | ||||
| /* glut for Warp */ | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
|  | ||||
| #include "WarpWin.h" | ||||
| #include "WarpGL.h" | ||||
|  | ||||
| #define POKA 0 | ||||
|  | ||||
| /* global variables that must be set for some functions to operate | ||||
|    correctly. */ | ||||
| HDC XHDC; | ||||
| HWND XHWND; | ||||
|  | ||||
|  | ||||
| void | ||||
| XStoreColor(Display* display, Colormap colormap, XColor* color) | ||||
| { | ||||
|   /* KLUDGE: set XHDC to 0 if the palette should NOT be realized after | ||||
|      setting the color.  set XHDC to the correct HDC if it should. */ | ||||
|  | ||||
|   LONG pe; | ||||
|   ULONG cclr; | ||||
|   int r,g,b; | ||||
|   /* X11 stores color from 0-65535, Win32 expects them to be 0-256, so | ||||
|      twiddle the bits ( / 256). */ | ||||
|   r = color->red / 256; | ||||
|   g = color->green / 256; | ||||
|   b = color->blue / 256; | ||||
|   pe = LONGFromRGB(r,g,b); | ||||
|   /* make sure we use this flag, otherwise the colors might get mapped | ||||
|      to another place in the colormap, and when we glIndex() that | ||||
|      color, it may have moved (argh!!) */ | ||||
|   pe |= (PC_NOCOLLAPSE<<24); | ||||
| /* This function changes the entries in a palette.  */ | ||||
| #if POKA | ||||
| OS2: | ||||
|  rc = GpiSetPaletteEntries(colormap,LCOLF_CONSECRGB, color->pixel, 1, &pe); | ||||
|  GpiSelectPalette(hps,colormap); | ||||
|  WinRealizePalette(hwnd,hps,&cclr); | ||||
| source Win: | ||||
|   if (XHDC) { | ||||
|     UnrealizeObject(colormap); | ||||
|     SelectPalette(XHDC, colormap, FALSE); | ||||
|     RealizePalette(XHDC); | ||||
|  | ||||
|    } | ||||
| #endif | ||||
| } | ||||
|  | ||||
| void | ||||
| XSetWindowColormap(Display* display, Window window, Colormap colormap) | ||||
| { | ||||
| #if POKA | ||||
|   HDC hdc = GetDC(window); | ||||
|  | ||||
|   /* if the third parameter is FALSE, the logical colormap is copied | ||||
|      into the device palette when the application is in the | ||||
|      foreground, if it is TRUE, the colors are mapped into the current | ||||
|      palette in the best possible way. */ | ||||
|   SelectPalette(hdc, colormap, FALSE); | ||||
|   RealizePalette(hdc); | ||||
|  | ||||
|   /* note that we don't have to release the DC, since our window class | ||||
|      uses the WC_OWNDC flag! */ | ||||
| #endif | ||||
| } | ||||
|  | ||||
|  | ||||
| /* display, root and visual - don't used at all */ | ||||
| Colormap | ||||
| XCreateColormap(Display* display, Window root, Visual* visual, int alloc) | ||||
| { | ||||
|   /* KLUDGE: this function needs XHDC to be set to the HDC currently | ||||
|      being operated on before it is invoked! */ | ||||
|  | ||||
|   HPAL    palette; | ||||
|   int n; | ||||
| #if POKA | ||||
|   PIXELFORMATDESCRIPTOR pfd; | ||||
|   LOGPALETTE *logical; | ||||
|  | ||||
|   /* grab the pixel format */ | ||||
|   memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); | ||||
|   DescribePixelFormat(XHDC, GetPixelFormat(XHDC), | ||||
|                      sizeof(PIXELFORMATDESCRIPTOR), &pfd); | ||||
|  | ||||
|   if (!(pfd.dwFlags & PFD_NEED_PALETTE || | ||||
|       pfd.iPixelType == PFD_TYPE_COLORINDEX)) | ||||
|   { | ||||
|     return 0; | ||||
|   } | ||||
|  | ||||
|   n = 1 << pfd.cColorBits; | ||||
|  | ||||
|   /* allocate a bunch of memory for the logical palette (assume 256 | ||||
|      colors in a Win32 palette */ | ||||
|   logical = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) + | ||||
|                                sizeof(PALETTEENTRY) * n); | ||||
|   memset(logical, 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * n); | ||||
|  | ||||
|   /* set the entries in the logical palette */ | ||||
|   logical->palVersion = 0x300; | ||||
|   logical->palNumEntries = n; | ||||
|  | ||||
|   /* start with a copy of the current system palette */ | ||||
|   GetSystemPaletteEntries(XHDC, 0, 256, &logical->palPalEntry[0]); | ||||
|  | ||||
|   if (pfd.iPixelType == PFD_TYPE_RGBA) { | ||||
|     int redMask = (1 << pfd.cRedBits) - 1; | ||||
|     int greenMask = (1 << pfd.cGreenBits) - 1; | ||||
|     int blueMask = (1 << pfd.cBlueBits) - 1; | ||||
|     int i; | ||||
|  | ||||
|     /* fill in an RGBA color palette */ | ||||
|     for (i = 0; i < n; ++i) { | ||||
|       logical->palPalEntry[i].peRed = | ||||
|        (((i >> pfd.cRedShift)   & redMask)   * 255) / redMask; | ||||
|       logical->palPalEntry[i].peGreen = | ||||
|        (((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask; | ||||
|        logical->palPalEntry[i].peBlue = | ||||
|        (((i >> pfd.cBlueShift)  & blueMask)  * 255) / blueMask; | ||||
|       logical->palPalEntry[i].peFlags = 0; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   palette = CreatePalette(logical); | ||||
|   free(logical); | ||||
|  | ||||
|   SelectPalette(XHDC, palette, FALSE); | ||||
|   RealizePalette(XHDC); | ||||
| #endif /* POKA */ | ||||
|  | ||||
|   return palette; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| int  GetSystemMetrics( int mode) | ||||
| {  RECTL rect; | ||||
|  | ||||
|    switch(mode) | ||||
|    {   case   SM_CXSCREEN: | ||||
|         WinQueryWindowRect(HWND_DESKTOP,&rect); | ||||
|         return (rect.xRight-rect.xLeft); | ||||
|       break; | ||||
|        case   SM_CYSCREEN: | ||||
|         WinQueryWindowRect(HWND_DESKTOP,&rect); | ||||
|         return (rect.yTop-rect.yBottom); | ||||
|       break; | ||||
|        default: ; | ||||
|    } | ||||
|    return 0; | ||||
| } | ||||
| /* | ||||
|  *    XParseGeometry parses strings of the form | ||||
|  *   "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where | ||||
|  *   width, height, xoffset, and yoffset are unsigned integers. | ||||
|  *   Example:  "=80x24+300-49" | ||||
|  *   The equal sign is optional. | ||||
|  *   It returns a bitmask that indicates which of the four values | ||||
|  *   were actually found in the string.  For each value found, | ||||
|  *   the corresponding argument is updated;  for each value | ||||
|  *   not found, the corresponding argument is left unchanged. | ||||
|  */ | ||||
|  | ||||
| static int | ||||
| ReadInteger(char *string, char **NextString) | ||||
| { | ||||
|     register int Result = 0; | ||||
|     int Sign = 1; | ||||
|  | ||||
|     if (*string == '+') | ||||
|        string++; | ||||
|     else if (*string == '-') | ||||
|     { | ||||
|        string++; | ||||
|        Sign = -1; | ||||
|     } | ||||
|     for (; (*string >= '0') && (*string <= '9'); string++) | ||||
|     { | ||||
|        Result = (Result * 10) + (*string - '0'); | ||||
|     } | ||||
|     *NextString = string; | ||||
|     if (Sign >= 0) | ||||
|        return (Result); | ||||
|     else | ||||
|        return (-Result); | ||||
| } | ||||
|  | ||||
| int XParseGeometry(char *string, int *x, int *y, unsigned int *width, unsigned int *height) | ||||
| { | ||||
|        int mask = NoValue; | ||||
|        register char *strind; | ||||
|        unsigned int tempWidth, tempHeight; | ||||
|        int tempX, tempY; | ||||
|        char *nextCharacter; | ||||
|  | ||||
|        if ( (string == NULL) || (*string == '\0')) return(mask); | ||||
|        if (*string == '=') | ||||
|                string++;  /* ignore possible '=' at beg of geometry spec */ | ||||
|  | ||||
|        strind = (char *)string; | ||||
|        if (*strind != '+' && *strind != '-' && *strind != 'x') { | ||||
|                tempWidth = ReadInteger(strind, &nextCharacter); | ||||
|                if (strind == nextCharacter) | ||||
|                    return (0); | ||||
|                strind = nextCharacter; | ||||
|                mask |= WidthValue; | ||||
|        } | ||||
|  | ||||
|        if (*strind == 'x' || *strind == 'X') { | ||||
|                strind++; | ||||
|                tempHeight = ReadInteger(strind, &nextCharacter); | ||||
|                if (strind == nextCharacter) | ||||
|                    return (0); | ||||
|                strind = nextCharacter; | ||||
|                mask |= HeightValue; | ||||
|        } | ||||
|  | ||||
|        if ((*strind == '+') || (*strind == '-')) { | ||||
|                if (*strind == '-') { | ||||
|                        strind++; | ||||
|                        tempX = -ReadInteger(strind, &nextCharacter); | ||||
|                        if (strind == nextCharacter) | ||||
|                            return (0); | ||||
|                        strind = nextCharacter; | ||||
|                        mask |= XNegative; | ||||
|  | ||||
|                } | ||||
|                else | ||||
|                {       strind++; | ||||
|                        tempX = ReadInteger(strind, &nextCharacter); | ||||
|                        if (strind == nextCharacter) | ||||
|                            return(0); | ||||
|                        strind = nextCharacter; | ||||
|                } | ||||
|                mask |= XValue; | ||||
|                if ((*strind == '+') || (*strind == '-')) { | ||||
|                        if (*strind == '-') { | ||||
|                                strind++; | ||||
|                                tempY = -ReadInteger(strind, &nextCharacter); | ||||
|                                if (strind == nextCharacter) | ||||
|                                    return(0); | ||||
|                                strind = nextCharacter; | ||||
|                                mask |= YNegative; | ||||
|  | ||||
|                        } | ||||
|                        else | ||||
|                        { | ||||
|                                strind++; | ||||
|                                tempY = ReadInteger(strind, &nextCharacter); | ||||
|                                if (strind == nextCharacter) | ||||
|                                    return(0); | ||||
|                                strind = nextCharacter; | ||||
|                        } | ||||
|                        mask |= YValue; | ||||
|                } | ||||
|        } | ||||
|  | ||||
|        /* If strind isn't at the end of the string the it's an invalid | ||||
|                geometry specification. */ | ||||
|  | ||||
|        if (*strind != '\0') return (0); | ||||
|  | ||||
|        if (mask & XValue) | ||||
|            *x = tempX; | ||||
|        if (mask & YValue) | ||||
|            *y = tempY; | ||||
|        if (mask & WidthValue) | ||||
|             *width = tempWidth; | ||||
|        if (mask & HeightValue) | ||||
|             *height = tempHeight; | ||||
|        return (mask); | ||||
| } | ||||
|  | ||||
| int gettimeofday(struct timeval* tp, void* tzp) | ||||
| { | ||||
|  DATETIME    DateTime; | ||||
|  APIRET       ulrc;  /*  Return Code. */ | ||||
|  | ||||
|  ulrc = DosGetDateTime(&DateTime); | ||||
|  tp->tv_sec  = 60 * (60*DateTime.hours + DateTime.minutes) + DateTime.seconds; | ||||
|  tp->tv_usec = DateTime.hundredths * 10000; | ||||
|  return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| int | ||||
| XPending(Display* display) | ||||
| { | ||||
|   /* similar functionality...I don't think that it is exact, but this | ||||
|      will have to do. */ | ||||
|   QMSG msg; | ||||
|   extern HAB   hab;      /* PM anchor block handle         */ | ||||
|  | ||||
| //?? WinPeekMsg(hab | ||||
|   return WinPeekMsg(hab, &msg, NULLHANDLE, 0, 0, PM_NOREMOVE); | ||||
| } | ||||
|  | ||||
| void | ||||
| __glutAdjustCoords(Window parent, int* x, int* y, int* width, int* height) | ||||
| { | ||||
|   RECTL rect; | ||||
|  | ||||
|   /* adjust the window rectangle because Win32 thinks that the x, y, | ||||
|      width & height are the WHOLE window (including decorations), | ||||
|      whereas GLUT treats the x, y, width & height as only the CLIENT | ||||
|      area of the window. */ | ||||
|   rect.xLeft = *x; rect.yTop = *y; | ||||
|   rect.xRight = *x + *width; rect.yBottom = *y + *height; | ||||
|  | ||||
|   /* must adjust the coordinates according to the correct style | ||||
|      because depending on the style, there may or may not be | ||||
|      borders. */ | ||||
| //??  AdjustWindowRect(&rect, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | | ||||
| //??              (parent ? WS_CHILD : WS_OVERLAPPEDWINDOW), | ||||
| //??              FALSE); | ||||
|   /* FALSE in the third parameter = window has no menu bar */ | ||||
|  | ||||
|   /* readjust if the x and y are offscreen */ | ||||
|   if(rect.xLeft < 0) { | ||||
|     *x = 0; | ||||
|   } else { | ||||
|     *x = rect.xLeft; | ||||
|   } | ||||
|  | ||||
|   if(rect.yTop < 0) { | ||||
|     *y = 0; | ||||
|   } else { | ||||
|     *y = rect.yTop; | ||||
|   } | ||||
|  | ||||
|   *width = rect.xRight - rect.xLeft;     /* adjusted width */ | ||||
|   *height = -(rect.yBottom - rect.yTop);    /* adjusted height */ | ||||
| } | ||||
|  | ||||
|  | ||||
| int | ||||
| __glutGetTransparentPixel(Display * dpy, XVisualInfo * vinfo) | ||||
| { | ||||
|   /* the transparent pixel on Win32 is always index number 0.  So if | ||||
|      we put this routine in this file, we can avoid compiling the | ||||
|      whole of layerutil.c which is where this routine normally comes | ||||
|      from. */ | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| /* Translate point coordinates src_x and src_y from src to dst */ | ||||
|  | ||||
| Bool | ||||
| XTranslateCoordinates(Display *display, Window src, Window dst, | ||||
|                      int src_x, int src_y, | ||||
|                      int* dest_x_return, int* dest_y_return, | ||||
|                      Window* child_return) | ||||
| { | ||||
|   SWP swp_src,swp_dst; | ||||
|  | ||||
|   WinQueryWindowPos(src,&swp_src); | ||||
|   WinQueryWindowPos(dst,&swp_dst); | ||||
|  | ||||
|   *dest_x_return =  src_x + swp_src.x - swp_dst.x; | ||||
|   *dest_y_return =  src_y + swp_src.y - swp_dst.y; | ||||
|  | ||||
|   /* just to make compilers happy...we don't use the return value. */ | ||||
|   return True; | ||||
| } | ||||
|  | ||||
| Status | ||||
| XGetGeometry(Display* display, Window window, Window* root_return, | ||||
|             int* x_return, int* y_return, | ||||
|             unsigned int* width_return, unsigned int* height_return, | ||||
|             unsigned int *border_width_return, unsigned int* depth_return) | ||||
| { | ||||
|   /* KLUDGE: doesn't return the border_width or depth or root, x & y | ||||
|      are in screen coordinates. */ | ||||
|   SWP swp_src; | ||||
|   WinQueryWindowPos(window,&swp_src); | ||||
|  | ||||
|   *x_return = swp_src.x; | ||||
|   *y_return = swp_src.y; | ||||
|   *width_return = swp_src.cx; | ||||
|   *height_return = swp_src.cy; | ||||
|  | ||||
|   /* just to make compilers happy...we don't use the return value. */ | ||||
|   return 1; | ||||
| } | ||||
|  | ||||
| /* Get Display Width in millimeters */ | ||||
| int | ||||
| DisplayWidthMM(Display* display, int screen) | ||||
| { | ||||
|   int width; | ||||
|   LONG *pVC_Caps; | ||||
|   pVC_Caps = GetVideoConfig(NULLHANDLE); | ||||
|   width = (int)( 0.001 * pVC_Caps[CAPS_WIDTH]  / pVC_Caps[CAPS_HORIZONTAL_RESOLUTION]);/* mm */ | ||||
|   return width; | ||||
| } | ||||
|  | ||||
| /* Get Display Height in millimeters */ | ||||
| int | ||||
| DisplayHeightMM(Display* display, int screen) | ||||
| { | ||||
|   int height; | ||||
|   LONG *pVC_Caps; | ||||
|   pVC_Caps = GetVideoConfig(NULLHANDLE); | ||||
|   height = (int)( 0.001 * pVC_Caps[CAPS_HEIGHT] / pVC_Caps[CAPS_VERTICAL_RESOLUTION]); /* mm */ | ||||
|   return height; | ||||
| } | ||||
|  | ||||
| void ScreenToClient( HWND hwnd,   POINTL *point) | ||||
| { | ||||
|   SWP swp_src; | ||||
|   WinQueryWindowPos(hwnd,&swp_src); | ||||
|   point->x -= swp_src.x; | ||||
|   point->y -= swp_src.y; | ||||
| } | ||||
|  | ||||
| /* WarpWin.c     */ | ||||
| /* glut for Warp */ | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
|  | ||||
| #include "WarpWin.h" | ||||
| #include "WarpGL.h" | ||||
|  | ||||
| #define POKA 0 | ||||
|  | ||||
| /* global variables that must be set for some functions to operate | ||||
|    correctly. */ | ||||
| HDC XHDC; | ||||
| HWND XHWND; | ||||
|  | ||||
|  | ||||
| void | ||||
| XStoreColor(Display* display, Colormap colormap, XColor* color) | ||||
| { | ||||
|   /* KLUDGE: set XHDC to 0 if the palette should NOT be realized after | ||||
|      setting the color.  set XHDC to the correct HDC if it should. */ | ||||
|  | ||||
|   LONG pe; | ||||
|   ULONG cclr; | ||||
|   int r,g,b; | ||||
|   /* X11 stores color from 0-65535, Win32 expects them to be 0-256, so | ||||
|      twiddle the bits ( / 256). */ | ||||
|   r = color->red / 256; | ||||
|   g = color->green / 256; | ||||
|   b = color->blue / 256; | ||||
|   pe = LONGFromRGB(r,g,b); | ||||
|   /* make sure we use this flag, otherwise the colors might get mapped | ||||
|      to another place in the colormap, and when we glIndex() that | ||||
|      color, it may have moved (argh!!) */ | ||||
|   pe |= (PC_NOCOLLAPSE<<24); | ||||
| /* This function changes the entries in a palette.  */ | ||||
| #if POKA | ||||
| OS2: | ||||
|  rc = GpiSetPaletteEntries(colormap,LCOLF_CONSECRGB, color->pixel, 1, &pe); | ||||
|  GpiSelectPalette(hps,colormap); | ||||
|  WinRealizePalette(hwnd,hps,&cclr); | ||||
| source Win: | ||||
|   if (XHDC) { | ||||
|     UnrealizeObject(colormap); | ||||
|     SelectPalette(XHDC, colormap, FALSE); | ||||
|     RealizePalette(XHDC); | ||||
|  | ||||
|    } | ||||
| #endif | ||||
| } | ||||
|  | ||||
| void | ||||
| XSetWindowColormap(Display* display, Window window, Colormap colormap) | ||||
| { | ||||
| #if POKA | ||||
|   HDC hdc = GetDC(window); | ||||
|  | ||||
|   /* if the third parameter is FALSE, the logical colormap is copied | ||||
|      into the device palette when the application is in the | ||||
|      foreground, if it is TRUE, the colors are mapped into the current | ||||
|      palette in the best possible way. */ | ||||
|   SelectPalette(hdc, colormap, FALSE); | ||||
|   RealizePalette(hdc); | ||||
|  | ||||
|   /* note that we don't have to release the DC, since our window class | ||||
|      uses the WC_OWNDC flag! */ | ||||
| #endif | ||||
| } | ||||
|  | ||||
|  | ||||
| /* display, root and visual - don't used at all */ | ||||
| Colormap | ||||
| XCreateColormap(Display* display, Window root, Visual* visual, int alloc) | ||||
| { | ||||
|   /* KLUDGE: this function needs XHDC to be set to the HDC currently | ||||
|      being operated on before it is invoked! */ | ||||
|  | ||||
|   HPAL    palette; | ||||
|   int n; | ||||
| #if POKA | ||||
|   PIXELFORMATDESCRIPTOR pfd; | ||||
|   LOGPALETTE *logical; | ||||
|  | ||||
|   /* grab the pixel format */ | ||||
|   memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); | ||||
|   DescribePixelFormat(XHDC, GetPixelFormat(XHDC), | ||||
|                      sizeof(PIXELFORMATDESCRIPTOR), &pfd); | ||||
|  | ||||
|   if (!(pfd.dwFlags & PFD_NEED_PALETTE || | ||||
|       pfd.iPixelType == PFD_TYPE_COLORINDEX)) | ||||
|   { | ||||
|     return 0; | ||||
|   } | ||||
|  | ||||
|   n = 1 << pfd.cColorBits; | ||||
|  | ||||
|   /* allocate a bunch of memory for the logical palette (assume 256 | ||||
|      colors in a Win32 palette */ | ||||
|   logical = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) + | ||||
|                                sizeof(PALETTEENTRY) * n); | ||||
|   memset(logical, 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * n); | ||||
|  | ||||
|   /* set the entries in the logical palette */ | ||||
|   logical->palVersion = 0x300; | ||||
|   logical->palNumEntries = n; | ||||
|  | ||||
|   /* start with a copy of the current system palette */ | ||||
|   GetSystemPaletteEntries(XHDC, 0, 256, &logical->palPalEntry[0]); | ||||
|  | ||||
|   if (pfd.iPixelType == PFD_TYPE_RGBA) { | ||||
|     int redMask = (1 << pfd.cRedBits) - 1; | ||||
|     int greenMask = (1 << pfd.cGreenBits) - 1; | ||||
|     int blueMask = (1 << pfd.cBlueBits) - 1; | ||||
|     int i; | ||||
|  | ||||
|     /* fill in an RGBA color palette */ | ||||
|     for (i = 0; i < n; ++i) { | ||||
|       logical->palPalEntry[i].peRed = | ||||
|        (((i >> pfd.cRedShift)   & redMask)   * 255) / redMask; | ||||
|       logical->palPalEntry[i].peGreen = | ||||
|        (((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask; | ||||
|        logical->palPalEntry[i].peBlue = | ||||
|        (((i >> pfd.cBlueShift)  & blueMask)  * 255) / blueMask; | ||||
|       logical->palPalEntry[i].peFlags = 0; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   palette = CreatePalette(logical); | ||||
|   free(logical); | ||||
|  | ||||
|   SelectPalette(XHDC, palette, FALSE); | ||||
|   RealizePalette(XHDC); | ||||
| #endif /* POKA */ | ||||
|  | ||||
|   return palette; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| int  GetSystemMetrics( int mode) | ||||
| {  RECTL rect; | ||||
|  | ||||
|    switch(mode) | ||||
|    {   case   SM_CXSCREEN: | ||||
|         WinQueryWindowRect(HWND_DESKTOP,&rect); | ||||
|         return (rect.xRight-rect.xLeft); | ||||
|       break; | ||||
|        case   SM_CYSCREEN: | ||||
|         WinQueryWindowRect(HWND_DESKTOP,&rect); | ||||
|         return (rect.yTop-rect.yBottom); | ||||
|       break; | ||||
|        default: ; | ||||
|    } | ||||
|    return 0; | ||||
| } | ||||
| /* | ||||
|  *    XParseGeometry parses strings of the form | ||||
|  *   "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where | ||||
|  *   width, height, xoffset, and yoffset are unsigned integers. | ||||
|  *   Example:  "=80x24+300-49" | ||||
|  *   The equal sign is optional. | ||||
|  *   It returns a bitmask that indicates which of the four values | ||||
|  *   were actually found in the string.  For each value found, | ||||
|  *   the corresponding argument is updated;  for each value | ||||
|  *   not found, the corresponding argument is left unchanged. | ||||
|  */ | ||||
|  | ||||
| static int | ||||
| ReadInteger(char *string, char **NextString) | ||||
| { | ||||
|     register int Result = 0; | ||||
|     int Sign = 1; | ||||
|  | ||||
|     if (*string == '+') | ||||
|        string++; | ||||
|     else if (*string == '-') | ||||
|     { | ||||
|        string++; | ||||
|        Sign = -1; | ||||
|     } | ||||
|     for (; (*string >= '0') && (*string <= '9'); string++) | ||||
|     { | ||||
|        Result = (Result * 10) + (*string - '0'); | ||||
|     } | ||||
|     *NextString = string; | ||||
|     if (Sign >= 0) | ||||
|        return (Result); | ||||
|     else | ||||
|        return (-Result); | ||||
| } | ||||
|  | ||||
| int XParseGeometry(char *string, int *x, int *y, unsigned int *width, unsigned int *height) | ||||
| { | ||||
|        int mask = NoValue; | ||||
|        register char *strind; | ||||
|        unsigned int tempWidth, tempHeight; | ||||
|        int tempX, tempY; | ||||
|        char *nextCharacter; | ||||
|  | ||||
|        if ( (string == NULL) || (*string == '\0')) return(mask); | ||||
|        if (*string == '=') | ||||
|                string++;  /* ignore possible '=' at beg of geometry spec */ | ||||
|  | ||||
|        strind = (char *)string; | ||||
|        if (*strind != '+' && *strind != '-' && *strind != 'x') { | ||||
|                tempWidth = ReadInteger(strind, &nextCharacter); | ||||
|                if (strind == nextCharacter) | ||||
|                    return (0); | ||||
|                strind = nextCharacter; | ||||
|                mask |= WidthValue; | ||||
|        } | ||||
|  | ||||
|        if (*strind == 'x' || *strind == 'X') { | ||||
|                strind++; | ||||
|                tempHeight = ReadInteger(strind, &nextCharacter); | ||||
|                if (strind == nextCharacter) | ||||
|                    return (0); | ||||
|                strind = nextCharacter; | ||||
|                mask |= HeightValue; | ||||
|        } | ||||
|  | ||||
|        if ((*strind == '+') || (*strind == '-')) { | ||||
|                if (*strind == '-') { | ||||
|                        strind++; | ||||
|                        tempX = -ReadInteger(strind, &nextCharacter); | ||||
|                        if (strind == nextCharacter) | ||||
|                            return (0); | ||||
|                        strind = nextCharacter; | ||||
|                        mask |= XNegative; | ||||
|  | ||||
|                } | ||||
|                else | ||||
|                {       strind++; | ||||
|                        tempX = ReadInteger(strind, &nextCharacter); | ||||
|                        if (strind == nextCharacter) | ||||
|                            return(0); | ||||
|                        strind = nextCharacter; | ||||
|                } | ||||
|                mask |= XValue; | ||||
|                if ((*strind == '+') || (*strind == '-')) { | ||||
|                        if (*strind == '-') { | ||||
|                                strind++; | ||||
|                                tempY = -ReadInteger(strind, &nextCharacter); | ||||
|                                if (strind == nextCharacter) | ||||
|                                    return(0); | ||||
|                                strind = nextCharacter; | ||||
|                                mask |= YNegative; | ||||
|  | ||||
|                        } | ||||
|                        else | ||||
|                        { | ||||
|                                strind++; | ||||
|                                tempY = ReadInteger(strind, &nextCharacter); | ||||
|                                if (strind == nextCharacter) | ||||
|                                    return(0); | ||||
|                                strind = nextCharacter; | ||||
|                        } | ||||
|                        mask |= YValue; | ||||
|                } | ||||
|        } | ||||
|  | ||||
|        /* If strind isn't at the end of the string the it's an invalid | ||||
|                geometry specification. */ | ||||
|  | ||||
|        if (*strind != '\0') return (0); | ||||
|  | ||||
|        if (mask & XValue) | ||||
|            *x = tempX; | ||||
|        if (mask & YValue) | ||||
|            *y = tempY; | ||||
|        if (mask & WidthValue) | ||||
|             *width = tempWidth; | ||||
|        if (mask & HeightValue) | ||||
|             *height = tempHeight; | ||||
|        return (mask); | ||||
| } | ||||
|  | ||||
| int gettimeofday(struct timeval* tp, void* tzp) | ||||
| { | ||||
|  DATETIME    DateTime; | ||||
|  APIRET       ulrc;  /*  Return Code. */ | ||||
|  | ||||
|  ulrc = DosGetDateTime(&DateTime); | ||||
|  tp->tv_sec  = 60 * (60*DateTime.hours + DateTime.minutes) + DateTime.seconds; | ||||
|  tp->tv_usec = DateTime.hundredths * 10000; | ||||
|  return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| int | ||||
| XPending(Display* display) | ||||
| { | ||||
|   /* similar functionality...I don't think that it is exact, but this | ||||
|      will have to do. */ | ||||
|   QMSG msg; | ||||
|   extern HAB   hab;      /* PM anchor block handle         */ | ||||
|  | ||||
| //?? WinPeekMsg(hab | ||||
|   return WinPeekMsg(hab, &msg, NULLHANDLE, 0, 0, PM_NOREMOVE); | ||||
| } | ||||
|  | ||||
| void | ||||
| __glutAdjustCoords(Window parent, int* x, int* y, int* width, int* height) | ||||
| { | ||||
|   RECTL rect; | ||||
|  | ||||
|   /* adjust the window rectangle because Win32 thinks that the x, y, | ||||
|      width & height are the WHOLE window (including decorations), | ||||
|      whereas GLUT treats the x, y, width & height as only the CLIENT | ||||
|      area of the window. */ | ||||
|   rect.xLeft = *x; rect.yTop = *y; | ||||
|   rect.xRight = *x + *width; rect.yBottom = *y + *height; | ||||
|  | ||||
|   /* must adjust the coordinates according to the correct style | ||||
|      because depending on the style, there may or may not be | ||||
|      borders. */ | ||||
| //??  AdjustWindowRect(&rect, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | | ||||
| //??              (parent ? WS_CHILD : WS_OVERLAPPEDWINDOW), | ||||
| //??              FALSE); | ||||
|   /* FALSE in the third parameter = window has no menu bar */ | ||||
|  | ||||
|   /* readjust if the x and y are offscreen */ | ||||
|   if(rect.xLeft < 0) { | ||||
|     *x = 0; | ||||
|   } else { | ||||
|     *x = rect.xLeft; | ||||
|   } | ||||
|  | ||||
|   if(rect.yTop < 0) { | ||||
|     *y = 0; | ||||
|   } else { | ||||
|     *y = rect.yTop; | ||||
|   } | ||||
|  | ||||
|   *width = rect.xRight - rect.xLeft;     /* adjusted width */ | ||||
|   *height = -(rect.yBottom - rect.yTop);    /* adjusted height */ | ||||
| } | ||||
|  | ||||
|  | ||||
| int | ||||
| __glutGetTransparentPixel(Display * dpy, XVisualInfo * vinfo) | ||||
| { | ||||
|   /* the transparent pixel on Win32 is always index number 0.  So if | ||||
|      we put this routine in this file, we can avoid compiling the | ||||
|      whole of layerutil.c which is where this routine normally comes | ||||
|      from. */ | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| /* Translate point coordinates src_x and src_y from src to dst */ | ||||
|  | ||||
| Bool | ||||
| XTranslateCoordinates(Display *display, Window src, Window dst, | ||||
|                      int src_x, int src_y, | ||||
|                      int* dest_x_return, int* dest_y_return, | ||||
|                      Window* child_return) | ||||
| { | ||||
|   SWP swp_src,swp_dst; | ||||
|  | ||||
|   WinQueryWindowPos(src,&swp_src); | ||||
|   WinQueryWindowPos(dst,&swp_dst); | ||||
|  | ||||
|   *dest_x_return =  src_x + swp_src.x - swp_dst.x; | ||||
|   *dest_y_return =  src_y + swp_src.y - swp_dst.y; | ||||
|  | ||||
|   /* just to make compilers happy...we don't use the return value. */ | ||||
|   return True; | ||||
| } | ||||
|  | ||||
| Status | ||||
| XGetGeometry(Display* display, Window window, Window* root_return, | ||||
|             int* x_return, int* y_return, | ||||
|             unsigned int* width_return, unsigned int* height_return, | ||||
|             unsigned int *border_width_return, unsigned int* depth_return) | ||||
| { | ||||
|   /* KLUDGE: doesn't return the border_width or depth or root, x & y | ||||
|      are in screen coordinates. */ | ||||
|   SWP swp_src; | ||||
|   WinQueryWindowPos(window,&swp_src); | ||||
|  | ||||
|   *x_return = swp_src.x; | ||||
|   *y_return = swp_src.y; | ||||
|   *width_return = swp_src.cx; | ||||
|   *height_return = swp_src.cy; | ||||
|  | ||||
|   /* just to make compilers happy...we don't use the return value. */ | ||||
|   return 1; | ||||
| } | ||||
|  | ||||
| /* Get Display Width in millimeters */ | ||||
| int | ||||
| DisplayWidthMM(Display* display, int screen) | ||||
| { | ||||
|   int width; | ||||
|   LONG *pVC_Caps; | ||||
|   pVC_Caps = GetVideoConfig(NULLHANDLE); | ||||
|   width = (int)( 0.001 * pVC_Caps[CAPS_WIDTH]  / pVC_Caps[CAPS_HORIZONTAL_RESOLUTION]);/* mm */ | ||||
|   return width; | ||||
| } | ||||
|  | ||||
| /* Get Display Height in millimeters */ | ||||
| int | ||||
| DisplayHeightMM(Display* display, int screen) | ||||
| { | ||||
|   int height; | ||||
|   LONG *pVC_Caps; | ||||
|   pVC_Caps = GetVideoConfig(NULLHANDLE); | ||||
|   height = (int)( 0.001 * pVC_Caps[CAPS_HEIGHT] / pVC_Caps[CAPS_VERTICAL_RESOLUTION]); /* mm */ | ||||
|   return height; | ||||
| } | ||||
|  | ||||
| void ScreenToClient( HWND hwnd,   POINTL *point) | ||||
| { | ||||
|   SWP swp_src; | ||||
|   WinQueryWindowPos(hwnd,&swp_src); | ||||
|   point->x -= swp_src.x; | ||||
|   point->y -= swp_src.y; | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -1,259 +1,259 @@ | ||||
|  | ||||
| /* Copyright (c) Mark J. Kilgard, 1994, 1996, 1997. */ | ||||
|  | ||||
| /* This program is freely distributable without licensing fees | ||||
|    and is provided without guarantee or warrantee expressed or | ||||
|    implied. This program is -not- in the public domain. */ | ||||
|  | ||||
| #include <stdlib.h> | ||||
| #include "glutint.h" | ||||
|  | ||||
| #if defined(__OS2PM__) | ||||
|    #define IsWindowVisible WinIsWindowVisible | ||||
| #endif | ||||
|  | ||||
| #define CLAMP(i) ((i) > 1.0 ? 1.0 : ((i) < 0.0 ? 0.0 : (i))) | ||||
|  | ||||
| /* CENTRY */ | ||||
| void GLUTAPIENTRY | ||||
| glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue) | ||||
| { | ||||
|   GLUTcolormap *cmap, *newcmap; | ||||
|   XVisualInfo *vis; | ||||
|   XColor color; | ||||
|   int i; | ||||
|  | ||||
|   if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { | ||||
|     cmap = __glutCurrentWindow->colormap; | ||||
|     vis = __glutCurrentWindow->vis; | ||||
|   } else { | ||||
|     cmap = __glutCurrentWindow->overlay->colormap; | ||||
|     vis = __glutCurrentWindow->overlay->vis; | ||||
|     if (ndx == __glutCurrentWindow->overlay->transparentPixel) { | ||||
|       __glutWarning( | ||||
|         "glutSetColor: cannot set color of overlay transparent index %d\n", | ||||
|         ndx); | ||||
|       return; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   if (!cmap) { | ||||
|     __glutWarning("glutSetColor: current window is RGBA"); | ||||
|     return; | ||||
|   } | ||||
| #if defined(_WIN32) || defined(__OS2PM__) | ||||
|   if (ndx >= 256 ||     /* always assume 256 colors on Win32 */ | ||||
| #else | ||||
|   if (ndx >= vis->visual->map_entries || | ||||
| #endif | ||||
|     ndx < 0) { | ||||
|     __glutWarning("glutSetColor: index %d out of range", ndx); | ||||
|     return; | ||||
|   } | ||||
|   if (cmap->refcnt > 1) { | ||||
|     newcmap = __glutAssociateNewColormap(vis); | ||||
|     cmap->refcnt--; | ||||
|     /* Wouldn't it be nice if XCopyColormapAndFree could be | ||||
|        told not to free the old colormap's entries! */ | ||||
|     for (i = cmap->size - 1; i >= 0; i--) { | ||||
|       if (i == ndx) { | ||||
|         /* We are going to set this cell shortly! */ | ||||
|         continue; | ||||
|       } | ||||
|       if (cmap->cells[i].component[GLUT_RED] >= 0.0) { | ||||
|         color.pixel = i; | ||||
|         newcmap->cells[i].component[GLUT_RED] = | ||||
|           cmap->cells[i].component[GLUT_RED]; | ||||
|         color.red = (GLfloat) 0xffff * | ||||
|           cmap->cells[i].component[GLUT_RED]; | ||||
|         newcmap->cells[i].component[GLUT_GREEN] = | ||||
|           cmap->cells[i].component[GLUT_GREEN]; | ||||
|         color.green = (GLfloat) 0xffff * | ||||
|           cmap->cells[i].component[GLUT_GREEN]; | ||||
|         newcmap->cells[i].component[GLUT_BLUE] = | ||||
|           cmap->cells[i].component[GLUT_BLUE]; | ||||
|         color.blue = (GLfloat) 0xffff * | ||||
|           cmap->cells[i].component[GLUT_BLUE]; | ||||
|         color.flags = DoRed | DoGreen | DoBlue; | ||||
| #if defined(_WIN32) || defined(__OS2PM__) | ||||
|         if (IsWindowVisible(__glutCurrentWindow->win)) { | ||||
|           XHDC = __glutCurrentWindow->hdc; | ||||
|         } else { | ||||
|           XHDC = 0; | ||||
|         } | ||||
| #endif | ||||
|         XStoreColor(__glutDisplay, newcmap->cmap, &color); | ||||
|       } else { | ||||
|         /* Leave unallocated entries unallocated. */ | ||||
|       } | ||||
|     } | ||||
|     cmap = newcmap; | ||||
|     if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { | ||||
|       __glutCurrentWindow->colormap = cmap; | ||||
|       __glutCurrentWindow->cmap = cmap->cmap; | ||||
|     } else { | ||||
|       __glutCurrentWindow->overlay->colormap = cmap; | ||||
|       __glutCurrentWindow->overlay->cmap = cmap->cmap; | ||||
|     } | ||||
|     XSetWindowColormap(__glutDisplay, | ||||
|       __glutCurrentWindow->renderWin, cmap->cmap); | ||||
|  | ||||
| #if !defined(_WIN32) && !defined(__OS2PM__) | ||||
|     { | ||||
|       GLUTwindow *toplevel; | ||||
|  | ||||
|       toplevel = __glutToplevelOf(__glutCurrentWindow); | ||||
|       if (toplevel->cmap != cmap->cmap) { | ||||
|         __glutPutOnWorkList(toplevel, GLUT_COLORMAP_WORK); | ||||
|       } | ||||
|     } | ||||
| #endif | ||||
|   } | ||||
|   color.pixel = ndx; | ||||
|   red = CLAMP(red); | ||||
|   cmap->cells[ndx].component[GLUT_RED] = red; | ||||
|   color.red = (GLfloat) 0xffff *red; | ||||
|   green = CLAMP(green); | ||||
|   cmap->cells[ndx].component[GLUT_GREEN] = green; | ||||
|   color.green = (GLfloat) 0xffff *green; | ||||
|   blue = CLAMP(blue); | ||||
|   cmap->cells[ndx].component[GLUT_BLUE] = blue; | ||||
|   color.blue = (GLfloat) 0xffff *blue; | ||||
|   color.flags = DoRed | DoGreen | DoBlue; | ||||
| #if defined(_WIN32) || defined(__OS2PM__) | ||||
|   if (IsWindowVisible(__glutCurrentWindow->win)) { | ||||
|     XHDC = __glutCurrentWindow->hdc; | ||||
|   } else { | ||||
|     XHDC = 0; | ||||
|   } | ||||
| #endif | ||||
|   XStoreColor(__glutDisplay, cmap->cmap, &color); | ||||
| } | ||||
|  | ||||
| GLfloat GLUTAPIENTRY | ||||
| glutGetColor(int ndx, int comp) | ||||
| { | ||||
|   GLUTcolormap *colormap; | ||||
|   XVisualInfo *vis; | ||||
|  | ||||
|   if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { | ||||
|     colormap = __glutCurrentWindow->colormap; | ||||
|     vis = __glutCurrentWindow->vis; | ||||
|   } else { | ||||
|     colormap = __glutCurrentWindow->overlay->colormap; | ||||
|     vis = __glutCurrentWindow->overlay->vis; | ||||
|     if (ndx == __glutCurrentWindow->overlay->transparentPixel) { | ||||
|       __glutWarning("glutGetColor: requesting overlay transparent index %d\n", | ||||
|         ndx); | ||||
|       return -1.0; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   if (!colormap) { | ||||
|     __glutWarning("glutGetColor: current window is RGBA"); | ||||
|     return -1.0; | ||||
|   } | ||||
| #if defined(_WIN32) || defined(__OS2PM__) | ||||
| #define OUT_OF_RANGE_NDX(ndx) (ndx >= 256 || ndx < 0) | ||||
| #else | ||||
| #define OUT_OF_RANGE_NDX(ndx) (ndx >= vis->visual->map_entries || ndx < 0) | ||||
| #endif | ||||
|   if (OUT_OF_RANGE_NDX(ndx)) { | ||||
|     __glutWarning("glutGetColor: index %d out of range", ndx); | ||||
|     return -1.0; | ||||
|   } | ||||
|   return colormap->cells[ndx].component[comp]; | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutCopyColormap(int winnum) | ||||
| { | ||||
|   GLUTwindow *window = __glutWindowList[winnum - 1]; | ||||
|   GLUTcolormap *oldcmap, *newcmap; | ||||
|   XVisualInfo *dstvis; | ||||
|  | ||||
|   if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { | ||||
|     oldcmap = __glutCurrentWindow->colormap; | ||||
|     dstvis = __glutCurrentWindow->vis; | ||||
|     newcmap = window->colormap; | ||||
|   } else { | ||||
|     oldcmap = __glutCurrentWindow->overlay->colormap; | ||||
|     dstvis = __glutCurrentWindow->overlay->vis; | ||||
|     if (!window->overlay) { | ||||
|       __glutWarning("glutCopyColormap: window %d has no overlay", winnum); | ||||
|       return; | ||||
|     } | ||||
|     newcmap = window->overlay->colormap; | ||||
|   } | ||||
|  | ||||
|   if (!oldcmap) { | ||||
|     __glutWarning("glutCopyColormap: destination colormap must be color index"); | ||||
|     return; | ||||
|   } | ||||
|   if (!newcmap) { | ||||
|     __glutWarning( | ||||
|       "glutCopyColormap: source colormap of window %d must be color index", | ||||
|       winnum); | ||||
|     return; | ||||
|   } | ||||
|   if (newcmap == oldcmap) { | ||||
|     /* Source and destination are the same; now copy needed. */ | ||||
|     return; | ||||
|   } | ||||
| #if !defined(_WIN32) && !defined(__OS2PM__) | ||||
|   /* Play safe: compare visual IDs, not Visual*'s. */ | ||||
|   if (newcmap->visual->visualid == oldcmap->visual->visualid) { | ||||
| #endif | ||||
|     /* Visuals match!  "Copy" by reference...  */ | ||||
|     __glutFreeColormap(oldcmap); | ||||
|     newcmap->refcnt++; | ||||
|     if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { | ||||
|       __glutCurrentWindow->colormap = newcmap; | ||||
|       __glutCurrentWindow->cmap = newcmap->cmap; | ||||
|     } else { | ||||
|       __glutCurrentWindow->overlay->colormap = newcmap; | ||||
|       __glutCurrentWindow->overlay->cmap = newcmap->cmap; | ||||
|     } | ||||
|     XSetWindowColormap(__glutDisplay, __glutCurrentWindow->renderWin, | ||||
|       newcmap->cmap); | ||||
| #if !defined(_WIN32) && !defined(__OS2PM__) | ||||
|     __glutPutOnWorkList(__glutToplevelOf(window), GLUT_COLORMAP_WORK); | ||||
| bla bla bla | ||||
|  | ||||
|   } else { | ||||
|     GLUTcolormap *copycmap; | ||||
|     XColor color; | ||||
|     int i, last; | ||||
|  | ||||
|     /* Visuals different - need a distinct X colormap! */ | ||||
|     copycmap = __glutAssociateNewColormap(dstvis); | ||||
|     /* Wouldn't it be nice if XCopyColormapAndFree could be | ||||
|        told not to free the old colormap's entries! */ | ||||
|     last = newcmap->size; | ||||
|     if (last > copycmap->size) { | ||||
|       last = copycmap->size; | ||||
|     } | ||||
|     for (i = last - 1; i >= 0; i--) { | ||||
|       if (newcmap->cells[i].component[GLUT_RED] >= 0.0) { | ||||
|         color.pixel = i; | ||||
|         copycmap->cells[i].component[GLUT_RED] = | ||||
|           newcmap->cells[i].component[GLUT_RED]; | ||||
|         color.red = (GLfloat) 0xffff * | ||||
|           newcmap->cells[i].component[GLUT_RED]; | ||||
|         copycmap->cells[i].component[GLUT_GREEN] = | ||||
|           newcmap->cells[i].component[GLUT_GREEN]; | ||||
|         color.green = (GLfloat) 0xffff * | ||||
|           newcmap->cells[i].component[GLUT_GREEN]; | ||||
|         copycmap->cells[i].component[GLUT_BLUE] = | ||||
|           newcmap->cells[i].component[GLUT_BLUE]; | ||||
|         color.blue = (GLfloat) 0xffff * | ||||
|           newcmap->cells[i].component[GLUT_BLUE]; | ||||
|         color.flags = DoRed | DoGreen | DoBlue; | ||||
|         XStoreColor(__glutDisplay, copycmap->cmap, &color); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| #endif | ||||
| } | ||||
| /* ENDCENTRY */ | ||||
|  | ||||
| /* Copyright (c) Mark J. Kilgard, 1994, 1996, 1997. */ | ||||
|  | ||||
| /* This program is freely distributable without licensing fees | ||||
|    and is provided without guarantee or warrantee expressed or | ||||
|    implied. This program is -not- in the public domain. */ | ||||
|  | ||||
| #include <stdlib.h> | ||||
| #include "glutint.h" | ||||
|  | ||||
| #if defined(__OS2PM__) | ||||
|    #define IsWindowVisible WinIsWindowVisible | ||||
| #endif | ||||
|  | ||||
| #define CLAMP(i) ((i) > 1.0 ? 1.0 : ((i) < 0.0 ? 0.0 : (i))) | ||||
|  | ||||
| /* CENTRY */ | ||||
| void GLUTAPIENTRY | ||||
| glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue) | ||||
| { | ||||
|   GLUTcolormap *cmap, *newcmap; | ||||
|   XVisualInfo *vis; | ||||
|   XColor color; | ||||
|   int i; | ||||
|  | ||||
|   if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { | ||||
|     cmap = __glutCurrentWindow->colormap; | ||||
|     vis = __glutCurrentWindow->vis; | ||||
|   } else { | ||||
|     cmap = __glutCurrentWindow->overlay->colormap; | ||||
|     vis = __glutCurrentWindow->overlay->vis; | ||||
|     if (ndx == __glutCurrentWindow->overlay->transparentPixel) { | ||||
|       __glutWarning( | ||||
|         "glutSetColor: cannot set color of overlay transparent index %d\n", | ||||
|         ndx); | ||||
|       return; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   if (!cmap) { | ||||
|     __glutWarning("glutSetColor: current window is RGBA"); | ||||
|     return; | ||||
|   } | ||||
| #if defined(_WIN32) || defined(__OS2PM__) | ||||
|   if (ndx >= 256 ||     /* always assume 256 colors on Win32 */ | ||||
| #else | ||||
|   if (ndx >= vis->visual->map_entries || | ||||
| #endif | ||||
|     ndx < 0) { | ||||
|     __glutWarning("glutSetColor: index %d out of range", ndx); | ||||
|     return; | ||||
|   } | ||||
|   if (cmap->refcnt > 1) { | ||||
|     newcmap = __glutAssociateNewColormap(vis); | ||||
|     cmap->refcnt--; | ||||
|     /* Wouldn't it be nice if XCopyColormapAndFree could be | ||||
|        told not to free the old colormap's entries! */ | ||||
|     for (i = cmap->size - 1; i >= 0; i--) { | ||||
|       if (i == ndx) { | ||||
|         /* We are going to set this cell shortly! */ | ||||
|         continue; | ||||
|       } | ||||
|       if (cmap->cells[i].component[GLUT_RED] >= 0.0) { | ||||
|         color.pixel = i; | ||||
|         newcmap->cells[i].component[GLUT_RED] = | ||||
|           cmap->cells[i].component[GLUT_RED]; | ||||
|         color.red = (GLfloat) 0xffff * | ||||
|           cmap->cells[i].component[GLUT_RED]; | ||||
|         newcmap->cells[i].component[GLUT_GREEN] = | ||||
|           cmap->cells[i].component[GLUT_GREEN]; | ||||
|         color.green = (GLfloat) 0xffff * | ||||
|           cmap->cells[i].component[GLUT_GREEN]; | ||||
|         newcmap->cells[i].component[GLUT_BLUE] = | ||||
|           cmap->cells[i].component[GLUT_BLUE]; | ||||
|         color.blue = (GLfloat) 0xffff * | ||||
|           cmap->cells[i].component[GLUT_BLUE]; | ||||
|         color.flags = DoRed | DoGreen | DoBlue; | ||||
| #if defined(_WIN32) || defined(__OS2PM__) | ||||
|         if (IsWindowVisible(__glutCurrentWindow->win)) { | ||||
|           XHDC = __glutCurrentWindow->hdc; | ||||
|         } else { | ||||
|           XHDC = 0; | ||||
|         } | ||||
| #endif | ||||
|         XStoreColor(__glutDisplay, newcmap->cmap, &color); | ||||
|       } else { | ||||
|         /* Leave unallocated entries unallocated. */ | ||||
|       } | ||||
|     } | ||||
|     cmap = newcmap; | ||||
|     if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { | ||||
|       __glutCurrentWindow->colormap = cmap; | ||||
|       __glutCurrentWindow->cmap = cmap->cmap; | ||||
|     } else { | ||||
|       __glutCurrentWindow->overlay->colormap = cmap; | ||||
|       __glutCurrentWindow->overlay->cmap = cmap->cmap; | ||||
|     } | ||||
|     XSetWindowColormap(__glutDisplay, | ||||
|       __glutCurrentWindow->renderWin, cmap->cmap); | ||||
|  | ||||
| #if !defined(_WIN32) && !defined(__OS2PM__) | ||||
|     { | ||||
|       GLUTwindow *toplevel; | ||||
|  | ||||
|       toplevel = __glutToplevelOf(__glutCurrentWindow); | ||||
|       if (toplevel->cmap != cmap->cmap) { | ||||
|         __glutPutOnWorkList(toplevel, GLUT_COLORMAP_WORK); | ||||
|       } | ||||
|     } | ||||
| #endif | ||||
|   } | ||||
|   color.pixel = ndx; | ||||
|   red = CLAMP(red); | ||||
|   cmap->cells[ndx].component[GLUT_RED] = red; | ||||
|   color.red = (GLfloat) 0xffff *red; | ||||
|   green = CLAMP(green); | ||||
|   cmap->cells[ndx].component[GLUT_GREEN] = green; | ||||
|   color.green = (GLfloat) 0xffff *green; | ||||
|   blue = CLAMP(blue); | ||||
|   cmap->cells[ndx].component[GLUT_BLUE] = blue; | ||||
|   color.blue = (GLfloat) 0xffff *blue; | ||||
|   color.flags = DoRed | DoGreen | DoBlue; | ||||
| #if defined(_WIN32) || defined(__OS2PM__) | ||||
|   if (IsWindowVisible(__glutCurrentWindow->win)) { | ||||
|     XHDC = __glutCurrentWindow->hdc; | ||||
|   } else { | ||||
|     XHDC = 0; | ||||
|   } | ||||
| #endif | ||||
|   XStoreColor(__glutDisplay, cmap->cmap, &color); | ||||
| } | ||||
|  | ||||
| GLfloat GLUTAPIENTRY | ||||
| glutGetColor(int ndx, int comp) | ||||
| { | ||||
|   GLUTcolormap *colormap; | ||||
|   XVisualInfo *vis; | ||||
|  | ||||
|   if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { | ||||
|     colormap = __glutCurrentWindow->colormap; | ||||
|     vis = __glutCurrentWindow->vis; | ||||
|   } else { | ||||
|     colormap = __glutCurrentWindow->overlay->colormap; | ||||
|     vis = __glutCurrentWindow->overlay->vis; | ||||
|     if (ndx == __glutCurrentWindow->overlay->transparentPixel) { | ||||
|       __glutWarning("glutGetColor: requesting overlay transparent index %d\n", | ||||
|         ndx); | ||||
|       return -1.0; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   if (!colormap) { | ||||
|     __glutWarning("glutGetColor: current window is RGBA"); | ||||
|     return -1.0; | ||||
|   } | ||||
| #if defined(_WIN32) || defined(__OS2PM__) | ||||
| #define OUT_OF_RANGE_NDX(ndx) (ndx >= 256 || ndx < 0) | ||||
| #else | ||||
| #define OUT_OF_RANGE_NDX(ndx) (ndx >= vis->visual->map_entries || ndx < 0) | ||||
| #endif | ||||
|   if (OUT_OF_RANGE_NDX(ndx)) { | ||||
|     __glutWarning("glutGetColor: index %d out of range", ndx); | ||||
|     return -1.0; | ||||
|   } | ||||
|   return colormap->cells[ndx].component[comp]; | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutCopyColormap(int winnum) | ||||
| { | ||||
|   GLUTwindow *window = __glutWindowList[winnum - 1]; | ||||
|   GLUTcolormap *oldcmap, *newcmap; | ||||
|   XVisualInfo *dstvis; | ||||
|  | ||||
|   if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { | ||||
|     oldcmap = __glutCurrentWindow->colormap; | ||||
|     dstvis = __glutCurrentWindow->vis; | ||||
|     newcmap = window->colormap; | ||||
|   } else { | ||||
|     oldcmap = __glutCurrentWindow->overlay->colormap; | ||||
|     dstvis = __glutCurrentWindow->overlay->vis; | ||||
|     if (!window->overlay) { | ||||
|       __glutWarning("glutCopyColormap: window %d has no overlay", winnum); | ||||
|       return; | ||||
|     } | ||||
|     newcmap = window->overlay->colormap; | ||||
|   } | ||||
|  | ||||
|   if (!oldcmap) { | ||||
|     __glutWarning("glutCopyColormap: destination colormap must be color index"); | ||||
|     return; | ||||
|   } | ||||
|   if (!newcmap) { | ||||
|     __glutWarning( | ||||
|       "glutCopyColormap: source colormap of window %d must be color index", | ||||
|       winnum); | ||||
|     return; | ||||
|   } | ||||
|   if (newcmap == oldcmap) { | ||||
|     /* Source and destination are the same; now copy needed. */ | ||||
|     return; | ||||
|   } | ||||
| #if !defined(_WIN32) && !defined(__OS2PM__) | ||||
|   /* Play safe: compare visual IDs, not Visual*'s. */ | ||||
|   if (newcmap->visual->visualid == oldcmap->visual->visualid) { | ||||
| #endif | ||||
|     /* Visuals match!  "Copy" by reference...  */ | ||||
|     __glutFreeColormap(oldcmap); | ||||
|     newcmap->refcnt++; | ||||
|     if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { | ||||
|       __glutCurrentWindow->colormap = newcmap; | ||||
|       __glutCurrentWindow->cmap = newcmap->cmap; | ||||
|     } else { | ||||
|       __glutCurrentWindow->overlay->colormap = newcmap; | ||||
|       __glutCurrentWindow->overlay->cmap = newcmap->cmap; | ||||
|     } | ||||
|     XSetWindowColormap(__glutDisplay, __glutCurrentWindow->renderWin, | ||||
|       newcmap->cmap); | ||||
| #if !defined(_WIN32) && !defined(__OS2PM__) | ||||
|     __glutPutOnWorkList(__glutToplevelOf(window), GLUT_COLORMAP_WORK); | ||||
| bla bla bla | ||||
|  | ||||
|   } else { | ||||
|     GLUTcolormap *copycmap; | ||||
|     XColor color; | ||||
|     int i, last; | ||||
|  | ||||
|     /* Visuals different - need a distinct X colormap! */ | ||||
|     copycmap = __glutAssociateNewColormap(dstvis); | ||||
|     /* Wouldn't it be nice if XCopyColormapAndFree could be | ||||
|        told not to free the old colormap's entries! */ | ||||
|     last = newcmap->size; | ||||
|     if (last > copycmap->size) { | ||||
|       last = copycmap->size; | ||||
|     } | ||||
|     for (i = last - 1; i >= 0; i--) { | ||||
|       if (newcmap->cells[i].component[GLUT_RED] >= 0.0) { | ||||
|         color.pixel = i; | ||||
|         copycmap->cells[i].component[GLUT_RED] = | ||||
|           newcmap->cells[i].component[GLUT_RED]; | ||||
|         color.red = (GLfloat) 0xffff * | ||||
|           newcmap->cells[i].component[GLUT_RED]; | ||||
|         copycmap->cells[i].component[GLUT_GREEN] = | ||||
|           newcmap->cells[i].component[GLUT_GREEN]; | ||||
|         color.green = (GLfloat) 0xffff * | ||||
|           newcmap->cells[i].component[GLUT_GREEN]; | ||||
|         copycmap->cells[i].component[GLUT_BLUE] = | ||||
|           newcmap->cells[i].component[GLUT_BLUE]; | ||||
|         color.blue = (GLfloat) 0xffff * | ||||
|           newcmap->cells[i].component[GLUT_BLUE]; | ||||
|         color.flags = DoRed | DoGreen | DoBlue; | ||||
|         XStoreColor(__glutDisplay, copycmap->cmap, &color); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| #endif | ||||
| } | ||||
| /* ENDCENTRY */ | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,127 +1,127 @@ | ||||
|  | ||||
| /* Copyright (c) Mark J. Kilgard, 1994.  */ | ||||
|  | ||||
| /* This program is freely distributable without licensing fees | ||||
|    and is provided without guarantee or warrantee expressed or | ||||
|    implied. This program is -not- in the public domain. */ | ||||
|  | ||||
|  | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <assert.h> | ||||
|  | ||||
|  | ||||
| #include "glutint.h" | ||||
|  | ||||
| /* CENTRY */ | ||||
| void GLUTAPIENTRY | ||||
| glutSetWindowTitle(const char *title) | ||||
| { | ||||
| #if defined(__OS2PM__) | ||||
|    __glutSetWindowText(__glutCurrentWindow->win, (char *)title); | ||||
|  | ||||
| #else | ||||
|   XTextProperty textprop; | ||||
|  | ||||
|   assert(!__glutCurrentWindow->parent); | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   textprop.value = (unsigned char *) title; | ||||
|   textprop.encoding = XA_STRING; | ||||
|   textprop.format = 8; | ||||
|   textprop.nitems = strlen(title); | ||||
|   XSetWMName(__glutDisplay, | ||||
|     __glutCurrentWindow->win, &textprop); | ||||
|   XFlush(__glutDisplay); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutSetIconTitle(const char *title) | ||||
| { | ||||
| #if defined(__OS2PM__) | ||||
| //todo ? | ||||
| #else | ||||
|  | ||||
|   XTextProperty textprop; | ||||
|  | ||||
|   assert(!__glutCurrentWindow->parent); | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   textprop.value = (unsigned char *) title; | ||||
|   textprop.encoding = XA_STRING; | ||||
|   textprop.format = 8; | ||||
|   textprop.nitems = strlen(title); | ||||
|   XSetWMIconName(__glutDisplay, | ||||
|     __glutCurrentWindow->win, &textprop); | ||||
|   XFlush(__glutDisplay); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutPositionWindow(int x, int y) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   __glutCurrentWindow->desiredX = x; | ||||
|   __glutCurrentWindow->desiredY = y; | ||||
|   __glutCurrentWindow->desiredConfMask |= CWX | CWY; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutReshapeWindow(int w, int h) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   if (w <= 0 || h <= 0) | ||||
|     __glutWarning("glutReshapeWindow: non-positive width or height not allowed"); | ||||
|  | ||||
|   __glutCurrentWindow->desiredWidth = w; | ||||
|   __glutCurrentWindow->desiredHeight = h; | ||||
|   __glutCurrentWindow->desiredConfMask |= CWWidth | CWHeight; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutPopWindow(void) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   __glutCurrentWindow->desiredStack = Above; | ||||
|   __glutCurrentWindow->desiredConfMask |= CWStackMode; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutPushWindow(void) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   __glutCurrentWindow->desiredStack = Below; | ||||
|   __glutCurrentWindow->desiredConfMask |= CWStackMode; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutIconifyWindow(void) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   assert(!__glutCurrentWindow->parent); | ||||
|   __glutCurrentWindow->desiredMapState = IconicState; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutShowWindow(void) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   __glutCurrentWindow->desiredMapState = NormalState; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutHideWindow(void) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   __glutCurrentWindow->desiredMapState = WithdrawnState; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); | ||||
| } | ||||
|  | ||||
| /* ENDCENTRY */ | ||||
|  | ||||
| /* Copyright (c) Mark J. Kilgard, 1994.  */ | ||||
|  | ||||
| /* This program is freely distributable without licensing fees | ||||
|    and is provided without guarantee or warrantee expressed or | ||||
|    implied. This program is -not- in the public domain. */ | ||||
|  | ||||
|  | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <assert.h> | ||||
|  | ||||
|  | ||||
| #include "glutint.h" | ||||
|  | ||||
| /* CENTRY */ | ||||
| void GLUTAPIENTRY | ||||
| glutSetWindowTitle(const char *title) | ||||
| { | ||||
| #if defined(__OS2PM__) | ||||
|    __glutSetWindowText(__glutCurrentWindow->win, (char *)title); | ||||
|  | ||||
| #else | ||||
|   XTextProperty textprop; | ||||
|  | ||||
|   assert(!__glutCurrentWindow->parent); | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   textprop.value = (unsigned char *) title; | ||||
|   textprop.encoding = XA_STRING; | ||||
|   textprop.format = 8; | ||||
|   textprop.nitems = strlen(title); | ||||
|   XSetWMName(__glutDisplay, | ||||
|     __glutCurrentWindow->win, &textprop); | ||||
|   XFlush(__glutDisplay); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutSetIconTitle(const char *title) | ||||
| { | ||||
| #if defined(__OS2PM__) | ||||
| //todo ? | ||||
| #else | ||||
|  | ||||
|   XTextProperty textprop; | ||||
|  | ||||
|   assert(!__glutCurrentWindow->parent); | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   textprop.value = (unsigned char *) title; | ||||
|   textprop.encoding = XA_STRING; | ||||
|   textprop.format = 8; | ||||
|   textprop.nitems = strlen(title); | ||||
|   XSetWMIconName(__glutDisplay, | ||||
|     __glutCurrentWindow->win, &textprop); | ||||
|   XFlush(__glutDisplay); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutPositionWindow(int x, int y) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   __glutCurrentWindow->desiredX = x; | ||||
|   __glutCurrentWindow->desiredY = y; | ||||
|   __glutCurrentWindow->desiredConfMask |= CWX | CWY; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutReshapeWindow(int w, int h) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   if (w <= 0 || h <= 0) | ||||
|     __glutWarning("glutReshapeWindow: non-positive width or height not allowed"); | ||||
|  | ||||
|   __glutCurrentWindow->desiredWidth = w; | ||||
|   __glutCurrentWindow->desiredHeight = h; | ||||
|   __glutCurrentWindow->desiredConfMask |= CWWidth | CWHeight; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutPopWindow(void) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   __glutCurrentWindow->desiredStack = Above; | ||||
|   __glutCurrentWindow->desiredConfMask |= CWStackMode; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutPushWindow(void) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   __glutCurrentWindow->desiredStack = Below; | ||||
|   __glutCurrentWindow->desiredConfMask |= CWStackMode; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutIconifyWindow(void) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   assert(!__glutCurrentWindow->parent); | ||||
|   __glutCurrentWindow->desiredMapState = IconicState; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutShowWindow(void) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   __glutCurrentWindow->desiredMapState = NormalState; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); | ||||
| } | ||||
|  | ||||
| void GLUTAPIENTRY | ||||
| glutHideWindow(void) | ||||
| { | ||||
|   IGNORE_IN_GAME_MODE(); | ||||
|   __glutCurrentWindow->desiredMapState = WithdrawnState; | ||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); | ||||
| } | ||||
|  | ||||
| /* ENDCENTRY */ | ||||
|  | ||||
| @@ -1,146 +1,146 @@ | ||||
| /* os2_glx.c */ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <malloc.h> | ||||
| #include "gl/gl.h" | ||||
| #include "WarpGL.h" | ||||
| #include "GL/os2mesa.h" | ||||
|  | ||||
| #define POKA 0 | ||||
| /* global current HDC */ | ||||
|  | ||||
| XVisualInfo *wglDescribePixelFormat(int iPixelFormat); | ||||
|  | ||||
| extern HDC XHDC; | ||||
| extern HWND XHWND; | ||||
| //extern HPS hpsCurrent; | ||||
| extern HAB   hab;      /* PM anchor block handle */ | ||||
|  | ||||
| GLXContext | ||||
| glXCreateContext(HPS hps, XVisualInfo * visinfo, | ||||
|   GLXContext share, Bool direct) | ||||
| { | ||||
|   /* KLUDGE: GLX really expects a display pointer to be passed | ||||
|      in as the first parameter, but Win32 needs an HDC instead, | ||||
|      so BE SURE that the global XHDC is set before calling this | ||||
|      routine. */ | ||||
|   HGLRC context; | ||||
|  | ||||
|   context = wglCreateContext(XHDC,hps,hab); | ||||
|  | ||||
|  | ||||
|   /* Since direct rendering is implicit, the direct flag is | ||||
|      ignored. */ | ||||
|  | ||||
|   return context; | ||||
| } | ||||
|  | ||||
|  | ||||
| int | ||||
| glXGetConfig(XVisualInfo * visual, int attrib, int *value) | ||||
| { | ||||
|   if (!visual) | ||||
|     return GLX_BAD_VISUAL; | ||||
|  | ||||
|   switch (attrib) { | ||||
|   case GLX_USE_GL: | ||||
|     if (visual->dwFlags & (PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW)) { | ||||
|       /* XXX Brad's Matrix Millenium II has problems creating | ||||
|          color index windows in 24-bit mode (lead to GDI crash) | ||||
|          and 32-bit mode (lead to black window).  The cColorBits | ||||
|          filed of the PIXELFORMATDESCRIPTOR returned claims to | ||||
|          have 24 and 32 bits respectively of color indices. 2^24 | ||||
|          and 2^32 are ridiculously huge writable colormaps. | ||||
|          Assume that if we get back a color index | ||||
|          PIXELFORMATDESCRIPTOR with 24 or more bits, the | ||||
|          PIXELFORMATDESCRIPTOR doesn't really work and skip it. | ||||
|          -mjk */ | ||||
|       if (visual->iPixelType == PFD_TYPE_COLORINDEX | ||||
|         && visual->cColorBits >= 24) { | ||||
|         *value = 0; | ||||
|       } else { | ||||
|        *value = 1; | ||||
|       } | ||||
|     } else { | ||||
|       *value = 0; | ||||
|     } | ||||
|     break; | ||||
|   case GLX_BUFFER_SIZE: | ||||
|     /* KLUDGE: if we're RGBA, return the number of bits/pixel, | ||||
|        otherwise, return 8 (we guessed at 256 colors in CI | ||||
|        mode). */ | ||||
|     if (visual->iPixelType == PFD_TYPE_RGBA) | ||||
|       *value = visual->cColorBits; | ||||
|     else | ||||
|       *value = 8; | ||||
|     break; | ||||
|   case GLX_LEVEL: | ||||
|     /* The bReserved flag of the pfd contains the | ||||
|        overlay/underlay info. */ | ||||
|     *value = visual->bReserved; | ||||
|     break; | ||||
|   case GLX_RGBA: | ||||
|     *value = visual->iPixelType == PFD_TYPE_RGBA; | ||||
|     break; | ||||
|   case GLX_DOUBLEBUFFER: | ||||
|     *value = visual->dwFlags & PFD_DOUBLEBUFFER; | ||||
|     break; | ||||
|   case GLX_STEREO: | ||||
|     *value = visual->dwFlags & PFD_STEREO; | ||||
|     break; | ||||
|   case GLX_AUX_BUFFERS: | ||||
|     *value = visual->cAuxBuffers; | ||||
|     break; | ||||
|   case GLX_RED_SIZE: | ||||
|     *value = visual->cRedBits; | ||||
|     break; | ||||
|   case GLX_GREEN_SIZE: | ||||
|     *value = visual->cGreenBits; | ||||
|     break; | ||||
|   case GLX_BLUE_SIZE: | ||||
|     *value = visual->cBlueBits; | ||||
|     break; | ||||
|   case GLX_ALPHA_SIZE: | ||||
|     *value = visual->cAlphaBits; | ||||
|     break; | ||||
|   case GLX_DEPTH_SIZE: | ||||
|     *value = visual->cDepthBits; | ||||
|     break; | ||||
|   case GLX_STENCIL_SIZE: | ||||
|     *value = visual->cStencilBits; | ||||
|     break; | ||||
|   case GLX_ACCUM_RED_SIZE: | ||||
|     *value = visual->cAccumRedBits; | ||||
|     break; | ||||
|   case GLX_ACCUM_GREEN_SIZE: | ||||
|     *value = visual->cAccumGreenBits; | ||||
|     break; | ||||
|   case GLX_ACCUM_BLUE_SIZE: | ||||
|     *value = visual->cAccumBlueBits; | ||||
|     break; | ||||
|   case GLX_ACCUM_ALPHA_SIZE: | ||||
|     *value = visual->cAccumAlphaBits; | ||||
|     break; | ||||
| #if POKA == 100 | ||||
| #endif /*  POKA == 100 */ | ||||
|   default: | ||||
|     return GLX_BAD_ATTRIB; | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| XVisualInfo * glXChooseVisual(int mode) | ||||
| {  int imode = 2; | ||||
|    if(mode & GLUT_DOUBLE) | ||||
|             imode = 1; | ||||
|    return | ||||
|          wglDescribePixelFormat(imode); | ||||
| } | ||||
|  | ||||
|  | ||||
| #if POKA | ||||
| #endif /* POKA */ | ||||
|  | ||||
| /* os2_glx.c */ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <malloc.h> | ||||
| #include "gl/gl.h" | ||||
| #include "WarpGL.h" | ||||
| #include "GL/os2mesa.h" | ||||
|  | ||||
| #define POKA 0 | ||||
| /* global current HDC */ | ||||
|  | ||||
| XVisualInfo *wglDescribePixelFormat(int iPixelFormat); | ||||
|  | ||||
| extern HDC XHDC; | ||||
| extern HWND XHWND; | ||||
| //extern HPS hpsCurrent; | ||||
| extern HAB   hab;      /* PM anchor block handle */ | ||||
|  | ||||
| GLXContext | ||||
| glXCreateContext(HPS hps, XVisualInfo * visinfo, | ||||
|   GLXContext share, Bool direct) | ||||
| { | ||||
|   /* KLUDGE: GLX really expects a display pointer to be passed | ||||
|      in as the first parameter, but Win32 needs an HDC instead, | ||||
|      so BE SURE that the global XHDC is set before calling this | ||||
|      routine. */ | ||||
|   HGLRC context; | ||||
|  | ||||
|   context = wglCreateContext(XHDC,hps,hab); | ||||
|  | ||||
|  | ||||
|   /* Since direct rendering is implicit, the direct flag is | ||||
|      ignored. */ | ||||
|  | ||||
|   return context; | ||||
| } | ||||
|  | ||||
|  | ||||
| int | ||||
| glXGetConfig(XVisualInfo * visual, int attrib, int *value) | ||||
| { | ||||
|   if (!visual) | ||||
|     return GLX_BAD_VISUAL; | ||||
|  | ||||
|   switch (attrib) { | ||||
|   case GLX_USE_GL: | ||||
|     if (visual->dwFlags & (PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW)) { | ||||
|       /* XXX Brad's Matrix Millenium II has problems creating | ||||
|          color index windows in 24-bit mode (lead to GDI crash) | ||||
|          and 32-bit mode (lead to black window).  The cColorBits | ||||
|          filed of the PIXELFORMATDESCRIPTOR returned claims to | ||||
|          have 24 and 32 bits respectively of color indices. 2^24 | ||||
|          and 2^32 are ridiculously huge writable colormaps. | ||||
|          Assume that if we get back a color index | ||||
|          PIXELFORMATDESCRIPTOR with 24 or more bits, the | ||||
|          PIXELFORMATDESCRIPTOR doesn't really work and skip it. | ||||
|          -mjk */ | ||||
|       if (visual->iPixelType == PFD_TYPE_COLORINDEX | ||||
|         && visual->cColorBits >= 24) { | ||||
|         *value = 0; | ||||
|       } else { | ||||
|        *value = 1; | ||||
|       } | ||||
|     } else { | ||||
|       *value = 0; | ||||
|     } | ||||
|     break; | ||||
|   case GLX_BUFFER_SIZE: | ||||
|     /* KLUDGE: if we're RGBA, return the number of bits/pixel, | ||||
|        otherwise, return 8 (we guessed at 256 colors in CI | ||||
|        mode). */ | ||||
|     if (visual->iPixelType == PFD_TYPE_RGBA) | ||||
|       *value = visual->cColorBits; | ||||
|     else | ||||
|       *value = 8; | ||||
|     break; | ||||
|   case GLX_LEVEL: | ||||
|     /* The bReserved flag of the pfd contains the | ||||
|        overlay/underlay info. */ | ||||
|     *value = visual->bReserved; | ||||
|     break; | ||||
|   case GLX_RGBA: | ||||
|     *value = visual->iPixelType == PFD_TYPE_RGBA; | ||||
|     break; | ||||
|   case GLX_DOUBLEBUFFER: | ||||
|     *value = visual->dwFlags & PFD_DOUBLEBUFFER; | ||||
|     break; | ||||
|   case GLX_STEREO: | ||||
|     *value = visual->dwFlags & PFD_STEREO; | ||||
|     break; | ||||
|   case GLX_AUX_BUFFERS: | ||||
|     *value = visual->cAuxBuffers; | ||||
|     break; | ||||
|   case GLX_RED_SIZE: | ||||
|     *value = visual->cRedBits; | ||||
|     break; | ||||
|   case GLX_GREEN_SIZE: | ||||
|     *value = visual->cGreenBits; | ||||
|     break; | ||||
|   case GLX_BLUE_SIZE: | ||||
|     *value = visual->cBlueBits; | ||||
|     break; | ||||
|   case GLX_ALPHA_SIZE: | ||||
|     *value = visual->cAlphaBits; | ||||
|     break; | ||||
|   case GLX_DEPTH_SIZE: | ||||
|     *value = visual->cDepthBits; | ||||
|     break; | ||||
|   case GLX_STENCIL_SIZE: | ||||
|     *value = visual->cStencilBits; | ||||
|     break; | ||||
|   case GLX_ACCUM_RED_SIZE: | ||||
|     *value = visual->cAccumRedBits; | ||||
|     break; | ||||
|   case GLX_ACCUM_GREEN_SIZE: | ||||
|     *value = visual->cAccumGreenBits; | ||||
|     break; | ||||
|   case GLX_ACCUM_BLUE_SIZE: | ||||
|     *value = visual->cAccumBlueBits; | ||||
|     break; | ||||
|   case GLX_ACCUM_ALPHA_SIZE: | ||||
|     *value = visual->cAccumAlphaBits; | ||||
|     break; | ||||
| #if POKA == 100 | ||||
| #endif /*  POKA == 100 */ | ||||
|   default: | ||||
|     return GLX_BAD_ATTRIB; | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| XVisualInfo * glXChooseVisual(int mode) | ||||
| {  int imode = 2; | ||||
|    if(mode & GLUT_DOUBLE) | ||||
|             imode = 1; | ||||
|    return | ||||
|          wglDescribePixelFormat(imode); | ||||
| } | ||||
|  | ||||
|  | ||||
| #if POKA | ||||
| #endif /* POKA */ | ||||
|  | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -28,18 +28,19 @@ default: $(TOP)/$(LIB_DIR)/$(GLW_LIB_NAME) | ||||
| # GLU pkg-config file | ||||
| pcedit = sed \ | ||||
| 	-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ | ||||
| 	-e 's,@LIB_DIR@,$(LIB_DIR),' \ | ||||
| 	-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ | ||||
| 	-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ | ||||
| 	-e 's,@VERSION@,$(MAJOR).$(MINOR).$(TINY),' | ||||
| glw.pc: glw.pc.in | ||||
| 	$(pcedit) $< > $@ | ||||
|  | ||||
| install: glw.pc | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) -m 644 *.h $(DESTDIR)$(INSTALL_DIR)/include/GL | ||||
| 	$(INSTALL) $(TOP)/$(LIB_DIR)/libGLw.* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 	$(INSTALL) -m 644 glw.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) -m 644 *.h $(DESTDIR)$(INSTALL_INC_DIR)/GL | ||||
| 	$(INSTALL) $(TOP)/$(LIB_DIR)/libGLw.* $(DESTDIR)$(INSTALL_LIB_DIR) | ||||
| 	$(INSTALL) -m 644 glw.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig | ||||
|  | ||||
| clean: | ||||
| 	-rm -f depend depend.bak | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| prefix=@INSTALL_DIR@ | ||||
| exec_prefix=${prefix} | ||||
| libdir=${exec_prefix}/@LIB_DIR@ | ||||
| includedir=${prefix}/include | ||||
| libdir=@INSTALL_LIB_DIR@ | ||||
| includedir=@INSTALL_INC_DIR@ | ||||
|  | ||||
| Name: glw | ||||
| Description: Mesa OpenGL widget library | ||||
|   | ||||
							
								
								
									
										1
									
								
								src/glx/x11/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								src/glx/x11/.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1 +0,0 @@ | ||||
| glcontextmodes.c | ||||
| @@ -31,6 +31,8 @@ SOURCES = \ | ||||
| 	  xfont.c \ | ||||
| 	  glx_pbuffer.c \ | ||||
| 	  glx_query.c \ | ||||
| 	  drisw_glx.c \ | ||||
| 	  dri_common.c \ | ||||
| 	  dri_glx.c \ | ||||
| 	  XF86dri.c \ | ||||
| 	  glxhash.c \ | ||||
| @@ -85,7 +87,7 @@ tags: | ||||
| 	etags `find . -name \*.[ch]` `find $(TOP)/include` | ||||
|  | ||||
| install: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) | ||||
| 	make -C $(TOP)/src/mesa install-libgl | ||||
| 	$(MAKE) -C $(TOP)/src/mesa install-libgl | ||||
|  | ||||
| # Remove .o and backup files | ||||
| clean: | ||||
|   | ||||
| @@ -32,7 +32,6 @@ | ||||
|  | ||||
| #ifdef GLX_DIRECT_RENDERING | ||||
|  | ||||
| #include <unistd.h> | ||||
| #include <X11/Xlib.h> | ||||
| #include <X11/extensions/Xfixes.h> | ||||
| #include <X11/extensions/Xdamage.h> | ||||
| @@ -46,18 +45,10 @@ | ||||
| #include <sys/mman.h> | ||||
| #include "xf86drm.h" | ||||
| #include "dri2.h" | ||||
|  | ||||
|  | ||||
| #ifndef RTLD_NOW | ||||
| #define RTLD_NOW 0 | ||||
| #endif | ||||
| #ifndef RTLD_GLOBAL | ||||
| #define RTLD_GLOBAL 0 | ||||
| #endif | ||||
| #include "dri_common.h" | ||||
|  | ||||
| typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate; | ||||
| typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate; | ||||
| typedef struct __GLXDRIconfigPrivateRec  __GLXDRIconfigPrivate; | ||||
|  | ||||
| struct __GLXDRIdisplayPrivateRec { | ||||
|     __GLXDRIdisplay base; | ||||
| @@ -76,11 +67,6 @@ struct __GLXDRIcontextPrivateRec { | ||||
|     __GLXscreenConfigs *psc; | ||||
| }; | ||||
|  | ||||
| struct __GLXDRIconfigPrivateRec { | ||||
|     __GLcontextModes modes; | ||||
|     const __DRIconfig *driConfig; | ||||
| }; | ||||
|  | ||||
| static void dri2DestroyContext(__GLXDRIcontext *context, | ||||
| 			      __GLXscreenConfigs *psc, Display *dpy) | ||||
| { | ||||
| @@ -253,94 +239,12 @@ static const __DRIloaderExtension dri2LoaderExtension = { | ||||
|     dri2PostDamage | ||||
| }; | ||||
|  | ||||
| _X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension; | ||||
|  | ||||
| static const __DRIextension *loader_extensions[] = { | ||||
|     &dri2LoaderExtension.base, | ||||
|     &systemTimeExtension.base, | ||||
|     NULL | ||||
| }; | ||||
|  | ||||
| /* We need a dri_common.h type-of-thing. */ | ||||
|  | ||||
| extern void ErrorMessageF(const char *f, ...); | ||||
|  | ||||
| extern void *driOpenDriver(const char *driverName); | ||||
|  | ||||
| extern __GLcontextModes * | ||||
| driConvertConfigs(const __DRIcoreExtension *core, | ||||
| 		  __GLcontextModes *modes, const __DRIconfig **configs); | ||||
|  | ||||
| extern void driBindExtensions(__GLXscreenConfigs *psc); | ||||
|  | ||||
| void | ||||
| driBindExtensions(__GLXscreenConfigs *psc) | ||||
| { | ||||
|     const __DRIextension **extensions; | ||||
|     int i; | ||||
|  | ||||
|     extensions = psc->core->getExtensions(psc->__driScreen); | ||||
|  | ||||
|     for (i = 0; extensions[i]; i++) { | ||||
| #ifdef __DRI_COPY_SUB_BUFFER | ||||
| 	if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) { | ||||
| 	    psc->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i]; | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer_bit"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_SWAP_CONTROL | ||||
| 	if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) { | ||||
| 	    psc->swapControl = (__DRIswapControlExtension *) extensions[i]; | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_SGI_swap_control"); | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_MESA_swap_control"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_ALLOCATE | ||||
| 	if (strcmp(extensions[i]->name, __DRI_ALLOCATE) == 0) { | ||||
| 	    psc->allocate = (__DRIallocateExtension *) extensions[i]; | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_MESA_allocate_memory"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_FRAME_TRACKING | ||||
| 	if (strcmp(extensions[i]->name, __DRI_FRAME_TRACKING) == 0) { | ||||
| 	    psc->frameTracking = (__DRIframeTrackingExtension *) extensions[i]; | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_MESA_swap_frame_usage"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_MEDIA_STREAM_COUNTER | ||||
| 	if (strcmp(extensions[i]->name, __DRI_MEDIA_STREAM_COUNTER) == 0) { | ||||
| 	    psc->msc = (__DRImediaStreamCounterExtension *) extensions[i]; | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_SGI_video_sync"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_SWAP_BUFFER_COUNTER | ||||
| 	/* No driver supports this at this time and the extension is | ||||
| 	 * not defined in dri_interface.h.  Will enable | ||||
| 	 * GLX_OML_sync_control if implemented. */ | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_READ_DRAWABLE | ||||
| 	if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) { | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_SGI_make_current_read"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_TEX_BUFFER | ||||
| 	if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) { | ||||
| 	    psc->texBuffer = (__DRItexBufferExtension *) extensions[i]; | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_EXT_texture_from_pixmap"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| 	/* Ignore unknown extensions */ | ||||
|     } | ||||
| } | ||||
|  | ||||
| static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen, | ||||
| 					__GLXdisplayPrivate *priv) | ||||
| { | ||||
|   | ||||
							
								
								
									
										399
									
								
								src/glx/x11/dri_common.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										399
									
								
								src/glx/x11/dri_common.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,399 @@ | ||||
| /* | ||||
|  * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. | ||||
|  * Copyright © 2008 Red Hat, Inc. | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Soft- | ||||
|  * ware"), to deal in the Software without restriction, including without | ||||
|  * limitation the rights to use, copy, modify, merge, publish, distribute, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, provided that the above copyright | ||||
|  * notice(s) and this permission notice appear in all copies of the Soft- | ||||
|  * ware and that both the above copyright notice(s) and this permission | ||||
|  * notice appear in supporting documentation. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||
|  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- | ||||
|  * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY | ||||
|  * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN | ||||
|  * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- | ||||
|  * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | ||||
|  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | ||||
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- | ||||
|  * MANCE OF THIS SOFTWARE. | ||||
|  * | ||||
|  * Except as contained in this notice, the name of a copyright holder shall | ||||
|  * not be used in advertising or otherwise to promote the sale, use or | ||||
|  * other dealings in this Software without prior written authorization of | ||||
|  * the copyright holder. | ||||
|  * | ||||
|  * Authors: | ||||
|  *   Kevin E. Martin <kevin@precisioninsight.com> | ||||
|  *   Brian Paul <brian@precisioninsight.com> | ||||
|  *   Kristian Høgsberg (krh@redhat.com) | ||||
|  */ | ||||
|  | ||||
| #ifdef GLX_DIRECT_RENDERING | ||||
|  | ||||
| #include <unistd.h> | ||||
| #include <dlfcn.h> | ||||
| #include "glheader.h" | ||||
| #include "glxclient.h" | ||||
| #include "glcontextmodes.h" | ||||
| #include "dri_common.h" | ||||
|  | ||||
| #ifndef RTLD_NOW | ||||
| #define RTLD_NOW 0 | ||||
| #endif | ||||
| #ifndef RTLD_GLOBAL | ||||
| #define RTLD_GLOBAL 0 | ||||
| #endif | ||||
|  | ||||
| _X_HIDDEN void InfoMessageF(const char *f, ...) | ||||
| { | ||||
|     va_list args; | ||||
|     const char *env; | ||||
|  | ||||
|     if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) { | ||||
| 	fprintf(stderr, "libGL: "); | ||||
| 	va_start(args, f); | ||||
| 	vfprintf(stderr, f, args); | ||||
| 	va_end(args); | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Print error to stderr, unless LIBGL_DEBUG=="quiet". | ||||
|  */ | ||||
| _X_HIDDEN void ErrorMessageF(const char *f, ...) | ||||
| { | ||||
|     va_list args; | ||||
|     const char *env; | ||||
|  | ||||
|     if ((env = getenv("LIBGL_DEBUG")) && !strstr(env, "quiet")) { | ||||
| 	fprintf(stderr, "libGL error: "); | ||||
| 	va_start(args, f); | ||||
| 	vfprintf(stderr, f, args); | ||||
| 	va_end(args); | ||||
|     } | ||||
| } | ||||
|  | ||||
| #ifndef DEFAULT_DRIVER_DIR | ||||
| /* this is normally defined in Mesa/configs/default with DRI_DRIVER_SEARCH_PATH */ | ||||
| #define DEFAULT_DRIVER_DIR "/usr/local/lib/dri" | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * Try to \c dlopen the named driver. | ||||
|  * | ||||
|  * This function adds the "_dri.so" suffix to the driver name and searches the | ||||
|  * directories specified by the \c LIBGL_DRIVERS_PATH environment variable in | ||||
|  * order to find the driver. | ||||
|  * | ||||
|  * \param driverName - a name like "tdfx", "i810", "mga", etc. | ||||
|  * | ||||
|  * \returns | ||||
|  * A handle from \c dlopen, or \c NULL if driver file not found. | ||||
|  */ | ||||
| _X_HIDDEN void *driOpenDriver(const char *driverName) | ||||
| { | ||||
|    void *glhandle, *handle; | ||||
|    const char *libPaths, *p, *next; | ||||
|    char realDriverName[200]; | ||||
|    int len; | ||||
|  | ||||
|    /* Attempt to make sure libGL symbols will be visible to the driver */ | ||||
|    glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL); | ||||
|  | ||||
|    libPaths = NULL; | ||||
|    if (geteuid() == getuid()) { | ||||
|       /* don't allow setuid apps to use LIBGL_DRIVERS_PATH */ | ||||
|       libPaths = getenv("LIBGL_DRIVERS_PATH"); | ||||
|       if (!libPaths) | ||||
|          libPaths = getenv("LIBGL_DRIVERS_DIR"); /* deprecated */ | ||||
|    } | ||||
|    if (libPaths == NULL) | ||||
|        libPaths = DEFAULT_DRIVER_DIR; | ||||
|  | ||||
|    handle = NULL; | ||||
|    for (p = libPaths; *p; p = next) { | ||||
|        next = strchr(p, ':'); | ||||
|        if (next == NULL) { | ||||
| 	   len = strlen(p); | ||||
| 	   next = p + len; | ||||
|        } else { | ||||
| 	   len = next - p; | ||||
| 	   next++; | ||||
|        } | ||||
|  | ||||
| #ifdef GLX_USE_TLS | ||||
|       snprintf(realDriverName, sizeof realDriverName, | ||||
| 	       "%.*s/tls/%s_dri.so", len, p, driverName); | ||||
|       InfoMessageF("OpenDriver: trying %s\n", realDriverName); | ||||
|       handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL); | ||||
| #endif | ||||
|  | ||||
|       if ( handle == NULL ) { | ||||
| 	 snprintf(realDriverName, sizeof realDriverName, | ||||
| 		  "%.*s/%s_dri.so", len, p, driverName); | ||||
| 	 InfoMessageF("OpenDriver: trying %s\n", realDriverName); | ||||
| 	 handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL); | ||||
|       } | ||||
|  | ||||
|       if ( handle != NULL ) | ||||
| 	  break; | ||||
|       else | ||||
| 	 ErrorMessageF("dlopen %s failed (%s)\n", realDriverName, dlerror()); | ||||
|    } | ||||
|  | ||||
|    if (!handle) | ||||
|       ErrorMessageF("unable to load driver: %s_dri.so\n", driverName); | ||||
|  | ||||
|    if (glhandle) | ||||
|       dlclose(glhandle); | ||||
|  | ||||
|    return handle; | ||||
| } | ||||
|  | ||||
| _X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension = { | ||||
|     { __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION }, | ||||
|     __glXGetUST, | ||||
|     __driGetMscRateOML | ||||
| }; | ||||
|  | ||||
| #define __ATTRIB(attrib, field) \ | ||||
|     { attrib, offsetof(__GLcontextModes, field) } | ||||
|  | ||||
| static const struct { unsigned int attrib, offset; } attribMap[] = { | ||||
|     __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE,			rgbBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_LEVEL,			level), | ||||
|     __ATTRIB(__DRI_ATTRIB_RED_SIZE,			redBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_GREEN_SIZE,			greenBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_BLUE_SIZE,			blueBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE,			alphaBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE,			depthBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE,			stencilBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE,		accumRedBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE,		accumGreenBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE,		accumBlueBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE,		accumAlphaBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS,		sampleBuffers), | ||||
|     __ATTRIB(__DRI_ATTRIB_SAMPLES,			samples), | ||||
|     __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER,		doubleBufferMode), | ||||
|     __ATTRIB(__DRI_ATTRIB_STEREO,			stereoMode), | ||||
|     __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS,			numAuxBuffers), | ||||
| #if 0 | ||||
|     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE,		transparentPixel), | ||||
|     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE,	transparentIndex), | ||||
|     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE,	transparentRed), | ||||
|     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE,	transparentGreen), | ||||
|     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE,	transparentBlue), | ||||
|     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE,	transparentAlpha), | ||||
|     __ATTRIB(__DRI_ATTRIB_RED_MASK,			redMask), | ||||
|     __ATTRIB(__DRI_ATTRIB_GREEN_MASK,			greenMask), | ||||
|     __ATTRIB(__DRI_ATTRIB_BLUE_MASK,			blueMask), | ||||
|     __ATTRIB(__DRI_ATTRIB_ALPHA_MASK,			alphaMask), | ||||
| #endif | ||||
|     __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH,		maxPbufferWidth), | ||||
|     __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT,		maxPbufferHeight), | ||||
|     __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS,		maxPbufferPixels), | ||||
|     __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH,	optimalPbufferWidth), | ||||
|     __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT,	optimalPbufferHeight), | ||||
| #if 0 | ||||
|     __ATTRIB(__DRI_ATTRIB_SWAP_METHOD,			swapMethod), | ||||
| #endif | ||||
|     __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB,		bindToTextureRgb), | ||||
|     __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA,		bindToTextureRgba), | ||||
|     __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE,	bindToMipmapTexture), | ||||
|     __ATTRIB(__DRI_ATTRIB_YINVERTED,			yInverted), | ||||
| }; | ||||
|  | ||||
| #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) | ||||
|  | ||||
| static int | ||||
| scalarEqual(__GLcontextModes *mode, unsigned int attrib, unsigned int value) | ||||
| { | ||||
|     unsigned int glxValue; | ||||
|     int i; | ||||
|  | ||||
|     for (i = 0; i < ARRAY_SIZE(attribMap); i++) | ||||
| 	if (attribMap[i].attrib == attrib) { | ||||
| 	    glxValue = *(unsigned int *) ((char *) mode + attribMap[i].offset); | ||||
| 	    return glxValue == GLX_DONT_CARE || glxValue == value; | ||||
| 	} | ||||
|  | ||||
|     return GL_TRUE; /* Is a non-existing attribute equal to value? */ | ||||
| } | ||||
|  | ||||
| static int | ||||
| driConfigEqual(const __DRIcoreExtension *core, | ||||
| 	       __GLcontextModes *modes, const __DRIconfig *driConfig) | ||||
| { | ||||
|     unsigned int attrib, value, glxValue; | ||||
|     int i; | ||||
|  | ||||
|     i = 0; | ||||
|     while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) { | ||||
| 	switch (attrib) { | ||||
| 	case __DRI_ATTRIB_RENDER_TYPE: | ||||
| 	    glxValue = 0; | ||||
| 	    if (value & __DRI_ATTRIB_RGBA_BIT) { | ||||
| 		glxValue |= GLX_RGBA_BIT; | ||||
| 	    } else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) { | ||||
| 		glxValue |= GLX_COLOR_INDEX_BIT; | ||||
| 	    } | ||||
| 	    if (glxValue != modes->renderType) | ||||
| 		return GL_FALSE; | ||||
| 	    break; | ||||
|  | ||||
| 	case __DRI_ATTRIB_CONFIG_CAVEAT: | ||||
| 	    if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG) | ||||
| 		glxValue = GLX_NON_CONFORMANT_CONFIG; | ||||
| 	    else if (value & __DRI_ATTRIB_SLOW_BIT) | ||||
| 		glxValue = GLX_SLOW_CONFIG; | ||||
| 	    else | ||||
| 		glxValue = GLX_NONE; | ||||
| 	    if (glxValue != modes->visualRating) | ||||
| 		return GL_FALSE; | ||||
| 	    break; | ||||
|  | ||||
| 	case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS: | ||||
| 	    glxValue = 0; | ||||
| 	    if (value & __DRI_ATTRIB_TEXTURE_1D_BIT) | ||||
| 		glxValue |= GLX_TEXTURE_1D_BIT_EXT; | ||||
| 	    if (value & __DRI_ATTRIB_TEXTURE_2D_BIT) | ||||
| 		glxValue |= GLX_TEXTURE_2D_BIT_EXT; | ||||
| 	    if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT) | ||||
| 		glxValue |= GLX_TEXTURE_RECTANGLE_BIT_EXT; | ||||
| 	    if (modes->bindToTextureTargets != GLX_DONT_CARE && | ||||
| 		glxValue != modes->bindToTextureTargets) | ||||
| 		return GL_FALSE; | ||||
| 	    break;	 | ||||
|  | ||||
| 	default: | ||||
| 	    if (!scalarEqual(modes, attrib, value)) | ||||
| 		return GL_FALSE; | ||||
| 	} | ||||
|     } | ||||
|  | ||||
|     return GL_TRUE; | ||||
| } | ||||
|  | ||||
| static __GLcontextModes * | ||||
| createDriMode(const __DRIcoreExtension *core, | ||||
| 	      __GLcontextModes *modes, const __DRIconfig **driConfigs) | ||||
| { | ||||
|     __GLXDRIconfigPrivate *config; | ||||
|     int i; | ||||
|  | ||||
|     for (i = 0; driConfigs[i]; i++) { | ||||
| 	if (driConfigEqual(core, modes, driConfigs[i])) | ||||
| 	    break; | ||||
|     } | ||||
|  | ||||
|     if (driConfigs[i] == NULL) | ||||
| 	return NULL; | ||||
|  | ||||
|     config = Xmalloc(sizeof *config); | ||||
|     if (config == NULL) | ||||
| 	return NULL; | ||||
|  | ||||
|     config->modes = *modes; | ||||
|     config->driConfig = driConfigs[i]; | ||||
|  | ||||
|     return &config->modes; | ||||
| } | ||||
|  | ||||
| _X_HIDDEN __GLcontextModes * | ||||
| driConvertConfigs(const __DRIcoreExtension *core, | ||||
| 		  __GLcontextModes *modes, const __DRIconfig **configs) | ||||
| { | ||||
|     __GLcontextModes head, *tail, *m; | ||||
|  | ||||
|     tail = &head; | ||||
|     head.next = NULL; | ||||
|     for (m = modes; m; m = m->next) { | ||||
| 	tail->next = createDriMode(core, m, configs); | ||||
| 	if (tail->next == NULL) { | ||||
| 	    /* no matching dri config for m */ | ||||
| 	    continue; | ||||
| 	} | ||||
|  | ||||
|  | ||||
| 	tail = tail->next; | ||||
|     } | ||||
|  | ||||
|     _gl_context_modes_destroy(modes); | ||||
|  | ||||
|     return head.next; | ||||
| } | ||||
|  | ||||
| _X_HIDDEN void | ||||
| driBindExtensions(__GLXscreenConfigs *psc) | ||||
| { | ||||
|     const __DRIextension **extensions; | ||||
|     int i; | ||||
|  | ||||
|     extensions = psc->core->getExtensions(psc->__driScreen); | ||||
|  | ||||
|     for (i = 0; extensions[i]; i++) { | ||||
| #ifdef __DRI_COPY_SUB_BUFFER | ||||
| 	if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) { | ||||
| 	    psc->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i]; | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer_bit"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_SWAP_CONTROL | ||||
| 	if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) { | ||||
| 	    psc->swapControl = (__DRIswapControlExtension *) extensions[i]; | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_SGI_swap_control"); | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_MESA_swap_control"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_ALLOCATE | ||||
| 	if (strcmp(extensions[i]->name, __DRI_ALLOCATE) == 0) { | ||||
| 	    psc->allocate = (__DRIallocateExtension *) extensions[i]; | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_MESA_allocate_memory"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_FRAME_TRACKING | ||||
| 	if (strcmp(extensions[i]->name, __DRI_FRAME_TRACKING) == 0) { | ||||
| 	    psc->frameTracking = (__DRIframeTrackingExtension *) extensions[i]; | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_MESA_swap_frame_usage"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_MEDIA_STREAM_COUNTER | ||||
| 	if (strcmp(extensions[i]->name, __DRI_MEDIA_STREAM_COUNTER) == 0) { | ||||
| 	    psc->msc = (__DRImediaStreamCounterExtension *) extensions[i]; | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_SGI_video_sync"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_SWAP_BUFFER_COUNTER | ||||
| 	/* No driver supports this at this time and the extension is | ||||
| 	 * not defined in dri_interface.h.  Will enable | ||||
| 	 * GLX_OML_sync_control if implemented. */ | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_READ_DRAWABLE | ||||
| 	if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) { | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_SGI_make_current_read"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| #ifdef __DRI_TEX_BUFFER | ||||
| 	if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) { | ||||
| 	    psc->texBuffer = (__DRItexBufferExtension *) extensions[i]; | ||||
| 	    __glXEnableDirectExtension(psc, "GLX_EXT_texture_from_pixmap"); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| 	/* Ignore unknown extensions */ | ||||
|     } | ||||
| } | ||||
|  | ||||
| #endif /* GLX_DIRECT_RENDERING */ | ||||
							
								
								
									
										60
									
								
								src/glx/x11/dri_common.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								src/glx/x11/dri_common.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | ||||
| /* | ||||
|  * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. | ||||
|  * Copyright © 2008 Red Hat, Inc. | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Soft- | ||||
|  * ware"), to deal in the Software without restriction, including without | ||||
|  * limitation the rights to use, copy, modify, merge, publish, distribute, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, provided that the above copyright | ||||
|  * notice(s) and this permission notice appear in all copies of the Soft- | ||||
|  * ware and that both the above copyright notice(s) and this permission | ||||
|  * notice appear in supporting documentation. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||
|  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- | ||||
|  * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY | ||||
|  * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN | ||||
|  * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- | ||||
|  * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | ||||
|  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | ||||
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- | ||||
|  * MANCE OF THIS SOFTWARE. | ||||
|  * | ||||
|  * Except as contained in this notice, the name of a copyright holder shall | ||||
|  * not be used in advertising or otherwise to promote the sale, use or | ||||
|  * other dealings in this Software without prior written authorization of | ||||
|  * the copyright holder. | ||||
|  * | ||||
|  * Authors: | ||||
|  *   Kevin E. Martin <kevin@precisioninsight.com> | ||||
|  *   Brian Paul <brian@precisioninsight.com> | ||||
|  *   Kristian Høgsberg (krh@redhat.com) | ||||
|  */ | ||||
|  | ||||
| #ifndef _DRI_COMMON_H | ||||
| #define _DRI_COMMON_H | ||||
|  | ||||
| typedef struct __GLXDRIconfigPrivateRec  __GLXDRIconfigPrivate; | ||||
|  | ||||
| struct __GLXDRIconfigPrivateRec { | ||||
|     __GLcontextModes modes; | ||||
|     const __DRIconfig *driConfig; | ||||
| }; | ||||
|  | ||||
| extern __GLcontextModes * | ||||
| driConvertConfigs(const __DRIcoreExtension *core, | ||||
| 		  __GLcontextModes *modes, const __DRIconfig **configs); | ||||
|  | ||||
| extern const __DRIsystemTimeExtension systemTimeExtension; | ||||
|  | ||||
| extern void InfoMessageF(const char *f, ...); | ||||
|  | ||||
| extern void ErrorMessageF(const char *f, ...); | ||||
|  | ||||
| extern void *driOpenDriver(const char *driverName); | ||||
|  | ||||
| extern void driBindExtensions(__GLXscreenConfigs *psc); | ||||
|  | ||||
| #endif /* _DRI_COMMON_H */ | ||||
| @@ -34,7 +34,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||
|  | ||||
| #ifdef GLX_DIRECT_RENDERING | ||||
|  | ||||
| #include <unistd.h> | ||||
| #include <X11/Xlib.h> | ||||
| #include <X11/extensions/Xfixes.h> | ||||
| #include <X11/extensions/Xdamage.h> | ||||
| @@ -47,17 +46,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||
| #include <sys/types.h> | ||||
| #include <sys/mman.h> | ||||
| #include "xf86drm.h" | ||||
|  | ||||
| #ifndef RTLD_NOW | ||||
| #define RTLD_NOW 0 | ||||
| #endif | ||||
| #ifndef RTLD_GLOBAL | ||||
| #define RTLD_GLOBAL 0 | ||||
| #endif | ||||
| #include "dri_common.h" | ||||
|  | ||||
| typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate; | ||||
| typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate; | ||||
| typedef struct __GLXDRIconfigPrivateRec  __GLXDRIconfigPrivate; | ||||
|  | ||||
| struct __GLXDRIdisplayPrivateRec { | ||||
|     __GLXDRIdisplay base; | ||||
| @@ -77,128 +69,12 @@ struct __GLXDRIcontextPrivateRec { | ||||
|     __GLXscreenConfigs *psc; | ||||
| }; | ||||
|  | ||||
| struct __GLXDRIconfigPrivateRec { | ||||
|     __GLcontextModes modes; | ||||
|     const __DRIconfig *driConfig; | ||||
| }; | ||||
|  | ||||
| #ifndef DEFAULT_DRIVER_DIR | ||||
| /* this is normally defined in Mesa/configs/default with DRI_DRIVER_SEARCH_PATH */ | ||||
| #define DEFAULT_DRIVER_DIR "/usr/local/lib/dri" | ||||
| #endif | ||||
|  | ||||
| static void InfoMessageF(const char *f, ...) | ||||
| { | ||||
|     va_list args; | ||||
|     const char *env; | ||||
|  | ||||
|     if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) { | ||||
| 	fprintf(stderr, "libGL: "); | ||||
| 	va_start(args, f); | ||||
| 	vfprintf(stderr, f, args); | ||||
| 	va_end(args); | ||||
|     } | ||||
| } | ||||
|  | ||||
| extern void ErrorMessageF(const char *f, ...); | ||||
|  | ||||
| /** | ||||
|  * Print error to stderr, unless LIBGL_DEBUG=="quiet". | ||||
|  */ | ||||
| _X_HIDDEN void ErrorMessageF(const char *f, ...) | ||||
| { | ||||
|     va_list args; | ||||
|     const char *env; | ||||
|  | ||||
|     if ((env = getenv("LIBGL_DEBUG")) && !strstr(env, "quiet")) { | ||||
| 	fprintf(stderr, "libGL error: "); | ||||
| 	va_start(args, f); | ||||
| 	vfprintf(stderr, f, args); | ||||
| 	va_end(args); | ||||
|     } | ||||
| } | ||||
|  | ||||
| extern void *driOpenDriver(const char *driverName); | ||||
|  | ||||
| /** | ||||
|  * Try to \c dlopen the named driver. | ||||
|  * | ||||
|  * This function adds the "_dri.so" suffix to the driver name and searches the | ||||
|  * directories specified by the \c LIBGL_DRIVERS_PATH environment variable in | ||||
|  * order to find the driver. | ||||
|  * | ||||
|  * \param driverName - a name like "tdfx", "i810", "mga", etc. | ||||
|  * | ||||
|  * \returns | ||||
|  * A handle from \c dlopen, or \c NULL if driver file not found. | ||||
|  */ | ||||
| _X_HIDDEN void *driOpenDriver(const char *driverName) | ||||
| { | ||||
|    void *glhandle, *handle; | ||||
|    const char *libPaths, *p, *next; | ||||
|    char realDriverName[200]; | ||||
|    int len; | ||||
|  | ||||
|    /* Attempt to make sure libGL symbols will be visible to the driver */ | ||||
|    glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL); | ||||
|  | ||||
|    libPaths = NULL; | ||||
|    if (geteuid() == getuid()) { | ||||
|       /* don't allow setuid apps to use LIBGL_DRIVERS_PATH */ | ||||
|       libPaths = getenv("LIBGL_DRIVERS_PATH"); | ||||
|       if (!libPaths) | ||||
|          libPaths = getenv("LIBGL_DRIVERS_DIR"); /* deprecated */ | ||||
|    } | ||||
|    if (libPaths == NULL) | ||||
|        libPaths = DEFAULT_DRIVER_DIR; | ||||
|  | ||||
|    handle = NULL; | ||||
|    for (p = libPaths; *p; p = next) { | ||||
|        next = strchr(p, ':'); | ||||
|        if (next == NULL) { | ||||
| 	   len = strlen(p); | ||||
| 	   next = p + len; | ||||
|        } else { | ||||
| 	   len = next - p; | ||||
| 	   next++; | ||||
|        } | ||||
|  | ||||
| #ifdef GLX_USE_TLS | ||||
|       snprintf(realDriverName, sizeof realDriverName, | ||||
| 	       "%.*s/tls/%s_dri.so", len, p, driverName); | ||||
|       InfoMessageF("OpenDriver: trying %s\n", realDriverName); | ||||
|       handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL); | ||||
| #endif | ||||
|  | ||||
|       if ( handle == NULL ) { | ||||
| 	 snprintf(realDriverName, sizeof realDriverName, | ||||
| 		  "%.*s/%s_dri.so", len, p, driverName); | ||||
| 	 InfoMessageF("OpenDriver: trying %s\n", realDriverName); | ||||
| 	 handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL); | ||||
|       } | ||||
|  | ||||
|       if ( handle != NULL ) | ||||
| 	  break; | ||||
|       else | ||||
| 	 ErrorMessageF("dlopen %s failed (%s)\n", realDriverName, dlerror()); | ||||
|    } | ||||
|  | ||||
|    if (!handle) | ||||
|       ErrorMessageF("unable to load driver: %s_dri.so\n", driverName); | ||||
|  | ||||
|    if (glhandle) | ||||
|       dlclose(glhandle); | ||||
|  | ||||
|    return handle; | ||||
| } | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Given a display pointer and screen number, determine the name of | ||||
|  * the DRI driver for the screen. (I.e. "r128", "tdfx", etc). | ||||
|  * Return True for success, False for failure. | ||||
|  */ | ||||
| static Bool GetDriverName(Display *dpy, int scrNum, char **driverName) | ||||
| static Bool driGetDriverName(Display *dpy, int scrNum, char **driverName) | ||||
| { | ||||
|    int directCapable; | ||||
|    Bool b; | ||||
| @@ -228,25 +104,6 @@ static Bool GetDriverName(Display *dpy, int scrNum, char **driverName) | ||||
|    return True; | ||||
| } | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Given a display pointer and screen number, return a __DRIdriver handle. | ||||
|  * Return NULL if anything goes wrong. | ||||
|  */ | ||||
| static void *driGetDriver(Display *dpy, int scrNum) | ||||
| { | ||||
|    char *driverName; | ||||
|    void *ret; | ||||
|  | ||||
|    if (GetDriverName(dpy, scrNum, &driverName)) { | ||||
|       ret = driOpenDriver(driverName); | ||||
|       if (driverName) | ||||
|      	 Xfree(driverName); | ||||
|       return ret; | ||||
|    } | ||||
|    return NULL; | ||||
| } | ||||
|  | ||||
| /* | ||||
|  * Exported function for querying the DRI driver for a given screen. | ||||
|  * | ||||
| @@ -256,7 +113,7 @@ static void *driGetDriver(Display *dpy, int scrNum) | ||||
| PUBLIC const char *glXGetScreenDriver (Display *dpy, int scrNum) { | ||||
|    static char ret[32]; | ||||
|    char *driverName; | ||||
|    if (GetDriverName(dpy, scrNum, &driverName)) { | ||||
|    if (driGetDriverName(dpy, scrNum, &driverName)) { | ||||
|       int len; | ||||
|       if (!driverName) | ||||
| 	 return NULL; | ||||
| @@ -270,7 +127,6 @@ PUBLIC const char *glXGetScreenDriver (Display *dpy, int scrNum) { | ||||
|    return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Exported function for obtaining a driver's option list (UTF-8 encoded XML). | ||||
|  * | ||||
| @@ -291,63 +147,6 @@ PUBLIC const char *glXGetDriverConfig (const char *driverName) | ||||
|       return NULL; | ||||
| } | ||||
|  | ||||
| extern void | ||||
| driFilterModes(__GLcontextModes ** server_modes, | ||||
| 	       const __GLcontextModes * driver_modes); | ||||
|  | ||||
| _X_HIDDEN void | ||||
| driFilterModes(__GLcontextModes ** server_modes, | ||||
| 	       const __GLcontextModes * driver_modes) | ||||
| { | ||||
|     __GLcontextModes * m; | ||||
|     __GLcontextModes ** prev_next; | ||||
|     const __GLcontextModes * check; | ||||
|  | ||||
|     if (driver_modes == NULL) { | ||||
| 	fprintf(stderr, "libGL warning: 3D driver returned no fbconfigs.\n"); | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     /* For each mode in server_modes, check to see if a matching mode exists | ||||
|      * in driver_modes.  If not, then the mode is not available. | ||||
|      */ | ||||
|  | ||||
|     prev_next = server_modes; | ||||
|     for ( m = *prev_next ; m != NULL ; m = *prev_next ) { | ||||
| 	GLboolean do_delete = GL_TRUE; | ||||
|  | ||||
| 	for ( check = driver_modes ; check != NULL ; check = check->next ) { | ||||
| 	    if ( _gl_context_modes_are_same( m, check ) ) { | ||||
| 		do_delete = GL_FALSE; | ||||
| 		break; | ||||
| 	    } | ||||
| 	} | ||||
|  | ||||
| 	/* The 3D has to support all the modes that match the GLX visuals | ||||
| 	 * sent from the X server. | ||||
| 	 */ | ||||
| 	if ( do_delete && (m->visualID != 0) ) { | ||||
| 	    do_delete = GL_FALSE; | ||||
|  | ||||
| 	    /* don't warn for this visual (Novell #247471 / X.Org #6689) */ | ||||
| 	    if (m->visualRating != GLX_NON_CONFORMANT_CONFIG) { | ||||
| 		fprintf(stderr, "libGL warning: 3D driver claims to not " | ||||
| 			"support visual 0x%02x\n", m->visualID); | ||||
| 	    } | ||||
| 	} | ||||
|  | ||||
| 	if ( do_delete ) { | ||||
| 	    *prev_next = m->next; | ||||
|  | ||||
| 	    m->next = NULL; | ||||
| 	    _gl_context_modes_destroy( m ); | ||||
| 	} | ||||
| 	else { | ||||
| 	    prev_next = & m->next; | ||||
| 	} | ||||
|     } | ||||
| } | ||||
|  | ||||
| #ifdef XDAMAGE_1_1_INTERFACE | ||||
|  | ||||
| static GLboolean has_damage_post(Display *dpy) | ||||
| @@ -442,12 +241,6 @@ __glXDRIGetDrawableInfo(__DRIdrawable *drawable, | ||||
| 				  numBackClipRects, pBackClipRects); | ||||
| } | ||||
|  | ||||
| _X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension = { | ||||
|     { __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION }, | ||||
|     __glXGetUST, | ||||
|     __driGetMscRateOML, | ||||
| }; | ||||
|  | ||||
| static const __DRIgetDrawableInfoExtension getDrawableInfoExtension = { | ||||
|     { __DRI_GET_DRAWABLE_INFO, __DRI_GET_DRAWABLE_INFO_VERSION }, | ||||
|     __glXDRIGetDrawableInfo | ||||
| @@ -456,184 +249,13 @@ static const __DRIgetDrawableInfoExtension getDrawableInfoExtension = { | ||||
| static const __DRIextension *loader_extensions[] = { | ||||
|     &systemTimeExtension.base, | ||||
|     &getDrawableInfoExtension.base, | ||||
|  | ||||
| #ifdef XDAMAGE_1_1_INTERFACE | ||||
|     &damageExtension.base, | ||||
| #endif | ||||
|  | ||||
|     NULL | ||||
| }; | ||||
|  | ||||
| #define __ATTRIB(attrib, field) \ | ||||
|     { attrib, offsetof(__GLcontextModes, field) } | ||||
|  | ||||
| static const struct { unsigned int attrib, offset; } attribMap[] = { | ||||
|     __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE,			rgbBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_LEVEL,			level), | ||||
|     __ATTRIB(__DRI_ATTRIB_RED_SIZE,			redBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_GREEN_SIZE,			greenBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_BLUE_SIZE,			blueBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE,			alphaBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE,			depthBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE,			stencilBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE,		accumRedBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE,		accumGreenBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE,		accumBlueBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE,		accumAlphaBits), | ||||
|     __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS,		sampleBuffers), | ||||
|     __ATTRIB(__DRI_ATTRIB_SAMPLES,			samples), | ||||
|     __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER,		doubleBufferMode), | ||||
|     __ATTRIB(__DRI_ATTRIB_STEREO,			stereoMode), | ||||
|     __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS,			numAuxBuffers), | ||||
| #if 0 | ||||
|     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE,		transparentPixel), | ||||
|     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE,	transparentIndex), | ||||
|     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE,	transparentRed), | ||||
|     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE,	transparentGreen), | ||||
|     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE,	transparentBlue), | ||||
|     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE,	transparentAlpha), | ||||
|     __ATTRIB(__DRI_ATTRIB_RED_MASK,			redMask), | ||||
|     __ATTRIB(__DRI_ATTRIB_GREEN_MASK,			greenMask), | ||||
|     __ATTRIB(__DRI_ATTRIB_BLUE_MASK,			blueMask), | ||||
|     __ATTRIB(__DRI_ATTRIB_ALPHA_MASK,			alphaMask), | ||||
| #endif | ||||
|     __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH,		maxPbufferWidth), | ||||
|     __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT,		maxPbufferHeight), | ||||
|     __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS,		maxPbufferPixels), | ||||
|     __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH,	optimalPbufferWidth), | ||||
|     __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT,	optimalPbufferHeight), | ||||
| #if 0 | ||||
|     __ATTRIB(__DRI_ATTRIB_SWAP_METHOD,			swapMethod), | ||||
| #endif | ||||
|     __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB,		bindToTextureRgb), | ||||
|     __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA,		bindToTextureRgba), | ||||
|     __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE,	bindToMipmapTexture), | ||||
|     __ATTRIB(__DRI_ATTRIB_YINVERTED,			yInverted), | ||||
| }; | ||||
|  | ||||
| #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) | ||||
|  | ||||
| static int | ||||
| scalarEqual(__GLcontextModes *mode, unsigned int attrib, unsigned int value) | ||||
| { | ||||
|     unsigned int glxValue; | ||||
|     int i; | ||||
|  | ||||
|     for (i = 0; i < ARRAY_SIZE(attribMap); i++) | ||||
| 	if (attribMap[i].attrib == attrib) { | ||||
| 	    glxValue = *(unsigned int *) ((char *) mode + attribMap[i].offset); | ||||
| 	    return glxValue == GLX_DONT_CARE || glxValue == value; | ||||
| 	} | ||||
|  | ||||
|     return GL_TRUE; /* Is a non-existing attribute equal to value? */ | ||||
| } | ||||
|  | ||||
| static int | ||||
| driConfigEqual(const __DRIcoreExtension *core, | ||||
| 	       __GLcontextModes *modes, const __DRIconfig *driConfig) | ||||
| { | ||||
|     unsigned int attrib, value, glxValue; | ||||
|     int i; | ||||
|  | ||||
|     i = 0; | ||||
|     while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) { | ||||
| 	switch (attrib) { | ||||
| 	case __DRI_ATTRIB_RENDER_TYPE: | ||||
| 	    glxValue = 0; | ||||
| 	    if (value & __DRI_ATTRIB_RGBA_BIT) { | ||||
| 		glxValue |= GLX_RGBA_BIT; | ||||
| 	    } else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) { | ||||
| 		glxValue |= GLX_COLOR_INDEX_BIT; | ||||
| 	    } | ||||
| 	    if (glxValue != modes->renderType) | ||||
| 		return GL_FALSE; | ||||
| 	    break; | ||||
|  | ||||
| 	case __DRI_ATTRIB_CONFIG_CAVEAT: | ||||
| 	    if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG) | ||||
| 		glxValue = GLX_NON_CONFORMANT_CONFIG; | ||||
| 	    else if (value & __DRI_ATTRIB_SLOW_BIT) | ||||
| 		glxValue = GLX_SLOW_CONFIG; | ||||
| 	    else | ||||
| 		glxValue = GLX_NONE; | ||||
| 	    if (glxValue != modes->visualRating) | ||||
| 		return GL_FALSE; | ||||
| 	    break; | ||||
|  | ||||
| 	case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS: | ||||
| 	    glxValue = 0; | ||||
| 	    if (value & __DRI_ATTRIB_TEXTURE_1D_BIT) | ||||
| 		glxValue |= GLX_TEXTURE_1D_BIT_EXT; | ||||
| 	    if (value & __DRI_ATTRIB_TEXTURE_2D_BIT) | ||||
| 		glxValue |= GLX_TEXTURE_2D_BIT_EXT; | ||||
| 	    if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT) | ||||
| 		glxValue |= GLX_TEXTURE_RECTANGLE_BIT_EXT; | ||||
| 	    if (modes->bindToTextureTargets != GLX_DONT_CARE && | ||||
| 		glxValue != modes->bindToTextureTargets) | ||||
| 		return GL_FALSE; | ||||
| 	    break;	 | ||||
|  | ||||
| 	default: | ||||
| 	    if (!scalarEqual(modes, attrib, value)) | ||||
| 		return GL_FALSE; | ||||
| 	} | ||||
|     } | ||||
|  | ||||
|     return GL_TRUE; | ||||
| } | ||||
|  | ||||
| static __GLcontextModes * | ||||
| createDriMode(const __DRIcoreExtension *core, | ||||
| 	      __GLcontextModes *modes, const __DRIconfig **driConfigs) | ||||
| { | ||||
|     __GLXDRIconfigPrivate *config; | ||||
|     int i; | ||||
|  | ||||
|     for (i = 0; driConfigs[i]; i++) { | ||||
| 	if (driConfigEqual(core, modes, driConfigs[i])) | ||||
| 	    break; | ||||
|     } | ||||
|  | ||||
|     if (driConfigs[i] == NULL) | ||||
| 	return NULL; | ||||
|  | ||||
|     config = Xmalloc(sizeof *config); | ||||
|     if (config == NULL) | ||||
| 	return NULL; | ||||
|  | ||||
|     config->modes = *modes; | ||||
|     config->driConfig = driConfigs[i]; | ||||
|  | ||||
|     return &config->modes; | ||||
| } | ||||
|  | ||||
| extern __GLcontextModes * | ||||
| driConvertConfigs(const __DRIcoreExtension *core, | ||||
| 		  __GLcontextModes *modes, const __DRIconfig **configs); | ||||
|  | ||||
| _X_HIDDEN __GLcontextModes * | ||||
| driConvertConfigs(const __DRIcoreExtension *core, | ||||
| 		  __GLcontextModes *modes, const __DRIconfig **configs) | ||||
| { | ||||
|     __GLcontextModes head, *tail, *m; | ||||
|  | ||||
|     tail = &head; | ||||
|     head.next = NULL; | ||||
|     for (m = modes; m; m = m->next) { | ||||
| 	tail->next = createDriMode(core, m, configs); | ||||
| 	if (tail->next == NULL) { | ||||
| 	    /* no matching dri config for m */ | ||||
| 	    continue; | ||||
| 	} | ||||
|  | ||||
|  | ||||
| 	tail = tail->next; | ||||
|     } | ||||
|  | ||||
|     _gl_context_modes_destroy(modes); | ||||
|  | ||||
|     return head.next; | ||||
| } | ||||
| #ifndef GLX_USE_APPLEGL | ||||
|  | ||||
| /** | ||||
|  * Perform the required libGL-side initialization and call the client-side | ||||
| @@ -647,17 +269,12 @@ driConvertConfigs(const __DRIcoreExtension *core, | ||||
|  *               \c __driCreateNewScreen function. | ||||
|  * \returns A pointer to the \c __DRIscreenPrivate structure returned by | ||||
|  *          the client-side driver on success, or \c NULL on failure. | ||||
|  *  | ||||
|  * \todo This function needs to be modified to remove context-modes from the | ||||
|  *       list stored in the \c __GLXscreenConfigsRec to match the list | ||||
|  *       returned by the client-side driver. | ||||
|  */ | ||||
| static void * | ||||
| CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, | ||||
| 		    __GLXDRIdisplayPrivate * driDpy) | ||||
| { | ||||
|     void *psp = NULL; | ||||
| #ifndef GLX_USE_APPLEGL | ||||
|     drm_handle_t hSAREA; | ||||
|     drmAddress pSAREA = MAP_FAILED; | ||||
|     char *BusID; | ||||
| @@ -667,175 +284,159 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, | ||||
|     __DRIframebuffer  framebuffer; | ||||
|     int   fd = -1; | ||||
|     int   status; | ||||
|     const char * err_msg; | ||||
|     const char * err_extra; | ||||
|  | ||||
|     drm_magic_t magic; | ||||
|     drmVersionPtr version; | ||||
|     int newlyopened; | ||||
|     char *driverName; | ||||
|     drm_handle_t  hFB; | ||||
|     int        junk; | ||||
|     const __DRIconfig **driver_configs; | ||||
|  | ||||
|     /* DRI protocol version. */ | ||||
|     dri_version.major = driDpy->driMajor; | ||||
|     dri_version.minor = driDpy->driMinor; | ||||
|     dri_version.patch = driDpy->driPatch; | ||||
|  | ||||
|     err_msg = "XF86DRIOpenConnection"; | ||||
|     err_extra = NULL; | ||||
|  | ||||
|     framebuffer.base = MAP_FAILED; | ||||
|     framebuffer.dev_priv = NULL; | ||||
|  | ||||
|     if (XF86DRIOpenConnection(dpy, scrn, &hSAREA, &BusID)) { | ||||
|         int newlyopened; | ||||
| 	fd = drmOpenOnce(NULL,BusID, &newlyopened); | ||||
| 	Xfree(BusID); /* No longer needed */ | ||||
|  | ||||
| 	err_msg = "open DRM"; | ||||
| 	err_extra = strerror( -fd ); | ||||
|  | ||||
| 	if (fd >= 0) { | ||||
| 	    drm_magic_t magic; | ||||
|  | ||||
| 	    err_msg = "drmGetMagic"; | ||||
| 	    err_extra = NULL; | ||||
|  | ||||
| 	    if (!drmGetMagic(fd, &magic)) { | ||||
| 		drmVersionPtr version = drmGetVersion(fd); | ||||
| 		if (version) { | ||||
| 		    drm_version.major = version->version_major; | ||||
| 		    drm_version.minor = version->version_minor; | ||||
| 		    drm_version.patch = version->version_patchlevel; | ||||
| 		    drmFreeVersion(version); | ||||
| 		} | ||||
| 		else { | ||||
| 		    drm_version.major = -1; | ||||
| 		    drm_version.minor = -1; | ||||
| 		    drm_version.patch = -1; | ||||
| 		} | ||||
|  | ||||
| 		err_msg = "XF86DRIAuthConnection"; | ||||
| 		if (!newlyopened || XF86DRIAuthConnection(dpy, scrn, magic)) { | ||||
| 		    char *driverName; | ||||
|  | ||||
| 		    /* | ||||
| 		     * Get device name (like "tdfx") and the ddx version | ||||
| 		     * numbers.  We'll check the version in each DRI driver's | ||||
| 		     * "createNewScreen" function. | ||||
| 		     */ | ||||
| 		    err_msg = "XF86DRIGetClientDriverName"; | ||||
| 		    if (XF86DRIGetClientDriverName(dpy, scrn, | ||||
| 						   &ddx_version.major, | ||||
| 						   &ddx_version.minor, | ||||
| 						   &ddx_version.patch, | ||||
| 						   &driverName)) { | ||||
| 			drm_handle_t  hFB; | ||||
| 			int        junk; | ||||
|  | ||||
| 			/* No longer needed. */ | ||||
| 			Xfree( driverName ); | ||||
|  | ||||
|  | ||||
| 			/* | ||||
| 			 * Get device-specific info.  pDevPriv will point to a struct | ||||
| 			 * (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) | ||||
| 			 * that has information about the screen size, depth, pitch, | ||||
| 			 * ancilliary buffers, DRM mmap handles, etc. | ||||
| 			 */ | ||||
| 			err_msg = "XF86DRIGetDeviceInfo"; | ||||
| 			if (XF86DRIGetDeviceInfo(dpy, scrn, | ||||
| 						 &hFB, | ||||
| 						 &junk, | ||||
| 						 &framebuffer.size, | ||||
| 						 &framebuffer.stride, | ||||
| 						 &framebuffer.dev_priv_size, | ||||
| 						 &framebuffer.dev_priv)) { | ||||
| 			    framebuffer.width = DisplayWidth(dpy, scrn); | ||||
| 			    framebuffer.height = DisplayHeight(dpy, scrn); | ||||
|  | ||||
| 			    /* | ||||
| 			     * Map the framebuffer region. | ||||
| 			     */ | ||||
| 			    status = drmMap(fd, hFB, framebuffer.size,  | ||||
| 					    (drmAddressPtr)&framebuffer.base); | ||||
|  | ||||
| 			    err_msg = "drmMap of framebuffer"; | ||||
| 			    err_extra = strerror( -status ); | ||||
|  | ||||
| 			    if ( status == 0 ) { | ||||
| 				/* | ||||
| 				 * Map the SAREA region.  Further mmap regions | ||||
| 				 * may be setup in each DRI driver's | ||||
| 				 * "createNewScreen" function. | ||||
| 				 */ | ||||
| 				status = drmMap(fd, hSAREA, SAREA_MAX,  | ||||
| 						&pSAREA); | ||||
|  | ||||
| 				err_msg = "drmMap of sarea"; | ||||
| 				err_extra = strerror( -status ); | ||||
|  | ||||
| 				if ( status == 0 ) { | ||||
| 				    err_msg = "InitDriver"; | ||||
| 				    err_extra = NULL; | ||||
| 				    psp = (*psc->legacy->createNewScreen)(scrn, | ||||
| 							     & ddx_version, | ||||
| 							     & dri_version, | ||||
| 							     & drm_version, | ||||
| 							     & framebuffer, | ||||
| 							     pSAREA, | ||||
| 							     fd, | ||||
| 							     loader_extensions, | ||||
| 							     & driver_configs, | ||||
| 							     psc); | ||||
|  | ||||
| 				    if (psp) { | ||||
| 					psc->configs = | ||||
| 					    driConvertConfigs(psc->core, | ||||
| 							      psc->configs, | ||||
| 							      driver_configs); | ||||
| 					psc->visuals = | ||||
| 					    driConvertConfigs(psc->core, | ||||
| 							      psc->visuals, | ||||
| 							      driver_configs); | ||||
| 				    } | ||||
| 				} | ||||
| 			    } | ||||
| 			} | ||||
| 		    } | ||||
| 		} | ||||
| 	    } | ||||
| 	} | ||||
|     if (!XF86DRIOpenConnection(dpy, scrn, &hSAREA, &BusID)) { | ||||
| 	ErrorMessageF("XF86DRIOpenConnection failed\n"); | ||||
| 	goto handle_error; | ||||
|     } | ||||
|  | ||||
|     if ( psp == NULL ) { | ||||
| 	if ( pSAREA != MAP_FAILED ) { | ||||
| 	    (void)drmUnmap(pSAREA, SAREA_MAX); | ||||
| 	} | ||||
|     fd = drmOpenOnce(NULL, BusID, &newlyopened); | ||||
|  | ||||
| 	if ( framebuffer.base != MAP_FAILED ) { | ||||
| 	    (void)drmUnmap((drmAddress)framebuffer.base, framebuffer.size); | ||||
| 	} | ||||
|     Xfree(BusID); /* No longer needed */ | ||||
|  | ||||
| 	if ( framebuffer.dev_priv != NULL ) { | ||||
| 	    Xfree(framebuffer.dev_priv); | ||||
| 	} | ||||
|  | ||||
| 	if ( fd >= 0 ) { | ||||
| 	    (void)drmCloseOnce(fd); | ||||
| 	} | ||||
|  | ||||
| 	(void)XF86DRICloseConnection(dpy, scrn); | ||||
|  | ||||
| 	if ( err_extra != NULL ) { | ||||
| 	    fprintf(stderr, "libGL error: %s failed (%s)\n", err_msg, | ||||
| 		    err_extra); | ||||
| 	} | ||||
| 	else { | ||||
| 	    fprintf(stderr, "libGL error: %s failed\n", err_msg ); | ||||
| 	} | ||||
|  | ||||
|         fprintf(stderr, "libGL error: reverting to (slow) indirect rendering\n"); | ||||
|     if (fd < 0) { | ||||
| 	ErrorMessageF("drmOpenOnce failed (%s)\n", strerror(-fd)); | ||||
| 	goto handle_error; | ||||
|     } | ||||
| #endif /* !GLX_USE_APPLEGL */ | ||||
|  | ||||
|     if (drmGetMagic(fd, &magic)) { | ||||
| 	ErrorMessageF("drmGetMagic failed\n"); | ||||
| 	goto handle_error; | ||||
|     } | ||||
|  | ||||
|     version = drmGetVersion(fd); | ||||
|     if (version) { | ||||
| 	drm_version.major = version->version_major; | ||||
| 	drm_version.minor = version->version_minor; | ||||
| 	drm_version.patch = version->version_patchlevel; | ||||
| 	drmFreeVersion(version); | ||||
|     } | ||||
|     else { | ||||
| 	drm_version.major = -1; | ||||
| 	drm_version.minor = -1; | ||||
| 	drm_version.patch = -1; | ||||
|     } | ||||
|  | ||||
|     if (newlyopened && !XF86DRIAuthConnection(dpy, scrn, magic)) { | ||||
| 	ErrorMessageF("XF86DRIAuthConnection failed\n"); | ||||
| 	goto handle_error; | ||||
|     } | ||||
|  | ||||
|     /* Get device name (like "tdfx") and the ddx version numbers. | ||||
|      * We'll check the version in each DRI driver's "createNewScreen" | ||||
|      * function. */ | ||||
|     if (!XF86DRIGetClientDriverName(dpy, scrn, | ||||
| 				    &ddx_version.major, | ||||
| 				    &ddx_version.minor, | ||||
| 				    &ddx_version.patch, | ||||
| 				    &driverName)) { | ||||
| 	ErrorMessageF("XF86DRIGetClientDriverName failed\n"); | ||||
| 	goto handle_error; | ||||
|     } | ||||
|  | ||||
|     Xfree(driverName); /* No longer needed. */ | ||||
|  | ||||
|     /* | ||||
|      * Get device-specific info.  pDevPriv will point to a struct | ||||
|      * (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) that | ||||
|      * has information about the screen size, depth, pitch, ancilliary | ||||
|      * buffers, DRM mmap handles, etc. | ||||
|      */ | ||||
|     if (!XF86DRIGetDeviceInfo(dpy, scrn, &hFB, &junk, | ||||
| 			      &framebuffer.size, &framebuffer.stride, | ||||
| 			      &framebuffer.dev_priv_size, &framebuffer.dev_priv)) { | ||||
| 	ErrorMessageF("XF86DRIGetDeviceInfo failed"); | ||||
| 	goto handle_error; | ||||
|     } | ||||
|  | ||||
|     framebuffer.width = DisplayWidth(dpy, scrn); | ||||
|     framebuffer.height = DisplayHeight(dpy, scrn); | ||||
|  | ||||
|     /* Map the framebuffer region. */ | ||||
|     status = drmMap(fd, hFB, framebuffer.size,  | ||||
| 		    (drmAddressPtr)&framebuffer.base); | ||||
|     if (status != 0) { | ||||
| 	ErrorMessageF("drmMap of framebuffer failed (%s)", strerror(-status)); | ||||
| 	goto handle_error; | ||||
|     } | ||||
|  | ||||
|     /* Map the SAREA region.  Further mmap regions may be setup in | ||||
|      * each DRI driver's "createNewScreen" function. | ||||
|      */ | ||||
|     status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA); | ||||
|     if (status != 0) { | ||||
| 	ErrorMessageF("drmMap of SAREA failed (%s)", strerror(-status)); | ||||
| 	goto handle_error; | ||||
|     } | ||||
|  | ||||
|     psp = (*psc->legacy->createNewScreen)(scrn, | ||||
| 					  &ddx_version, | ||||
| 					  &dri_version, | ||||
| 					  &drm_version, | ||||
| 					  &framebuffer, | ||||
| 					  pSAREA, | ||||
| 					  fd, | ||||
| 					  loader_extensions, | ||||
| 					  &driver_configs, | ||||
| 					  psc); | ||||
|  | ||||
|     if (psp == NULL) { | ||||
| 	ErrorMessageF("Calling driver entry point failed"); | ||||
| 	goto handle_error; | ||||
|     } | ||||
|  | ||||
|     psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs); | ||||
|     psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs); | ||||
|  | ||||
|     return psp; | ||||
|  | ||||
|  handle_error: | ||||
|     if (pSAREA != MAP_FAILED) | ||||
| 	drmUnmap(pSAREA, SAREA_MAX); | ||||
|  | ||||
|     if (framebuffer.base != MAP_FAILED) | ||||
| 	drmUnmap((drmAddress)framebuffer.base, framebuffer.size); | ||||
|  | ||||
|     if (framebuffer.dev_priv != NULL) | ||||
| 	Xfree(framebuffer.dev_priv); | ||||
|  | ||||
|     if (fd >= 0) | ||||
| 	drmCloseOnce(fd); | ||||
|  | ||||
|     XF86DRICloseConnection(dpy, scrn); | ||||
|  | ||||
|     ErrorMessageF("reverting to software direct rendering\n"); | ||||
|  | ||||
|     return NULL; | ||||
| } | ||||
|  | ||||
| #else /* !GLX_USE_APPLEGL */ | ||||
|  | ||||
| static void * | ||||
| CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, | ||||
| 		    __GLXDRIdisplayPrivate * driDpy) | ||||
| { | ||||
|     return NULL; | ||||
| } | ||||
|  | ||||
| #endif /* !GLX_USE_APPLEGL */ | ||||
|  | ||||
| static void driDestroyContext(__GLXDRIcontext *context, | ||||
| 			      __GLXscreenConfigs *psc, Display *dpy) | ||||
| { | ||||
| @@ -875,45 +476,44 @@ static __GLXDRIcontext *driCreateContext(__GLXscreenConfigs *psc, | ||||
|     __DRIcontext *shared = NULL; | ||||
|     __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode; | ||||
|  | ||||
|     if (psc && psc->driScreen) { | ||||
| 	if (shareList) { | ||||
| 	    pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext; | ||||
| 	    shared = pcp_shared->driContext; | ||||
| 	} | ||||
|     if (!psc || !psc->driScreen) | ||||
| 	return NULL; | ||||
|  | ||||
| 	pcp = Xmalloc(sizeof *pcp); | ||||
| 	if (pcp == NULL) | ||||
| 	    return NULL; | ||||
|  | ||||
| 	pcp->psc = psc; | ||||
| 	if (!XF86DRICreateContextWithConfig(psc->dpy, psc->scr, | ||||
| 					    mode->visualID, | ||||
| 					    &pcp->hwContextID, &hwContext)) { | ||||
| 	    Xfree(pcp); | ||||
| 	    return NULL; | ||||
| 	} | ||||
|  | ||||
| 	pcp->driContext =  | ||||
| 	    (*psc->legacy->createNewContext)(psc->__driScreen, | ||||
| 					     config->driConfig, | ||||
| 					     renderType, | ||||
| 					     shared, | ||||
| 					     hwContext, | ||||
| 					     pcp); | ||||
| 	if (pcp->driContext == NULL) { | ||||
| 	    XF86DRIDestroyContext(psc->dpy, psc->scr, pcp->hwContextID); | ||||
| 	    Xfree(pcp); | ||||
| 	    return NULL; | ||||
| 	} | ||||
|  | ||||
| 	pcp->base.destroyContext = driDestroyContext; | ||||
| 	pcp->base.bindContext = driBindContext; | ||||
| 	pcp->base.unbindContext = driUnbindContext; | ||||
|  | ||||
| 	return &pcp->base; | ||||
|     if (shareList) { | ||||
| 	pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext; | ||||
| 	shared = pcp_shared->driContext; | ||||
|     } | ||||
|  | ||||
|     return NULL; | ||||
|     pcp = Xmalloc(sizeof *pcp); | ||||
|     if (pcp == NULL) | ||||
| 	return NULL; | ||||
|  | ||||
|     pcp->psc = psc; | ||||
|     if (!XF86DRICreateContextWithConfig(psc->dpy, psc->scr, | ||||
| 					mode->visualID, | ||||
| 					&pcp->hwContextID, &hwContext)) { | ||||
| 	Xfree(pcp); | ||||
| 	return NULL; | ||||
|     } | ||||
|  | ||||
|     pcp->driContext = | ||||
|         (*psc->legacy->createNewContext)(psc->__driScreen, | ||||
| 					 config->driConfig, | ||||
| 					 renderType, | ||||
| 					 shared, | ||||
| 					 hwContext, | ||||
| 					 pcp); | ||||
|     if (pcp->driContext == NULL) { | ||||
| 	XF86DRIDestroyContext(psc->dpy, psc->scr, pcp->hwContextID); | ||||
| 	Xfree(pcp); | ||||
| 	return NULL; | ||||
|     } | ||||
|  | ||||
|     pcp->base.destroyContext = driDestroyContext; | ||||
|     pcp->base.bindContext = driBindContext; | ||||
|     pcp->base.unbindContext = driUnbindContext; | ||||
|  | ||||
|     return &pcp->base; | ||||
| } | ||||
|  | ||||
| static void driDestroyDrawable(__GLXDRIdrawable *pdraw) | ||||
| @@ -979,15 +579,13 @@ static void driDestroyScreen(__GLXscreenConfigs *psc) | ||||
| 	dlclose(psc->driver); | ||||
| } | ||||
|  | ||||
| void | ||||
| driBindExtensions(__GLXscreenConfigs *psc); | ||||
|  | ||||
| static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen, | ||||
| 				       __GLXdisplayPrivate *priv) | ||||
| { | ||||
|     __GLXDRIdisplayPrivate *pdp; | ||||
|     __GLXDRIscreen *psp; | ||||
|     const __DRIextension **extensions; | ||||
|     char *driverName; | ||||
|     int i; | ||||
|  | ||||
|     psp = Xmalloc(sizeof *psp); | ||||
| @@ -997,7 +595,13 @@ static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen, | ||||
|     /* Initialize per screen dynamic client GLX extensions */ | ||||
|     psc->ext_list_first_time = GL_TRUE; | ||||
|  | ||||
|     psc->driver = driGetDriver(priv->dpy, screen); | ||||
|     if (!driGetDriverName(priv->dpy, screen, &driverName)) { | ||||
| 	Xfree(psp); | ||||
| 	return NULL; | ||||
|     } | ||||
|  | ||||
|     psc->driver = driOpenDriver(driverName); | ||||
|     Xfree(driverName); | ||||
|     if (psc->driver == NULL) { | ||||
| 	Xfree(psp); | ||||
| 	return NULL; | ||||
|   | ||||
							
								
								
									
										441
									
								
								src/glx/x11/drisw_glx.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										441
									
								
								src/glx/x11/drisw_glx.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,441 @@ | ||||
| /* | ||||
|  * Copyright 2008 George Sapountzis | ||||
|  * | ||||
|  * 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 | ||||
|  * THE AUTHORS OR COPYRIGHT HOLDERS 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. | ||||
|  */ | ||||
|  | ||||
| #ifdef GLX_DIRECT_RENDERING | ||||
|  | ||||
| #include <X11/Xlib.h> | ||||
| #include "glheader.h" | ||||
| #include "glxclient.h" | ||||
| #include "glcontextmodes.h" | ||||
| #include <dlfcn.h> | ||||
| #include "dri_common.h" | ||||
|  | ||||
| typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate; | ||||
| typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate; | ||||
| typedef struct __GLXDRIdrawablePrivateRec __GLXDRIdrawablePrivate; | ||||
|  | ||||
| struct __GLXDRIdisplayPrivateRec { | ||||
|     __GLXDRIdisplay base; | ||||
| }; | ||||
|  | ||||
| struct __GLXDRIcontextPrivateRec { | ||||
|     __GLXDRIcontext base; | ||||
|     __DRIcontext *driContext; | ||||
|     __GLXscreenConfigs *psc; | ||||
| }; | ||||
|  | ||||
| struct __GLXDRIdrawablePrivateRec { | ||||
|     __GLXDRIdrawable base; | ||||
|  | ||||
|     GC gc; | ||||
|     GC swapgc; | ||||
|  | ||||
|     XVisualInfo *visinfo; | ||||
|     XImage *ximage; | ||||
|     int bpp; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * swrast loader functions | ||||
|  */ | ||||
|  | ||||
| static Bool XCreateDrawable(__GLXDRIdrawablePrivate *pdp, | ||||
| 			    Display *dpy, XID drawable, int visualid) | ||||
| { | ||||
|     XGCValues gcvalues; | ||||
|     long visMask; | ||||
|     XVisualInfo visTemp; | ||||
|     int num_visuals; | ||||
|  | ||||
|     /* create GC's */ | ||||
|     pdp->gc = XCreateGC(dpy, drawable, 0, NULL); | ||||
|     pdp->swapgc = XCreateGC(dpy, drawable, 0, NULL); | ||||
|  | ||||
|     gcvalues.function = GXcopy; | ||||
|     gcvalues.graphics_exposures = False; | ||||
|     XChangeGC(dpy, pdp->gc, GCFunction, &gcvalues); | ||||
|     XChangeGC(dpy, pdp->swapgc, GCFunction, &gcvalues); | ||||
|     XChangeGC(dpy, pdp->swapgc, GCGraphicsExposures, &gcvalues); | ||||
|  | ||||
|     /* create XImage  */ | ||||
|     visTemp.screen = DefaultScreen(dpy); | ||||
|     visTemp.visualid = visualid; | ||||
|     visMask = (VisualScreenMask | VisualIDMask); | ||||
|     pdp->visinfo = XGetVisualInfo(dpy, visMask, &visTemp, &num_visuals); | ||||
|  | ||||
|     pdp->ximage = XCreateImage(dpy, | ||||
| 			       pdp->visinfo->visual, | ||||
| 			       pdp->visinfo->depth, | ||||
| 			       ZPixmap, 0,   /* format, offset */ | ||||
| 			       NULL,         /* data */ | ||||
| 			       0, 0,         /* size */ | ||||
| 			       32,           /* bitmap_pad */ | ||||
| 			       0);           /* bytes_per_line */ | ||||
|  | ||||
|     /* get the true number of bits per pixel */ | ||||
|     pdp->bpp = pdp->ximage->bits_per_pixel; | ||||
|  | ||||
|     return True; | ||||
| } | ||||
|  | ||||
| static void XDestroyDrawable(__GLXDRIdrawablePrivate *pdp, | ||||
| 			     Display *dpy, XID drawable) | ||||
| { | ||||
|     XDestroyImage(pdp->ximage); | ||||
|     XFree(pdp->visinfo); | ||||
|  | ||||
|     XFreeGC(dpy, pdp->gc); | ||||
|     XFreeGC(dpy, pdp->swapgc); | ||||
| } | ||||
|  | ||||
| static void | ||||
| swrastGetDrawableInfo(__DRIdrawable *draw, | ||||
| 		      int *x, int *y, int *w, int *h, | ||||
| 		      void *loaderPrivate) | ||||
| { | ||||
|     __GLXDRIdrawablePrivate *pdp = loaderPrivate; | ||||
|     __GLXDRIdrawable *pdraw = &(pdp->base);; | ||||
|     Display *dpy = pdraw->psc->dpy; | ||||
|     Drawable drawable; | ||||
|  | ||||
|     Window root; | ||||
|     Status stat; | ||||
|     unsigned int bw, depth; | ||||
|  | ||||
|     drawable = pdraw->xDrawable; | ||||
|  | ||||
|     stat = XGetGeometry(dpy, drawable, &root, | ||||
| 			x, y, (unsigned int *)w, (unsigned int *)h, | ||||
| 			&bw, &depth); | ||||
| } | ||||
|  | ||||
| static inline int | ||||
| bytes_per_line(int w, int bpp, unsigned mul) | ||||
| { | ||||
|     unsigned mask = mul - 1; | ||||
|  | ||||
|     return ((w * bpp + mask) & ~mask) / 8; | ||||
| } | ||||
|  | ||||
| static void | ||||
| swrastPutImage(__DRIdrawable *draw, int op, | ||||
| 	       int x, int y, int w, int h, char *data, | ||||
| 	       void *loaderPrivate) | ||||
| { | ||||
|     __GLXDRIdrawablePrivate *pdp = loaderPrivate; | ||||
|     __GLXDRIdrawable *pdraw = &(pdp->base);; | ||||
|     Display *dpy = pdraw->psc->dpy; | ||||
|     Drawable drawable; | ||||
|     XImage *ximage; | ||||
|     GC gc; | ||||
|  | ||||
|     switch (op) { | ||||
|     case __DRI_SWRAST_IMAGE_OP_DRAW: | ||||
| 	gc = pdp->gc; | ||||
| 	break; | ||||
|     case __DRI_SWRAST_IMAGE_OP_SWAP: | ||||
| 	gc = pdp->swapgc; | ||||
| 	break; | ||||
|     default: | ||||
| 	return; | ||||
|     } | ||||
|  | ||||
|     drawable = pdraw->xDrawable; | ||||
|  | ||||
|     ximage = pdp->ximage; | ||||
|     ximage->data = data; | ||||
|     ximage->width = w; | ||||
|     ximage->height = h; | ||||
|     ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32); | ||||
|  | ||||
|     XPutImage(dpy, drawable, gc, ximage, 0, 0, x, y, w, h); | ||||
|  | ||||
|     ximage->data = NULL; | ||||
| } | ||||
|  | ||||
| static void | ||||
| swrastGetImage(__DRIdrawable *draw, | ||||
| 	       int x, int y, int w, int h, char *data, | ||||
| 	       void *loaderPrivate) | ||||
| { | ||||
|     __GLXDRIdrawablePrivate *pdp = loaderPrivate; | ||||
|     __GLXDRIdrawable *pdraw = &(pdp->base);; | ||||
|     Display *dpy = pdraw->psc->dpy; | ||||
|     Drawable drawable; | ||||
|     XImage *ximage; | ||||
|  | ||||
|     drawable = pdraw->xDrawable; | ||||
|  | ||||
|     ximage = pdp->ximage; | ||||
|     ximage->data = data; | ||||
|     ximage->width = w; | ||||
|     ximage->height = h; | ||||
|     ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32); | ||||
|  | ||||
|     XGetSubImage(dpy, drawable, x, y, w, h, ~0L, ZPixmap, ximage, 0, 0); | ||||
|  | ||||
|     ximage->data = NULL; | ||||
| } | ||||
|  | ||||
| static const __DRIswrastLoaderExtension swrastLoaderExtension = { | ||||
|     { __DRI_SWRAST_LOADER, __DRI_SWRAST_LOADER_VERSION }, | ||||
|     swrastGetDrawableInfo, | ||||
|     swrastPutImage, | ||||
|     swrastGetImage | ||||
| }; | ||||
|  | ||||
| static const __DRIextension *loader_extensions[] = { | ||||
|     &systemTimeExtension.base, | ||||
|     &swrastLoaderExtension.base, | ||||
|     NULL | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * GLXDRI functions | ||||
|  */ | ||||
|  | ||||
| static void driDestroyContext(__GLXDRIcontext *context, | ||||
| 			      __GLXscreenConfigs *psc, Display *dpy) | ||||
| { | ||||
|     __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context; | ||||
|     const __DRIcoreExtension *core = pcp->psc->core; | ||||
|  | ||||
|     (*core->destroyContext)(pcp->driContext); | ||||
|  | ||||
|     Xfree(pcp); | ||||
| } | ||||
|  | ||||
| static Bool driBindContext(__GLXDRIcontext *context, | ||||
| 			   __GLXDRIdrawable *draw, __GLXDRIdrawable *read) | ||||
| { | ||||
|     __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context; | ||||
|     const __DRIcoreExtension *core = pcp->psc->core; | ||||
|  | ||||
|     return (*core->bindContext)(pcp->driContext, | ||||
| 				draw->driDrawable, | ||||
| 				read->driDrawable); | ||||
| } | ||||
|  | ||||
| static void driUnbindContext(__GLXDRIcontext *context) | ||||
| { | ||||
|     __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context; | ||||
|     const __DRIcoreExtension *core = pcp->psc->core; | ||||
|  | ||||
|     (*core->unbindContext)(pcp->driContext); | ||||
| } | ||||
|  | ||||
| static __GLXDRIcontext *driCreateContext(__GLXscreenConfigs *psc, | ||||
| 					 const __GLcontextModes *mode, | ||||
| 					 GLXContext gc, | ||||
| 					 GLXContext shareList, int renderType) | ||||
| { | ||||
|     __GLXDRIcontextPrivate *pcp, *pcp_shared; | ||||
|     __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode; | ||||
|     const __DRIcoreExtension *core = psc->core; | ||||
|     __DRIcontext *shared = NULL; | ||||
|  | ||||
|     if (!psc || !psc->driScreen) | ||||
| 	return NULL; | ||||
|  | ||||
|     if (shareList) { | ||||
| 	pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext; | ||||
| 	shared = pcp_shared->driContext; | ||||
|     } | ||||
|  | ||||
|     pcp = Xmalloc(sizeof *pcp); | ||||
|     if (pcp == NULL) | ||||
| 	return NULL; | ||||
|  | ||||
|     pcp->psc = psc; | ||||
|     pcp->driContext = | ||||
| 	(*core->createNewContext)(psc->__driScreen, | ||||
| 				  config->driConfig, shared, pcp); | ||||
|     if (pcp->driContext == NULL) { | ||||
| 	Xfree(pcp); | ||||
| 	return NULL; | ||||
|     } | ||||
|  | ||||
|     pcp->base.destroyContext = driDestroyContext; | ||||
|     pcp->base.bindContext = driBindContext; | ||||
|     pcp->base.unbindContext = driUnbindContext; | ||||
|  | ||||
|     return &pcp->base; | ||||
| } | ||||
|  | ||||
| static void driDestroyDrawable(__GLXDRIdrawable *pdraw) | ||||
| { | ||||
|     __GLXDRIdrawablePrivate *pdp = (__GLXDRIdrawablePrivate *) pdraw; | ||||
|     const __DRIcoreExtension *core = pdraw->psc->core; | ||||
|  | ||||
|     (*core->destroyDrawable)(pdraw->driDrawable); | ||||
|  | ||||
|     XDestroyDrawable(pdp, pdraw->psc->dpy, pdraw->drawable); | ||||
|     Xfree(pdp); | ||||
| } | ||||
|  | ||||
| static __GLXDRIdrawable *driCreateDrawable(__GLXscreenConfigs *psc, | ||||
| 					   XID xDrawable, | ||||
| 					   GLXDrawable drawable, | ||||
| 					   const __GLcontextModes *modes) | ||||
| { | ||||
|     __GLXDRIdrawable *pdraw; | ||||
|     __GLXDRIdrawablePrivate *pdp; | ||||
|     __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes; | ||||
|     const __DRIswrastExtension *swrast = psc->swrast; | ||||
|  | ||||
|     /* Old dri can't handle GLX 1.3+ drawable constructors. */ | ||||
|     if (xDrawable != drawable) | ||||
| 	return NULL; | ||||
|  | ||||
|     pdp = Xmalloc(sizeof(*pdp)); | ||||
|     if (!pdp) | ||||
| 	return NULL; | ||||
|  | ||||
|     pdraw = &(pdp->base); | ||||
|     pdraw->xDrawable = xDrawable; | ||||
|     pdraw->drawable = drawable; | ||||
|     pdraw->psc = psc; | ||||
|  | ||||
|     XCreateDrawable(pdp, psc->dpy, xDrawable, modes->visualID); | ||||
|  | ||||
|     /* Create a new drawable */ | ||||
|     pdraw->driDrawable = | ||||
| 	(*swrast->createNewDrawable)(psc->__driScreen, | ||||
| 				     config->driConfig, | ||||
| 				     pdp); | ||||
|  | ||||
|     if (!pdraw->driDrawable) { | ||||
| 	XDestroyDrawable(pdp, psc->dpy, xDrawable); | ||||
| 	Xfree(pdp); | ||||
| 	return NULL; | ||||
|     } | ||||
|  | ||||
|     pdraw->destroyDrawable = driDestroyDrawable; | ||||
|  | ||||
|     return pdraw; | ||||
| } | ||||
|  | ||||
| static void driDestroyScreen(__GLXscreenConfigs *psc) | ||||
| { | ||||
|     /* Free the direct rendering per screen data */ | ||||
|     (*psc->core->destroyScreen)(psc->__driScreen); | ||||
|     psc->__driScreen = NULL; | ||||
|     if (psc->driver) | ||||
| 	dlclose(psc->driver); | ||||
| } | ||||
|  | ||||
| static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen, | ||||
| 				       __GLXdisplayPrivate *priv) | ||||
| { | ||||
|     __GLXDRIscreen *psp; | ||||
|     const __DRIconfig **driver_configs; | ||||
|     const __DRIextension **extensions; | ||||
|     const char *driverName = "swrast"; | ||||
|     int i; | ||||
|  | ||||
|     psp = Xmalloc(sizeof *psp); | ||||
|     if (psp == NULL) | ||||
| 	return NULL; | ||||
|  | ||||
|     /* Initialize per screen dynamic client GLX extensions */ | ||||
|     psc->ext_list_first_time = GL_TRUE; | ||||
|  | ||||
|     psc->driver = driOpenDriver(driverName); | ||||
|     if (psc->driver == NULL) | ||||
| 	goto handle_error; | ||||
|  | ||||
|     extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS); | ||||
|     if (extensions == NULL) { | ||||
| 	ErrorMessageF("driver exports no extensions (%s)\n", dlerror()); | ||||
| 	goto handle_error; | ||||
|     } | ||||
|  | ||||
|     for (i = 0; extensions[i]; i++) { | ||||
| 	if (strcmp(extensions[i]->name, __DRI_CORE) == 0) | ||||
| 	    psc->core = (__DRIcoreExtension *) extensions[i]; | ||||
| 	if (strcmp(extensions[i]->name, __DRI_SWRAST) == 0) | ||||
| 	    psc->swrast = (__DRIswrastExtension *) extensions[i]; | ||||
|     } | ||||
|  | ||||
|     if (psc->core == NULL || psc->swrast == NULL) { | ||||
| 	ErrorMessageF("core dri extension not found\n"); | ||||
| 	goto handle_error; | ||||
|     } | ||||
|  | ||||
|     psc->__driScreen = | ||||
| 	psc->swrast->createNewScreen(screen, | ||||
| 				     loader_extensions, &driver_configs, psc); | ||||
|     if (psc->__driScreen == NULL) { | ||||
| 	ErrorMessageF("failed to create dri screen\n"); | ||||
| 	goto handle_error; | ||||
|     } | ||||
|  | ||||
|     driBindExtensions(psc); | ||||
|  | ||||
|     psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs); | ||||
|     psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs); | ||||
|  | ||||
|     psp->destroyScreen = driDestroyScreen; | ||||
|     psp->createContext = driCreateContext; | ||||
|     psp->createDrawable = driCreateDrawable; | ||||
|  | ||||
|     return psp; | ||||
|  | ||||
|  handle_error: | ||||
|     Xfree(psp); | ||||
|  | ||||
|     if (psc->driver) | ||||
| 	dlclose(psc->driver); | ||||
|  | ||||
|     ErrorMessageF("reverting to indirect rendering\n"); | ||||
|  | ||||
|     return NULL; | ||||
| } | ||||
|  | ||||
| /* Called from __glXFreeDisplayPrivate. | ||||
|  */ | ||||
| static void driDestroyDisplay(__GLXDRIdisplay *dpy) | ||||
| { | ||||
|     Xfree(dpy); | ||||
| } | ||||
|  | ||||
| /* | ||||
|  * Allocate, initialize and return a __DRIdisplayPrivate object. | ||||
|  * This is called from __glXInitialize() when we are given a new | ||||
|  * display pointer. | ||||
|  */ | ||||
| _X_HIDDEN __GLXDRIdisplay *driswCreateDisplay(Display *dpy) | ||||
| { | ||||
|     __GLXDRIdisplayPrivate *pdpyp; | ||||
|  | ||||
|     pdpyp = Xmalloc(sizeof *pdpyp); | ||||
|     if (pdpyp == NULL) | ||||
| 	return NULL; | ||||
|  | ||||
|     pdpyp->base.destroyDisplay = driDestroyDisplay; | ||||
|     pdpyp->base.createScreen = driCreateScreen; | ||||
|  | ||||
|     return &pdpyp->base; | ||||
| } | ||||
|  | ||||
| #endif /* GLX_DIRECT_RENDERING */ | ||||
| @@ -118,7 +118,7 @@ _gl_convert_to_x_visual_type( int visualType ) | ||||
|  * of the fields in \c config are copied to \c mode.  Additional fields in | ||||
|  * \c mode that can be derrived from the fields of \c config (i.e., | ||||
|  * \c haveDepthBuffer) are also filled in.  The remaining fields in \c mode | ||||
|  * that cannot be derrived are set to default values. | ||||
|  * that cannot be derived are set to default values. | ||||
|  *  | ||||
|  * \param mode   Destination GL context mode. | ||||
|  * \param config Source GLX visual config. | ||||
| @@ -184,6 +184,9 @@ _gl_copy_visual_to_context_mode( __GLcontextModes * mode, | ||||
|     mode->transparentBlue  = config->transparentBlue; | ||||
|     mode->transparentAlpha = config->transparentAlpha; | ||||
|     mode->transparentIndex = config->transparentIndex; | ||||
|     mode->samples = config->multiSampleSize; | ||||
|     mode->sampleBuffers = config->nMultiSampleBuffers; | ||||
|     /* mode->visualSelectGroup = config->visualSelectGroup; ? */ | ||||
|  | ||||
|     mode->swapMethod = GLX_SWAP_UNDEFINED_OML; | ||||
|  | ||||
|   | ||||
| @@ -293,7 +293,7 @@ GetDrawableAttribute( Display *dpy, GLXDrawable drawable, | ||||
| 		__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL); | ||||
|  | ||||
| 		if (pdraw != NULL && !pdraw->textureTarget) | ||||
| 		    pdraw->textureTarget = determineTextureTarget(data, | ||||
| 		    pdraw->textureTarget = determineTextureTarget((const int *)data, | ||||
| 								  num_attributes); | ||||
| 	   } | ||||
| #endif | ||||
|   | ||||
| @@ -147,6 +147,7 @@ struct __GLXDRIdrawableRec { | ||||
| ** Function to create and DRI display data and initialize the display | ||||
| ** dependent methods. | ||||
| */ | ||||
| extern __GLXDRIdisplay *driswCreateDisplay(Display *dpy); | ||||
| extern __GLXDRIdisplay *driCreateDisplay(Display *dpy); | ||||
| extern __GLXDRIdisplay *dri2CreateDisplay(Display *dpy); | ||||
|  | ||||
| @@ -465,6 +466,7 @@ struct __GLXscreenConfigsRec { | ||||
|     __DRIscreen *__driScreen; | ||||
|     const __DRIcoreExtension *core; | ||||
|     const __DRIlegacyExtension *legacy; | ||||
|     const __DRIswrastExtension *swrast; | ||||
|     __glxHashTable *drawHash; | ||||
|     Display *dpy; | ||||
|     int scr, fd; | ||||
| @@ -564,6 +566,7 @@ struct __GLXdisplayPrivateRec { | ||||
|     /** | ||||
|      * Per display direct rendering interface functions and data. | ||||
|      */ | ||||
|     __GLXDRIdisplay *driswDisplay; | ||||
|     __GLXDRIdisplay *driDisplay; | ||||
|     __GLXDRIdisplay *dri2Display; | ||||
| #endif | ||||
|   | ||||
| @@ -194,9 +194,14 @@ static int __glXFreeDisplayPrivate(XExtData *extension) | ||||
|  | ||||
| #ifdef GLX_DIRECT_RENDERING | ||||
|     /* Free the direct rendering per display data */ | ||||
|     if (priv->driswDisplay) | ||||
| 	(*priv->driswDisplay->destroyDisplay)(priv->driswDisplay); | ||||
|     priv->driswDisplay = NULL; | ||||
|  | ||||
|     if (priv->driDisplay) | ||||
| 	(*priv->driDisplay->destroyDisplay)(priv->driDisplay); | ||||
|     priv->driDisplay = NULL; | ||||
|  | ||||
|     if (priv->dri2Display) | ||||
| 	(*priv->dri2Display->destroyDisplay)(priv->dri2Display); | ||||
|     priv->dri2Display = NULL; | ||||
| @@ -596,10 +601,16 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv) | ||||
| 	psc->drawHash = __glxHashCreate(); | ||||
| 	if (psc->drawHash == NULL) | ||||
| 	    continue; | ||||
|  | ||||
| 	if (priv->dri2Display) | ||||
| 	    psc->driScreen = (*priv->dri2Display->createScreen)(psc, i, priv); | ||||
|  | ||||
| 	if (psc->driScreen == NULL && priv->driDisplay) | ||||
| 	    psc->driScreen = (*priv->driDisplay->createScreen)(psc, i, priv); | ||||
|  | ||||
| 	if (psc->driScreen == NULL && priv->driswDisplay) | ||||
| 	    psc->driScreen = (*priv->driswDisplay->createScreen)(psc, i, priv); | ||||
|  | ||||
| 	if (psc->driScreen == NULL) { | ||||
| 	    __glxHashDestroy(psc->drawHash); | ||||
| 	    psc->drawHash = NULL; | ||||
| @@ -620,6 +631,9 @@ _X_HIDDEN __GLXdisplayPrivate *__glXInitialize(Display* dpy) | ||||
|     __GLXdisplayPrivate *dpyPriv; | ||||
|     XEDataObject dataObj; | ||||
|     int major, minor; | ||||
| #ifdef GLX_DIRECT_RENDERING | ||||
|     Bool glx_direct, glx_accel; | ||||
| #endif | ||||
|  | ||||
| #if defined(USE_XTHREADS) | ||||
|     { | ||||
| @@ -687,15 +701,20 @@ _X_HIDDEN __GLXdisplayPrivate *__glXInitialize(Display* dpy) | ||||
|     dpyPriv->serverGLXversion = 0x0; | ||||
|  | ||||
| #ifdef GLX_DIRECT_RENDERING | ||||
|     glx_direct = (getenv("LIBGL_ALWAYS_INDIRECT") == NULL); | ||||
|     glx_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL); | ||||
|  | ||||
|     /* | ||||
|     ** Initialize the direct rendering per display data and functions. | ||||
|     ** Note: This _must_ be done before calling any other DRI routines | ||||
|     ** (e.g., those called in AllocAndFetchScreenConfigs). | ||||
|     */ | ||||
|     if (getenv("LIBGL_ALWAYS_INDIRECT") == NULL) { | ||||
|         dpyPriv->dri2Display = dri2CreateDisplay(dpy); | ||||
|     if (glx_direct && glx_accel) { | ||||
| 	dpyPriv->dri2Display = dri2CreateDisplay(dpy); | ||||
| 	dpyPriv->driDisplay = driCreateDisplay(dpy); | ||||
|     } | ||||
|     if (glx_direct) | ||||
| 	dpyPriv->driswDisplay = driswCreateDisplay(dpy); | ||||
| #endif | ||||
|  | ||||
|     if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) { | ||||
|   | ||||
| @@ -23,6 +23,7 @@ | ||||
|  * SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| #include "glheader.h" | ||||
| #include <inttypes.h> | ||||
| #include <GL/gl.h> | ||||
| #include "indirect.h" | ||||
|   | ||||
| @@ -34,6 +34,7 @@ | ||||
| ** | ||||
| */ | ||||
|  | ||||
| #include "glheader.h" | ||||
| #include "glxclient.h" | ||||
| #include "indirect.h" | ||||
|  | ||||
|   | ||||
| @@ -34,6 +34,7 @@ | ||||
| ** | ||||
| */ | ||||
|  | ||||
| #include "glheader.h" | ||||
| #include "packsingle.h" | ||||
| #include "indirect.h" | ||||
| #include "dispatch.h" | ||||
|   | ||||
| @@ -6,11 +6,6 @@ include $(TOP)/configs/current | ||||
| include sources | ||||
|  | ||||
|  | ||||
| GL_MAJOR = 1 | ||||
| GL_MINOR = 5 | ||||
| GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) | ||||
|  | ||||
|  | ||||
| .SUFFIXES : .cpp | ||||
|  | ||||
| .c.o: | ||||
| @@ -23,20 +18,62 @@ GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) | ||||
| 	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ | ||||
|  | ||||
|  | ||||
| # Figure out what to make here | ||||
| default: depend | ||||
| 	@for driver in $(DRIVER_DIRS) ; do \ | ||||
| 	  case "$$driver" in \ | ||||
| 	    x11)      $(MAKE) stand-alone || exit 1 ;; \ | ||||
| 	    dri)      $(MAKE) linux-solo || exit 1 ;; \ | ||||
| 	    osmesa)   $(MAKE) osmesa-only || exit 1 ;; \ | ||||
| 	    beos)     $(MAKE) beos || exit 1 ;; \ | ||||
| 	    directfb) $(MAKE) directfb || exit 1 ;; \ | ||||
| 	    fbdev)    $(MAKE) fbdev || exit 1 ;; \ | ||||
| 	    *) echo "$$driver is invalid in DRIVER_DIRS" >&2; exit 1;; \ | ||||
| 	  esac ; \ | ||||
| 	done | ||||
|  | ||||
| # Default: build dependencies, then asm_subdirs, then convenience | ||||
| # libs (.a) and finally the device drivers: | ||||
| default: depend asm_subdirs libmesa.a libglapi.a driver_subdirs | ||||
|  | ||||
|  | ||||
|  | ||||
| ###################################################################### | ||||
| # Helper libraries used by many drivers: | ||||
|  | ||||
| # Make archive of core mesa object files | ||||
| libmesa.a: $(MESA_OBJECTS) | ||||
| 	@ $(TOP)/bin/mklib -o mesa -static $(MESA_OBJECTS) | ||||
|  | ||||
| # Make archive of gl* API dispatcher functions only | ||||
| libglapi.a: $(GLAPI_OBJECTS) | ||||
| 	@ $(TOP)/bin/mklib -o glapi -static $(GLAPI_OBJECTS) | ||||
|  | ||||
|  | ||||
| ###################################################################### | ||||
| # Device drivers | ||||
| driver_subdirs: libmesa.a libglapi.a | ||||
| 	(cd drivers && $(MAKE)) | ||||
|  | ||||
|  | ||||
| ###################################################################### | ||||
| # Assembly subdirs | ||||
| asm_subdirs: | ||||
| 	@ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \ | ||||
| 		(cd x86 && $(MAKE)) || exit 1 ; \ | ||||
| 	fi | ||||
| 	@ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \ | ||||
| 		(cd x86 && $(MAKE)) || exit 1 ; \ | ||||
| 		(cd x86-64 && $(MAKE)) || exit 1 ; \ | ||||
| 	fi | ||||
|  | ||||
|  | ||||
| ###################################################################### | ||||
| # Dependency generation | ||||
|  | ||||
| depend: $(ALL_SOURCES) | ||||
| 	@ echo "running $(MKDEP)" | ||||
| 	@ touch depend | ||||
| 	@$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \ | ||||
| 		> /dev/null 2>/dev/null | ||||
|  | ||||
|  | ||||
| ###################################################################### | ||||
| # Installation rules | ||||
|  | ||||
| # this isn't fleshed out yet but is probably the way to go in the future | ||||
| new_install: | ||||
| 	(cd drivers && $(MAKE) install) | ||||
|  | ||||
|  | ||||
| # XXX replace this with new_install above someday | ||||
| install: default | ||||
| 	@for driver in $(DRIVER_DIRS) ; do \ | ||||
| 	  case "$$driver" in \ | ||||
| @@ -51,164 +88,50 @@ install: default | ||||
| 	done | ||||
|  | ||||
|  | ||||
| ###################################################################### | ||||
| # BeOS driver target | ||||
|  | ||||
| beos: depend subdirs libmesa.a | ||||
| 	cd drivers/beos && $(MAKE) | ||||
|  | ||||
|  | ||||
| ###################################################################### | ||||
| # Linux DRI drivers | ||||
|  | ||||
| # Make archive of core object files | ||||
| libmesa.a: $(SOLO_OBJECTS) | ||||
| 	@ $(TOP)/bin/mklib -o mesa -static $(SOLO_OBJECTS); | ||||
| 	@if [ "${CONFIG_NAME}" = "beos" ] ; then \ | ||||
| 		mimeset -f "$@" ; \ | ||||
| 	fi | ||||
|  | ||||
| linux-solo: depend subdirs libmesa.a | ||||
| 	cd drivers/dri && $(MAKE) | ||||
|  | ||||
|  | ||||
| ##################################################################### | ||||
| # Stand-alone Mesa libGL, no built-in drivers (DirectFB) | ||||
|  | ||||
| libgl-core: $(CORE_OBJECTS) | ||||
| 	@ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ | ||||
| 		-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ | ||||
| 		-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(CORE_OBJECTS) \ | ||||
| 		$(GL_LIB_DEPS) | ||||
|  | ||||
| directfb: depend subdirs libgl-core | ||||
| 	cd drivers/directfb && $(MAKE) | ||||
|  | ||||
|  | ||||
| ##################################################################### | ||||
| # fbdev Mesa driver (libGL.so) | ||||
|  | ||||
| fbdev: $(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) $(COMMON_DRIVER_OBJECTS) | ||||
| 	@ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ | ||||
| 		-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ | ||||
| 		-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ | ||||
| 		$(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) \ | ||||
| 		$(COMMON_DRIVER_OBJECTS) $(GL_LIB_DEPS) | ||||
|  | ||||
|  | ||||
| ###################################################################### | ||||
| # Stand-alone Mesa libGL and libOSMesa | ||||
| STAND_ALONE_DRIVER_SOURCES = \ | ||||
| 	$(COMMON_DRIVER_SOURCES) \ | ||||
| 	$(X11_DRIVER_SOURCES) | ||||
|  | ||||
| STAND_ALONE_DRIVER_OBJECTS = $(STAND_ALONE_DRIVER_SOURCES:.c=.o) | ||||
|  | ||||
| STAND_ALONE_OBJECTS = \ | ||||
| 	$(CORE_OBJECTS) \ | ||||
| 	$(STAND_ALONE_DRIVER_OBJECTS) | ||||
|  | ||||
| # For libOSMesa16 or libOSMesa32 we link _all_ the objects into the library, | ||||
| # not just the osmesa.o object (i.e. we don't have a libGL). | ||||
| OSMESA16_OBJECTS = \ | ||||
| 	$(CORE_OBJECTS) \ | ||||
| 	$(COMMON_DRIVER_OBJECTS) \ | ||||
| 	$(OSMESA_DRIVER_OBJECTS) | ||||
|  | ||||
|  | ||||
| stand-alone: depend subdirs libmesa.a \ | ||||
| 	$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) | ||||
|  | ||||
| osmesa-only: depend subdirs \ | ||||
| 	$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) | ||||
|  | ||||
| # Make the GL library | ||||
| $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS) | ||||
| 	@ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ | ||||
| 		-major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \ | ||||
| 		-install $(TOP)/$(LIB_DIR) \ | ||||
| 		$(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(STAND_ALONE_OBJECTS) | ||||
|  | ||||
| # Make the OSMesa library | ||||
| $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS) | ||||
| 	@ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \ | ||||
| 		$(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \ | ||||
| 			-ldflags '$(LDFLAGS)' -major $(MESA_MAJOR) \ | ||||
| 			-minor $(MESA_MINOR) -patch $(MESA_TINY) \ | ||||
| 			-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ | ||||
| 			$(OSMESA_LIB_DEPS) $(OSMESA16_OBJECTS) ; \ | ||||
| 	else \ | ||||
| 		$(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \ | ||||
| 			-ldflags '$(LDFLAGS)' -major $(MESA_MAJOR) \ | ||||
| 			-minor $(MESA_MINOR) -patch $(GL_TINY) \ | ||||
| 			-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ | ||||
| 			$(OSMESA_LIB_DEPS) $(OSMESA_DRIVER_OBJECTS) ; \ | ||||
| 	fi | ||||
|  | ||||
|  | ||||
| ###################################################################### | ||||
| # Generic stuff | ||||
|  | ||||
| depend: $(ALL_SOURCES) | ||||
| 	@ echo "running $(MKDEP)" | ||||
| 	@ touch depend | ||||
| 	@$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \ | ||||
| 		> /dev/null 2>/dev/null | ||||
|  | ||||
|  | ||||
| subdirs: | ||||
| 	@ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \ | ||||
| 		(cd x86 && $(MAKE)) || exit 1 ; \ | ||||
| 	fi | ||||
| 	@ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \ | ||||
| 		(cd x86 && $(MAKE)) || exit 1 ; \ | ||||
| 		(cd x86-64 && $(MAKE)) || exit 1 ; \ | ||||
| 	fi | ||||
|  | ||||
| pcedit = sed \ | ||||
| 	-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ | ||||
| 	-e 's,@LIB_DIR@,$(LIB_DIR),' \ | ||||
| 	-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ | ||||
| 	-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ | ||||
| 	-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' | ||||
|  | ||||
| gl.pc: gl.pc.in | ||||
| 	$(pcedit) $< > $@ | ||||
|  | ||||
| install-headers: | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL | ||||
| 	$(INSTALL) -m 644 $(TOP)/include/GL/*.h \ | ||||
| 		$(DESTDIR)$(INSTALL_DIR)/include/GL | ||||
| 		$(DESTDIR)$(INSTALL_INC_DIR)/GL | ||||
|  | ||||
| install-libgl: default gl.pc install-headers | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)* \ | ||||
| 		$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 	$(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig | ||||
| 		$(DESTDIR)$(INSTALL_LIB_DIR) | ||||
| 	$(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig | ||||
|  | ||||
| install-osmesa: default | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) | ||||
| 	$(INSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)* \ | ||||
| 		$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) | ||||
| 		$(DESTDIR)$(INSTALL_LIB_DIR) | ||||
|  | ||||
| install-dri: | ||||
| install-dri: default | ||||
| 	cd drivers/dri && $(MAKE) install | ||||
|  | ||||
| ## NOT INSTALLED YET: | ||||
| ## $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GLES | ||||
| ## $(INSTALL) -m 644 include/GLES/*.h $(DESTDIR)$(INSTALL_DIR)/include/GLES | ||||
|  | ||||
|  | ||||
| # Emacs tags | ||||
| tags: | ||||
| 	etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h | ||||
|  | ||||
|  | ||||
| clean: | ||||
| 	-rm -f */*.o | ||||
| 	-rm -f */*/*.o | ||||
| 	-rm -f depend depend.bak libmesa.a | ||||
| 	-rm -f depend depend.bak libmesa.a libglapi.a | ||||
| 	-rm -f drivers/*/*.o | ||||
| 	-@cd drivers/dri && $(MAKE) clean | ||||
| 	-@cd drivers/xorg && $(MAKE) clean | ||||
| 	-@cd drivers/x11 && $(MAKE) clean | ||||
| 	-@cd drivers/osmesa && $(MAKE) clean | ||||
| 	-@cd x86 && $(MAKE) clean | ||||
| 	-@cd x86-64 && $(MAKE) clean | ||||
|  | ||||
|   | ||||
							
								
								
									
										29
									
								
								src/mesa/drivers/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								src/mesa/drivers/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| # src/mesa/drivers/Makefile | ||||
|  | ||||
| TOP = ../../.. | ||||
| include $(TOP)/configs/current | ||||
|  | ||||
|  | ||||
| default: | ||||
| 	@for dir in $(DRIVER_DIRS) ; do \ | ||||
| 		if [ -d $$dir ] ; then \ | ||||
| 			(cd $$dir && $(MAKE)) || exit 1; \ | ||||
| 		fi \ | ||||
| 	done | ||||
|  | ||||
|  | ||||
| clean: | ||||
| 	@for dir in $(DRIVER_DIRS) ; do \ | ||||
| 		if [ -d $$dir ] ; then \ | ||||
| 			(cd $$dir && $(MAKE) clean) || exit 1; \ | ||||
| 		fi \ | ||||
| 	done | ||||
|  | ||||
|  | ||||
| install: | ||||
| 	@for dir in $(DRIVER_DIRS) ; do \ | ||||
| 		if [ -d $$dir ] ; then \ | ||||
| 			(cd $$dir && $(MAKE) install) || exit 1; \ | ||||
| 		fi \ | ||||
| 	done | ||||
|  | ||||
| @@ -169,8 +169,10 @@ OBJECTS := $(DRIVER_OBJECTS:.cpp=.o) | ||||
|  | ||||
| default: depend $(TOP)/$(LIB_DIR) $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) | ||||
|  | ||||
| # XXX FIXME: mesa.a might be libmesa.a now | ||||
| $(MESA_MODULES): | ||||
| 	cd $(TOP)/src/mesa && $(MAKE) mesa.a ; | ||||
| 	mimeset -f "$@" | ||||
|  | ||||
| $(GLU_MODULES): | ||||
| 	cd $(GLU_DIR) && $(MAKE) $(subst $(GLU_DIR)/,,$(GLU_MODULES)) ; | ||||
|   | ||||
| @@ -25,11 +25,24 @@ DIRECTFBGL_MESA_OBJECTS = $(DIRECTFBGL_MESA_SOURCES:.c=.o) | ||||
|  | ||||
| DIRECTFBGL_MESA = libidirectfbgl_mesa.so | ||||
|  | ||||
| LIBS = $(TOP)/src/mesa/libmesa.a $(TOP)/src/mesa/libglapi.a | ||||
|  | ||||
|  | ||||
| .c.o: | ||||
| 	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(DFB_CFLAGS) $< -o $@ | ||||
|  | ||||
|  | ||||
| default: directfbgl_mesa | ||||
| default: directfb-libgl directfbgl_mesa | ||||
|  | ||||
|  | ||||
| # XXX this used to be in src/mesa/Makefile and is probably broken now | ||||
| directfb-libgl: $(LIBS) | ||||
| 	@ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ | ||||
| 		-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ | ||||
| 		-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(LIBS) \ | ||||
| 		$(GL_LIB_DEPS) | ||||
|  | ||||
|  | ||||
|  | ||||
| # Mesa DirectFBGL module | ||||
| directfbgl_mesa: $(DIRECTFBGL_MESA_OBJECTS) | ||||
|   | ||||
| @@ -102,7 +102,7 @@ typedef struct { | ||||
| static pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER; | ||||
| static unsigned int    global_ref  = 0; | ||||
|  | ||||
| static inline int directfbgl_init( void ) | ||||
| static INLINE int directfbgl_init( void ) | ||||
| { | ||||
|      pthread_mutexattr_t attr; | ||||
|      int                 ret; | ||||
| @@ -118,7 +118,7 @@ static inline int directfbgl_init( void ) | ||||
|      return ret; | ||||
| } | ||||
|  | ||||
| static inline void directfbgl_finish( void ) | ||||
| static INLINE void directfbgl_finish( void ) | ||||
| { | ||||
|      if (--global_ref == 0) | ||||
|           pthread_mutex_destroy( &global_lock ); | ||||
|   | ||||
| @@ -20,16 +20,30 @@ subdirs: | ||||
| 		fi \ | ||||
| 	done | ||||
|  | ||||
| pcedit = sed \ | ||||
| 	-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ | ||||
| 	-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ | ||||
| 	-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ | ||||
| 	-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ | ||||
| 	-e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_SEARCH_DIR),' | ||||
|  | ||||
| install: | ||||
| dri.pc: dri.pc.in | ||||
| 	$(pcedit) $< > $@ | ||||
|  | ||||
|  | ||||
| install: dri.pc | ||||
| 	@for dir in $(DRI_DIRS) ; do \ | ||||
| 		if [ -d $$dir ] ; then \ | ||||
| 			(cd $$dir && $(MAKE) install) || exit 1 ; \ | ||||
| 		fi \ | ||||
| 	done | ||||
| 	$(TOP)/bin/minstall -d $(DESTDIR)$(INSTALL_DIR)/include/GL/internal | ||||
| 	$(TOP)/bin/minstall -m 0644 $(TOP)/include/GL/internal/dri_interface.h $(DESTDIR)$(INSTALL_DIR)/include/GL/internal | ||||
| 	$(TOP)/bin/minstall -m 0644 $(TOP)/include/GL/internal/dri_sarea.h $(DESTDIR)$(INSTALL_DIR)/include/GL/internal | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL/internal | ||||
| 	$(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_interface.h \ | ||||
| 	  $(DESTDIR)$(INSTALL_INC_DIR)/GL/internal | ||||
| 	$(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_sarea.h \ | ||||
| 	  $(DESTDIR)$(INSTALL_INC_DIR)/GL/internal | ||||
| 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig | ||||
| 	$(INSTALL) -m 0644 dri.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig | ||||
|  | ||||
|  | ||||
| clean: | ||||
|   | ||||
| @@ -3,7 +3,6 @@ | ||||
| MESA_MODULES = $(TOP)/src/mesa/libmesa.a | ||||
|  | ||||
| COMMON_SOURCES = \ | ||||
|         ../../common/driverfuncs.c \ | ||||
|         ../common/utils.c \ | ||||
|         ../common/texmem.c \ | ||||
|         ../common/vblank.c \ | ||||
|   | ||||
| @@ -40,11 +40,6 @@ dri_bo * | ||||
| dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size, | ||||
| 	     unsigned int alignment, uint64_t location_mask) | ||||
| { | ||||
|    assert((location_mask & ~(DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_MEM_TT | | ||||
| 			     DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0 | | ||||
| 			     DRM_BO_FLAG_MEM_PRIV1 | DRM_BO_FLAG_MEM_PRIV2 | | ||||
| 			     DRM_BO_FLAG_MEM_PRIV3 | DRM_BO_FLAG_MEM_PRIV4 | | ||||
| 			     DRM_BO_FLAG_CACHED | DRM_BO_FLAG_CACHED_MAPPED)) == 0); | ||||
|    return bufmgr->bo_alloc(bufmgr, name, size, alignment, location_mask); | ||||
| } | ||||
|  | ||||
| @@ -53,12 +48,6 @@ dri_bo_alloc_static(dri_bufmgr *bufmgr, const char *name, unsigned long offset, | ||||
| 		    unsigned long size, void *virtual, | ||||
| 		    uint64_t location_mask) | ||||
| { | ||||
|    assert((location_mask & ~(DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_MEM_TT | | ||||
| 			     DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0 | | ||||
| 			     DRM_BO_FLAG_MEM_PRIV1 | DRM_BO_FLAG_MEM_PRIV2 | | ||||
| 			     DRM_BO_FLAG_MEM_PRIV3 | | ||||
| 			     DRM_BO_FLAG_MEM_PRIV4)) == 0); | ||||
|  | ||||
|    return bufmgr->bo_alloc_static(bufmgr, name, offset, size, virtual, | ||||
| 				  location_mask); | ||||
| } | ||||
|   | ||||
| @@ -219,4 +219,42 @@ void dri_post_process_relocs(dri_bo *batch_buf); | ||||
| void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence); | ||||
| int dri_bufmgr_check_aperture_space(dri_bo *bo); | ||||
|  | ||||
| #ifndef TTM_API | ||||
| /* reuse some TTM API */ | ||||
|  | ||||
| #define DRM_BO_MEM_LOCAL 0 | ||||
| #define DRM_BO_MEM_TT 1 | ||||
| #define DRM_BO_MEM_VRAM 2 | ||||
| #define DRM_BO_MEM_PRIV0 3 | ||||
| #define DRM_BO_MEM_PRIV1 4 | ||||
| #define DRM_BO_MEM_PRIV2 5 | ||||
| #define DRM_BO_MEM_PRIV3 6 | ||||
| #define DRM_BO_MEM_PRIV4 7 | ||||
|  | ||||
| #define DRM_BO_FLAG_READ        (1ULL << 0) | ||||
| #define DRM_BO_FLAG_WRITE       (1ULL << 1) | ||||
| #define DRM_BO_FLAG_EXE         (1ULL << 2) | ||||
| #define DRM_BO_MASK_ACCESS	(DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_EXE) | ||||
| #define DRM_BO_FLAG_NO_EVICT    (1ULL << 4) | ||||
|  | ||||
| #define DRM_BO_FLAG_MAPPABLE    (1ULL << 5) | ||||
| #define DRM_BO_FLAG_SHAREABLE   (1ULL << 6) | ||||
|  | ||||
| #define DRM_BO_FLAG_CACHED      (1ULL << 7) | ||||
|  | ||||
| #define DRM_BO_FLAG_NO_MOVE     (1ULL << 8) | ||||
| #define DRM_BO_FLAG_CACHED_MAPPED    (1ULL << 19) | ||||
| #define DRM_BO_FLAG_FORCE_CACHING  (1ULL << 13) | ||||
| #define DRM_BO_FLAG_FORCE_MAPPABLE (1ULL << 14) | ||||
| #define DRM_BO_FLAG_TILE           (1ULL << 15) | ||||
|  | ||||
| #define DRM_BO_FLAG_MEM_LOCAL  (1ULL << 24) | ||||
| #define DRM_BO_FLAG_MEM_TT     (1ULL << 25) | ||||
| #define DRM_BO_FLAG_MEM_VRAM   (1ULL << 26) | ||||
|  | ||||
| #define DRM_BO_MASK_MEM         0x00000000FF000000ULL | ||||
|  | ||||
| #define DRM_FENCE_TYPE_EXE                 0x00000001 | ||||
| #endif | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -277,13 +277,13 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) | ||||
|        pdp->pStamp = &(psp->pSAREA->drawableTable[pdp->index].stamp); | ||||
|  | ||||
|     DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int | ||||
| __driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp) | ||||
| { | ||||
|     __DRIscreenPrivate *psp = pcp->driScreenPriv; | ||||
|     __DRIscreenPrivate *psp = pdp->driScreenPriv; | ||||
|     __DRIDrawableConfigEvent *dc, *last_dc; | ||||
|     __DRIBufferAttachEvent *ba, *last_ba; | ||||
|     unsigned int tail, mask, *p, end, total, size, changed; | ||||
| @@ -291,7 +291,7 @@ __driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp) | ||||
|     size_t rect_size; | ||||
|  | ||||
|     /* Check for wraparound. */ | ||||
|     if (psp->dri2.buffer->prealloc - pdp->dri2.tail > psp->dri2.buffer->size) { | ||||
|     if (pcp && psp->dri2.buffer->prealloc - pdp->dri2.tail > psp->dri2.buffer->size) { | ||||
|        /* If prealloc overlaps into what we just parsed, the | ||||
| 	* server overwrote it and we have to reset our tail | ||||
| 	* pointer. */ | ||||
| @@ -460,6 +460,9 @@ static void driSwapBuffers(__DRIdrawable *dPriv) | ||||
|     if (!dPriv->numClipRects) | ||||
|         return; | ||||
|  | ||||
|     if (psp->dri2.enabled) | ||||
|        __driParseEvents(NULL, dPriv); | ||||
|  | ||||
|     psp->DriverAPI.SwapBuffers(dPriv); | ||||
|  | ||||
|     driReportDamage(dPriv, dPriv->pClipRects, dPriv->numClipRects); | ||||
| @@ -471,6 +474,7 @@ static int driDrawableGetMSC( __DRIscreen *sPriv, __DRIdrawable *dPriv, | ||||
|     return sPriv->DriverAPI.GetDrawableMSC(sPriv, dPriv, msc); | ||||
| } | ||||
|  | ||||
|  | ||||
| static int driWaitForMSC(__DRIdrawable *dPriv, int64_t target_msc, | ||||
| 			 int64_t divisor, int64_t remainder, | ||||
| 			 int64_t * msc, int64_t * sbc) | ||||
| @@ -478,7 +482,6 @@ static int driWaitForMSC(__DRIdrawable *dPriv, int64_t target_msc, | ||||
|     __DRIswapInfo  sInfo; | ||||
|     int  status; | ||||
|  | ||||
|  | ||||
|     status = dPriv->driScreenPriv->DriverAPI.WaitForMSC( dPriv, target_msc, | ||||
|                                                          divisor, remainder, | ||||
|                                                          msc ); | ||||
| @@ -496,12 +499,14 @@ static int driWaitForMSC(__DRIdrawable *dPriv, int64_t target_msc, | ||||
|     return status; | ||||
| } | ||||
|  | ||||
|  | ||||
| const __DRImediaStreamCounterExtension driMediaStreamCounterExtension = { | ||||
|     { __DRI_MEDIA_STREAM_COUNTER, __DRI_MEDIA_STREAM_COUNTER_VERSION }, | ||||
|     driWaitForMSC, | ||||
|     driDrawableGetMSC, | ||||
| }; | ||||
|  | ||||
|  | ||||
| static void driCopySubBuffer(__DRIdrawable *dPriv, | ||||
| 			      int x, int y, int w, int h) | ||||
| { | ||||
| @@ -510,9 +515,9 @@ static void driCopySubBuffer(__DRIdrawable *dPriv, | ||||
|     dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h); | ||||
|  | ||||
|     rect.x1 = x; | ||||
|     rect.y1 = y; | ||||
|     rect.y1 = dPriv->h - y - h; | ||||
|     rect.x2 = x + w; | ||||
|     rect.y2 = y + w; | ||||
|     rect.y2 = rect.y1 + h; | ||||
|     driReportDamage(dPriv, &rect, 1); | ||||
| } | ||||
|  | ||||
| @@ -595,6 +600,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config, | ||||
|     return pdp; | ||||
| } | ||||
|  | ||||
|  | ||||
| static __DRIdrawable * | ||||
| dri2CreateNewDrawable(__DRIscreen *screen, const __DRIconfig *config, | ||||
| 		      unsigned int drawable_id, unsigned int head, void *data) | ||||
| @@ -602,6 +608,8 @@ dri2CreateNewDrawable(__DRIscreen *screen, const __DRIconfig *config, | ||||
|     __DRIdrawable *pdraw; | ||||
|  | ||||
|     pdraw = driCreateNewDrawable(screen, config, 0, 0, NULL, data); | ||||
|     if (!pdraw) | ||||
|     	return NULL; | ||||
|  | ||||
|     pdraw->dri2.drawable_id = drawable_id; | ||||
|     pdraw->dri2.tail = head; | ||||
| @@ -642,8 +650,6 @@ driDestroyDrawable(__DRIdrawable *pdp) | ||||
| /** | ||||
|  * Destroy the per-context private information. | ||||
|  *  | ||||
|  * \param contextPrivate opaque pointer to the per-drawable private info. | ||||
|  * | ||||
|  * \internal | ||||
|  * This function calls __DriverAPIRec::DestroyContext on \p contextPrivate, calls | ||||
|  * drmDestroyContext(), and finally frees \p contextPrivate. | ||||
| @@ -661,13 +667,9 @@ driDestroyContext(__DRIcontext *pcp) | ||||
| /** | ||||
|  * Create the per-drawable private driver information. | ||||
|  *  | ||||
|  * \param dpy           The display handle. | ||||
|  * \param modes         Mode used to create the new context. | ||||
|  * \param render_type   Type of rendering target.  \c GLX_RGBA is the only | ||||
|  *                      type likely to ever be supported for direct-rendering. | ||||
|  * \param shared        The shared context dependent methods or \c NULL if | ||||
|  *                      non-existent. | ||||
|  * \param pctx          DRI context to receive the context dependent methods. | ||||
|  * \param shared        Context with which to share textures, etc. or NULL | ||||
|  * | ||||
|  * \returns An opaque pointer to the per-context private information on | ||||
|  *          success, or \c NULL on failure. | ||||
| @@ -716,6 +718,7 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config, | ||||
|     return pcp; | ||||
| } | ||||
|  | ||||
|  | ||||
| static __DRIcontext * | ||||
| dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config, | ||||
| 		      __DRIcontext *shared, void *data) | ||||
| @@ -734,6 +737,7 @@ dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config, | ||||
|     return driCreateNewContext(screen, config, 0, shared, hwContext, data); | ||||
| } | ||||
|  | ||||
|  | ||||
| static int | ||||
| driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask) | ||||
| { | ||||
| @@ -751,10 +755,6 @@ driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask) | ||||
| /** | ||||
|  * Destroy the per-screen private information. | ||||
|  *  | ||||
|  * \param dpy the display handle. | ||||
|  * \param scrn the screen number. | ||||
|  * \param screenPrivate opaque pointer to the per-screen private information. | ||||
|  * | ||||
|  * \internal | ||||
|  * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls | ||||
|  * drmClose(), and finally frees \p screenPrivate. | ||||
| @@ -771,8 +771,10 @@ static void driDestroyScreen(__DRIscreen *psp) | ||||
| 	    (*psp->DriverAPI.DestroyScreen)(psp); | ||||
|  | ||||
| 	if (psp->dri2.enabled) { | ||||
| #ifdef TTM_API | ||||
| 	    drmBOUnmap(psp->fd, &psp->dri2.sareaBO); | ||||
| 	    drmBOUnreference(psp->fd, &psp->dri2.sareaBO); | ||||
| #endif | ||||
| 	} else { | ||||
| 	   (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX); | ||||
| 	   (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); | ||||
| @@ -807,15 +809,10 @@ setupLoaderExtensions(__DRIscreen *psp, | ||||
|  * This routine also fills in the linked list pointed to by \c driver_modes | ||||
|  * with the \c __GLcontextModes that the driver can support for windows or | ||||
|  * pbuffers. | ||||
|  * | ||||
|  * For legacy DRI. | ||||
|  *  | ||||
|  * \param scrn  Index of the screen | ||||
|  * \param psc   DRI screen data (not driver private) | ||||
|  * \param modes Linked list of known display modes.  This list is, at a | ||||
|  *              minimum, a list of modes based on the current display mode. | ||||
|  *              These roughly match the set of available X11 visuals, but it | ||||
|  *              need not be limited to X11!  The calling libGL should create | ||||
|  *              a list that will inform the driver of the current display | ||||
|  *              mode (i.e., color buffer depth, depth buffer depth, etc.). | ||||
|  * \param ddx_version Version of the 2D DDX.  This may not be meaningful for | ||||
|  *                    all drivers. | ||||
|  * \param dri_version Version of the "server-side" DRI. | ||||
| @@ -824,9 +821,9 @@ setupLoaderExtensions(__DRIscreen *psp, | ||||
|  *                     framebuffer. | ||||
|  * \param pSAREA       Pointer the the SAREA. | ||||
|  * \param fd           Device handle for the DRM. | ||||
|  * \param internal_api_version  Version of the internal interface between the | ||||
|  *                              driver and libGL. | ||||
|  * \param driverAPI Driver API functions used by other routines in dri_util.c. | ||||
|  * \param extensions   ?? | ||||
|  * \param driver_modes  Returns modes suppoted by the driver | ||||
|  * \param loaderPrivate  ?? | ||||
|  *  | ||||
|  * \note There is no need to check the minimum API version in this | ||||
|  * function.  Since the name of this function is versioned, it is | ||||
| @@ -899,11 +896,15 @@ driCreateNewScreen(int scrn, | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * DRI2 | ||||
|  */ | ||||
| static __DRIscreen * | ||||
| dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle, | ||||
| 		    const __DRIextension **extensions, | ||||
| 		    const __DRIconfig ***driver_configs, void *data) | ||||
| { | ||||
| #ifdef TTM_API | ||||
|     static const __DRIextension *emptyExtensionList[] = { NULL }; | ||||
|     __DRIscreen *psp; | ||||
|     unsigned int *p; | ||||
| @@ -971,6 +972,9 @@ dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle, | ||||
|     psp->DriverAPI = driDriverAPI; | ||||
|  | ||||
|     return psp; | ||||
| #else | ||||
|     return NULL; | ||||
| #endif | ||||
| } | ||||
|  | ||||
| static const __DRIextension **driGetExtensions(__DRIscreen *psp) | ||||
| @@ -978,6 +982,7 @@ static const __DRIextension **driGetExtensions(__DRIscreen *psp) | ||||
|     return psp->extensions; | ||||
| } | ||||
|  | ||||
| /** Legacy DRI interface */ | ||||
| const __DRIlegacyExtension driLegacyExtension = { | ||||
|     { __DRI_LEGACY, __DRI_LEGACY_VERSION }, | ||||
|     driCreateNewScreen, | ||||
| @@ -985,6 +990,7 @@ const __DRIlegacyExtension driLegacyExtension = { | ||||
|     driCreateNewContext | ||||
| }; | ||||
|  | ||||
| /** DRI2 interface */ | ||||
| const __DRIcoreExtension driCoreExtension = { | ||||
|     { __DRI_CORE, __DRI_CORE_VERSION }, | ||||
|     dri2CreateNewScreen, | ||||
|   | ||||
| @@ -53,7 +53,7 @@ | ||||
| #include <drm.h> | ||||
| #include <drm_sarea.h> | ||||
| #include <xf86drm.h> | ||||
| #include <xf86mm.h> | ||||
| #include "glheader.h" | ||||
| #include "GL/internal/glcore.h" | ||||
| #include "GL/internal/dri_interface.h" | ||||
| #include "GL/internal/dri_sarea.h" | ||||
| @@ -524,7 +524,9 @@ struct __DRIscreenRec { | ||||
| 	/* Flag to indicate that this is a DRI2 screen.  Many of the above | ||||
| 	 * fields will not be valid or initializaed in that case. */ | ||||
| 	int enabled; | ||||
| #ifdef TTM_API | ||||
| 	drmBO sareaBO; | ||||
| #endif | ||||
| 	void *sarea; | ||||
| 	__DRIEventBuffer *buffer; | ||||
| 	__DRILock *lock; | ||||
|   | ||||
| @@ -1077,13 +1077,6 @@ static const char AreTexturesResident_names[] = | ||||
|     ""; | ||||
| #endif | ||||
|  | ||||
| #if defined(need_GL_EXT_framebuffer_object) | ||||
| static const char IsRenderbufferEXT_names[] =  | ||||
|     "i\0" /* Parameter signature */ | ||||
|     "glIsRenderbufferEXT\0" | ||||
|     ""; | ||||
| #endif | ||||
|  | ||||
| #if defined(need_GL_VERSION_2_0) || defined(need_GL_ATI_separate_stencil) | ||||
| static const char StencilOpSeparate_names[] =  | ||||
|     "iiii\0" /* Parameter signature */ | ||||
| @@ -1763,13 +1756,6 @@ static const char DeleteFencesNV_names[] = | ||||
|     ""; | ||||
| #endif | ||||
|  | ||||
| #if defined(need_GL_SGIX_polynomial_ffd) | ||||
| static const char DeformationMap3dSGIX_names[] =  | ||||
|     "iddiiddiiddiip\0" /* Parameter signature */ | ||||
|     "glDeformationMap3dSGIX\0" | ||||
|     ""; | ||||
| #endif | ||||
|  | ||||
| #if defined(need_GL_VERSION_2_0) | ||||
| static const char IsShader_names[] =  | ||||
|     "i\0" /* Parameter signature */ | ||||
| @@ -2015,6 +2001,13 @@ static const char WeightfvARB_names[] = | ||||
|     ""; | ||||
| #endif | ||||
|  | ||||
| #if defined(need_GL_EXT_framebuffer_object) | ||||
| static const char IsRenderbufferEXT_names[] =  | ||||
|     "i\0" /* Parameter signature */ | ||||
|     "glIsRenderbufferEXT\0" | ||||
|     ""; | ||||
| #endif | ||||
|  | ||||
| #if defined(need_GL_MESA_window_pos) | ||||
| static const char WindowPos4fMESA_names[] =  | ||||
|     "ffff\0" /* Parameter signature */ | ||||
| @@ -4530,6 +4523,13 @@ static const char Minmax_names[] = | ||||
|     ""; | ||||
| #endif | ||||
|  | ||||
| #if defined(need_GL_SGIX_polynomial_ffd) | ||||
| static const char DeformationMap3dSGIX_names[] =  | ||||
|     "iddiiddiiddiip\0" /* Parameter signature */ | ||||
|     "glDeformationMap3dSGIX\0" | ||||
|     ""; | ||||
| #endif | ||||
|  | ||||
| #if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) | ||||
| static const char FogCoorddvEXT_names[] =  | ||||
|     "p\0" /* Parameter signature */ | ||||
| @@ -5319,13 +5319,13 @@ static const struct dri_extension_function GL_EXT_framebuffer_blit_functions[] = | ||||
| #if defined(need_GL_EXT_framebuffer_object) | ||||
| static const struct dri_extension_function GL_EXT_framebuffer_object_functions[] = { | ||||
|     { GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, -1 }, | ||||
|     { IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 }, | ||||
|     { RenderbufferStorageEXT_names, RenderbufferStorageEXT_remap_index, -1 }, | ||||
|     { CheckFramebufferStatusEXT_names, CheckFramebufferStatusEXT_remap_index, -1 }, | ||||
|     { DeleteRenderbuffersEXT_names, DeleteRenderbuffersEXT_remap_index, -1 }, | ||||
|     { FramebufferTexture3DEXT_names, FramebufferTexture3DEXT_remap_index, -1 }, | ||||
|     { FramebufferRenderbufferEXT_names, FramebufferRenderbufferEXT_remap_index, -1 }, | ||||
|     { FramebufferTexture1DEXT_names, FramebufferTexture1DEXT_remap_index, -1 }, | ||||
|     { IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 }, | ||||
|     { BindFramebufferEXT_names, BindFramebufferEXT_remap_index, -1 }, | ||||
|     { GenRenderbuffersEXT_names, GenRenderbuffersEXT_remap_index, -1 }, | ||||
|     { IsFramebufferEXT_names, IsFramebufferEXT_remap_index, -1 }, | ||||
| @@ -5965,9 +5965,9 @@ static const struct dri_extension_function GL_SGIX_pixel_texture_functions[] = { | ||||
| #if defined(need_GL_SGIX_polynomial_ffd) | ||||
| static const struct dri_extension_function GL_SGIX_polynomial_ffd_functions[] = { | ||||
|     { LoadIdentityDeformationMapSGIX_names, LoadIdentityDeformationMapSGIX_remap_index, -1 }, | ||||
|     { DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 }, | ||||
|     { DeformSGIX_names, DeformSGIX_remap_index, -1 }, | ||||
|     { DeformationMap3fSGIX_names, DeformationMap3fSGIX_remap_index, -1 }, | ||||
|     { DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 }, | ||||
|     { NULL, 0, 0 } | ||||
| }; | ||||
| #endif | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
| * memset an area in I/O space | ||||
| * We need to be careful about this on some archs | ||||
| */ | ||||
| static __inline__ void drimemsetio(void* address, int c, int size) | ||||
| static INLINE void drimemsetio(void* address, int c, int size) | ||||
| { | ||||
| #if defined(__powerpc__) || defined(__ia64__) | ||||
|      int i; | ||||
|   | ||||
| @@ -37,7 +37,7 @@ | ||||
|  | ||||
| #if defined( __powerpc__ ) | ||||
|  | ||||
| static __inline__ u_int32_t | ||||
| static INLINE u_int32_t | ||||
| read_MMIO_LE32( volatile void * base, unsigned long offset ) | ||||
| { | ||||
|    u_int32_t val; | ||||
| @@ -50,7 +50,7 @@ read_MMIO_LE32( volatile void * base, unsigned long offset ) | ||||
|  | ||||
| #else | ||||
|  | ||||
| static __inline__ u_int32_t | ||||
| static INLINE u_int32_t | ||||
| read_MMIO_LE32( volatile void * base, unsigned long offset ) | ||||
| { | ||||
|    volatile u_int32_t * p = (volatile u_int32_t *) (((volatile char *) base) + offset); | ||||
|   | ||||
| @@ -1278,6 +1278,7 @@ driCalculateTextureFirstLastLevel( driTextureObject * t ) | ||||
|       else { | ||||
| 	 firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5); | ||||
| 	 firstLevel = MAX2(firstLevel, tObj->BaseLevel); | ||||
| 	 firstLevel = MIN2(firstLevel, tObj->BaseLevel + baseImage->MaxLog2); | ||||
| 	 lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5); | ||||
| 	 lastLevel = MAX2(lastLevel, t->tObj->BaseLevel); | ||||
| 	 lastLevel = MIN2(lastLevel, t->tObj->BaseLevel + baseImage->MaxLog2); | ||||
|   | ||||
| @@ -63,6 +63,12 @@ extern char *program_invocation_name, *program_invocation_short_name; | ||||
| #elif defined(__NetBSD__) && defined(__NetBSD_Version) && (__NetBSD_Version >= 106000100) | ||||
| #    include <stdlib.h> | ||||
| #    define GET_PROGRAM_NAME() getprogname() | ||||
| #elif defined(__sun) | ||||
| /* Solaris has getexecname() which returns the full path - return just | ||||
|    the basename to match BSD getprogname() */ | ||||
| #    include <stdlib.h> | ||||
| #    include <libgen.h> | ||||
| #    define GET_PROGRAM_NAME() basename(getexecname()) | ||||
| #endif | ||||
|  | ||||
| #if !defined(GET_PROGRAM_NAME) | ||||
|   | ||||
							
								
								
									
										10
									
								
								src/mesa/drivers/dri/dri.pc.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/mesa/drivers/dri/dri.pc.in
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| prefix=@INSTALL_DIR@ | ||||
| exec_prefix=${prefix} | ||||
| libdir=@INSTALL_LIB_DIR@ | ||||
| includedir=@INSTALL_INC_DIR@ | ||||
| dridriverdir=@DRI_DRIVER_DIR@ | ||||
|  | ||||
| Name: dri | ||||
| Description: Direct Rendering Infrastructure | ||||
| Version: @VERSION@ | ||||
| Cflags: -I${includedir} | ||||
| @@ -79,7 +79,7 @@ struct ff_fixups { | ||||
| /* Compute fixups of non-page aligned areas after a page fill. | ||||
|  * Return the number of fixups needed. | ||||
|  */ | ||||
| static __inline__ int | ||||
| static INLINE int | ||||
| CreatorComputePageFillFixups(struct ff_fixups *fixups, | ||||
| 			     int x, int y, int w, int h, | ||||
| 			     int paligned_x, int paligned_y, | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| /* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_linetmp.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */ | ||||
|  | ||||
| static __inline void TAG(ffb_line)(GLcontext *ctx, ffb_vertex *v0,  | ||||
| static INLINE void TAG(ffb_line)(GLcontext *ctx, ffb_vertex *v0,  | ||||
| 				   ffb_vertex *v1 ) | ||||
| { | ||||
| 	ffbContextPtr fmesa = FFB_CONTEXT(ctx); | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| /* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h,v 1.3 2002/02/22 21:32:59 dawes Exp $ */ | ||||
|  | ||||
| static __inline void TAG(ffb_draw_point)(GLcontext *ctx, ffb_vertex *tmp ) | ||||
| static INLINE void TAG(ffb_draw_point)(GLcontext *ctx, ffb_vertex *tmp ) | ||||
| { | ||||
| 	ffbContextPtr fmesa = FFB_CONTEXT(ctx); | ||||
| 	ffb_fbcPtr ffb = fmesa->regs; | ||||
|   | ||||
| @@ -42,10 +42,6 @@ | ||||
|  | ||||
| #include "ffb_vtxfmt.h" | ||||
|  | ||||
| #ifndef __GNUC__ | ||||
| #define __inline  /**/ | ||||
| #endif | ||||
|  | ||||
| #define TNL_VERTEX			ffbTnlVertex | ||||
|  | ||||
| #define INTERP_RGBA(t, out, a, b)		\ | ||||
| @@ -60,7 +56,7 @@ do {						\ | ||||
|  | ||||
| /* Color functions: */ | ||||
|  | ||||
| static __inline void ffb_recalc_base_color(GLcontext *ctx) | ||||
| static INLINE void ffb_recalc_base_color(GLcontext *ctx) | ||||
| { | ||||
| 	ffbContextPtr fmesa = FFB_CONTEXT(ctx); | ||||
| 	struct gl_light *light; | ||||
|   | ||||
| @@ -384,7 +384,7 @@ struct gamma_context { | ||||
|     int                 TextureCount; | ||||
| }; | ||||
|  | ||||
| static __inline GLuint gammaPackColor( GLuint cpp, | ||||
| static INLINE GLuint gammaPackColor( GLuint cpp, | ||||
| 					GLubyte r, GLubyte g, | ||||
| 					GLubyte b, GLubyte a ) | ||||
| { | ||||
|   | ||||
| @@ -129,13 +129,13 @@ static const GLuint hw_prim[GL_POLYGON+1] = { | ||||
|    B_PrimType_Polygon | ||||
| }; | ||||
|  | ||||
| static __inline void gammaStartPrimitive( gammaContextPtr gmesa, GLenum prim ) | ||||
| static INLINE void gammaStartPrimitive( gammaContextPtr gmesa, GLenum prim ) | ||||
| { | ||||
|    CHECK_DMA_BUFFER(gmesa, 1); | ||||
|    WRITE(gmesa->buf, Begin, gmesa->Begin | hw_prim[prim]); | ||||
| } | ||||
|  | ||||
| static __inline void gammaEndPrimitive( gammaContextPtr gmesa ) | ||||
| static INLINE void gammaEndPrimitive( gammaContextPtr gmesa ) | ||||
| { | ||||
|    GLcontext *ctx = gmesa->glCtx; | ||||
|  | ||||
|   | ||||
| @@ -34,7 +34,7 @@ do {								\ | ||||
|    }								\ | ||||
| } while (0) | ||||
|  | ||||
| static __inline GLuint *i810AllocDmaLow( i810ContextPtr imesa, int bytes ) | ||||
| static INLINE GLuint *i810AllocDmaLow( i810ContextPtr imesa, int bytes ) | ||||
| { | ||||
|    if (imesa->vertex_low + bytes > imesa->vertex_high)  | ||||
|       i810FlushPrimsGetBuffer( imesa ); | ||||
|   | ||||
| @@ -27,7 +27,7 @@ | ||||
|  | ||||
| #include "tnl/t_pipeline.h" | ||||
|  | ||||
| static __inline__ GLuint i810PackColor(GLuint format, | ||||
| static INLINE GLuint i810PackColor(GLuint format, | ||||
| 				       GLubyte r, GLubyte g, | ||||
| 				       GLubyte b, GLubyte a) | ||||
| { | ||||
|   | ||||
| @@ -64,7 +64,7 @@ void i810DestroyTexObj(i810ContextPtr imesa, i810TextureObjectPtr t) | ||||
| /* From linux kernel i386 header files, copes with odd sizes better | ||||
|  * than COPY_DWORDS would: | ||||
|  */ | ||||
| static __inline__ void * __memcpy(void * to, const void * from, size_t n) | ||||
| static INLINE void * __memcpy(void * to, const void * from, size_t n) | ||||
| { | ||||
| int d0, d1, d2; | ||||
| __asm__ __volatile__( | ||||
|   | ||||
| @@ -75,7 +75,7 @@ do {									\ | ||||
| } while (0) | ||||
| #endif | ||||
|  | ||||
| static __inline__ void i810_draw_triangle( i810ContextPtr imesa, | ||||
| static INLINE void i810_draw_triangle( i810ContextPtr imesa, | ||||
| 					   i810VertexPtr v0, | ||||
| 					   i810VertexPtr v1, | ||||
| 					   i810VertexPtr v2 ) | ||||
| @@ -90,7 +90,7 @@ static __inline__ void i810_draw_triangle( i810ContextPtr imesa, | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline__ void i810_draw_quad( i810ContextPtr imesa, | ||||
| static INLINE void i810_draw_quad( i810ContextPtr imesa, | ||||
| 				       i810VertexPtr v0, | ||||
| 				       i810VertexPtr v1, | ||||
| 				       i810VertexPtr v2, | ||||
| @@ -109,7 +109,7 @@ static __inline__ void i810_draw_quad( i810ContextPtr imesa, | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline__ void i810_draw_point( i810ContextPtr imesa, | ||||
| static INLINE void i810_draw_point( i810ContextPtr imesa, | ||||
| 					i810VertexPtr tmp ) | ||||
| { | ||||
|    GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size, | ||||
| @@ -133,7 +133,7 @@ static __inline__ void i810_draw_point( i810ContextPtr imesa, | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline__ void i810_draw_line( i810ContextPtr imesa, | ||||
| static INLINE void i810_draw_line( i810ContextPtr imesa, | ||||
| 				       i810VertexPtr v0, | ||||
| 				       i810VertexPtr v1 ) | ||||
| { | ||||
|   | ||||
| @@ -28,6 +28,7 @@ DRIVER_SOURCES = \ | ||||
| 	intel_tex_format.c \ | ||||
| 	intel_tex.c \ | ||||
| 	intel_pixel.c \ | ||||
| 	intel_pixel_bitmap.c \ | ||||
| 	intel_pixel_copy.c \ | ||||
| 	intel_pixel_read.c \ | ||||
| 	intel_pixel_draw.c \ | ||||
|   | ||||
| @@ -52,7 +52,6 @@ static void | ||||
| i830InitDriverFunctions(struct dd_function_table *functions) | ||||
| { | ||||
|    intelInitDriverFunctions(functions); | ||||
|    intelInitPixelFuncs(functions); | ||||
|    i830InitStateFuncs(functions); | ||||
|    i830InitTextureFuncs(functions); | ||||
| } | ||||
|   | ||||
| @@ -94,7 +94,6 @@ static void | ||||
| i915InitDriverFunctions(struct dd_function_table *functions) | ||||
| { | ||||
|    intelInitDriverFunctions(functions); | ||||
|    intelInitPixelFuncs(functions); | ||||
|    i915InitStateFunctions(functions); | ||||
|    i915InitTextureFuncs(functions); | ||||
|    i915InitFragProgFuncs(functions); | ||||
|   | ||||
| @@ -65,7 +65,12 @@ translate_texture_format(GLuint mesa_format, GLenum DepthMode) | ||||
|    case MESA_FORMAT_RGBA_FXT1: | ||||
|       return (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1); | ||||
|    case MESA_FORMAT_Z16: | ||||
|       return (MAPSURF_16BIT | (DepthMode==GL_ALPHA?MT_16BIT_A16:MT_16BIT_L16)); | ||||
|       if (DepthMode == GL_ALPHA) | ||||
|           return (MAPSURF_16BIT | MT_16BIT_A16); | ||||
|       else if (DepthMode == GL_INTENSITY) | ||||
|           return (MAPSURF_16BIT | MT_16BIT_I16); | ||||
|       else | ||||
|           return (MAPSURF_16BIT | MT_16BIT_L16); | ||||
|    case MESA_FORMAT_RGBA_DXT1: | ||||
|    case MESA_FORMAT_RGB_DXT1: | ||||
|       return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1); | ||||
|   | ||||
| @@ -1,349 +0,0 @@ | ||||
| /************************************************************************** | ||||
|  *  | ||||
|  * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas. | ||||
|  * All Rights Reserved. | ||||
|  *  | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the | ||||
|  * "Software"), to deal in the Software without restriction, including | ||||
|  * without limitation the rights to use, copy, modify, merge, publish, | ||||
|  * distribute, sub license, and/or sell copies of the Software, and to | ||||
|  * permit persons to whom the Software is furnished to do so, subject to | ||||
|  * the following conditions: | ||||
|  *  | ||||
|  * The above copyright notice and this permission notice (including the | ||||
|  * next paragraph) shall be included in all copies or substantial portionsalloc | ||||
|  * of the Software. | ||||
|  *  | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||
|  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||
|  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||||
|  * IN NO EVENT SHALL TUNGSTEN GRAPHICS 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. | ||||
|  *  | ||||
|  **************************************************************************/ | ||||
|  | ||||
| #include "glheader.h" | ||||
| #include "enums.h" | ||||
| #include "image.h" | ||||
| #include "colormac.h" | ||||
| #include "mtypes.h" | ||||
| #include "macros.h" | ||||
| #include "bufferobj.h" | ||||
| #include "swrast/swrast.h" | ||||
|  | ||||
| #include "intel_screen.h" | ||||
| #include "intel_context.h" | ||||
| #include "intel_ioctl.h" | ||||
| #include "intel_batchbuffer.h" | ||||
| #include "intel_blit.h" | ||||
| #include "intel_regions.h" | ||||
| #include "intel_buffer_objects.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| #define FILE_DEBUG_FLAG DEBUG_PIXEL | ||||
|  | ||||
|  | ||||
| /* Unlike the other intel_pixel_* functions, the expectation here is | ||||
|  * that the incoming data is not in a PBO.  With the XY_TEXT blit | ||||
|  * method, there's no benefit haveing it in a PBO, but we could | ||||
|  * implement a path based on XY_MONO_SRC_COPY_BLIT which might benefit | ||||
|  * PBO bitmaps.  I think they are probably pretty rare though - I | ||||
|  * wonder if Xgl uses them? | ||||
|  */ | ||||
| static const GLubyte *map_pbo( GLcontext *ctx, | ||||
| 			       GLsizei width, GLsizei height, | ||||
| 			       const struct gl_pixelstore_attrib *unpack, | ||||
| 			       const GLubyte *bitmap ) | ||||
| { | ||||
|    GLubyte *buf; | ||||
|  | ||||
|    if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, | ||||
| 				  GL_COLOR_INDEX, GL_BITMAP, | ||||
| 				  (GLvoid *) bitmap)) { | ||||
|       _mesa_error(ctx, GL_INVALID_OPERATION,"glBitmap(invalid PBO access)"); | ||||
|       return NULL; | ||||
|    } | ||||
|  | ||||
|    buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, | ||||
| 					   GL_READ_ONLY_ARB, | ||||
| 					   unpack->BufferObj); | ||||
|    if (!buf) { | ||||
|       _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); | ||||
|       return NULL; | ||||
|    } | ||||
|  | ||||
|    return ADD_POINTERS(buf, bitmap); | ||||
| } | ||||
|  | ||||
| static GLboolean test_bit( const GLubyte *src, | ||||
| 			    GLuint bit ) | ||||
| { | ||||
|    return (src[bit/8] & (1<<(bit % 8))) ? 1 : 0; | ||||
| } | ||||
|  | ||||
| static void set_bit( GLubyte *dest, | ||||
| 			  GLuint bit ) | ||||
| { | ||||
|    dest[bit/8] |= 1 << (bit % 8); | ||||
| } | ||||
|  | ||||
| static int align(int x, int align) | ||||
| { | ||||
|    return (x + align - 1) & ~(align - 1); | ||||
| } | ||||
|  | ||||
| /* Extract a rectangle's worth of data from the bitmap.  Called | ||||
|  * per-cliprect. | ||||
|  */ | ||||
| static GLuint get_bitmap_rect(GLsizei width, GLsizei height, | ||||
| 			      const struct gl_pixelstore_attrib *unpack, | ||||
| 			      const GLubyte *bitmap, | ||||
| 			      GLuint x, GLuint y,  | ||||
| 			      GLuint w, GLuint h, | ||||
| 			      GLubyte *dest, | ||||
| 			      GLuint row_align, | ||||
| 			      GLboolean invert) | ||||
| { | ||||
|    GLuint src_offset = (x + unpack->SkipPixels) & 0x7; | ||||
|    GLuint mask = unpack->LsbFirst ? 0 : 7; | ||||
|    GLuint bit = 0; | ||||
|    GLint row, col; | ||||
|    GLint first, last; | ||||
|    GLint incr; | ||||
|    GLuint count = 0; | ||||
|  | ||||
|    if (INTEL_DEBUG & DEBUG_PIXEL) | ||||
|       _mesa_printf("%s %d,%d %dx%d bitmap %dx%d skip %d src_offset %d mask %d\n", | ||||
| 		   __FUNCTION__, x,y,w,h,width,height,unpack->SkipPixels, src_offset, mask); | ||||
|  | ||||
|    if (invert) { | ||||
|       first = h-1; | ||||
|       last = 0; | ||||
|       incr = -1; | ||||
|    } | ||||
|    else { | ||||
|       first = 0; | ||||
|       last = h-1; | ||||
|       incr = 1; | ||||
|    } | ||||
|  | ||||
|    /* Require that dest be pre-zero'd. | ||||
|     */ | ||||
|    for (row = first; row != (last+incr); row += incr) { | ||||
|       const GLubyte *rowsrc = _mesa_image_address2d(unpack, bitmap,  | ||||
| 						    width, height,  | ||||
| 						    GL_COLOR_INDEX, GL_BITMAP,  | ||||
| 						    y + row, x); | ||||
|  | ||||
|       for (col = 0; col < w; col++, bit++) { | ||||
| 	 if (test_bit(rowsrc, (col + src_offset) ^ mask)) { | ||||
| 	    set_bit(dest, bit ^ 7); | ||||
| 	    count++; | ||||
| 	 } | ||||
|       } | ||||
|  | ||||
|       if (row_align) | ||||
| 	 bit = (bit + row_align - 1) & ~(row_align - 1); | ||||
|    } | ||||
|  | ||||
|    return count; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Render a bitmap. | ||||
|  */ | ||||
| static GLboolean | ||||
| do_blit_bitmap( GLcontext *ctx,  | ||||
| 		GLint dstx, GLint dsty, | ||||
| 		GLsizei width, GLsizei height, | ||||
| 		const struct gl_pixelstore_attrib *unpack, | ||||
| 		const GLubyte *bitmap ) | ||||
| { | ||||
|    struct intel_context *intel = intel_context(ctx); | ||||
|    struct intel_region *dst = intel_drawbuf_region(intel); | ||||
|     | ||||
|    union { | ||||
|       GLuint ui; | ||||
|       GLubyte ub[4]; | ||||
|    } color; | ||||
|  | ||||
|  | ||||
|    if (unpack->BufferObj->Name) { | ||||
|       bitmap = map_pbo(ctx, width, height, unpack, bitmap); | ||||
|       if (bitmap == NULL) | ||||
| 	 return GL_TRUE;	/* even though this is an error, we're done */ | ||||
|    } | ||||
|  | ||||
|    UNCLAMPED_FLOAT_TO_CHAN(color.ub[0], ctx->Current.RasterColor[2]); | ||||
|    UNCLAMPED_FLOAT_TO_CHAN(color.ub[1], ctx->Current.RasterColor[1]); | ||||
|    UNCLAMPED_FLOAT_TO_CHAN(color.ub[2], ctx->Current.RasterColor[0]); | ||||
|    UNCLAMPED_FLOAT_TO_CHAN(color.ub[3], ctx->Current.RasterColor[3]); | ||||
|  | ||||
|    /* Does zoom apply to bitmaps? | ||||
|     */ | ||||
|    if (!intel_check_blit_fragment_ops(ctx) || | ||||
|        ctx->Pixel.ZoomX != 1.0F ||  | ||||
|        ctx->Pixel.ZoomY != 1.0F) | ||||
|       return GL_FALSE; | ||||
|  | ||||
|    LOCK_HARDWARE(intel); | ||||
|  | ||||
|    if (intel->driDrawable->numClipRects) { | ||||
|       __DRIdrawablePrivate *dPriv = intel->driDrawable; | ||||
|       drm_clip_rect_t *box = dPriv->pClipRects; | ||||
|       drm_clip_rect_t dest_rect; | ||||
|       GLint nbox = dPriv->numClipRects; | ||||
|       GLint srcx = 0, srcy = 0; | ||||
|       GLint orig_screen_x1, orig_screen_y2; | ||||
|       GLuint i; | ||||
|  | ||||
|  | ||||
|       orig_screen_x1 = dPriv->x + dstx; | ||||
|       orig_screen_y2 = dPriv->y + (dPriv->h - dsty); | ||||
|  | ||||
|       /* Do scissoring in GL coordinates: | ||||
|        */ | ||||
| x      if (ctx->Scissor.Enabled) | ||||
|       { | ||||
| 	 GLint x = ctx->Scissor.X; | ||||
| 	 GLint y = ctx->Scissor.Y; | ||||
| 	 GLuint w = ctx->Scissor.Width; | ||||
| 	 GLuint h = ctx->Scissor.Height; | ||||
|  | ||||
|          if (!_mesa_clip_to_region(x, y, x+w-1, y+h-1, &dstx, &dsty, &width, &height)) | ||||
|             goto out; | ||||
|       } | ||||
|  | ||||
|       /* Convert from GL to hardware coordinates: | ||||
|        */ | ||||
|       dsty = dPriv->y + (dPriv->h - dsty - height);   | ||||
|       dstx = dPriv->x + dstx; | ||||
|  | ||||
|       dest_rect.x1 = dstx; | ||||
|       dest_rect.y1 = dsty; | ||||
|       dest_rect.x2 = dstx + width; | ||||
|       dest_rect.y2 = dsty + height; | ||||
|  | ||||
|       for (i = 0; i < nbox; i++) { | ||||
|          drm_clip_rect_t rect; | ||||
| 	 int box_w, box_h; | ||||
| 	 GLint px, py; | ||||
| 	 GLuint stipple[32];   | ||||
|  | ||||
|          if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i])) | ||||
|             continue; | ||||
|  | ||||
| 	 /* Now go back to GL coordinates to figure out what subset of | ||||
| 	  * the bitmap we are uploading for this cliprect: | ||||
| 	  */ | ||||
| 	 box_w = rect.x2 - rect.x1; | ||||
| 	 box_h = rect.y2 - rect.y1; | ||||
| 	 srcx = rect.x1 - orig_screen_x1; | ||||
| 	 srcy = orig_screen_y2 - rect.y2; | ||||
|  | ||||
|  | ||||
| #define DY 32 | ||||
| #define DX 32 | ||||
|  | ||||
| 	 /* Then, finally, chop it all into chunks that can be | ||||
| 	  * digested by hardware: | ||||
| 	  */ | ||||
| 	 for (py = 0; py < box_h; py += DY) {  | ||||
| 	    for (px = 0; px < box_w; px += DX) {  | ||||
| 	       int h = MIN2(DY, box_h - py); | ||||
| 	       int w = MIN2(DX, box_w - px);  | ||||
| 	       GLuint sz = align(align(w,8) * h, 64)/8; | ||||
| 	     | ||||
| 	       assert(sz <= sizeof(stipple)); | ||||
| 	       memset(stipple, 0, sz); | ||||
|  | ||||
| 	       /* May need to adjust this when padding has been introduced in | ||||
| 		* sz above: | ||||
| 		*/ | ||||
| 	       if (get_bitmap_rect(width, height, unpack,  | ||||
| 				   bitmap, | ||||
| 				   srcx + px, srcy + py, w, h, | ||||
| 				   (GLubyte *)stipple, | ||||
| 				   8, | ||||
| 				   GL_TRUE) == 0) | ||||
| 		  continue; | ||||
|  | ||||
| 	       /*  | ||||
| 		*/ | ||||
| 	       intelEmitImmediateColorExpandBlit( intel, | ||||
| 						  dst->cpp, | ||||
| 						  (GLubyte *)stipple,  | ||||
| 						  sz, | ||||
| 						  color.ui, | ||||
| 						  dst->pitch, | ||||
| 						  dst->buffer, | ||||
| 						  0, | ||||
| 						  dst->tiled, | ||||
| 						  rect.x1 + px, | ||||
| 						  rect.y2 - (py + h), | ||||
| 						  w, h); | ||||
| 	    }  | ||||
| 	 }  | ||||
|       } | ||||
|    out: | ||||
|       intel_batchbuffer_flush(intel->batch); | ||||
|    } | ||||
|    UNLOCK_HARDWARE(intel); | ||||
|  | ||||
|  | ||||
|    if (unpack->BufferObj->Name) { | ||||
|       /* done with PBO so unmap it now */ | ||||
|       ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, | ||||
|                               unpack->BufferObj); | ||||
|    } | ||||
|  | ||||
|    return GL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| /* There are a large number of possible ways to implement bitmap on | ||||
|  * this hardware, most of them have some sort of drawback.  Here are a | ||||
|  * few that spring to mind: | ||||
|  *  | ||||
|  * Blit: | ||||
|  *    - XY_MONO_SRC_BLT_CMD | ||||
|  *         - use XY_SETUP_CLIP_BLT for cliprect clipping. | ||||
|  *    - XY_TEXT_BLT | ||||
|  *    - XY_TEXT_IMMEDIATE_BLT | ||||
|  *         - blit per cliprect, subject to maximum immediate data size. | ||||
|  *    - XY_COLOR_BLT  | ||||
|  *         - per pixel or run of pixels | ||||
|  *    - XY_PIXEL_BLT | ||||
|  *         - good for sparse bitmaps | ||||
|  * | ||||
|  * 3D engine: | ||||
|  *    - Point per pixel | ||||
|  *    - Translate bitmap to an alpha texture and render as a quad | ||||
|  *    - Chop bitmap up into 32x32 squares and render w/polygon stipple. | ||||
|  */ | ||||
| void | ||||
| intelBitmap(GLcontext * ctx, | ||||
| 	    GLint x, GLint y, | ||||
| 	    GLsizei width, GLsizei height, | ||||
| 	    const struct gl_pixelstore_attrib *unpack, | ||||
| 	    const GLubyte * pixels) | ||||
| { | ||||
|    if (do_blit_bitmap(ctx, x, y, width, height, | ||||
|                           unpack, pixels)) | ||||
|       return; | ||||
|  | ||||
|    if (INTEL_DEBUG & DEBUG_PIXEL) | ||||
|       _mesa_printf("%s: fallback to swrast\n", __FUNCTION__); | ||||
|  | ||||
|    _swrast_Bitmap(ctx, x, y, width, height, unpack, pixels); | ||||
| } | ||||
							
								
								
									
										1
									
								
								src/mesa/drivers/dri/i915/intel_pixel_bitmap.c
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								src/mesa/drivers/dri/i915/intel_pixel_bitmap.c
									
									
									
									
									
										Symbolic link
									
								
							| @@ -0,0 +1 @@ | ||||
| ../intel/intel_pixel_bitmap.c | ||||
| @@ -19,6 +19,7 @@ DRIVER_SOURCES = \ | ||||
| 	intel_regions.c \ | ||||
| 	intel_screen.c \ | ||||
| 	intel_span.c \ | ||||
| 	intel_pixel.c \ | ||||
| 	intel_pixel_copy.c \ | ||||
| 	intel_pixel_bitmap.c \ | ||||
| 	intel_state.c \ | ||||
|   | ||||
| @@ -148,7 +148,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c ) | ||||
|    brw_clip_init_clipmask(c); | ||||
|  | ||||
|    /* -ve rhw workaround */ | ||||
|    if (!BRW_IS_IGD(p->brw)) { | ||||
|    if (!(BRW_IS_GM45(p->brw) || BRW_IS_G4X(p->brw))) { | ||||
|       brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); | ||||
|       brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2), | ||||
|               brw_imm_ud(1<<20)); | ||||
|   | ||||
| @@ -102,7 +102,7 @@ clip_unit_create_from_key(struct brw_context *brw, | ||||
|    clip.clip5.api_mode = BRW_CLIP_API_OGL; | ||||
|    clip.clip5.clip_mode = key->clip_mode; | ||||
|  | ||||
|    if (BRW_IS_IGD(brw)) | ||||
|    if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) | ||||
|       clip.clip5.negative_w_clip_test = 1; | ||||
|  | ||||
|    clip.clip6.clipper_viewport_state_ptr = 0; | ||||
|   | ||||
| @@ -536,7 +536,7 @@ void brw_emit_tri_clip( struct brw_clip_compile *c ) | ||||
|  | ||||
|    /* if -ve rhw workaround bit is set,  | ||||
|       do cliptest */ | ||||
|    if (!BRW_IS_IGD(p->brw)) { | ||||
|    if (!(BRW_IS_GM45(p->brw) || BRW_IS_G4X(p->brw))) { | ||||
|       brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); | ||||
|       brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2),  | ||||
|               brw_imm_ud(1<<20)); | ||||
|   | ||||
| @@ -65,14 +65,6 @@ static void brwInitDriverFunctions( struct dd_function_table *functions ) | ||||
| { | ||||
|    intelInitDriverFunctions( functions ); | ||||
|  | ||||
|    /* CopyPixels can be accelerated even with the current memory | ||||
|     * manager: | ||||
|     */ | ||||
|    if (!getenv("INTEL_NO_BLIT")) { | ||||
|       functions->CopyPixels = intelCopyPixels; | ||||
|       functions->Bitmap = intelBitmap; | ||||
|    } | ||||
|  | ||||
|    brwInitFragProgFuncs( functions ); | ||||
|    brwInitProgFuncs( functions ); | ||||
| } | ||||
| @@ -133,7 +125,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis, | ||||
|    ctx->Const.MaxTextureUnits = BRW_MAX_TEX_UNIT; | ||||
|    ctx->Const.MaxTextureImageUnits = BRW_MAX_TEX_UNIT; | ||||
|    ctx->Const.MaxTextureCoordUnits = BRW_MAX_TEX_UNIT; | ||||
|  | ||||
|    ctx->Const.MaxVertexTextureImageUnits = 0; /* no vertex shader textures */ | ||||
|  | ||||
|    /* Advertise the full hardware capabilities.  The new memory | ||||
|     * manager should cope much better with overload situations: | ||||
|   | ||||
| @@ -685,7 +685,7 @@ void brw_upload_constant_buffer_state(struct brw_context *brw); | ||||
|  * Inline conversion functions.  These are better-typed than the | ||||
|  * macros used previously: | ||||
|  */ | ||||
| static inline struct brw_context * | ||||
| static INLINE struct brw_context * | ||||
| brw_context( GLcontext *ctx ) | ||||
| { | ||||
|    return (struct brw_context *)ctx; | ||||
|   | ||||
| @@ -804,7 +804,7 @@ | ||||
| #define CMD_STATE_BASE_ADDRESS        0x6101 | ||||
| #define CMD_STATE_INSN_POINTER        0x6102 | ||||
| #define CMD_PIPELINE_SELECT_965       0x6104 | ||||
| #define CMD_PIPELINE_SELECT_IGD       0x6904 | ||||
| #define CMD_PIPELINE_SELECT_GM45      0x6904 | ||||
|  | ||||
| #define CMD_PIPELINED_STATE_POINTERS  0x7800 | ||||
| #define CMD_BINDING_TABLE_PTRS        0x7801 | ||||
| @@ -836,7 +836,7 @@ | ||||
|  | ||||
| #define CMD_INDEX_BUFFER              0x780a | ||||
| #define CMD_VF_STATISTICS_965         0x780b | ||||
| #define CMD_VF_STATISTICS_IGD         0x680b | ||||
| #define CMD_VF_STATISTICS_GM45        0x680b | ||||
|  | ||||
| #define CMD_DRAW_RECT                 0x7900 | ||||
| #define CMD_BLEND_CONSTANT_COLOR      0x7901 | ||||
| @@ -862,9 +862,10 @@ | ||||
|  | ||||
| #include "intel_chipset.h" | ||||
|  | ||||
| #define BRW_IS_IGD(brw)     (IS_IGD((brw)->intel.intelScreen->deviceID)) | ||||
| #define CMD_PIPELINE_SELECT(brw)       ((BRW_IS_IGD(brw)) ? CMD_PIPELINE_SELECT_IGD : CMD_PIPELINE_SELECT_965) | ||||
| #define CMD_VF_STATISTICS(brw)         ((BRW_IS_IGD(brw)) ? CMD_VF_STATISTICS_IGD : CMD_VF_STATISTICS_965) | ||||
| #define URB_SIZES(brw)                 ((BRW_IS_IGD(brw)) ? 384 : 256)  /* 512 bit unit */ | ||||
| #define BRW_IS_GM45(brw)        (IS_GM45_GM((brw)->intel.intelScreen->deviceID)) | ||||
| #define BRW_IS_G4X(brw)         (IS_G4X((brw)->intel.intelScreen->deviceID)) | ||||
| #define CMD_PIPELINE_SELECT(brw)        ((BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? CMD_PIPELINE_SELECT_GM45 : CMD_PIPELINE_SELECT_965) | ||||
| #define CMD_VF_STATISTICS(brw)          ((BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? CMD_VF_STATISTICS_GM45 : CMD_VF_STATISTICS_965) | ||||
| #define URB_SIZES(brw)                  ((BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? 384 : 256)  /* 512 bit unit */ | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -110,7 +110,7 @@ struct brw_compile { | ||||
|  | ||||
|  | ||||
|  | ||||
| static __inline int type_sz( GLuint type ) | ||||
| static INLINE int type_sz( GLuint type ) | ||||
| { | ||||
|    switch( type ) { | ||||
|    case BRW_REGISTER_TYPE_UD: | ||||
| @@ -129,7 +129,7 @@ static __inline int type_sz( GLuint type ) | ||||
|    } | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_reg( GLuint file, | ||||
| static INLINE struct brw_reg brw_reg( GLuint file, | ||||
| 					GLuint nr, | ||||
| 					GLuint subnr, | ||||
| 					GLuint type, | ||||
| @@ -166,7 +166,7 @@ static __inline struct brw_reg brw_reg( GLuint file, | ||||
|    return reg; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_vec16_reg( GLuint file, | ||||
| static INLINE struct brw_reg brw_vec16_reg( GLuint file, | ||||
| 					      GLuint nr, | ||||
| 					      GLuint subnr ) | ||||
| { | ||||
| @@ -181,7 +181,7 @@ static __inline struct brw_reg brw_vec16_reg( GLuint file, | ||||
| 		  WRITEMASK_XYZW); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_vec8_reg( GLuint file, | ||||
| static INLINE struct brw_reg brw_vec8_reg( GLuint file, | ||||
| 					     GLuint nr, | ||||
| 					     GLuint subnr ) | ||||
| { | ||||
| @@ -197,7 +197,7 @@ static __inline struct brw_reg brw_vec8_reg( GLuint file, | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline struct brw_reg brw_vec4_reg( GLuint file, | ||||
| static INLINE struct brw_reg brw_vec4_reg( GLuint file, | ||||
| 					      GLuint nr, | ||||
| 					      GLuint subnr ) | ||||
| { | ||||
| @@ -213,7 +213,7 @@ static __inline struct brw_reg brw_vec4_reg( GLuint file, | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline struct brw_reg brw_vec2_reg( GLuint file, | ||||
| static INLINE struct brw_reg brw_vec2_reg( GLuint file, | ||||
| 					      GLuint nr, | ||||
| 					      GLuint subnr ) | ||||
| { | ||||
| @@ -228,7 +228,7 @@ static __inline struct brw_reg brw_vec2_reg( GLuint file, | ||||
| 		  WRITEMASK_XY); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_vec1_reg( GLuint file, | ||||
| static INLINE struct brw_reg brw_vec1_reg( GLuint file, | ||||
| 					     GLuint nr, | ||||
| 					     GLuint subnr ) | ||||
| { | ||||
| @@ -244,14 +244,14 @@ static __inline struct brw_reg brw_vec1_reg( GLuint file, | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline struct brw_reg retype( struct brw_reg reg, | ||||
| static INLINE struct brw_reg retype( struct brw_reg reg, | ||||
| 				       GLuint type ) | ||||
| { | ||||
|    reg.type = type; | ||||
|    return reg; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg suboffset( struct brw_reg reg, | ||||
| static INLINE struct brw_reg suboffset( struct brw_reg reg, | ||||
| 					  GLuint delta ) | ||||
| {    | ||||
|    reg.subnr += delta * type_sz(reg.type); | ||||
| @@ -259,7 +259,7 @@ static __inline struct brw_reg suboffset( struct brw_reg reg, | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline struct brw_reg offset( struct brw_reg reg, | ||||
| static INLINE struct brw_reg offset( struct brw_reg reg, | ||||
| 				       GLuint delta ) | ||||
| { | ||||
|    reg.nr += delta; | ||||
| @@ -267,7 +267,7 @@ static __inline struct brw_reg offset( struct brw_reg reg, | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline struct brw_reg byte_offset( struct brw_reg reg, | ||||
| static INLINE struct brw_reg byte_offset( struct brw_reg reg, | ||||
| 					    GLuint bytes ) | ||||
| { | ||||
|    GLuint newoffset = reg.nr * REG_SIZE + reg.subnr + bytes; | ||||
| @@ -277,28 +277,28 @@ static __inline struct brw_reg byte_offset( struct brw_reg reg, | ||||
| } | ||||
|     | ||||
|  | ||||
| static __inline struct brw_reg brw_uw16_reg( GLuint file, | ||||
| static INLINE struct brw_reg brw_uw16_reg( GLuint file, | ||||
| 					     GLuint nr, | ||||
| 					     GLuint subnr ) | ||||
| { | ||||
|    return suboffset(retype(brw_vec16_reg(file, nr, 0), BRW_REGISTER_TYPE_UW), subnr); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_uw8_reg( GLuint file, | ||||
| static INLINE struct brw_reg brw_uw8_reg( GLuint file, | ||||
| 					    GLuint nr, | ||||
| 					    GLuint subnr ) | ||||
| { | ||||
|    return suboffset(retype(brw_vec8_reg(file, nr, 0), BRW_REGISTER_TYPE_UW), subnr); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_uw1_reg( GLuint file, | ||||
| static INLINE struct brw_reg brw_uw1_reg( GLuint file, | ||||
| 					    GLuint nr, | ||||
| 					    GLuint subnr ) | ||||
| { | ||||
|    return suboffset(retype(brw_vec1_reg(file, nr, 0), BRW_REGISTER_TYPE_UW), subnr); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_imm_reg( GLuint type ) | ||||
| static INLINE struct brw_reg brw_imm_reg( GLuint type ) | ||||
| { | ||||
|    return brw_reg( BRW_IMMEDIATE_VALUE, | ||||
| 		   0, | ||||
| @@ -311,35 +311,35 @@ static __inline struct brw_reg brw_imm_reg( GLuint type ) | ||||
| 		   0);       | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_imm_f( GLfloat f ) | ||||
| static INLINE struct brw_reg brw_imm_f( GLfloat f ) | ||||
| { | ||||
|    struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_F); | ||||
|    imm.dw1.f = f; | ||||
|    return imm; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_imm_d( GLint d ) | ||||
| static INLINE struct brw_reg brw_imm_d( GLint d ) | ||||
| { | ||||
|    struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_D); | ||||
|    imm.dw1.d = d; | ||||
|    return imm; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_imm_ud( GLuint ud ) | ||||
| static INLINE struct brw_reg brw_imm_ud( GLuint ud ) | ||||
| { | ||||
|    struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_UD); | ||||
|    imm.dw1.ud = ud; | ||||
|    return imm; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_imm_uw( GLushort uw ) | ||||
| static INLINE struct brw_reg brw_imm_uw( GLushort uw ) | ||||
| { | ||||
|    struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_UW); | ||||
|    imm.dw1.ud = uw | (uw << 16); | ||||
|    return imm; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_imm_w( GLshort w ) | ||||
| static INLINE struct brw_reg brw_imm_w( GLshort w ) | ||||
| { | ||||
|    struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_W); | ||||
|    imm.dw1.d = w | (w << 16); | ||||
| @@ -352,7 +352,7 @@ static __inline struct brw_reg brw_imm_w( GLshort w ) | ||||
|  | ||||
| /* Vector of eight signed half-byte values:  | ||||
|  */ | ||||
| static __inline struct brw_reg brw_imm_v( GLuint v ) | ||||
| static INLINE struct brw_reg brw_imm_v( GLuint v ) | ||||
| { | ||||
|    struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_V); | ||||
|    imm.vstride = BRW_VERTICAL_STRIDE_0; | ||||
| @@ -364,7 +364,7 @@ static __inline struct brw_reg brw_imm_v( GLuint v ) | ||||
|  | ||||
| /* Vector of four 8-bit float values: | ||||
|  */ | ||||
| static __inline struct brw_reg brw_imm_vf( GLuint v ) | ||||
| static INLINE struct brw_reg brw_imm_vf( GLuint v ) | ||||
| { | ||||
|    struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_VF); | ||||
|    imm.vstride = BRW_VERTICAL_STRIDE_0; | ||||
| @@ -378,7 +378,7 @@ static __inline struct brw_reg brw_imm_vf( GLuint v ) | ||||
| #define VF_ONE  0x30 | ||||
| #define VF_NEG  (1<<7) | ||||
|  | ||||
| static __inline struct brw_reg brw_imm_vf4( GLuint v0,  | ||||
| static INLINE struct brw_reg brw_imm_vf4( GLuint v0,  | ||||
| 					    GLuint v1,  | ||||
| 					    GLuint v2, | ||||
| 					    GLuint v3) | ||||
| @@ -395,51 +395,51 @@ static __inline struct brw_reg brw_imm_vf4( GLuint v0, | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline struct brw_reg brw_address( struct brw_reg reg ) | ||||
| static INLINE struct brw_reg brw_address( struct brw_reg reg ) | ||||
| { | ||||
|    return brw_imm_uw(reg.nr * REG_SIZE + reg.subnr); | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline struct brw_reg brw_vec1_grf( GLuint nr, | ||||
| static INLINE struct brw_reg brw_vec1_grf( GLuint nr, | ||||
| 					       GLuint subnr ) | ||||
| { | ||||
|    return brw_vec1_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_vec8_grf( GLuint nr, | ||||
| static INLINE struct brw_reg brw_vec8_grf( GLuint nr, | ||||
| 					     GLuint subnr ) | ||||
| { | ||||
|    return brw_vec8_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_vec4_grf( GLuint nr, | ||||
| static INLINE struct brw_reg brw_vec4_grf( GLuint nr, | ||||
| 					     GLuint subnr ) | ||||
| { | ||||
|    return brw_vec4_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline struct brw_reg brw_vec2_grf( GLuint nr, | ||||
| static INLINE struct brw_reg brw_vec2_grf( GLuint nr, | ||||
| 					     GLuint subnr ) | ||||
| { | ||||
|    return brw_vec2_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_uw8_grf( GLuint nr, | ||||
| static INLINE struct brw_reg brw_uw8_grf( GLuint nr, | ||||
| 					    GLuint subnr ) | ||||
| { | ||||
|    return brw_uw8_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_null_reg( void ) | ||||
| static INLINE struct brw_reg brw_null_reg( void ) | ||||
| { | ||||
|    return brw_vec8_reg(BRW_ARCHITECTURE_REGISTER_FILE,  | ||||
| 		       BRW_ARF_NULL,  | ||||
| 		       0); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_address_reg( GLuint subnr ) | ||||
| static INLINE struct brw_reg brw_address_reg( GLuint subnr ) | ||||
| { | ||||
|    return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE,  | ||||
| 		      BRW_ARF_ADDRESS,  | ||||
| @@ -450,7 +450,7 @@ static __inline struct brw_reg brw_address_reg( GLuint subnr ) | ||||
|  * aren't xyzw.  This goes against the convention for other scalar | ||||
|  * regs: | ||||
|  */ | ||||
| static __inline struct brw_reg brw_ip_reg( void ) | ||||
| static INLINE struct brw_reg brw_ip_reg( void ) | ||||
| { | ||||
|    return brw_reg(BRW_ARCHITECTURE_REGISTER_FILE,  | ||||
| 		  BRW_ARF_IP,  | ||||
| @@ -463,7 +463,7 @@ static __inline struct brw_reg brw_ip_reg( void ) | ||||
| 		  WRITEMASK_XYZW); /* NOTE! */ | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_acc_reg( void ) | ||||
| static INLINE struct brw_reg brw_acc_reg( void ) | ||||
| { | ||||
|    return brw_vec8_reg(BRW_ARCHITECTURE_REGISTER_FILE,  | ||||
| 		       BRW_ARF_ACCUMULATOR,  | ||||
| @@ -471,7 +471,7 @@ static __inline struct brw_reg brw_acc_reg( void ) | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline struct brw_reg brw_flag_reg( void ) | ||||
| static INLINE struct brw_reg brw_flag_reg( void ) | ||||
| { | ||||
|    return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE, | ||||
| 		      BRW_ARF_FLAG, | ||||
| @@ -479,14 +479,14 @@ static __inline struct brw_reg brw_flag_reg( void ) | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline struct brw_reg brw_mask_reg( GLuint subnr ) | ||||
| static INLINE struct brw_reg brw_mask_reg( GLuint subnr ) | ||||
| { | ||||
|    return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE, | ||||
| 		      BRW_ARF_MASK, | ||||
| 		      subnr); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_message_reg( GLuint nr ) | ||||
| static INLINE struct brw_reg brw_message_reg( GLuint nr ) | ||||
| { | ||||
|    return brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, | ||||
| 		       nr, | ||||
| @@ -499,7 +499,7 @@ static __inline struct brw_reg brw_message_reg( GLuint nr ) | ||||
| /* This is almost always called with a numeric constant argument, so | ||||
|  * make things easy to evaluate at compile time: | ||||
|  */ | ||||
| static __inline GLuint cvt( GLuint val ) | ||||
| static INLINE GLuint cvt( GLuint val ) | ||||
| { | ||||
|    switch (val) { | ||||
|    case 0: return 0; | ||||
| @@ -513,7 +513,7 @@ static __inline GLuint cvt( GLuint val ) | ||||
|    return 0; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg stride( struct brw_reg reg, | ||||
| static INLINE struct brw_reg stride( struct brw_reg reg, | ||||
| 				       GLuint vstride, | ||||
| 				       GLuint width, | ||||
| 				       GLuint hstride ) | ||||
| @@ -525,43 +525,43 @@ static __inline struct brw_reg stride( struct brw_reg reg, | ||||
|    return reg; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg vec16( struct brw_reg reg ) | ||||
| static INLINE struct brw_reg vec16( struct brw_reg reg ) | ||||
| { | ||||
|    return stride(reg, 16,16,1); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg vec8( struct brw_reg reg ) | ||||
| static INLINE struct brw_reg vec8( struct brw_reg reg ) | ||||
| { | ||||
|    return stride(reg, 8,8,1); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg vec4( struct brw_reg reg ) | ||||
| static INLINE struct brw_reg vec4( struct brw_reg reg ) | ||||
| { | ||||
|    return stride(reg, 4,4,1); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg vec2( struct brw_reg reg ) | ||||
| static INLINE struct brw_reg vec2( struct brw_reg reg ) | ||||
| { | ||||
|    return stride(reg, 2,2,1); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg vec1( struct brw_reg reg ) | ||||
| static INLINE struct brw_reg vec1( struct brw_reg reg ) | ||||
| { | ||||
|    return stride(reg, 0,1,0); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg get_element( struct brw_reg reg, GLuint elt ) | ||||
| static INLINE struct brw_reg get_element( struct brw_reg reg, GLuint elt ) | ||||
| { | ||||
|    return vec1(suboffset(reg, elt)); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg get_element_ud( struct brw_reg reg, GLuint elt ) | ||||
| static INLINE struct brw_reg get_element_ud( struct brw_reg reg, GLuint elt ) | ||||
| { | ||||
|    return vec1(suboffset(retype(reg, BRW_REGISTER_TYPE_UD), elt)); | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline struct brw_reg brw_swizzle( struct brw_reg reg, | ||||
| static INLINE struct brw_reg brw_swizzle( struct brw_reg reg, | ||||
| 					    GLuint x, | ||||
| 					    GLuint y,  | ||||
| 					    GLuint z, | ||||
| @@ -575,33 +575,33 @@ static __inline struct brw_reg brw_swizzle( struct brw_reg reg, | ||||
| } | ||||
|  | ||||
|  | ||||
| static __inline struct brw_reg brw_swizzle1( struct brw_reg reg, | ||||
| static INLINE struct brw_reg brw_swizzle1( struct brw_reg reg, | ||||
| 					     GLuint x ) | ||||
| { | ||||
|    return brw_swizzle(reg, x, x, x, x); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_writemask( struct brw_reg reg, | ||||
| static INLINE struct brw_reg brw_writemask( struct brw_reg reg, | ||||
| 					      GLuint mask ) | ||||
| { | ||||
|    reg.dw1.bits.writemask &= mask; | ||||
|    return reg; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_set_writemask( struct brw_reg reg, | ||||
| static INLINE struct brw_reg brw_set_writemask( struct brw_reg reg, | ||||
| 						  GLuint mask ) | ||||
| { | ||||
|    reg.dw1.bits.writemask = mask; | ||||
|    return reg; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg negate( struct brw_reg reg ) | ||||
| static INLINE struct brw_reg negate( struct brw_reg reg ) | ||||
| { | ||||
|    reg.negate ^= 1; | ||||
|    return reg; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_abs( struct brw_reg reg ) | ||||
| static INLINE struct brw_reg brw_abs( struct brw_reg reg ) | ||||
| { | ||||
|    reg.abs = 1; | ||||
|    return reg; | ||||
| @@ -609,7 +609,7 @@ static __inline struct brw_reg brw_abs( struct brw_reg reg ) | ||||
|  | ||||
| /*********************************************************************** | ||||
|  */ | ||||
| static __inline struct brw_reg brw_vec4_indirect( GLuint subnr, | ||||
| static INLINE struct brw_reg brw_vec4_indirect( GLuint subnr, | ||||
| 						  GLint offset ) | ||||
| { | ||||
|    struct brw_reg reg =  brw_vec4_grf(0, 0); | ||||
| @@ -619,7 +619,7 @@ static __inline struct brw_reg brw_vec4_indirect( GLuint subnr, | ||||
|    return reg; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg brw_vec1_indirect( GLuint subnr, | ||||
| static INLINE struct brw_reg brw_vec1_indirect( GLuint subnr, | ||||
| 						  GLint offset ) | ||||
| { | ||||
|    struct brw_reg reg =  brw_vec1_grf(0, 0); | ||||
| @@ -629,48 +629,48 @@ static __inline struct brw_reg brw_vec1_indirect( GLuint subnr, | ||||
|    return reg; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg deref_4f(struct brw_indirect ptr, GLint offset) | ||||
| static INLINE struct brw_reg deref_4f(struct brw_indirect ptr, GLint offset) | ||||
| { | ||||
|    return brw_vec4_indirect(ptr.addr_subnr, ptr.addr_offset + offset); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg deref_1f(struct brw_indirect ptr, GLint offset) | ||||
| static INLINE struct brw_reg deref_1f(struct brw_indirect ptr, GLint offset) | ||||
| { | ||||
|    return brw_vec1_indirect(ptr.addr_subnr, ptr.addr_offset + offset); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg deref_4b(struct brw_indirect ptr, GLint offset) | ||||
| static INLINE struct brw_reg deref_4b(struct brw_indirect ptr, GLint offset) | ||||
| { | ||||
|    return retype(deref_4f(ptr, offset), BRW_REGISTER_TYPE_B); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg deref_1uw(struct brw_indirect ptr, GLint offset) | ||||
| static INLINE struct brw_reg deref_1uw(struct brw_indirect ptr, GLint offset) | ||||
| { | ||||
|    return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_UW); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg deref_1d(struct brw_indirect ptr, GLint offset) | ||||
| static INLINE struct brw_reg deref_1d(struct brw_indirect ptr, GLint offset) | ||||
| { | ||||
|    return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_D); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg deref_1ud(struct brw_indirect ptr, GLint offset) | ||||
| static INLINE struct brw_reg deref_1ud(struct brw_indirect ptr, GLint offset) | ||||
| { | ||||
|    return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_UD); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_reg get_addr_reg(struct brw_indirect ptr) | ||||
| static INLINE struct brw_reg get_addr_reg(struct brw_indirect ptr) | ||||
| { | ||||
|    return brw_address_reg(ptr.addr_subnr); | ||||
| } | ||||
|  | ||||
| static __inline struct brw_indirect brw_indirect_offset( struct brw_indirect ptr, GLint offset ) | ||||
| static INLINE struct brw_indirect brw_indirect_offset( struct brw_indirect ptr, GLint offset ) | ||||
| { | ||||
|    ptr.addr_offset += offset; | ||||
|    return ptr; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_indirect brw_indirect( GLuint addr_subnr, GLint offset ) | ||||
| static INLINE struct brw_indirect brw_indirect( GLuint addr_subnr, GLint offset ) | ||||
| { | ||||
|    struct brw_indirect ptr; | ||||
|    ptr.addr_subnr = addr_subnr; | ||||
| @@ -679,7 +679,7 @@ static __inline struct brw_indirect brw_indirect( GLuint addr_subnr, GLint offse | ||||
|    return ptr; | ||||
| } | ||||
|  | ||||
| static __inline struct brw_instruction *current_insn( struct brw_compile *p) | ||||
| static INLINE struct brw_instruction *current_insn( struct brw_compile *p) | ||||
| { | ||||
| 	return &p->store[p->nr_insn]; | ||||
| } | ||||
|   | ||||
| @@ -329,14 +329,14 @@ static void brw_set_sampler_message(struct brw_context *brw, | ||||
| { | ||||
|    brw_set_src1(insn, brw_imm_d(0)); | ||||
|  | ||||
|    if (BRW_IS_IGD(brw)) { | ||||
|       insn->bits3.sampler_igd.binding_table_index = binding_table_index; | ||||
|       insn->bits3.sampler_igd.sampler = sampler; | ||||
|       insn->bits3.sampler_igd.msg_type = msg_type; | ||||
|       insn->bits3.sampler_igd.response_length = response_length; | ||||
|       insn->bits3.sampler_igd.msg_length = msg_length; | ||||
|       insn->bits3.sampler_igd.end_of_thread = eot; | ||||
|       insn->bits3.sampler_igd.msg_target = BRW_MESSAGE_TARGET_SAMPLER; | ||||
|    if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) { | ||||
|       insn->bits3.sampler_gm45_g4x.binding_table_index = binding_table_index; | ||||
|       insn->bits3.sampler_gm45_g4x.sampler = sampler; | ||||
|       insn->bits3.sampler_gm45_g4x.msg_type = msg_type; | ||||
|       insn->bits3.sampler_gm45_g4x.response_length = response_length; | ||||
|       insn->bits3.sampler_gm45_g4x.msg_length = msg_length; | ||||
|       insn->bits3.sampler_gm45_g4x.end_of_thread = eot; | ||||
|       insn->bits3.sampler_gm45_g4x.msg_target = BRW_MESSAGE_TARGET_SAMPLER; | ||||
|    } else { | ||||
|       insn->bits3.sampler.binding_table_index = binding_table_index; | ||||
|       insn->bits3.sampler.sampler = sampler; | ||||
|   | ||||
| @@ -192,7 +192,7 @@ static void emit_depthbuffer(struct brw_context *brw) | ||||
| { | ||||
|    struct intel_context *intel = &brw->intel; | ||||
|    struct intel_region *region = brw->state.depth_region; | ||||
|    unsigned int len = BRW_IS_IGD(brw) ? sizeof(struct brw_depthbuffer_igd) / 4 : sizeof(struct brw_depthbuffer) / 4; | ||||
|    unsigned int len = (BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? sizeof(struct brw_depthbuffer_gm45_g4x) / 4 : sizeof(struct brw_depthbuffer) / 4; | ||||
|  | ||||
|    if (region == NULL) { | ||||
|       BEGIN_BATCH(len, IGNORE_CLIPRECTS); | ||||
| @@ -203,7 +203,7 @@ static void emit_depthbuffer(struct brw_context *brw) | ||||
|       OUT_BATCH(0); | ||||
|       OUT_BATCH(0); | ||||
|  | ||||
|       if (BRW_IS_IGD(brw)) | ||||
|       if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) | ||||
|          OUT_BATCH(0); | ||||
|  | ||||
|       ADVANCE_BATCH(); | ||||
| @@ -239,7 +239,7 @@ static void emit_depthbuffer(struct brw_context *brw) | ||||
| 		((region->height - 1) << 19)); | ||||
|       OUT_BATCH(0); | ||||
|  | ||||
|       if (BRW_IS_IGD(brw)) | ||||
|       if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) | ||||
|          OUT_BATCH(0); | ||||
|  | ||||
|       ADVANCE_BATCH(); | ||||
| @@ -324,7 +324,7 @@ static void upload_aa_line_parameters(struct brw_context *brw) | ||||
| { | ||||
|    struct brw_aa_line_parameters balp; | ||||
|     | ||||
|    if (!BRW_IS_IGD(brw)) | ||||
|    if (!(BRW_IS_GM45(brw) || BRW_IS_G4X(brw))) | ||||
|       return; | ||||
|  | ||||
|    /* use legacy aa line coverage computation */ | ||||
|   | ||||
| @@ -175,7 +175,7 @@ struct brw_depthbuffer | ||||
|    } dword4; | ||||
| }; | ||||
|  | ||||
| struct brw_depthbuffer_igd | ||||
| struct brw_depthbuffer_gm45_g4x | ||||
| { | ||||
|    union header_union header; | ||||
|     | ||||
| @@ -1405,7 +1405,7 @@ struct brw_instruction | ||||
|          GLuint msg_target:4; | ||||
|          GLuint pad1:3; | ||||
|          GLuint end_of_thread:1; | ||||
|       } sampler_igd;  | ||||
|       } sampler_gm45_g4x;  | ||||
|  | ||||
|       struct brw_urb_immediate urb; | ||||
|  | ||||
|   | ||||
| @@ -867,7 +867,7 @@ static void emit_vertex_write( struct brw_vs_compile *c) | ||||
|        * Later, clipping will detect ucp[6] and ensure the primitive is | ||||
|        * clipped against all fixed planes. | ||||
|        */ | ||||
|       if (!BRW_IS_IGD(p->brw) && !c->key.know_w_is_one) { | ||||
|       if (!(BRW_IS_GM45(p->brw) || BRW_IS_G4X(p->brw)) && !c->key.know_w_is_one) { | ||||
| 	 brw_CMP(p, | ||||
| 		 vec8(brw_null_reg()), | ||||
| 		 BRW_CONDITIONAL_L, | ||||
|   | ||||
| @@ -39,7 +39,7 @@ | ||||
| /* Not quite sure how correct this is - need to understand horiz | ||||
|  * vs. vertical strides a little better. | ||||
|  */ | ||||
| static __inline struct brw_reg sechalf( struct brw_reg reg ) | ||||
| static INLINE struct brw_reg sechalf( struct brw_reg reg ) | ||||
| { | ||||
|    if (reg.vstride) | ||||
|       reg.nr++; | ||||
|   | ||||
| @@ -737,7 +737,8 @@ static void precalc_tex( struct brw_wm_compile *c, | ||||
|       release_temp(c, tmp); | ||||
|    } | ||||
|  | ||||
|    if (inst->TexSrcTarget == GL_TEXTURE_RECTANGLE_NV)  | ||||
|    if ((inst->TexSrcTarget == TEXTURE_RECT_INDEX) || | ||||
|        (inst->TexSrcTarget == TEXTURE_CUBE_INDEX)) | ||||
|       release_temp(c, tmpcoord); | ||||
| } | ||||
|  | ||||
| @@ -1019,7 +1020,11 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) | ||||
|       case OPCODE_LIT: | ||||
| 	 precalc_lit(c, inst); | ||||
| 	 break; | ||||
|       | ||||
|  | ||||
|       case OPCODE_TEX: | ||||
| 	 precalc_tex(c, inst); | ||||
| 	 break; | ||||
|  | ||||
|       case OPCODE_TXP: | ||||
| 	 precalc_txp(c, inst); | ||||
| 	 break; | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user