mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
Merge branch 'master' into drm-gem
Conflicts: src/mesa/drivers/dri/common/dri_bufmgr.c src/mesa/drivers/dri/i965/brw_wm_surface_state.c
This commit is contained in:
commit
1e645b3659
219 changed files with 10044 additions and 30891 deletions
13
Makefile
13
Makefile
|
|
@ -174,10 +174,10 @@ ultrix-gcc:
|
|||
|
||||
# Rules for making release tarballs
|
||||
|
||||
DIRECTORY = Mesa-7.1-rc1
|
||||
LIB_NAME = MesaLib-7.1-rc1
|
||||
DEMO_NAME = MesaDemos-7.1-rc1
|
||||
GLUT_NAME = MesaGLUT-7.1-rc1
|
||||
DIRECTORY = Mesa-7.1-rc3
|
||||
LIB_NAME = MesaLib-7.1-rc3
|
||||
DEMO_NAME = MesaDemos-7.1-rc3
|
||||
GLUT_NAME = MesaGLUT-7.1-rc3
|
||||
|
||||
MAIN_FILES = \
|
||||
$(DIRECTORY)/Makefile* \
|
||||
|
|
@ -258,6 +258,7 @@ MAIN_FILES = \
|
|||
$(DIRECTORY)/src/mesa/tnl_dd/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm \
|
||||
$(DIRECTORY)/src/mesa/drivers/Makefile \
|
||||
$(DIRECTORY)/src/mesa/drivers/beos/*.cpp \
|
||||
$(DIRECTORY)/src/mesa/drivers/beos/Makefile \
|
||||
$(DIRECTORY)/src/mesa/drivers/common/*.[ch] \
|
||||
|
|
@ -265,6 +266,7 @@ MAIN_FILES = \
|
|||
$(DIRECTORY)/src/mesa/drivers/directfb/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/drivers/directfb/Makefile \
|
||||
$(DIRECTORY)/src/mesa/drivers/dos/*.[chS] \
|
||||
$(DIRECTORY)/src/mesa/drivers/fbdev/Makefile \
|
||||
$(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c \
|
||||
$(DIRECTORY)/src/mesa/drivers/glide/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/drivers/ggi/*.[ch] \
|
||||
|
|
@ -274,6 +276,7 @@ MAIN_FILES = \
|
|||
$(DIRECTORY)/src/mesa/drivers/ggi/display/*.c \
|
||||
$(DIRECTORY)/src/mesa/drivers/ggi/display/fbdev.conf.in \
|
||||
$(DIRECTORY)/src/mesa/drivers/ggi/include/ggi/mesa/*.h \
|
||||
$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile \
|
||||
$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.win \
|
||||
$(DIRECTORY)/src/mesa/drivers/osmesa/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def \
|
||||
|
|
@ -281,6 +284,7 @@ MAIN_FILES = \
|
|||
$(DIRECTORY)/src/mesa/drivers/svga/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/drivers/windows/*/*.def \
|
||||
$(DIRECTORY)/src/mesa/drivers/x11/Makefile \
|
||||
$(DIRECTORY)/src/mesa/drivers/x11/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/drivers/x11/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/ppc/*.[ch] \
|
||||
|
|
@ -317,6 +321,7 @@ DRI_FILES = \
|
|||
$(DIRECTORY)/src/glx/x11/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/drivers/dri/Makefile \
|
||||
$(DIRECTORY)/src/mesa/drivers/dri/Makefile.template \
|
||||
$(DIRECTORY)/src/mesa/drivers/dri/dri.pc.in \
|
||||
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po \
|
||||
$(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS] \
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ case $ARCH in
|
|||
if [ $EXPORTS ] ; then
|
||||
#OPTS="${OPTS} -Xlinker --retain-symbols-file ${EXPORTS}"
|
||||
# Make the 'exptmp' file for --version-script option
|
||||
echo "VERSION_${MAJOR}.${MINOR} {" > exptmp
|
||||
echo "{" > exptmp
|
||||
echo "global:" >> exptmp
|
||||
sed 's/$/;/' ${EXPORTS} >> exptmp
|
||||
echo "local:" >> exptmp
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ ASM_API = @ASM_API@
|
|||
|
||||
# Misc tools and flags
|
||||
MAKE = @MAKE@
|
||||
SHELL = @SHELL@
|
||||
MKLIB_OPTIONS = @MKLIB_OPTIONS@
|
||||
MKDEP = @MKDEP@
|
||||
MKDEP_OPTIONS = @MKDEP_OPTIONS@
|
||||
INSTALL = $(TOP)/bin/minstall
|
||||
|
||||
# Python and flags (generally only needed by the developers)
|
||||
PYTHON2 = python
|
||||
|
|
@ -66,6 +66,10 @@ USING_EGL = @USING_EGL@
|
|||
# Dependencies
|
||||
X11_INCLUDES = @X11_INCLUDES@
|
||||
|
||||
# GLw motif setup
|
||||
GLW_SOURCES = @GLW_SOURCES@
|
||||
MOTIF_CFLAGS = @MOTIF_CFLAGS@
|
||||
|
||||
# Library/program dependencies
|
||||
GL_LIB_DEPS = $(EXTRA_LIB_PATH) @GL_LIB_DEPS@
|
||||
OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @OSMESA_MESA_DEPS@ \
|
||||
|
|
@ -89,15 +93,15 @@ EXPAT_INCLUDES = @EXPAT_INCLUDES@
|
|||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
libdir = @libdir@
|
||||
includedir = @includedir@
|
||||
|
||||
# Installation directories (for make install)
|
||||
INSTALL_DIR = $(prefix)
|
||||
INSTALL_LIB_DIR = $(libdir)
|
||||
INSTALL_INC_DIR = $(includedir)
|
||||
|
||||
# DRI installation directories
|
||||
DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@
|
||||
|
||||
# Where libGL will look for DRI hardware drivers
|
||||
DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
|
||||
|
||||
# Additional per-platform configuration settings
|
||||
@EXTRA_CONFIG_LINES@
|
||||
|
|
|
|||
|
|
@ -25,11 +25,13 @@ LDFLAGS =
|
|||
GLU_CFLAGS =
|
||||
|
||||
# Misc tools and flags
|
||||
SHELL = /bin/sh
|
||||
MKLIB = $(SHELL) $(TOP)/bin/mklib
|
||||
MKLIB_OPTIONS =
|
||||
MKDEP = makedepend
|
||||
MKDEP_OPTIONS = -fdepend
|
||||
MAKE = make
|
||||
INSTALL = $(TOP)/bin/minstall
|
||||
INSTALL = $(SHELL) $(TOP)/bin/minstall
|
||||
|
||||
# Tools for regenerating glapi (generally only needed by the developers)
|
||||
PYTHON2 = python
|
||||
|
|
@ -59,6 +61,7 @@ ASM_SOURCES =
|
|||
# GLw widget sources (Append "GLwMDrawA.c" here and add -lXm to GLW_LIB_DEPS in
|
||||
# order to build the Motif widget too)
|
||||
GLW_SOURCES = GLwDrawA.c
|
||||
MOTIF_CFLAGS = -I/usr/include/Motif1.2
|
||||
|
||||
|
||||
# Directories to build
|
||||
|
|
@ -84,7 +87,9 @@ APP_LIB_DEPS = -lm
|
|||
|
||||
# Installation directories (for make install)
|
||||
INSTALL_DIR = /usr/local
|
||||
DRI_DRIVER_INSTALL_DIR = $(INSTALL_DIR)/$(LIB_DIR)/dri
|
||||
INSTALL_LIB_DIR = $(INSTALL_DIR)/$(LIB_DIR)
|
||||
INSTALL_INC_DIR = $(INSTALL_DIR)/include
|
||||
DRI_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/dri
|
||||
|
||||
# Where libGL will look for DRI hardware drivers
|
||||
DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
|
||||
|
|
|
|||
|
|
@ -70,4 +70,4 @@ WINDOW_SYSTEM=dri
|
|||
# gamma are missing because they have not been converted to use the new
|
||||
# interface.
|
||||
DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon s3v \
|
||||
savage sis tdfx trident unichrome ffb nouveau
|
||||
savage sis tdfx trident unichrome ffb
|
||||
|
|
|
|||
61
configure.ac
61
configure.ac
|
|
@ -12,6 +12,10 @@ m4_ifval(mesa_version,[],[
|
|||
m4_exit([1])
|
||||
])
|
||||
|
||||
dnl Tell the user about autoconf.html in the --help output
|
||||
m4_divert_once([HELP_END], [
|
||||
See docs/autoconf.html for more details on the options for Mesa.])
|
||||
|
||||
AC_INIT([Mesa],[mesa_version],
|
||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
|
||||
AC_CONFIG_AUX_DIR([bin])
|
||||
|
|
@ -29,18 +33,16 @@ AC_CHECK_PROGS([MAKE], [gmake make])
|
|||
AC_PATH_PROG([MKDEP], [makedepend])
|
||||
AC_PATH_PROG([SED], [sed])
|
||||
|
||||
dnl Platform-specific program settings
|
||||
EXTRA_CONFIG_LINES=""
|
||||
AC_SUBST([EXTRA_CONFIG_LINES])
|
||||
dnl We need a POSIX shell for parts of the build. Assume we have one
|
||||
dnl in most cases.
|
||||
case "$host_os" in
|
||||
solaris*)
|
||||
# Solaris /bin/sh is too old/non-POSIX compliant
|
||||
AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
|
||||
EXTRA_CONFIG_LINES="SHELL=$POSIX_SHELL"
|
||||
SHELL="$POSIX_SHELL"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
MKDEP_OPTIONS=-fdepend
|
||||
dnl Ask gcc where it's keeping its secret headers
|
||||
if test "x$GCC" = xyes; then
|
||||
|
|
@ -85,7 +87,7 @@ linux*)
|
|||
if test "x$GCC" = xyes; then
|
||||
DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
|
||||
fi
|
||||
DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
|
||||
DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS"
|
||||
;;
|
||||
solaris*)
|
||||
DEFINES="$DEFINES -DPTHREADS -DSVR4"
|
||||
|
|
@ -325,6 +327,9 @@ dnl has it in libc), or if libdl is needed to get it.
|
|||
AC_CHECK_FUNC([dlopen], [],
|
||||
[AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
|
||||
|
||||
dnl See if posix_memalign is available
|
||||
AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
|
||||
|
||||
dnl SELinux awareness.
|
||||
AC_ARG_ENABLE([selinux],
|
||||
[AS_HELP_STRING([--enable-selinux],
|
||||
|
|
@ -449,7 +454,7 @@ esac
|
|||
|
||||
dnl
|
||||
dnl Find out if X is available. The variable have_x is set if libX11 is
|
||||
dnl to mimic AC_PATH_XTRA.
|
||||
dnl found to mimic AC_PATH_XTRA.
|
||||
dnl
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
AC_MSG_CHECKING([pkg-config files for X11 are available])
|
||||
|
|
@ -468,6 +473,12 @@ if test "$x11_pkgconfig" = no; then
|
|||
AC_PATH_XTRA
|
||||
fi
|
||||
|
||||
dnl Try to tell the user that the --x-* options are only used when
|
||||
dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
|
||||
m4_divert_once([HELP_BEGIN],
|
||||
[These options are only used when the X libraries cannot be found by the
|
||||
pkg-config utility.])
|
||||
|
||||
dnl We need X for xlib and dri, so bomb now if it's not found
|
||||
case "$mesa_driver" in
|
||||
xlib|dri)
|
||||
|
|
@ -601,7 +612,8 @@ fi
|
|||
dnl Which drivers to build - default is chosen by platform
|
||||
AC_ARG_WITH([dri-drivers],
|
||||
[AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
|
||||
[comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
|
||||
[comma delimited DRI drivers list, e.g.
|
||||
"swrast,i965,radeon,nouveau" @<:@default=auto@:>@])],
|
||||
[with_dri_drivers="$withval"],
|
||||
[with_dri_drivers=yes])
|
||||
if test "x$with_dri_drivers" = x; then
|
||||
|
|
@ -615,7 +627,7 @@ case "$with_dri_drivers" in
|
|||
no|yes) ;;
|
||||
*)
|
||||
# verify the requested driver directories exist
|
||||
dri_drivers=`IFS=,; echo $with_dri_drivers`
|
||||
dri_drivers=`IFS=', '; echo $with_dri_drivers`
|
||||
for driver in $dri_drivers; do
|
||||
test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
|
||||
AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
|
||||
|
|
@ -866,6 +878,12 @@ if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
|
|||
AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
|
||||
enable_glw=no
|
||||
fi
|
||||
AC_ARG_ENABLE([motif],
|
||||
[AS_HELP_STRING([--enable-motif],
|
||||
[use Motif widgets in GLw @<:@default=disabled@:>@])],
|
||||
[enable_motif="$enableval"],
|
||||
[enable_motif=no])
|
||||
|
||||
if test "x$enable_glw" = xyes; then
|
||||
SRC_DIRS="$SRC_DIRS glw"
|
||||
if test "$x11_pkgconfig" = yes; then
|
||||
|
|
@ -873,7 +891,25 @@ if test "x$enable_glw" = xyes; then
|
|||
GLW_LIB_DEPS="$GLW_LIBS"
|
||||
else
|
||||
# should check these...
|
||||
GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
|
||||
GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
|
||||
fi
|
||||
|
||||
GLW_SOURCES="GLwDrawA.c"
|
||||
MOTIF_CFLAGS=
|
||||
if test "x$enable_motif" = xyes; then
|
||||
GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
|
||||
AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
|
||||
if test "x$MOTIF_CONFIG" != xno; then
|
||||
MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
|
||||
MOTIF_LIBS=`$MOTIF_CONFIG --libs`
|
||||
else
|
||||
AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
|
||||
[AC_MSG_ERROR([Can't locate Motif headers])])
|
||||
AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
|
||||
[AC_MSG_ERROR([Can't locate Motif Xm library])])
|
||||
fi
|
||||
# MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
|
||||
GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
|
||||
fi
|
||||
|
||||
# If static, empty GLW_LIB_DEPS and add libs for programs to link
|
||||
|
|
@ -888,6 +924,8 @@ if test "x$enable_glw" = xyes; then
|
|||
fi
|
||||
AC_SUBST([GLW_LIB_DEPS])
|
||||
AC_SUBST([GLW_MESA_DEPS])
|
||||
AC_SUBST([GLW_SOURCES])
|
||||
AC_SUBST([MOTIF_CFLAGS])
|
||||
|
||||
dnl
|
||||
dnl GLUT configuration
|
||||
|
|
@ -990,6 +1028,7 @@ echo ""
|
|||
echo " prefix: $prefix"
|
||||
echo " exec_prefix: $exec_prefix"
|
||||
echo " libdir: $libdir"
|
||||
echo " includedir: $includedir"
|
||||
|
||||
dnl Driver info
|
||||
echo ""
|
||||
|
|
@ -1012,7 +1051,7 @@ echo ""
|
|||
echo " Shared libs: $enable_shared"
|
||||
echo " Static libs: $enable_static"
|
||||
echo " GLU: $enable_glu"
|
||||
echo " GLw: $enable_glw"
|
||||
echo " GLw: $enable_glw (Motif: $enable_motif)"
|
||||
echo " glut: $enable_glut"
|
||||
|
||||
dnl Programs
|
||||
|
|
|
|||
|
|
@ -182,11 +182,12 @@ will search for DRI drivers. The default is <code>${libdir}/dri</code>.
|
|||
</li>
|
||||
<li><code>--with-dri-drivers=DRIVER,DRIVER,...</code> - This option
|
||||
allows a specific set of DRI drivers to be built. For example,
|
||||
<code>--with-dri-drivers="i965,radeon,nouveau"</code>. By default,
|
||||
the drivers will be chosen depending on the target platform. See the
|
||||
directory <code>src/mesa/drivers/dri</code> in the source tree for
|
||||
available drivers.
|
||||
</li>
|
||||
<code>--with-dri-drivers="swrast,i965,radeon,nouveau"</code>. By
|
||||
default, the drivers will be chosen depending on the target platform.
|
||||
See the directory <code>src/mesa/drivers/dri</code> in the source tree
|
||||
for available drivers. Beware that the swrast DRI driver is used by both
|
||||
libGL and the X.Org xserver GLX module to do software rendering, so you
|
||||
may run into problems if it is not available.</li>
|
||||
<!-- This explanation might be totally bogus. Kristian? -->
|
||||
<li><code>--disable-driglx-direct</code> - Disable direct rendering in
|
||||
GLX. Normally, direct hardware rendering through the DRI drivers and
|
||||
|
|
|
|||
|
|
@ -25,23 +25,12 @@
|
|||
<h3>1.1 Prerequisites for DRI and Hardware Acceleration</h3>
|
||||
|
||||
<p>
|
||||
To build Mesa with DRI-based hardware acceleration you must first have
|
||||
the right version of DRM.
|
||||
To build Mesa 7.1 with DRI-based hardware acceleration you must first have
|
||||
the <a href="http://dri.freedesktop.org/libdrm/" target="_parent">DRM version 2.3.1</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For Mesa 7.1 a particular snapshot of
|
||||
<a href="http://dri.freedesktop.org/libdrm/">DRM</a> from git is required:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
git-clone git://anongit.freedesktop.org/git/mesa/drm
|
||||
git-checkout (XXXX HASH ID TBD)
|
||||
</pre>
|
||||
</li>
|
||||
|
||||
<p>
|
||||
You should also be using Xorg server version 1.4
|
||||
You should also be using the Xorg server version 1.4 or 1.5.
|
||||
</p>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,13 @@ TBD
|
|||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Fixed a number of minor GLSL intrinsic function/constructor bugs
|
||||
<li>Fixed some error code/detection bugs in the GLSL-related API functions
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>To Do (someday) items</h2>
|
||||
<ul>
|
||||
<li>Remove the MEMCPY() and _mesa_memcpy() wrappers and just use memcpy().
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ Contents
|
|||
<li><a href="#unsup">Unsupported Features</a>
|
||||
<li><a href="#notes">Implementation Notes</a>
|
||||
<li><a href="#hints">Programming Hints</a>
|
||||
<li><a href="#standalone">Stand-alone Compiler</a>
|
||||
<li><a href="#standalone">Stand-alone GLSL Compiler</a>
|
||||
<li><a href="#implementation">Compiler Implementation</a>
|
||||
<li><a href="#validation">Compiler Validation</a>
|
||||
</ul>
|
||||
|
|
@ -133,7 +133,7 @@ These issues will be addressed/resolved in the future.
|
|||
|
||||
|
||||
<a name="standalone">
|
||||
<h2>Stand-alone Compiler</h2>
|
||||
<h2>Stand-alone GLSL Compiler</h2>
|
||||
|
||||
<p>
|
||||
A unique stand-alone GLSL compiler driver has been added to Mesa.
|
||||
|
|
@ -155,12 +155,10 @@ This tool is useful for:
|
|||
</ul>
|
||||
|
||||
<p>
|
||||
To build the glslcompiler program (this will be improved someday):
|
||||
After building Mesa, the glslcompiler can be built by manually running:
|
||||
</p>
|
||||
<pre>
|
||||
cd src/mesa
|
||||
make libmesa.a
|
||||
cd drivers/glslcompiler
|
||||
cd src/mesa/drivers/glslcompiler
|
||||
make
|
||||
</pre>
|
||||
|
||||
|
|
@ -170,20 +168,31 @@ Here's an example of using the compiler to compile a vertex shader and
|
|||
emit GL_ARB_vertex_program-style instructions:
|
||||
</p>
|
||||
<pre>
|
||||
glslcompiler --arb --linenumbers --vs vertshader.txt
|
||||
bin/glslcompiler --debug --numbers --fs progs/glsl/CH06-brick.frag.txt
|
||||
</pre>
|
||||
<p>
|
||||
The output may look similar to this:
|
||||
results in:
|
||||
</p>
|
||||
<pre>
|
||||
!!ARBvp1.0
|
||||
0: MOV result.texcoord[0], vertex.texcoord[0];
|
||||
1: DP4 temp0.x, state.matrix.mvp.row[0], vertex.position;
|
||||
2: DP4 temp0.y, state.matrix.mvp.row[1], vertex.position;
|
||||
3: DP4 temp0.z, state.matrix.mvp.row[2], vertex.position;
|
||||
4: DP4 temp0.w, state.matrix.mvp.row[3], vertex.position;
|
||||
5: MOV result.position, temp0;
|
||||
6: END
|
||||
# Fragment Program/Shader
|
||||
0: RCP TEMP[4].x, UNIFORM[2].xxxx;
|
||||
1: RCP TEMP[4].y, UNIFORM[2].yyyy;
|
||||
2: MUL TEMP[3].xy, VARYING[0], TEMP[4];
|
||||
3: MOV TEMP[1], TEMP[3];
|
||||
4: MUL TEMP[0].w, TEMP[1].yyyy, CONST[4].xxxx;
|
||||
5: FRC TEMP[1].z, TEMP[0].wwww;
|
||||
6: SGT.C TEMP[0].w, TEMP[1].zzzz, CONST[4].xxxx;
|
||||
7: IF (NE.wwww); # (if false, goto 9);
|
||||
8: ADD TEMP[1].x, TEMP[1].xxxx, CONST[4].xxxx;
|
||||
9: ENDIF;
|
||||
10: FRC TEMP[1].xy, TEMP[1];
|
||||
11: SGT TEMP[2].xy, UNIFORM[3], TEMP[1];
|
||||
12: MUL TEMP[1].z, TEMP[2].xxxx, TEMP[2].yyyy;
|
||||
13: LRP TEMP[0], TEMP[1].zzzz, UNIFORM[0], UNIFORM[1];
|
||||
14: MUL TEMP[0].xyz, TEMP[0], VARYING[1].xxxx;
|
||||
15: MOV OUTPUT[0].xyz, TEMP[0];
|
||||
16: MOV OUTPUT[0].w, CONST[4].yyyy;
|
||||
17: END
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -3419,16 +3419,16 @@ typedef unsigned short GLhalfNV;
|
|||
#endif
|
||||
|
||||
#ifndef GLEXT_64_TYPES_DEFINED
|
||||
/* This code block is duplicated in glext.h, so must be protected */
|
||||
/* This code block is duplicated in glxext.h, so must be protected */
|
||||
#define GLEXT_64_TYPES_DEFINED
|
||||
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
|
||||
/* (as used in the GL_EXT_timer_query extension). */
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#include <inttypes.h>
|
||||
#elif defined(__sun__)
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
#include <inttypes.h>
|
||||
#if defined(__STDC__)
|
||||
#if defined(__arch64__)
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int int64_t;
|
||||
typedef unsigned long int uint64_t;
|
||||
#else
|
||||
|
|
@ -3436,7 +3436,7 @@ typedef long long int int64_t;
|
|||
typedef unsigned long long int uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#endif /* __STDC__ */
|
||||
#elif defined( __VMS )
|
||||
#elif defined( __VMS ) || defined(__sgi)
|
||||
#include <inttypes.h>
|
||||
#elif defined(__SCO__) || defined(__USLC__)
|
||||
#include <stdint.h>
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ typedef struct {
|
|||
#endif
|
||||
|
||||
#ifndef GLEXT_64_TYPES_DEFINED
|
||||
/* This code block is duplicated in glxext.h, so must be protected */
|
||||
/* This code block is duplicated in glext.h, so must be protected */
|
||||
#define GLEXT_64_TYPES_DEFINED
|
||||
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
|
||||
/* (as used in the GLX_OML_sync_control extension). */
|
||||
|
|
@ -389,7 +389,7 @@ typedef struct {
|
|||
#elif defined(__sun__) || defined(__digital__)
|
||||
#include <inttypes.h>
|
||||
#if defined(__STDC__)
|
||||
#if defined(__arch64__)
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int int64_t;
|
||||
typedef unsigned long int uint64_t;
|
||||
#else
|
||||
|
|
@ -397,7 +397,7 @@ typedef long long int int64_t;
|
|||
typedef unsigned long long int uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#endif /* __STDC__ */
|
||||
#elif defined( __VMS )
|
||||
#elif defined( __VMS ) || defined(__sgi)
|
||||
#include <inttypes.h>
|
||||
#elif defined(__SCO__) || defined(__USLC__)
|
||||
#include <stdint.h>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ PROGS = \
|
|||
cubemap \
|
||||
drawpix \
|
||||
engine \
|
||||
fbo_firecube \
|
||||
fire \
|
||||
fogcoord \
|
||||
fplight \
|
||||
|
|
|
|||
1041
progs/demos/fbo_firecube.c
Normal file
1041
progs/demos/fbo_firecube.c
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
static GLfloat Xrot = 0, Yrot = -30, Zrot = 0;
|
||||
static GLboolean Anim = GL_TRUE;
|
||||
static GLint Bias = 4, BiasStepSign = +1; /* ints avoid fp precision problem */
|
||||
static GLint Bias = 0, BiasStepSign = +1; /* ints avoid fp precision problem */
|
||||
static GLint BiasMin = -400, BiasMax = 400;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -955,7 +955,6 @@ Init(void)
|
|||
glGenTextures(1, &GrayTexture);
|
||||
glBindTexture(GL_TEXTURE_1D, GrayTexture);
|
||||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
static GLfloat Zrot = 0;
|
||||
static GLboolean Anim = GL_TRUE;
|
||||
static GLboolean HaveMultisample = GL_TRUE;
|
||||
static GLboolean DoMultisample = GL_TRUE;
|
||||
|
||||
|
||||
static void
|
||||
|
|
@ -86,7 +87,10 @@ Display( void )
|
|||
glColor3f(1, 1, 1);
|
||||
if (HaveMultisample) {
|
||||
glRasterPos2f(-3.1, -1.6);
|
||||
PrintString("MULTISAMPLE");
|
||||
if (DoMultisample)
|
||||
PrintString("MULTISAMPLE");
|
||||
else
|
||||
PrintString("MULTISAMPLE (off)");
|
||||
}
|
||||
glRasterPos2f(-0.8, -1.6);
|
||||
PrintString("No antialiasing");
|
||||
|
|
@ -96,7 +100,8 @@ Display( void )
|
|||
/* multisample */
|
||||
if (HaveMultisample) {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_MULTISAMPLE_ARB);
|
||||
if (DoMultisample)
|
||||
glEnable(GL_MULTISAMPLE_ARB);
|
||||
glPushMatrix();
|
||||
glTranslatef(-2.5, 0, 0);
|
||||
glPushMatrix();
|
||||
|
|
@ -173,6 +178,9 @@ Key( unsigned char key, int x, int y )
|
|||
else
|
||||
glutIdleFunc(NULL);
|
||||
break;
|
||||
case 'm':
|
||||
DoMultisample = !DoMultisample;
|
||||
break;
|
||||
case 'z':
|
||||
Zrot = (int) (Zrot - step);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ TRACER = gltrace.so
|
|||
default: $(TRACER)
|
||||
|
||||
$(TRACER): $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o $(TRACER) -noprefix -cplusplus \
|
||||
$(MKLIB) -o $(TRACER) -noprefix -cplusplus -linker '$(CXX)' \
|
||||
-ldflags '$(LDFLAGS)' $(MKLIB_OPTIONS) $(OBJECTS)
|
||||
|
||||
gltrace.cc: gltrace.py
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
|
||||
#include "gltrace_support.h"
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <assert.h>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
|
@ -136,7 +138,7 @@ namespace gltrace {
|
|||
|
||||
struct timeval now;
|
||||
struct tm t;
|
||||
static char *months[12] =
|
||||
static char const *months[12] =
|
||||
{
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
|
|
|
|||
|
|
@ -523,6 +523,13 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits)
|
|||
printf("OpenGL vendor string: %s\n", glVendor);
|
||||
printf("OpenGL renderer string: %s\n", glRenderer);
|
||||
printf("OpenGL version string: %s\n", glVersion);
|
||||
#ifdef GL_VERSION_2_0
|
||||
if (glVersion[0] >= '2' && glVersion[1] == '.') {
|
||||
char *v = (char *) glGetString(GL_SHADING_LANGUAGE_VERSION);
|
||||
printf("OpenGL shading language version string: %s\n", v);
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("OpenGL extensions:\n");
|
||||
print_extension_list(glExtensions);
|
||||
if (limits)
|
||||
|
|
|
|||
|
|
@ -21,8 +21,9 @@ default: $(TOP)/$(LIB_DIR)/demodriver.so
|
|||
|
||||
|
||||
$(TOP)/$(LIB_DIR)/demodriver.so: $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o demodriver.so -noprefix -ldflags '$(LDFLAGS)' \
|
||||
-install $(TOP)/$(LIB_DIR) $(OBJECTS)
|
||||
$(MKLIB) -o demodriver.so -noprefix -linker '$(CC)' \
|
||||
-ldflags '$(LDFLAGS)' -install $(TOP)/$(LIB_DIR) \
|
||||
$(OBJECTS)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ default: depend library Makefile
|
|||
library: $(TOP)/$(LIB_DIR)/libEGLdri.so
|
||||
|
||||
$(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o EGLdri -ldflags '$(LDFLAGS)' -major 1 -minor 0 \
|
||||
$(MKLIB) -o EGLdri -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major 1 -minor 0 \
|
||||
-install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ default: depend library
|
|||
library: $(TOP)/$(LIB_DIR)/libEGL.so
|
||||
|
||||
$(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o EGL -ldflags '$(LDFLAGS)' -major 1 -minor 0 \
|
||||
$(MKLIB) -o EGL -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major 1 -minor 0 \
|
||||
-install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,18 +16,20 @@ default: $(TOP)/configs/current
|
|||
# GLU pkg-config file
|
||||
pcedit = sed \
|
||||
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
|
||||
-e 's,@LIB_DIR@,$(LIB_DIR),' \
|
||||
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
|
||||
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
|
||||
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),'
|
||||
glu.pc: glu.pc.in
|
||||
$(pcedit) $< > $@
|
||||
|
||||
install: glu.pc
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLU.* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLU.* $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
|
||||
clean:
|
||||
-@for dir in $(SUBDIRS) ; do \
|
||||
(cd $$dir && $(MAKE) clean) ; \
|
||||
done
|
||||
-rm -f *.pc
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
prefix=@INSTALL_DIR@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/@LIB_DIR@
|
||||
includedir=${prefix}/include
|
||||
libdir=@INSTALL_LIB_DIR@
|
||||
includedir=@INSTALL_INC_DIR@
|
||||
|
||||
Name: glu
|
||||
Description: Mesa OpenGL Utility library
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ $(TOP)/$(LIB_DIR):
|
|||
|
||||
# Make the library:
|
||||
$(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS)
|
||||
@ $(TOP)/bin/mklib -o $(GLU_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
@ $(MKLIB) -o $(GLU_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \
|
||||
$(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
|
||||
$(GLU_LIB_DEPS) $(OBJECTS)
|
||||
|
|
|
|||
|
|
@ -136,9 +136,10 @@ $(TOP)/$(LIB_DIR):
|
|||
|
||||
# Make the library:
|
||||
$(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o $(GLU_LIB) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
|
||||
$(MKLIB) -o $(GLU_LIB) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
|
||||
-major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \
|
||||
-cplusplus $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
|
||||
-exports glu.exports \
|
||||
$(GLU_LIB_DEPS) $(OBJECTS)
|
||||
|
||||
|
||||
|
|
|
|||
59
src/glu/sgi/glu.exports
Normal file
59
src/glu/sgi/glu.exports
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
gluBeginCurve
|
||||
gluBeginPolygon
|
||||
gluBeginSurface
|
||||
gluBeginTrim
|
||||
gluBuild1DMipmapLevels
|
||||
gluBuild1DMipmaps
|
||||
gluBuild2DMipmapLevels
|
||||
gluBuild2DMipmaps
|
||||
gluBuild3DMipmapLevels
|
||||
gluBuild3DMipmaps
|
||||
gluCheckExtension
|
||||
gluCylinder
|
||||
gluDeleteNurbsRenderer
|
||||
gluDeleteQuadric
|
||||
gluDeleteTess
|
||||
gluDisk
|
||||
gluEndCurve
|
||||
gluEndPolygon
|
||||
gluEndSurface
|
||||
gluEndTrim
|
||||
gluErrorString
|
||||
gluGetNurbsProperty
|
||||
gluGetString
|
||||
gluGetTessProperty
|
||||
gluLoadSamplingMatrices
|
||||
gluLookAt
|
||||
gluNewNurbsRenderer
|
||||
gluNewQuadric
|
||||
gluNewTess
|
||||
gluNextContour
|
||||
gluNurbsCallback
|
||||
gluNurbsCallbackData
|
||||
gluNurbsCallbackDataEXT
|
||||
gluNurbsCurve
|
||||
gluNurbsProperty
|
||||
gluNurbsSurface
|
||||
gluOrtho2D
|
||||
gluPartialDisk
|
||||
gluPerspective
|
||||
gluPickMatrix
|
||||
gluProject
|
||||
gluPwlCurve
|
||||
gluQuadricCallback
|
||||
gluQuadricDrawStyle
|
||||
gluQuadricNormals
|
||||
gluQuadricOrientation
|
||||
gluQuadricTexture
|
||||
gluScaleImage
|
||||
gluSphere
|
||||
gluTessBeginContour
|
||||
gluTessBeginPolygon
|
||||
gluTessCallback
|
||||
gluTessEndContour
|
||||
gluTessEndPolygon
|
||||
gluTessNormal
|
||||
gluTessProperty
|
||||
gluTessVertex
|
||||
gluUnProject
|
||||
gluUnProject4
|
||||
|
|
@ -83,10 +83,10 @@ $(TOP)/$(LIB_DIR):
|
|||
|
||||
# Make the library
|
||||
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
|
||||
@$(TOP)/bin/mklib -o $(GLUT_LIB) -ldflags '$(LDFLAGS)' \
|
||||
@$(MKLIB) -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
|
||||
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(GLUT_LIB_DEPS) \
|
||||
$(OBJECTS)
|
||||
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
|
||||
$(GLUT_LIB_DEPS) $(OBJECTS)
|
||||
|
||||
clean:
|
||||
-rm -f *.o
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ default: depend $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
|
|||
|
||||
# Make the library
|
||||
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
$(MKLIB) -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
|
||||
$(GLUT_LIB_DEPS) -install $(TOP)/$(LIB_DIR) \
|
||||
$(MKLIB_OPTIONS) $(OBJECTS)
|
||||
|
|
|
|||
|
|
@ -63,16 +63,16 @@ default: depend $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
|
|||
|
||||
# Make the library
|
||||
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
$(MKLIB) -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
|
||||
$(GLUT_LIB_DEPS) -install $(TOP)/$(LIB_DIR) \
|
||||
$(MKLIB_OPTIONS) $(OBJECTS)
|
||||
|
||||
install:
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_INC_DIR)/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
|
||||
# Run 'make -f Makefile.solo dep' to update the dependencies if you change
|
||||
# what's included by any source file.
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ default: $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
|
|||
|
||||
# Make the library
|
||||
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
$(MKLIB) -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major $(GLUT_MAJOR) -minor $(GLUT_MINOR) \
|
||||
-patch $(GLUT_TINY) $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
|
||||
$(GLUT_LIB_DEPS) $(OBJECTS)
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ default: $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
|
|||
|
||||
# Make the library
|
||||
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
$(MKLIB) -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
|
||||
$(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
|
||||
$(GLUT_LIB_DEPS) $(OBJECTS)
|
||||
|
|
@ -100,24 +100,26 @@ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
|
|||
# glut pkgconfig file
|
||||
pcedit = sed \
|
||||
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
|
||||
-e 's,@LIB_DIR@,$(LIB_DIR),' \
|
||||
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
|
||||
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
|
||||
-e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),'
|
||||
glut.pc: glut.pc.in
|
||||
$(pcedit) $< > $@
|
||||
|
||||
install: glut.pc
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_INC_DIR)/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
|
||||
|
||||
clean:
|
||||
-rm -f *.o *~
|
||||
-rm -f *.lo
|
||||
-rm -f *.la
|
||||
-rm -f *.pc
|
||||
-rm -rf .libs
|
||||
-rm -f depend depend.bak
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
prefix=@INSTALL_DIR@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/@LIB_DIR@
|
||||
includedir=${prefix}/include
|
||||
libdir=@INSTALL_LIB_DIR@
|
||||
includedir=@INSTALL_INC_DIR@
|
||||
|
||||
Name: glut
|
||||
Description: Mesa OpenGL Utility Toolkit library
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ default: depend $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
|
|||
|
||||
# Make the library
|
||||
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
$(MKLIB) -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
|
||||
$(GLUT_LIB_DEPS) -install $(TOP)/$(LIB_DIR) \
|
||||
$(MKLIB_OPTIONS) $(OBJECTS)
|
||||
|
|
@ -75,23 +75,24 @@ tags:
|
|||
# glut pkgconfig file
|
||||
pcedit = sed \
|
||||
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
|
||||
-e 's,@LIB_DIR@,$(LIB_DIR),' \
|
||||
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
|
||||
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
|
||||
-e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),'
|
||||
glut.pc: glut.pc.in
|
||||
$(pcedit) $< > $@
|
||||
|
||||
install: glut.pc
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_INC_DIR)/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
|
||||
|
||||
# Remove .o and backup files
|
||||
clean: depend
|
||||
-rm -f depend depend.bak
|
||||
-rm -f *.o *~ *.o *~ *.so libglut.so.3.7
|
||||
-rm -f *.o *~ *.o *~ *.so *.pc libglut.so.3.7
|
||||
|
||||
include depend
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
prefix=@INSTALL_DIR@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/@LIB_DIR@
|
||||
includedir=${prefix}/include
|
||||
libdir=@INSTALL_LIB_DIR@
|
||||
includedir=@INSTALL_INC_DIR@
|
||||
|
||||
Name: glut
|
||||
Description: Mesa OpenGL Utility Toolkit library
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ MAJOR = 1
|
|||
MINOR = 0
|
||||
TINY = 0
|
||||
|
||||
INCDIRS = -I$(TOP)/include -I/usr/include/Motif1.2 $(X11_INCLUDES)
|
||||
INCDIRS = -I$(TOP)/include $(MOTIF_CFLAGS) $(X11_INCLUDES)
|
||||
|
||||
|
||||
OBJECTS = $(GLW_SOURCES:.c=.o)
|
||||
|
|
@ -28,27 +28,28 @@ default: $(TOP)/$(LIB_DIR)/$(GLW_LIB_NAME)
|
|||
# GLU pkg-config file
|
||||
pcedit = sed \
|
||||
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
|
||||
-e 's,@LIB_DIR@,$(LIB_DIR),' \
|
||||
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
|
||||
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
|
||||
-e 's,@VERSION@,$(MAJOR).$(MINOR).$(TINY),'
|
||||
glw.pc: glw.pc.in
|
||||
$(pcedit) $< > $@
|
||||
|
||||
install: glw.pc
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -m 644 *.h $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLw.* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 glw.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -m 644 *.h $(DESTDIR)$(INSTALL_INC_DIR)/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLw.* $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -m 644 glw.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
|
||||
clean:
|
||||
-rm -f depend depend.bak
|
||||
-rm -f *.o *~
|
||||
-rm -f *.o *.pc *~
|
||||
|
||||
|
||||
# Make the library
|
||||
$(TOP)/$(LIB_DIR)/$(GLW_LIB_NAME): $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o $(GLW_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
$(MKLIB) -o $(GLW_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major $(MAJOR) -minor $(MINOR) -patch $(TINY) \
|
||||
$(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
|
||||
$(GLW_LIB_DEPS) $(OBJECTS)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
prefix=@INSTALL_DIR@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/@LIB_DIR@
|
||||
includedir=${prefix}/include
|
||||
libdir=@INSTALL_LIB_DIR@
|
||||
includedir=@INSTALL_INC_DIR@
|
||||
|
||||
Name: glw
|
||||
Description: Mesa OpenGL widget library
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/miniglx.conf
|
|||
|
||||
# Make libGL
|
||||
$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile
|
||||
@ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
@ $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major 1 -minor 2 $(MKLIB_OPTIONS) \
|
||||
-install $(TOP)/$(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS) \
|
||||
$(LIBDRM_LIB) $(PCIACCESS_LIB)
|
||||
|
|
|
|||
1
src/glx/x11/.gitignore
vendored
1
src/glx/x11/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
|||
glcontextmodes.c
|
||||
|
|
@ -71,7 +71,7 @@ default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
|
|||
|
||||
# Make libGL
|
||||
$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile
|
||||
$(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
$(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major 1 -minor 2 $(MKLIB_OPTIONS) \
|
||||
-install $(TOP)/$(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS)
|
||||
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
driBindExtensions(psc);
|
||||
driBindExtensions(psc, 1);
|
||||
|
||||
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
|
||||
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ driConvertConfigs(const __DRIcoreExtension *core,
|
|||
}
|
||||
|
||||
_X_HIDDEN void
|
||||
driBindExtensions(__GLXscreenConfigs *psc)
|
||||
driBindExtensions(__GLXscreenConfigs *psc, int dri2)
|
||||
{
|
||||
const __DRIextension **extensions;
|
||||
int i;
|
||||
|
|
@ -386,7 +386,7 @@ driBindExtensions(__GLXscreenConfigs *psc)
|
|||
#endif
|
||||
|
||||
#ifdef __DRI_TEX_BUFFER
|
||||
if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
|
||||
if ((strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) && dri2) {
|
||||
psc->texBuffer = (__DRItexBufferExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_EXT_texture_from_pixmap");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,6 @@ extern void ErrorMessageF(const char *f, ...);
|
|||
|
||||
extern void *driOpenDriver(const char *driverName);
|
||||
|
||||
extern void driBindExtensions(__GLXscreenConfigs *psc);
|
||||
extern void driBindExtensions(__GLXscreenConfigs *psc, int dri2);
|
||||
|
||||
#endif /* _DRI_COMMON_H */
|
||||
|
|
|
|||
|
|
@ -635,7 +635,7 @@ static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
driBindExtensions(psc);
|
||||
driBindExtensions(psc, 0);
|
||||
|
||||
psp->destroyScreen = driDestroyScreen;
|
||||
psp->createContext = driCreateContext;
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen,
|
|||
goto handle_error;
|
||||
}
|
||||
|
||||
driBindExtensions(psc);
|
||||
driBindExtensions(psc, 0);
|
||||
|
||||
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
|
||||
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
|
||||
|
|
|
|||
|
|
@ -631,6 +631,9 @@ _X_HIDDEN __GLXdisplayPrivate *__glXInitialize(Display* dpy)
|
|||
__GLXdisplayPrivate *dpyPriv;
|
||||
XEDataObject dataObj;
|
||||
int major, minor;
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
Bool glx_direct, glx_accel;
|
||||
#endif
|
||||
|
||||
#if defined(USE_XTHREADS)
|
||||
{
|
||||
|
|
@ -698,16 +701,20 @@ _X_HIDDEN __GLXdisplayPrivate *__glXInitialize(Display* dpy)
|
|||
dpyPriv->serverGLXversion = 0x0;
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
glx_direct = (getenv("LIBGL_ALWAYS_INDIRECT") == NULL);
|
||||
glx_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL);
|
||||
|
||||
/*
|
||||
** Initialize the direct rendering per display data and functions.
|
||||
** Note: This _must_ be done before calling any other DRI routines
|
||||
** (e.g., those called in AllocAndFetchScreenConfigs).
|
||||
*/
|
||||
if (getenv("LIBGL_ALWAYS_INDIRECT") == NULL) {
|
||||
if (glx_direct && glx_accel) {
|
||||
dpyPriv->dri2Display = dri2CreateDisplay(dpy);
|
||||
dpyPriv->driDisplay = driCreateDisplay(dpy);
|
||||
dpyPriv->driswDisplay = driswCreateDisplay(dpy);
|
||||
}
|
||||
if (glx_direct)
|
||||
dpyPriv->driswDisplay = driswCreateDisplay(dpy);
|
||||
#endif
|
||||
|
||||
if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
* "vbo", to support multiple texture coordinate arrays, generic attributes,
|
||||
* and vertex buffer objects.
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
* \author Ian Romanick <ian.d.romanick@intel.com>
|
||||
*/
|
||||
|
||||
static void emit_DrawArrays_none( GLenum mode, GLint first, GLsizei count );
|
||||
|
|
@ -1601,17 +1601,21 @@ void __indirect_glClientActiveTextureARB(GLenum texture)
|
|||
|
||||
|
||||
/**
|
||||
* Modify the enable state for the selected array
|
||||
*/
|
||||
GLboolean
|
||||
__glXSetArrayEnable( __GLXattribute * state,
|
||||
GLenum key, unsigned index, GLboolean enable )
|
||||
__glXSetArrayEnable(__GLXattribute *state, GLenum key, unsigned index,
|
||||
GLboolean enable)
|
||||
{
|
||||
struct array_state_vector * arrays = state->array_state;
|
||||
struct array_state * a;
|
||||
|
||||
|
||||
if ( key == GL_TEXTURE_COORD_ARRAY ) {
|
||||
index = arrays->active_texture_unit;
|
||||
/* Texture coordinate arrays have an implict index set when the
|
||||
* application calls glClientActiveTexture.
|
||||
*/
|
||||
if (key == GL_TEXTURE_COORD_ARRAY) {
|
||||
index = arrays->active_texture_unit;
|
||||
}
|
||||
|
||||
a = get_array_entry( arrays, key, index );
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ default: depend asm_subdirs libmesa.a libglapi.a driver_subdirs
|
|||
|
||||
# Make archive of core mesa object files
|
||||
libmesa.a: $(MESA_OBJECTS)
|
||||
@ $(TOP)/bin/mklib -o mesa -static $(MESA_OBJECTS)
|
||||
@ $(MKLIB) -o mesa -static $(MESA_OBJECTS)
|
||||
|
||||
# Make archive of gl* API dispatcher functions only
|
||||
libglapi.a: $(GLAPI_OBJECTS)
|
||||
@ $(TOP)/bin/mklib -o glapi -static $(GLAPI_OBJECTS)
|
||||
@ $(MKLIB) -o glapi -static $(GLAPI_OBJECTS)
|
||||
|
||||
|
||||
######################################################################
|
||||
|
|
@ -90,28 +90,29 @@ install: default
|
|||
|
||||
pcedit = sed \
|
||||
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
|
||||
-e 's,@LIB_DIR@,$(LIB_DIR),' \
|
||||
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
|
||||
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
|
||||
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),'
|
||||
|
||||
gl.pc: gl.pc.in
|
||||
$(pcedit) $< > $@
|
||||
|
||||
install-headers:
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
|
||||
$(INSTALL) -m 644 $(TOP)/include/GL/*.h \
|
||||
$(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(DESTDIR)$(INSTALL_INC_DIR)/GL
|
||||
|
||||
install-libgl: default gl.pc install-headers
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)* \
|
||||
$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
|
||||
install-osmesa: default
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)* \
|
||||
$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
|
||||
install-dri: default
|
||||
cd drivers/dri && $(MAKE) install
|
||||
|
|
@ -128,6 +129,7 @@ clean:
|
|||
-rm -f */*/*.o
|
||||
-rm -f depend depend.bak libmesa.a libglapi.a
|
||||
-rm -f drivers/*/*.o
|
||||
-rm -f *.pc
|
||||
-@cd drivers/dri && $(MAKE) clean
|
||||
-@cd drivers/x11 && $(MAKE) clean
|
||||
-@cd drivers/osmesa && $(MAKE) clean
|
||||
|
|
|
|||
|
|
@ -181,9 +181,10 @@ $(TOP)/$(LIB_DIR):
|
|||
mkdir $(TOP)/$(LIB_DIR)
|
||||
|
||||
$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) $(MESA_MODULES) $(GLU_MODULES)
|
||||
@$(TOP)/bin/mklib -o $(GL_LIB) -ldflags '$(LDFLAGS)' -install $(TOP)/$(LIB_DIR) \
|
||||
@$(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
|
||||
$(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(OBJECTS) $(MESA_MODULES) $(GLU_MODULES)
|
||||
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(GL_LIB_DEPS) \
|
||||
$(OBJECTS) $(MESA_MODULES) $(GLU_MODULES)
|
||||
|
||||
# $(GLU_OBJECTS):
|
||||
# cd $(GLU_DIR) && $(MAKE) $< ;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ default: directfb-libgl directfbgl_mesa
|
|||
|
||||
# XXX this used to be in src/mesa/Makefile and is probably broken now
|
||||
directfb-libgl: $(LIBS)
|
||||
@ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
@ $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
|
||||
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(LIBS) \
|
||||
$(GL_LIB_DEPS)
|
||||
|
|
|
|||
|
|
@ -20,16 +20,30 @@ subdirs:
|
|||
fi \
|
||||
done
|
||||
|
||||
pcedit = sed \
|
||||
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
|
||||
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
|
||||
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
|
||||
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
|
||||
-e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_SEARCH_DIR),'
|
||||
|
||||
install:
|
||||
dri.pc: dri.pc.in
|
||||
$(pcedit) $< > $@
|
||||
|
||||
|
||||
install: dri.pc
|
||||
@for dir in $(DRI_DIRS) ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir && $(MAKE) install) || exit 1 ; \
|
||||
fi \
|
||||
done
|
||||
$(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
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL/internal
|
||||
$(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_interface.h \
|
||||
$(DESTDIR)$(INSTALL_INC_DIR)/GL/internal
|
||||
$(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_sarea.h \
|
||||
$(DESTDIR)$(INSTALL_INC_DIR)/GL/internal
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -m 0644 dri.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
|
||||
|
||||
clean:
|
||||
|
|
@ -39,3 +53,4 @@ clean:
|
|||
fi \
|
||||
done
|
||||
-rm -f common/*.o
|
||||
-rm -f *.pc
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ default: symlinks depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
|
|||
|
||||
|
||||
$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
|
||||
$(TOP)/bin/mklib -ldflags '$(LDFLAGS)' -noprefix -o $@ \
|
||||
$(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
$(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
|
|||
int
|
||||
__driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp)
|
||||
{
|
||||
__DRIscreenPrivate *psp = pcp->driScreenPriv;
|
||||
__DRIscreenPrivate *psp = pdp->driScreenPriv;
|
||||
__DRIDrawableConfigEvent *dc, *last_dc;
|
||||
__DRIBufferAttachEvent *ba, *last_ba;
|
||||
unsigned int tail, mask, *p, end, total, size, changed;
|
||||
|
|
@ -291,7 +291,7 @@ __driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp)
|
|||
size_t rect_size;
|
||||
|
||||
/* Check for wraparound. */
|
||||
if (psp->dri2.buffer->prealloc - pdp->dri2.tail > psp->dri2.buffer->size) {
|
||||
if (pcp && psp->dri2.buffer->prealloc - pdp->dri2.tail > psp->dri2.buffer->size) {
|
||||
/* If prealloc overlaps into what we just parsed, the
|
||||
* server overwrote it and we have to reset our tail
|
||||
* pointer. */
|
||||
|
|
@ -460,6 +460,9 @@ static void driSwapBuffers(__DRIdrawable *dPriv)
|
|||
if (!dPriv->numClipRects)
|
||||
return;
|
||||
|
||||
if (psp->dri2.enabled)
|
||||
__driParseEvents(NULL, dPriv);
|
||||
|
||||
psp->DriverAPI.SwapBuffers(dPriv);
|
||||
|
||||
driReportDamage(dPriv, dPriv->pClipRects, dPriv->numClipRects);
|
||||
|
|
|
|||
|
|
@ -1077,13 +1077,6 @@ static const char AreTexturesResident_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_EXT_framebuffer_object)
|
||||
static const char IsRenderbufferEXT_names[] =
|
||||
"i\0" /* Parameter signature */
|
||||
"glIsRenderbufferEXT\0"
|
||||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ATI_separate_stencil)
|
||||
static const char StencilOpSeparate_names[] =
|
||||
"iiii\0" /* Parameter signature */
|
||||
|
|
@ -1763,13 +1756,6 @@ static const char DeleteFencesNV_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_SGIX_polynomial_ffd)
|
||||
static const char DeformationMap3dSGIX_names[] =
|
||||
"iddiiddiiddiip\0" /* Parameter signature */
|
||||
"glDeformationMap3dSGIX\0"
|
||||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_VERSION_2_0)
|
||||
static const char IsShader_names[] =
|
||||
"i\0" /* Parameter signature */
|
||||
|
|
@ -2015,6 +2001,13 @@ static const char WeightfvARB_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_EXT_framebuffer_object)
|
||||
static const char IsRenderbufferEXT_names[] =
|
||||
"i\0" /* Parameter signature */
|
||||
"glIsRenderbufferEXT\0"
|
||||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_MESA_window_pos)
|
||||
static const char WindowPos4fMESA_names[] =
|
||||
"ffff\0" /* Parameter signature */
|
||||
|
|
@ -4530,6 +4523,13 @@ static const char Minmax_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_SGIX_polynomial_ffd)
|
||||
static const char DeformationMap3dSGIX_names[] =
|
||||
"iddiiddiiddiip\0" /* Parameter signature */
|
||||
"glDeformationMap3dSGIX\0"
|
||||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
|
||||
static const char FogCoorddvEXT_names[] =
|
||||
"p\0" /* Parameter signature */
|
||||
|
|
@ -5319,13 +5319,13 @@ static const struct dri_extension_function GL_EXT_framebuffer_blit_functions[] =
|
|||
#if defined(need_GL_EXT_framebuffer_object)
|
||||
static const struct dri_extension_function GL_EXT_framebuffer_object_functions[] = {
|
||||
{ GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, -1 },
|
||||
{ IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 },
|
||||
{ RenderbufferStorageEXT_names, RenderbufferStorageEXT_remap_index, -1 },
|
||||
{ CheckFramebufferStatusEXT_names, CheckFramebufferStatusEXT_remap_index, -1 },
|
||||
{ DeleteRenderbuffersEXT_names, DeleteRenderbuffersEXT_remap_index, -1 },
|
||||
{ FramebufferTexture3DEXT_names, FramebufferTexture3DEXT_remap_index, -1 },
|
||||
{ FramebufferRenderbufferEXT_names, FramebufferRenderbufferEXT_remap_index, -1 },
|
||||
{ FramebufferTexture1DEXT_names, FramebufferTexture1DEXT_remap_index, -1 },
|
||||
{ IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 },
|
||||
{ BindFramebufferEXT_names, BindFramebufferEXT_remap_index, -1 },
|
||||
{ GenRenderbuffersEXT_names, GenRenderbuffersEXT_remap_index, -1 },
|
||||
{ IsFramebufferEXT_names, IsFramebufferEXT_remap_index, -1 },
|
||||
|
|
@ -5965,9 +5965,9 @@ static const struct dri_extension_function GL_SGIX_pixel_texture_functions[] = {
|
|||
#if defined(need_GL_SGIX_polynomial_ffd)
|
||||
static const struct dri_extension_function GL_SGIX_polynomial_ffd_functions[] = {
|
||||
{ LoadIdentityDeformationMapSGIX_names, LoadIdentityDeformationMapSGIX_remap_index, -1 },
|
||||
{ DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 },
|
||||
{ DeformSGIX_names, DeformSGIX_remap_index, -1 },
|
||||
{ DeformationMap3fSGIX_names, DeformationMap3fSGIX_remap_index, -1 },
|
||||
{ DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 },
|
||||
{ NULL, 0, 0 }
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1278,6 +1278,7 @@ driCalculateTextureFirstLastLevel( driTextureObject * t )
|
|||
else {
|
||||
firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5);
|
||||
firstLevel = MAX2(firstLevel, tObj->BaseLevel);
|
||||
firstLevel = MIN2(firstLevel, tObj->BaseLevel + baseImage->MaxLog2);
|
||||
lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5);
|
||||
lastLevel = MAX2(lastLevel, t->tObj->BaseLevel);
|
||||
lastLevel = MIN2(lastLevel, t->tObj->BaseLevel + baseImage->MaxLog2);
|
||||
|
|
|
|||
10
src/mesa/drivers/dri/dri.pc.in
Normal file
10
src/mesa/drivers/dri/dri.pc.in
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
prefix=@INSTALL_DIR@
|
||||
exec_prefix=${prefix}
|
||||
libdir=@INSTALL_LIB_DIR@
|
||||
includedir=@INSTALL_INC_DIR@
|
||||
dridriverdir=@DRI_DRIVER_DIR@
|
||||
|
||||
Name: dri
|
||||
Description: Direct Rendering Infrastructure
|
||||
Version: @VERSION@
|
||||
Cflags: -I${includedir}
|
||||
|
|
@ -42,12 +42,6 @@
|
|||
* Mesa's Driver Functions
|
||||
***************************************/
|
||||
|
||||
static const struct dri_extension i830_extensions[] = {
|
||||
{"GL_ARB_texture_env_crossbar", NULL},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
i830InitDriverFunctions(struct dd_function_table *functions)
|
||||
{
|
||||
|
|
@ -108,8 +102,6 @@ i830CreateContext(const __GLcontextModes * mesaVis,
|
|||
|
||||
intel->verts = TNL_CONTEXT(ctx)->clipspace.vertex_buf;
|
||||
|
||||
driInitExtensions(ctx, i830_extensions, GL_FALSE);
|
||||
|
||||
i830InitState(i830);
|
||||
i830InitMetaFuncs(i830);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ static const struct dri_extension i915_extensions[] = {
|
|||
{"GL_ARB_depth_texture", NULL},
|
||||
{"GL_ARB_fragment_program", NULL},
|
||||
{"GL_ARB_shadow", NULL},
|
||||
{"GL_ARB_texture_env_crossbar", NULL},
|
||||
{"GL_ARB_texture_non_power_of_two", NULL},
|
||||
{"GL_EXT_shadow_funcs", NULL},
|
||||
/* ARB extn won't work if not enabled */
|
||||
|
|
|
|||
|
|
@ -257,18 +257,15 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
|
|||
*/
|
||||
if (tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB &&
|
||||
tObj->Target != GL_TEXTURE_3D) {
|
||||
if (tObj->Target == GL_TEXTURE_1D)
|
||||
return GL_FALSE;
|
||||
|
||||
state[I915_TEXREG_SS2] |=
|
||||
(SS2_SHADOW_ENABLE |
|
||||
intel_translate_shadow_compare_func(tObj->CompareFunc));
|
||||
|
||||
if (tObj->Target == GL_TEXTURE_1D) {
|
||||
minFilt = FILTER_NEAREST;
|
||||
magFilt = FILTER_NEAREST;
|
||||
} else {
|
||||
minFilt = FILTER_4X4_FLAT;
|
||||
magFilt = FILTER_4X4_FLAT;
|
||||
}
|
||||
minFilt = FILTER_4X4_FLAT;
|
||||
magFilt = FILTER_4X4_FLAT;
|
||||
}
|
||||
|
||||
state[I915_TEXREG_SS2] |= ((minFilt << SS2_MIN_FILTER_SHIFT) |
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
|
|||
brw_clip_init_clipmask(c);
|
||||
|
||||
/* -ve rhw workaround */
|
||||
if (!BRW_IS_IGD(p->brw)) {
|
||||
if (!(BRW_IS_GM45(p->brw) || BRW_IS_G4X(p->brw))) {
|
||||
brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
|
||||
brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2),
|
||||
brw_imm_ud(1<<20));
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ clip_unit_create_from_key(struct brw_context *brw,
|
|||
clip.clip5.api_mode = BRW_CLIP_API_OGL;
|
||||
clip.clip5.clip_mode = key->clip_mode;
|
||||
|
||||
if (BRW_IS_IGD(brw))
|
||||
if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw))
|
||||
clip.clip5.negative_w_clip_test = 1;
|
||||
|
||||
clip.clip6.clipper_viewport_state_ptr = 0;
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ void brw_emit_tri_clip( struct brw_clip_compile *c )
|
|||
|
||||
/* if -ve rhw workaround bit is set,
|
||||
do cliptest */
|
||||
if (!BRW_IS_IGD(p->brw)) {
|
||||
if (!(BRW_IS_GM45(p->brw) || BRW_IS_G4X(p->brw))) {
|
||||
brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
|
||||
brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2),
|
||||
brw_imm_ud(1<<20));
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
|
|||
ctx->Const.MaxTextureUnits = BRW_MAX_TEX_UNIT;
|
||||
ctx->Const.MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
|
||||
ctx->Const.MaxTextureCoordUnits = BRW_MAX_TEX_UNIT;
|
||||
|
||||
ctx->Const.MaxVertexTextureImageUnits = 0; /* no vertex shader textures */
|
||||
|
||||
/* Advertise the full hardware capabilities. The new memory
|
||||
* manager should cope much better with overload situations:
|
||||
|
|
|
|||
|
|
@ -740,7 +740,7 @@
|
|||
#define CMD_STATE_BASE_ADDRESS 0x6101
|
||||
#define CMD_STATE_INSN_POINTER 0x6102
|
||||
#define CMD_PIPELINE_SELECT_965 0x6104
|
||||
#define CMD_PIPELINE_SELECT_IGD 0x6904
|
||||
#define CMD_PIPELINE_SELECT_GM45 0x6904
|
||||
|
||||
#define CMD_PIPELINED_STATE_POINTERS 0x7800
|
||||
#define CMD_BINDING_TABLE_PTRS 0x7801
|
||||
|
|
@ -772,7 +772,7 @@
|
|||
|
||||
#define CMD_INDEX_BUFFER 0x780a
|
||||
#define CMD_VF_STATISTICS_965 0x780b
|
||||
#define CMD_VF_STATISTICS_IGD 0x680b
|
||||
#define CMD_VF_STATISTICS_GM45 0x680b
|
||||
|
||||
#define CMD_DRAW_RECT 0x7900
|
||||
#define CMD_BLEND_CONSTANT_COLOR 0x7901
|
||||
|
|
@ -798,9 +798,10 @@
|
|||
|
||||
#include "intel_chipset.h"
|
||||
|
||||
#define BRW_IS_IGD(brw) (IS_IGD((brw)->intel.intelScreen->deviceID))
|
||||
#define CMD_PIPELINE_SELECT(brw) ((BRW_IS_IGD(brw)) ? CMD_PIPELINE_SELECT_IGD : CMD_PIPELINE_SELECT_965)
|
||||
#define CMD_VF_STATISTICS(brw) ((BRW_IS_IGD(brw)) ? CMD_VF_STATISTICS_IGD : CMD_VF_STATISTICS_965)
|
||||
#define URB_SIZES(brw) ((BRW_IS_IGD(brw)) ? 384 : 256) /* 512 bit unit */
|
||||
#define BRW_IS_GM45(brw) (IS_GM45_GM((brw)->intel.intelScreen->deviceID))
|
||||
#define BRW_IS_G4X(brw) (IS_G4X((brw)->intel.intelScreen->deviceID))
|
||||
#define CMD_PIPELINE_SELECT(brw) ((BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? CMD_PIPELINE_SELECT_GM45 : CMD_PIPELINE_SELECT_965)
|
||||
#define CMD_VF_STATISTICS(brw) ((BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? CMD_VF_STATISTICS_GM45 : CMD_VF_STATISTICS_965)
|
||||
#define URB_SIZES(brw) ((BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? 384 : 256) /* 512 bit unit */
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -329,14 +329,14 @@ static void brw_set_sampler_message(struct brw_context *brw,
|
|||
{
|
||||
brw_set_src1(insn, brw_imm_d(0));
|
||||
|
||||
if (BRW_IS_IGD(brw)) {
|
||||
insn->bits3.sampler_igd.binding_table_index = binding_table_index;
|
||||
insn->bits3.sampler_igd.sampler = sampler;
|
||||
insn->bits3.sampler_igd.msg_type = msg_type;
|
||||
insn->bits3.sampler_igd.response_length = response_length;
|
||||
insn->bits3.sampler_igd.msg_length = msg_length;
|
||||
insn->bits3.sampler_igd.end_of_thread = eot;
|
||||
insn->bits3.sampler_igd.msg_target = BRW_MESSAGE_TARGET_SAMPLER;
|
||||
if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) {
|
||||
insn->bits3.sampler_gm45_g4x.binding_table_index = binding_table_index;
|
||||
insn->bits3.sampler_gm45_g4x.sampler = sampler;
|
||||
insn->bits3.sampler_gm45_g4x.msg_type = msg_type;
|
||||
insn->bits3.sampler_gm45_g4x.response_length = response_length;
|
||||
insn->bits3.sampler_gm45_g4x.msg_length = msg_length;
|
||||
insn->bits3.sampler_gm45_g4x.end_of_thread = eot;
|
||||
insn->bits3.sampler_gm45_g4x.msg_target = BRW_MESSAGE_TARGET_SAMPLER;
|
||||
} else {
|
||||
insn->bits3.sampler.binding_table_index = binding_table_index;
|
||||
insn->bits3.sampler.sampler = sampler;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,10 @@ static GLboolean do_check_fallback(struct brw_context *brw)
|
|||
if (texUnit->_ReallyEnabled) {
|
||||
struct intel_texture_object *intelObj = intel_texture_object(texUnit->_Current);
|
||||
struct gl_texture_image *texImage = intelObj->base.Image[0][intelObj->firstLevel];
|
||||
if (texImage->Border) {
|
||||
if (texImage->Border ||
|
||||
((texImage->_BaseFormat == GL_DEPTH_COMPONENT) &&
|
||||
((texImage->TexObject->WrapS == GL_CLAMP_TO_BORDER) ||
|
||||
(texImage->TexObject->WrapT == GL_CLAMP_TO_BORDER)))) {
|
||||
DBG("FALLBACK: texture border\n");
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ static void emit_depthbuffer(struct brw_context *brw)
|
|||
{
|
||||
struct intel_context *intel = &brw->intel;
|
||||
struct intel_region *region = brw->state.depth_region;
|
||||
unsigned int len = BRW_IS_IGD(brw) ? sizeof(struct brw_depthbuffer_igd) / 4 : sizeof(struct brw_depthbuffer) / 4;
|
||||
unsigned int len = (BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? sizeof(struct brw_depthbuffer_gm45_g4x) / 4 : sizeof(struct brw_depthbuffer) / 4;
|
||||
|
||||
if (region == NULL) {
|
||||
BEGIN_BATCH(len, IGNORE_CLIPRECTS);
|
||||
|
|
@ -205,7 +205,7 @@ static void emit_depthbuffer(struct brw_context *brw)
|
|||
OUT_BATCH(0);
|
||||
OUT_BATCH(0);
|
||||
|
||||
if (BRW_IS_IGD(brw))
|
||||
if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw))
|
||||
OUT_BATCH(0);
|
||||
|
||||
ADVANCE_BATCH();
|
||||
|
|
@ -242,7 +242,7 @@ static void emit_depthbuffer(struct brw_context *brw)
|
|||
((region->height - 1) << 19));
|
||||
OUT_BATCH(0);
|
||||
|
||||
if (BRW_IS_IGD(brw))
|
||||
if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw))
|
||||
OUT_BATCH(0);
|
||||
|
||||
ADVANCE_BATCH();
|
||||
|
|
@ -327,7 +327,7 @@ static void upload_aa_line_parameters(struct brw_context *brw)
|
|||
{
|
||||
struct brw_aa_line_parameters balp;
|
||||
|
||||
if (!BRW_IS_IGD(brw))
|
||||
if (!(BRW_IS_GM45(brw) || BRW_IS_G4X(brw)))
|
||||
return;
|
||||
|
||||
/* use legacy aa line coverage computation */
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ struct brw_depthbuffer
|
|||
} dword4;
|
||||
};
|
||||
|
||||
struct brw_depthbuffer_igd
|
||||
struct brw_depthbuffer_gm45_g4x
|
||||
{
|
||||
union header_union header;
|
||||
|
||||
|
|
@ -1405,7 +1405,7 @@ struct brw_instruction
|
|||
GLuint msg_target:4;
|
||||
GLuint pad1:3;
|
||||
GLuint end_of_thread:1;
|
||||
} sampler_igd;
|
||||
} sampler_gm45_g4x;
|
||||
|
||||
struct brw_urb_immediate urb;
|
||||
|
||||
|
|
|
|||
|
|
@ -867,7 +867,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
|
|||
* Later, clipping will detect ucp[6] and ensure the primitive is
|
||||
* clipped against all fixed planes.
|
||||
*/
|
||||
if (!BRW_IS_IGD(p->brw) && !c->key.know_w_is_one) {
|
||||
if (!(BRW_IS_GM45(p->brw) || BRW_IS_G4X(p->brw)) && !c->key.know_w_is_one) {
|
||||
brw_CMP(p,
|
||||
vec8(brw_null_reg()),
|
||||
BRW_CONDITIONAL_L,
|
||||
|
|
|
|||
|
|
@ -948,15 +948,16 @@ static void emit_fb_write( struct brw_wm_compile *c,
|
|||
GLuint off = c->key.dest_depth_reg % 2;
|
||||
|
||||
if (off != 0) {
|
||||
brw_push_insn_state(p);
|
||||
brw_set_compression_control(p, BRW_COMPRESSION_NONE);
|
||||
brw_MOV(p, brw_message_reg(nr), arg1[comp]);
|
||||
/* 2nd half? */
|
||||
brw_MOV(p, brw_message_reg(nr+1), offset(arg1[comp],1));
|
||||
brw_pop_insn_state(p);
|
||||
brw_push_insn_state(p);
|
||||
brw_set_compression_control(p, BRW_COMPRESSION_NONE);
|
||||
|
||||
brw_MOV(p, brw_message_reg(nr), offset(arg1[comp],1));
|
||||
/* 2nd half? */
|
||||
brw_MOV(p, brw_message_reg(nr+1), arg1[comp+1]);
|
||||
brw_pop_insn_state(p);
|
||||
}
|
||||
else {
|
||||
brw_MOV(p, brw_message_reg(nr), arg1[comp]);
|
||||
brw_MOV(p, brw_message_reg(nr), arg1[comp]);
|
||||
}
|
||||
nr += 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,8 +120,10 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
|
|||
if (batch->cliprect_mode == IGNORE_CLIPRECTS) {
|
||||
batch->cliprect_mode = cliprect_mode;
|
||||
} else {
|
||||
if (batch->cliprect_mode != cliprect_mode)
|
||||
if (batch->cliprect_mode != cliprect_mode) {
|
||||
intel_batchbuffer_flush(batch);
|
||||
batch->cliprect_mode = cliprect_mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,8 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
|||
dst_pitch /= 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* do space/cliprects check before going any further */
|
||||
intel_batchbuffer_require_space(intel->batch, 8 * 4, REFERENCES_CLIPRECTS);
|
||||
again:
|
||||
ret = dri_bufmgr_check_aperture_space(dst->buffer);
|
||||
ret |= dri_bufmgr_check_aperture_space(src->buffer);
|
||||
|
|
@ -275,6 +276,8 @@ intelEmitCopyBlit(struct intel_context *intel,
|
|||
int ret;
|
||||
BATCH_LOCALS;
|
||||
|
||||
/* do space/cliprects check before going any further */
|
||||
intel_batchbuffer_require_space(intel->batch, 8 * 4, NO_LOOP_CLIPRECTS);
|
||||
again:
|
||||
ret = dri_bufmgr_check_aperture_space(dst_buffer);
|
||||
ret |= dri_bufmgr_check_aperture_space(src_buffer);
|
||||
|
|
|
|||
|
|
@ -197,7 +197,6 @@ intelSetBackClipRects(struct intel_context *intel)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef I915
|
||||
static void
|
||||
intelUpdatePageFlipping(struct intel_context *intel,
|
||||
GLint areaA, GLint areaB)
|
||||
|
|
@ -267,7 +266,6 @@ intelUpdatePageFlipping(struct intel_context *intel,
|
|||
intel_flip_renderbuffers(intel_fb);
|
||||
intel_draw_buffer(&intel->ctx, intel->ctx.DrawBuffer);
|
||||
}
|
||||
#endif /* I915 */
|
||||
|
||||
/**
|
||||
* This will be called whenever the currently bound window is moved/resized.
|
||||
|
|
@ -318,9 +316,7 @@ intelWindowMoved(struct intel_context *intel)
|
|||
GLint areaB = driIntersectArea( drw_rect, planeB_rect );
|
||||
GLuint flags = dPriv->vblFlags;
|
||||
|
||||
#ifdef I915
|
||||
intelUpdatePageFlipping(intel, areaA, areaB);
|
||||
#endif
|
||||
|
||||
/* Update vblank info
|
||||
*/
|
||||
|
|
@ -645,7 +641,6 @@ intel_wait_flips(struct intel_context *intel)
|
|||
static GLboolean
|
||||
intelPageFlip(const __DRIdrawablePrivate * dPriv)
|
||||
{
|
||||
#ifdef I915
|
||||
struct intel_context *intel;
|
||||
int ret;
|
||||
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
|
||||
|
|
@ -698,40 +693,8 @@ intelPageFlip(const __DRIdrawablePrivate * dPriv)
|
|||
intel_draw_buffer(&intel->ctx, &intel_fb->Base);
|
||||
|
||||
return GL_TRUE;
|
||||
#else
|
||||
return GL_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
intelSwapBuffers(__DRIdrawablePrivate * dPriv)
|
||||
{
|
||||
if (dPriv->driverPrivate) {
|
||||
const struct gl_framebuffer *fb
|
||||
= (struct gl_framebuffer *) dPriv->driverPrivate;
|
||||
if (fb->Visual.doubleBufferMode) {
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
if (ctx && ctx->DrawBuffer == fb) {
|
||||
_mesa_notifySwapBuffers(ctx); /* flush pending rendering */
|
||||
}
|
||||
if (intel->doPageFlip) {
|
||||
intelPageFlip(dPriv);
|
||||
}
|
||||
else {
|
||||
intelCopyBuffer(dPriv);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
_mesa_problem(NULL,
|
||||
"dPriv has no gl_framebuffer pointer in intelSwapBuffers");
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* Trunk version:
|
||||
*/
|
||||
|
||||
static GLboolean
|
||||
intelScheduleSwap(__DRIdrawablePrivate * dPriv, GLboolean *missed_target)
|
||||
{
|
||||
|
|
@ -755,9 +718,8 @@ intelScheduleSwap(__DRIdrawablePrivate * dPriv, GLboolean *missed_target)
|
|||
|
||||
if (dPriv->vblFlags & VBLANK_FLAG_SYNC) {
|
||||
swap.seqtype |= DRM_VBLANK_NEXTONMISS;
|
||||
} else if (interval == 0) {
|
||||
} else if (interval == 0)
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
swap.drawable = dPriv->hHWDrawable;
|
||||
target = swap.sequence = dPriv->vblSeq + interval;
|
||||
|
|
@ -834,6 +796,15 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv)
|
|||
if (!intelScheduleSwap(dPriv, &missed_target)) {
|
||||
driWaitForVBlank(dPriv, &missed_target);
|
||||
|
||||
/*
|
||||
* Update each buffer's vbl_pending so we don't get too out of
|
||||
* sync
|
||||
*/
|
||||
intel_get_renderbuffer(&intel_fb->Base,
|
||||
BUFFER_BACK_LEFT)->vbl_pending =
|
||||
intel_get_renderbuffer(&intel_fb->Base,
|
||||
BUFFER_FRONT_LEFT)->vbl_pending =
|
||||
dPriv->vblSeq;
|
||||
if (!intelPageFlip(dPriv)) {
|
||||
intelCopyBuffer(dPriv, NULL);
|
||||
}
|
||||
|
|
@ -856,7 +827,6 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv)
|
|||
fprintf(stderr, "%s: drawable has no context!\n", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
#define PCI_CHIP_I965_GM 0x2A02
|
||||
#define PCI_CHIP_I965_GME 0x2A12
|
||||
|
||||
#define PCI_CHIP_IGD_GM 0x2A42
|
||||
#define PCI_CHIP_GM45_GM 0x2A42
|
||||
|
||||
#define PCI_CHIP_IGD_E_G 0x2E02
|
||||
#define PCI_CHIP_Q45_G 0x2E12
|
||||
|
|
@ -65,13 +65,12 @@
|
|||
devid == PCI_CHIP_I945_GME || \
|
||||
devid == PCI_CHIP_I965_GM || \
|
||||
devid == PCI_CHIP_I965_GME || \
|
||||
devid == PCI_CHIP_IGD_GM)
|
||||
devid == PCI_CHIP_GM45_GM)
|
||||
|
||||
#define IS_IGD_GM(devid) (devid == PCI_CHIP_IGD_GM)
|
||||
#define IS_GM45_GM(devid) (devid == PCI_CHIP_GM45_GM)
|
||||
#define IS_G4X(devid) (devid == PCI_CHIP_IGD_E_G || \
|
||||
devid == PCI_CHIP_Q45_G || \
|
||||
devid == PCI_CHIP_G45_G)
|
||||
#define IS_IGD(devid) (IS_IGD_GM(devid) || IS_G4X(devid))
|
||||
|
||||
#define IS_915(devid) (devid == PCI_CHIP_I915_G || \
|
||||
devid == PCI_CHIP_E7221_G || \
|
||||
|
|
@ -90,7 +89,8 @@
|
|||
devid == PCI_CHIP_I965_GM || \
|
||||
devid == PCI_CHIP_I965_GME || \
|
||||
devid == PCI_CHIP_I946_GZ || \
|
||||
IS_IGD(devid))
|
||||
IS_GM45_GM(devid) || \
|
||||
IS_G4X(devid))
|
||||
|
||||
#define IS_9XX(devid) (IS_915(devid) || \
|
||||
IS_945(devid) || \
|
||||
|
|
|
|||
|
|
@ -168,7 +168,9 @@ intelGetString(GLcontext * ctx, GLenum name)
|
|||
case PCI_CHIP_I965_GME:
|
||||
chipset = "Intel(R) 965GME/GLE";
|
||||
break;
|
||||
case PCI_CHIP_IGD_GM:
|
||||
case PCI_CHIP_GM45_GM:
|
||||
chipset = "Mobile Intel® GM45 Express Chipset";
|
||||
break;
|
||||
case PCI_CHIP_IGD_E_G:
|
||||
chipset = "Intel(R) Integrated Graphics Device";
|
||||
break;
|
||||
|
|
@ -196,9 +198,8 @@ intelGetString(GLcontext * ctx, GLenum name)
|
|||
/**
|
||||
* Extension strings exported by the intel driver.
|
||||
*
|
||||
* \note
|
||||
* It appears that ARB_texture_env_crossbar has "disappeared" compared to the
|
||||
* old i830-specific driver.
|
||||
* Extensions supported by all chips supported by i830_dri, i915_dri, or
|
||||
* i965_dri.
|
||||
*/
|
||||
static const struct dri_extension card_extensions[] = {
|
||||
{"GL_ARB_multisample", GL_ARB_multisample_functions},
|
||||
|
|
@ -210,6 +211,7 @@ static const struct dri_extension card_extensions[] = {
|
|||
{"GL_ARB_texture_cube_map", NULL},
|
||||
{"GL_ARB_texture_env_add", NULL},
|
||||
{"GL_ARB_texture_env_combine", NULL},
|
||||
{"GL_ARB_texture_env_crossbar", NULL},
|
||||
{"GL_ARB_texture_env_dot3", NULL},
|
||||
{"GL_ARB_texture_mirrored_repeat", NULL},
|
||||
{"GL_ARB_texture_non_power_of_two", NULL },
|
||||
|
|
@ -266,7 +268,6 @@ static const struct dri_extension brw_extensions[] = {
|
|||
{ "GL_EXT_shadow_funcs", NULL },
|
||||
/* ARB extn won't work if not enabled */
|
||||
{ "GL_SGIX_depth_texture", NULL },
|
||||
{ "GL_ARB_texture_env_crossbar", NULL },
|
||||
{ "GL_EXT_texture_sRGB", NULL},
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -265,7 +265,10 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt,
|
|||
{
|
||||
/* Images with borders are never pulled into mipmap trees.
|
||||
*/
|
||||
if (image->Border)
|
||||
if (image->Border ||
|
||||
((image->_BaseFormat == GL_DEPTH_COMPONENT) &&
|
||||
((image->TexObject->WrapS == GL_CLAMP_TO_BORDER) ||
|
||||
(image->TexObject->WrapT == GL_CLAMP_TO_BORDER))))
|
||||
return GL_FALSE;
|
||||
|
||||
if (image->InternalFormat != mt->internal_format ||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,10 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel,
|
|||
|
||||
DBG("%s\n", __FUNCTION__);
|
||||
|
||||
if (intelImage->base.Border)
|
||||
if (intelImage->base.Border ||
|
||||
((intelImage->base._BaseFormat == GL_DEPTH_COMPONENT) &&
|
||||
((intelObj->base.WrapS == GL_CLAMP_TO_BORDER) ||
|
||||
(intelObj->base.WrapT == GL_CLAMP_TO_BORDER))))
|
||||
return;
|
||||
|
||||
if (intelImage->level > intelObj->base.BaseLevel &&
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ intel_calculate_first_last_level(struct intel_texture_object *intelObj)
|
|||
#ifdef I915
|
||||
firstLevel = tObj->BaseLevel + (GLint) (tObj->MinLod + 0.5);
|
||||
firstLevel = MAX2(firstLevel, tObj->BaseLevel);
|
||||
firstLevel = MIN2(firstLevel, tObj->BaseLevel + baseImage->MaxLog2);
|
||||
lastLevel = tObj->BaseLevel + (GLint) (tObj->MaxLod + 0.5);
|
||||
lastLevel = MAX2(lastLevel, tObj->BaseLevel);
|
||||
lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2);
|
||||
|
|
@ -140,7 +141,10 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
|
|||
|
||||
/* Fallback case:
|
||||
*/
|
||||
if (firstImage->base.Border) {
|
||||
if (firstImage->base.Border ||
|
||||
((firstImage->base._BaseFormat == GL_DEPTH_COMPONENT) &&
|
||||
((tObj->WrapS == GL_CLAMP_TO_BORDER) ||
|
||||
(tObj->WrapT == GL_CLAMP_TO_BORDER)))) {
|
||||
if (intelObj->mt) {
|
||||
intel_miptree_release(intel, &intelObj->mt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
# src/mesa/drivers/dri/nouveau/Makefile
|
||||
|
||||
TOP = ../../../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
LIBNAME = nouveau_dri.so
|
||||
|
||||
MINIGLX_SOURCES =
|
||||
|
||||
DRIVER_SOURCES = \
|
||||
nouveau_bufferobj.c \
|
||||
nouveau_card.c \
|
||||
nouveau_context.c \
|
||||
nouveau_driver.c \
|
||||
nouveau_fbo.c \
|
||||
nouveau_fifo.c \
|
||||
nouveau_lock.c \
|
||||
nouveau_mem.c \
|
||||
nouveau_object.c \
|
||||
nouveau_screen.c \
|
||||
nouveau_span.c \
|
||||
nouveau_state.c \
|
||||
nouveau_state_cache.c \
|
||||
nouveau_shader.c \
|
||||
nouveau_shader_0.c \
|
||||
nouveau_shader_1.c \
|
||||
nouveau_shader_2.c \
|
||||
nouveau_tex.c \
|
||||
nouveau_swtcl.c \
|
||||
nouveau_sync.c \
|
||||
nouveau_query.c \
|
||||
nv04_state.c \
|
||||
nv04_swtcl.c \
|
||||
nv10_state.c \
|
||||
nv10_swtcl.c \
|
||||
nv20_state.c \
|
||||
nv20_vertprog.c \
|
||||
nv30_state.c \
|
||||
nv30_fragprog.c \
|
||||
nv30_vertprog.c \
|
||||
nv40_fragprog.c \
|
||||
nv40_vertprog.c \
|
||||
nv50_state.c
|
||||
|
||||
C_SOURCES = \
|
||||
$(COMMON_SOURCES) \
|
||||
$(DRIVER_SOURCES)
|
||||
|
||||
ASM_SOURCES =
|
||||
|
||||
|
||||
include ../Makefile.template
|
||||
|
||||
symlinks:
|
||||
|
|
@ -1,627 +0,0 @@
|
|||
#include "bufferobj.h"
|
||||
#include "enums.h"
|
||||
|
||||
#include "nouveau_bufferobj.h"
|
||||
#include "nouveau_context.h"
|
||||
#include "nouveau_drm.h"
|
||||
#include "nouveau_mem.h"
|
||||
#include "nouveau_msg.h"
|
||||
#include "nouveau_object.h"
|
||||
|
||||
#define NOUVEAU_MEM_FREE(mem) do { \
|
||||
nouveau_mem_free(ctx, (mem)); \
|
||||
(mem) = NULL; \
|
||||
} while(0)
|
||||
|
||||
#define DEBUG(fmt,args...) do { \
|
||||
if (NOUVEAU_DEBUG & DEBUG_BUFFEROBJ) { \
|
||||
fprintf(stderr, "%s: "fmt, __func__, ##args); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static GLboolean
|
||||
nouveau_bo_download_from_screen(GLcontext *ctx, GLuint offset, GLuint size,
|
||||
struct gl_buffer_object *bo)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
nouveau_buffer_object *nbo = (nouveau_buffer_object *)bo;
|
||||
nouveau_mem *in_mem;
|
||||
|
||||
DEBUG("bo=%p, offset=%d, size=%d\n", bo, offset, size);
|
||||
|
||||
/* If there's a permanent backing store, blit directly into it */
|
||||
if (nbo->cpu_mem) {
|
||||
if (nbo->cpu_mem != nbo->gpu_mem) {
|
||||
DEBUG("..cpu_mem\n");
|
||||
nouveau_memformat_flat_emit(ctx, nbo->cpu_mem,
|
||||
nbo->gpu_mem,
|
||||
offset, offset, size);
|
||||
}
|
||||
} else {
|
||||
DEBUG("..sys_mem\n");
|
||||
in_mem = nouveau_mem_alloc(ctx, NOUVEAU_MEM_AGP, size, 0);
|
||||
if (in_mem) {
|
||||
DEBUG("....via GART\n");
|
||||
/* otherwise, try blitting to faster memory and
|
||||
* copying from there
|
||||
*/
|
||||
nouveau_memformat_flat_emit(ctx, in_mem, nbo->gpu_mem,
|
||||
0, offset, size);
|
||||
nouveau_notifier_wait_nop(ctx, nmesa->syncNotifier,
|
||||
NvSubMemFormat);
|
||||
_mesa_memcpy(nbo->cpu_mem_sys + offset,
|
||||
in_mem->map, size);
|
||||
NOUVEAU_MEM_FREE(in_mem);
|
||||
} else {
|
||||
DEBUG("....direct VRAM copy\n");
|
||||
/* worst case, copy directly from vram */
|
||||
_mesa_memcpy(nbo->cpu_mem_sys + offset,
|
||||
nbo->gpu_mem + offset,
|
||||
size);
|
||||
}
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
nouveau_bo_upload_to_screen(GLcontext *ctx, GLuint offset, GLuint size,
|
||||
struct gl_buffer_object *bo)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
nouveau_buffer_object *nbo = (nouveau_buffer_object *)bo;
|
||||
nouveau_mem *out_mem;
|
||||
|
||||
DEBUG("bo=%p, offset=%d, size=%d\n", bo, offset, size);
|
||||
|
||||
if (nbo->cpu_mem) {
|
||||
if (nbo->cpu_mem != nbo->gpu_mem) {
|
||||
DEBUG("..cpu_mem\n");
|
||||
nouveau_memformat_flat_emit(ctx, nbo->gpu_mem,
|
||||
nbo->cpu_mem,
|
||||
offset, offset, size);
|
||||
}
|
||||
} else {
|
||||
out_mem = nouveau_mem_alloc(ctx, NOUVEAU_MEM_AGP |
|
||||
NOUVEAU_MEM_MAPPED,
|
||||
size, 0);
|
||||
if (out_mem) {
|
||||
DEBUG("....via GART\n");
|
||||
_mesa_memcpy(out_mem->map,
|
||||
nbo->cpu_mem_sys + offset, size);
|
||||
nouveau_memformat_flat_emit(ctx, nbo->gpu_mem, out_mem,
|
||||
offset, 0, size);
|
||||
nouveau_notifier_wait_nop(ctx, nmesa->syncNotifier,
|
||||
NvSubMemFormat);
|
||||
NOUVEAU_MEM_FREE(out_mem);
|
||||
} else {
|
||||
DEBUG("....direct VRAM copy\n");
|
||||
_mesa_memcpy(nbo->gpu_mem->map + offset,
|
||||
nbo->cpu_mem_sys + offset,
|
||||
size);
|
||||
}
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
GLboolean
|
||||
nouveau_bo_move_in(GLcontext *ctx, struct gl_buffer_object *bo)
|
||||
{
|
||||
nouveau_buffer_object *nbo = (nouveau_buffer_object *)bo;
|
||||
|
||||
DEBUG("bo=%p\n", bo);
|
||||
|
||||
if (bo->OnCard)
|
||||
return GL_TRUE;
|
||||
assert(nbo->gpu_mem_flags);
|
||||
|
||||
nbo->gpu_mem = nouveau_mem_alloc(ctx, nbo->gpu_mem_flags |
|
||||
NOUVEAU_MEM_MAPPED,
|
||||
bo->Size, 0);
|
||||
assert(nbo->gpu_mem);
|
||||
|
||||
if (nbo->cpu_mem_flags) {
|
||||
if ((nbo->cpu_mem_flags|NOUVEAU_MEM_MAPPED) != nbo->gpu_mem->type) {
|
||||
DEBUG("..need cpu_mem buffer\n");
|
||||
|
||||
nbo->cpu_mem = nouveau_mem_alloc(ctx,
|
||||
nbo->cpu_mem_flags |
|
||||
NOUVEAU_MEM_MAPPED,
|
||||
bo->Size, 0);
|
||||
|
||||
if (nbo->cpu_mem) {
|
||||
DEBUG("....alloc ok, kill sys_mem buffer\n");
|
||||
_mesa_memcpy(nbo->cpu_mem->map,
|
||||
nbo->cpu_mem_sys, bo->Size);
|
||||
FREE(nbo->cpu_mem_sys);
|
||||
}
|
||||
} else {
|
||||
DEBUG("..cpu direct access to GPU buffer\n");
|
||||
nbo->cpu_mem = nbo->gpu_mem;
|
||||
}
|
||||
}
|
||||
nouveau_bo_upload_to_screen(ctx, 0, bo->Size, bo);
|
||||
|
||||
bo->OnCard = GL_TRUE;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
GLboolean
|
||||
nouveau_bo_move_out(GLcontext *ctx, struct gl_buffer_object *bo)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
nouveau_buffer_object *nbo = (nouveau_buffer_object *)bo;
|
||||
GLuint nr_dirty;
|
||||
|
||||
DEBUG("bo=%p\n", bo);
|
||||
if (!bo->OnCard)
|
||||
return GL_TRUE;
|
||||
|
||||
nr_dirty = nouveau_bo_download_dirty(ctx, bo);
|
||||
if (nbo->cpu_mem) {
|
||||
if (nr_dirty && nbo->cpu_mem != nbo->gpu_mem)
|
||||
nouveau_notifier_wait_nop(ctx, nmesa->syncNotifier,
|
||||
NvSubMemFormat);
|
||||
DEBUG("..destroy cpu_mem buffer\n");
|
||||
nbo->cpu_mem_sys = malloc(bo->Size);
|
||||
assert(nbo->cpu_mem_sys);
|
||||
_mesa_memcpy(nbo->cpu_mem_sys, nbo->cpu_mem->map, bo->Size);
|
||||
if (nbo->cpu_mem == nbo->gpu_mem)
|
||||
nbo->cpu_mem = NULL;
|
||||
else
|
||||
NOUVEAU_MEM_FREE(nbo->cpu_mem);
|
||||
}
|
||||
NOUVEAU_MEM_FREE(nbo->gpu_mem);
|
||||
|
||||
bo->OnCard = GL_FALSE;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_bo_choose_storage_method(GLcontext *ctx, GLenum usage,
|
||||
struct gl_buffer_object *bo)
|
||||
{
|
||||
nouveau_buffer_object *nbo = (nouveau_buffer_object *)bo;
|
||||
GLuint gpu_type = 0;
|
||||
GLuint cpu_type = 0;
|
||||
|
||||
switch (usage) {
|
||||
/* Client source, changes often, used by GL many times */
|
||||
case GL_DYNAMIC_DRAW_ARB:
|
||||
gpu_type = NOUVEAU_MEM_AGP | NOUVEAU_MEM_FB_ACCEPTABLE;
|
||||
cpu_type = NOUVEAU_MEM_AGP;
|
||||
break;
|
||||
/* GL source, changes often, client reads many times */
|
||||
case GL_DYNAMIC_READ_ARB:
|
||||
/* Client source, specified once, used by GL many times */
|
||||
case GL_STATIC_DRAW_ARB:
|
||||
/* GL source, specified once, client reads many times */
|
||||
case GL_STATIC_READ_ARB:
|
||||
/* Client source, specified once, used by GL a few times */
|
||||
case GL_STREAM_DRAW_ARB:
|
||||
/* GL source, specified once, client reads a few times */
|
||||
case GL_STREAM_READ_ARB:
|
||||
/* GL source, changes often, used by GL many times*/
|
||||
case GL_DYNAMIC_COPY_ARB:
|
||||
/* GL source, specified once, used by GL many times */
|
||||
case GL_STATIC_COPY_ARB:
|
||||
/* GL source, specified once, used by GL a few times */
|
||||
case GL_STREAM_COPY_ARB:
|
||||
gpu_type = NOUVEAU_MEM_FB;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
nbo->gpu_mem_flags = gpu_type;
|
||||
nbo->cpu_mem_flags = cpu_type;
|
||||
nbo->usage = usage;
|
||||
}
|
||||
|
||||
void
|
||||
nouveau_bo_init_storage(GLcontext *ctx, GLuint valid_gpu_access,
|
||||
GLsizeiptrARB size,
|
||||
const GLvoid *data,
|
||||
GLenum usage,
|
||||
struct gl_buffer_object *bo, int flags)
|
||||
{
|
||||
nouveau_buffer_object *nbo = (nouveau_buffer_object *)bo;
|
||||
|
||||
DEBUG("bo=%p\n", bo);
|
||||
|
||||
/* Free up previous buffers if we can't reuse them */
|
||||
if (nbo->usage != usage ||
|
||||
(nbo->gpu_mem && (nbo->gpu_mem->size != size))) {
|
||||
if (nbo->cpu_mem_sys)
|
||||
FREE(nbo->cpu_mem_sys);
|
||||
if (nbo->cpu_mem) {
|
||||
if (nbo->cpu_mem != nbo->gpu_mem)
|
||||
NOUVEAU_MEM_FREE(nbo->cpu_mem);
|
||||
else
|
||||
nbo->cpu_mem = NULL;
|
||||
}
|
||||
if (nbo->gpu_mem)
|
||||
NOUVEAU_MEM_FREE(nbo->gpu_mem);
|
||||
|
||||
bo->OnCard = GL_FALSE;
|
||||
nbo->cpu_mem_sys = calloc(1, size);
|
||||
}
|
||||
|
||||
nouveau_bo_choose_storage_method(ctx, usage, bo);
|
||||
/* Force off flags that may not be ok for a given buffer */
|
||||
nbo->gpu_mem_flags &= valid_gpu_access;
|
||||
|
||||
bo->Usage = usage;
|
||||
bo->Size = size;
|
||||
|
||||
if (data) {
|
||||
GLvoid *map = nouveau_bo_map(ctx, GL_WRITE_ONLY_ARB, bo);
|
||||
#ifdef MESA_BIG_ENDIAN
|
||||
int i;
|
||||
if (flags) {
|
||||
for (i = 0; i < size; i+=4) {
|
||||
uint32_t _data = *(unsigned int *)(data+i);
|
||||
_data = ((_data >> 16) | ((_data & 0xffff) << 16));
|
||||
*(unsigned int *)(map+i) = _data;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
_mesa_memcpy(map, data, size);
|
||||
(void)flags; /* get rid of warning */
|
||||
nouveau_bo_dirty_all(ctx, GL_FALSE, bo);
|
||||
nouveau_bo_unmap(ctx, bo);
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
nouveau_bo_map(GLcontext *ctx, GLenum access, struct gl_buffer_object *bo)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
nouveau_buffer_object *nbo = (nouveau_buffer_object *)bo;
|
||||
|
||||
DEBUG("bo=%p, access=%s\n", bo, _mesa_lookup_enum_by_nr(access));
|
||||
|
||||
if (bo->OnCard &&
|
||||
(access == GL_READ_ONLY_ARB || access == GL_READ_WRITE_ARB)) {
|
||||
GLuint nr_dirty;
|
||||
|
||||
DEBUG("..on card\n");
|
||||
nr_dirty = nouveau_bo_download_dirty(ctx, bo);
|
||||
|
||||
/* nouveau_bo_download_dirty won't wait unless it needs to
|
||||
* free a temp buffer, which isn't the case if cpu_mem is
|
||||
* present.
|
||||
*/
|
||||
if (nr_dirty && nbo->cpu_mem && nbo->cpu_mem != nbo->gpu_mem)
|
||||
nouveau_notifier_wait_nop(ctx, nmesa->syncNotifier,
|
||||
NvSubMemFormat);
|
||||
}
|
||||
|
||||
if (nbo->cpu_mem) {
|
||||
DEBUG("..access via cpu_mem\n");
|
||||
return nbo->cpu_mem->map;
|
||||
} else {
|
||||
DEBUG("..access via cpu_mem_sys\n");
|
||||
return nbo->cpu_mem_sys;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nouveau_bo_unmap(GLcontext *ctx, struct gl_buffer_object *bo)
|
||||
{
|
||||
DEBUG("unmap bo=%p\n", bo);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
nouveau_bo_gpu_ref(GLcontext *ctx, struct gl_buffer_object *bo)
|
||||
{
|
||||
nouveau_buffer_object *nbo = (nouveau_buffer_object *)bo;
|
||||
|
||||
assert(nbo->mapped == GL_FALSE);
|
||||
|
||||
DEBUG("gpu_ref\n");
|
||||
|
||||
if (!bo->OnCard) {
|
||||
nouveau_bo_move_in(ctx, bo);
|
||||
bo->OnCard = GL_TRUE;
|
||||
}
|
||||
nouveau_bo_upload_dirty(ctx, bo);
|
||||
|
||||
return nouveau_mem_gpu_offset_get(ctx, nbo->gpu_mem);
|
||||
}
|
||||
|
||||
void
|
||||
nouveau_bo_dirty_linear(GLcontext *ctx, GLboolean on_card,
|
||||
uint32_t offset, uint32_t size,
|
||||
struct gl_buffer_object *bo)
|
||||
{
|
||||
nouveau_buffer_object *nbo = (nouveau_buffer_object *)bo;
|
||||
nouveau_bufferobj_dirty *dirty;
|
||||
uint32_t start = offset;
|
||||
uint32_t end = offset + size;
|
||||
int i;
|
||||
|
||||
if (nbo->cpu_mem == nbo->gpu_mem)
|
||||
return;
|
||||
|
||||
dirty = on_card ? &nbo->gpu_dirty : &nbo->cpu_dirty;
|
||||
|
||||
DEBUG("on_card=%d, offset=%d, size=%d, bo=%p\n",
|
||||
on_card, offset, size, bo);
|
||||
|
||||
for (i=0; i<dirty->nr_dirty; i++) {
|
||||
nouveau_bufferobj_region *r = &dirty->dirty[i];
|
||||
|
||||
/* already dirty */
|
||||
if (start >= r->start && end <= r->end) {
|
||||
DEBUG("..already dirty\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* add to the end of a region */
|
||||
if (start >= r->start && start <= r->end) {
|
||||
if (end > r->end) {
|
||||
DEBUG("..extend end of region\n");
|
||||
r->end = end;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* add to the start of a region */
|
||||
if (start < r->start && end >= r->end) {
|
||||
DEBUG("..extend start of region\n");
|
||||
r->start = start;
|
||||
/* .. and to the end */
|
||||
if (end > r->end) {
|
||||
DEBUG("....and end\n");
|
||||
r->end = end;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* new region */
|
||||
DEBUG("..new dirty\n");
|
||||
dirty->nr_dirty++;
|
||||
dirty->dirty = realloc(dirty->dirty,
|
||||
sizeof(nouveau_bufferobj_region) *
|
||||
dirty->nr_dirty);
|
||||
dirty->dirty[dirty->nr_dirty - 1].start = start;
|
||||
dirty->dirty[dirty->nr_dirty - 1].end = end;
|
||||
}
|
||||
|
||||
void
|
||||
nouveau_bo_dirty_all(GLcontext *ctx, GLboolean on_card,
|
||||
struct gl_buffer_object *bo)
|
||||
{
|
||||
nouveau_buffer_object *nbo = (nouveau_buffer_object *)bo;
|
||||
nouveau_bufferobj_dirty *dirty;
|
||||
|
||||
dirty = on_card ? &nbo->gpu_dirty : &nbo->cpu_dirty;
|
||||
|
||||
DEBUG("dirty all\n");
|
||||
if (dirty->nr_dirty) {
|
||||
FREE(dirty->dirty);
|
||||
dirty->dirty = NULL;
|
||||
dirty->nr_dirty = 0;
|
||||
}
|
||||
|
||||
nouveau_bo_dirty_linear(ctx, on_card, 0, bo->Size, bo);
|
||||
}
|
||||
|
||||
GLuint
|
||||
nouveau_bo_upload_dirty(GLcontext *ctx, struct gl_buffer_object *bo)
|
||||
{
|
||||
nouveau_buffer_object *nbo = (nouveau_buffer_object *)bo;
|
||||
nouveau_bufferobj_dirty *dirty = &nbo->cpu_dirty;
|
||||
GLuint nr_dirty;
|
||||
int i;
|
||||
|
||||
nr_dirty = dirty->nr_dirty;
|
||||
if (!nr_dirty) {
|
||||
DEBUG("clean\n");
|
||||
return nr_dirty;
|
||||
}
|
||||
|
||||
for (i=0; i<nr_dirty; i++) {
|
||||
nouveau_bufferobj_region *r = &dirty->dirty[i];
|
||||
|
||||
DEBUG("dirty %d: o=0x%08x, s=0x%08x\n",
|
||||
i, r->start, r->end - r->start);
|
||||
nouveau_bo_upload_to_screen(ctx,
|
||||
r->start, r->end - r->start, bo);
|
||||
}
|
||||
|
||||
FREE(dirty->dirty);
|
||||
dirty->dirty = NULL;
|
||||
dirty->nr_dirty = 0;
|
||||
|
||||
return nr_dirty;
|
||||
}
|
||||
|
||||
GLuint
|
||||
nouveau_bo_download_dirty(GLcontext *ctx, struct gl_buffer_object *bo)
|
||||
{
|
||||
nouveau_buffer_object *nbo = (nouveau_buffer_object *)bo;
|
||||
nouveau_bufferobj_dirty *dirty = &nbo->gpu_dirty;
|
||||
GLuint nr_dirty;
|
||||
int i;
|
||||
|
||||
nr_dirty = dirty->nr_dirty;
|
||||
if (nr_dirty) {
|
||||
DEBUG("clean\n");
|
||||
return nr_dirty;
|
||||
}
|
||||
|
||||
for (i=0; i<nr_dirty; i++) {
|
||||
nouveau_bufferobj_region *r = &dirty->dirty[i];
|
||||
|
||||
DEBUG("dirty %d: o=0x%08x, s=0x%08x\n",
|
||||
i, r->start, r->end - r->start);
|
||||
nouveau_bo_download_from_screen(ctx,
|
||||
r->start,
|
||||
r->end - r->start, bo);
|
||||
}
|
||||
|
||||
FREE(dirty->dirty);
|
||||
dirty->dirty = NULL;
|
||||
dirty->nr_dirty = 0;
|
||||
|
||||
return nr_dirty;
|
||||
}
|
||||
|
||||
static void
|
||||
nouveauBindBuffer(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj)
|
||||
{
|
||||
}
|
||||
|
||||
static struct gl_buffer_object *
|
||||
nouveauNewBufferObject(GLcontext *ctx, GLuint buffer, GLenum target)
|
||||
{
|
||||
nouveau_buffer_object *nbo;
|
||||
|
||||
nbo = CALLOC_STRUCT(nouveau_buffer_object_t);
|
||||
if (nbo)
|
||||
_mesa_initialize_buffer_object(&nbo->mesa, buffer, target);
|
||||
DEBUG("bo=%p\n", nbo);
|
||||
|
||||
return nbo ? &nbo->mesa : NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
nouveauDeleteBuffer(GLcontext *ctx, struct gl_buffer_object *obj)
|
||||
{
|
||||
nouveau_buffer_object *nbo = (nouveau_buffer_object *)obj;
|
||||
|
||||
if (nbo->gpu_dirty.nr_dirty)
|
||||
FREE(nbo->gpu_dirty.dirty);
|
||||
if (nbo->cpu_dirty.nr_dirty)
|
||||
FREE(nbo->cpu_dirty.dirty);
|
||||
if (nbo->cpu_mem) nouveau_mem_free(ctx, nbo->cpu_mem);
|
||||
if (nbo->gpu_mem) nouveau_mem_free(ctx, nbo->gpu_mem);
|
||||
|
||||
_mesa_delete_buffer_object(ctx, obj);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveauBufferData(GLcontext *ctx, GLenum target, GLsizeiptrARB size,
|
||||
const GLvoid *data, GLenum usage,
|
||||
struct gl_buffer_object *obj)
|
||||
{
|
||||
GLuint gpu_flags;
|
||||
|
||||
DEBUG("target=%s, size=%d, data=%p, usage=%s, obj=%p\n",
|
||||
_mesa_lookup_enum_by_nr(target),
|
||||
(GLuint)size, data,
|
||||
_mesa_lookup_enum_by_nr(usage),
|
||||
obj);
|
||||
|
||||
switch (target) {
|
||||
case GL_ELEMENT_ARRAY_BUFFER_ARB:
|
||||
gpu_flags = 0;
|
||||
break;
|
||||
default:
|
||||
gpu_flags = NOUVEAU_BO_VRAM_OK | NOUVEAU_BO_GART_OK;
|
||||
break;
|
||||
}
|
||||
nouveau_bo_init_storage(ctx, gpu_flags, size, data, usage, obj, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveauBufferSubData(GLcontext *ctx, GLenum target, GLintptrARB offset,
|
||||
GLsizeiptrARB size, const GLvoid *data,
|
||||
struct gl_buffer_object *obj)
|
||||
{
|
||||
GLvoid *out;
|
||||
|
||||
DEBUG("target=%s, offset=0x%x, size=%d, data=%p, obj=%p\n",
|
||||
_mesa_lookup_enum_by_nr(target),
|
||||
(GLuint)offset, (GLuint)size, data, obj);
|
||||
|
||||
out = nouveau_bo_map(ctx, GL_WRITE_ONLY_ARB, obj);
|
||||
_mesa_memcpy(out + offset, data, size);
|
||||
nouveau_bo_dirty_linear(ctx, GL_FALSE, offset, size, obj);
|
||||
nouveau_bo_unmap(ctx, obj);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveauGetBufferSubData(GLcontext *ctx, GLenum target, GLintptrARB offset,
|
||||
GLsizeiptrARB size, GLvoid *data,
|
||||
struct gl_buffer_object *obj)
|
||||
{
|
||||
const GLvoid *in;
|
||||
|
||||
DEBUG("target=%s, offset=0x%x, size=%d, data=%p, obj=%p\n",
|
||||
_mesa_lookup_enum_by_nr(target),
|
||||
(GLuint)offset, (GLuint)size, data, obj);
|
||||
|
||||
in = nouveau_bo_map(ctx, GL_READ_ONLY_ARB, obj);
|
||||
_mesa_memcpy(data, in + offset, size);
|
||||
nouveau_bo_unmap(ctx, obj);
|
||||
}
|
||||
|
||||
static void *
|
||||
nouveauMapBuffer(GLcontext *ctx, GLenum target, GLenum access,
|
||||
struct gl_buffer_object *obj)
|
||||
{
|
||||
DEBUG("target=%s, access=%s, obj=%p\n",
|
||||
_mesa_lookup_enum_by_nr(target),
|
||||
_mesa_lookup_enum_by_nr(access),
|
||||
obj
|
||||
);
|
||||
|
||||
/* Already mapped.. */
|
||||
if (obj->Pointer)
|
||||
return NULL;
|
||||
|
||||
/* Have to pass READ_WRITE here, nouveau_bo_map will only ensure that
|
||||
* the cpu_mem buffer is up-to-date if we ask for read access.
|
||||
*
|
||||
* However, even if the client only asks for write access, we're still
|
||||
* forced to reupload the entire buffer. So, we need the cpu_mem buffer
|
||||
* to have the correct data all the time.
|
||||
*/
|
||||
obj->Pointer = nouveau_bo_map(ctx, GL_READ_WRITE_ARB, obj);
|
||||
|
||||
/* The GL spec says that a client attempting to write to a bufferobj
|
||||
* mapped READ_ONLY object may have unpredictable results, possibly
|
||||
* even program termination.
|
||||
*
|
||||
* We're going to use this, and only mark the buffer as dirtied if
|
||||
* the client asks for write access.
|
||||
*/
|
||||
if (target != GL_READ_ONLY_ARB) {
|
||||
/* We have no way of knowing what was modified by the client,
|
||||
* so the entire buffer gets dirtied. */
|
||||
nouveau_bo_dirty_all(ctx, GL_FALSE, obj);
|
||||
}
|
||||
|
||||
return obj->Pointer;
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
nouveauUnmapBuffer(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj)
|
||||
{
|
||||
DEBUG("target=%s, obj=%p\n", _mesa_lookup_enum_by_nr(target), obj);
|
||||
|
||||
assert(obj->Pointer);
|
||||
|
||||
nouveau_bo_unmap(ctx, obj);
|
||||
obj->Pointer = NULL;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nouveauInitBufferObjects(GLcontext *ctx)
|
||||
{
|
||||
ctx->Driver.BindBuffer = nouveauBindBuffer;
|
||||
ctx->Driver.NewBufferObject = nouveauNewBufferObject;
|
||||
ctx->Driver.DeleteBuffer = nouveauDeleteBuffer;
|
||||
ctx->Driver.BufferData = nouveauBufferData;
|
||||
ctx->Driver.BufferSubData = nouveauBufferSubData;
|
||||
ctx->Driver.GetBufferSubData = nouveauGetBufferSubData;
|
||||
ctx->Driver.MapBuffer = nouveauMapBuffer;
|
||||
ctx->Driver.UnmapBuffer = nouveauUnmapBuffer;
|
||||
}
|
||||
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
#ifndef __NOUVEAU_BUFFEROBJ_H__
|
||||
#define __NOUVEAU_BUFFEROBJ_H__
|
||||
|
||||
#include "mtypes.h"
|
||||
#include "nouveau_mem.h"
|
||||
|
||||
#define NOUVEAU_BO_VRAM_OK (NOUVEAU_MEM_FB | NOUVEAU_MEM_FB_ACCEPTABLE)
|
||||
#define NOUVEAU_BO_GART_OK (NOUVEAU_MEM_AGP | NOUVEAU_MEM_AGP_ACCEPTABLE)
|
||||
|
||||
typedef struct nouveau_bufferobj_region_t {
|
||||
uint32_t start;
|
||||
uint32_t end;
|
||||
} nouveau_bufferobj_region;
|
||||
|
||||
typedef struct nouveau_bufferobj_dirty_t {
|
||||
nouveau_bufferobj_region *dirty;
|
||||
int nr_dirty;
|
||||
} nouveau_bufferobj_dirty;
|
||||
|
||||
typedef struct nouveau_buffer_object_t {
|
||||
/* Base class, must be first */
|
||||
struct gl_buffer_object mesa;
|
||||
|
||||
GLboolean mapped;
|
||||
GLenum usage;
|
||||
|
||||
/* Memory used for GPU access to the buffer*/
|
||||
GLuint gpu_mem_flags;
|
||||
nouveau_mem * gpu_mem;
|
||||
nouveau_bufferobj_dirty gpu_dirty;
|
||||
|
||||
/* Memory used for CPU access to the buffer */
|
||||
GLuint cpu_mem_flags;
|
||||
nouveau_mem * cpu_mem;
|
||||
GLvoid * cpu_mem_sys;
|
||||
nouveau_bufferobj_dirty cpu_dirty;
|
||||
} nouveau_buffer_object;
|
||||
|
||||
extern void
|
||||
nouveau_bo_init_storage(GLcontext *ctx, GLuint valid_gpu_access,
|
||||
GLsizeiptrARB size, const GLvoid *data, GLenum usage,
|
||||
struct gl_buffer_object *bo, int flags);
|
||||
|
||||
extern GLboolean
|
||||
nouveau_bo_move_in(GLcontext *ctx, struct gl_buffer_object *bo);
|
||||
|
||||
extern GLboolean
|
||||
nouveau_bo_move_out(GLcontext *ctx, struct gl_buffer_object *bo);
|
||||
|
||||
extern void *
|
||||
nouveau_bo_map(GLcontext *ctx, GLenum usage, struct gl_buffer_object *bo);
|
||||
|
||||
extern void
|
||||
nouveau_bo_unmap(GLcontext *ctx, struct gl_buffer_object *bo);
|
||||
|
||||
extern uint32_t
|
||||
nouveau_bo_gpu_ref(GLcontext *ctx, struct gl_buffer_object *bo);
|
||||
|
||||
extern void
|
||||
nouveau_bo_dirty_linear(GLcontext *ctx, GLboolean on_card,
|
||||
uint32_t offset, uint32_t size,
|
||||
struct gl_buffer_object *bo);
|
||||
|
||||
extern void
|
||||
nouveau_bo_dirty_all(GLcontext *ctx, GLboolean on_card,
|
||||
struct gl_buffer_object *bo);
|
||||
|
||||
extern GLuint
|
||||
nouveau_bo_upload_dirty(GLcontext *ctx, struct gl_buffer_object *bo);
|
||||
|
||||
extern GLuint
|
||||
nouveau_bo_download_dirty(GLcontext *ctx, struct gl_buffer_object *bo);
|
||||
|
||||
extern void
|
||||
nouveauInitBufferObjects(GLcontext *ctx);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
|
||||
#include "nouveau_card.h"
|
||||
#include "nouveau_reg.h"
|
||||
#include "nouveau_drm.h"
|
||||
#include "nouveau_card_list.h"
|
||||
|
||||
|
||||
nouveau_card* nouveau_card_lookup(uint32_t device_id)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<sizeof(nouveau_card_list)/sizeof(nouveau_card)-1;i++)
|
||||
if (nouveau_card_list[i].id==(device_id&0xffff))
|
||||
return &(nouveau_card_list[i]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/**************************************************************************
|
||||
|
||||
Copyright 2006 Stephane Marchesin
|
||||
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
|
||||
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
|
||||
ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#ifndef __NOUVEAU_CARD_H__
|
||||
#define __NOUVEAU_CARD_H__
|
||||
|
||||
#include "dri_util.h"
|
||||
#include "drm.h"
|
||||
#include "nouveau_drm.h"
|
||||
|
||||
typedef struct nouveau_card_t {
|
||||
uint16_t id; /* last 4 digits of pci id, last digit is always 0 */
|
||||
char* name; /* the user-friendly card name */
|
||||
uint32_t class_3d; /* the object class this card uses for 3D */
|
||||
uint32_t type; /* the major card family */
|
||||
uint32_t flags;
|
||||
}
|
||||
nouveau_card;
|
||||
|
||||
#define NV_HAS_LMA 0x00000001
|
||||
|
||||
extern nouveau_card* nouveau_card_lookup(uint32_t device_id);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,226 +0,0 @@
|
|||
static nouveau_card nouveau_card_list[]={
|
||||
{0x0020, "RIVA TNT", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x0028, "RIVA TNT2/TNT2 Pro", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x0029, "RIVA TNT2 Ultra", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x002A, "Riva TnT2", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x002B, "Riva TnT2", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x002C, "Vanta/Vanta LT", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x002D, "RIVA TNT2 Model 64/Model 64 Pro", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x002E, "Vanta", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x002F, "Vanta", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x0040, "GeForce 6800 Ultra", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0041, "GeForce 6800", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0042, "GeForce 6800 LE", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0043, "NV40.3", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0044, "GeForce 6800 XT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0045, "GeForce 6800 GT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0046, "GeForce 6800 GT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0047, "GeForce 6800 GS", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0048, "GeForce 6800 XT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0049, "NV40GL", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x004D, "Quadro FX 4000", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x004E, "Quadro FX 4000", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0090, "GeForce 7800 GTX", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0091, "GeForce 7800 GTX", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0092, "GeForce 7800 GT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0093, "GeForce 7800 GS", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0098, "GeForce Go 7800", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0099, "GE Force Go 7800 GTX", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x009D, "Quadro FX4500", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00A0, "Aladdin TNT2", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x00C0, "GeForce 6800 GS", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00C1, "GeForce 6800", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00C2, "GeForce 6800 LE", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00C3, "Geforce 6800 XT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00C8, "GeForce Go 6800", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00C9, "GeForce Go 6800 Ultra", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00CC, "Quadro FX Go1400", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00CD, "Quadro FX 3450/4000 SDI", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00CE, "Quadro FX 1400", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00F0, "GeForce 6800/GeForce 6800 Ultra", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00F1, "GeForce 6600/GeForce 6600 GT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00F2, "GeForce 6600/GeForce 6600 GT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00F3, "GeForce 6200", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00F4, "GeForce 6600 LE", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00F5, "GeForce 7800 GS", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00F6, "GeForce 6600 GS", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00F8, "Quadro FX 3400/4400", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00F9, "GeForce 6800 Ultra/GeForce 6800 GT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x00FA, "GeForce PCX 5750", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x00FB, "GeForce PCX 5900", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x00FC, "Quadro FX 330/GeForce PCX 5300", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x00FD, "Quadro FX 330/Quadro NVS280", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x00FE, "Quadro FX 1300", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x00FF, "GeForce PCX 4300", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0100, "GeForce 256 SDR", NV10_TCL_PRIMITIVE_3D, NV_10, 0},
|
||||
{0x0101, "GeForce 256 DDR", NV10_TCL_PRIMITIVE_3D, NV_10, 0},
|
||||
{0x0103, "Quadro", NV10_TCL_PRIMITIVE_3D, NV_10, 0},
|
||||
{0x0110, "GeForce2 MX/MX 400", NV11_TCL_PRIMITIVE_3D, NV_11, 0},
|
||||
{0x0111, "GeForce2 MX 100 DDR/200 DDR", NV11_TCL_PRIMITIVE_3D, NV_11, 0},
|
||||
{0x0112, "GeForce2 Go", NV11_TCL_PRIMITIVE_3D, NV_11, 0},
|
||||
{0x0113, "Quadro2 MXR/EX/Go", NV11_TCL_PRIMITIVE_3D, NV_11, 0},
|
||||
{0x0140, "GeForce 6600 GT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0141, "GeForce 6600", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0142, "GeForce 6600 PCIe", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0144, "GeForce Go 6600", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0145, "GeForce 6610 XL", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0146, "Geforce Go 6600TE/6200TE", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0148, "GeForce Go 6600", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0149, "GeForce Go 6600 GT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x014A, "Quadro NVS 440", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x014C, "Quadro FX 550", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x014D, "Quadro FX 550", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x014E, "Quadro FX 540", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x014F, "GeForce 6200", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0150, "GeForce2 GTS/Pro", NV11_TCL_PRIMITIVE_3D, NV_11, 0},
|
||||
{0x0151, "GeForce2 Ti", NV11_TCL_PRIMITIVE_3D, NV_11, 0},
|
||||
{0x0152, "GeForce2 Ultra, Bladerunner", NV11_TCL_PRIMITIVE_3D, NV_11, 0},
|
||||
{0x0153, "Quadro2 Pro", NV11_TCL_PRIMITIVE_3D, NV_11, 0},
|
||||
{0x0161, "GeForce 6200 TurboCache(TM)", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x0162, "GeForce 6200 SE TurboCache (TM)", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x0163, "GeForce 6200 LE", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x0164, "GeForce Go 6200", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x0165, "Quadro NVS 285", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x0166, "GeForce Go 6400", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x0167, "GeForce Go 6200 TurboCache", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x0168, "GeForce Go 6200 TurboCache", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x0170, "GeForce4 MX 460", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0171, "GeForce4 MX 440", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0172, "GeForce4 MX 420", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0173, "GeForce4 MX 440-SE", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0174, "GeForce4 440 Go", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0175, "GeForce4 420 Go", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0176, "GeForce4 420 Go 32M", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0177, "GeForce4 460 Go", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0178, "Quadro4 550 XGL", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0179, "GeForce4 420 Go 32M", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x017A, "Quadro4 200/400 NVS", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x017B, "Quadro4 550 XGL", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x017C, "Quadro4 500 GoGL", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x017D, "GeForce4 410 Go 16M", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0181, "GeForce4 MX 440 AGP 8x", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0182, "GeForce4 MX 440SE AGP 8x", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0183, "GeForce4 MX 420 AGP 8x", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0185, "GeForce4 MX 4000 AGP 8x", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0186, "GeForce4 448 Go", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0187, "GeForce4 488 Go", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0188, "Quadro4 580 XGL", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x018A, "Quadro4 NVS AGP 8x", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x018B, "Quadro4 380 XGL", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x018C, "Quadro NVS 50 PCI", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x018D, "GeForce4 448 Go", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0191, "GeForce 8800 GTX", NV30_TCL_PRIMITIVE_3D|0x5000, NV_50, 0},
|
||||
{0x0193, "GeForce 8800 GTS", NV30_TCL_PRIMITIVE_3D|0x5000, NV_50, 0},
|
||||
{0x01A0, "GeForce2 MX Integrated Graphics", NV11_TCL_PRIMITIVE_3D, NV_11, 0},
|
||||
{0x01D1, "GeForce 7300 LE", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x01D3, "GeForce 7300 SE", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x01D6, "GeForce Go 7200", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x01D7, "Quadro NVS 110M / GeForce Go 7300", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x01D8, "GeForce Go 7400", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x01DA, "Quadro NVS 110M", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x01DF, "GeForce 7300 GS", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x01F0, "GeForce4 MX - nForce GPU", NV17_TCL_PRIMITIVE_3D, NV_17, 0},
|
||||
{0x0200, "GeForce3", NV20_TCL_PRIMITIVE_3D, NV_20, 0},
|
||||
{0x0201, "GeForce3 Ti 200", NV20_TCL_PRIMITIVE_3D, NV_20, 0},
|
||||
{0x0202, "GeForce3 Ti 500", NV20_TCL_PRIMITIVE_3D, NV_20, 0},
|
||||
{0x0203, "Quadro DCC", NV20_TCL_PRIMITIVE_3D, NV_20, 0},
|
||||
{0x0211, "GeForce 6800", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0212, "GeForce 6800 LE", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0215, "GeForce 6800 GT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0218, "GeForce 6800 XT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0221, "GeForce 6200", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x0240, "GeForce 6150", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x0242, "GeForce 6100", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x0244, "Geforce 6150 Go", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x0250, "GeForce4 Ti 4600", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x0251, "GeForce4 Ti 4400", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x0252, "GeForce4 Ti", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x0253, "GeForce4 Ti 4200", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x0258, "Quadro4 900 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x0259, "Quadro4 750 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x025B, "Quadro4 700 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x0280, "GeForce4 Ti 4800", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x0281, "GeForce4 Ti 4200 AGP 8x", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x0282, "GeForce4 Ti 4800 SE", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x0286, "GeForce4 Ti 4200 Go AGP 8x", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x0288, "Quadro4 980 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x0289, "Quadro4 780 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x028C, "Quadro4 700 GoGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0},
|
||||
{0x0290, "GeForce 7900 GTX", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0291, "GeForce 7900 GT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0292, "GeForce 7900 GS", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0298, "GeForce Go 7900 GS", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0299, "GeForce Go 7900 GTX", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x029A, "Quadro FX 2500M", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x029B, "Quadro FX 1500M", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x029C, "Quadro FX 5500", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x029D, "Quadro FX 3500", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x029E, "Quadro FX 1500", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x029F, "Quadro FX 4500 X2", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x02A0, "XGPU", NV20_TCL_PRIMITIVE_3D, NV_20, 0},
|
||||
{0x02E1, "GeForce 7600 GS", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0300, "GeForce FX", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x0301, "GeForce FX 5800 Ultra", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x0302, "GeForce FX 5800", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x0308, "Quadro FX 2000", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x0309, "Quadro FX 1000", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x0311, "GeForce FX 5600 Ultra", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x0312, "GeForce FX 5600", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x0313, "NV31", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x0314, "GeForce FX 5600XT", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x0316, "NV31M", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x0317, "NV31M Pro", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x031A, "GeForce FX Go5600", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x031B, "GeForce FX Go5650", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x031C, "NVIDIA Quadro FX Go700", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x031D, "NV31GLM", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x031E, "NV31GLM Pro", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x031F, "NV31GLM Pro", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0},
|
||||
{0x0320, "GeForce FX 5200", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x0321, "GeForce FX 5200 Ultra", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x0322, "GeForce FX 5200", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x0323, "GeForce FX 5200LE", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x0324, "GeForce FX Go5200", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x0325, "GeForce FX Go5250", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x0326, "GeForce FX 5500", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x0327, "GeForce FX 5100", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x0328, "GeForce FX Go5200 32M/64M", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x0329, "GeForce FX Go5200", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x032A, "Quadro NVS 280 PCI", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x032B, "Quadro FX 500/600 PCI", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x032C, "GeForce FX Go 5300", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x032D, "GeForce FX Go5100", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x032F, "NV34GL", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0},
|
||||
{0x0330, "GeForce FX 5900 Ultra", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0331, "GeForce FX 5900", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0332, "GeForce FX 5900XT", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0333, "GeForce FX 5950 Ultra", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0334, "GeForce FX 5900ZT", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0338, "Quadro FX 3000", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x033F, "Quadro FX 700", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0341, "GeForce FX 5700 Ultra", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0342, "GeForce FX 5700", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0343, "GeForce FX 5700LE", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0344, "GeForce FX 5700VE", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0345, "NV36.5", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0347, "GeForce FX Go5700", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0348, "GeForce FX Go5700", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0349, "NV36M Pro", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x034B, "NV36MAP", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x034C, "Quadro FX Go1000", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x034E, "Quadro FX 1100", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x034F, "NV36GL", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0},
|
||||
{0x0391, "GeForce 7600 GT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0392, "GeForce 7600 GS", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0393, "GeForce 7300 GT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x0398, "GeForce Go 7600", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0},
|
||||
{0x03D0, "GeForce 6100 nForce 430", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x03D1, "GeForce 6100 nForce 405", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x03D2, "GeForce 6100 nForce 400", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x03D5, "GeForce 6100 nForce 420", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0},
|
||||
{0x0020, "TNT", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x0028, "TNT2", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x0029, "UTNT2", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x002C, "VTNT2", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
{0x00A0, "ITNT2", NV04_DX5_TEXTURED_TRIANGLE, NV_04, 0},
|
||||
};
|
||||
|
|
@ -1,422 +0,0 @@
|
|||
/**************************************************************************
|
||||
|
||||
Copyright 2006 Stephane Marchesin
|
||||
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
|
||||
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
|
||||
ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
#include "glheader.h"
|
||||
#include "context.h"
|
||||
#include "simple_list.h"
|
||||
#include "imports.h"
|
||||
#include "matrix.h"
|
||||
#include "swrast/swrast.h"
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
#include "framebuffer.h"
|
||||
|
||||
#include "tnl/tnl.h"
|
||||
#include "tnl/t_pipeline.h"
|
||||
#include "tnl/t_vp_build.h"
|
||||
|
||||
#include "drivers/common/driverfuncs.h"
|
||||
|
||||
#include "nouveau_context.h"
|
||||
#include "nouveau_driver.h"
|
||||
//#include "nouveau_state.h"
|
||||
#include "nouveau_span.h"
|
||||
#include "nouveau_object.h"
|
||||
#include "nouveau_fifo.h"
|
||||
#include "nouveau_tex.h"
|
||||
#include "nouveau_msg.h"
|
||||
#include "nouveau_reg.h"
|
||||
#include "nouveau_lock.h"
|
||||
#include "nouveau_query.h"
|
||||
#include "nv04_swtcl.h"
|
||||
#include "nv10_swtcl.h"
|
||||
|
||||
#include "vblank.h"
|
||||
#include "utils.h"
|
||||
#include "texmem.h"
|
||||
#include "xmlpool.h" /* for symbolic values of enum-type options */
|
||||
|
||||
#ifndef NOUVEAU_DEBUG
|
||||
int NOUVEAU_DEBUG = 0;
|
||||
#endif
|
||||
|
||||
static const struct dri_debug_control debug_control[] =
|
||||
{
|
||||
{ "shaders" , DEBUG_SHADERS },
|
||||
{ "mem" , DEBUG_MEM },
|
||||
{ "bufferobj" , DEBUG_BUFFEROBJ },
|
||||
{ NULL , 0 }
|
||||
};
|
||||
|
||||
#define need_GL_ARB_vertex_program
|
||||
#define need_GL_ARB_occlusion_query
|
||||
#include "extension_helper.h"
|
||||
|
||||
const struct dri_extension common_extensions[] =
|
||||
{
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
const struct dri_extension nv10_extensions[] =
|
||||
{
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
const struct dri_extension nv20_extensions[] =
|
||||
{
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
const struct dri_extension nv30_extensions[] =
|
||||
{
|
||||
{ "GL_ARB_fragment_program", NULL },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
const struct dri_extension nv40_extensions[] =
|
||||
{
|
||||
/* ARB_vp can be moved to nv20/30 once the shader backend has been
|
||||
* written for those cards.
|
||||
*/
|
||||
{ "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
|
||||
{ "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions},
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
const struct dri_extension nv50_extensions[] =
|
||||
{
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
/* Create the device specific context.
|
||||
*/
|
||||
GLboolean nouveauCreateContext( const __GLcontextModes *glVisual,
|
||||
__DRIcontextPrivate *driContextPriv,
|
||||
void *sharedContextPrivate )
|
||||
{
|
||||
GLcontext *ctx, *shareCtx;
|
||||
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
|
||||
struct dd_function_table functions;
|
||||
nouveauContextPtr nmesa;
|
||||
nouveauScreenPtr screen;
|
||||
|
||||
/* Allocate the context */
|
||||
nmesa = (nouveauContextPtr) CALLOC( sizeof(*nmesa) );
|
||||
if ( !nmesa )
|
||||
return GL_FALSE;
|
||||
|
||||
nmesa->driContext = driContextPriv;
|
||||
nmesa->driScreen = sPriv;
|
||||
nmesa->driDrawable = NULL;
|
||||
nmesa->hHWContext = driContextPriv->hHWContext;
|
||||
nmesa->driHwLock = &sPriv->pSAREA->lock;
|
||||
nmesa->driFd = sPriv->fd;
|
||||
|
||||
nmesa->screen = (nouveauScreenPtr)(sPriv->private);
|
||||
screen=nmesa->screen;
|
||||
|
||||
/* Create the hardware context */
|
||||
if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_FB_PHYSICAL,
|
||||
&nmesa->vram_phys))
|
||||
return GL_FALSE;
|
||||
if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_FB_SIZE,
|
||||
&nmesa->vram_size))
|
||||
return GL_FALSE;
|
||||
if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_AGP_PHYSICAL,
|
||||
&nmesa->gart_phys))
|
||||
return GL_FALSE;
|
||||
if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_AGP_SIZE,
|
||||
&nmesa->gart_size))
|
||||
return GL_FALSE;
|
||||
if (!nouveauFifoInit(nmesa))
|
||||
return GL_FALSE;
|
||||
nouveauObjectInit(nmesa);
|
||||
|
||||
|
||||
/* Init default driver functions then plug in our nouveau-specific functions
|
||||
* (the texture functions are especially important)
|
||||
*/
|
||||
_mesa_init_driver_functions( &functions );
|
||||
nouveauDriverInitFunctions( &functions );
|
||||
nouveauTexInitFunctions( &functions );
|
||||
|
||||
/* Allocate the Mesa context */
|
||||
if (sharedContextPrivate)
|
||||
shareCtx = ((nouveauContextPtr) sharedContextPrivate)->glCtx;
|
||||
else
|
||||
shareCtx = NULL;
|
||||
nmesa->glCtx = _mesa_create_context(glVisual, shareCtx,
|
||||
&functions, (void *) nmesa);
|
||||
if (!nmesa->glCtx) {
|
||||
FREE(nmesa);
|
||||
return GL_FALSE;
|
||||
}
|
||||
driContextPriv->driverPrivate = nmesa;
|
||||
ctx = nmesa->glCtx;
|
||||
|
||||
/* Parse configuration files */
|
||||
driParseConfigFiles (&nmesa->optionCache, &screen->optionCache,
|
||||
screen->driScreen->myNum, "nouveau");
|
||||
|
||||
nmesa->sarea = (struct drm_nouveau_sarea *)((char *)sPriv->pSAREA +
|
||||
screen->sarea_priv_offset);
|
||||
|
||||
/* Enable any supported extensions */
|
||||
driInitExtensions(ctx, common_extensions, GL_TRUE);
|
||||
if (nmesa->screen->card->type >= NV_10)
|
||||
driInitExtensions(ctx, nv10_extensions, GL_FALSE);
|
||||
if (nmesa->screen->card->type >= NV_20)
|
||||
driInitExtensions(ctx, nv20_extensions, GL_FALSE);
|
||||
if (nmesa->screen->card->type >= NV_30)
|
||||
driInitExtensions(ctx, nv30_extensions, GL_FALSE);
|
||||
if (nmesa->screen->card->type >= NV_40)
|
||||
driInitExtensions(ctx, nv40_extensions, GL_FALSE);
|
||||
if (nmesa->screen->card->type >= NV_50)
|
||||
driInitExtensions(ctx, nv50_extensions, GL_FALSE);
|
||||
|
||||
nmesa->current_primitive = -1;
|
||||
|
||||
nouveauShaderInitFuncs(ctx);
|
||||
/* Install Mesa's fixed-function texenv shader support */
|
||||
if (nmesa->screen->card->type >= NV_40)
|
||||
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
|
||||
|
||||
/* Initialize the swrast */
|
||||
_swrast_CreateContext( ctx );
|
||||
_vbo_CreateContext( ctx );
|
||||
_tnl_CreateContext( ctx );
|
||||
_swsetup_CreateContext( ctx );
|
||||
|
||||
_math_matrix_ctr(&nmesa->viewport);
|
||||
|
||||
nouveauDDInitStateFuncs( ctx );
|
||||
nouveauSpanInitFunctions( ctx );
|
||||
nouveauDDInitState( nmesa );
|
||||
switch(nmesa->screen->card->type)
|
||||
{
|
||||
case NV_04:
|
||||
case NV_05:
|
||||
nv04TriInitFunctions( ctx );
|
||||
break;
|
||||
case NV_10:
|
||||
case NV_11:
|
||||
case NV_17:
|
||||
case NV_20:
|
||||
case NV_30:
|
||||
case NV_40:
|
||||
case NV_44:
|
||||
case NV_50:
|
||||
default:
|
||||
nv10TriInitFunctions( ctx );
|
||||
break;
|
||||
}
|
||||
|
||||
nouveauInitBufferObjects(ctx);
|
||||
if (!nouveauSyncInitFuncs(ctx))
|
||||
return GL_FALSE;
|
||||
nouveauQueryInitFuncs(ctx);
|
||||
nmesa->hw_func.InitCard(nmesa);
|
||||
nouveauInitState(ctx);
|
||||
|
||||
driContextPriv->driverPrivate = (void *)nmesa;
|
||||
|
||||
NOUVEAU_DEBUG = driParseDebugString( getenv( "NOUVEAU_DEBUG" ),
|
||||
debug_control );
|
||||
|
||||
if (driQueryOptionb(&nmesa->optionCache, "no_rast")) {
|
||||
fprintf(stderr, "disabling 3D acceleration\n");
|
||||
FALLBACK(nmesa, NOUVEAU_FALLBACK_DISABLE, 1);
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
/* Destroy the device specific context. */
|
||||
void nouveauDestroyContext( __DRIcontextPrivate *driContextPriv )
|
||||
{
|
||||
nouveauContextPtr nmesa = (nouveauContextPtr) driContextPriv->driverPrivate;
|
||||
|
||||
assert(nmesa);
|
||||
if ( nmesa ) {
|
||||
/* free the option cache */
|
||||
driDestroyOptionCache (&nmesa->optionCache);
|
||||
|
||||
FREE( nmesa );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Force the context `c' to be the current context and associate with it
|
||||
* buffer `b'.
|
||||
*/
|
||||
GLboolean nouveauMakeCurrent( __DRIcontextPrivate *driContextPriv,
|
||||
__DRIdrawablePrivate *driDrawPriv,
|
||||
__DRIdrawablePrivate *driReadPriv )
|
||||
{
|
||||
if ( driContextPriv ) {
|
||||
nouveauContextPtr nmesa = (nouveauContextPtr) driContextPriv->driverPrivate;
|
||||
struct gl_framebuffer *draw_fb =
|
||||
(struct gl_framebuffer*)driDrawPriv->driverPrivate;
|
||||
struct gl_framebuffer *read_fb =
|
||||
(struct gl_framebuffer*)driReadPriv->driverPrivate;
|
||||
|
||||
if (driDrawPriv->swap_interval == (unsigned)-1) {
|
||||
driDrawPriv->vblFlags =
|
||||
driGetDefaultVBlankFlags(&nmesa->optionCache);
|
||||
|
||||
driDrawableInitVBlank(driDrawPriv);
|
||||
}
|
||||
|
||||
nmesa->driDrawable = driDrawPriv;
|
||||
|
||||
_mesa_resize_framebuffer(nmesa->glCtx, draw_fb,
|
||||
driDrawPriv->w, driDrawPriv->h);
|
||||
if (draw_fb != read_fb) {
|
||||
_mesa_resize_framebuffer(nmesa->glCtx, draw_fb,
|
||||
driReadPriv->w,
|
||||
driReadPriv->h);
|
||||
}
|
||||
_mesa_make_current(nmesa->glCtx, draw_fb, read_fb);
|
||||
|
||||
nouveau_build_framebuffer(nmesa->glCtx,
|
||||
driDrawPriv->driverPrivate);
|
||||
} else {
|
||||
_mesa_make_current( NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* Force the context `c' to be unbound from its buffer.
|
||||
*/
|
||||
GLboolean nouveauUnbindContext( __DRIcontextPrivate *driContextPriv )
|
||||
{
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nouveauDoSwapBuffers(nouveauContextPtr nmesa, __DRIdrawablePrivate *dPriv)
|
||||
{
|
||||
struct gl_framebuffer *fb;
|
||||
nouveauScreenPtr screen = dPriv->driScreenPriv->private;
|
||||
nouveau_renderbuffer_t *src;
|
||||
drm_clip_rect_t *box;
|
||||
int nbox, i;
|
||||
|
||||
fb = (struct gl_framebuffer *)dPriv->driverPrivate;
|
||||
if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {
|
||||
src = (nouveau_renderbuffer_t *)
|
||||
fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
|
||||
} else {
|
||||
src = (nouveau_renderbuffer_t *)
|
||||
fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer;
|
||||
}
|
||||
|
||||
LOCK_HARDWARE(nmesa);
|
||||
nbox = dPriv->numClipRects;
|
||||
box = dPriv->pClipRects;
|
||||
|
||||
if (nbox) {
|
||||
BEGIN_RING_SIZE(NvSubCtxSurf2D,
|
||||
NV10_CONTEXT_SURFACES_2D_FORMAT, 4);
|
||||
if (src->mesa._ActualFormat == GL_RGBA8)
|
||||
OUT_RING (6); /* X8R8G8B8 */
|
||||
else
|
||||
OUT_RING (4); /* R5G6B5 */
|
||||
OUT_RING(((screen->frontPitch * screen->fbFormat) << 16) |
|
||||
src->pitch);
|
||||
OUT_RING(src->offset);
|
||||
OUT_RING(screen->frontOffset);
|
||||
}
|
||||
|
||||
for (i=0; i<nbox; i++, box++) {
|
||||
BEGIN_RING_SIZE(NvSubImageBlit, NV_IMAGE_BLIT_POINT_IN, 3);
|
||||
OUT_RING (((box->y1 - dPriv->y) << 16) |
|
||||
(box->x1 - dPriv->x));
|
||||
OUT_RING ((box->y1 << 16) | box->x1);
|
||||
OUT_RING (((box->y2 - box->y1) << 16) |
|
||||
(box->x2 - box->x1));
|
||||
}
|
||||
FIRE_RING();
|
||||
|
||||
UNLOCK_HARDWARE(nmesa);
|
||||
}
|
||||
|
||||
void nouveauSwapBuffers(__DRIdrawablePrivate *dPriv)
|
||||
{
|
||||
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
|
||||
nouveauContextPtr nmesa = dPriv->driContextPriv->driverPrivate;
|
||||
|
||||
if (nmesa->glCtx->Visual.doubleBufferMode) {
|
||||
_mesa_notifySwapBuffers(nmesa->glCtx);
|
||||
nouveauDoSwapBuffers(nmesa, dPriv);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void nouveauCopySubBuffer(__DRIdrawablePrivate *dPriv,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
}
|
||||
|
||||
void nouveauClearBuffer(GLcontext *ctx, nouveau_renderbuffer_t *buffer,
|
||||
int fill, int mask)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
int dimensions;
|
||||
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* FIXME: only support 32 bits atm */
|
||||
|
||||
/* Surface that we will work on */
|
||||
nouveauObjectOnSubchannel(nmesa, NvSubCtxSurf2D, NvCtxSurf2D);
|
||||
|
||||
BEGIN_RING_SIZE(NvSubCtxSurf2D, NV10_CONTEXT_SURFACES_2D_FORMAT, 4);
|
||||
OUT_RING(0x0b); /* Y32 color format */
|
||||
OUT_RING((buffer->pitch<<16)|buffer->pitch);
|
||||
OUT_RING(buffer->offset);
|
||||
OUT_RING(buffer->offset);
|
||||
|
||||
/* Now clear a rectangle */
|
||||
dimensions = ((buffer->mesa.Height)<<16) | (buffer->mesa.Width);
|
||||
|
||||
nouveauObjectOnSubchannel(nmesa, NvSubGdiRectText, NvGdiRectText);
|
||||
|
||||
BEGIN_RING_SIZE(NvSubGdiRectText, NV04_GDI_RECTANGLE_TEXT_OPERATION, 1);
|
||||
OUT_RING(3); /* SRCCOPY */
|
||||
|
||||
BEGIN_RING_SIZE(NvSubGdiRectText, NV04_GDI_RECTANGLE_TEXT_BLOCK_LEVEL1_TL, 5);
|
||||
OUT_RING(0); /* top left */
|
||||
OUT_RING(dimensions); /* bottom right */
|
||||
OUT_RING(fill);
|
||||
OUT_RING(0); /* top left */
|
||||
OUT_RING(dimensions); /* bottom right */
|
||||
}
|
||||
|
|
@ -1,241 +0,0 @@
|
|||
/**************************************************************************
|
||||
|
||||
Copyright 2006 Stephane Marchesin
|
||||
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
|
||||
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
|
||||
ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef __NOUVEAU_CONTEXT_H__
|
||||
#define __NOUVEAU_CONTEXT_H__
|
||||
|
||||
#include "dri_util.h"
|
||||
#include "drm.h"
|
||||
#include "nouveau_drm.h"
|
||||
|
||||
#include "mtypes.h"
|
||||
#include "tnl/t_vertex.h"
|
||||
|
||||
#include "nouveau_fbo.h"
|
||||
#include "nouveau_screen.h"
|
||||
#include "nouveau_shader.h"
|
||||
#include "nouveau_state_cache.h"
|
||||
#include "nouveau_sync.h"
|
||||
|
||||
#include "xmlconfig.h"
|
||||
|
||||
typedef struct nouveau_fifo {
|
||||
struct drm_nouveau_channel_alloc drm;
|
||||
uint32_t *pushbuf;
|
||||
uint32_t *mmio;
|
||||
uint32_t *notifier_block;
|
||||
uint32_t current;
|
||||
uint32_t put;
|
||||
uint32_t free;
|
||||
uint32_t max;
|
||||
} nouveau_fifo_t;
|
||||
|
||||
#define TAG(x) nouveau##x
|
||||
#include "tnl_dd/t_dd_vertex.h"
|
||||
#undef TAG
|
||||
|
||||
/* Subpixel offsets for window coordinates (triangles): */
|
||||
#define SUBPIXEL_X (0.0F)
|
||||
#define SUBPIXEL_Y (0.125F)
|
||||
|
||||
struct nouveau_context;
|
||||
|
||||
typedef void (*nouveau_tri_func)( struct nouveau_context*,
|
||||
nouveauVertex *,
|
||||
nouveauVertex *,
|
||||
nouveauVertex * );
|
||||
|
||||
typedef void (*nouveau_line_func)( struct nouveau_context*,
|
||||
nouveauVertex *,
|
||||
nouveauVertex * );
|
||||
|
||||
typedef void (*nouveau_point_func)( struct nouveau_context*,
|
||||
nouveauVertex * );
|
||||
|
||||
typedef struct nouveau_hw_func_t {
|
||||
/* Initialise any card-specific non-GL related state */
|
||||
GLboolean (*InitCard)(struct nouveau_context *);
|
||||
/* Update buffer offset/pitch/format */
|
||||
GLboolean (*BindBuffers)(struct nouveau_context *, int num_color,
|
||||
nouveau_renderbuffer_t **color,
|
||||
nouveau_renderbuffer_t *depth);
|
||||
/* Update anything that depends on the window position/size */
|
||||
void (*WindowMoved)(struct nouveau_context *);
|
||||
|
||||
/* Update projection matrix */
|
||||
void (*UpdateProjectionMatrix)(GLcontext *);
|
||||
|
||||
/* Update modelview matrix (used for lighting and vertex weight) */
|
||||
void (*UpdateModelviewMatrix)(GLcontext *);
|
||||
} nouveau_hw_func;
|
||||
|
||||
typedef struct nouveau_context {
|
||||
/* Mesa context */
|
||||
GLcontext *glCtx;
|
||||
|
||||
/* The per-context fifo */
|
||||
nouveau_fifo_t fifo;
|
||||
|
||||
/* Physical addresses of AGP/VRAM apertures */
|
||||
uint64_t vram_phys;
|
||||
uint64_t vram_size;
|
||||
uint64_t gart_phys;
|
||||
uint64_t gart_size;
|
||||
|
||||
/* Channel synchronisation */
|
||||
struct drm_nouveau_notifierobj_alloc *syncNotifier;
|
||||
|
||||
/* ARB_occlusion_query / EXT_timer_query */
|
||||
GLuint query_object_max;
|
||||
GLboolean * query_alloc;
|
||||
struct drm_nouveau_notifierobj_alloc *queryNotifier;
|
||||
|
||||
/* Additional hw-specific functions */
|
||||
nouveau_hw_func hw_func;
|
||||
|
||||
/* FIXME : do we want to put all state into a separate struct ? */
|
||||
/* State for tris */
|
||||
GLuint color_offset;
|
||||
GLuint specular_offset;
|
||||
|
||||
/* Vertex state */
|
||||
GLuint vertex_size;
|
||||
GLubyte *verts;
|
||||
struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
|
||||
GLuint vertex_attr_count;
|
||||
|
||||
/* Color and depth renderbuffers */
|
||||
nouveau_renderbuffer_t *color_buffer;
|
||||
nouveau_renderbuffer_t *depth_buffer;
|
||||
|
||||
/* Depth/stencil clear value */
|
||||
uint32_t clear_value;
|
||||
|
||||
/* Light state */
|
||||
GLboolean lighting_enabled;
|
||||
uint32_t enabled_lights;
|
||||
|
||||
/* Cached state */
|
||||
nouveau_state_cache state_cache;
|
||||
|
||||
/* The drawing fallbacks */
|
||||
GLuint Fallback;
|
||||
nouveau_tri_func draw_tri;
|
||||
nouveau_line_func draw_line;
|
||||
nouveau_point_func draw_point;
|
||||
|
||||
/* Cliprects information */
|
||||
GLuint numClipRects;
|
||||
drm_clip_rect_t *pClipRects;
|
||||
drm_clip_rect_t osClipRect;
|
||||
GLuint drawX, drawY, drawW, drawH;
|
||||
|
||||
/* The rendering context information */
|
||||
GLenum current_primitive; /* the current primitive enum */
|
||||
DECLARE_RENDERINPUTS(render_inputs_bitset); /* the current render inputs */
|
||||
|
||||
/* Shader state */
|
||||
nvsFunc VPfunc;
|
||||
nvsFunc FPfunc;
|
||||
nouveauShader *current_fragprog;
|
||||
nouveauShader *current_vertprog;
|
||||
nouveauShader *passthrough_vp;
|
||||
nouveauShader *passthrough_fp;
|
||||
|
||||
nouveauScreenRec *screen;
|
||||
struct drm_nouveau_sarea *sarea;
|
||||
|
||||
__DRIcontextPrivate *driContext; /* DRI context */
|
||||
__DRIscreenPrivate *driScreen; /* DRI screen */
|
||||
__DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */
|
||||
GLint lastStamp;
|
||||
|
||||
drm_context_t hHWContext;
|
||||
drm_hw_lock_t *driHwLock;
|
||||
int driFd;
|
||||
|
||||
/* Configuration cache */
|
||||
driOptionCache optionCache;
|
||||
|
||||
GLuint new_state;
|
||||
GLuint new_render_state;
|
||||
GLuint render_index;
|
||||
GLmatrix viewport;
|
||||
GLfloat depth_scale;
|
||||
|
||||
}nouveauContextRec, *nouveauContextPtr;
|
||||
|
||||
|
||||
#define NOUVEAU_CONTEXT(ctx) ((nouveauContextPtr)(ctx->DriverCtx))
|
||||
|
||||
/* Flags for software fallback cases: */
|
||||
#define NOUVEAU_FALLBACK_TEXTURE 0x0001
|
||||
#define NOUVEAU_FALLBACK_DRAW_BUFFER 0x0002
|
||||
#define NOUVEAU_FALLBACK_READ_BUFFER 0x0004
|
||||
#define NOUVEAU_FALLBACK_STENCIL 0x0008
|
||||
#define NOUVEAU_FALLBACK_RENDER_MODE 0x0010
|
||||
#define NOUVEAU_FALLBACK_LOGICOP 0x0020
|
||||
#define NOUVEAU_FALLBACK_SEP_SPECULAR 0x0040
|
||||
#define NOUVEAU_FALLBACK_BLEND_EQ 0x0080
|
||||
#define NOUVEAU_FALLBACK_BLEND_FUNC 0x0100
|
||||
#define NOUVEAU_FALLBACK_PROJTEX 0x0200
|
||||
#define NOUVEAU_FALLBACK_DISABLE 0x0400
|
||||
|
||||
|
||||
extern GLboolean nouveauCreateContext( const __GLcontextModes *glVisual,
|
||||
__DRIcontextPrivate *driContextPriv,
|
||||
void *sharedContextPrivate );
|
||||
|
||||
extern void nouveauDestroyContext( __DRIcontextPrivate * );
|
||||
|
||||
extern GLboolean nouveauMakeCurrent( __DRIcontextPrivate *driContextPriv,
|
||||
__DRIdrawablePrivate *driDrawPriv,
|
||||
__DRIdrawablePrivate *driReadPriv );
|
||||
|
||||
extern GLboolean nouveauUnbindContext( __DRIcontextPrivate *driContextPriv );
|
||||
|
||||
extern void nouveauDoSwapBuffers(nouveauContextPtr nmesa,
|
||||
__DRIdrawablePrivate *dPriv);
|
||||
|
||||
extern void nouveauSwapBuffers(__DRIdrawablePrivate *dPriv);
|
||||
|
||||
extern void nouveauCopySubBuffer(__DRIdrawablePrivate *dPriv,
|
||||
int x, int y, int w, int h);
|
||||
|
||||
extern void nouveauClearBuffer(GLcontext *ctx, nouveau_renderbuffer_t *buffer,
|
||||
int fill, int mask);
|
||||
|
||||
/* Debugging utils: */
|
||||
extern int NOUVEAU_DEBUG;
|
||||
|
||||
#define DEBUG_SHADERS 0x00000001
|
||||
#define DEBUG_MEM 0x00000002
|
||||
#define DEBUG_BUFFEROBJ 0x00000004
|
||||
|
||||
#endif /* __NOUVEAU_CONTEXT_H__ */
|
||||
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
/**************************************************************************
|
||||
|
||||
Copyright 2006 Stephane Marchesin, Sylvain Munaut
|
||||
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
|
||||
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
|
||||
ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#define NV03_STATUS 0x004006b0
|
||||
#define NV04_STATUS 0x00400700
|
||||
|
||||
#define NV03_FIFO_REGS_SIZE 0x10000
|
||||
# define NV03_FIFO_REGS_DMAPUT 0x00000040
|
||||
# define NV03_FIFO_REGS_DMAGET 0x00000044
|
||||
|
||||
/* Fifo commands. These are not regs, neither masks */
|
||||
#define NV03_FIFO_CMD_JUMP 0x20000000
|
||||
#define NV03_FIFO_CMD_JUMP_OFFSET_MASK 0x1ffffffc
|
||||
#define NV03_FIFO_CMD_REWIND (NV03_FIFO_CMD_JUMP | (0 & NV03_FIFO_CMD_JUMP_OFFSET_MASK))
|
||||
|
||||
|
||||
#define NONINC_METHOD 0x40000000
|
||||
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef _NOUVEAU_DRI_
|
||||
#define _NOUVEAU_DRI_
|
||||
|
||||
#include "xf86drm.h"
|
||||
#include "drm.h"
|
||||
#include "nouveau_drm.h"
|
||||
|
||||
typedef struct {
|
||||
uint32_t device_id; /**< \brief PCI device ID */
|
||||
uint32_t width; /**< \brief width in pixels of display */
|
||||
uint32_t height; /**< \brief height in scanlines of display */
|
||||
uint32_t depth; /**< \brief depth of display (8, 15, 16, 24) */
|
||||
uint32_t bpp; /**< \brief bit depth of display (8, 16, 24, 32) */
|
||||
|
||||
uint32_t bus_type; /**< \brief ths bus type */
|
||||
uint32_t bus_mode; /**< \brief bus mode (used for AGP, maybe also for PCI-E ?) */
|
||||
|
||||
uint32_t front_offset; /**< \brief front buffer offset */
|
||||
uint32_t front_pitch; /**< \brief front buffer pitch */
|
||||
uint32_t back_offset; /**< \brief private back buffer offset */
|
||||
uint32_t back_pitch; /**< \brief private back buffer pitch */
|
||||
uint32_t depth_offset; /**< \brief private depth buffer offset */
|
||||
uint32_t depth_pitch; /**< \brief private depth buffer pitch */
|
||||
|
||||
} NOUVEAUDRIRec, *NOUVEAUDRIPtr;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,218 +0,0 @@
|
|||
/**************************************************************************
|
||||
|
||||
Copyright 2006 Stephane Marchesin
|
||||
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
|
||||
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
|
||||
ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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 "nouveau_context.h"
|
||||
//#include "nouveau_state.h"
|
||||
#include "nouveau_lock.h"
|
||||
#include "nouveau_fifo.h"
|
||||
#include "nouveau_driver.h"
|
||||
#include "swrast/swrast.h"
|
||||
|
||||
#include "context.h"
|
||||
#include "framebuffer.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "colormac.h"
|
||||
|
||||
/* Wrapper for DRM_NOUVEAU_GETPARAM ioctl */
|
||||
GLboolean nouveauDRMGetParam(nouveauContextPtr nmesa,
|
||||
unsigned int param,
|
||||
uint64_t* value)
|
||||
{
|
||||
struct drm_nouveau_getparam getp;
|
||||
|
||||
getp.param = param;
|
||||
if (!value || drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_GETPARAM,
|
||||
&getp, sizeof(getp)))
|
||||
return GL_FALSE;
|
||||
*value = getp.value;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
/* Wrapper for DRM_NOUVEAU_GETPARAM ioctl */
|
||||
GLboolean nouveauDRMSetParam(nouveauContextPtr nmesa,
|
||||
unsigned int param,
|
||||
uint64_t value)
|
||||
{
|
||||
struct drm_nouveau_setparam setp;
|
||||
|
||||
setp.param = param;
|
||||
setp.value = value;
|
||||
if (drmCommandWrite(nmesa->driFd, DRM_NOUVEAU_SETPARAM, &setp,
|
||||
sizeof(setp)))
|
||||
return GL_FALSE;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
/* Return the width and height of the current color buffer */
|
||||
static void nouveauGetBufferSize( GLframebuffer *buffer,
|
||||
GLuint *width, GLuint *height )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
|
||||
LOCK_HARDWARE( nmesa );
|
||||
*width = nmesa->driDrawable->w;
|
||||
*height = nmesa->driDrawable->h;
|
||||
UNLOCK_HARDWARE( nmesa );
|
||||
}
|
||||
|
||||
/* glGetString */
|
||||
static const GLubyte *nouveauGetString( GLcontext *ctx, GLenum name )
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
static char buffer[128];
|
||||
const char * card_name = "Unknown";
|
||||
GLuint agp_mode = 0;
|
||||
|
||||
switch ( name ) {
|
||||
case GL_VENDOR:
|
||||
return (GLubyte *)DRIVER_AUTHOR;
|
||||
|
||||
case GL_RENDERER:
|
||||
card_name=nmesa->screen->card->name;
|
||||
|
||||
switch(nmesa->screen->bus_type)
|
||||
{
|
||||
case NV_PCI:
|
||||
case NV_PCIE:
|
||||
default:
|
||||
agp_mode=0;
|
||||
break;
|
||||
case NV_AGP:
|
||||
agp_mode=nmesa->screen->agp_mode;
|
||||
break;
|
||||
}
|
||||
driGetRendererString( buffer, card_name, DRIVER_DATE,
|
||||
agp_mode );
|
||||
return (GLubyte *)buffer;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* glFlush */
|
||||
static void nouveauFlush( GLcontext *ctx )
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
|
||||
if (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT)
|
||||
nouveauDoSwapBuffers(nmesa, nmesa->driDrawable);
|
||||
FIRE_RING();
|
||||
}
|
||||
|
||||
/* glFinish */
|
||||
static void nouveauFinish( GLcontext *ctx )
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
|
||||
nouveauFlush( ctx );
|
||||
nouveauWaitForIdle( nmesa );
|
||||
}
|
||||
|
||||
/* glClear */
|
||||
static void nouveauClear( GLcontext *ctx, GLbitfield mask )
|
||||
{
|
||||
uint32_t clear_value;
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
|
||||
/* FIXME: should we clear front buffer, even if asked to do it? */
|
||||
if (mask & (BUFFER_BIT_FRONT_LEFT|BUFFER_BIT_BACK_LEFT)) {
|
||||
GLubyte c[4];
|
||||
int color_bits = 32;
|
||||
int color_mask = 0xffffffff;
|
||||
|
||||
UNCLAMPED_FLOAT_TO_RGBA_CHAN(c,ctx->Color.ClearColor);
|
||||
clear_value = PACK_COLOR_8888(c[3],c[0],c[1],c[2]);
|
||||
|
||||
if (ctx->DrawBuffer) {
|
||||
/* FIXME: find correct color buffer, instead of [0] */
|
||||
if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {
|
||||
color_bits = ctx->DrawBuffer->_ColorDrawBuffers[0]->RedBits;
|
||||
color_bits += ctx->DrawBuffer->_ColorDrawBuffers[0]->GreenBits;
|
||||
color_bits += ctx->DrawBuffer->_ColorDrawBuffers[0]->BlueBits;
|
||||
color_bits += ctx->DrawBuffer->_ColorDrawBuffers[0]->AlphaBits;
|
||||
}
|
||||
}
|
||||
|
||||
if (color_bits<24) {
|
||||
clear_value = PACK_COLOR_565(c[0],c[1],c[2]);
|
||||
color_mask = 0xffff;
|
||||
}
|
||||
|
||||
nouveauClearBuffer(ctx, nmesa->color_buffer,
|
||||
clear_value, color_mask);
|
||||
}
|
||||
|
||||
if (mask & (BUFFER_BIT_DEPTH)) {
|
||||
int depth_bits = 24;
|
||||
int depth_mask;
|
||||
if (ctx->DrawBuffer) {
|
||||
if (ctx->DrawBuffer->_DepthBuffer) {
|
||||
depth_bits = ctx->DrawBuffer->_DepthBuffer->DepthBits;
|
||||
}
|
||||
}
|
||||
|
||||
switch(depth_bits) {
|
||||
case 16:
|
||||
clear_value = (uint32_t) (ctx->Depth.Clear * 32767.0);
|
||||
depth_mask = 0xffff;
|
||||
break;
|
||||
default:
|
||||
clear_value = ((uint32_t) (ctx->Depth.Clear * 16777215.0)) << 8;
|
||||
depth_mask = 0xffffff00;
|
||||
break;
|
||||
}
|
||||
|
||||
nouveauClearBuffer(ctx, nmesa->depth_buffer,
|
||||
clear_value, depth_mask);
|
||||
}
|
||||
|
||||
if (mask & (BUFFER_BIT_STENCIL)) {
|
||||
int stencil_bits = 0;
|
||||
if (ctx->DrawBuffer) {
|
||||
if (ctx->DrawBuffer->_StencilBuffer) {
|
||||
stencil_bits = ctx->DrawBuffer->_StencilBuffer->StencilBits;
|
||||
}
|
||||
}
|
||||
|
||||
if (stencil_bits>0) {
|
||||
nouveauClearBuffer(ctx, nmesa->depth_buffer,
|
||||
ctx->Stencil.Clear, (1<<stencil_bits)-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nouveauDriverInitFunctions( struct dd_function_table *functions )
|
||||
{
|
||||
functions->GetBufferSize = nouveauGetBufferSize;
|
||||
functions->ResizeBuffers = _mesa_resize_framebuffer;
|
||||
functions->GetString = nouveauGetString;
|
||||
functions->Flush = nouveauFlush;
|
||||
functions->Finish = nouveauFinish;
|
||||
functions->Clear = nouveauClear;
|
||||
}
|
||||
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/**************************************************************************
|
||||
|
||||
Copyright 2006 Stephane Marchesin
|
||||
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
|
||||
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
|
||||
ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef __NOUVEAU_DRIVER_H__
|
||||
#define __NOUVEAU_DRIVER_H__
|
||||
|
||||
#define DRIVER_DATE "20060219"
|
||||
#define DRIVER_AUTHOR "Stephane Marchesin"
|
||||
|
||||
extern void nouveauDriverInitFunctions( struct dd_function_table *functions );
|
||||
extern GLboolean nouveauDRMGetParam(nouveauContextPtr nmesa, unsigned int param,
|
||||
uint64_t *value);
|
||||
extern GLboolean nouveauDRMSetParam(nouveauContextPtr nmesa, unsigned int param,
|
||||
uint64_t value);
|
||||
|
||||
#endif /* __NOUVEAU_DRIVER_H__ */
|
||||
|
||||
|
|
@ -1,289 +0,0 @@
|
|||
#include "utils.h"
|
||||
#include "framebuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
#include "fbobject.h"
|
||||
|
||||
#include "nouveau_context.h"
|
||||
#include "nouveau_fbo.h"
|
||||
#include "nouveau_fifo.h"
|
||||
#include "nouveau_msg.h"
|
||||
#include "nouveau_object.h"
|
||||
#include "nouveau_reg.h"
|
||||
|
||||
static GLboolean
|
||||
nouveau_renderbuffer_pixelformat(nouveau_renderbuffer_t * nrb,
|
||||
GLenum internalFormat)
|
||||
{
|
||||
nrb->mesa.InternalFormat = internalFormat;
|
||||
|
||||
/*TODO: We probably want to extend this a bit, and maybe make
|
||||
* card-specific?
|
||||
*/
|
||||
switch (internalFormat) {
|
||||
case GL_RGBA:
|
||||
case GL_RGBA8:
|
||||
nrb->mesa._BaseFormat = GL_RGBA;
|
||||
nrb->mesa._ActualFormat = GL_RGBA8;
|
||||
nrb->mesa.DataType = GL_UNSIGNED_BYTE;
|
||||
nrb->mesa.RedBits = 8;
|
||||
nrb->mesa.GreenBits = 8;
|
||||
nrb->mesa.BlueBits = 8;
|
||||
nrb->mesa.AlphaBits = 8;
|
||||
nrb->cpp = 4;
|
||||
break;
|
||||
case GL_RGB:
|
||||
case GL_RGB5:
|
||||
nrb->mesa._BaseFormat = GL_RGB;
|
||||
nrb->mesa._ActualFormat = GL_RGB5;
|
||||
nrb->mesa.DataType = GL_UNSIGNED_BYTE;
|
||||
nrb->mesa.RedBits = 5;
|
||||
nrb->mesa.GreenBits = 6;
|
||||
nrb->mesa.BlueBits = 5;
|
||||
nrb->mesa.AlphaBits = 0;
|
||||
nrb->cpp = 2;
|
||||
break;
|
||||
case GL_DEPTH_COMPONENT16:
|
||||
nrb->mesa._BaseFormat = GL_DEPTH_COMPONENT;
|
||||
nrb->mesa._ActualFormat = GL_DEPTH_COMPONENT16;
|
||||
nrb->mesa.DataType = GL_UNSIGNED_SHORT;
|
||||
nrb->mesa.DepthBits = 16;
|
||||
nrb->cpp = 2;
|
||||
break;
|
||||
case GL_DEPTH_COMPONENT24:
|
||||
nrb->mesa._BaseFormat = GL_DEPTH_COMPONENT;
|
||||
nrb->mesa._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
|
||||
nrb->mesa.DataType = GL_UNSIGNED_INT_24_8_EXT;
|
||||
nrb->mesa.DepthBits = 24;
|
||||
nrb->cpp = 4;
|
||||
break;
|
||||
case GL_STENCIL_INDEX8_EXT:
|
||||
nrb->mesa._BaseFormat = GL_STENCIL_INDEX;
|
||||
nrb->mesa._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
|
||||
nrb->mesa.DataType = GL_UNSIGNED_INT_24_8_EXT;
|
||||
nrb->mesa.StencilBits = 8;
|
||||
nrb->cpp = 4;
|
||||
break;
|
||||
case GL_DEPTH24_STENCIL8_EXT:
|
||||
nrb->mesa._BaseFormat = GL_DEPTH_STENCIL_EXT;
|
||||
nrb->mesa._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
|
||||
nrb->mesa.DataType = GL_UNSIGNED_INT_24_8_EXT;
|
||||
nrb->mesa.DepthBits = 24;
|
||||
nrb->mesa.StencilBits = 8;
|
||||
nrb->cpp = 4;
|
||||
break;
|
||||
default:
|
||||
return GL_FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
nouveau_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||
GLenum internalFormat,
|
||||
GLuint width, GLuint height)
|
||||
{
|
||||
nouveau_renderbuffer_t *nrb = (nouveau_renderbuffer_t *) rb;
|
||||
|
||||
if (!nouveau_renderbuffer_pixelformat(nrb, internalFormat)) {
|
||||
fprintf(stderr, "%s: unknown internalFormat\n", __func__);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* If this buffer isn't statically alloc'd, we may need to ask the
|
||||
* drm for more memory */
|
||||
if (rb->Width != width || rb->Height != height) {
|
||||
GLuint pitch;
|
||||
|
||||
/* align pitches to 64 bytes */
|
||||
pitch = ((width * nrb->cpp) + 63) & ~63;
|
||||
|
||||
if (nrb->mem)
|
||||
nouveau_mem_free(ctx, nrb->mem);
|
||||
nrb->mem = nouveau_mem_alloc(ctx,
|
||||
NOUVEAU_MEM_FB |
|
||||
NOUVEAU_MEM_MAPPED,
|
||||
pitch * height, 0);
|
||||
if (!nrb->mem)
|
||||
return GL_FALSE;
|
||||
|
||||
/* update nouveau_renderbuffer info */
|
||||
nrb->offset = nouveau_mem_gpu_offset_get(ctx, nrb->mem);
|
||||
nrb->pitch = pitch;
|
||||
}
|
||||
|
||||
rb->Width = width;
|
||||
rb->Height = height;
|
||||
rb->InternalFormat = internalFormat;
|
||||
|
||||
nouveauSpanSetFunctions(nrb);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_renderbuffer_delete(struct gl_renderbuffer *rb)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
nouveau_renderbuffer_t *nrb = (nouveau_renderbuffer_t *) rb;
|
||||
|
||||
if (nrb->mem)
|
||||
nouveau_mem_free(ctx, nrb->mem);
|
||||
FREE(nrb);
|
||||
}
|
||||
|
||||
nouveau_renderbuffer_t *
|
||||
nouveau_renderbuffer_new(GLenum internalFormat)
|
||||
{
|
||||
nouveau_renderbuffer_t *nrb;
|
||||
|
||||
nrb = CALLOC_STRUCT(nouveau_renderbuffer);
|
||||
if (!nrb)
|
||||
return NULL;
|
||||
|
||||
_mesa_init_renderbuffer(&nrb->mesa, 0);
|
||||
|
||||
if (!nouveau_renderbuffer_pixelformat(nrb, internalFormat)) {
|
||||
fprintf(stderr, "%s: unknown internalFormat\n", __func__);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
nrb->mesa.AllocStorage = nouveau_renderbuffer_storage;
|
||||
nrb->mesa.Delete = nouveau_renderbuffer_delete;
|
||||
|
||||
return nrb;
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_cliprects_renderbuffer_set(nouveauContextPtr nmesa,
|
||||
nouveau_renderbuffer_t * nrb)
|
||||
{
|
||||
nmesa->numClipRects = 1;
|
||||
nmesa->pClipRects = &nmesa->osClipRect;
|
||||
nmesa->osClipRect.x1 = 0;
|
||||
nmesa->osClipRect.y1 = 0;
|
||||
nmesa->osClipRect.x2 = nrb->mesa.Width;
|
||||
nmesa->osClipRect.y2 = nrb->mesa.Height;
|
||||
nmesa->drawX = 0;
|
||||
nmesa->drawY = 0;
|
||||
nmesa->drawW = nrb->mesa.Width;
|
||||
nmesa->drawH = nrb->mesa.Height;
|
||||
}
|
||||
|
||||
void
|
||||
nouveau_window_moved(GLcontext * ctx)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
nouveau_renderbuffer_t *nrb;
|
||||
|
||||
nrb = (nouveau_renderbuffer_t *) ctx->DrawBuffer->_ColorDrawBuffers[0];
|
||||
if (!nrb)
|
||||
return;
|
||||
|
||||
nouveau_cliprects_renderbuffer_set(nmesa, nrb);
|
||||
|
||||
/* Viewport depends on window size/position, nouveauCalcViewport
|
||||
* will take care of calling the hw-specific WindowMoved
|
||||
*/
|
||||
ctx->Driver.Viewport(ctx, ctx->Viewport.X, ctx->Viewport.Y,
|
||||
ctx->Viewport.Width, ctx->Viewport.Height);
|
||||
/* Scissor depends on window position */
|
||||
ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
|
||||
ctx->Scissor.Width, ctx->Scissor.Height);
|
||||
}
|
||||
|
||||
GLboolean
|
||||
nouveau_build_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
nouveau_renderbuffer_t *color[MAX_DRAW_BUFFERS];
|
||||
nouveau_renderbuffer_t *depth;
|
||||
|
||||
_mesa_update_framebuffer(ctx);
|
||||
_mesa_update_draw_buffer_bounds(ctx);
|
||||
|
||||
color[0] = (nouveau_renderbuffer_t *) fb->_ColorDrawBuffers[0];
|
||||
if (fb->_DepthBuffer && fb->_DepthBuffer->Wrapped)
|
||||
depth = (nouveau_renderbuffer_t *) fb->_DepthBuffer->Wrapped;
|
||||
else
|
||||
depth = (nouveau_renderbuffer_t *) fb->_DepthBuffer;
|
||||
|
||||
if (!nmesa->hw_func.BindBuffers(nmesa, 1, color, depth))
|
||||
return GL_FALSE;
|
||||
nouveau_window_moved(ctx);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
nouveauDrawBuffer(GLcontext *ctx, GLenum buffer)
|
||||
{
|
||||
nouveau_build_framebuffer(ctx, ctx->DrawBuffer);
|
||||
}
|
||||
|
||||
static struct gl_framebuffer *
|
||||
nouveauNewFramebuffer(GLcontext *ctx, GLuint name)
|
||||
{
|
||||
return _mesa_new_framebuffer(ctx, name);
|
||||
}
|
||||
|
||||
static struct gl_renderbuffer *
|
||||
nouveauNewRenderbuffer(GLcontext *ctx, GLuint name)
|
||||
{
|
||||
nouveau_renderbuffer_t *nrb;
|
||||
|
||||
nrb = CALLOC_STRUCT(nouveau_renderbuffer);
|
||||
if (!nrb)
|
||||
return NULL;
|
||||
|
||||
_mesa_init_renderbuffer(&nrb->mesa, name);
|
||||
|
||||
nrb->mesa.AllocStorage = nouveau_renderbuffer_storage;
|
||||
nrb->mesa.Delete = nouveau_renderbuffer_delete;
|
||||
return &nrb->mesa;
|
||||
}
|
||||
|
||||
static void
|
||||
nouveauBindFramebuffer(GLcontext *ctx, GLenum target,
|
||||
struct gl_framebuffer *fb,
|
||||
struct gl_framebuffer *fbread)
|
||||
{
|
||||
if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) {
|
||||
nouveau_build_framebuffer(ctx, fb);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nouveauFramebufferRenderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
|
||||
GLenum attachment, struct gl_renderbuffer *rb)
|
||||
{
|
||||
_mesa_framebuffer_renderbuffer(ctx, fb, attachment, rb);
|
||||
nouveau_build_framebuffer(ctx, fb);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveauRenderTexture(GLcontext * ctx, struct gl_framebuffer *fb,
|
||||
struct gl_renderbuffer_attachment *att)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nouveauFinishRenderTexture(GLcontext * ctx,
|
||||
struct gl_renderbuffer_attachment *att)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nouveauInitBufferFuncs(struct dd_function_table *func)
|
||||
{
|
||||
func->DrawBuffer = nouveauDrawBuffer;
|
||||
|
||||
func->NewFramebuffer = nouveauNewFramebuffer;
|
||||
func->NewRenderbuffer = nouveauNewRenderbuffer;
|
||||
func->BindFramebuffer = nouveauBindFramebuffer;
|
||||
func->FramebufferRenderbuffer = nouveauFramebufferRenderbuffer;
|
||||
func->RenderTexture = nouveauRenderTexture;
|
||||
func->FinishRenderTexture = nouveauFinishRenderTexture;
|
||||
}
|
||||
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
#ifndef __NOUVEAU_BUFFERS_H__
|
||||
#define __NOUVEAU_BUFFERS_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mtypes.h"
|
||||
#include "utils.h"
|
||||
#include "renderbuffer.h"
|
||||
|
||||
#include "nouveau_mem.h"
|
||||
|
||||
typedef struct nouveau_renderbuffer {
|
||||
struct gl_renderbuffer mesa; /* must be first! */
|
||||
|
||||
nouveau_mem *mem;
|
||||
void *map;
|
||||
|
||||
int cpp;
|
||||
uint32_t offset;
|
||||
uint32_t pitch;
|
||||
} nouveau_renderbuffer_t;
|
||||
|
||||
extern nouveau_renderbuffer_t *nouveau_renderbuffer_new(GLenum internalFormat);
|
||||
extern void nouveau_window_moved(GLcontext *);
|
||||
extern GLboolean nouveau_build_framebuffer(GLcontext *,
|
||||
struct gl_framebuffer *);
|
||||
extern nouveau_renderbuffer_t *nouveau_current_draw_buffer(GLcontext *);
|
||||
|
||||
extern void nouveauInitBufferFuncs(struct dd_function_table *);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,153 +0,0 @@
|
|||
/**************************************************************************
|
||||
|
||||
Copyright 2006 Stephane Marchesin
|
||||
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
|
||||
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
|
||||
ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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 "vblank.h"
|
||||
#include <errno.h>
|
||||
#include "mtypes.h"
|
||||
#include "macros.h"
|
||||
#include "dd.h"
|
||||
#include "swrast/swrast.h"
|
||||
#include "nouveau_context.h"
|
||||
#include "nouveau_msg.h"
|
||||
#include "nouveau_fifo.h"
|
||||
#include "nouveau_lock.h"
|
||||
#include "nouveau_object.h"
|
||||
#include "nouveau_sync.h"
|
||||
|
||||
#ifdef NOUVEAU_RING_DEBUG
|
||||
int nouveau_fifo_remaining=0;
|
||||
#endif
|
||||
|
||||
|
||||
#define RING_SKIPS 8
|
||||
|
||||
void WAIT_RING(nouveauContextPtr nmesa,u_int32_t size)
|
||||
{
|
||||
#ifdef NOUVEAU_RING_DEBUG
|
||||
return;
|
||||
#endif
|
||||
u_int32_t fifo_get;
|
||||
while(nmesa->fifo.free < size+1) {
|
||||
fifo_get = NV_FIFO_READ_GET();
|
||||
|
||||
if(nmesa->fifo.put >= fifo_get) {
|
||||
nmesa->fifo.free = nmesa->fifo.max - nmesa->fifo.current;
|
||||
if(nmesa->fifo.free < size+1) {
|
||||
OUT_RING(NV03_FIFO_CMD_JUMP |
|
||||
nmesa->fifo.drm.put_base);
|
||||
if(fifo_get <= RING_SKIPS) {
|
||||
if(nmesa->fifo.put <= RING_SKIPS) /* corner case - will be idle */
|
||||
NV_FIFO_WRITE_PUT(RING_SKIPS + 1);
|
||||
do { fifo_get = NV_FIFO_READ_GET(); }
|
||||
while(fifo_get <= RING_SKIPS);
|
||||
}
|
||||
NV_FIFO_WRITE_PUT(RING_SKIPS);
|
||||
nmesa->fifo.current = nmesa->fifo.put = RING_SKIPS;
|
||||
nmesa->fifo.free = fifo_get - (RING_SKIPS + 1);
|
||||
}
|
||||
} else
|
||||
nmesa->fifo.free = fifo_get - nmesa->fifo.current - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for the channel to be idle
|
||||
*/
|
||||
void nouveauWaitForIdleLocked(nouveauContextPtr nmesa)
|
||||
{
|
||||
/* Wait for FIFO idle */
|
||||
FIRE_RING();
|
||||
while(RING_AHEAD()>0);
|
||||
|
||||
/* Wait on notifier to indicate all commands in the channel have
|
||||
* been completed.
|
||||
*/
|
||||
nouveau_notifier_wait_nop(nmesa->glCtx, nmesa->syncNotifier, NvSub3D);
|
||||
}
|
||||
|
||||
void nouveauWaitForIdle(nouveauContextPtr nmesa)
|
||||
{
|
||||
LOCK_HARDWARE(nmesa);
|
||||
nouveauWaitForIdleLocked(nmesa);
|
||||
UNLOCK_HARDWARE(nmesa);
|
||||
}
|
||||
|
||||
// here we call the fifo initialization ioctl and fill in stuff accordingly
|
||||
GLboolean nouveauFifoInit(nouveauContextPtr nmesa)
|
||||
{
|
||||
int i, ret;
|
||||
|
||||
#ifdef NOUVEAU_RING_DEBUG
|
||||
return GL_TRUE;
|
||||
#endif
|
||||
|
||||
nmesa->fifo.drm.fb_ctxdma_handle = NvDmaFB;
|
||||
nmesa->fifo.drm.tt_ctxdma_handle = NvDmaTT;
|
||||
ret = drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_CHANNEL_ALLOC,
|
||||
&nmesa->fifo.drm, sizeof(nmesa->fifo.drm));
|
||||
if (ret) {
|
||||
FATAL("Fifo initialization ioctl failed (returned %d)\n", ret);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
ret = drmMap(nmesa->driFd, nmesa->fifo.drm.cmdbuf,
|
||||
nmesa->fifo.drm.cmdbuf_size, &nmesa->fifo.pushbuf);
|
||||
if (ret) {
|
||||
FATAL("Unable to map the fifo (returned %d)\n", ret);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
ret = drmMap(nmesa->driFd, nmesa->fifo.drm.ctrl,
|
||||
nmesa->fifo.drm.ctrl_size, &nmesa->fifo.mmio);
|
||||
if (ret) {
|
||||
FATAL("Unable to map the control regs (returned %d)\n", ret);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
ret = drmMap(nmesa->driFd, nmesa->fifo.drm.notifier,
|
||||
nmesa->fifo.drm.notifier_size,
|
||||
&nmesa->fifo.notifier_block);
|
||||
if (ret) {
|
||||
FATAL("Unable to map the notifier block (returned %d)\n", ret);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Setup our initial FIFO tracking params */
|
||||
nmesa->fifo.current = 0;
|
||||
nmesa->fifo.put = 0;
|
||||
nmesa->fifo.max = (nmesa->fifo.drm.cmdbuf_size >> 2) - 1;
|
||||
nmesa->fifo.free = nmesa->fifo.max - nmesa->fifo.current;
|
||||
|
||||
for (i=0; i<RING_SKIPS; i++)
|
||||
OUT_RING(0);
|
||||
nmesa->fifo.free -= RING_SKIPS;
|
||||
|
||||
MESSAGE("Fifo init ok. Using context %d\n", nmesa->fifo.drm.channel);
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,222 +0,0 @@
|
|||
/**************************************************************************
|
||||
|
||||
Copyright 2006 Stephane Marchesin
|
||||
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
|
||||
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
|
||||
ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef __NOUVEAU_FIFO_H__
|
||||
#define __NOUVEAU_FIFO_H__
|
||||
|
||||
#include "nouveau_context.h"
|
||||
#include "nouveau_ctrlreg.h"
|
||||
#include "nouveau_state_cache.h"
|
||||
|
||||
//#define NOUVEAU_RING_TRACE
|
||||
//#define NOUVEAU_RING_DEBUG
|
||||
//#define NOUVEAU_STATE_CACHE_DISABLE
|
||||
|
||||
#ifndef NOUVEAU_RING_TRACE
|
||||
#define NOUVEAU_RING_TRACE 0
|
||||
#else
|
||||
#undef NOUVEAU_RING_TRACE
|
||||
#define NOUVEAU_RING_TRACE 1
|
||||
#endif
|
||||
|
||||
#define NV_READ(reg) *(volatile u_int32_t *)(nmesa->mmio + (reg))
|
||||
|
||||
#define NV_FIFO_READ(reg) *(volatile u_int32_t *)(nmesa->fifo.mmio + (reg/4))
|
||||
#define NV_FIFO_WRITE(reg,value) *(volatile u_int32_t *)(nmesa->fifo.mmio + (reg/4)) = value;
|
||||
#define NV_FIFO_READ_GET() ((NV_FIFO_READ(NV03_FIFO_REGS_DMAGET) - nmesa->fifo.drm.put_base) >> 2)
|
||||
#define NV_FIFO_WRITE_PUT(val) do { \
|
||||
if (NOUVEAU_RING_TRACE) {\
|
||||
printf("FIRE_RING : 0x%08x\n", nmesa->fifo.current << 2); \
|
||||
fflush(stdout); \
|
||||
sleep(1); \
|
||||
} \
|
||||
NV_FIFO_WRITE(NV03_FIFO_REGS_DMAPUT, ((val)<<2) + nmesa->fifo.drm.put_base); \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* Ring/fifo interface
|
||||
*
|
||||
* - Begin a ring section with BEGIN_RING_SIZE (if you know the full size in advance)
|
||||
* - Output stuff to the ring with either OUT_RINGp (outputs a raw mem chunk), OUT_RING (1 uint32_t) or OUT_RINGf (1 float)
|
||||
* - RING_AVAILABLE returns the available fifo (in uint32_ts)
|
||||
* - RING_AHEAD returns how much ahead of the last submission point we are
|
||||
* - FIRE_RING fires whatever we have that wasn't fired before
|
||||
* - WAIT_RING waits for size (in uint32_ts) to be available in the fifo
|
||||
*/
|
||||
|
||||
/* Enable for ring debugging. Prints out writes to the ring buffer
|
||||
* but does not actually write to it.
|
||||
*/
|
||||
#ifdef NOUVEAU_RING_DEBUG
|
||||
|
||||
extern int nouveau_fifo_remaining;
|
||||
|
||||
#define OUT_RINGp(ptr,sz) do { \
|
||||
uint32_t* p=(uint32_t*)(ptr); \
|
||||
int i; printf("OUT_RINGp: (size 0x%x dwords)\n",sz); for(i=0;i<sz;i++) printf(" 0x%08x %f\n", *(p+i), *((float*)(p+i))); \
|
||||
nouveau_fifo_remaining-=sz; \
|
||||
}while(0)
|
||||
|
||||
#define OUT_RING(n) do { \
|
||||
printf("OUT_RINGn: 0x%08x (%s)\n", n, __func__); \
|
||||
nouveau_fifo_remaining--; \
|
||||
}while(0)
|
||||
|
||||
#define OUT_RINGf(n) do { \
|
||||
printf("OUT_RINGf: %.04f (%s)\n", n, __func__); \
|
||||
nouveau_fifo_remaining--; \
|
||||
}while(0)
|
||||
|
||||
#define BEGIN_RING_SIZE(subchannel,tag,size) do { \
|
||||
if (nouveau_fifo_remaining!=0) \
|
||||
printf("RING ERROR : remaining %d\n",nouveau_fifo_remaining); \
|
||||
nouveau_state_cache_flush(nmesa); \
|
||||
if (nmesa->fifo.free <= (size)) \
|
||||
WAIT_RING(nmesa,(size)); \
|
||||
OUT_RING( ((size)<<18) | ((subchannel) << 13) | (tag)); \
|
||||
nmesa->fifo.free -= ((size) + 1); \
|
||||
nouveau_fifo_remaining=size; \
|
||||
}while(0)
|
||||
|
||||
#else
|
||||
|
||||
#define OUT_RINGp(ptr,sz) do{ \
|
||||
if (NOUVEAU_RING_TRACE) { \
|
||||
uint32_t* p=(uint32_t*)(ptr); \
|
||||
int i; printf("OUT_RINGp: (size 0x%x dwords) (%s)\n",sz, __func__); for(i=0;i<sz;i++) printf(" [0x%08x] 0x%08x %f\n", (nmesa->fifo.current+i) << 2, *(p+i), *((float*)(p+i))); \
|
||||
} \
|
||||
memcpy(nmesa->fifo.pushbuf+nmesa->fifo.current,ptr,(sz)*4); \
|
||||
nmesa->fifo.current+=(sz); \
|
||||
}while(0)
|
||||
|
||||
#define OUT_RING(n) do { \
|
||||
if (NOUVEAU_RING_TRACE) \
|
||||
printf("OUT_RINGn: [0x%08x] 0x%08x (%s)\n", nmesa->fifo.current << 2, n, __func__); \
|
||||
nmesa->fifo.pushbuf[nmesa->fifo.current++]=(n); \
|
||||
}while(0)
|
||||
|
||||
#define OUT_RINGf(n) do { \
|
||||
if (NOUVEAU_RING_TRACE) \
|
||||
printf("OUT_RINGf: [0x%08x] %.04f (%s)\n", nmesa->fifo.current << 2, n, __func__); \
|
||||
*((float*)(nmesa->fifo.pushbuf+nmesa->fifo.current++))=(n); \
|
||||
}while(0)
|
||||
|
||||
#define BEGIN_RING_SIZE(subchannel,tag,size) do { \
|
||||
nouveau_state_cache_flush(nmesa); \
|
||||
if (nmesa->fifo.free <= (size)) \
|
||||
WAIT_RING(nmesa,(size)); \
|
||||
OUT_RING( ((size)<<18) | ((subchannel) << 13) | (tag)); \
|
||||
nmesa->fifo.free -= ((size) + 1); \
|
||||
}while(0)
|
||||
|
||||
#endif
|
||||
|
||||
extern void WAIT_RING(nouveauContextPtr nmesa,u_int32_t size);
|
||||
extern void nouveau_state_cache_flush(nouveauContextPtr nmesa);
|
||||
extern void nouveau_state_cache_init(nouveauContextPtr nmesa);
|
||||
|
||||
#ifdef NOUVEAU_STATE_CACHE_DISABLE
|
||||
#define BEGIN_RING_CACHE(subc,tag,size) BEGIN_RING_SIZE((subc), (tag), (size))
|
||||
#define OUT_RING_CACHE(n) OUT_RING((n))
|
||||
#define OUT_RING_CACHEf(n) OUT_RINGf((n))
|
||||
#define OUT_RING_CACHEp(ptr, sz) OUT_RINGp((ptr), (sz))
|
||||
#define OUT_RING_CACHE_FORCE(n) OUT_RING((n))
|
||||
#define OUT_RING_CACHE_FORCEf(n) OUT_RINGf((n))
|
||||
#define OUT_RING_CACHE_FORCEp(ptr, sz) OUT_RINGp((ptr), (sz))
|
||||
#else
|
||||
#define BEGIN_RING_CACHE(subchannel,tag,size) do { \
|
||||
nmesa->state_cache.dirty=1; \
|
||||
nmesa->state_cache.current_pos=((tag)/4); \
|
||||
assert(nmesa->state_cache.current_pos + size <= NOUVEAU_STATE_CACHE_ENTRIES); \
|
||||
}while(0)
|
||||
|
||||
#define OUT_RING_CACHE(n) do { \
|
||||
if (nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value!=(n)) { \
|
||||
nmesa->state_cache.atoms[nmesa->state_cache.current_pos].dirty=1; \
|
||||
nmesa->state_cache.hdirty[nmesa->state_cache.current_pos/NOUVEAU_STATE_CACHE_HIER_SIZE]=1; \
|
||||
nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value=(n); \
|
||||
} \
|
||||
nmesa->state_cache.current_pos++; \
|
||||
}while(0)
|
||||
|
||||
#define OUT_RING_CACHEf(n) do { \
|
||||
if ((*(GLfloat*)(&nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value))!=(n)){ \
|
||||
nmesa->state_cache.atoms[nmesa->state_cache.current_pos].dirty=1; \
|
||||
nmesa->state_cache.hdirty[nmesa->state_cache.current_pos/NOUVEAU_STATE_CACHE_HIER_SIZE]=1; \
|
||||
(*(GLfloat*)(&nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value))=(n);\
|
||||
} \
|
||||
nmesa->state_cache.current_pos++; \
|
||||
}while(0)
|
||||
|
||||
#define OUT_RING_CACHEp(ptr,sz) do { \
|
||||
GLuint* p=(GLuint*)(ptr); \
|
||||
int i; \
|
||||
for(i=0;i<sz;i++) \
|
||||
OUT_RING_CACHE(*(p+i)); \
|
||||
}while(0)
|
||||
|
||||
#define OUT_RING_CACHE_FORCE(n) do { \
|
||||
nmesa->state_cache.atoms[nmesa->state_cache.current_pos].dirty=1; \
|
||||
nmesa->state_cache.hdirty[nmesa->state_cache.current_pos/NOUVEAU_STATE_CACHE_HIER_SIZE]=1; \
|
||||
nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value=(n); \
|
||||
nmesa->state_cache.current_pos++; \
|
||||
}while(0)
|
||||
|
||||
#define OUT_RING_CACHE_FORCEf(n) do { \
|
||||
nmesa->state_cache.atoms[nmesa->state_cache.current_pos].dirty=1; \
|
||||
nmesa->state_cache.hdirty[nmesa->state_cache.current_pos/NOUVEAU_STATE_CACHE_HIER_SIZE]=1; \
|
||||
(*(GLfloat*)(&nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value))=(n);\
|
||||
nmesa->state_cache.current_pos++; \
|
||||
}while(0)
|
||||
|
||||
#define OUT_RING_CACHE_FORCEp(ptr,sz) do { \
|
||||
GLuint* p=(GLuint*)(ptr); \
|
||||
int i; \
|
||||
for(i=0;i<sz;i++) \
|
||||
OUT_RING_CACHE_FORCE(*(p+i)); \
|
||||
}while(0)
|
||||
#endif
|
||||
|
||||
#define RING_AVAILABLE() (nmesa->fifo.free-1)
|
||||
|
||||
#define RING_AHEAD() ((nmesa->fifo.put<=nmesa->fifo.current)?(nmesa->fifo.current-nmesa->fifo.put):nmesa->fifo.max-nmesa->fifo.put+nmesa->fifo.current)
|
||||
|
||||
#define FIRE_RING() do { \
|
||||
if (nmesa->fifo.current!=nmesa->fifo.put) { \
|
||||
nmesa->fifo.put=nmesa->fifo.current; \
|
||||
NV_FIFO_WRITE_PUT(nmesa->fifo.put); \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
extern void nouveauWaitForIdle(nouveauContextPtr nmesa);
|
||||
extern void nouveauWaitForIdleLocked(nouveauContextPtr nmesa);
|
||||
extern GLboolean nouveauFifoInit(nouveauContextPtr nmesa);
|
||||
|
||||
#endif /* __NOUVEAU_FIFO_H__ */
|
||||
|
||||
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
/**************************************************************************
|
||||
|
||||
Copyright 2006 Stephane Marchesin
|
||||
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
|
||||
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
|
||||
ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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 "nouveau_context.h"
|
||||
#include "nouveau_lock.h"
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
#include "framebuffer.h"
|
||||
|
||||
|
||||
/* Update the hardware state. This is called if another context has
|
||||
* grabbed the hardware lock, which includes the X server. This
|
||||
* function also updates the driver's window state after the X server
|
||||
* moves, resizes or restacks a window -- the change will be reflected
|
||||
* in the drawable position and clip rects. Since the X server grabs
|
||||
* the hardware lock when it changes the window state, this routine will
|
||||
* automatically be called after such a change.
|
||||
*/
|
||||
void nouveauGetLock( nouveauContextPtr nmesa, GLuint flags )
|
||||
{
|
||||
__DRIdrawablePrivate *dPriv = nmesa->driDrawable;
|
||||
__DRIscreenPrivate *sPriv = nmesa->driScreen;
|
||||
struct drm_nouveau_sarea *sarea = nmesa->sarea;
|
||||
|
||||
drmGetLock( nmesa->driFd, nmesa->hHWContext, flags );
|
||||
|
||||
/* The window might have moved, so we might need to get new clip
|
||||
* rects.
|
||||
*
|
||||
* NOTE: This releases and regrabs the hw lock to allow the X server
|
||||
* to respond to the DRI protocol request for new drawable info.
|
||||
* Since the hardware state depends on having the latest drawable
|
||||
* clip rects, all state checking must be done _after_ this call.
|
||||
*/
|
||||
DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
|
||||
|
||||
/* If timestamps don't match, the window has been changed */
|
||||
if (nmesa->lastStamp != dPriv->lastStamp) {
|
||||
struct gl_framebuffer *fb = (struct gl_framebuffer *)dPriv->driverPrivate;
|
||||
|
||||
/* _mesa_resize_framebuffer will take care of calling the renderbuffer's
|
||||
* AllocStorage function if we need more memory to hold it */
|
||||
if (fb->Width != dPriv->w || fb->Height != dPriv->h) {
|
||||
_mesa_resize_framebuffer(nmesa->glCtx, fb, dPriv->w, dPriv->h);
|
||||
/* resize buffers, will call nouveau_window_moved */
|
||||
nouveau_build_framebuffer(nmesa->glCtx, fb);
|
||||
} else {
|
||||
nouveau_window_moved(nmesa->glCtx);
|
||||
}
|
||||
|
||||
nmesa->lastStamp = dPriv->lastStamp;
|
||||
}
|
||||
|
||||
nmesa->numClipRects = dPriv->numClipRects;
|
||||
nmesa->pClipRects = dPriv->pClipRects;
|
||||
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/**************************************************************************
|
||||
|
||||
Copyright 2006 Stephane Marchesin
|
||||
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
|
||||
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
|
||||
ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#ifndef __NOUVEAU_LOCK_H__
|
||||
#define __NOUVEAU_LOCK_H__
|
||||
|
||||
#include "nouveau_context.h"
|
||||
|
||||
extern void nouveauGetLock( nouveauContextPtr nmesa, GLuint flags );
|
||||
|
||||
/*
|
||||
* !!! We may want to separate locks from locks with validation. This
|
||||
* could be used to improve performance for those things commands that
|
||||
* do not do any drawing !!!
|
||||
*/
|
||||
|
||||
/* Lock the hardware and validate our state.
|
||||
*/
|
||||
#define LOCK_HARDWARE( nmesa ) \
|
||||
do { \
|
||||
char __ret = 0; \
|
||||
DEBUG_CHECK_LOCK(); \
|
||||
DRM_CAS( nmesa->driHwLock, nmesa->hHWContext, \
|
||||
(DRM_LOCK_HELD | nmesa->hHWContext), __ret ); \
|
||||
if ( __ret ) \
|
||||
nouveauGetLock( nmesa, 0 ); \
|
||||
DEBUG_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
/* Unlock the hardware.
|
||||
*/
|
||||
#define UNLOCK_HARDWARE( nmesa ) \
|
||||
do { \
|
||||
DRM_UNLOCK( nmesa->driFd, \
|
||||
nmesa->driHwLock, \
|
||||
nmesa->hHWContext ); \
|
||||
DEBUG_RESET(); \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_LOCK()
|
||||
#define DEBUG_RESET()
|
||||
#define DEBUG_CHECK_LOCK()
|
||||
|
||||
|
||||
#endif /* __NOUVEAU_LOCK_H__ */
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
#include "mtypes.h"
|
||||
|
||||
#include "nouveau_context.h"
|
||||
#include "nouveau_fifo.h"
|
||||
#include "nouveau_mem.h"
|
||||
#include "nouveau_msg.h"
|
||||
#include "nouveau_object.h"
|
||||
#include "nouveau_reg.h"
|
||||
|
||||
#define MAX_MEMFMT_LENGTH 32768
|
||||
|
||||
/* Unstrided blit using NV_MEMORY_TO_MEMORY_FORMAT */
|
||||
GLboolean
|
||||
nouveau_memformat_flat_emit(GLcontext * ctx,
|
||||
nouveau_mem * dst, nouveau_mem * src,
|
||||
GLuint dst_offset, GLuint src_offset,
|
||||
GLuint size)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
uint32_t src_handle, dst_handle;
|
||||
GLuint count;
|
||||
|
||||
if (src_offset + size > src->size) {
|
||||
MESSAGE("src out of nouveau_mem bounds\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
if (dst_offset + size > dst->size) {
|
||||
MESSAGE("dst out of nouveau_mem bounds\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
src_handle = (src->type & NOUVEAU_MEM_FB) ? NvDmaFB : NvDmaTT;
|
||||
dst_handle = (dst->type & NOUVEAU_MEM_FB) ? NvDmaFB : NvDmaTT;
|
||||
src_offset += nouveau_mem_gpu_offset_get(ctx, src);
|
||||
dst_offset += nouveau_mem_gpu_offset_get(ctx, dst);
|
||||
|
||||
BEGIN_RING_SIZE(NvSubMemFormat,
|
||||
NV_MEMORY_TO_MEMORY_FORMAT_OBJECT_IN, 2);
|
||||
OUT_RING(src_handle);
|
||||
OUT_RING(dst_handle);
|
||||
|
||||
count = (size / MAX_MEMFMT_LENGTH) +
|
||||
((size % MAX_MEMFMT_LENGTH) ? 1 : 0);
|
||||
|
||||
while (count--) {
|
||||
GLuint length =
|
||||
(size > MAX_MEMFMT_LENGTH) ? MAX_MEMFMT_LENGTH : size;
|
||||
|
||||
BEGIN_RING_SIZE(NvSubMemFormat,
|
||||
NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8);
|
||||
OUT_RING(src_offset);
|
||||
OUT_RING(dst_offset);
|
||||
OUT_RING(0); /* pitch in */
|
||||
OUT_RING(0); /* pitch out */
|
||||
OUT_RING(length); /* line length */
|
||||
OUT_RING(1); /* number of lines */
|
||||
OUT_RING((1 << 8) /* dst_inc */ |(1 << 0) /* src_inc */ );
|
||||
OUT_RING(0); /* buffer notify? */
|
||||
FIRE_RING();
|
||||
|
||||
src_offset += length;
|
||||
dst_offset += length;
|
||||
size -= length;
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
void nouveau_mem_free(GLcontext * ctx, nouveau_mem * mem)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
struct drm_nouveau_mem_free memf;
|
||||
|
||||
if (NOUVEAU_DEBUG & DEBUG_MEM) {
|
||||
fprintf(stderr, "%s: type=0x%x, offset=0x%x, size=0x%x\n",
|
||||
__func__, mem->type, (GLuint) mem->offset,
|
||||
(GLuint) mem->size);
|
||||
}
|
||||
|
||||
if (mem->map)
|
||||
drmUnmap(mem->map, mem->size);
|
||||
memf.flags = mem->type;
|
||||
memf.offset = mem->offset;
|
||||
drmCommandWrite(nmesa->driFd, DRM_NOUVEAU_MEM_FREE, &memf,
|
||||
sizeof(memf));
|
||||
FREE(mem);
|
||||
}
|
||||
|
||||
nouveau_mem *nouveau_mem_alloc(GLcontext *ctx, uint32_t flags, GLuint size,
|
||||
GLuint align)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
struct drm_nouveau_mem_alloc mema;
|
||||
nouveau_mem *mem;
|
||||
int ret;
|
||||
|
||||
if (NOUVEAU_DEBUG & DEBUG_MEM) {
|
||||
fprintf(stderr,
|
||||
"%s: requested: flags=0x%x, size=0x%x, align=0x%x\n",
|
||||
__func__, flags, (GLuint) size, align);
|
||||
}
|
||||
|
||||
mem = CALLOC(sizeof(nouveau_mem));
|
||||
if (!mem)
|
||||
return NULL;
|
||||
|
||||
mema.flags = flags;
|
||||
mema.size = mem->size = size;
|
||||
mema.alignment = align;
|
||||
mem->map = NULL;
|
||||
ret = drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_MEM_ALLOC,
|
||||
&mema, sizeof(mema));
|
||||
if (ret) {
|
||||
FREE(mem);
|
||||
return NULL;
|
||||
}
|
||||
mem->offset = mema.offset;
|
||||
mem->type = mema.flags;
|
||||
|
||||
if (NOUVEAU_DEBUG & DEBUG_MEM) {
|
||||
fprintf(stderr,
|
||||
"%s: actual: type=0x%x, offset=0x%x, size=0x%x\n",
|
||||
__func__, mem->type, (GLuint) mem->offset,
|
||||
(GLuint) mem->size);
|
||||
}
|
||||
|
||||
if (flags & NOUVEAU_MEM_MAPPED)
|
||||
ret = drmMap(nmesa->driFd, mema.map_handle, mem->size,
|
||||
&mem->map);
|
||||
if (ret) {
|
||||
mem->map = NULL;
|
||||
nouveau_mem_free(ctx, mem);
|
||||
mem = NULL;
|
||||
}
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
uint32_t nouveau_mem_gpu_offset_get(GLcontext * ctx, nouveau_mem * mem)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
|
||||
return mem->offset;
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
#ifndef __NOUVEAU_MEM_H__
|
||||
#define __NOUVEAU_MEM_H__
|
||||
|
||||
typedef struct nouveau_mem_t {
|
||||
int type;
|
||||
uint64_t offset;
|
||||
uint64_t size;
|
||||
void *map;
|
||||
} nouveau_mem;
|
||||
|
||||
extern nouveau_mem *nouveau_mem_alloc(GLcontext *, uint32_t flags,
|
||||
GLuint size, GLuint align);
|
||||
extern void nouveau_mem_free(GLcontext *, nouveau_mem *);
|
||||
extern uint32_t nouveau_mem_gpu_offset_get(GLcontext *, nouveau_mem *);
|
||||
|
||||
extern GLboolean nouveau_memformat_flat_emit(GLcontext *,
|
||||
nouveau_mem *dst,
|
||||
nouveau_mem *src,
|
||||
GLuint dst_offset,
|
||||
GLuint src_offset,
|
||||
GLuint size);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
|
||||
Copyright 2006 Stephane Marchesin. All Rights Reserved
|
||||
|
||||
The Weather Channel (TM) funded Tungsten Graphics to develop the
|
||||
initial release of the Radeon 8500 driver under the XFree86 license.
|
||||
This notice must be preserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the
|
||||
next paragraph) shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
* Nicolai Haehnle <prefect_@gmx.net>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __NOUVEAU_MSG_H__
|
||||
#define __NOUVEAU_MSG_H__
|
||||
|
||||
#define WARN_ONCE(a, ...) do {\
|
||||
static int warn##__LINE__=1;\
|
||||
if(warn##__LINE__){\
|
||||
fprintf(stderr, "*********************************WARN_ONCE*********************************\n");\
|
||||
fprintf(stderr, "File %s function %s line %d\n", __FILE__, __FUNCTION__, __LINE__);\
|
||||
fprintf(stderr, a, ## __VA_ARGS__);\
|
||||
fprintf(stderr, "***************************************************************************\n");\
|
||||
warn##__LINE__=0;\
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#define MESSAGE(a, ...) do{\
|
||||
fprintf(stderr, "************************************INFO***********************************\n");\
|
||||
fprintf(stderr, "File %s function %s line %d\n", __FILE__, __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, a, ## __VA_ARGS__);\
|
||||
fprintf(stderr, "***************************************************************************\n");\
|
||||
}while(0)
|
||||
|
||||
#define FATAL(a, ...) do{\
|
||||
fprintf(stderr, "***********************************FATAL***********************************\n");\
|
||||
fprintf(stderr, "File %s function %s line %d\n", __FILE__, __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, a, ## __VA_ARGS__);\
|
||||
fprintf(stderr, "***************************************************************************\n");\
|
||||
}while(0)
|
||||
|
||||
#endif /* __NOUVEAU_MSG_H__ */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue