Merge commit 'origin/master' into drm-gem

Conflicts:

	src/mesa/drivers/dri/common/dri_bufmgr.h
	src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c
	src/mesa/drivers/dri/intel/intel_bufmgr_ttm.h
	src/mesa/drivers/dri/intel/intel_ioctl.c
This commit is contained in:
Keith Packard 2008-06-03 22:56:25 -07:00
commit dbf3c5247c
182 changed files with 9360 additions and 20359 deletions

1
.gitignore vendored
View file

@ -13,3 +13,4 @@ autom4te.cache
aclocal.m4
config.log
config.status
cscope*

View file

@ -14,27 +14,25 @@ default: $(TOP)/configs/current
doxygen:
(cd doxygen ; make) ; \
cd doxygen && $(MAKE)
clean:
@for dir in $(SUBDIRS) ; do \
-@touch $(TOP)/configs/current
-@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) clean) ; \
fi \
done
-@test -s $(TOP)/configs/current || rm -f $(TOP)/configs/current
realclean:
touch $(TOP)/configs/current
$(MAKE) clean
realclean: clean
-rm -rf lib*
-rm -f $(TOP)/configs/current
-rm -f $(TOP)/configs/autoconf
-rm -rf autom4te.cache
-rm -f `find . -name \*.o`
-rm -f `find . -name \*.a`
-rm -f `find . -name \*.so`
-rm -f `find . -name depend`
-find . '(' -name '*.o' -o -name '*.a' -o -name '*.so' -o \
-name depend -o -name depend.bak ')' -exec rm -f '{}' ';'
@ -50,21 +48,20 @@ install:
linux-directfb-install:
cd src/mesa/drivers/directfb && $(MAKE) install
# Xserver GLcore module
glcore:
cd src/mesa/drivers/xorg ; $(MAKE)
glcore-install:
cd src/mesa/drivers/xorg ; $(MAKE) install
.PHONY: default doxygen clean realclean install linux-directfb-install
# If there's no current configuration file
$(TOP)/configs/current:
@echo
@echo
@echo "Please choose a configuration from the following list:"
@ls -1 $(TOP)/configs | grep -v "current\|default\|CVS"
@ls -1 $(TOP)/configs | grep -v "current\|default\|CVS\|autoconf.*"
@echo
@echo "Then type 'make <config>' (ex: 'make linux-x86')"
@echo
@echo "Or, run './configure' then 'make'"
@echo "See './configure --help' for details"
@echo
@echo "(ignore the following error message)"
@exit 1
@ -177,15 +174,16 @@ ultrix-gcc:
# Rules for making release tarballs
DIRECTORY = Mesa-7.1pre
LIB_NAME = MesaLib-7.1pre
DEMO_NAME = MesaDemos-7.1pre
GLUT_NAME = MesaGLUT-7.1pre
DIRECTORY = Mesa-7.1-rc1
LIB_NAME = MesaLib-7.1-rc1
DEMO_NAME = MesaDemos-7.1-rc1
GLUT_NAME = MesaGLUT-7.1-rc1
MAIN_FILES = \
$(DIRECTORY)/Makefile* \
$(DIRECTORY)/configure \
$(DIRECTORY)/configure.ac \
$(DIRECTORY)/acinclude.m4 \
$(DIRECTORY)/aclocal.m4 \
$(DIRECTORY)/descrip.mms \
$(DIRECTORY)/mms-config. \
@ -450,9 +448,9 @@ ACLOCAL = aclocal
ACLOCAL_FLAGS =
AUTOCONF = autoconf
AC_FLAGS =
aclocal.m4: configure.ac
aclocal.m4: configure.ac acinclude.m4
$(ACLOCAL) $(ACLOCAL_FLAGS)
configure: configure.ac aclocal.m4
configure: configure.ac aclocal.m4 acinclude.m4
$(AUTOCONF) $(AC_FLAGS)
rm_depend:
@ -531,3 +529,6 @@ md5:
@-md5sum $(GLUT_NAME).tar.gz
@-md5sum $(GLUT_NAME).tar.bz2
@-md5sum $(GLUT_NAME).zip
.PHONY: tarballs rm_depend lib_gz demo_gz glut_gz lib_bz2 demo_bz2 \
glut_bz2 lib_zip demo_zip glut_zip md5

119
acinclude.m4 Normal file
View file

@ -0,0 +1,119 @@
# A few convenience macros for Mesa, mostly to keep all the platform
# specifics out of configure.ac.
# MESA_PIC_FLAGS()
#
# Find out whether to build PIC code using the option --enable-pic and
# the configure enable_static/enable_shared settings. If PIC is needed,
# figure out the necessary flags for the platform and compiler.
#
# The platform checks have been shamelessly taken from libtool and
# stripped down to just what's needed for Mesa. See _LT_COMPILER_PIC in
# /usr/share/aclocal/libtool.m4 or
# http://git.savannah.gnu.org/gitweb/?p=libtool.git;a=blob;f=libltdl/m4/libtool.m4;hb=HEAD
#
AC_DEFUN([MESA_PIC_FLAGS],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_ARG_VAR([PIC_FLAGS], [compiler flags for PIC code])
AC_ARG_ENABLE([pic],
[AS_HELP_STRING([--disable-pic],
[compile PIC objects @<:@default=enabled for shared builds
on supported platforms@:>@])],
[enable_pic="$enableval"
test "x$enable_pic" = x && enable_pic=auto],
[enable_pic=auto])
# disable PIC by default for static builds
if test "$enable_pic" = auto && test "$enable_static" = yes; then
enable_pic=no
fi
# if PIC hasn't been explicitly disabled, try to figure out the flags
if test "$enable_pic" != no; then
AC_MSG_CHECKING([for $CC option to produce PIC])
# allow the user's flags to override
if test "x$PIC_FLAGS" = x; then
# see if we're using GCC
if test "x$GCC" = xyes; then
case "$host_os" in
aix*|beos*|cygwin*|irix5*|irix6*|osf3*|osf4*|osf5*)
# PIC is the default for these OSes.
;;
mingw*|os2*|pw32*)
# This hack is so that the source file can tell whether
# it is being built for inclusion in a dll (and should
# export symbols for example).
PIC_FLAGS="-DDLL_EXPORT"
;;
darwin*|rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
PIC_FLAGS="-fno-common"
;;
hpux*)
# PIC is the default for IA64 HP-UX and 64-bit HP-UX,
# but not for PA HP-UX.
case $host_cpu in
hppa*64*|ia64*)
;;
*)
PIC_FLAGS="-fPIC"
;;
esac
;;
*)
# Everyone else on GCC uses -fPIC
PIC_FLAGS="-fPIC"
;;
esac
else # !GCC
case "$host_os" in
hpux9*|hpux10*|hpux11*)
# PIC is the default for IA64 HP-UX and 64-bit HP-UX,
# but not for PA HP-UX.
case "$host_cpu" in
hppa*64*|ia64*)
# +Z the default
;;
*)
PIC_FLAGS="+Z"
;;
esac
;;
linux*|k*bsd*-gnu)
case `basename "$CC"` in
icc*|ecc*|ifort*)
PIC_FLAGS="-KPIC"
;;
pgcc*|pgf77*|pgf90*|pgf95*)
# Portland Group compilers (*not* the Pentium gcc
# compiler, which looks to be a dead project)
PIC_FLAGS="-fpic"
;;
ccc*)
# All Alpha code is PIC.
;;
xl*)
# IBM XL C 8.0/Fortran 10.1 on PPC
PIC_FLAGS="-qpic"
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*|*Sun\ F*)
# Sun C 5.9 or Sun Fortran
PIC_FLAGS="-KPIC"
;;
esac
esac
;;
solaris*)
PIC_FLAGS="-KPIC"
;;
sunos4*)
PIC_FLAGS="-PIC"
;;
esac
fi # GCC
fi # PIC_FLAGS
AC_MSG_RESULT([$PIC_FLAGS])
fi
AC_SUBST([PIC_FLAGS])
])# MESA_PIC_FLAGS

17
bin/version.mk Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/make -sf
# Print the various Mesa version fields. This is mostly used to add the
# version to configure.
# This reflects that this script is usually called from the toplevel
TOP = .
include $(TOP)/configs/default
version:
@echo $(MESA_VERSION)
major:
@echo $(MESA_MAJOR)
minor:
@echo $(MESA_MINOR)
tiny:
@echo $(MESA_TINY)

View file

@ -78,9 +78,6 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \
$(EXTRA_LIB_PATH) @GLW_LIB_DEPS@
APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@
# GLcore dependencies
GLCORE_LIB_DEPS = $(EXTRA_LIB_PATH) @GLCORE_LIB_DEPS@
# DRI dependencies
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
LIBDRM_CFLAGS = @LIBDRM_CFLAGS@

View file

@ -11,6 +11,7 @@ CONFIG_NAME = default
MESA_MAJOR=7
MESA_MINOR=1
MESA_TINY=0
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
# external projects. This should be useless now that we use libdrm.
DRM_SOURCE_PATH=$(TOP)/../drm
@ -81,10 +82,9 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lXt -lX11
APP_LIB_DEPS = -lm
# Installation directories (for make install)
INSTALL_DIR = /usr/local
DRI_DRIVER_INSTALL_DIR = /usr/X11R6/lib/modules/dri
DRI_DRIVER_INSTALL_DIR = $(INSTALL_DIR)/$(LIB_DIR)/dri
# Where libGL will look for DRI hardware drivers
DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)

View file

@ -34,7 +34,6 @@ LIBDRM_LIB = `pkg-config --libs libdrm`
DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB)
GL_LIB_DEPS = -L/usr/local/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-lm -pthread $(LIBDRM_LIB)
GLCORE_LIB_DEPS = -lm -pthread
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt -lX11

View file

@ -48,7 +48,6 @@ LIBDRM_LIB = `pkg-config --libs libdrm`
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-lm -lpthread -ldl $(LIBDRM_LIB)
GLCORE_LIB_DEPS = -lm -lpthread -ldl
# This is now 0 by default since it seems to confuse the hell out of people

View file

