aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libX11/cpprules.in60
-rw-r--r--libX11/nls/Makefile.am6
-rw-r--r--libxcb/doc/Makefile.am4
-rw-r--r--libxcb/xcb-proto/Makefile.am2
-rw-r--r--mesalib/Makefile2
-rw-r--r--mesalib/configure.ac3
-rw-r--r--mesalib/docs/contents.html1
-rw-r--r--mesalib/docs/news.html10
-rw-r--r--mesalib/docs/relnotes-8.0.html4
-rw-r--r--mesalib/docs/systems.html68
-rw-r--r--mesalib/docs/vmware-guest.html3
-rw-r--r--mesalib/src/glsl/Android.mk1
-rw-r--r--mesalib/src/glsl/loop_unroll.cpp15
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c3
-rw-r--r--mesalib/src/mesa/main/extensions.c3
-rw-r--r--mesalib/src/mesa/main/light.c65
-rw-r--r--mesalib/src/mesa/main/light.h37
-rw-r--r--mesalib/src/mesa/main/mtypes.h6
-rw-r--r--mesalib/src/mesa/main/pixel.c2
-rw-r--r--mesalib/src/mesa/main/pixeltransfer.c26
-rw-r--r--mesalib/src/mesa/main/pixeltransfer.h6
-rw-r--r--mesalib/src/mesa/main/texcompress.c12
-rw-r--r--mesalib/src/mesa/main/texgetimage.c60
-rw-r--r--mesalib/src/mesa/main/teximage.c22
-rw-r--r--mesalib/src/mesa/main/texparam.c24
-rw-r--r--mesalib/src/mesa/main/texstate.c19
-rw-r--r--mesalib/src/mesa/main/version.h2
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom.c410
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c11
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_sampler.c16
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c19
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_blit.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c4
-rw-r--r--mesalib/src/mesa/swrast/s_context.h3
-rw-r--r--mesalib/src/mesa/swrast/s_renderbuffer.c28
-rw-r--r--mesalib/src/mesa/swrast/s_span.c14
-rw-r--r--mesalib/src/mesa/tnl/t_rasterpos.c8
-rw-r--r--mesalib/src/mesa/tnl/t_vb_lighttmp.h1283
-rw-r--r--mesalib/src/mesa/vbo/vbo_save.h8
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_api.c20
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_draw.c24
-rw-r--r--mesalib/src/mesa/x86/gen_matypes.c1
-rw-r--r--mkfontscale/configure.ac2
-rw-r--r--xorg-server/Xi/exevents.c160
-rw-r--r--xorg-server/Xi/xiallowev.c81
-rw-r--r--xorg-server/configure.ac6
-rw-r--r--xorg-server/dix/events.c36
-rw-r--r--xorg-server/dix/inpututils.c3
-rw-r--r--xorg-server/dix/touch.c73
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.c10
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.c20
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86_OSlib.h2
-rw-r--r--xorg-server/hw/xfree86/parser/InputClass.c76
-rw-r--r--xorg-server/hw/xfree86/parser/xf86Parser.h20
-rw-r--r--xorg-server/include/exevents.h7
-rw-r--r--xorg-server/include/input.h7
-rw-r--r--xorg-server/include/inputstr.h5
-rw-r--r--xorg-server/include/list.h114
-rw-r--r--xorg-server/test/input.c12
-rw-r--r--xorg-server/test/list.c132
-rw-r--r--xorg-server/xfixes/cursor.c16
61 files changed, 1589 insertions, 1511 deletions
diff --git a/libX11/cpprules.in b/libX11/cpprules.in
index 723560c1c..e1296c699 100644
--- a/libX11/cpprules.in
+++ b/libX11/cpprules.in
@@ -1,30 +1,30 @@
-# -*- Makefile -*-
-# Rules for generating files using the C pre-processor
-# (Replaces CppFileTarget from Imake)
-
-SED = sed
-
-SUFFIXES += .pre
-
-WCHAR32_FLAGS = -DWCHAR32=@WCHAR32@
-
-CPP_FILES_FLAGS = $(WCHAR32_FLAGS)
-
-# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
-# to cpp, because that trick does not work on all ANSI C preprocessors.
-# Delete line numbers from the cpp output (-P is not portable, I guess).
-# Allow XCOMM to be preceded by whitespace and provide a means of generating
-# output lines with trailing backslashes.
-# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
-
-CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
- -e '/^\#line *[0-9][0-9]* *.*$$/d' \
- -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
- -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
- -e '/^[ ]*XHASH/s/XHASH/\#/' \
- -e 's,X11_LOCALEDATADIR,$(X11_LOCALEDATADIR),g' \
- -e '/\@\@$$/s/\@\@$$/\\/'
-
-.pre:
- @$(MKDIR_P) $(@D)
- $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+SED = LC_CTYPE=C sed
+
+SUFFIXES += .pre
+
+WCHAR32_FLAGS = -DWCHAR32=@WCHAR32@
+
+CPP_FILES_FLAGS = $(WCHAR32_FLAGS)
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e 's,X11_LOCALEDATADIR,$(X11_LOCALEDATADIR),g' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+.pre:
+ @$(MKDIR_P) $(@D)
+ $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
diff --git a/libX11/nls/Makefile.am b/libX11/nls/Makefile.am
index 7dc43088c..0eced4cd8 100644
--- a/libX11/nls/Makefile.am
+++ b/libX11/nls/Makefile.am
@@ -20,19 +20,19 @@ include $(top_srcdir)/cpprules.in
locale.alias: locale.alias.pre
$(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $(srcdir)/locale.alias.pre | $(CPP_SED_MAGIC) > locale.alias.l1
- sed -e '/^[^#][^ ]*:/s/://' -e '/^[^#].*[ ].*:/d' \
+ $(SED) -e '/^[^#][^ ]*:/s/://' -e '/^[^#].*[ ].*:/d' \
< locale.alias.l1 > locale.alias.l2
cat locale.alias.l2 locale.alias.l1 > locale.alias
compose.dir: compose.dir.pre
$(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $(srcdir)/compose.dir.pre | $(CPP_SED_MAGIC) > compose.dir.l1
- sed -e '/^[^#][^ ]*:/s/://' -e '/^[^#].*[ ].*:/d' \
+ $(SED) -e '/^[^#][^ ]*:/s/://' -e '/^[^#].*[ ].*:/d' \
< compose.dir.l1 > compose.dir.l2
cat compose.dir.l2 compose.dir.l1 > compose.dir
locale.dir: locale.dir.pre
$(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $(srcdir)/locale.dir.pre | $(CPP_SED_MAGIC) > locale.dir.l1
- sed -e '/^[^#][^ ]*:/s/://' -e '/^[^#].*[ ].*:/d' \
+ $(SED) -e '/^[^#][^ ]*:/s/://' -e '/^[^#].*[ ].*:/d' \
< locale.dir.l1 > locale.dir.l2
cat locale.dir.l2 locale.dir.l1 > locale.dir
diff --git a/libxcb/doc/Makefile.am b/libxcb/doc/Makefile.am
index 19255197c..dbe2e0b0c 100644
--- a/libxcb/doc/Makefile.am
+++ b/libxcb/doc/Makefile.am
@@ -2,7 +2,9 @@
EXTRA_DIST = \
tutorial/index.html \
tutorial/xcb.css \
-xcb.doxygen.in
+xcb.doxygen.in \
+xkb_internals \
+xkb_issues
docdirs = $(srcdir)/tutorial
diff --git a/libxcb/xcb-proto/Makefile.am b/libxcb/xcb-proto/Makefile.am
index c272c6237..6bc14ada0 100644
--- a/libxcb/xcb-proto/Makefile.am
+++ b/libxcb/xcb-proto/Makefile.am
@@ -3,4 +3,4 @@ SUBDIRS = src xcbgen
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = xcb-proto.pc
-EXTRA_DIST=doc xcb-proto.pc.in
+EXTRA_DIST=doc xcb-proto.pc.in autogen.sh
diff --git a/mesalib/Makefile b/mesalib/Makefile
index 1fa369a96..6120fbe9f 100644
--- a/mesalib/Makefile
+++ b/mesalib/Makefile
@@ -184,7 +184,7 @@ ultrix-gcc:
# Rules for making release tarballs
-PACKAGE_VERSION=8.0-devel
+PACKAGE_VERSION=8.1-devel
PACKAGE_DIR = Mesa-$(PACKAGE_VERSION)
PACKAGE_NAME = MesaLib-$(PACKAGE_VERSION)
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index b2b1ab8f4..846b62300 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -698,6 +698,9 @@ AC_ARG_ENABLE([shared-glapi],
SHARED_GLAPI="0"
if test "x$enable_shared_glapi" = xyes; then
SHARED_GLAPI="1"
+ # libGL will use libglapi for function lookups (IN_DRI_DRIVER means to use
+ # the remap table)
+ DEFINES="$DEFINES -DIN_DRI_DRIVER"
fi
AC_SUBST([SHARED_GLAPI])
diff --git a/mesalib/docs/contents.html b/mesalib/docs/contents.html
index 33c2191ee..6f556eed9 100644
--- a/mesalib/docs/contents.html
+++ b/mesalib/docs/contents.html
@@ -52,7 +52,6 @@ a:visited {
<b>User Topics</b>
<ul>
-<li><a href="shading.html" target="MainFrame">Shading Language</a>
<li><a href="egl.html" target="MainFrame">EGL</a>
<li><a href="opengles.html" target="MainFrame">OpenGL ES</a>
<li><a href="openvg.html" target="MainFrame">OpenVG / Vega</a>
diff --git a/mesalib/docs/news.html b/mesalib/docs/news.html
index d6a2aa8e6..472f98bae 100644
--- a/mesalib/docs/news.html
+++ b/mesalib/docs/news.html
@@ -11,6 +11,16 @@
<H1>News</H1>
+<h2>February 9, 2012</h2>
+
+<p>
+<a href="relnotes-8.0.html">Mesa 8.0</a> is released.
+This is the first version of Mesa to support OpenGL 3.0 and GLSL 1.30
+(with the i965 driver).
+See the release notes for more information about the release.
+</p>
+
+
<h2>November 27, 2011</h2>
<p>
diff --git a/mesalib/docs/relnotes-8.0.html b/mesalib/docs/relnotes-8.0.html
index 4aa175366..4edd8081e 100644
--- a/mesalib/docs/relnotes-8.0.html
+++ b/mesalib/docs/relnotes-8.0.html
@@ -30,7 +30,9 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
-tbd
+3516fea6c28ce4a0fa9759e4894729a1 MesaLib-8.0.tar.gz
+1a5668fe72651a670611164cefc703b2 MesaLib-8.0.tar.bz2
+66f5a01a85530a91472a3acceb556db8 MesaLib-8.0.zip
</pre>
diff --git a/mesalib/docs/systems.html b/mesalib/docs/systems.html
index 035a48962..62a6e0b52 100644
--- a/mesalib/docs/systems.html
+++ b/mesalib/docs/systems.html
@@ -9,34 +9,78 @@
<H1>Supported Systems and Drivers</H1>
<p>
-Mesa was originally designed for Unix/X11 systems and is still best
-supported on those systems. All you need is an ANSI C compiler and the
-X development environment to use Mesa.
+Mesa is primarily developed and used on Linux systems.
+But there's also support for Windows, other flavors of Unix and other
+systems such as Haiku.
+We're actively developing and maintaining several hardware and
+software drivers.
</p>
<p>
-The DRI hardware drivers for the X.org server and XFree86 provide
-hardware accelerated rendering for chips from ATI, Intel, and NVIDIA
-on Linux and FreeBSD.
+The primary API is OpenGL but there's also support for OpenGL ES 1
+and ES 2, OpenVG and the EGL interface.
</p>
<p>
-Drivers for other assorted platforms include:
-the Apple Macintosh and Windows.
+Hardware drivers include:
</p>
+<ul>
+<li>Intel i965, i945, i915.
+ See <a href="http://intellinuxgraphics.org/index.html" target="_parent">
+ Intel's website</a>
+<li>AMD Radeon series
+<li>Some NVIDIA GPus.
+<li>VMware virtual GPU
+</ul>
<p>
-Details about particular drivers follows:
+Software drivers include:
+</p>
+<ul>
+<li><a href="llvmpipe.html">llvmpipe</a> - uses LLVM for x86 JIT code
+ generation and is multi-threaded
+<li>softpipe - a reference Gallium driver
+<li>swrast - the legacy/original Mesa software rasterizer
+</ul>
+
+<p>
+Additional driver information:
</p>
<UL>
<li><a href="http://dri.freedesktop.org/" target="_parent"> DRI hardware
drivers</a> for the X Window System
-<LI><a href="xlibdriver.html">Xlib software driver</a> for the X Window System
+<li><a href="xlibdriver.html">Xlib / swrast driver</a> for the X Window System
and Unix-like operating systems
-<LI>Microsoft Windows <A HREF="README.WIN32">(README.WIN32)</A>
-<LI>DEC VMS <A HREF="README.VMS">(README.VMS)</A>
+<li><a href="README.WIN32">Microsoft Windows</a>
+<li><a href="vmware-guest.html">VMware</a> guest OS driver
</UL>
+
+<h1>
+Deprecated Systems and Drivers
+</h1>
+
+<p>
+In the past there were other drivers for older GPUs and operating
+systems.
+These have been removed from the Mesa source tree and distribution.
+If anyone's interested though, the code can be found in the git repo.
+The list includes:
+</p>
+
+<ul>
+<li>3dfx/glide
+<li>Matrox
+<li>ATI R128
+<li>Savage
+<li>VIA Unichrome
+<li>SIS
+<li>3Dlabs gamma
+<li>DOS
+<li>fbdev
+<li>DEC/VMS
+<ul>
+
</body>
</html>
diff --git a/mesalib/docs/vmware-guest.html b/mesalib/docs/vmware-guest.html
index e19782ce2..4d95c1769 100644
--- a/mesalib/docs/vmware-guest.html
+++ b/mesalib/docs/vmware-guest.html
@@ -10,7 +10,8 @@
<h1>VMware guest GL driver</h1>
<p>
-This page describes how to build, install and use the VMware guest GL driver
+This page describes how to build, install and use the
+<a href="http://www.vmware.com/" target="_parent">VMware</a> guest GL driver
(aka the SVGA or SVGA3D driver) for Linux using the latest source code.
This driver gives a Linux virtual machine access to the host's GPU for
hardware-accelerated 3D.
diff --git a/mesalib/src/glsl/Android.mk b/mesalib/src/glsl/Android.mk
index 754f3cced..cf793d65e 100644
--- a/mesalib/src/glsl/Android.mk
+++ b/mesalib/src/glsl/Android.mk
@@ -39,6 +39,7 @@ LOCAL_SRC_FILES := \
$(LIBGLSL_CXX_FILES)
LOCAL_C_INCLUDES := \
+ external/astl/include \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa
diff --git a/mesalib/src/glsl/loop_unroll.cpp b/mesalib/src/glsl/loop_unroll.cpp
index 5b84e1014..d0bcaa670 100644
--- a/mesalib/src/glsl/loop_unroll.cpp
+++ b/mesalib/src/glsl/loop_unroll.cpp
@@ -56,6 +56,7 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
{
loop_variable_state *const ls = this->state->get(ir);
int iterations;
+ unsigned ir_count;
/* If we've entered a loop that hasn't been analyzed, something really,
* really bad has happened.
@@ -78,6 +79,20 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
if (iterations > (int) max_iterations)
return visit_continue;
+ /* Don't try to unroll nested loops and loops with a huge body.
+ */
+ ir_count = 0;
+ foreach_list(node, &ir->body_instructions) {
+ ++ir_count;
+
+ /* If the loop body gets to huge, do not unroll. */
+ if (5*max_iterations < ir_count*iterations)
+ return visit_continue;
+ /* Do not unroll loops with child loop nodes. */
+ if (((ir_instruction *) node)->as_loop())
+ return visit_continue;
+ }
+
if (ls->num_loop_jumps > 1)
return visit_continue;
else if (ls->num_loop_jumps) {
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index aa5fef873..0cf1028c4 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -3029,7 +3029,8 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
/* sanity check */
status = _mesa_CheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- abort();
+ _mesa_problem(ctx, "Unexpected incomplete framebuffer in "
+ "_mesa_meta_GenerateMipmap()");
break;
}
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index b02a49de4..d945124d2 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -931,9 +931,6 @@ _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index)
size_t n;
const struct extension *i;
- if (index < 0)
- return NULL;
-
base = (GLboolean*) &ctx->Extensions;
n = 0;
for (i = extension_table; i->name != 0; ++i) {
diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c
index bf4bee3d6..a16d0e998 100644
--- a/mesalib/src/mesa/main/light.c
+++ b/mesalib/src/mesa/main/light.c
@@ -154,7 +154,6 @@ _mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *pa
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
light->SpotExponent = params[0];
- _mesa_invalidate_spot_exp_table(light);
break;
case GL_SPOT_CUTOFF:
ASSERT(params[0] == 180.0 || (params[0] >= 0.0 && params[0] <= 90.0));
@@ -624,6 +623,11 @@ _mesa_material_bitmask( struct gl_context *ctx, GLenum face, GLenum pname,
+static void
+invalidate_shine_table( struct gl_context *ctx, GLuint side );
+
+
+
/* Update derived values following a change in ctx->Light.Material
*/
void
@@ -697,11 +701,11 @@ _mesa_update_material( struct gl_context *ctx, GLuint bitmask )
}
if (bitmask & MAT_BIT_FRONT_SHININESS) {
- _mesa_invalidate_shine_table( ctx, 0 );
+ invalidate_shine_table( ctx, 0 );
}
if (bitmask & MAT_BIT_BACK_SHININESS) {
- _mesa_invalidate_shine_table( ctx, 1 );
+ invalidate_shine_table( ctx, 1 );
}
}
@@ -911,52 +915,12 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
-/*
- * Whenever the spotlight exponent for a light changes we must call
- * this function to recompute the exponent lookup table.
- */
-void
-_mesa_invalidate_spot_exp_table( struct gl_light *l )
-{
- l->_SpotExpTable[0][0] = -1;
-}
-
-
-static void
-validate_spot_exp_table( struct gl_light *l )
-{
- GLint i;
- GLdouble exponent = l->SpotExponent;
- GLdouble tmp = 0;
- GLint clamp = 0;
-
- l->_SpotExpTable[0][0] = 0.0;
-
- for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) {
- if (clamp == 0) {
- tmp = pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent);
- if (tmp < FLT_MIN * 100.0) {
- tmp = 0.0;
- clamp = 1;
- }
- }
- l->_SpotExpTable[i][0] = (GLfloat) tmp;
- }
- for (i = 0; i < EXP_TABLE_SIZE - 1; i++) {
- l->_SpotExpTable[i][1] = (l->_SpotExpTable[i+1][0] -
- l->_SpotExpTable[i][0]);
- }
- l->_SpotExpTable[EXP_TABLE_SIZE-1][1] = 0.0;
-}
-
-
-
/* Calculate a new shine table. Doing this here saves a branch in
* lighting, and the cost of doing it early may be partially offset
* by keeping a MRU cache of shine tables for various shine values.
*/
-void
-_mesa_invalidate_shine_table( struct gl_context *ctx, GLuint side )
+static void
+invalidate_shine_table( struct gl_context *ctx, GLuint side )
{
ASSERT(side < 2);
if (ctx->_ShineTable[side])
@@ -1020,7 +984,6 @@ validate_shine_table( struct gl_context *ctx, GLuint side, GLfloat shininess )
void
_mesa_validate_all_lighting_tables( struct gl_context *ctx )
{
- GLuint i;
GLfloat shininess;
shininess = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS][0];
@@ -1030,10 +993,6 @@ _mesa_validate_all_lighting_tables( struct gl_context *ctx )
shininess = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_SHININESS][0];
if (!ctx->_ShineTable[1] || ctx->_ShineTable[1]->shininess != shininess)
validate_shine_table( ctx, 1, shininess );
-
- for (i = 0; i < ctx->Const.MaxLights; i++)
- if (ctx->Light.Light[i]._SpotExpTable[0][0] == -1)
- validate_spot_exp_table( &ctx->Light.Light[i] );
}
@@ -1180,11 +1139,8 @@ compute_light_positions( struct gl_context *ctx )
light->_NormSpotDirection);
if (PV_dot_dir > light->_CosCutoff) {
- double x = PV_dot_dir * (EXP_TABLE_SIZE-1);
- int k = (int) x;
light->_VP_inf_spot_attenuation =
- (GLfloat) (light->_SpotExpTable[k][0] +
- (x-k)*light->_SpotExpTable[k][1]);
+ powf(PV_dot_dir, light->SpotExponent);
}
else {
light->_VP_inf_spot_attenuation = 0;
@@ -1303,7 +1259,6 @@ init_light( struct gl_light *l, GLuint n )
ASSIGN_4V( l->EyePosition, 0.0, 0.0, 1.0, 0.0 );
ASSIGN_3V( l->SpotDirection, 0.0, 0.0, -1.0 );
l->SpotExponent = 0.0;
- _mesa_invalidate_spot_exp_table( l );
l->SpotCutoff = 180.0;
l->_CosCutoffNeg = -1.0f;
l->_CosCutoff = 0.0; /* KW: -ve values not admitted */
diff --git a/mesalib/src/mesa/main/light.h b/mesalib/src/mesa/main/light.h
index 9b66c7ed8..996698793 100644
--- a/mesalib/src/mesa/main/light.h
+++ b/mesalib/src/mesa/main/light.h
@@ -87,22 +87,24 @@ extern void
_mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *params);
-/* Lerp between adjacent values in the f(x) lookup table, giving a
- * continuous function, with adequeate overall accuracy. (Though
- * still pretty good compared to a straight lookup).
- * Result should be a GLfloat.
+/*
+ * Compute dp ^ SpecularExponent.
+ * Lerp between adjacent values in the f(x) lookup table, giving a
+ * continuous function, with adequate overall accuracy. (Though still
+ * pretty good compared to a straight lookup).
*/
-#define GET_SHINE_TAB_ENTRY( table, dp, result ) \
-do { \
- struct gl_shine_tab *_tab = table; \
- float f = (dp * (SHINE_TABLE_SIZE-1)); \
- int k = (int) f; \
- if (k < 0 /* gcc may cast an overflow float value to negative int value*/ \
- || k > SHINE_TABLE_SIZE-2) \
- result = (GLfloat) pow( dp, _tab->shininess ); \
- else \
- result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \
-} while (0)
+static inline GLfloat
+_mesa_lookup_shininess(const struct gl_context *ctx, GLuint face, GLfloat dp)
+{
+ const struct gl_shine_tab *tab = ctx->_ShineTable[face];
+ float f = dp * (SHINE_TABLE_SIZE - 1);
+ int k = (int) f;
+ if (k < 0 /* gcc may cast an overflow float value to negative int value */
+ || k > SHINE_TABLE_SIZE - 2)
+ return powf(dp, tab->shininess);
+ else
+ return tab->tab[k] + (f - k) * (tab->tab[k+1] - tab->tab[k]);
+}
extern GLuint _mesa_material_bitmask( struct gl_context *ctx,
@@ -110,10 +112,6 @@ extern GLuint _mesa_material_bitmask( struct gl_context *ctx,
GLuint legal,
const char * );
-extern void _mesa_invalidate_spot_exp_table( struct gl_light *l );
-
-extern void _mesa_invalidate_shine_table( struct gl_context *ctx, GLuint i );
-
extern void _mesa_validate_all_lighting_tables( struct gl_context *ctx );
extern void _mesa_update_lighting( struct gl_context *ctx );
@@ -135,7 +133,6 @@ extern void _mesa_allow_light_in_model( struct gl_context *ctx, GLboolean flag )
#else
#define _mesa_update_color_material( c, r ) ((void)0)
#define _mesa_validate_all_lighting_tables( c ) ((void)0)
-#define _mesa_invalidate_spot_exp_table( l ) ((void)0)
#define _mesa_material_bitmask( c, f, p, l, s ) 0
#define _mesa_init_lighting( c ) ((void)0)
#define _mesa_free_lighting_data( c ) ((void)0)
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index d3001d35c..5ef97c86c 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -689,7 +689,6 @@ struct gl_light
GLfloat _NormSpotDirection[4]; /**< normalized spotlight direction */
GLfloat _VP_inf_spot_attenuation;
- GLfloat _SpotExpTable[EXP_TABLE_SIZE][2]; /**< to replace a pow() call */
GLfloat _MatAmbient[2][3]; /**< material ambient * light ambient */
GLfloat _MatDiffuse[2][3]; /**< material diffuse * light diffuse */
GLfloat _MatSpecular[2][3]; /**< material spec * light specular */
@@ -1046,7 +1045,6 @@ struct gl_pixelmap
{
GLint Size;
GLfloat Map[MAX_PIXEL_MAP_TABLE];
- GLubyte Map8[MAX_PIXEL_MAP_TABLE]; /**< converted to 8-bit color */
};
@@ -2529,8 +2527,6 @@ struct gl_shared_state
/** GL_ARB_sampler_objects */
struct _mesa_HashTable *SamplerObjects;
-
- void *DriverData; /**< Device driver shared state */
};
@@ -2829,7 +2825,7 @@ struct gl_constants
* borders and mipmapped textures. (Note: not static border color, but the
* old 1-pixel border around each edge). Implementations then have to do
* slow fallbacks to be correct, or just ignore the border and be fast but
- * wrong. Setting the flag stripts the border off of TexImage calls,
+ * wrong. Setting the flag strips the border off of TexImage calls,
* providing "fast but wrong" at significantly reduced driver complexity.
*
* Texture borders are deprecated in GL 3.0.
diff --git a/mesalib/src/mesa/main/pixel.c b/mesalib/src/mesa/main/pixel.c
index e73c5a49a..450c936b7 100644
--- a/mesalib/src/mesa/main/pixel.c
+++ b/mesalib/src/mesa/main/pixel.c
@@ -137,7 +137,6 @@ store_pixelmap(struct gl_context *ctx, GLenum map, GLsizei mapsize,
for (i = 0; i < mapsize; i++) {
GLfloat val = CLAMP(values[i], 0.0F, 1.0F);
pm->Map[i] = val;
- pm->Map8[i] = (GLint) (val * 255.0F);
}
}
}
@@ -683,7 +682,6 @@ init_pixelmap(struct gl_pixelmap *map)
{
map->Size = 1;
map->Map[0] = 0.0;
- map->Map8[0] = 0;
}
diff --git a/mesalib/src/mesa/main/pixeltransfer.c b/mesalib/src/mesa/main/pixeltransfer.c
index 5c167e0a9..c6172b9fd 100644
--- a/mesalib/src/mesa/main/pixeltransfer.c
+++ b/mesalib/src/mesa/main/pixeltransfer.c
@@ -125,32 +125,6 @@ _mesa_map_ci_to_rgba( const struct gl_context *ctx, GLuint n,
}
-/**
- * Map ubyte color indexes to ubyte/RGBA values.
- */
-void
-_mesa_map_ci8_to_rgba8(const struct gl_context *ctx,
- GLuint n, const GLubyte index[],
- GLubyte rgba[][4])
-{
- GLuint rmask = ctx->PixelMaps.ItoR.Size - 1;
- GLuint gmask = ctx->PixelMaps.ItoG.Size - 1;
- GLuint bmask = ctx->PixelMaps.ItoB.Size - 1;
- GLuint amask = ctx->PixelMaps.ItoA.Size - 1;
- const GLubyte *rMap = ctx->PixelMaps.ItoR.Map8;
- const GLubyte *gMap = ctx->PixelMaps.ItoG.Map8;
- const GLubyte *bMap = ctx->PixelMaps.ItoB.Map8;
- const GLubyte *aMap = ctx->PixelMaps.ItoA.Map8;
- GLuint i;
- for (i=0;i<n;i++) {
- rgba[i][RCOMP] = rMap[index[i] & rmask];
- rgba[i][GCOMP] = gMap[index[i] & gmask];
- rgba[i][BCOMP] = bMap[index[i] & bmask];
- rgba[i][ACOMP] = aMap[index[i] & amask];
- }
-}
-
-
void
_mesa_scale_and_bias_depth(const struct gl_context *ctx, GLuint n,
GLfloat depthValues[])
diff --git a/mesalib/src/mesa/main/pixeltransfer.h b/mesalib/src/mesa/main/pixeltransfer.h
index a8c14757f..3cd7ebe77 100644
--- a/mesalib/src/mesa/main/pixeltransfer.h
+++ b/mesalib/src/mesa/main/pixeltransfer.h
@@ -46,12 +46,6 @@ _mesa_map_ci_to_rgba(const struct gl_context *ctx,
extern void
-_mesa_map_ci8_to_rgba8(const struct gl_context *ctx,
- GLuint n, const GLubyte index[],
- GLubyte rgba[][4]);
-
-
-extern void
_mesa_scale_and_bias_depth(const struct gl_context *ctx, GLuint n,
GLfloat depthValues[]);
diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c
index 44590ea96..c376b970e 100644
--- a/mesalib/src/mesa/main/texcompress.c
+++ b/mesalib/src/mesa/main/texcompress.c
@@ -465,6 +465,8 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img,
/**
* Decompress a compressed texture image, returning a GL_RGBA/GL_FLOAT image.
+ * \param srcRowStride stride in bytes between rows of blocks in the
+ * compressed source image.
*/
void
_mesa_decompress_image(gl_format format, GLuint width, GLuint height,
@@ -475,11 +477,19 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height,
GLint i, GLint j, GLint k, GLfloat *texel);
struct swrast_texture_image texImage; /* dummy teximage */
GLuint i, j;
+ GLuint bytes, bw, bh;
+
+ bytes = _mesa_get_format_bytes(format);
+ _mesa_get_format_block_size(format, &bw, &bh);
/* setup dummy texture image info */
memset(&texImage, 0, sizeof(texImage));
texImage.Map = (void *) src;
- texImage.RowStride = srcRowStride;
+
+ /* XXX This line is a bit of a hack to adapt to the row stride
+ * convention used by the texture decompression functions.
+ */
+ texImage.RowStride = srcRowStride * bh / bytes;
switch (format) {
/* DXT formats */
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index bff003d24..a02a49156 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -246,23 +246,12 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
{
GLubyte *srcMap;
GLint srcRowStride;
- GLuint bytes, bw, bh;
-
- bytes = _mesa_get_format_bytes(texFormat);
- _mesa_get_format_block_size(texFormat, &bw, &bh);
ctx->Driver.MapTextureImage(ctx, texImage, 0,
0, 0, width, height,
GL_MAP_READ_BIT,
&srcMap, &srcRowStride);
if (srcMap) {
- /* XXX This line is a bit of a hack to work around the
- * mismatch of compressed row strides as returned by
- * MapTextureImage() vs. what the texture decompression code
- * uses. This will be fixed in the future.
- */
- srcRowStride = srcRowStride * bh / bytes;
-
_mesa_decompress_image(texFormat, width, height,
srcMap, srcRowStride, tempImage);
@@ -270,6 +259,8 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
}
else {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
+ free(tempImage);
+ return;
}
}
@@ -496,52 +487,17 @@ get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type,
GLboolean memCopy = GL_FALSE;
/*
- * Check if the src/dst formats are compatible.
- * Also note that GL's pixel transfer ops don't apply to glGetTexImage()
- * so we don't have to worry about those.
- * XXX more format combinations could be supported here.
+ * Check if we can use memcpy to copy from the hardware texture
+ * format to the user's format/type.
+ * Note that GL's pixel transfer ops don't apply to glGetTexImage()
*/
if (target == GL_TEXTURE_1D ||
target == GL_TEXTURE_2D ||
target == GL_TEXTURE_RECTANGLE ||
_mesa_is_cube_face(target)) {
- if ((texImage->TexFormat == MESA_FORMAT_ARGB8888 ||
- texImage->TexFormat == MESA_FORMAT_SARGB8) &&
- format == GL_BGRA &&
- (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) &&
- !ctx->Pack.SwapBytes &&
- _mesa_little_endian()) {
- memCopy = GL_TRUE;
- }
- else if ((texImage->TexFormat == MESA_FORMAT_AL88 ||
- texImage->TexFormat == MESA_FORMAT_SLA8) &&
- format == GL_LUMINANCE_ALPHA &&
- type == GL_UNSIGNED_BYTE &&
- !ctx->Pack.SwapBytes &&
- _mesa_little_endian()) {
- memCopy = GL_TRUE;
- }
- else if ((texImage->TexFormat == MESA_FORMAT_L8 ||
- texImage->TexFormat == MESA_FORMAT_SL8) &&
- format == GL_LUMINANCE &&
- type == GL_UNSIGNED_BYTE) {
- memCopy = GL_TRUE;
- }
- else if (texImage->TexFormat == MESA_FORMAT_L16 &&
- format == GL_LUMINANCE &&
- type == GL_UNSIGNED_SHORT) {
- memCopy = GL_TRUE;
- }
- else if (texImage->TexFormat == MESA_FORMAT_A8 &&
- format == GL_ALPHA &&
- type == GL_UNSIGNED_BYTE) {
- memCopy = GL_TRUE;
- }
- else if (texImage->TexFormat == MESA_FORMAT_A16 &&
- format == GL_ALPHA &&
- type == GL_UNSIGNED_SHORT) {
- memCopy = GL_TRUE;
- }
+ memCopy = _mesa_format_matches_format_and_type(texImage->TexFormat,
+ format, type,
+ ctx->Pack.SwapBytes);
}
if (memCopy) {
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 25da75369..e4eb7f67d 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1179,7 +1179,7 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
switch (target) {
case GL_PROXY_TEXTURE_1D:
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
- if (width < 2 * border || width > maxSize)
+ if (width < 2 * border || width > 2 * border + maxSize)
return GL_FALSE;
if (level >= ctx->Const.MaxTextureLevels)
return GL_FALSE;
@@ -1191,9 +1191,9 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
case GL_PROXY_TEXTURE_2D:
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
- if (width < 2 * border || width > maxSize)
+ if (width < 2 * border || width > 2 * border + maxSize)
return GL_FALSE;
- if (height < 2 * border || height > maxSize)
+ if (height < 2 * border || height > 2 * border + maxSize)
return GL_FALSE;
if (level >= ctx->Const.MaxTextureLevels)
return GL_FALSE;
@@ -1207,11 +1207,11 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
case GL_PROXY_TEXTURE_3D:
maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
- if (width < 2 * border || width > maxSize)
+ if (width < 2 * border || width > 2 * border + maxSize)
return GL_FALSE;
- if (height < 2 * border || height > maxSize)
+ if (height < 2 * border || height > 2 * border + maxSize)
return GL_FALSE;
- if (depth < 2 * border || depth > maxSize)
+ if (depth < 2 * border || depth > 2 * border + maxSize)
return GL_FALSE;
if (level >= ctx->Const.Max3DTextureLevels)
return GL_FALSE;
@@ -1237,9 +1237,9 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
- if (width < 2 * border || width > maxSize)
+ if (width < 2 * border || width > 2 * border + maxSize)
return GL_FALSE;
- if (height < 2 * border || height > maxSize)
+ if (height < 2 * border || height > 2 * border + maxSize)
return GL_FALSE;
if (level >= ctx->Const.MaxCubeTextureLevels)
return GL_FALSE;
@@ -1253,7 +1253,7 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
- if (width < 2 * border || width > maxSize)
+ if (width < 2 * border || width > 2 * border + maxSize)
return GL_FALSE;
if (height < 1 || height > ctx->Const.MaxArrayTextureLayers)
return GL_FALSE;
@@ -1267,9 +1267,9 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
- if (width < 2 * border || width > maxSize)
+ if (width < 2 * border || width > 2 * border + maxSize)
return GL_FALSE;
- if (height < 2 * border || height > maxSize)
+ if (height < 2 * border || height > 2 * border + maxSize)
return GL_FALSE;
if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers)
return GL_FALSE;
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 0f92a5b98..9a2ec518f 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -1233,19 +1233,19 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
switch (pname) {
case GL_TEXTURE_MAG_FILTER:
*params = (GLint) obj->Sampler.MagFilter;
- break;;
+ break;
case GL_TEXTURE_MIN_FILTER:
*params = (GLint) obj->Sampler.MinFilter;
- break;;
+ break;
case GL_TEXTURE_WRAP_S:
*params = (GLint) obj->Sampler.WrapS;
- break;;
+ break;
case GL_TEXTURE_WRAP_T:
*params = (GLint) obj->Sampler.WrapT;
- break;;
+ break;
case GL_TEXTURE_WRAP_R:
*params = (GLint) obj->Sampler.WrapR;
- break;;
+ break;
case GL_TEXTURE_BORDER_COLOR:
{
GLfloat b[4];
@@ -1258,25 +1258,25 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
params[2] = FLOAT_TO_INT(b[2]);
params[3] = FLOAT_TO_INT(b[3]);
}
- break;;
+ break;
case GL_TEXTURE_RESIDENT:
*params = 1;
- break;;
+ break;
case GL_TEXTURE_PRIORITY:
*params = FLOAT_TO_INT(obj->Priority);
- break;;
+ break;
case GL_TEXTURE_MIN_LOD:
*params = (GLint) obj->Sampler.MinLod;
- break;;
+ break;
case GL_TEXTURE_MAX_LOD:
*params = (GLint) obj->Sampler.MaxLod;
- break;;
+ break;
case GL_TEXTURE_BASE_LEVEL:
*params = obj->BaseLevel;
- break;;
+ break;
case GL_TEXTURE_MAX_LEVEL:
*params = obj->MaxLevel;
- break;;
+ break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
if (!ctx->Extensions.EXT_texture_filter_anisotropic)
goto invalid_pname;
diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c
index 8e9537fae..cc49916a9 100644
--- a/mesalib/src/mesa/main/texstate.c
+++ b/mesalib/src/mesa/main/texstate.c
@@ -682,20 +682,25 @@ _mesa_update_texture( struct gl_context *ctx, GLuint new_state )
static GLboolean
alloc_proxy_textures( struct gl_context *ctx )
{
+ /* NOTE: these values must be in the same order as the TEXTURE_x_INDEX
+ * values!
+ */
static const GLenum targets[] = {
- GL_TEXTURE_1D,
- GL_TEXTURE_2D,
- GL_TEXTURE_3D,
+ GL_TEXTURE_BUFFER,
+ GL_TEXTURE_2D_ARRAY_EXT,
+ GL_TEXTURE_1D_ARRAY_EXT,
+ GL_TEXTURE_EXTERNAL_OES,
GL_TEXTURE_CUBE_MAP_ARB,
+ GL_TEXTURE_3D,
GL_TEXTURE_RECTANGLE_NV,
- GL_TEXTURE_1D_ARRAY_EXT,
- GL_TEXTURE_2D_ARRAY_EXT,
- GL_TEXTURE_BUFFER,
- GL_TEXTURE_EXTERNAL_OES
+ GL_TEXTURE_2D,
+ GL_TEXTURE_1D,
};
GLint tgt;
STATIC_ASSERT(Elements(targets) == NUM_TEXTURE_TARGETS);
+ assert(targets[TEXTURE_2D_INDEX] == GL_TEXTURE_2D);
+ assert(targets[TEXTURE_CUBE_INDEX] == GL_TEXTURE_CUBE_MAP);
for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
if (!(ctx->Texture.ProxyTex[tgt]
diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h
index 8723c1f57..35bf53392 100644
--- a/mesalib/src/mesa/main/version.h
+++ b/mesalib/src/mesa/main/version.h
@@ -33,7 +33,7 @@ struct gl_context;
/* Mesa version */
#define MESA_MAJOR 8
-#define MESA_MINOR 0
+#define MESA_MINOR 1
#define MESA_PATCH 0
#define MESA_VERSION_STRING "8.0-devel"
diff --git a/mesalib/src/mesa/state_tracker/st_atom.c b/mesalib/src/mesa/state_tracker/st_atom.c
index 95010d1b2..d9cd4aab4 100644
--- a/mesalib/src/mesa/state_tracker/st_atom.c
+++ b/mesalib/src/mesa/state_tracker/st_atom.c
@@ -1,205 +1,205 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-
-#include "pipe/p_defines.h"
-#include "st_context.h"
-#include "st_atom.h"
-#include "st_cb_bitmap.h"
-#include "st_program.h"
-#include "st_manager.h"
-
-
-/**
- * This is used to initialize st->atoms[].
- */
-static const struct st_tracked_state *atoms[] =
-{
- &st_update_depth_stencil_alpha,
- &st_update_clip,
-
- &st_finalize_textures,
- &st_update_fp,
- &st_update_gp,
- &st_update_vp,
-
- &st_update_rasterizer,
- &st_update_polygon_stipple,
- &st_update_viewport,
- &st_update_scissor,
- &st_update_blend,
- &st_update_sampler,
- &st_update_vertex_texture,
- &st_update_texture,
- &st_update_framebuffer,
- &st_update_msaa,
- &st_update_vs_constants,
- &st_update_gs_constants,
- &st_update_fs_constants,
- &st_update_pixel_transfer
-};
-
-
-void st_init_atoms( struct st_context *st )
-{
- /* no-op */
-}
-
-
-void st_destroy_atoms( struct st_context *st )
-{
- /* no-op */
-}
-
-
-/***********************************************************************
- */
-
-static GLboolean check_state( const struct st_state_flags *a,
- const struct st_state_flags *b )
-{
- return ((a->mesa & b->mesa) ||
- (a->st & b->st));
-}
-
-static void accumulate_state( struct st_state_flags *a,
- const struct st_state_flags *b )
-{
- a->mesa |= b->mesa;
- a->st |= b->st;
-}
-
-
-static void xor_states( struct st_state_flags *result,
- const struct st_state_flags *a,
- const struct st_state_flags *b )
-{
- result->mesa = a->mesa ^ b->mesa;
- result->st = a->st ^ b->st;
-}
-
-
-/* Too complex to figure out, just check every time:
- */
-static void check_program_state( struct st_context *st )
-{
- struct gl_context *ctx = st->ctx;
-
- if (ctx->VertexProgram._Current != &st->vp->Base)
- st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
-
- if (ctx->FragmentProgram._Current != &st->fp->Base)
- st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
-
- if (ctx->GeometryProgram._Current != &st->gp->Base)
- st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM;
-}
-
-
-/***********************************************************************
- * Update all derived state:
- */
-
-void st_validate_state( struct st_context *st )
-{
- struct st_state_flags *state = &st->dirty;
- GLuint i;
-
- /* The bitmap cache is immune to pixel unpack changes.
- * Note that GLUT makes several calls to glPixelStore for each
- * bitmap char it draws so this is an important check.
- */
- if (state->mesa & ~_NEW_PACKUNPACK)
- st_flush_bitmap_cache(st);
-
- check_program_state( st );
-
- st_manager_validate_framebuffers(st);
-
- if (state->st == 0)
- return;
-
- /*printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);*/
-
-#ifdef NDEBUG
- if (0) {
-#else
- if (1) {
-#endif
- /* Debug version which enforces various sanity checks on the
- * state flags which are generated and checked to help ensure
- * state atoms are ordered correctly in the list.
- */
- struct st_state_flags examined, prev;
- memset(&examined, 0, sizeof(examined));
- prev = *state;
-
- for (i = 0; i < Elements(atoms); i++) {
- const struct st_tracked_state *atom = atoms[i];
- struct st_state_flags generated;
-
- /*printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st);*/
-
- if (!(atom->dirty.mesa || atom->dirty.st) ||
- !atom->update) {
- printf("malformed atom %s\n", atom->name);
- assert(0);
- }
-
- if (check_state(state, &atom->dirty)) {
- atoms[i]->update( st );
- /*printf("after: %x\n", atom->dirty.mesa);*/
- }
-
- accumulate_state(&examined, &atom->dirty);
-
- /* generated = (prev ^ state)
- * if (examined & generated)
- * fail;
- */
- xor_states(&generated, &prev, state);
- assert(!check_state(&examined, &generated));
- prev = *state;
- }
- /*printf("\n");*/
-
- }
- else {
- for (i = 0; i < Elements(atoms); i++) {
- if (check_state(state, &atoms[i]->dirty))
- atoms[i]->update( st );
- }
- }
-
- memset(state, 0, sizeof(*state));
-}
-
-
-
+/**************************************************************************
+ *
+ * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "main/glheader.h"
+#include "main/context.h"
+
+#include "pipe/p_defines.h"
+#include "st_context.h"
+#include "st_atom.h"
+#include "st_cb_bitmap.h"
+#include "st_program.h"
+#include "st_manager.h"
+
+
+/**
+ * This is used to initialize st->atoms[].
+ */
+static const struct st_tracked_state *atoms[] =
+{
+ &st_update_depth_stencil_alpha,
+ &st_update_clip,
+
+ &st_finalize_textures,
+ &st_update_fp,
+ &st_update_gp,
+ &st_update_vp,
+
+ &st_update_rasterizer,
+ &st_update_polygon_stipple,
+ &st_update_viewport,
+ &st_update_scissor,
+ &st_update_blend,
+ &st_update_sampler,
+ &st_update_vertex_texture,
+ &st_update_texture,
+ &st_update_framebuffer,
+ &st_update_msaa,
+ &st_update_vs_constants,
+ &st_update_gs_constants,
+ &st_update_fs_constants,
+ &st_update_pixel_transfer
+};
+
+
+void st_init_atoms( struct st_context *st )
+{
+ /* no-op */
+}
+
+
+void st_destroy_atoms( struct st_context *st )
+{
+ /* no-op */
+}
+
+
+/***********************************************************************
+ */
+
+static GLboolean check_state( const struct st_state_flags *a,
+ const struct st_state_flags *b )
+{
+ return ((a->mesa & b->mesa) ||
+ (a->st & b->st));
+}
+
+static void accumulate_state( struct st_state_flags *a,
+ const struct st_state_flags *b )
+{
+ a->mesa |= b->mesa;
+ a->st |= b->st;
+}
+
+
+static void xor_states( struct st_state_flags *result,
+ const struct st_state_flags *a,
+ const struct st_state_flags *b )
+{
+ result->mesa = a->mesa ^ b->mesa;
+ result->st = a->st ^ b->st;
+}
+
+
+/* Too complex to figure out, just check every time:
+ */
+static void check_program_state( struct st_context *st )
+{
+ struct gl_context *ctx = st->ctx;
+
+ if (ctx->VertexProgram._Current != &st->vp->Base)
+ st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
+
+ if (ctx->FragmentProgram._Current != &st->fp->Base)
+ st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
+
+ if (ctx->GeometryProgram._Current != &st->gp->Base)
+ st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM;
+}
+
+
+/***********************************************************************
+ * Update all derived state:
+ */
+
+void st_validate_state( struct st_context *st )
+{
+ struct st_state_flags *state = &st->dirty;
+ GLuint i;
+
+ /* The bitmap cache is immune to pixel unpack changes.
+ * Note that GLUT makes several calls to glPixelStore for each
+ * bitmap char it draws so this is an important check.
+ */
+ if (state->mesa & ~_NEW_PACKUNPACK)
+ st_flush_bitmap_cache(st);
+
+ check_program_state( st );
+
+ st_manager_validate_framebuffers(st);
+
+ if (state->st == 0)
+ return;
+
+ /*printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);*/
+
+#ifdef DEBUG
+ if (1) {
+#else
+ if (0) {
+#endif
+ /* Debug version which enforces various sanity checks on the
+ * state flags which are generated and checked to help ensure
+ * state atoms are ordered correctly in the list.
+ */
+ struct st_state_flags examined, prev;
+ memset(&examined, 0, sizeof(examined));
+ prev = *state;
+
+ for (i = 0; i < Elements(atoms); i++) {
+ const struct st_tracked_state *atom = atoms[i];
+ struct st_state_flags generated;
+
+ /*printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st);*/
+
+ if (!(atom->dirty.mesa || atom->dirty.st) ||
+ !atom->update) {
+ printf("malformed atom %s\n", atom->name);
+ assert(0);
+ }
+
+ if (check_state(state, &atom->dirty)) {
+ atoms[i]->update( st );
+ /*printf("after: %x\n", atom->dirty.mesa);*/
+ }
+
+ accumulate_state(&examined, &atom->dirty);
+
+ /* generated = (prev ^ state)
+ * if (examined & generated)
+ * fail;
+ */
+ xor_states(&generated, &prev, state);
+ assert(!check_state(&examined, &generated));
+ prev = *state;
+ }
+ /*printf("\n");*/
+
+ }
+ else {
+ for (i = 0; i < Elements(atoms); i++) {
+ if (check_state(state, &atoms[i]->dirty))
+ atoms[i]->update( st );
+ }
+ }
+
+ memset(state, 0, sizeof(*state));
+}
+
+
+
diff --git a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
index fb1e4092c..8d2317ea1 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -116,11 +116,12 @@ load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt)
for (j = 0; j < texSize; j++) {
union util_color uc;
int k = (i * texSize + j);
- ubyte r = ctx->PixelMaps.RtoR.Map8[j * rSize / texSize];
- ubyte g = ctx->PixelMaps.GtoG.Map8[i * gSize / texSize];
- ubyte b = ctx->PixelMaps.BtoB.Map8[j * bSize / texSize];
- ubyte a = ctx->PixelMaps.AtoA.Map8[i * aSize / texSize];
- util_pack_color_ub(r, g, b, a, pt->format, &uc);
+ float rgba[4];
+ rgba[0] = ctx->PixelMaps.RtoR.Map[j * rSize / texSize];
+ rgba[1] = ctx->PixelMaps.GtoG.Map[i * gSize / texSize];
+ rgba[2] = ctx->PixelMaps.BtoB.Map[j * bSize / texSize];
+ rgba[3] = ctx->PixelMaps.AtoA.Map[i * aSize / texSize];
+ util_pack_color(rgba, pt->format, &uc);
*(dest + k) = uc.ui;
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
index 8845fed51..ee69fc390 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
@@ -233,29 +233,33 @@ update_fragment_samplers(struct st_context *st)
const struct gl_context *ctx = st->ctx;
struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
GLuint su;
+ GLuint samplers_used = fprog->Base.SamplersUsed;
+ GLuint old_max = st->state.num_samplers;
st->state.num_samplers = 0;
/* loop over sampler units (aka tex image units) */
- for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++) {
+ for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++, samplers_used >>= 1) {
struct pipe_sampler_state *sampler = st->state.samplers + su;
-
- if (fprog->Base.SamplersUsed & (1 << su)) {
+ if (samplers_used & 1) {
GLuint texUnit;
- texUnit = fprog->Base.SamplerUnits[su];
+ texUnit = fprog->Base.SamplerUnits[su];
- convert_sampler(st, sampler, texUnit);
+ convert_sampler(st, sampler, texUnit);
st->state.num_samplers = su + 1;
/*printf("%s su=%u non-null\n", __FUNCTION__, su);*/
cso_single_sampler(st->cso_context, su, sampler);
}
- else {
+ else if (samplers_used != 0 || su < old_max) {
/*printf("%s su=%u null\n", __FUNCTION__, su);*/
cso_single_sampler(st->cso_context, su, NULL);
+ } else {
+ /* if we've reset all the old views and we have no more new ones */
+ break;
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index d241527cc..e8941da8d 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -300,24 +300,31 @@ update_fragment_textures(struct st_context *st)
const struct gl_context *ctx = st->ctx;
struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
GLuint su;
+ int old_max = st->state.num_textures;
+ GLbitfield samplers_used = fprog->Base.SamplersUsed;
st->state.num_textures = 0;
/* loop over sampler units (aka tex image units) */
- for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++) {
+ for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++, samplers_used >>= 1) {
struct pipe_sampler_view *sampler_view = NULL;
- if (fprog->Base.SamplersUsed & (1 << su)) {
+
+ if (samplers_used & 1) {
GLboolean retval;
GLuint texUnit;
- texUnit = fprog->Base.SamplerUnits[su];
+ texUnit = fprog->Base.SamplerUnits[su];
- retval = update_single_texture(st, &sampler_view, texUnit);
- if (retval == GL_FALSE)
- continue;
+ retval = update_single_texture(st, &sampler_view, texUnit);
+ if (retval == GL_FALSE)
+ continue;
st->state.num_textures = su + 1;
+ } else if (samplers_used == 0 && su >= old_max) {
+ /* if we've reset all the old views and we have no more new ones */
+ break;
}
+
pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view);
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.c b/mesalib/src/mesa/state_tracker/st_cb_blit.c
index 750f541b5..27da2c633 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_blit.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_blit.c
@@ -178,7 +178,8 @@ st_BlitFramebuffer(struct gl_context *ctx,
st->pipe->render_condition(st->pipe, NULL, 0);
}
- if (readFB->Visual.sampleBuffers > drawFB->Visual.sampleBuffers) {
+ if (readFB->Visual.sampleBuffers > drawFB->Visual.sampleBuffers &&
+ readFB->Visual.samples > 1) {
struct pipe_resolve_info info;
if (dstX0 < dstX1) {
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 443cb4bdf..fb36a6809 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -146,8 +146,8 @@ void st_init_limits(struct st_context *st)
= CLAMP(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
1, MAX_DRAW_BUFFERS);
- /* Quads always follow GL provoking rules. */
- c->QuadsFollowProvokingVertexConvention = GL_FALSE;
+ c->QuadsFollowProvokingVertexConvention = screen->get_param(
+ screen, PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION);
for (sh = 0; sh < MESA_SHADER_TYPES; ++sh) {
struct gl_shader_compiler_options *options =
diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h
index 363bdf03a..9388c3569 100644
--- a/mesalib/src/mesa/swrast/s_context.h
+++ b/mesalib/src/mesa/swrast/s_context.h
@@ -176,6 +176,9 @@ struct swrast_renderbuffer
/** These fields are only valid while buffer is mapped for rendering */
GLubyte *Map;
GLint RowStride; /**< in bytes */
+
+ /** For span rendering */
+ GLenum ColorType;
};
diff --git a/mesalib/src/mesa/swrast/s_renderbuffer.c b/mesalib/src/mesa/swrast/s_renderbuffer.c
index 637a7b6dc..d8a7467b0 100644
--- a/mesalib/src/mesa/swrast/s_renderbuffer.c
+++ b/mesalib/src/mesa/swrast/s_renderbuffer.c
@@ -615,8 +615,31 @@ unmap_attachment(struct gl_context *ctx,
srb->Map = NULL;
}
-
-
+
+
+/**
+ * Determine what type to use (ubyte vs. float) for span colors for the
+ * given renderbuffer.
+ * See also _swrast_write_rgba_span().
+ */
+static void
+find_renderbuffer_colortype(struct gl_renderbuffer *rb)
+{
+ struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
+ GLuint rbMaxBits = _mesa_get_format_max_bits(rb->Format);
+ GLenum rbDatatype = _mesa_get_format_datatype(rb->Format);
+
+ if (rbDatatype == GL_UNSIGNED_NORMALIZED && rbMaxBits <= 8) {
+ /* the buffer's values fit in GLubyte values */
+ srb->ColorType = GL_UNSIGNED_BYTE;
+ }
+ else {
+ /* use floats otherwise */
+ srb->ColorType = GL_FLOAT;
+ }
+}
+
+
/**
* Map the renderbuffers we'll use for tri/line/point rendering.
*/
@@ -641,6 +664,7 @@ _swrast_map_renderbuffers(struct gl_context *ctx)
for (buf = 0; buf < fb->_NumColorDrawBuffers; buf++) {
map_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
+ find_renderbuffer_colortype(fb->_ColorDrawBuffers[buf]);
}
}
diff --git a/mesalib/src/mesa/swrast/s_span.c b/mesalib/src/mesa/swrast/s_span.c
index 422d86c00..025e7b207 100644
--- a/mesalib/src/mesa/swrast/s_span.c
+++ b/mesalib/src/mesa/swrast/s_span.c
@@ -1320,15 +1320,15 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
if (rb) {
GLchan rgbaSave[MAX_WIDTH][4];
+ struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
+ GLenum colorType = srb->ColorType;
- GLenum datatype;
- GLuint comps;
+ assert(colorType == GL_UNSIGNED_BYTE ||
+ colorType == GL_FLOAT);
- _mesa_format_to_type_and_comps(rb->Format, &datatype, &comps);
-
- /* set span->array->rgba to colors for render buffer's datatype */
- if (datatype != span->array->ChanType) {
- convert_color_type(span, datatype, 0);
+ /* set span->array->rgba to colors for renderbuffer's datatype */
+ if (span->array->ChanType != colorType) {
+ convert_color_type(span, colorType, 0);
}
else {
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
diff --git a/mesalib/src/mesa/tnl/t_rasterpos.c b/mesalib/src/mesa/tnl/t_rasterpos.c
index a7e4397b6..17611cd21 100644
--- a/mesalib/src/mesa/tnl/t_rasterpos.c
+++ b/mesalib/src/mesa/tnl/t_rasterpos.c
@@ -167,10 +167,7 @@ shade_rastpos(struct gl_context *ctx,
continue;
}
else {
- double x = PV_dot_dir * (EXP_TABLE_SIZE-1);
- int k = (int) x;
- GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0]
- + (x-k)*light->_SpotExpTable[k][1]);
+ GLfloat spot = powf(PV_dot_dir, light->SpotExponent);
attenuation *= spot;
}
}
@@ -217,8 +214,7 @@ shade_rastpos(struct gl_context *ctx,
n_dot_h = DOT3(normal, h);
if (n_dot_h > 0.0F) {
- GLfloat spec_coef;
- GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec_coef );
+ GLfloat spec_coef = _mesa_lookup_shininess(ctx, 0, n_dot_h);
if (spec_coef > 1.0e-10) {
if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) {
diff --git a/mesalib/src/mesa/tnl/t_vb_lighttmp.h b/mesalib/src/mesa/tnl/t_vb_lighttmp.h
index 63b817ab6..1041a24e7 100644
--- a/mesalib/src/mesa/tnl/t_vb_lighttmp.h
+++ b/mesalib/src/mesa/tnl/t_vb_lighttmp.h
@@ -1,651 +1,632 @@
-/*
- * Mesa 3-D graphics library
- * Version: 5.1
- *
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * Authors:
- * Brian Paul
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-
-#if IDX & LIGHT_TWOSIDE
-# define NR_SIDES 2
-#else
-# define NR_SIDES 1
-#endif
-
-
-/* define TRACE to trace lighting code */
-/* #define TRACE 1 */
-
-/*
- * ctx is the current context
- * VB is the vertex buffer
- * stage is the lighting stage-private data
- * input is the vector of eye or object-space vertex coordinates
- */
-static void TAG(light_rgba_spec)( struct gl_context *ctx,
- struct vertex_buffer *VB,
- struct tnl_pipeline_stage *stage,
- GLvector4f *input )
-{
- struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
- GLfloat (*base)[3] = ctx->Light._BaseColor;
- GLfloat sumA[2];
- GLuint j;
-
- const GLuint vstride = input->stride;
- const GLfloat *vertex = (GLfloat *)input->data;
- const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
- const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
-
- GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
- GLfloat (*Fspec)[4] = (GLfloat (*)[4]) store->LitSecondary[0].data;
-#if IDX & LIGHT_TWOSIDE
- GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
- GLfloat (*Bspec)[4] = (GLfloat (*)[4]) store->LitSecondary[1].data;
-#endif
-
- const GLuint nr = VB->Count;
-
-#ifdef TRACE
- fprintf(stderr, "%s\n", __FUNCTION__ );
-#endif
-
- VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
- VB->AttribPtr[_TNL_ATTRIB_COLOR1] = &store->LitSecondary[0];
- sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
-
-#if IDX & LIGHT_TWOSIDE
- VB->BackfaceColorPtr = &store->LitColor[1];
- VB->BackfaceSecondaryColorPtr = &store->LitSecondary[1];
- sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
-#endif
-
-
- store->LitColor[0].stride = 16;
- store->LitColor[1].stride = 16;
-
- for (j = 0; j < nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal,nstride)) {
- GLfloat sum[2][3], spec[2][3];
- struct gl_light *light;
-
-#if IDX & LIGHT_MATERIAL
- update_materials( ctx, store );
- sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
-#if IDX & LIGHT_TWOSIDE
- sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
-#endif
-#endif
-
- COPY_3V(sum[0], base[0]);
- ZERO_3V(spec[0]);
-
-#if IDX & LIGHT_TWOSIDE
- COPY_3V(sum[1], base[1]);
- ZERO_3V(spec[1]);
-#endif
-
- /* Add contribution from each enabled light source */
- foreach (light, &ctx->Light.EnabledList) {
- GLfloat n_dot_h;
- GLfloat correction;
- GLint side;
- GLfloat contrib[3];
- GLfloat attenuation;
- GLfloat VP[3]; /* unit vector from vertex to light */
- GLfloat n_dot_VP; /* n dot VP */
- GLfloat *h;
-
- /* compute VP and attenuation */
- if (!(light->_Flags & LIGHT_POSITIONAL)) {
- /* directional light */
- COPY_3V(VP, light->_VP_inf_norm);
- attenuation = light->_VP_inf_spot_attenuation;
- }
- else {
- GLfloat d; /* distance from vertex to light */
-
- SUB_3V(VP, light->_Position, vertex);
-
- d = (GLfloat) LEN_3FV( VP );
-
- if (d > 1e-6) {
- GLfloat invd = 1.0F / d;
- SELF_SCALE_SCALAR_3V(VP, invd);
- }
-
- attenuation = 1.0F / (light->ConstantAttenuation + d *
- (light->LinearAttenuation + d *
- light->QuadraticAttenuation));
-
- /* spotlight attenuation */
- if (light->_Flags & LIGHT_SPOT) {
- GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
-
- if (PV_dot_dir<light->_CosCutoff) {
- continue; /* this light makes no contribution */
- }
- else {
- GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1);
- GLint k = (GLint) x;
- GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0]
- + (x-k)*light->_SpotExpTable[k][1]);
- attenuation *= spot;
- }
- }
- }
-
- if (attenuation < 1e-3)
- continue; /* this light makes no contribution */
-
- /* Compute dot product or normal and vector from V to light pos */
- n_dot_VP = DOT3( normal, VP );
-
- /* Which side gets the diffuse & specular terms? */
- if (n_dot_VP < 0.0F) {
- ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
-#if IDX & LIGHT_TWOSIDE
- side = 1;
- correction = -1;
- n_dot_VP = -n_dot_VP;
-#else
- continue;
-#endif
- }
- else {
-#if IDX & LIGHT_TWOSIDE
- ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
-#endif
- side = 0;
- correction = 1;
- }
-
- /* diffuse term */
- COPY_3V(contrib, light->_MatAmbient[side]);
- ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]);
- ACC_SCALE_SCALAR_3V(sum[side], attenuation, contrib );
-
- /* specular term - cannibalize VP... */
- if (ctx->Light.Model.LocalViewer) {
- GLfloat v[3];
- COPY_3V(v, vertex);
- NORMALIZE_3FV(v);
- SUB_3V(VP, VP, v); /* h = VP + VPe */
- h = VP;
- NORMALIZE_3FV(h);
- }
- else if (light->_Flags & LIGHT_POSITIONAL) {
- h = VP;
- ACC_3V(h, ctx->_EyeZDir);
- NORMALIZE_3FV(h);
- }
- else {
- h = light->_h_inf_norm;
- }
-
- n_dot_h = correction * DOT3(normal, h);
-
- if (n_dot_h > 0.0F) {
- GLfloat spec_coef;
- struct gl_shine_tab *tab = ctx->_ShineTable[side];
- GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef );
-
- if (spec_coef > 1.0e-10) {
- spec_coef *= attenuation;
- ACC_SCALE_SCALAR_3V( spec[side], spec_coef,
- light->_MatSpecular[side]);
- }
- }
- } /*loop over lights*/
-
- COPY_3V( Fcolor[j], sum[0] );
- COPY_3V( Fspec[j], spec[0] );
- Fcolor[j][3] = sumA[0];
-
-#if IDX & LIGHT_TWOSIDE
- COPY_3V( Bcolor[j], sum[1] );
- COPY_3V( Bspec[j], spec[1] );
- Bcolor[j][3] = sumA[1];
-#endif
- }
-}
-
-
-static void TAG(light_rgba)( struct gl_context *ctx,
- struct vertex_buffer *VB,
- struct tnl_pipeline_stage *stage,
- GLvector4f *input )
-{
- struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
- GLuint j;
-
- GLfloat (*base)[3] = ctx->Light._BaseColor;
- GLfloat sumA[2];
-
- const GLuint vstride = input->stride;
- const GLfloat *vertex = (GLfloat *) input->data;
- const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
- const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
-
- GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
-#if IDX & LIGHT_TWOSIDE
- GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
-#endif
-
- const GLuint nr = VB->Count;
-
-#ifdef TRACE
- fprintf(stderr, "%s\n", __FUNCTION__ );
-#endif
-
- VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
- sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
-
-#if IDX & LIGHT_TWOSIDE
- VB->BackfaceColorPtr = &store->LitColor[1];
- sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
-#endif
-
- store->LitColor[0].stride = 16;
- store->LitColor[1].stride = 16;
-
- for (j = 0; j < nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal,nstride)) {
- GLfloat sum[2][3];
- struct gl_light *light;
-
-#if IDX & LIGHT_MATERIAL
- update_materials( ctx, store );
- sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
-#if IDX & LIGHT_TWOSIDE
- sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
-#endif
-#endif
-
- COPY_3V(sum[0], base[0]);
-
-#if IDX & LIGHT_TWOSIDE
- COPY_3V(sum[1], base[1]);
-#endif
-
- /* Add contribution from each enabled light source */
- foreach (light, &ctx->Light.EnabledList) {
-
- GLfloat n_dot_h;
- GLfloat correction;
- GLint side;
- GLfloat contrib[3];
- GLfloat attenuation = 1.0;
- GLfloat VP[3]; /* unit vector from vertex to light */
- GLfloat n_dot_VP; /* n dot VP */
- GLfloat *h;
-
- /* compute VP and attenuation */
- if (!(light->_Flags & LIGHT_POSITIONAL)) {
- /* directional light */
- COPY_3V(VP, light->_VP_inf_norm);
- attenuation = light->_VP_inf_spot_attenuation;
- }
- else {
- GLfloat d; /* distance from vertex to light */
-
-
- SUB_3V(VP, light->_Position, vertex);
-
- d = (GLfloat) LEN_3FV( VP );
-
- if ( d > 1e-6) {
- GLfloat invd = 1.0F / d;
- SELF_SCALE_SCALAR_3V(VP, invd);
- }
-
- attenuation = 1.0F / (light->ConstantAttenuation + d *
- (light->LinearAttenuation + d *
- light->QuadraticAttenuation));
-
- /* spotlight attenuation */
- if (light->_Flags & LIGHT_SPOT) {
- GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
-
- if (PV_dot_dir<light->_CosCutoff) {
- continue; /* this light makes no contribution */
- }
- else {
- GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1);
- GLint k = (GLint) x;
- GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0]
- + (x-k)*light->_SpotExpTable[k][1]);
- attenuation *= spot;
- }
- }
- }
-
- if (attenuation < 1e-3)
- continue; /* this light makes no contribution */
-
- /* Compute dot product or normal and vector from V to light pos */
- n_dot_VP = DOT3( normal, VP );
-
- /* which side are we lighting? */
- if (n_dot_VP < 0.0F) {
- ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
-#if IDX & LIGHT_TWOSIDE
- side = 1;
- correction = -1;
- n_dot_VP = -n_dot_VP;
-#else
- continue;
-#endif
- }
- else {
-#if IDX & LIGHT_TWOSIDE
- ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
-#endif
- side = 0;
- correction = 1;
- }
-
- COPY_3V(contrib, light->_MatAmbient[side]);
-
- /* diffuse term */
- ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]);
-
- /* specular term - cannibalize VP... */
- {
- if (ctx->Light.Model.LocalViewer) {
- GLfloat v[3];
- COPY_3V(v, vertex);
- NORMALIZE_3FV(v);
- SUB_3V(VP, VP, v); /* h = VP + VPe */
- h = VP;
- NORMALIZE_3FV(h);
- }
- else if (light->_Flags & LIGHT_POSITIONAL) {
- h = VP;
- ACC_3V(h, ctx->_EyeZDir);
- NORMALIZE_3FV(h);
- }
- else {
- h = light->_h_inf_norm;
- }
-
- n_dot_h = correction * DOT3(normal, h);
-
- if (n_dot_h > 0.0F)
- {
- GLfloat spec_coef;
- struct gl_shine_tab *tab = ctx->_ShineTable[side];
-
- GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef );
-
- ACC_SCALE_SCALAR_3V( contrib, spec_coef,
- light->_MatSpecular[side]);
- }
- }
-
- ACC_SCALE_SCALAR_3V( sum[side], attenuation, contrib );
- }
-
- COPY_3V( Fcolor[j], sum[0] );
- Fcolor[j][3] = sumA[0];
-
-#if IDX & LIGHT_TWOSIDE
- COPY_3V( Bcolor[j], sum[1] );
- Bcolor[j][3] = sumA[1];
-#endif
- }
-}
-
-
-
-
-/* As below, but with just a single light.
- */
-static void TAG(light_fast_rgba_single)( struct gl_context *ctx,
- struct vertex_buffer *VB,
- struct tnl_pipeline_stage *stage,
- GLvector4f *input )
-
-{
- struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
- const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
- const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
- GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
-#if IDX & LIGHT_TWOSIDE
- GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
-#endif
- const struct gl_light *light = ctx->Light.EnabledList.next;
- GLuint j = 0;
- GLfloat base[2][4];
-#if IDX & LIGHT_MATERIAL
- const GLuint nr = VB->Count;
-#else
- const GLuint nr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->count;
-#endif
-
-#ifdef TRACE
- fprintf(stderr, "%s\n", __FUNCTION__ );
-#endif
-
- (void) input; /* doesn't refer to Eye or Obj */
-
- VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
-#if IDX & LIGHT_TWOSIDE
- VB->BackfaceColorPtr = &store->LitColor[1];
-#endif
-
- if (nr > 1) {
- store->LitColor[0].stride = 16;
- store->LitColor[1].stride = 16;
- }
- else {
- store->LitColor[0].stride = 0;
- store->LitColor[1].stride = 0;
- }
-
- for (j = 0; j < nr; j++, STRIDE_F(normal,nstride)) {
-
- GLfloat n_dot_VP;
-
-#if IDX & LIGHT_MATERIAL
- update_materials( ctx, store );
-#endif
-
- /* No attenuation, so incoporate _MatAmbient into base color.
- */
-#if !(IDX & LIGHT_MATERIAL)
- if ( j == 0 )
-#endif
- {
- COPY_3V(base[0], light->_MatAmbient[0]);
- ACC_3V(base[0], ctx->Light._BaseColor[0] );
- base[0][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
-
-#if IDX & LIGHT_TWOSIDE
- COPY_3V(base[1], light->_MatAmbient[1]);
- ACC_3V(base[1], ctx->Light._BaseColor[1]);
- base[1][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
-#endif
- }
-
- n_dot_VP = DOT3(normal, light->_VP_inf_norm);
-
- if (n_dot_VP < 0.0F) {
-#if IDX & LIGHT_TWOSIDE
- GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm);
- GLfloat sum[3];
- COPY_3V(sum, base[1]);
- ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]);
- if (n_dot_h > 0.0F) {
- GLfloat spec;
- GET_SHINE_TAB_ENTRY( ctx->_ShineTable[1], n_dot_h, spec );
- ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]);
- }
- COPY_3V(Bcolor[j], sum );
- Bcolor[j][3] = base[1][3];
-#endif
- COPY_4FV(Fcolor[j], base[0]);
- }
- else {
- GLfloat n_dot_h = DOT3(normal, light->_h_inf_norm);
- GLfloat sum[3];
- COPY_3V(sum, base[0]);
- ACC_SCALE_SCALAR_3V(sum, n_dot_VP, light->_MatDiffuse[0]);
- if (n_dot_h > 0.0F) {
- GLfloat spec;
- GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec );
- ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[0]);
-
- }
- COPY_3V(Fcolor[j], sum );
- Fcolor[j][3] = base[0][3];
-#if IDX & LIGHT_TWOSIDE
- COPY_4FV(Bcolor[j], base[1]);
-#endif
- }
- }
-}
-
-
-/* Light infinite lights
- */
-static void TAG(light_fast_rgba)( struct gl_context *ctx,
- struct vertex_buffer *VB,
- struct tnl_pipeline_stage *stage,
- GLvector4f *input )
-{
- struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
- GLfloat sumA[2];
- const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
- const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
- GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
-#if IDX & LIGHT_TWOSIDE
- GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
-#endif
- GLuint j = 0;
-#if IDX & LIGHT_MATERIAL
- const GLuint nr = VB->Count;
-#else
- const GLuint nr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->count;
-#endif
- const struct gl_light *light;
-
-#ifdef TRACE
- fprintf(stderr, "%s %d\n", __FUNCTION__, nr );
-#endif
-
- (void) input;
-
- sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
- sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
-
- VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
-#if IDX & LIGHT_TWOSIDE
- VB->BackfaceColorPtr = &store->LitColor[1];
-#endif
-
- if (nr > 1) {
- store->LitColor[0].stride = 16;
- store->LitColor[1].stride = 16;
- }
- else {
- store->LitColor[0].stride = 0;
- store->LitColor[1].stride = 0;
- }
-
- for (j = 0; j < nr; j++, STRIDE_F(normal,nstride)) {
-
- GLfloat sum[2][3];
-
-#if IDX & LIGHT_MATERIAL
- update_materials( ctx, store );
-
- sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
-#if IDX & LIGHT_TWOSIDE
- sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
-#endif
-#endif
-
-
- COPY_3V(sum[0], ctx->Light._BaseColor[0]);
-#if IDX & LIGHT_TWOSIDE
- COPY_3V(sum[1], ctx->Light._BaseColor[1]);
-#endif
-
- foreach (light, &ctx->Light.EnabledList) {
- GLfloat n_dot_h, n_dot_VP, spec;
-
- ACC_3V(sum[0], light->_MatAmbient[0]);
-#if IDX & LIGHT_TWOSIDE
- ACC_3V(sum[1], light->_MatAmbient[1]);
-#endif
-
- n_dot_VP = DOT3(normal, light->_VP_inf_norm);
-
- if (n_dot_VP > 0.0F) {
- ACC_SCALE_SCALAR_3V(sum[0], n_dot_VP, light->_MatDiffuse[0]);
- n_dot_h = DOT3(normal, light->_h_inf_norm);
- if (n_dot_h > 0.0F) {
- struct gl_shine_tab *tab = ctx->_ShineTable[0];
- GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec );
- ACC_SCALE_SCALAR_3V( sum[0], spec, light->_MatSpecular[0]);
- }
- }
-#if IDX & LIGHT_TWOSIDE
- else {
- ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->_MatDiffuse[1]);
- n_dot_h = -DOT3(normal, light->_h_inf_norm);
- if (n_dot_h > 0.0F) {
- struct gl_shine_tab *tab = ctx->_ShineTable[1];
- GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec );
- ACC_SCALE_SCALAR_3V( sum[1], spec, light->_MatSpecular[1]);
- }
- }
-#endif
- }
-
- COPY_3V( Fcolor[j], sum[0] );
- Fcolor[j][3] = sumA[0];
-
-#if IDX & LIGHT_TWOSIDE
- COPY_3V( Bcolor[j], sum[1] );
- Bcolor[j][3] = sumA[1];
-#endif
- }
-}
-
-
-
-
-static void TAG(init_light_tab)( void )
-{
- _tnl_light_tab[IDX] = TAG(light_rgba);
- _tnl_light_fast_tab[IDX] = TAG(light_fast_rgba);
- _tnl_light_fast_single_tab[IDX] = TAG(light_fast_rgba_single);
- _tnl_light_spec_tab[IDX] = TAG(light_rgba_spec);
-}
-
-
-#undef TAG
-#undef IDX
-#undef NR_SIDES
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Authors:
+ * Brian Paul
+ * Keith Whitwell <keith@tungstengraphics.com>
+ */
+
+
+#if IDX & LIGHT_TWOSIDE
+# define NR_SIDES 2
+#else
+# define NR_SIDES 1
+#endif
+
+
+/* define TRACE to trace lighting code */
+/* #define TRACE 1 */
+
+/*
+ * ctx is the current context
+ * VB is the vertex buffer
+ * stage is the lighting stage-private data
+ * input is the vector of eye or object-space vertex coordinates
+ */
+static void TAG(light_rgba_spec)( struct gl_context *ctx,
+ struct vertex_buffer *VB,
+ struct tnl_pipeline_stage *stage,
+ GLvector4f *input )
+{
+ struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
+ GLfloat (*base)[3] = ctx->Light._BaseColor;
+ GLfloat sumA[2];
+ GLuint j;
+
+ const GLuint vstride = input->stride;
+ const GLfloat *vertex = (GLfloat *)input->data;
+ const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+ const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
+
+ GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
+ GLfloat (*Fspec)[4] = (GLfloat (*)[4]) store->LitSecondary[0].data;
+#if IDX & LIGHT_TWOSIDE
+ GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
+ GLfloat (*Bspec)[4] = (GLfloat (*)[4]) store->LitSecondary[1].data;
+#endif
+
+ const GLuint nr = VB->Count;
+
+#ifdef TRACE
+ fprintf(stderr, "%s\n", __FUNCTION__ );
+#endif
+
+ VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
+ VB->AttribPtr[_TNL_ATTRIB_COLOR1] = &store->LitSecondary[0];
+ sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
+
+#if IDX & LIGHT_TWOSIDE
+ VB->BackfaceColorPtr = &store->LitColor[1];
+ VB->BackfaceSecondaryColorPtr = &store->LitSecondary[1];
+ sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#endif
+
+
+ store->LitColor[0].stride = 16;
+ store->LitColor[1].stride = 16;
+
+ for (j = 0; j < nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal,nstride)) {
+ GLfloat sum[2][3], spec[2][3];
+ struct gl_light *light;
+
+#if IDX & LIGHT_MATERIAL
+ update_materials( ctx, store );
+ sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
+#if IDX & LIGHT_TWOSIDE
+ sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#endif
+#endif
+
+ COPY_3V(sum[0], base[0]);
+ ZERO_3V(spec[0]);
+
+#if IDX & LIGHT_TWOSIDE
+ COPY_3V(sum[1], base[1]);
+ ZERO_3V(spec[1]);
+#endif
+
+ /* Add contribution from each enabled light source */
+ foreach (light, &ctx->Light.EnabledList) {
+ GLfloat n_dot_h;
+ GLfloat correction;
+ GLint side;
+ GLfloat contrib[3];
+ GLfloat attenuation;
+ GLfloat VP[3]; /* unit vector from vertex to light */
+ GLfloat n_dot_VP; /* n dot VP */
+ GLfloat *h;
+
+ /* compute VP and attenuation */
+ if (!(light->_Flags & LIGHT_POSITIONAL)) {
+ /* directional light */
+ COPY_3V(VP, light->_VP_inf_norm);
+ attenuation = light->_VP_inf_spot_attenuation;
+ }
+ else {
+ GLfloat d; /* distance from vertex to light */
+
+ SUB_3V(VP, light->_Position, vertex);
+
+ d = (GLfloat) LEN_3FV( VP );
+
+ if (d > 1e-6) {
+ GLfloat invd = 1.0F / d;
+ SELF_SCALE_SCALAR_3V(VP, invd);
+ }
+
+ attenuation = 1.0F / (light->ConstantAttenuation + d *
+ (light->LinearAttenuation + d *
+ light->QuadraticAttenuation));
+
+ /* spotlight attenuation */
+ if (light->_Flags & LIGHT_SPOT) {
+ GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
+
+ if (PV_dot_dir<light->_CosCutoff) {
+ continue; /* this light makes no contribution */
+ }
+ else {
+ GLfloat spot = powf(PV_dot_dir, light->SpotExponent);
+ attenuation *= spot;
+ }
+ }
+ }
+
+ if (attenuation < 1e-3)
+ continue; /* this light makes no contribution */
+
+ /* Compute dot product or normal and vector from V to light pos */
+ n_dot_VP = DOT3( normal, VP );
+
+ /* Which side gets the diffuse & specular terms? */
+ if (n_dot_VP < 0.0F) {
+ ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
+#if IDX & LIGHT_TWOSIDE
+ side = 1;
+ correction = -1;
+ n_dot_VP = -n_dot_VP;
+#else
+ continue;
+#endif
+ }
+ else {
+#if IDX & LIGHT_TWOSIDE
+ ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
+#endif
+ side = 0;
+ correction = 1;
+ }
+
+ /* diffuse term */
+ COPY_3V(contrib, light->_MatAmbient[side]);
+ ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]);
+ ACC_SCALE_SCALAR_3V(sum[side], attenuation, contrib );
+
+ /* specular term - cannibalize VP... */
+ if (ctx->Light.Model.LocalViewer) {
+ GLfloat v[3];
+ COPY_3V(v, vertex);
+ NORMALIZE_3FV(v);
+ SUB_3V(VP, VP, v); /* h = VP + VPe */
+ h = VP;
+ NORMALIZE_3FV(h);
+ }
+ else if (light->_Flags & LIGHT_POSITIONAL) {
+ h = VP;
+ ACC_3V(h, ctx->_EyeZDir);
+ NORMALIZE_3FV(h);
+ }
+ else {
+ h = light->_h_inf_norm;
+ }
+
+ n_dot_h = correction * DOT3(normal, h);
+
+ if (n_dot_h > 0.0F) {
+ GLfloat spec_coef = _mesa_lookup_shininess(ctx, side, n_dot_h);
+ if (spec_coef > 1.0e-10) {
+ spec_coef *= attenuation;
+ ACC_SCALE_SCALAR_3V( spec[side], spec_coef,
+ light->_MatSpecular[side]);
+ }
+ }
+ } /*loop over lights*/
+
+ COPY_3V( Fcolor[j], sum[0] );
+ COPY_3V( Fspec[j], spec[0] );
+ Fcolor[j][3] = sumA[0];
+
+#if IDX & LIGHT_TWOSIDE
+ COPY_3V( Bcolor[j], sum[1] );
+ COPY_3V( Bspec[j], spec[1] );
+ Bcolor[j][3] = sumA[1];
+#endif
+ }
+}
+
+
+static void TAG(light_rgba)( struct gl_context *ctx,
+ struct vertex_buffer *VB,
+ struct tnl_pipeline_stage *stage,
+ GLvector4f *input )
+{
+ struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
+ GLuint j;
+
+ GLfloat (*base)[3] = ctx->Light._BaseColor;
+ GLfloat sumA[2];
+
+ const GLuint vstride = input->stride;
+ const GLfloat *vertex = (GLfloat *) input->data;
+ const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+ const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
+
+ GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
+#if IDX & LIGHT_TWOSIDE
+ GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
+#endif
+
+ const GLuint nr = VB->Count;
+
+#ifdef TRACE
+ fprintf(stderr, "%s\n", __FUNCTION__ );
+#endif
+
+ VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
+ sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
+
+#if IDX & LIGHT_TWOSIDE
+ VB->BackfaceColorPtr = &store->LitColor[1];
+ sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#endif
+
+ store->LitColor[0].stride = 16;
+ store->LitColor[1].stride = 16;
+
+ for (j = 0; j < nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal,nstride)) {
+ GLfloat sum[2][3];
+ struct gl_light *light;
+
+#if IDX & LIGHT_MATERIAL
+ update_materials( ctx, store );
+ sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
+#if IDX & LIGHT_TWOSIDE
+ sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#endif
+#endif
+
+ COPY_3V(sum[0], base[0]);
+
+#if IDX & LIGHT_TWOSIDE
+ COPY_3V(sum[1], base[1]);
+#endif
+
+ /* Add contribution from each enabled light source */
+ foreach (light, &ctx->Light.EnabledList) {
+
+ GLfloat n_dot_h;
+ GLfloat correction;
+ GLint side;
+ GLfloat contrib[3];
+ GLfloat attenuation = 1.0;
+ GLfloat VP[3]; /* unit vector from vertex to light */
+ GLfloat n_dot_VP; /* n dot VP */
+ GLfloat *h;
+
+ /* compute VP and attenuation */
+ if (!(light->_Flags & LIGHT_POSITIONAL)) {
+ /* directional light */
+ COPY_3V(VP, light->_VP_inf_norm);
+ attenuation = light->_VP_inf_spot_attenuation;
+ }
+ else {
+ GLfloat d; /* distance from vertex to light */
+
+
+ SUB_3V(VP, light->_Position, vertex);
+
+ d = (GLfloat) LEN_3FV( VP );
+
+ if ( d > 1e-6) {
+ GLfloat invd = 1.0F / d;
+ SELF_SCALE_SCALAR_3V(VP, invd);
+ }
+
+ attenuation = 1.0F / (light->ConstantAttenuation + d *
+ (light->LinearAttenuation + d *
+ light->QuadraticAttenuation));
+
+ /* spotlight attenuation */
+ if (light->_Flags & LIGHT_SPOT) {
+ GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
+
+ if (PV_dot_dir<light->_CosCutoff) {
+ continue; /* this light makes no contribution */
+ }
+ else {
+ GLfloat spot = powf(PV_dot_dir, light->SpotExponent);
+ attenuation *= spot;
+ }
+ }
+ }
+
+ if (attenuation < 1e-3)
+ continue; /* this light makes no contribution */
+
+ /* Compute dot product or normal and vector from V to light pos */
+ n_dot_VP = DOT3( normal, VP );
+
+ /* which side are we lighting? */
+ if (n_dot_VP < 0.0F) {
+ ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
+#if IDX & LIGHT_TWOSIDE
+ side = 1;
+ correction = -1;
+ n_dot_VP = -n_dot_VP;
+#else
+ continue;
+#endif
+ }
+ else {
+#if IDX & LIGHT_TWOSIDE
+ ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
+#endif
+ side = 0;
+ correction = 1;
+ }
+
+ COPY_3V(contrib, light->_MatAmbient[side]);
+
+ /* diffuse term */
+ ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]);
+
+ /* specular term - cannibalize VP... */
+ {
+ if (ctx->Light.Model.LocalViewer) {
+ GLfloat v[3];
+ COPY_3V(v, vertex);
+ NORMALIZE_3FV(v);
+ SUB_3V(VP, VP, v); /* h = VP + VPe */
+ h = VP;
+ NORMALIZE_3FV(h);
+ }
+ else if (light->_Flags & LIGHT_POSITIONAL) {
+ h = VP;
+ ACC_3V(h, ctx->_EyeZDir);
+ NORMALIZE_3FV(h);
+ }
+ else {
+ h = light->_h_inf_norm;
+ }
+
+ n_dot_h = correction * DOT3(normal, h);
+
+ if (n_dot_h > 0.0F) {
+ GLfloat spec_coef = _mesa_lookup_shininess(ctx, side, n_dot_h);
+ ACC_SCALE_SCALAR_3V( contrib, spec_coef,
+ light->_MatSpecular[side]);
+ }
+ }
+
+ ACC_SCALE_SCALAR_3V( sum[side], attenuation, contrib );
+ }
+
+ COPY_3V( Fcolor[j], sum[0] );
+ Fcolor[j][3] = sumA[0];
+
+#if IDX & LIGHT_TWOSIDE
+ COPY_3V( Bcolor[j], sum[1] );
+ Bcolor[j][3] = sumA[1];
+#endif
+ }
+}
+
+
+
+
+/* As below, but with just a single light.
+ */
+static void TAG(light_fast_rgba_single)( struct gl_context *ctx,
+ struct vertex_buffer *VB,
+ struct tnl_pipeline_stage *stage,
+ GLvector4f *input )
+
+{
+ struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
+ const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+ const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
+ GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
+#if IDX & LIGHT_TWOSIDE
+ GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
+#endif
+ const struct gl_light *light = ctx->Light.EnabledList.next;
+ GLuint j = 0;
+ GLfloat base[2][4];
+#if IDX & LIGHT_MATERIAL
+ const GLuint nr = VB->Count;
+#else
+ const GLuint nr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->count;
+#endif
+
+#ifdef TRACE
+ fprintf(stderr, "%s\n", __FUNCTION__ );
+#endif
+
+ (void) input; /* doesn't refer to Eye or Obj */
+
+ VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
+#if IDX & LIGHT_TWOSIDE
+ VB->BackfaceColorPtr = &store->LitColor[1];
+#endif
+
+ if (nr > 1) {
+ store->LitColor[0].stride = 16;
+ store->LitColor[1].stride = 16;
+ }
+ else {
+ store->LitColor[0].stride = 0;
+ store->LitColor[1].stride = 0;
+ }
+
+ for (j = 0; j < nr; j++, STRIDE_F(normal,nstride)) {
+
+ GLfloat n_dot_VP;
+
+#if IDX & LIGHT_MATERIAL
+ update_materials( ctx, store );
+#endif
+
+ /* No attenuation, so incoporate _MatAmbient into base color.
+ */
+#if !(IDX & LIGHT_MATERIAL)
+ if ( j == 0 )
+#endif
+ {
+ COPY_3V(base[0], light->_MatAmbient[0]);
+ ACC_3V(base[0], ctx->Light._BaseColor[0] );
+ base[0][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
+
+#if IDX & LIGHT_TWOSIDE
+ COPY_3V(base[1], light->_MatAmbient[1]);
+ ACC_3V(base[1], ctx->Light._BaseColor[1]);
+ base[1][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#endif
+ }
+
+ n_dot_VP = DOT3(normal, light->_VP_inf_norm);
+
+ if (n_dot_VP < 0.0F) {
+#if IDX & LIGHT_TWOSIDE
+ GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm);
+ GLfloat sum[3];
+ COPY_3V(sum, base[1]);
+ ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]);
+ if (n_dot_h > 0.0F) {
+ GLfloat spec = _mesa_lookup_shininess(ctx, 1, n_dot_h);
+ ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]);
+ }
+ COPY_3V(Bcolor[j], sum );
+ Bcolor[j][3] = base[1][3];
+#endif
+ COPY_4FV(Fcolor[j], base[0]);
+ }
+ else {
+ GLfloat n_dot_h = DOT3(normal, light->_h_inf_norm);
+ GLfloat sum[3];
+ COPY_3V(sum, base[0]);
+ ACC_SCALE_SCALAR_3V(sum, n_dot_VP, light->_MatDiffuse[0]);
+ if (n_dot_h > 0.0F) {
+ GLfloat spec = _mesa_lookup_shininess(ctx, 0, n_dot_h);
+ ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[0]);
+ }
+ COPY_3V(Fcolor[j], sum );
+ Fcolor[j][3] = base[0][3];
+#if IDX & LIGHT_TWOSIDE
+ COPY_4FV(Bcolor[j], base[1]);
+#endif
+ }
+ }
+}
+
+
+/* Light infinite lights
+ */
+static void TAG(light_fast_rgba)( struct gl_context *ctx,
+ struct vertex_buffer *VB,
+ struct tnl_pipeline_stage *stage,
+ GLvector4f *input )
+{
+ struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
+ GLfloat sumA[2];
+ const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+ const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
+ GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
+#if IDX & LIGHT_TWOSIDE
+ GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
+#endif
+ GLuint j = 0;
+#if IDX & LIGHT_MATERIAL
+ const GLuint nr = VB->Count;
+#else
+ const GLuint nr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->count;
+#endif
+ const struct gl_light *light;
+
+#ifdef TRACE
+ fprintf(stderr, "%s %d\n", __FUNCTION__, nr );
+#endif
+
+ (void) input;
+
+ sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
+ sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+
+ VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
+#if IDX & LIGHT_TWOSIDE
+ VB->BackfaceColorPtr = &store->LitColor[1];
+#endif
+
+ if (nr > 1) {
+ store->LitColor[0].stride = 16;
+ store->LitColor[1].stride = 16;
+ }
+ else {
+ store->LitColor[0].stride = 0;
+ store->LitColor[1].stride = 0;
+ }
+
+ for (j = 0; j < nr; j++, STRIDE_F(normal,nstride)) {
+
+ GLfloat sum[2][3];
+
+#if IDX & LIGHT_MATERIAL
+ update_materials( ctx, store );
+
+ sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
+#if IDX & LIGHT_TWOSIDE
+ sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#endif
+#endif
+
+
+ COPY_3V(sum[0], ctx->Light._BaseColor[0]);
+#if IDX & LIGHT_TWOSIDE
+ COPY_3V(sum[1], ctx->Light._BaseColor[1]);
+#endif
+
+ foreach (light, &ctx->Light.EnabledList) {
+ GLfloat n_dot_h, n_dot_VP, spec;
+
+ ACC_3V(sum[0], light->_MatAmbient[0]);
+#if IDX & LIGHT_TWOSIDE
+ ACC_3V(sum[1], light->_MatAmbient[1]);
+#endif
+
+ n_dot_VP = DOT3(normal, light->_VP_inf_norm);
+
+ if (n_dot_VP > 0.0F) {
+ ACC_SCALE_SCALAR_3V(sum[0], n_dot_VP, light->_MatDiffuse[0]);
+ n_dot_h = DOT3(normal, light->_h_inf_norm);
+ if (n_dot_h > 0.0F) {
+ spec = _mesa_lookup_shininess(ctx, 0, n_dot_h);
+ ACC_SCALE_SCALAR_3V( sum[0], spec, light->_MatSpecular[0]);
+ }
+ }
+#if IDX & LIGHT_TWOSIDE
+ else {
+ ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->_MatDiffuse[1]);
+ n_dot_h = -DOT3(normal, light->_h_inf_norm);
+ if (n_dot_h > 0.0F) {
+ spec = _mesa_lookup_shininess(ctx, 1, n_dot_h);
+ ACC_SCALE_SCALAR_3V( sum[1], spec, light->_MatSpecular[1]);
+ }
+ }
+#endif
+ }
+
+ COPY_3V( Fcolor[j], sum[0] );
+ Fcolor[j][3] = sumA[0];
+
+#if IDX & LIGHT_TWOSIDE
+ COPY_3V( Bcolor[j], sum[1] );
+ Bcolor[j][3] = sumA[1];
+#endif
+ }
+}
+
+
+
+
+static void TAG(init_light_tab)( void )
+{
+ _tnl_light_tab[IDX] = TAG(light_rgba);
+ _tnl_light_fast_tab[IDX] = TAG(light_fast_rgba);
+ _tnl_light_fast_single_tab[IDX] = TAG(light_fast_rgba_single);
+ _tnl_light_spec_tab[IDX] = TAG(light_rgba_spec);
+}
+
+
+#undef TAG
+#undef IDX
+#undef NR_SIDES
diff --git a/mesalib/src/mesa/vbo/vbo_save.h b/mesalib/src/mesa/vbo/vbo_save.h
index 4d4a5bf17..0b4d563a7 100644
--- a/mesalib/src/mesa/vbo/vbo_save.h
+++ b/mesalib/src/mesa/vbo/vbo_save.h
@@ -187,6 +187,14 @@ void vbo_save_playback_vertex_list( struct gl_context *ctx, void *data );
void vbo_save_api_init( struct vbo_save_context *save );
+GLfloat *
+vbo_save_map_vertex_store(struct gl_context *ctx,
+ struct vbo_save_vertex_store *vertex_store);
+
+void
+vbo_save_unmap_vertex_store(struct gl_context *ctx,
+ struct vbo_save_vertex_store *vertex_store);
+
#else /* FEATURE_dlist */
static inline void
diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c
index 952136747..13604333e 100644
--- a/mesalib/src/mesa/vbo/vbo_save_api.c
+++ b/mesalib/src/mesa/vbo/vbo_save_api.c
@@ -237,9 +237,9 @@ free_vertex_store(struct gl_context *ctx,
}
-static GLfloat *
-map_vertex_store(struct gl_context *ctx,
- struct vbo_save_vertex_store *vertex_store)
+GLfloat *
+vbo_save_map_vertex_store(struct gl_context *ctx,
+ struct vbo_save_vertex_store *vertex_store)
{
assert(vertex_store->bufferobj);
assert(!vertex_store->buffer);
@@ -259,9 +259,9 @@ map_vertex_store(struct gl_context *ctx,
}
-static void
-unmap_vertex_store(struct gl_context *ctx,
- struct vbo_save_vertex_store *vertex_store)
+void
+vbo_save_unmap_vertex_store(struct gl_context *ctx,
+ struct vbo_save_vertex_store *vertex_store)
{
if (vertex_store->bufferobj->Size > 0) {
ctx->Driver.UnmapBuffer(ctx, vertex_store->bufferobj);
@@ -407,7 +407,7 @@ _save_compile_vertex_list(struct gl_context *ctx)
/* Unmap old store:
*/
- unmap_vertex_store(ctx, save->vertex_store);
+ vbo_save_unmap_vertex_store(ctx, save->vertex_store);
/* Release old reference:
*/
@@ -418,7 +418,7 @@ _save_compile_vertex_list(struct gl_context *ctx)
/* Allocate and map new store:
*/
save->vertex_store = alloc_vertex_store(ctx);
- save->buffer_ptr = map_vertex_store(ctx, save->vertex_store);
+ save->buffer_ptr = vbo_save_map_vertex_store(ctx, save->vertex_store);
save->out_of_memory = save->buffer_ptr == NULL;
}
@@ -1398,7 +1398,7 @@ vbo_save_NewList(struct gl_context *ctx, GLuint list, GLenum mode)
if (!save->vertex_store)
save->vertex_store = alloc_vertex_store(ctx);
- save->buffer_ptr = map_vertex_store(ctx, save->vertex_store);
+ save->buffer_ptr = vbo_save_map_vertex_store(ctx, save->vertex_store);
_save_reset_vertex(ctx);
_save_reset_counters(ctx);
@@ -1435,7 +1435,7 @@ vbo_save_EndList(struct gl_context *ctx)
_mesa_install_save_vtxfmt(ctx, &ctx->ListState.ListVtxfmt);
}
- unmap_vertex_store(ctx, save->vertex_store);
+ vbo_save_unmap_vertex_store(ctx, save->vertex_store);
assert(save->vertex_size == 0);
}
diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c
index b903757c0..b8e1e7883 100644
--- a/mesalib/src/mesa/vbo/vbo_save_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_save_draw.c
@@ -249,6 +249,19 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
(const struct vbo_save_vertex_list *) data;
struct vbo_save_context *save = &vbo_context(ctx)->save;
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
+ GLboolean remap_vertex_store = GL_FALSE;
+
+ if (save->vertex_store->buffer) {
+ /* The vertex store is currently mapped but we're about to replay
+ * a display list. This can happen when a nested display list is
+ * being build with GL_COMPILE_AND_EXECUTE.
+ * We never want to have mapped vertex buffers when we're drawing.
+ * Unmap the vertex store, execute the list, then remap the vertex
+ * store.
+ */
+ vbo_save_unmap_vertex_store(ctx, save->vertex_store);
+ remap_vertex_store = GL_TRUE;
+ }
FLUSH_CURRENT(ctx, 0);
@@ -264,14 +277,16 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
printf("displaylist recursive begin");
vbo_save_loopback_vertex_list( ctx, node );
- return;
+
+ goto end;
}
else if (save->replay_flags) {
/* Various degnerate cases: translate into immediate mode
* calls rather than trying to execute in place.
*/
vbo_save_loopback_vertex_list( ctx, node );
- return;
+
+ goto end;
}
if (ctx->NewState)
@@ -310,6 +325,11 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
/* Copy to current?
*/
_playback_copy_to_current( ctx, node );
+
+end:
+ if (remap_vertex_store) {
+ save->buffer_ptr = vbo_save_map_vertex_store(ctx, save->vertex_store);
+ }
}
diff --git a/mesalib/src/mesa/x86/gen_matypes.c b/mesalib/src/mesa/x86/gen_matypes.c
index 97f71f92c..7af82b4ae 100644
--- a/mesalib/src/mesa/x86/gen_matypes.c
+++ b/mesalib/src/mesa/x86/gen_matypes.c
@@ -209,7 +209,6 @@ int main( int argc, char **argv )
OFFSET( "LIGHT_NORM_DIRECTION ", struct gl_light, _NormSpotDirection );
OFFSET( "LIGHT_VP_INF_SPOT_ATTEN ", struct gl_light, _VP_inf_spot_attenuation );
printf( "\n" );
- OFFSET( "LIGHT_SPOT_EXP_TABLE ", struct gl_light, _SpotExpTable );
OFFSET( "LIGHT_MAT_AMBIENT ", struct gl_light, _MatAmbient );
OFFSET( "LIGHT_MAT_DIFFUSE ", struct gl_light, _MatDiffuse );
OFFSET( "LIGHT_MAT_SPECULAR ", struct gl_light, _MatSpecular );
diff --git a/mkfontscale/configure.ac b/mkfontscale/configure.ac
index 6f7698c74..4340f99e1 100644
--- a/mkfontscale/configure.ac
+++ b/mkfontscale/configure.ac
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure.
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([mkfontscale], [1.0.9],
+AC_INIT([mkfontscale], [1.1.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[mkfontscale])
AC_CONFIG_SRCDIR([Makefile.am])
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c
index 92edae3e3..a6819c8c2 100644
--- a/xorg-server/Xi/exevents.c
+++ b/xorg-server/Xi/exevents.c
@@ -1090,20 +1090,71 @@ DeliverOneTouchEvent(ClientPtr client, DeviceIntPtr dev, TouchPointInfoPtr ti,
return TRUE;
}
+static void
+ActivateEarlyAccept(DeviceIntPtr dev, TouchPointInfoPtr ti)
+{
+ int rc;
+ ClientPtr client;
+ XID error;
+
+ rc = dixLookupClient(&client, ti->listeners[0].listener, serverClient,
+ DixSendAccess);
+ if (rc != Success)
+ {
+ ErrorF("[Xi] Failed to lookup early accepting client.\n");
+ return;
+ }
+
+ if (TouchAcceptReject(client, dev, XIAcceptTouch, ti->client_id,
+ ti->listeners[0].window->drawable.id, &error) !=
+ Success)
+ ErrorF("[Xi] Failed to accept touch grab after early acceptance.\n");
+}
+
/**
- * If the current owner has rejected the event, deliver the
- * TouchOwnership/TouchBegin to the next item in the sprite stack.
+ * Generate and deliver a TouchEnd event.
+ *
+ * @param dev The device to deliver the event for.
+ * @param ti The touch point record to deliver the event for.
+ * @param flags Internal event flags. The called does not need to provide
+ * TOUCH_CLIENT_ID and TOUCH_POINTER_EMULATED, this function will ensure
+ * they are set appropriately.
+ * @param resource The client resource to deliver to, or 0 for all clients.
*/
static void
-TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
- TouchOwnershipEvent *ev)
+EmitTouchEnd(DeviceIntPtr dev, TouchPointInfoPtr ti, int flags, XID resource)
{
InternalEvent *tel = InitEventList(GetMaximumEventsNum());
ValuatorMask *mask = valuator_mask_new(2);
int i, nev;
+ valuator_mask_set_double(mask, 0,
+ valuator_mask_get_double(ti->valuators, 0));
+ valuator_mask_set_double(mask, 1,
+ valuator_mask_get_double(ti->valuators, 1));
+
+ flags |= TOUCH_CLIENT_ID;
+ if (ti->emulate_pointer)
+ flags |= TOUCH_POINTER_EMULATED;
+ nev = GetTouchEvents(tel, dev, ti->client_id, XI_TouchEnd, flags, mask);
+ for (i = 0; i < nev; i++)
+ DeliverTouchEvents(dev, ti, tel + i, resource);
+
+ valuator_mask_free(&mask);
+ FreeEventList(tel, GetMaximumEventsNum());
+}
+
+/**
+ * If the current owner has rejected the event, deliver the
+ * TouchOwnership/TouchBegin to the next item in the sprite stack.
+ */
+static void
+TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
+ TouchOwnershipEvent *ev)
+{
/* Deliver the ownership */
- if (ti->listeners[0].state == LISTENER_AWAITING_OWNER)
+ if (ti->listeners[0].state == LISTENER_AWAITING_OWNER ||
+ ti->listeners[0].state == LISTENER_EARLY_ACCEPT)
DeliverTouchEvents(dev, ti, (InternalEvent*)ev, ti->listeners[0].listener);
else if (ti->listeners[0].state == LISTENER_AWAITING_BEGIN)
TouchEventHistoryReplay(ti, dev, ti->listeners[0].listener);
@@ -1113,52 +1164,41 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
if (ti->num_listeners == 1 && ti->num_grabs == 0 &&
ti->pending_finish)
{
- int flags;
- valuator_mask_set_double(mask, 0,
- valuator_mask_get_double(ti->valuators, 0));
- valuator_mask_set_double(mask, 1,
- valuator_mask_get_double(ti->valuators, 1));
-
- flags = TOUCH_CLIENT_ID;
- if (ti->emulate_pointer)
- flags |= TOUCH_POINTER_EMULATED;
- nev = GetTouchEvents(tel, dev, ti->client_id, XI_TouchEnd, flags, mask);
- for (i = 0; i < nev; i++)
- DeliverTouchEvents(dev, ti, tel + i, 0);
+ EmitTouchEnd(dev, ti, 0, 0);
TouchEndTouch(dev, ti);
}
- valuator_mask_free(&mask);
- FreeEventList(tel, GetMaximumEventsNum());
+ if (ti->listeners[0].state == LISTENER_EARLY_ACCEPT)
+ ActivateEarlyAccept(dev, ti);
}
-static void
-TouchEventRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
- TouchOwnershipEvent *ev)
+/**
+ * Process a touch rejection.
+ *
+ * @param sourcedev The source device of the touch sequence.
+ * @param ti The touchpoint info record.
+ * @param resource The resource of the client rejecting the touch.
+ * @param ev TouchOwnership event to send. Set to NULL if no event should be
+ * sent.
+ */
+void
+TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
+ TouchOwnershipEvent *ev)
{
- InternalEvent *tel = InitEventList(GetMaximumEventsNum());
- ValuatorMask *mask = valuator_mask_new(2);
- Bool was_owner = (ev->resource == ti->listeners[0].listener);
+ Bool was_owner = (resource == ti->listeners[0].listener);
void *grab;
- int nev, i;
-
+ int i;
/* Send a TouchEnd event to the resource being removed, but only if they
* haven't received one yet already */
- if (ti->listeners[0].state != LISTENER_HAS_END)
+ for (i = 0; i < ti->num_listeners; i++)
{
- int flags;
- valuator_mask_set_double(mask, 0,
- valuator_mask_get_double(ti->valuators, 0));
- valuator_mask_set_double(mask, 1,
- valuator_mask_get_double(ti->valuators, 1));
-
- flags = TOUCH_CLIENT_ID|TOUCH_REJECT;
- if (ti->emulate_pointer)
- flags |= TOUCH_POINTER_EMULATED;
- nev = GetTouchEvents(tel, sourcedev, ti->client_id, XI_TouchEnd, flags, mask);
- for (i = 0; i < nev; i++)
- DeliverTouchEvents(sourcedev, ti, tel + i, ev->resource);
+ if (ti->listeners[i].listener == resource)
+ {
+ if (ti->listeners[i].state != LISTENER_HAS_END)
+ EmitTouchEnd(sourcedev, ti, TOUCH_REJECT, resource);
+ break;
+ }
}
/* If there are no other listeners left, and the touchpoint is pending
@@ -1166,26 +1206,22 @@ TouchEventRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
if (ti->num_listeners == 1 && ti->pending_finish)
{
TouchEndTouch(sourcedev, ti);
- goto out;
+ return;
}
/* Remove the resource from the listener list, updating
* ti->num_listeners, as well as ti->num_grabs if it was a grab. */
- if (TouchRemoveListener(ti, ev->resource))
+ if (TouchRemoveListener(ti, resource))
{
- if (dixLookupResourceByType(&grab, ev->resource, RT_PASSIVEGRAB,
+ if (dixLookupResourceByType(&grab, resource, RT_PASSIVEGRAB,
serverClient, DixGetAttrAccess) == Success)
ti->num_grabs--;
}
/* If the current owner was removed and there are further listeners, deliver
* the TouchOwnership or TouchBegin event to the new owner. */
- if (ti->num_listeners > 0 && was_owner)
+ if (ev && ti->num_listeners > 0 && was_owner)
TouchPuntToNextOwner(sourcedev, ti, ev);
-
-out:
- FreeEventList(tel, GetMaximumEventsNum());
- valuator_mask_free(&mask);
}
/**
@@ -1201,35 +1237,11 @@ ProcessTouchOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
{
if (ev->reason == XIRejectTouch)
- TouchEventRejected(dev, ti, ev);
+ TouchRejected(dev, ti, ev->resource, ev);
else if (ev->reason == XIAcceptTouch) {
- int flags;
- int nev, i;
- ValuatorMask *mask;
-
- InternalEvent *tel = InitEventList(GetMaximumEventsNum());
-
- mask = valuator_mask_new(dev->valuator->numAxes);
- valuator_mask_set_double(mask, 0,
- valuator_mask_get_double(ti->valuators, 0));
- valuator_mask_set_double(mask, 1,
- valuator_mask_get_double(ti->valuators, 1));
-
- /* FIXME: what about early acceptance? a client may accept before it
- * owns the touch. */
-
/* The touch owner has accepted the touch. Send TouchEnd events to
* everyone else, and truncate the list of listeners. */
- flags = TOUCH_ACCEPT|TOUCH_CLIENT_ID;
- if (ti->emulate_pointer)
- flags |= TOUCH_POINTER_EMULATED;
- nev = GetTouchEvents(tel, dev, ti->client_id, XI_TouchEnd,
- flags, mask);
- for (i = 0; i < nev; i++)
- DeliverTouchEvents(dev, ti, tel + i, 0);
-
- FreeEventList(tel, GetMaximumEventsNum());
- valuator_mask_free(&mask);
+ EmitTouchEnd(dev, ti, TOUCH_ACCEPT, 0);
while (ti->num_listeners > 1)
TouchRemoveListener(ti, ti->listeners[1].listener);
diff --git a/xorg-server/Xi/xiallowev.c b/xorg-server/Xi/xiallowev.c
index a4b2f5782..d0856b656 100644
--- a/xorg-server/Xi/xiallowev.c
+++ b/xorg-server/Xi/xiallowev.c
@@ -41,6 +41,7 @@
#include <X11/extensions/XI2proto.h>
#include "exglobals.h" /* BadDevice */
+#include "exevents.h"
#include "xiallowev.h"
int
@@ -51,51 +52,14 @@ SProcXIAllowEvents(ClientPtr client)
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->time);
- /* FIXME swap touchid */
- /* FIXME swap window */
-
- return ProcXIAllowEvents(client);
-}
-
-static int
-AllowTouch(ClientPtr client, DeviceIntPtr dev, int mode, uint32_t touchid, XID *error)
-{
- TouchPointInfoPtr ti;
- int nev, i;
- InternalEvent *events = InitEventList(GetMaximumEventsNum());
-
- if (!events)
- return BadAlloc;
-
- if (!dev->touch)
- {
- *error = dev->id;
- return BadDevice;
- }
-
- /* FIXME window is unhandled */
-
- ti = TouchFindByClientID(dev, touchid);
- if (!ti)
+ if (stuff->length > 3)
{
- *error = touchid;
- return BadValue;
+ xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq*)stuff;
+ swapl(&req_xi22->touchid);
+ swapl(&req_xi22->grab_window);
}
- /* FIXME: Allow for early accept */
- if (ti->num_listeners == 0 || CLIENT_ID(ti->listeners[0].listener) != client->index)
- return BadAccess;
-
- nev = GetTouchOwnershipEvents(events, dev, ti, mode, ti->listeners[0].listener, 0);
- if (nev == 0)
- return BadAlloc;
- for (i = 0; i < nev; i++)
- mieqProcessDeviceEvent(dev, events + i, NULL);
-
- ProcessInputEvents();
-
- FreeEventList(events, GetMaximumEventsNum());
- return Success;
+ return ProcXIAllowEvents(client);
}
int
@@ -104,9 +68,21 @@ ProcXIAllowEvents(ClientPtr client)
TimeStamp time;
DeviceIntPtr dev;
int ret = Success;
+ XIClientPtr xi_client;
+ Bool have_xi22 = FALSE;
+ REQUEST(xXI2_2AllowEventsReq);
- REQUEST(xXIAllowEventsReq);
- /* FIXME: check request length, 12 for XI 2.0+, 20 for XI 2.2+ */
+ xi_client = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
+
+ if (version_compare(xi_client->major_version,
+ xi_client->minor_version, 2, 2) >= 0)
+ {
+ REQUEST_AT_LEAST_SIZE(xXI2_2AllowEventsReq);
+ have_xi22 = TRUE;
+ } else
+ {
+ REQUEST_SIZE_MATCH(xXIAllowEventsReq);
+ }
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (ret != Success)
@@ -138,9 +114,20 @@ ProcXIAllowEvents(ClientPtr client)
break;
case XIRejectTouch:
case XIAcceptTouch:
- ret = AllowTouch(client, dev,
- stuff->mode, stuff->touchid,
- &client->errorValue);
+ {
+ int rc;
+ WindowPtr win;
+
+ if (!have_xi22)
+ return BadValue;
+
+ rc = dixLookupWindow(&win, stuff->grab_window, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
+
+ ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid,
+ stuff->grab_window, &client->errorValue);
+ }
break;
default:
client->errorValue = stuff->mode;
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index 6241119c4..a44a12a11 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -26,8 +26,8 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.11.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-01-27"
+AC_INIT([xorg-server], 1.11.99.903, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-02-11"
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
@@ -776,7 +776,7 @@ XPROTO="xproto >= 7.0.22"
RANDRPROTO="randrproto >= 1.2.99.3"
RENDERPROTO="renderproto >= 0.11"
XEXTPROTO="xextproto >= 7.1.99"
-INPUTPROTO="inputproto >= 2.1.99.5"
+INPUTPROTO="inputproto >= 2.1.99.6"
KBPROTO="kbproto >= 1.0.3"
FONTSPROTO="fontsproto"
FIXESPROTO="fixesproto >= 5.0"
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 626fd23dd..781d27f36 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -1125,8 +1125,8 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
int eventlen;
DeviceEvent *event = &ev->device_event;
- if (!list_is_empty(&syncEvents.pending))
- tail = list_last_entry(&syncEvents.pending, QdEventRec, next);
+ if (!xorg_list_is_empty(&syncEvents.pending))
+ tail = xorg_list_last_entry(&syncEvents.pending, QdEventRec, next);
NoticeTime((InternalEvent*)event);
@@ -1186,13 +1186,13 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
qe = malloc(sizeof(QdEventRec) + eventlen);
if (!qe)
return;
- list_init(&qe->next);
+ xorg_list_init(&qe->next);
qe->device = device;
qe->pScreen = pSprite->hotPhys.pScreen;
qe->months = currentTime.months;
qe->event = (InternalEvent *)(qe + 1);
memcpy(qe->event, event, eventlen);
- list_append(&qe->next, &syncEvents.pending);
+ xorg_list_append(&qe->next, &syncEvents.pending);
}
/**
@@ -1213,10 +1213,10 @@ PlayReleasedEvents(void)
DeviceIntPtr pDev;
restart:
- list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next) {
+ xorg_list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next) {
if (!qe->device->deviceGrab.sync.frozen)
{
- list_del(&qe->next);
+ xorg_list_del(&qe->next);
pDev = qe->device;
if (qe->event->any.type == ET_Motion)
CheckVirtualMotion(pDev, qe, NullWindow);
@@ -1300,7 +1300,7 @@ ComputeFreezes(void)
FreezeThaw(dev, dev->deviceGrab.sync.other ||
(dev->deviceGrab.sync.state >= FROZEN));
if (syncEvents.playingEvents ||
- (!replayDev && list_is_empty(&syncEvents.pending)))
+ (!replayDev && xorg_list_is_empty(&syncEvents.pending)))
return;
syncEvents.playingEvents = TRUE;
if (replayDev)
@@ -4272,7 +4272,6 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
if (grab->ownerEvents)
{
WindowPtr focus;
- WindowPtr win;
/* Hack: Some pointer device have a focus class. So we need to check
* for the type of event, to see if we really want to deliver it to
@@ -4289,16 +4288,15 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
else
focus = PointerRootWin;
if (focus == PointerRootWin)
- {
- win = pSprite->win;
- focus = NullWindow;
- } else if (focus && (focus == pSprite->win ||
- IsParent(focus, pSprite->win)))
- win = pSprite->win;
+ deliveries = DeliverDeviceEvents(pSprite->win, event, grab,
+ NullWindow, thisDev);
+ else if (focus && (focus == pSprite->win ||
+ IsParent(focus, pSprite->win)))
+ deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus,
+ thisDev);
else if (focus)
- win = focus;
-
- deliveries = DeliverDeviceEvents(win, event, grab, focus, thisDev);
+ deliveries = DeliverDeviceEvents(focus, event, grab, focus,
+ thisDev);
}
if (!deliveries)
{
@@ -5399,9 +5397,9 @@ InitEvents(void)
syncEvents.replayDev = (DeviceIntPtr)NULL;
syncEvents.replayWin = NullWindow;
if (syncEvents.pending.next)
- list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next)
+ xorg_list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next)
free(qe);
- list_init(&syncEvents.pending);
+ xorg_list_init(&syncEvents.pending);
syncEvents.playingEvents = FALSE;
syncEvents.time.months = 0;
syncEvents.time.milliseconds = 0; /* hardly matters */
diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c
index d279c1d75..9e0c5518c 100644
--- a/xorg-server/dix/inpututils.c
+++ b/xorg-server/dix/inpututils.c
@@ -432,6 +432,9 @@ valuator_mask_new(int num_valuators)
* flying-car future, when we can dynamically alloc the masks and are
* not constrained by signals, we can start using num_valuators */
ValuatorMask *mask = calloc(1, sizeof(ValuatorMask));
+ if (mask == NULL)
+ return NULL;
+
mask->last_bit = -1;
return mask;
}
diff --git a/xorg-server/dix/touch.c b/xorg-server/dix/touch.c
index db0bf334a..d04801c86 100644
--- a/xorg-server/dix/touch.c
+++ b/xorg-server/dix/touch.c
@@ -34,6 +34,7 @@
#include "eventstr.h"
#include "exevents.h"
+#include "exglobals.h"
#include "inpututils.h"
#include "eventconvert.h"
#include "windowstr.h"
@@ -697,12 +698,14 @@ TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource)
*/
void
TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level,
- enum TouchListenerType type, enum TouchListenerState state)
+ enum TouchListenerType type, enum TouchListenerState state,
+ WindowPtr window)
{
ti->listeners[ti->num_listeners].listener = resource;
ti->listeners[ti->num_listeners].level = level;
ti->listeners[ti->num_listeners].state = state;
ti->listeners[ti->num_listeners].type = type;
+ ti->listeners[ti->num_listeners].window = window;
ti->num_listeners++;
}
@@ -753,7 +756,7 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
}
TouchAddListener(ti, grab->resource, grab->grabtype,
- type, LISTENER_AWAITING_BEGIN);
+ type, LISTENER_AWAITING_BEGIN, grab->window);
ti->num_grabs++;
}
@@ -814,7 +817,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, iclients->resource, XI2,
- type, LISTENER_AWAITING_BEGIN);
+ type, LISTENER_AWAITING_BEGIN, win);
return TRUE;
}
}
@@ -830,7 +833,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, iclients->resource, XI,
- LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN);
+ LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
+ win);
return TRUE;
}
}
@@ -845,7 +849,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
{
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, win->drawable.id, CORE,
- LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN);
+ LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
+ win);
return TRUE;
}
@@ -857,7 +862,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, iclients->resource, CORE,
- type, LISTENER_AWAITING_BEGIN);
+ type, LISTENER_AWAITING_BEGIN, win);
return TRUE;
}
}
@@ -980,3 +985,59 @@ TouchListenerGone(XID resource)
FreeEventList(events, GetMaximumEventsNum());
}
+
+int
+TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
+ uint32_t touchid, Window grab_window, XID *error)
+{
+ TouchPointInfoPtr ti;
+ int nev, i;
+ InternalEvent *events = InitEventList(GetMaximumEventsNum());
+
+ if (!events)
+ return BadAlloc;
+
+ if (!dev->touch)
+ {
+ *error = dev->id;
+ return BadDevice;
+ }
+
+ ti = TouchFindByClientID(dev, touchid);
+ if (!ti)
+ {
+ *error = touchid;
+ return BadValue;
+ }
+
+ for (i = 0; i < ti->num_listeners; i++)
+ {
+ if (CLIENT_ID(ti->listeners[i].listener) == client->index &&
+ ti->listeners[i].window->drawable.id == grab_window)
+ break;
+ }
+ if (i == ti->num_listeners)
+ return BadAccess;
+
+ if (i > 0)
+ {
+ if (mode == XIRejectTouch)
+ TouchRejected(dev, ti, ti->listeners[i].listener, NULL);
+ else
+ ti->listeners[i].state = LISTENER_EARLY_ACCEPT;
+
+ return Success;
+ }
+
+ nev = GetTouchOwnershipEvents(events, dev, ti, mode,
+ ti->listeners[0].listener, 0);
+ if (nev == 0)
+ return BadAlloc;
+ for (i = 0; i < nev; i++)
+ mieqProcessDeviceEvent(dev, events + i, NULL);
+
+ ProcessInputEvents();
+
+ FreeEventList(events, GetMaximumEventsNum());
+ return Success;
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
index fd40f28da..f6be99910 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.c
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -516,13 +516,13 @@ match_string_implicit(const char *attr, const char *pattern)
* If a pattern in each list entry is matched, return TRUE.
*/
static Bool
-MatchAttrToken(const char *attr, struct list *patterns,
+MatchAttrToken(const char *attr, struct xorg_list *patterns,
int (*compare)(const char *attr, const char *pattern))
{
const xf86MatchGroup *group;
/* If there are no patterns, accept the match */
- if (list_is_empty(patterns))
+ if (xorg_list_is_empty(patterns))
return TRUE;
/* If there are patterns but no attribute, reject the match */
@@ -533,7 +533,7 @@ MatchAttrToken(const char *attr, struct list *patterns,
* Otherwise, iterate the list of patterns ensuring each entry has a
* match. Each list entry is a separate Match line of the same type.
*/
- list_for_each_entry(group, patterns, entry) {
+ xorg_list_for_each_entry(group, patterns, entry) {
char * const *cur;
Bool match = FALSE;
@@ -590,7 +590,7 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev,
* MatchTag string
* See if any of the device's tags match any of the MatchTag tokens.
*/
- if (!list_is_empty(&iclass->match_tag)) {
+ if (!xorg_list_is_empty(&iclass->match_tag)) {
char * const *tag;
Bool match;
@@ -607,7 +607,7 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev,
}
/* MatchLayout string */
- if (!list_is_empty(&iclass->match_layout)) {
+ if (!xorg_list_is_empty(&iclass->match_layout)) {
if (!MatchAttrToken(xf86ConfigLayout.id,
&iclass->match_layout, match_string_implicit))
return FALSE;
diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c
index d6441a234..5cc9068af 100644
--- a/xorg-server/hw/xfree86/dri2/dri2.c
+++ b/xorg-server/hw/xfree86/dri2/dri2.c
@@ -67,7 +67,7 @@ typedef struct _DRI2Screen *DRI2ScreenPtr;
typedef struct _DRI2Drawable {
DRI2ScreenPtr dri2_screen;
DrawablePtr drawable;
- struct list reference_list;
+ struct xorg_list reference_list;
int width;
int height;
DRI2BufferPtr *buffers;
@@ -179,7 +179,7 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
pPriv->swap_limit = 1; /* default to double buffering */
pPriv->last_swap_msc = 0;
pPriv->last_swap_ust = 0;
- list_init(&pPriv->reference_list);
+ xorg_list_init(&pPriv->reference_list);
pPriv->serialNumber = DRI2DrawableSerial(pDraw);
pPriv->needInvalidate = FALSE;
@@ -229,7 +229,7 @@ typedef struct DRI2DrawableRefRec {
XID dri2_id;
DRI2InvalidateProcPtr invalidate;
void *priv;
- struct list link;
+ struct xorg_list link;
} DRI2DrawableRefRec, *DRI2DrawableRefPtr;
static DRI2DrawableRefPtr
@@ -237,7 +237,7 @@ DRI2LookupDrawableRef(DRI2DrawablePtr pPriv, XID id)
{
DRI2DrawableRefPtr ref;
- list_for_each_entry(ref, &pPriv->reference_list, link) {
+ xorg_list_for_each_entry(ref, &pPriv->reference_list, link) {
if (ref->id == id)
return ref;
}
@@ -270,7 +270,7 @@ DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id,
ref->dri2_id = dri2_id;
ref->invalidate = invalidate;
ref->priv = priv;
- list_add(&ref->link, &pPriv->reference_list);
+ xorg_list_add(&ref->link, &pPriv->reference_list);
return Success;
}
@@ -307,9 +307,9 @@ static int DRI2DrawableGone(pointer p, XID id)
DrawablePtr pDraw;
int i;
- list_for_each_entry_safe(ref, next, &pPriv->reference_list, link) {
+ xorg_list_for_each_entry_safe(ref, next, &pPriv->reference_list, link) {
if (ref->dri2_id == id) {
- list_del(&ref->link);
+ xorg_list_del(&ref->link);
/* If this was the last ref under this X drawable XID,
* unregister the X drawable resource. */
if (!DRI2LookupDrawableRef(pPriv, ref->id))
@@ -319,13 +319,13 @@ static int DRI2DrawableGone(pointer p, XID id)
}
if (ref->id == id) {
- list_del(&ref->link);
+ xorg_list_del(&ref->link);
FreeResourceByType(ref->dri2_id, dri2DrawableRes, TRUE);
free(ref);
}
}
- if (!list_is_empty(&pPriv->reference_list))
+ if (!xorg_list_is_empty(&pPriv->reference_list))
return Success;
pDraw = pPriv->drawable;
@@ -586,7 +586,7 @@ DRI2InvalidateDrawable(DrawablePtr pDraw)
pPriv->needInvalidate = FALSE;
- list_for_each_entry(ref, &pPriv->reference_list, link)
+ xorg_list_for_each_entry(ref, &pPriv->reference_list, link)
ref->invalidate(pDraw, ref->priv, ref->id);
}
diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSlib.h b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
index 0a5861f49..45500dbdb 100644
--- a/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
+++ b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
@@ -98,8 +98,8 @@
# if !(defined (sun) && defined (SVR4))
# include <sys/immu.h>
# include <sys/region.h>
+# include <sys/proc.h>
# endif
-# include <sys/proc.h>
# include <sys/tss.h>
# include <sys/sysi86.h>
# if defined(SVR4) && !defined(sun)
diff --git a/xorg-server/hw/xfree86/parser/InputClass.c b/xorg-server/hw/xfree86/parser/InputClass.c
index 919ae1869..c25117c1a 100644
--- a/xorg-server/hw/xfree86/parser/InputClass.c
+++ b/xorg-server/hw/xfree86/parser/InputClass.c
@@ -67,14 +67,14 @@ xf86ConfigSymTabRec InputClassTab[] =
#define TOKEN_SEP "|"
static void
-add_group_entry(struct list *head, char **values)
+add_group_entry(struct xorg_list *head, char **values)
{
xf86MatchGroup *group;
group = malloc(sizeof(*group));
if (group) {
group->values = values;
- list_add(&group->entry, head);
+ xorg_list_add(&group->entry, head);
}
}
@@ -87,15 +87,15 @@ xf86parseInputClassSection(void)
parsePrologue(XF86ConfInputClassPtr, XF86ConfInputClassRec)
/* Initialize MatchGroup lists */
- list_init(&ptr->match_product);
- list_init(&ptr->match_vendor);
- list_init(&ptr->match_device);
- list_init(&ptr->match_os);
- list_init(&ptr->match_pnpid);
- list_init(&ptr->match_usbid);
- list_init(&ptr->match_driver);
- list_init(&ptr->match_tag);
- list_init(&ptr->match_layout);
+ xorg_list_init(&ptr->match_product);
+ xorg_list_init(&ptr->match_vendor);
+ xorg_list_init(&ptr->match_device);
+ xorg_list_init(&ptr->match_os);
+ xorg_list_init(&ptr->match_pnpid);
+ xorg_list_init(&ptr->match_usbid);
+ xorg_list_init(&ptr->match_driver);
+ xorg_list_init(&ptr->match_tag);
+ xorg_list_init(&ptr->match_layout);
while ((token = xf86getToken(InputClassTab)) != ENDSECTION) {
switch (token) {
@@ -274,63 +274,63 @@ xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
if (ptr->driver)
fprintf(cf, "\tDriver \"%s\"\n", ptr->driver);
- list_for_each_entry(group, &ptr->match_product, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_product, entry) {
fprintf(cf, "\tMatchProduct \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_vendor, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_vendor, entry) {
fprintf(cf, "\tMatchVendor \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_device, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_device, entry) {
fprintf(cf, "\tMatchDevicePath \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_os, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_os, entry) {
fprintf(cf, "\tMatchOS \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_pnpid, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_pnpid, entry) {
fprintf(cf, "\tMatchPnPID \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_usbid, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_usbid, entry) {
fprintf(cf, "\tMatchUSBID \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_driver, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_driver, entry) {
fprintf(cf, "\tMatchDriver \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_tag, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_tag, entry) {
fprintf(cf, "\tMatchTag \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_layout, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_layout, entry) {
fprintf(cf, "\tMatchLayout \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
@@ -374,56 +374,56 @@ xf86freeInputClassList (XF86ConfInputClassPtr ptr)
TestFree(ptr->identifier);
TestFree(ptr->driver);
- list_for_each_entry_safe(group, next, &ptr->match_product, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_product, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_device, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_device, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_os, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_os, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_tag, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_tag, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_layout, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_layout, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
diff --git a/xorg-server/hw/xfree86/parser/xf86Parser.h b/xorg-server/hw/xfree86/parser/xf86Parser.h
index 7d4662b98..beac35404 100644
--- a/xorg-server/hw/xfree86/parser/xf86Parser.h
+++ b/xorg-server/hw/xfree86/parser/xf86Parser.h
@@ -340,7 +340,7 @@ xf86TriState;
typedef struct
{
- struct list entry;
+ struct xorg_list entry;
char **values;
}
xf86MatchGroup;
@@ -350,15 +350,15 @@ typedef struct
GenericListRec list;
char *identifier;
char *driver;
- struct list match_product;
- struct list match_vendor;
- struct list match_device;
- struct list match_os;
- struct list match_pnpid;
- struct list match_usbid;
- struct list match_driver;
- struct list match_tag;
- struct list match_layout;
+ struct xorg_list match_product;
+ struct xorg_list match_vendor;
+ struct xorg_list match_device;
+ struct xorg_list match_os;
+ struct xorg_list match_pnpid;
+ struct xorg_list match_usbid;
+ struct xorg_list match_driver;
+ struct xorg_list match_tag;
+ struct xorg_list match_layout;
xf86TriState is_keyboard;
xf86TriState is_pointer;
xf86TriState is_joystick;
diff --git a/xorg-server/include/exevents.h b/xorg-server/include/exevents.h
index 31acb30ea..fb2ef274c 100644
--- a/xorg-server/include/exevents.h
+++ b/xorg-server/include/exevents.h
@@ -323,6 +323,13 @@ SendEventToAllWindows(
xEvent * /* ev */,
int /* count */);
+extern void
+TouchRejected(
+ DeviceIntPtr /* sourcedev */,
+ TouchPointInfoPtr /* ti */,
+ XID /* resource */,
+ TouchOwnershipEvent * /* ev */);
+
extern _X_HIDDEN void XI2EventSwap(
xGenericEvent * /* from */,
xGenericEvent * /* to */);
diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h
index fb456175a..b7825a762 100644
--- a/xorg-server/include/input.h
+++ b/xorg-server/include/input.h
@@ -583,6 +583,8 @@ extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs);
enum TouchListenerState{
LISTENER_AWAITING_BEGIN = 0, /**< Waiting for a TouchBegin event */
LISTENER_AWAITING_OWNER, /**< Waiting for a TouchOwnership event */
+ LISTENER_EARLY_ACCEPT, /**< Waiting for ownership, has already
+ accepted */
LISTENER_IS_OWNER, /**< Is the current owner */
LISTENER_HAS_END, /**< Has already received the end event */
};
@@ -613,7 +615,8 @@ extern void TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev);
extern void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource);
extern Bool TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource);
extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level,
- enum TouchListenerType type, enum TouchListenerState state);
+ enum TouchListenerType type, enum TouchListenerState state,
+ WindowPtr window);
extern Bool TouchRemoveListener(TouchPointInfoPtr ti, XID resource);
extern void TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev);
extern Bool TouchEnsureSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
@@ -624,6 +627,8 @@ extern int TouchConvertToPointerEvent(const InternalEvent *ev,
extern int TouchGetPointerEventType(const InternalEvent *ev);
extern void TouchRemovePointerGrab(DeviceIntPtr dev);
extern void TouchListenerGone(XID resource);
+extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
+ uint32_t touchid, Window grab_window, XID *error);
/* misc event helpers */
extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
diff --git a/xorg-server/include/inputstr.h b/xorg-server/include/inputstr.h
index c3297db64..86db811fc 100644
--- a/xorg-server/include/inputstr.h
+++ b/xorg-server/include/inputstr.h
@@ -314,6 +314,7 @@ typedef struct _TouchPointInfo {
enum TouchListenerType type;
enum TouchListenerState state;
enum InputLevel level; /* matters only for emulating touches */
+ WindowPtr window;
} *listeners;
int num_listeners;
int num_grabs; /* number of open grabs on this touch
@@ -622,7 +623,7 @@ extern _X_EXPORT InputInfo inputInfo;
/* for keeping the events for devices grabbed synchronously */
typedef struct _QdEvent *QdEventPtr;
typedef struct _QdEvent {
- struct list next;
+ struct xorg_list next;
DeviceIntPtr device;
ScreenPtr pScreen; /* what screen the pointer was on */
unsigned long months; /* milliseconds is in the event */
@@ -638,7 +639,7 @@ typedef struct _QdEvent {
* replayed and processed as if they would come from the device directly.
*/
typedef struct _EventSyncInfo {
- struct list pending;
+ struct xorg_list pending;
/** The device to replay events for. Only set in AllowEvents(), in which
* case it is set to the device specified in the request. */
diff --git a/xorg-server/include/list.h b/xorg-server/include/list.h
index 6ec2bac53..14c671f37 100644
--- a/xorg-server/include/list.h
+++ b/xorg-server/include/list.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef _LIST_H_
-#define _LIST_H_
+#ifndef _XORG_LIST_H_
+#define _XORG_LIST_H_
/**
* @file Classic doubly-link circular list implementation.
@@ -41,17 +41,17 @@
* }
*
* We need one list head in bar and a list element in all list_of_foos (both are of
- * data type 'struct list').
+ * data type 'struct xorg_list').
*
* struct bar {
* ...
- * struct list list_of_foos;
+ * struct xorg_list list_of_foos;
* ...
* }
*
* struct foo {
* ...
- * struct list entry;
+ * struct xorg_list entry;
* ...
* }
*
@@ -59,74 +59,74 @@
*
* struct bar bar;
* ...
- * list_init(&bar.list_of_foos);
+ * xorg_list_init(&bar.list_of_foos);
*
* Then we create the first element and add it to this list:
*
* struct foo *foo = malloc(...);
* ....
- * list_add(&foo->entry, &bar.list_of_foos);
+ * xorg_list_add(&foo->entry, &bar.list_of_foos);
*
* Repeat the above for each element you want to add to the list. Deleting
* works with the element itself.
- * list_del(&foo->entry);
+ * xorg_list_del(&foo->entry);
* free(foo);
*
- * Note: calling list_del(&bar.list_of_foos) will set bar.list_of_foos to an empty
+ * Note: calling xorg_list_del(&bar.list_of_foos) will set bar.list_of_foos to an empty
* list again.
*
* Looping through the list requires a 'struct foo' as iterator and the
* name of the field the subnodes use.
*
* struct foo *iterator;
- * list_for_each_entry(iterator, &bar.list_of_foos, entry) {
+ * xorg_list_for_each_entry(iterator, &bar.list_of_foos, entry) {
* if (iterator->something == ...)
* ...
* }
*
- * Note: You must not call list_del() on the iterator if you continue the
+ * Note: You must not call xorg_list_del() on the iterator if you continue the
* loop. You need to run the safe for-each loop instead:
*
* struct foo *iterator, *next;
- * list_for_each_entry_safe(iterator, next, &bar.list_of_foos, entry) {
+ * xorg_list_for_each_entry_safe(iterator, next, &bar.list_of_foos, entry) {
* if (...)
- * list_del(&iterator->entry);
+ * xorg_list_del(&iterator->entry);
* }
*
*/
/**
* The linkage struct for list nodes. This struct must be part of your
- * to-be-linked struct. struct list is required for both the head of the
+ * to-be-linked struct. struct xorg_list is required for both the head of the
* list and for each list node.
*
- * Position and name of the struct list field is irrelevant.
+ * Position and name of the struct xorg_list field is irrelevant.
* There are no requirements that elements of a list are of the same type.
- * There are no requirements for a list head, any struct list can be a list
+ * There are no requirements for a list head, any struct xorg_list can be a list
* head.
*/
-struct list {
- struct list *next, *prev;
+struct xorg_list {
+ struct xorg_list *next, *prev;
};
/**
* Initialize the list as an empty list.
*
* Example:
- * list_init(&bar->list_of_foos);
+ * xorg_list_init(&bar->list_of_foos);
*
* @param The list to initialized.
*/
static void
-list_init(struct list *list)
+xorg_list_init(struct xorg_list *list)
{
list->next = list->prev = list;
}
static inline void
-__list_add(struct list *entry,
- struct list *prev,
- struct list *next)
+__xorg_list_add(struct xorg_list *entry,
+ struct xorg_list *prev,
+ struct xorg_list *next)
{
next->prev = entry;
entry->next = next;
@@ -144,15 +144,15 @@ __list_add(struct list *entry,
*
* Example:
* struct foo *newfoo = malloc(...);
- * list_add(&newfoo->entry, &bar->list_of_foos);
+ * xorg_list_add(&newfoo->entry, &bar->list_of_foos);
*
* @param entry The new element to prepend to the list.
* @param head The existing list.
*/
static inline void
-list_add(struct list *entry, struct list *head)
+xorg_list_add(struct xorg_list *entry, struct xorg_list *head)
{
- __list_add(entry, head, head->next);
+ __xorg_list_add(entry, head, head->next);
}
/**
@@ -165,20 +165,20 @@ list_add(struct list *entry, struct list *head)
*
* Example:
* struct foo *newfoo = malloc(...);
- * list_append(&newfoo->entry, &bar->list_of_foos);
+ * xorg_list_append(&newfoo->entry, &bar->list_of_foos);
*
* @param entry The new element to prepend to the list.
* @param head The existing list.
*/
static inline void
-list_append(struct list *entry, struct list *head)
+xorg_list_append(struct xorg_list *entry, struct xorg_list *head)
{
- __list_add(entry, head->prev, head);
+ __xorg_list_add(entry, head->prev, head);
}
static inline void
-__list_del(struct list *prev, struct list *next)
+__xorg_list_del(struct xorg_list *prev, struct xorg_list *next)
{
next->prev = prev;
prev->next = next;
@@ -189,32 +189,32 @@ __list_del(struct list *prev, struct list *next)
* the pointers to/from this element so it is removed from the list. It does
* NOT free the element itself or manipulate it otherwise.
*
- * Using list_del on a pure list head (like in the example at the top of
+ * Using xorg_list_del on a pure list head (like in the example at the top of
* this file) will NOT remove the first element from
* the list but rather reset the list as empty list.
*
* Example:
- * list_del(&foo->entry);
+ * xorg_list_del(&foo->entry);
*
* @param entry The element to remove.
*/
static inline void
-list_del(struct list *entry)
+xorg_list_del(struct xorg_list *entry)
{
- __list_del(entry->prev, entry->next);
- list_init(entry);
+ __xorg_list_del(entry->prev, entry->next);
+ xorg_list_init(entry);
}
/**
* Check if the list is empty.
*
* Example:
- * list_is_empty(&bar->list_of_foos);
+ * xorg_list_is_empty(&bar->list_of_foos);
*
* @return True if the list contains one or more elements or False otherwise.
*/
static inline Bool
-list_is_empty(struct list *head)
+xorg_list_is_empty(struct xorg_list *head)
{
return head->next == head;
}
@@ -227,9 +227,9 @@ list_is_empty(struct list *head)
* f = container_of(&foo->entry, struct foo, entry);
* assert(f == foo);
*
- * @param ptr Pointer to the struct list.
+ * @param ptr Pointer to the struct xorg_list.
* @param type Data type of the list element.
- * @param member Member name of the struct list field in the list element.
+ * @param member Member name of the struct xorg_list field in the list element.
* @return A pointer to the data struct containing the list head.
*/
#ifndef container_of
@@ -240,7 +240,7 @@ list_is_empty(struct list *head)
/**
* Alias of container_of
*/
-#define list_entry(ptr, type, member) \
+#define xorg_list_entry(ptr, type, member) \
container_of(ptr, type, member)
/**
@@ -248,30 +248,30 @@ list_is_empty(struct list *head)
*
* Example:
* struct foo *first;
- * first = list_first_entry(&bar->list_of_foos, struct foo, list_of_foos);
+ * first = xorg_list_first_entry(&bar->list_of_foos, struct foo, list_of_foos);
*
* @param ptr The list head
* @param type Data type of the list element to retrieve
- * @param member Member name of the struct list field in the list element.
+ * @param member Member name of the struct xorg_list field in the list element.
* @return A pointer to the first list element.
*/
-#define list_first_entry(ptr, type, member) \
- list_entry((ptr)->next, type, member)
+#define xorg_list_first_entry(ptr, type, member) \
+ xorg_list_entry((ptr)->next, type, member)
/**
* Retrieve the last list entry for the given listpointer.
*
* Example:
* struct foo *first;
- * first = list_last_entry(&bar->list_of_foos, struct foo, list_of_foos);
+ * first = xorg_list_last_entry(&bar->list_of_foos, struct foo, list_of_foos);
*
* @param ptr The list head
* @param type Data type of the list element to retrieve
- * @param member Member name of the struct list field in the list element.
+ * @param member Member name of the struct xorg_list field in the list element.
* @return A pointer to the last list element.
*/
-#define list_last_entry(ptr, type, member) \
- list_entry((ptr)->prev, type, member)
+#define xorg_list_last_entry(ptr, type, member) \
+ xorg_list_entry((ptr)->prev, type, member)
#define __container_of(ptr, sample, member) \
(void *)((char *)(ptr) \
@@ -281,19 +281,19 @@ list_is_empty(struct list *head)
*
* Example:
* struct foo *iterator;
- * list_for_each_entry(iterator, &bar->list_of_foos, entry) {
+ * xorg_list_for_each_entry(iterator, &bar->list_of_foos, entry) {
* [modify iterator]
* }
*
- * This macro is not safe for node deletion. Use list_for_each_entry_safe
+ * This macro is not safe for node deletion. Use xorg_list_for_each_entry_safe
* instead.
*
* @param pos Iterator variable of the type of the list elements.
* @param head List head
- * @param member Member name of the struct list in the list elements.
+ * @param member Member name of the struct xorg_list in the list elements.
*
*/
-#define list_for_each_entry(pos, head, member) \
+#define xorg_list_for_each_entry(pos, head, member) \
for (pos = __container_of((head)->next, pos, member); \
&pos->member != (head); \
pos = __container_of(pos->member.next, pos, member))
@@ -303,9 +303,9 @@ list_is_empty(struct list *head)
* macro allows for the deletion of a list element while looping through the
* list.
*
- * See list_for_each_entry for more details.
+ * See xorg_list_for_each_entry for more details.
*/
-#define list_for_each_entry_safe(pos, tmp, head, member) \
+#define xorg_list_for_each_entry_safe(pos, tmp, head, member) \
for (pos = __container_of((head)->next, pos, member), \
tmp = __container_of(pos->member.next, pos, member); \
&pos->member != (head); \
@@ -315,9 +315,9 @@ list_is_empty(struct list *head)
/* NULL-Terminated List Interface
*
- * The interface below does _not_ use the struct list as described above.
+ * The interface below does _not_ use the struct xorg_list as described above.
* It is mainly for legacy structures that cannot easily be switched to
- * struct list.
+ * struct xorg_list.
*
* This interface is for structs like
* struct foo {
@@ -349,7 +349,7 @@ list_is_empty(struct list *head)
* struct foo *element = list;
* while ((element = nt_list_next(element, next)) { }
*
- * This macro is not safe for node deletion. Use list_for_each_entry_safe
+ * This macro is not safe for node deletion. Use xorg_list_for_each_entry_safe
* instead.
*
* @param list The list or current element.
diff --git a/xorg-server/test/input.c b/xorg-server/test/input.c
index 576cd8531..e0291417f 100644
--- a/xorg-server/test/input.c
+++ b/xorg-server/test/input.c
@@ -1714,7 +1714,7 @@ dix_enqueue_events(void) {
spriteInfo.sprite = &sprite;
InitEvents();
- assert(list_is_empty(&syncEvents.pending));
+ assert(xorg_list_is_empty(&syncEvents.pending));
/* this way PlayReleasedEvents really runs through all events in the
* queue */
@@ -1728,22 +1728,22 @@ dix_enqueue_events(void) {
ev[i].any.length = sizeof(*ev);
ev[i].any.type = i;
EnqueueEvent(&ev[i], &dev);
- assert(!list_is_empty(&syncEvents.pending));
- qe = list_last_entry(&syncEvents.pending, QdEventRec, next);
+ assert(!xorg_list_is_empty(&syncEvents.pending));
+ qe = xorg_list_last_entry(&syncEvents.pending, QdEventRec, next);
assert(memcmp(qe->event, &ev[i], ev[i].any.length) == 0);
- qe = list_first_entry(&syncEvents.pending, QdEventRec, next);
+ qe = xorg_list_first_entry(&syncEvents.pending, QdEventRec, next);
assert(memcmp(qe->event, &ev[0], ev[i].any.length) == 0);
}
/* calls process_input_proc */
dev.deviceGrab.sync.frozen = 1;
PlayReleasedEvents();
- assert(!list_is_empty(&syncEvents.pending));
+ assert(!xorg_list_is_empty(&syncEvents.pending));
dev.deviceGrab.sync.frozen = 0;
PlayReleasedEvents();
- assert(list_is_empty(&syncEvents.pending));
+ assert(xorg_list_is_empty(&syncEvents.pending));
inputInfo.devices = NULL;
}
diff --git a/xorg-server/test/list.c b/xorg-server/test/list.c
index ffb85efd0..14bc74a08 100644
--- a/xorg-server/test/list.c
+++ b/xorg-server/test/list.c
@@ -33,18 +33,18 @@
struct parent {
int a;
- struct list children;
+ struct xorg_list children;
int b;
};
struct child {
int foo;
int bar;
- struct list node;
+ struct xorg_list node;
};
static void
-test_list_init(void)
+test_xorg_list_init(void)
{
struct parent parent, tmp;
@@ -54,146 +54,146 @@ test_list_init(void)
tmp = parent;
- list_init(&parent.children);
+ xorg_list_init(&parent.children);
/* test we haven't touched anything else. */
assert(parent.a == tmp.a);
assert(parent.b == tmp.b);
- assert(list_is_empty(&parent.children));
+ assert(xorg_list_is_empty(&parent.children));
}
static void
-test_list_add(void)
+test_xorg_list_add(void)
{
struct parent parent = {0};
struct child child[3];
struct child *c;
- list_init(&parent.children);
+ xorg_list_init(&parent.children);
- list_add(&child[0].node, &parent.children);
- assert(!list_is_empty(&parent.children));
+ xorg_list_add(&child[0].node, &parent.children);
+ assert(!xorg_list_is_empty(&parent.children));
- c = list_first_entry(&parent.children, struct child, node);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
- /* note: list_add prepends */
- list_add(&child[1].node, &parent.children);
- c = list_first_entry(&parent.children, struct child, node);
+ /* note: xorg_list_add prepends */
+ xorg_list_add(&child[1].node, &parent.children);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
- list_add(&child[2].node, &parent.children);
- c = list_first_entry(&parent.children, struct child, node);
+ xorg_list_add(&child[2].node, &parent.children);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[2], sizeof(struct child)) == 0);
};
static void
-test_list_append(void)
+test_xorg_list_append(void)
{
struct parent parent = {0};
struct child child[3];
struct child *c;
int i;
- list_init(&parent.children);
+ xorg_list_init(&parent.children);
- list_append(&child[0].node, &parent.children);
- assert(!list_is_empty(&parent.children));
+ xorg_list_append(&child[0].node, &parent.children);
+ assert(!xorg_list_is_empty(&parent.children));
- c = list_first_entry(&parent.children, struct child, node);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
- c = list_last_entry(&parent.children, struct child, node);
+ c = xorg_list_last_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
- list_append(&child[1].node, &parent.children);
- c = list_first_entry(&parent.children, struct child, node);
+ xorg_list_append(&child[1].node, &parent.children);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
- c = list_last_entry(&parent.children, struct child, node);
+ c = xorg_list_last_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
- list_append(&child[2].node, &parent.children);
- c = list_first_entry(&parent.children, struct child, node);
+ xorg_list_append(&child[2].node, &parent.children);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
- c = list_last_entry(&parent.children, struct child, node);
+ c = xorg_list_last_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[2], sizeof(struct child)) == 0);
i = 0;
- list_for_each_entry(c, &parent.children, node) {
+ xorg_list_for_each_entry(c, &parent.children, node) {
assert(memcmp(c, &child[i++], sizeof(struct child)) == 0);
}
};
static void
-test_list_del(void)
+test_xorg_list_del(void)
{
struct parent parent = {0};
struct child child[3];
struct child *c;
- list_init(&parent.children);
+ xorg_list_init(&parent.children);
- list_add(&child[0].node, &parent.children);
- assert(!list_is_empty(&parent.children));
+ xorg_list_add(&child[0].node, &parent.children);
+ assert(!xorg_list_is_empty(&parent.children));
- list_del(&parent.children);
- assert(list_is_empty(&parent.children));
+ xorg_list_del(&parent.children);
+ assert(xorg_list_is_empty(&parent.children));
- list_add(&child[0].node, &parent.children);
- list_del(&child[0].node);
- assert(list_is_empty(&parent.children));
+ xorg_list_add(&child[0].node, &parent.children);
+ xorg_list_del(&child[0].node);
+ assert(xorg_list_is_empty(&parent.children));
- list_add(&child[0].node, &parent.children);
- list_add(&child[1].node, &parent.children);
+ xorg_list_add(&child[0].node, &parent.children);
+ xorg_list_add(&child[1].node, &parent.children);
- c = list_first_entry(&parent.children, struct child, node);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
/* delete first node */
- list_del(&child[1].node);
- assert(!list_is_empty(&parent.children));
- assert(list_is_empty(&child[1].node));
- c = list_first_entry(&parent.children, struct child, node);
+ xorg_list_del(&child[1].node);
+ assert(!xorg_list_is_empty(&parent.children));
+ assert(xorg_list_is_empty(&child[1].node));
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
/* delete last node */
- list_add(&child[1].node, &parent.children);
- list_del(&child[0].node);
- c = list_first_entry(&parent.children, struct child, node);
+ xorg_list_add(&child[1].node, &parent.children);
+ xorg_list_del(&child[0].node);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
/* delete list head */
- list_add(&child[0].node, &parent.children);
- list_del(&parent.children);
- assert(list_is_empty(&parent.children));
- assert(!list_is_empty(&child[1].node));
- assert(!list_is_empty(&child[2].node));
+ xorg_list_add(&child[0].node, &parent.children);
+ xorg_list_del(&parent.children);
+ assert(xorg_list_is_empty(&parent.children));
+ assert(!xorg_list_is_empty(&child[1].node));
+ assert(!xorg_list_is_empty(&child[2].node));
}
static void
-test_list_for_each(void)
+test_xorg_list_for_each(void)
{
struct parent parent = {0};
struct child child[3];
struct child *c;
int i = 0;
- list_init(&parent.children);
+ xorg_list_init(&parent.children);
- list_add(&child[2].node, &parent.children);
- list_add(&child[1].node, &parent.children);
- list_add(&child[0].node, &parent.children);
+ xorg_list_add(&child[2].node, &parent.children);
+ xorg_list_add(&child[1].node, &parent.children);
+ xorg_list_add(&child[0].node, &parent.children);
- list_for_each_entry(c, &parent.children, node) {
+ xorg_list_for_each_entry(c, &parent.children, node) {
assert(memcmp(c, &child[i], sizeof(struct child)) == 0);
i++;
}
/* foreach on empty list */
- list_del(&parent.children);
- assert(list_is_empty(&parent.children));
+ xorg_list_del(&parent.children);
+ assert(xorg_list_is_empty(&parent.children));
- list_for_each_entry(c, &parent.children, node) {
+ xorg_list_for_each_entry(c, &parent.children, node) {
assert(0); /* we must not get here */
}
}
@@ -359,11 +359,11 @@ test_nt_list_delete(void)
int main(int argc, char** argv)
{
- test_list_init();
- test_list_add();
- test_list_append();
- test_list_del();
- test_list_for_each();
+ test_xorg_list_init();
+ test_xorg_list_add();
+ test_xorg_list_append();
+ test_xorg_list_del();
+ test_xorg_list_for_each();
test_nt_list_init();
test_nt_list_append();
diff --git a/xorg-server/xfixes/cursor.c b/xorg-server/xfixes/cursor.c
index e61135e89..686ed4949 100644
--- a/xorg-server/xfixes/cursor.c
+++ b/xorg-server/xfixes/cursor.c
@@ -118,7 +118,7 @@ typedef struct PointerBarrierClient *PointerBarrierClientPtr;
struct PointerBarrierClient {
ScreenPtr screen;
struct PointerBarrier barrier;
- struct list entry;
+ struct xorg_list entry;
};
/*
@@ -130,7 +130,7 @@ typedef struct _CursorScreen {
CloseScreenProcPtr CloseScreen;
ConstrainCursorHarderProcPtr ConstrainCursorHarder;
CursorHideCountPtr pCursorHideCounts;
- struct list barriers;
+ struct xorg_list barriers;
} CursorScreenRec, *CursorScreenPtr;
#define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey))
@@ -1174,7 +1174,7 @@ barrier_find_nearest(CursorScreenPtr cs, int dir,
struct PointerBarrier *nearest = NULL;
double min_distance = INT_MAX; /* can't get higher than that in X anyway */
- list_for_each_entry(c, &cs->barriers, entry) {
+ xorg_list_for_each_entry(c, &cs->barriers, entry) {
struct PointerBarrier *b = &c->barrier;
double distance;
@@ -1226,7 +1226,7 @@ CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, int *x
{
CursorScreenPtr cs = GetCursorScreen(screen);
- if (!list_is_empty(&cs->barriers) && !IsFloating(dev) && mode == Relative) {
+ if (!xorg_list_is_empty(&cs->barriers) && !IsFloating(dev) && mode == Relative) {
int ox, oy;
int dir;
struct PointerBarrier *nearest = NULL;
@@ -1287,7 +1287,7 @@ CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client,
ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
if (barrier_is_vertical(&ret->barrier))
ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
- list_add(&ret->entry, &cs->barriers);
+ xorg_list_add(&ret->entry, &cs->barriers);
}
return ret;
@@ -1366,9 +1366,9 @@ CursorFreeBarrier(void *data, XID id)
cs = GetCursorScreen(screen);
/* find and unlink from the screen private */
- list_for_each_entry(b, &cs->barriers, entry) {
+ xorg_list_for_each_entry(b, &cs->barriers, entry) {
if (b == barrier) {
- list_del(&b->entry);
+ xorg_list_del(&b->entry);
break;
}
}
@@ -1428,7 +1428,7 @@ XFixesCursorInit (void)
cs = (CursorScreenPtr) calloc(1, sizeof (CursorScreenRec));
if (!cs)
return FALSE;
- list_init(&cs->barriers);
+ xorg_list_init(&cs->barriers);
Wrap (cs, pScreen, CloseScreen, CursorCloseScreen);
Wrap (cs, pScreen, DisplayCursor, CursorDisplayCursor);
Wrap (cs, pScreen, ConstrainCursorHarder, CursorConstrainCursorHarder);