Compare commits
80 Commits
mesa_6_3_1
...
mesa_6_3_2
Author | SHA1 | Date | |
---|---|---|---|
|
eacd347fce | ||
|
8fcd1e0287 | ||
|
2ae5645115 | ||
|
b7c727e500 | ||
|
d912f6cfe3 | ||
|
f7eb54a12f | ||
|
e0029b33ef | ||
|
ab5be2c5f7 | ||
|
61ac29e7c6 | ||
|
b462855c24 | ||
|
e918bac8cd | ||
|
aa2a357bae | ||
|
05fe2871e3 | ||
|
926a19e108 | ||
|
160b3284dd | ||
|
c2c2600728 | ||
|
7a362deb8c | ||
|
a3dd6efb00 | ||
|
dabec11d27 | ||
|
69dc32cfac | ||
|
33f9c98aa6 | ||
|
6fe7a0dc01 | ||
|
f2876d1ee3 | ||
|
fbcc5aedf2 | ||
|
4c4e4bfa4e | ||
|
ac7c147aaf | ||
|
b7ae3e4787 | ||
|
82dfd4b71f | ||
|
ac887d4211 | ||
|
967b006f51 | ||
|
1b8d0f149e | ||
|
8c9cd63c89 | ||
|
63c9ebeaff | ||
|
6b563bda43 | ||
|
5d40169436 | ||
|
738c9a073f | ||
|
258f005c6b | ||
|
c91720fb1a | ||
|
d2e289c70f | ||
|
e78a3c42e4 | ||
|
a1a6fa2fa1 | ||
|
ecde87054c | ||
|
24d55a1145 | ||
|
aba4864a25 | ||
|
7bf08c23fd | ||
|
63dffa4e77 | ||
|
da0c5b2e2c | ||
|
0d942b740c | ||
|
ac54de021a | ||
|
ae4e58c9ab | ||
|
81b3c5e85c | ||
|
f1a261377f | ||
|
8e653f12bc | ||
|
bf54a28384 | ||
|
9a4dbf1cff | ||
|
7e5da5d526 | ||
|
94a4eb1e78 | ||
|
b8731903df | ||
|
23a4f50c5b | ||
|
6965f2cb0a | ||
|
928218a283 | ||
|
6bc24c5c05 | ||
|
126c89e35f | ||
|
33f5e47faf | ||
|
485528f2ac | ||
|
b507bd4160 | ||
|
711555d1e3 | ||
|
7f5925d57c | ||
|
7adcedcd54 | ||
|
29206ae569 | ||
|
dc6e2c778a | ||
|
4508bcc72c | ||
|
a7d4bfed8a | ||
|
4ce390b933 | ||
|
df68d11b47 | ||
|
82e3ecf413 | ||
|
f7c9eafa85 | ||
|
68679d2b9e | ||
|
960467443e | ||
|
14fa5f6a60 |
11
Makefile
11
Makefile
@@ -89,6 +89,7 @@ linux-dri \
|
||||
linux-dri-x86 \
|
||||
linux-dri-x86-64 \
|
||||
linux-dri-ppc \
|
||||
linux-indirect \
|
||||
linux-fbdev \
|
||||
linux-glide \
|
||||
linux-icc \
|
||||
@@ -133,9 +134,9 @@ ultrix-gcc:
|
||||
|
||||
# Rules for making release tarballs
|
||||
|
||||
DIRECTORY = Mesa-6.3.1
|
||||
LIB_NAME = MesaLib-6.3.1
|
||||
DEMO_NAME = MesaDemos-6.3.1
|
||||
DIRECTORY = Mesa-6.3.2
|
||||
LIB_NAME = MesaLib-6.3.2
|
||||
DEMO_NAME = MesaDemos-6.3.2
|
||||
|
||||
MAIN_FILES = \
|
||||
$(DIRECTORY)/Makefile* \
|
||||
@@ -151,8 +152,9 @@ MAIN_FILES = \
|
||||
$(DIRECTORY)/docs/VERSIONS \
|
||||
$(DIRECTORY)/docs/*.spec \
|
||||
$(DIRECTORY)/include/GL/internal/glcore.h \
|
||||
$(DIRECTORY)/include/GL/dmesa.h \
|
||||
$(DIRECTORY)/include/GL/amesa.h \
|
||||
$(DIRECTORY)/include/GL/dmesa.h \
|
||||
$(DIRECTORY)/include/GL/directfbgl.h \
|
||||
$(DIRECTORY)/include/GL/fxmesa.h \
|
||||
$(DIRECTORY)/include/GL/ggimesa.h \
|
||||
$(DIRECTORY)/include/GL/gl.h \
|
||||
@@ -269,7 +271,6 @@ DRI_FILES = \
|
||||
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po \
|
||||
$(DIRECTORY)/src/mesa/drivers/dri/dri_client/imports/*.h \
|
||||
$(DIRECTORY)/src/mesa/drivers/dri/*/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/drivers/dri/*/depend \
|
||||
$(DIRECTORY)/src/mesa/drivers/dri/*/Makefile \
|
||||
$(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile \
|
||||
$(DIRECTORY)/src/mesa/drivers/dri/*/server/*.[ch]
|
||||
|
55
bin/mklib
55
bin/mklib
@@ -25,31 +25,6 @@
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
function usage()
|
||||
{
|
||||
echo 'Usage: mklib [options] objects'
|
||||
echo 'Create a shared library from object files.'
|
||||
echo ' -o LIBRARY specifies the name of the resulting library, without'
|
||||
echo ' the leading "lib" or any suffix.'
|
||||
echo ' (eg: "-o GL" might result in "libGL.so" being made)'
|
||||
echo ' -major N specifies major version number (default is 1)'
|
||||
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 ' -linker L explicity specify the linker program to use (eg: gcc, g++)'
|
||||
echo ' Not observed on all systems at this time.'
|
||||
echo ' -cplusplus link with C++ runtime'
|
||||
echo ' -static make a static library (default is dynamic/shared)'
|
||||
echo ' -install DIR put resulting library file(s) in DIR'
|
||||
echo ' -arch ARCH override using `uname` to determine host system'
|
||||
echo ' -archopt OPT specify an extra achitecture-specific option OPT'
|
||||
echo " -noprefix don't prefix library name with 'lib' nor add any suffix"
|
||||
echo ' -exports FILE only export the symbols listed in FILE'
|
||||
echo ' -h, --help display this information and exit'
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Option defaults
|
||||
#
|
||||
@@ -75,7 +50,26 @@ while true
|
||||
do
|
||||
case $1 in
|
||||
'-h' | '--help')
|
||||
usage;
|
||||
echo 'Usage: mklib [options] objects'
|
||||
echo 'Create a shared library from object files.'
|
||||
echo ' -o LIBRARY specifies the name of the resulting library, without'
|
||||
echo ' the leading "lib" or any suffix.'
|
||||
echo ' (eg: "-o GL" might result in "libGL.so" being made)'
|
||||
echo ' -major N specifies major version number (default is 1)'
|
||||
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 ' -linker L explicity specify the linker program to use (eg: gcc, g++)'
|
||||
echo ' Not observed on all systems at this time.'
|
||||
echo ' -cplusplus link with C++ runtime'
|
||||
echo ' -static make a static library (default is dynamic/shared)'
|
||||
echo ' -install DIR put resulting library file(s) in DIR'
|
||||
echo ' -arch ARCH override using `uname` to determine host system'
|
||||
echo ' -archopt OPT specify an extra achitecture-specific option OPT'
|
||||
echo " -noprefix don't prefix library name with 'lib' nor add any suffix"
|
||||
echo ' -exports FILE only export the symbols listed in FILE'
|
||||
echo ' -h, --help display this information and exit'
|
||||
exit 1
|
||||
;;
|
||||
'-o')
|
||||
@@ -198,6 +192,15 @@ case $ARCH in
|
||||
echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}
|
||||
#OPTS="-shared -Wl,-soname,${LIBNAME}" # soname???
|
||||
OPTS="-shared"
|
||||
|
||||
# Check if objects are 32-bit and we're running in 64-bit
|
||||
# environment. If so, pass -m32 flag to linker.
|
||||
set ${OBJECTS}
|
||||
ABI32=`file $1 | grep 32-bit`
|
||||
if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then
|
||||
OPTS="-m32 ${OPTS}"
|
||||
fi
|
||||
|
||||
rm -f ${LIBNAME}
|
||||
# make lib
|
||||
${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
|
||||
|
@@ -8,9 +8,9 @@ CONFIG_NAME = default
|
||||
# Version info
|
||||
MESA_MAJOR=6
|
||||
MESA_MINOR=3
|
||||
MESA_TINY=1
|
||||
MESA_TINY=2
|
||||
|
||||
# external projects
|
||||
# external projects. This should be useless now that we use libdrm.
|
||||
DRM_SOURCE_PATH=$(TOP)/../drm
|
||||
|
||||
# Compiler and flags
|
||||
|
@@ -12,8 +12,9 @@ WARN_FLAGS = -Wall
|
||||
OPT_FLAGS = -O
|
||||
|
||||
EXPAT_INCLUDES = -I/usr/local/include
|
||||
X11_INCLUDES = -I/usr/X11R6/include -I/usr/X11R6/include/X11/extensions
|
||||
DEFINES = -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER
|
||||
X11_INCLUDES = -I/usr/X11R6/include
|
||||
DEFINES = -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
|
||||
-DGLX_DIRECT_RENDERING -DHAVE_ALIAS
|
||||
CFLAGS = $(DEFINES) -Wmissing-prototypes -g -std=c99 -Wundef -fPIC \
|
||||
-ffast-math $(X11_INCLUDES)
|
||||
CXXFLAGS = $(DEFINES) -Wall -g -ansi -pedantic -fPIC
|
||||
@@ -21,8 +22,9 @@ CXXFLAGS = $(DEFINES) -Wall -g -ansi -pedantic -fPIC
|
||||
ASM_SOURCES =
|
||||
|
||||
# Library/program dependencies
|
||||
DRI_LIB_DEPS = -L/usr/local/lib -lm -lpthread -lexpat
|
||||
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread
|
||||
LIBDRM_LIB = `pkg-config --libs libdrm` -ldrm
|
||||
DRI_LIB_DEPS = -L/usr/local/lib -lm -lpthread -lexpat $(LIBDRM_LIB)
|
||||
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread $(LIBDRM_LIB)
|
||||
|
||||
GLUT_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
|
||||
GLW_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -lGL -lXt -lXm -lX11
|
||||
@@ -38,6 +40,6 @@ DRM_SOURCE_PATH=$(TOP)/../drm
|
||||
|
||||
# ffb and gamma are missing because they have not been converted to use the new
|
||||
# interface.
|
||||
DRI_DIRS = dri_client i810 i830 i915 mach64 mga r128 r200 r300 radeon tdfx \
|
||||
DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 r300 radeon tdfx \
|
||||
unichrome savage sis
|
||||
|
||||
|
@@ -22,9 +22,10 @@ ARCH_FLAGS ?=
|
||||
|
||||
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
|
||||
-D_BSD_SOURCE -D_GNU_SOURCE \
|
||||
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER
|
||||
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
|
||||
-DGLX_DIRECT_RENDERING -DHAVE_ALIAS
|
||||
|
||||
X11_INCLUDES = -I/usr/X11R6/include -I/usr/X11R6/include/X11/extensions
|
||||
X11_INCLUDES = -I/usr/X11R6/include
|
||||
|
||||
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
|
||||
$(ASM_FLAGS) -std=c99 -ffast-math
|
||||
@@ -37,17 +38,31 @@ ASM_SOURCES =
|
||||
# Library/program dependencies
|
||||
EXTRA_LIB_PATH=-L/usr/X11R6/lib
|
||||
|
||||
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl
|
||||
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl
|
||||
LIBDRM_LIB = `pkg-config --libs libdrm` -ldrm
|
||||
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
|
||||
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \
|
||||
$(LIBDRM_LIB)
|
||||
|
||||
|
||||
# This is now 0 by default since it seems to confuse the hell out of people
|
||||
# and generate a lot of extra noise on bugzilla. If you need to build with
|
||||
# EGL, do 'make linux-dri USING_EGL=1'
|
||||
|
||||
USING_EGL=0
|
||||
|
||||
# Directories
|
||||
ifeq ($(USING_EGL), 1)
|
||||
SRC_DIRS = egl glx/x11 mesa glu glut/glx glw
|
||||
PROGRAM_DIRS = egl
|
||||
else
|
||||
SRC_DIRS = glx/x11 mesa glu glut/glx glw
|
||||
PROGRAM_DIRS =
|
||||
endif
|
||||
|
||||
DRIVER_DIRS = dri
|
||||
PROGRAM_DIRS =
|
||||
WINDOW_SYSTEM=dri
|
||||
|
||||
# gamma are missing because they have not been converted to use the new
|
||||
# interface.
|
||||
DRI_DIRS = dri_client i810 i830 i915 mach64 mga r128 r200 r300 radeon s3v \
|
||||
DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 r300 radeon s3v \
|
||||
savage sis tdfx trident unichrome ffb
|
||||
|
@@ -13,5 +13,5 @@ ASM_SOURCES = $(PPC_SOURCES)
|
||||
|
||||
# Build only the drivers for cards that exist on PowerPC. At some point MGA
|
||||
# will be added, but not yet.
|
||||
DRI_DIRS = dri_client mach64 r128 r200 radeon tdfx
|
||||
DRI_DIRS = mach64 r128 r200 r300 radeon tdfx
|
||||
|
||||
|
@@ -19,5 +19,5 @@ EXTRA_LIB_PATH=-L/usr/X11R6/lib64
|
||||
# the new interface. i810 and i830 are missing because there is no x86-64
|
||||
# system where they could *ever* be used.
|
||||
#
|
||||
DRI_DIRS = dri_client i915 mach64 mga r128 r200 radeon tdfx unichrome savage
|
||||
DRI_DIRS = i915 mach64 mga r128 r200 radeon tdfx unichrome savage r300
|
||||
|
||||
|
49
configs/linux-indirect
Normal file
49
configs/linux-indirect
Normal file
@@ -0,0 +1,49 @@
|
||||
# -*-makefile-*-
|
||||
# Configuration for linux-indirect: Builds a libGL capable of indirect
|
||||
# rendering, but *NOT* capable of direct rendering.
|
||||
|
||||
include $(TOP)/configs/default
|
||||
|
||||
CONFIG_NAME = linux-dri
|
||||
|
||||
# Compiler and flags
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
|
||||
MKDEP = /usr/X11R6/bin/makedepend
|
||||
#MKDEP = gcc -M
|
||||
#MKDEP_OPTIONS = -MF depend
|
||||
|
||||
WARN_FLAGS = -Wall
|
||||
OPT_FLAGS = -O -g
|
||||
PIC_FLAGS = -fPIC
|
||||
|
||||
# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
|
||||
ARCH_FLAGS ?=
|
||||
|
||||
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
|
||||
-D_BSD_SOURCE -D_GNU_SOURCE \
|
||||
-DPTHREADS -DHAVE_ALIAS
|
||||
|
||||
X11_INCLUDES = -I/usr/X11R6/include
|
||||
|
||||
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
|
||||
$(ASM_FLAGS) -std=c99 -ffast-math
|
||||
|
||||
CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
|
||||
|
||||
|
||||
ASM_SOURCES =
|
||||
|
||||
# Library/program dependencies
|
||||
EXTRA_LIB_PATH=-L/usr/X11R6/lib
|
||||
|
||||
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl
|
||||
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl
|
||||
|
||||
|
||||
# Directories
|
||||
SRC_DIRS = glx/x11 glu glut/glx glw
|
||||
DRIVER_DIRS =
|
||||
PROGRAM_DIRS =
|
||||
WINDOW_SYSTEM=dri
|
@@ -28,16 +28,16 @@ CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
|
||||
ASM_SOURCES =
|
||||
|
||||
# Library/program dependencies
|
||||
DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl -L$(LIB_DIR) -lEGL -l$(GL_LIB)
|
||||
DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl -L$(LIB_DIR)
|
||||
GL_LIB_DEPS = -lm -lpthread -ldl
|
||||
GLU_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -lm
|
||||
GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
|
||||
APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lpthread
|
||||
|
||||
# Directories
|
||||
SRC_DIRS = egl mesa glx/mini glu glut/mini
|
||||
SRC_DIRS = glx/mini mesa glu glut/mini
|
||||
DRIVER_DIRS = dri
|
||||
PROGRAM_DIRS = miniglx egl
|
||||
PROGRAM_DIRS = miniglx
|
||||
|
||||
#DRI_DIRS = ffb gamma sis savage
|
||||
DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 radeon tdfx unichrome fb
|
||||
|
37
docs/RELNOTES-6.3.2
Normal file
37
docs/RELNOTES-6.3.2
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
Mesa 6.3.2 Release Notes
|
||||
|
||||
August 19, 2005
|
||||
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Mesa uses an even/odd version number scheme like the Linux kernel.
|
||||
Odd numbered versions (such as 6.3) designate new developmental releases.
|
||||
Even numbered versions (such as 6.2) designate stable releases.
|
||||
|
||||
|
||||
6.3.2 is primarily a bug-fix release. See the VERSIONS file for details.
|
||||
|
||||
|
||||
|
||||
Driver Status
|
||||
---------------------- ----------------------
|
||||
DRI drivers varies with the driver
|
||||
XMesa (Xlib) implements OpenGL 1.5
|
||||
OSMesa (off-screen) implements OpenGL 1.5
|
||||
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
|
||||
SVGA implements OpenGL 1.3
|
||||
Wind River UGL implements OpenGL 1.3
|
||||
Windows/Win32 implements OpenGL 1.5
|
||||
DJGPP implements OpenGL 1.5
|
||||
GGI implements OpenGL 1.3
|
||||
BeOS implements OpenGL 1.5
|
||||
Allegro needs updating
|
||||
D3D needs updating
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: RELNOTES-6.3.2,v 3.2 2005/08/19 16:57:50 brianp Exp $
|
@@ -1352,10 +1352,23 @@ Mesa Version History
|
||||
- fixed a few Darwin compilation problems
|
||||
|
||||
|
||||
6.3.1 July XX, 2005
|
||||
6.3.1
|
||||
This was an intermediate release for X.org which wasn't otherwise released.
|
||||
|
||||
|
||||
6.3.2 August 19, 2005
|
||||
New:
|
||||
- The distribution now includes the DRI drivers and GLX code
|
||||
Changes:
|
||||
- Made the DRI "new" driver interface standard, remove old code
|
||||
Bug fixes:
|
||||
- GL_ARB_vertex/fragment_shader were mistakenly listed in the
|
||||
extensions string
|
||||
- negative relative addressing in vertex programs was broken
|
||||
- update/fix SPARC assembly code for vertex transformation
|
||||
- fixed memory leak when freeing GLX drawables/renderbuffers
|
||||
- fixed display list memory leak
|
||||
- the GL_PIXEL_MAP_I_TO_I table is now floating point, not integer
|
||||
- wglGetProcAddress() didn't handle wgl-functions
|
||||
- fixed glxext.h cross-compile issue (Colin Harrison)
|
||||
- assorted DRI driver fixes
|
||||
|
@@ -38,7 +38,7 @@ a:visited {
|
||||
<b>Download / Install</b>
|
||||
<ul>
|
||||
<li><a href="http://www.sourceforge.net/projects/mesa3d" target="_parent">Stable Release (6.2.1)</a>
|
||||
<li><a href="http://www.sourceforge.net/projects/mesa3d" target="_parent">Devel Release (6.3)</a>
|
||||
<li><a href="http://www.sourceforge.net/projects/mesa3d" target="_parent">Devel Release (6.3.2)</a>
|
||||
<li><a href="download.html" target="MainFrame">Downloading/Unpacking</a>
|
||||
<li><a href="install.html" target="MainFrame">Compilation/Installation</a>
|
||||
<li><a href="glu.html" target="MainFrame">SGI's GLU</a>
|
||||
@@ -82,6 +82,7 @@ a:visited {
|
||||
<ul>
|
||||
<li><a href="http://www.opengl.org" target="_parent">OpenGL website</a>
|
||||
<li><a href="http://dri.sourceforge.net" target="_parent">DRI website</a>
|
||||
<li><a href="http://www.freedesktop.org" target="_parent">freedesktop.org</a>
|
||||
<li><a href="games.html" target="MainFrame">Games and Entertainment</a>
|
||||
<li><a href="libraries.html" target="MainFrame">Libraries and Toolkits</a>
|
||||
<li><a href="modelers.html" target="MainFrame">Modeling and Rendering</a>
|
||||
|
@@ -16,7 +16,9 @@ Mesa supports the following environment variables:
|
||||
<li>MESA_NO_MMX - if set, disables Intel MMX optimizations
|
||||
<li>MESA_NO_3DNOW - if set, disables AMD 3DNow! optimizations
|
||||
<li>MESA_NO_SSE - if set, disables Intel SSE optimizations
|
||||
<li>MESA_DEBUG - if set, error messages are printed to stderr
|
||||
<li>MESA_DEBUG - if set, error messages are printed to stderr.
|
||||
If the value of MESA_DEBUG is "FP" floating point arithmetic errors will
|
||||
generate exceptions.
|
||||
<li>MESA_NO_DITHER - if set, disables dithering, overriding glEnable(GL_DITHER)
|
||||
</ul>
|
||||
|
||||
|
@@ -24,7 +24,7 @@ We're no longer developing the original Mesa GLU library.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The new SI GLU library code is included in the Mesa package.
|
||||
The SI GLU library code is included in the Mesa distribution.
|
||||
You don't have to download it separately.
|
||||
</p>
|
||||
|
||||
|
@@ -146,7 +146,8 @@ I continue to enhance Mesa with new extensions and features.
|
||||
|
||||
<p>
|
||||
This is a summary of the major versions of Mesa. Note that Mesa's major
|
||||
version number tracks OpenGL's minor version number.
|
||||
version number tracks OpenGL's minor version number (+1).
|
||||
Work is underway to implement the OpenGL 2.0 specification.
|
||||
</p>
|
||||
|
||||
|
||||
@@ -162,10 +163,11 @@ extensions incorporated as standard features:
|
||||
</ul>
|
||||
<p>
|
||||
Also note that several OpenGL tokens were renamed in OpenGL 1.5
|
||||
for the sake of consistency. The old names will still be valid.
|
||||
for the sake of consistency.
|
||||
The old tokens are still available.
|
||||
</p>
|
||||
<pre>
|
||||
New Name Old Name
|
||||
New Token Old Token
|
||||
------------------------------------------------------------
|
||||
GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE
|
||||
GL_FOG_COORD GL_FOG_COORDINATE
|
||||
|
@@ -13,17 +13,18 @@ The Mesa distribution consists of several components. Different copyrights
|
||||
and licenses apply to different components. For example, GLUT is copyrighted
|
||||
by Mark Kilgard, some demo programs are copyrighted by SGI, some of the Mesa
|
||||
device drivers are copyrighted by their authors. See below for a list of
|
||||
Mesa's components and the copyright/license for each.
|
||||
Mesa's main components and the license for each.
|
||||
</p>
|
||||
<p>
|
||||
The core Mesa library is licensed according to the terms of the XFree86
|
||||
copyright (an MIT-style license). This allows integration with the
|
||||
XFree86/DRI project. Unless otherwise stated, the Mesa source code and
|
||||
documentation is licensed as follows:
|
||||
The core Mesa library is licensed according to the terms of the MIT license.
|
||||
This allows integration with the XFree86, Xorg and DRI projects.
|
||||
</p>
|
||||
<p>
|
||||
The default Mesa license is as follows:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||
Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
@@ -47,70 +48,38 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
<H1>Attention, Contributors</H1>
|
||||
|
||||
<p>
|
||||
When contributing to the Mesa project you must agree to relinquish your
|
||||
work to the holder of the copyright for the particular component you're
|
||||
contributing to. That is, you can't put your own copyright on the code,
|
||||
unless it's a modular piece that can be omitted from Mesa (like a new
|
||||
device driver). If for example, you contribute a bug fix to Mesa's
|
||||
texture mapping code, your code will become a part of the body of work
|
||||
which is copyrighted by Brian Paul and licensed by the above terms.
|
||||
When contributing to the Mesa project you must agree to the licensing terms
|
||||
of the component to which you're contributing.
|
||||
The following section lists the primary comonents of the Mesa distribution
|
||||
and their respective licenses.
|
||||
</p>
|
||||
|
||||
|
||||
<H1>Mesa Component Licenses</H1>
|
||||
|
||||
<pre>
|
||||
Mesa Component Licenses:
|
||||
|
||||
Component Files Primary Author License
|
||||
Component Location Primary Author License
|
||||
----------------------------------------------------------------------------
|
||||
core Mesa code src/*.[ch] Brian Paul Mesa
|
||||
include/GL/gl.h
|
||||
Main Mesa code src/mesa/ Brian Paul Mesa (MIT)
|
||||
|
||||
GLX driver src/X/* Brian Paul Mesa
|
||||
include/GL/glx.h
|
||||
include/GL/xmesa.h
|
||||
Device drivers src/mesa/drivers/* See drivers See drivers
|
||||
|
||||
OS/Mesa driver src/OSmesa/* Brian Paul Mesa
|
||||
include/GL/osmesa.h
|
||||
Ext headers include/GL/glext.h SGI SGI Free B
|
||||
include/GL/glxext.h
|
||||
|
||||
3Dfx driver src/FX/* David Bucciarelli Mesa
|
||||
include/GL/fxmesa.h
|
||||
GLUT src/glut/ Mark Kilgard Mark's copyright
|
||||
|
||||
BeOS R4 driver src/BeOS/* Brian Paul Mesa
|
||||
Mesa GLU library src/glu/mesa/ Brian Paul GNU-LGPL
|
||||
|
||||
MGL driver src/MGL/* SciTech, Inc SciTech copyright
|
||||
include/GL/mglmesa.h
|
||||
SGI GLU library src/glu/sgi/ SGI SGI Free B
|
||||
|
||||
Windows driver src/Windows/* Li Wei copyright by Li Wei
|
||||
include/GL/wmesa.h
|
||||
demo programs progs/demos/ various see source files
|
||||
|
||||
SVGA driver src/SVGA/* Brian Paul GNU-LGPL
|
||||
include/GL/svgamesa.h
|
||||
X demos progs/xdemos/ Brian Paul see source files
|
||||
|
||||
DOS driver src/DOS/* Charlie Wallace GNU-LGPL
|
||||
include/GL/dosmesa.h
|
||||
SGI demos progs/samples/ SGI SGI copyright
|
||||
|
||||
GGI driver src/GGI/* Uwe Maurer GNU-LGPL
|
||||
include/GL/ggimesa.h
|
||||
|
||||
S3 driver src/S3/* S3, Inc. S3 copyright
|
||||
|
||||
GLUT src-glut/* Mark Kilgard Mark's copyright
|
||||
include/GL/*glut*.h
|
||||
|
||||
GLU library src-glu/* Brian Paul GNU-LGPL
|
||||
|
||||
SI GLU library si-glu/* SGI SGI Free B
|
||||
include/GL/glu.h
|
||||
|
||||
Ext registry include/GL/glext.h SGI SGI Free B
|
||||
include/GL/glxext.h
|
||||
|
||||
demo programs demos/* various see source files
|
||||
|
||||
X demos xdemos/* Brian Paul see source files
|
||||
|
||||
SGI demos samples/* SGI SGI copyright
|
||||
|
||||
RedBook demos book/* SGI SGI copyright
|
||||
RedBook demos progs/redbook/ SGI SGI copyright
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
|
@@ -11,6 +11,36 @@
|
||||
<H1>News</H1>
|
||||
|
||||
|
||||
<h2>August 19, 2005</h2>
|
||||
<p>
|
||||
Mesa 6.3.2 has been released.
|
||||
Note: there was no public release of version 6.3.1.
|
||||
</p>
|
||||
<pre>
|
||||
New:
|
||||
- The distribution now includes the DRI drivers and GLX code
|
||||
Changes:
|
||||
- Made the DRI "new" driver interface standard, remove old code
|
||||
Bug fixes:
|
||||
- GL_ARB_vertex/fragment_shader were mistakenly listed in the
|
||||
extensions string
|
||||
- negative relative addressing in vertex programs was broken
|
||||
- update/fix SPARC assembly code for vertex transformation
|
||||
- fixed memory leak when freeing GLX drawables/renderbuffers
|
||||
- fixed display list memory leak
|
||||
- the GL_PIXEL_MAP_I_TO_I table is now floating point, not integer
|
||||
- wglGetProcAddress() didn't handle wgl-functions
|
||||
- fixed glxext.h cross-compile issue (Colin Harrison)
|
||||
- assorted DRI driver fixes
|
||||
</pre>
|
||||
<p>
|
||||
The MD5 checksums are:
|
||||
</p>
|
||||
<pre>
|
||||
(tbd)
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>July 20, 2005</h2>
|
||||
<p>
|
||||
Mesa 6.3 has been released.
|
||||
@@ -1016,6 +1046,6 @@ source code</a>.</p>
|
||||
|
||||
|
||||
<hr>
|
||||
$Id: news.html,v 3.22 2005/07/20 18:20:45 brianp Exp $
|
||||
$Id: news.html,v 3.23 2005/08/19 16:57:50 brianp Exp $
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -13,7 +13,7 @@ The release notes summarize what's new or changed in each Mesa release.
|
||||
</p>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="RELNOTES-6.3.1">RELNOTES-6.3.1</A>
|
||||
<LI><A HREF="RELNOTES-6.3.2">RELNOTES-6.3.2</A>
|
||||
<LI><A HREF="RELNOTES-6.3">RELNOTES-6.3</A>
|
||||
<LI><A HREF="RELNOTES-6.2.1">RELNOTES-6.2.1</A>
|
||||
<LI><A HREF="RELNOTES-6.2">RELNOTES-6.2</A>
|
||||
|
@@ -14,98 +14,43 @@ supported on those systems. All you need is an ANSI C compiler and the
|
||||
X development environment to use Mesa.
|
||||
</p>
|
||||
|
||||
<p>Others have contributed drivers
|
||||
for the Amiga, Apple Macintosh, BeOS, NeXT, OS/2, MS-DOS, VMS, Windows
|
||||
<p>
|
||||
The DRI hardware drivers for the X.org server and XFree86 provide
|
||||
hardware accelerated rendering for chips from ATI, Intel, Matrox, 3dfx
|
||||
and others on Linux and FreeBSD.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Drivers for other assorted platforms include:
|
||||
the Amiga, Apple Macintosh, BeOS, NeXT, OS/2, MS-DOS, VMS, Windows
|
||||
9x/NT, and Direct3D.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The following files describe the details for various platforms.
|
||||
Be warned, some of these files (and drivers) may be very out of date.
|
||||
Details about particular drivers follows.
|
||||
Be warned that some drivers may be out of date and no longer function.
|
||||
</p>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="README.X11">README.X11</A> - X Window System / Unix / Linux
|
||||
<LI><A HREF="README.WIN32">README.WIN32</A> - Microsoft Windows
|
||||
<LI><A HREF="README.VMS">README.VMS</A> - DEC VMS
|
||||
<LI><A HREF="README.GGI">README.GGI</A> - GGI
|
||||
<LI><A HREF="README.3DFX">README.3DFX</A> - 3Dfx/Glide driver
|
||||
<LI><A HREF="README.AMIWIN">README.AMIWIN</A> - Amiga Amiwin
|
||||
<LI><A HREF="README.BEOS">README.BEOS</A> - BeOS
|
||||
<LI><A HREF="README.D3D">README.D3D</A> - Direct3D driver
|
||||
<LI><A HREF="README.DJ">README.DJ</A> - DJGPP
|
||||
<LI><A HREF="README.LYNXOS">README.LYNXOS</A> - LynxOS
|
||||
<LI><A HREF="README.MINGW32">README.MINGW32</A> - Mingw32
|
||||
<LI><A HREF="README.NeXT">README.NeXT</A> - NeXT
|
||||
<LI><A HREF="README.OpenStep">README.OpenStep</A> - OpenStep
|
||||
<LI><A HREF="README.OS2">README.OS2</A> - OS/2
|
||||
<LI><A HREF="README.WINDML">README.WINDML</A> - WindML
|
||||
<LI>Xlib driver for the X Window System <A HREF="README.X11">(README.X11)</A>
|
||||
<li><a href="http://dri.sourceforge.net/" target="_parent">
|
||||
DRI hardware drivers</a> for the X window system
|
||||
<LI>Microsoft Windows <A HREF="README.WIN32">(README.WIN32)</A>
|
||||
<LI>DEC VMS <A HREF="README.VMS">(README.VMS)</A>
|
||||
<LI>3dfx/Glide <A HREF="README.3DFX">(README.3DFX)</A>
|
||||
<LI>GGI <A HREF="README.GGI">(README.GGI)</A>
|
||||
<LI>Amiga Amiwin <A HREF="README.AMIWIN">(README.AMIWIN)</A>
|
||||
<LI>BeOS <A HREF="README.BEOS">(README.BEOS)</A>
|
||||
<LI>Direct3D driver <A HREF="README.D3D">(README.D3D)</A>
|
||||
<LI>DJGPP <A HREF="README.DJ">(README.DJ)</A>
|
||||
<LI>LynxOS <A HREF="README.LYNXOS">(README.LYNXOS)</A>
|
||||
<LI>Mingw32 <A HREF="README.MINGW32">(README.MINGW32)</A>
|
||||
<LI>NeXT <A HREF="README.NeXT">(README.NeXT)</A>
|
||||
<LI>OpenStep <A HREF="README.OpenStep">(README.OpenStep)</A>
|
||||
<LI>OS/2 <A HREF="README.OS2">(README.OS2)</A>
|
||||
<LI>WindML <A HREF="README.WINDML">(README.WINDML)</A>
|
||||
<LI><a href="http://utah-glx.sourceforge.net/" target="_parent">Utah GLX drivers</a>
|
||||
</UL>
|
||||
|
||||
|
||||
<p>
|
||||
The standard Mesa distribution only supports software-based rendering, with
|
||||
the exception of the 3Dfx Glide driver.
|
||||
Information about other hardware support follows.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>DRI-based hardware support for 3dfx, Intel, Matrox, ATI with XFree86
|
||||
<blockquote>
|
||||
<p>The <a href="http://dri.sourceforge.net/" target="_parent">DRI architecture</a>,
|
||||
originally developed by Precision Insight, Inc. uses Mesa and
|
||||
provides hardware acceleration for a number of popular chipsets.<br>
|
||||
<br>
|
||||
The DRI is part of XFree86 4.0 and later.
|
||||
<br><br>
|
||||
If you download and install XFree86 4.x you do not need to
|
||||
install Mesa separately. All the important parts of Mesa
|
||||
will be installed with the rest of XFree86.
|
||||
</blockquote>
|
||||
|
||||
|
||||
<li>3dfx Voodoo1, Voodoo2, Voodoo Rush, Voodoo Banshee, Voodoo3
|
||||
<blockquote>
|
||||
<p>All cards based on these chipsets should work with Linux and
|
||||
Windows 95 via 3dfx's Glide library.
|
||||
The Mesa/Glide driver is included with the Mesa distribution.
|
||||
You'll need to install the Glide header files and runtime library.
|
||||
</p>
|
||||
<p>
|
||||
David Bucciarelli wrote the original 3dfx driver for Mesa.<br>
|
||||
Daryll Strauss ported Glide to Linux.
|
||||
</p>
|
||||
</blockquote>
|
||||
|
||||
|
||||
<li>Matrox G200/G400, nVidia RIVA, ATI Rage Pro, Intel i810 on Linux
|
||||
<blockquote>
|
||||
<p>The <a href="http://utah-glx.sourceforge.net/" target="_parent">
|
||||
Utah GLX project</a>
|
||||
(no longer active) developed drivers for these chipsets and others.
|
||||
</blockquote>
|
||||
|
||||
<li>Amiga Warp3D
|
||||
<blockquote>
|
||||
<p>Amiga systems can support 3D hardware with the Warp3D API.
|
||||
See <a href="http://www.haage-partner.com/3dworld" target="_parent">here</a>.
|
||||
</blockquote>
|
||||
|
||||
<li>Also see
|
||||
<blockquote>
|
||||
<p><a href="http://www.linux3d.org/" target="_parent">www.linux3d.org</a> for
|
||||
other 3D hardware info for Linux.
|
||||
</blockquote>
|
||||
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<b><em>Note:</em></b>
|
||||
If you have NVIDIA hardware in your computer,
|
||||
you should download and install NVIDIA's OpenGL library. You may
|
||||
however, want to download Mesa in order to use its GLU and GLUT
|
||||
libraries, or assorted demo programs.</p>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -347,6 +347,8 @@ typedef long long int int64_t;
|
||||
#include <inttypes.h>
|
||||
#elif defined(__SCO__) || defined(__USLC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(WIN32) && defined(__GNUC__)
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#ifndef GLX_VERSION_1_3
|
||||
|
@@ -38,12 +38,6 @@
|
||||
#ifndef DRI_INTERFACE_H
|
||||
#define DRI_INTERFACE_H
|
||||
|
||||
#if 0 /*ndef DRI_NEW_INTERFACE_ONLY*/
|
||||
# include <X11/X.h>
|
||||
# include <GL/glx.h>
|
||||
# include "GL/glxint.h"
|
||||
#endif
|
||||
|
||||
#include <GL/internal/glcore.h>
|
||||
#include <xf86drm.h>
|
||||
#include <drm.h>
|
||||
|
@@ -26,6 +26,7 @@
|
||||
static GLint T0 = 0;
|
||||
static GLint Frames = 0;
|
||||
static GLint autoexit = 0;
|
||||
static GLint win = 0;
|
||||
|
||||
|
||||
/**
|
||||
@@ -163,6 +164,15 @@ 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 void
|
||||
cleanup(void)
|
||||
{
|
||||
glDeleteLists(gear1, 1);
|
||||
glDeleteLists(gear2, 1);
|
||||
glDeleteLists(gear3, 1);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
@@ -198,16 +208,18 @@ draw(void)
|
||||
Frames++;
|
||||
|
||||
{
|
||||
GLint t = glutGet(GLUT_ELAPSED_TIME);
|
||||
if (t - T0 >= 5000) {
|
||||
GLfloat seconds = (t - T0) / 1000.0;
|
||||
GLfloat fps = Frames / seconds;
|
||||
printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
|
||||
T0 = t;
|
||||
Frames = 0;
|
||||
if ((t >= 999.0 * autoexit) && (autoexit))
|
||||
exit(0);
|
||||
}
|
||||
GLint t = glutGet(GLUT_ELAPSED_TIME);
|
||||
if (t - T0 >= 5000) {
|
||||
GLfloat seconds = (t - T0) / 1000.0;
|
||||
GLfloat fps = Frames / seconds;
|
||||
printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
|
||||
T0 = t;
|
||||
Frames = 0;
|
||||
if ((t >= 999.0 * autoexit) && (autoexit)) {
|
||||
cleanup();
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,6 +251,7 @@ key(unsigned char k, int x, int y)
|
||||
view_rotz -= 5.0;
|
||||
break;
|
||||
case 27: /* Escape */
|
||||
cleanup();
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
@@ -352,7 +365,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
glutInitWindowPosition(0, 0);
|
||||
glutInitWindowSize(300, 300);
|
||||
glutCreateWindow("Gears");
|
||||
win = glutCreateWindow("Gears");
|
||||
init(argc, argv);
|
||||
|
||||
glutDisplayFunc(draw);
|
||||
|
@@ -25,35 +25,35 @@ default: $(PROGRAMS)
|
||||
|
||||
|
||||
demo1: demo1.o $(LIB_DIR)/libEGL.so
|
||||
$(CC) demo1.o -L$(LIB_DIR) -lEGL -o $@
|
||||
$(CC) $(CFLAGS) demo1.o -L$(LIB_DIR) -lEGL -o $@
|
||||
|
||||
demo1.o: demo1.c $(HEADERS)
|
||||
$(CC) -c $(CFLAGS) -I$(TOP)/include demo1.c
|
||||
|
||||
|
||||
demo2: demo2.o $(LIB_DIR)/libEGL.so
|
||||
$(CC) demo2.o -L$(LIB_DIR) -lEGL $(APP_LIB_DEPS) -o $@
|
||||
$(CC) $(CFLAGS) demo2.o -L$(LIB_DIR) -lEGL $(APP_LIB_DEPS) -o $@
|
||||
|
||||
demo2.o: demo2.c $(HEADERS)
|
||||
$(CC) -c $(CFLAGS) -I$(TOP)/include demo2.c
|
||||
|
||||
|
||||
demo3: demo3.o $(LIB_DIR)/libEGL.so
|
||||
$(CC) demo3.o -L$(LIB_DIR) -lEGL $(APP_LIB_DEPS) -o $@
|
||||
$(CC) $(CFLAGS) demo3.o -L$(LIB_DIR) -lEGL $(APP_LIB_DEPS) -o $@
|
||||
|
||||
demo3.o: demo3.c $(HEADERS)
|
||||
$(CC) -c $(CFLAGS) -I$(TOP)/include demo3.c
|
||||
|
||||
|
||||
eglinfo: eglinfo.o $(LIB_DIR)/libEGL.so
|
||||
$(CC) eglinfo.o -L$(LIB_DIR) -lEGL -o $@
|
||||
$(CC) $(CFLAGS) eglinfo.o -L$(LIB_DIR) -lEGL -o $@
|
||||
|
||||
eglinfo.o: eglinfo.c $(HEADERS)
|
||||
$(CC) -c $(CFLAGS) -I$(TOP)/include eglinfo.c
|
||||
|
||||
|
||||
eglgears: eglgears.o $(LIB_DIR)/libEGL.so
|
||||
$(CC) eglgears.o -L$(LIB_DIR) -lEGL $(APP_LIB_DEPS) -o $@
|
||||
$(CC) $(CFLAGS) eglgears.o -L$(LIB_DIR) -lEGL $(APP_LIB_DEPS) -o $@
|
||||
|
||||
eglgears.o: eglgears.c $(HEADERS)
|
||||
$(CC) -c $(CFLAGS) -I$(TOP)/include eglgears.c
|
||||
|
@@ -576,7 +576,7 @@ main(int argc, char *argv[])
|
||||
/*
|
||||
EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
*/
|
||||
EGLDisplay d = eglGetDisplay("!fb_dri");
|
||||
EGLDisplay d = eglGetDisplay(":0");
|
||||
assert(d);
|
||||
|
||||
if (!eglInitialize(d, &maj, &min)) {
|
||||
@@ -602,7 +602,7 @@ main(int argc, char *argv[])
|
||||
printf("failed to create screen surface\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
eglShowSurfaceMESA(d, screen, screen_surf, mode);
|
||||
|
||||
b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
|
||||
@@ -610,25 +610,24 @@ main(int argc, char *argv[])
|
||||
printf("make current failed\n");
|
||||
return 0;
|
||||
}
|
||||
glViewport(0, 0, 1024, 768);
|
||||
|
||||
Init();
|
||||
|
||||
Init();
|
||||
Reshape(1024, 768);
|
||||
|
||||
glDrawBuffer( GL_FRONT );
|
||||
glClearColor( 0,
|
||||
1.0,
|
||||
0,
|
||||
1);
|
||||
glDrawBuffer( GL_FRONT );
|
||||
glClearColor( 0, 1.0, 0, 1);
|
||||
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
doubleBuffer = 1;
|
||||
glDrawBuffer( GL_BACK );
|
||||
doubleBuffer = 1;
|
||||
glDrawBuffer( GL_BACK );
|
||||
|
||||
Draw(d, screen_surf);
|
||||
|
||||
|
||||
write_ppm("dump.ppm", ((struct fb_display *)_eglLookupDisplay(d))->pFB, 1024, 768);
|
||||
|
||||
|
||||
eglDestroySurface(d, screen_surf);
|
||||
eglDestroyContext(d, ctx);
|
||||
eglTerminate(d);
|
||||
|
@@ -87,9 +87,9 @@ 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 GLfloat eyesep = 5.0; /* Eye separation. */
|
||||
static GLfloat fix_point = 40.0; /* Fixation point distance. */
|
||||
static GLfloat left, right, asp; /* Stereo frustum params. */
|
||||
//static GLfloat eyesep = 5.0; /* Eye separation. */
|
||||
//static GLfloat fix_point = 40.0; /* Fixation point distance. */
|
||||
//static GLfloat left, right, asp; /* Stereo frustum params. */
|
||||
|
||||
|
||||
/*
|
||||
@@ -385,7 +385,7 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// DBR : Create EGL context/surface etc
|
||||
EGLDisplay d = eglGetDisplay("!fb_dri");
|
||||
EGLDisplay d = eglGetDisplay(":0");
|
||||
assert(d);
|
||||
|
||||
if (!eglInitialize(d, &maj, &min)) {
|
||||
@@ -431,7 +431,9 @@ main(int argc, char *argv[])
|
||||
|
||||
init(); // Initialise the GL visual
|
||||
reshape(1024,768);
|
||||
|
||||
|
||||
glDrawBuffer( GL_BACK );
|
||||
|
||||
// DBR : Run the simulation
|
||||
run_gears(d, screen_surf, 5.0);
|
||||
|
||||
|
@@ -136,7 +136,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int maj, min;
|
||||
/*EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);*/
|
||||
EGLDisplay d = eglGetDisplay("!fb_dri");
|
||||
EGLDisplay d = eglGetDisplay("!r200_dri");
|
||||
|
||||
if (!eglInitialize(d, &maj, &min)) {
|
||||
printf("eglinfo: eglInitialize failed\n");
|
||||
|
@@ -23,6 +23,7 @@ SOURCES = antialias.c \
|
||||
blendsquare.c \
|
||||
bufferobj.c \
|
||||
bug_3101.c \
|
||||
bug_3195.c \
|
||||
crossbar.c \
|
||||
cva.c \
|
||||
dinoshade.c \
|
||||
@@ -104,6 +105,12 @@ texrect: texrect.o readtex.o
|
||||
texrect.o: texrect.c readtex.h
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
|
||||
|
||||
bug_3195: bug_3195.o readtex.o
|
||||
$(CC) $(CFLAGS) bug_3195.o readtex.o $(LIBS) -o $@
|
||||
|
||||
bug_3195.o: bug_3195.c readtex.h
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
|
||||
|
||||
invert: invert.o readtex.o
|
||||
$(CC) invert.o readtex.o $(LIBS) -o $@
|
||||
|
||||
|
275
progs/tests/bug_3195.c
Normal file
275
progs/tests/bug_3195.c
Normal file
@@ -0,0 +1,275 @@
|
||||
/*
|
||||
* Copyright (C) 2000 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file bug_3195.c
|
||||
*
|
||||
* Simple regression test for bug #3195. A bug in the i180 driver caused
|
||||
* a segfault (inside the driver) when the LOD bias is adjusted and no texture
|
||||
* is enabled. This test, which is based on progs/demos/lodbias.c, sets up
|
||||
* all the texturing, disables all textures, adjusts the LOD bias, then
|
||||
* re-enables \c GL_TEXTURE_2D.
|
||||
*
|
||||
* \author Brian Paul
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
|
||||
#include "readtex.h"
|
||||
|
||||
#define TEXTURE_FILE "../images/girl.rgb"
|
||||
|
||||
static GLfloat Xrot = 0, Yrot = -30, Zrot = 0;
|
||||
static GLint Bias = 0, BiasStepSign = +1; /* ints avoid fp precision problem */
|
||||
static GLint BiasMin = -400, BiasMax = 400;
|
||||
|
||||
|
||||
|
||||
static void
|
||||
PrintString(const char *s)
|
||||
{
|
||||
while (*s) {
|
||||
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
static void Idle( void )
|
||||
{
|
||||
static int lastTime = 0;
|
||||
int time = glutGet(GLUT_ELAPSED_TIME);
|
||||
int step;
|
||||
|
||||
if (lastTime == 0)
|
||||
lastTime = time;
|
||||
else if (time - lastTime < 10)
|
||||
return;
|
||||
|
||||
step = (time - lastTime) / 10 * BiasStepSign;
|
||||
lastTime = time;
|
||||
|
||||
Bias += step;
|
||||
if (Bias < BiasMin) {
|
||||
exit(0);
|
||||
}
|
||||
else if (Bias > BiasMax) {
|
||||
Bias = BiasMax;
|
||||
BiasStepSign = -1;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
char str[100];
|
||||
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glOrtho(-1, 1, -1, 1, -1, 1);
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glColor3f(1,1,1);
|
||||
glRasterPos3f(-0.9, -0.9, 0.0);
|
||||
sprintf(str, "Texture LOD Bias = %4.1f", Bias * 0.01);
|
||||
PrintString(str);
|
||||
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0.0, 0.0, -8.0 );
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(Xrot, 1, 0, 0);
|
||||
glRotatef(Yrot, 0, 1, 0);
|
||||
glRotatef(Zrot, 0, 0, 1);
|
||||
|
||||
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0.01 * Bias);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
glTexCoord2f(0, 0); glVertex2f(-1, -1);
|
||||
glTexCoord2f(2, 0); glVertex2f( 1, -1);
|
||||
glTexCoord2f(2, 2); glVertex2f( 1, 1);
|
||||
glTexCoord2f(0, 2); glVertex2f(-1, 1);
|
||||
glEnd();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
glViewport( 0, 0, width, height );
|
||||
}
|
||||
|
||||
|
||||
static void Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void SpecialKey( int key, int x, int y )
|
||||
{
|
||||
const GLfloat step = 3.0;
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case GLUT_KEY_UP:
|
||||
Xrot -= step;
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
Xrot += step;
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
Yrot -= step;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
Yrot += step;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void Init( void )
|
||||
{
|
||||
GLfloat maxBias;
|
||||
const char * const ver_string = (const char * const)
|
||||
glGetString( GL_VERSION );
|
||||
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", ver_string);
|
||||
|
||||
printf("\nThis program should function nearly identically to Mesa's lodbias demo.\n"
|
||||
"It should cycle through the complet LOD bias range once and exit. If bug\n"
|
||||
"#3195 still exists, the demo should crash almost immediatly.\n");
|
||||
printf("This is a regression test for bug #3101.\n");
|
||||
printf("https://bugs.freedesktop.org/show_bug.cgi?id=3101\n");
|
||||
|
||||
if (!glutExtensionSupported("GL_EXT_texture_lod_bias")) {
|
||||
printf("Sorry, GL_EXT_texture_lod_bias not supported by this renderer.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
if (glutExtensionSupported("GL_SGIS_generate_mipmap")) {
|
||||
/* test auto mipmap generation */
|
||||
GLint width, height, i;
|
||||
GLenum format;
|
||||
GLubyte *image = LoadRGBImage(TEXTURE_FILE, &width, &height, &format);
|
||||
if (!image) {
|
||||
printf("Error: could not load texture image %s\n", TEXTURE_FILE);
|
||||
exit(1);
|
||||
}
|
||||
/* resize to 256 x 256 */
|
||||
if (width != 256 || height != 256) {
|
||||
GLubyte *newImage = malloc(256 * 256 * 4);
|
||||
gluScaleImage(format, width, height, GL_UNSIGNED_BYTE, image,
|
||||
256, 256, GL_UNSIGNED_BYTE, newImage);
|
||||
free(image);
|
||||
image = newImage;
|
||||
}
|
||||
printf("Using GL_SGIS_generate_mipmap\n");
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format, 256, 256, 0,
|
||||
format, GL_UNSIGNED_BYTE, image);
|
||||
free(image);
|
||||
|
||||
/* make sure mipmap was really generated correctly */
|
||||
width = height = 256;
|
||||
for (i = 0; i < 9; i++) {
|
||||
GLint w, h;
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_WIDTH, &w);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_HEIGHT, &h);
|
||||
printf("Level %d size: %d x %d\n", i, w, h);
|
||||
assert(w == width);
|
||||
assert(h == height);
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
}
|
||||
|
||||
}
|
||||
else if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
|
||||
printf("Error: could not load texture image %s\n", TEXTURE_FILE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* mipmapping required for this extension */
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS_EXT, &maxBias);
|
||||
printf("LOD bias range: [%g, %g]\n", -maxBias, maxBias);
|
||||
BiasMin = -100 * maxBias;
|
||||
BiasMax = 100 * maxBias;
|
||||
|
||||
/* Since we have (about) 8 mipmap levels, no need to bias beyond
|
||||
* the range [-1, +8].
|
||||
*/
|
||||
if (BiasMin < -100)
|
||||
BiasMin = -100;
|
||||
if (BiasMax > 800)
|
||||
BiasMax = 800;
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( 350, 350 );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
|
||||
glutCreateWindow( "Bug #3195 Test" );
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutSpecialFunc( SpecialKey );
|
||||
glutDisplayFunc( Display );
|
||||
glutIdleFunc(Idle);
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
@@ -10,28 +10,94 @@
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
GLboolean wrapping;
|
||||
|
||||
static void RunTest(void)
|
||||
{
|
||||
const GLenum prim = GL_QUAD_STRIP;
|
||||
GLubyte val;
|
||||
int bits, max, i;
|
||||
int expected;
|
||||
GLboolean failed;
|
||||
|
||||
glGetIntegerv(GL_STENCIL_BITS, &bits);
|
||||
max = (1 << bits) - 1;
|
||||
|
||||
glClearStencil(0);
|
||||
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glStencilFunc(GL_ALWAYS, 0, ~0);
|
||||
|
||||
/* test GL_KEEP */
|
||||
glClearStencil(max);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||
failed = GL_FALSE;
|
||||
printf("Testing GL_KEEP...\n");
|
||||
expected = max;
|
||||
glBegin(prim);
|
||||
glVertex2f(0, 0);
|
||||
glVertex2f(10, 0);
|
||||
glVertex2f(0, 10);
|
||||
glVertex2f(10, 10);
|
||||
glEnd();
|
||||
glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
|
||||
if (val != expected) {
|
||||
printf("Failed GL_KEEP test(got %u, expected %u)\n", val, expected);
|
||||
failed = GL_TRUE;
|
||||
}
|
||||
else
|
||||
printf("OK!\n");
|
||||
|
||||
/* test GL_ZERO */
|
||||
glClearStencil(max);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO);
|
||||
failed = GL_FALSE;
|
||||
printf("Testing GL_ZERO...\n");
|
||||
expected = 0;
|
||||
glBegin(prim);
|
||||
glVertex2f(0, 0);
|
||||
glVertex2f(10, 0);
|
||||
glVertex2f(0, 10);
|
||||
glVertex2f(10, 10);
|
||||
glEnd();
|
||||
glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
|
||||
if (val != expected) {
|
||||
printf("Failed GL_ZERO test(got %u, expected %u)\n", val, expected);
|
||||
failed = GL_TRUE;
|
||||
}
|
||||
else
|
||||
printf("OK!\n");
|
||||
|
||||
/* test GL_REPLACE */
|
||||
glClearStencil(max);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
failed = GL_FALSE;
|
||||
printf("Testing GL_REPLACE...\n");
|
||||
expected = 0;
|
||||
glBegin(prim);
|
||||
glVertex2f(0, 0);
|
||||
glVertex2f(10, 0);
|
||||
glVertex2f(0, 10);
|
||||
glVertex2f(10, 10);
|
||||
glEnd();
|
||||
glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
|
||||
if (val != expected) {
|
||||
printf("Failed GL_REPLACE test(got %u, expected %u)\n", val, expected);
|
||||
failed = GL_TRUE;
|
||||
}
|
||||
else
|
||||
printf("OK!\n");
|
||||
|
||||
/* test GL_INCR (saturation) */
|
||||
glClearStencil(0);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
|
||||
failed = GL_FALSE;
|
||||
printf("Testing GL_INCR...\n");
|
||||
for (i = 1; i < max+10; i++) {
|
||||
int expected = (i > max) ? max : i;
|
||||
expected = (i > max) ? max : i;
|
||||
glBegin(prim);
|
||||
glVertex2f(0, 0); glVertex2f(10, 0);
|
||||
glVertex2f(0, 10); glVertex2f(10, 10);
|
||||
@@ -44,39 +110,17 @@ static void RunTest(void)
|
||||
failed = GL_TRUE;
|
||||
}
|
||||
}
|
||||
if ( !failed )
|
||||
printf("OK!\n");
|
||||
|
||||
if ( !failed ) printf("OK!\n");
|
||||
|
||||
|
||||
/* test GL_INCR_WRAP_EXT (wrap around) */
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR_WRAP_EXT);
|
||||
failed = GL_FALSE;
|
||||
printf("Testing GL_INCR_WRAP_EXT...\n");
|
||||
for (i = 1; i < max+10; i++) {
|
||||
int expected = i % (max + 1);
|
||||
glBegin(prim);
|
||||
glVertex2f(0, 0); glVertex2f(10, 0);
|
||||
glVertex2f(0, 10); glVertex2f(10, 10);
|
||||
glEnd();
|
||||
glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
|
||||
if (val != expected) {
|
||||
printf( "Failed GL_INCR_WRAP test on iteration #%u "
|
||||
"(got %u, expected %u)\n", i, val, expected );
|
||||
failed = GL_TRUE;
|
||||
}
|
||||
}
|
||||
if ( !failed ) printf("OK!\n");
|
||||
|
||||
/* test GL_DECR (saturation) */
|
||||
glClearStencil(max);
|
||||
|
||||
/* test GL_INCR (saturation) */
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
|
||||
failed = GL_FALSE;
|
||||
printf("Testing GL_DECR...\n");
|
||||
for (i = max-1; i > -10; i--) {
|
||||
int expected = (i < 0) ? 0 : i;
|
||||
expected = (i < 0) ? 0 : i;
|
||||
glBegin(prim);
|
||||
glVertex2f(0, 0); glVertex2f(10, 0);
|
||||
glVertex2f(0, 10); glVertex2f(10, 10);
|
||||
@@ -88,27 +132,76 @@ static void RunTest(void)
|
||||
failed = GL_TRUE;
|
||||
}
|
||||
}
|
||||
if ( !failed ) printf("OK!\n");
|
||||
if ( !failed )
|
||||
printf("OK!\n");
|
||||
|
||||
/* test GL_INCR_WRAP_EXT (wrap-around) */
|
||||
/* test GL_INVERT */
|
||||
glClearStencil(0);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_DECR_WRAP_EXT);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT);
|
||||
failed = GL_FALSE;
|
||||
printf("Testing GL_DECR_WRAP_EXT...\n");
|
||||
for (i = max-1; i > -10; i--) {
|
||||
int expected = (i < 0) ? max + i + 1: i;
|
||||
glBegin(prim);
|
||||
glVertex2f(0, 0); glVertex2f(10, 0);
|
||||
glVertex2f(0, 10); glVertex2f(10, 10);
|
||||
glEnd();
|
||||
glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
|
||||
if (val != expected) {
|
||||
printf( "Failed GL_DECR_WRAP test on iteration #%u "
|
||||
"(got %u, expected %u)\n", max - i, val, expected );
|
||||
failed = GL_TRUE;
|
||||
}
|
||||
printf("Testing GL_INVERT...\n");
|
||||
expected = max;
|
||||
glBegin(prim);
|
||||
glVertex2f(0, 0);
|
||||
glVertex2f(10, 0);
|
||||
glVertex2f(0, 10);
|
||||
glVertex2f(10, 10);
|
||||
glEnd();
|
||||
glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
|
||||
if (val != expected) {
|
||||
printf("Failed GL_INVERT test(got %u, expected %u)\n", val, expected);
|
||||
failed = GL_TRUE;
|
||||
}
|
||||
else
|
||||
printf("OK!\n");
|
||||
|
||||
if(wrapping)
|
||||
{
|
||||
/* test GL_INCR_WRAP_EXT (wrap around) */
|
||||
glClearStencil(0);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR_WRAP_EXT);
|
||||
failed = GL_FALSE;
|
||||
printf("Testing GL_INCR_WRAP_EXT...\n");
|
||||
for (i = 1; i < max+10; i++) {
|
||||
expected = i % (max + 1);
|
||||
glBegin(prim);
|
||||
glVertex2f(0, 0); glVertex2f(10, 0);
|
||||
glVertex2f(0, 10); glVertex2f(10, 10);
|
||||
glEnd();
|
||||
glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
|
||||
if (val != expected) {
|
||||
printf( "Failed GL_INCR_WRAP test on iteration #%u "
|
||||
"(got %u, expected %u)\n", i, val, expected );
|
||||
failed = GL_TRUE;
|
||||
}
|
||||
}
|
||||
if ( !failed )
|
||||
printf("OK!\n");
|
||||
|
||||
/* test GL_DECR_WRAP_EXT (wrap-around) */
|
||||
glClearStencil(max);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_DECR_WRAP_EXT);
|
||||
failed = GL_FALSE;
|
||||
printf("Testing GL_DECR_WRAP_EXT...\n");
|
||||
for (i = max-1; i > -10; i--) {
|
||||
expected = (i < 0) ? max + i + 1: i;
|
||||
glBegin(prim);
|
||||
glVertex2f(0, 0); glVertex2f(10, 0);
|
||||
glVertex2f(0, 10); glVertex2f(10, 10);
|
||||
glEnd();
|
||||
glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
|
||||
if (val != expected) {
|
||||
printf( "Failed GL_DECR_WRAP test on iteration #%u "
|
||||
"(got %u, expected %u)\n", max - i, val, expected );
|
||||
failed = GL_TRUE;
|
||||
}
|
||||
}
|
||||
if ( !failed )
|
||||
printf("OK!\n");
|
||||
}
|
||||
if ( !failed ) printf("OK!\n");
|
||||
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
}
|
||||
@@ -158,7 +251,7 @@ static void Init( void )
|
||||
|
||||
|
||||
/* Check for both the extension string and GL version 1.4 on the
|
||||
* outside chance that some silly vendor exports version 1.4 but doesn't
|
||||
* outside chance that some vendor exports version 1.4 but doesn't
|
||||
* export the extension string. The stencil-wrap modes are a required
|
||||
* part of GL 1.4.
|
||||
*/
|
||||
@@ -166,11 +259,9 @@ static void Init( void )
|
||||
ver_str = glGetString( GL_VERSION );
|
||||
version = (ver_str == NULL) ? 1.0 : atof( ver_str );
|
||||
|
||||
if ( !glutExtensionSupported("GL_EXT_stencil_wrap")
|
||||
&& (version < 1.4) ) {
|
||||
printf("Sorry, GL_EXT_stencil_wrap not supported.\n");
|
||||
exit(1);
|
||||
}
|
||||
wrapping = (glutExtensionSupported("GL_EXT_stencil_wrap") || (version >= 1.4));
|
||||
if (!wrapping)
|
||||
printf("GL_EXT_stencil_wrap not supported. Only testing the rest.\n");
|
||||
}
|
||||
|
||||
|
||||
|
@@ -590,6 +590,9 @@ main(int argc, char *argv[])
|
||||
|
||||
event_loop(dpy, win);
|
||||
|
||||
glDeleteLists(gear1, 1);
|
||||
glDeleteLists(gear2, 1);
|
||||
glDeleteLists(gear3, 1);
|
||||
glXDestroyContext(dpy, ctx);
|
||||
XDestroyWindow(dpy, win);
|
||||
XCloseDisplay(dpy);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
TOP = ../..
|
||||
|
||||
SUBDIRS = main drivers/demo
|
||||
SUBDIRS = main drivers/demo drivers/dri
|
||||
|
||||
|
||||
default: subdirs
|
||||
|
@@ -286,19 +286,12 @@ demoMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface rea
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Just to silence warning
|
||||
*/
|
||||
extern _EGLDriver *
|
||||
_eglMain(NativeDisplayType dpy);
|
||||
|
||||
|
||||
/**
|
||||
* The bootstrap function. Return a new DemoDriver object and
|
||||
* plug in API functions.
|
||||
*/
|
||||
_EGLDriver *
|
||||
_eglMain(NativeDisplayType dpy)
|
||||
_eglMain(_EGLDisplay *dpy)
|
||||
{
|
||||
DemoDriver *demo;
|
||||
|
||||
|
64
src/egl/drivers/dri/Makefile
Normal file
64
src/egl/drivers/dri/Makefile
Normal file
@@ -0,0 +1,64 @@
|
||||
# src/egl/drivers/dri/Makefile
|
||||
|
||||
TOP = ../../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
|
||||
### Include directories
|
||||
INCLUDE_DIRS = \
|
||||
-I. \
|
||||
-I$(DRM_SOURCE_PATH)/shared-core \
|
||||
-I$(DRM_SOURCE_PATH)/libdrm \
|
||||
-I$(TOP)/include \
|
||||
-I$(TOP)/include/GL/internal \
|
||||
-I$(TOP)/src/mesa \
|
||||
-I$(TOP)/src/mesa/main \
|
||||
-I$(TOP)/src/mesa/glapi \
|
||||
-I$(TOP)/src/mesa/math \
|
||||
-I$(TOP)/src/mesa/transform \
|
||||
-I$(TOP)/src/mesa/shader \
|
||||
-I$(TOP)/src/mesa/swrast \
|
||||
-I$(TOP)/src/mesa/swrast_setup \
|
||||
-I$(TOP)/src/egl/main \
|
||||
-I$(TOP)/src/mesa/drivers/dri/common
|
||||
|
||||
|
||||
HEADERS = egldri.h
|
||||
|
||||
SOURCES = egldri.c \
|
||||
$(DRM_SOURCE_PATH)/libdrm/xf86drm.c \
|
||||
$(DRM_SOURCE_PATH)/libdrm/xf86drmHash.c \
|
||||
$(DRM_SOURCE_PATH)/libdrm/xf86drmRandom.c
|
||||
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
|
||||
|
||||
|
||||
|
||||
default: depend library Makefile
|
||||
|
||||
|
||||
# EGLdri Library
|
||||
library: $(LIB_DIR)/libEGLdri.so
|
||||
|
||||
$(LIB_DIR)/libEGLdri.so: $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o EGLdri -major 1 -minor 0 \
|
||||
-install $(LIB_DIR) -ldl $(OBJECTS)
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f *.so
|
||||
|
||||
depend: $(SOURCES) $(HEADERS)
|
||||
@ echo "running $(MKDEP)"
|
||||
@ touch depend
|
||||
$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
|
||||
$(SOURCES) $(HEADERS) > /dev/null
|
||||
|
||||
include depend
|
||||
# DO NOT DELETE
|
||||
|
1001
src/egl/drivers/dri/egldri.c
Normal file
1001
src/egl/drivers/dri/egldri.c
Normal file
File diff suppressed because it is too large
Load Diff
113
src/egl/drivers/dri/egldri.h
Normal file
113
src/egl/drivers/dri/egldri.h
Normal file
@@ -0,0 +1,113 @@
|
||||
#ifndef EGLDRI_INCLUDED
|
||||
#define EGLDRI_INCLUDED
|
||||
|
||||
#include "egldisplay.h"
|
||||
#include "eglscreen.h"
|
||||
#include "eglsurface.h"
|
||||
#include "eglcontext.h"
|
||||
#include "mtypes.h"
|
||||
#include "dri_util.h"
|
||||
#include "drm_sarea.h"
|
||||
|
||||
/**
|
||||
* dri display-specific driver class derived from _EGLDisplay
|
||||
*/
|
||||
typedef struct dri_display
|
||||
{
|
||||
_EGLDisplay Base; /* base class/object */
|
||||
void *pFB;
|
||||
int drmFD; /**< \brief DRM device file descriptor */
|
||||
int minor;
|
||||
unsigned long hFrameBuffer;
|
||||
|
||||
int virtualWidth;
|
||||
int virtualHeight;
|
||||
int fbSize;
|
||||
int bpp;
|
||||
int cpp;
|
||||
int isPCI;
|
||||
int SAREASize;
|
||||
drm_sarea_t *pSAREA;
|
||||
unsigned int serverContext; /**< \brief DRM context only active on server */
|
||||
unsigned long FBStart; /**< \brief physical address of the framebuffer */
|
||||
void *driverClientMsg;
|
||||
int driverClientMsgSize;
|
||||
int chipset;
|
||||
void *driverPrivate;
|
||||
drm_magic_t magic;
|
||||
|
||||
__GLcontextModes *driver_modes;
|
||||
__DRIscreen driScreen;
|
||||
|
||||
} driDisplay;
|
||||
|
||||
/**
|
||||
* dri driver-specific screen class derived from _EGLScreen
|
||||
*/
|
||||
typedef struct dri_screen
|
||||
{
|
||||
_EGLScreen Base;
|
||||
char fb[NAME_MAX];
|
||||
} driScreen;
|
||||
|
||||
|
||||
/**
|
||||
* dri driver-specific surface class derived from _EGLSurface
|
||||
*/
|
||||
typedef struct dri_surface
|
||||
{
|
||||
_EGLSurface Base; /* base class/object */
|
||||
__DRIdrawable drawable;
|
||||
} driSurface;
|
||||
|
||||
|
||||
/**
|
||||
* dri driver-specific context class derived from _EGLContext
|
||||
*/
|
||||
typedef struct dri_context
|
||||
{
|
||||
_EGLContext Base; /* base class/object */
|
||||
__DRIcontext driContext; /**< \brief context dependent methods */
|
||||
} driContext;
|
||||
|
||||
|
||||
|
||||
static inline driDisplay *
|
||||
Lookup_driDisplay(EGLDisplay dpy)
|
||||
{
|
||||
_EGLDisplay *d = _eglLookupDisplay(dpy);
|
||||
return (driDisplay *) d;
|
||||
}
|
||||
|
||||
|
||||
static inline driScreen *
|
||||
Lookup_driScreen(EGLDisplay dpy, EGLScreenMESA screen)
|
||||
{
|
||||
_EGLScreen *s = _eglLookupScreen(dpy, screen);
|
||||
return (driScreen *) s;
|
||||
}
|
||||
|
||||
|
||||
static inline driContext *
|
||||
Lookup_driContext(EGLContext ctx)
|
||||
{
|
||||
_EGLContext *c = _eglLookupContext(ctx);
|
||||
return (driContext *) c;
|
||||
}
|
||||
|
||||
|
||||
static inline driSurface *
|
||||
Lookup_driSurface(EGLSurface surf)
|
||||
{
|
||||
_EGLSurface *s = _eglLookupSurface(surf);
|
||||
return (driSurface *) s;
|
||||
}
|
||||
|
||||
extern void _eglDRIInitDriverFallbacks(_EGLDriver *drv);
|
||||
extern EGLBoolean _eglDRIShowSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA m);
|
||||
extern EGLBoolean _eglDRIInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
extern EGLBoolean _eglDRIGetDisplayInfo(driDisplay *dpy);
|
||||
extern EGLBoolean _eglDRICreateDisplay(driDisplay *dpy, __DRIframebuffer *framebuffer);
|
||||
extern EGLBoolean _eglDRICreateScreen(driDisplay *dpy);
|
||||
|
||||
#endif /* EGLDRI_INCLUDED */
|
@@ -45,7 +45,7 @@ _eglChooseDriver(EGLDisplay display)
|
||||
else if (name[0] == ':' && (name[1] >= '0' && name[1] <= '9') && !name[2]) {
|
||||
printf("EGL: Use driver for screen: %s\n", name);
|
||||
/* XXX probe hardware here to determine which driver to open */
|
||||
/* driverName = "something"; */
|
||||
driverName = "libEGLdri";
|
||||
}
|
||||
else if (name[0] == '!') {
|
||||
/* use specified driver name */
|
||||
@@ -71,44 +71,40 @@ _eglChooseDriver(EGLDisplay display)
|
||||
_EGLDriver *
|
||||
_eglOpenDriver(_EGLDisplay *dpy, const char *driverName)
|
||||
{
|
||||
_EGLDriver *drv;
|
||||
_EGLMain_t mainFunc;
|
||||
void *lib;
|
||||
char driverFilename[1000];
|
||||
|
||||
/* XXX also prepend a directory path??? */
|
||||
sprintf(driverFilename, "%s.so", driverName);
|
||||
|
||||
#if 1
|
||||
lib = dlopen(driverFilename, RTLD_NOW);
|
||||
if (lib) {
|
||||
_EGLDriver *drv;
|
||||
_EGLMain_t mainFunc;
|
||||
|
||||
mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain");
|
||||
if (!mainFunc) {
|
||||
fprintf(stderr, "_eglMain not found in %s", (char *) driverFilename);
|
||||
dlclose(lib);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
drv = mainFunc(dpy);
|
||||
if (!drv) {
|
||||
dlclose(lib);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
drv->LibHandle = lib;
|
||||
drv->Display = dpy;
|
||||
return drv;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "EGLdebug: Error opening %s: %s\n",
|
||||
driverFilename, dlerror());
|
||||
if (!lib) {
|
||||
fprintf(stderr, "EGLdebug: Error opening %s: %s\n", driverFilename, dlerror());
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
/* use built-in driver */
|
||||
return _eglDefaultMain(d);
|
||||
#endif
|
||||
|
||||
mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain");
|
||||
if (!mainFunc) {
|
||||
fprintf(stderr, "_eglMain not found in %s", (char *) driverFilename);
|
||||
dlclose(lib);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
drv = mainFunc(dpy);
|
||||
if (!drv) {
|
||||
dlclose(lib);
|
||||
return NULL;
|
||||
}
|
||||
/* with a recurvise open you want the inner most handle */
|
||||
if (!drv->LibHandle)
|
||||
drv->LibHandle = lib;
|
||||
else
|
||||
dlclose(lib);
|
||||
|
||||
drv->Display = dpy;
|
||||
return drv;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -125,10 +125,7 @@ struct _egl_driver
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
extern _EGLDriver *
|
||||
_eglDefaultMain(NativeDisplayType d);
|
||||
extern _EGLDriver *_eglMain(_EGLDisplay *dpy);
|
||||
|
||||
|
||||
extern _EGLDriver *
|
||||
|
@@ -5,7 +5,7 @@ TOP = ../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
|
||||
DEFINES += -DGLX_DIRECT_RENDERING
|
||||
DEFINES += -DGLX_DIRECT_RENDERING -DIN_MINI_GLX -UIN_DRI_DRIVER
|
||||
|
||||
C_SOURCES = \
|
||||
$(TOP)/src/mesa/main/dispatch.c \
|
||||
|
@@ -68,6 +68,8 @@ typedef struct DRIDriverContextRec {
|
||||
int cpp;
|
||||
int agpmode;
|
||||
int isPCI;
|
||||
|
||||
int colorTiling; /**< \brief color tiling is enabled */
|
||||
|
||||
unsigned long FBStart; /**< \brief physical address of the framebuffer */
|
||||
unsigned long MMIOStart; /**< \brief physical address of the MMIO region */
|
||||
|
@@ -30,3 +30,7 @@ agpmode=1
|
||||
|
||||
# Rotated monitor? -- NOTE: only works with subsetted radeon driver!
|
||||
rotateMode=0
|
||||
|
||||
# Do we want to use color tiling ?
|
||||
colorTiling=0
|
||||
|
||||
|
@@ -104,6 +104,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h> /* for gettimeofday */
|
||||
#include <linux/kd.h>
|
||||
#include <linux/vt.h>
|
||||
|
||||
@@ -115,17 +116,35 @@
|
||||
#include "glapi.h"
|
||||
|
||||
|
||||
extern GLboolean __glXCreateContextWithConfig(__DRInativeDisplay *dpy,
|
||||
static GLboolean __glXCreateContextWithConfig(__DRInativeDisplay *dpy,
|
||||
int screen, int fbconfigID, void *contextID,
|
||||
drm_context_t *hHWContext);
|
||||
|
||||
extern GLboolean __glXGetDrawableInfo(__DRInativeDisplay *dpy, int scrn,
|
||||
static GLboolean __glXGetDrawableInfo(__DRInativeDisplay *dpy, int scrn,
|
||||
__DRIid draw, unsigned int * index, unsigned int * stamp,
|
||||
int * x, int * y, int * width, int * height,
|
||||
int * numClipRects, drm_clip_rect_t ** pClipRects,
|
||||
int * backX, int * backY,
|
||||
int * numBackClipRects, drm_clip_rect_t ** pBackClipRects);
|
||||
|
||||
static __DRIscreen * __glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn);
|
||||
|
||||
static GLboolean __glXWindowExists(__DRInativeDisplay *dpy, __DRIid draw);
|
||||
|
||||
static int __glXGetUST( int64_t * ust );
|
||||
|
||||
static GLboolean __glXGetMscRate(__DRInativeDisplay * dpy, __DRIid drawable,
|
||||
int32_t * numerator, int32_t * denominator);
|
||||
|
||||
static GLboolean xf86DRI_DestroyContext(__DRInativeDisplay *dpy, int screen,
|
||||
__DRIid context_id );
|
||||
|
||||
static GLboolean xf86DRI_CreateDrawable(__DRInativeDisplay *dpy, int screen,
|
||||
__DRIid drawable, drm_drawable_t *hHWDrawable );
|
||||
|
||||
static GLboolean xf86DRI_DestroyDrawable(__DRInativeDisplay *dpy, int screen,
|
||||
__DRIid drawable);
|
||||
|
||||
|
||||
/** Wrapper around either malloc() */
|
||||
void *
|
||||
@@ -418,6 +437,8 @@ SetupFBDev( Display *dpy )
|
||||
width = dpy->driverContext.shared.virtualWidth;
|
||||
height = dpy->driverContext.shared.virtualHeight;
|
||||
|
||||
if (width==832)
|
||||
width=800;
|
||||
/* Bump size up to next supported mode.
|
||||
*/
|
||||
if (width <= 720 && height <= 480) {
|
||||
@@ -440,8 +461,6 @@ SetupFBDev( Display *dpy )
|
||||
}
|
||||
|
||||
|
||||
dpy->driverContext.shared.virtualHeight = height;
|
||||
dpy->driverContext.shared.virtualWidth = width;
|
||||
dpy->driverContext.shared.fbStride = width * (dpy->driverContext.bpp / 8);
|
||||
|
||||
/* set the depth, resolution, etc */
|
||||
@@ -726,7 +745,7 @@ CloseFBDev( Display *dpy )
|
||||
* \internal
|
||||
* Returns the MiniGLXDisplayRec::driScreen attribute.
|
||||
*/
|
||||
__DRIscreen *
|
||||
static __DRIscreen *
|
||||
__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn)
|
||||
{
|
||||
(void) scrn;
|
||||
@@ -743,11 +762,11 @@ __glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn)
|
||||
* Since Mini GLX only supports one window, compares the specified drawable with
|
||||
* the MiniGLXDisplayRec::TheWindow attribute.
|
||||
*/
|
||||
Bool
|
||||
__glXWindowExists(__DRInativeDisplay *dpy, GLXDrawable draw)
|
||||
static GLboolean
|
||||
__glXWindowExists(__DRInativeDisplay *dpy, __DRIid draw)
|
||||
{
|
||||
Display* display = (Display*)dpy;
|
||||
if (display->TheWindow == draw)
|
||||
const Display * const display = (Display*)dpy;
|
||||
if (display->TheWindow == (Window) draw)
|
||||
return True;
|
||||
else
|
||||
return False;
|
||||
@@ -859,6 +878,7 @@ static int __read_config_file( Display *dpy )
|
||||
dpy->rotateMode = 0;
|
||||
dpy->driverContext.agpmode = 1;
|
||||
dpy->driverContext.isPCI = 0;
|
||||
dpy->driverContext.colorTiling = 0;
|
||||
|
||||
fname = getenv("MINIGLX_CONF");
|
||||
if (!fname) fname = "/etc/miniglx.conf";
|
||||
@@ -931,6 +951,9 @@ static int __read_config_file( Display *dpy )
|
||||
else if (strcmp(opt, "isPCI") == 0) {
|
||||
dpy->driverContext.isPCI = atoi(val) ? 1 : 0;
|
||||
}
|
||||
else if (strcmp(opt, "colorTiling") == 0) {
|
||||
dpy->driverContext.colorTiling = atoi(val) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
@@ -941,6 +964,19 @@ static int __read_config_file( Display *dpy )
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Versioned name of the expected \c __driCreateNewScreen function.
|
||||
*
|
||||
* The version of the last incompatible loader/driver inteface change is
|
||||
* appended to the name of the \c __driCreateNewScreen function. This
|
||||
* prevents loaders from trying to load drivers that are too old.
|
||||
*
|
||||
* \todo
|
||||
* Create a macro or something so that this is automatically updated.
|
||||
*/
|
||||
static const char createNewScreenName[] = "__driCreateNewScreen_20050727";
|
||||
|
||||
|
||||
static int InitDriver( Display *dpy )
|
||||
{
|
||||
/*
|
||||
@@ -968,9 +1004,9 @@ static int InitDriver( Display *dpy )
|
||||
/* Pull in standard DRI client-side driver hooks:
|
||||
*/
|
||||
dpy->createNewScreen = (PFNCREATENEWSCREENFUNC)
|
||||
dlsym(dpy->dlHandle, "__driCreateNewScreen");
|
||||
dlsym(dpy->dlHandle, createNewScreenName);
|
||||
if (!dpy->createNewScreen) {
|
||||
fprintf(stderr, "Couldn't find __driCreateScreen in %s\n",
|
||||
fprintf(stderr, "Couldn't find %s in %s\n", createNewScreenName,
|
||||
dpy->clientDriverName);
|
||||
goto failed;
|
||||
}
|
||||
@@ -1083,10 +1119,43 @@ __miniglx_StartServer( const char *display_name )
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implement \c __DRIinterfaceMethods::getProcAddress.
|
||||
*/
|
||||
static __DRIfuncPtr get_proc_address( const char * proc_name )
|
||||
{
|
||||
(void) proc_name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Table of functions exported by the loader to the driver.
|
||||
*/
|
||||
static const __DRIinterfaceMethods interface_methods = {
|
||||
get_proc_address,
|
||||
|
||||
_gl_context_modes_create,
|
||||
_gl_context_modes_destroy,
|
||||
|
||||
__glXFindDRIScreen,
|
||||
__glXWindowExists,
|
||||
|
||||
__glXCreateContextWithConfig,
|
||||
xf86DRI_DestroyContext,
|
||||
|
||||
xf86DRI_CreateDrawable,
|
||||
xf86DRI_DestroyDrawable,
|
||||
__glXGetDrawableInfo,
|
||||
|
||||
__glXGetUST,
|
||||
__glXGetMscRate,
|
||||
};
|
||||
|
||||
|
||||
static void *
|
||||
CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
|
||||
{
|
||||
int directCapable;
|
||||
void *psp = NULL;
|
||||
drm_handle_t hSAREA;
|
||||
drmAddress pSAREA;
|
||||
@@ -1102,11 +1171,8 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
|
||||
const char * err_extra;
|
||||
drmVersionPtr version;
|
||||
drm_handle_t hFB;
|
||||
int junk;
|
||||
drm_magic_t magic;
|
||||
|
||||
err_msg = "XF86DRIOpenConnection";
|
||||
err_extra = NULL;
|
||||
|
||||
hSAREA = dpy->driverContext.shared.hSAREA;
|
||||
BusID = dpy->driverContext.pciBusID;
|
||||
@@ -1149,7 +1215,6 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
|
||||
* We'll check the version in each DRI driver's "createScreen"
|
||||
* function.
|
||||
*/
|
||||
err_msg = "XF86DRIGetClientDriverName";
|
||||
ddx_version.major = 4;
|
||||
ddx_version.minor = 0;
|
||||
ddx_version.patch = 0;
|
||||
@@ -1157,7 +1222,6 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
|
||||
/*
|
||||
* Get the DRI X extension version.
|
||||
*/
|
||||
err_msg = "XF86DRIQueryVersion";
|
||||
dri_version.major = 4;
|
||||
dri_version.minor = 0;
|
||||
dri_version.patch = 0;
|
||||
@@ -1168,7 +1232,6 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
|
||||
* that has information about the screen size, depth, pitch,
|
||||
* ancilliary buffers, DRM mmap handles, etc.
|
||||
*/
|
||||
err_msg = "XF86DRIGetDeviceInfo";
|
||||
hFB = dpy->driverContext.shared.hFrameBuffer;
|
||||
framebuffer.size = dpy->driverContext.shared.fbSize;
|
||||
framebuffer.stride = dpy->driverContext.shared.fbStride;
|
||||
@@ -1198,11 +1261,6 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
|
||||
err_extra = strerror( -status );
|
||||
|
||||
if ( status == 0 ) {
|
||||
PFNGLXGETINTERNALVERSIONPROC get_ver;
|
||||
|
||||
get_ver = (PFNGLXGETINTERNALVERSIONPROC)
|
||||
glXGetProcAddress( (const GLubyte *) "__glXGetInternalVersion" );
|
||||
|
||||
err_msg = "InitDriver";
|
||||
err_extra = NULL;
|
||||
psp = dpy->createNewScreen(dpy, scrn, psc, NULL,
|
||||
@@ -1212,7 +1270,8 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
|
||||
& framebuffer,
|
||||
pSAREA,
|
||||
fd,
|
||||
(get_ver != NULL) ? (*get_ver)() : 20040602,
|
||||
20050727,
|
||||
& interface_methods,
|
||||
(__GLcontextModes **) &dpy->driver_modes);
|
||||
|
||||
/* fill in dummy visual ids */
|
||||
@@ -2083,7 +2142,7 @@ glXDestroyContext( Display *dpy, GLXContext ctx )
|
||||
if (ctx) {
|
||||
if (glxctx == ctx) {
|
||||
/* destroying current context */
|
||||
ctx->driContext.bindContext3(dpy, 0, 0, 0, 0);
|
||||
ctx->driContext.bindContext(dpy, 0, 0, 0, 0);
|
||||
CurrentContext = 0;
|
||||
}
|
||||
ctx->driContext.destroyContext(dpy, 0, ctx->driContext.private);
|
||||
@@ -2126,20 +2185,20 @@ glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx)
|
||||
GLXDrawable oldDrawable = glXGetCurrentDrawable();
|
||||
/* unbind old */
|
||||
if (oldContext) {
|
||||
oldContext->driContext.unbindContext3(dpy, 0,
|
||||
oldContext->driContext.unbindContext(dpy, 0,
|
||||
(__DRIid) oldDrawable, (__DRIid) oldDrawable,
|
||||
&oldContext->driContext);
|
||||
}
|
||||
/* bind new */
|
||||
CurrentContext = ctx;
|
||||
ctx->driContext.bindContext3(dpy, 0, (__DRIid) drawable,
|
||||
ctx->driContext.bindContext(dpy, 0, (__DRIid) drawable,
|
||||
(__DRIid) drawable, &ctx->driContext);
|
||||
ctx->drawBuffer = drawable;
|
||||
ctx->curBuffer = drawable;
|
||||
}
|
||||
else if (ctx && dpy) {
|
||||
/* unbind */
|
||||
ctx->driContext.bindContext3(dpy, 0, 0, 0, 0);
|
||||
ctx->driContext.bindContext(dpy, 0, 0, 0, 0);
|
||||
}
|
||||
else if (dpy) {
|
||||
CurrentContext = 0; /* kw: this seems to be intended??? */
|
||||
@@ -2210,7 +2269,7 @@ glXGetCurrentDrawable( void )
|
||||
}
|
||||
|
||||
|
||||
GLboolean
|
||||
static GLboolean
|
||||
__glXCreateContextWithConfig(__DRInativeDisplay *dpy, int screen,
|
||||
int fbconfigID, void *contextID, drm_context_t *hHWContext)
|
||||
{
|
||||
@@ -2236,7 +2295,7 @@ __glXCreateContextWithConfig(__DRInativeDisplay *dpy, int screen,
|
||||
}
|
||||
|
||||
|
||||
GLboolean
|
||||
static GLboolean
|
||||
__glXGetDrawableInfo(__DRInativeDisplay *dpy, int scrn,
|
||||
__DRIid draw, unsigned int * index, unsigned int * stamp,
|
||||
int * x, int * y, int * width, int * height,
|
||||
@@ -2278,23 +2337,23 @@ __glXGetDrawableInfo(__DRInativeDisplay *dpy, int scrn,
|
||||
}
|
||||
|
||||
|
||||
GLboolean
|
||||
XF86DRIDestroyContext(__DRInativeDisplay *dpy, int screen, __DRIid context_id )
|
||||
static GLboolean
|
||||
xf86DRI_DestroyContext(__DRInativeDisplay *dpy, int screen, __DRIid context_id )
|
||||
{
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
GLboolean
|
||||
XF86DRICreateDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable,
|
||||
static GLboolean
|
||||
xf86DRI_CreateDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable,
|
||||
drm_drawable_t *hHWDrawable )
|
||||
{
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
GLboolean
|
||||
XF86DRIDestroyDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable)
|
||||
static GLboolean
|
||||
xf86DRI_DestroyDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable)
|
||||
{
|
||||
return GL_TRUE;
|
||||
}
|
||||
@@ -2348,12 +2407,6 @@ void (*glXGetProcAddress(const GLubyte *procname))( void )
|
||||
{ "glXDestroyPbuffer", (void *) glXDestroyPbuffer },
|
||||
{ "glXChooseFBConfig", (void *) glXChooseFBConfig },
|
||||
{ "glXGetVisualFromFBConfig", (void *) glXGetVisualFromFBConfig },
|
||||
{ "__glXCreateContextWithConfig", (void *) __glXCreateContextWithConfig },
|
||||
{ "__glXGetDrawableInfo", (void *) __glXGetDrawableInfo },
|
||||
{ "__glXWindowExists", (void *) __glXWindowExists },
|
||||
{ "__glXCreateContextModes", (void *) _gl_context_modes_create },
|
||||
{ "__glXFindDRIScreen", (void *)__glXFindDRIScreen },
|
||||
{ "__glXScrEnableExtension", (void *)__glXScrEnableExtension },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
const struct name_address *entry;
|
||||
@@ -2438,32 +2491,73 @@ void *glXAllocateMemoryMESA(Display *dpy, int scrn,
|
||||
size_t size, float readFreq,
|
||||
float writeFreq, float priority)
|
||||
{
|
||||
if (dpy->driScreen.private && dpy->driScreen.allocateMemory) {
|
||||
return (*dpy->driScreen.allocateMemory)( dpy, scrn, size,
|
||||
readFreq, writeFreq,
|
||||
priority );
|
||||
}
|
||||
if (dpy->driScreen.private && dpy->driScreen.allocateMemory) {
|
||||
return (*dpy->driScreen.allocateMemory)( dpy, scrn, size,
|
||||
readFreq, writeFreq,
|
||||
priority );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer){
|
||||
if (dpy->driScreen.private && dpy->driScreen.freeMemory) {
|
||||
(*dpy->driScreen.freeMemory)( dpy, scrn, pointer );
|
||||
}
|
||||
void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
|
||||
{
|
||||
if (dpy->driScreen.private && dpy->driScreen.freeMemory) {
|
||||
(*dpy->driScreen.freeMemory)( dpy, scrn, pointer );
|
||||
}
|
||||
}
|
||||
|
||||
GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
|
||||
const void *pointer )
|
||||
{
|
||||
if (dpy->driScreen.private && dpy->driScreen.memoryOffset) {
|
||||
return (*dpy->driScreen.memoryOffset)( dpy, scrn, pointer );
|
||||
}
|
||||
if (dpy->driScreen.private && dpy->driScreen.memoryOffset) {
|
||||
return (*dpy->driScreen.memoryOffset)( dpy, scrn, pointer );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
__glXScrEnableExtension( void *psc, const char * name )
|
||||
|
||||
/**
|
||||
* Get the unadjusted system time (UST). Currently, the UST is measured in
|
||||
* microseconds since Epoc. The actual resolution of the UST may vary from
|
||||
* system to system, and the units may vary from release to release.
|
||||
* Drivers should not call this function directly. They should instead use
|
||||
* \c glXGetProcAddress to obtain a pointer to the function.
|
||||
*
|
||||
* \param ust Location to store the 64-bit UST
|
||||
* \returns Zero on success or a negative errno value on failure.
|
||||
*
|
||||
* \note
|
||||
* This function was copied directly from src/glx/x11/glxcmds.c.
|
||||
*/
|
||||
static int __glXGetUST( int64_t * ust )
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
if ( ust == NULL ) {
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if ( gettimeofday( & tv, NULL ) == 0 ) {
|
||||
ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
|
||||
return 0;
|
||||
} else {
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* \bug
|
||||
* This needs to be implemented for miniGlx.
|
||||
*/
|
||||
static GLboolean __glXGetMscRate(__DRInativeDisplay * dpy, __DRIid drawable,
|
||||
int32_t * numerator, int32_t * denominator)
|
||||
{
|
||||
*numerator = 0;
|
||||
*denominator = 0;
|
||||
return False;
|
||||
}
|
||||
/*@}*/
|
||||
|
@@ -199,9 +199,6 @@ extern int send_char_msg( Display *dpy, int i, char msg );
|
||||
extern int blocking_read( Display *dpy, int connection, char *msg, size_t msg_size );
|
||||
extern int handle_fd_events( Display *dpy, int nonblock );
|
||||
|
||||
|
||||
extern Bool __glXWindowExists(__DRInativeDisplay *dpy, GLXDrawable draw);
|
||||
|
||||
extern int __miniglx_open_connections( Display *dpy );
|
||||
extern void __miniglx_close_connections( Display *dpy );
|
||||
|
||||
|
@@ -1,24 +1,15 @@
|
||||
TOP = ../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
# Context creation has evolved over the years, such that this
|
||||
# code will not build with DNIO defined. When we finally drop old interface
|
||||
# support in libGL, we need to clean up both glxcmds.c and dri_interface.h.
|
||||
|
||||
DEFINES += -DGLX_DIRECT_RENDERING -DGLXEXT -DXF86DRI -DGLX_USE_DLOPEN \
|
||||
-DGLX_USE_MESA -DXF86VIDMODE -D_REENTRANT -UIN_DRI_DRIVER
|
||||
DEFINES += -DXF86VIDMODE -D_REENTRANT -UIN_DRI_DRIVER
|
||||
|
||||
C_SOURCES = \
|
||||
$(TOP)/src/mesa/glapi/glapi.c \
|
||||
$(TOP)/src/mesa/glapi/glthread.c \
|
||||
$(TOP)/src/mesa/main/dispatch.c \
|
||||
glcontextmodes.c \
|
||||
$(DRM_SOURCE_PATH)/libdrm/xf86drm.c \
|
||||
$(DRM_SOURCE_PATH)/libdrm/xf86drmHash.c \
|
||||
$(DRM_SOURCE_PATH)/libdrm/xf86drmRandom.c \
|
||||
$(DRM_SOURCE_PATH)/libdrm/xf86drmSL.c \
|
||||
clientattrib.c \
|
||||
compsize.c \
|
||||
dispatch.c \
|
||||
eval.c \
|
||||
glxcmds.c \
|
||||
glxext.c \
|
||||
@@ -55,16 +46,10 @@ OBJECTS = $(C_SOURCES:.c=.o) \
|
||||
INCLUDES = -I. \
|
||||
-I$(TOP)/include \
|
||||
-I$(TOP)/include/GL/internal \
|
||||
-I$(TOP)/src/mesa \
|
||||
-I$(TOP)/src/mesa/main \
|
||||
-I$(TOP)/src/mesa/glapi \
|
||||
-I$(TOP)/src/mesa/math \
|
||||
-I$(TOP)/src/mesa/transform \
|
||||
-I$(TOP)/src/mesa/swrast \
|
||||
-I$(TOP)/src/mesa/swrast_setup \
|
||||
-I$(TOP)/src/mesa/drivers/dri/common \
|
||||
-I$(DRM_SOURCE_PATH)/libdrm \
|
||||
-I$(DRM_SOURCE_PATH)/shared-core \
|
||||
`pkg-config --cflags libdrm` \
|
||||
$(X11_INCLUDES)
|
||||
|
||||
|
||||
@@ -83,9 +68,6 @@ default: depend $(LIB_DIR)/$(GL_LIB_NAME)
|
||||
glcontextmodes.c:
|
||||
ln -s $(TOP)/src/mesa/drivers/dri/common/glcontextmodes.c .
|
||||
|
||||
dispatch.c:
|
||||
ln -s $(TOP)/src/mesa/main/dispatch.c .
|
||||
|
||||
# Make libGL
|
||||
$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile
|
||||
$(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \
|
||||
@@ -93,10 +75,6 @@ $(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile
|
||||
-install $(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS)
|
||||
|
||||
|
||||
drmtest: xf86drm.o drmtest.o
|
||||
rm -f drmtest && $(CC) -o drmtest xf86drm.o drmtest.o
|
||||
|
||||
|
||||
depend: $(C_SOURCES) $(ASM_SOURCES) Makefile
|
||||
touch depend
|
||||
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(ASM_SOURCES)
|
||||
|
@@ -40,7 +40,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#define NEED_REPLIES
|
||||
#include <X11/Xlibint.h>
|
||||
#include <X11/extensions/Xext.h>
|
||||
#include "extutil.h"
|
||||
#include <X11/extensions/extutil.h>
|
||||
#include "glheader.h"
|
||||
#include "xf86dristr.h"
|
||||
|
||||
|
@@ -38,7 +38,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#include <unistd.h>
|
||||
#include <X11/Xlibint.h>
|
||||
#include <X11/extensions/Xext.h>
|
||||
#include "extutil.h"
|
||||
#include <X11/extensions/extutil.h>
|
||||
#include "glxclient.h"
|
||||
#include "xf86dri.h"
|
||||
#include "sarea.h"
|
||||
|
@@ -31,8 +31,8 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "glxclient.h"
|
||||
#include <extutil.h>
|
||||
#include <Xext.h>
|
||||
#include <X11/extensions/extutil.h>
|
||||
#include <X11/extensions/Xext.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "glapi.h"
|
||||
|
@@ -60,8 +60,8 @@
|
||||
#include "GL/internal/glcore.h"
|
||||
#include "glapitable.h"
|
||||
#include "glxextensions.h"
|
||||
#if defined( XTHREADS )
|
||||
# include "Xthreads.h"
|
||||
#if defined( USE_XTHREADS )
|
||||
# include <X11/Xthreads.h>
|
||||
#elif defined( PTHREADS )
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
@@ -154,51 +154,6 @@ typedef struct __GLXpixelStoreModeRec {
|
||||
GLuint alignment;
|
||||
} __GLXpixelStoreMode;
|
||||
|
||||
/* The next 3 structures are deprecated. Client state is no longer tracked
|
||||
* using them. They only remain to maintain the layout / structure offset of
|
||||
* __GLXcontextRec. In XFree86 5.0 they will be removed altogether.
|
||||
*/
|
||||
|
||||
typedef struct __GLXvertexArrayPointerStateRecDEPRECATED {
|
||||
GLboolean enable;
|
||||
void (*proc)(const void *);
|
||||
const GLubyte *ptr;
|
||||
GLsizei skip;
|
||||
GLint size;
|
||||
GLenum type;
|
||||
GLsizei stride;
|
||||
} __GLXvertexArrayPointerStateDEPRECATED;
|
||||
|
||||
typedef struct __GLXvertArrayStateRecDEPRECATED {
|
||||
__GLXvertexArrayPointerStateDEPRECATED vertex;
|
||||
__GLXvertexArrayPointerStateDEPRECATED normal;
|
||||
__GLXvertexArrayPointerStateDEPRECATED color;
|
||||
__GLXvertexArrayPointerStateDEPRECATED index;
|
||||
__GLXvertexArrayPointerStateDEPRECATED texCoord[__GLX_MAX_TEXTURE_UNITS];
|
||||
__GLXvertexArrayPointerStateDEPRECATED edgeFlag;
|
||||
GLint maxElementsVertices;
|
||||
GLint maxElementsIndices;
|
||||
GLint activeTexture;
|
||||
} __GLXvertArrayStateDEPRECATED;
|
||||
|
||||
typedef struct __GLXattributeRecDEPRECATED {
|
||||
GLuint mask;
|
||||
|
||||
/*
|
||||
** Pixel storage state. Most of the pixel store mode state is kept
|
||||
** here and used by the client code to manage the packing and
|
||||
** unpacking of data sent to/received from the server.
|
||||
*/
|
||||
__GLXpixelStoreMode storePack, storeUnpack;
|
||||
|
||||
/*
|
||||
** Vertex Array storage state. The vertex array component
|
||||
** state is stored here and is used to manage the packing of
|
||||
** DrawArrays data sent to the server.
|
||||
*/
|
||||
__GLXvertArrayStateDEPRECATED vertArray;
|
||||
} __GLXattributeDEPRECATED;
|
||||
|
||||
|
||||
typedef struct __GLXattributeRec {
|
||||
GLuint mask;
|
||||
@@ -330,12 +285,9 @@ struct __GLXcontextRec {
|
||||
GLenum, const GLvoid*, GLubyte*, GLubyte*);
|
||||
|
||||
/**
|
||||
* \name Client side attribs.
|
||||
* Client side attribs.
|
||||
*/
|
||||
/*@{*/
|
||||
__GLXattributeDEPRECATED stateDEPRECATED;
|
||||
__GLXattributeMachine attributes;
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Client side error code. This is set when client side gl API
|
||||
@@ -595,7 +547,7 @@ extern __GLXdisplayPrivate *__glXInitialize(Display*);
|
||||
extern int __glXDebug;
|
||||
|
||||
/* This is per-thread storage in an MT environment */
|
||||
#if defined( XTHREADS ) || defined( PTHREADS )
|
||||
#if defined( USE_XTHREADS ) || defined( PTHREADS )
|
||||
|
||||
extern void __glXSetCurrentContext(__GLXcontext *c);
|
||||
|
||||
@@ -618,14 +570,14 @@ extern __GLXcontext *__glXcurrentContext;
|
||||
#define __glXGetCurrentContext() __glXcurrentContext
|
||||
#define __glXSetCurrentContext(gc) __glXcurrentContext = gc
|
||||
|
||||
#endif /* defined( XTHREADS ) || defined( PTHREADS ) */
|
||||
#endif /* defined( USE_XTHREADS ) || defined( PTHREADS ) */
|
||||
|
||||
|
||||
/*
|
||||
** Global lock for all threads in this address space using the GLX
|
||||
** extension
|
||||
*/
|
||||
#if defined( XTHREADS )
|
||||
#if defined( USE_XTHREADS )
|
||||
extern xmutex_rec __glXmutex;
|
||||
#define __glXLock() xmutex_lock(&__glXmutex)
|
||||
#define __glXUnlock() xmutex_unlock(&__glXmutex)
|
||||
|
@@ -41,14 +41,14 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "glxclient.h"
|
||||
#include <extutil.h>
|
||||
#include <Xext.h>
|
||||
#include <X11/extensions/extutil.h>
|
||||
#include <X11/extensions/Xext.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "glapi.h"
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#include "indirect_init.h"
|
||||
#include "xf86vmode.h"
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
#include "xf86dri.h"
|
||||
#endif
|
||||
#include "glxextensions.h"
|
||||
@@ -1269,7 +1269,7 @@ PUBLIC const char *glXQueryExtensionsString( Display *dpy, int screen )
|
||||
|
||||
__glXCalculateUsableExtensions(psc,
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
(priv->driDisplay.private != NULL),
|
||||
(psc->driScreen.private != NULL),
|
||||
#else
|
||||
GL_FALSE,
|
||||
#endif
|
||||
|
@@ -46,16 +46,11 @@
|
||||
|
||||
#include "glxclient.h"
|
||||
#include <stdio.h>
|
||||
#include <Xext.h>
|
||||
#include <extutil.h>
|
||||
#include <X11/extensions/Xext.h>
|
||||
#include <X11/extensions/extutil.h>
|
||||
#include <assert.h>
|
||||
#include "indirect_init.h"
|
||||
#include "glapi.h"
|
||||
#ifdef XTHREADS
|
||||
# include "Xthreads.h"
|
||||
#elif defined(PTHREADS)
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
#include "glxextensions.h"
|
||||
#include "glcontextmodes.h"
|
||||
#include "glheader.h"
|
||||
@@ -150,7 +145,7 @@ static __GLapi *IndirectAPI = NULL;
|
||||
* Current context management and locking
|
||||
*/
|
||||
|
||||
#if defined( XTHREADS )
|
||||
#if defined( USE_XTHREADS )
|
||||
|
||||
/* thread safe */
|
||||
static GLboolean TSDinitialized = GL_FALSE;
|
||||
@@ -733,7 +728,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc,
|
||||
__DRIscreenPrivate *psp = NULL;
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
drm_handle_t hSAREA;
|
||||
drmAddress pSAREA;
|
||||
drmAddress pSAREA = MAP_FAILED;
|
||||
char *BusID;
|
||||
__DRIversion ddx_version;
|
||||
__DRIversion dri_version;
|
||||
@@ -754,6 +749,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc,
|
||||
err_msg = "XF86DRIOpenConnection";
|
||||
err_extra = NULL;
|
||||
|
||||
framebuffer.base = MAP_FAILED;
|
||||
framebuffer.dev_priv = NULL;
|
||||
|
||||
if (XF86DRIOpenConnection(dpy, scrn, &hSAREA, &BusID)) {
|
||||
@@ -1111,7 +1107,7 @@ __GLXdisplayPrivate *__glXInitialize(Display* dpy)
|
||||
XEDataObject dataObj;
|
||||
int major, minor;
|
||||
|
||||
#if defined(XTHREADS)
|
||||
#if defined(USE_XTHREADS)
|
||||
{
|
||||
static int firstCall = 1;
|
||||
if (firstCall) {
|
||||
@@ -1593,7 +1589,9 @@ USED static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw,
|
||||
|
||||
oldGC->currentContextTag = 0;
|
||||
}
|
||||
|
||||
|
||||
_glapi_check_multithread();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
/* Unbind the old direct rendering context */
|
||||
if (oldGC->isDirect) {
|
||||
@@ -1613,7 +1611,6 @@ USED static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw,
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
_glapi_check_multithread();
|
||||
/* Send a glXMakeCurrent request to bind the new context. */
|
||||
LockDisplay(dpy);
|
||||
|
||||
|
@@ -29,8 +29,8 @@
|
||||
*/
|
||||
|
||||
#include "glxclient.h"
|
||||
#include <extutil.h>
|
||||
#include <Xext.h>
|
||||
#include <X11/extensions/extutil.h>
|
||||
#include <X11/extensions/Xext.h>
|
||||
#include <string.h>
|
||||
#include "glapi.h"
|
||||
#include "glxextensions.h"
|
||||
|
@@ -29,10 +29,6 @@
|
||||
#include <GL/gl.h>
|
||||
#include "indirect_size.h"
|
||||
|
||||
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
|
||||
# define HAVE_ALIAS
|
||||
# endif
|
||||
|
||||
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define PURE __attribute__((pure))
|
||||
# else
|
||||
@@ -365,10 +361,7 @@ ALIAS( Map2f, Map2d )
|
||||
ALIAS( ColorTableParameteriv, ColorTableParameterfv )
|
||||
ALIAS( ConvolutionParameteriv, ConvolutionParameterfv )
|
||||
ALIAS( PointParameterivNV, PointParameterfvEXT )
|
||||
ALIAS( PointParameterfvARB, PointParameterfvEXT )
|
||||
ALIAS( PointParameteriv, PointParameterfvEXT )
|
||||
|
||||
# undef HAVE_ALIAS
|
||||
# undef PURE
|
||||
# undef FASTCALL
|
||||
# undef INTERNAL
|
||||
|
@@ -211,12 +211,14 @@ struct array_state_vector {
|
||||
* There are some bytes of extra data before \c array_info_cache that is
|
||||
* used to hold the header for RenderLarge commands. This is
|
||||
* \b not included in \c array_info_cache_size or
|
||||
* \c array_info_cache_buffer_size.
|
||||
* \c array_info_cache_buffer_size. \c array_info_cache_base stores a
|
||||
* pointer to the true start of the buffer (i.e., what malloc returned).
|
||||
*/
|
||||
/*@{*/
|
||||
size_t array_info_cache_size;
|
||||
size_t array_info_cache_buffer_size;
|
||||
void * array_info_cache;
|
||||
void * array_info_cache_base;
|
||||
/*@}*/
|
||||
|
||||
|
||||
|
@@ -382,13 +382,14 @@ allocate_array_info_cache( struct array_state_vector * arrays,
|
||||
{
|
||||
#define MAX_HEADER_SIZE 20
|
||||
if ( arrays->array_info_cache_buffer_size < required_size ) {
|
||||
GLubyte * temp = realloc( arrays->array_info_cache, required_size
|
||||
+ MAX_HEADER_SIZE );
|
||||
GLubyte * temp = realloc( arrays->array_info_cache_base,
|
||||
required_size + MAX_HEADER_SIZE );
|
||||
|
||||
if ( temp == NULL ) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
arrays->array_info_cache_base = temp;
|
||||
arrays->array_info_cache = temp + MAX_HEADER_SIZE;
|
||||
arrays->array_info_cache_buffer_size = required_size;
|
||||
}
|
||||
|
@@ -10,15 +10,13 @@ COMMON_SOURCES = \
|
||||
../common/vblank.c \
|
||||
../common/dri_util.c \
|
||||
../common/xmlconfig.c \
|
||||
../common/drirenderbuffer.c \
|
||||
../common/glcontextmodes.c
|
||||
../common/drirenderbuffer.c
|
||||
|
||||
ifeq ($(WINDOW_SYSTEM),dri)
|
||||
WINOBJ=../dri_client/dri.a
|
||||
WINOBJ=
|
||||
WINLIB=
|
||||
INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES) \
|
||||
-I../dri_client \
|
||||
-I../dri_client/imports
|
||||
`pkg-config --cflags libdrm`
|
||||
|
||||
OBJECTS = $(C_SOURCES:.c=.o) \
|
||||
$(ASM_SOURCES:.S=.o)
|
||||
@@ -54,7 +52,8 @@ SHARED_INCLUDES = \
|
||||
-I$(TOP)/src/mesa/shader \
|
||||
-I$(TOP)/src/mesa/swrast \
|
||||
-I$(TOP)/src/mesa/swrast_setup \
|
||||
-I$(TOP)/src/egl/main
|
||||
-I$(TOP)/src/egl/main \
|
||||
-I$(TOP)/src/egl/drivers/dri
|
||||
|
||||
##### RULES #####
|
||||
|
||||
|
@@ -31,7 +31,6 @@
|
||||
|
||||
#include "dri_util.h"
|
||||
#include "drm_sarea.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
#ifndef GLX_OML_sync_control
|
||||
typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRInativeDisplay *dpy, __DRIid drawable, int32_t *numerator, int32_t *denominator);
|
||||
@@ -41,14 +40,6 @@ typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRInativeDisplay *dpy, __DRIid
|
||||
*/
|
||||
const __DRIinterfaceMethods * dri_interface = NULL;
|
||||
|
||||
/**
|
||||
* Weak thread-safety dispatch pointer. Older versions of libGL will not have
|
||||
* this symbol, so a "weak" version is included here so that the driver will
|
||||
* dynamically link properly. The value is set to \c NULL. This forces the
|
||||
* driver to fall back to the old dispatch interface.
|
||||
*/
|
||||
struct _glapi_table *_glapi_DispatchTSD __attribute__((weak)) = NULL;
|
||||
|
||||
/**
|
||||
* This is used in a couple of places that call \c driCreateNewDrawable.
|
||||
*/
|
||||
@@ -836,7 +827,7 @@ static void driDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPriv
|
||||
_mesa_free(psp->pDevPriv);
|
||||
(void)drmClose(psp->fd);
|
||||
if ( psp->modes != NULL ) {
|
||||
_gl_context_modes_destroy( psp->modes );
|
||||
(*dri_interface->destroyContextModes)( psp->modes );
|
||||
}
|
||||
_mesa_free(psp);
|
||||
}
|
||||
|
@@ -31,11 +31,11 @@
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
#ifdef IN_DRI_DRIVER
|
||||
#if defined(IN_MINI_GLX)
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <GL/gl.h>
|
||||
# include "dri_interface.h"
|
||||
# include "GL/internal/dri_interface.h"
|
||||
# include "imports.h"
|
||||
# define __glXMemset memset
|
||||
#else
|
||||
@@ -55,11 +55,11 @@ extern void __glXFree( void * ptr );
|
||||
# define _mesa_malloc(b) Xmalloc(b)
|
||||
# define _mesa_free(m) Xfree(m)
|
||||
# endif /* XFree86Server */
|
||||
#endif /* !defined(IN_DRI_DRIVER) */
|
||||
#endif /* !defined(IN_MINI_GLX) */
|
||||
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
#if !defined(IN_DRI_DRIVER)
|
||||
#if !defined(IN_MINI_GLX)
|
||||
#define NUM_VISUAL_TYPES 6
|
||||
|
||||
/**
|
||||
@@ -320,7 +320,7 @@ _gl_get_context_mode_data(const __GLcontextModes *mode, int attribute,
|
||||
return GLX_BAD_ATTRIBUTE;
|
||||
}
|
||||
}
|
||||
#endif /* !defined(IN_DRI_DRIVER) */
|
||||
#endif /* !defined(IN_MINI_GLX) */
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -32,14 +32,14 @@
|
||||
|
||||
#include "GL/internal/glcore.h"
|
||||
|
||||
#if !defined(IN_DRI_DRIVER)
|
||||
#if !defined(IN_MINI_GLX)
|
||||
extern GLint _gl_convert_from_x_visual_type( int visualType );
|
||||
extern GLint _gl_convert_to_x_visual_type( int visualType );
|
||||
extern void _gl_copy_visual_to_context_mode( __GLcontextModes * mode,
|
||||
const __GLXvisualConfig * config );
|
||||
extern int _gl_get_context_mode_data( const __GLcontextModes *mode,
|
||||
int attribute, int *value_return );
|
||||
#endif /* !defined(IN_DRI_DRIVER) */
|
||||
#endif /* !defined(IN_MINI_GLX) */
|
||||
|
||||
extern __GLcontextModes * _gl_context_modes_create( unsigned count,
|
||||
size_t minimum_size );
|
||||
|
@@ -36,7 +36,7 @@
|
||||
#include "utils.h"
|
||||
#include "dispatch.h"
|
||||
|
||||
unsigned driDispatchRemapTable[ driDispatchRemapTable_size ];
|
||||
int driDispatchRemapTable[ driDispatchRemapTable_size ];
|
||||
|
||||
#if defined(USE_X86_ASM)
|
||||
#include "x86/common_x86_asm.h"
|
||||
@@ -188,17 +188,26 @@ driGetRendererString( char * buffer, const char * hardware_name,
|
||||
#define need_GL_EXT_vertex_array
|
||||
#define need_GL_MESA_window_pos
|
||||
|
||||
/* These are needed in *all* drivers because Mesa internally implements
|
||||
* certain functionality in terms of functions provided by these extensions.
|
||||
* For example, glBlendFunc is implemented by calling glBlendFuncSeparateEXT.
|
||||
*/
|
||||
#define need_GL_EXT_blend_func_separate
|
||||
#define need_GL_NV_vertex_program
|
||||
|
||||
#include "extension_helper.h"
|
||||
|
||||
static const struct dri_extension all_mesa_extensions[] = {
|
||||
{ "GL_ARB_multisample", GL_ARB_multisample_functions },
|
||||
{ "GL_ARB_transpose_matrix", GL_ARB_transpose_matrix_functions },
|
||||
{ "GL_ARB_window_pos", GL_ARB_window_pos_functions },
|
||||
{ "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions },
|
||||
{ "GL_EXT_compiled_vertex_array", GL_EXT_compiled_vertex_array_functions },
|
||||
{ "GL_EXT_polygon_offset", GL_EXT_polygon_offset_functions },
|
||||
{ "GL_EXT_texture_object", GL_EXT_texture_object_functions },
|
||||
{ "GL_EXT_vertex_array", GL_EXT_vertex_array_functions },
|
||||
{ "GL_MESA_window_pos", GL_MESA_window_pos_functions },
|
||||
{ "GL_NV_vertex_program", GL_NV_vertex_program_functions },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -220,6 +229,10 @@ void driInitExtensions( GLcontext * ctx,
|
||||
unsigned i;
|
||||
|
||||
if ( first_time ) {
|
||||
for ( i = 0 ; i < driDispatchRemapTable_size ; i++ ) {
|
||||
driDispatchRemapTable[i] = -1;
|
||||
}
|
||||
|
||||
first_time = 0;
|
||||
driInitExtensions( ctx, all_mesa_extensions, GL_FALSE );
|
||||
}
|
||||
|
@@ -842,19 +842,12 @@ fbSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Just to silence warning
|
||||
*/
|
||||
extern _EGLDriver *
|
||||
_eglMain(NativeDisplayType dpy);
|
||||
|
||||
|
||||
/**
|
||||
* The bootstrap function. Return a new fbDriver object and
|
||||
* plug in API functions.
|
||||
*/
|
||||
_EGLDriver *
|
||||
_eglMain(NativeDisplayType dpy)
|
||||
_eglMain(_EGLDisplay *dpy)
|
||||
{
|
||||
fbDriver *fb;
|
||||
|
||||
|
@@ -8,14 +8,18 @@
|
||||
extern void ffbXMesaUpdateState(ffbContextPtr fmesa);
|
||||
#define FFB_UPDATE_STATE(fmesa) ffbXMesaUpdateState(fmesa)
|
||||
|
||||
/* Lock the hardware and validate our state. */
|
||||
#if defined(__i386__)
|
||||
/* Lock the hardware and validate our state. This hardware can only ever
|
||||
* exist on SPARC platforms. Don't bother building the real LOCK_HARDWARE and
|
||||
* UNLOCK_HARDWARE code on non-SPARC platforms. The only reason the driver
|
||||
* gets built on non-SPARC is to catch build breakages earlier.
|
||||
*/
|
||||
#if !defined(__sparc__)
|
||||
#define LOCK_HARDWARE(fmesa)
|
||||
#define UNLOCK_HARDWARE(fmesa)
|
||||
#else
|
||||
#define LOCK_HARDWARE(fmesa) \
|
||||
do { \
|
||||
int __ret=0; \
|
||||
DRM_CAS_RESULT(__ret); \
|
||||
DRM_CAS(fmesa->driHwLock, fmesa->hHWContext, \
|
||||
(DRM_LOCK_HELD | fmesa->hHWContext), __ret);\
|
||||
if (__ret) { \
|
||||
|
@@ -64,10 +64,17 @@ ffbInitDriver(__DRIscreenPrivate *sPriv)
|
||||
{
|
||||
ffbScreenPrivate *ffbScreen;
|
||||
FFBDRIPtr gDRIPriv = (FFBDRIPtr) sPriv->pDevPriv;
|
||||
drmAddress map;
|
||||
|
||||
if (getenv("LIBGL_FORCE_XSERVER"))
|
||||
return GL_FALSE;
|
||||
|
||||
|
||||
if (sPriv->devPrivSize != sizeof(FFBDRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(FFBDRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Allocate the private area. */
|
||||
ffbScreen = (ffbScreenPrivate *) MALLOC(sizeof(ffbScreenPrivate));
|
||||
if (!ffbScreen)
|
||||
@@ -77,59 +84,59 @@ ffbInitDriver(__DRIscreenPrivate *sPriv)
|
||||
if (drmMap(sPriv->fd,
|
||||
gDRIPriv->hFbcRegs,
|
||||
gDRIPriv->sFbcRegs,
|
||||
&gDRIPriv->mFbcRegs)) {
|
||||
&map)) {
|
||||
FREE(ffbScreen);
|
||||
return GL_FALSE;
|
||||
}
|
||||
ffbScreen->regs = (ffb_fbcPtr) gDRIPriv->mFbcRegs;
|
||||
ffbScreen->regs = (ffb_fbcPtr) map;
|
||||
|
||||
/* Map ramdac registers. */
|
||||
if (drmMap(sPriv->fd,
|
||||
gDRIPriv->hDacRegs,
|
||||
gDRIPriv->sDacRegs,
|
||||
&gDRIPriv->mDacRegs)) {
|
||||
drmUnmap(gDRIPriv->mFbcRegs, gDRIPriv->sFbcRegs);
|
||||
&map)) {
|
||||
drmUnmap((drmAddress)ffbScreen->regs, gDRIPriv->sFbcRegs);
|
||||
FREE(ffbScreen);
|
||||
return GL_FALSE;
|
||||
}
|
||||
ffbScreen->dac = (ffb_dacPtr) gDRIPriv->mDacRegs;
|
||||
ffbScreen->dac = (ffb_dacPtr) map;
|
||||
|
||||
/* Map "Smart" framebuffer views. */
|
||||
if (drmMap(sPriv->fd,
|
||||
gDRIPriv->hSfb8r,
|
||||
gDRIPriv->sSfb8r,
|
||||
&gDRIPriv->mSfb8r)) {
|
||||
drmUnmap(gDRIPriv->mFbcRegs, gDRIPriv->sFbcRegs);
|
||||
drmUnmap(gDRIPriv->mDacRegs, gDRIPriv->sDacRegs);
|
||||
&map)) {
|
||||
drmUnmap((drmAddress)ffbScreen->regs, gDRIPriv->sFbcRegs);
|
||||
drmUnmap((drmAddress)ffbScreen->dac, gDRIPriv->sDacRegs);
|
||||
FREE(ffbScreen);
|
||||
return GL_FALSE;
|
||||
}
|
||||
ffbScreen->sfb8r = (volatile char *) gDRIPriv->mSfb8r;
|
||||
ffbScreen->sfb8r = (volatile char *) map;
|
||||
|
||||
if (drmMap(sPriv->fd,
|
||||
gDRIPriv->hSfb32,
|
||||
gDRIPriv->sSfb32,
|
||||
&gDRIPriv->mSfb32)) {
|
||||
drmUnmap(gDRIPriv->mFbcRegs, gDRIPriv->sFbcRegs);
|
||||
drmUnmap(gDRIPriv->mDacRegs, gDRIPriv->sDacRegs);
|
||||
drmUnmap(gDRIPriv->mSfb8r, gDRIPriv->sSfb8r);
|
||||
&map)) {
|
||||
drmUnmap((drmAddress)ffbScreen->regs, gDRIPriv->sFbcRegs);
|
||||
drmUnmap((drmAddress)ffbScreen->dac, gDRIPriv->sDacRegs);
|
||||
drmUnmap((drmAddress)ffbScreen->sfb8r, gDRIPriv->sSfb8r);
|
||||
FREE(ffbScreen);
|
||||
return GL_FALSE;
|
||||
}
|
||||
ffbScreen->sfb32 = (volatile char *) gDRIPriv->mSfb32;
|
||||
ffbScreen->sfb32 = (volatile char *) map;
|
||||
|
||||
if (drmMap(sPriv->fd,
|
||||
gDRIPriv->hSfb64,
|
||||
gDRIPriv->sSfb64,
|
||||
&gDRIPriv->mSfb64)) {
|
||||
drmUnmap(gDRIPriv->mFbcRegs, gDRIPriv->sFbcRegs);
|
||||
drmUnmap(gDRIPriv->mDacRegs, gDRIPriv->sDacRegs);
|
||||
drmUnmap(gDRIPriv->mSfb8r, gDRIPriv->sSfb8r);
|
||||
drmUnmap(gDRIPriv->mSfb32, gDRIPriv->sSfb32);
|
||||
&map)) {
|
||||
drmUnmap((drmAddress)ffbScreen->regs, gDRIPriv->sFbcRegs);
|
||||
drmUnmap((drmAddress)ffbScreen->dac, gDRIPriv->sDacRegs);
|
||||
drmUnmap((drmAddress)ffbScreen->sfb8r, gDRIPriv->sSfb8r);
|
||||
drmUnmap((drmAddress)ffbScreen->sfb32, gDRIPriv->sSfb32);
|
||||
FREE(ffbScreen);
|
||||
return GL_FALSE;
|
||||
}
|
||||
ffbScreen->sfb64 = (volatile char *) gDRIPriv->mSfb64;
|
||||
ffbScreen->sfb64 = (volatile char *) map;
|
||||
|
||||
ffbScreen->fifo_cache = 0;
|
||||
ffbScreen->rp_active = 0;
|
||||
@@ -150,11 +157,11 @@ ffbDestroyScreen(__DRIscreenPrivate *sPriv)
|
||||
ffbScreenPrivate *ffbScreen = sPriv->private;
|
||||
FFBDRIPtr gDRIPriv = (FFBDRIPtr) sPriv->pDevPriv;
|
||||
|
||||
drmUnmap(gDRIPriv->mFbcRegs, gDRIPriv->sFbcRegs);
|
||||
drmUnmap(gDRIPriv->mDacRegs, gDRIPriv->sDacRegs);
|
||||
drmUnmap(gDRIPriv->mSfb8r, gDRIPriv->sSfb8r);
|
||||
drmUnmap(gDRIPriv->mSfb32, gDRIPriv->sSfb32);
|
||||
drmUnmap(gDRIPriv->mSfb64, gDRIPriv->sSfb64);
|
||||
drmUnmap((drmAddress)ffbScreen->regs, gDRIPriv->sFbcRegs);
|
||||
drmUnmap((drmAddress)ffbScreen->dac, gDRIPriv->sDacRegs);
|
||||
drmUnmap((drmAddress)ffbScreen->sfb8r, gDRIPriv->sSfb8r);
|
||||
drmUnmap((drmAddress)ffbScreen->sfb32, gDRIPriv->sSfb32);
|
||||
drmUnmap((drmAddress)ffbScreen->sfb64, gDRIPriv->sSfb64);
|
||||
|
||||
FREE(ffbScreen);
|
||||
}
|
||||
@@ -721,7 +728,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
|
||||
|
||||
{
|
||||
__DRIscreenPrivate *psp;
|
||||
static const __DRIversion ddx_expected = { 0, 0, 1 };
|
||||
static const __DRIversion ddx_expected = { 0, 1, 1 };
|
||||
static const __DRIversion dri_expected = { 4, 0, 0 };
|
||||
static const __DRIversion drm_expected = { 0, 0, 1 };
|
||||
|
||||
|
@@ -21,23 +21,18 @@ typedef struct ffb_dri_state {
|
||||
typedef struct {
|
||||
drm_handle_t hFbcRegs;
|
||||
drmSize sFbcRegs;
|
||||
drmAddress mFbcRegs;
|
||||
|
||||
drm_handle_t hDacRegs;
|
||||
drmSize sDacRegs;
|
||||
drmAddress mDacRegs;
|
||||
|
||||
drm_handle_t hSfb8r;
|
||||
drmSize sSfb8r;
|
||||
drmAddress mSfb8r;
|
||||
|
||||
drm_handle_t hSfb32;
|
||||
drmSize sSfb32;
|
||||
drmAddress mSfb32;
|
||||
|
||||
drm_handle_t hSfb64;
|
||||
drmSize sSfb64;
|
||||
drmAddress mSfb64;
|
||||
|
||||
/* Fastfill/Pagefill parameters. */
|
||||
unsigned char disable_pagefill;
|
||||
|
@@ -35,6 +35,11 @@ gammaScreenPtr gammaCreateScreen( __DRIscreenPrivate *sPriv )
|
||||
GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)sPriv->pDevPriv;
|
||||
int i;
|
||||
|
||||
if (sPriv->devPrivSize != sizeof(GLINTDRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(GLINTDRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Check the DRI externsion version */
|
||||
if ( sPriv->driMajor != 3 || sPriv->driMinor != 1 ) {
|
||||
|
@@ -63,6 +63,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#include "utils.h"
|
||||
|
||||
#define need_GL_ARB_multisample
|
||||
#define need_GL_ARB_texture_compression
|
||||
#include "extension_helper.h"
|
||||
|
||||
#ifndef I810_DEBUG
|
||||
@@ -72,13 +73,30 @@ int I810_DEBUG = (0);
|
||||
PUBLIC const char __driConfigOptions[] = { 0 };
|
||||
const GLuint __driNConfigOptions = 0;
|
||||
|
||||
#define DRIVER_DATE "20050818"
|
||||
|
||||
static const GLubyte *i810GetString( GLcontext *ctx, GLenum name )
|
||||
{
|
||||
static char buffer[128];
|
||||
|
||||
switch (name) {
|
||||
case GL_VENDOR:
|
||||
return (GLubyte *)"Keith Whitwell";
|
||||
case GL_RENDERER:
|
||||
return (GLubyte *)"Mesa DRI I810 20021125";
|
||||
case GL_RENDERER: {
|
||||
i810ContextPtr imesa = I810_CONTEXT(ctx);
|
||||
const char * chipset;
|
||||
|
||||
switch (imesa->i810Screen->deviceID) {
|
||||
case PCI_CHIP_I810: chipset = "i810"; break;
|
||||
case PCI_CHIP_I810_DC100: chipset = "i810 DC-100"; break;
|
||||
case PCI_CHIP_I810_E: chipset = "i810E"; break;
|
||||
case PCI_CHIP_I815: chipset = "i815"; break;
|
||||
default: chipset = "Unknown i810-class Chipset"; break;
|
||||
}
|
||||
|
||||
(void) driGetRendererString( buffer, chipset, DRIVER_DATE, 0 );
|
||||
return (GLubyte *) buffer;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -101,16 +119,18 @@ static void i810BufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
|
||||
|
||||
/* Extension strings exported by the i810 driver.
|
||||
*/
|
||||
static const struct dri_extension card_extensions[] =
|
||||
const struct dri_extension card_extensions[] =
|
||||
{
|
||||
{ "GL_ARB_multisample", GL_ARB_multisample_functions },
|
||||
{ "GL_ARB_multitexture", NULL },
|
||||
{ "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
|
||||
{ "GL_ARB_texture_env_add", NULL },
|
||||
{ "GL_ARB_texture_mirrored_repeat", NULL },
|
||||
{ "GL_EXT_stencil_wrap", NULL },
|
||||
{ "GL_EXT_texture_edge_clamp", NULL },
|
||||
{ "GL_EXT_texture_lod_bias", NULL },
|
||||
{ "GL_MESA_ycbcr_texture", NULL },
|
||||
{ "GL_NV_blend_square", NULL },
|
||||
{ "GL_SGIS_generate_mipmap", NULL },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
@@ -54,6 +54,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include "GL/internal/dri_interface.h"
|
||||
|
||||
extern const struct dri_extension card_extensions[];
|
||||
|
||||
static __GLcontextModes *fill_in_modes( __GLcontextModes *modes,
|
||||
unsigned pixel_bits,
|
||||
unsigned depth_bits,
|
||||
@@ -223,6 +225,10 @@ i810InitDriver(__DRIscreenPrivate *sPriv)
|
||||
i810ScreenPrivate *i810Screen;
|
||||
I810DRIPtr gDRIPriv = (I810DRIPtr)sPriv->pDevPriv;
|
||||
|
||||
if (sPriv->devPrivSize != sizeof(I810DRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(I810DRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Allocate the private area */
|
||||
i810Screen = (i810ScreenPrivate *)CALLOC(sizeof(i810ScreenPrivate));
|
||||
@@ -458,6 +464,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
|
||||
*driver_modes = i810FillInModes( 16,
|
||||
16, 0,
|
||||
1);
|
||||
driInitExtensions( NULL, card_extensions, GL_TRUE );
|
||||
}
|
||||
|
||||
return (void *) psp;
|
||||
|
@@ -103,14 +103,23 @@ static void i810BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
|
||||
|
||||
switch (ctx->Color.BlendSrcRGB) {
|
||||
case GL_ZERO: a |= SDM_SRC_ZERO; break;
|
||||
case GL_SRC_ALPHA: a |= SDM_SRC_SRC_ALPHA; break;
|
||||
case GL_ONE: a |= SDM_SRC_ONE; break;
|
||||
case GL_DST_COLOR: a |= SDM_SRC_DST_COLOR; break;
|
||||
case GL_ONE_MINUS_DST_COLOR: a |= SDM_SRC_INV_DST_COLOR; break;
|
||||
case GL_SRC_COLOR: a |= SDM_SRC_SRC_COLOR; break;
|
||||
case GL_ONE_MINUS_SRC_COLOR: a |= SDM_SRC_INV_SRC_COLOR; break;
|
||||
case GL_SRC_ALPHA: a |= SDM_SRC_SRC_ALPHA; break;
|
||||
case GL_ONE_MINUS_SRC_ALPHA: a |= SDM_SRC_INV_SRC_ALPHA; break;
|
||||
case GL_DST_ALPHA: a |= SDM_SRC_ONE; break;
|
||||
case GL_ONE_MINUS_DST_ALPHA: a |= SDM_SRC_ZERO; break;
|
||||
case GL_SRC_ALPHA_SATURATE: /*a |= SDM_SRC_SRC_ALPHA; break;*/
|
||||
case GL_DST_COLOR: a |= SDM_SRC_DST_COLOR; break;
|
||||
case GL_ONE_MINUS_DST_COLOR: a |= SDM_SRC_INV_DST_COLOR; break;
|
||||
|
||||
/* (f, f, f, 1), f = min(As, 1 - Ad) = min(As, 1 - 1) = 0
|
||||
* So (f, f, f, 1) = (0, 0, 0, 1). Since there is no destination alpha and
|
||||
* the only supported alpha operation is GL_FUNC_ADD, the result modulating
|
||||
* the source alpha with the alpha factor is largely irrelevant.
|
||||
*/
|
||||
case GL_SRC_ALPHA_SATURATE: a |= SDM_SRC_ZERO; break;
|
||||
|
||||
case GL_CONSTANT_COLOR:
|
||||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
case GL_CONSTANT_ALPHA:
|
||||
@@ -122,14 +131,17 @@ static void i810BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
|
||||
}
|
||||
|
||||
switch (ctx->Color.BlendDstRGB) {
|
||||
case GL_SRC_ALPHA: a |= SDM_DST_SRC_ALPHA; break;
|
||||
case GL_ONE_MINUS_SRC_ALPHA: a |= SDM_DST_INV_SRC_ALPHA; break;
|
||||
case GL_ZERO: a |= SDM_DST_ZERO; break;
|
||||
case GL_ONE: a |= SDM_DST_ONE; break;
|
||||
case GL_SRC_COLOR: a |= SDM_DST_SRC_COLOR; break;
|
||||
case GL_ONE_MINUS_SRC_COLOR: a |= SDM_DST_INV_SRC_COLOR; break;
|
||||
case GL_SRC_ALPHA: a |= SDM_DST_SRC_ALPHA; break;
|
||||
case GL_ONE_MINUS_SRC_ALPHA: a |= SDM_DST_INV_SRC_ALPHA; break;
|
||||
case GL_DST_ALPHA: a |= SDM_DST_ONE; break;
|
||||
case GL_ONE_MINUS_DST_ALPHA: a |= SDM_DST_ZERO; break;
|
||||
case GL_DST_COLOR: a |= SDM_DST_DST_COLOR; break;
|
||||
case GL_ONE_MINUS_DST_COLOR: a |= SDM_DST_INV_DST_COLOR; break;
|
||||
|
||||
case GL_CONSTANT_COLOR:
|
||||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
case GL_CONSTANT_ALPHA:
|
||||
|
@@ -282,48 +282,52 @@ static void i810TexParameter( GLcontext *ctx, GLenum target,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup hardware bits for new texture environment settings.
|
||||
*
|
||||
* \todo
|
||||
* Determine whether or not \c param can be used instead of
|
||||
* \c texUnit->EnvColor in the \c GL_TEXTURE_ENV_COLOR case.
|
||||
*/
|
||||
static void i810TexEnv( GLcontext *ctx, GLenum target,
|
||||
GLenum pname, const GLfloat *param )
|
||||
{
|
||||
i810ContextPtr imesa = I810_CONTEXT( ctx );
|
||||
GLuint unit = ctx->Texture.CurrentUnit;
|
||||
const GLuint unit = ctx->Texture.CurrentUnit;
|
||||
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
|
||||
|
||||
/* Only one env color. Need a fallback if env colors are different
|
||||
* and texture setup references env color in both units.
|
||||
*/
|
||||
switch (pname) {
|
||||
case GL_TEXTURE_ENV_COLOR: {
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
|
||||
GLfloat *fc = texUnit->EnvColor;
|
||||
GLuint r, g, b, a, col;
|
||||
CLAMPED_FLOAT_TO_UBYTE(r, fc[0]);
|
||||
CLAMPED_FLOAT_TO_UBYTE(g, fc[1]);
|
||||
CLAMPED_FLOAT_TO_UBYTE(b, fc[2]);
|
||||
CLAMPED_FLOAT_TO_UBYTE(a, fc[3]);
|
||||
GLubyte c[4];
|
||||
GLuint envColor;
|
||||
|
||||
col = ((a << 24) |
|
||||
(r << 16) |
|
||||
(g << 8) |
|
||||
(b << 0));
|
||||
|
||||
if (imesa->Setup[I810_CTXREG_CF1] != col) {
|
||||
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
|
||||
imesa->Setup[I810_CTXREG_CF1] = col;
|
||||
UNCLAMPED_FLOAT_TO_RGBA_CHAN( c, texUnit->EnvColor );
|
||||
envColor = PACK_COLOR_8888( c[3], c[0], c[1], c[2] );
|
||||
|
||||
if (imesa->Setup[I810_CTXREG_CF1] != envColor) {
|
||||
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
|
||||
imesa->Setup[I810_CTXREG_CF1] = envColor;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case GL_TEXTURE_ENV_MODE:
|
||||
imesa->TexEnvImageFmt[unit] = 0; /* force recalc of env state */
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_LOD_BIAS_EXT:
|
||||
{
|
||||
struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
|
||||
i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData;
|
||||
t->Setup[I810_TEXREG_MLC] &= ~(MLC_LOD_BIAS_MASK);
|
||||
t->Setup[I810_TEXREG_MLC] |= i810ComputeLodBias(*param);
|
||||
case GL_TEXTURE_LOD_BIAS: {
|
||||
if ( texUnit->_Current != NULL ) {
|
||||
const struct gl_texture_object *tObj = texUnit->_Current;
|
||||
i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData;
|
||||
|
||||
t->Setup[I810_TEXREG_MLC] &= ~(MLC_LOD_BIAS_MASK);
|
||||
t->Setup[I810_TEXREG_MLC] |= i810ComputeLodBias(*param);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -430,6 +434,14 @@ static void i810DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
|
||||
_mesa_delete_texture_object(ctx, tObj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Choose a Mesa texture format to match the requested format.
|
||||
*
|
||||
* \todo
|
||||
* Determine why \c _mesa_texformat_al88 doesn't work right for
|
||||
* \c GL_LUMINANCE_ALPHA textures. It seems to work fine for \c GL_INTENSITY,
|
||||
* but \c GL_LUMINANCE_ALPHA gets some red bands in progs/demos/texenv.
|
||||
*/
|
||||
static const struct gl_texture_format *
|
||||
i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
|
||||
GLenum format, GLenum type )
|
||||
@@ -500,7 +512,11 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
|
||||
case GL_INTENSITY12:
|
||||
case GL_INTENSITY16:
|
||||
case GL_COMPRESSED_INTENSITY:
|
||||
#if 0
|
||||
return &_mesa_texformat_al88;
|
||||
#else
|
||||
return &_mesa_texformat_argb4444;
|
||||
#endif
|
||||
|
||||
case GL_YCBCR_MESA:
|
||||
if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
|
||||
|
@@ -212,7 +212,7 @@ static int I810DRIAgpInit( const DRIDriverContext *ctx, I810Ptr info)
|
||||
drmAgpAlloc(ctx->drmFD, 4096 * 1024, 1, NULL, &dcacheHandle);
|
||||
info->dcacheHandle = dcacheHandle;
|
||||
|
||||
fprintf(stderr, "[agp] dcacheHandle : %p\n", dcacheHandle);
|
||||
fprintf(stderr, "[agp] dcacheHandle : 0x%x\n", dcacheHandle);
|
||||
|
||||
#define Elements(x) sizeof(x)/sizeof(*x)
|
||||
for (pitch_idx = 0; pitch_idx < Elements(i810_pitches); pitch_idx++)
|
||||
@@ -710,7 +710,7 @@ static int I810ScreenInit( DRIDriverContext *ctx, I810Ptr info )
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[drm] register handle = 0x%08lx\n", info->regs);
|
||||
"[drm] register handle = 0x%08x\n", info->regs);
|
||||
|
||||
I810DRIAgpPreInit(ctx, info);
|
||||
/* Need to AddMap the framebuffer and mmio regions here:
|
||||
|
@@ -11,7 +11,6 @@
|
||||
typedef struct {
|
||||
drm_handle_t regs;
|
||||
drmSize regsSize;
|
||||
drmAddress regsMap;
|
||||
|
||||
drmSize backbufferSize;
|
||||
drm_handle_t backbuffer;
|
||||
|
@@ -146,8 +146,8 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv)
|
||||
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
|
||||
void * const psc = sPriv->psc->screenConfigs;
|
||||
|
||||
|
||||
if ( glx_enable_extension == NULL ) {
|
||||
if (sPriv->devPrivSize != sizeof(I830DRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(I830DRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,9 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv)
|
||||
}
|
||||
#endif
|
||||
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
|
||||
if ( glx_enable_extension != NULL ) {
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
@@ -18,7 +18,6 @@
|
||||
typedef struct _I830DRIRec {
|
||||
drm_handle_t regs;
|
||||
drmSize regsSize;
|
||||
drmAddress regsMap;
|
||||
|
||||
drmSize backbufferSize;
|
||||
drm_handle_t backbuffer;
|
||||
|
@@ -79,8 +79,8 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
|
||||
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
|
||||
void * const psc = sPriv->psc->screenConfigs;
|
||||
|
||||
|
||||
if (glx_enable_extension == NULL) {
|
||||
if (sPriv->devPrivSize != sizeof(I830DRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(I830DRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
@@ -199,14 +199,15 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
|
||||
}
|
||||
}
|
||||
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
|
||||
if (glx_enable_extension != NULL) {
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" );
|
||||
}
|
||||
|
||||
sPriv->psc->allocateMemory = (void *) intelAllocateMemoryMESA;
|
||||
sPriv->psc->freeMemory = (void *) intelFreeMemoryMESA;
|
||||
sPriv->psc->memoryOffset = (void *) intelGetMemoryOffsetMESA;
|
||||
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" );
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,6 @@
|
||||
typedef struct _I830DRIRec {
|
||||
drm_handle_t regs;
|
||||
drmSize regsSize;
|
||||
drmAddress regsMap;
|
||||
|
||||
drmSize backbufferSize;
|
||||
drm_handle_t backbuffer;
|
||||
|
@@ -211,14 +211,14 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv )
|
||||
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
|
||||
void * const psc = sPriv->psc->screenConfigs;
|
||||
|
||||
if (sPriv->devPrivSize != sizeof(ATIDRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(ATIDRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if ( MACH64_DEBUG & DEBUG_VERBOSE_DRI )
|
||||
fprintf( stderr, "%s\n", __FUNCTION__ );
|
||||
|
||||
if ( glx_enable_extension == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Allocate the private area */
|
||||
mach64Screen = (mach64ScreenPtr) CALLOC( sizeof(*mach64Screen) );
|
||||
if ( !mach64Screen ) return NULL;
|
||||
@@ -318,13 +318,15 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv )
|
||||
|
||||
mach64Screen->driScreen = sPriv;
|
||||
|
||||
if ( mach64Screen->irq != 0 ) {
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
|
||||
}
|
||||
if ( glx_enable_extension != NULL ) {
|
||||
if ( mach64Screen->irq != 0 ) {
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
|
||||
}
|
||||
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
|
||||
}
|
||||
|
||||
return mach64Screen;
|
||||
}
|
||||
|
@@ -200,8 +200,8 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
|
||||
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
|
||||
void * const psc = sPriv->psc->screenConfigs;
|
||||
|
||||
|
||||
if ( glx_enable_extension == NULL ) {
|
||||
if (sPriv->devPrivSize != sizeof(MGADRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(MGADRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
@@ -233,11 +233,13 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
|
||||
}
|
||||
}
|
||||
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
|
||||
if ( glx_enable_extension != NULL ) {
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
|
||||
}
|
||||
|
||||
if (serverInfo->chipset != MGA_CARD_TYPE_G200 &&
|
||||
serverInfo->chipset != MGA_CARD_TYPE_G400) {
|
||||
@@ -947,7 +949,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
|
||||
|
||||
{
|
||||
__DRIscreenPrivate *psp;
|
||||
static const __DRIversion ddx_expected = { 1, 1, 1 };
|
||||
static const __DRIversion ddx_expected = { 1, 2, 0 };
|
||||
static const __DRIversion dri_expected = { 4, 0, 0 };
|
||||
static const __DRIversion drm_expected = { 3, 0, 0 };
|
||||
|
||||
|
@@ -206,7 +206,7 @@ static int MGADRIAgpInit(struct DRIDriverContextRec *ctx, MGAPtr pMga)
|
||||
return 0;
|
||||
}
|
||||
fprintf( stderr,
|
||||
"[agp] WARP microcode handle = 0x%08lx\n",
|
||||
"[agp] WARP microcode handle = 0x%08x\n",
|
||||
pMga->warp.handle );
|
||||
|
||||
if ( drmMap( ctx->drmFD,
|
||||
@@ -233,7 +233,7 @@ static int MGADRIAgpInit(struct DRIDriverContextRec *ctx, MGAPtr pMga)
|
||||
return 0;
|
||||
}
|
||||
fprintf( stderr,
|
||||
"[agp] Primary DMA handle = 0x%08lx\n",
|
||||
"[agp] Primary DMA handle = 0x%08x\n",
|
||||
pMga->primary.handle );
|
||||
|
||||
if ( drmMap( ctx->drmFD,
|
||||
@@ -260,7 +260,7 @@ static int MGADRIAgpInit(struct DRIDriverContextRec *ctx, MGAPtr pMga)
|
||||
return 0;
|
||||
}
|
||||
fprintf( stderr,
|
||||
"[agp] DMA buffers handle = 0x%08lx\n",
|
||||
"[agp] DMA buffers handle = 0x%08x\n",
|
||||
pMga->buffers.handle );
|
||||
|
||||
if ( drmMap( ctx->drmFD,
|
||||
@@ -304,7 +304,7 @@ static int MGADRIAgpInit(struct DRIDriverContextRec *ctx, MGAPtr pMga)
|
||||
}
|
||||
/* should i map it ? */
|
||||
fprintf( stderr,
|
||||
"[agp] agpTexture handle = 0x%08lx\n",
|
||||
"[agp] agpTexture handle = 0x%08x\n",
|
||||
pMga->agpTextures.handle );
|
||||
fprintf( stderr,
|
||||
"[agp] agpTexture size: %d kb\n", pMga->agpTextures.size/1024 );
|
||||
@@ -339,7 +339,7 @@ static int MGADRIMapInit( struct DRIDriverContextRec *ctx, MGAPtr pMga )
|
||||
return 0;
|
||||
}
|
||||
fprintf( stderr,
|
||||
"[drm] Status handle = 0x%08lx\n",
|
||||
"[drm] Status handle = 0x%08x\n",
|
||||
pMga->status.handle );
|
||||
|
||||
if ( drmMap( ctx->drmFD,
|
||||
|
@@ -49,6 +49,16 @@
|
||||
# define DEPRECATED
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
typedef struct _mgaDrmRegion {
|
||||
drm_handle_t handle;
|
||||
unsigned int offset;
|
||||
drmSize size;
|
||||
} mgaDrmRegion, *mgaDrmRegionPtr;
|
||||
#else
|
||||
#define mgaDrmRegion drmRegion
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int chipset;
|
||||
int width DEPRECATED;
|
||||
@@ -91,10 +101,10 @@ typedef struct {
|
||||
* for the X.org 6.9 / 7.0 release), these fields should be removed.
|
||||
*/
|
||||
/*@{*/
|
||||
drmRegion registers; /**< MMIO registers. */
|
||||
drmRegion status DEPRECATED; /**< No longer used on the client-side. */
|
||||
drmRegion primary; /**< Primary DMA region. */
|
||||
drmRegion buffers DEPRECATED; /**< No longer used on the client-side. */
|
||||
mgaDrmRegion registers; /**< MMIO registers. */
|
||||
mgaDrmRegion status DEPRECATED; /**< No longer used on the client-side. */
|
||||
mgaDrmRegion primary; /**< Primary DMA region. */
|
||||
mgaDrmRegion buffers DEPRECATED; /**< No longer used on the client-side. */
|
||||
/*@}*/
|
||||
|
||||
unsigned int sarea_priv_offset;
|
||||
|
@@ -102,9 +102,9 @@ r128CreateScreen( __DRIscreenPrivate *sPriv )
|
||||
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
|
||||
void * const psc = sPriv->psc->screenConfigs;
|
||||
|
||||
|
||||
if ( glx_enable_extension == NULL ) {
|
||||
return NULL;
|
||||
if (sPriv->devPrivSize != sizeof(R128DRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(R128DRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Allocate the private area */
|
||||
@@ -218,13 +218,15 @@ r128CreateScreen( __DRIscreenPrivate *sPriv )
|
||||
|
||||
r128Screen->driScreen = sPriv;
|
||||
|
||||
if ( r128Screen->irq != 0 ) {
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
|
||||
}
|
||||
if ( glx_enable_extension != NULL ) {
|
||||
if ( r128Screen->irq != 0 ) {
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
|
||||
}
|
||||
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
|
||||
}
|
||||
|
||||
return r128Screen;
|
||||
}
|
||||
|
@@ -164,7 +164,7 @@ static GLboolean R128DRIAgpInit(const DRIDriverContext *ctx)
|
||||
return GL_FALSE;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[agp] ring handle = 0x%08lx\n", info->ringHandle);
|
||||
"[agp] ring handle = 0x%08x\n", info->ringHandle);
|
||||
|
||||
if (drmMap(ctx->drmFD, info->ringHandle, info->ringMapSize,
|
||||
(drmAddressPtr)&info->ring) < 0) {
|
||||
@@ -182,7 +182,7 @@ static GLboolean R128DRIAgpInit(const DRIDriverContext *ctx)
|
||||
return GL_FALSE;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[agp] ring read ptr handle = 0x%08lx\n",
|
||||
"[agp] ring read ptr handle = 0x%08x\n",
|
||||
info->ringReadPtrHandle);
|
||||
|
||||
if (drmMap(ctx->drmFD, info->ringReadPtrHandle, info->ringReadMapSize,
|
||||
@@ -398,7 +398,7 @@ static GLboolean R128DRIMapInit(const DRIDriverContext *ctx)
|
||||
return GL_FALSE;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[drm] register handle = 0x%08lx\n", info->registerHandle);
|
||||
"[drm] register handle = 0x%08x\n", info->registerHandle);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
@@ -7,6 +7,10 @@ LIBNAME = r200_dri.so
|
||||
|
||||
MINIGLX_SOURCES = server/radeon_dri.c
|
||||
|
||||
ifeq ($(USING_EGL), 1)
|
||||
EGL_SOURCES = server/radeon_egl.c
|
||||
endif
|
||||
|
||||
DRIVER_SOURCES = r200_context.c \
|
||||
r200_ioctl.c \
|
||||
r200_lock.c \
|
||||
@@ -26,18 +30,20 @@ DRIVER_SOURCES = r200_context.c \
|
||||
r200_vtxfmt.c \
|
||||
r200_vtxfmt_c.c \
|
||||
r200_vtxfmt_sse.c \
|
||||
r200_vtxfmt_x86.c
|
||||
r200_vtxfmt_x86.c \
|
||||
$(EGL_SOURCES)
|
||||
|
||||
C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES)
|
||||
|
||||
X86_SOURCES = r200_vtxtmp_x86.S
|
||||
|
||||
SYMLINKS = \
|
||||
server/radeon_egl.c \
|
||||
server/radeon_dri.c \
|
||||
server/radeon_dri.h \
|
||||
server/radeon.h \
|
||||
server/radeon_macros.h \
|
||||
server/radeon_reg.h
|
||||
server/radeon_dri.h \
|
||||
server/radeon.h \
|
||||
server/radeon_macros.h \
|
||||
server/radeon_reg.h
|
||||
|
||||
##### TARGETS #####
|
||||
|
||||
|
@@ -524,10 +524,11 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
|
||||
}
|
||||
TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_TCL_DISABLE, 1);
|
||||
}
|
||||
|
||||
if (rmesa->r200Screen->chipset & R200_CHIPSET_TCL) {
|
||||
if (tcl_mode >= DRI_CONF_TCL_VTXFMT && !getenv("R200_NO_VTXFMT")) {
|
||||
if (tcl_mode >= DRI_CONF_TCL_VTXFMT)
|
||||
r200VtxfmtInit( ctx, tcl_mode >= DRI_CONF_TCL_CODEGEN );
|
||||
}
|
||||
|
||||
_tnl_need_dlist_norm_lengths( ctx, GL_FALSE );
|
||||
}
|
||||
return GL_TRUE;
|
||||
|
@@ -239,9 +239,9 @@ r200CreateScreen( __DRIscreenPrivate *sPriv )
|
||||
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
|
||||
void * const psc = sPriv->psc->screenConfigs;
|
||||
|
||||
|
||||
if ( glx_enable_extension == NULL ) {
|
||||
return NULL;
|
||||
if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Allocate the private area */
|
||||
@@ -467,20 +467,21 @@ r200CreateScreen( __DRIscreenPrivate *sPriv )
|
||||
screen->driScreen = sPriv;
|
||||
screen->sarea_priv_offset = dri_priv->sarea_priv_offset;
|
||||
|
||||
if ( screen->irq != 0 ) {
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
|
||||
}
|
||||
if ( glx_enable_extension != NULL ) {
|
||||
if ( screen->irq != 0 ) {
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
|
||||
}
|
||||
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" );
|
||||
}
|
||||
|
||||
sPriv->psc->allocateMemory = (void *) r200AllocateMemoryMESA;
|
||||
sPriv->psc->freeMemory = (void *) r200FreeMemoryMESA;
|
||||
sPriv->psc->memoryOffset = (void *) r200GetMemoryOffsetMESA;
|
||||
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" );
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
|
@@ -16,8 +16,7 @@ COMMON_SOURCES = \
|
||||
../common/texmem.c \
|
||||
../common/vblank.c \
|
||||
../common/xmlconfig.c \
|
||||
../common/dri_util.c \
|
||||
../common/glcontextmodes.c
|
||||
../common/dri_util.c
|
||||
|
||||
DRIVER_SOURCES = \
|
||||
radeon_screen.c \
|
||||
|
@@ -67,10 +67,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
int future_hw_tcl_on=0;
|
||||
int hw_tcl_on=0;
|
||||
|
||||
#if 1
|
||||
#define need_GL_ARB_multisample
|
||||
#define need_GL_ARB_texture_compression
|
||||
#define need_GL_ARB_vertex_buffer_object
|
||||
#define need_GL_ARB_vertex_program
|
||||
#define need_GL_EXT_blend_minmax
|
||||
#define need_GL_EXT_secondary_color
|
||||
#define need_GL_EXT_blend_equation_separate
|
||||
#define need_GL_EXT_blend_func_separate
|
||||
#define need_GL_NV_vertex_program
|
||||
#include "extension_helper.h"
|
||||
|
||||
const struct dri_extension card_extensions[] = {
|
||||
@@ -85,16 +90,16 @@ const struct dri_extension card_extensions[] = {
|
||||
{"GL_ARB_texture_env_crossbar", NULL},
|
||||
{"GL_ARB_texture_env_dot3", NULL},
|
||||
{"GL_ARB_texture_mirrored_repeat", NULL},
|
||||
{"GL_ARB_vertex_buffer_object", NULL},
|
||||
{"GL_ARB_vertex_program", NULL},
|
||||
{"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
|
||||
{"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
|
||||
#if USE_ARB_F_P == 1
|
||||
{"GL_ARB_fragment_program", NULL},
|
||||
#endif
|
||||
{"GL_EXT_blend_equation_separate", NULL},
|
||||
{"GL_EXT_blend_func_separate", NULL},
|
||||
{"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
|
||||
{"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
|
||||
{"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
|
||||
{"GL_EXT_blend_subtract", NULL},
|
||||
{"GL_EXT_secondary_color", NULL},
|
||||
{"GL_EXT_secondary_color", GL_EXT_secondary_color_functions},
|
||||
{"GL_EXT_stencil_wrap", NULL},
|
||||
{"GL_EXT_texture_edge_clamp", NULL},
|
||||
{"GL_EXT_texture_env_combine", NULL},
|
||||
@@ -108,54 +113,11 @@ const struct dri_extension card_extensions[] = {
|
||||
{"GL_MESA_pack_invert", NULL},
|
||||
{"GL_MESA_ycbcr_texture", NULL},
|
||||
{"GL_NV_blend_square", NULL},
|
||||
{"GL_NV_vertex_program", NULL},
|
||||
{"GL_NV_vertex_program", GL_NV_vertex_program_functions},
|
||||
{"GL_SGIS_generate_mipmap", NULL},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
#else
|
||||
/* Extension strings exported by the R300 driver.
|
||||
*/
|
||||
static const char *const card_extensions[] = {
|
||||
"GL_ARB_multisample",
|
||||
"GL_ARB_multitexture",
|
||||
"GL_ARB_texture_border_clamp",
|
||||
"GL_ARB_texture_compression",
|
||||
/* disable until we support it, fixes a few things in ut2004 */
|
||||
/* "GL_ARB_texture_cube_map", */
|
||||
"GL_ARB_texture_env_add",
|
||||
"GL_ARB_texture_env_combine",
|
||||
"GL_ARB_texture_env_crossbar",
|
||||
"GL_ARB_texture_env_dot3",
|
||||
"GL_ARB_texture_mirrored_repeat",
|
||||
"GL_ARB_vertex_buffer_object",
|
||||
"GL_ARB_vertex_program",
|
||||
#if USE_ARB_F_P == 1
|
||||
"GL_ARB_fragment_program",
|
||||
#endif
|
||||
"GL_EXT_blend_equation_separate",
|
||||
"GL_EXT_blend_func_separate",
|
||||
"GL_EXT_blend_minmax",
|
||||
"GL_EXT_blend_subtract",
|
||||
"GL_EXT_secondary_color",
|
||||
"GL_EXT_stencil_wrap",
|
||||
"GL_EXT_texture_edge_clamp",
|
||||
"GL_EXT_texture_env_combine",
|
||||
"GL_EXT_texture_env_dot3",
|
||||
"GL_EXT_texture_filter_anisotropic",
|
||||
"GL_EXT_texture_lod_bias",
|
||||
"GL_EXT_texture_mirror_clamp",
|
||||
"GL_EXT_texture_rectangle",
|
||||
"GL_ATI_texture_env_combine3",
|
||||
"GL_ATI_texture_mirror_once",
|
||||
"GL_MESA_pack_invert",
|
||||
"GL_MESA_ycbcr_texture",
|
||||
"GL_NV_blend_square",
|
||||
"GL_NV_vertex_program",
|
||||
"GL_SGIS_generate_mipmap",
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
extern struct tnl_pipeline_stage _r300_render_stage;
|
||||
extern struct tnl_pipeline_stage _r300_tcl_stage;
|
||||
|
||||
|
@@ -315,10 +315,10 @@ static radeonScreenPtr radeonCreateScreen(__DRIscreenPrivate * sPriv)
|
||||
(*dri_interface->getProcAddress("glxEnableExtension"));
|
||||
void *const psc = sPriv->psc->screenConfigs;
|
||||
|
||||
|
||||
if (glx_enable_extension == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Allocate the private area */
|
||||
screen = (radeonScreenPtr) CALLOC(sizeof(*screen));
|
||||
@@ -586,20 +586,24 @@ static radeonScreenPtr radeonCreateScreen(__DRIscreenPrivate * sPriv)
|
||||
screen->driScreen = sPriv;
|
||||
screen->sarea_priv_offset = dri_priv->sarea_priv_offset;
|
||||
|
||||
if (screen->irq != 0) {
|
||||
(*glx_enable_extension) (psc, "GLX_SGI_swap_control");
|
||||
(*glx_enable_extension) (psc, "GLX_SGI_video_sync");
|
||||
(*glx_enable_extension) (psc, "GLX_MESA_swap_control");
|
||||
}
|
||||
if (glx_enable_extension != NULL) {
|
||||
if (screen->irq != 0) {
|
||||
(*glx_enable_extension) (psc, "GLX_SGI_swap_control");
|
||||
(*glx_enable_extension) (psc, "GLX_SGI_video_sync");
|
||||
(*glx_enable_extension) (psc, "GLX_MESA_swap_control");
|
||||
}
|
||||
|
||||
(*glx_enable_extension) (psc, "GLX_MESA_swap_frame_usage");
|
||||
(*glx_enable_extension) (psc, "GLX_MESA_swap_frame_usage");
|
||||
}
|
||||
|
||||
#if R200_MERGED
|
||||
sPriv->psc->allocateMemory = (void *)r200AllocateMemoryMESA;
|
||||
sPriv->psc->freeMemory = (void *)r200FreeMemoryMESA;
|
||||
sPriv->psc->memoryOffset = (void *)r200GetMemoryOffsetMESA;
|
||||
|
||||
(*glx_enable_extension) (psc, "GLX_MESA_allocate_memory");
|
||||
if (glx_enable_extension != NULL) {
|
||||
(*glx_enable_extension) (psc, "GLX_MESA_allocate_memory");
|
||||
}
|
||||
#endif
|
||||
|
||||
return screen;
|
||||
|
@@ -212,9 +212,9 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv )
|
||||
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
|
||||
void * const psc = sPriv->psc->screenConfigs;
|
||||
|
||||
|
||||
if ( glx_enable_extension == NULL ) {
|
||||
return NULL;
|
||||
if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Allocate the private area */
|
||||
@@ -395,13 +395,15 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv )
|
||||
dri_priv->log2GARTTexGran;
|
||||
}
|
||||
|
||||
if ( screen->irq != 0 ) {
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
|
||||
}
|
||||
if ( glx_enable_extension != NULL ) {
|
||||
if ( screen->irq != 0 ) {
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
|
||||
}
|
||||
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
|
||||
}
|
||||
|
||||
screen->driScreen = sPriv;
|
||||
screen->sarea_priv_offset = dri_priv->sarea_priv_offset;
|
||||
|
@@ -38,6 +38,21 @@
|
||||
|
||||
#include "xf86drm.h" /* drm_handle_t, etc */
|
||||
|
||||
# define RADEON_AGP_1X_MODE 0x01
|
||||
# define RADEON_AGP_2X_MODE 0x02
|
||||
# define RADEON_AGP_4X_MODE 0x04
|
||||
# define RADEON_AGP_FW_MODE 0x10
|
||||
# define RADEON_AGP_MODE_MASK 0x17
|
||||
#define RADEON_CP_CSQ_CNTL 0x0740
|
||||
# define RADEON_CSQ_CNT_PRIMARY_MASK (0xff << 0)
|
||||
# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28)
|
||||
# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28)
|
||||
# define RADEON_CSQ_PRIBM_INDDIS (2 << 28)
|
||||
# define RADEON_CSQ_PRIPIO_INDBM (3 << 28)
|
||||
# define RADEON_CSQ_PRIBM_INDBM (4 << 28)
|
||||
# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28)
|
||||
|
||||
|
||||
#define PCI_CHIP_R200_BB 0x4242
|
||||
#define PCI_CHIP_RV250_Id 0x4964
|
||||
#define PCI_CHIP_RV250_Ie 0x4965
|
||||
@@ -173,6 +188,8 @@ typedef struct {
|
||||
unsigned int frontPitchOffset;
|
||||
unsigned int backPitchOffset;
|
||||
unsigned int depthPitchOffset;
|
||||
|
||||
int colorTiling; /**< \brief Enable color tiling */
|
||||
|
||||
int irq; /**< \brief IRQ number */
|
||||
int page_flip_enable; /**< \brief Page Flip enable */
|
||||
|
@@ -26,6 +26,21 @@
|
||||
|
||||
static size_t radeon_drm_page_size;
|
||||
|
||||
static int RadeonSetParam(const DRIDriverContext *ctx, int param, int value)
|
||||
{
|
||||
drm_radeon_setparam_t sp;
|
||||
|
||||
memset(&sp, 0, sizeof(sp));
|
||||
sp.param = param;
|
||||
sp.value = value;
|
||||
|
||||
if (drmCommandWrite(ctx->drmFD, DRM_RADEON_SETPARAM, &sp, sizeof(sp))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Wait for free FIFO entries.
|
||||
*
|
||||
@@ -210,6 +225,8 @@ static int RADEONEngineRestore( const DRIDriverContext *ctx )
|
||||
|
||||
|
||||
OUTREG(RADEON_GEN_INT_CNTL, info->gen_int_cntl);
|
||||
if (info->colorTiling)
|
||||
info->crtc_offset_cntl |= RADEON_CRTC_TILE_EN;
|
||||
OUTREG(RADEON_CRTC_OFFSET_CNTL, info->crtc_offset_cntl);
|
||||
|
||||
/* Initialize and start the CP if required */
|
||||
@@ -381,7 +398,7 @@ static int RADEONDRIAgpInit( const DRIDriverContext *ctx, RADEONInfoPtr info)
|
||||
fprintf(stderr, "[gart] Could not add ring mapping\n");
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr, "[gart] ring handle = 0x%08lx\n", info->ringHandle);
|
||||
fprintf(stderr, "[gart] ring handle = 0x%08x\n", info->ringHandle);
|
||||
|
||||
|
||||
if (drmAddMap(ctx->drmFD, info->ringReadOffset, info->ringReadMapSize,
|
||||
@@ -392,7 +409,7 @@ static int RADEONDRIAgpInit( const DRIDriverContext *ctx, RADEONInfoPtr info)
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"[gart] ring read ptr handle = 0x%08lx\n",
|
||||
"[gart] ring read ptr handle = 0x%08lx\n",
|
||||
info->ringReadPtrHandle);
|
||||
|
||||
if (drmAddMap(ctx->drmFD, info->bufStart, info->bufMapSize,
|
||||
@@ -402,7 +419,7 @@ static int RADEONDRIAgpInit( const DRIDriverContext *ctx, RADEONInfoPtr info)
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[gart] vertex/indirect buffers handle = 0x%08lx\n",
|
||||
"[gart] vertex/indirect buffers handle = 0x%08x\n",
|
||||
info->bufHandle);
|
||||
|
||||
if (drmAddMap(ctx->drmFD, info->gartTexStart, info->gartTexMapSize,
|
||||
@@ -412,7 +429,7 @@ static int RADEONDRIAgpInit( const DRIDriverContext *ctx, RADEONInfoPtr info)
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[gart] AGP texture map handle = 0x%08lx\n",
|
||||
"[gart] AGP texture map handle = 0x%08lx\n",
|
||||
info->gartTexHandle);
|
||||
|
||||
/* Initialize Radeon's AGP registers */
|
||||
@@ -438,7 +455,7 @@ static int RADEONDRIPciInit(const DRIDriverContext *ctx, RADEONInfoPtr info)
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[pci] %d kB allocated with handle 0x%08x\n",
|
||||
"[pci] %d kB allocated with handle 0x%08lx\n",
|
||||
info->gartSize*1024, info->gartMemHandle);
|
||||
|
||||
info->gartOffset = 0;
|
||||
@@ -469,7 +486,7 @@ static int RADEONDRIPciInit(const DRIDriverContext *ctx, RADEONInfoPtr info)
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[pci] ring handle = 0x%08lx\n", info->ringHandle);
|
||||
"[pci] ring handle = 0x%08x\n", info->ringHandle);
|
||||
|
||||
if (drmAddMap(ctx->drmFD, info->ringReadOffset, info->ringReadMapSize,
|
||||
DRM_SCATTER_GATHER, flags, &info->ringReadPtrHandle) < 0) {
|
||||
@@ -478,7 +495,7 @@ static int RADEONDRIPciInit(const DRIDriverContext *ctx, RADEONInfoPtr info)
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[pci] ring read ptr handle = 0x%08lx\n",
|
||||
"[pci] ring read ptr handle = 0x%08lx\n",
|
||||
info->ringReadPtrHandle);
|
||||
|
||||
if (drmAddMap(ctx->drmFD, info->bufStart, info->bufMapSize,
|
||||
@@ -488,7 +505,7 @@ static int RADEONDRIPciInit(const DRIDriverContext *ctx, RADEONInfoPtr info)
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[pci] vertex/indirect buffers handle = 0x%08lx\n",
|
||||
"[pci] vertex/indirect buffers handle = 0x%08lx\n",
|
||||
info->bufHandle);
|
||||
|
||||
if (drmAddMap(ctx->drmFD, info->gartTexStart, info->gartTexMapSize,
|
||||
@@ -498,7 +515,7 @@ static int RADEONDRIPciInit(const DRIDriverContext *ctx, RADEONInfoPtr info)
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[pci] GART texture map handle = 0x%08lx\n",
|
||||
"[pci] GART texture map handle = 0x%08x\n",
|
||||
info->gartTexHandle);
|
||||
|
||||
return 1;
|
||||
@@ -702,12 +719,9 @@ static int RADEONMemoryInit( const DRIDriverContext *ctx, RADEONInfoPtr info )
|
||||
{
|
||||
int width_bytes = ctx->shared.virtualWidth * ctx->cpp;
|
||||
int cpp = ctx->cpp;
|
||||
int bufferSize = ((ctx->shared.virtualHeight * width_bytes
|
||||
+ RADEON_BUFFER_ALIGN)
|
||||
& ~RADEON_BUFFER_ALIGN);
|
||||
int bufferSize = ((((ctx->shared.virtualHeight+15) & ~15) * width_bytes + RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN);
|
||||
int depthSize = ((((ctx->shared.virtualHeight+15) & ~15) * width_bytes
|
||||
+ RADEON_BUFFER_ALIGN)
|
||||
& ~RADEON_BUFFER_ALIGN);
|
||||
+ RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN);
|
||||
int l;
|
||||
|
||||
info->frontOffset = 0;
|
||||
@@ -726,6 +740,11 @@ static int RADEONMemoryInit( const DRIDriverContext *ctx, RADEONInfoPtr info )
|
||||
*/
|
||||
info->textureSize = ctx->shared.fbSize - 2 * bufferSize - depthSize;
|
||||
|
||||
if (ctx->colorTiling==1)
|
||||
{
|
||||
info->textureSize = ctx->shared.fbSize - ((ctx->shared.fbSize - info->textureSize + width_bytes * 16 - 1) / (width_bytes * 16)) * (width_bytes*16);
|
||||
}
|
||||
|
||||
if (info->textureSize < 0)
|
||||
return 0;
|
||||
|
||||
@@ -748,10 +767,17 @@ static int RADEONMemoryInit( const DRIDriverContext *ctx, RADEONInfoPtr info )
|
||||
}
|
||||
|
||||
/* Reserve space for textures */
|
||||
info->textureOffset = ((ctx->shared.fbSize - info->textureSize +
|
||||
RADEON_BUFFER_ALIGN) &
|
||||
if (ctx->colorTiling==1)
|
||||
{
|
||||
info->textureOffset = ((ctx->shared.fbSize - info->textureSize) /
|
||||
(width_bytes * 16)) * (width_bytes*16);
|
||||
}
|
||||
else
|
||||
{
|
||||
info->textureOffset = ((ctx->shared.fbSize - info->textureSize +
|
||||
RADEON_BUFFER_ALIGN) &
|
||||
~RADEON_BUFFER_ALIGN);
|
||||
|
||||
}
|
||||
/* Reserve space for the shared depth
|
||||
* buffer.
|
||||
*/
|
||||
@@ -786,6 +812,43 @@ static int RADEONMemoryInit( const DRIDriverContext *ctx, RADEONInfoPtr info )
|
||||
(info->depthOffset >> 10));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int RADEONColorTilingInit( const DRIDriverContext *ctx, RADEONInfoPtr info )
|
||||
{
|
||||
int width_bytes = ctx->shared.virtualWidth * ctx->cpp;
|
||||
int bufferSize = ((((ctx->shared.virtualHeight+15) & ~15) * width_bytes + RADEON_BUFFER_ALIGN)
|
||||
& ~RADEON_BUFFER_ALIGN);
|
||||
/* Setup color tiling */
|
||||
if (info->drmMinor<14)
|
||||
info->colorTiling=0;
|
||||
|
||||
if (info->colorTiling)
|
||||
{
|
||||
|
||||
int colorTilingFlag;
|
||||
drm_radeon_surface_alloc_t front,back;
|
||||
|
||||
RadeonSetParam(ctx, RADEON_SETPARAM_SWITCH_TILING, info->colorTiling ? 1 : 0);
|
||||
|
||||
/* Setup the surfaces */
|
||||
if (info->ChipFamily < CHIP_FAMILY_R200)
|
||||
colorTilingFlag=RADEON_SURF_TILE_COLOR_MACRO;
|
||||
else
|
||||
colorTilingFlag=R200_SURF_TILE_COLOR_MACRO;
|
||||
|
||||
front.address = info->frontOffset;
|
||||
front.size = bufferSize;
|
||||
front.flags = (width_bytes) | colorTilingFlag;
|
||||
drmCommandWrite(ctx->drmFD, DRM_RADEON_SURF_ALLOC, &front,sizeof(front));
|
||||
|
||||
back.address = info->backOffset;
|
||||
back.size = bufferSize;
|
||||
back.flags = (width_bytes) | colorTilingFlag;
|
||||
drmCommandWrite(ctx->drmFD, DRM_RADEON_SURF_ALLOC, &back,sizeof(back));
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -961,12 +1024,15 @@ static int RADEONScreenInit( DRIDriverContext *ctx, RADEONInfoPtr info )
|
||||
return 0;
|
||||
}
|
||||
|
||||
RADEONColorTilingInit(ctx, info);
|
||||
|
||||
/* Initialize IRQ */
|
||||
RADEONDRIIrqInit(ctx, info);
|
||||
|
||||
/* Initialize kernel gart memory manager */
|
||||
RADEONDRIAgpHeapInit(ctx, info);
|
||||
|
||||
fprintf(stderr,"color tiling %sabled\n", info->colorTiling?"en":"dis");
|
||||
fprintf(stderr,"page flipping %sabled\n", info->page_flip_enable?"en":"dis");
|
||||
/* Initialize the SAREA private data structure */
|
||||
{
|
||||
@@ -990,7 +1056,6 @@ static int RADEONScreenInit( DRIDriverContext *ctx, RADEONInfoPtr info )
|
||||
0,
|
||||
info->backPitch * ctx->cpp * ctx->shared.virtualHeight );
|
||||
|
||||
|
||||
/* This is the struct passed to radeon_dri.so for its initialization */
|
||||
ctx->driverClientMsg = malloc(sizeof(RADEONDRIRec));
|
||||
ctx->driverClientMsgSize = sizeof(RADEONDRIRec);
|
||||
@@ -1126,6 +1191,8 @@ static int radeonValidateMode( const DRIDriverContext *ctx )
|
||||
info->gen_int_cntl = INREG(RADEON_GEN_INT_CNTL);
|
||||
info->crtc_offset_cntl = INREG(RADEON_CRTC_OFFSET_CNTL);
|
||||
|
||||
if (info->colorTiling)
|
||||
info->crtc_offset_cntl |= RADEON_CRTC_TILE_EN;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1146,9 +1213,12 @@ static int radeonPostValidateMode( const DRIDriverContext *ctx )
|
||||
unsigned char *RADEONMMIO = ctx->MMIOAddress;
|
||||
RADEONInfoPtr info = ctx->driverPrivate;
|
||||
|
||||
RADEONColorTilingInit( ctx, info);
|
||||
OUTREG(RADEON_GEN_INT_CNTL, info->gen_int_cntl);
|
||||
if (info->colorTiling)
|
||||
info->crtc_offset_cntl |= RADEON_CRTC_TILE_EN;
|
||||
OUTREG(RADEON_CRTC_OFFSET_CNTL, info->crtc_offset_cntl);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1172,16 +1242,27 @@ static int radeonInitFBDev( DRIDriverContext *ctx )
|
||||
{
|
||||
int dummy = ctx->shared.virtualWidth;
|
||||
|
||||
switch (ctx->bpp / 8) {
|
||||
case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
|
||||
case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
|
||||
case 3:
|
||||
case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
|
||||
if (ctx->colorTiling==1)
|
||||
{
|
||||
switch (ctx->bpp / 8) {
|
||||
case 1: dummy = (ctx->shared.virtualWidth + 255) & ~255; break;
|
||||
case 2: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
|
||||
case 3:
|
||||
case 4: dummy = (ctx->shared.virtualWidth + 63) & ~63; break;
|
||||
}
|
||||
} else {
|
||||
switch (ctx->bpp / 8) {
|
||||
case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
|
||||
case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
|
||||
case 3:
|
||||
case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
|
||||
}
|
||||
}
|
||||
|
||||
ctx->shared.virtualWidth = dummy;
|
||||
}
|
||||
|
||||
fprintf(stderr,"shared virtual width is %d\n", ctx->shared.virtualWidth);
|
||||
ctx->driverPrivate = (void *)info;
|
||||
|
||||
info->gartFastWrite = RADEON_DEFAULT_AGP_FAST_WRITE;
|
||||
@@ -1190,6 +1271,7 @@ static int radeonInitFBDev( DRIDriverContext *ctx )
|
||||
info->bufSize = RADEON_DEFAULT_BUFFER_SIZE;
|
||||
info->ringSize = RADEON_DEFAULT_RING_SIZE;
|
||||
info->page_flip_enable = RADEON_DEFAULT_PAGE_FLIP;
|
||||
info->colorTiling = ctx->colorTiling;
|
||||
|
||||
info->Chipset = ctx->chipset;
|
||||
|
||||
|
978
src/mesa/drivers/dri/radeon/server/radeon_egl.c
Normal file
978
src/mesa/drivers/dri/radeon/server/radeon_egl.c
Normal file
@@ -0,0 +1,978 @@
|
||||
/*
|
||||
* EGL driver for radeon_dri.so
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include "eglconfig.h"
|
||||
#include "eglcontext.h"
|
||||
#include "egldisplay.h"
|
||||
#include "egldriver.h"
|
||||
#include "eglglobals.h"
|
||||
#include "eglmode.h"
|
||||
#include "eglscreen.h"
|
||||
#include "eglsurface.h"
|
||||
#include "egldri.h"
|
||||
|
||||
#include "mtypes.h"
|
||||
#include "memops.h"
|
||||
#include "drm.h"
|
||||
#include "drm_sarea.h"
|
||||
#include "radeon_drm.h"
|
||||
#include "radeon_dri.h"
|
||||
#include "radeon.h"
|
||||
|
||||
static size_t radeon_drm_page_size;
|
||||
|
||||
/**
|
||||
* radeon driver-specific driver class derived from _EGLDriver
|
||||
*/
|
||||
typedef struct radeon_driver
|
||||
{
|
||||
_EGLDriver Base; /* base class/object */
|
||||
GLuint radeonStuff;
|
||||
} radeonDriver;
|
||||
|
||||
static int RADEONCheckDRMVersion( driDisplay *disp,
|
||||
RADEONInfoPtr info )
|
||||
{
|
||||
drmVersionPtr version;
|
||||
|
||||
version = drmGetVersion(disp->drmFD);
|
||||
if (version) {
|
||||
int req_minor, req_patch;
|
||||
|
||||
/* Need 1.8.x for proper cleanup-on-client-exit behaviour.
|
||||
*/
|
||||
req_minor = 8;
|
||||
req_patch = 0;
|
||||
|
||||
if (version->version_major != 1 ||
|
||||
version->version_minor < req_minor ||
|
||||
(version->version_minor == req_minor &&
|
||||
version->version_patchlevel < req_patch)) {
|
||||
/* Incompatible drm version */
|
||||
fprintf(stderr,
|
||||
"[dri] RADEONDRIScreenInit failed because of a version "
|
||||
"mismatch.\n"
|
||||
"[dri] radeon.o kernel module version is %d.%d.%d "
|
||||
"but version 1.%d.%d or newer is needed.\n"
|
||||
"[dri] Disabling DRI.\n",
|
||||
version->version_major,
|
||||
version->version_minor,
|
||||
version->version_patchlevel,
|
||||
req_minor,
|
||||
req_patch);
|
||||
drmFreeVersion(version);
|
||||
return 0;
|
||||
}
|
||||
|
||||
info->drmMinor = version->version_minor;
|
||||
drmFreeVersion(version);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Compute base 2 logarithm.
|
||||
*
|
||||
* \param val value.
|
||||
*
|
||||
* \return base 2 logarithm of \p val.
|
||||
*/
|
||||
static int RADEONMinBits(int val)
|
||||
{
|
||||
int bits;
|
||||
|
||||
if (!val) return 1;
|
||||
for (bits = 0; val; val >>= 1, ++bits);
|
||||
return bits;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize the PCI GART state. Request memory for use in PCI space,
|
||||
* and initialize the Radeon registers to point to that memory.
|
||||
*/
|
||||
static int RADEONDRIPciInit(driDisplay *disp, RADEONInfoPtr info)
|
||||
{
|
||||
int ret;
|
||||
int flags = DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL;
|
||||
int s, l;
|
||||
|
||||
ret = drmScatterGatherAlloc(disp->drmFD, info->gartSize*1024*1024,
|
||||
&info->gartMemHandle);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "[pci] Out of memory (%d)\n", ret);
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[pci] %d kB allocated with handle 0x%04lx\n",
|
||||
info->gartSize*1024, info->gartMemHandle);
|
||||
|
||||
info->gartOffset = 0;
|
||||
|
||||
/* Initialize the CP ring buffer data */
|
||||
info->ringStart = info->gartOffset;
|
||||
info->ringMapSize = info->ringSize*1024*1024 + radeon_drm_page_size;
|
||||
|
||||
info->ringReadOffset = info->ringStart + info->ringMapSize;
|
||||
info->ringReadMapSize = radeon_drm_page_size;
|
||||
|
||||
/* Reserve space for vertex/indirect buffers */
|
||||
info->bufStart = info->ringReadOffset + info->ringReadMapSize;
|
||||
info->bufMapSize = info->bufSize*1024*1024;
|
||||
|
||||
/* Reserve the rest for AGP textures */
|
||||
info->gartTexStart = info->bufStart + info->bufMapSize;
|
||||
s = (info->gartSize*1024*1024 - info->gartTexStart);
|
||||
l = RADEONMinBits((s-1) / RADEON_NR_TEX_REGIONS);
|
||||
if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY;
|
||||
info->gartTexMapSize = (s >> l) << l;
|
||||
info->log2GARTTexGran = l;
|
||||
|
||||
if (drmAddMap(disp->drmFD, info->ringStart, info->ringMapSize,
|
||||
DRM_SCATTER_GATHER, flags, &info->ringHandle) < 0) {
|
||||
fprintf(stderr,
|
||||
"[pci] Could not add ring mapping\n");
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[pci] ring handle = 0x%08lx\n", info->ringHandle);
|
||||
|
||||
if (drmAddMap(disp->drmFD, info->ringReadOffset, info->ringReadMapSize,
|
||||
DRM_SCATTER_GATHER, flags, &info->ringReadPtrHandle) < 0) {
|
||||
fprintf(stderr,
|
||||
"[pci] Could not add ring read ptr mapping\n");
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[pci] ring read ptr handle = 0x%08lx\n",
|
||||
info->ringReadPtrHandle);
|
||||
|
||||
if (drmAddMap(disp->drmFD, info->bufStart, info->bufMapSize,
|
||||
DRM_SCATTER_GATHER, 0, &info->bufHandle) < 0) {
|
||||
fprintf(stderr,
|
||||
"[pci] Could not add vertex/indirect buffers mapping\n");
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[pci] vertex/indirect buffers handle = 0x%08lx\n",
|
||||
info->bufHandle);
|
||||
|
||||
if (drmAddMap(disp->drmFD, info->gartTexStart, info->gartTexMapSize,
|
||||
DRM_SCATTER_GATHER, 0, &info->gartTexHandle) < 0) {
|
||||
fprintf(stderr,
|
||||
"[pci] Could not add GART texture map mapping\n");
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[pci] GART texture map handle = 0x%08lx\n",
|
||||
info->gartTexHandle);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Initialize the AGP state
|
||||
*
|
||||
* \param ctx display handle.
|
||||
* \param info driver private data.
|
||||
*
|
||||
* \return one on success, or zero on failure.
|
||||
*
|
||||
* Acquires and enables the AGP device. Reserves memory in the AGP space for
|
||||
* the ring buffer, vertex buffers and textures. Initialize the Radeon
|
||||
* registers to point to that memory and add client mappings.
|
||||
*/
|
||||
static int RADEONDRIAgpInit( driDisplay *disp, RADEONInfoPtr info)
|
||||
{
|
||||
int mode, ret;
|
||||
int s, l;
|
||||
int agpmode = 1;
|
||||
|
||||
if (drmAgpAcquire(disp->drmFD) < 0) {
|
||||
fprintf(stderr, "[gart] AGP not available\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
mode = drmAgpGetMode(disp->drmFD); /* Default mode */
|
||||
/* Disable fast write entirely - too many lockups.
|
||||
*/
|
||||
mode &= ~RADEON_AGP_MODE_MASK;
|
||||
switch (agpmode) {
|
||||
case 4: mode |= RADEON_AGP_4X_MODE;
|
||||
case 2: mode |= RADEON_AGP_2X_MODE;
|
||||
case 1: default: mode |= RADEON_AGP_1X_MODE;
|
||||
}
|
||||
|
||||
if (drmAgpEnable(disp->drmFD, mode) < 0) {
|
||||
fprintf(stderr, "[gart] AGP not enabled\n");
|
||||
drmAgpRelease(disp->drmFD);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Workaround for some hardware bugs */
|
||||
if (info->ChipFamily < CHIP_FAMILY_R200)
|
||||
OUTREG(RADEON_AGP_CNTL, INREG(RADEON_AGP_CNTL) | 0x000e0000);
|
||||
#endif
|
||||
info->gartOffset = 0;
|
||||
|
||||
if ((ret = drmAgpAlloc(disp->drmFD, info->gartSize*1024*1024, 0, NULL,
|
||||
&info->gartMemHandle)) < 0) {
|
||||
fprintf(stderr, "[gart] Out of memory (%d)\n", ret);
|
||||
drmAgpRelease(disp->drmFD);
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[gart] %d kB allocated with handle 0x%08x\n",
|
||||
info->gartSize*1024, (unsigned)info->gartMemHandle);
|
||||
|
||||
if (drmAgpBind(disp->drmFD,
|
||||
info->gartMemHandle, info->gartOffset) < 0) {
|
||||
fprintf(stderr, "[gart] Could not bind\n");
|
||||
drmAgpFree(disp->drmFD, info->gartMemHandle);
|
||||
drmAgpRelease(disp->drmFD);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialize the CP ring buffer data */
|
||||
info->ringStart = info->gartOffset;
|
||||
info->ringMapSize = info->ringSize*1024*1024 + radeon_drm_page_size;
|
||||
|
||||
info->ringReadOffset = info->ringStart + info->ringMapSize;
|
||||
info->ringReadMapSize = radeon_drm_page_size;
|
||||
|
||||
/* Reserve space for vertex/indirect buffers */
|
||||
info->bufStart = info->ringReadOffset + info->ringReadMapSize;
|
||||
info->bufMapSize = info->bufSize*1024*1024;
|
||||
|
||||
/* Reserve the rest for AGP textures */
|
||||
info->gartTexStart = info->bufStart + info->bufMapSize;
|
||||
s = (info->gartSize*1024*1024 - info->gartTexStart);
|
||||
l = RADEONMinBits((s-1) / RADEON_NR_TEX_REGIONS);
|
||||
if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY;
|
||||
info->gartTexMapSize = (s >> l) << l;
|
||||
info->log2GARTTexGran = l;
|
||||
|
||||
if (drmAddMap(disp->drmFD, info->ringStart, info->ringMapSize,
|
||||
DRM_AGP, DRM_READ_ONLY, &info->ringHandle) < 0) {
|
||||
fprintf(stderr, "[gart] Could not add ring mapping\n");
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr, "[gart] ring handle = 0x%08lx\n", info->ringHandle);
|
||||
|
||||
|
||||
if (drmAddMap(disp->drmFD, info->ringReadOffset, info->ringReadMapSize,
|
||||
DRM_AGP, DRM_READ_ONLY, &info->ringReadPtrHandle) < 0) {
|
||||
fprintf(stderr,
|
||||
"[gart] Could not add ring read ptr mapping\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"[gart] ring read ptr handle = 0x%08lx\n",
|
||||
info->ringReadPtrHandle);
|
||||
|
||||
if (drmAddMap(disp->drmFD, info->bufStart, info->bufMapSize,
|
||||
DRM_AGP, 0, &info->bufHandle) < 0) {
|
||||
fprintf(stderr,
|
||||
"[gart] Could not add vertex/indirect buffers mapping\n");
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[gart] vertex/indirect buffers handle = 0x%08lx\n",
|
||||
info->bufHandle);
|
||||
|
||||
if (drmAddMap(disp->drmFD, info->gartTexStart, info->gartTexMapSize,
|
||||
DRM_AGP, 0, &info->gartTexHandle) < 0) {
|
||||
fprintf(stderr,
|
||||
"[gart] Could not add AGP texture map mapping\n");
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[gart] AGP texture map handle = 0x%08lx\n",
|
||||
info->gartTexHandle);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int RADEONMemoryInit( driDisplay *disp, RADEONInfoPtr info )
|
||||
{
|
||||
int width_bytes = disp->virtualWidth * disp->cpp;
|
||||
int cpp = disp->cpp;
|
||||
int bufferSize = ((disp->virtualHeight * width_bytes
|
||||
+ RADEON_BUFFER_ALIGN)
|
||||
& ~RADEON_BUFFER_ALIGN);
|
||||
int depthSize = ((((disp->virtualHeight+15) & ~15) * width_bytes
|
||||
+ RADEON_BUFFER_ALIGN)
|
||||
& ~RADEON_BUFFER_ALIGN);
|
||||
int l;
|
||||
|
||||
info->frontOffset = 0;
|
||||
info->frontPitch = disp->virtualWidth;
|
||||
|
||||
fprintf(stderr,
|
||||
"Using %d MB AGP aperture\n", info->gartSize);
|
||||
fprintf(stderr,
|
||||
"Using %d MB for the ring buffer\n", info->ringSize);
|
||||
fprintf(stderr,
|
||||
"Using %d MB for vertex/indirect buffers\n", info->bufSize);
|
||||
fprintf(stderr,
|
||||
"Using %d MB for AGP textures\n", info->gartTexSize);
|
||||
|
||||
/* Front, back and depth buffers - everything else texture??
|
||||
*/
|
||||
info->textureSize = disp->fbSize - 2 * bufferSize - depthSize;
|
||||
|
||||
if (info->textureSize < 0)
|
||||
return 0;
|
||||
|
||||
l = RADEONMinBits((info->textureSize-1) / RADEON_NR_TEX_REGIONS);
|
||||
if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY;
|
||||
|
||||
/* Round the texture size up to the nearest whole number of
|
||||
* texture regions. Again, be greedy about this, don't
|
||||
* round down.
|
||||
*/
|
||||
info->log2TexGran = l;
|
||||
info->textureSize = (info->textureSize >> l) << l;
|
||||
|
||||
/* Set a minimum usable local texture heap size. This will fit
|
||||
* two 256x256x32bpp textures.
|
||||
*/
|
||||
if (info->textureSize < 512 * 1024) {
|
||||
info->textureOffset = 0;
|
||||
info->textureSize = 0;
|
||||
}
|
||||
|
||||
/* Reserve space for textures */
|
||||
info->textureOffset = ((disp->fbSize - info->textureSize +
|
||||
RADEON_BUFFER_ALIGN) &
|
||||
~RADEON_BUFFER_ALIGN);
|
||||
|
||||
/* Reserve space for the shared depth
|
||||
* buffer.
|
||||
*/
|
||||
info->depthOffset = ((info->textureOffset - depthSize +
|
||||
RADEON_BUFFER_ALIGN) &
|
||||
~RADEON_BUFFER_ALIGN);
|
||||
info->depthPitch = disp->virtualWidth;
|
||||
|
||||
info->backOffset = ((info->depthOffset - bufferSize +
|
||||
RADEON_BUFFER_ALIGN) &
|
||||
~RADEON_BUFFER_ALIGN);
|
||||
info->backPitch = disp->virtualWidth;
|
||||
|
||||
|
||||
fprintf(stderr,
|
||||
"Will use back buffer at offset 0x%x\n",
|
||||
info->backOffset);
|
||||
fprintf(stderr,
|
||||
"Will use depth buffer at offset 0x%x\n",
|
||||
info->depthOffset);
|
||||
fprintf(stderr,
|
||||
"Will use %d kb for textures at offset 0x%x\n",
|
||||
info->textureSize/1024, info->textureOffset);
|
||||
|
||||
info->frontPitchOffset = (((info->frontPitch * cpp / 64) << 22) |
|
||||
(info->frontOffset >> 10));
|
||||
|
||||
info->backPitchOffset = (((info->backPitch * cpp / 64) << 22) |
|
||||
(info->backOffset >> 10));
|
||||
|
||||
info->depthPitchOffset = (((info->depthPitch * cpp / 64) << 22) |
|
||||
(info->depthOffset >> 10));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Initialize the kernel data structures and enable the CP engine.
|
||||
*
|
||||
* \param ctx display handle.
|
||||
* \param info driver private data.
|
||||
*
|
||||
* \return non-zero on success, or zero on failure.
|
||||
*
|
||||
* This function is a wrapper around the DRM_RADEON_CP_INIT command, passing
|
||||
* all the parameters in a drm_radeon_init_t structure.
|
||||
*/
|
||||
static int RADEONDRIKernelInit( driDisplay *disp,
|
||||
RADEONInfoPtr info)
|
||||
{
|
||||
int cpp = disp->bpp / 8;
|
||||
drm_radeon_init_t drmInfo;
|
||||
int ret;
|
||||
|
||||
memset(&drmInfo, 0, sizeof(drmInfo));
|
||||
|
||||
if ( (info->ChipFamily == CHIP_FAMILY_R200) ||
|
||||
(info->ChipFamily == CHIP_FAMILY_RV250) ||
|
||||
(info->ChipFamily == CHIP_FAMILY_M9) ||
|
||||
(info->ChipFamily == CHIP_FAMILY_RV280) )
|
||||
drmInfo.func = RADEON_INIT_R200_CP;
|
||||
else
|
||||
drmInfo.func = RADEON_INIT_CP;
|
||||
|
||||
/* This is the struct passed to the kernel module for its initialization */
|
||||
drmInfo.sarea_priv_offset = sizeof(drm_sarea_t);
|
||||
drmInfo.cp_mode = RADEON_DEFAULT_CP_BM_MODE;
|
||||
drmInfo.gart_size = info->gartSize*1024*1024;
|
||||
drmInfo.ring_size = info->ringSize*1024*1024;
|
||||
drmInfo.usec_timeout = 1000;
|
||||
drmInfo.fb_bpp = disp->bpp;
|
||||
drmInfo.depth_bpp = disp->bpp;
|
||||
drmInfo.front_offset = info->frontOffset;
|
||||
drmInfo.front_pitch = info->frontPitch * cpp;
|
||||
drmInfo.back_offset = info->backOffset;
|
||||
drmInfo.back_pitch = info->backPitch * cpp;
|
||||
drmInfo.depth_offset = info->depthOffset;
|
||||
drmInfo.depth_pitch = info->depthPitch * cpp;
|
||||
drmInfo.ring_offset = info->ringHandle;
|
||||
drmInfo.ring_rptr_offset = info->ringReadPtrHandle;
|
||||
drmInfo.buffers_offset = info->bufHandle;
|
||||
drmInfo.gart_textures_offset = info->gartTexHandle;
|
||||
|
||||
ret = drmCommandWrite(disp->drmFD, DRM_RADEON_CP_INIT, &drmInfo,
|
||||
sizeof(drm_radeon_init_t));
|
||||
|
||||
return ret >= 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Add a map for the vertex buffers that will be accessed by any
|
||||
* DRI-based clients.
|
||||
*
|
||||
* \param ctx display handle.
|
||||
* \param info driver private data.
|
||||
*
|
||||
* \return one on success, or zero on failure.
|
||||
*
|
||||
* Calls drmAddBufs() with the previously allocated vertex buffers.
|
||||
*/
|
||||
static int RADEONDRIBufInit( driDisplay *disp, RADEONInfoPtr info )
|
||||
{
|
||||
/* Initialize vertex buffers */
|
||||
info->bufNumBufs = drmAddBufs(disp->drmFD,
|
||||
info->bufMapSize / RADEON_BUFFER_SIZE,
|
||||
RADEON_BUFFER_SIZE,
|
||||
disp->isPCI ? DRM_SG_BUFFER : DRM_AGP_BUFFER,
|
||||
info->bufStart);
|
||||
|
||||
if (info->bufNumBufs <= 0) {
|
||||
fprintf(stderr,
|
||||
"[drm] Could not create vertex/indirect buffers list\n");
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"[drm] Added %d %d byte vertex/indirect buffers\n",
|
||||
info->bufNumBufs, RADEON_BUFFER_SIZE);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Install an IRQ handler.
|
||||
*
|
||||
* \param disp display handle.
|
||||
* \param info driver private data.
|
||||
*
|
||||
* Attempts to install an IRQ handler via drmCtlInstHandler(), falling back to
|
||||
* IRQ-free operation on failure.
|
||||
*/
|
||||
static void RADEONDRIIrqInit(driDisplay *disp, RADEONInfoPtr info)
|
||||
{
|
||||
if ((drmCtlInstHandler(disp->drmFD, 0)) != 0)
|
||||
fprintf(stderr, "[drm] failure adding irq handler, "
|
||||
"there is a device already using that irq\n"
|
||||
"[drm] falling back to irq-free operation\n");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Initialize the AGP heap.
|
||||
*
|
||||
* \param disp display handle.
|
||||
* \param info driver private data.
|
||||
*
|
||||
* This function is a wrapper around the DRM_RADEON_INIT_HEAP command, passing
|
||||
* all the parameters in a drm_radeon_mem_init_heap structure.
|
||||
*/
|
||||
static void RADEONDRIAgpHeapInit(driDisplay *disp,
|
||||
RADEONInfoPtr info)
|
||||
{
|
||||
drm_radeon_mem_init_heap_t drmHeap;
|
||||
|
||||
/* Start up the simple memory manager for gart space */
|
||||
drmHeap.region = RADEON_MEM_REGION_GART;
|
||||
drmHeap.start = 0;
|
||||
drmHeap.size = info->gartTexMapSize;
|
||||
|
||||
if (drmCommandWrite(disp->drmFD, DRM_RADEON_INIT_HEAP,
|
||||
&drmHeap, sizeof(drmHeap))) {
|
||||
fprintf(stderr,
|
||||
"[drm] Failed to initialized gart heap manager\n");
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"[drm] Initialized kernel gart heap manager, %d\n",
|
||||
info->gartTexMapSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called at the start of each server generation.
|
||||
*
|
||||
* \param disp display handle.
|
||||
* \param info driver private data.
|
||||
*
|
||||
* \return non-zero on success, or zero on failure.
|
||||
*
|
||||
* Performs static frame buffer allocation. Opens the DRM device and add maps
|
||||
* to the SAREA, framebuffer and MMIO regions. Fills in \p info with more
|
||||
* information. Creates a \e server context to grab the lock for the
|
||||
* initialization ioctls and calls the other initilization functions in this
|
||||
* file. Starts the CP engine via the DRM_RADEON_CP_START command.
|
||||
*
|
||||
* Setups a RADEONDRIRec structure to be passed to radeon_dri.so for its
|
||||
* initialization.
|
||||
*/
|
||||
static int RADEONScreenInit( driDisplay *disp, RADEONInfoPtr info, RADEONDRIPtr pRADEONDRI)
|
||||
{
|
||||
int i, err;
|
||||
|
||||
{
|
||||
int width_bytes = (disp->virtualWidth * disp->cpp);
|
||||
int maxy = disp->fbSize / width_bytes;
|
||||
|
||||
|
||||
if (maxy <= disp->virtualHeight * 3) {
|
||||
fprintf(stderr,
|
||||
"Static buffer allocation failed -- "
|
||||
"need at least %d kB video memory (have %d kB)\n",
|
||||
(disp->virtualWidth * disp->virtualHeight *
|
||||
disp->cpp * 3 + 1023) / 1024,
|
||||
disp->fbSize / 1024);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (info->ChipFamily >= CHIP_FAMILY_R300) {
|
||||
fprintf(stderr,
|
||||
"Direct rendering not yet supported on "
|
||||
"Radeon 9700 and newer cards\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
radeon_drm_page_size = getpagesize();
|
||||
|
||||
/* Check the radeon DRM version */
|
||||
if (!RADEONCheckDRMVersion(disp, info)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (disp->isPCI) {
|
||||
/* Initialize PCI */
|
||||
if (!RADEONDRIPciInit(disp, info))
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
/* Initialize AGP */
|
||||
if (!RADEONDRIAgpInit(disp, info))
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Memory manager setup */
|
||||
if (!RADEONMemoryInit(disp, info)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create a 'server' context so we can grab the lock for
|
||||
* initialization ioctls.
|
||||
*/
|
||||
if ((err = drmCreateContext(disp->drmFD, &disp->serverContext)) != 0) {
|
||||
fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DRM_LOCK(disp->drmFD, disp->pSAREA, disp->serverContext, 0);
|
||||
|
||||
/* Initialize the kernel data structures */
|
||||
if (!RADEONDRIKernelInit(disp, info)) {
|
||||
fprintf(stderr, "RADEONDRIKernelInit failed\n");
|
||||
DRM_UNLOCK(disp->drmFD, disp->pSAREA, disp->serverContext);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialize the vertex buffers list */
|
||||
if (!RADEONDRIBufInit(disp, info)) {
|
||||
fprintf(stderr, "RADEONDRIBufInit failed\n");
|
||||
DRM_UNLOCK(disp->drmFD, disp->pSAREA, disp->serverContext);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialize IRQ */
|
||||
RADEONDRIIrqInit(disp, info);
|
||||
|
||||
/* Initialize kernel gart memory manager */
|
||||
RADEONDRIAgpHeapInit(disp, info);
|
||||
|
||||
fprintf(stderr,"page flipping %sabled\n", info->page_flip_enable?"en":"dis");
|
||||
/* Initialize the SAREA private data structure */
|
||||
{
|
||||
drm_radeon_sarea_t *pSAREAPriv;
|
||||
pSAREAPriv = (drm_radeon_sarea_t *)(((char*)disp->pSAREA) +
|
||||
sizeof(drm_sarea_t));
|
||||
memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
|
||||
pSAREAPriv->pfState = info->page_flip_enable;
|
||||
}
|
||||
|
||||
for ( i = 0;; i++ ) {
|
||||
drmMapType type;
|
||||
drmMapFlags flags;
|
||||
drm_handle_t handle, offset;
|
||||
drmSize size;
|
||||
int rc, mtrr;
|
||||
|
||||
if ( ( rc = drmGetMap( disp->drmFD, i, &offset, &size, &type, &flags, &handle, &mtrr ) ) != 0 )
|
||||
break;
|
||||
if ( type == DRM_REGISTERS ) {
|
||||
pRADEONDRI->registerHandle = offset;
|
||||
pRADEONDRI->registerSize = size;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Quick hack to clear the front & back buffers. Could also use
|
||||
* the clear ioctl to do this, but would need to setup hw state
|
||||
* first.
|
||||
*/
|
||||
drimemsetio((char *)disp->pFB + info->frontOffset,
|
||||
0xEE,
|
||||
info->frontPitch * disp->cpp * disp->virtualHeight );
|
||||
|
||||
drimemsetio((char *)disp->pFB + info->backOffset,
|
||||
0x30,
|
||||
info->backPitch * disp->cpp * disp->virtualHeight );
|
||||
|
||||
|
||||
/* This is the struct passed to radeon_dri.so for its initialization */
|
||||
pRADEONDRI->deviceID = info->Chipset;
|
||||
pRADEONDRI->width = disp->virtualWidth;
|
||||
pRADEONDRI->height = disp->virtualHeight;
|
||||
pRADEONDRI->depth = disp->bpp; /* XXX: depth */
|
||||
pRADEONDRI->bpp = disp->bpp;
|
||||
pRADEONDRI->IsPCI = disp->isPCI;
|
||||
pRADEONDRI->frontOffset = info->frontOffset;
|
||||
pRADEONDRI->frontPitch = info->frontPitch;
|
||||
pRADEONDRI->backOffset = info->backOffset;
|
||||
pRADEONDRI->backPitch = info->backPitch;
|
||||
pRADEONDRI->depthOffset = info->depthOffset;
|
||||
pRADEONDRI->depthPitch = info->depthPitch;
|
||||
pRADEONDRI->textureOffset = info->textureOffset;
|
||||
pRADEONDRI->textureSize = info->textureSize;
|
||||
pRADEONDRI->log2TexGran = info->log2TexGran;
|
||||
pRADEONDRI->statusHandle = info->ringReadPtrHandle;
|
||||
pRADEONDRI->statusSize = info->ringReadMapSize;
|
||||
pRADEONDRI->gartTexHandle = info->gartTexHandle;
|
||||
pRADEONDRI->gartTexMapSize = info->gartTexMapSize;
|
||||
pRADEONDRI->log2GARTTexGran = info->log2GARTTexGran;
|
||||
pRADEONDRI->gartTexOffset = info->gartTexStart;
|
||||
pRADEONDRI->sarea_priv_offset = sizeof(drm_sarea_t);
|
||||
|
||||
/* Don't release the lock now - let the VT switch handler do it. */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get Radeon chip family from chipset number.
|
||||
*
|
||||
* \param info driver private data.
|
||||
*
|
||||
* \return non-zero on success, or zero on failure.
|
||||
*
|
||||
* Called by radeonInitFBDev() to set RADEONInfoRec::ChipFamily
|
||||
* according to the value of RADEONInfoRec::Chipset. Fails if the
|
||||
* chipset is unrecognized or not appropriate for this driver (i.e., not
|
||||
* an r100 style radeon)
|
||||
*/
|
||||
static int get_chipfamily_from_chipset( RADEONInfoPtr info )
|
||||
{
|
||||
switch (info->Chipset) {
|
||||
case PCI_CHIP_RADEON_LY:
|
||||
case PCI_CHIP_RADEON_LZ:
|
||||
info->ChipFamily = CHIP_FAMILY_M6;
|
||||
break;
|
||||
|
||||
case PCI_CHIP_RADEON_QY:
|
||||
case PCI_CHIP_RADEON_QZ:
|
||||
info->ChipFamily = CHIP_FAMILY_VE;
|
||||
break;
|
||||
|
||||
case PCI_CHIP_R200_QL:
|
||||
case PCI_CHIP_R200_QN:
|
||||
case PCI_CHIP_R200_QO:
|
||||
case PCI_CHIP_R200_Ql:
|
||||
case PCI_CHIP_R200_BB:
|
||||
info->ChipFamily = CHIP_FAMILY_R200;
|
||||
break;
|
||||
|
||||
case PCI_CHIP_RV200_QW: /* RV200 desktop */
|
||||
case PCI_CHIP_RV200_QX:
|
||||
info->ChipFamily = CHIP_FAMILY_RV200;
|
||||
break;
|
||||
|
||||
case PCI_CHIP_RADEON_LW:
|
||||
case PCI_CHIP_RADEON_LX:
|
||||
info->ChipFamily = CHIP_FAMILY_M7;
|
||||
break;
|
||||
|
||||
case PCI_CHIP_RV250_Id:
|
||||
case PCI_CHIP_RV250_Ie:
|
||||
case PCI_CHIP_RV250_If:
|
||||
case PCI_CHIP_RV250_Ig:
|
||||
info->ChipFamily = CHIP_FAMILY_RV250;
|
||||
break;
|
||||
|
||||
case PCI_CHIP_RV250_Ld:
|
||||
case PCI_CHIP_RV250_Le:
|
||||
case PCI_CHIP_RV250_Lf:
|
||||
case PCI_CHIP_RV250_Lg:
|
||||
info->ChipFamily = CHIP_FAMILY_M9;
|
||||
break;
|
||||
|
||||
case PCI_CHIP_RV280_Y_:
|
||||
case PCI_CHIP_RV280_Ya:
|
||||
case PCI_CHIP_RV280_Yb:
|
||||
case PCI_CHIP_RV280_Yc:
|
||||
info->ChipFamily = CHIP_FAMILY_RV280;
|
||||
break;
|
||||
|
||||
case PCI_CHIP_R300_ND:
|
||||
case PCI_CHIP_R300_NE:
|
||||
case PCI_CHIP_R300_NF:
|
||||
case PCI_CHIP_R300_NG:
|
||||
info->ChipFamily = CHIP_FAMILY_R300;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Original Radeon/7200 */
|
||||
info->ChipFamily = CHIP_FAMILY_RADEON;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Initialize the framebuffer device mode
|
||||
*
|
||||
* \param disp display handle.
|
||||
*
|
||||
* \return one on success, or zero on failure.
|
||||
*
|
||||
* Fills in \p info with some default values and some information from \p disp
|
||||
* and then calls RADEONScreenInit() for the screen initialization.
|
||||
*
|
||||
* Before exiting clears the framebuffer memory accessing it directly.
|
||||
*/
|
||||
static int radeonInitFBDev( driDisplay *disp, RADEONDRIPtr pRADEONDRI )
|
||||
{
|
||||
int err;
|
||||
RADEONInfoPtr info = calloc(1, sizeof(*info));
|
||||
|
||||
disp->driverPrivate = (void *)info;
|
||||
|
||||
info->gartFastWrite = RADEON_DEFAULT_AGP_FAST_WRITE;
|
||||
info->gartSize = RADEON_DEFAULT_AGP_SIZE;
|
||||
info->gartTexSize = RADEON_DEFAULT_AGP_TEX_SIZE;
|
||||
info->bufSize = RADEON_DEFAULT_BUFFER_SIZE;
|
||||
info->ringSize = RADEON_DEFAULT_RING_SIZE;
|
||||
info->page_flip_enable = RADEON_DEFAULT_PAGE_FLIP;
|
||||
|
||||
info->Chipset = disp->chipset;
|
||||
|
||||
if (!get_chipfamily_from_chipset( info )) {
|
||||
fprintf(stderr, "Unknown or non-radeon chipset -- cannot continue\n");
|
||||
fprintf(stderr, "==> Verify PCI BusID is correct in miniglx.conf\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
info->frontPitch = disp->virtualWidth;
|
||||
|
||||
if (!RADEONScreenInit( disp, info, pRADEONDRI))
|
||||
return 0;
|
||||
|
||||
/* Initialize and start the CP if required */
|
||||
if ((err = drmCommandNone(disp->drmFD, DRM_RADEON_CP_START)) != 0) {
|
||||
fprintf(stderr, "%s: CP start %d\n", __FUNCTION__, err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
radeonFillInConfigs(_EGLDisplay *disp, unsigned pixel_bits, unsigned depth_bits,
|
||||
unsigned stencil_bits, GLboolean have_back_buffer) {
|
||||
_EGLConfig *configs;
|
||||
_EGLConfig *c;
|
||||
unsigned int i, num_configs;
|
||||
unsigned int depth_buffer_factor;
|
||||
unsigned int back_buffer_factor;
|
||||
GLenum fb_format;
|
||||
GLenum fb_type;
|
||||
|
||||
/* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy
|
||||
* enough to add support. Basically, if a context is created with an
|
||||
* fbconfig where the swap method is GLX_SWAP_COPY_OML, pageflipping
|
||||
* will never be used.
|
||||
*/
|
||||
static const GLenum back_buffer_modes[] = {
|
||||
GLX_NONE, GLX_SWAP_UNDEFINED_OML /*, GLX_SWAP_COPY_OML */
|
||||
};
|
||||
|
||||
u_int8_t depth_bits_array[2];
|
||||
u_int8_t stencil_bits_array[2];
|
||||
|
||||
depth_bits_array[0] = depth_bits;
|
||||
depth_bits_array[1] = depth_bits;
|
||||
|
||||
/* Just like with the accumulation buffer, always provide some modes
|
||||
* with a stencil buffer. It will be a sw fallback, but some apps won't
|
||||
* care about that.
|
||||
*/
|
||||
stencil_bits_array[0] = 0;
|
||||
stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;
|
||||
|
||||
depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
|
||||
back_buffer_factor = (have_back_buffer) ? 2 : 1;
|
||||
|
||||
num_configs = depth_buffer_factor * back_buffer_factor * 2;
|
||||
|
||||
if (pixel_bits == 16) {
|
||||
fb_format = GL_RGB;
|
||||
fb_type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
} else {
|
||||
fb_format = GL_RGBA;
|
||||
fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
}
|
||||
|
||||
configs = calloc(sizeof(*configs), num_configs);
|
||||
c = configs;
|
||||
if (!_eglFillInConfigs(c, fb_format, fb_type,
|
||||
depth_bits_array, stencil_bits_array, depth_buffer_factor,
|
||||
back_buffer_modes, back_buffer_factor,
|
||||
GLX_TRUE_COLOR)) {
|
||||
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n",
|
||||
__func__, __LINE__);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
/* Mark the visual as slow if there are "fake" stencil bits.
|
||||
*/
|
||||
for (i = 0, c = configs; i < num_configs; i++, c++) {
|
||||
int stencil = GET_CONFIG_ATTRIB(c, EGL_STENCIL_SIZE);
|
||||
if ((stencil != 0) && (stencil != stencil_bits)) {
|
||||
SET_CONFIG_ATTRIB(c, EGL_CONFIG_CAVEAT, EGL_SLOW_CONFIG);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0, c = configs; i < num_configs; i++, c++)
|
||||
_eglAddConfig(disp, c);
|
||||
|
||||
free(configs);
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the given surface on the named screen.
|
||||
* If surface is EGL_NO_SURFACE, disable the screen's output.
|
||||
*/
|
||||
static EGLBoolean
|
||||
radeonShowSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
|
||||
EGLSurface surface, EGLModeMESA m)
|
||||
{
|
||||
_eglDRIShowSurfaceMESA(drv, dpy, screen, surface, m);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
radeonInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
|
||||
{
|
||||
__DRIframebuffer framebuffer;
|
||||
driDisplay *display;
|
||||
|
||||
if (!_eglDRIInitialize(drv, dpy, major, minor))
|
||||
return EGL_FALSE;
|
||||
|
||||
display = Lookup_driDisplay(dpy);
|
||||
|
||||
framebuffer.dev_priv_size = sizeof(RADEONDRIRec);
|
||||
framebuffer.dev_priv = malloc(sizeof(RADEONDRIRec));
|
||||
|
||||
display->virtualWidth = 1024;
|
||||
display->virtualHeight = 768;
|
||||
display->bpp = 32;
|
||||
display->cpp = 4;
|
||||
|
||||
if (!_eglDRIGetDisplayInfo(display))
|
||||
return EGL_FALSE;
|
||||
|
||||
framebuffer.base = display->pFB;
|
||||
radeonInitFBDev( display, framebuffer.dev_priv );
|
||||
|
||||
if (!_eglDRICreateDisplay(display, &framebuffer))
|
||||
return EGL_FALSE;
|
||||
|
||||
if (!_eglDRICreateScreen(display))
|
||||
return EGL_FALSE;
|
||||
|
||||
radeonFillInConfigs(&display->Base, 32, 24, 8, 1);
|
||||
radeonFillInConfigs(&display->Base, 16, 16, 0, 1);
|
||||
|
||||
drv->Initialized = EGL_TRUE;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The bootstrap function. Return a new radeonDriver object and
|
||||
* plug in API functions.
|
||||
*/
|
||||
_EGLDriver *
|
||||
_eglMain(_EGLDisplay *dpy)
|
||||
{
|
||||
radeonDriver *radeon;
|
||||
|
||||
radeon = (radeonDriver *) calloc(1, sizeof(*radeon));
|
||||
if (!radeon) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* First fill in the dispatch table with defaults */
|
||||
_eglDRIInitDriverFallbacks(&radeon->Base);
|
||||
|
||||
/* then plug in our radeon-specific functions */
|
||||
radeon->Base.Initialize = radeonInitialize;
|
||||
radeon->Base.ShowSurfaceMESA = radeonShowSurfaceMESA;
|
||||
|
||||
return &radeon->Base;
|
||||
}
|
@@ -1065,6 +1065,20 @@
|
||||
# define RADEON_NONSURF_AP0_SWP_16BPP (1 << 20)
|
||||
# define RADEON_NONSURF_AP0_SWP_32BPP (1 << 21)
|
||||
#define RADEON_SURFACE0_INFO 0x0b0c
|
||||
# define RADEON_SURF_TILE_COLOR_MACRO (0 << 16)
|
||||
# define RADEON_SURF_TILE_COLOR_BOTH (1 << 16)
|
||||
# define RADEON_SURF_TILE_DEPTH_32BPP (2 << 16)
|
||||
# define RADEON_SURF_TILE_DEPTH_16BPP (3 << 16)
|
||||
# define R200_SURF_TILE_NONE (0 << 16)
|
||||
# define R200_SURF_TILE_COLOR_MACRO (1 << 16)
|
||||
# define R200_SURF_TILE_COLOR_MICRO (2 << 16)
|
||||
# define R200_SURF_TILE_COLOR_BOTH (3 << 16)
|
||||
# define R200_SURF_TILE_DEPTH_32BPP (4 << 16)
|
||||
# define R200_SURF_TILE_DEPTH_16BPP (5 << 16)
|
||||
# define RADEON_SURF_AP0_SWP_16BPP (1 << 20)
|
||||
# define RADEON_SURF_AP0_SWP_32BPP (1 << 21)
|
||||
# define RADEON_SURF_AP1_SWP_16BPP (1 << 22)
|
||||
# define RADEON_SURF_AP1_SWP_32BPP (1 << 23)
|
||||
#define RADEON_SURFACE0_LOWER_BOUND 0x0b04
|
||||
#define RADEON_SURFACE0_UPPER_BOUND 0x0b08
|
||||
#define RADEON_SURFACE1_INFO 0x0b1c
|
||||
|
@@ -17,6 +17,11 @@ s3vScreenPtr s3vCreateScreen( __DRIscreenPrivate *sPriv )
|
||||
DEBUG(("sPriv->pDevPriv at %p\n", sPriv->pDevPriv));
|
||||
DEBUG(("size = %i\n", sizeof(*vDRIPriv)));
|
||||
|
||||
if (sPriv->devPrivSize != sizeof(S3VDRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(S3VDRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Allocate the private area */
|
||||
s3vScreen = (s3vScreenPtr) CALLOC( sizeof(*s3vScreen) );
|
||||
if ( !s3vScreen ) return NULL;
|
||||
|
@@ -431,43 +431,17 @@ typedef enum
|
||||
* stencil control
|
||||
*/
|
||||
|
||||
typedef ZCmpFunc SCmpFunc;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STC_FAIL_Keep,
|
||||
STC_FAIL_Zero,
|
||||
STC_FAIL_Equal,
|
||||
STC_FAIL_IncClamp,
|
||||
STC_FAIL_DecClamp,
|
||||
STC_FAIL_Invert,
|
||||
STC_FAIL_Inc,
|
||||
STC_FAIL_Dec
|
||||
} StencilFailOp;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STC_ZPASS_Keep,
|
||||
STC_ZPASS_Zero,
|
||||
STC_ZPASS_Equal,
|
||||
STC_ZPASS_IncClamp,
|
||||
STC_ZPASS_DecClamp,
|
||||
STC_ZPASS_Invert,
|
||||
STC_ZPASS_Inc,
|
||||
STC_ZPASS_Dec
|
||||
} StencilZPassOp;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STC_ZFAIL_Keep,
|
||||
STC_ZFAIL_Zero,
|
||||
STC_ZFAIL_Equal,
|
||||
STC_ZFAIL_IncClamp,
|
||||
STC_ZFAIL_DecClamp,
|
||||
STC_ZFAIL_Invert,
|
||||
STC_ZFAIL_Inc,
|
||||
STC_ZFAIL_Dec
|
||||
} StencilZFailOp;
|
||||
STENCIL_Keep,
|
||||
STENCIL_Zero,
|
||||
STENCIL_Equal,
|
||||
STENCIL_IncClamp,
|
||||
STENCIL_DecClamp,
|
||||
STENCIL_Invert,
|
||||
STENCIL_Inc,
|
||||
STENCIL_Dec
|
||||
} StencilOp;
|
||||
|
||||
/***************************************************************
|
||||
*** Bitfield Structures for Programming Interface **************
|
||||
|
@@ -133,6 +133,7 @@ static const struct dri_extension card_extensions[] =
|
||||
{ "GL_ARB_multisample", GL_ARB_multisample_functions },
|
||||
{ "GL_ARB_multitexture", NULL },
|
||||
{ "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
|
||||
{ "GL_EXT_stencil_wrap", NULL },
|
||||
{ "GL_EXT_texture_lod_bias", NULL },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
@@ -169,6 +170,11 @@ savageInitDriver(__DRIscreenPrivate *sPriv)
|
||||
savageScreenPrivate *savageScreen;
|
||||
SAVAGEDRIPtr gDRIPriv = (SAVAGEDRIPtr)sPriv->pDevPriv;
|
||||
|
||||
if (sPriv->devPrivSize != sizeof(SAVAGEDRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(SAVAGEDRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Allocate the private area */
|
||||
savageScreen = (savageScreenPrivate *)Xmalloc(sizeof(savageScreenPrivate));
|
||||
if (!savageScreen)
|
||||
|
@@ -1001,9 +1001,9 @@ static void savageDDStencilFunc(GLcontext *ctx, GLenum func, GLint ref,
|
||||
GLuint mask)
|
||||
{
|
||||
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
|
||||
SCmpFunc a=0;
|
||||
u_int32_t zBufCtrl = imesa->regs.s4.zBufCtrl.ui;
|
||||
u_int32_t stencilCtrl = imesa->regs.s4.stencilCtrl.ui;
|
||||
unsigned a=0;
|
||||
const u_int32_t zBufCtrl = imesa->regs.s4.zBufCtrl.ui;
|
||||
const u_int32_t stencilCtrl = imesa->regs.s4.stencilCtrl.ui;
|
||||
|
||||
imesa->regs.s4.zBufCtrl.ni.stencilRefVal = ctx->Stencil.Ref[0];
|
||||
imesa->regs.s4.stencilCtrl.ni.readMask = ctx->Stencil.ValueMask[0];
|
||||
@@ -1039,96 +1039,33 @@ static void savageDDStencilMask(GLcontext *ctx, GLuint mask)
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned get_stencil_op_value( GLenum op )
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case GL_KEEP: return STENCIL_Keep;
|
||||
case GL_ZERO: return STENCIL_Zero;
|
||||
case GL_REPLACE: return STENCIL_Equal;
|
||||
case GL_INCR: return STENCIL_IncClamp;
|
||||
case GL_DECR: return STENCIL_DecClamp;
|
||||
case GL_INVERT: return STENCIL_Invert;
|
||||
case GL_INCR_WRAP: return STENCIL_Inc;
|
||||
case GL_DECR_WRAP: return STENCIL_Dec;
|
||||
}
|
||||
|
||||
/* Should *never* get here. */
|
||||
return STENCIL_Keep;
|
||||
}
|
||||
|
||||
static void savageDDStencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
|
||||
GLenum zpass)
|
||||
{
|
||||
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
|
||||
u_int32_t stencilCtrl = imesa->regs.s4.stencilCtrl.ui;
|
||||
const u_int32_t stencilCtrl = imesa->regs.s4.stencilCtrl.ui;
|
||||
|
||||
switch (ctx->Stencil.FailFunc[0])
|
||||
{
|
||||
case GL_KEEP:
|
||||
imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Keep;
|
||||
break;
|
||||
case GL_ZERO:
|
||||
imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Zero;
|
||||
break;
|
||||
case GL_REPLACE:
|
||||
imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Equal;
|
||||
break;
|
||||
case GL_INCR:
|
||||
imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_IncClamp;
|
||||
break;
|
||||
case GL_DECR:
|
||||
imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_DecClamp;
|
||||
break;
|
||||
case GL_INVERT:
|
||||
imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Invert;
|
||||
break;
|
||||
case GL_INCR_WRAP_EXT:
|
||||
imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Inc;
|
||||
break;
|
||||
case GL_DECR_WRAP_EXT:
|
||||
imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Dec;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
switch (ctx->Stencil.ZFailFunc[0])
|
||||
{
|
||||
case GL_KEEP:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Keep;
|
||||
break;
|
||||
case GL_ZERO:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Zero;
|
||||
break;
|
||||
case GL_REPLACE:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Equal;
|
||||
break;
|
||||
case GL_INCR:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_IncClamp;
|
||||
break;
|
||||
case GL_DECR:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_DecClamp;
|
||||
break;
|
||||
case GL_INVERT:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Invert;
|
||||
break;
|
||||
case GL_INCR_WRAP_EXT:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Inc;
|
||||
break;
|
||||
case GL_DECR_WRAP_EXT:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Dec;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (ctx->Stencil.ZPassFunc[0])
|
||||
{
|
||||
case GL_KEEP:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Keep;
|
||||
break;
|
||||
case GL_ZERO:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Zero;
|
||||
break;
|
||||
case GL_REPLACE:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Equal;
|
||||
break;
|
||||
case GL_INCR:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_IncClamp;
|
||||
break;
|
||||
case GL_DECR:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_DecClamp;
|
||||
break;
|
||||
case GL_INVERT:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Invert;
|
||||
break;
|
||||
case GL_INCR_WRAP_EXT:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Inc;
|
||||
break;
|
||||
case GL_DECR_WRAP_EXT:
|
||||
imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Dec;
|
||||
break;
|
||||
}
|
||||
imesa->regs.s4.stencilCtrl.ni.failOp = get_stencil_op_value( ctx->Stencil.FailFunc[0] );
|
||||
imesa->regs.s4.stencilCtrl.ni.passZfailOp = get_stencil_op_value( ctx->Stencil.ZFailFunc[0] );
|
||||
imesa->regs.s4.stencilCtrl.ni.passZpassOp = get_stencil_op_value( ctx->Stencil.ZPassFunc[0] );
|
||||
|
||||
if (stencilCtrl != imesa->regs.s4.stencilCtrl.ui)
|
||||
imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
|
||||
@@ -1586,9 +1523,9 @@ static void savageDDInitState_s4( savageContextPtr imesa )
|
||||
|
||||
imesa->regs.s4.stencilCtrl.ni.stencilEn = GL_FALSE;
|
||||
imesa->regs.s4.stencilCtrl.ni.cmpFunc = CF_Always;
|
||||
imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Keep;
|
||||
imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Keep;
|
||||
imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Keep;
|
||||
imesa->regs.s4.stencilCtrl.ni.failOp = STENCIL_Keep;
|
||||
imesa->regs.s4.stencilCtrl.ni.passZfailOp = STENCIL_Keep;
|
||||
imesa->regs.s4.stencilCtrl.ni.passZpassOp = STENCIL_Keep;
|
||||
imesa->regs.s4.stencilCtrl.ni.writeMask = 0xff;
|
||||
imesa->regs.s4.stencilCtrl.ni.readMask = 0xff;
|
||||
|
||||
|
@@ -38,7 +38,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
drm_handle_t handle;
|
||||
drmSize size;
|
||||
drmAddress map;
|
||||
} sisRegion, *sisRegionPtr;
|
||||
|
||||
typedef struct {
|
||||
|
@@ -129,6 +129,10 @@ sisCreateScreen( __DRIscreenPrivate *sPriv )
|
||||
sisScreenPtr sisScreen;
|
||||
SISDRIPtr sisDRIPriv = (SISDRIPtr)sPriv->pDevPriv;
|
||||
|
||||
if (sPriv->devPrivSize != sizeof(SISDRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(SISDRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Allocate the private area */
|
||||
sisScreen = (sisScreenPtr)CALLOC( sizeof(*sisScreen) );
|
||||
@@ -427,7 +431,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn,
|
||||
|
||||
{
|
||||
__DRIscreenPrivate *psp;
|
||||
static const __DRIversion ddx_expected = {0, 1, 0};
|
||||
static const __DRIversion ddx_expected = {0, 8, 0};
|
||||
static const __DRIversion dri_expected = {4, 0, 0};
|
||||
static const __DRIversion drm_expected = {1, 0, 0};
|
||||
|
||||
|
@@ -9,7 +9,6 @@
|
||||
typedef struct {
|
||||
drm_handle_t regs;
|
||||
drmSize regsSize;
|
||||
drmAddress regsMap;
|
||||
int deviceID;
|
||||
int width;
|
||||
int height;
|
||||
|
@@ -74,6 +74,11 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv )
|
||||
tdfxScreenPrivate *fxScreen;
|
||||
TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv;
|
||||
|
||||
if (sPriv->devPrivSize != sizeof(TDFXDRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(TDFXDRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Allocate the private area */
|
||||
fxScreen = (tdfxScreenPrivate *) CALLOC( sizeof(tdfxScreenPrivate) );
|
||||
if ( !fxScreen )
|
||||
@@ -441,7 +446,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
|
||||
__GLcontextModes ** driver_modes )
|
||||
{
|
||||
__DRIscreenPrivate *psp;
|
||||
static const __DRIversion ddx_expected = { 1, 0, 0 };
|
||||
static const __DRIversion ddx_expected = { 1, 1, 0 };
|
||||
static const __DRIversion dri_expected = { 4, 0, 0 };
|
||||
static const __DRIversion drm_expected = { 1, 0, 0 };
|
||||
|
||||
|
@@ -358,6 +358,10 @@ tridentScreenPtr tridentCreateScreen( __DRIscreenPrivate *sPriv )
|
||||
TRIDENTDRIPtr tDRIPriv = (TRIDENTDRIPtr)sPriv->pDevPriv;
|
||||
tridentScreenPtr tridentScreen;
|
||||
|
||||
if (sPriv->devPrivSize != sizeof(TRIDENTDRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(TRIDENTDRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Allocate the private area */
|
||||
tridentScreen = (tridentScreenPtr) CALLOC( sizeof(*tridentScreen) );
|
||||
|
@@ -101,12 +101,11 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
|
||||
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
|
||||
void * const psc = sPriv->psc->screenConfigs;
|
||||
|
||||
|
||||
if ( glx_enable_extension == NULL ) {
|
||||
return GL_FALSE;
|
||||
if (sPriv->devPrivSize != sizeof(VIADRIRec)) {
|
||||
fprintf(stderr,"\nERROR! sizeof(VIADRIRec) does not match passed size from device driver\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Allocate the private area */
|
||||
viaScreen = (viaScreenPrivate *) CALLOC(sizeof(viaScreenPrivate));
|
||||
if (!viaScreen) {
|
||||
@@ -175,13 +174,15 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
|
||||
|
||||
viaScreen->sareaPrivOffset = gDRIPriv->sarea_priv_offset;
|
||||
|
||||
if ( viaScreen->irqEnabled ) {
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
|
||||
}
|
||||
if ( glx_enable_extension != NULL ) {
|
||||
if ( viaScreen->irqEnabled ) {
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
|
||||
}
|
||||
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user