@ -1,23 +1,33 @@
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.59)
AC_PREREQ([2.59])
dnl Versioning
dnl Make version number available to autoconf and configure
m4_define([mesa_version],[7.1.0])
dnl Versioning - scrape the version from configs/default
m4_define([mesa_version],
[m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n'])])
m4_ifval(mesa_version,[],[
m4_errprint([Error: Failed to get the Mesa version from the output of
running `make -f bin/version.mk version'
])
m4_exit([1])
])
AC_INIT([Mesa],[mesa_version()],
AC_INIT([Mesa],[mesa_version],
[https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
AC_CONFIG_AUX_DIR(bin)
AC_CONFIG_AUX_DIR([bin])
AC_CANONICAL_HOST
dnl Versions for external dependencies
LIBDRM_REQUIRED=2.3.1
DRI2PROTO_REQUIRED=1.1
dnl Check for progs
AC_PROG_CPP
AC_PROG_CC
AC_PROG_CXX
AC_CHECK_PROGS(MAKE, [gmake make])
AC_PATH_PROG(MKDEP, makedepend)
AC_PATH_PROG(SED, sed)
AC_CHECK_PROGS([MAKE], [gmake make])
AC_PATH_PROG([MKDEP], [makedepend])
AC_PATH_PROG([SED], [sed])
MKDEP_OPTIONS=-fdepend
dnl Ask gcc where it's keeping its secret headers
@ -27,15 +37,15 @@ if test "x$GCC" = xyes; then
MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
fi
fi
AC_SUBST(MKDEP_OPTIONS)
AC_SUBST([MKDEP_OPTIONS])
dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [],
AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
[AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
dnl Make sure the pkg-config macros are defined
m4_ifdef([PKG_PROG_PKG_CONFIG],,[
m4_ifdef([PKG_PROG_PKG_CONFIG],[],[
m4_errprint([Error: Could not locate the pkg-config autoconf macros.
These are usually located in /usr/share/aclocal/pkg.m4. If your
macros are in a different location, try setting the environment
@ -48,21 +58,21 @@ PKG_PROG_PKG_CONFIG()
dnl LIB_DIR - library basename
LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
AC_SUBST(LIB_DIR)
AC_SUBST([LIB_DIR])
dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
_SAVE_LDFLAGS="$LDFLAGS"
AC_ARG_VAR(EXTRA_LIB_PATH,[Extra -L paths for the linker])
AC_SUBST(EXTRA_LIB_PATH)
AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
AC_SUBST([EXTRA_LIB_PATH])
dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
_SAVE_CPPFLAGS="$CPPFLAGS"
AC_ARG_VAR(X11_INCLUDES,[Extra -I paths for X11 headers])
AC_SUBST(X11_INCLUDES)
AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
AC_SUBST([X11_INCLUDES])
dnl Compiler macros
DEFINES=""
AC_SUBST(DEFINES)
AC_SUBST([DEFINES])
case "$host_os" in
linux*)
if test "x$GCC" = xyes; then
@ -87,21 +97,21 @@ if test "x$GXX" = xyes; then
fi
dnl These should be unnecessary, but let the user set them if they want
AC_ARG_VAR(OPT_FLAGS, [Additional optimization flags for the compiler.
AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
Default is to use CFLAGS.])
AC_ARG_VAR(ARCH_FLAGS, [Additional architecture specific flags for the
AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
compiler. Default is to use CFLAGS.])
AC_SUBST(OPT_FLAGS)
AC_SUBST(ARCH_FLAGS)
AC_SUBST([OPT_FLAGS])
AC_SUBST([ARCH_FLAGS])
dnl
dnl Hacks to enable 32 or 64 bit build
dnl
AC_ARG_ENABLE(32-bit,
AC_ARG_ENABLE([32-bit],
[AS_HELP_STRING([--enable-32-bit],
[build 32-bit libraries @<:@default=auto@:>@])],
enable_32bit="$enableval",
enable_32bit=auto
[enable_32bit="$enableval"],
[enable_32bit=auto]
)
if test "x$enable_32bit" = xyes; then
if test "x$GCC" = xyes; then
@ -111,11 +121,11 @@ if test "x$enable_32bit" = xyes; then
CXXFLAGS="$CXXFLAGS -m32"
fi
fi
AC_ARG_ENABLE(64-bit,
AC_ARG_ENABLE([64-bit],
[AS_HELP_STRING([--enable-64-bit],
[build 64-bit libraries @<:@default=auto@:>@])],
enable_64bit="$enableval",
enable_64bit=auto
[enable_64bit="$enableval"],
[enable_64bit=auto]
)
if test "x$enable_64bit" = xyes; then
if test "x$GCC" = xyes; then
@ -129,11 +139,11 @@ fi
dnl
dnl shared/static libraries, mimic libtool options
dnl
AC_ARG_ENABLE(static,
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static],
[build static libraries @<:@default=disabled@:>@])],
enable_static="$enableval",
enable_static=no
[enable_static="$enableval"],
[enable_static=no]
)
case "x$enable_static" in
xyes|xno ) ;;
@ -142,11 +152,11 @@ x ) enable_static=no ;;
AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
;;
esac
AC_ARG_ENABLE(shared,
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--disable-shared],
[build shared libraries @<:@default=enabled@:>@])],
enable_shared="$enableval",
enable_shared=yes
[enable_shared="$enableval"],
[enable_shared=yes]
)
case "x$enable_shared" in
xyes|xno ) ;;
@ -173,20 +183,20 @@ esac
dnl
dnl mklib options
dnl
AC_ARG_VAR(MKLIB_OPTIONS,[Options for the Mesa library script, mklib])
AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
if test "$enable_static" = yes; then
MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
fi
AC_SUBST(MKLIB_OPTIONS)
AC_SUBST([MKLIB_OPTIONS])
dnl
dnl other compiler options
dnl
AC_ARG_ENABLE(debug,
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[use debug compiler flags and macros @<:@default=disabled@:>@])],
enable_debug="$enableval",
enable_debug=no
[enable_debug="$enableval"],
[enable_debug=no]
)
if test "x$enable_debug" = xyes; then
DEFINES="$DEFINES -DDEBUG"
@ -197,13 +207,6 @@ if test "x$enable_debug" = xyes; then
CXXFLAGS="$CXXFLAGS -g"
fi
fi
dnl These will be used near the end in the arch specific options
AC_ARG_ENABLE(asm,
[AS_HELP_STRING([--disable-asm],
[disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
enable_asm="$enableval",
enable_asm=yes
)
dnl
dnl library names
@ -221,11 +224,11 @@ else
GLW_LIB_NAME='lib$(GLW_LIB).so'
OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
fi
AC_SUBST(GL_LIB_NAME)
AC_SUBST(GLU_LIB_NAME)
AC_SUBST(GLUT_LIB_NAME)
AC_SUBST(GLW_LIB_NAME)
AC_SUBST(OSMESA_LIB_NAME)
AC_SUBST([GL_LIB_NAME])
AC_SUBST([GLU_LIB_NAME])
AC_SUBST([GLUT_LIB_NAME])
AC_SUBST([GLW_LIB_NAME])
AC_SUBST([OSMESA_LIB_NAME])
dnl
dnl Driver configuration. Options are xlib, dri and osmesa right now.
@ -246,11 +249,11 @@ freebsd* | dragonfly*)
;;
esac
AC_ARG_WITH(driver,
AC_ARG_WITH([driver],
[AS_HELP_STRING([--with-driver=DRIVER],
[driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
mesa_driver="$withval",
mesa_driver="$default_driver")
[mesa_driver="$withval"],
[mesa_driver="$default_driver"])
dnl Check for valid option
case "x$mesa_driver" in
xxlib|xdri|xosmesa)
@ -279,10 +282,10 @@ osmesa)
DRIVER_DIRS="osmesa"
;;
esac
AC_SUBST(SRC_DIRS)
AC_SUBST(GLU_DIRS)
AC_SUBST(DRIVER_DIRS)
AC_SUBST(WINDOW_SYSTEM)
AC_SUBST([SRC_DIRS])
AC_SUBST([GLU_DIRS])
AC_SUBST([DRIVER_DIRS])
AC_SUBST([WINDOW_SYSTEM])
dnl
dnl User supplied program configuration
@ -292,12 +295,12 @@ if test -d "$srcdir/progs/demos"; then
else
default_demos=no
fi
AC_ARG_WITH(demos,
AC_ARG_WITH([demos],
[AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
[optional comma delimited demo directories to build
@<:@default=auto if source available@:>@])],
with_demos="$withval",
with_demos="$default_demos")
[with_demos="$withval"],
[with_demos="$default_demos"])
if test "x$with_demos" = x; then
with_demos=no
fi
@ -324,20 +327,18 @@ yes)
esac
dnl
dnl Find out if X is available. The variables have_x or no_x will be
dnl set and used later in the driver setups
dnl Find out if X is available. The variable have_x is set if libX11 is
dnl to mimic AC_PATH_XTRA.
dnl
if test -n "$PKG_CONFIG"; then
AC_MSG_CHECKING([pkg-config files for X11 are available])
if $PKG_CONFIG --exists x11; then
PKG_CHECK_EXISTS([x11],[
x11_pkgconfig=yes
have_x=yes
AC_MSG_RESULT(yes)
else
],[
x11_pkgconfig=no
no_x=yes
AC_MSG_RESULT(no)
fi
])
AC_MSG_RESULT([$x11_pkgconfig])
else
x11_pkgconfig=no
fi
@ -355,13 +356,29 @@ xlib|dri)
;;
esac
dnl XCB - this is only used for GLX right now
AC_ARG_ENABLE([xcb],
[AS_HELP_STRING([--enable-xcb],
[use XCB for GLX @<:@default=disabled@:>@])],
[enable_xcb="$enableval"],
[enable_xcb=no])
if test "x$enable_xcb" = xyes; then
DEFINES="$DEFINES -DUSE_XCB"
else
enable_xcb=no
fi
# SELinux awareness.
AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux], [Build SELinux-aware Mesa (default: disabled)]), [MESA_SELINUX=$enableval], [MESA_SELINUX=no])
AC_ARG_ENABLE([selinux],
[AS_HELP_STRING([--enable-selinux],
[Build SELinux-aware Mesa (default: disabled)])],
[MESA_SELINUX="$enableval"],
[MESA_SELINUX=no])
if test "x$enable_selinux" = "xyes"; then
AC_CHECK_HEADER(selinux/selinux.h,,
AC_MSG_ERROR([SELinux headers not found]))
AC_CHECK_LIB(selinux,is_selinux_enabled,,
AC_MSG_ERROR([SELinux library not found]))
AC_CHECK_HEADER([selinux/selinux.h],[],
[AC_MSG_ERROR([SELinux headers not found])])
AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
[AC_MSG_ERROR([SELinux library not found])])
SELINUX_LIBS="-lselinux"
DEFINES="$DEFINES -DMESA_SELINUX"
fi
@ -372,7 +389,7 @@ dnl
case "$mesa_driver" in
xlib)
if test "$x11_pkgconfig" = yes; then
PKG_CHECK_MODULES(XLIBGL, x11 xext)
PKG_CHECK_MODULES([XLIBGL], [x11 xext])
X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
GL_LIB_DEPS="$XLIBGL_LIBS"
else
@ -381,7 +398,6 @@ xlib)
GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
fi
GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
GLCORE_LIB_DEPS=""
# if static, move the external libraries to the programs
# and empty the libraries for libGL
@ -397,32 +413,42 @@ dri)
fi
# Check for libdrm
PKG_CHECK_MODULES(LIBDRM, libdrm)
PKG_CHECK_MODULES(DRI2PROTO, dri2proto >= 1.1)
PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
# find the DRI deps for libGL
if test "$x11_pkgconfig" = yes; then
PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes)
# add xcb modules if necessary
dri_modules="x11 xext xxf86vm xdamage xfixes"
if test "$enable_xcb" = yes; then
dri_modules="$dri_modules x11-xcb xcb-glx"
fi
PKG_CHECK_MODULES([DRIGL], [$dri_modules])
X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
GL_LIB_DEPS="$DRIGL_LIBS"
else
# should check these...
X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
# XCB can only be used from pkg-config
if test "$enable_xcb" = yes; then
PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
fi
fi
# need DRM libs, -lpthread, etc.
GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
GLCORE_LIB_DEPS="-lm -lpthread $DLOPEN_LIBS"
;;
osmesa)
# No libGL for osmesa
GL_LIB_DEPS=""
GLCORE_LIB_DEPS=""
;;
esac
AC_SUBST(GL_LIB_DEPS)
AC_SUBST(GLCORE_LIB_DEPS)
AC_SUBST([GL_LIB_DEPS])
dnl
dnl More X11 setup
@ -434,31 +460,44 @@ fi
dnl
dnl More DRI setup
dnl
AC_ARG_ENABLE(glx-tls,
AC_ARG_ENABLE([glx-tls],
[AS_HELP_STRING([--enable-glx-tls],
[enable TLS support in GLX @<:@default=disabled@:>@])],
GLX_USE_TLS="$enableval",
GLX_USE_TLS=no)
[GLX_USE_TLS="$enableval"],
[GLX_USE_TLS=no])
dnl Directory for DRI drivers
AC_ARG_WITH(dri-driverdir,
AC_ARG_WITH([dri-driverdir],
[AS_HELP_STRING([--with-dri-driverdir=DIR],
[directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
DRI_DRIVER_INSTALL_DIR="$withval",
DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
AC_SUBST(DRI_DRIVER_INSTALL_DIR)
[directory for the DRI drivers @<:@${libdir}/dri@:>@])],
[DRI_DRIVER_INSTALL_DIR="$withval"],
[DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
AC_SUBST([DRI_DRIVER_INSTALL_DIR])
dnl Direct rendering or just indirect rendering
AC_ARG_ENABLE(driglx-direct,
AC_ARG_ENABLE([driglx-direct],
[AS_HELP_STRING([--disable-driglx-direct],
[enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
driglx_direct="$enableval",
driglx_direct="yes")
[driglx_direct="$enableval"],
[driglx_direct="yes"])
dnl ttm support
AC_ARG_ENABLE([ttm-api],
[AS_HELP_STRING([--enable-ttm-api],
[enable TTM API users])],
[ttmapi="$enableval"],
[ttmapi="no"])
if test "x$ttmapi" = "xyes"; then
save_CFLAGS=$CFLAGS
CFLAGS=$LIBDRM_CFLAGS
AC_CHECK_HEADERS([xf86mm.h],[],[AC_MSG_ERROR([xf86mm.h required for TTM.])],[#include "stdint.h"\n#include "drm.h"])
CFLAGS=$save_CFLAGS
fi
dnl Which drivers to build - default is chosen by platform
AC_ARG_WITH(dri-drivers,
AC_ARG_WITH([dri-drivers],
[AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
[comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
with_dri_drivers="$withval",
with_dri_drivers=yes)
[with_dri_drivers="$withval"],
[with_dri_drivers=yes])
if test "x$with_dri_drivers" = x; then
with_dri_drivers=no
fi
@ -481,7 +520,7 @@ esac
dnl Just default to no EGL for now
USING_EGL=0
AC_SUBST(USING_EGL)
AC_SUBST([USING_EGL])
dnl Set DRI_DIRS, DEFINES and LIB_DEPS
if test "$mesa_driver" = dri; then
@ -490,6 +529,10 @@ if test "$mesa_driver" = dri; then
DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
fi
if test "x$ttmapi" = xyes; then
DEFINES="$DEFINES -DTTM_API"
fi
if test "x$USING_EGL" = x1; then
PROGRAM_DIRS="egl"
fi
@ -511,14 +554,14 @@ if test "$mesa_driver" = dri; then
# be used.
if test "x$DRI_DIRS" = x; then
DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
savage tdfx unichrome"
savage tdfx unichrome swrast"
fi
;;
powerpc*)
# Build only the drivers for cards that exist on PowerPC.
# At some point MGA will be added, but not yet.
if test "x$DRI_DIRS" = x; then
DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast"
fi
;;
esac
@ -538,7 +581,7 @@ if test "$mesa_driver" = dri; then
# to use the new interface.
if test "x$DRI_DIRS" = x; then
DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
unichrome savage sis"
unichrome savage sis swrast"
fi
;;
esac
@ -546,7 +589,7 @@ if test "$mesa_driver" = dri; then
# default drivers
if test "x$DRI_DIRS" = x; then
DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
savage sis tdfx trident unichrome ffb"
savage sis tdfx trident unichrome ffb swrast"
fi
DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
@ -554,23 +597,24 @@ if test "$mesa_driver" = dri; then
# Check for expat
EXPAT_INCLUDES=""
EXPAT_LIB=-lexpat
AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR],
[expat install directory]),[
AC_ARG_WITH([expat],
[AS_HELP_STRING([--with-expat=DIR],
[expat install directory])],[
EXPAT_INCLUDES="-I$withval/include"
CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
])
AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.]))
AC_CHECK_LIB(expat, XML_ParserCreate,,
AC_MSG_ERROR([Expat required for DRI.]))
AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
AC_CHECK_LIB([expat],[XML_ParserCreate],[],
[AC_MSG_ERROR([Expat required for DRI.])])
# put all the necessary libs together
DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
fi
AC_SUBST(DRI_DIRS)
AC_SUBST(EXPAT_INCLUDES)
AC_SUBST(DRI_LIB_DEPS)
AC_SUBST([DRI_DIRS])
AC_SUBST([EXPAT_INCLUDES])
AC_SUBST([DRI_LIB_DEPS])
dnl
dnl OSMesa configuration
@ -580,11 +624,11 @@ if test "$mesa_driver" = xlib; then
else
default_gl_osmesa=no
fi
AC_ARG_ENABLE(gl-osmesa,
AC_ARG_ENABLE([gl-osmesa],
[AS_HELP_STRING([--enable-gl-osmesa],
[enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
gl_osmesa="$enableval",
gl_osmesa="$default_gl_osmesa")
[gl_osmesa="$enableval"],
[gl_osmesa="$default_gl_osmesa"])
if test "x$gl_osmesa" = xyes; then
if test "$mesa_driver" = osmesa; then
AC_MSG_ERROR([libGL is not available for OSMesa driver])
@ -594,11 +638,11 @@ if test "x$gl_osmesa" = xyes; then
fi
dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
AC_ARG_WITH(osmesa-bits,
AC_ARG_WITH([osmesa-bits],
[AS_HELP_STRING([--with-osmesa-bits=BITS],
[OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
osmesa_bits="$withval",
osmesa_bits=8)
[osmesa_bits="$withval"],
[osmesa_bits=8])
if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
osmesa_bits=8
@ -615,7 +659,7 @@ x16|x32)
AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
;;
esac
AC_SUBST(OSMESA_LIB)
AC_SUBST([OSMESA_LIB])
case "$mesa_driver" in
osmesa)
@ -638,17 +682,17 @@ osmesa)
fi
;;
esac
AC_SUBST(OSMESA_LIB_DEPS)
AC_SUBST(OSMESA_MESA_DEPS)
AC_SUBST([OSMESA_LIB_DEPS])
AC_SUBST([OSMESA_MESA_DEPS])
dnl
dnl GLU configuration
dnl
AC_ARG_ENABLE(glu,
AC_ARG_ENABLE([glu],
[AS_HELP_STRING([--disable-glu],
[enable OpenGL Utility library @<:@default=enabled@:>@])],
enable_glu="$enableval",
enable_glu=yes)
[enable_glu="$enableval"],
[enable_glu=yes])
if test "x$enable_glu" = xyes; then
SRC_DIRS="$SRC_DIRS glu"
@ -681,17 +725,17 @@ if test "x$enable_glu" = xyes; then
;;
esac
fi
AC_SUBST(GLU_LIB_DEPS)
AC_SUBST(GLU_MESA_DEPS)
AC_SUBST([GLU_LIB_DEPS])
AC_SUBST([GLU_MESA_DEPS])
dnl
dnl GLw configuration
dnl
AC_ARG_ENABLE(glw,
AC_ARG_ENABLE([glw],
[AS_HELP_STRING([--disable-glw],
[enable Xt/Motif widget library @<:@default=enabled@:>@])],
enable_glw="$enableval",
enable_glw=yes)
[enable_glw="$enableval"],
[enable_glw=yes])
dnl Don't build GLw on osmesa
if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
@ -700,7 +744,7 @@ fi
if test "x$enable_glw" = xyes; then
SRC_DIRS="$SRC_DIRS glw"
if test "$x11_pkgconfig" = yes; then
PKG_CHECK_MODULES(GLW, x11 xt)
PKG_CHECK_MODULES([GLW],[x11 xt])
GLW_LIB_DEPS="$GLW_LIBS"
else
# should check these...
@ -716,8 +760,8 @@ if test "x$enable_glw" = xyes; then
GLW_MESA_DEPS=""
fi
fi
AC_SUBST(GLW_LIB_DEPS)
AC_SUBST(GLW_MESA_DEPS)
AC_SUBST([GLW_LIB_DEPS])
AC_SUBST([GLW_MESA_DEPS])
dnl
dnl GLUT configuration
@ -727,11 +771,11 @@ if test -f "$srcdir/include/GL/glut.h"; then
else
default_glut=no
fi
AC_ARG_ENABLE(glut,
AC_ARG_ENABLE([glut],
[AS_HELP_STRING([--disable-glut],
[enable GLUT library @<:@default=enabled if source available@:>@])],
enable_glut="$enableval",
enable_glut="$default_glut")
[enable_glut="$enableval"],
[enable_glut="$default_glut"])
dnl Can't build glut if GLU not available
if test "x$enable_glu$enable_glut" = xnoyes; then
@ -751,7 +795,7 @@ if test "x$enable_glut" = xyes; then
GLUT_CFLAGS="-fexceptions"
fi
if test "$x11_pkgconfig" = yes; then
PKG_CHECK_MODULES(GLUT, x11 xmu xi)
PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
GLUT_LIB_DEPS="$GLUT_LIBS"
else
# should check these...
@ -773,9 +817,9 @@ if test "x$enable_glut" = xyes; then
GLUT_MESA_DEPS=""
fi
fi
AC_SUBST(GLUT_LIB_DEPS)
AC_SUBST(GLUT_MESA_DEPS)
AC_SUBST(GLUT_CFLAGS)
AC_SUBST([GLUT_LIB_DEPS])
AC_SUBST([GLUT_MESA_DEPS])
AC_SUBST([GLUT_CFLAGS])
dnl
dnl Program library dependencies
@ -785,65 +829,89 @@ dnl
if test "x$APP_LIB_DEPS" = x; then
APP_LIB_DEPS="-lm"
fi
AC_SUBST(APP_LIB_DEPS)
AC_SUBST(PROGRAM_DIRS)
AC_SUBST([APP_LIB_DEPS])
AC_SUBST([PROGRAM_DIRS])
dnl
dnl Arch/platform-specific settings
PIC_FLAGS=""
dnl
AC_ARG_ENABLE([asm],
[AS_HELP_STRING([--disable-asm],
[disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
[enable_asm="$enableval"],
[enable_asm=yes]
)
asm_arch=""
ASM_FLAGS=""
ASM_SOURCES=""
ASM_API=""
AC_SUBST(PIC_FLAGS)
AC_SUBST(ASM_FLAGS)
AC_SUBST(ASM_SOURCES)
AC_SUBST(ASM_API)
case "$host_os" in
linux*)
PIC_FLAGS="-fPIC"
AC_MSG_CHECKING([whether to enable assembly])
test "x$enable_asm" = xno && AC_MSG_RESULT([no])
# disable if cross compiling on x86/x86_64 since we must run gen_matypes
if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
case "$host_cpu" in
i*86)
if test "x$enable_asm" = xyes; then
ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
ASM_SOURCES='$(X86_SOURCES)'
ASM_API='$(X86_API)'
fi
i?86 | x86_64)
enable_asm=no
AC_MSG_RESULT([no, cross compiling])
;;
esac
fi
# check for supported arches
if test "x$enable_asm" = xyes; then
case "$host_cpu" in
i?86)
case "$host_os" in
linux* | freebsd* | dragonfly*)
test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
;;
esac
;;
x86_64)
if test "x$enable_asm" = xyes; then
ASM_FLAGS="-DUSE_X86_64_ASM"
ASM_SOURCES='$(X86-64_SOURCES)'
ASM_API='$(X86-64_API)'
fi
case "$host_os" in
linux* | freebsd* | dragonfly*)
test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
;;
esac
;;
powerpc)
if test "x$enable_asm" = xyes; then
ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
ASM_SOURCES='$(PPC_SOURCES)'
fi
case "$host_os" in
linux*)
asm_arch=ppc
;;
esac
;;
esac
;;
freebsd* | dragonfly*)
PIC_FLAGS="-fPIC"
case "$host_cpu" in
i*86)
PIC_FLAGS=""
if test "x$enable_asm" = xyes; then
ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
ASM_SOURCES='$(X86_SOURCES)'
ASM_API='$(X86_API)'
fi
case "$asm_arch" in
x86)
ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
ASM_SOURCES='$(X86_SOURCES)'
ASM_API='$(X86_API)'
AC_MSG_RESULT([yes, x86])
;;
x86_64)
if test "x$enable_asm" = xyes; then
ASM_FLAGS="-DUSE_X86_64_ASM"
ASM_SOURCES='$(X86-64_SOURCES)'
ASM_API='$(X86-64_API)'
fi
ASM_FLAGS="-DUSE_X86_64_ASM"
ASM_SOURCES='$(X86-64_SOURCES)'
ASM_API='$(X86-64_API)'
AC_MSG_RESULT([yes, x86_64])
;;
ppc)
ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
ASM_SOURCES='$(PPC_SOURCES)'
AC_MSG_RESULT([yes, ppc])
;;
*)
AC_MSG_RESULT([no, platform not supported])
;;
esac
;;
esac
fi
AC_SUBST([ASM_FLAGS])
AC_SUBST([ASM_SOURCES])
AC_SUBST([ASM_API])
dnl PIC code macro
MESA_PIC_FLAGS
dnl Restore LDFLAGS and CPPFLAGS
LDFLAGS="$_SAVE_LDFLAGS"
@ -851,13 +919,16 @@ CPPFLAGS="$_SAVE_CPPFLAGS"
dnl Substitute the config
AC_CONFIG_FILES([configs/autoconf])
AC_OUTPUT
dnl Replace the configs/current symlink
AC_CONFIG_COMMANDS([configs],[
if test -f configs/current || test -L configs/current; then
rm -f configs/current
fi
ln -s autoconf configs/current
])
AC_OUTPUT
dnl
dnl Output some configuration info for the user
@ -880,6 +951,7 @@ if test "$mesa_driver" = dri; then
dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
echo " DRI drivers: $dri_dirs"
echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
echo " TTM API support: $ttmapi"
fi
dnl Libraries

View file

@ -178,8 +178,7 @@ drivers.
<ul>
<li><code>--with-dri-driverdir=DIR</code> - This option specifies the
location the DRI drivers will be installed to and the location libGL
will search for DRI drivers. The default is
<code>/usr/X11R6/lib/modules/dri</code>.
will search for DRI drivers. The default is <code>${libdir}/dri</code>.
</li>
<li><code>--with-dri-drivers=DRIVER,DRIVER,...</code> - This option
allows a specific set of DRI drivers to be built. For example,

View file

@ -136,11 +136,11 @@ Update the docs/VERSIONS file too.
<p>
Edit the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
configs/default and configure.ac.
configs/default.
</p>
<p>
Make sure the values in src/mesa/main/version.h is correct.
Make sure the values in src/mesa/main/version.h are correct.
</p>
<p>

View file

@ -21,16 +21,53 @@
<a name="unix-x11">
<H2>1. Unix/X11 Compilation and Installation</H1>
<h3>1.1 Compilation</h3>
<h3>1.1 Prerequisites for DRI and Hardware Acceleration</h3>
<p>
Mesa is built by reading Makefile stubs from the configs directory.
There are configurations for many Unix variants and different Mesa
options. Type <b>make</b> from the top-level directory to see a list of
supported system configurations. Alternatively, an autoconf system can
be used to create a Makefile stub for your system. See the <a
href="autoconf.html">autoconf instructions</a> for more details. Mesa
may be compiled in several ways using the predefined configurations:
To build Mesa with DRI-based hardware acceleration you must first have
the right version of DRM.
</p>
<p>
For Mesa 7.1 a particular snapshot of
<a href="http://dri.freedesktop.org/libdrm/">DRM</a> from git is required:
</p>
<pre>
git-clone git://anongit.freedesktop.org/git/mesa/drm
git-checkout (XXXX HASH ID TBD)
</pre>
</li>
<p>
You should also be using Xorg server version 1.4
</p>
<h3>1.2 Autoconf Compilation</h3>
<p>
Mesa may be <a href="autoconf.html">built using autoconf</a>.
This should work well on most GNU-based systems.
When that fails, the traditional Mesa build system is available.
<h3>1.3 Traditional Compilation</h3>
<p>
The traditional Mesa build system is based on a collection of pre-defined
system configurations.
</p>
<p>
To see the list of configurations, type <b>make</b> alone.
Then choose a configuration from the list and type <b>make configname</b>.
</p>
<p>
Mesa may be built in several different ways using the predefined configurations:
</p>
<ul>
<li><b><em>Stand-alone/Xlib mode</em></b> - Mesa will be compiled as
@ -55,43 +92,6 @@ accelerated OpenGL rendering (for ATI, Intel, Matrox, etc) will be built.
The libGL.so library will support the GLX extension and will load/use
the DRI hardware drivers.
<p>
<b>Prerequisites:</b>
</p>
<ol>
<li>
<p>
For Mesa 7.0.2 <a href="http://dri.freedesktop.org/libdrm/">
DRM version 2.3</a> is required.
</p>
<p>
To check if you already have it, run:
<br>
<code>pkg-config --modversion libdrm</code>
</p>
<p>
You can download and install a <a href="http://dri.freedesktop.org/libdrm/">
tarball release</a> or get the code from git with:
<br>
<code>git clone git://anongit.freedesktop.org/git/mesa/drm</code>
<br>
Then revert to the drm-2.3.0 tag with:
<br>
<code>git-reset --hard drm-2.3.0</code>
</p>
</li>
<li>
Relatively recent
<a href="http://freedesktop.org/wiki/Software_2fXserver" target="_parent">
X.org</a> release.
Mesa depends on a number of X header and library files.
</li>
</ol>
<p>
Build Mesa and the DRI hardware drivers by running
@ -104,8 +104,13 @@ There are also <code>linux-dri-x86</code>, <code>linux-dri-x86-64</code>,
and <code>linux-ppc</code> configurations which are optimized for those
architectures.
</p>
<p>
Make sure you have the prerequisite versions of DRM and Xserver mentioned
above.
</p>
</li>
</ul>
@ -115,7 +120,7 @@ Later, if you want to rebuild for a different configuration run
</p>
<h3>1.2 The libraries</h3>
<h3>1.4 The libraries</h3>
<p>
When compilation has finished, look in the top-level <code>lib/</code>
@ -156,15 +161,15 @@ lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSM
If you built the DRI hardware drivers, you'll also see the DRI drivers:
</p>
<pre>
-rwxr-xr-x 1 brian users 15607851 Jul 21 12:11 ffb_dri.so*
-rwxr-xr-x 1 brian users 15148747 Jul 21 12:11 i810_dri.so*
-rwxr-xr-x 1 brian users 14497814 Jul 21 12:11 i830_dri.so*
-rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so*
-rwxr-xr-x 1 brian users 15607851 Jul 21 12:11 ffb_dri.so
-rwxr-xr-x 1 brian users 15148747 Jul 21 12:11 i810_dri.so
-rwxr-xr-x 1 brian users 14497814 Jul 21 12:11 i830_dri.so
-rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so
-rwxr-xr-x 1 brian users 11320803 Jul 21 12:11 mach64_dri.so
-rwxr-xr-x 1 brian users 11418014 Jul 21 12:12 mga_dri.so
-rwxr-xr-x 1 brian users 11064426 Jul 21 12:12 r128_dri.so
-rwxr-xr-x 1 brian users 11849858 Jul 21 12:12 r200_dri.so
-rwxr-xr-x 1 brian users 16050488 Jul 21 12:11 r300_dri.so*
-rwxr-xr-x 1 brian users 16050488 Jul 21 12:11 r300_dri.so
-rwxr-xr-x 1 brian users 11757388 Jul 21 12:12 radeon_dri.so
-rwxr-xr-x 1 brian users 11232304 Jul 21 12:13 s3v_dri.so
-rwxr-xr-x 1 brian users 11062970 Jul 21 12:13 savage_dri.so
@ -175,7 +180,7 @@ If you built the DRI hardware drivers, you'll also see the DRI drivers:
</pre>
<h3>1.3 Running the demos</h3>
<h3>1.5 Running the demos</h3>
<p>
If you downloaded/unpacked the MesaDemos-x.y.z.tar.gz archive or
@ -184,18 +189,15 @@ bunch of demonstration programs.
</p>
<p>
Before running a demo, you may have to set an environment variable
(such as <b>LD_LIBRARY_PATH</b> on Linux) to indicate where the
libraries are located. For example:
Before running a demo, you'll probably have to set two environment variables
to indicate where the libraries are located. For example:
<p>
<blockquote>
<b>cd</b> into the Mesa <b>lib/</b> directory.
<b>cd lib/</b>
<br>
<b>setenv LD_LIBRARY_PATH ${cwd}</b> (if using csh or tcsh shell)
<b>export LD_LIBRARY_PATH=${PWD}</b>
<br>
or,
<br>
<b>export LD_LIBRARY_PATH=${PWD}</b> (if using bash or sh shell)
<b>export LIBGL_DRIVERS_PATH=${PWD}</b> (if using DRI drivers)
</blockquote>
<p>
@ -253,7 +255,7 @@ Retrace your steps if this doesn't look right.
</p>
<H3>1.4 Installing the header and library files</H3>
<H3>1.6 Installing the header and library files</H3>
<p>
The standard location for the OpenGL header files on Unix-type systems is
@ -293,7 +295,7 @@ This is a handy way to compare multiple OpenGL implementations.
</p>
<H3>1.5 pkg-config support</H3>
<H3>1.7 Building OpenGL Programs With pkg-config</H3>
<p>
Running <code>make install</code> will install package configuration files

View file

@ -8,10 +8,13 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.1 Release Notes / (<em>in progress</em>)</H1>
<H1>Mesa 7.1 Release Notes / May XX, 2008</H1>
<p>
Mesa 7.1 is a new development release.
There have been many internal code changes since Mesa 7.0.x.
It should be relatively stable, but those who are especially concerned about
stability should wait for Mesa 7.2.
</p>
@ -23,21 +26,13 @@ TBD
<h2>New features</h2>
<ul>
<li>autoconf-based configuration
<li>Reduced dependencies between X server and Mesa
<li>GL_EXT_texture_from_pixmap extension for Xlib driver
<li>Support for the GL shading language with i965 driver (implemented by Intel)
</ul>
<h2>Bug fixes</h2>
<ul>
</ul>
<h2>Internal code changes</h2>
<ul>
</ul>
<h2>To Do (someday) items</h2>
<ul>
<li>Remove the MEMCPY() and _mesa_memcpy() wrappers and just use memcpy().

View file

@ -29,5 +29,5 @@ subset: $(SUBSET:.doxy=.tag)
$(foreach FILE,$(SUBSET),doxygen $(FILE);)
clean:
rm -rf $(FULL:.doxy=) $(SUBSET:.doxy=)
rm -rf *.tag
-rm -rf $(FULL:.doxy=) $(SUBSET:.doxy=)
-rm -rf *.tag

View file

@ -67,6 +67,7 @@ typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtens
typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension;
typedef struct __DRItexBufferExtensionRec __DRItexBufferExtension;
typedef struct __DRIlegacyExtensionRec __DRIlegacyExtension;
typedef struct __DRIswrastExtensionRec __DRIswrastExtension;
/*@}*/
@ -256,6 +257,7 @@ typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension;
typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension;
typedef struct __DRIdamageExtensionRec __DRIdamageExtension;
typedef struct __DRIloaderExtensionRec __DRIloaderExtension;
typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension;
/**
@ -357,6 +359,40 @@ struct __DRIloaderExtensionRec {
int num_rects, void *loaderPrivate);
};
#define __DRI_SWRAST_IMAGE_OP_DRAW 1
#define __DRI_SWRAST_IMAGE_OP_CLEAR 2
#define __DRI_SWRAST_IMAGE_OP_SWAP 3
/**
* SWRast Loader extension.
*/
#define __DRI_SWRAST_LOADER "DRI_SWRastLoader"
#define __DRI_SWRAST_LOADER_VERSION 1
struct __DRIswrastLoaderExtensionRec {
__DRIextension base;
/*
* Drawable position and size
*/
void (*getDrawableInfo)(__DRIdrawable *drawable,
int *x, int *y, int *width, int *height,
void *loaderPrivate);
/**
* Put image to drawable
*/
void (*putImage)(__DRIdrawable *drawable, int op,
int x, int y, int width, int height, char *data,
void *loaderPrivate);
/**
* Get image from drawable
*/
void (*getImage)(__DRIdrawable *drawable,
int x, int y, int width, int height, char *data,
void *loaderPrivate);
};
/**
* The remaining extensions describe driver extensions, immediately
* available interfaces provided by the driver. To start using the
@ -569,4 +605,25 @@ struct __DRIlegacyExtensionRec {
void *loaderPrivate);
};
/**
* This extension provides alternative screen, drawable and context
* constructors for swrast DRI functionality. This is used in
* conjunction with the core extension.
*/
#define __DRI_SWRAST "DRI_SWRast"
#define __DRI_SWRAST_VERSION 1
struct __DRIswrastExtensionRec {
__DRIextension base;
__DRIscreen *(*createNewScreen)(int screen,
const __DRIextension **extensions,
const __DRIconfig ***driver_configs,
void *loaderPrivate);
__DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
const __DRIconfig *config,
void *loaderPrivate);
};
#endif

View file

@ -181,77 +181,4 @@ typedef struct __GLcontextModesRec {
#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
/************************************************************************/
#ifdef _NEED_GL_CORE_IF
/**
* The GLcore interface (a subset of the XMesa interface)
*/
#define __GL_CORE "GL_Core"
typedef struct __GLcoreModuleRec {
/*
* XMesaVisual
*/
XMesaVisual (*XMesaCreateVisual)( ScreenPtr display,
VisualPtr visinfo,
GLboolean rgb_flag,
GLboolean alpha_flag,
GLboolean db_flag,
GLboolean stereo_flag,
GLboolean ximage_flag,
GLint depth_size,
GLint stencil_size,
GLint accum_red_size,
GLint accum_green_size,
GLint accum_blue_size,
GLint accum_alpha_size,
GLint num_samples,
GLint level,
GLint visualCaveat );
void (*XMesaDestroyVisual)( XMesaVisual v );
/*
* XMesaBuffer
*/
XMesaBuffer (*XMesaCreateWindowBuffer)( XMesaVisual v,
WindowPtr w );
XMesaBuffer (*XMesaCreatePixmapBuffer)( XMesaVisual v,
PixmapPtr p,
ColormapPtr cmap );
void (*XMesaDestroyBuffer)( XMesaBuffer b );
void (*XMesaSwapBuffers)( XMesaBuffer b );
void (*XMesaResizeBuffers)( XMesaBuffer b );
/*
* XMesaContext
*/
XMesaContext (*XMesaCreateContext)( XMesaVisual v,
XMesaContext share_list );
void (*XMesaDestroyContext)( XMesaContext c );
GLboolean (*XMesaCopyContext)( XMesaContext src,
XMesaContext dst,
GLuint mask );
GLboolean (*XMesaMakeCurrent2)( XMesaContext c,
XMesaBuffer drawBuffer,
XMesaBuffer readBuffer );
GLboolean (*XMesaForceCurrent)( XMesaContext c );
GLboolean (*XMesaLoseCurrent)( XMesaContext c );
} __GLcoreModule;
#endif /* _NEED_GL_CORE_IF */
#endif /* __gl_core_h_ */

View file

@ -130,7 +130,7 @@ extern void WMesaPaletteChange(HPALETTE Pal);
extern void WMesaMove(void);
void WMesaShareLists(WMesaContext ctx_to_share, WMesaContext ctx);
#ifdef __cplusplus
}

View file

@ -25,7 +25,7 @@ subdirs:
install:
clean:
@for dir in $(SUBDIRS) tests ; do \
-@for dir in $(SUBDIRS) tests ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) clean) ; \
fi \

View file

@ -19,8 +19,8 @@ INCLUDES = -I. -I- -I../../include
default: demo sample GLInfo
clean:
rm -f demo sample GLInfo
rm -f *.o
-rm -f demo sample GLInfo
-rm -f *.o
demo: demo.o
$(LD) demo.o $(LDFLAGS) $(LIBS) -o $@

View file

@ -11,9 +11,11 @@ OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa16 -lGLU -lGL $(APP_LIB_DEPS)
OSMESA32_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa32 -lGLU -lGL $(APP_LIB_DEPS)
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) -lX11 -lXi -lXmu
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \
$(APP_LIB_DEPS)
PROGS = \
arbfplight \

View file

@ -60,6 +60,6 @@ eglgears.o: eglgears.c $(HEADERS)
clean:
rm -f *.o *~
rm -f *.so
rm -f $(PROGRAMS)
-rm -f *.o *~
-rm -f *.so
-rm -f $(PROGRAMS)

View file

@ -37,8 +37,8 @@ LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
default: depend $(PROGS)
clean:
rm -f $(PROGS)
rm -f *.o
-rm -f $(PROGS)
-rm -f *.o
depend: $(SOURCES)

View file

@ -86,9 +86,9 @@ UTIL_FILES = readtex.h readtex.c
default: $(UTIL_FILES) $(PROGS)
clean:
rm -f $(PROGS)
rm -f *.o
rm -f getproclist.h
-rm -f $(PROGS)
-rm -f *.o
-rm -f getproclist.h
# auto code generation

View file

@ -15,6 +15,7 @@ PROGS = \
bump \
deriv \
mandelbrot \
multitex \
noise \
points \
texdemo1 \
@ -102,6 +103,13 @@ mandelbrot: mandelbrot.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) mandelbrot.o shaderutil.o $(LIBS) -o $@
multitex.o: multitex.c extfuncs.h readtex.h shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) multitex.c
multitex: multitex.o readtex.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) multitex.o readtex.o shaderutil.o $(LIBS) -o $@
noise.o: noise.c extfuncs.h shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) noise.c

285
progs/glsl/multitex.c Normal file
View file

@ -0,0 +1,285 @@
/**
* Test multi-texturing with GL shading language.
*
* Copyright (C) 2008 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.
*/
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "GL/glut.h"
#include "readtex.h"
#include "extfuncs.h"
#include "shaderutil.h"
static const char *Demo = "multitex";
static const char *VertFile = "multitex.vert.txt";
static const char *FragFile = "multitex.frag.txt";
static const char *TexFiles[2] =
{
"../images/tile.rgb",
"../images/tree2.rgba"
};
static GLuint Program;
static GLfloat Xrot = -90.0, Yrot = .0, Zrot = 0.0;
static GLfloat EyeDist = 10;
static GLboolean Anim = GL_TRUE;
/* value[0] = tex unit */
static struct uniform_info Uniforms[] = {
{ "tex1", 1, GL_INT, { 0, 0, 0, 0 }, -1 },
{ "tex2", 1, GL_INT, { 1, 0, 0, 0 }, -1 },
END_OF_UNIFORMS
};
static void
DrawPolygon(GLfloat size)
{
glPushMatrix();
glRotatef(90, 1, 0, 0);
glNormal3f(0, 0, 1);
glBegin(GL_POLYGON);
glMultiTexCoord2f(GL_TEXTURE0, 0, 0);
glMultiTexCoord2f(GL_TEXTURE1, 0, 0);
glVertex2f(-size, -size);
glMultiTexCoord2f(GL_TEXTURE0, 2, 0);
glMultiTexCoord2f(GL_TEXTURE1, 1, 0);
glVertex2f( size, -size);
glMultiTexCoord2f(GL_TEXTURE0, 2, 2);
glMultiTexCoord2f(GL_TEXTURE1, 1, 1);
glVertex2f( size, size);
glMultiTexCoord2f(GL_TEXTURE0, 0, 2);
glMultiTexCoord2f(GL_TEXTURE1, 0, 1);
glVertex2f(-size, size);
glEnd();
glPopMatrix();
}
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix(); /* modelview matrix */
glTranslatef(0.0, 0.0, -EyeDist);
glRotatef(Zrot, 0, 0, 1);
glRotatef(Yrot, 0, 1, 0);
glRotatef(Xrot, 1, 0, 0);
DrawPolygon(3.0);
glPopMatrix();
glutSwapBuffers();
}
static void
idle(void)
{
GLfloat t = 0.05 * glutGet(GLUT_ELAPSED_TIME);
Yrot = t;
glutPostRedisplay();
}
static void
key(unsigned char k, int x, int y)
{
(void) x;
(void) y;
switch (k) {
case ' ':
case 'a':
Anim = !Anim;
if (Anim)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
break;
case 'z':
EyeDist -= 0.5;
if (EyeDist < 3.0)
EyeDist = 3.0;
break;
case 'Z':
EyeDist += 0.5;
if (EyeDist > 90.0)
EyeDist = 90;
break;
case 27:
exit(0);
}
glutPostRedisplay();
}
static void
specialkey(int key, int x, int y)
{
GLfloat step = 2.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();
}
/* new window size or exposure */
static void
Reshape(int width, int height)
{
GLfloat ar = (float) width / (float) height;
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-2.0*ar, 2.0*ar, -2.0, 2.0, 4.0, 100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void
InitTextures(void)
{
GLenum filter = GL_LINEAR;
int i;
for (i = 0; i < 2; i++) {
GLint imgWidth, imgHeight;
GLenum imgFormat;
GLubyte *image = NULL;
image = LoadRGBImage(TexFiles[i], &imgWidth, &imgHeight, &imgFormat);
if (!image) {
printf("Couldn't read %s\n", TexFiles[i]);
exit(0);
}
glActiveTexture(GL_TEXTURE0 + i);
glBindTexture(GL_TEXTURE_2D, 42 + i);
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, imgWidth, imgHeight,
imgFormat, GL_UNSIGNED_BYTE, image);
free(image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
}
}
static GLuint
CreateProgram(const char *vertProgFile, const char *fragProgFile,
struct uniform_info *uniforms)
{
GLuint fragShader, vertShader, program;
vertShader = CompileShaderFile(GL_VERTEX_SHADER, vertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, fragProgFile);
assert(vertShader);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
InitUniforms(program, uniforms);
return program;
}
static void
InitPrograms(void)
{
Program = CreateProgram(VertFile, FragFile, Uniforms);
}
static void
InitGL(void)
{
const char *version = (const char *) glGetString(GL_VERSION);
if (version[0] != '2' || version[1] != '.') {
printf("Warning: this program expects OpenGL 2.0\n");
/*exit(1);*/
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
InitTextures();
InitPrograms();
glEnable(GL_DEPTH_TEST);
glClearColor(.6, .6, .9, 0);
glColor3f(1.0, 1.0, 1.0);
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowSize(500, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutCreateWindow(Demo);
glutReshapeFunc(Reshape);
glutKeyboardFunc(key);
glutSpecialFunc(specialkey);
glutDisplayFunc(draw);
if (Anim)
glutIdleFunc(idle);
InitGL();
glutMainLoop();
return 0;
}

View file

@ -0,0 +1,15 @@
// Multi-texture fragment shader
// Brian Paul
// Composite second texture over first.
// We're assuming the 2nd texture has a meaningful alpha channel.
uniform sampler2D tex1;
uniform sampler2D tex2;
void main()
{
vec4 t1 = texture2D(tex1, gl_TexCoord[0].xy, 0.0);
vec4 t2 = texture2D(tex2, gl_TexCoord[1].xy, 0.0);
gl_FragColor = mix(t1, t2, t2.w);
}

View file

@ -0,0 +1,10 @@
// Multi-texture vertex shader
// Brian Paul
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1] = gl_MultiTexCoord1;
gl_Position = ftransform();
}

View file

@ -43,8 +43,8 @@ LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS
default: depend $(PROGS)
clean:
rm -f $(PROGS)
rm -f *.o
-rm -f $(PROGS)
-rm -f *.o
depend: $(SOURCES)

View file

@ -24,7 +24,7 @@ tests: default
! ./cltest 2> /dev/null | (grep -e ^[*][*][*])
clean:
rm -f cltest.o sotest.o vstest.o framework.o cltest sotest vstest
-rm -f cltest.o sotest.o vstest.o framework.o cltest sotest vstest
#
# executables

View file

@ -99,9 +99,9 @@ UTIL_FILES = readtex.h readtex.c
default: $(UTIL_FILES) $(PROGS)
clean:
rm -f $(PROGS)
rm -f *.o
rm -f getproclist.h
-rm -f $(PROGS)
-rm -f *.o
-rm -f getproclist.h
##### RULES #####

View file

@ -68,6 +68,7 @@ Display( void )
/* draw to window */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */
glWindowPos2iARB(0, 0);
glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);

View file

@ -59,6 +59,18 @@ static GLfloat LodBias = 0.0;
static GLboolean NearestFilter = GL_TRUE;
static void
InitValues(void)
{
BaseLevel = 0;
MaxLevel = 8;
MinLod = -1;
MaxLod = 9;
LodBias = 0.0;
NearestFilter = GL_TRUE;
}
static void MakeImage(int level, int width, int height, const GLubyte color[4])
{
const int makeStripes = 0;
@ -108,6 +120,8 @@ static void makeImages(void)
static void myinit(void)
{
InitValues();
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glShadeModel(GL_FLAT);
@ -125,7 +139,7 @@ static void myinit(void)
static void display(void)
{
GLfloat tcm = 4.0;
printf("BASE_LEVEL = %d MAX_LEVEL = %d MIN_LOD = %f MAX_LOD = %f Bias = %.2g filter = %s\n",
printf("BASE_LEVEL=%d MAX_LEVEL=%d MIN_LOD=%.2g MAX_LOD=%.2g Bias=%.2g Filter=%s\n",
BaseLevel, MaxLevel, MinLod, MaxLod, LodBias,
NearestFilter ? "NEAREST" : "LINEAR");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel);
@ -214,6 +228,9 @@ key(unsigned char k, int x, int y)
case 'f':
NearestFilter = !NearestFilter;
break;
case ' ':
InitValues();
break;
case 27: /* Escape */
exit(0);
break;
@ -227,12 +244,13 @@ key(unsigned char k, int x, int y)
static void usage(void)
{
printf("usage:\n");
printf(" b/B decrease/increase GL_TEXTURE_BASE_LEVEL\n");
printf(" m/M decrease/increase GL_TEXTURE_MAX_LEVEL\n");
printf(" n/N decrease/increase GL_TEXTURE_MIN_LOD\n");
printf(" x/X decrease/increase GL_TEXTURE_MAX_LOD\n");
printf(" l/L decrease/increase GL_TEXTURE_LOD_BIAS\n");
printf(" f toggle nearest/linear filtering\n");
printf(" b/B decrease/increase GL_TEXTURE_BASE_LEVEL\n");
printf(" m/M decrease/increase GL_TEXTURE_MAX_LEVEL\n");
printf(" n/N decrease/increase GL_TEXTURE_MIN_LOD\n");
printf(" x/X decrease/increase GL_TEXTURE_MAX_LOD\n");
printf(" l/L decrease/increase GL_TEXTURE_LOD_BIAS\n");
printf(" f toggle nearest/linear filtering\n");
printf(" SPACE reset values\n");
}

View file

@ -102,9 +102,9 @@ UTIL_FILES = readtex.h readtex.c
default: $(UTIL_FILES) $(PROGS)
clean:
rm -f $(PROGS)
rm -f *.o
rm -f getproclist.h
-rm -f $(PROGS)
-rm -f *.o
-rm -f getproclist.h
# auto code generation

View file

@ -33,6 +33,7 @@
GLenum doubleBuffer;
int win;
static void Init(void)
{
@ -59,7 +60,8 @@ static void Key(unsigned char key, int x, int y)
switch (key) {
case 27:
exit(1);
glutDestroyWindow(win);
exit(0);
default:
return;
}
@ -122,7 +124,8 @@ int main(int argc, char **argv)
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
win = glutCreateWindow("First Tri");
if (!win) {
exit(1);
}

View file

@ -40,9 +40,9 @@ INCLUDES = -I. -I$(TOP)/include -I../samples
default: $(PROGS)
clean:
rm -f $(PROGS)
rm -f *.o
rm -f getproclist.h
-rm -f $(PROGS)
-rm -f *.o
-rm -f getproclist.h

View file

@ -16,6 +16,7 @@ offset
overlay
pbdemo
pbinfo
sharedtex
texture_from_pixmap
wincopy
xdemo

View file

@ -24,6 +24,7 @@
* This program tests GLX thread safety.
* Command line options:
* -p Open a display connection for each thread
* -l Enable application-side locking
* -n <num threads> Number of threads to create (default is 2)
* -display <display name> Specify X display (default is :0.0)
*
@ -405,6 +406,19 @@ clean_up(void)
}
static void
usage(void)
{
printf("glthreads: test of GL thread safety (any key = exit)\n");
printf("Usage:\n");
printf(" glthreads [options]\n");
printf("Options:\n");
printf(" -display DISPLAYNAME Specify display string\n");
printf(" -n NUMTHREADS Number of threads to create\n");
printf(" -p Use a separate display connection for each thread\n");
printf(" -l Use application-side locking\n");
}
int
main(int argc, char *argv[])
@ -416,9 +430,7 @@ main(int argc, char *argv[])
Status threadStat;
if (argc == 1) {
printf("glthreads: test of GL thread safety (any key = exit)\n");
printf("Usage:\n");
printf(" glthreads [-display dpyName] [-n numthreads]\n");
usage();
}
else {
int i;
@ -442,13 +454,14 @@ main(int argc, char *argv[])
i++;
}
else {
fprintf(stderr, "glthreads: unexpected flag: %s\n", argv[i]);
usage();
exit(1);
}
}
}
if (Locking)
printf("glthreads: Using explict locks around Xlib calls.\n");
printf("glthreads: Using explicit locks around Xlib calls.\n");
else
printf("glthreads: No explict locking.\n");

View file

@ -33,7 +33,7 @@ $(TOP)/$(LIB_DIR):
clean:
@for dir in $(SUBDIRS) ; do \
-@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) clean) ; \
fi \

View file

@ -11,14 +11,14 @@ default: subdirs
subdirs:
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir ; $(MAKE)) || exit 1 ; \
(cd $$dir && $(MAKE)) || exit 1 ; \
fi \
done
clean:
@for dir in $(SUBDIRS) ; do \
-@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir ; $(MAKE) clean) ; \
(cd $$dir && $(MAKE) clean) ; \
fi \
done

View file

@ -27,5 +27,5 @@ $(TOP)/$(LIB_DIR)/demodriver.so: $(OBJECTS)
clean:
rm -f *.o
rm -f *.so
-rm -f *.o
-rm -f *.so

View file

@ -47,8 +47,8 @@ $(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS)
clean:
rm -f *.o
rm -f *.so
-rm -f *.o
-rm -f *.so
depend: $(SOURCES) $(HEADERS)
@ echo "running $(MKDEP)"

View file

@ -52,8 +52,8 @@ $(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS)
clean:
rm -f *.o *.so*
rm -f core.*
-rm -f *.o *.so*
-rm -f core.*
depend: $(SOURCES) $(HEADERS)

View file

@ -10,7 +10,7 @@ SUBDIRS = $(GLU_DIRS)
default: $(TOP)/configs/current
@for dir in $(SUBDIRS) ; do \
(cd $$dir ; $(MAKE)) ; \
(cd $$dir && $(MAKE)) || exit 1 ; \
done
# GLU pkg-config file
@ -28,6 +28,6 @@ install: glu.pc
$(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
clean:
@for dir in $(SUBDIRS) ; do \
(cd $$dir ; $(MAKE) clean) ; \
-@for dir in $(SUBDIRS) ; do \
(cd $$dir && $(MAKE) clean) ; \
done

View file

@ -37,7 +37,7 @@ default:
echo "$(GLU_LIB_NAME) not build under BeOS, but integrated into ${GL_LIB_NAME}." ; \
exit 0 ; \
else \
$(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) ; \
$(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) || exit 1 ; \
fi
$(TOP)/$(LIB_DIR):

View file

@ -128,7 +128,7 @@ default:
echo "$(GLU_LIB_NAME) not build under BeOS, but integrated into ${GL_LIB_NAME}." ; \
exit 0 ; \
else \
$(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) ; \
$(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) || exit 1 ; \
fi
$(TOP)/$(LIB_DIR):

View file

@ -80,7 +80,7 @@ tags:
# Remove .o and backup files
clean: depend
-rm -f depend
-rm -f depend depend.bak
-rm -f *.o *~ *.o *~ *.so libglut.so.3.7
include depend

View file

@ -87,7 +87,7 @@ tags:
# Remove .o and backup files
clean: depend
-rm -f depend
-rm -f depend depend.bak
-rm -f *.o *~ *.o *~ *.so libglut.so.3.7
include depend

View file

@ -119,7 +119,7 @@ clean:
-rm -f *.lo
-rm -f *.la
-rm -rf .libs
-rm -rf depend depend.bak
-rm -f depend depend.bak
depend: $(SOURCES)

View file

@ -91,7 +91,7 @@ install: glut.pc
# Remove .o and backup files
clean: depend
-rm -f depend
-rm -f depend depend.bak
-rm -f *.o *~ *.o *~ *.so libglut.so.3.7
include depend

View file

@ -42,7 +42,7 @@ install: glw.pc
$(INSTALL) -m 644 glw.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
clean:
-rm depend depend.bak
-rm -f depend depend.bak
-rm -f *.o *~

View file

@ -4,9 +4,9 @@ include $(TOP)/configs/current
default:
cd mini ; $(MAKE)
cd mini && $(MAKE)
clean:
cd mini ; $(MAKE) clean
-@cd mini && $(MAKE) clean

View file

@ -83,6 +83,6 @@ install:
clean:
-rm -f drmtest $(TOP)/$(LIB_DIR)/libGL.so*
-rm -f *.o *~
-rm -f depend
-rm -f depend depend.bak
include depend

View file

@ -85,12 +85,12 @@ tags:
etags `find . -name \*.[ch]` `find $(TOP)/include`
install: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
make -C $(TOP)/src/mesa install-libgl
$(MAKE) -C $(TOP)/src/mesa install-libgl
# Remove .o and backup files
clean:
-rm -f $(TOP)/$(LIB_DIR)/libGL.so*
-rm -f *.o *~
-rm -f depend
-rm -f depend depend.bak
-include depend

View file

@ -84,7 +84,7 @@ struct __GLXDRIconfigPrivateRec {
#ifndef DEFAULT_DRIVER_DIR
/* this is normally defined in Mesa/configs/default with DRI_DRIVER_SEARCH_PATH */
#define DEFAULT_DRIVER_DIR "/usr/X11R6/lib/modules/dri"
#define DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
#endif
static void InfoMessageF(const char *f, ...)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,832 +0,0 @@
/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */
/*
* (C) Copyright IBM Corporation 2005
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sub license,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* IBM,
* AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <GL/gl.h>
#include "glxserver.h"
#include "glxbyteorder.h"
#include "indirect_size.h"
#include "indirect_reqsize.h"
#define __GLX_PAD(x) (((x) + 3) & ~3)
#if defined(__CYGWIN__) || defined(__MINGW32__)
# undef HAVE_ALIAS
#endif
#ifdef HAVE_ALIAS
# define ALIAS2(from,to) \
GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \
__attribute__ ((alias( # to )));
# define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize )
#else
# define ALIAS(from,to) \
GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \
{ return __glX ## to ## ReqSize( pc, swap ); }
#endif
int
__glXCallListsReqSize(const GLbyte *pc, Bool swap)
{
GLsizei n = *(GLsizei *) (pc + 0);
GLenum type = *(GLenum *) (pc + 4);
GLsizei compsize;
if (swap) {
n = bswap_32(n);
type = bswap_32(type);
}
compsize = __glCallLists_size(type);
return __GLX_PAD((compsize * n));
}
int
__glXBitmapReqSize(const GLbyte *pc, Bool swap)
{
GLint row_length = *(GLint *) (pc + 4);
GLint image_height = 0;
GLint skip_images = 0;
GLint skip_rows = *(GLint *) (pc + 8);
GLint alignment = *(GLint *) (pc + 16);
GLsizei width = *(GLsizei *) (pc + 20);
GLsizei height = *(GLsizei *) (pc + 24);
if (swap) {
row_length = bswap_32(row_length);
skip_rows = bswap_32(skip_rows);
alignment = bswap_32(alignment);
width = bswap_32(width);
height = bswap_32(height);
}
return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, width, height, 1,
image_height, row_length, skip_images,
skip_rows, alignment);
}
int
__glXFogfvReqSize(const GLbyte *pc, Bool swap)
{
GLenum pname = *(GLenum *) (pc + 0);
GLsizei compsize;
if (swap) {
pname = bswap_32(pname);
}
compsize = __glFogfv_size(pname);
return __GLX_PAD((compsize * 4));
}
int
__glXLightfvReqSize(const GLbyte *pc, Bool swap)
{
GLenum pname = *(GLenum *) (pc + 4);
GLsizei compsize;
if (swap) {
pname = bswap_32(pname);
}
compsize = __glLightfv_size(pname);
return __GLX_PAD((compsize * 4));
}
int
__glXLightModelfvReqSize(const GLbyte *pc, Bool swap)
{
GLenum pname = *(GLenum *) (pc + 0);
GLsizei compsize;
if (swap) {
pname = bswap_32(pname);
}
compsize = __glLightModelfv_size(pname);
return __GLX_PAD((compsize * 4));
}
int
__glXMaterialfvReqSize(const GLbyte *pc, Bool swap)
{
GLenum pname = *(GLenum *) (pc + 4);
GLsizei compsize;
if (swap) {
pname = bswap_32(pname);
}
compsize = __glMaterialfv_size(pname);
return __GLX_PAD((compsize * 4));
}
int
__glXPolygonStippleReqSize(const GLbyte *pc, Bool swap)
{
GLint row_length = *(GLint *) (pc + 4);
GLint image_height = 0;
GLint skip_images = 0;
GLint skip_rows = *(GLint *) (pc + 8);
GLint alignment = *(GLint *) (pc + 16);
if (swap) {
row_length = bswap_32(row_length);
skip_rows = bswap_32(skip_rows);
alignment = bswap_32(alignment);
}
return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, 32, 32, 1,
image_height, row_length, skip_images,
skip_rows, alignment);
}
int
__glXTexParameterfvReqSize(const GLbyte *pc, Bool swap)
{
GLenum pname = *(GLenum *) (pc + 4);
GLsizei compsize;
if (swap) {
pname = bswap_32(pname);
}
compsize = __glTexParameterfv_size(pname);
return __GLX_PAD((compsize * 4));
}
int
__glXTexImage1DReqSize(const GLbyte *pc, Bool swap)
{
GLint row_length = *(GLint *) (pc + 4);
GLint image_height = 0;
GLint skip_images = 0;
GLint skip_rows = *(GLint *) (pc + 8);
GLint alignment = *(GLint *) (pc + 16);
GLenum target = *(GLenum *) (pc + 20);
GLsizei width = *(GLsizei *) (pc + 32);
GLenum format = *(GLenum *) (pc + 44);
GLenum type = *(GLenum *) (pc + 48);
if (swap) {
row_length = bswap_32(row_length);
skip_rows = bswap_32(skip_rows);
alignment = bswap_32(alignment);
target = bswap_32(target);
width = bswap_32(width);
format = bswap_32(format);
type = bswap_32(type);
}
return __glXImageSize(format, type, target, width, 1, 1,
image_height, row_length, skip_images,
skip_rows, alignment);
}
int
__glXTexImage2DReqSize(const GLbyte *pc, Bool swap)
{
GLint row_length = *(GLint *) (pc + 4);
GLint image_height = 0;
GLint skip_images = 0;
GLint skip_rows = *(GLint *) (pc + 8);
GLint alignment = *(GLint *) (pc + 16);
GLenum target = *(GLenum *) (pc + 20);
GLsizei width = *(GLsizei *) (pc + 32);
GLsizei height = *(GLsizei *) (pc + 36);
GLenum format = *(GLenum *) (pc + 44);
GLenum type = *(GLenum *) (pc + 48);
if (swap) {
row_length = bswap_32(row_length);
skip_rows = bswap_32(skip_rows);
alignment = bswap_32(alignment);
target = bswap_32(target);
width = bswap_32(width);
height = bswap_32(height);
format = bswap_32(format);
type = bswap_32(type);
}
return __glXImageSize(format, type, target, width, height, 1,
image_height, row_length, skip_images,
skip_rows, alignment);
}
int
__glXTexEnvfvReqSize(const GLbyte *pc, Bool swap)
{
GLenum pname = *(GLenum *) (pc + 4);
GLsizei compsize;
if (swap) {
pname = bswap_32(pname);
}
compsize = __glTexEnvfv_size(pname);
return __GLX_PAD((compsize * 4));
}
int
__glXTexGendvReqSize(const GLbyte *pc, Bool swap)
{
GLenum pname = *(GLenum *) (pc + 4);
GLsizei compsize;
if (swap) {
pname = bswap_32(pname);
}
compsize = __glTexGendv_size(pname);
return __GLX_PAD((compsize * 8));
}
int
__glXTexGenfvReqSize(const GLbyte *pc, Bool swap)
{
GLenum pname = *(GLenum *) (pc + 4);
GLsizei compsize;
if (swap) {
pname = bswap_32(pname);
}
compsize = __glTexGenfv_size(pname);
return __GLX_PAD((compsize * 4));
}
int
__glXPixelMapfvReqSize(const GLbyte *pc, Bool swap)
{
GLsizei mapsize = *(GLsizei *) (pc + 4);
if (swap) {
mapsize = bswap_32(mapsize);
}
return __GLX_PAD((mapsize * 4));
}
int
__glXPixelMapusvReqSize(const GLbyte *pc, Bool swap)
{
GLsizei mapsize = *(GLsizei *) (pc + 4);
if (swap) {
mapsize = bswap_32(mapsize);
}
return __GLX_PAD((mapsize * 2));
}
int
__glXDrawPixelsReqSize(const GLbyte *pc, Bool swap)
{
GLint row_length = *(GLint *) (pc + 4);
GLint image_height = 0;
GLint skip_images = 0;
GLint skip_rows = *(GLint *) (pc + 8);
GLint alignment = *(GLint *) (pc + 16);
GLsizei width = *(GLsizei *) (pc + 20);
GLsizei height = *(GLsizei *) (pc + 24);
GLenum format = *(GLenum *) (pc + 28);
GLenum type = *(GLenum *) (pc + 32);
if (swap) {
row_length = bswap_32(row_length);
skip_rows = bswap_32(skip_rows);
alignment = bswap_32(alignment);
width = bswap_32(width);
height = bswap_32(height);
format = bswap_32(format);
type = bswap_32(type);
}
return __glXImageSize(format, type, 0, width, height, 1,
image_height, row_length, skip_images,
skip_rows, alignment);
}
int
__glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap)
{
GLsizei n = *(GLsizei *) (pc + 0);
if (swap) {
n = bswap_32(n);
}
return __GLX_PAD((n * 4) + (n * 4));
}
int
__glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap)
{
GLint row_length = *(GLint *) (pc + 4);
GLint image_height = 0;
GLint skip_images = 0;
GLint skip_rows = *(GLint *) (pc + 8);
GLint alignment = *(GLint *) (pc + 16);
GLenum target = *(GLenum *) (pc + 20);
GLsizei width = *(GLsizei *) (pc + 36);
GLenum format = *(GLenum *) (pc + 44);
GLenum type = *(GLenum *) (pc + 48);
if (swap) {
row_length = bswap_32(row_length);
skip_rows = bswap_32(skip_rows);
alignment = bswap_32(alignment);
target = bswap_32(target);
width = bswap_32(width);
format = bswap_32(format);
type = bswap_32(type);
}
return __glXImageSize(format, type, target, width, 1, 1,
image_height, row_length, skip_images,
skip_rows, alignment);
}
int
__glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap)
{
GLint row_length = *(GLint *) (pc + 4);
GLint image_height = 0;
GLint skip_images = 0;
GLint skip_rows = *(GLint *) (pc + 8);
GLint alignment = *(GLint *) (pc + 16);
GLenum target = *(GLenum *) (pc + 20);
GLsizei width = *(GLsizei *) (pc + 36);
GLsizei height = *(GLsizei *) (pc + 40);
GLenum format = *(GLenum *) (pc + 44);
GLenum type = *(GLenum *) (pc + 48);
if (swap) {
row_length = bswap_32(row_length);
skip_rows = bswap_32(skip_rows);
alignment = bswap_32(alignment);
target = bswap_32(target);
width = bswap_32(width);
height = bswap_32(height);
format = bswap_32(format);
type = bswap_32(type);
}
return __glXImageSize(format, type, target, width, height, 1,
image_height, row_length, skip_images,
skip_rows, alignment);
}
int
__glXColorTableReqSize(const GLbyte *pc, Bool swap)
{
GLint row_length = *(GLint *) (pc + 4);
GLint image_height = 0;
GLint skip_images = 0;
GLint skip_rows = *(GLint *) (pc + 8);
GLint alignment = *(GLint *) (pc + 16);
GLenum target = *(GLenum *) (pc + 20);
GLsizei width = *(GLsizei *) (pc + 28);
GLenum format = *(GLenum *) (pc + 32);
GLenum type = *(GLenum *) (pc + 36);
if (swap) {
row_length = bswap_32(row_length);
skip_rows = bswap_32(skip_rows);
alignment = bswap_32(alignment);
target = bswap_32(target);
width = bswap_32(width);
format = bswap_32(format);
type = bswap_32(type);
}
return __glXImageSize(format, type, target, width, 1, 1,
image_height, row_length, skip_images,
skip_rows, alignment);
}
int
__glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap)
{
GLenum pname = *(GLenum *) (pc + 4);
GLsizei compsize;
if (swap) {
pname = bswap_32(pname);
}
compsize = __glColorTableParameterfv_size(pname);
return __GLX_PAD((compsize * 4));
}
int
__glXColorSubTableReqSize(const GLbyte *pc, Bool swap)
{
GLint row_length = *(GLint *) (pc + 4);
GLint image_height = 0;
GLint skip_images = 0;
GLint skip_rows = *(GLint *) (pc + 8);
GLint alignment = *(GLint *) (pc + 16);
GLenum target = *(GLenum *) (pc + 20);
GLsizei count = *(GLsizei *) (pc + 28);
GLenum format = *(GLenum *) (pc + 32);
GLenum type = *(GLenum *) (pc + 36);
if (swap) {
row_length = bswap_32(row_length);
skip_rows = bswap_32(skip_rows);
alignment = bswap_32(alignment);
target = bswap_32(target);
count = bswap_32(count);
format = bswap_32(format);
type = bswap_32(type);
}
return __glXImageSize(format, type, target, count, 1, 1,
image_height, row_length, skip_images,
skip_rows, alignment);
}
int
__glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap)
{
GLint row_length = *(GLint *) (pc + 4);
GLint image_height = 0;
GLint skip_images = 0;
GLint skip_rows = *(GLint *) (pc + 8);
GLint alignment = *(GLint *) (pc + 16);
GLenum target = *(GLenum *) (pc + 20);
GLsizei width = *(GLsizei *) (pc + 28);
GLenum format = *(GLenum *) (pc + 36);
GLenum type = *(GLenum *) (pc + 40);
if (swap) {
row_length = bswap_32(row_length);
skip_rows = bswap_32(skip_rows);
alignment = bswap_32(alignment);
target = bswap_32(target);
width = bswap_32(width);
format = bswap_32(format);
type = bswap_32(type);
}
return __glXImageSize(format, type, target, width, 1, 1,
image_height, row_length, skip_images,
skip_rows, alignment);
}
int
__glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap)
{
GLint row_length = *(GLint *) (pc + 4);
GLint image_height = 0;
GLint skip_images = 0;
GLint skip_rows = *(GLint *) (pc + 8);
GLint alignment = *(GLint *) (pc + 16);
GLenum target = *(GLenum *) (pc + 20);
GLsizei width = *(GLsizei *) (pc + 28);
GLsizei height = *(GLsizei *) (pc + 32);
GLenum format = *(GLenum *) (pc + 36);
GLenum type = *(GLenum *) (pc + 40);
if (swap) {
row_length = bswap_32(row_length);
skip_rows = bswap_32(skip_rows);
alignment = bswap_32(alignment);
target = bswap_32(target);
width = bswap_32(width);
height = bswap_32(height);
format = bswap_32(format);
type = bswap_32(type);
}
return __glXImageSize(format, type, target, width, height, 1,
image_height, row_length, skip_images,
skip_rows, alignment);
}
int
__glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap)
{
GLenum pname = *(GLenum *) (pc + 4);
GLsizei compsize;
if (swap) {
pname = bswap_32(pname);
}
compsize = __glConvolutionParameterfv_size(pname);
return __GLX_PAD((compsize * 4));
}
int
__glXTexImage3DReqSize(const GLbyte *pc, Bool swap)
{
GLint row_length = *(GLint *) (pc + 4);
GLint image_height = *(GLint *) (pc + 8);
GLint skip_rows = *(GLint *) (pc + 16);
GLint skip_images = *(GLint *) (pc + 20);
GLint alignment = *(GLint *) (pc + 32);
GLenum target = *(GLenum *) (pc + 36);
GLsizei width = *(GLsizei *) (pc + 48);
GLsizei height = *(GLsizei *) (pc + 52);
GLsizei depth = *(GLsizei *) (pc + 56);
GLenum format = *(GLenum *) (pc + 68);
GLenum type = *(GLenum *) (pc + 72);
if (swap) {
row_length = bswap_32(row_length);
image_height = bswap_32(image_height);
skip_rows = bswap_32(skip_rows);
skip_images = bswap_32(skip_images);
alignment = bswap_32(alignment);
target = bswap_32(target);
width = bswap_32(width);
height = bswap_32(height);
depth = bswap_32(depth);
format = bswap_32(format);
type = bswap_32(type);
}
return __glXImageSize(format, type, target, width, height, depth,
image_height, row_length, skip_images,
skip_rows, alignment);
}
int
__glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap)
{
GLint row_length = *(GLint *) (pc + 4);
GLint image_height = *(GLint *) (pc + 8);
GLint skip_rows = *(GLint *) (pc + 16);
GLint skip_images = *(GLint *) (pc + 20);
GLint alignment = *(GLint *) (pc + 32);
GLenum target = *(GLenum *) (pc + 36);
GLsizei width = *(GLsizei *) (pc + 60);
GLsizei height = *(GLsizei *) (pc + 64);
GLsizei depth = *(GLsizei *) (pc + 68);
GLenum format = *(GLenum *) (pc + 76);
GLenum type = *(GLenum *) (pc + 80);
if (swap) {
row_length = bswap_32(row_length);
image_height = bswap_32(image_height);
skip_rows = bswap_32(skip_rows);
skip_images = bswap_32(skip_images);
alignment = bswap_32(alignment);
target = bswap_32(target);
width = bswap_32(width);
height = bswap_32(height);
depth = bswap_32(depth);
format = bswap_32(format);
type = bswap_32(type);
}
return __glXImageSize(format, type, target, width, height, depth,
image_height, row_length, skip_images,
skip_rows, alignment);
}
int
__glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap)
{
GLsizei imageSize = *(GLsizei *) (pc + 20);
if (swap) {
imageSize = bswap_32(imageSize);
}
return __GLX_PAD(imageSize);
}
int
__glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap)
{
GLsizei imageSize = *(GLsizei *) (pc + 24);
if (swap) {
imageSize = bswap_32(imageSize);
}
return __GLX_PAD(imageSize);
}
int
__glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap)
{
GLsizei imageSize = *(GLsizei *) (pc + 28);
if (swap) {
imageSize = bswap_32(imageSize);
}
return __GLX_PAD(imageSize);
}
int
__glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap)
{
GLsizei imageSize = *(GLsizei *) (pc + 36);
if (swap) {
imageSize = bswap_32(imageSize);
}
return __GLX_PAD(imageSize);
}
int
__glXProgramStringARBReqSize(const GLbyte *pc, Bool swap)
{
GLsizei len = *(GLsizei *) (pc + 8);
if (swap) {
len = bswap_32(len);
}
return __GLX_PAD(len);
}
int
__glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap)
{
GLsizei n = *(GLsizei *) (pc + 0);
if (swap) {
n = bswap_32(n);
}
return __GLX_PAD((n * 4));
}
int
__glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap)
{
GLenum pname = *(GLenum *) (pc + 0);
GLsizei compsize;
if (swap) {
pname = bswap_32(pname);
}
compsize = __glPointParameterfvEXT_size(pname);
return __GLX_PAD((compsize * 4));
}
int
__glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap)
{
GLuint num = *(GLuint *) (pc + 8);
if (swap) {
num = bswap_32(num);
}
return __GLX_PAD((num * 32));
}
int
__glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap)
{
GLuint num = *(GLuint *) (pc + 8);
if (swap) {
num = bswap_32(num);
}
return __GLX_PAD((num * 16));
}
int
__glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap)
{
GLsizei n = *(GLsizei *) (pc + 4);
if (swap) {
n = bswap_32(n);
}
return __GLX_PAD((n * 8));
}
int
__glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap)
{
GLsizei n = *(GLsizei *) (pc + 4);
if (swap) {
n = bswap_32(n);
}
return __GLX_PAD((n * 16));
}
int
__glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap)
{
GLsizei n = *(GLsizei *) (pc + 4);
if (swap) {
n = bswap_32(n);
}
return __GLX_PAD((n * 24));
}
int
__glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap)
{
GLsizei n = *(GLsizei *) (pc + 4);
if (swap) {
n = bswap_32(n);
}
return __GLX_PAD((n * 12));
}
int
__glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap)
{
GLsizei n = *(GLsizei *) (pc + 4);
if (swap) {
n = bswap_32(n);
}
return __GLX_PAD((n * 6));
}
int
__glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap)
{
GLsizei n = *(GLsizei *) (pc + 4);
if (swap) {
n = bswap_32(n);
}
return __GLX_PAD((n * 32));
}
int
__glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap)
{
GLsizei len = *(GLsizei *) (pc + 4);
if (swap) {
len = bswap_32(len);
}
return __GLX_PAD(len);
}
ALIAS(Fogiv, Fogfv)
ALIAS(Lightiv, Lightfv)
ALIAS(LightModeliv, LightModelfv)
ALIAS(Materialiv, Materialfv)
ALIAS(TexParameteriv, TexParameterfv)
ALIAS(TexEnviv, TexEnvfv)
ALIAS(TexGeniv, TexGenfv)
ALIAS(PixelMapuiv, PixelMapfv)
ALIAS(ColorTableParameteriv, ColorTableParameterfv)
ALIAS(ConvolutionParameteriv, ConvolutionParameterfv)
ALIAS(CompressedTexSubImage1DARB, CompressedTexImage1DARB)
ALIAS(CompressedTexSubImage2DARB, CompressedTexImage3DARB)
ALIAS(LoadProgramNV, ProgramStringARB)
ALIAS(RequestResidentProgramsNV, DrawBuffersARB)
ALIAS(VertexAttribs1fvNV, PixelMapfv)
ALIAS(VertexAttribs1svNV, PixelMapusv)
ALIAS(VertexAttribs2fvNV, VertexAttribs1dvNV)
ALIAS(VertexAttribs2svNV, PixelMapfv)
ALIAS(VertexAttribs4fvNV, VertexAttribs2dvNV)
ALIAS(VertexAttribs4svNV, VertexAttribs1dvNV)
ALIAS(VertexAttribs4ubvNV, PixelMapfv)
ALIAS(PointParameterivNV, PointParameterfvEXT)
ALIAS(ProgramNamedParameter4dvNV, CompressedTexSubImage3DARB)
ALIAS(DeleteFramebuffersEXT, DrawBuffersARB)
ALIAS(DeleteRenderbuffersEXT, DrawBuffersARB)

View file

@ -1,121 +0,0 @@
/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */
/*
* (C) Copyright IBM Corporation 2005
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sub license,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* IBM,
* AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#if !defined( _INDIRECT_REQSIZE_H_ )
# define _INDIRECT_REQSIZE_H_
# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__)
# define HIDDEN __attribute__((visibility("hidden")))
# else
# define HIDDEN
# endif
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define PURE __attribute__((pure))
# else
# define PURE
# endif
extern PURE HIDDEN int __glXCallListsReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXBitmapReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXFogfvReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXFogivReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXLightfvReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXLightivReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXLightModelfvReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXLightModelivReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXMaterialfvReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXMaterialivReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXPolygonStippleReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexParameterfvReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexParameterivReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexImage1DReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexImage2DReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexEnvfvReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexEnvivReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexGendvReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexGenfvReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexGenivReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXMap1dReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXMap1fReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXMap2dReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXMap2fReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXPixelMapfvReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXPixelMapuivReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXPixelMapusvReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXDrawPixelsReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXDrawArraysReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXColorTableReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXColorTableParameterivReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXColorSubTableReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXConvolutionParameterivReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexImage3DReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXLoadProgramNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXRequestResidentProgramsNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs1fvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs1svNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs2fvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs2svNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs4fvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXPointParameterivNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap);
# undef HIDDEN
# undef PURE
#endif /* !defined( _INDIRECT_REQSIZE_H_ ) */

File diff suppressed because it is too large Load diff

View file

@ -1,102 +0,0 @@
/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */
/*
* (C) Copyright IBM Corporation 2004
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sub license,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* IBM,
* AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#if !defined( _INDIRECT_SIZE_GET_H_ )
# define _INDIRECT_SIZE_GET_H_
/**
* \file
* Prototypes for functions used to determine the number of data elements in
* various GLX protocol messages.
*
* \author Ian Romanick <idr@us.ibm.com>
*/
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define PURE __attribute__((pure))
# else
# define PURE
# endif
# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# define FASTCALL __attribute__((fastcall))
# else
# define FASTCALL
# endif
# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__)
# define INTERNAL __attribute__((visibility("internal")))
# else
# define INTERNAL
# endif
extern INTERNAL PURE FASTCALL GLint __glGetBooleanv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetDoublev_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetFloatv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetIntegerv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetLightfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetLightiv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetMaterialfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetMaterialiv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetTexEnvfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetTexEnviv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetTexGendv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetTexGenfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetTexGeniv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetTexParameterfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetTexParameteriv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetTexLevelParameterfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetTexLevelParameteriv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameterfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameteriv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint
__glGetConvolutionParameterfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint
__glGetConvolutionParameteriv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameterfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameteriv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetMinmaxParameterfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetMinmaxParameteriv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetProgramivARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectivARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectuivARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetQueryivARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetProgramivNV_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvNV_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvNV_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivNV_size(GLenum);
extern INTERNAL PURE FASTCALL GLint
__glGetFramebufferAttachmentParameterivEXT_size(GLenum);
# undef PURE
# undef FASTCALL
# undef INTERNAL
#endif /* !defined( _INDIRECT_SIZE_GET_H_ ) */

File diff suppressed because it is too large Load diff

View file

@ -24,25 +24,38 @@ GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
# Figure out what to make here
default:
default: depend
@for driver in $(DRIVER_DIRS) ; do \
case "$$driver" in \
x11) $(MAKE) stand-alone ;; \
dri) $(MAKE) linux-solo ;; \
osmesa) $(MAKE) osmesa-only ;; \
beos) $(MAKE) beos ;; \
directfb) $(MAKE) directfb ;; \
fbdev) $(MAKE) fbdev ;; \
x11) $(MAKE) stand-alone || exit 1 ;; \
dri) $(MAKE) linux-solo || exit 1 ;; \
osmesa) $(MAKE) osmesa-only || exit 1 ;; \
beos) $(MAKE) beos || exit 1 ;; \
directfb) $(MAKE) directfb || exit 1 ;; \
fbdev) $(MAKE) fbdev || exit 1 ;; \
*) echo "$$driver is invalid in DRIVER_DIRS" >&2; exit 1;; \
esac ; \
done
install: default
@for driver in $(DRIVER_DIRS) ; do \
case "$$driver" in \
osmesa) if [ "$(DRIVER_DIRS)" = osmesa ]; then \
$(MAKE) install-headers install-osmesa || exit 1 ; \
else \
$(MAKE) install-osmesa || exit 1 ; \
fi ;; \
dri) $(MAKE) install-libgl install-dri || exit 1 ;; \
*) $(MAKE) install-libgl || exit 1 ;; \
esac ; \
done
######################################################################
# BeOS driver target
beos: depend subdirs libmesa.a
cd drivers/beos; $(MAKE)
cd drivers/beos && $(MAKE)
######################################################################
@ -56,7 +69,7 @@ libmesa.a: $(SOLO_OBJECTS)
fi
linux-solo: depend subdirs libmesa.a
cd drivers/dri ; $(MAKE)
cd drivers/dri && $(MAKE)
#####################################################################
@ -69,7 +82,7 @@ libgl-core: $(CORE_OBJECTS)
$(GL_LIB_DEPS)
directfb: depend subdirs libgl-core
cd drivers/directfb ; $(MAKE)
cd drivers/directfb && $(MAKE)
#####################################################################
@ -145,11 +158,11 @@ depend: $(ALL_SOURCES)
subdirs:
@ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \
(cd x86 ; $(MAKE)) ; \
(cd x86 && $(MAKE)) || exit 1 ; \
fi
@ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \
(cd x86 ; $(MAKE)) ; \
(cd x86-64 ; $(MAKE)) ; \
(cd x86 && $(MAKE)) || exit 1 ; \
(cd x86-64 && $(MAKE)) || exit 1 ; \
fi
pcedit = sed \
@ -160,31 +173,25 @@ pcedit = sed \
gl.pc: gl.pc.in
$(pcedit) $< > $@
install-libgl: gl.pc
install-headers:
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) -m 644 $(TOP)/include/GL/*.h \
$(DESTDIR)$(INSTALL_DIR)/include/GL
install-libgl: default gl.pc install-headers
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) -m 644 $(TOP)/include/GL/*.h $(DESTDIR)$(INSTALL_DIR)/include/GL
@if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \
$(INSTALL) $(TOP)/$(LIB_DIR)/libGL* \
$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \
fi
$(INSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)* \
$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
install-osmesa:
@if [ -e $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \
$(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa* \
$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \
fi
install-osmesa: default
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)* \
$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
install-drivers:
@for target in $(DRIVER_DIRS); do \
case "$$target" in \
dri) cd drivers/dri ; $(MAKE) install ;; \
esac; \
done
install: default install-libgl install-osmesa install-drivers
install-dri:
cd drivers/dri && $(MAKE) install
## NOT INSTALLED YET:
## $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GLES
@ -200,9 +207,10 @@ clean:
-rm -f */*/*.o
-rm -f depend depend.bak libmesa.a
-rm -f drivers/*/*.o
(cd drivers/dri && $(MAKE) clean)
(cd x86 && $(MAKE) clean)
(cd x86-64 && $(MAKE) clean)
-@cd drivers/dri && $(MAKE) clean
-@cd drivers/xorg && $(MAKE) clean
-@cd x86 && $(MAKE) clean
-@cd x86-64 && $(MAKE) clean
-include depend

View file

@ -170,10 +170,10 @@ OBJECTS := $(DRIVER_OBJECTS:.cpp=.o)
default: depend $(TOP)/$(LIB_DIR) $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
$(MESA_MODULES):
cd $(TOP)/src/mesa; $(MAKE) mesa.a ;
cd $(TOP)/src/mesa && $(MAKE) mesa.a ;
$(GLU_MODULES):
cd $(GLU_DIR); $(MAKE) $(subst $(GLU_DIR)/,,$(GLU_MODULES)) ;
cd $(GLU_DIR) && $(MAKE) $(subst $(GLU_DIR)/,,$(GLU_MODULES)) ;
$(TOP)/$(LIB_DIR):
mkdir $(TOP)/$(LIB_DIR)
@ -184,13 +184,13 @@ $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) $(MESA_MODULES) $(GLU_MODULES)
$(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(OBJECTS) $(MESA_MODULES) $(GLU_MODULES)
# $(GLU_OBJECTS):
# cd $(GLU_DIR); $(MAKE) $< ;
# cd $(GLU_DIR) && $(MAKE) $< ;
depend: $(DRIVER_SOURCES) $(GLU_SOURCES)
touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(DRIVER_SOURCES) $(GLU_SOURCES) > /dev/null
clean:
rm -f depend $(OBJECTS)
-rm -f depend depend.bak $(OBJECTS)
include depend

View file

@ -29,6 +29,7 @@
#include "buffers.h"
#include "context.h"
#include "framebuffer.h"
#include "mipmap.h"
#include "queryobj.h"
#include "renderbuffer.h"
#include "texcompress.h"
@ -98,6 +99,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d;
driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d;
driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d;
driver->GenerateMipmap = _mesa_generate_mipmap;
driver->TestProxyTexImage = _mesa_test_proxy_teximage;
driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d;
driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d;
@ -259,43 +261,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
}
/**
* Plug in Mesa's GLSL functions.
*/
void
_mesa_init_glsl_driver_functions(struct dd_function_table *driver)
{
driver->AttachShader = _mesa_attach_shader;
driver->BindAttribLocation = _mesa_bind_attrib_location;
driver->CompileShader = _mesa_compile_shader;
driver->CreateProgram = _mesa_create_program;
driver->CreateShader = _mesa_create_shader;
driver->DeleteProgram2 = _mesa_delete_program2;
driver->DeleteShader = _mesa_delete_shader;
driver->DetachShader = _mesa_detach_shader;
driver->GetActiveAttrib = _mesa_get_active_attrib;
driver->GetActiveUniform = _mesa_get_active_uniform;
driver->GetAttachedShaders = _mesa_get_attached_shaders;
driver->GetAttribLocation = _mesa_get_attrib_location;
driver->GetHandle = _mesa_get_handle;
driver->GetProgramiv = _mesa_get_programiv;
driver->GetProgramInfoLog = _mesa_get_program_info_log;
driver->GetShaderiv = _mesa_get_shaderiv;
driver->GetShaderInfoLog = _mesa_get_shader_info_log;
driver->GetShaderSource = _mesa_get_shader_source;
driver->GetUniformfv = _mesa_get_uniformfv;
driver->GetUniformLocation = _mesa_get_uniform_location;
driver->IsProgram = _mesa_is_program;
driver->IsShader = _mesa_is_shader;
driver->LinkProgram = _mesa_link_program;
driver->ShaderSource = _mesa_shader_source;
driver->Uniform = _mesa_uniform;
driver->UniformMatrix = _mesa_uniform_matrix;
driver->UseProgram = _mesa_use_program;
driver->ValidateProgram = _mesa_validate_program;
}
/**
* Call the ctx->Driver.* state functions with current values to initialize
* driver state.

View file

@ -30,10 +30,6 @@ extern void
_mesa_init_driver_functions(struct dd_function_table *driver);
extern void
_mesa_init_glsl_driver_functions(struct dd_function_table *driver);
extern void
_mesa_init_driver_state(GLcontext *ctx);

View file

@ -50,5 +50,5 @@ install:
clean:
rm -f *.o *.so
-rm -f *.o *.so

View file

@ -27,13 +27,13 @@ install:
(cd $$dir && $(MAKE) install) || exit 1 ; \
fi \
done
$(TOP)/bin/minstall -d $(DESTDIR)$(INSTALL_DIR)/include/GL/internal
$(TOP)/bin/minstall -m 0644 $(TOP)/include/GL/internal/dri_interface.h $(DESTDIR)$(INSTALL_DIR)/include/GL/internal
$(TOP)/bin/minstall -m 0644 $(TOP)/include/GL/internal/dri_sarea.h $(DESTDIR)$(INSTALL_DIR)/include/GL/internal
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL/internal
$(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_interface.h $(DESTDIR)$(INSTALL_DIR)/include/GL/internal
$(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_sarea.h $(DESTDIR)$(INSTALL_DIR)/include/GL/internal
clean:
@for dir in $(DRI_DIRS) ; do \
-@for dir in $(DRI_DIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) clean) ; \
fi \

View file

@ -31,6 +31,7 @@
#include "dri_util.h"
#include "drm_sarea.h"
#include "utils.h"
#ifndef GLX_OML_sync_control
typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRIdrawable *drawable, int32_t *numerator, int32_t *denominator);
@ -66,6 +67,18 @@ __driUtilMessage(const char *f, ...)
}
}
GLint
driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 )
{
if (rect2.x1 > rect1.x1) rect1.x1 = rect2.x1;
if (rect2.x2 < rect1.x2) rect1.x2 = rect2.x2;
if (rect2.y1 > rect1.y1) rect1.y1 = rect2.y1;
if (rect2.y2 < rect1.y2) rect1.y2 = rect2.y2;
if (rect1.x1 > rect1.x2 || rect1.y1 > rect1.y2) return 0;
return (rect1.x2 - rect1.x1) * (rect1.y2 - rect1.y1);
}
/*****************************************************************/
/** \name Context (un)binding functions */
@ -497,9 +510,9 @@ static void driCopySubBuffer(__DRIdrawable *dPriv,
dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h);
rect.x1 = x;
rect.y1 = y;
rect.y1 = dPriv->h - y - h;
rect.x2 = x + w;
rect.y2 = y + w;
rect.y2 = rect.y1 + h;
driReportDamage(dPriv, &rect, 1);
}
@ -758,8 +771,10 @@ static void driDestroyScreen(__DRIscreen *psp)
(*psp->DriverAPI.DestroyScreen)(psp);
if (psp->dri2.enabled) {
#ifdef TTM_API
drmBOUnmap(psp->fd, &psp->dri2.sareaBO);
drmBOUnreference(psp->fd, &psp->dri2.sareaBO);
#endif
} else {
(void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX);
(void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
@ -891,6 +906,7 @@ dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle,
const __DRIextension **extensions,
const __DRIconfig ***driver_configs, void *data)
{
#ifdef TTM_API
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
unsigned int *p;
@ -958,6 +974,9 @@ dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle,
psp->DriverAPI = driDriverAPI;
return psp;
#else
return NULL;
#endif
}
static const __DRIextension **driGetExtensions(__DRIscreen *psp)
@ -965,117 +984,6 @@ static const __DRIextension **driGetExtensions(__DRIscreen *psp)
return psp->extensions;
}
#define __ATTRIB(attrib, field) \
{ attrib, offsetof(__GLcontextModes, field) }
static const struct { unsigned int attrib, offset; } attribMap[] = {
__ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
__ATTRIB(__DRI_ATTRIB_LEVEL, level),
__ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
__ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
__ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
__ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
__ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
__ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
__ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
__ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
__ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
__ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
__ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
__ATTRIB(__DRI_ATTRIB_FLOAT_MODE, floatMode),
__ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
__ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
__ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
__ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
__ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
__ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture),
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS, bindToTextureTargets),
__ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),
/* The struct field doesn't matter here, these are handled by the
* switch in driGetConfigAttribIndex. We need them in the array
* so the iterator includes them though.*/
__ATTRIB(__DRI_ATTRIB_RENDER_TYPE, level),
__ATTRIB(__DRI_ATTRIB_CONFIG_CAVEAT, level),
__ATTRIB(__DRI_ATTRIB_SWAP_METHOD, level)
};
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
static int
driGetConfigAttribIndex(const __DRIconfig *config,
unsigned int index, unsigned int *value)
{
switch (attribMap[index].attrib) {
case __DRI_ATTRIB_RENDER_TYPE:
if (config->modes.rgbMode)
*value = __DRI_ATTRIB_RGBA_BIT;
else
*value = __DRI_ATTRIB_COLOR_INDEX_BIT;
break;
case __DRI_ATTRIB_CONFIG_CAVEAT:
if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG)
*value = __DRI_ATTRIB_NON_CONFORMANT_CONFIG;
else if (config->modes.visualRating == GLX_SLOW_CONFIG)
*value = __DRI_ATTRIB_SLOW_BIT;
else
*value = 0;
break;
case __DRI_ATTRIB_SWAP_METHOD:
break;
default:
*value = *(unsigned int *)
((char *) &config->modes + attribMap[index].offset);
break;
}
return GL_TRUE;
}
static int
driGetConfigAttrib(const __DRIconfig *config,
unsigned int attrib, unsigned int *value)
{
int i;
for (i = 0; i < ARRAY_SIZE(attribMap); i++)
if (attribMap[i].attrib == attrib)
return driGetConfigAttribIndex(config, i, value);
return GL_FALSE;
}
static int
driIndexConfigAttrib(const __DRIconfig *config, int index,
unsigned int *attrib, unsigned int *value)
{
if (index >= 0 && index < ARRAY_SIZE(attribMap)) {
*attrib = attribMap[index].attrib;
return driGetConfigAttribIndex(config, index, value);
}
return GL_FALSE;
}
const __DRIlegacyExtension driLegacyExtension = {
{ __DRI_LEGACY, __DRI_LEGACY_VERSION },
driCreateNewScreen,

View file

@ -53,7 +53,6 @@
#include <drm.h>
#include <drm_sarea.h>
#include <xf86drm.h>
#include <xf86mm.h>
#include "GL/internal/glcore.h"
#include "GL/internal/dri_interface.h"
#include "GL/internal/dri_sarea.h"
@ -61,7 +60,6 @@
#define GLX_BAD_CONTEXT 5
typedef struct __DRIswapInfoRec __DRIswapInfo;
typedef struct __DRIutilversionRec2 __DRIutilversion2;
/* Typedefs to avoid rewriting the world. */
typedef struct __DRIscreenRec __DRIscreenPrivate;
@ -525,7 +523,9 @@ struct __DRIscreenRec {
/* Flag to indicate that this is a DRI2 screen. Many of the above
* fields will not be valid or initializaed in that case. */
int enabled;
#ifdef TTM_API
drmBO sareaBO;
#endif
void *sarea;
__DRIEventBuffer *buffer;
__DRILock *lock;
@ -536,22 +536,6 @@ struct __DRIscreenRec {
drmLock *lock;
};
struct __DRIconfigRec {
__GLcontextModes modes;
};
/**
* Used to store a version which includes a major range instead of a single
* major version number.
*/
struct __DRIutilversionRec2 {
int major_min; /** min allowed Major version number. */
int major_max; /** max allowed Major version number. */
int minor; /**< Minor version number. */
int patch; /**< Patch-level. */
};
extern void
__driUtilMessage(const char *f, ...);
@ -566,4 +550,7 @@ extern float
driCalculateSwapUsage( __DRIdrawable *dPriv,
int64_t last_swap_ust, int64_t current_ust );
extern GLint
driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 );
#endif /* _DRI_UTIL_H_ */

View file

@ -419,21 +419,6 @@ driCheckDriDdxDrmVersions2(const char * driver_name,
drmActual, drmExpected);
}
GLint
driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 )
{
if (rect2.x1 > rect1.x1) rect1.x1 = rect2.x1;
if (rect2.x2 < rect1.x2) rect1.x2 = rect2.x2;
if (rect2.y1 > rect1.y1) rect1.y1 = rect2.y1;
if (rect2.y2 < rect1.y2) rect1.y2 = rect2.y2;
if (rect1.x1 > rect1.x2 || rect1.y1 > rect1.y2) return 0;
return (rect1.x2 - rect1.x1) * (rect1.y2 - rect1.y1);
}
GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer,
GLint *x, GLint *y,
GLsizei *width, GLsizei *height )
@ -540,68 +525,62 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
unsigned num_depth_stencil_bits,
const GLenum * db_modes, unsigned num_db_modes)
{
static const u_int8_t bits_table[3][4] = {
static const u_int8_t bits_table[4][4] = {
/* R G B A */
{ 3, 3, 2, 0 }, /* Any GL_UNSIGNED_BYTE_3_3_2 */
{ 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */
{ 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */
{ 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */
};
/* The following arrays are all indexed by the fb_type masked with 0x07.
* Given the four supported fb_type values, this results in valid array
* indices of 3, 4, 5, and 7.
*/
static const u_int32_t masks_table_rgb[8][4] = {
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
static const u_int32_t masks_table_rgb[6][4] = {
{ 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 3_3_2 */
{ 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 2_3_3_REV */
{ 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */
{ 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5_REV */
{ 0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000 }, /* 8_8_8_8 */
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 } /* 8_8_8_8_REV */
};
static const u_int32_t masks_table_rgba[8][4] = {
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
static const u_int32_t masks_table_rgba[6][4] = {
{ 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 3_3_2 */
{ 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 2_3_3_REV */
{ 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */
{ 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5_REV */
{ 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF }, /* 8_8_8_8 */
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 }, /* 8_8_8_8_REV */
};
static const u_int32_t masks_table_bgr[8][4] = {
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
static const u_int32_t masks_table_bgr[6][4] = {
{ 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 3_3_2 */
{ 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 2_3_3_REV */
{ 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */
{ 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5_REV */
{ 0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000 }, /* 8_8_8_8 */
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 }, /* 8_8_8_8_REV */
};
static const u_int32_t masks_table_bgra[8][4] = {
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
static const u_int32_t masks_table_bgra[6][4] = {
{ 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 3_3_2 */
{ 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 2_3_3_REV */
{ 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */
{ 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5_REV */
{ 0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF }, /* 8_8_8_8 */
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 }, /* 8_8_8_8_REV */
};
static const u_int8_t bytes_per_pixel[8] = {
0, 0, 0, 2, 2, 4, 0, 4
static const u_int8_t bytes_per_pixel[6] = {
1, /* 3_3_2 */
1, /* 2_3_3_REV */
2, /* 5_6_5 */
2, /* 5_6_5_REV */
4, /* 8_8_8_8 */
4 /* 8_8_8_8_REV */
};
const u_int8_t * bits;
const u_int32_t * masks;
const int index = fb_type & 0x07;
int index;
__DRIconfig **configs, **c;
__GLcontextModes *modes;
unsigned i;
@ -610,10 +589,29 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
unsigned num_modes;
unsigned num_accum_bits = 2;
if ( bytes_per_pixel[ index ] == 0 ) {
fprintf( stderr, "[%s:%u] Framebuffer type 0x%04x has 0 bytes per pixel.\n",
__FUNCTION__, __LINE__, fb_type );
return NULL;
switch ( fb_type ) {
case GL_UNSIGNED_BYTE_3_3_2:
index = 0;
break;
case GL_UNSIGNED_BYTE_2_3_3_REV:
index = 1;
break;
case GL_UNSIGNED_SHORT_5_6_5:
index = 2;
break;
case GL_UNSIGNED_SHORT_5_6_5_REV:
index = 3;
break;
case GL_UNSIGNED_INT_8_8_8_8:
index = 4;
break;
case GL_UNSIGNED_INT_8_8_8_8_REV:
index = 5;
break;
default:
fprintf( stderr, "[%s:%u] Unknown framebuffer type 0x%04x.\n",
__FUNCTION__, __LINE__, fb_type );
return NULL;
}
@ -625,35 +623,41 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
switch ( fb_format ) {
case GL_RGB:
bits = (bytes_per_pixel[ index ] == 2)
? bits_table[0] : bits_table[1];
masks = masks_table_rgb[ index ];
break;
case GL_RGBA:
bits = (bytes_per_pixel[ index ] == 2)
? bits_table[0] : bits_table[2];
masks = masks_table_rgba[ index ];
break;
case GL_BGR:
bits = (bytes_per_pixel[ index ] == 2)
? bits_table[0] : bits_table[1];
masks = masks_table_bgr[ index ];
break;
case GL_BGRA:
bits = (bytes_per_pixel[ index ] == 2)
? bits_table[0] : bits_table[2];
masks = masks_table_bgra[ index ];
break;
default:
fprintf( stderr, "[%s:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.\n",
__FUNCTION__, __LINE__, fb_format );
fprintf( stderr, "[%s:%u] Unknown framebuffer format 0x%04x.\n",
__FUNCTION__, __LINE__, fb_format );
return NULL;
}
switch ( bytes_per_pixel[ index ] ) {
case 1:
bits = bits_table[0];
break;
case 2:
bits = bits_table[1];
break;
default:
bits = ((fb_format == GL_RGB) || (fb_format == GL_BGR))
? bits_table[2]
: bits_table[3];
break;
}
num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits;
configs = _mesa_calloc((num_modes + 1) * sizeof *configs);
if (configs == NULL)
@ -755,3 +759,114 @@ const __DRIconfig **driConcatConfigs(__DRIconfig **a, __DRIconfig **b)
return all;
}
#define __ATTRIB(attrib, field) \
{ attrib, offsetof(__GLcontextModes, field) }
static const struct { unsigned int attrib, offset; } attribMap[] = {
__ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
__ATTRIB(__DRI_ATTRIB_LEVEL, level),
__ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
__ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
__ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
__ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
__ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
__ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
__ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
__ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
__ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
__ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
__ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
__ATTRIB(__DRI_ATTRIB_FLOAT_MODE, floatMode),
__ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
__ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
__ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
__ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
__ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
__ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture),
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS, bindToTextureTargets),
__ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),
/* The struct field doesn't matter here, these are handled by the
* switch in driGetConfigAttribIndex. We need them in the array
* so the iterator includes them though.*/
__ATTRIB(__DRI_ATTRIB_RENDER_TYPE, level),
__ATTRIB(__DRI_ATTRIB_CONFIG_CAVEAT, level),
__ATTRIB(__DRI_ATTRIB_SWAP_METHOD, level)
};
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
static int
driGetConfigAttribIndex(const __DRIconfig *config,
unsigned int index, unsigned int *value)
{
switch (attribMap[index].attrib) {
case __DRI_ATTRIB_RENDER_TYPE:
if (config->modes.rgbMode)
*value = __DRI_ATTRIB_RGBA_BIT;
else
*value = __DRI_ATTRIB_COLOR_INDEX_BIT;
break;
case __DRI_ATTRIB_CONFIG_CAVEAT:
if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG)
*value = __DRI_ATTRIB_NON_CONFORMANT_CONFIG;
else if (config->modes.visualRating == GLX_SLOW_CONFIG)
*value = __DRI_ATTRIB_SLOW_BIT;
else
*value = 0;
break;
case __DRI_ATTRIB_SWAP_METHOD:
break;
default:
*value = *(unsigned int *)
((char *) &config->modes + attribMap[index].offset);
break;
}
return GL_TRUE;
}
int
driGetConfigAttrib(const __DRIconfig *config,
unsigned int attrib, unsigned int *value)
{
int i;
for (i = 0; i < ARRAY_SIZE(attribMap); i++)
if (attribMap[i].attrib == attrib)
return driGetConfigAttribIndex(config, i, value);
return GL_FALSE;
}
int
driIndexConfigAttrib(const __DRIconfig *config, int index,
unsigned int *attrib, unsigned int *value)
{
if (index >= 0 && index < ARRAY_SIZE(attribMap)) {
*attrib = attribMap[index].attrib;
return driGetConfigAttribIndex(config, index, value);
}
return GL_FALSE;
}

View file

@ -29,8 +29,11 @@
#ifndef DRI_DEBUG_H
#define DRI_DEBUG_H
#include <GL/gl.h>
#include <GL/internal/dri_interface.h>
#include "context.h"
#include "dri_util.h"
typedef struct __DRIutilversionRec2 __DRIutilversion2;
struct dri_debug_control {
const char * string;
@ -84,6 +87,17 @@ struct dri_extension {
const struct dri_extension_function * functions;
};
/**
* Used to store a version which includes a major range instead of a single
* major version number.
*/
struct __DRIutilversionRec2 {
int major_min; /** min allowed Major version number. */
int major_max; /** max allowed Major version number. */
int minor; /**< Minor version number. */
int patch; /**< Patch-level. */
};
extern unsigned driParseDebugString( const char * debug,
const struct dri_debug_control * control );
@ -106,12 +120,14 @@ extern GLboolean driCheckDriDdxDrmVersions3(const char * driver_name,
const __DRIversion * ddxActual, const __DRIutilversion2 * ddxExpected,
const __DRIversion * drmActual, const __DRIversion * drmExpected);
extern GLint driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 );
extern GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer,
GLint *x, GLint *y,
GLsizei *width, GLsizei *height );
struct __DRIconfigRec {
__GLcontextModes modes;
};
extern __DRIconfig **
driCreateConfigs(GLenum fb_format, GLenum fb_type,
const u_int8_t * depth_bits, const u_int8_t * stencil_bits,
@ -120,4 +136,11 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
const __DRIconfig **driConcatConfigs(__DRIconfig **a, __DRIconfig **b);
int
driGetConfigAttrib(const __DRIconfig *config,
unsigned int attrib, unsigned int *value);
int
driIndexConfigAttrib(const __DRIconfig *config, int index,
unsigned int *attrib, unsigned int *value);
#endif /* DRI_DEBUG_H */

View file

@ -260,8 +260,8 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd )
if ( first_time ) {
fprintf(stderr,
"%s: drmWaitVBlank returned %d, IRQs don't seem to be"
" working correctly.\nTry running with LIBGL_THROTTLE_REFRESH"
" and LIBL_SYNC_REFRESH unset.\n", __FUNCTION__, ret);
" working correctly.\nTry adjusting the vblank_mode"
" configuration parameter.\n", __FUNCTION__, ret);
first_time = GL_FALSE;
}

View file

@ -57,8 +57,8 @@ all: options.h
# Only intermediate files are cleaned up. options.h is not deleted because
# it's in CVS.
clean:
rm -f $(POT) *~
rm -rf $(LANGS)
-rm -f $(POT) *~
-rm -rf $(LANGS)
# Default target options.h
options.h: t_options.h mo

View file

@ -1,84 +0,0 @@
# src/mesa/drivers/dri/glcore/Makefile
TOP = ../../../../..
include $(TOP)/configs/current
LIBNAME = glcore_dri.so
DRIVER_SOURCES = glcore_driver.c \
$(TOP)/src/mesa/drivers/common/driverfuncs.c \
../common/dri_util.c
C_SOURCES = \
$(DRIVER_SOURCES) \
$(DRI_SOURCES)
# Include directories
INCLUDE_DIRS = \
-I. \
-I../common \
-I../dri_client \
-I../dri_client/imports \
-Iserver \
-I$(TOP)/include \
-I$(DRM_SOURCE_PATH)/shared-core \
-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
# Core Mesa objects
MESA_MODULES = $(TOP)/src/mesa/libmesa.a
# Libraries that the driver shared lib depends on
LIB_DEPS = -lm -lpthread -lc
# LIB_DEPS = -lGL -lm -lpthread -lc
ASM_SOURCES =
OBJECTS = $(C_SOURCES:.c=.o) \
$(ASM_SOURCES:.S=.o)
##### RULES #####
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(DEFINES) $< -o $@
.S.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(DEFINES) $< -o $@
##### TARGETS #####
default: depend $(TOP)/$(LIB_DIR)/$(LIBNAME)
$(TOP)/$(LIB_DIR)/$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile
CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(LIBNAME) -noprefix \
-ldflags '$(LDFLAGS)' -install $(TOP)/$(LIB_DIR) \
$(OBJECTS) $(WINLIB) $(LIB_DEPS) $(WINOBJ) $(MESA_MODULES)
depend: $(C_SOURCES) $(ASM_SOURCES)
touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDE_DIRS) $(C_SOURCES) $(ASM_SOURCES) \
> /dev/null
# Emacs tags
tags:
etags `find . -name \*.[ch]` `find ../include`
clean:
-rm -f *.o server/*.o
include depend

View file

@ -1,128 +0,0 @@
/*
* Copyright 2006 Red Hat, Inc.
*
* 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
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS 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.
*/
/*
* This implements a software-only "DRI" driver. It doesn't actually speak
* any DRI protocol or talk to the DRM, it just looks enough like a DRI driver
* that libglx in the server can load it for software rendering in the
* unaccelerated case.
*/
static GLboolean
glcoreInitDriver(__DRIscreenPrivate *driScreenPriv)
{
}
static void
glcoreDestroyScreen(__DRIScreenPrivate *driScreenPriv)
{
}
static GLboolean
glcoreCreateContext(const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
void *shared_context)
{
}
static void
glcoreDestroyContext(__DRIcontextPrivate *driContextPriv)
{
}
static GLboolean
glcoreCreateBuffer(__DRIscreenPrivate *driScreenPriv,
__DRIdrawablePrivate *driDrawablePriv,
const __GLcontextModes *mesaVisual,
GLboolean isPixmap)
{
}
static void
glcoreDestroyBuffer(__DRIdrawablePrivate *driDrawablePriv)
{
}
static void
glcoreSwapBuffers(__DRIdrawablePrivate *driDrawablePriv)
{
}
static GLboolean
glcoreMakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawablePriv,
__DRIdrawablePrivate *driReadablePriv)
{
}
static GLboolean
glcoreUnbindContext(__DRIcontextPrivate *driContextPriv)
{
}
static struct __DriverAPIRec glcore_api = {
.InitDriver = glcoreInitDriver,
.DestroyScreen = glcoreDestroyScreen,
.CreateContext = glcoreCreateContext,
.DestroyContext = glcoreDestroyContext,
.CreateBuffer = glcoreCreateBuffer,
.DestroyBuffer = glcoreDestroyBuffer,
.SwapBuffers = glcoreSwapBuffers,
.MakeCurrent = glcoreMakeCurrent,
.UnbindContext = glcoreUnbindContext,
};
static __GLcontextModes *
glcoreFillInModes(unsigned pixel_bits)
{
}
PUBLIC void *
__driCreateNewScreen_20050727(__DRInativeDisplay *dpy, int scrn,
__DRIscreen *psc, const __GLcontextModes *modes,
const __DRIversion *ddx_version,
const __DRIversion *dri_version,
const __DRIversion *drm_version,
const __DRIframebuffer *fb, drmAddress pSarea,
int fd, int internal_api_version,
const ___DRIinterfaceMethods *interface,
__GLcontextModes **driver_modes)
{
__DRIscreenPrivate *driScreenPriv;
glcoreDriverPrivate *glcoreDriverPriv;
/* would normally check ddx/dri/drm versions here */
driScreenPriv = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, ddx_version,
dri_version, drm_version, fb,
internal_api_version, &glcore_api);
if (!driScreenPriv)
return NULL;
glcoreDriverPriv = driScreenPriv->pDrvPriv;
*driver_modes = glcoreFillInModes(glcoreDriverPriv->bpp);
driInitExtensions(NULL, NULL, GL_FALSE);
return driScreenPriv;
}

View file

@ -257,10 +257,12 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
struct intel_context *intel = intel_context(ctx);
struct brw_context *brw = brw_context(ctx);
GLboolean retval = GL_FALSE;
GLuint i, ret;
GLuint i;
GLuint ib_offset;
dri_bo *ib_bo;
GLboolean force_flush = GL_FALSE;
int ret;
if (ctx->NewState)
_mesa_update_state( ctx );
@ -316,6 +318,14 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
goto flush;
}
/* Various fallback checks:
*/
if (brw->intel.Fallback)
goto out;
if (check_fallbacks( brw, prim, nr_prims ))
goto out;
/* need to account for index buffer and vertex buffer */
if (ib) {
ret = brw_prepare_indices( brw, ib , &ib_bo, &ib_offset);
@ -333,16 +343,6 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
force_flush = GL_TRUE;
goto flush;
}
/* Various fallback checks:
*/
if (brw->intel.Fallback)
goto out;
if (check_fallbacks( brw, prim, nr_prims ))
goto out;
/* Upload index, vertex data:
*/

View file

@ -401,6 +401,7 @@ int brw_prepare_vertices( struct brw_context *brw,
*/
copy_array_to_vbo_array(brw, upload[0], interleave);
ret |= dri_bufmgr_check_aperture_space(upload[0]->bo);
for (i = 1; i < nr_uploads; i++) {
/* Then, just point upload[i] at upload[0]'s buffer. */
upload[i]->stride = interleave;
@ -413,13 +414,13 @@ int brw_prepare_vertices( struct brw_context *brw,
else {
/* Upload non-interleaved arrays */
for (i = 0; i < nr_uploads; i++) {
copy_array_to_vbo_array(brw, upload[i], upload[i]->element_size);
copy_array_to_vbo_array(brw, upload[i], upload[i]->element_size);
if (upload[i]->bo) {
ret |= dri_bufmgr_check_aperture_space(upload[i]->bo);
}
}
}
if (brw->vb.upload.bo) {
ret |= dri_bufmgr_check_aperture_space(brw->vb.upload.bo);
}
if (ret)
return 1;

View file

@ -150,6 +150,7 @@ intel_batch_ioctl(struct intel_context *intel,
return 0;
}
#ifdef TTM_API
int
intel_exec_ioctl(struct intel_context *intel,
GLuint used,
@ -183,3 +184,13 @@ intel_exec_ioctl(struct intel_context *intel,
return 0;
}
#else
int
int intel_exec_ioctl(struct intel_context *intel,
GLuint used,
GLboolean ignore_cliprects, GLboolean allow_unlock,
struct drm_i915_gem_execbuffer *execbuf);
{
return -EINVAL;
}
#endif

View file

@ -172,14 +172,13 @@ timed_memcpy(void *dest, const void *src, size_t n)
*/
void
intel_generate_mipmap(GLcontext *ctx, GLenum target,
const struct gl_texture_unit *texUnit,
struct gl_texture_object *texObj)
{
struct intel_texture_object *intelObj = intel_texture_object(texObj);
GLuint nr_faces = (intelObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
int face, i;
_mesa_generate_mipmap(ctx, target, texUnit, texObj);
_mesa_generate_mipmap(ctx, target, texObj);
/* Update the level information in our private data in the new images, since
* it didn't get set as part of a normal TexImage path.
@ -198,6 +197,15 @@ intel_generate_mipmap(GLcontext *ctx, GLenum target,
}
}
static void intelGenerateMipmap(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj)
{
struct intel_context *intel = intel_context(ctx);
struct intel_texture_object *intelObj = intel_texture_object(texObj);
intel_tex_map_images(intel, intelObj);
intel_generate_mipmap(ctx, target, texObj);
intel_tex_unmap_images(intel, intelObj);
}
void
intelInitTextureFuncs(struct dd_function_table *functions)
@ -221,6 +229,7 @@ intelInitTextureFuncs(struct dd_function_table *functions)
functions->CopyTexSubImage2D = _swrast_copy_texsubimage2d;
#endif
functions->GetTexImage = intelGetTexImage;
functions->GenerateMipmap = intelGenerateMipmap;
/* compressed texture functions */
functions->CompressedTexImage2D = intelCompressedTexImage2D;

View file

@ -151,7 +151,6 @@ void intel_tex_unmap_images(struct intel_context *intel,
int intel_compressed_num_bytes(GLuint mesaFormat);
void intel_generate_mipmap(GLcontext *ctx, GLenum target,
const struct gl_texture_unit *texUnit,
struct gl_texture_object *texObj);
#endif

View file

@ -161,9 +161,7 @@ do_copy_texsubimage(struct intel_context *intel,
/* GL_SGIS_generate_mipmap */
if (intelImage->level == texObj->BaseLevel && texObj->GenerateMipmap) {
intel_generate_mipmap(ctx, target,
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
texObj);
intel_generate_mipmap(ctx, target, texObj);
}
return GL_TRUE;

View file

@ -522,9 +522,7 @@ intelTexImage(GLcontext * ctx,
/* GL_SGIS_generate_mipmap */
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
intel_generate_mipmap(ctx, target,
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
texObj);
intel_generate_mipmap(ctx, target, texObj);
}
_mesa_unmap_teximage_pbo(ctx, unpack);

View file

@ -103,9 +103,7 @@ intelTexSubimage(GLcontext * ctx,
/* GL_SGIS_generate_mipmap */
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
intel_generate_mipmap(ctx, target,
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
texObj);
intel_generate_mipmap(ctx, target, texObj);
}
_mesa_unmap_teximage_pbo(ctx, packing);

View file

@ -477,16 +477,18 @@ void r200CopyBuffer( __DRIdrawablePrivate *dPriv,
if (rect->y2 < b->y2)
b->y2 = rect->y2;
if (b->x1 < b->x2 && b->y1 < b->y2)
b++;
if (b->x1 >= b->x2 || b->y1 >= b->y2)
continue;
}
else
b++;
b++;
n++;
}
rmesa->sarea->nbox = n;
if (!n)
continue;
ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_SWAP );
if ( ret ) {

View file

@ -39,6 +39,7 @@ DRIVER_SOURCES = \
r300_texstate.c \
r300_vertprog.c \
r300_fragprog.c \
r500_fragprog.c \
r300_shader.c \
r300_emit.c \
r300_swtcl.c \

View file

@ -164,7 +164,7 @@ static inline void r300EmitAtoms(r300ContextPtr r300, GLboolean dirty)
r300->cmdbuf.count_used++;
/* Emit cache flush */
*dest = cmdpacket0(R300_TX_CNTL, 1);
*dest = cmdpacket0(R300_TX_INVALTAGS, 1);
dest++;
r300->cmdbuf.count_used++;
@ -242,6 +242,7 @@ void r300EmitState(r300ContextPtr r300)
#define packet0_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->packet0.count)
#define vpu_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count)
#define r500fp_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->r500fp.count)
static int check_always(r300ContextPtr r300, struct r300_state_atom *atom)
{
@ -262,6 +263,20 @@ static int check_vpu(r300ContextPtr r300, struct r300_state_atom *atom)
return cnt ? (cnt * 4) + 1 : 0;
}
static int check_r500fp(r300ContextPtr r300, struct r300_state_atom *atom)
{
int cnt;
cnt = r500fp_count(atom->cmd);
return cnt ? (cnt * 6) + 1 : 0;
}
static int check_r500fp_const(r300ContextPtr r300, struct r300_state_atom *atom)
{
int cnt;
cnt = r500fp_count(atom->cmd);
return cnt ? (cnt * 4) + 1 : 0;
}
#define ALLOC_STATE( ATOM, CHK, SZ, IDX ) \
do { \
r300->hw.ATOM.cmd_size = (SZ); \
@ -281,10 +296,15 @@ void r300InitCmdBuf(r300ContextPtr r300)
{
int size, mtu;
int has_tcl = 1;
int is_r500 = 0;
int i;
if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL))
has_tcl = 0;
if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515)
is_r500 = 1;
r300->hw.max_state_size = 2 + 2; /* reserve extra space for WAIT_IDLE and tex cache flush */
mtu = r300->radeon.glCtx->Const.MaxTextureUnits;
@ -299,8 +319,15 @@ void r300InitCmdBuf(r300ContextPtr r300)
/* Initialize state atoms */
ALLOC_STATE(vpt, always, R300_VPT_CMDSIZE, 0);
r300->hw.vpt.cmd[R300_VPT_CMD_0] = cmdpacket0(R300_SE_VPORT_XSCALE, 6);
ALLOC_STATE(vap_cntl, always, 2, 0);
r300->hw.vap_cntl.cmd[0] = cmdpacket0(R300_VAP_CNTL, 1);
ALLOC_STATE(vap_cntl, always, R300_VAP_CNTL_SIZE, 0);
r300->hw.vap_cntl.cmd[R300_VAP_CNTL_FLUSH] = cmdpacket0(R300_VAP_PVS_STATE_FLUSH_REG, 1);
r300->hw.vap_cntl.cmd[R300_VAP_CNTL_FLUSH_1] = 0;
r300->hw.vap_cntl.cmd[R300_VAP_CNTL_CMD] = cmdpacket0(R300_VAP_CNTL, 1);
if (is_r500) {
ALLOC_STATE(vap_index_offset, always, 2, 0);
r300->hw.vap_index_offset.cmd[0] = cmdpacket0(R500_VAP_INDEX_OFFSET, 1);
r300->hw.vap_index_offset.cmd[1] = 0;
}
ALLOC_STATE(vte, always, 3, 0);
r300->hw.vte.cmd[0] = cmdpacket0(R300_SE_VTE_CNTL, 2);
ALLOC_STATE(vap_vf_max_vtx_indx, always, 3, 0);
@ -309,12 +336,12 @@ void r300InitCmdBuf(r300ContextPtr r300)
r300->hw.vap_cntl_status.cmd[0] = cmdpacket0(R300_VAP_CNTL_STATUS, 1);
ALLOC_STATE(vir[0], variable, R300_VIR_CMDSIZE, 0);
r300->hw.vir[0].cmd[R300_VIR_CMD_0] =
cmdpacket0(R300_VAP_INPUT_ROUTE_0_0, 1);
cmdpacket0(R300_VAP_PROG_STREAM_CNTL_0, 1);
ALLOC_STATE(vir[1], variable, R300_VIR_CMDSIZE, 1);
r300->hw.vir[1].cmd[R300_VIR_CMD_0] =
cmdpacket0(R300_VAP_INPUT_ROUTE_1_0, 1);
cmdpacket0(R300_VAP_PROG_STREAM_CNTL_EXT_0, 1);
ALLOC_STATE(vic, always, R300_VIC_CMDSIZE, 0);
r300->hw.vic.cmd[R300_VIC_CMD_0] = cmdpacket0(R300_VAP_INPUT_CNTL_0, 2);
r300->hw.vic.cmd[R300_VIC_CMD_0] = cmdpacket0(R300_VAP_VTX_STATE_CNTL, 2);
ALLOC_STATE(vap_psc_sgn_norm_cntl, always, 2, 0);
r300->hw.vap_psc_sgn_norm_cntl.cmd[0] = cmdpacket0(R300_VAP_PSC_SGN_NORM_CNTL, SGN_NORM_ZERO_CLAMP_MINUS_ONE);
@ -322,7 +349,7 @@ void r300InitCmdBuf(r300ContextPtr r300)
ALLOC_STATE(vap_clip_cntl, always, 2, 0);
r300->hw.vap_clip_cntl.cmd[0] = cmdpacket0(R300_VAP_CLIP_CNTL, 1);
ALLOC_STATE(vap_clip, always, 5, 0);
r300->hw.vap_clip.cmd[0] = cmdpacket0(R300_VAP_CLIP_X_0, 4);
r300->hw.vap_clip.cmd[0] = cmdpacket0(R300_VAP_GB_VERT_CLIP_ADJ, 4);
ALLOC_STATE(vap_pvs_vtx_timeout_reg, always, 2, 0);
r300->hw.vap_pvs_vtx_timeout_reg.cmd[0] = cmdpacket0(VAP_PVS_VTX_TIMEOUT_REG, 1);
}
@ -334,7 +361,7 @@ void r300InitCmdBuf(r300ContextPtr r300)
if (has_tcl) {
ALLOC_STATE(pvs, always, R300_PVS_CMDSIZE, 0);
r300->hw.pvs.cmd[R300_PVS_CMD_0] =
cmdpacket0(R300_VAP_PVS_CNTL_1, 3);
cmdpacket0(R300_VAP_PVS_CODE_CNTL_0, 3);
}
ALLOC_STATE(gb_enable, always, 2, 0);
@ -344,69 +371,99 @@ void r300InitCmdBuf(r300ContextPtr r300)
ALLOC_STATE(txe, always, R300_TXE_CMDSIZE, 0);
r300->hw.txe.cmd[R300_TXE_CMD_0] = cmdpacket0(R300_TX_ENABLE, 1);
ALLOC_STATE(ga_point_s0, always, 5, 0);
r300->hw.ga_point_s0.cmd[0] = cmdpacket0(GA_POINT_S0, 4);
r300->hw.ga_point_s0.cmd[0] = cmdpacket0(R300_GA_POINT_S0, 4);
ALLOC_STATE(ga_triangle_stipple, always, 2, 0);
r300->hw.ga_triangle_stipple.cmd[0] = cmdpacket0(GA_TRIANGLE_STIPPLE, 1);
r300->hw.ga_triangle_stipple.cmd[0] = cmdpacket0(R300_GA_TRIANGLE_STIPPLE, 1);
ALLOC_STATE(ps, always, R300_PS_CMDSIZE, 0);
r300->hw.ps.cmd[0] = cmdpacket0(R300_GA_POINT_SIZE, 1);
ALLOC_STATE(ga_point_minmax, always, 4, 0);
r300->hw.ga_point_minmax.cmd[0] = cmdpacket0(R300_GA_POINT_MINMAX, 3);
ALLOC_STATE(lcntl, always, 2, 0);
r300->hw.lcntl.cmd[0] = cmdpacket0(GA_LINE_CNTL, 1);
r300->hw.lcntl.cmd[0] = cmdpacket0(R300_GA_LINE_CNTL, 1);
ALLOC_STATE(ga_line_stipple, always, 4, 0);
r300->hw.ga_line_stipple.cmd[0] = cmdpacket0(R300_GA_LINE_STIPPLE_VALUE, 3);
ALLOC_STATE(shade, always, 5, 0);
r300->hw.shade.cmd[0] = cmdpacket0(GA_ENHANCE, 4);
r300->hw.shade.cmd[0] = cmdpacket0(R300_GA_ENHANCE, 4);
ALLOC_STATE(polygon_mode, always, 4, 0);
r300->hw.polygon_mode.cmd[0] = cmdpacket0(GA_POLY_MODE, 3);
r300->hw.polygon_mode.cmd[0] = cmdpacket0(R300_GA_POLY_MODE, 3);
ALLOC_STATE(fogp, always, 3, 0);
r300->hw.fogp.cmd[0] = cmdpacket0(R300_RE_FOG_SCALE, 2);
r300->hw.fogp.cmd[0] = cmdpacket0(R300_GA_FOG_SCALE, 2);
ALLOC_STATE(zbias_cntl, always, 2, 0);
r300->hw.zbias_cntl.cmd[0] = cmdpacket0(R300_RE_ZBIAS_CNTL, 1);
r300->hw.zbias_cntl.cmd[0] = cmdpacket0(R300_SU_TEX_WRAP, 1);
ALLOC_STATE(zbs, always, R300_ZBS_CMDSIZE, 0);
r300->hw.zbs.cmd[R300_ZBS_CMD_0] =
cmdpacket0(R300_RE_ZBIAS_T_FACTOR, 4);
cmdpacket0(R300_SU_POLY_OFFSET_FRONT_SCALE, 4);
ALLOC_STATE(occlusion_cntl, always, 2, 0);
r300->hw.occlusion_cntl.cmd[0] = cmdpacket0(R300_RE_OCCLUSION_CNTL, 1);
r300->hw.occlusion_cntl.cmd[0] = cmdpacket0(R300_SU_POLY_OFFSET_ENABLE, 1);
ALLOC_STATE(cul, always, R300_CUL_CMDSIZE, 0);
r300->hw.cul.cmd[R300_CUL_CMD_0] = cmdpacket0(R300_RE_CULL_CNTL, 1);
r300->hw.cul.cmd[R300_CUL_CMD_0] = cmdpacket0(R300_SU_CULL_MODE, 1);
ALLOC_STATE(su_depth_scale, always, 3, 0);
r300->hw.su_depth_scale.cmd[0] = cmdpacket0(R300_SU_DEPTH_SCALE, 2);
ALLOC_STATE(rc, always, R300_RC_CMDSIZE, 0);
r300->hw.rc.cmd[R300_RC_CMD_0] = cmdpacket0(R300_RS_COUNT, 2);
ALLOC_STATE(ri, always, R300_RI_CMDSIZE, 0);
r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(R300_RS_IP_0, 8);
ALLOC_STATE(rr, variable, R300_RR_CMDSIZE, 0);
r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_INST_0, 1);
if (is_r500) {
ALLOC_STATE(ri, always, R500_RI_CMDSIZE, 0);
r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(R500_RS_IP_0, 16);
for (i = 0; i < 8; i++) {
r300->hw.ri.cmd[R300_RI_CMD_0 + i +1] =
(R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_S_SHIFT) |
(R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT) |
(R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT) |
(R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT);
}
ALLOC_STATE(rr, variable, R300_RR_CMDSIZE, 0);
r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R500_RS_INST_0, 1);
} else {
ALLOC_STATE(ri, always, R300_RI_CMDSIZE, 0);
r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(R300_RS_IP_0, 8);
ALLOC_STATE(rr, variable, R300_RR_CMDSIZE, 0);
r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_INST_0, 1);
}
ALLOC_STATE(sc_hyperz, always, 3, 0);
r300->hw.sc_hyperz.cmd[0] = cmdpacket0(R300_SC_HYPERZ, 2);
ALLOC_STATE(sc_screendoor, always, 2, 0);
r300->hw.sc_screendoor.cmd[0] = cmdpacket0(R300_SC_SCREENDOOR, 1);
ALLOC_STATE(fp, always, R300_FP_CMDSIZE, 0);
r300->hw.fp.cmd[R300_FP_CMD_0] = cmdpacket0(R300_PFS_CNTL_0, 3);
r300->hw.fp.cmd[R300_FP_CMD_1] = cmdpacket0(R300_PFS_NODE_0, 4);
ALLOC_STATE(fpt, variable, R300_FPT_CMDSIZE, 0);
r300->hw.fpt.cmd[R300_FPT_CMD_0] = cmdpacket0(R300_PFS_TEXI_0, 0);
ALLOC_STATE(us_out_fmt, always, 6, 0);
r300->hw.us_out_fmt.cmd[0] = cmdpacket0(R500_US_OUT_FMT, 5);
ALLOC_STATE(fpi[0], variable, R300_FPI_CMDSIZE, 0);
r300->hw.fpi[0].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR0_0, 1);
ALLOC_STATE(fpi[1], variable, R300_FPI_CMDSIZE, 1);
r300->hw.fpi[1].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR1_0, 1);
ALLOC_STATE(fpi[2], variable, R300_FPI_CMDSIZE, 2);
r300->hw.fpi[2].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR2_0, 1);
ALLOC_STATE(fpi[3], variable, R300_FPI_CMDSIZE, 3);
r300->hw.fpi[3].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR3_0, 1);
r300->hw.us_out_fmt.cmd[0] = cmdpacket0(R300_US_OUT_FMT, 5);
if (is_r500) {
ALLOC_STATE(fp, always, R500_FP_CMDSIZE, 0);
r300->hw.fp.cmd[R500_FP_CMD_0] = cmdpacket0(R500_US_CONFIG, 2);
r300->hw.fp.cmd[R500_FP_CNTL] = R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO;
r300->hw.fp.cmd[R500_FP_CMD_1] = cmdpacket0(R500_US_CODE_ADDR, 3);
r300->hw.fp.cmd[R500_FP_CMD_2] = cmdpacket0(R500_US_FC_CTRL, 1);
r300->hw.fp.cmd[R500_FP_FC_CNTL] = 0; /* FIXME when we add flow control */
ALLOC_STATE(r500fp, r500fp, R500_FPI_CMDSIZE, 0);
r300->hw.r500fp.cmd[R300_FPI_CMD_0] = cmdr500fp(0, 0, 0, 0);
ALLOC_STATE(r500fp_const, r500fp_const, R500_FPP_CMDSIZE, 0);
r300->hw.r500fp_const.cmd[R300_FPI_CMD_0] = cmdr500fp(0, 0, 1, 0);
} else {
ALLOC_STATE(fp, always, R300_FP_CMDSIZE, 0);
r300->hw.fp.cmd[R300_FP_CMD_0] = cmdpacket0(R300_US_CONFIG, 3);
r300->hw.fp.cmd[R300_FP_CMD_1] = cmdpacket0(R300_US_CODE_ADDR_0, 4);
ALLOC_STATE(fpt, variable, R300_FPT_CMDSIZE, 0);
r300->hw.fpt.cmd[R300_FPT_CMD_0] = cmdpacket0(R300_US_TEX_INST_0, 0);
ALLOC_STATE(fpi[0], variable, R300_FPI_CMDSIZE, 0);
r300->hw.fpi[0].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_US_ALU_RGB_INST_0, 1);
ALLOC_STATE(fpi[1], variable, R300_FPI_CMDSIZE, 1);
r300->hw.fpi[1].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_US_ALU_RGB_ADDR_0, 1);
ALLOC_STATE(fpi[2], variable, R300_FPI_CMDSIZE, 2);
r300->hw.fpi[2].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_US_ALU_ALPHA_INST_0, 1);
ALLOC_STATE(fpi[3], variable, R300_FPI_CMDSIZE, 3);
r300->hw.fpi[3].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_US_ALU_ALPHA_ADDR_0, 1);
ALLOC_STATE(fpp, variable, R300_FPP_CMDSIZE, 0);
r300->hw.fpp.cmd[R300_FPP_CMD_0] = cmdpacket0(R300_PFS_PARAM_0_X, 0);
}
ALLOC_STATE(fogs, always, R300_FOGS_CMDSIZE, 0);
r300->hw.fogs.cmd[R300_FOGS_CMD_0] = cmdpacket0(FG_FOG_BLEND, 1);
r300->hw.fogs.cmd[R300_FOGS_CMD_0] = cmdpacket0(R300_FG_FOG_BLEND, 1);
ALLOC_STATE(fogc, always, R300_FOGC_CMDSIZE, 0);
r300->hw.fogc.cmd[R300_FOGC_CMD_0] = cmdpacket0(FG_FOG_COLOR_R, 3);
r300->hw.fogc.cmd[R300_FOGC_CMD_0] = cmdpacket0(R300_FG_FOG_COLOR_R, 3);
ALLOC_STATE(at, always, R300_AT_CMDSIZE, 0);
r300->hw.at.cmd[R300_AT_CMD_0] = cmdpacket0(FG_ALPHA_FUNC, 2);
r300->hw.at.cmd[R300_AT_CMD_0] = cmdpacket0(R300_FG_ALPHA_FUNC, 2);
ALLOC_STATE(fg_depth_src, always, 2, 0);
r300->hw.fg_depth_src.cmd[0] = cmdpacket0(R300_FG_DEPTH_SRC, 1);
ALLOC_STATE(fpp, variable, R300_FPP_CMDSIZE, 0);
r300->hw.fpp.cmd[R300_FPP_CMD_0] = cmdpacket0(R300_PFS_PARAM_0_X, 0);
ALLOC_STATE(rb3d_cctl, always, 2, 0);
r300->hw.rb3d_cctl.cmd[0] = cmdpacket0(R300_RB3D_CCTL, 1);
ALLOC_STATE(bld, always, R300_BLD_CMDSIZE, 0);
@ -421,45 +478,61 @@ void r300InitCmdBuf(r300ContextPtr r300)
ALLOC_STATE(rb3d_dither_ctl, always, 10, 0);
r300->hw.rb3d_dither_ctl.cmd[0] = cmdpacket0(R300_RB3D_DITHER_CTL, 9);
ALLOC_STATE(rb3d_aaresolve_ctl, always, 2, 0);
r300->hw.rb3d_aaresolve_ctl.cmd[0] = cmdpacket0(RB3D_AARESOLVE_CTL, 1);
r300->hw.rb3d_aaresolve_ctl.cmd[0] = cmdpacket0(R300_RB3D_AARESOLVE_CTL, 1);
ALLOC_STATE(rb3d_discard_src_pixel_lte_threshold, always, 3, 0);
r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[0] = cmdpacket0(RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 2);
r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[0] = cmdpacket0(R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 2);
ALLOC_STATE(zs, always, R300_ZS_CMDSIZE, 0);
r300->hw.zs.cmd[R300_ZS_CMD_0] =
cmdpacket0(R300_RB3D_ZSTENCIL_CNTL_0, 3);
cmdpacket0(R300_ZB_CNTL, 3);
ALLOC_STATE(zstencil_format, always, 5, 0);
r300->hw.zstencil_format.cmd[0] =
cmdpacket0(ZB_FORMAT, 4);
cmdpacket0(R300_ZB_FORMAT, 4);
ALLOC_STATE(zb, always, R300_ZB_CMDSIZE, 0);
r300->hw.zb.cmd[R300_ZB_CMD_0] = cmdpacket0(ZB_DEPTHOFFSET, 2);
r300->hw.zb.cmd[R300_ZB_CMD_0] = cmdpacket0(R300_ZB_DEPTHOFFSET, 2);
ALLOC_STATE(zb_depthclearvalue, always, 2, 0);
r300->hw.zb_depthclearvalue.cmd[0] = cmdpacket0(ZB_DEPTHCLEARVALUE, 1);
r300->hw.zb_depthclearvalue.cmd[0] = cmdpacket0(R300_ZB_DEPTHCLEARVALUE, 1);
ALLOC_STATE(unk4F30, always, 3, 0);
r300->hw.unk4F30.cmd[0] = cmdpacket0(0x4F30, 2);
ALLOC_STATE(zb_hiz_offset, always, 2, 0);
r300->hw.zb_hiz_offset.cmd[0] = cmdpacket0(ZB_HIZ_OFFSET, 1);
r300->hw.zb_hiz_offset.cmd[0] = cmdpacket0(R300_ZB_HIZ_OFFSET, 1);
ALLOC_STATE(zb_hiz_pitch, always, 2, 0);
r300->hw.zb_hiz_pitch.cmd[0] = cmdpacket0(ZB_HIZ_PITCH, 1);
r300->hw.zb_hiz_pitch.cmd[0] = cmdpacket0(R300_ZB_HIZ_PITCH, 1);
/* VPU only on TCL */
if (has_tcl) {
int i;
ALLOC_STATE(vpi, vpu, R300_VPI_CMDSIZE, 0);
r300->hw.vpi.cmd[R300_VPI_CMD_0] =
cmdvpu(R300_PVS_UPLOAD_PROGRAM, 0);
cmdvpu(R300_PVS_CODE_START, 0);
ALLOC_STATE(vpp, vpu, R300_VPP_CMDSIZE, 0);
r300->hw.vpp.cmd[R300_VPP_CMD_0] =
cmdvpu(R300_PVS_UPLOAD_PARAMETERS, 0);
if (is_r500) {
ALLOC_STATE(vpp, vpu, R300_VPP_CMDSIZE, 0);
r300->hw.vpp.cmd[R300_VPP_CMD_0] =
cmdvpu(R500_PVS_CONST_START, 0);
ALLOC_STATE(vps, vpu, R300_VPS_CMDSIZE, 0);
r300->hw.vps.cmd[R300_VPS_CMD_0] =
cmdvpu(R300_PVS_UPLOAD_POINTSIZE, 1);
ALLOC_STATE(vps, vpu, R300_VPS_CMDSIZE, 0);
r300->hw.vps.cmd[R300_VPS_CMD_0] =
cmdvpu(R500_POINT_VPORT_SCALE_OFFSET, 1);
for (i = 0; i < 6; i++) {
ALLOC_STATE(vpucp[i], vpu, R300_VPUCP_CMDSIZE, 0);
r300->hw.vpucp[i].cmd[R300_VPUCP_CMD_0] =
cmdvpu(R300_PVS_UPLOAD_CLIP_PLANE0+i, 1);
for (i = 0; i < 6; i++) {
ALLOC_STATE(vpucp[i], vpu, R300_VPUCP_CMDSIZE, 0);
r300->hw.vpucp[i].cmd[R300_VPUCP_CMD_0] =
cmdvpu(R500_PVS_UCP_START + i, 1);
}
} else {
ALLOC_STATE(vpp, vpu, R300_VPP_CMDSIZE, 0);
r300->hw.vpp.cmd[R300_VPP_CMD_0] =
cmdvpu(R300_PVS_CONST_START, 0);
ALLOC_STATE(vps, vpu, R300_VPS_CMDSIZE, 0);
r300->hw.vps.cmd[R300_VPS_CMD_0] =
cmdvpu(R300_POINT_VPORT_SCALE_OFFSET, 1);
for (i = 0; i < 6; i++) {
ALLOC_STATE(vpucp[i], vpu, R300_VPUCP_CMDSIZE, 0);
r300->hw.vpucp[i].cmd[R300_VPUCP_CMD_0] =
cmdvpu(R300_PVS_UCP_START + i, 1);
}
}
}

View file

@ -278,6 +278,11 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
ctx->Const.MaxTextureCoordUnits);
ctx->Const.MaxTextureMaxAnisotropy = 16.0;
if (screen->chip_family >= CHIP_FAMILY_RV515) {
ctx->Const.MaxTextureLevels = 13;
ctx->Const.MaxTextureRectSize = 4096;
}
ctx->Const.MinPointSize = 1.0;
ctx->Const.MinPointSizeAA = 1.0;
ctx->Const.MaxPointSize = R300_POINTSIZE_MAX;

View file

@ -74,6 +74,7 @@ typedef struct r300_context *r300ContextPtr;
#include "r300_vertprog.h"
#include "r300_fragprog.h"
#include "r500_fragprog.h"
/**
* This function takes a float and packs it into a uint32_t
@ -330,6 +331,8 @@ struct r300_state_atom {
#define R300_RI_INTERP_7 8
#define R300_RI_CMDSIZE 9
#define R500_RI_CMDSIZE 17
#define R300_RR_CMD_0 0 /* rr is variable size (at least 1) */
#define R300_RR_INST_0 1
#define R300_RR_INST_1 2
@ -352,6 +355,17 @@ struct r300_state_atom {
#define R300_FP_NODE3 8
#define R300_FP_CMDSIZE 9
#define R500_FP_CMD_0 0
#define R500_FP_CNTL 1
#define R500_FP_PIXSIZE 2
#define R500_FP_CMD_1 3
#define R500_FP_CODE_ADDR 4
#define R500_FP_CODE_RANGE 5
#define R500_FP_CODE_OFFSET 6
#define R500_FP_CMD_2 7
#define R500_FP_FC_CNTL 8
#define R500_FP_CMDSIZE 9
#define R300_FPT_CMD_0 0
#define R300_FPT_INSTR_0 1
#define R300_FPT_CMDSIZE 65
@ -359,10 +373,14 @@ struct r300_state_atom {
#define R300_FPI_CMD_0 0
#define R300_FPI_INSTR_0 1
#define R300_FPI_CMDSIZE 65
/* R500 has space for 512 instructions - 6 dwords per instruction */
#define R500_FPI_CMDSIZE (512*6+1)
#define R300_FPP_CMD_0 0
#define R300_FPP_PARAM_0 1
#define R300_FPP_CMDSIZE (32*4+1)
/* R500 has spcae for 256 constants - 4 dwords per constant */
#define R500_FPP_CMDSIZE (256*4+1)
#define R300_FOGS_CMD_0 0
#define R300_FOGS_STATE 1
@ -410,6 +428,12 @@ struct r300_state_atom {
#define R300_ZB_PITCH 2
#define R300_ZB_CMDSIZE 3
#define R300_VAP_CNTL_FLUSH 0
#define R300_VAP_CNTL_FLUSH_1 1
#define R300_VAP_CNTL_CMD 2
#define R300_VAP_CNTL_INSTR 3
#define R300_VAP_CNTL_SIZE 4
#define R300_VPI_CMD_0 0
#define R300_VPI_INSTR_0 1
#define R300_VPI_CMDSIZE 1025 /* 256 16 byte instructions */
@ -451,6 +475,7 @@ struct r300_hw_state {
struct r300_state_atom vpt; /* viewport (1D98) */
struct r300_state_atom vap_cntl;
struct r300_state_atom vap_index_offset; /* 0x208c r5xx only */
struct r300_state_atom vof; /* VAP output format register 0x2090 */
struct r300_state_atom vte; /* (20B0) */
struct r300_state_atom vap_vf_max_vtx_indx; /* Maximum Vertex Indx Clamp (2134) */
@ -473,7 +498,7 @@ struct r300_hw_state {
struct r300_state_atom shade;
struct r300_state_atom polygon_mode;
struct r300_state_atom fogp; /* fog parameters (4294) */
struct r300_state_atom unk429C; /* (429C) */
struct r300_state_atom ga_soft_reset; /* (429C) */
struct r300_state_atom zbias_cntl;
struct r300_state_atom zbs; /* zbias (42A4) */
struct r300_state_atom occlusion_cntl;
@ -487,6 +512,8 @@ struct r300_hw_state {
struct r300_state_atom fp; /* fragment program cntl + nodes (4600) */
struct r300_state_atom fpt; /* texi - (4620) */
struct r300_state_atom us_out_fmt; /* (46A4) */
struct r300_state_atom r500fp; /* r500 fp instructions */
struct r300_state_atom r500fp_const; /* r500 fp constants */
struct r300_state_atom fpi[4]; /* fp instructions (46C0/47C0/48C0/49C0) */
struct r300_state_atom fogs; /* fog state (4BC0) */
struct r300_state_atom fogc; /* fog color (4BC8) */
@ -767,6 +794,47 @@ struct r300_fragment_program {
int max_temp_idx;
GLboolean WritesDepth;
GLuint optimization;
};
struct r500_fragment_program {
struct gl_fragment_program mesa_program;
GLcontext *ctx;
GLboolean translated;
GLboolean error;
struct r300_pfs_compile_state *cs;
struct {
GLuint inst0;
GLuint inst1;
GLuint inst2;
GLuint inst3;
GLuint inst4;
GLuint inst5;
} inst[512];
/* TODO: This is magic! */
int temp_reg_offset;
int inst_offset;
int inst_end;
/* Hardware constants.
* Contains a pointer to the value. The destination of the pointer
* is supposed to be updated when GL state changes.
* Typically, this is either a pointer into
* gl_program_parameter_list::ParameterValues, or a pointer to a
* global constant (e.g. for sin/cos-approximation)
*/
const GLfloat *constant[PFS_NUM_CONST_REGS];
int const_nr;
int max_temp_idx;
GLboolean writes_depth;
GLuint optimization;
};
@ -804,7 +872,7 @@ struct r300_state {
*/
struct r300_swtcl_info {
GLuint RenderIndex;
/**
* Size of a hardware vertex. This is calculated when \c ::vertex_attrs is
* installed in the Mesa state vector.

View file

@ -207,7 +207,10 @@ static void r300EmitVec(GLcontext * ctx, struct r300_dma_region *rvb,
}
}
static GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr,
#define DW_SIZE(x) ((inputs[tab[(x)]] << R300_DST_VEC_LOC_SHIFT) | \
(attribptr[tab[(x)]]->size - 1) << R300_DATA_TYPE_0_SHIFT)
GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr,
int *inputs, GLint * tab, GLuint nr)
{
GLuint i, dw;
@ -216,14 +219,15 @@ static GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr,
for (i = 0; i < nr; i += 2) {
/* make sure input is valid, would lockup the gpu */
assert(inputs[tab[i]] != -1);
dw = R300_INPUT_ROUTE_FLOAT | (inputs[tab[i]] << 8) | (attribptr[tab[i]]->size - 1);
dw = (R300_SIGNED | DW_SIZE(i));
if (i + 1 == nr) {
dw |= R300_VAP_INPUT_ROUTE_END;
dw |= R300_LAST_VEC << R300_DATA_TYPE_0_SHIFT;
} else {
assert(inputs[tab[i + 1]] != -1);
dw |= (R300_INPUT_ROUTE_FLOAT | (inputs[tab[i + 1]] << 8) | (attribptr[tab[i + 1]]->size - 1)) << 16;
dw |= (R300_SIGNED |
DW_SIZE(i + 1)) << R300_DATA_TYPE_1_SHIFT;
if (i + 2 == nr) {
dw |= (R300_VAP_INPUT_ROUTE_END << 16);
dw |= R300_LAST_VEC << R300_DATA_TYPE_1_SHIFT;
}
}
dst[i >> 1] = dw;
@ -234,10 +238,10 @@ static GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr,
static GLuint r300VAPInputRoute1Swizzle(int swizzle[4])
{
return (swizzle[0] << R300_INPUT_ROUTE_X_SHIFT) |
(swizzle[1] << R300_INPUT_ROUTE_Y_SHIFT) |
(swizzle[2] << R300_INPUT_ROUTE_Z_SHIFT) |
(swizzle[3] << R300_INPUT_ROUTE_W_SHIFT);
return (swizzle[0] << R300_SWIZZLE_SELECT_X_SHIFT) |
(swizzle[1] << R300_SWIZZLE_SELECT_Y_SHIFT) |
(swizzle[2] << R300_SWIZZLE_SELECT_Z_SHIFT) |
(swizzle[3] << R300_SWIZZLE_SELECT_W_SHIFT);
}
GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr)
@ -245,9 +249,13 @@ GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr)
GLuint i, dw;
for (i = 0; i < nr; i += 2) {
dw = r300VAPInputRoute1Swizzle(swizzle[i]) | R300_INPUT_ROUTE_ENABLE;
dw = (r300VAPInputRoute1Swizzle(swizzle[i]) |
((R300_WRITE_ENA_X | R300_WRITE_ENA_Y |
R300_WRITE_ENA_Z | R300_WRITE_ENA_W) << R300_WRITE_ENA_SHIFT)) << R300_SWIZZLE0_SHIFT;
if (i + 1 < nr) {
dw |= (r300VAPInputRoute1Swizzle(swizzle[i + 1]) | R300_INPUT_ROUTE_ENABLE) << 16;
dw |= (r300VAPInputRoute1Swizzle(swizzle[i + 1]) |
((R300_WRITE_ENA_X | R300_WRITE_ENA_Y |
R300_WRITE_ENA_Z | R300_WRITE_ENA_W) << R300_WRITE_ENA_SHIFT)) << R300_SWIZZLE1_SHIFT;
}
dst[i >> 1] = dw;
}
@ -542,10 +550,10 @@ void r300EmitCacheFlush(r300ContextPtr rmesa)
drm_radeon_cmd_header_t *cmd = NULL;
reg_start(R300_RB3D_DSTCACHE_CTLSTAT, 0);
e32(RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS |
RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D);
e32(R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS |
R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D);
reg_start(ZB_ZCACHE_CTLSTAT, 0);
e32(ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE |
ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE);
reg_start(R300_ZB_ZCACHE_CTLSTAT, 0);
e32(R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE |
R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE);
}

View file

@ -74,6 +74,20 @@ static inline uint32_t cmdvpu(int addr, int count)
return cmd.u;
}
static inline uint32_t cmdr500fp(int addr, int count, int type, int clamp)
{
drm_r300_cmd_header_t cmd;
cmd.r500fp.cmd_type = R300_CMD_R500FP;
cmd.r500fp.count = count;
cmd.r500fp.adrhi_flags = ((unsigned int)addr & 0x100) >> 8;
cmd.r500fp.adrhi_flags |= type ? R500FP_CONSTANT_TYPE : 0;
cmd.r500fp.adrhi_flags |= clamp ? R500FP_CONSTANT_CLAMP : 0;
cmd.r500fp.adrlo = ((unsigned int)addr & 0x00FF);
return cmd.u;
}
static inline uint32_t cmdpacket3(int packet)
{
drm_r300_cmd_header_t cmd;
@ -166,6 +180,19 @@ static inline uint32_t cmdpacify(void)
cmd[0].i = cmdvpu((dest), _n/4); \
} while (0);
#define r500fp_start_fragment(dest, length) \
do { \
int _n; \
_n = (length); \
cmd = (drm_radeon_cmd_header_t*) \
r300AllocCmdBuf(rmesa, \
(_n+1), \
__FUNCTION__); \
cmd_reserved = _n+1; \
cmd_written =1; \
cmd[0].i = cmdr500fp((dest), _n/6, 0, 0); \
} while (0);
#define start_packet3(packet, count) \
{ \
int _n; \
@ -230,6 +257,8 @@ extern int r300NumVerts(r300ContextPtr rmesa, int num_verts, int prim);
extern void r300EmitCacheFlush(r300ContextPtr rmesa);
extern GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr,
int *inputs, GLint * tab, GLuint nr);
extern GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr);
extern GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead);
extern GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead);

View file

@ -172,19 +172,19 @@ static const struct {
int s_op;
} r300_fpop[] = {
/* *INDENT-OFF* */
{"MAD", 3, R300_FPI0_OUTC_MAD, R300_FPI2_OUTA_MAD},
{"DP3", 2, R300_FPI0_OUTC_DP3, R300_FPI2_OUTA_DP4},
{"DP4", 2, R300_FPI0_OUTC_DP4, R300_FPI2_OUTA_DP4},
{"MIN", 2, R300_FPI0_OUTC_MIN, R300_FPI2_OUTA_MIN},
{"MAX", 2, R300_FPI0_OUTC_MAX, R300_FPI2_OUTA_MAX},
{"CMP", 3, R300_FPI0_OUTC_CMP, R300_FPI2_OUTA_CMP},
{"FRC", 1, R300_FPI0_OUTC_FRC, R300_FPI2_OUTA_FRC},
{"EX2", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_EX2},
{"LG2", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_LG2},
{"RCP", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_RCP},
{"RSQ", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_RSQ},
{"REPL_ALPHA", 1, R300_FPI0_OUTC_REPL_ALPHA, PFS_INVAL},
{"CMPH", 3, R300_FPI0_OUTC_CMPH, PFS_INVAL},
{"MAD", 3, R300_ALU_OUTC_MAD, R300_ALU_OUTA_MAD},
{"DP3", 2, R300_ALU_OUTC_DP3, R300_ALU_OUTA_DP4},
{"DP4", 2, R300_ALU_OUTC_DP4, R300_ALU_OUTA_DP4},
{"MIN", 2, R300_ALU_OUTC_MIN, R300_ALU_OUTA_MIN},
{"MAX", 2, R300_ALU_OUTC_MAX, R300_ALU_OUTA_MAX},
{"CMP", 3, R300_ALU_OUTC_CMP, R300_ALU_OUTA_CMP},
{"FRC", 1, R300_ALU_OUTC_FRC, R300_ALU_OUTA_FRC},
{"EX2", 1, R300_ALU_OUTC_REPL_ALPHA, R300_ALU_OUTA_EX2},
{"LG2", 1, R300_ALU_OUTC_REPL_ALPHA, R300_ALU_OUTA_LG2},
{"RCP", 1, R300_ALU_OUTC_REPL_ALPHA, R300_ALU_OUTA_RCP},
{"RSQ", 1, R300_ALU_OUTC_REPL_ALPHA, R300_ALU_OUTA_RSQ},
{"REPL_ALPHA", 1, R300_ALU_OUTC_REPL_ALPHA, PFS_INVAL},
{"CMPH", 3, R300_ALU_OUTC_CMPH, PFS_INVAL},
/* *INDENT-ON* */
};
@ -209,17 +209,17 @@ static const struct r300_pfs_swizzle {
GLuint flags;
} v_swiz[] = {
/* *INDENT-OFF* */
{MAKE_SWZ3(X, Y, Z), R300_FPI0_ARGC_SRC0C_XYZ, 4, SLOT_SRC_VECTOR},
{MAKE_SWZ3(X, X, X), R300_FPI0_ARGC_SRC0C_XXX, 4, SLOT_SRC_VECTOR},
{MAKE_SWZ3(Y, Y, Y), R300_FPI0_ARGC_SRC0C_YYY, 4, SLOT_SRC_VECTOR},
{MAKE_SWZ3(Z, Z, Z), R300_FPI0_ARGC_SRC0C_ZZZ, 4, SLOT_SRC_VECTOR},
{MAKE_SWZ3(W, W, W), R300_FPI0_ARGC_SRC0A, 1, SLOT_SRC_SCALAR},
{MAKE_SWZ3(Y, Z, X), R300_FPI0_ARGC_SRC0C_YZX, 1, SLOT_SRC_VECTOR},
{MAKE_SWZ3(Z, X, Y), R300_FPI0_ARGC_SRC0C_ZXY, 1, SLOT_SRC_VECTOR},
{MAKE_SWZ3(W, Z, Y), R300_FPI0_ARGC_SRC0CA_WZY, 1, SLOT_SRC_BOTH},
{MAKE_SWZ3(ONE, ONE, ONE), R300_FPI0_ARGC_ONE, 0, 0},
{MAKE_SWZ3(ZERO, ZERO, ZERO), R300_FPI0_ARGC_ZERO, 0, 0},
{MAKE_SWZ3(HALF, HALF, HALF), R300_FPI0_ARGC_HALF, 0, 0},
{MAKE_SWZ3(X, Y, Z), R300_ALU_ARGC_SRC0C_XYZ, 4, SLOT_SRC_VECTOR},
{MAKE_SWZ3(X, X, X), R300_ALU_ARGC_SRC0C_XXX, 4, SLOT_SRC_VECTOR},
{MAKE_SWZ3(Y, Y, Y), R300_ALU_ARGC_SRC0C_YYY, 4, SLOT_SRC_VECTOR},
{MAKE_SWZ3(Z, Z, Z), R300_ALU_ARGC_SRC0C_ZZZ, 4, SLOT_SRC_VECTOR},
{MAKE_SWZ3(W, W, W), R300_ALU_ARGC_SRC0A, 1, SLOT_SRC_SCALAR},
{MAKE_SWZ3(Y, Z, X), R300_ALU_ARGC_SRC0C_YZX, 1, SLOT_SRC_VECTOR},
{MAKE_SWZ3(Z, X, Y), R300_ALU_ARGC_SRC0C_ZXY, 1, SLOT_SRC_VECTOR},
{MAKE_SWZ3(W, Z, Y), R300_ALU_ARGC_SRC0CA_WZY, 1, SLOT_SRC_BOTH},
{MAKE_SWZ3(ONE, ONE, ONE), R300_ALU_ARGC_ONE, 0, 0},
{MAKE_SWZ3(ZERO, ZERO, ZERO), R300_ALU_ARGC_ZERO, 0, 0},
{MAKE_SWZ3(HALF, HALF, HALF), R300_ALU_ARGC_HALF, 0, 0},
{PFS_INVAL, 0, 0, 0},
/* *INDENT-ON* */
};
@ -252,13 +252,13 @@ static const struct {
GLuint flags;
} s_swiz[] = {
/* *INDENT-OFF* */
{R300_FPI2_ARGA_SRC0C_X, 3, SLOT_SRC_VECTOR},
{R300_FPI2_ARGA_SRC0C_Y, 3, SLOT_SRC_VECTOR},
{R300_FPI2_ARGA_SRC0C_Z, 3, SLOT_SRC_VECTOR},
{R300_FPI2_ARGA_SRC0A, 1, SLOT_SRC_SCALAR},
{R300_FPI2_ARGA_ZERO, 0, 0},
{R300_FPI2_ARGA_ONE, 0, 0},
{R300_FPI2_ARGA_HALF, 0, 0}
{R300_ALU_ARGA_SRC0C_X, 3, SLOT_SRC_VECTOR},
{R300_ALU_ARGA_SRC0C_Y, 3, SLOT_SRC_VECTOR},
{R300_ALU_ARGA_SRC0C_Z, 3, SLOT_SRC_VECTOR},
{R300_ALU_ARGA_SRC0A, 1, SLOT_SRC_SCALAR},
{R300_ALU_ARGA_ZERO, 0, 0},
{R300_ALU_ARGA_ONE, 0, 0},
{R300_ALU_ARGA_HALF, 0, 0}
/* *INDENT-ON* */
};
@ -859,11 +859,12 @@ static int t_hw_dst(struct r300_fragment_program *fp,
switch (index) {
case FRAG_RESULT_COLR:
fp->node[fp->cur_node].flags |=
R300_PFS_NODE_OUTPUT_COLOR;
R300_RGBA_OUT;
break;
case FRAG_RESULT_DEPR:
fp->WritesDepth = GL_TRUE;
fp->node[fp->cur_node].flags |=
R300_PFS_NODE_OUTPUT_DEPTH;
R300_W_OUT;
break;
}
return index;
@ -903,49 +904,59 @@ static void emit_tex(struct r300_fragment_program *fp,
int hwsrc, hwdest;
GLuint tempreg = 0;
/**
* Hardware uses [0..1]x[0..1] range for rectangle textures
* instead of [0..Width]x[0..Height].
* Add a scaling instruction.
*
* \todo Refactor this once we have proper rewriting/optimization
* support for programs.
*/
if (opcode != R300_TEX_OP_KIL && fpi->TexSrcTarget == TEXTURE_RECT_INDEX) {
gl_state_index tokens[STATE_LENGTH] = {
STATE_INTERNAL, STATE_R300_TEXRECT_FACTOR, 0, 0,
0
};
int factor_index;
GLuint factorreg;
tokens[2] = unit;
factor_index =
_mesa_add_state_reference(fp->mesa_program.Base.
Parameters, tokens);
factorreg =
emit_const4fv(fp,
fp->mesa_program.Base.Parameters->
ParameterValues[factor_index]);
tempreg = keep(get_temp_reg(fp));
emit_arith(fp, PFS_OP_MAD, tempreg, WRITEMASK_XYZW,
coord, factorreg, pfs_zero, 0);
coord = tempreg;
}
/* Texture operations do not support swizzles etc. in hardware,
* so emit an additional arithmetic operation if necessary.
*/
if (REG_GET_VSWZ(coord) != SWIZZLE_XYZ ||
REG_GET_SSWZ(coord) != SWIZZLE_W ||
coord & (REG_NEGV_MASK | REG_NEGS_MASK | REG_ABS_MASK)) {
assert(tempreg == 0);
tempreg = keep(get_temp_reg(fp));
emit_arith(fp, PFS_OP_MAD, tempreg, WRITEMASK_XYZW,
coord, pfs_one, pfs_zero, 0);
coord = tempreg;
}
/* Ensure correct node indirection */
uin = cs->used_in_node;
din = cs->dest_in_node;
/* Resolve source/dest to hardware registers */
if (opcode != R300_FPITX_OP_KIL) {
if (fpi->TexSrcTarget == TEXTURE_RECT_INDEX) {
/**
* Hardware uses [0..1]x[0..1] range for rectangle textures
* instead of [0..Width]x[0..Height].
* Add a scaling instruction.
*
* \todo Refactor this once we have proper rewriting/optimization
* support for programs.
*/
gl_state_index tokens[STATE_LENGTH] = {
STATE_INTERNAL, STATE_R300_TEXRECT_FACTOR, 0, 0,
0
};
int factor_index;
GLuint factorreg;
tokens[2] = unit;
factor_index =
_mesa_add_state_reference(fp->mesa_program.Base.
Parameters, tokens);
factorreg =
emit_const4fv(fp,
fp->mesa_program.Base.Parameters->
ParameterValues[factor_index]);
tempreg = keep(get_temp_reg(fp));
emit_arith(fp, PFS_OP_MAD, tempreg, WRITEMASK_XYZW,
coord, factorreg, pfs_zero, 0);
/* Ensure correct node indirection */
uin = cs->used_in_node;
din = cs->dest_in_node;
hwsrc = t_hw_src(fp, tempreg, GL_TRUE);
} else {
hwsrc = t_hw_src(fp, coord, GL_TRUE);
}
hwsrc = t_hw_src(fp, coord, GL_TRUE);
if (opcode != R300_TEX_OP_KIL) {
dest = t_dst(fp, fpi->DstReg);
/* r300 doesn't seem to be able to do TEX->output reg */
@ -972,7 +983,6 @@ static void emit_tex(struct r300_fragment_program *fp,
} else {
hwdest = 0;
unit = 0;
hwsrc = t_hw_src(fp, coord, GL_TRUE);
}
/* Indirection if source has been written in this node, or if the
@ -1007,11 +1017,10 @@ static void emit_tex(struct r300_fragment_program *fp,
if (fp->cur_node == 0)
fp->first_node_has_tex = 1;
fp->tex.inst[fp->tex.length++] = 0 | (hwsrc << R300_FPITX_SRC_SHIFT)
| (hwdest << R300_FPITX_DST_SHIFT)
| (unit << R300_FPITX_IMAGE_SHIFT)
/* not entirely sure about this */
| (opcode << R300_FPITX_OPCODE_SHIFT);
fp->tex.inst[fp->tex.length++] = 0 | (hwsrc << R300_SRC_ADDR_SHIFT)
| (hwdest << R300_DST_ADDR_SHIFT)
| (unit << R300_TEX_ID_SHIFT)
| (opcode << R300_TEX_INST_SHIFT);
cs->dest_in_node |= (1 << hwdest);
if (REG_GET_TYPE(coord) != REG_TYPE_CONST)
@ -1228,17 +1237,17 @@ static int find_and_prepare_slot(struct r300_fragment_program *fp,
}
// Emit the source fetch code
fp->alu.inst[pos].inst1 &= ~R300_FPI1_SRC_MASK;
fp->alu.inst[pos].inst1 &= ~R300_ALU_SRC_MASK;
fp->alu.inst[pos].inst1 |=
((cs->slot[pos].vsrc[0] << R300_FPI1_SRC0C_SHIFT) |
(cs->slot[pos].vsrc[1] << R300_FPI1_SRC1C_SHIFT) |
(cs->slot[pos].vsrc[2] << R300_FPI1_SRC2C_SHIFT));
((cs->slot[pos].vsrc[0] << R300_ALU_SRC0C_SHIFT) |
(cs->slot[pos].vsrc[1] << R300_ALU_SRC1C_SHIFT) |
(cs->slot[pos].vsrc[2] << R300_ALU_SRC2C_SHIFT));
fp->alu.inst[pos].inst3 &= ~R300_FPI3_SRC_MASK;
fp->alu.inst[pos].inst3 &= ~R300_ALU_SRC_MASK;
fp->alu.inst[pos].inst3 |=
((cs->slot[pos].ssrc[0] << R300_FPI3_SRC0A_SHIFT) |
(cs->slot[pos].ssrc[1] << R300_FPI3_SRC1A_SHIFT) |
(cs->slot[pos].ssrc[2] << R300_FPI3_SRC2A_SHIFT));
((cs->slot[pos].ssrc[0] << R300_ALU_SRC0A_SHIFT) |
(cs->slot[pos].ssrc[1] << R300_ALU_SRC1A_SHIFT) |
(cs->slot[pos].ssrc[2] << R300_ALU_SRC2A_SHIFT));
// Emit the argument selection code
if (emit_vop) {
@ -1257,17 +1266,17 @@ static int find_and_prepare_slot(struct r300_fragment_program *fp,
ARG_ABS
: 0);
} else {
swz[i] = R300_FPI0_ARGC_ZERO;
swz[i] = R300_ALU_ARGC_ZERO;
}
}
fp->alu.inst[pos].inst0 &=
~(R300_FPI0_ARG0C_MASK | R300_FPI0_ARG1C_MASK |
R300_FPI0_ARG2C_MASK);
~(R300_ALU_ARG0C_MASK | R300_ALU_ARG1C_MASK |
R300_ALU_ARG2C_MASK);
fp->alu.inst[pos].inst0 |=
(swz[0] << R300_FPI0_ARG0C_SHIFT) | (swz[1] <<
R300_FPI0_ARG1C_SHIFT)
| (swz[2] << R300_FPI0_ARG2C_SHIFT);
(swz[0] << R300_ALU_ARG0C_SHIFT) | (swz[1] <<
R300_ALU_ARG1C_SHIFT)
| (swz[2] << R300_ALU_ARG2C_SHIFT);
}
if (emit_sop) {
@ -1286,17 +1295,17 @@ static int find_and_prepare_slot(struct r300_fragment_program *fp,
ARG_ABS
: 0);
} else {
swz[i] = R300_FPI2_ARGA_ZERO;
swz[i] = R300_ALU_ARGA_ZERO;
}
}
fp->alu.inst[pos].inst2 &=
~(R300_FPI2_ARG0A_MASK | R300_FPI2_ARG1A_MASK |
R300_FPI2_ARG2A_MASK);
~(R300_ALU_ARG0A_MASK | R300_ALU_ARG1A_MASK |
R300_ALU_ARG2A_MASK);
fp->alu.inst[pos].inst2 |=
(swz[0] << R300_FPI2_ARG0A_SHIFT) | (swz[1] <<
R300_FPI2_ARG1A_SHIFT)
| (swz[2] << R300_FPI2_ARG2A_SHIFT);
(swz[0] << R300_ALU_ARG0A_SHIFT) | (swz[1] <<
R300_ALU_ARG1A_SHIFT)
| (swz[2] << R300_ALU_ARG2A_SHIFT);
}
return pos;
@ -1333,9 +1342,9 @@ static void emit_arith(struct r300_fragment_program *fp,
emit_vop = GL_FALSE;
emit_sop = GL_FALSE;
if ((mask & WRITEMASK_XYZ) || vop == R300_FPI0_OUTC_DP3)
if ((mask & WRITEMASK_XYZ) || vop == R300_ALU_OUTC_DP3)
emit_vop = GL_TRUE;
if ((mask & WRITEMASK_W) || vop == R300_FPI0_OUTC_REPL_ALPHA)
if ((mask & WRITEMASK_W) || vop == R300_ALU_OUTC_REPL_ALPHA)
emit_sop = GL_TRUE;
pos =
@ -1347,33 +1356,33 @@ static void emit_arith(struct r300_fragment_program *fp,
hwdest = t_hw_dst(fp, dest, GL_FALSE, pos); /* Note: Side effects wrt register allocation */
if (flags & PFS_FLAG_SAT) {
vop |= R300_FPI0_OUTC_SAT;
sop |= R300_FPI2_OUTA_SAT;
vop |= R300_ALU_OUTC_CLAMP;
sop |= R300_ALU_OUTA_CLAMP;
}
/* Throw the pieces together and get FPI0/1 */
/* Throw the pieces together and get ALU/1 */
if (emit_vop) {
fp->alu.inst[pos].inst0 |= vop;
fp->alu.inst[pos].inst1 |= hwdest << R300_FPI1_DSTC_SHIFT;
fp->alu.inst[pos].inst1 |= hwdest << R300_ALU_DSTC_SHIFT;
if (REG_GET_TYPE(dest) == REG_TYPE_OUTPUT) {
if (REG_GET_INDEX(dest) == FRAG_RESULT_COLR) {
fp->alu.inst[pos].inst1 |=
(mask & WRITEMASK_XYZ) <<
R300_FPI1_DSTC_OUTPUT_MASK_SHIFT;
R300_ALU_DSTC_OUTPUT_MASK_SHIFT;
} else
assert(0);
} else {
fp->alu.inst[pos].inst1 |=
(mask & WRITEMASK_XYZ) <<
R300_FPI1_DSTC_REG_MASK_SHIFT;
R300_ALU_DSTC_REG_MASK_SHIFT;
cs->hwtemps[hwdest].vector_valid = pos + 1;
}
}
/* And now FPI2/3 */
/* And now ALU/3 */
if (emit_sop) {
fp->alu.inst[pos].inst2 |= sop;
@ -1381,18 +1390,18 @@ static void emit_arith(struct r300_fragment_program *fp,
if (REG_GET_TYPE(dest) == REG_TYPE_OUTPUT) {
if (REG_GET_INDEX(dest) == FRAG_RESULT_COLR) {
fp->alu.inst[pos].inst3 |=
(hwdest << R300_FPI3_DSTA_SHIFT) |
R300_FPI3_DSTA_OUTPUT;
(hwdest << R300_ALU_DSTA_SHIFT) |
R300_ALU_DSTA_OUTPUT;
} else if (REG_GET_INDEX(dest) ==
FRAG_RESULT_DEPR) {
fp->alu.inst[pos].inst3 |=
R300_FPI3_DSTA_DEPTH;
R300_ALU_DSTA_DEPTH;
} else
assert(0);
} else {
fp->alu.inst[pos].inst3 |=
(hwdest << R300_FPI3_DSTA_SHIFT) |
R300_FPI3_DSTA_REG;
(hwdest << R300_ALU_DSTA_SHIFT) |
R300_ALU_DSTA_REG;
cs->hwtemps[hwdest].scalar_valid = pos + 1;
}
@ -1708,7 +1717,7 @@ static GLboolean parse_program(struct r300_fragment_program *fp)
src[0], undef, undef, flags);
break;
case OPCODE_KIL:
emit_tex(fp, fpi, R300_FPITX_OP_KIL);
emit_tex(fp, fpi, R300_TEX_OP_KIL);
break;
case OPCODE_LG2:
src[0] = t_scalar_src(fp, fpi->SrcReg[0]);
@ -1943,13 +1952,13 @@ static GLboolean parse_program(struct r300_fragment_program *fp)
src[0], pfs_one, negate(src[1]), flags);
break;
case OPCODE_TEX:
emit_tex(fp, fpi, R300_FPITX_OP_TEX);
emit_tex(fp, fpi, R300_TEX_OP_LD);
break;
case OPCODE_TXB:
emit_tex(fp, fpi, R300_FPITX_OP_TXB);
emit_tex(fp, fpi, R300_TEX_OP_TXB);
break;
case OPCODE_TXP:
emit_tex(fp, fpi, R300_FPITX_OP_TXP);
emit_tex(fp, fpi, R300_TEX_OP_TXP);
break;
case OPCODE_XPD:{
src[0] = t_src(fp, fpi->SrcReg[0]);
@ -2097,6 +2106,7 @@ static void init_program(r300ContextPtr r300, struct r300_fragment_program *fp)
fp->translated = GL_FALSE;
fp->error = GL_FALSE;
fp->cs = cs = &(R300_CONTEXT(fp->ctx)->state.pfs_compile);
fp->WritesDepth = GL_FALSE;
fp->tex.length = 0;
fp->cur_node = 0;
fp->first_node_has_tex = 0;
@ -2217,6 +2227,7 @@ static void update_params(struct r300_fragment_program *fp)
void r300TranslateFragmentShader(r300ContextPtr r300,
struct r300_fragment_program *fp)
{
struct r300_pfs_compile_state *cs = NULL;
if (!fp->translated) {
@ -2281,18 +2292,18 @@ static void dump_program(struct r300_fragment_program *fp)
const char *instr;
switch ((fp->tex.
inst[i] >> R300_FPITX_OPCODE_SHIFT) &
inst[i] >> R300_TEX_INST_SHIFT) &
15) {
case R300_FPITX_OP_TEX:
case R300_TEX_OP_LD:
instr = "TEX";
break;
case R300_FPITX_OP_KIL:
case R300_TEX_OP_KIL:
instr = "KIL";
break;
case R300_FPITX_OP_TXP:
case R300_TEX_OP_TXP:
instr = "TXP";
break;
case R300_FPITX_OP_TXB:
case R300_TEX_OP_TXB:
instr = "TXB";
break;
default:
@ -2303,15 +2314,13 @@ static void dump_program(struct r300_fragment_program *fp)
" %s t%i, %c%i, texture[%i] (%08x)\n",
instr,
(fp->tex.
inst[i] >> R300_FPITX_DST_SHIFT) & 31,
(fp->tex.
inst[i] & R300_FPITX_SRC_CONST) ? 'c' :
inst[i] >> R300_DST_ADDR_SHIFT) & 31,
't',
(fp->tex.
inst[i] >> R300_FPITX_SRC_SHIFT) & 31,
inst[i] >> R300_SRC_ADDR_SHIFT) & 31,
(fp->tex.
inst[i] & R300_FPITX_IMAGE_MASK) >>
R300_FPITX_IMAGE_SHIFT,
inst[i] & R300_TEX_ID_MASK) >>
R300_TEX_ID_SHIFT,
fp->tex.inst[i]);
}
}
@ -2337,45 +2346,45 @@ static void dump_program(struct r300_fragment_program *fp)
dstc[0] = 0;
sprintf(flags, "%s%s%s",
(fp->alu.inst[i].
inst1 & R300_FPI1_DSTC_REG_X) ? "x" : "",
inst1 & R300_ALU_DSTC_REG_X) ? "x" : "",
(fp->alu.inst[i].
inst1 & R300_FPI1_DSTC_REG_Y) ? "y" : "",
inst1 & R300_ALU_DSTC_REG_Y) ? "y" : "",
(fp->alu.inst[i].
inst1 & R300_FPI1_DSTC_REG_Z) ? "z" : "");
inst1 & R300_ALU_DSTC_REG_Z) ? "z" : "");
if (flags[0] != 0) {
sprintf(dstc, "t%i.%s ",
(fp->alu.inst[i].
inst1 >> R300_FPI1_DSTC_SHIFT) & 31,
inst1 >> R300_ALU_DSTC_SHIFT) & 31,
flags);
}
sprintf(flags, "%s%s%s",
(fp->alu.inst[i].
inst1 & R300_FPI1_DSTC_OUTPUT_X) ? "x" : "",
inst1 & R300_ALU_DSTC_OUTPUT_X) ? "x" : "",
(fp->alu.inst[i].
inst1 & R300_FPI1_DSTC_OUTPUT_Y) ? "y" : "",
inst1 & R300_ALU_DSTC_OUTPUT_Y) ? "y" : "",
(fp->alu.inst[i].
inst1 & R300_FPI1_DSTC_OUTPUT_Z) ? "z" : "");
inst1 & R300_ALU_DSTC_OUTPUT_Z) ? "z" : "");
if (flags[0] != 0) {
sprintf(tmp, "o%i.%s",
(fp->alu.inst[i].
inst1 >> R300_FPI1_DSTC_SHIFT) & 31,
inst1 >> R300_ALU_DSTC_SHIFT) & 31,
flags);
strcat(dstc, tmp);
}
dsta[0] = 0;
if (fp->alu.inst[i].inst3 & R300_FPI3_DSTA_REG) {
if (fp->alu.inst[i].inst3 & R300_ALU_DSTA_REG) {
sprintf(dsta, "t%i.w ",
(fp->alu.inst[i].
inst3 >> R300_FPI3_DSTA_SHIFT) & 31);
inst3 >> R300_ALU_DSTA_SHIFT) & 31);
}
if (fp->alu.inst[i].inst3 & R300_FPI3_DSTA_OUTPUT) {
if (fp->alu.inst[i].inst3 & R300_ALU_DSTA_OUTPUT) {
sprintf(tmp, "o%i.w ",
(fp->alu.inst[i].
inst3 >> R300_FPI3_DSTA_SHIFT) & 31);
inst3 >> R300_ALU_DSTA_SHIFT) & 31);
strcat(dsta, tmp);
}
if (fp->alu.inst[i].inst3 & R300_FPI3_DSTA_DEPTH) {
if (fp->alu.inst[i].inst3 & R300_ALU_DSTA_DEPTH) {
strcat(dsta, "Z");
}
@ -2395,19 +2404,19 @@ static void dump_program(struct r300_fragment_program *fp)
d = regc & 31;
if (d < 12) {
switch (d % 4) {
case R300_FPI0_ARGC_SRC0C_XYZ:
case R300_ALU_ARGC_SRC0C_XYZ:
sprintf(buf, "%s.xyz",
srcc[d / 4]);
break;
case R300_FPI0_ARGC_SRC0C_XXX:
case R300_ALU_ARGC_SRC0C_XXX:
sprintf(buf, "%s.xxx",
srcc[d / 4]);
break;
case R300_FPI0_ARGC_SRC0C_YYY:
case R300_ALU_ARGC_SRC0C_YYY:
sprintf(buf, "%s.yyy",
srcc[d / 4]);
break;
case R300_FPI0_ARGC_SRC0C_ZZZ:
case R300_ALU_ARGC_SRC0C_ZZZ:
sprintf(buf, "%s.zzz",
srcc[d / 4]);
break;

View file

@ -75,23 +75,23 @@ typedef struct r300_fragment_program_swizzle {
#define SRC_STRIDE 6
#define NOP_INST0 ( \
(R300_FPI0_OUTC_MAD) | \
(R300_FPI0_ARGC_ZERO << R300_FPI0_ARG0C_SHIFT) | \
(R300_FPI0_ARGC_ZERO << R300_FPI0_ARG1C_SHIFT) | \
(R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT))
(R300_ALU_OUTC_MAD) | \
(R300_ALU_ARGC_ZERO << R300_ALU_ARG0C_SHIFT) | \
(R300_ALU_ARGC_ZERO << R300_ALU_ARG1C_SHIFT) | \
(R300_ALU_ARGC_ZERO << R300_ALU_ARG2C_SHIFT))
#define NOP_INST1 ( \
((0 | SRC_CONST) << R300_FPI1_SRC0C_SHIFT) | \
((0 | SRC_CONST) << R300_FPI1_SRC1C_SHIFT) | \
((0 | SRC_CONST) << R300_FPI1_SRC2C_SHIFT))
((0 | SRC_CONST) << R300_ALU_SRC0C_SHIFT) | \
((0 | SRC_CONST) << R300_ALU_SRC1C_SHIFT) | \
((0 | SRC_CONST) << R300_ALU_SRC2C_SHIFT))
#define NOP_INST2 ( \
(R300_FPI2_OUTA_MAD) | \
(R300_FPI2_ARGA_ZERO << R300_FPI2_ARG0A_SHIFT) | \
(R300_FPI2_ARGA_ZERO << R300_FPI2_ARG1A_SHIFT) | \
(R300_FPI2_ARGA_ZERO << R300_FPI2_ARG2A_SHIFT))
(R300_ALU_OUTA_MAD) | \
(R300_ALU_ARGA_ZERO << R300_ALU_ARG0A_SHIFT) | \
(R300_ALU_ARGA_ZERO << R300_ALU_ARG1A_SHIFT) | \
(R300_ALU_ARGA_ZERO << R300_ALU_ARG2A_SHIFT))
#define NOP_INST3 ( \
((0 | SRC_CONST) << R300_FPI3_SRC0A_SHIFT) | \
((0 | SRC_CONST) << R300_FPI3_SRC1A_SHIFT) | \
((0 | SRC_CONST) << R300_FPI3_SRC2A_SHIFT))
((0 | SRC_CONST) << R300_ALU_SRC0A_SHIFT) | \
((0 | SRC_CONST) << R300_ALU_SRC1A_SHIFT) | \
((0 | SRC_CONST) << R300_ALU_SRC2A_SHIFT))
#define DRI_CONF_FP_OPTIMIZATION_SPEED 0
#define DRI_CONF_FP_OPTIMIZATION_QUALITY 1
@ -117,42 +117,42 @@ typedef struct r300_fragment_program_swizzle {
#define FP_SELC_MASK_XYZ 7
#define FP_SELC(destidx,regmask,outmask,src0,src1,src2) \
(((destidx) << R300_FPI1_DSTC_SHIFT) | \
(((destidx) << R300_ALU_DSTC_SHIFT) | \
(FP_SELC_MASK_##regmask << 23) | \
(FP_SELC_MASK_##outmask << 26) | \
((src0) << R300_FPI1_SRC0C_SHIFT) | \
((src1) << R300_FPI1_SRC1C_SHIFT) | \
((src2) << R300_FPI1_SRC2C_SHIFT))
((src0) << R300_ALU_SRC0C_SHIFT) | \
((src1) << R300_ALU_SRC1C_SHIFT) | \
((src2) << R300_ALU_SRC2C_SHIFT))
#define FP_SELA_MASK_NO 0
#define FP_SELA_MASK_W 1
#define FP_SELA(destidx,regmask,outmask,src0,src1,src2) \
(((destidx) << R300_FPI3_DSTA_SHIFT) | \
(((destidx) << R300_ALU_DSTA_SHIFT) | \
(FP_SELA_MASK_##regmask << 23) | \
(FP_SELA_MASK_##outmask << 24) | \
((src0) << R300_FPI3_SRC0A_SHIFT) | \
((src1) << R300_FPI3_SRC1A_SHIFT) | \
((src2) << R300_FPI3_SRC2A_SHIFT))
((src0) << R300_ALU_SRC0A_SHIFT) | \
((src1) << R300_ALU_SRC1A_SHIFT) | \
((src2) << R300_ALU_SRC2A_SHIFT))
/* Produce unshifted argument selectors */
#define FP_ARGC(source) R300_FPI0_ARGC_##source
#define FP_ARGA(source) R300_FPI2_ARGA_##source
#define FP_ARGC(source) R300_ALU_ARGC_##source
#define FP_ARGA(source) R300_ALU_ARGA_##source
#define FP_ABS(arg) ((arg) | (1 << 6))
#define FP_NEG(arg) ((arg) ^ (1 << 5))
/* Produce instruction dword */
#define FP_INSTRC(opcode,arg0,arg1,arg2) \
(R300_FPI0_OUTC_##opcode | \
((arg0) << R300_FPI0_ARG0C_SHIFT) | \
((arg1) << R300_FPI0_ARG1C_SHIFT) | \
((arg2) << R300_FPI0_ARG2C_SHIFT))
(R300_ALU_OUTC_##opcode | \
((arg0) << R300_ALU_ARG0C_SHIFT) | \
((arg1) << R300_ALU_ARG1C_SHIFT) | \
((arg2) << R300_ALU_ARG2C_SHIFT))
#define FP_INSTRA(opcode,arg0,arg1,arg2) \
(R300_FPI2_OUTA_##opcode | \
((arg0) << R300_FPI2_ARG0A_SHIFT) | \
((arg1) << R300_FPI2_ARG1A_SHIFT) | \
((arg2) << R300_FPI2_ARG2A_SHIFT))
(R300_ALU_OUTA_##opcode | \
((arg0) << R300_ALU_ARG0A_SHIFT) | \
((arg1) << R300_ALU_ARG1A_SHIFT) | \
((arg2) << R300_ALU_ARG2A_SHIFT))
#endif

View file

@ -118,7 +118,7 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
}
R300_STATECHANGE(r300, zs);
reg_start(R300_RB3D_ZSTENCIL_CNTL_0, 2);
reg_start(R300_ZB_CNTL, 2);
{
uint32_t t1, t2;
@ -127,32 +127,32 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
t2 = 0x0;
if (flags & CLEARBUFFER_DEPTH) {
t1 |= R300_RB3D_Z_WRITE_ONLY;
t1 |= R300_Z_ENABLE | R300_Z_WRITE_ENABLE;
t2 |=
(R300_ZS_ALWAYS << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
} else {
t1 |= R300_RB3D_Z_DISABLED_1; // disable
(R300_ZS_ALWAYS << R300_Z_FUNC_SHIFT);
} else { //XXX
t1 |= R300_STENCIL_FRONT_BACK; // disable
}
if (flags & CLEARBUFFER_STENCIL) {
t1 |= R300_RB3D_STENCIL_ENABLE;
t1 |= R300_STENCIL_ENABLE;
t2 |=
(R300_ZS_ALWAYS <<
R300_RB3D_ZS1_FRONT_FUNC_SHIFT) |
R300_S_FRONT_FUNC_SHIFT) |
(R300_ZS_REPLACE <<
R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) |
R300_S_FRONT_SFAIL_OP_SHIFT) |
(R300_ZS_REPLACE <<
R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) |
R300_S_FRONT_ZPASS_OP_SHIFT) |
(R300_ZS_REPLACE <<
R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) |
R300_S_FRONT_ZFAIL_OP_SHIFT) |
(R300_ZS_ALWAYS <<
R300_RB3D_ZS1_BACK_FUNC_SHIFT) |
R300_S_BACK_FUNC_SHIFT) |
(R300_ZS_REPLACE <<
R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) |
R300_S_BACK_SFAIL_OP_SHIFT) |
(R300_ZS_REPLACE <<
R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT) |
R300_S_BACK_ZPASS_OP_SHIFT) |
(R300_ZS_REPLACE <<
R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT);
R300_S_BACK_ZFAIL_OP_SHIFT);
}
e32(t1);
@ -186,10 +186,16 @@ static void r300EmitClearState(GLcontext * ctx)
int cmd_written = 0;
drm_radeon_cmd_header_t *cmd = NULL;
int has_tcl = 1;
int is_r500 = 0;
GLuint vap_cntl;
if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL))
has_tcl = 0;
if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515)
is_r500 = 1;
/* FIXME: the values written to R300_VAP_INPUT_ROUTE_0_0 and
* R300_VAP_INPUT_ROUTE_0_1 are in fact known, however, the values are
* quite complex; see the functions in r300_emit.c.
@ -199,25 +205,38 @@ static void r300EmitClearState(GLcontext * ctx)
* these registers, as well as the actual values used for rendering.
*/
R300_STATECHANGE(r300, vir[0]);
reg_start(R300_VAP_INPUT_ROUTE_0_0, 0);
reg_start(R300_VAP_PROG_STREAM_CNTL_0, 0);
if (!has_tcl)
e32(0x22030003);
e32(((((0 << R300_DST_VEC_LOC_SHIFT) | R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_0_SHIFT) |
((R300_LAST_VEC | (2 << R300_DST_VEC_LOC_SHIFT) | R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT)));
else
e32(0x21030003);
e32(((((0 << R300_DST_VEC_LOC_SHIFT) | R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_0_SHIFT) |
((R300_LAST_VEC | (1 << R300_DST_VEC_LOC_SHIFT) | R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT)));
/* disable fog */
R300_STATECHANGE(r300, fogs);
reg_start(FG_FOG_BLEND, 0);
reg_start(R300_FG_FOG_BLEND, 0);
e32(0x0);
R300_STATECHANGE(r300, vir[1]);
reg_start(R300_VAP_INPUT_ROUTE_1_0, 0);
e32(0xF688F688);
reg_start(R300_VAP_PROG_STREAM_CNTL_EXT_0, 0);
e32(((((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) |
(R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) |
(R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_SHIFT) |
(R300_SWIZZLE_SELECT_W << R300_SWIZZLE_SELECT_W_SHIFT) |
((R300_WRITE_ENA_X | R300_WRITE_ENA_Y | R300_WRITE_ENA_Z | R300_WRITE_ENA_W) << R300_WRITE_ENA_SHIFT))
<< R300_SWIZZLE0_SHIFT) |
(((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) |
(R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) |
(R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_SHIFT) |
(R300_SWIZZLE_SELECT_W << R300_SWIZZLE_SELECT_W_SHIFT) |
((R300_WRITE_ENA_X | R300_WRITE_ENA_Y | R300_WRITE_ENA_Z | R300_WRITE_ENA_W) << R300_WRITE_ENA_SHIFT))
<< R300_SWIZZLE1_SHIFT)));
/* R300_VAP_INPUT_CNTL_0, R300_VAP_INPUT_CNTL_1 */
R300_STATECHANGE(r300, vic);
reg_start(R300_VAP_INPUT_CNTL_0, 1);
e32(R300_INPUT_CNTL_0_COLOR);
reg_start(R300_VAP_VTX_STATE_CNTL, 1);
e32((R300_SEL_USER_COLOR_0 << R300_COLOR_0_ASSEMBLY_SHIFT));
e32(R300_INPUT_CNTL_POS | R300_INPUT_CNTL_COLOR | R300_INPUT_CNTL_TC0);
R300_STATECHANGE(r300, vte);
@ -229,7 +248,7 @@ static void r300EmitClearState(GLcontext * ctx)
R300_VPORT_Z_OFFSET_ENA);
e32(0x8);
reg_start(R300_VAP_PSC_SGN_NORM_CNTL, SGN_NORM_ZERO);
reg_start(R300_VAP_PSC_SGN_NORM_CNTL, 0);
e32(0xaaaaaaaa);
R300_STATECHANGE(r300, vof);
@ -252,7 +271,7 @@ static void r300EmitClearState(GLcontext * ctx)
efloat(0.0);
R300_STATECHANGE(r300, at);
reg_start(FG_ALPHA_FUNC, 0);
reg_start(R300_FG_ALPHA_FUNC, 0);
e32(0x0);
R300_STATECHANGE(r300, bld);
@ -263,7 +282,7 @@ static void r300EmitClearState(GLcontext * ctx)
if (has_tcl) {
R300_STATECHANGE(r300, vap_clip_cntl);
reg_start(R300_VAP_CLIP_CNTL, 0);
e32(R300_221C_CLEAR);
e32(R300_PS_UCP_MODE_CLIP_AS_TRIFAN | R300_CLIP_DISABLE);
}
R300_STATECHANGE(r300, ps);
@ -271,59 +290,169 @@ static void r300EmitClearState(GLcontext * ctx)
e32(((dPriv->w * 6) << R300_POINTSIZE_X_SHIFT) |
((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT));
R300_STATECHANGE(r300, ri);
reg_start(R300_RS_IP_0, 8);
for (i = 0; i < 8; ++i) {
e32(R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3));
if (!is_r500) {
R300_STATECHANGE(r300, ri);
reg_start(R300_RS_IP_0, 7);
for (i = 0; i < 8; ++i) {
e32(R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3));
}
R300_STATECHANGE(r300, rc);
/* The second constant is needed to get glxgears display anything .. */
reg_start(R300_RS_COUNT, 1);
e32((1 << R300_IC_COUNT_SHIFT) | R300_HIRES_EN);
e32(0x0);
R300_STATECHANGE(r300, rr);
reg_start(R300_RS_INST_0, 0);
e32(R300_RS_INST_COL_CN_WRITE);
} else {
R300_STATECHANGE(r300, ri);
reg_start(R500_RS_IP_0, 7);
for (i = 0; i < 8; ++i) {
e32((R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_S_SHIFT) |
(R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT) |
(R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT) |
(R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT));
}
R300_STATECHANGE(r300, rc);
/* The second constant is needed to get glxgears display anything .. */
reg_start(R300_RS_COUNT, 1);
e32((1 << R300_IC_COUNT_SHIFT) | R300_HIRES_EN);
e32(0x0);
R300_STATECHANGE(r300, rr);
reg_start(R500_RS_INST_0, 0);
e32(R500_RS_INST_COL_CN_WRITE);
}
R300_STATECHANGE(r300, rc);
/* The second constant is needed to get glxgears display anything .. */
reg_start(R300_RS_COUNT, 1);
e32((1 << R300_IC_COUNT_SHIFT) | R300_HIRES_EN);
e32(0x0);
if (!is_r500) {
R300_STATECHANGE(r300, fp);
reg_start(R300_US_CONFIG, 2);
e32(0x0);
e32(0x0);
e32(0x0);
reg_start(R300_US_CODE_ADDR_0, 3);
e32(0x0);
e32(0x0);
e32(0x0);
e32(R300_RGBA_OUT);
R300_STATECHANGE(r300, rr);
reg_start(R300_RS_INST_0, 0);
e32(R300_RS_INST_COL_CN_WRITE);
R300_STATECHANGE(r300, fpi[0]);
R300_STATECHANGE(r300, fpi[1]);
R300_STATECHANGE(r300, fpi[2]);
R300_STATECHANGE(r300, fpi[3]);
R300_STATECHANGE(r300, fp);
reg_start(R300_PFS_CNTL_0, 2);
e32(0x0);
e32(0x0);
e32(0x0);
reg_start(R300_PFS_NODE_0, 3);
e32(0x0);
e32(0x0);
e32(0x0);
e32(R300_PFS_NODE_OUTPUT_COLOR);
reg_start(R300_US_ALU_RGB_INST_0, 0);
e32(FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)));
R300_STATECHANGE(r300, fpi[0]);
R300_STATECHANGE(r300, fpi[1]);
R300_STATECHANGE(r300, fpi[2]);
R300_STATECHANGE(r300, fpi[3]);
reg_start(R300_US_ALU_RGB_ADDR_0, 0);
e32(FP_SELC(0, NO, XYZ, FP_TMP(0), 0, 0));
reg_start(R300_PFS_INSTR0_0, 0);
e32(FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)));
reg_start(R300_US_ALU_ALPHA_INST_0, 0);
e32(FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)));
reg_start(R300_PFS_INSTR1_0, 0);
e32(FP_SELC(0, NO, XYZ, FP_TMP(0), 0, 0));
reg_start(R300_US_ALU_ALPHA_ADDR_0, 0);
e32(FP_SELA(0, NO, W, FP_TMP(0), 0, 0));
} else {
R300_STATECHANGE(r300, fp);
reg_start(R500_US_CONFIG, 1);
e32(R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO);
e32(0x0);
reg_start(R500_US_CODE_ADDR, 2);
e32(R500_US_CODE_START_ADDR(0) | R500_US_CODE_END_ADDR(1));
e32(R500_US_CODE_RANGE_ADDR(0) | R500_US_CODE_RANGE_SIZE(1));
e32(R500_US_CODE_OFFSET_ADDR(0));
reg_start(R300_PFS_INSTR2_0, 0);
e32(FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)));
R300_STATECHANGE(r300, r500fp);
r500fp_start_fragment(0, 6);
reg_start(R300_PFS_INSTR3_0, 0);
e32(FP_SELA(0, NO, W, FP_TMP(0), 0, 0));
e32(R500_INST_TYPE_OUT |
R500_INST_TEX_SEM_WAIT |
R500_INST_LAST |
R500_INST_RGB_OMASK_R |
R500_INST_RGB_OMASK_G |
R500_INST_RGB_OMASK_B |
R500_INST_ALPHA_OMASK |
R500_INST_RGB_CLAMP |
R500_INST_ALPHA_CLAMP);
e32(R500_RGB_ADDR0(0) |
R500_RGB_ADDR1(0) |
R500_RGB_ADDR1_CONST |
R500_RGB_ADDR2(0) |
R500_RGB_ADDR2_CONST);
e32(R500_ALPHA_ADDR0(0) |
R500_ALPHA_ADDR1(0) |
R500_ALPHA_ADDR1_CONST |
R500_ALPHA_ADDR2(0) |
R500_ALPHA_ADDR2_CONST);
e32(R500_ALU_RGB_SEL_A_SRC0 |
R500_ALU_RGB_R_SWIZ_A_R |
R500_ALU_RGB_G_SWIZ_A_G |
R500_ALU_RGB_B_SWIZ_A_B |
R500_ALU_RGB_SEL_B_SRC0 |
R500_ALU_RGB_R_SWIZ_B_R |
R500_ALU_RGB_B_SWIZ_B_G |
R500_ALU_RGB_G_SWIZ_B_B);
e32(R500_ALPHA_OP_CMP |
R500_ALPHA_SWIZ_A_A |
R500_ALPHA_SWIZ_B_A);
e32(R500_ALU_RGBA_OP_CMP |
R500_ALU_RGBA_R_SWIZ_0 |
R500_ALU_RGBA_G_SWIZ_0 |
R500_ALU_RGBA_B_SWIZ_0 |
R500_ALU_RGBA_A_SWIZ_0);
}
reg_start(R300_VAP_PVS_STATE_FLUSH_REG, 0);
e32(0x00000000);
if (has_tcl) {
vap_cntl = ((10 << R300_PVS_NUM_SLOTS_SHIFT) |
(5 << R300_PVS_NUM_CNTLRS_SHIFT) |
(12 << R300_VF_MAX_VTX_NUM_SHIFT));
if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515)
vap_cntl |= R500_TCL_STATE_OPTIMIZATION;
} else
vap_cntl = ((10 << R300_PVS_NUM_SLOTS_SHIFT) |
(5 << R300_PVS_NUM_CNTLRS_SHIFT) |
(5 << R300_VF_MAX_VTX_NUM_SHIFT));
if (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV515)
vap_cntl |= (2 << R300_PVS_NUM_FPUS_SHIFT);
else if ((r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV530) ||
(r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV560))
vap_cntl |= (5 << R300_PVS_NUM_FPUS_SHIFT);
else if (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R420)
vap_cntl |= (6 << R300_PVS_NUM_FPUS_SHIFT);
else if ((r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R520) ||
(r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R580) ||
(r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV570))
vap_cntl |= (8 << R300_PVS_NUM_FPUS_SHIFT);
else
vap_cntl |= (4 << R300_PVS_NUM_FPUS_SHIFT);
R300_STATECHANGE(rmesa, vap_cntl);
reg_start(R300_VAP_CNTL, 0);
e32(vap_cntl);
if (has_tcl) {
R300_STATECHANGE(r300, pvs);
reg_start(R300_VAP_PVS_CNTL_1, 2);
reg_start(R300_VAP_PVS_CODE_CNTL_0, 2);
e32((0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) |
(0 << R300_PVS_CNTL_1_POS_END_SHIFT) |
(1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT));
e32(0x0);
e32(1 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT);
e32((0 << R300_PVS_FIRST_INST_SHIFT) |
(0 << R300_PVS_XYZW_VALID_INST_SHIFT) |
(1 << R300_PVS_LAST_INST_SHIFT));
e32((0 << R300_PVS_CONST_BASE_OFFSET_SHIFT) |
(0 << R300_PVS_MAX_CONST_ADDR_SHIFT));
e32(1 << R300_PVS_LAST_VTX_SRC_INST_SHIFT);
R300_STATECHANGE(r300, vpi);
vsf_start_fragment(0x0, 8);

File diff suppressed because it is too large Load diff

View file

@ -334,13 +334,26 @@ static GLboolean r300RunRender(GLcontext * ctx,
static int r300Fallback(GLcontext * ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
struct r300_fragment_program *fp = (struct r300_fragment_program *)
/* Do we need to use new-style shaders?
* Also is there a better way to do this? */
if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
struct r500_fragment_program *fp = (struct r500_fragment_program *)
(char *)ctx->FragmentProgram._Current;
if (fp) {
if (!fp->translated)
r300TranslateFragmentShader(r300, fp);
FALLBACK_IF(!fp->translated);
if (fp) {
if (!fp->translated) {
r500TranslateFragmentShader(r300, fp);
FALLBACK_IF(!fp->translated);
}
}
} else {
struct r300_fragment_program *fp = (struct r300_fragment_program *)
(char *)ctx->FragmentProgram._Current;
if (fp) {
if (!fp->translated) {
r300TranslateFragmentShader(r300, fp);
FALLBACK_IF(!fp->translated);
}
}
}
FALLBACK_IF(ctx->RenderMode != GL_RENDER);

View file

@ -9,8 +9,10 @@
static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target,
GLuint id)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct r300_vertex_program_cont *vp;
struct r300_fragment_program *fp;
struct r300_fragment_program *r300_fp;
struct r500_fragment_program *r500_fp;
switch (target) {
case GL_VERTEX_STATE_PROGRAM_NV:
@ -19,14 +21,28 @@ static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target,
return _mesa_init_vertex_program(ctx, &vp->mesa_program,
target, id);
case GL_FRAGMENT_PROGRAM_ARB:
fp = CALLOC_STRUCT(r300_fragment_program);
fp->ctx = ctx;
return _mesa_init_fragment_program(ctx, &fp->mesa_program,
target, id);
if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
r500_fp = CALLOC_STRUCT(r500_fragment_program);
r500_fp->ctx = ctx;
return _mesa_init_fragment_program(ctx, &r500_fp->mesa_program,
target, id);
} else {
r300_fp = CALLOC_STRUCT(r300_fragment_program);
r300_fp->ctx = ctx;
return _mesa_init_fragment_program(ctx, &r300_fp->mesa_program,
target, id);
}
case GL_FRAGMENT_PROGRAM_NV:
fp = CALLOC_STRUCT(r300_fragment_program);
return _mesa_init_fragment_program(ctx, &fp->mesa_program,
target, id);
if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
r500_fp = CALLOC_STRUCT(r500_fragment_program);
return _mesa_init_fragment_program(ctx, &r500_fp->mesa_program,
target, id);
} else {
r300_fp = CALLOC_STRUCT(r300_fragment_program);
return _mesa_init_fragment_program(ctx, &r300_fp->mesa_program,
target, id);
}
default:
_mesa_problem(ctx, "Bad target in r300NewProgram");
}
@ -42,15 +58,20 @@ static void r300DeleteProgram(GLcontext * ctx, struct gl_program *prog)
static void
r300ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct r300_vertex_program_cont *vp = (void *)prog;
struct r300_fragment_program *fp = (struct r300_fragment_program *)prog;
struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)prog;
struct r500_fragment_program *r500_fp = (struct r500_fragment_program *)prog;
switch (target) {
case GL_VERTEX_PROGRAM_ARB:
vp->progs = NULL;
break;
case GL_FRAGMENT_PROGRAM_ARB:
fp->translated = GL_FALSE;
if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515)
r500_fp->translated = GL_FALSE;
else
r300_fp->translated = GL_FALSE;
break;
}

File diff suppressed because it is too large Load diff

View file

@ -78,31 +78,6 @@ do { \
rmesa->swtcl.vertex_attr_count++; \
} while (0)
/* this differs from the VIR0 in emit.c - TODO merge them using another option */
static GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr,
int *inputs, GLint * tab, GLuint nr)
{
GLuint i, dw;
/* type, inputs, stop bit, size */
for (i = 0; i + 1 < nr; i += 2) {
dw = (inputs[tab[i]] << 8) | 0x3;
dw |= ((inputs[tab[i + 1]] << 8) | 0x3) << 16;
if (i + 2 == nr) {
dw |= (R300_VAP_INPUT_ROUTE_END << 16);
}
dst[i >> 1] = dw;
}
if (nr & 1) {
dw = (inputs[tab[nr - 1]] << 8) | 0x3;
dw |= R300_VAP_INPUT_ROUTE_END;
dst[nr >> 1] = dw;
}
return (nr + 1) >> 1;
}
static void r300SetVertexFormat( GLcontext *ctx )
{
r300ContextPtr rmesa = R300_CONTEXT( ctx );
@ -118,19 +93,24 @@ static void r300SetVertexFormat( GLcontext *ctx )
GLint tab[VERT_ATTRIB_MAX];
int swizzle[VERT_ATTRIB_MAX][4];
GLuint i, nr;
GLuint sz, vap_fmt_1 = 0;
DECLARE_RENDERINPUTS(render_inputs_bitset);
RENDERINPUTS_COPY(render_inputs_bitset, tnl->render_inputs_bitset);
RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
RENDERINPUTS_COPY(rmesa->state.render_inputs_bitset, render_inputs_bitset);
vte = rmesa->hw.vte.cmd[1];
vte &= ~(R300_VTX_XY_FMT | R300_VTX_Z_FMT | R300_VTX_W0_FMT);
/* Important:
*/
if ( VB->NdcPtr != NULL ) {
VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
vte |= R300_VTX_XY_FMT | R300_VTX_Z_FMT;
}
else {
VB->AttribPtr[VERT_ATTRIB_POS] = VB->ClipPtr;
vte |= R300_VTX_W0_FMT;
}
assert( VB->AttribPtr[VERT_ATTRIB_POS] != NULL );
@ -140,14 +120,15 @@ static void r300SetVertexFormat( GLcontext *ctx )
* build up a hardware vertex.
*/
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POS)) {
vap_vte_cntl |= R300_VTX_W0_FMT;
sz = VB->AttribPtr[VERT_ATTRIB_POS]->size;
InputsRead |= 1 << VERT_ATTRIB_POS;
OutputsWritten |= 1 << VERT_RESULT_HPOS;
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F );
} else
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_1F + sz - 1 );
offset = sz;
} else {
offset = 4;
EMIT_PAD(4 * sizeof(float));
offset = 4;
}
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE )) {
EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F );
@ -156,18 +137,19 @@ static void r300SetVertexFormat( GLcontext *ctx )
}
if (RENDERINPUTS_TEST(index_bitset, _TNL_ATTRIB_COLOR0)) {
sz = VB->AttribPtr[VERT_ATTRIB_COLOR0]->size;
rmesa->swtcl.coloroffset = offset;
InputsRead |= 1 << VERT_ATTRIB_COLOR0;
OutputsWritten |= 1 << VERT_RESULT_COL0;
EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4F );
EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_1F + sz - 1 );
offset += sz;
}
offset += 4;
rmesa->swtcl.specoffset = 0;
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
sz = VB->AttribPtr[VERT_ATTRIB_COLOR1]->size;
rmesa->swtcl.specoffset = offset;
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4F );
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_1F + sz - 1 );
InputsRead |= 1 << VERT_ATTRIB_COLOR1;
OutputsWritten |= 1 << VERT_RESULT_COL1;
}
@ -177,9 +159,11 @@ static void r300SetVertexFormat( GLcontext *ctx )
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
sz = VB->TexCoordPtr[i]->size;
InputsRead |= 1 << (VERT_ATTRIB_TEX0 + i);
OutputsWritten |= 1 << (VERT_RESULT_TEX0 + i);
EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_4F );
EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_1F + sz - 1 );
vap_fmt_1 |= sz << (3 * i);
}
}
}
@ -238,7 +222,7 @@ static void r300SetVertexFormat( GLcontext *ctx )
R300_STATECHANGE(rmesa, vof);
rmesa->hw.vof.cmd[R300_VOF_CNTL_0] = r300VAPOutputCntl0(ctx, OutputsWritten);
rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = r300VAPOutputCntl1(ctx, OutputsWritten);
rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = vap_fmt_1;
rmesa->swtcl.vertex_size =
_tnl_install_attrs( ctx,
@ -250,7 +234,7 @@ static void r300SetVertexFormat( GLcontext *ctx )
RENDERINPUTS_COPY( rmesa->tnl_index_bitset, index_bitset );
vte = rmesa->hw.vte.cmd[1];
R300_STATECHANGE(rmesa, vte);
rmesa->hw.vte.cmd[1] = vte;
rmesa->hw.vte.cmd[2] = rmesa->swtcl.vertex_size;
@ -591,6 +575,7 @@ static void r300RenderStart(GLcontext *ctx)
r300ChooseRenderState(ctx);
r300SetVertexFormat(ctx);
r300UpdateShaders(rmesa);
r300UpdateShaderStates(rmesa);
r300EmitCacheFlush(rmesa);

View file

@ -398,16 +398,18 @@ static void r300SetTexImages(r300ContextPtr rmesa,
R300_TX_HEIGHTMASK_SHIFT))
| ((numLevels - 1) << R300_TX_MAX_MIP_LEVEL_SHIFT);
t->pitch = 0;
/* Only need to round to nearest 32 for textures, but the blitter
* requires 64-byte aligned pitches, and we may/may not need the
* blitter. NPOT only!
*/
if (baseImage->IsCompressed) {
t->pitch =
t->pitch |=
(tObj->Image[0][t->base.firstLevel]->Width + 63) & ~(63);
} else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
unsigned int align = blitWidth - 1;
t->pitch = ((tObj->Image[0][t->base.firstLevel]->Width *
t->pitch |= ((tObj->Image[0][t->base.firstLevel]->Width *
texelBytes) + 63) & ~(63);
t->size |= R300_TX_SIZE_TXPITCH_EN;
if (!t->image_override)
@ -415,11 +417,18 @@ static void r300SetTexImages(r300ContextPtr rmesa,
(((tObj->Image[0][t->base.firstLevel]->Width) +
align) & ~align) - 1;
} else {
t->pitch =
t->pitch |=
((tObj->Image[0][t->base.firstLevel]->Width *
texelBytes) + 63) & ~(63);
}
if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
if (tObj->Image[0][t->base.firstLevel]->Width > 2048)
t->pitch_reg |= R500_TXWIDTH_BIT11;
if (tObj->Image[0][t->base.firstLevel]->Height > 2048)
t->pitch_reg |= R500_TXHEIGHT_BIT11;
}
t->dirty_state = TEX_ALL;
/* FYI: r300UploadTexImages( rmesa, t ) used to be called here */
@ -573,6 +582,7 @@ void r300SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
struct gl_texture_object *tObj =
_mesa_lookup_texture(rmesa->radeon.glCtx, texname);
r300TexObjPtr t;
uint32_t pitch_val;
if (!tObj)
return;
@ -585,28 +595,30 @@ void r300SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
return;
t->offset = offset;
t->pitch_reg = pitch;
t->pitch_reg &= (1 << 13) -1;
pitch_val = pitch;
switch (depth) {
case 32:
t->format = R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8);
t->filter |= tx_table[2].filter;
t->pitch_reg /= 4;
pitch_val /= 4;
break;
case 24:
default:
t->format = R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8);
t->filter |= tx_table[4].filter;
t->pitch_reg /= 4;
pitch_val /= 4;
break;
case 16:
t->format = R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5);
t->filter |= tx_table[5].filter;
t->pitch_reg /= 2;
pitch_val /= 2;
break;
}
pitch_val--;
t->pitch_reg--;
t->pitch_reg |= pitch_val;
}
static GLboolean r300UpdateTextureUnit(GLcontext * ctx, int unit)

Some files were not shown because too many files have changed in this diff Show more