aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-07 12:17:07 +0100
committermarha <marha@users.sourceforge.net>2013-01-07 12:17:07 +0100
commit0e950715b62dcf30ffbf69831bf932fd348537e5 (patch)
tree83fdafc455e9906f029e2e1ad926fb35c98e7be9
parent506537495e6d808f219361a5b270510c752e7a2e (diff)
parent3f553aaceddc9b09363c73d9bea40eaea8164fc4 (diff)
downloadvcxsrv-0e950715b62dcf30ffbf69831bf932fd348537e5.tar.gz
vcxsrv-0e950715b62dcf30ffbf69831bf932fd348537e5.tar.bz2
vcxsrv-0e950715b62dcf30ffbf69831bf932fd348537e5.zip
Merge remote-tracking branch 'origin/released'
* origin/released: pixman xkbcomp libX11 libXau mesa fontconfig xserver xkeyboard-config git update 7 jan 2013 Conflicts: fontconfig/src/fcatomic.c pixman/pixman/pixman-mmx.c pixman/pixman/pixman-sse2.c xorg-server/dix/dispatch.c xorg-server/hw/xwin/wincursor.c xorg-server/hw/xwin/winmsg.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winsetsp.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/xfixes/cursor.c
-rw-r--r--fontconfig/.gitignore100
-rw-r--r--fontconfig/COPYING1
-rw-r--r--fontconfig/Makefile.am13
-rw-r--r--fontconfig/Tools.mk64
-rw-r--r--fontconfig/conf.d/Makefile.am2
-rw-r--r--fontconfig/configure.ac44
-rw-r--r--fontconfig/doc/Makefile.am16
-rw-r--r--fontconfig/doc/fcconstant.fncs8
-rw-r--r--fontconfig/doc/fcobjecttype.fncs6
-rw-r--r--fontconfig/doc/fontconfig-user.sgml12
-rw-r--r--fontconfig/fc-cache/Makefile.am2
-rw-r--r--fontconfig/fc-case/Makefile.am53
-rw-r--r--fontconfig/fc-cat/Makefile.am2
-rw-r--r--fontconfig/fc-cat/fc-cat.c10
-rw-r--r--fontconfig/fc-glyphname/Makefile.am48
-rw-r--r--fontconfig/fc-glyphname/fc-glyphname.c48
-rw-r--r--fontconfig/fc-lang/Makefile.am49
-rw-r--r--fontconfig/fc-lang/fc-lang.c19
-rw-r--r--fontconfig/fc-list/Makefile.am2
-rw-r--r--fontconfig/fc-list/fc-list.c5
-rw-r--r--fontconfig/fc-match/Makefile.am2
-rw-r--r--fontconfig/fc-match/fc-match.c5
-rw-r--r--fontconfig/fc-pattern/Makefile.am2
-rw-r--r--fontconfig/fc-pattern/fc-pattern.c5
-rw-r--r--fontconfig/fc-query/Makefile.am2
-rw-r--r--fontconfig/fc-query/fc-query.c10
-rw-r--r--fontconfig/fc-scan/Makefile.am2
-rw-r--r--fontconfig/fc-scan/fc-scan.c6
-rw-r--r--fontconfig/fontconfig/Makefile.am2
-rw-r--r--fontconfig/fontconfig/fontconfig.h18
-rw-r--r--fontconfig/fonts.dtd5
-rw-r--r--fontconfig/git.mk227
-rw-r--r--fontconfig/m4/ax_cc_for_build.m477
-rw-r--r--fontconfig/m4/ax_pthread.m4309
-rw-r--r--fontconfig/src/Makefile.am42
-rw-r--r--fontconfig/src/fcarch.c11
-rwxr-xr-x[-rw-r--r--]fontconfig/src/fcatomic.c8
-rw-r--r--fontconfig/src/fcatomic.h121
-rw-r--r--fontconfig/src/fcblanks.c8
-rw-r--r--fontconfig/src/fccache.c154
-rw-r--r--fontconfig/src/fccfg.c285
-rw-r--r--fontconfig/src/fccharset.c64
-rw-r--r--fontconfig/src/fcdbg.c75
-rw-r--r--fontconfig/src/fcdefault.c91
-rw-r--r--fontconfig/src/fcdir.c6
-rw-r--r--fontconfig/src/fcformat.c15
-rw-r--r--fontconfig/src/fcfreetype.c12
-rw-r--r--fontconfig/src/fcfs.c8
-rw-r--r--fontconfig/src/fcinit.c134
-rw-r--r--fontconfig/src/fcint.h209
-rw-r--r--fontconfig/src/fclang.c66
-rw-r--r--fontconfig/src/fclist.c16
-rw-r--r--fontconfig/src/fcmatch.c27
-rw-r--r--fontconfig/src/fcmatrix.c4
-rw-r--r--fontconfig/src/fcmutex.h127
-rw-r--r--fontconfig/src/fcname.c426
-rw-r--r--fontconfig/src/fcobjs.c139
-rw-r--r--fontconfig/src/fcobjs.h44
-rw-r--r--fontconfig/src/fcobjshash.gperf.h26
-rw-r--r--fontconfig/src/fcpat.c150
-rw-r--r--fontconfig/src/fcserialize.c1
-rw-r--r--fontconfig/src/fcstat.c9
-rw-r--r--fontconfig/src/fcstr.c65
-rw-r--r--fontconfig/src/fcwindows.h44
-rwxr-xr-xfontconfig/src/fcxml.c280
-rw-r--r--fontconfig/src/ftglue.c3
-rw-r--r--fontconfig/src/makefile11
-rw-r--r--fontconfig/test/Makefile.am4
-rw-r--r--fontconfig/test/run-test.sh4
-rw-r--r--libX11/src/xcms/Makefile.am5
-rw-r--r--libX11/src/xcms/cmsColNm.c2
-rw-r--r--libXau/AuFileName.c6
-rw-r--r--libXau/AuRead.c4
-rw-r--r--libXau/AuWrite.c4
-rw-r--r--libXau/include/X11/Xauth.h12
-rw-r--r--mesalib/Android.common.mk4
-rw-r--r--mesalib/Android.mk5
-rw-r--r--mesalib/bin/.gitignore1
-rw-r--r--mesalib/configure.ac26
-rw-r--r--mesalib/include/EGL/eglext.h72
-rw-r--r--mesalib/src/.gitignore2
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c168
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.h26
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_dump_state.c9
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format_zs.c2
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_inlines.h18
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_surface.c55
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_surface.h6
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_tile.c38
-rw-r--r--mesalib/src/glsl/glcpp/Makefile.am1
-rw-r--r--mesalib/src/glsl/ir_uniform.h4
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c3
-rw-r--r--mesalib/src/mesa/main/api_validate.c94
-rw-r--r--mesalib/src/mesa/main/arrayobj.c8
-rw-r--r--mesalib/src/mesa/main/buffers.c4
-rw-r--r--mesalib/src/mesa/main/fbobject.c44
-rw-r--r--mesalib/src/mesa/main/get.c3
-rw-r--r--mesalib/src/mesa/main/mtypes.h27
-rw-r--r--mesalib/src/mesa/main/pbo.c15
-rw-r--r--mesalib/src/mesa/main/pbo.h3
-rw-r--r--mesalib/src/mesa/main/samplerobj.c20
-rw-r--r--mesalib/src/mesa/main/samplerobj.h7
-rw-r--r--mesalib/src/mesa/main/shaderapi.c8
-rw-r--r--mesalib/src/mesa/main/texcompress.c4
-rw-r--r--mesalib/src/mesa/main/texcompress_rgtc.c5
-rw-r--r--mesalib/src/mesa/main/texcompress_s3tc.c82
-rw-r--r--mesalib/src/mesa/main/texgetimage.c2
-rw-r--r--mesalib/src/mesa/main/teximage.c16
-rw-r--r--mesalib/src/mesa/main/texstore.c58
-rw-r--r--mesalib/src/mesa/main/transformfeedback.c135
-rw-r--r--mesalib/src/mesa/main/transformfeedback.h14
-rw-r--r--mesalib/src/mesa/main/uniform_query.cpp26
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_array.c7
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_flush.c11
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_flush.h3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_queryobj.c85
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_queryobj.h4
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_syncobj.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c256
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h1
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c11
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.c11
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.h8
-rw-r--r--mesalib/src/mesa/vbo/vbo.h3
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec.c34
-rw-r--r--pixman/configure.ac2
-rw-r--r--pixman/pixman/pixman-bits-image.c2
-rw-r--r--pixman/pixman/pixman-combine-float.c28
-rw-r--r--pixman/pixman/pixman-combine32.h47
-rw-r--r--pixman/pixman/pixman-compiler.h4
-rw-r--r--pixman/pixman/pixman-edge.c1
-rw-r--r--pixman/pixman/pixman-fast-path.c64
-rw-r--r--pixman/pixman/pixman-filter.c10
-rw-r--r--pixman/pixman/pixman-general.c8
-rw-r--r--pixman/pixman/pixman-glyph.c2
-rw-r--r--pixman/pixman/pixman-image.c2
-rw-r--r--pixman/pixman/pixman-implementation.c4
-rw-r--r--pixman/pixman/pixman-inlines.h30
-rwxr-xr-xpixman/pixman/pixman-mmx.c40
-rw-r--r--pixman/pixman/pixman-noop.c20
-rw-r--r--pixman/pixman/pixman-private.h60
-rw-r--r--pixman/pixman/pixman-region.c2
-rw-r--r--pixman/pixman/pixman-solid-fill.c25
-rwxr-xr-x[-rw-r--r--]pixman/pixman/pixman-sse2.c30
-rw-r--r--pixman/pixman/pixman-trap.c7
-rw-r--r--pixman/pixman/pixman.c6
-rw-r--r--pixman/test/lowlevel-blt-bench.c1
-rw-r--r--pixman/test/stress-test.c160
-rw-r--r--xkbcomp/xkbcomp.c3
-rw-r--r--xkbcomp/xkbpath.c3
-rw-r--r--xorg-server/Xext/saver.c2
-rw-r--r--xorg-server/Xi/Makefile.am2
-rw-r--r--xorg-server/Xi/exevents.c47
-rw-r--r--xorg-server/Xi/extinit.c47
-rw-r--r--xorg-server/Xi/gtmotion.c2
-rw-r--r--xorg-server/Xi/makefile1
-rw-r--r--xorg-server/Xi/xibarriers.c916
-rw-r--r--xorg-server/Xi/xibarriers.h48
-rw-r--r--xorg-server/Xi/xichangehierarchy.c16
-rw-r--r--xorg-server/Xi/xiquerydevice.c4
-rw-r--r--xorg-server/configure.ac8
-rw-r--r--xorg-server/dix/colormap.c8
-rw-r--r--xorg-server/dix/devices.c4
-rwxr-xr-xxorg-server/dix/dispatch.c2
-rw-r--r--xorg-server/dix/eventconvert.c45
-rw-r--r--xorg-server/dix/events.c26
-rw-r--r--xorg-server/dix/getevents.c15
-rw-r--r--xorg-server/dix/grabs.c5
-rw-r--r--xorg-server/dix/window.c2
-rw-r--r--xorg-server/exa/exa.c4
-rw-r--r--xorg-server/fb/fbgc.c4
-rw-r--r--xorg-server/glx/glapi.c2
-rw-r--r--xorg-server/glx/glxdri.c2
-rw-r--r--xorg-server/glx/indirect_program.c2
-rw-r--r--xorg-server/glx/indirect_texture_compression.c4
-rw-r--r--xorg-server/glx/renderpixswap.c20
-rw-r--r--xorg-server/glx/singlepix.c18
-rw-r--r--xorg-server/glx/singlepixswap.c18
-rw-r--r--xorg-server/glx/xfont.c2
-rw-r--r--xorg-server/hw/dmx/config/Canvas.c4
-rw-r--r--xorg-server/hw/dmx/dmx_glxvisuals.c4
-rw-r--r--xorg-server/hw/dmx/dmxinit.c2
-rw-r--r--xorg-server/hw/dmx/dmxwindow.c2
-rw-r--r--xorg-server/hw/dmx/examples/xinput.c4
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxcmds.c16
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxcmdsswap.c2
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxscreens.c4
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxsingle.c6
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvendor.c4
-rw-r--r--xorg-server/hw/dmx/glxProxy/renderpixswap.c310
-rw-r--r--xorg-server/hw/kdrive/ephyr/XF86dri.c18
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrdriext.c4
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostglx.c10
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c2
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c4
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrvideo.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86cmap.c2
-rw-r--r--xorg-server/hw/xfree86/dri/xf86dri.c4
-rw-r--r--xorg-server/hw/xfree86/i2c/fi1236.c10
-rw-r--r--xorg-server/hw/xfree86/i2c/tda9850.c2
-rw-r--r--xorg-server/hw/xquartz/GL/visualConfigs.c214
-rw-r--r--xorg-server/hw/xquartz/darwin.c16
-rw-r--r--xorg-server/hw/xquartz/xpr/xprScreen.c5
-rw-r--r--xorg-server/hw/xwin/InitOutput.c2
-rwxr-xr-xxorg-server/hw/xwin/glx/indirect.c4
-rw-r--r--xorg-server/hw/xwin/winclipboardxevents.c6
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/wincursor.c6
-rw-r--r--xorg-server/hw/xwin/winengine.c2
-rw-r--r--xorg-server/hw/xwin/wingc.c4
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/winmsg.c2
-rw-r--r--xorg-server/hw/xwin/winmultiwindowicons.c2
-rw-r--r--xorg-server/hw/xwin/winmultiwindowshape.c2
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwndproc.c2
-rw-r--r--xorg-server/hw/xwin/winpfbdd.c8
-rw-r--r--xorg-server/hw/xwin/winpixmap.c2
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/winscrinit.c2
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/winsetsp.c4
-rw-r--r--xorg-server/hw/xwin/winshaddd.c8
-rw-r--r--xorg-server/hw/xwin/winshadddnl.c10
-rw-r--r--xorg-server/hw/xwin/winshadgdi.c2
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/winwin32rootless.c4
-rw-r--r--xorg-server/hw/xwin/winwin32rootlesswndproc.c6
-rw-r--r--xorg-server/include/dix-config.h.in3
-rw-r--r--xorg-server/include/events.h1
-rw-r--r--xorg-server/include/eventstr.h24
-rw-r--r--xorg-server/include/input.h6
-rw-r--r--xorg-server/include/inputstr.h2
-rw-r--r--xorg-server/mi/mieq.c4
-rw-r--r--xorg-server/mi/miinitext.c9
-rw-r--r--xorg-server/mi/mipointer.c54
-rw-r--r--xorg-server/mi/mipointer.h3
-rw-r--r--xorg-server/os/access.c2
-rwxr-xr-xxorg-server/os/utils.c2
-rw-r--r--xorg-server/os/xdmcp.c12
-rw-r--r--xorg-server/test/fixes.c26
-rw-r--r--xorg-server/test/input.c2
-rw-r--r--xorg-server/test/xi2/protocol-eventconvert.c218
-rw-r--r--xorg-server/test/xi2/protocol-xiquerydevice.c2
-rw-r--r--xorg-server/test/xi2/protocol-xiselectevents.c12
-rwxr-xr-x[-rw-r--r--]xorg-server/xfixes/cursor.c432
-rw-r--r--xorg-server/xfixes/xfixes.h17
-rwxr-xr-xxorg-server/xkb/xkb.c36
-rw-r--r--xorg-server/xkb/xkbout.c2
-rw-r--r--xorg-server/xkeyboard-config/rules/base.o_s.part2
-rw-r--r--xorg-server/xkeyboard-config/rules/base.xml.in4
-rw-r--r--xorg-server/xkeyboard-config/rules/compat/layoutsMapping.lst1
-rw-r--r--xorg-server/xkeyboard-config/symbols/altwin13
-rw-r--r--xorg-server/xkeyboard-config/symbols/cd.in14
-rw-r--r--xorg-server/xkeyboard-config/symbols/gr6
250 files changed, 5626 insertions, 3206 deletions
diff --git a/fontconfig/.gitignore b/fontconfig/.gitignore
deleted file mode 100644
index 32b9e43e6..000000000
--- a/fontconfig/.gitignore
+++ /dev/null
@@ -1,100 +0,0 @@
-tags
-TAGS
-*.exe
-*.tar.gz
-.libs
-.deps
-*.o
-*.lo
-*.la
-*~
-*.orig
-*.rej
-ChangeLog
-ChangeLog-*
-Makefile
-Makefile.in
-aclocal.m4
-autom4te.cache
-config.guess
-config.h
-config.h.in
-config.log
-config.status
-config.sub
-configure
-depcomp
-fontconfig-zip
-fontconfig.pc
-fontconfig.spec
-fonts.conf
-install-sh
-doltcompile
-libtool
-ltmain.sh
-missing
-stamp-h1
-manpage.log
-doc/*.3
-doc/confdir.sgml
-doc/edit-sgml
-doc/fcatomic.sgml
-doc/fcblanks.sgml
-doc/fccache.sgml
-doc/fccharset.sgml
-doc/fcconfig.sgml
-doc/fcconstant.sgml
-doc/fcdircache.sgml
-doc/fcfile.sgml
-doc/fcformat.sgml
-doc/fcfontset.sgml
-doc/fcfreetype.sgml
-doc/fclangset.sgml
-doc/fcinit.sgml
-doc/fcmatrix.sgml
-doc/fcobjectset.sgml
-doc/fcobjecttype.sgml
-doc/fcpattern.sgml
-doc/fcstring.sgml
-doc/fcstrset.sgml
-doc/fcvalue.sgml
-doc/fontconfig-devel.pdf
-doc/fontconfig-devel.txt
-doc/fontconfig-devel
-doc/fontconfig-user.html
-doc/fontconfig-user.pdf
-doc/fontconfig-user.txt
-doc/fonts-conf.5
-doc/func.refs
-doc/local-fontconfig-devel.sgml
-doc/local-fontconfig-user.sgml
-doc/version.sgml
-doc/devel-man
-fc-arch/fc-arch
-fc-arch/fcarch.h
-fc-cache/fc-cache
-fc-cache/fc-cache.1
-fc-case/fc-case
-fc-case/fccase.h
-fc-cat/fc-cat
-fc-cat/fc-cat.1
-fc-glyphname/fc-glyphname
-fc-glyphname/fcglyphname.h
-fc-lang/fc-lang
-fc-lang/fclang.h
-fc-list/fc-list
-fc-list/fc-list.1
-fc-match/fc-match
-fc-match/fc-match.1
-fc-pattern/fc-pattern
-fc-pattern/fc-pattern.1
-fc-query/fc-query
-fc-query/fc-query.1
-fc-scan/fc-scan
-fc-scan/fc-scan.1
-src/fcarch
-src/fontconfig.def
-fcalias.h
-fcaliastail.h
-src/fcftalias.h
-src/fcftaliastail.h
diff --git a/fontconfig/COPYING b/fontconfig/COPYING
index 2a5d777ff..66392b13b 100644
--- a/fontconfig/COPYING
+++ b/fontconfig/COPYING
@@ -5,6 +5,7 @@ Copyright © 2005 Patrick Lam
Copyright © 2009 Roozbeh Pournader
Copyright © 2008,2009 Red Hat, Inc.
Copyright © 2008 Danilo Šegan
+Copyright © 2012 Google, Inc.
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/fontconfig/Makefile.am b/fontconfig/Makefile.am
index f4203d6a2..6aee88a59 100644
--- a/fontconfig/Makefile.am
+++ b/fontconfig/Makefile.am
@@ -21,10 +21,15 @@
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-DOCSRC=@DOCSRC@
SUBDIRS=fontconfig fc-case fc-lang fc-glyphname src \
fc-cache fc-cat fc-list fc-match fc-pattern fc-query fc-scan \
- conf.d $(DOCSRC) test
+ conf.d test
+if ENABLE_DOCS
+SUBDIRS += doc
+DIST_SUBDIRS = $(SUBDIRS)
+else
+DIST_SUBDIRS = $(SUBDIRS) doc
+endif
AUTOMAKE_OPTIONS = dist-bzip2
ACLOCAL_AMFLAGS = -I m4
@@ -148,3 +153,7 @@ debuild-dirs: distdir
$(RM) -r $(distdir).orig
cp -a $(distdir) $(distdir).orig
$(RM) -r $(distdir).orig/debian
+
+DISTCHECK_CONFIGURE_FLAGS =
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/Tools.mk b/fontconfig/Tools.mk
new file mode 100644
index 000000000..56766da0e
--- /dev/null
+++ b/fontconfig/Tools.mk
@@ -0,0 +1,64 @@
+# -*- encoding: utf-8 -*-
+#
+# Copyright © 2003 Keith Packard
+# Copyright © 2013 Google, Inc.
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of the author(s) not be used in
+# advertising or publicity pertaining to distribution of the software without
+# specific, written prior permission. The authors make no
+# representations about the suitability of this software for any purpose. It
+# is provided "as is" without express or implied warranty.
+#
+# THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+# EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+#
+# Google Author(s): Behdad Esfahbod
+
+DIR=fc-$(TAG)
+OUT=fc$(TAG)
+TMPL=$(OUT).tmpl.h
+TARG=$(OUT).h
+TSRC=$(DIR).c
+TOOL=./$(DIR)$(EXEEXT_FOR_BUILD)
+
+EXTRA_DIST = $(TARG) $(TMPL) $(TSRC) $(DIST)
+
+INCLUDES = \
+ -I$(builddir) \
+ -I$(srcdir) \
+ -I$(top_builddir)/src \
+ -I$(top_srcdir)/src \
+ -I$(top_builddir) \
+ -I$(top_srcdir) \
+ -DHAVE_CONFIG_H \
+ $(WARN_CFLAGS)
+
+$(TOOL): $(TSRC) $(ALIAS_FILES)
+ $(AM_V_GEN) $(CC_FOR_BUILD) -o $(TOOL) $< $(INCLUDES)
+
+$(TARG): $(TMPL) $(TSRC) $(DEPS)
+ $(AM_V_GEN) $(MAKE) $(TOOL) && \
+ $(RM) $(TARG) && \
+ $(TOOL) $(ARGS) < $< > $(TARG).tmp && \
+ mv $(TARG).tmp $(TARG) || ( $(RM) $(TARG).tmp && false )
+noinst_HEADERS=$(TARG)
+
+ALIAS_FILES = fcalias.h fcaliastail.h
+
+BUILT_SOURCES = $(ALIAS_FILES)
+
+$(ALIAS_FILES):
+ $(AM_V_GEN) touch $@
+
+CLEANFILES = $(ALIAS_FILES) $(TOOL)
+
+MAINTAINERCLEANFILES = $(TARG)
diff --git a/fontconfig/conf.d/Makefile.am b/fontconfig/conf.d/Makefile.am
index 0f6f59c60..e3a26f081 100644
--- a/fontconfig/conf.d/Makefile.am
+++ b/fontconfig/conf.d/Makefile.am
@@ -92,3 +92,5 @@ uninstall-local:
echo $(RM) $$i; \
$(RM) $$i; \
done)
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/configure.ac b/fontconfig/configure.ac
index 5657bb5d1..4beca08d3 100644
--- a/fontconfig/configure.ac
+++ b/fontconfig/configure.ac
@@ -105,6 +105,8 @@ AC_SUBST(WARN_CFLAGS)
dnl ==========================================================================
+AX_CC_FOR_BUILD()
+AC_ARG_VAR(CC_FOR_BUILD, [build system C compiler])
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = "yes")
@@ -151,7 +153,7 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([[
}
]])],[
AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_POSIX_FADVISE], [1], [Define to 1 if you have the `posix_fadvise' function.])
+ AC_DEFINE([HAVE_POSIX_FADVISE], [1], [Define to 1 if you have the 'posix_fadvise' function.])
],[AC_MSG_RESULT([no])])
CFLAGS="$fc_saved_CFLAGS"
@@ -567,6 +569,42 @@ AC_SUBST(CONFIGDIR)
AC_SUBST(xmldir)
AC_SUBST(XMLDIR)
+
+dnl ===========================================================================
+
+#
+# Thread-safety primitives
+#
+
+AC_CACHE_CHECK([for Intel atomic primitives], fc_cv_have_intel_atomic_primitives, [
+ fc_cv_have_intel_atomic_primitives=false
+ AC_TRY_LINK([
+ void memory_barrier (void) { __sync_synchronize (); }
+ int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
+ int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
+ void mutex_unlock (int *m) { __sync_lock_release (m); }
+ ], [], fc_cv_have_intel_atomic_primitives=true
+ )
+])
+if $fc_cv_have_intel_atomic_primitives; then
+ AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
+fi
+
+AC_CHECK_HEADERS(sched.h)
+AC_CHECK_FUNCS(sched_yield)
+
+have_pthread=false
+if test "$os_win32" = no; then
+ AX_PTHREAD([have_pthread=true])
+fi
+if $have_pthread; then
+ AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
+fi
+AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
+
+
+dnl ===========================================================================
+
#
# Let people not build/install docs if they don't have docbook
#
@@ -596,7 +634,6 @@ AC_ARG_ENABLE(docs,
AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)
if test "x$enable_docs" = xyes; then
- DOCSRC="doc"
tmp=funcs.$$
cat $srcdir/doc/*.fncs | awk '
/^@TITLE@/ { if (!done) { printf ("%s\n", $2); done = 1; } }
@@ -606,11 +643,8 @@ if test "x$enable_docs" = xyes; then
echo DOCMAN3 $DOCMAN3
rm -f $tmp
else
- DOCSRC=""
DOCMAN3=""
fi
-
-AC_SUBST(DOCSRC)
AC_SUBST(DOCMAN3)
diff --git a/fontconfig/doc/Makefile.am b/fontconfig/doc/Makefile.am
index 80674df68..c6b095c85 100644
--- a/fontconfig/doc/Makefile.am
+++ b/fontconfig/doc/Makefile.am
@@ -118,6 +118,7 @@ noinst_PROGRAMS = \
edit_sgml_SOURCES = \
edit-sgml.c \
$(NULL)
+edit_sgml_CC = $(CC_FOR_BUILD)
#
check_SCRIPTS = \
check-missing-doc \
@@ -150,14 +151,9 @@ noinst_PROGRAMS += \
htmldoc_DATA += $(HTML_DIR)/*
##
-if CROSS_COMPILING
-.fncs.sgml:
- @echo Warning: cannot rebuild $@ when cross-compiling
-else
.fncs.sgml:
$(AM_V_GEN) $(RM) $@; \
$(builddir)/edit-sgml$(EXEEXT) $(srcdir)/func.sgml < '$(srcdir)/$*.fncs' > $*.sgml
-endif
.sgml.txt:
$(AM_V_GEN) $(RM) $@; \
$(DOC2TXT) $*.sgml
@@ -203,8 +199,18 @@ all-local: $(BUILT_DOCS) $(HTML_DIR)/*
clean-local:
$(RM) -r $(HTML_DIR) devel-man
[ "x$(builddir)" != "x$(srcdir)" ] && $(RM) $(builddir)/*.sgml || :
+dist-local-check-docs-enabled:
+ @true
else
htmldoc_DATA += $(srcdir)/$(HTML_DIR)/*
all-local:
clean-local:
+dist-local-check-docs-enabled:
+ @echo "*** --enable-man must be used in order to make dist"
+ @false
endif
+
+# force doc rebulid after configure
+dist-hook-local: dist-local-check-docs-enabled
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/doc/fcconstant.fncs b/fontconfig/doc/fcconstant.fncs
index 2ead0a6f0..8f4c87898 100644
--- a/fontconfig/doc/fcconstant.fncs
+++ b/fontconfig/doc/fcconstant.fncs
@@ -27,9 +27,7 @@
@TYPE2@ int% @ARG2@ nconsts
@PURPOSE@ Register symbolic constants
@DESC@
-Register <parameter>nconsts</parameter> new symbolic constants. Returns
-FcFalse if the constants cannot be registered (due to allocation failure).
-Otherwise returns FcTrue.
+Deprecated. Does nothing. Returns FcFalse.
@@
@RET@ FcBool
@@ -38,9 +36,7 @@ Otherwise returns FcTrue.
@TYPE2@ int% @ARG2@ nconsts
@PURPOSE@ Unregister symbolic constants
@DESC@
-Unregister <parameter>nconsts</parameter> symbolic constants. Returns
-FcFalse if the specified constants were not registered. Otherwise returns
-FcTrue.
+Deprecated. Does nothing. Returns FcFalse.
@@
@RET@ const FcConstant *
diff --git a/fontconfig/doc/fcobjecttype.fncs b/fontconfig/doc/fcobjecttype.fncs
index 45f3a31a0..3f976e431 100644
--- a/fontconfig/doc/fcobjecttype.fncs
+++ b/fontconfig/doc/fcobjecttype.fncs
@@ -27,9 +27,7 @@
@TYPE2@ int% @ARG2@ ntype
@PURPOSE@ Register object types
@DESC@
-Register <parameter>ntype</parameter> new object types. Returns FcFalse if
-some of the names cannot be
-registered (due to allocation failure). Otherwise returns FcTrue.
+Deprecated. Does nothing. Returns FcFalse.
@@
@RET@ FcBool
@@ -38,7 +36,7 @@ registered (due to allocation failure). Otherwise returns FcTrue.
@TYPE2@ int% @ARG2@ ntype
@PURPOSE@ Unregister object types
@DESC@
-Unregister <parameter>ntype</parameter> object types. Returns FcTrue.
+Deprecated. Does nothing. Returns FcFalse.
@@
@RET@ const FcObjectType *
diff --git a/fontconfig/doc/fontconfig-user.sgml b/fontconfig/doc/fontconfig-user.sgml
index f7632ea67..c842371ec 100644
--- a/fontconfig/doc/fontconfig-user.sgml
+++ b/fontconfig/doc/fontconfig-user.sgml
@@ -434,8 +434,9 @@ zero for purely fractional values (e.g. use 0.5 instead of .5 and -0.5
instead of -.5).
</para></refsect2>
<refsect2><title><literal>&lt;matrix&gt;</literal></title><para>
-This element holds the four <literal>&lt;double&gt;</literal> elements of an affine
-transformation.
+This element holds four numerical expressions of an affine transformation.
+At their simplest these will be four <literal>&lt;double&gt;</literal> elements
+but they can also be more involved expressions.
</para></refsect2>
<refsect2><title><literal>&lt;range&gt;</literal></title><para>
This element holds the two <literal>&lt;int&gt;</literal> elements of a range
@@ -451,7 +452,12 @@ a RFC-3066-style languages or more.
</para></refsect2>
<refsect2><title><literal>&lt;name&gt;</literal></title><para>
Holds a property name. Evaluates to the first value from the property of
-the font, not the pattern.
+the pattern. If the 'target' attribute is not present, it will default to
+'default', in which case the property is returned from the font pattern
+during a target="font" match, and to the pattern during a target="pattern"
+match. The attribute can also take the values 'font' or 'pattern' to
+explicitly choose which pattern to use. It is an error to use a target
+of 'font' in a match that has target="pattern".
</para></refsect2>
<refsect2><title><literal>&lt;const&gt;</literal></title><para>
Holds the name of a constant; these are always integers and serve as
diff --git a/fontconfig/fc-cache/Makefile.am b/fontconfig/fc-cache/Makefile.am
index 61f5019fb..7f7d1b1a0 100644
--- a/fontconfig/fc-cache/Makefile.am
+++ b/fontconfig/fc-cache/Makefile.am
@@ -65,3 +65,5 @@ CLEANFILES += ${man_MANS}
else
all-local:
endif
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/fc-case/Makefile.am b/fontconfig/fc-case/Makefile.am
index 6fe3a4484..662f771af 100644
--- a/fontconfig/fc-case/Makefile.am
+++ b/fontconfig/fc-case/Makefile.am
@@ -1,8 +1,7 @@
# -*- encoding: utf-8 -*-
#
-# $Id $
-#
-# Copyright © 2003 Keith Packard
+# Copyright © 2003 Keith Packard
+# Copyright © 2013 Google, Inc.
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
@@ -22,47 +21,13 @@
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
+# Google Author(s): Behdad Esfahbod
-INCLUDES=-I${top_builddir}/src -I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS)
-
-TMPL=fccase.tmpl.h
-STMPL=${top_srcdir}/fc-case/${TMPL}
-TARG=fccase.h
-
-noinst_PROGRAMS=fc-case
-
-noinst_HEADERS=$(TARG)
-
-fc_case_SOURCES= \
- fc-case.c
-
-CASEFOLDING=CaseFolding.txt
-SCASEFOLDING=${top_srcdir}/fc-case/CaseFolding.txt
-
-EXTRA_DIST = $(TARG) $(TMPL) $(CASEFOLDING)
-
-if CROSS_COMPILING
-$(TARG): $(STMPL) fc-case.c $(SCASEFOLDING)
- @echo Warning: cannot rebuild $(TARG) when cross-compiling
-else
-## BUILT_SOURCES doesn't effect to 'distcheck'
-## so $(ALIAS_FILES) has to be appeared prior to fc-case$(EXEEXT)
-## to make sure availability.
-$(TARG): $(STMPL) $(ALIAS_FILES) fc-case$(EXEEXT) $(SCASEFOLDING)
- $(AM_V_GEN) $(RM) $(TARG); \
- ./fc-case$(EXEEXT) $(SCASEFOLDING) < $(STMPL) > $(TARG).tmp && \
- mv $(TARG).tmp $(TARG)
-endif
-
-ALIAS_FILES = fcalias.h fcaliastail.h
-
-BUILT_SOURCES = $(ALIAS_FILES)
-
-$(ALIAS_FILES):
- $(AM_V_GEN) touch $@
-
-CLEANFILES = $(ALIAS_FILES)
+TAG=case
+DEPS = $(srcdir)/CaseFolding.txt
+ARGS = $(srcdir)/CaseFolding.txt
+DIST = $(srcdir)/CaseFolding.txt
-DISTCLEANFILES = $(TARG)
+include $(top_srcdir)/Tools.mk
-MAINTAINERCLEANFILES = $(TARG)
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/fc-cat/Makefile.am b/fontconfig/fc-cat/Makefile.am
index 7b52d49b6..b426723ba 100644
--- a/fontconfig/fc-cat/Makefile.am
+++ b/fontconfig/fc-cat/Makefile.am
@@ -56,3 +56,5 @@ CLEANFILES += ${man_MANS}
else
all-local:
endif
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/fc-cat/fc-cat.c b/fontconfig/fc-cat/fc-cat.c
index 72912b798..9a2abb3fa 100644
--- a/fontconfig/fc-cat/fc-cat.c
+++ b/fontconfig/fc-cat/fc-cat.c
@@ -67,17 +67,15 @@ extern int optind, opterr, optopt;
#endif
/*
- * POSIX has broken stdio so that getc must do thread-safe locking,
+ * POSIX has broken stdio so that putc must do thread-safe locking,
* this is a serious performance problem for applications doing large
- * amounts of IO with getc (as is done here). If available, use
- * the getc_unlocked varient instead.
+ * amounts of IO with putc (as is done here). If available, use
+ * the putc_unlocked varient instead.
*/
-#if defined(getc_unlocked) || defined(_IO_getc_unlocked)
-#define GETC(f) getc_unlocked(f)
+#if defined(putc_unlocked) || defined(_IO_putc_unlocked)
#define PUTC(c,f) putc_unlocked(c,f)
#else
-#define GETC(f) getc(f)
#define PUTC(c,f) putc(c,f)
#endif
diff --git a/fontconfig/fc-glyphname/Makefile.am b/fontconfig/fc-glyphname/Makefile.am
index e33b3ba6a..12725674c 100644
--- a/fontconfig/fc-glyphname/Makefile.am
+++ b/fontconfig/fc-glyphname/Makefile.am
@@ -1,8 +1,7 @@
# -*- encoding: utf-8 -*-
#
-# $Id $
-#
-# Copyright © 2003 Keith Packard
+# Copyright © 2003 Keith Packard
+# Copyright © 2013 Google, Inc.
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
@@ -22,42 +21,13 @@
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
+# Google Author(s): Behdad Esfahbod
-INCLUDES=-I${top_builddir}/src -I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS)
-
-TMPL=fcglyphname.tmpl.h
-STMPL=${top_srcdir}/fc-glyphname/${TMPL}
-TARG=fcglyphname.h
-
-noinst_PROGRAMS=fc-glyphname
-
-GLYPHNAME=zapfdingbats.txt
-SGLYPHNAME=${top_srcdir}/fc-glyphname/zapfdingbats.txt
-
-EXTRA_DIST = $(TARG) $(TMPL) $(GLYPHNAME)
-
-if CROSS_COMPILING
-$(TARG): $(STMPL) fc-glyphname.c $(SGLYPHNAME)
- @echo Warning: cannot rebuild $(TARG) when cross-compiling
-else
-## BUILT_SOURCES doesn't effect to 'distcheck'
-## so $(ALIAS_FILES) has to be appeared prior to fc-glyphname$(EXEEXT)
-## to make sure availability.
-$(TARG): $(STMPL) $(ALIAS_FILES) fc-glyphname$(EXEEXT) $(SGLYPHNAME)
- $(AM_V_GEN) $(RM) $(TARG); \
- ./fc-glyphname$(EXEEXT) $(SGLYPHNAME) < $(STMPL) > $(TARG).tmp && \
- mv $(TARG).tmp $(TARG)
-endif
-
-ALIAS_FILES = fcalias.h fcaliastail.h
-
-BUILT_SOURCES = $(ALIAS_FILES)
-
-$(ALIAS_FILES):
- $(AM_V_GEN) touch $@
-
-CLEANFILES = $(ALIAS_FILES)
+TAG = glyphname
+DEPS = $(srcdir)/zapfdingbats.txt
+ARGS = $(srcdir)/zapfdingbats.txt
+DIST = $(srcdir)/zapfdingbats.txt
-DISTCLEANFILES = $(TARG)
+include $(top_srcdir)/Tools.mk
-MAINTAINERCLEANFILES = $(TARG)
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/fc-glyphname/fc-glyphname.c b/fontconfig/fc-glyphname/fc-glyphname.c
index b790d986f..840278164 100644
--- a/fontconfig/fc-glyphname/fc-glyphname.c
+++ b/fontconfig/fc-glyphname/fc-glyphname.c
@@ -58,12 +58,12 @@ FcAllocGlyphName (FcChar32 ucs, FcChar8 *name)
return gn;
}
-static void
+static void
fatal (const char *file, int lineno, const char *msg)
{
if (lineno)
fprintf (stderr, "%s:%d: %s\n", file, lineno, msg);
- else
+ else
fprintf (stderr, "%s: %s\n", file, msg);
exit (1);
@@ -100,7 +100,7 @@ scan (FILE *f, char *filename)
FcGlyphName *gn;
int lineno = 0;
int len;
-
+
while (fgets (buf, sizeof (buf), f))
{
lineno++;
@@ -177,7 +177,7 @@ find_hash (void)
int h;
h = nraw + nraw / 4;
- if ((h & 1) == 0)
+ if ((h & 1) == 0)
h++;
while (!isprime(h-2) || !isprime(h))
h += 2;
@@ -201,12 +201,12 @@ FcHashGlyphName (const FcChar8 *name)
static void
insert (FcGlyphName *gn, FcGlyphName **table, FcChar32 h)
{
- int i, r = 0;
+ unsigned int i, r = 0;
i = (int) (h % hash);
while (table[i])
{
- if (!r) r = (int) (h % rehash + 1);
+ if (!r) r = (h % rehash + 1);
i += r;
if (i >= hash)
i -= hash;
@@ -217,8 +217,8 @@ insert (FcGlyphName *gn, FcGlyphName **table, FcChar32 h)
static void
dump (FcGlyphName * const *table, const char *name)
{
- int i;
-
+ unsigned int i;
+
printf ("static const FcGlyphId %s[%d] = {\n", name, hash);
for (i = 0; i < hash; i++)
@@ -226,19 +226,19 @@ dump (FcGlyphName * const *table, const char *name)
printf (" %d,\n", rawindex(table[i]));
else
printf (" -1,\n");
-
+
printf ("};\n");
}
int
-main (int argc, char **argv)
+main (int argc FC_UNUSED, char **argv)
{
char *files[MAX_GLYPHFILE];
char line[1024];
FILE *f;
int i;
- char *type;
-
+ const char *type;
+
i = 0;
while (argv[i+1])
{
@@ -249,7 +249,7 @@ main (int argc, char **argv)
}
files[i] = 0;
qsort (files, i, sizeof (char *), compare_string);
- for (i = 0; files[i]; i++)
+ for (i = 0; files[i]; i++)
{
f = fopen (files[i], "r");
if (!f)
@@ -260,27 +260,27 @@ main (int argc, char **argv)
qsort (raw, nraw, sizeof (FcGlyphName *), compare_glyphname);
find_hash ();
-
+
for (i = 0; i < nraw; i++)
{
insert (raw[i], name_to_ucs, FcHashGlyphName (raw[i]->name));
insert (raw[i], ucs_to_name, raw[i]->ucs);
}
-
+
/*
* Scan the input until the marker is found
*/
-
+
while (fgets (line, sizeof (line), stdin))
{
if (!strncmp (line, "@@@", 3))
break;
fputs (line, stdout);
}
-
+
printf ("/* %d glyphnames in %d entries, %d%% occupancy */\n\n",
nraw, hash, nraw * 100 / hash);
-
+
printf ("#define FC_GLYPHNAME_HASH %u\n", hash);
printf ("#define FC_GLYPHNAME_REHASH %u\n", rehash);
printf ("#define FC_GLYPHNAME_MAXLEN %d\n\n", max_name_len);
@@ -290,16 +290,16 @@ main (int argc, char **argv)
type = "int16_t";
else
type = "int32_t";
-
+
printf ("typedef %s FcGlyphId;\n\n", type);
-
+
/*
* Dump out entries
*/
-
+
printf ("static const struct { const FcChar32 ucs; const FcChar8 name[%d]; } _fc_glyph_names[%d] = {\n",
max_name_len + 1, nraw);
-
+
for (i = 0; i < nraw; i++)
printf (" { 0x%lx, \"%s\" },\n",
(unsigned long) raw[i]->ucs, raw[i]->name);
@@ -311,7 +311,7 @@ main (int argc, char **argv)
*/
dump (name_to_ucs, "_fc_name_to_ucs");
-
+
/*
* Dump out ucs_to_name table
*/
@@ -319,7 +319,7 @@ main (int argc, char **argv)
while (fgets (line, sizeof (line), stdin))
fputs (line, stdout);
-
+
fflush (stdout);
exit (ferror (stdout));
}
diff --git a/fontconfig/fc-lang/Makefile.am b/fontconfig/fc-lang/Makefile.am
index 3336511bf..2340de4a6 100644
--- a/fontconfig/fc-lang/Makefile.am
+++ b/fontconfig/fc-lang/Makefile.am
@@ -1,8 +1,7 @@
# -*- encoding: utf-8 -*-
#
-# $Id $
-#
-# Copyright © 2003 Keith Packard
+# Copyright © 2003 Keith Packard
+# Copyright © 2013 Google, Inc.
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
@@ -22,44 +21,14 @@
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
+# Google Author(s): Behdad Esfahbod
-INCLUDES=-I${top_builddir}/src -I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS)
-
-TMPL=fclang.tmpl.h
-STMPL=${top_srcdir}/fc-lang/fclang.tmpl.h
-TARG=fclang.h
-
-noinst_PROGRAMS=fc-lang
-
-noinst_MANS=fc-lang.man
-
-EXTRA_DIST = $(TARG) $(TMPL) $(ORTH)
-
-if CROSS_COMPILING
-$(TARG):$(ORTH) fc-lang.c $(STMPL)
- @echo Warning: cannot rebuild $(TARG) when cross-compiling
-else
-## BUILT_SOURCES doesn't effect to 'distcheck'
-## so $(ALIAS_FILES) has to be appeared prior to fc-lang$(EXEEXT)
-## to make sure availability.
-$(TARG):$(ORTH) $(ALIAS_FILES) fc-lang${EXEEXT} $(STMPL)
- $(AM_V_GEN) $(RM) $(TARG); \
- ./fc-lang${EXEEXT} -d ${srcdir} $(ORTH) < $(STMPL) > $(TARG).tmp && \
- mv $(TARG).tmp $(TARG)
-endif
+TAG = lang
+DEPS = $(ORTH)
+ARGS = -d $(srcdir) $(ORTH)
+DIST = $(ORTH)
-ALIAS_FILES = fcalias.h fcaliastail.h
-
-BUILT_SOURCES = $(ALIAS_FILES)
-
-$(ALIAS_FILES):
- $(AM_V_GEN) touch $@
-
-CLEANFILES = $(ALIAS_FILES)
-
-DISTCLEANFILES = $(TARG)
-
-MAINTAINERCLEANFILES = $(TARG)
+include $(top_srcdir)/Tools.mk
# NOTE:
#
@@ -312,3 +281,5 @@ ORTH = \
doi.orth \
mni.orth
# ^-------------- Add new orth files here
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/fc-lang/fc-lang.c b/fontconfig/fc-lang/fc-lang.c
index 93200c4e0..0f4217f78 100644
--- a/fontconfig/fc-lang/fc-lang.c
+++ b/fontconfig/fc-lang/fc-lang.c
@@ -37,28 +37,18 @@
* functions are also needed in slightly modified form
*/
-void
-FcMemAlloc (int kind, int size)
-{
-}
-
-void
-FcMemFree (int kind, int size)
-{
-}
-
FcPrivate void
-FcCacheObjectReference (void *object)
+FcCacheObjectReference (void *object FC_UNUSED)
{
}
FcPrivate void
-FcCacheObjectDereference (void *object)
+FcCacheObjectDereference (void *object FC_UNUSED)
{
}
FcPrivate FcChar8 *
-FcLangNormalize (const FcChar8 *lang)
+FcLangNormalize (const FcChar8 *lang FC_UNUSED)
{
return NULL;
}
@@ -260,10 +250,9 @@ static int compare (const void *a, const void *b)
#define MAX_LANG_SET_MAP ((MAX_LANG + 31) / 32)
#define BitSet(map, i) ((map)[(entries[i].id)>>5] |= ((FcChar32) 1 << ((entries[i].id) & 0x1f)))
-#define BitGet(map, i) ((map)[(entries[i].id)>>5] >> ((entries[i].id) & 0x1f)) & 1)
int
-main (int argc, char **argv)
+main (int argc FC_UNUSED, char **argv)
{
static Entry entries[MAX_LANG];
static FcCharSet *sets[MAX_LANG];
diff --git a/fontconfig/fc-list/Makefile.am b/fontconfig/fc-list/Makefile.am
index 8b1356817..b2c499d23 100644
--- a/fontconfig/fc-list/Makefile.am
+++ b/fontconfig/fc-list/Makefile.am
@@ -56,3 +56,5 @@ CLEANFILES += ${man_MANS}
else
all-local:
endif
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/fc-list/fc-list.c b/fontconfig/fc-list/fc-list.c
index eb7b688c5..5ad133317 100644
--- a/fontconfig/fc-list/fc-list.c
+++ b/fontconfig/fc-list/fc-list.c
@@ -136,11 +136,6 @@ main (int argc, char **argv)
i = 1;
#endif
- if (!FcInit ())
- {
- fprintf (stderr, "Can't init font config library\n");
- return 1;
- }
if (argv[i])
{
pat = FcNameParse ((FcChar8 *) argv[i]);
diff --git a/fontconfig/fc-match/Makefile.am b/fontconfig/fc-match/Makefile.am
index 4066c9e38..0e9e8fd0e 100644
--- a/fontconfig/fc-match/Makefile.am
+++ b/fontconfig/fc-match/Makefile.am
@@ -56,3 +56,5 @@ CLEANFILES += ${man_MANS}
else
all-local:
endif
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/fc-match/fc-match.c b/fontconfig/fc-match/fc-match.c
index 8ae8ee9cd..260f4043c 100644
--- a/fontconfig/fc-match/fc-match.c
+++ b/fontconfig/fc-match/fc-match.c
@@ -143,11 +143,6 @@ main (int argc, char **argv)
i = 1;
#endif
- if (!FcInit ())
- {
- fprintf (stderr, "Can't init font config library\n");
- return 1;
- }
if (argv[i])
{
pat = FcNameParse ((FcChar8 *) argv[i]);
diff --git a/fontconfig/fc-pattern/Makefile.am b/fontconfig/fc-pattern/Makefile.am
index c97db12a9..92b043398 100644
--- a/fontconfig/fc-pattern/Makefile.am
+++ b/fontconfig/fc-pattern/Makefile.am
@@ -56,3 +56,5 @@ CLEANFILES += ${man_MANS}
else
all-local:
endif
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/fc-pattern/fc-pattern.c b/fontconfig/fc-pattern/fc-pattern.c
index 84eb1eea1..3f066c1e3 100644
--- a/fontconfig/fc-pattern/fc-pattern.c
+++ b/fontconfig/fc-pattern/fc-pattern.c
@@ -134,11 +134,6 @@ main (int argc, char **argv)
i = 1;
#endif
- if (!FcInit ())
- {
- fprintf (stderr, "Can't init font config library\n");
- return 1;
- }
if (argv[i])
{
pat = FcNameParse ((FcChar8 *) argv[i]);
diff --git a/fontconfig/fc-query/Makefile.am b/fontconfig/fc-query/Makefile.am
index 4271252e4..b3ea1e61d 100644
--- a/fontconfig/fc-query/Makefile.am
+++ b/fontconfig/fc-query/Makefile.am
@@ -56,3 +56,5 @@ CLEANFILES += ${man_MANS}
else
all-local:
endif
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/fc-query/fc-query.c b/fontconfig/fc-query/fc-query.c
index 2ed18a2c3..883e3031e 100644
--- a/fontconfig/fc-query/fc-query.c
+++ b/fontconfig/fc-query/fc-query.c
@@ -136,14 +136,6 @@ main (int argc, char **argv)
if (i == argc)
usage (argv[0], 1);
- if (!FcInit ())
- {
- fprintf (stderr, "Can't init font config library\n");
- return 1;
- }
-
- blanks = FcConfigGetBlanks (NULL);
-
for (; i < argc; i++)
{
int index;
@@ -154,7 +146,7 @@ main (int argc, char **argv)
do {
FcPattern *pat;
- pat = FcFreeTypeQuery ((FcChar8 *) argv[i], index, blanks, &count);
+ pat = FcFreeTypeQuery ((FcChar8 *) argv[i], index, NULL, &count);
if (pat)
{
if (format)
diff --git a/fontconfig/fc-scan/Makefile.am b/fontconfig/fc-scan/Makefile.am
index 22136b16b..206340506 100644
--- a/fontconfig/fc-scan/Makefile.am
+++ b/fontconfig/fc-scan/Makefile.am
@@ -56,3 +56,5 @@ CLEANFILES += ${man_MANS}
else
all-local:
endif
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/fc-scan/fc-scan.c b/fontconfig/fc-scan/fc-scan.c
index c852e0d95..5638b51cf 100644
--- a/fontconfig/fc-scan/fc-scan.c
+++ b/fontconfig/fc-scan/fc-scan.c
@@ -126,12 +126,6 @@ main (int argc, char **argv)
if (i == argc)
usage (argv[0], 1);
- if (!FcInit ())
- {
- fprintf (stderr, "Can't init font config library\n");
- return 1;
- }
-
fs = FcFontSetCreate ();
for (; i < argc; i++)
diff --git a/fontconfig/fontconfig/Makefile.am b/fontconfig/fontconfig/Makefile.am
index 72fec336e..99bb4c3b2 100644
--- a/fontconfig/fontconfig/Makefile.am
+++ b/fontconfig/fontconfig/Makefile.am
@@ -6,3 +6,5 @@ fontconfig_headers= \
fcprivate.h
fontconfiginclude_HEADERS = $(fontconfig_headers)
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/fontconfig/fontconfig.h b/fontconfig/fontconfig/fontconfig.h
index 266986c87..1af63abfb 100644
--- a/fontconfig/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig/fontconfig.h
@@ -181,10 +181,10 @@ typedef int FcBool;
#define FC_LCD_LEGACY 3
typedef enum _FcType {
- FcTypeVoid,
- FcTypeInteger,
- FcTypeDouble,
- FcTypeString,
+ FcTypeVoid,
+ FcTypeInteger,
+ FcTypeDouble,
+ FcTypeString,
FcTypeBool,
FcTypeMatrix,
FcTypeCharSet,
@@ -424,7 +424,7 @@ FcCharSetCreate (void);
/* deprecated alias for FcCharSetCreate */
FcPublic FcCharSet *
FcCharSetNew (void);
-
+
FcPublic void
FcCharSetDestroy (FcCharSet *fcs);
@@ -734,21 +734,25 @@ FcMatrixShear (FcMatrix *m, double sh, double sv);
/* fcname.c */
+/* Deprecated. Does nothing. Returns FcFalse. */
FcPublic FcBool
FcNameRegisterObjectTypes (const FcObjectType *types, int ntype);
+/* Deprecated. Does nothing. Returns FcFalse. */
FcPublic FcBool
FcNameUnregisterObjectTypes (const FcObjectType *types, int ntype);
-
+
FcPublic const FcObjectType *
FcNameGetObjectType (const char *object);
+/* Deprecated. Does nothing. Returns FcFalse. */
FcPublic FcBool
FcNameRegisterConstants (const FcConstant *consts, int nconsts);
+/* Deprecated. Does nothing. Returns FcFalse. */
FcPublic FcBool
FcNameUnregisterConstants (const FcConstant *consts, int nconsts);
-
+
FcPublic const FcConstant *
FcNameGetConstant (const FcChar8 *string);
diff --git a/fontconfig/fonts.dtd b/fontconfig/fonts.dtd
index 4a309a9d2..def8c216f 100644
--- a/fontconfig/fonts.dtd
+++ b/fontconfig/fonts.dtd
@@ -201,13 +201,14 @@
<!ATTLIST double xml:space (default|preserve) 'preserve'>
<!ELEMENT string (#PCDATA)>
<!ATTLIST string xml:space (default|preserve) 'preserve'>
-<!ELEMENT matrix (double,double,double,double)>
+<!ELEMENT matrix ((%expr;), (%expr;), (%expr;), (%expr;))>
<!ELEMENT bool (#PCDATA)>
<!ELEMENT charset (int|range)*>
<!ELEMENT range (int,int)>
<!ELEMENT langset (string)*>
<!ELEMENT name (#PCDATA)>
-<!ATTLIST name xml:space (default|preserve) 'preserve'>
+<!ATTLIST name xml:space (default|preserve) 'preserve'
+ target (default|font|pattern) 'default'>
<!ELEMENT const (#PCDATA)>
<!ATTLIST const xml:space (default|preserve) 'preserve'>
<!ELEMENT or (%expr;)*>
diff --git a/fontconfig/git.mk b/fontconfig/git.mk
new file mode 100644
index 000000000..d5bf7b842
--- /dev/null
+++ b/fontconfig/git.mk
@@ -0,0 +1,227 @@
+# git.mk
+#
+# Copyright 2009, Red Hat, Inc.
+# Copyright 2010,2011 Behdad Esfahbod
+# Written by Behdad Esfahbod
+#
+# Copying and distribution of this file, with or without modification,
+# is permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+#
+# The latest version of this file can be downloaded from:
+# https://raw.github.com/behdad/git.mk/master/git.mk
+# Bugs, etc, should be reported upstream at:
+# https://github.com/behdad/git.mk
+#
+# To use in your project, import this file in your git repo's toplevel,
+# then do "make -f git.mk". This modifies all Makefile.am files in
+# your project to -include git.mk. Remember to add that line to new
+# Makefile.am files you create in your project, or just rerun the
+# "make -f git.mk".
+#
+# This enables automatic .gitignore generation. If you need to ignore
+# more files, add them to the GITIGNOREFILES variable in your Makefile.am.
+# But think twice before doing that. If a file has to be in .gitignore,
+# chances are very high that it's a generated file and should be in one
+# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES.
+#
+# The only case that you need to manually add a file to GITIGNOREFILES is
+# when remove files in one of mostlyclean-local, clean-local, distclean-local,
+# or maintainer-clean-local make targets.
+#
+# Note that for files like editor backup, etc, there are better places to
+# ignore them. See "man gitignore".
+#
+# If "make maintainer-clean" removes the files but they are not recognized
+# by this script (that is, if "git status" shows untracked files still), send
+# me the output of "git status" as well as your Makefile.am and Makefile for
+# the directories involved and I'll diagnose.
+#
+# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
+# Makefile.am.sample in the git.mk git repo.
+#
+# Don't EXTRA_DIST this file. It is supposed to only live in git clones,
+# not tarballs. It serves no useful purpose in tarballs and clutters the
+# build dir.
+#
+# This file knows how to handle autoconf, automake, libtool, gtk-doc,
+# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu.
+#
+# This makefile provides the following targets:
+#
+# - all: "make all" will build all gitignore files.
+# - gitignore: makes all gitignore files in the current dir and subdirs.
+# - .gitignore: make gitignore file for the current dir.
+# - gitignore-recurse: makes all gitignore files in the subdirs.
+#
+# KNOWN ISSUES:
+#
+# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the
+# submodule doesn't find us. If you have configure.{in,ac} files in
+# subdirs, add a proxy git.mk file in those dirs that simply does:
+# "include $(top_srcdir)/../git.mk". Add more ..'s to your taste.
+# And add those files to git. See vte/gnome-pty-helper/git.mk for
+# example.
+#
+
+git-all: git-mk-install
+
+git-mk-install:
+ @echo Installing git makefile
+ @any_failed=; \
+ find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \
+ if grep 'include .*/git.mk' $$x >/dev/null; then \
+ echo $$x already includes git.mk; \
+ else \
+ failed=; \
+ echo "Updating $$x"; \
+ { cat $$x; \
+ echo ''; \
+ echo '-include $$(top_srcdir)/git.mk'; \
+ } > $$x.tmp || failed=1; \
+ if test x$$failed = x; then \
+ mv $$x.tmp $$x || failed=1; \
+ fi; \
+ if test x$$failed = x; then : else \
+ echo Failed updating $$x; >&2 \
+ any_failed=1; \
+ fi; \
+ fi; done; test -z "$$any_failed"
+
+.PHONY: git-all git-mk-install
+
+
+### .gitignore generation
+
+$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
+ $(AM_V_GEN) \
+ { \
+ if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \
+ for x in \
+ $(DOC_MODULE)-decl-list.txt \
+ $(DOC_MODULE)-decl.txt \
+ tmpl/$(DOC_MODULE)-unused.sgml \
+ "tmpl/*.bak" \
+ xml html \
+ ; do echo /$$x; done; \
+ fi; \
+ if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
+ for lc in $(DOC_LINGUAS); do \
+ for x in \
+ $(if $(DOC_MODULE),$(DOC_MODULE).xml) \
+ $(DOC_PAGES) \
+ $(DOC_INCLUDES) \
+ ; do echo /$$lc/$$x; done; \
+ done; \
+ for x in \
+ $(_DOC_OMF_ALL) \
+ $(_DOC_DSK_ALL) \
+ $(_DOC_HTML_ALL) \
+ $(_DOC_MOFILES) \
+ $(DOC_H_FILE) \
+ "*/.xml2po.mo" \
+ "*/*.omf.out" \
+ ; do echo /$$x; done; \
+ fi; \
+ if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \
+ for lc in $(HELP_LINGUAS); do \
+ for x in \
+ $(HELP_FILES) \
+ "$$lc.stamp" \
+ "$$lc.mo" \
+ ; do echo /$$lc/$$x; done; \
+ done; \
+ fi; \
+ if test "x$(gsettings_SCHEMAS)" = x; then :; else \
+ for x in \
+ $(gsettings_SCHEMAS:.xml=.valid) \
+ $(gsettings__enum_file) \
+ ; do echo /$$x; done; \
+ fi; \
+ if test -f $(srcdir)/po/Makefile.in.in; then \
+ for x in \
+ po/Makefile.in.in \
+ po/Makefile.in \
+ po/Makefile \
+ po/POTFILES \
+ po/stamp-it \
+ po/.intltool-merge-cache \
+ "po/*.gmo" \
+ "po/*.mo" \
+ po/$(GETTEXT_PACKAGE).pot \
+ intltool-extract.in \
+ intltool-merge.in \
+ intltool-update.in \
+ ; do echo /$$x; done; \
+ fi; \
+ if test -f $(srcdir)/configure; then \
+ for x in \
+ autom4te.cache \
+ configure \
+ config.h \
+ stamp-h1 \
+ libtool \
+ config.lt \
+ ; do echo /$$x; done; \
+ fi; \
+ if test "x$(DEJATOOL)" = x; then :; else \
+ for x in \
+ $(DEJATOOL) \
+ ; do echo /$$x.sum; echo /$$x.log; done; \
+ echo /site.exp; \
+ fi; \
+ for x in \
+ .gitignore \
+ $(GITIGNOREFILES) \
+ $(CLEANFILES) \
+ $(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \
+ $(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \
+ $(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \
+ so_locations \
+ .libs _libs \
+ $(MOSTLYCLEANFILES) \
+ "*.$(OBJEXT)" \
+ "*.lo" \
+ $(DISTCLEANFILES) \
+ $(am__CONFIG_DISTCLEAN_FILES) \
+ $(CONFIG_CLEAN_FILES) \
+ TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
+ "*.tab.c" \
+ $(MAINTAINERCLEANFILES) \
+ $(BUILT_SOURCES) \
+ $(DEPDIR) \
+ Makefile \
+ Makefile.in \
+ "*.orig" \
+ "*.rej" \
+ "*.bak" \
+ "*~" \
+ ".*.sw[nop]" \
+ ".dirstamp" \
+ ; do echo /$$x; done; \
+ } | \
+ sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
+ sed 's@/[.]/@/@g' | \
+ LC_ALL=C sort | uniq > $@.tmp && \
+ mv $@.tmp $@;
+
+all: $(srcdir)/.gitignore gitignore-recurse-maybe
+gitignore: $(srcdir)/.gitignore gitignore-recurse
+
+gitignore-recurse-maybe:
+ @for subdir in $(DIST_SUBDIRS); do \
+ case " $(SUBDIRS) " in \
+ *" $$subdir "*) :;; \
+ *) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse-maybe || echo "Skipping $$subdir");; \
+ esac; \
+ done
+gitignore-recurse:
+ @for subdir in $(DIST_SUBDIRS); do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir"); \
+ done
+
+maintainer-clean: gitignore-clean
+gitignore-clean:
+ -rm -f $(srcdir)/.gitignore
+
+.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe
diff --git a/fontconfig/m4/ax_cc_for_build.m4 b/fontconfig/m4/ax_cc_for_build.m4
new file mode 100644
index 000000000..c880fd0e1
--- /dev/null
+++ b/fontconfig/m4/ax_cc_for_build.m4
@@ -0,0 +1,77 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_cc_for_build.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CC_FOR_BUILD
+#
+# DESCRIPTION
+#
+# Find a build-time compiler. Sets CC_FOR_BUILD and EXEEXT_FOR_BUILD.
+#
+# LICENSE
+#
+# Copyright (c) 2010 Reuben Thomas <rrt@sc3d.org>
+# Copyright (c) 1999 Richard Henderson <rth@redhat.com>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 2
+
+dnl Get a default for CC_FOR_BUILD to put into Makefile.
+AC_DEFUN([AX_CC_FOR_BUILD],
+[# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test -z "$CC_FOR_BUILD"; then
+ if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+ else
+ CC_FOR_BUILD=gcc
+ fi
+fi
+AC_SUBST(CC_FOR_BUILD)
+# Also set EXEEXT_FOR_BUILD.
+if test "x$cross_compiling" = "xno"; then
+ EXEEXT_FOR_BUILD='$(EXEEXT)'
+else
+ AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
+ [rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.c
+ bfd_cv_build_exeext=
+ ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ rm -f conftest*
+ test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
+ EXEEXT_FOR_BUILD=""
+ test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
+fi
+AC_SUBST(EXEEXT_FOR_BUILD)])dnl
diff --git a/fontconfig/m4/ax_pthread.m4 b/fontconfig/m4/ax_pthread.m4
new file mode 100644
index 000000000..d90de34d1
--- /dev/null
+++ b/fontconfig/m4/ax_pthread.m4
@@ -0,0 +1,309 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+# This macro figures out how to build C programs using POSIX threads. It
+# sets the PTHREAD_LIBS output variable to the threads library and linker
+# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
+# flags that are needed. (The user can also force certain compiler
+# flags/libs to be tested by setting these environment variables.)
+#
+# Also sets PTHREAD_CC to any special C compiler that is needed for
+# multi-threaded programs (defaults to the value of CC otherwise). (This
+# is necessary on AIX to use the special cc_r compiler alias.)
+#
+# NOTE: You are assumed to not only compile your program with these flags,
+# but also link it with them as well. e.g. you should link with
+# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
+#
+# If you are only building threads programs, you may wish to use these
+# variables in your default LIBS, CFLAGS, and CC:
+#
+# LIBS="$PTHREAD_LIBS $LIBS"
+# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+# CC="$PTHREAD_CC"
+#
+# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
+# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
+# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+#
+# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
+# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
+# PTHREAD_CFLAGS.
+#
+# ACTION-IF-FOUND is a list of shell commands to run if a threads library
+# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
+# is not found. If ACTION-IF-FOUND is not specified, the default action
+# will define HAVE_PTHREAD.
+#
+# Please let the authors know if this macro fails on any platform, or if
+# you have any other suggestions or comments. This macro was based on work
+# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
+# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
+# Alejandro Forero Cuervo to the autoconf macro repository. We are also
+# grateful for the helpful feedback of numerous users.
+#
+# Updated for Autoconf 2.68 by Daniel Richard G.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
+# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 18
+
+AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
+AC_DEFUN([AX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_PUSH([C])
+ax_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+ AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
+ AC_MSG_RESULT($ax_pthread_ok)
+ if test x"$ax_pthread_ok" = xno; then
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+ fi
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try. Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important. Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+# other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+# doesn't hurt to check since this sometimes defines pthreads too;
+# also defines -D_REENTRANT)
+# ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case ${host_os} in
+ solaris*)
+
+ # On Solaris (at least, for some versions), libc contains stubbed
+ # (non-functional) versions of the pthreads routines, so link-based
+ # tests will erroneously succeed. (We need to link with -pthreads/-mt/
+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
+ # a function called by this macro, so we could check for that, but
+ # who knows whether they'll stub that too in a future libc.) So,
+ # we'll just look for -pthreads and -lpthread first:
+
+ ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
+ ;;
+
+ darwin*)
+ ax_pthread_flags="-pthread $ax_pthread_flags"
+ ;;
+esac
+
+if test x"$ax_pthread_ok" = xno; then
+for flag in $ax_pthread_flags; do
+
+ case $flag in
+ none)
+ AC_MSG_CHECKING([whether pthreads work without any flags])
+ ;;
+
+ -*)
+ AC_MSG_CHECKING([whether pthreads work with $flag])
+ PTHREAD_CFLAGS="$flag"
+ ;;
+
+ pthread-config)
+ AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
+ if test x"$ax_pthread_config" = xno; then continue; fi
+ PTHREAD_CFLAGS="`pthread-config --cflags`"
+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+ ;;
+
+ *)
+ AC_MSG_CHECKING([for the pthreads library -l$flag])
+ PTHREAD_LIBS="-l$flag"
+ ;;
+ esac
+
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Check for various functions. We must include pthread.h,
+ # since some functions may be macros. (On the Sequent, we
+ # need a special flag -Kthread to make this header compile.)
+ # We check for pthread_join because it is in -lpthread on IRIX
+ # while pthread_create is in libc. We check for pthread_attr_init
+ # due to DEC craziness with -lpthreads. We check for
+ # pthread_cleanup_push because it is one of the few pthread
+ # functions on Solaris that doesn't have a non-functional libc stub.
+ # We try pthread_create on general principles.
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
+ static void routine(void *a) { a = 0; }
+ static void *start_routine(void *a) { return a; }],
+ [pthread_t th; pthread_attr_t attr;
+ pthread_create(&th, 0, start_routine, 0);
+ pthread_join(th, 0);
+ pthread_attr_init(&attr);
+ pthread_cleanup_push(routine, 0);
+ pthread_cleanup_pop(0) /* ; */])],
+ [ax_pthread_ok=yes],
+ [])
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ AC_MSG_RESULT($ax_pthread_ok)
+ if test "x$ax_pthread_ok" = xyes; then
+ break;
+ fi
+
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$ax_pthread_ok" = xyes; then
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+ AC_MSG_CHECKING([for joinable pthread attribute])
+ attr_name=unknown
+ for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
+ [int attr = $attr; return attr /* ; */])],
+ [attr_name=$attr; break],
+ [])
+ done
+ AC_MSG_RESULT($attr_name)
+ if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+ AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+ [Define to necessary symbol if this constant
+ uses a non-standard name on your system.])
+ fi
+
+ AC_MSG_CHECKING([if more special flags are required for pthreads])
+ flag=no
+ case ${host_os} in
+ aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
+ osf* | hpux*) flag="-D_REENTRANT";;
+ solaris*)
+ if test "$GCC" = "yes"; then
+ flag="-D_REENTRANT"
+ else
+ flag="-mt -D_REENTRANT"
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT(${flag})
+ if test "x$flag" != xno; then
+ PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+ fi
+
+ AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
+ ax_cv_PTHREAD_PRIO_INHERIT, [
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])],
+ [ax_cv_PTHREAD_PRIO_INHERIT=yes],
+ [ax_cv_PTHREAD_PRIO_INHERIT=no])
+ ])
+ AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
+ AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ # More AIX lossage: must compile with xlc_r or cc_r
+ if test x"$GCC" != xyes; then
+ AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+ else
+ PTHREAD_CC=$CC
+ fi
+else
+ PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$ax_pthread_ok" = xyes; then
+ ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+ :
+else
+ ax_pthread_ok=no
+ $2
+fi
+AC_LANG_POP
+])dnl AX_PTHREAD
diff --git a/fontconfig/src/Makefile.am b/fontconfig/src/Makefile.am
index dc082b7df..617713fe7 100644
--- a/fontconfig/src/Makefile.am
+++ b/fontconfig/src/Makefile.am
@@ -21,6 +21,8 @@
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
+EXTRA_DIST =
+
if OS_WIN32
export_symbols = -export-symbols fontconfig.def
@@ -78,7 +80,7 @@ INCLUDES = \
-DFC_CACHEDIR='"$(FC_CACHEDIR)"' \
-DFONTCONFIG_PATH='"$(BASECONFIGDIR)"'
-EXTRA_DIST = makealias
+EXTRA_DIST += makealias
noinst_HEADERS=fcint.h fcftint.h fcdeprecate.h fcstdint.h
@@ -88,7 +90,9 @@ BUILT_SOURCES = $(ALIAS_FILES) \
../fc-case/fccase.h \
../fc-glyphname/fcglyphname.h \
../fc-lang/fclang.h \
- stamp-fcstdint
+ stamp-fcstdint \
+ fcobjshash.h \
+ fcobjshash.gperf
noinst_PROGRAMS = fcarch
@@ -99,9 +103,30 @@ noinst_PROGRAMS = fcarch
../fc-lang/fclang.h:
cd ../fc-lang && $(MAKE) $(AM_MAKEFLAGS) fclang.h
+fcobjshash.gperf: fcobjshash.gperf.h fcobjs.h
+ $(AM_V_GEN) $(CPP) -I$(top_srcdir) $< | \
+ $(SED) 's/^ *//;s/ *, */,/' | \
+ $(GREP) '^[^#]' | \
+ awk ' \
+ /CUT_OUT_BEGIN/ { no_write=1; next; }; \
+ /CUT_OUT_END/ { no_write=0; next; }; \
+ { if (!no_write) print; next; }; \
+ ' - > $@.tmp && \
+ mv -f $@.tmp $@ || ( $(RM) $@.tmp && false )
+
+fcobjshash.h: fcobjshash.gperf
+ $(AM_V_GEN) $(top_srcdir)/missing --run gperf -m 100 $< > $@.tmp && \
+ mv -f $@.tmp $@ || ( $(RM) $@.tmp && false )
+
+EXTRA_DIST += \
+ fcobjshash.gperf.h \
+ fcobjshash.gperf \
+ fcobjshash.h
+
libfontconfig_la_SOURCES = \
fcarch.h \
fcatomic.c \
+ fcatomic.h \
fcblanks.c \
fccache.c \
fccfg.c \
@@ -117,11 +142,16 @@ libfontconfig_la_SOURCES = \
fclist.c \
fcmatch.c \
fcmatrix.c \
+ fcmutex.h \
fcname.c \
+ fcobjs.c \
+ fcobjs.h \
+ fcobjshash.h \
fcpat.c \
fcserialize.c \
fcstat.c \
fcstr.c \
+ fcwindows.h \
fcxml.c \
ftglue.h \
ftglue.c
@@ -164,15 +194,17 @@ stamp-fcstdint: $(top_builddir)/config.status
$(SHELL) ./config.status src/fcstdint.h
@touch $@
-CLEANFILES = $(ALIAS_FILES)
+CLEANFILES = $(ALIAS_FILES) fontconfig.def
DISTCLEANFILES = stamp-fcstdint fcstdint.h
fontconfig.def: $(PUBLIC_FILES) $(PUBLIC_FT_FILES)
echo Generating $@
(echo EXPORTS; \
(cat $(PUBLIC_FILES) $(PUBLIC_FT_FILES) || echo 'FcERROR ()' ) | \
- grep '^Fc[^ ]* *(' | sed -e 's/ *(.*$$//' -e 's/^/ /' | \
+ $(GREP) '^Fc[^ ]* *(' | $(SED) -e 's/ *(.*$$//' -e 's/^/ /' | \
sort; \
echo LIBRARY libfontconfig-@LIBT_CURRENT_MINUS_AGE@.dll; \
echo VERSION @LIBT_CURRENT@.@LIBT_REVISION@) >$@
- @ ! grep -q FcERROR $@ || ($(RM) $@; false)
+ @ ! $(GREP) -q FcERROR $@ || ($(RM) $@; false)
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/src/fcarch.c b/fontconfig/src/fcarch.c
index 44548fc1b..35734c021 100644
--- a/fontconfig/src/fcarch.c
+++ b/fontconfig/src/fcarch.c
@@ -27,14 +27,7 @@
#include <config.h>
#endif
-/* If architecture is hardcoded, skip the assert tests */
-
-#ifndef FC_ARCHITECTURE
-
-/* Make sure the cache structure is consistent with what we expect */
-
#include "fcint.h"
-
#include "fcarch.h"
FC_ASSERT_STATIC (1 == sizeof (char));
@@ -62,11 +55,9 @@ FC_ASSERT_STATIC (0x08 + 2*SIZEOF_VOID_P == sizeof (FcPattern));
FC_ASSERT_STATIC (0x08 + 2*SIZEOF_VOID_P == sizeof (FcCharSet));
FC_ASSERT_STATIC (0x08 + 6*SIZEOF_VOID_P == sizeof (FcCache));
-#endif
-
int
-main (int argc, char **argv)
+main (int argc FC_UNUSED, char **argv FC_UNUSED)
{
printf ("%s\n", FC_ARCHITECTURE);
return 0;
diff --git a/fontconfig/src/fcatomic.c b/fontconfig/src/fcatomic.c
index f15e02f23..45048aa9f 100644..100755
--- a/fontconfig/src/fcatomic.c
+++ b/fontconfig/src/fcatomic.c
@@ -7,7 +7,7 @@
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the author(s) not be used in
+ * documentation, and that the name of the author(s) not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. The authors make no
* representations about the suitability of this software for any purpose. It
@@ -79,7 +79,6 @@ FcAtomicCreate (const FcChar8 *file)
FcAtomic *atomic = malloc (total_len);
if (!atomic)
return 0;
- FcMemAlloc (FC_MEM_ATOMIC, total_len);
atomic->file = (FcChar8 *) (atomic + 1);
strcpy ((char *) atomic->file, (char *) file);
@@ -224,11 +223,6 @@ FcAtomicUnlock (FcAtomic *atomic)
void
FcAtomicDestroy (FcAtomic *atomic)
{
- FcMemFree (FC_MEM_ATOMIC, sizeof (FcAtomic) +
- strlen ((char *) atomic->file) * 4 + 4 +
- sizeof (NEW_NAME) + sizeof (LCK_NAME) +
- sizeof (TMP_NAME));
-
free (atomic);
}
#define __fcatomic__
diff --git a/fontconfig/src/fcatomic.h b/fontconfig/src/fcatomic.h
new file mode 100644
index 000000000..72ae37280
--- /dev/null
+++ b/fontconfig/src/fcatomic.h
@@ -0,0 +1,121 @@
+/*
+ * Mutex operations. Originally copied from HarfBuzz.
+ *
+ * Copyright © 2007 Chris Wilson
+ * Copyright © 2009,2010 Red Hat, Inc.
+ * Copyright © 2011,2012,2013 Google, Inc.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Contributor(s):
+ * Chris Wilson <chris@chris-wilson.co.uk>
+ * Red Hat Author(s): Behdad Esfahbod
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef _FCATOMIC_H_
+#define _FCATOMIC_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+/* atomic_int */
+
+/* We need external help for these */
+
+#if 0
+
+
+#elif !defined(FC_NO_MT) && defined(_MSC_VER) || defined(__MINGW32__)
+
+#include "fcwindows.h"
+
+/* mingw32 does not have MemoryBarrier.
+ * MemoryBarrier may be defined as a macro or a function.
+ * Just make a failsafe version for ourselves. */
+#ifdef MemoryBarrier
+#define HBMemoryBarrier MemoryBarrier
+#else
+static inline void HBMemoryBarrier (void) {
+ long dummy = 0;
+ InterlockedExchange (&dummy, 1);
+}
+#endif
+
+typedef LONG fc_atomic_int_t;
+#define fc_atomic_int_add(AI, V) InterlockedExchangeAdd (&(AI), (V))
+
+#define fc_atomic_ptr_get(P) (HBMemoryBarrier (), (void *) *(P))
+#define fc_atomic_ptr_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
+
+
+#elif !defined(FC_NO_MT) && defined(__APPLE__)
+
+#include <libkern/OSAtomic.h>
+
+typedef int fc_atomic_int_t;
+#define fc_atomic_int_add(AI, V) (OSAtomicAdd32Barrier ((V), &(AI)) - (V))
+
+#define fc_atomic_ptr_get(P) (OSMemoryBarrier (), (void *) *(P))
+#define fc_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
+
+
+#elif !defined(FC_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
+
+typedef int fc_atomic_int_t;
+#define fc_atomic_int_add(AI, V) __sync_fetch_and_add (&(AI), (V))
+
+#define fc_atomic_ptr_get(P) (void *) (__sync_synchronize (), *(P))
+#define fc_atomic_ptr_cmpexch(P,O,N) __sync_bool_compare_and_swap ((P), (O), (N))
+
+
+#elif !defined(FC_NO_MT)
+
+#define FC_ATOMIC_INT_NIL 1 /* Warn that fallback implementation is in use. */
+typedef volatile int fc_atomic_int_t;
+#define fc_atomic_int_add(AI, V) (((AI) += (V)) - (V))
+
+#define fc_atomic_ptr_get(P) ((void *) *(P))
+#define fc_atomic_ptr_cmpexch(P,O,N) (* (void * volatile *) (P) == (void *) (O) ? (* (void * volatile *) (P) = (void *) (N), FcTrue) : FcFalse)
+
+
+#else /* FC_NO_MT */
+
+typedef int fc_atomic_int_t;
+#define fc_atomic_int_add(AI, V) (((AI) += (V)) - (V))
+
+#define fc_atomic_ptr_get(P) ((void *) *(P))
+#define fc_atomic_ptr_cmpexch(P,O,N) (* (void **) (P) == (void *) (O) ? (* (void **) (P) = (void *) (N), FcTrue) : FcFalse)
+
+#endif
+
+/* reference count */
+#define FC_REF_CONSTANT_VALUE ((fc_atomic_int_t) -1)
+#define FC_REF_CONSTANT {FC_REF_CONSTANT_VALUE}
+typedef struct _FcRef { fc_atomic_int_t count; } FcRef;
+static inline void FcRefInit (FcRef *r, int v) { r->count = v; }
+static inline int FcRefInc (FcRef *r) { return fc_atomic_int_add (r->count, +1); }
+static inline int FcRefDec (FcRef *r) { return fc_atomic_int_add (r->count, -1); }
+static inline int FcRefAdd (FcRef *r, int v) { return fc_atomic_int_add (r->count, v); }
+static inline void FcRefSetConst (FcRef *r) { r->count = FC_REF_CONSTANT_VALUE; }
+static inline FcBool FcRefIsConst (const FcRef *r) { return r->count == FC_REF_CONSTANT_VALUE; }
+
+#endif /* _FCATOMIC_H_ */
diff --git a/fontconfig/src/fcblanks.c b/fontconfig/src/fcblanks.c
index a80a1344f..46698bcda 100644
--- a/fontconfig/src/fcblanks.c
+++ b/fontconfig/src/fcblanks.c
@@ -32,7 +32,6 @@ FcBlanksCreate (void)
b = malloc (sizeof (FcBlanks));
if (!b)
return 0;
- FcMemAlloc (FC_MEM_BLANKS, sizeof (FcBlanks));
b->nblank = 0;
b->sblank = 0;
b->blanks = 0;
@@ -43,11 +42,7 @@ void
FcBlanksDestroy (FcBlanks *b)
{
if (b->blanks)
- {
- FcMemFree (FC_MEM_BLANKS, b->sblank * sizeof (FcChar32));
free (b->blanks);
- }
- FcMemFree (FC_MEM_BLANKS, sizeof (FcBlanks));
free (b);
}
@@ -70,9 +65,6 @@ FcBlanksAdd (FcBlanks *b, FcChar32 ucs4)
c = (FcChar32 *) malloc (sblank * sizeof (FcChar32));
if (!c)
return FcFalse;
- if (b->sblank)
- FcMemFree (FC_MEM_BLANKS, b->sblank * sizeof (FcChar32));
- FcMemAlloc (FC_MEM_BLANKS, sblank * sizeof (FcChar32));
b->sblank = sblank;
b->blanks = c;
}
diff --git a/fontconfig/src/fccache.c b/fontconfig/src/fccache.c
index 9b06b65a3..5926a398b 100644
--- a/fontconfig/src/fccache.c
+++ b/fontconfig/src/fccache.c
@@ -59,26 +59,32 @@ static void MD5Transform(FcChar32 buf[4], FcChar32 in[16]);
static FcBool
FcCacheIsMmapSafe (int fd)
{
- static FcBool is_initialized = FcFalse;
- static FcBool is_env_available = FcFalse;
- static FcBool use_mmap = FcFalse;
+ enum {
+ MMAP_NOT_INITIALIZED = 0,
+ MMAP_USE,
+ MMAP_DONT_USE,
+ MMAP_CHECK_FS,
+ } status;
+ static void *static_status;
- if (!is_initialized)
- {
- const char *env;
+ status = (intptr_t) fc_atomic_ptr_get (&static_status);
- env = getenv ("FONTCONFIG_USE_MMAP");
- if (env)
- {
- if (FcNameBool ((const FcChar8 *)env, &use_mmap))
- is_env_available = FcTrue;
- }
- is_initialized = FcTrue;
+ if (status == MMAP_NOT_INITIALIZED)
+ {
+ const char *env = getenv ("FONTCONFIG_USE_MMAP");
+ FcBool use;
+ if (env && FcNameBool ((const FcChar8 *) env, &use))
+ status = use ? MMAP_USE : MMAP_DONT_USE;
+ else
+ status = MMAP_CHECK_FS;
+ (void) fc_atomic_ptr_cmpexch (&static_status, NULL, (void *) status);
}
- if (is_env_available)
- return use_mmap;
- return FcIsFsMmapSafe (fd);
+ if (status == MMAP_CHECK_FS)
+ return FcIsFsMmapSafe (fd);
+ else
+ return status == MMAP_USE;
+
}
static const char bin2hex[] = { '0', '1', '2', '3',
@@ -227,7 +233,7 @@ typedef struct _FcCacheSkip FcCacheSkip;
struct _FcCacheSkip {
FcCache *cache;
- int ref;
+ FcRef ref;
intptr_t size;
dev_t cache_dev;
ino_t cache_ino;
@@ -242,6 +248,7 @@ struct _FcCacheSkip {
#define FC_CACHE_MAX_LEVEL 16
+/* Protected by cache_lock below */
static FcCacheSkip *fcCacheChains[FC_CACHE_MAX_LEVEL];
static int fcCacheMaxLevel;
@@ -301,6 +308,50 @@ FcRandom(void)
return result;
}
+
+static FcMutex *cache_lock;
+
+static void
+lock_cache (void)
+{
+ FcMutex *lock;
+retry:
+ lock = fc_atomic_ptr_get (&cache_lock);
+ if (!lock) {
+ lock = (FcMutex *) malloc (sizeof (FcMutex));
+ FcMutexInit (lock);
+ if (!fc_atomic_ptr_cmpexch (&cache_lock, NULL, lock)) {
+ FcMutexFinish (lock);
+ goto retry;
+ }
+
+ FcMutexLock (lock);
+ /* Initialize random state */
+ FcRandom ();
+ return;
+ }
+ FcMutexLock (lock);
+}
+
+static void
+unlock_cache (void)
+{
+ FcMutexUnlock (cache_lock);
+}
+
+static void
+free_lock (void)
+{
+ FcMutex *lock;
+ lock = fc_atomic_ptr_get (&cache_lock);
+ if (lock && fc_atomic_ptr_cmpexch (&cache_lock, lock, NULL)) {
+ FcMutexFinish (lock);
+ free (lock);
+ }
+}
+
+
+
/*
* Generate a random level number, distributed
* so that each level is 1/4 as likely as the one before
@@ -333,6 +384,8 @@ FcCacheInsert (FcCache *cache, struct stat *cache_stat)
FcCacheSkip *s, **next;
int i, level;
+ lock_cache ();
+
/*
* Find links along each chain
*/
@@ -362,7 +415,7 @@ FcCacheInsert (FcCache *cache, struct stat *cache_stat)
s->cache = cache;
s->size = cache->size;
- s->ref = 1;
+ FcRefInit (&s->ref, 1);
if (cache_stat)
{
s->cache_dev = cache_stat->st_dev;
@@ -384,11 +437,13 @@ FcCacheInsert (FcCache *cache, struct stat *cache_stat)
s->next[i] = *update[i];
*update[i] = s;
}
+
+ unlock_cache ();
return FcTrue;
}
static FcCacheSkip *
-FcCacheFindByAddr (void *object)
+FcCacheFindByAddrUnlocked (void *object)
{
int i;
FcCacheSkip **next = fcCacheChains;
@@ -409,8 +464,18 @@ FcCacheFindByAddr (void *object)
return NULL;
}
+static FcCacheSkip *
+FcCacheFindByAddr (void *object)
+{
+ FcCacheSkip *ret;
+ lock_cache ();
+ ret = FcCacheFindByAddrUnlocked (object);
+ unlock_cache ();
+ return ret;
+}
+
static void
-FcCacheRemove (FcCache *cache)
+FcCacheRemoveUnlocked (FcCache *cache)
{
FcCacheSkip **update[FC_CACHE_MAX_LEVEL];
FcCacheSkip *s, **next;
@@ -440,20 +505,25 @@ FcCacheFindByStat (struct stat *cache_stat)
{
FcCacheSkip *s;
+ lock_cache ();
for (s = fcCacheChains[0]; s; s = s->next[0])
if (s->cache_dev == cache_stat->st_dev &&
s->cache_ino == cache_stat->st_ino &&
s->cache_mtime == cache_stat->st_mtime)
{
- s->ref++;
+ FcRefInc (&s->ref);
+ unlock_cache ();
return s->cache;
}
+ unlock_cache ();
return NULL;
}
static void
-FcDirCacheDispose (FcCache *cache)
+FcDirCacheDisposeUnlocked (FcCache *cache)
{
+ FcCacheRemoveUnlocked (cache);
+
switch (cache->magic) {
case FC_CACHE_MAGIC_ALLOC:
free (cache);
@@ -466,7 +536,6 @@ FcDirCacheDispose (FcCache *cache)
#endif
break;
}
- FcCacheRemove (cache);
}
void
@@ -475,20 +544,22 @@ FcCacheObjectReference (void *object)
FcCacheSkip *skip = FcCacheFindByAddr (object);
if (skip)
- skip->ref++;
+ FcRefInc (&skip->ref);
}
void
FcCacheObjectDereference (void *object)
{
- FcCacheSkip *skip = FcCacheFindByAddr (object);
+ FcCacheSkip *skip;
+ lock_cache ();
+ skip = FcCacheFindByAddrUnlocked (object);
if (skip)
{
- skip->ref--;
- if (skip->ref <= 0)
- FcDirCacheDispose (skip->cache);
+ if (FcRefDec (&skip->ref) <= 1)
+ FcDirCacheDisposeUnlocked (skip->cache);
}
+ unlock_cache ();
}
void
@@ -499,6 +570,8 @@ FcCacheFini (void)
for (i = 0; i < FC_CACHE_MAX_LEVEL; i++)
assert (fcCacheChains[i] == NULL);
assert (fcCacheMaxLevel == 0);
+
+ free_lock ();
}
static FcBool
@@ -527,7 +600,7 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
FcCache *cache;
FcBool allocated = FcFalse;
- if (fd_stat->st_size < sizeof (FcCache))
+ if (fd_stat->st_size < (int) sizeof (FcCache))
return NULL;
cache = FcCacheFindByStat (fd_stat);
if (cache)
@@ -582,7 +655,7 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
}
if (cache->magic != FC_CACHE_MAGIC_MMAP ||
cache->version < FC_CACHE_CONTENT_VERSION ||
- cache->size != fd_stat->st_size ||
+ cache->size != (intptr_t) fd_stat->st_size ||
!FcCacheTimeValid (cache, dir_stat) ||
!FcCacheInsert (cache, fd_stat))
{
@@ -612,7 +685,7 @@ FcDirCacheReference (FcCache *cache, int nref)
FcCacheSkip *skip = FcCacheFindByAddr (cache);
if (skip)
- skip->ref += nref;
+ FcRefAdd (&skip->ref, nref);
}
void
@@ -666,7 +739,7 @@ FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat)
* the magic number and the size field
*/
static FcBool
-FcDirCacheValidateHelper (int fd, struct stat *fd_stat, struct stat *dir_stat, void *closure)
+FcDirCacheValidateHelper (int fd, struct stat *fd_stat, struct stat *dir_stat, void *closure FC_UNUSED)
{
FcBool ret = FcTrue;
FcCache c;
@@ -843,7 +916,7 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config)
FcChar8 *test_dir;
FcCacheSkip *skip;
struct stat cache_stat;
- int magic;
+ unsigned int magic;
int written;
/*
@@ -937,13 +1010,16 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config)
* new cache file is not read again. If it's large, we don't do that
* such that we reload it, using mmap, which is shared across processes.
*/
- if (cache->size < FC_CACHE_MIN_MMAP &&
- (skip = FcCacheFindByAddr (cache)) &&
- FcStat (cache_hashed, &cache_stat))
+ if (cache->size < FC_CACHE_MIN_MMAP && FcStat (cache_hashed, &cache_stat))
{
- skip->cache_dev = cache_stat.st_dev;
- skip->cache_ino = cache_stat.st_ino;
- skip->cache_mtime = cache_stat.st_mtime;
+ lock_cache ();
+ if ((skip = FcCacheFindByAddrUnlocked (cache)))
+ {
+ skip->cache_dev = cache_stat.st_dev;
+ skip->cache_ino = cache_stat.st_ino;
+ skip->cache_mtime = cache_stat.st_mtime;
+ }
+ unlock_cache ();
}
FcStrFree (cache_hashed);
diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c
index f94f0e051..877a4f57e 100644
--- a/fontconfig/src/fccfg.c
+++ b/fontconfig/src/fccfg.c
@@ -22,21 +22,50 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
+/* Objects MT-safe for readonly access. */
+
#include "fcint.h"
#include <dirent.h>
#include <sys/types.h>
-#if defined (_WIN32) && (defined (PIC) || defined (DLL_EXPORT))
-#define STRICT
-#include <windows.h>
-#undef STRICT
-#endif
-
#if defined (_WIN32) && !defined (R_OK)
#define R_OK 4
#endif
-FcConfig *_fcConfig;
+static FcConfig *_fcConfig; /* MT-safe */
+
+static FcConfig *
+FcConfigEnsure (void)
+{
+ FcConfig *config;
+retry:
+ config = fc_atomic_ptr_get (&_fcConfig);
+ if (!config)
+ {
+ config = FcInitLoadConfigAndFonts ();
+
+ if (!fc_atomic_ptr_cmpexch (&_fcConfig, NULL, config)) {
+ FcConfigDestroy (config);
+ goto retry;
+ }
+ }
+ return config;
+}
+
+FcBool
+FcConfigInit (void)
+{
+ return FcConfigEnsure () ? FcTrue : FcFalse;
+}
+
+void
+FcConfigFini (void)
+{
+ FcConfig *cfg = fc_atomic_ptr_get (&_fcConfig);
+ if (cfg && fc_atomic_ptr_cmpexch (&_fcConfig, cfg, NULL))
+ FcConfigDestroy (cfg);
+}
+
FcConfig *
FcConfigCreate (void)
@@ -47,7 +76,6 @@ FcConfigCreate (void)
config = malloc (sizeof (FcConfig));
if (!config)
goto bail0;
- FcMemAlloc (FC_MEM_CONFIG, sizeof (FcConfig));
config->configDirs = FcStrSetCreate ();
if (!config->configDirs)
@@ -95,7 +123,7 @@ FcConfigCreate (void)
config->expr_pool = NULL;
- config->ref = 1;
+ FcRefInit (&config->ref, 1);
return config;
@@ -115,7 +143,6 @@ bail2:
FcStrSetDestroy (config->configDirs);
bail1:
free (config);
- FcMemFree (FC_MEM_CONFIG, sizeof (FcConfig));
bail0:
return 0;
}
@@ -166,7 +193,7 @@ FcConfigUptoDate (FcConfig *config)
(font_time.set && (font_time.time - now) > 0))
{
fprintf (stderr,
- "Fontconfig warning: Directory/file mtime in the future. New fonts may not be detected\n");
+ "Fontconfig warning: Directory/file mtime in the future. New fonts may not be detected.\n");
config->rescanTime = now;
return FcTrue;
}
@@ -190,7 +217,6 @@ FcSubstDestroy (FcSubst *s)
if (s->edit)
FcEditDestroy (s->edit);
free (s);
- FcMemFree (FC_MEM_SUBST, sizeof (FcSubst));
s = n;
}
}
@@ -205,7 +231,6 @@ FcConfigAllocExpr (FcConfig *config)
new_page = malloc (sizeof (FcExprPage));
if (!new_page)
return 0;
- FcMemAlloc (FC_MEM_EXPR, sizeof (FcExprPage));
new_page->next_page = config->expr_pool;
new_page->next = new_page->exprs;
@@ -225,7 +250,7 @@ FcConfigReference (FcConfig *config)
return 0;
}
- config->ref++;
+ FcRefInc (&config->ref);
return config;
}
@@ -236,11 +261,10 @@ FcConfigDestroy (FcConfig *config)
FcSetName set;
FcExprPage *page;
- if (--config->ref > 0)
+ if (FcRefDec (&config->ref) != 1)
return;
- if (config == _fcConfig)
- _fcConfig = 0;
+ (void) fc_atomic_ptr_cmpexch (&_fcConfig, config, NULL);
FcStrSetDestroy (config->configDirs);
FcStrSetDestroy (config->fontDirs);
@@ -265,13 +289,11 @@ FcConfigDestroy (FcConfig *config)
while (page)
{
FcExprPage *next = page->next_page;
- FcMemFree (FC_MEM_EXPR, sizeof (FcExprPage));
free (page);
page = next;
}
free (config);
- FcMemFree (FC_MEM_CONFIG, sizeof (FcConfig));
}
/*
@@ -395,26 +417,31 @@ FcConfigBuildFonts (FcConfig *config)
FcBool
FcConfigSetCurrent (FcConfig *config)
{
- if (config == _fcConfig)
+ FcConfig *cfg;
+
+retry:
+ cfg = fc_atomic_ptr_get (&_fcConfig);
+
+ if (config == cfg)
return FcTrue;
if (!config->fonts[FcSetSystem])
if (!FcConfigBuildFonts (config))
return FcFalse;
- if (_fcConfig)
- FcConfigDestroy (_fcConfig);
- _fcConfig = config;
+ if (!fc_atomic_ptr_cmpexch (&_fcConfig, cfg, config))
+ goto retry;
+
+ if (cfg)
+ FcConfigDestroy (cfg);
+
return FcTrue;
}
FcConfig *
FcConfigGetCurrent (void)
{
- if (!_fcConfig)
- if (!FcInit ())
- return 0;
- return _fcConfig;
+ return FcConfigEnsure ();
}
FcBool
@@ -510,7 +537,7 @@ FcConfigGetConfigFiles (FcConfig *config)
}
FcChar8 *
-FcConfigGetCache (FcConfig *config)
+FcConfigGetCache (FcConfig *config FC_UNUSED)
{
return NULL;
}
@@ -640,7 +667,6 @@ FcConfigAddEdit (FcConfig *config,
subst = (FcSubst *) malloc (sizeof (FcSubst));
if (!subst)
return FcFalse;
- FcMemAlloc (FC_MEM_SUBST, sizeof (FcSubst));
for (; *prev; prev = &(*prev)->next);
*prev = subst;
subst->next = 0;
@@ -669,7 +695,7 @@ typedef struct _FcSubState {
} FcSubState;
static FcValue
-FcConfigPromote (FcValue v, FcValue u)
+FcConfigPromote (FcValue v, FcValue u, FcValuePromotionBuffer *buf)
{
if (v.type == FcTypeInteger)
{
@@ -681,9 +707,9 @@ FcConfigPromote (FcValue v, FcValue u)
v.u.m = &FcIdentityMatrix;
v.type = FcTypeMatrix;
}
- else if (v.type == FcTypeString && u.type == FcTypeLangSet)
+ else if (buf && v.type == FcTypeString && u.type == FcTypeLangSet)
{
- v.u.l = FcLangSetPromote (v.u.s);
+ v.u.l = FcLangSetPromote (v.u.s, buf);
v.type = FcTypeLangSet;
}
return v;
@@ -699,16 +725,17 @@ FcConfigCompareValue (const FcValue *left_o,
FcBool ret = FcFalse;
FcOp op = FC_OP_GET_OP (op_);
int flags = FC_OP_GET_FLAGS (op_);
+ FcValuePromotionBuffer buf1, buf2;
- left = FcConfigPromote (left, right);
- right = FcConfigPromote (right, left);
+ left = FcConfigPromote (left, right, &buf1);
+ right = FcConfigPromote (right, left, &buf2);
if (left.type == right.type)
{
switch (left.type) {
case FcTypeInteger:
break; /* FcConfigPromote prevents this from happening */
case FcTypeDouble:
- switch (op) {
+ switch ((int) op) {
case FcOpEqual:
case FcOpContains:
case FcOpListing:
@@ -735,7 +762,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeBool:
- switch (op) {
+ switch ((int) op) {
case FcOpEqual:
case FcOpContains:
case FcOpListing:
@@ -750,7 +777,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeString:
- switch (op) {
+ switch ((int) op) {
case FcOpEqual:
case FcOpListing:
if (flags & FcOpFlagIgnoreBlanks)
@@ -775,7 +802,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeMatrix:
- switch (op) {
+ switch ((int) op) {
case FcOpEqual:
case FcOpContains:
case FcOpListing:
@@ -790,7 +817,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeCharSet:
- switch (op) {
+ switch ((int) op) {
case FcOpContains:
case FcOpListing:
/* left contains right if right is a subset of left */
@@ -811,7 +838,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeLangSet:
- switch (op) {
+ switch ((int) op) {
case FcOpContains:
case FcOpListing:
ret = FcLangSetContains (left.u.l, right.u.l);
@@ -830,7 +857,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeVoid:
- switch (op) {
+ switch ((int) op) {
case FcOpEqual:
case FcOpContains:
case FcOpListing:
@@ -841,7 +868,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeFTFace:
- switch (op) {
+ switch ((int) op) {
case FcOpEqual:
case FcOpContains:
case FcOpListing:
@@ -874,15 +901,14 @@ FcConfigCompareValue (const FcValue *left_o,
#define FcDoubleTrunc(d) ((d) >= 0 ? _FcDoubleFloor (d) : -_FcDoubleFloor (-(d)))
static FcValue
-FcConfigEvaluate (FcPattern *p, FcExpr *e)
+FcConfigEvaluate (FcPattern *p, FcPattern *p_pat, FcMatchKind kind, FcExpr *e)
{
FcValue v, vl, vr;
- FcResult r;
FcMatrix *m;
FcChar8 *str;
FcOp op = FC_OP_GET_OP (e->op);
- switch (op) {
+ switch ((int) op) {
case FcOpInteger:
v.type = FcTypeInteger;
v.u.i = e->u.ival;
@@ -897,9 +923,27 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
v = FcValueSave (v);
break;
case FcOpMatrix:
- v.type = FcTypeMatrix;
- v.u.m = e->u.mval;
- v = FcValueSave (v);
+ {
+ FcMatrix m;
+ FcValue xx, xy, yx, yy;
+ v.type = FcTypeMatrix;
+ xx = FcConfigPromote (FcConfigEvaluate (p, p_pat, kind, e->u.mexpr->xx), v, NULL);
+ xy = FcConfigPromote (FcConfigEvaluate (p, p_pat, kind, e->u.mexpr->xy), v, NULL);
+ yx = FcConfigPromote (FcConfigEvaluate (p, p_pat, kind, e->u.mexpr->yx), v, NULL);
+ yy = FcConfigPromote (FcConfigEvaluate (p, p_pat, kind, e->u.mexpr->yy), v, NULL);
+ if (xx.type == FcTypeDouble && xy.type == FcTypeDouble &&
+ yx.type == FcTypeDouble && yy.type == FcTypeDouble)
+ {
+ m.xx = xx.u.d;
+ m.xy = xy.u.d;
+ m.yx = yx.u.d;
+ m.yy = yy.u.d;
+ v.u.m = &m;
+ }
+ else
+ v.type = FcTypeVoid;
+ v = FcValueSave (v);
+ }
break;
case FcOpCharSet:
v.type = FcTypeCharSet;
@@ -916,9 +960,22 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
v.u.b = e->u.bval;
break;
case FcOpField:
- r = FcPatternObjectGet (p, e->u.object, 0, &v);
- if (r != FcResultMatch)
+ if (kind == FcMatchFont && e->u.name.kind == FcMatchPattern)
+ {
+ if (FcResultMatch != FcPatternObjectGet (p_pat, e->u.name.object, 0, &v))
+ v.type = FcTypeVoid;
+ }
+ else if (kind == FcMatchPattern && e->u.name.kind == FcMatchFont)
+ {
+ fprintf (stderr,
+ "Fontconfig warning: <name> tag has target=\"font\" in a <match target=\"pattern\">.\n");
v.type = FcTypeVoid;
+ }
+ else
+ {
+ if (FcResultMatch != FcPatternObjectGet (p, e->u.name.object, 0, &v))
+ v.type = FcTypeVoid;
+ }
v = FcValueSave (v);
break;
case FcOpConst:
@@ -928,13 +985,13 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
v.type = FcTypeVoid;
break;
case FcOpQuest:
- vl = FcConfigEvaluate (p, e->u.tree.left);
+ vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
if (vl.type == FcTypeBool)
{
if (vl.u.b)
- v = FcConfigEvaluate (p, e->u.tree.right->u.tree.left);
+ v = FcConfigEvaluate (p, p_pat, kind, e->u.tree.right->u.tree.left);
else
- v = FcConfigEvaluate (p, e->u.tree.right->u.tree.right);
+ v = FcConfigEvaluate (p, p_pat, kind, e->u.tree.right->u.tree.right);
}
else
v.type = FcTypeVoid;
@@ -949,8 +1006,8 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
case FcOpContains:
case FcOpNotContains:
case FcOpListing:
- vl = FcConfigEvaluate (p, e->u.tree.left);
- vr = FcConfigEvaluate (p, e->u.tree.right);
+ vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
+ vr = FcConfigEvaluate (p, p_pat, kind, e->u.tree.right);
v.type = FcTypeBool;
v.u.b = FcConfigCompareValue (&vl, e->op, &vr);
FcValueDestroy (vl);
@@ -962,15 +1019,15 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
case FcOpMinus:
case FcOpTimes:
case FcOpDivide:
- vl = FcConfigEvaluate (p, e->u.tree.left);
- vr = FcConfigEvaluate (p, e->u.tree.right);
- vl = FcConfigPromote (vl, vr);
- vr = FcConfigPromote (vr, vl);
+ vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
+ vr = FcConfigEvaluate (p, p_pat, kind, e->u.tree.right);
+ vl = FcConfigPromote (vl, vr, NULL);
+ vr = FcConfigPromote (vr, vl, NULL);
if (vl.type == vr.type)
{
- switch (vl.type) {
+ switch ((int) vl.type) {
case FcTypeDouble:
- switch (op) {
+ switch ((int) op) {
case FcOpPlus:
v.type = FcTypeDouble;
v.u.d = vl.u.d + vr.u.d;
@@ -999,7 +1056,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
}
break;
case FcTypeBool:
- switch (op) {
+ switch ((int) op) {
case FcOpOr:
v.type = FcTypeBool;
v.u.b = vl.u.b || vr.u.b;
@@ -1014,11 +1071,11 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
}
break;
case FcTypeString:
- switch (op) {
+ switch ((int) op) {
case FcOpPlus:
v.type = FcTypeString;
str = FcStrPlus (vl.u.s, vr.u.s);
- v.u.s = FcSharedStr (str);
+ v.u.s = FcStrdup (str);
FcStrFree (str);
if (!v.u.s)
@@ -1030,13 +1087,12 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
}
break;
case FcTypeMatrix:
- switch (op) {
+ switch ((int) op) {
case FcOpTimes:
v.type = FcTypeMatrix;
m = malloc (sizeof (FcMatrix));
if (m)
{
- FcMemAlloc (FC_MEM_MATRIX, sizeof (FcMatrix));
FcMatrixMultiply (m, vl.u.m, vr.u.m);
v.u.m = m;
}
@@ -1051,7 +1107,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
}
break;
case FcTypeCharSet:
- switch (op) {
+ switch ((int) op) {
case FcOpPlus:
v.type = FcTypeCharSet;
v.u.c = FcCharSetUnion (vl.u.c, vr.u.c);
@@ -1070,7 +1126,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
}
break;
case FcTypeLangSet:
- switch (op) {
+ switch ((int) op) {
case FcOpPlus:
v.type = FcTypeLangSet;
v.u.l = FcLangSetUnion (vl.u.l, vr.u.l);
@@ -1099,8 +1155,8 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
FcValueDestroy (vr);
break;
case FcOpNot:
- vl = FcConfigEvaluate (p, e->u.tree.left);
- switch (vl.type) {
+ vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
+ switch ((int) vl.type) {
case FcTypeBool:
v.type = FcTypeBool;
v.u.b = !vl.u.b;
@@ -1112,8 +1168,8 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
FcValueDestroy (vl);
break;
case FcOpFloor:
- vl = FcConfigEvaluate (p, e->u.tree.left);
- switch (vl.type) {
+ vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
+ switch ((int) vl.type) {
case FcTypeInteger:
v = vl;
break;
@@ -1128,8 +1184,8 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
FcValueDestroy (vl);
break;
case FcOpCeil:
- vl = FcConfigEvaluate (p, e->u.tree.left);
- switch (vl.type) {
+ vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
+ switch ((int) vl.type) {
case FcTypeInteger:
v = vl;
break;
@@ -1144,8 +1200,8 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
FcValueDestroy (vl);
break;
case FcOpRound:
- vl = FcConfigEvaluate (p, e->u.tree.left);
- switch (vl.type) {
+ vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
+ switch ((int) vl.type) {
case FcTypeInteger:
v = vl;
break;
@@ -1160,8 +1216,8 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
FcValueDestroy (vl);
break;
case FcOpTrunc:
- vl = FcConfigEvaluate (p, e->u.tree.left);
- switch (vl.type) {
+ vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
+ switch ((int) vl.type) {
case FcTypeInteger:
v = vl;
break;
@@ -1184,6 +1240,8 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
static FcValueList *
FcConfigMatchValueList (FcPattern *p,
+ FcPattern *p_pat,
+ FcMatchKind kind,
FcTest *t,
FcValueList *values)
{
@@ -1197,12 +1255,12 @@ FcConfigMatchValueList (FcPattern *p,
/* Compute the value of the match expression */
if (FC_OP_GET_OP (e->op) == FcOpComma)
{
- value = FcConfigEvaluate (p, e->u.tree.left);
+ value = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
e = e->u.tree.right;
}
else
{
- value = FcConfigEvaluate (p, e);
+ value = FcConfigEvaluate (p, p_pat, kind, e);
e = 0;
}
@@ -1229,7 +1287,7 @@ FcConfigMatchValueList (FcPattern *p,
}
static FcValueList *
-FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding)
+FcConfigValues (FcPattern *p, FcPattern *p_pat, FcMatchKind kind, FcExpr *e, FcValueBinding binding)
{
FcValueList *l;
@@ -1238,15 +1296,14 @@ FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding)
l = (FcValueList *) malloc (sizeof (FcValueList));
if (!l)
return 0;
- FcMemAlloc (FC_MEM_VALLIST, sizeof (FcValueList));
if (FC_OP_GET_OP (e->op) == FcOpComma)
{
- l->value = FcConfigEvaluate (p, e->u.tree.left);
- l->next = FcConfigValues (p, e->u.tree.right, binding);
+ l->value = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
+ l->next = FcConfigValues (p, p_pat, kind, e->u.tree.right, binding);
}
else
{
- l->value = FcConfigEvaluate (p, e);
+ l->value = FcConfigEvaluate (p, p_pat, kind, e);
l->next = NULL;
}
l->binding = binding;
@@ -1254,7 +1311,6 @@ FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding)
{
FcValueList *next = FcValueListNext(l);
- FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
free (l);
l = next;
}
@@ -1266,11 +1322,33 @@ static FcBool
FcConfigAdd (FcValueListPtr *head,
FcValueList *position,
FcBool append,
- FcValueList *new)
+ FcValueList *new,
+ FcObject object)
{
- FcValueListPtr *prev, last, v;
+ FcValueListPtr *prev, l, last, v;
FcValueBinding sameBinding;
+ /*
+ * Make sure the stored type is valid for built-in objects
+ */
+ for (l = new; l != NULL; l = FcValueListNext (l))
+ {
+ if (!FcObjectValidType (object, l->value.type))
+ {
+ fprintf (stderr,
+ "Fontconfig warning: FcPattern object %s does not accept value", FcObjectName (object));
+ FcValuePrintFile (stderr, l->value);
+ fprintf (stderr, "\n");
+
+ if (FcDebug () & FC_DBG_EDIT)
+ {
+ printf ("Not adding\n");
+ }
+
+ return FcFalse;
+ }
+ }
+
if (position)
sameBinding = position->binding;
else
@@ -1365,7 +1443,7 @@ FcConfigPatternAdd (FcPattern *p,
if (!e)
return;
- FcConfigAdd (&e->values, 0, append, list);
+ FcConfigAdd (&e->values, 0, append, list, object);
}
}
@@ -1449,7 +1527,6 @@ FcConfigSubstituteWithPat (FcConfig *config,
st = (FcSubState *) malloc (config->maxObjects * sizeof (FcSubState));
if (!st && config->maxObjects)
return FcFalse;
- FcMemAlloc (FC_MEM_SUBSTATE, config->maxObjects * sizeof (FcSubState));
if (FcDebug () & FC_DBG_EDIT)
{
@@ -1496,7 +1573,7 @@ FcConfigSubstituteWithPat (FcConfig *config,
* Check to see if there is a match, mark the location
* to apply match-relative edits
*/
- st[i].value = FcConfigMatchValueList (m, t, st[i].elt->values);
+ st[i].value = FcConfigMatchValueList (m, p_pat, kind, t, st[i].elt->values);
if (!st[i].value)
break;
if (t->qual == FcQualFirst && st[i].value != st[i].elt->values)
@@ -1520,7 +1597,7 @@ FcConfigSubstituteWithPat (FcConfig *config,
/*
* Evaluate the list of expressions
*/
- l = FcConfigValues (p, e->expr, e->binding);
+ l = FcConfigValues (p, p_pat,kind, e->expr, e->binding);
/*
* Locate any test associated with this field, skipping
* tests associated with the pattern when substituting in
@@ -1558,7 +1635,7 @@ FcConfigSubstituteWithPat (FcConfig *config,
/*
* Append the new list of values after the current value
*/
- FcConfigAdd (&st[i].elt->values, thisValue, FcTrue, l);
+ FcConfigAdd (&st[i].elt->values, thisValue, FcTrue, l, e->object);
/*
* Delete the marked value
*/
@@ -1600,7 +1677,7 @@ FcConfigSubstituteWithPat (FcConfig *config,
case FcOpPrepend:
if (t)
{
- FcConfigAdd (&st[i].elt->values, st[i].value, FcFalse, l);
+ FcConfigAdd (&st[i].elt->values, st[i].value, FcFalse, l, e->object);
break;
}
/* fall through ... */
@@ -1610,7 +1687,7 @@ FcConfigSubstituteWithPat (FcConfig *config,
case FcOpAppend:
if (t)
{
- FcConfigAdd (&st[i].elt->values, st[i].value, FcTrue, l);
+ FcConfigAdd (&st[i].elt->values, st[i].value, FcTrue, l, e->object);
break;
}
/* fall through ... */
@@ -1635,7 +1712,6 @@ FcConfigSubstituteWithPat (FcConfig *config,
FcPatternPrint (p);
}
}
- FcMemFree (FC_MEM_SUBSTATE, config->maxObjects * sizeof (FcSubState));
free (st);
if (FcDebug () & FC_DBG_EDIT)
{
@@ -1655,17 +1731,18 @@ FcConfigSubstitute (FcConfig *config,
#if defined (_WIN32)
-# define WIN32_LEAN_AND_MEAN
-# define WIN32_EXTRA_LEAN
-# include <windows.h>
-
-static FcChar8 fontconfig_path[1000] = "";
+static FcChar8 fontconfig_path[1000] = ""; /* MT-dontcare */
# if (defined (PIC) || defined (DLL_EXPORT))
BOOL WINAPI
DllMain (HINSTANCE hinstDLL,
DWORD fdwReason,
+ LPVOID lpvReserved);
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+ DWORD fdwReason,
LPVOID lpvReserved)
{
FcChar8 *p;
@@ -1748,7 +1825,6 @@ FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
#endif
strcat ((char *) path, (char *) file);
- FcMemAlloc (FC_MEM_STRING, osize);
if (access ((char *) path, R_OK) == 0)
return path;
@@ -1838,7 +1914,7 @@ FcConfigFreePath (FcChar8 **path)
free (path);
}
-static FcBool _FcConfigHomeEnabled = FcTrue;
+static FcBool _FcConfigHomeEnabled = FcTrue; /* MT-goodenough */
FcChar8 *
FcConfigHome (void)
@@ -1873,7 +1949,6 @@ FcConfigXdgCacheHome (void)
ret = malloc (len + 7 + 1);
if (ret)
{
- FcMemAlloc (FC_MEM_STRING, len + 7 + 1);
memcpy (ret, home, len);
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".cache", 7);
ret[len + 7] = 0;
@@ -1899,7 +1974,6 @@ FcConfigXdgConfigHome (void)
ret = malloc (len + 8 + 1);
if (ret)
{
- FcMemAlloc (FC_MEM_STRING, len + 8 + 1);
memcpy (ret, home, len);
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".config", 8);
ret[len + 8] = 0;
@@ -1925,7 +1999,6 @@ FcConfigXdgDataHome (void)
ret = malloc (len + 13 + 1);
if (ret)
{
- FcMemAlloc (FC_MEM_STRING, len + 13 + 1);
memcpy (ret, home, len);
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".local" FC_DIR_SEPARATOR_S "share", 13);
ret[len + 13] = 0;
diff --git a/fontconfig/src/fccharset.c b/fontconfig/src/fccharset.c
index 8c1d85819..c9f928cd4 100644
--- a/fontconfig/src/fccharset.c
+++ b/fontconfig/src/fccharset.c
@@ -35,8 +35,7 @@ FcCharSetCreate (void)
fcs = (FcCharSet *) malloc (sizeof (FcCharSet));
if (!fcs)
return 0;
- FcMemAlloc (FC_MEM_CHARSET, sizeof (FcCharSet));
- fcs->ref = 1;
+ FcRefInit (&fcs->ref, 1);
fcs->num = 0;
fcs->leaves_offset = 0;
fcs->numbers_offset = 0;
@@ -56,27 +55,20 @@ FcCharSetDestroy (FcCharSet *fcs)
if (fcs)
{
- if (fcs->ref == FC_REF_CONSTANT)
+ if (FcRefIsConst (&fcs->ref))
{
FcCacheObjectDereference (fcs);
return;
}
- if (--fcs->ref > 0)
+ if (FcRefDec (&fcs->ref) != 1)
return;
for (i = 0; i < fcs->num; i++)
- {
- FcMemFree (FC_MEM_CHARLEAF, sizeof (FcCharLeaf));
free (FcCharSetLeaf (fcs, i));
- }
if (fcs->num)
{
- /* the numbers here are estimates */
- FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (intptr_t));
free (FcCharSetLeaves (fcs));
- FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcChar16));
free (FcCharSetNumbers (fcs));
}
- FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet));
free (fcs);
}
}
@@ -157,24 +149,16 @@ FcCharSetPutLeaf (FcCharSet *fcs,
unsigned int alloced = 8;
leaves = malloc (alloced * sizeof (*leaves));
numbers = malloc (alloced * sizeof (*numbers));
- FcMemAlloc (FC_MEM_CHARSET, alloced * sizeof (*leaves));
- FcMemAlloc (FC_MEM_CHARSET, alloced * sizeof (*numbers));
}
else
{
unsigned int alloced = fcs->num;
intptr_t *new_leaves, distance;
- FcMemFree (FC_MEM_CHARSET, alloced * sizeof (*leaves));
- FcMemFree (FC_MEM_CHARSET, alloced * sizeof (*numbers));
-
alloced *= 2;
new_leaves = realloc (leaves, alloced * sizeof (*leaves));
numbers = realloc (numbers, alloced * sizeof (*numbers));
- FcMemAlloc (FC_MEM_CHARSET, alloced * sizeof (*leaves));
- FcMemAlloc (FC_MEM_CHARSET, alloced * sizeof (*numbers));
-
distance = (intptr_t) new_leaves - (intptr_t) leaves;
if (new_leaves && distance)
{
@@ -227,7 +211,6 @@ FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4)
free (leaf);
return 0;
}
- FcMemAlloc (FC_MEM_CHARLEAF, sizeof (FcCharLeaf));
return leaf;
}
@@ -239,7 +222,6 @@ FcCharSetInsertLeaf (FcCharSet *fcs, FcChar32 ucs4, FcCharLeaf *leaf)
pos = FcCharSetFindLeafPos (fcs, ucs4);
if (pos >= 0)
{
- FcMemFree (FC_MEM_CHARLEAF, sizeof (FcCharLeaf));
free (FcCharSetLeaf (fcs, pos));
FcCharSetLeaves(fcs)[pos] = FcPtrToOffset (FcCharSetLeaves(fcs),
leaf);
@@ -255,7 +237,7 @@ FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4)
FcCharLeaf *leaf;
FcChar32 *b;
- if (fcs == NULL || fcs->ref == FC_REF_CONSTANT)
+ if (fcs == NULL || FcRefIsConst (&fcs->ref))
return FcFalse;
leaf = FcCharSetFindLeafCreate (fcs, ucs4);
if (!leaf)
@@ -271,7 +253,7 @@ FcCharSetDelChar (FcCharSet *fcs, FcChar32 ucs4)
FcCharLeaf *leaf;
FcChar32 *b;
- if (fcs == NULL || fcs->ref == FC_REF_CONSTANT)
+ if (fcs == NULL || FcRefIsConst (&fcs->ref))
return FcFalse;
leaf = FcCharSetFindLeaf (fcs, ucs4);
if (!leaf)
@@ -347,8 +329,8 @@ FcCharSetCopy (FcCharSet *src)
{
if (src)
{
- if (src->ref != FC_REF_CONSTANT)
- src->ref++;
+ if (!FcRefIsConst (&src->ref))
+ FcRefInc (&src->ref);
else
FcCacheObjectReference (src);
}
@@ -506,7 +488,7 @@ FcCharSetMerge (FcCharSet *a, const FcCharSet *b, FcBool *changed)
if (!a || !b)
return FcFalse;
- if (a->ref == FC_REF_CONSTANT) {
+ if (FcRefIsConst (&a->ref)) {
if (changed)
*changed = FcFalse;
return FcFalse;
@@ -971,15 +953,12 @@ FcNameParseCharSet (FcChar8 *string)
bail1:
if (c->num)
{
- FcMemFree (FC_MEM_CHARSET, c->num * sizeof (FcCharLeaf *));
free (FcCharSetLeaves (c));
}
if (c->num)
{
- FcMemFree (FC_MEM_CHARSET, c->num * sizeof (FcChar16));
free (FcCharSetNumbers (c));
}
- FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet));
free (c);
bail0:
return NULL;
@@ -1116,7 +1095,6 @@ FcCharLeafEntCreate (FcCharSetFreezer *freezer)
freezer->current_block = freezer->leaf_blocks[freezer->leaf_block_count-1] = malloc (FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt));
if (!freezer->current_block)
return 0;
- FcMemAlloc (FC_MEM_CHARLEAF, FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt));
freezer->leaf_remain = FC_CHAR_LEAF_BLOCK;
}
freezer->leaf_remain--;
@@ -1190,7 +1168,7 @@ FcCharSetFreezeOrig (FcCharSetFreezer *freezer, const FcCharSet *orig, const FcC
}
static FcCharSet *
-FcCharSetFreezeBase (FcCharSetFreezer *freezer, FcCharSet *fcs, const FcCharSet *orig)
+FcCharSetFreezeBase (FcCharSetFreezer *freezer, FcCharSet *fcs)
{
FcChar32 hash = FcCharSetHash (fcs);
FcCharSetEnt **bucket = &freezer->set_hash_table[hash % FC_CHAR_SET_HASH_SIZE];
@@ -1223,11 +1201,10 @@ FcCharSetFreezeBase (FcCharSetFreezer *freezer, FcCharSet *fcs, const FcCharSet
ent = malloc (size);
if (!ent)
return 0;
- FcMemAlloc (FC_MEM_CHARSET, size);
freezer->charsets_allocated++;
- ent->set.ref = FC_REF_CONSTANT;
+ FcRefSetConst (&ent->set.ref);
ent->set.num = fcs->num;
if (fcs->num)
{
@@ -1289,7 +1266,7 @@ FcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs)
if (!FcCharSetInsertLeaf (b, FcCharSetNumbers(fcs)[i] << 8, l))
goto bail1;
}
- n = FcCharSetFreezeBase (freezer, b, fcs);
+ n = FcCharSetFreezeBase (freezer, b);
if (!FcCharSetFreezeOrig (freezer, fcs, n))
{
n = NULL;
@@ -1299,16 +1276,9 @@ FcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs)
freezer->leaves_seen += fcs->num;
bail1:
if (b->num)
- {
- FcMemFree (FC_MEM_CHARSET, b->num * sizeof (FcCharLeaf *));
free (FcCharSetLeaves (b));
- }
if (b->num)
- {
- FcMemFree (FC_MEM_CHARSET, b->num * sizeof (FcChar16));
free (FcCharSetNumbers (b));
- }
- FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet));
free (b);
bail0:
return n;
@@ -1340,9 +1310,6 @@ FcCharSetFreezerDestroy (FcCharSetFreezer *freezer)
for (ent = freezer->set_hash_table[i]; ent; ent = next)
{
next = ent->next;
- FcMemFree (FC_MEM_CHARSET, (sizeof (FcCharSetEnt) +
- ent->set.num * sizeof (FcCharLeaf *) +
- ent->set.num * sizeof (FcChar16)));
free (ent);
}
}
@@ -1358,10 +1325,7 @@ FcCharSetFreezerDestroy (FcCharSetFreezer *freezer)
}
for (i = 0; i < freezer->leaf_block_count; i++)
- {
free (freezer->leaf_blocks[i]);
- FcMemFree (FC_MEM_CHARLEAF, FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt));
- }
free (freezer->leaf_blocks);
free (freezer);
@@ -1374,7 +1338,7 @@ FcCharSetSerializeAlloc (FcSerialize *serialize, const FcCharSet *cs)
FcChar16 *numbers;
int i;
- if (cs->ref != FC_REF_CONSTANT)
+ if (!FcRefIsConst (&cs->ref))
{
if (!serialize->cs_freezer)
{
@@ -1413,7 +1377,7 @@ FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs)
FcCharLeaf *leaf, *leaf_serialized;
int i;
- if (cs->ref != FC_REF_CONSTANT && serialize->cs_freezer)
+ if (!FcRefIsConst (&cs->ref) && serialize->cs_freezer)
{
cs = FcCharSetFindFrozen (serialize->cs_freezer, cs);
if (!cs)
@@ -1424,7 +1388,7 @@ FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs)
if (!cs_serialized)
return NULL;
- cs_serialized->ref = FC_REF_CONSTANT;
+ FcRefSetConst (&cs_serialized->ref);
cs_serialized->num = cs->num;
if (cs->num)
diff --git a/fontconfig/src/fcdbg.c b/fontconfig/src/fcdbg.c
index a1ed2b2dd..270d79179 100644
--- a/fontconfig/src/fcdbg.c
+++ b/fontconfig/src/fcdbg.c
@@ -27,44 +27,52 @@
#include <stdlib.h>
static void
-_FcValuePrint (const FcValue v)
+_FcValuePrintFile (FILE *f, const FcValue v)
{
switch (v.type) {
case FcTypeVoid:
- printf ("<void>");
+ fprintf (f, "<void>");
break;
case FcTypeInteger:
- printf ("%d(i)", v.u.i);
+ fprintf (f, "%d(i)", v.u.i);
break;
case FcTypeDouble:
- printf ("%g(f)", v.u.d);
+ fprintf (f, "%g(f)", v.u.d);
break;
case FcTypeString:
- printf ("\"%s\"", v.u.s);
+ fprintf (f, "\"%s\"", v.u.s);
break;
case FcTypeBool:
- printf ("%s", v.u.b ? "FcTrue" : "FcFalse");
+ fprintf (f, "%s", v.u.b ? "True" : "False");
break;
case FcTypeMatrix:
- printf ("(%f %f; %f %f)", v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
+ fprintf (f, "[%g %g; %g %g]", v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
break;
case FcTypeCharSet: /* XXX */
- FcCharSetPrint (v.u.c);
+ if (f == stdout)
+ FcCharSetPrint (v.u.c);
break;
case FcTypeLangSet:
FcLangSetPrint (v.u.l);
break;
case FcTypeFTFace:
- printf ("face");
+ fprintf (f, "face");
break;
}
}
void
+FcValuePrintFile (FILE *f, const FcValue v)
+{
+ fprintf (f, " ");
+ _FcValuePrintFile (f, v);
+}
+
+void
FcValuePrint (const FcValue v)
{
printf (" ");
- _FcValuePrint (v);
+ _FcValuePrintFile (stdout, v);
}
void
@@ -74,7 +82,7 @@ FcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark)
printf (" [insert here] ");
else
printf (" ");
- _FcValuePrint (v);
+ _FcValuePrintFile (stdout, v);
}
static void
@@ -249,11 +257,17 @@ FcExprPrint (const FcExpr *expr)
case FcOpInteger: printf ("%d", expr->u.ival); break;
case FcOpDouble: printf ("%g", expr->u.dval); break;
case FcOpString: printf ("\"%s\"", expr->u.sval); break;
- case FcOpMatrix: printf ("[%g %g %g %g]",
- expr->u.mval->xx,
- expr->u.mval->xy,
- expr->u.mval->yx,
- expr->u.mval->yy); break;
+ case FcOpMatrix:
+ printf ("[");
+ FcExprPrint (expr->u.mexpr->xx);
+ printf (" ");
+ FcExprPrint (expr->u.mexpr->xy);
+ printf ("; ");
+ FcExprPrint (expr->u.mexpr->yx);
+ printf (" ");
+ FcExprPrint (expr->u.mexpr->yy);
+ printf ("]");
+ break;
case FcOpRange: break;
case FcOpBool: printf ("%s", expr->u.bval ? "true" : "false"); break;
case FcOpCharSet: printf ("charset\n"); break;
@@ -263,7 +277,16 @@ FcExprPrint (const FcExpr *expr)
printf ("\n");
break;
case FcOpNil: printf ("nil\n"); break;
- case FcOpField: printf ("%s", FcObjectName(expr->u.object)); break;
+ case FcOpField: printf ("%s ", FcObjectName(expr->u.name.object));
+ switch ((int) expr->u.name.kind) {
+ case FcMatchPattern:
+ printf ("(pattern) ");
+ break;
+ case FcMatchFont:
+ printf ("(font) ");
+ break;
+ }
+ break;
case FcOpConst: printf ("%s", expr->u.constant); break;
case FcOpQuest:
FcExprPrint (expr->u.tree.left);
@@ -432,15 +455,17 @@ int FcDebugVal;
void
FcInitDebug (void)
{
- char *e;
+ if (!FcDebugVal) {
+ char *e;
- e = getenv ("FC_DEBUG");
- if (e)
- {
- printf ("FC_DEBUG=%s\n", e);
- FcDebugVal = atoi (e);
- if (FcDebugVal < 0)
- FcDebugVal = 0;
+ e = getenv ("FC_DEBUG");
+ if (e)
+ {
+ printf ("FC_DEBUG=%s\n", e);
+ FcDebugVal = atoi (e);
+ if (FcDebugVal < 0)
+ FcDebugVal = 0;
+ }
}
}
#define __fcdbg__
diff --git a/fontconfig/src/fcdefault.c b/fontconfig/src/fcdefault.c
index 8ad1b1e90..6937994b7 100644
--- a/fontconfig/src/fcdefault.c
+++ b/fontconfig/src/fcdefault.c
@@ -25,6 +25,8 @@
#include "fcint.h"
#include <string.h>
+/* MT-safe */
+
static const struct {
FcObject field;
FcBool value;
@@ -32,7 +34,6 @@ static const struct {
{ FC_HINTING_OBJECT, FcTrue }, /* !FT_LOAD_NO_HINTING */
{ FC_VERTICAL_LAYOUT_OBJECT, FcFalse }, /* FC_LOAD_VERTICAL_LAYOUT */
{ FC_AUTOHINT_OBJECT, FcFalse }, /* FC_LOAD_FORCE_AUTOHINT */
- /* XXX: FC_GLOBAL_ADVANCE is deprecated */
{ FC_GLOBAL_ADVANCE_OBJECT, FcTrue }, /* !FC_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */
{ FC_EMBEDDED_BITMAP_OBJECT, FcTrue }, /* !FC_LOAD_NO_BITMAP */
{ FC_DECORATIVE_OBJECT, FcFalse },
@@ -40,45 +41,85 @@ static const struct {
#define NUM_FC_BOOL_DEFAULTS (int) (sizeof FcBoolDefaults / sizeof FcBoolDefaults[0])
+FcStrSet *default_langs;
+
FcStrSet *
FcGetDefaultLangs (void)
{
- FcStrSet *result = FcStrSetCreate ();
- char *langs;
-
- langs = getenv ("FC_LANG");
- if (!langs || !langs[0])
- langs = getenv ("LC_ALL");
- if (!langs || !langs[0])
- langs = getenv ("LC_CTYPE");
- if (!langs || !langs[0])
- langs = getenv ("LANG");
- if (langs && langs[0])
+ FcStrSet *result;
+retry:
+ result = (FcStrSet *) fc_atomic_ptr_get (&default_langs);
+ if (!result)
{
- if (!FcStrSetAddLangs (result, langs))
+ char *langs;
+
+ result = FcStrSetCreate ();
+
+ langs = getenv ("FC_LANG");
+ if (!langs || !langs[0])
+ langs = getenv ("LC_ALL");
+ if (!langs || !langs[0])
+ langs = getenv ("LC_CTYPE");
+ if (!langs || !langs[0])
+ langs = getenv ("LANG");
+ if (langs && langs[0])
+ {
+ if (!FcStrSetAddLangs (result, langs))
+ FcStrSetAdd (result, (const FcChar8 *) "en");
+ }
+ else
FcStrSetAdd (result, (const FcChar8 *) "en");
+
+ FcRefSetConst (&result->ref);
+ if (!fc_atomic_ptr_cmpexch (&default_langs, NULL, result)) {
+ FcRefInit (&result->ref, 1);
+ FcStrSetDestroy (result);
+ goto retry;
+ }
}
- else
- FcStrSetAdd (result, (const FcChar8 *) "en");
return result;
}
+static FcChar8 *default_lang; /* MT-safe */
+
FcChar8 *
FcGetDefaultLang (void)
{
- static FcChar8 lang_local[128] = {0};
- FcStrSet *langs;
-
- if (!lang_local[0])
+ FcChar8 *lang;
+retry:
+ lang = fc_atomic_ptr_get (&default_lang);
+ if (!lang)
{
- langs = FcGetDefaultLangs ();
- strncpy ((char *)lang_local, (const char *)langs->strs[0], 127);
- lang_local[127] = 0;
+ FcStrSet *langs = FcGetDefaultLangs ();
+ lang = FcStrdup (langs->strs[0]);
FcStrSetDestroy (langs);
+
+ if (!fc_atomic_ptr_cmpexch (&default_lang, NULL, lang)) {
+ free (lang);
+ goto retry;
+ }
}
- return lang_local;
+ return lang;
+}
+
+void
+FcDefaultFini (void)
+{
+ FcChar8 *lang;
+ FcStrSet *langs;
+
+ lang = fc_atomic_ptr_get (&default_lang);
+ if (lang && fc_atomic_ptr_cmpexch (&default_lang, lang, NULL)) {
+ free (lang);
+ }
+
+ langs = fc_atomic_ptr_get (&default_langs);
+ if (langs && fc_atomic_ptr_cmpexch (&default_langs, langs, NULL)) {
+ FcRefInit (&langs->ref, 1);
+ FcStrSetDestroy (langs);
+ }
}
void
@@ -154,7 +195,7 @@ FcDefaultSubstitute (FcPattern *pattern)
* exact matched "en" has higher score than ll-cc.
*/
v2.type = FcTypeString;
- v2.u.s = FcSharedStr ((FcChar8 *)"en-us");
+ v2.u.s = FcStrdup ("en-us");
if (FcPatternObjectGet (pattern, FC_FAMILYLANG_OBJECT, 0, &v) == FcResultNoMatch)
{
FcPatternObjectAdd (pattern, FC_FAMILYLANG_OBJECT, namelang, FcTrue);
@@ -170,7 +211,7 @@ FcDefaultSubstitute (FcPattern *pattern)
FcPatternObjectAdd (pattern, FC_FULLNAMELANG_OBJECT, namelang, FcTrue);
FcPatternObjectAddWithBinding (pattern, FC_FULLNAMELANG_OBJECT, v2, FcValueBindingWeak, FcTrue);
}
- FcSharedStrFree (v2.u.s);
+ FcFree (v2.u.s);
}
#define __fcdefault__
#include "fcaliastail.h"
diff --git a/fontconfig/src/fcdir.c b/fontconfig/src/fcdir.c
index 6869ea179..dc580bb6f 100644
--- a/fontconfig/src/fcdir.c
+++ b/fontconfig/src/fcdir.c
@@ -126,10 +126,10 @@ FcFileScanConfig (FcFontSet *set,
FcBool
FcFileScan (FcFontSet *set,
FcStrSet *dirs,
- FcFileCache *cache, /* XXX unused */
+ FcFileCache *cache FC_UNUSED,
FcBlanks *blanks,
const FcChar8 *file,
- FcBool force)
+ FcBool force FC_UNUSED)
{
return FcFileScanConfig (set, dirs, blanks, file, FcConfigGetCurrent ());
}
@@ -316,7 +316,7 @@ FcDirCacheRead (const FcChar8 *dir, FcBool force, FcConfig *config)
}
FcBool
-FcDirSave (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir)
+FcDirSave (FcFontSet *set FC_UNUSED, FcStrSet * dirs FC_UNUSED, const FcChar8 *dir FC_UNUSED)
{
return FcFalse; /* XXX deprecated */
}
diff --git a/fontconfig/src/fcformat.c b/fontconfig/src/fcformat.c
index 8eef7bb29..59f8681df 100644
--- a/fontconfig/src/fcformat.c
+++ b/fontconfig/src/fcformat.c
@@ -358,7 +358,7 @@ skip_percent (FcFormatContext *c)
/* skip an optional width specifier */
if (strtol ((const char *) c->format, (char **) &c->format, 10))
- /* don't care */;
+ {/* don't care */}
if (!expect_char (c, '{'))
return FcFalse;
@@ -790,7 +790,7 @@ interpret_simple (FcFormatContext *c,
}
static FcBool
-cescape (FcFormatContext *c,
+cescape (FcFormatContext *c FC_UNUSED,
const FcChar8 *str,
FcStrBuf *buf)
{
@@ -811,7 +811,7 @@ cescape (FcFormatContext *c,
}
static FcBool
-shescape (FcFormatContext *c,
+shescape (FcFormatContext *c FC_UNUSED,
const FcChar8 *str,
FcStrBuf *buf)
{
@@ -829,7 +829,7 @@ shescape (FcFormatContext *c,
}
static FcBool
-xmlescape (FcFormatContext *c,
+xmlescape (FcFormatContext *c FC_UNUSED,
const FcChar8 *str,
FcStrBuf *buf)
{
@@ -1193,12 +1193,19 @@ FcPatternFormat (FcPattern *pat,
{
FcStrBuf buf;
FcChar8 buf_static[8192 - 1024];
+ FcPattern *alloced = NULL;
FcBool ret;
+ if (!pat)
+ alloced = pat = FcPatternCreate ();
+
FcStrBufInit (&buf, buf_static, sizeof (buf_static));
ret = FcPatternFormatToBuf (pat, format, &buf);
+ if (alloced)
+ FcPatternDestroy (alloced);
+
if (ret)
return FcStrBufDone (&buf);
else
diff --git a/fontconfig/src/fcfreetype.c b/fontconfig/src/fcfreetype.c
index fb2b0f2f9..9ac2fa901 100644
--- a/fontconfig/src/fcfreetype.c
+++ b/fontconfig/src/fcfreetype.c
@@ -1005,7 +1005,6 @@ static const FcStringConst slantConsts[] = {
#define NUM_SLANT_CONSTS (int) (sizeof (slantConsts) / sizeof (slantConsts[0]))
-#define FcIsSlant(s) FcStringIsConst(s,slantConsts,NUM_SLANT_CONSTS)
#define FcContainsSlant(s) FcStringContainsConst (s,slantConsts,NUM_SLANT_CONSTS)
static const FcStringConst decorativeConsts[] = {
@@ -1019,7 +1018,6 @@ static const FcStringConst decorativeConsts[] = {
#define NUM_DECORATIVE_CONSTS (int) (sizeof (decorativeConsts) / sizeof (decorativeConsts[0]))
-#define FcIsDecorative(s) FcStringIsConst(s,decorativeConsts,NUM_DECORATIVE_CONSTS)
#define FcContainsDecorative(s) FcStringContainsConst (s,decorativeConsts,NUM_DECORATIVE_CONSTS)
static double
@@ -1119,8 +1117,8 @@ FcFreeTypeQueryFace (const FT_Face face,
int nstyle_lang = 0;
int nfullname = 0;
int nfullname_lang = 0;
- int p, platform;
- int n, nameid;
+ unsigned int p, n;
+ int platform, nameid;
FcChar8 *style = 0;
int st;
@@ -1201,7 +1199,7 @@ FcFreeTypeQueryFace (const FT_Face face,
}
else
{
- int sp;
+ unsigned int sp;
for (sp = 0; sp < NUM_PLATFORM_ORDER; sp++)
if (sname.platform_id == platform_order[sp])
@@ -2262,7 +2260,7 @@ FcFreeTypeCheckGlyph (FT_Face face, FcChar32 ucs4,
*advance = slot->metrics.horiAdvance;
- switch (slot->format) {
+ switch ((int) slot->format) {
case ft_glyph_format_bitmap:
/*
* Bitmaps are assumed to be reasonable; if
@@ -2598,7 +2596,7 @@ addtag(FcChar8 *complex_, FT_ULong tag)
if (*complex_ != '\0')
strcat ((char *) complex_, " ");
- strcat ((char *) complex_, "otlayout:");
+ strcat ((char *) complex_, OTLAYOUT_HEAD);
strcat ((char *) complex_, (char *) tagstring);
}
diff --git a/fontconfig/src/fcfs.c b/fontconfig/src/fcfs.c
index 6625687c1..941abba8f 100644
--- a/fontconfig/src/fcfs.c
+++ b/fontconfig/src/fcfs.c
@@ -33,7 +33,6 @@ FcFontSetCreate (void)
s = (FcFontSet *) malloc (sizeof (FcFontSet));
if (!s)
return 0;
- FcMemAlloc (FC_MEM_FONTSET, sizeof (FcFontSet));
s->nfont = 0;
s->sfont = 0;
s->fonts = 0;
@@ -48,11 +47,7 @@ FcFontSetDestroy (FcFontSet *s)
for (i = 0; i < s->nfont; i++)
FcPatternDestroy (s->fonts[i]);
if (s->fonts)
- {
- FcMemFree (FC_MEM_FONTPTR, s->sfont * sizeof (FcPattern *));
free (s->fonts);
- }
- FcMemFree (FC_MEM_FONTSET, sizeof (FcFontSet));
free (s);
}
@@ -71,9 +66,6 @@ FcFontSetAdd (FcFontSet *s, FcPattern *font)
f = (FcPattern **) malloc (sfont * sizeof (FcPattern *));
if (!f)
return FcFalse;
- if (s->sfont)
- FcMemFree (FC_MEM_FONTPTR, s->sfont * sizeof (FcPattern *));
- FcMemAlloc (FC_MEM_FONTPTR, sfont * sizeof (FcPattern *));
s->sfont = sfont;
s->fonts = f;
}
diff --git a/fontconfig/src/fcinit.c b/fontconfig/src/fcinit.c
index 606483d8d..2360764fc 100644
--- a/fontconfig/src/fcinit.c
+++ b/fontconfig/src/fcinit.c
@@ -25,6 +25,16 @@
#include "fcint.h"
#include <stdlib.h>
+#if defined(FC_ATOMIC_INT_NIL)
+#pragma message("Could not find any system to define atomic_int macros, library may NOT be thread-safe.")
+#endif
+#if defined(FC_MUTEX_IMPL_NIL)
+#pragma message("Could not find any system to define mutex macros, library may NOT be thread-safe.")
+#endif
+#if defined(FC_ATOMIC_INT_NIL) || defined(FC_MUTEX_IMPL_NIL)
+#pragma message("To suppress these warnings, define FC_NO_MT.")
+#endif
+
static FcConfig *
FcInitFallbackConfig (void)
{
@@ -88,8 +98,6 @@ FcInitLoadConfig (void)
if (!p)
goto bail;
prefix = p;
- FcMemFree (FC_MEM_STRING, plen + 1);
- FcMemAlloc (FC_MEM_STRING, plen + 12);
memcpy (&prefix[plen], FC_DIR_SEPARATOR_S "fontconfig", 11);
prefix[plen + 11] = 0;
fprintf (stderr,
@@ -137,17 +145,7 @@ FcInitLoadConfigAndFonts (void)
FcBool
FcInit (void)
{
- FcConfig *config;
-
- if (_fcConfig)
- return FcTrue;
- config = FcInitLoadConfigAndFonts ();
- if (!config)
- return FcFalse;
- FcConfigSetCurrent (config);
- if (FcDebug() & FC_DBG_MEMORY)
- FcMemReport ();
- return FcTrue;
+ return FcConfigInit ();
}
/*
@@ -156,13 +154,9 @@ FcInit (void)
void
FcFini (void)
{
- if (_fcConfig)
- FcConfigDestroy (_fcConfig);
-
- FcObjectFini ();
+ FcConfigFini ();
FcCacheFini ();
- if (FcDebug() & FC_DBG_MEMORY)
- FcMemReport ();
+ FcDefaultFini ();
}
/*
@@ -176,8 +170,7 @@ FcInitReinitialize (void)
config = FcInitLoadConfigAndFonts ();
if (!config)
return FcFalse;
- FcConfigSetCurrent (config);
- return FcTrue;
+ return FcConfigSetCurrent (config);
}
FcBool
@@ -205,105 +198,6 @@ FcInitBringUptoDate (void)
return FcInitReinitialize ();
}
-static struct {
- char name[16];
- int alloc_count;
- int alloc_mem;
- int free_count;
- int free_mem;
-} FcInUse[FC_MEM_NUM] = {
- { "charset" },
- { "charleaf" },
- { "fontset" },
- { "fontptr" },
- { "objectset" },
- { "objectptr" },
- { "matrix" },
- { "pattern" },
- { "patelt" },
- { "vallist" },
- { "substate" },
- { "string" },
- { "listbuck" },
- { "strset" },
- { "strlist" },
- { "config" },
- { "langset" },
- { "atomic" },
- { "blanks" },
- { "cache" },
- { "strbuf" },
- { "subst" },
- { "objecttype" },
- { "constant" },
- { "test" },
- { "expr" },
- { "vstack" },
- { "attr" },
- { "pstack" },
- { "sharedstr" },
-};
-
-static int FcAllocCount, FcAllocMem;
-static int FcFreeCount, FcFreeMem;
-
-static int FcMemNotice = 1*1024*1024;
-
-static int FcAllocNotify, FcFreeNotify;
-
-void
-FcMemReport (void)
-{
- int i;
- printf ("Fc Memory Usage:\n");
- printf ("\t Which Alloc Free Active\n");
- printf ("\t count bytes count bytes count bytes\n");
- for (i = 0; i < FC_MEM_NUM; i++)
- printf ("%16.16s%8d%8d%8d%8d%8d%8d\n",
- FcInUse[i].name,
- FcInUse[i].alloc_count, FcInUse[i].alloc_mem,
- FcInUse[i].free_count, FcInUse[i].free_mem,
- FcInUse[i].alloc_count - FcInUse[i].free_count,
- FcInUse[i].alloc_mem - FcInUse[i].free_mem);
- printf ("%16.16s%8d%8d%8d%8d%8d%8d\n",
- "Total",
- FcAllocCount, FcAllocMem,
- FcFreeCount, FcFreeMem,
- FcAllocCount - FcFreeCount,
- FcAllocMem - FcFreeMem);
- FcAllocNotify = 0;
- FcFreeNotify = 0;
-}
-
-void
-FcMemAlloc (int kind, int size)
-{
- if (FcDebug() & FC_DBG_MEMORY)
- {
- FcInUse[kind].alloc_count++;
- FcInUse[kind].alloc_mem += size;
- FcAllocCount++;
- FcAllocMem += size;
- FcAllocNotify += size;
- if (FcAllocNotify > FcMemNotice)
- FcMemReport ();
- }
-}
-
-void
-FcMemFree (int kind, int size)
-{
- if (FcDebug() & FC_DBG_MEMORY)
- {
- FcInUse[kind].free_count++;
- FcInUse[kind].free_mem += size;
- FcFreeCount++;
- FcFreeMem += size;
- FcFreeNotify += size;
- if (FcFreeNotify > FcMemNotice)
- FcMemReport ();
- }
-}
#define __fcinit__
#include "fcaliastail.h"
#undef __fcinit__
diff --git a/fontconfig/src/fcint.h b/fontconfig/src/fcint.h
index 87c7b9a9f..38bd9bb73 100644
--- a/fontconfig/src/fcint.h
+++ b/fontconfig/src/fcint.h
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
+#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <stddef.h>
@@ -44,18 +45,15 @@
#include <fontconfig/fontconfig.h>
#include <fontconfig/fcprivate.h>
#include "fcdeprecate.h"
+#include "fcmutex.h"
+#include "fcatomic.h"
#ifndef FC_CONFIG_PATH
#define FC_CONFIG_PATH "fonts.conf"
#endif
#ifdef _WIN32
-# ifndef _WIN32_WINNT
-# define _WIN32_WINNT 0x0500
-# endif
-# define WIN32_LEAN_AND_MEAN
-# define STRICT
-# include <windows.h>
+# include "fcwindows.h"
typedef UINT (WINAPI *pfnGetSystemWindowsDirectory)(LPSTR, UINT);
typedef HRESULT (WINAPI *pfnSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
extern pfnGetSystemWindowsDirectory pGetSystemWindowsDirectory;
@@ -69,6 +67,12 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
# define FC_DIR_SEPARATOR_S "/"
#endif
+#if __GNUC__ >= 4
+#define FC_UNUSED __attribute__((unused))
+#else
+#define FC_UNUSED
+#endif
+
#define FC_DBG_MATCH 1
#define FC_DBG_MATCHV 2
#define FC_DBG_EDIT 4
@@ -78,43 +82,8 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
#define FC_DBG_PARSE 64
#define FC_DBG_SCAN 128
#define FC_DBG_SCANV 256
-#define FC_DBG_MEMORY 512
#define FC_DBG_CONFIG 1024
#define FC_DBG_LANGSET 2048
-#define FC_DBG_OBJTYPES 4096
-
-#define FC_MEM_CHARSET 0
-#define FC_MEM_CHARLEAF 1
-#define FC_MEM_FONTSET 2
-#define FC_MEM_FONTPTR 3
-#define FC_MEM_OBJECTSET 4
-#define FC_MEM_OBJECTPTR 5
-#define FC_MEM_MATRIX 6
-#define FC_MEM_PATTERN 7
-#define FC_MEM_PATELT 8
-#define FC_MEM_VALLIST 9
-#define FC_MEM_SUBSTATE 10
-#define FC_MEM_STRING 11
-#define FC_MEM_LISTBUCK 12
-#define FC_MEM_STRSET 13
-#define FC_MEM_STRLIST 14
-#define FC_MEM_CONFIG 15
-#define FC_MEM_LANGSET 16
-#define FC_MEM_ATOMIC 17
-#define FC_MEM_BLANKS 18
-#define FC_MEM_CACHE 19
-#define FC_MEM_STRBUF 20
-#define FC_MEM_SUBST 21
-#define FC_MEM_OBJECTTYPE 22
-#define FC_MEM_CONSTANT 23
-#define FC_MEM_TEST 24
-#define FC_MEM_EXPR 25
-#define FC_MEM_VSTACK 26
-#define FC_MEM_ATTR 27
-#define FC_MEM_PSTACK 28
-#define FC_MEM_SHAREDSTR 29
-
-#define FC_MEM_NUM 30
#define _FC_ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1]
#define _FC_ASSERT_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond))
@@ -135,10 +104,15 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
#define FcPrivate
#endif
+FC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int));
+
typedef enum _FcValueBinding {
FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame
} FcValueBinding;
+#define FcStrdup(s) ((FcChar8 *) strdup ((const char *) (s)))
+#define FcFree(s) (free ((FcChar8 *) (s)))
+
/*
* Serialized data structures use only offsets instead of pointers
* A low bit of 1 indicates an offset.
@@ -215,7 +189,7 @@ struct _FcPattern {
int num;
int size;
intptr_t elts_offset;
- int ref;
+ FcRef ref;
};
#define FcPatternElts(p) FcOffsetMember(p,elts_offset,FcPatternElt)
@@ -251,17 +225,28 @@ typedef enum _FcOpFlags {
#define FC_OP_GET_FLAGS(_x_) (((_x_) & 0xffff0000) >> 16)
#define FC_OP(_x_,_f_) (FC_OP_GET_OP (_x_) | ((_f_) << 16))
+typedef struct _FcExprMatrix {
+ struct _FcExpr *xx, *xy, *yx, *yy;
+} FcExprMatrix;
+
+typedef struct _FcExprName {
+ FcObject object;
+ FcMatchKind kind;
+} FcExprName;
+
+
typedef struct _FcExpr {
FcOp op;
union {
int ival;
double dval;
const FcChar8 *sval;
- FcMatrix *mval;
+ FcExprMatrix *mexpr;
FcBool bval;
FcCharSet *cval;
FcLangSet *lval;
- FcObject object;
+
+ FcExprName name;
const FcChar8 *constant;
struct {
struct _FcExpr *left, *right;
@@ -311,10 +296,8 @@ typedef struct _FcCharLeaf {
FcChar32 map[256/32];
} FcCharLeaf;
-#define FC_REF_CONSTANT -1
-
struct _FcCharSet {
- int ref; /* reference count */
+ FcRef ref; /* reference count */
int num; /* size of leaves and numbers arrays */
intptr_t leaves_offset;
intptr_t numbers_offset;
@@ -327,7 +310,7 @@ struct _FcCharSet {
#define FcCharSetNumbers(c) FcOffsetMember(c,numbers_offset,FcChar16)
struct _FcStrSet {
- int ref; /* reference count */
+ FcRef ref; /* reference count */
int num;
int size;
FcChar8 **strs;
@@ -348,7 +331,7 @@ typedef struct _FcStrBuf {
} FcStrBuf;
struct _FcCache {
- int magic; /* FC_CACHE_MAGIC_MMAP or FC_CACHE_ALLOC */
+ unsigned int magic; /* FC_CACHE_MAGIC_MMAP or FC_CACHE_ALLOC */
int version; /* FC_CACHE_CONTENT_VERSION */
intptr_t size; /* size of file */
intptr_t dir; /* offset to dir name */
@@ -441,7 +424,7 @@ typedef struct _FcCaseFold {
#define FC_CACHE_MAGIC_MMAP 0xFC02FC04
#define FC_CACHE_MAGIC_ALLOC 0xFC02FC05
-#define FC_CACHE_CONTENT_VERSION 3 /* also check FC_CACHE_VERSION */
+#define FC_CACHE_CONTENT_VERSION 3
struct _FcAtomic {
FcChar8 *file; /* original file name */
@@ -515,13 +498,11 @@ struct _FcConfig {
time_t rescanTime; /* last time information was scanned */
int rescanInterval; /* interval between scans */
- int ref; /* reference count */
+ FcRef ref; /* reference count */
FcExprPage *expr_pool; /* pool of FcExpr's */
};
-extern FcPrivate FcConfig *_fcConfig;
-
typedef struct _FcFileTime {
time_t time;
FcBool set;
@@ -543,6 +524,17 @@ struct _FcStatFS {
FcBool is_mtime_broken;
};
+typedef struct _FcValuePromotionBuffer FcValuePromotionBuffer;
+
+struct _FcValuePromotionBuffer {
+ union {
+ double d;
+ int i;
+ long l;
+ char c[256]; /* Enlarge as needed */
+ } u;
+};
+
/* fcblanks.c */
/* fccache.c */
@@ -573,6 +565,12 @@ FcDirCacheReference (FcCache *cache, int nref);
/* fccfg.c */
+FcPrivate FcBool
+FcConfigInit (void);
+
+FcPrivate void
+FcConfigFini (void);
+
FcPrivate FcChar8 *
FcConfigXdgCacheHome (void);
@@ -720,6 +718,10 @@ FcPrivate FcChar16 *
FcCharSetGetNumbers(const FcCharSet *c);
/* fcdbg.c */
+
+FcPrivate void
+FcValuePrintFile (FILE *f, const FcValue v);
+
FcPrivate void
FcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark);
@@ -761,6 +763,9 @@ FcInitDebug (void);
FcPrivate FcChar8 *
FcGetDefaultLang (void);
+FcPrivate void
+FcDefaultFini (void);
+
/* fcdir.c */
FcPrivate FcBool
@@ -800,17 +805,6 @@ FcTestDestroy (FcTest *test);
FcPrivate void
FcEditDestroy (FcEdit *e);
-/* fcinit.c */
-
-FcPrivate void
-FcMemReport (void);
-
-FcPrivate void
-FcMemAlloc (int kind, int size);
-
-FcPrivate void
-FcMemFree (int kind, int size);
-
/* fclang.c */
FcPrivate FcLangSet *
FcFreeTypeLangSet (const FcCharSet *charset,
@@ -823,7 +817,7 @@ FcPrivate FcLangResult
FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
FcPrivate FcLangSet *
-FcLangSetPromote (const FcChar8 *lang);
+FcLangSetPromote (const FcChar8 *lang, FcValuePromotionBuffer *buf);
FcPrivate FcLangSet *
FcNameParseLangSet (const FcChar8 *string);
@@ -844,54 +838,14 @@ FcListPatternMatchAny (const FcPattern *p,
/* fcname.c */
-/*
- * NOTE -- this ordering is part of the cache file format.
- * It must also match the ordering in fcname.c
- */
-
-#define FC_FAMILY_OBJECT 1
-#define FC_FAMILYLANG_OBJECT 2
-#define FC_STYLE_OBJECT 3
-#define FC_STYLELANG_OBJECT 4
-#define FC_FULLNAME_OBJECT 5
-#define FC_FULLNAMELANG_OBJECT 6
-#define FC_SLANT_OBJECT 7
-#define FC_WEIGHT_OBJECT 8
-#define FC_WIDTH_OBJECT 9
-#define FC_SIZE_OBJECT 10
-#define FC_ASPECT_OBJECT 11
-#define FC_PIXEL_SIZE_OBJECT 12
-#define FC_SPACING_OBJECT 13
-#define FC_FOUNDRY_OBJECT 14
-#define FC_ANTIALIAS_OBJECT 15
-#define FC_HINT_STYLE_OBJECT 16
-#define FC_HINTING_OBJECT 17
-#define FC_VERTICAL_LAYOUT_OBJECT 18
-#define FC_AUTOHINT_OBJECT 19
-#define FC_GLOBAL_ADVANCE_OBJECT 20 /* deprecated */
-#define FC_FILE_OBJECT 21
-#define FC_INDEX_OBJECT 22
-#define FC_RASTERIZER_OBJECT 23
-#define FC_OUTLINE_OBJECT 24
-#define FC_SCALABLE_OBJECT 25
-#define FC_DPI_OBJECT 26
-#define FC_RGBA_OBJECT 27
-#define FC_SCALE_OBJECT 28
-#define FC_MINSPACE_OBJECT 29
-#define FC_CHAR_WIDTH_OBJECT 30
-#define FC_CHAR_HEIGHT_OBJECT 31
-#define FC_MATRIX_OBJECT 32
-#define FC_CHARSET_OBJECT 33
-#define FC_LANG_OBJECT 34
-#define FC_FONTVERSION_OBJECT 35
-#define FC_CAPABILITY_OBJECT 36
-#define FC_FONTFORMAT_OBJECT 37
-#define FC_EMBOLDEN_OBJECT 38
-#define FC_EMBEDDED_BITMAP_OBJECT 39
-#define FC_DECORATIVE_OBJECT 40
-#define FC_LCD_FILTER_OBJECT 41
-#define FC_NAMELANG_OBJECT 42
-#define FC_MAX_BASE_OBJECT FC_NAMELANG_OBJECT
+enum {
+ FC_INVALID_OBJECT = 0,
+#define FC_OBJECT(NAME, Type) FC_##NAME##_OBJECT,
+#include "fcobjs.h"
+#undef FC_OBJECT
+ FC_ONE_AFTER_MAX_BASE_OBJECT
+#define FC_MAX_BASE_OBJECT (FC_ONE_AFTER_MAX_BASE_OBJECT - 1)
+};
FcPrivate FcBool
FcNameBool (const FcChar8 *v, FcBool *result);
@@ -908,12 +862,6 @@ FcObjectName (FcObject object);
FcPrivate FcObjectSet *
FcObjectGetSet (void);
-FcPrivate FcBool
-FcObjectInit (void);
-
-FcPrivate void
-FcObjectFini (void);
-
#define FcObjectCompare(a, b) ((int) a - (int) b)
/* fcpat.c */
@@ -1019,12 +967,6 @@ FcPatternObjectGetLangSet (const FcPattern *p, FcObject object, int n, FcLangSet
FcPrivate FcBool
FcPatternAppend (FcPattern *p, FcPattern *s);
-FcPrivate const FcChar8 *
-FcSharedStr (const FcChar8 *name);
-
-FcPrivate FcBool
-FcSharedStrFree (const FcChar8 *name);
-
FcPrivate FcChar32
FcStringHash (const FcChar8 *s);
@@ -1127,4 +1069,21 @@ FcStrSerializeAlloc (FcSerialize *serialize, const FcChar8 *str);
FcPrivate FcChar8 *
FcStrSerialize (FcSerialize *serialize, const FcChar8 *str);
+/* fcobjs.c */
+
+FcPrivate FcObject
+FcObjectLookupIdByName (const char *str);
+
+FcPrivate FcObject
+FcObjectLookupBuiltinIdByName (const char *str);
+
+FcPrivate const char *
+FcObjectLookupOtherNameById (FcObject id);
+
+FcPrivate const FcObjectType *
+FcObjectLookupOtherTypeById (FcObject id);
+
+FcPrivate const FcObjectType *
+FcObjectLookupOtherTypeByName (const char *str);
+
#endif /* _FC_INT_H_ */
diff --git a/fontconfig/src/fclang.c b/fontconfig/src/fclang.c
index 65d22a932..8e9b094b2 100644
--- a/fontconfig/src/fclang.c
+++ b/fontconfig/src/fclang.c
@@ -22,10 +22,11 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-#include <string.h>
#include "fcint.h"
#include "fcftint.h"
+/* Objects MT-safe for readonly access. */
+
typedef struct {
const FcChar8 lang[8];
const FcCharSet charset;
@@ -51,7 +52,7 @@ static void
FcLangSetBitSet (FcLangSet *ls,
unsigned int id)
{
- int bucket;
+ unsigned int bucket;
id = fcLangCharSetIndices[id];
bucket = id >> 5;
@@ -65,7 +66,7 @@ static FcBool
FcLangSetBitGet (const FcLangSet *ls,
unsigned int id)
{
- int bucket;
+ unsigned int bucket;
id = fcLangCharSetIndices[id];
bucket = id >> 5;
@@ -79,7 +80,7 @@ static void
FcLangSetBitReset (FcLangSet *ls,
unsigned int id)
{
- int bucket;
+ unsigned int bucket;
id = fcLangCharSetIndices[id];
bucket = id >> 5;
@@ -182,7 +183,7 @@ FcLangNormalize (const FcChar8 *lang)
{
FcChar8 *result = NULL, *s, *orig;
char *territory, *encoding, *modifier;
- size_t llen, tlen = 0, mlen = 0, ssize;
+ size_t llen, tlen = 0, mlen = 0;
if (!lang || !*lang)
return NULL;
@@ -197,10 +198,6 @@ FcLangNormalize (const FcChar8 *lang)
s = FcStrCopy (lang);
if (!s)
goto bail;
- /* store the original length of 's' here to let FcMemFree know
- * the correct size since we breaks 's' from now on.
- */
- ssize = strlen ((const char *)s) + 1;
/* from the comments in glibc:
*
@@ -289,8 +286,6 @@ FcLangNormalize (const FcChar8 *lang)
/* we'll miss the opportunity to reduce the correct size
* of the allocated memory for the string after that.
*/
- FcMemFree (FC_MEM_STRING, ssize);
- FcMemAlloc (FC_MEM_STRING, strlen((const char *)s) + 1);
s = NULL;
goto bail1;
}
@@ -307,8 +302,6 @@ FcLangNormalize (const FcChar8 *lang)
/* we'll miss the opportunity to reduce the correct size
* of the allocated memory for the string after that.
*/
- FcMemFree (FC_MEM_STRING, ssize);
- FcMemAlloc (FC_MEM_STRING, strlen((const char *)s) + 1);
s = NULL;
goto bail1;
}
@@ -329,8 +322,6 @@ FcLangNormalize (const FcChar8 *lang)
/* we'll miss the opportunity to reduce the correct size
* of the allocated memory for the string after that.
*/
- FcMemFree (FC_MEM_STRING, ssize);
- FcMemAlloc (FC_MEM_STRING, strlen((const char *)s) + 1);
s = NULL;
}
bail1:
@@ -338,10 +329,7 @@ FcLangNormalize (const FcChar8 *lang)
FcStrFree (orig);
bail0:
if (s)
- {
free (s);
- FcMemFree (FC_MEM_STRING, ssize);
- }
bail:
if (FcDebug () & FC_DBG_LANGSET)
{
@@ -465,7 +453,6 @@ FcLangSetCreate (void)
ls = malloc (sizeof (FcLangSet));
if (!ls)
return 0;
- FcMemAlloc (FC_MEM_LANGSET, sizeof (FcLangSet));
memset (ls->map, '\0', sizeof (ls->map));
ls->map_size = NUM_LANG_SET_MAP;
ls->extra = 0;
@@ -477,7 +464,6 @@ FcLangSetDestroy (FcLangSet *ls)
{
if (ls->extra)
FcStrSetDestroy (ls->extra);
- FcMemFree (FC_MEM_LANGSET, sizeof (FcLangSet));
free (ls);
}
@@ -717,34 +703,38 @@ FcLangSetCompare (const FcLangSet *lsa, const FcLangSet *lsb)
/*
* Used in computing values -- mustn't allocate any storage
- * XXX Not thread-safe
*/
FcLangSet *
-FcLangSetPromote (const FcChar8 *lang)
+FcLangSetPromote (const FcChar8 *lang, FcValuePromotionBuffer *vbuf)
{
- static FcLangSet ls;
- static FcStrSet strs;
- static FcChar8 *str;
- int id;
-
- memset (ls.map, '\0', sizeof (ls.map));
- ls.map_size = NUM_LANG_SET_MAP;
- ls.extra = 0;
+ int id;
+ typedef struct {
+ FcLangSet ls;
+ FcStrSet strs;
+ FcChar8 *str;
+ } FcLangSetPromotionBuffer;
+ FcLangSetPromotionBuffer *buf = (FcLangSetPromotionBuffer *) vbuf;
+
+ FC_ASSERT_STATIC (sizeof (FcLangSetPromotionBuffer) <= sizeof (FcValuePromotionBuffer));
+
+ memset (buf->ls.map, '\0', sizeof (buf->ls.map));
+ buf->ls.map_size = NUM_LANG_SET_MAP;
+ buf->ls.extra = 0;
id = FcLangSetIndex (lang);
if (id > 0)
{
- FcLangSetBitSet (&ls, id);
+ FcLangSetBitSet (&buf->ls, id);
}
else
{
- ls.extra = &strs;
- strs.num = 1;
- strs.size = 1;
- strs.strs = &str;
- strs.ref = 1;
- str = (FcChar8 *) lang;
+ buf->ls.extra = &buf->strs;
+ buf->strs.num = 1;
+ buf->strs.size = 1;
+ buf->strs.strs = &buf->str;
+ FcRefInit (&buf->strs.ref, 1);
+ buf->str = (FcChar8 *) lang;
}
- return &ls;
+ return &buf->ls;
}
FcChar32
diff --git a/fontconfig/src/fclist.c b/fontconfig/src/fclist.c
index 56f04329e..b7ae899cd 100644
--- a/fontconfig/src/fclist.c
+++ b/fontconfig/src/fclist.c
@@ -33,7 +33,6 @@ FcObjectSetCreate (void)
os = (FcObjectSet *) malloc (sizeof (FcObjectSet));
if (!os)
return 0;
- FcMemAlloc (FC_MEM_OBJECTSET, sizeof (FcObjectSet));
os->nobject = 0;
os->sobject = 0;
os->objects = 0;
@@ -57,9 +56,6 @@ FcObjectSetAdd (FcObjectSet *os, const char *object)
objects = (const char **) malloc (s * sizeof (const char *));
if (!objects)
return FcFalse;
- if (os->sobject)
- FcMemFree (FC_MEM_OBJECTPTR, os->sobject * sizeof (const char *));
- FcMemAlloc (FC_MEM_OBJECTPTR, s * sizeof (const char *));
os->objects = objects;
os->sobject = s;
}
@@ -67,14 +63,14 @@ FcObjectSetAdd (FcObjectSet *os, const char *object)
low = 0;
mid = 0;
c = 1;
- object = (char *)FcSharedStr ((FcChar8 *)object);
+ object = strdup (object);
while (low <= high)
{
mid = (low + high) >> 1;
c = os->objects[mid] - object;
if (c == 0)
{
- FcSharedStrFree ((FcChar8 *)object);
+ FcFree (object);
return FcTrue;
}
if (c < 0)
@@ -99,12 +95,10 @@ FcObjectSetDestroy (FcObjectSet *os)
if (os->objects)
{
for (i = 0; i < os->nobject; i++)
- FcSharedStrFree ((FcChar8 *)os->objects[i]);
+ FcFree (os->objects[i]);
- FcMemFree (FC_MEM_OBJECTPTR, os->sobject * sizeof (const char *));
free ((void *) os->objects);
}
- FcMemFree (FC_MEM_OBJECTSET, sizeof (FcObjectSet));
free (os);
}
@@ -342,7 +336,6 @@ FcListHashTableCleanup (FcListHashTable *table)
{
next = bucket->next;
FcPatternDestroy (bucket->pattern);
- FcMemFree (FC_MEM_LISTBUCK, sizeof (FcListBucket));
free (bucket);
}
table->buckets[i] = 0;
@@ -418,7 +411,6 @@ FcListAppend (FcListHashTable *table,
bucket = (FcListBucket *) malloc (sizeof (FcListBucket));
if (!bucket)
goto bail0;
- FcMemAlloc (FC_MEM_LISTBUCK, sizeof (FcListBucket));
bucket->next = 0;
bucket->hash = hash;
bucket->pattern = FcPatternCreate ();
@@ -469,7 +461,6 @@ FcListAppend (FcListHashTable *table,
bail2:
FcPatternDestroy (bucket->pattern);
bail1:
- FcMemFree (FC_MEM_LISTBUCK, sizeof (FcListBucket));
free (bucket);
bail0:
return FcFalse;
@@ -569,7 +560,6 @@ FcFontSetList (FcConfig *config,
if (!FcFontSetAdd (ret, bucket->pattern))
goto bail2;
table.buckets[i] = bucket->next;
- FcMemFree (FC_MEM_LISTBUCK, sizeof (FcListBucket));
free (bucket);
}
diff --git a/fontconfig/src/fcmatch.c b/fontconfig/src/fcmatch.c
index 970339201..6778967b9 100644
--- a/fontconfig/src/fcmatch.c
+++ b/fontconfig/src/fcmatch.c
@@ -23,17 +23,13 @@
*/
#include "fcint.h"
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
static double
FcCompareNumber (FcValue *value1, FcValue *value2)
{
double v1, v2, v;
- switch (value1->type) {
+ switch ((int) value1->type) {
case FcTypeInteger:
v1 = (double) value1->u.i;
break;
@@ -43,7 +39,7 @@ FcCompareNumber (FcValue *value1, FcValue *value2)
default:
return -1.0;
}
- switch (value2->type) {
+ switch ((int) value2->type) {
case FcTypeInteger:
v2 = (double) value2->u.i;
break;
@@ -86,9 +82,9 @@ FcCompareLang (FcValue *v1, FcValue *v2)
FcLangResult result;
FcValue value1 = FcValueCanonicalize(v1), value2 = FcValueCanonicalize(v2);
- switch (value1.type) {
+ switch ((int) value1.type) {
case FcTypeLangSet:
- switch (value2.type) {
+ switch ((int) value2.type) {
case FcTypeLangSet:
result = FcLangSetCompare (value1.u.l, value2.u.l);
break;
@@ -101,7 +97,7 @@ FcCompareLang (FcValue *v1, FcValue *v2)
}
break;
case FcTypeString:
- switch (value2.type) {
+ switch ((int) value2.type) {
case FcTypeLangSet:
result = FcLangSetHasLang (value2.u.l, value1.u.s);
break;
@@ -146,7 +142,7 @@ FcCompareSize (FcValue *value1, FcValue *value2)
{
double v1, v2, v;
- switch (value1->type) {
+ switch ((int) value1->type) {
case FcTypeInteger:
v1 = value1->u.i;
break;
@@ -156,7 +152,7 @@ FcCompareSize (FcValue *value1, FcValue *value2)
default:
return -1;
}
- switch (value2->type) {
+ switch ((int) value2->type) {
case FcTypeInteger:
v2 = value2->u.i;
break;
@@ -563,8 +559,7 @@ FcFontRenderPrepare (FcConfig *config,
}
static FcPattern *
-FcFontSetMatchInternal (FcConfig *config,
- FcFontSet **sets,
+FcFontSetMatchInternal (FcFontSet **sets,
int nsets,
FcPattern *p,
FcResult *result)
@@ -658,7 +653,7 @@ FcFontSetMatch (FcConfig *config,
if (!config)
return 0;
}
- best = FcFontSetMatchInternal (config, sets, nsets, p, result);
+ best = FcFontSetMatchInternal (sets, nsets, p, result);
if (best)
return FcFontRenderPrepare (config, p, best);
else
@@ -691,7 +686,7 @@ FcFontMatch (FcConfig *config,
if (config->fonts[FcSetApplication])
sets[nsets++] = config->fonts[FcSetApplication];
- best = FcFontSetMatchInternal (config, sets, nsets, p, result);
+ best = FcFontSetMatchInternal (sets, nsets, p, result);
if (best)
return FcFontRenderPrepare (config, p, best);
else
@@ -794,7 +789,7 @@ FcFontSetSortDestroy (FcFontSet *fs)
}
FcFontSet *
-FcFontSetSort (FcConfig *config,
+FcFontSetSort (FcConfig *config FC_UNUSED,
FcFontSet **sets,
int nsets,
FcPattern *p,
diff --git a/fontconfig/src/fcmatrix.c b/fontconfig/src/fcmatrix.c
index f0c613918..a6fbca2a0 100644
--- a/fontconfig/src/fcmatrix.c
+++ b/fontconfig/src/fcmatrix.c
@@ -38,7 +38,6 @@ FcMatrixCopy (const FcMatrix *mat)
r = (FcMatrix *) malloc (sizeof (*r) );
if (!r)
return 0;
- FcMemAlloc (FC_MEM_MATRIX, sizeof (FcMatrix));
*r = *mat;
return r;
}
@@ -47,10 +46,7 @@ void
FcMatrixFree (FcMatrix *mat)
{
if (mat != &FcIdentityMatrix)
- {
- FcMemFree (FC_MEM_MATRIX, sizeof (FcMatrix));
free (mat);
- }
}
FcBool
diff --git a/fontconfig/src/fcmutex.h b/fontconfig/src/fcmutex.h
new file mode 100644
index 000000000..556a05efc
--- /dev/null
+++ b/fontconfig/src/fcmutex.h
@@ -0,0 +1,127 @@
+/*
+ * Atomic int and pointer operations. Originally copied from HarfBuzz.
+ *
+ * Copyright © 2007 Chris Wilson
+ * Copyright © 2009,2010 Red Hat, Inc.
+ * Copyright © 2011,2012,2013 Google, Inc.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Contributor(s):
+ * Chris Wilson <chris@chris-wilson.co.uk>
+ * Red Hat Author(s): Behdad Esfahbod
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef _FCMUTEX_H_
+#define _FCMUTEX_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define FC_STMT_START do
+#define FC_STMT_END while (0)
+
+/* mutex */
+
+/* We need external help for these */
+
+#if 0
+
+
+#elif !defined(FC_NO_MT) && defined(_MSC_VER) || defined(__MINGW32__)
+
+#include "fcwindows.h"
+typedef CRITICAL_SECTION fc_mutex_impl_t;
+#define FC_MUTEX_IMPL_INIT { NULL, 0, 0, NULL, NULL, 0 }
+#define fc_mutex_impl_init(M) InitializeCriticalSection (M)
+#define fc_mutex_impl_lock(M) EnterCriticalSection (M)
+#define fc_mutex_impl_unlock(M) LeaveCriticalSection (M)
+#define fc_mutex_impl_finish(M) DeleteCriticalSection (M)
+
+
+#elif !defined(FC_NO_MT) && (defined(HAVE_PTHREAD) || defined(__APPLE__))
+
+#include <pthread.h>
+typedef pthread_mutex_t fc_mutex_impl_t;
+#define FC_MUTEX_IMPL_INIT PTHREAD_MUTEX_INITIALIZER
+#define fc_mutex_impl_init(M) pthread_mutex_init (M, NULL)
+#define fc_mutex_impl_lock(M) pthread_mutex_lock (M)
+#define fc_mutex_impl_unlock(M) pthread_mutex_unlock (M)
+#define fc_mutex_impl_finish(M) pthread_mutex_destroy (M)
+
+
+#elif !defined(FC_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
+
+#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_YIELD)
+# include <sched.h>
+# define FC_SCHED_YIELD() sched_yield ()
+#else
+# define FC_SCHED_YIELD() FC_STMT_START {} FC_STMT_END
+#endif
+
+/* This actually is not a totally awful implementation. */
+typedef volatile int fc_mutex_impl_t;
+#define FC_MUTEX_IMPL_INIT 0
+#define fc_mutex_impl_init(M) *(M) = 0
+#define fc_mutex_impl_lock(M) FC_STMT_START { while (__sync_lock_test_and_set((M), 1)) FC_SCHED_YIELD (); } FC_STMT_END
+#define fc_mutex_impl_unlock(M) __sync_lock_release (M)
+#define fc_mutex_impl_finish(M) FC_STMT_START {} FC_STMT_END
+
+
+#elif !defined(FC_NO_MT)
+
+#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_YIELD)
+# include <sched.h>
+# define FC_SCHED_YIELD() sched_yield ()
+#else
+# define FC_SCHED_YIELD() FC_STMT_START {} FC_STMT_END
+#endif
+
+#define FC_MUTEX_INT_NIL 1 /* Warn that fallback implementation is in use. */
+typedef volatile int fc_mutex_impl_t;
+#define FC_MUTEX_IMPL_INIT 0
+#define fc_mutex_impl_init(M) *(M) = 0
+#define fc_mutex_impl_lock(M) FC_STMT_START { while (*(M)) FC_SCHED_YIELD (); (*(M))++; } FC_STMT_END
+#define fc_mutex_impl_unlock(M) (*(M))--;
+#define fc_mutex_impl_finish(M) FC_STMT_START {} FC_STMT_END
+
+
+#else /* FC_NO_MT */
+
+typedef int fc_mutex_impl_t;
+#define FC_MUTEX_IMPL_INIT 0
+#define fc_mutex_impl_init(M) FC_STMT_START {} FC_STMT_END
+#define fc_mutex_impl_lock(M) FC_STMT_START {} FC_STMT_END
+#define fc_mutex_impl_unlock(M) FC_STMT_START {} FC_STMT_END
+#define fc_mutex_impl_finish(M) FC_STMT_START {} FC_STMT_END
+
+#endif
+
+
+#define FC_MUTEX_INIT {FC_MUTEX_IMPL_INIT}
+typedef fc_mutex_impl_t FcMutex;
+static inline void FcMutexInit (FcMutex *m) { fc_mutex_impl_init (m); }
+static inline void FcMutexLock (FcMutex *m) { fc_mutex_impl_lock (m); }
+static inline void FcMutexUnlock (FcMutex *m) { fc_mutex_impl_unlock (m); }
+static inline void FcMutexFinish (FcMutex *m) { fc_mutex_impl_finish (m); }
+
+
+#endif /* _FCMUTEX_H_ */
diff --git a/fontconfig/src/fcname.c b/fontconfig/src/fcname.c
index 6a1fc12e8..2418189f9 100644
--- a/fontconfig/src/fcname.c
+++ b/fontconfig/src/fcname.c
@@ -28,275 +28,54 @@
#include <string.h>
#include <stdio.h>
-/*
- * Please do not change this list, it is used to initialize the object
- * list in this order to match the FC_foo_OBJECT constants. Those
- * constants are written into cache files.
- */
-
-static const FcObjectType _FcBaseObjectTypes[] = {
- { FC_FAMILY, FcTypeString, }, /* 1 */
- { FC_FAMILYLANG, FcTypeString, },
- { FC_STYLE, FcTypeString, },
- { FC_STYLELANG, FcTypeString, },
- { FC_FULLNAME, FcTypeString, },
- { FC_FULLNAMELANG, FcTypeString, },
- { FC_SLANT, FcTypeInteger, },
- { FC_WEIGHT, FcTypeInteger, },
- { FC_WIDTH, FcTypeInteger, },
- { FC_SIZE, FcTypeDouble, },
- { FC_ASPECT, FcTypeDouble, },
- { FC_PIXEL_SIZE, FcTypeDouble, },
- { FC_SPACING, FcTypeInteger, },
- { FC_FOUNDRY, FcTypeString, },
- { FC_ANTIALIAS, FcTypeBool, },
- { FC_HINT_STYLE, FcTypeInteger, },
- { FC_HINTING, FcTypeBool, },
- { FC_VERTICAL_LAYOUT, FcTypeBool, },
- { FC_AUTOHINT, FcTypeBool, },
- { FC_GLOBAL_ADVANCE, FcTypeBool, }, /* deprecated */
- { FC_FILE, FcTypeString, },
- { FC_INDEX, FcTypeInteger, },
- { FC_RASTERIZER, FcTypeString, },
- { FC_OUTLINE, FcTypeBool, },
- { FC_SCALABLE, FcTypeBool, },
- { FC_DPI, FcTypeDouble },
- { FC_RGBA, FcTypeInteger, },
- { FC_SCALE, FcTypeDouble, },
- { FC_MINSPACE, FcTypeBool, },
- { FC_CHAR_WIDTH, FcTypeInteger },
- { FC_CHAR_HEIGHT, FcTypeInteger },
- { FC_MATRIX, FcTypeMatrix },
- { FC_CHARSET, FcTypeCharSet },
- { FC_LANG, FcTypeLangSet },
- { FC_FONTVERSION, FcTypeInteger },
- { FC_CAPABILITY, FcTypeString },
- { FC_FONTFORMAT, FcTypeString },
- { FC_EMBOLDEN, FcTypeBool },
- { FC_EMBEDDED_BITMAP, FcTypeBool },
- { FC_DECORATIVE, FcTypeBool },
- { FC_LCD_FILTER, FcTypeInteger }, /* 41 */
- { FC_NAMELANG, FcTypeString }, /* 42 */
-};
-
-#define NUM_OBJECT_TYPES (sizeof _FcBaseObjectTypes / sizeof _FcBaseObjectTypes[0])
-
-typedef struct _FcObjectTypeList FcObjectTypeList;
-
-struct _FcObjectTypeList {
- const FcObjectTypeList *next;
- const FcObjectType *types;
- int ntypes;
+static const FcObjectType FcObjects[] = {
+#define FC_OBJECT(NAME, Type) { FC_##NAME, Type },
+#include "fcobjs.h"
+#undef FC_OBJECT
};
-static const FcObjectTypeList _FcBaseObjectTypesList = {
- 0,
- _FcBaseObjectTypes,
- NUM_OBJECT_TYPES,
-};
-
-static const FcObjectTypeList *_FcObjectTypes = &_FcBaseObjectTypesList;
-
-#define OBJECT_HASH_SIZE 31
-
-typedef struct _FcObjectBucket {
- struct _FcObjectBucket *next;
- FcChar32 hash;
- FcObject id;
-} FcObjectBucket;
-
-static FcObjectBucket *FcObjectBuckets[OBJECT_HASH_SIZE];
-
-static FcObjectType *FcObjects = (FcObjectType *) _FcBaseObjectTypes;
-static int FcObjectsNumber = NUM_OBJECT_TYPES;
-static int FcObjectsSize = 0;
-static FcBool FcObjectsInited;
-
-static FcObjectType *
-FcObjectInsert (const char *name, FcType type)
-{
- FcObjectType *o;
- if (FcObjectsNumber >= FcObjectsSize)
- {
- int newsize = FcObjectsNumber * 2;
- FcObjectType *newobjects;
-
- if (FcObjectsSize)
- newobjects = realloc (FcObjects, newsize * sizeof (FcObjectType));
- else
- {
- newobjects = malloc (newsize * sizeof (FcObjectType));
- if (newobjects)
- memcpy (newobjects, FcObjects,
- FcObjectsNumber * sizeof (FcObjectType));
- }
- if (!newobjects)
- return NULL;
- FcObjects = newobjects;
- FcObjectsSize = newsize;
- }
- o = &FcObjects[FcObjectsNumber];
- o->object = name;
- o->type = type;
- ++FcObjectsNumber;
- return o;
-}
-
-static FcObject
-FcObjectId (FcObjectType *o)
-{
- return o - FcObjects + 1;
-}
-
-static FcObjectType *
-FcObjectFindByName (const char *object, FcBool insert)
-{
- FcChar32 hash = FcStringHash ((const FcChar8 *) object);
- FcObjectBucket **p;
- FcObjectBucket *b;
- FcObjectType *o;
-
- if (!FcObjectsInited)
- FcObjectInit ();
- for (p = &FcObjectBuckets[hash%OBJECT_HASH_SIZE]; (b = *p); p = &(b->next))
- {
- o = FcObjects + b->id - 1;
- if (b->hash == hash && !strcmp (object, (o->object)))
- return o;
- }
- if (!insert)
- return NULL;
- /*
- * Hook it into the hash chain
- */
- b = malloc (sizeof(FcObjectBucket));
- if (!b)
- return NULL;
- object = (const char *) FcStrCopy ((FcChar8 *) object);
- if (!object) {
- free (b);
- return NULL;
- }
- o = FcObjectInsert (object, -1);
- b->next = NULL;
- b->hash = hash;
- b->id = FcObjectId (o);
- *p = b;
- return o;
-}
+#define NUM_OBJECT_TYPES ((int) (sizeof FcObjects / sizeof FcObjects[0]))
-static FcObjectType *
+static const FcObjectType *
FcObjectFindById (FcObject object)
{
- if (1 <= object && object <= FcObjectsNumber)
- return FcObjects + object - 1;
- return NULL;
-}
-
-static FcBool
-FcObjectHashInsert (const FcObjectType *object, FcBool copy)
-{
- FcChar32 hash = FcStringHash ((const FcChar8 *) object->object);
- FcObjectBucket **p;
- FcObjectBucket *b;
- FcObjectType *o;
-
- if (!FcObjectsInited)
- FcObjectInit ();
- for (p = &FcObjectBuckets[hash%OBJECT_HASH_SIZE]; (b = *p); p = &(b->next))
- {
- o = FcObjects + b->id - 1;
- if (b->hash == hash && !strcmp (object->object, o->object))
- return FcFalse;
- }
- /*
- * Hook it into the hash chain
- */
- b = malloc (sizeof(FcObjectBucket));
- if (!b)
- return FcFalse;
- if (copy)
- {
- o = FcObjectInsert (object->object, object->type);
- if (!o)
- {
- free (b);
- return FcFalse;
- }
- }
- else
- o = (FcObjectType *) object;
- b->next = NULL;
- b->hash = hash;
- b->id = FcObjectId (o);
- *p = b;
- return FcTrue;
-}
-
-static void
-FcObjectHashRemove (const FcObjectType *object, FcBool cleanobj)
-{
- FcChar32 hash = FcStringHash ((const FcChar8 *) object->object);
- FcObjectBucket **p;
- FcObjectBucket *b;
- FcObjectType *o;
-
- if (!FcObjectsInited)
- FcObjectInit ();
- for (p = &FcObjectBuckets[hash%OBJECT_HASH_SIZE]; (b = *p); p = &(b->next))
- {
- o = FcObjects + b->id - 1;
- if (b->hash == hash && !strcmp (object->object, o->object))
- {
- *p = b->next;
- free (b);
- if (cleanobj)
- {
- /* Clean up object array */
- o->object = NULL;
- o->type = -1;
- while (FcObjects[FcObjectsNumber-1].object == NULL)
- --FcObjectsNumber;
- }
- break;
- }
- }
+ if (1 <= object && object <= NUM_OBJECT_TYPES)
+ return &FcObjects[object - 1];
+ return FcObjectLookupOtherTypeById (object);
}
FcBool
FcNameRegisterObjectTypes (const FcObjectType *types, int ntypes)
{
- int i;
-
- for (i = 0; i < ntypes; i++)
- if (!FcObjectHashInsert (&types[i], FcTrue))
- return FcFalse;
- return FcTrue;
+ /* Deprecated. */
+ return FcFalse;
}
FcBool
FcNameUnregisterObjectTypes (const FcObjectType *types, int ntypes)
{
- int i;
-
- for (i = 0; i < ntypes; i++)
- FcObjectHashRemove (&types[i], FcTrue);
- return FcTrue;
+ /* Deprecated. */
+ return FcFalse;
}
const FcObjectType *
FcNameGetObjectType (const char *object)
{
- return FcObjectFindByName (object, FcFalse);
+ int id = FcObjectLookupBuiltinIdByName (object);
+
+ if (!id)
+ return FcObjectLookupOtherTypeByName (object);
+
+ return &FcObjects[id - 1];
}
FcBool
FcObjectValidType (FcObject object, FcType type)
{
- FcObjectType *t = FcObjectFindById (object);
+ const FcObjectType *t = FcObjectFindById (object);
if (t) {
- switch (t->type) {
+ switch ((int) t->type) {
case FcTypeDouble:
case FcTypeInteger:
if (type == FcTypeDouble || type == FcTypeInteger)
@@ -307,7 +86,7 @@ FcObjectValidType (FcObject object, FcType type)
return FcTrue;
break;
default:
- if (t->type == -1 || type == t->type)
+ if (t->type == (unsigned int) -1 || type == t->type)
return FcTrue;
break;
}
@@ -319,11 +98,7 @@ FcObjectValidType (FcObject object, FcType type)
FcObject
FcObjectFromName (const char * name)
{
- FcObjectType *o = FcObjectFindByName (name, FcTrue);
-
- if (o)
- return FcObjectId (o);
- return 0;
+ return FcObjectLookupIdByName (name);
}
FcObjectSet *
@@ -334,61 +109,21 @@ FcObjectGetSet (void)
os = FcObjectSetCreate ();
- for (i = 0; i < FcObjectsNumber; i++)
+ for (i = 0; i < NUM_OBJECT_TYPES; i++)
FcObjectSetAdd (os, FcObjects[i].object);
return os;
}
-FcBool
-FcObjectInit (void)
-{
- int i;
-
- if (FcObjectsInited)
- return FcTrue;
-
- FcObjectsInited = FcTrue;
- for (i = 0; i < NUM_OBJECT_TYPES; i++)
- if (!FcObjectHashInsert (&_FcBaseObjectTypes[i], FcFalse))
- return FcFalse;
- return FcTrue;
-}
-
-void
-FcObjectFini (void)
-{
- int i;
- FcObjectBucket *b, *next;
-
- for (i = 0; i < OBJECT_HASH_SIZE; i++)
- {
- for (b = FcObjectBuckets[i]; b; b = next)
- {
- next = b->next;
- free (b);
- }
- FcObjectBuckets[i] = 0;
- }
- for (i = 0; i < FcObjectsNumber; i++)
- if (FcObjects[i].type == -1)
- free ((void*) FcObjects[i].object);
- if (FcObjects != _FcBaseObjectTypes)
- free (FcObjects);
- FcObjects = (FcObjectType *) _FcBaseObjectTypes;
- FcObjectsNumber = NUM_OBJECT_TYPES;
- FcObjectsSize = 0;
- FcObjectsInited = FcFalse;
-}
-
const char *
FcObjectName (FcObject object)
{
- FcObjectType *o = FcObjectFindById (object);
+ const FcObjectType *o = FcObjectFindById (object);
if (o)
return o->object;
- return NULL;
+
+ return FcObjectLookupOtherNameById (object);
}
static const FcConstant _FcBaseConstants[] = {
@@ -414,7 +149,7 @@ static const FcConstant _FcBaseConstants[] = {
{ (FcChar8 *) "ultracondensed", "width", FC_WIDTH_ULTRACONDENSED },
{ (FcChar8 *) "extracondensed", "width", FC_WIDTH_EXTRACONDENSED },
{ (FcChar8 *) "condensed", "width", FC_WIDTH_CONDENSED },
- { (FcChar8 *) "semicondensed", "width", FC_WIDTH_SEMICONDENSED },
+ { (FcChar8 *) "semicondensed", "width", FC_WIDTH_SEMICONDENSED },
{ (FcChar8 *) "normal", "width", FC_WIDTH_NORMAL },
{ (FcChar8 *) "semiexpanded", "width", FC_WIDTH_SEMIEXPANDED },
{ (FcChar8 *) "expanded", "width", FC_WIDTH_EXPANDED },
@@ -457,70 +192,29 @@ static const FcConstant _FcBaseConstants[] = {
#define NUM_FC_CONSTANTS (sizeof _FcBaseConstants/sizeof _FcBaseConstants[0])
-typedef struct _FcConstantList FcConstantList;
-
-struct _FcConstantList {
- const FcConstantList *next;
- const FcConstant *consts;
- int nconsts;
-};
-
-static const FcConstantList _FcBaseConstantList = {
- 0,
- _FcBaseConstants,
- NUM_FC_CONSTANTS
-};
-
-static const FcConstantList *_FcConstants = &_FcBaseConstantList;
-
FcBool
FcNameRegisterConstants (const FcConstant *consts, int nconsts)
{
- FcConstantList *l;
-
- l = (FcConstantList *) malloc (sizeof (FcConstantList));
- if (!l)
- return FcFalse;
- FcMemAlloc (FC_MEM_CONSTANT, sizeof (FcConstantList));
- l->consts = consts;
- l->nconsts = nconsts;
- l->next = _FcConstants;
- _FcConstants = l;
- return FcTrue;
+ /* Deprecated. */
+ return FcFalse;
}
FcBool
FcNameUnregisterConstants (const FcConstant *consts, int nconsts)
{
- const FcConstantList *l, **prev;
-
- for (prev = &_FcConstants;
- (l = *prev);
- prev = (const FcConstantList **) &(l->next))
- {
- if (l->consts == consts && l->nconsts == nconsts)
- {
- *prev = l->next;
- FcMemFree (FC_MEM_CONSTANT, sizeof (FcConstantList));
- free ((void *) l);
- return FcTrue;
- }
- }
+ /* Deprecated. */
return FcFalse;
}
const FcConstant *
FcNameGetConstant (const FcChar8 *string)
{
- const FcConstantList *l;
- int i;
+ unsigned int i;
+
+ for (i = 0; i < NUM_FC_CONSTANTS; i++)
+ if (!FcStrCmpIgnoreCase (string, _FcBaseConstants[i].name))
+ return &_FcBaseConstants[i];
- for (l = _FcConstants; l; l = l->next)
- {
- for (i = 0; i < l->nconsts; i++)
- if (!FcStrCmpIgnoreCase (string, l->consts[i].name))
- return &l->consts[i];
- }
return 0;
}
@@ -579,13 +273,13 @@ FcNameConvert (FcType type, FcChar8 *string)
FcMatrix m;
v.type = type;
- switch (v.type) {
+ switch ((int) v.type) {
case FcTypeInteger:
if (!FcNameConstant (string, &v.u.i))
v.u.i = atoi ((char *) string);
break;
case FcTypeString:
- v.u.s = FcSharedStr (string);
+ v.u.s = FcStrdup (string);
if (!v.u.s)
v.type = FcTypeVoid;
break;
@@ -597,6 +291,7 @@ FcNameConvert (FcType type, FcChar8 *string)
v.u.d = strtod ((char *) string, 0);
break;
case FcTypeMatrix:
+ FcMatrixInit (&m);
sscanf ((char *) string, "%lg %lg %lg %lg", &m.xx, &m.xy, &m.yx, &m.yy);
v.u.m = FcMatrixCopy (&m);
break;
@@ -717,7 +412,7 @@ FcNameParse (const FcChar8 *name)
if ((c = FcNameGetConstant (save)))
{
t = FcNameGetObjectType ((char *) c->object);
- switch (t->type) {
+ switch ((int) t->type) {
case FcTypeInteger:
case FcTypeDouble:
if (!FcPatternAddInteger (pat, c->object, c->value))
@@ -831,8 +526,6 @@ FcNameUnparseEscaped (FcPattern *pat, FcBool escape)
FcChar8 buf_static[8192];
int i;
FcPatternElt *e;
- const FcObjectTypeList *l;
- const FcObjectType *o;
FcStrBufInit (&buf, buf_static, sizeof (buf_static));
e = FcPatternObjectFindElt (pat, FC_FAMILY_OBJECT);
@@ -849,28 +542,27 @@ FcNameUnparseEscaped (FcPattern *pat, FcBool escape)
if (!FcNameUnparseValueList (&buf, FcPatternEltValues(e), escape ? (FcChar8 *) FC_ESCAPE_FIXED : 0))
goto bail0;
}
- for (l = _FcObjectTypes; l; l = l->next)
+ for (i = 0; i < NUM_OBJECT_TYPES; i++)
{
- for (i = 0; i < l->ntypes; i++)
+ FcObject id = i + 1;
+ const FcObjectType *o;
+ o = &FcObjects[i];
+ if (!strcmp (o->object, FC_FAMILY) ||
+ !strcmp (o->object, FC_SIZE))
+ continue;
+
+ e = FcPatternObjectFindElt (pat, id);
+ if (e)
{
- o = &l->types[i];
- if (!strcmp (o->object, FC_FAMILY) ||
- !strcmp (o->object, FC_SIZE))
- continue;
-
- e = FcPatternObjectFindElt (pat, FcObjectFromName (o->object));
- if (e)
- {
- if (!FcNameUnparseString (&buf, (FcChar8 *) ":", 0))
- goto bail0;
- if (!FcNameUnparseString (&buf, (FcChar8 *) o->object, escape ? (FcChar8 *) FC_ESCAPE_VARIABLE : 0))
- goto bail0;
- if (!FcNameUnparseString (&buf, (FcChar8 *) "=", 0))
- goto bail0;
- if (!FcNameUnparseValueList (&buf, FcPatternEltValues(e), escape ?
- (FcChar8 *) FC_ESCAPE_VARIABLE : 0))
- goto bail0;
- }
+ if (!FcNameUnparseString (&buf, (FcChar8 *) ":", 0))
+ goto bail0;
+ if (!FcNameUnparseString (&buf, (FcChar8 *) o->object, escape ? (FcChar8 *) FC_ESCAPE_VARIABLE : 0))
+ goto bail0;
+ if (!FcNameUnparseString (&buf, (FcChar8 *) "=", 0))
+ goto bail0;
+ if (!FcNameUnparseValueList (&buf, FcPatternEltValues(e), escape ?
+ (FcChar8 *) FC_ESCAPE_VARIABLE : 0))
+ goto bail0;
}
}
return FcStrBufDone (&buf);
diff --git a/fontconfig/src/fcobjs.c b/fontconfig/src/fcobjs.c
new file mode 100644
index 000000000..146ca70d0
--- /dev/null
+++ b/fontconfig/src/fcobjs.c
@@ -0,0 +1,139 @@
+/*
+ * fontconfig/src/fclist.c
+ *
+ * Copyright © 2000 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the author(s) not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The authors make no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "fcint.h"
+
+static unsigned int
+FcObjectTypeHash (register const char *str, register unsigned int len);
+
+static const struct FcObjectTypeInfo *
+FcObjectTypeLookup (register const char *str, register unsigned int len);
+
+#include "fcobjshash.h"
+
+#include <string.h>
+
+/* The 1000 is to leave some room for future added internal objects, such
+ * that caches from newer fontconfig can still be used with older fontconfig
+ * without getting confused. */
+static fc_atomic_int_t next_id = FC_MAX_BASE_OBJECT + 1000;
+struct FcObjectOtherTypeInfo {
+ struct FcObjectOtherTypeInfo *next;
+ FcObjectType object;
+ FcObject id;
+} *other_types;
+
+static FcObjectType *
+_FcObjectLookupOtherTypeByName (const char *str, FcObject *id)
+{
+ struct FcObjectOtherTypeInfo *ots, *ot;
+
+retry:
+ ots = fc_atomic_ptr_get (&other_types);
+
+ for (ot = ots; ot; ot = ot->next)
+ if (0 == strcmp (ot->object.object, str))
+ break;
+
+ if (!ot)
+ {
+ ot = malloc (sizeof (*ot));
+ if (!ot)
+ return NULL;
+
+ ot->object.object = (const char *) FcStrdup (str);
+ ot->object.type = -1;
+ ot->id = fc_atomic_int_add (next_id, +1);
+ ot->next = ots;
+
+ if (!fc_atomic_ptr_cmpexch (&other_types, ots, ot)) {
+ free (ot);
+ goto retry;
+ }
+ }
+
+ if (id)
+ *id = ot->id;
+
+ return &ot->object;
+}
+
+FcObject
+FcObjectLookupBuiltinIdByName (const char *str)
+{
+ const struct FcObjectTypeInfo *o = FcObjectTypeLookup (str, strlen (str));
+
+ if (o)
+ return o->id;
+
+ return 0;
+}
+
+FcObject
+FcObjectLookupIdByName (const char *str)
+{
+ const struct FcObjectTypeInfo *o = FcObjectTypeLookup (str, strlen (str));
+ FcObject id;
+ if (o)
+ return o->id;
+
+ if (_FcObjectLookupOtherTypeByName (str, &id))
+ return id;
+
+ return 0;
+}
+
+const char *
+FcObjectLookupOtherNameById (FcObject id)
+{
+ struct FcObjectOtherTypeInfo *ot;
+
+ for (ot = fc_atomic_ptr_get (&other_types); ot; ot = ot->next)
+ if (ot->id == id)
+ return ot->object.object;
+
+ return NULL;
+}
+
+const FcObjectType *
+FcObjectLookupOtherTypeByName (const char *str)
+{
+ return _FcObjectLookupOtherTypeByName (str, NULL);
+}
+
+FcPrivate const FcObjectType *
+FcObjectLookupOtherTypeById (FcObject id)
+{
+ struct FcObjectOtherTypeInfo *ot;
+
+ for (ot = fc_atomic_ptr_get (&other_types); ot; ot = ot->next)
+ if (ot->id == id)
+ return &ot->object;
+
+ return NULL;
+}
+
+
+#include "fcaliastail.h"
+#undef __fcobjs__
diff --git a/fontconfig/src/fcobjs.h b/fontconfig/src/fcobjs.h
new file mode 100644
index 000000000..1e9067e21
--- /dev/null
+++ b/fontconfig/src/fcobjs.h
@@ -0,0 +1,44 @@
+/* DON'T REORDER! The order is part of the cache signature. */
+FC_OBJECT (FAMILY, FcTypeString)
+FC_OBJECT (FAMILYLANG, FcTypeString)
+FC_OBJECT (STYLE, FcTypeString)
+FC_OBJECT (STYLELANG, FcTypeString)
+FC_OBJECT (FULLNAME, FcTypeString)
+FC_OBJECT (FULLNAMELANG, FcTypeString)
+FC_OBJECT (SLANT, FcTypeInteger)
+FC_OBJECT (WEIGHT, FcTypeInteger)
+FC_OBJECT (WIDTH, FcTypeInteger)
+FC_OBJECT (SIZE, FcTypeDouble)
+FC_OBJECT (ASPECT, FcTypeDouble)
+FC_OBJECT (PIXEL_SIZE, FcTypeDouble)
+FC_OBJECT (SPACING, FcTypeInteger)
+FC_OBJECT (FOUNDRY, FcTypeString)
+FC_OBJECT (ANTIALIAS, FcTypeBool)
+FC_OBJECT (HINT_STYLE, FcTypeInteger)
+FC_OBJECT (HINTING, FcTypeBool)
+FC_OBJECT (VERTICAL_LAYOUT, FcTypeBool)
+FC_OBJECT (AUTOHINT, FcTypeBool)
+FC_OBJECT (GLOBAL_ADVANCE, FcTypeBool) /* deprecated */
+FC_OBJECT (FILE, FcTypeString)
+FC_OBJECT (INDEX, FcTypeInteger)
+FC_OBJECT (RASTERIZER, FcTypeString)
+FC_OBJECT (OUTLINE, FcTypeBool)
+FC_OBJECT (SCALABLE, FcTypeBool)
+FC_OBJECT (DPI, FcTypeDouble)
+FC_OBJECT (RGBA, FcTypeInteger)
+FC_OBJECT (SCALE, FcTypeDouble)
+FC_OBJECT (MINSPACE, FcTypeBool)
+FC_OBJECT (CHAR_WIDTH, FcTypeInteger)
+FC_OBJECT (CHAR_HEIGHT, FcTypeInteger)
+FC_OBJECT (MATRIX, FcTypeMatrix)
+FC_OBJECT (CHARSET, FcTypeCharSet)
+FC_OBJECT (LANG, FcTypeLangSet)
+FC_OBJECT (FONTVERSION, FcTypeInteger)
+FC_OBJECT (CAPABILITY, FcTypeString)
+FC_OBJECT (FONTFORMAT, FcTypeString)
+FC_OBJECT (EMBOLDEN, FcTypeBool)
+FC_OBJECT (EMBEDDED_BITMAP, FcTypeBool)
+FC_OBJECT (DECORATIVE, FcTypeBool)
+FC_OBJECT (LCD_FILTER, FcTypeInteger)
+FC_OBJECT (NAMELANG, FcTypeString)
+/* ^-------------- Add new objects here. */
diff --git a/fontconfig/src/fcobjshash.gperf.h b/fontconfig/src/fcobjshash.gperf.h
new file mode 100644
index 000000000..dafac1bc2
--- /dev/null
+++ b/fontconfig/src/fcobjshash.gperf.h
@@ -0,0 +1,26 @@
+%{
+CUT_OUT_BEGIN
+#include <fontconfig/fontconfig.h>
+CUT_OUT_END
+%}
+%struct-type
+%language=ANSI-C
+%includes
+%enum
+%readonly-tables
+%define slot-name name
+%define hash-function-name FcObjectTypeHash
+%define lookup-function-name FcObjectTypeLookup
+
+%pic
+%define string-pool-name FcObjectTypeNamePool
+
+struct FcObjectTypeInfo {
+ int name;
+ int id;
+};
+
+%%
+#define FC_OBJECT(NAME, Type) FC_##NAME, FC_##NAME##_OBJECT
+#include "fcobjs.h"
+#undef FC_OBJECT
diff --git a/fontconfig/src/fcpat.c b/fontconfig/src/fcpat.c
index 62e47ca7e..b3b155d4d 100644
--- a/fontconfig/src/fcpat.c
+++ b/fontconfig/src/fcpat.c
@@ -22,9 +22,8 @@
#include "fcint.h"
#include "fcftint.h"
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
+
+/* Objects MT-safe for readonly access. */
FcPattern *
FcPatternCreate (void)
@@ -34,21 +33,19 @@ FcPatternCreate (void)
p = (FcPattern *) malloc (sizeof (FcPattern));
if (!p)
return 0;
- FcMemAlloc (FC_MEM_PATTERN, sizeof (FcPattern));
p->num = 0;
p->size = 0;
p->elts_offset = FcPtrToOffset (p, NULL);
- p->ref = 1;
+ FcRefInit (&p->ref, 1);
return p;
}
void
FcValueDestroy (FcValue v)
{
- switch (v.type) {
+ switch ((int) v.type) {
case FcTypeString:
- if (!FcSharedStrFree (v.u.s))
- FcStrFree ((FcChar8 *) v.u.s);
+ FcFree (v.u.s);
break;
case FcTypeMatrix:
FcMatrixFree ((FcMatrix *) v.u.m);
@@ -69,7 +66,7 @@ FcValueCanonicalize (const FcValue *v)
{
FcValue new;
- switch (v->type)
+ switch ((int) v->type)
{
case FcTypeString:
new.u.s = FcValueString(v);
@@ -93,9 +90,9 @@ FcValueCanonicalize (const FcValue *v)
FcValue
FcValueSave (FcValue v)
{
- switch (v.type) {
+ switch ((int) v.type) {
case FcTypeString:
- v.u.s = FcSharedStr (v.u.s);
+ v.u.s = FcStrdup (v.u.s);
if (!v.u.s)
v.type = FcTypeVoid;
break;
@@ -123,15 +120,7 @@ FcValueSave (FcValue v)
FcValueListPtr
FcValueListCreate (void)
{
- FcValueListPtr ret;
-
- ret = calloc (1, sizeof (FcValueList));
- if (ret)
- {
- FcMemAlloc(FC_MEM_VALLIST, sizeof (FcValueList));
- }
-
- return ret;
+ return calloc (1, sizeof (FcValueList));
}
void
@@ -140,10 +129,9 @@ FcValueListDestroy (FcValueListPtr l)
FcValueListPtr next;
for (; l; l = next)
{
- switch (l->value.type) {
+ switch ((int) l->value.type) {
case FcTypeString:
- if (!FcSharedStrFree ((FcChar8 *)l->value.u.s))
- FcStrFree ((FcChar8 *)l->value.u.s);
+ FcFree (l->value.u.s);
break;
case FcTypeMatrix:
FcMatrixFree ((FcMatrix *)l->value.u.m);
@@ -160,7 +148,6 @@ FcValueListDestroy (FcValueListPtr l)
break;
}
next = FcValueListNext(l);
- FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
free(l);
}
}
@@ -369,22 +356,23 @@ FcPatternDestroy (FcPattern *p)
int i;
FcPatternElt *elts;
- if (p->ref == FC_REF_CONSTANT)
+ if (!p)
+ return;
+
+ if (FcRefIsConst (&p->ref))
{
FcCacheObjectDereference (p);
return;
}
- if (--p->ref > 0)
+ if (FcRefDec (&p->ref) != 1)
return;
elts = FcPatternElts (p);
for (i = 0; i < p->num; i++)
FcValueListDestroy (FcPatternEltValues(&elts[i]));
- FcMemFree (FC_MEM_PATELT, p->size * sizeof (FcPatternElt));
free (elts);
- FcMemFree (FC_MEM_PATTERN, sizeof (FcPattern));
free (p);
}
@@ -454,9 +442,6 @@ FcPatternObjectInsertElt (FcPattern *p, FcObject object)
if (!e)
return FcFalse;
p->elts_offset = FcPtrToOffset (p, e);
- if (p->size)
- FcMemFree (FC_MEM_PATELT, p->size * sizeof (FcPatternElt));
- FcMemAlloc (FC_MEM_PATELT, s * sizeof (FcPatternElt));
while (p->size < s)
{
e[p->size].object = 0;
@@ -558,7 +543,7 @@ FcPatternObjectListAdd (FcPattern *p,
FcPatternElt *e;
FcValueListPtr l, *prev;
- if (p->ref == FC_REF_CONSTANT)
+ if (FcRefIsConst (&p->ref))
goto bail0;
/*
@@ -568,12 +553,10 @@ FcPatternObjectListAdd (FcPattern *p,
{
if (!FcObjectValidType (object, l->value.type))
{
- if (FcDebug() & FC_DBG_OBJTYPES)
- {
- printf ("FcPattern object %s does not accept value ",
- FcObjectName (object));
- FcValuePrint (l->value);
- }
+ fprintf (stderr,
+ "Fontconfig warning: FcPattern object %s does not accept value", FcObjectName (object));
+ FcValuePrintFile (stderr, l->value);
+ fprintf (stderr, "\n");
goto bail0;
}
}
@@ -612,7 +595,7 @@ FcPatternObjectAddWithBinding (FcPattern *p,
FcPatternElt *e;
FcValueListPtr new, *prev;
- if (p->ref == FC_REF_CONSTANT)
+ if (FcRefIsConst (&p->ref))
goto bail0;
new = FcValueListCreate ();
@@ -628,12 +611,11 @@ FcPatternObjectAddWithBinding (FcPattern *p,
*/
if (!FcObjectValidType (object, value.type))
{
- if (FcDebug() & FC_DBG_OBJTYPES)
- {
- printf ("FcPattern object %s does not accept value ",
- FcObjectName (object));
- FcValuePrint (value);
- }
+ fprintf (stderr,
+ "Fontconfig warning: FcPattern object %s does not accept value",
+ FcObjectName (object));
+ FcValuePrintFile (stderr, value);
+ fprintf (stderr, "\n");
goto bail1;
}
@@ -662,7 +644,6 @@ FcPatternObjectAddWithBinding (FcPattern *p,
bail2:
FcValueDestroy (value);
bail1:
- FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
free (new);
bail0:
return FcFalse;
@@ -892,7 +873,7 @@ FcPatternObjectGetInteger (const FcPattern *p, FcObject object, int id, int *i)
r = FcPatternObjectGet (p, object, id, &v);
if (r != FcResultMatch)
return r;
- switch (v.type) {
+ switch ((int) v.type) {
case FcTypeDouble:
*i = (int) v.u.d;
break;
@@ -921,7 +902,7 @@ FcPatternObjectGetDouble (const FcPattern *p, FcObject object, int id, double *d
r = FcPatternObjectGet (p, object, id, &v);
if (r != FcResultMatch)
return r;
- switch (v.type) {
+ switch ((int) v.type) {
case FcTypeDouble:
*d = v.u.d;
break;
@@ -1076,8 +1057,8 @@ bail0:
void
FcPatternReference (FcPattern *p)
{
- if (p->ref != FC_REF_CONSTANT)
- p->ref++;
+ if (!FcRefIsConst (&p->ref))
+ FcRefInc (&p->ref);
else
FcCacheObjectReference (p);
}
@@ -1163,69 +1144,6 @@ bail0:
return NULL;
}
-#define OBJECT_HASH_SIZE 251
-static struct objectBucket {
- struct objectBucket *next;
- FcChar32 hash;
- int ref_count;
-} *FcObjectBuckets[OBJECT_HASH_SIZE];
-
-FcBool
-FcSharedStrFree (const FcChar8 *name)
-{
- FcChar32 hash = FcStringHash (name);
- struct objectBucket **p;
- struct objectBucket *b;
- int size;
-
- for (p = &FcObjectBuckets[hash % OBJECT_HASH_SIZE]; (b = *p); p = &(b->next))
- if (b->hash == hash && ((char *)name == (char *) (b + 1)))
- {
- b->ref_count--;
- if (!b->ref_count)
- {
- *p = b->next;
- size = sizeof (struct objectBucket) + strlen ((char *)name) + 1;
- size = (size + 3) & ~3;
- FcMemFree (FC_MEM_SHAREDSTR, size);
- free (b);
- }
- return FcTrue;
- }
- return FcFalse;
-}
-
-const FcChar8 *
-FcSharedStr (const FcChar8 *name)
-{
- FcChar32 hash = FcStringHash (name);
- struct objectBucket **p;
- struct objectBucket *b;
- int size;
-
- for (p = &FcObjectBuckets[hash % OBJECT_HASH_SIZE]; (b = *p); p = &(b->next))
- if (b->hash == hash && !strcmp ((char *)name, (char *) (b + 1)))
- {
- b->ref_count++;
- return (FcChar8 *) (b + 1);
- }
- size = sizeof (struct objectBucket) + strlen ((char *)name) + 1;
- /*
- * workaround valgrind warning because glibc takes advantage of how it knows memory is
- * allocated to implement strlen by reading in groups of 4
- */
- size = (size + 3) & ~3;
- b = malloc (size);
- FcMemAlloc (FC_MEM_SHAREDSTR, size);
- if (!b)
- return NULL;
- b->next = 0;
- b->hash = hash;
- b->ref_count = 1;
- strcpy ((char *) (b + 1), (char *)name);
- *p = b;
- return (FcChar8 *) (b + 1);
-}
FcBool
FcPatternSerializeAlloc (FcSerialize *serialize, const FcPattern *pat)
@@ -1257,7 +1175,7 @@ FcPatternSerialize (FcSerialize *serialize, const FcPattern *pat)
return NULL;
*pat_serialized = *pat;
pat_serialized->size = pat->num;
- pat_serialized->ref = FC_REF_CONSTANT;
+ FcRefSetConst (&pat_serialized->ref);
elts_serialized = FcSerializePtr (serialize, elts);
if (!elts_serialized)
@@ -1293,7 +1211,7 @@ FcValueListSerializeAlloc (FcSerialize *serialize, const FcValueList *vl)
{
if (!FcSerializeAlloc (serialize, vl, sizeof (FcValueList)))
return FcFalse;
- switch (vl->value.type) {
+ switch ((int) vl->value.type) {
case FcTypeString:
if (!FcStrSerializeAlloc (serialize, vl->value.u.s))
return FcFalse;
@@ -1339,7 +1257,7 @@ FcValueListSerialize (FcSerialize *serialize, const FcValueList *vl)
vl_serialized->next = NULL;
vl_serialized->value.type = vl->value.type;
- switch (vl->value.type) {
+ switch ((int) vl->value.type) {
case FcTypeInteger:
vl_serialized->value.u.i = vl->value.u.i;
break;
diff --git a/fontconfig/src/fcserialize.c b/fontconfig/src/fcserialize.c
index e5ec90bde..d2f221df8 100644
--- a/fontconfig/src/fcserialize.c
+++ b/fontconfig/src/fcserialize.c
@@ -151,6 +151,5 @@ FcStrSerialize (FcSerialize *serialize, const FcChar8 *str)
strcpy ((char *) str_serialize, (const char *) str);
return str_serialize;
}
-#define __fcserialize__
#include "fcaliastail.h"
#undef __fcserialize__
diff --git a/fontconfig/src/fcstat.c b/fontconfig/src/fcstat.c
index d4431e00e..9763c21a4 100644
--- a/fontconfig/src/fcstat.c
+++ b/fontconfig/src/fcstat.c
@@ -44,9 +44,6 @@
#endif
#ifdef _WIN32
-
-#include <windows.h>
-
#ifdef __GNUC__
typedef long long INT64;
#define EPOCH_OFFSET 11644473600ll
@@ -268,11 +265,11 @@ FcFStatFs (int fd, FcStatFS *statb)
int ret = -1;
FcBool flag = FcFalse;
- memset (statb, 0, sizeof (FcStatFS));
-
#if defined(HAVE_FSTATVFS) && (defined(HAVE_STRUCT_STATVFS_F_BASETYPE) || defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME))
struct statvfs buf;
+ memset (statb, 0, sizeof (FcStatFS));
+
if ((ret = fstatvfs (fd, &buf)) == 0)
{
# if defined(HAVE_STRUCT_STATVFS_F_BASETYPE)
@@ -284,6 +281,8 @@ FcFStatFs (int fd, FcStatFS *statb)
#elif defined(HAVE_FSTATFS) && (defined(HAVE_STRUCT_STATFS_F_FLAGS) || defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) || defined(__linux__))
struct statfs buf;
+ memset (statb, 0, sizeof (FcStatFS));
+
if ((ret = fstatfs (fd, &buf)) == 0)
{
# if defined(HAVE_STRUCT_STATFS_F_FLAGS) && defined(MNT_LOCAL)
diff --git a/fontconfig/src/fcstr.c b/fontconfig/src/fcstr.c
index cc1465cc9..cdab38397 100644
--- a/fontconfig/src/fcstr.c
+++ b/fontconfig/src/fcstr.c
@@ -29,24 +29,13 @@
#ifdef HAVE_REGEX_H
#include <regex.h>
#endif
-#ifdef _WIN32
-#include <windows.h>
-#endif
+
+/* Objects MT-safe for readonly access. */
FcChar8 *
FcStrCopy (const FcChar8 *s)
{
- int len;
- FcChar8 *r;
- if (!s)
- return 0;
- len = strlen ((char *) s) + 1;
- r = (FcChar8 *) malloc (len);
- if (!r)
- return 0;
- FcMemAlloc (FC_MEM_STRING, len);
- memcpy (r, s, len);
- return r;
+ return FcStrdup (s);
}
FcChar8 *
@@ -59,7 +48,6 @@ FcStrPlus (const FcChar8 *s1, const FcChar8 *s2)
if (!s)
return 0;
- FcMemAlloc (FC_MEM_STRING, l);
memcpy (s, s1, s1l);
memcpy (s + s1l, s2, s2l + 1);
return s;
@@ -68,7 +56,6 @@ FcStrPlus (const FcChar8 *s1, const FcChar8 *s2)
void
FcStrFree (FcChar8 *s)
{
- FcMemFree (FC_MEM_STRING, strlen ((char *) s) + 1);
free (s);
}
@@ -78,8 +65,6 @@ FcStrFree (FcChar8 *s)
#define FcCaseFoldUpperCount(cf) \
((cf)->method == FC_CASE_FOLD_FULL ? 1 : (cf)->count)
-#define FC_STR_CANON_BUF_LEN 1024
-
typedef struct _FcCaseWalker {
const FcChar8 *read;
const FcChar8 *src;
@@ -206,7 +191,6 @@ FcStrDowncase (const FcChar8 *s)
d = dst = malloc (len + 1);
if (!d)
return 0;
- FcMemAlloc (FC_MEM_STRING, len + 1);
FcStrCaseWalkerInit (s, &w);
while ((*d++ = FcStrCaseWalkerNext (&w)));
return dst;
@@ -782,7 +766,6 @@ FcStrBufDestroy (FcStrBuf *buf)
{
if (buf->allocated)
{
- FcMemFree (FC_MEM_STRBUF, buf->size);
free (buf->buf);
FcStrBufInit (buf, 0, 0);
}
@@ -799,7 +782,6 @@ FcStrBufDone (FcStrBuf *buf)
ret = malloc (buf->len + 1);
if (ret)
{
- FcMemAlloc (FC_MEM_STRING, buf->len + 1);
memcpy (ret, buf->buf, buf->len);
ret[buf->len] = '\0';
}
@@ -832,7 +814,6 @@ FcStrBufChar (FcStrBuf *buf, FcChar8 c)
if (buf->allocated)
{
size = buf->size * 2;
- FcMemFree (FC_MEM_STRBUF, buf->size);
new = realloc (buf->buf, size);
}
else
@@ -850,7 +831,6 @@ FcStrBufChar (FcStrBuf *buf, FcChar8 c)
buf->failed = FcTrue;
return FcFalse;
}
- FcMemAlloc (FC_MEM_STRBUF, size);
buf->size = size;
buf->buf = new;
}
@@ -941,7 +921,6 @@ FcStrDirname (const FcChar8 *file)
dir = malloc ((slash - file) + 1);
if (!dir)
return 0;
- FcMemAlloc (FC_MEM_STRING, (slash - file) + 1);
strncpy ((char *) dir, (const char *) file, slash - file);
dir[slash - file] = '\0';
return dir;
@@ -970,7 +949,6 @@ FcStrCanonAbsoluteFilename (const FcChar8 *s)
file = malloc (size);
if (!file)
return NULL;
- FcMemAlloc (FC_MEM_STRING, size);
slash = NULL;
f = file;
#ifdef _WIN32
@@ -1090,8 +1068,7 @@ FcStrSetCreate (void)
FcStrSet *set = malloc (sizeof (FcStrSet));
if (!set)
return 0;
- FcMemAlloc (FC_MEM_STRSET, sizeof (FcStrSet));
- set->ref = 1;
+ FcRefInit (&set->ref, 1);
set->num = 0;
set->size = 0;
set->strs = 0;
@@ -1112,14 +1089,10 @@ _FcStrSetAppend (FcStrSet *set, FcChar8 *s)
if (!strs)
return FcFalse;
- FcMemAlloc (FC_MEM_STRSET, (set->size + 2) * sizeof (FcChar8 *));
if (set->num)
memcpy (strs, set->strs, set->num * sizeof (FcChar8 *));
if (set->strs)
- {
- FcMemFree (FC_MEM_STRSET, (set->size + 1) * sizeof (FcChar8 *));
free (set->strs);
- }
set->size = set->size + 1;
set->strs = strs;
}
@@ -1247,20 +1220,20 @@ FcStrSetDel (FcStrSet *set, const FcChar8 *s)
void
FcStrSetDestroy (FcStrSet *set)
{
- if (--set->ref == 0)
- {
- int i;
+ int i;
- for (i = 0; i < set->num; i++)
- FcStrFree (set->strs[i]);
- if (set->strs)
- {
- FcMemFree (FC_MEM_STRSET, (set->size + 1) * sizeof (FcChar8 *));
- free (set->strs);
- }
- FcMemFree (FC_MEM_STRSET, sizeof (FcStrSet));
- free (set);
- }
+ /* We rely on this in FcGetDefaultLangs for caching. */
+ if (FcRefIsConst (&set->ref))
+ return;
+
+ if (FcRefDec (&set->ref) != 1)
+ return;
+
+ for (i = 0; i < set->num; i++)
+ FcStrFree (set->strs[i]);
+ if (set->strs)
+ free (set->strs);
+ free (set);
}
FcStrList *
@@ -1271,9 +1244,8 @@ FcStrListCreate (FcStrSet *set)
list = malloc (sizeof (FcStrList));
if (!list)
return 0;
- FcMemAlloc (FC_MEM_STRLIST, sizeof (FcStrList));
list->set = set;
- set->ref++;
+ FcRefInc (&set->ref);
list->n = 0;
return list;
}
@@ -1290,7 +1262,6 @@ void
FcStrListDone (FcStrList *list)
{
FcStrSetDestroy (list->set);
- FcMemFree (FC_MEM_STRLIST, sizeof (FcStrList));
free (list);
}
diff --git a/fontconfig/src/fcwindows.h b/fontconfig/src/fcwindows.h
new file mode 100644
index 000000000..02489d9dc
--- /dev/null
+++ b/fontconfig/src/fcwindows.h
@@ -0,0 +1,44 @@
+/*
+ * fontconfig/src/fcwindows.h
+ *
+ * Copyright © 2013 Google, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the author(s) not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The authors make no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef _FCWINDOWS_H_
+#define _FCWINDOWS_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef _WIN32
+# ifndef _WIN32_WINNT
+# define _WIN32_WINNT 0x0500
+# endif
+# define WIN32_LEAN_AND_MEAN
+# define WIN32_EXTRA_LEAN
+# define STRICT
+# include <windows.h>
+#endif
+
+#endif /* _FCWINDOWS_H_ */
diff --git a/fontconfig/src/fcxml.c b/fontconfig/src/fcxml.c
index c840027d1..5b074c88e 100755
--- a/fontconfig/src/fcxml.c
+++ b/fontconfig/src/fcxml.c
@@ -65,7 +65,6 @@ FcTestDestroy (FcTest *test)
if (test->next)
FcTestDestroy (test->next);
FcExprDestroy (test->expr);
- FcMemFree (FC_MEM_TEST, sizeof (FcTest));
free (test);
}
@@ -100,19 +99,53 @@ FcExprCreateString (FcConfig *config, const FcChar8 *s)
if (e)
{
e->op = FcOpString;
- e->u.sval = FcSharedStr (s);
+ e->u.sval = FcStrdup (s);
}
return e;
}
+static FcExprMatrix *
+FcExprMatrixCopyShallow (const FcExprMatrix *matrix)
+{
+ FcExprMatrix *m = malloc (sizeof (FcExprMatrix));
+ if (m)
+ {
+ *m = *matrix;
+ }
+ return m;
+}
+
+static void
+FcExprMatrixFreeShallow (FcExprMatrix *m)
+{
+ if (!m)
+ return;
+
+ free (m);
+}
+
+static void
+FcExprMatrixFree (FcExprMatrix *m)
+{
+ if (!m)
+ return;
+
+ FcExprDestroy (m->xx);
+ FcExprDestroy (m->xy);
+ FcExprDestroy (m->yx);
+ FcExprDestroy (m->yy);
+
+ free (m);
+}
+
static FcExpr *
-FcExprCreateMatrix (FcConfig *config, const FcMatrix *m)
+FcExprCreateMatrix (FcConfig *config, const FcExprMatrix *matrix)
{
FcExpr *e = FcConfigAllocExpr (config);
if (e)
{
e->op = FcOpMatrix;
- e->u.mval = FcMatrixCopy (m);
+ e->u.mexpr = FcExprMatrixCopyShallow (matrix);
}
return e;
}
@@ -154,13 +187,13 @@ FcExprCreateLangSet (FcConfig *config, FcLangSet *langset)
}
static FcExpr *
-FcExprCreateField (FcConfig *config, const char *field)
+FcExprCreateName (FcConfig *config, FcExprName name)
{
FcExpr *e = FcConfigAllocExpr (config);
if (e)
{
e->op = FcOpField;
- e->u.object = FcObjectFromName (field);
+ e->u.name = name;
}
return e;
}
@@ -172,7 +205,7 @@ FcExprCreateConst (FcConfig *config, const FcChar8 *constant)
if (e)
{
e->op = FcOpConst;
- e->u.constant = FcSharedStr (constant);
+ e->u.constant = FcStrdup (constant);
}
return e;
}
@@ -201,10 +234,10 @@ FcExprDestroy (FcExpr *e)
case FcOpDouble:
break;
case FcOpString:
- FcSharedStrFree (e->u.sval);
+ FcFree (e->u.sval);
break;
case FcOpMatrix:
- FcMatrixFree (e->u.mval);
+ FcExprMatrixFree (e->u.mexpr);
break;
case FcOpRange:
break;
@@ -219,7 +252,7 @@ FcExprDestroy (FcExpr *e)
case FcOpField:
break;
case FcOpConst:
- FcSharedStrFree (e->u.constant);
+ FcFree (e->u.constant);
break;
case FcOpAssign:
case FcOpAssignReplace:
@@ -420,9 +453,9 @@ typedef enum _FcVStackTag {
FcVStackString,
FcVStackFamily,
- FcVStackField,
FcVStackConstant,
FcVStackGlob,
+ FcVStackName,
FcVStackPattern,
FcVStackPrefer,
@@ -451,11 +484,12 @@ typedef struct _FcVStack {
int integer;
double _double;
- FcMatrix *matrix;
+ FcExprMatrix *matrix;
FcRange range;
FcBool bool_;
FcCharSet *charset;
FcLangSet *langset;
+ FcExprName name;
FcTest *test;
FcQual qual;
@@ -474,9 +508,9 @@ typedef struct _FcConfigParse {
const FcChar8 *name;
FcConfig *config;
XML_Parser parser;
- int pstack_static_used;
+ unsigned int pstack_static_used;
FcPStack pstack_static[8];
- int vstack_static_used;
+ unsigned int vstack_static_used;
FcVStack vstack_static[64];
} FcConfigParse;
@@ -516,6 +550,10 @@ FcConfigMessage (FcConfigParse *parse, FcConfigSeverity severe, const char *fmt,
}
+static FcExpr *
+FcPopExpr (FcConfigParse *parse);
+
+
static const char *
FcTypeName (FcType type)
{
@@ -556,6 +594,10 @@ FcTypecheckValue (FcConfigParse *parse, FcType value, FcType type)
return;
if (type == (FcType) -1)
return;
+ /* It's perfectly fine to use user-define elements in expressions,
+ * so don't warn in that case. */
+ if (value == (FcType) -1)
+ return;
FcConfigMessage (parse, FcSevereWarning, "saw %s, expected %s",
FcTypeName (value), FcTypeName (type));
}
@@ -594,7 +636,7 @@ FcTypecheckExpr (FcConfigParse *parse, FcExpr *expr, FcType type)
case FcOpNil:
break;
case FcOpField:
- o = FcNameGetObjectType (FcObjectName (expr->u.object));
+ o = FcNameGetObjectType (FcObjectName (expr->u.name.object));
if (o)
FcTypecheckValue (parse, o->type, type);
break;
@@ -670,7 +712,6 @@ FcTestCreate (FcConfigParse *parse,
{
const FcObjectType *o;
- FcMemAlloc (FC_MEM_TEST, sizeof (FcTest));
test->next = 0;
test->kind = kind;
test->qual = qual;
@@ -721,7 +762,6 @@ FcVStackCreateAndPush (FcConfigParse *parse)
new = malloc (sizeof (FcVStack));
if (!new)
return 0;
- FcMemAlloc (FC_MEM_VSTACK, sizeof (FcVStack));
}
new->tag = FcVStackNone;
new->prev = 0;
@@ -767,16 +807,13 @@ FcVStackPushDouble (FcConfigParse *parse, double _double)
}
static FcBool
-FcVStackPushMatrix (FcConfigParse *parse, FcMatrix *matrix)
+FcVStackPushMatrix (FcConfigParse *parse, FcExprMatrix *matrix)
{
FcVStack *vstack;
- matrix = FcMatrixCopy (matrix);
- if (!matrix)
- return FcFalse;
vstack = FcVStackCreateAndPush (parse);
if (!vstack)
return FcFalse;
- vstack->u.matrix = matrix;
+ vstack->u.matrix = FcExprMatrixCopyShallow (matrix);
vstack->tag = FcVStackMatrix;
return FcTrue;
}
@@ -833,6 +870,18 @@ FcVStackPushLangSet (FcConfigParse *parse, FcLangSet *langset)
}
static FcBool
+FcVStackPushName (FcConfigParse *parse, FcMatchKind kind, FcObject object)
+{
+ FcVStack *vstack = FcVStackCreateAndPush (parse);
+ if (!vstack)
+ return FcFalse;
+ vstack->u.name.object = object;
+ vstack->u.name.kind = kind;
+ vstack->tag = FcVStackName;
+ return FcTrue;
+}
+
+static FcBool
FcVStackPushTest (FcConfigParse *parse, FcTest *test)
{
FcVStack *vstack = FcVStackCreateAndPush (parse);
@@ -906,10 +955,11 @@ FcVStackPopAndDestroy (FcConfigParse *parse)
switch (vstack->tag) {
case FcVStackNone:
break;
+ case FcVStackName:
+ break;
case FcVStackFamily:
break;
case FcVStackString:
- case FcVStackField:
case FcVStackConstant:
case FcVStackGlob:
FcStrFree (vstack->u.string);
@@ -921,7 +971,7 @@ FcVStackPopAndDestroy (FcConfigParse *parse)
case FcVStackDouble:
break;
case FcVStackMatrix:
- FcMatrixFree (vstack->u.matrix);
+ FcExprMatrixFreeShallow (vstack->u.matrix);
break;
case FcVStackRange:
case FcVStackBool:
@@ -949,10 +999,7 @@ FcVStackPopAndDestroy (FcConfigParse *parse)
if (vstack == &parse->vstack_static[parse->vstack_static_used - 1])
parse->vstack_static_used--;
else
- {
- FcMemFree (FC_MEM_VSTACK, sizeof (FcVStack));
free (vstack);
- }
}
static void
@@ -1001,7 +1048,6 @@ FcConfigSaveAttr (const XML_Char **attr, FcChar8 **buf, int size_bytes)
FcConfigMessage (0, FcSevereError, "out of memory");
return 0;
}
- FcMemAlloc (FC_MEM_ATTR, 1); /* size is too expensive */
}
s = (FcChar8 *) (new + (i + 1));
for (i = 0; attr[i]; i++)
@@ -1026,7 +1072,6 @@ FcPStackPush (FcConfigParse *parse, FcElement element, const XML_Char **attr)
new = malloc (sizeof (FcPStack));
if (!new)
return FcFalse;
- FcMemAlloc (FC_MEM_PSTACK, sizeof (FcPStack));
}
new->prev = parse->pstack;
@@ -1047,28 +1092,38 @@ FcPStackPop (FcConfigParse *parse)
FcConfigMessage (parse, FcSevereError, "mismatching element");
return FcFalse;
}
+
+ if (parse->pstack->attr)
+ {
+ /* Warn about unused attrs. */
+ FcChar8 **attrs = parse->pstack->attr;
+ while (*attrs)
+ {
+ if (attrs[0][0])
+ {
+ FcConfigMessage (parse, FcSevereError, "invalid attribute '%s'", attrs[0]);
+ }
+ attrs += 2;
+ }
+ }
+
FcVStackClear (parse);
old = parse->pstack;
parse->pstack = old->prev;
FcStrBufDestroy (&old->str);
+
if (old->attr && old->attr != old->attr_buf_static)
- {
- FcMemFree (FC_MEM_ATTR, 1); /* size is to expensive */
free (old->attr);
- }
if (old == &parse->pstack_static[parse->pstack_static_used - 1])
parse->pstack_static_used--;
else
- {
- FcMemFree (FC_MEM_PSTACK, sizeof (FcPStack));
free (old);
- }
return FcTrue;
}
static FcBool
-FcConfigInit (FcConfigParse *parse, const FcChar8 *name, FcConfig *config, XML_Parser parser)
+FcConfigParseInit (FcConfigParse *parse, const FcChar8 *name, FcConfig *config, XML_Parser parser)
{
parse->pstack = 0;
parse->pstack_static_used = 0;
@@ -1102,7 +1157,10 @@ FcConfigGetAttribute (FcConfigParse *parse, const char *attr)
while (*attrs)
{
if (!strcmp ((char *) *attrs, attr))
+ {
+ attrs[0][0] = '\0'; /* Mark as used. */
return attrs[1];
+ }
attrs += 2;
}
return 0;
@@ -1140,7 +1198,7 @@ FcParseBlank (FcConfigParse *parse)
if (!parse->config->blanks)
goto bail;
}
- switch (v->tag) {
+ switch ((int) v->tag) {
case FcVStackInteger:
if (!FcBlanksAdd (parse->config->blanks, v->u.integer))
goto bail;
@@ -1301,48 +1359,67 @@ FcParseString (FcConfigParse *parse, FcVStackTag tag)
}
static void
-FcParseMatrix (FcConfigParse *parse)
+FcParseName (FcConfigParse *parse)
{
- FcVStack *vstack;
- enum { m_done, m_xx, m_xy, m_yx, m_yy } matrix_state = m_yy;
- FcMatrix m;
+ const FcChar8 *kind_string;
+ FcMatchKind kind;
+ FcChar8 *s;
+ FcObject object;
- while ((vstack = FcVStackPeek (parse)))
+ kind_string = FcConfigGetAttribute (parse, "target");
+ if (!kind_string)
+ kind = FcMatchDefault;
+ else
{
- double v;
- switch (vstack->tag) {
- case FcVStackInteger:
- v = vstack->u.integer;
- break;
- case FcVStackDouble:
- v = vstack->u._double;
- break;
- default:
- FcConfigMessage (parse, FcSevereError, "non-double matrix element");
- v = 1.0;
- break;
- }
- switch (matrix_state) {
- case m_xx: m.xx = v; break;
- case m_xy: m.xy = v; break;
- case m_yx: m.yx = v; break;
- case m_yy: m.yy = v; break;
- default: break;
+ if (!strcmp ((char *) kind_string, "pattern"))
+ kind = FcMatchPattern;
+ else if (!strcmp ((char *) kind_string, "font"))
+ kind = FcMatchFont;
+ else if (!strcmp ((char *) kind_string, "default"))
+ kind = FcMatchDefault;
+ else
+ {
+ FcConfigMessage (parse, FcSevereWarning, "invalid name target \"%s\"", kind_string);
+ return;
}
- FcVStackPopAndDestroy (parse);
- matrix_state--;
}
- if (matrix_state != m_done)
- FcConfigMessage (parse, FcSevereError, "wrong number of matrix elements");
+
+ if (!parse->pstack)
+ return;
+ s = FcStrBufDone (&parse->pstack->str);
+ if (!s)
+ {
+ FcConfigMessage (parse, FcSevereError, "out of memory");
+ return;
+ }
+ object = FcObjectFromName ((const char *) s);
+
+ FcVStackPushName (parse, kind, object);
+
+ FcStrFree (s);
+}
+
+static void
+FcParseMatrix (FcConfigParse *parse)
+{
+ FcExprMatrix m;
+
+ m.yy = FcPopExpr (parse);
+ m.yx = FcPopExpr (parse);
+ m.xy = FcPopExpr (parse);
+ m.xx = FcPopExpr (parse);
+
+ if (FcPopExpr (parse))
+ FcConfigMessage (parse, FcSevereError, "wrong number of matrix elements");
else
- FcVStackPushMatrix (parse, &m);
+ FcVStackPushMatrix (parse, &m);
}
static void
FcParseRange (FcConfigParse *parse)
{
FcVStack *vstack;
- FcRange r;
+ FcRange r = {0, 0};
FcChar32 n;
int count = 1;
@@ -1353,7 +1430,7 @@ FcParseRange (FcConfigParse *parse)
FcConfigMessage (parse, FcSevereError, "too many elements in range");
return;
}
- switch (vstack->tag) {
+ switch ((int) vstack->tag) {
case FcVStackInteger:
n = vstack->u.integer;
break;
@@ -1420,7 +1497,7 @@ FcParseCharSet (FcConfigParse *parse)
while ((vstack = FcVStackPeek (parse)))
{
- switch (vstack->tag) {
+ switch ((int) vstack->tag) {
case FcVStackInteger:
if (!FcCharSetAddChar (charset, vstack->u.integer))
{
@@ -1464,7 +1541,7 @@ FcParseLangSet (FcConfigParse *parse)
while ((vstack = FcVStackPeek (parse)))
{
- switch (vstack->tag) {
+ switch ((int) vstack->tag) {
case FcVStackString:
if (!FcLangSetAdd (langset, vstack->u.string))
{
@@ -1587,7 +1664,7 @@ FcParseAlias (FcConfigParse *parse)
return;
while ((vstack = FcVStackPeek (parse)))
{
- switch (vstack->tag) {
+ switch ((int) vstack->tag) {
case FcVStackFamily:
if (family)
{
@@ -1716,15 +1793,15 @@ FcPopExpr (FcConfigParse *parse)
FcExpr *expr = 0;
if (!vstack)
return 0;
- switch (vstack->tag) {
+ switch ((int) vstack->tag) {
case FcVStackNone:
break;
case FcVStackString:
case FcVStackFamily:
expr = FcExprCreateString (parse->config, vstack->u.string);
break;
- case FcVStackField:
- expr = FcExprCreateField (parse->config, (char *) vstack->u.string);
+ case FcVStackName:
+ expr = FcExprCreateName (parse->config, vstack->u.name);
break;
case FcVStackConstant:
expr = FcExprCreateConst (parse->config, vstack->u.string);
@@ -1877,8 +1954,6 @@ FcParseDir (FcConfigParse *parse)
goto bail;
}
prefix = p;
- FcMemFree (FC_MEM_STRING, plen + 1);
- FcMemAlloc (FC_MEM_STRING, plen + 1 + dlen + 1);
prefix[plen] = FC_DIR_SEPARATOR;
memcpy (&prefix[plen + 1], data, dlen);
prefix[plen + 1 + dlen] = 0;
@@ -1887,7 +1962,7 @@ FcParseDir (FcConfigParse *parse)
#ifdef _WIN32
if (strcmp ((const char *) data, "CUSTOMFONTDIR") == 0)
{
- char *p;
+ FcChar8 *p;
data = buffer;
if (!GetModuleFileName (NULL, (LPCH) buffer, sizeof (buffer) - 20))
{
@@ -1902,11 +1977,11 @@ FcParseDir (FcConfigParse *parse)
*/
p = _mbsrchr (data, '\\');
if (p) *p = '\0';
- strcat (data, "\\fonts");
+ strcat ((char *) data, "\\fonts");
}
else if (strcmp ((const char *) data, "APPSHAREFONTDIR") == 0)
{
- char *p;
+ FcChar8 *p;
data = buffer;
if (!GetModuleFileName (NULL, (LPCH) buffer, sizeof (buffer) - 20))
{
@@ -1915,7 +1990,7 @@ FcParseDir (FcConfigParse *parse)
}
p = _mbsrchr (data, '\\');
if (p) *p = '\0';
- strcat (data, "\\..\\share\\fonts");
+ strcat ((char *) data, "\\..\\share\\fonts");
}
else if (strcmp ((const char *) data, "WINDOWSFONTDIR") == 0)
{
@@ -1928,8 +2003,8 @@ FcParseDir (FcConfigParse *parse)
goto bail;
}
if (data [strlen ((const char *) data) - 1] != '\\')
- strcat (data, "\\");
- strcat (data, "fonts");
+ strcat ((char *) data, "\\");
+ strcat ((char *) data, "fonts");
}
#endif
if (strlen ((char *) data) == 0)
@@ -1974,8 +2049,6 @@ FcParseCacheDir (FcConfigParse *parse)
goto bail;
}
prefix = p;
- FcMemFree (FC_MEM_STRING, plen + 1);
- FcMemAlloc (FC_MEM_STRING, plen + 1 + dlen + 1);
prefix[plen] = FC_DIR_SEPARATOR;
memcpy (&prefix[plen + 1], data, dlen);
prefix[plen + 1 + dlen] = 0;
@@ -1993,7 +2066,6 @@ FcParseCacheDir (FcConfigParse *parse)
FcConfigMessage (parse, FcSevereError, "out of memory");
goto bail;
}
- FcMemAlloc (FC_MEM_STRING, 1000);
rc = GetTempPath (800, (LPSTR) data);
if (rc == 0 || rc > 800)
{
@@ -2001,8 +2073,8 @@ FcParseCacheDir (FcConfigParse *parse)
goto bail;
}
if (data [strlen ((const char *) data) - 1] != '\\')
- strcat (data, "\\");
- strcat (data, "fontconfig\\cache");
+ strcat ((char *) data, "\\");
+ strcat ((char *) data, "fontconfig\\cache");
}
else if (strcmp ((const char *) data, "LOCAL_APPDATA_FONTCONFIG_CACHE") == 0)
{
@@ -2023,7 +2095,6 @@ FcParseCacheDir (FcConfigParse *parse)
FcConfigMessage (parse, FcSevereError, "out of memory");
goto bail;
}
- FcMemAlloc (FC_MEM_STRING, len);
strncpy((char *) data, szFPath, len);
}
#endif
@@ -2077,8 +2148,6 @@ FcParseInclude (FcConfigParse *parse)
goto bail;
}
prefix = p;
- FcMemFree (FC_MEM_STRING, plen + 1);
- FcMemAlloc (FC_MEM_STRING, plen + 1 + dlen + 1);
prefix[plen] = FC_DIR_SEPARATOR;
memcpy (&prefix[plen + 1], s, dlen);
prefix[plen + 1 + dlen] = 0;
@@ -2335,7 +2404,7 @@ FcParseMatch (FcConfigParse *parse)
}
while ((vstack = FcVStackPeek (parse)))
{
- switch (vstack->tag) {
+ switch ((int) vstack->tag) {
case FcVStackTest:
vstack->u.test->next = test;
test = vstack->u.test;
@@ -2369,7 +2438,7 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
while ((vstack = FcVStackPeek (parse)))
{
- switch (vstack->tag) {
+ switch ((int) vstack->tag) {
case FcVStackGlob:
if (!FcConfigGlobAdd (parse->config,
vstack->u.string,
@@ -2408,9 +2477,9 @@ FcPopValue (FcConfigParse *parse)
if (!vstack)
return value;
- switch (vstack->tag) {
+ switch ((int) vstack->tag) {
case FcVStackString:
- value.u.s = FcSharedStr (vstack->u.string);
+ value.u.s = FcStrdup (vstack->u.string);
if (value.u.s)
value.type = FcTypeString;
break;
@@ -2424,12 +2493,7 @@ FcPopValue (FcConfigParse *parse)
break;
case FcVStackDouble:
value.u.d = vstack->u._double;
- value.type = FcTypeInteger;
- break;
- case FcVStackMatrix:
- value.u.m = FcMatrixCopy (vstack->u.matrix);
- if (value.u.m)
- value.type = FcTypeMatrix;
+ value.type = FcTypeDouble;
break;
case FcVStackBool:
value.u.b = vstack->u.bool_;
@@ -2507,7 +2571,7 @@ FcParsePattern (FcConfigParse *parse)
while ((vstack = FcVStackPeek (parse)))
{
- switch (vstack->tag) {
+ switch ((int) vstack->tag) {
case FcVStackPattern:
if (!FcPatternAppend (pattern, vstack->u.pattern))
{
@@ -2527,7 +2591,7 @@ FcParsePattern (FcConfigParse *parse)
}
static void
-FcEndElement(void *userData, const XML_Char *name)
+FcEndElement(void *userData, const XML_Char *name FC_UNUSED)
{
FcConfigParse *parse = userData;
FcChar8 *data;
@@ -2634,7 +2698,7 @@ FcEndElement(void *userData, const XML_Char *name)
FcParsePatelt (parse);
break;
case FcElementName:
- FcParseString (parse, FcVStackField);
+ FcParseName (parse);
break;
case FcElementConst:
FcParseString (parse, FcVStackConstant);
@@ -2719,9 +2783,9 @@ FcCharacterData (void *userData, const XML_Char *s, int len)
static void
FcStartDoctypeDecl (void *userData,
const XML_Char *doctypeName,
- const XML_Char *sysid,
- const XML_Char *pubid,
- int has_internal_subset)
+ const XML_Char *sysid FC_UNUSED,
+ const XML_Char *pubid FC_UNUSED,
+ int has_internal_subset FC_UNUSED)
{
FcConfigParse *parse = userData;
@@ -2752,7 +2816,7 @@ FcExternalSubsetDecl (void *userData,
#else /* ENABLE_LIBXML2 */
static void
-FcEndDoctypeDecl (void *userData)
+FcEndDoctypeDecl (void *userData FC_UNUSED)
{
}
@@ -2940,7 +3004,7 @@ FcConfigParseAndLoad (FcConfig *config,
if (!p)
goto bail1;
- if (!FcConfigInit (&parse, name, config, p))
+ if (!FcConfigParseInit (&parse, name, config, p))
goto bail2;
#ifndef ENABLE_LIBXML2
diff --git a/fontconfig/src/ftglue.c b/fontconfig/src/ftglue.c
index 7c643d0ff..0e02bd2df 100644
--- a/fontconfig/src/ftglue.c
+++ b/fontconfig/src/ftglue.c
@@ -87,7 +87,7 @@ ftglue_stream_seek( FT_Stream stream,
if ( stream->read( stream, pos, 0, 0 ) )
error = FT_Err_Invalid_Stream_Operation;
}
- else if ( pos > stream->size )
+ else if ( pos < 0 || (FT_ULong) pos > stream->size )
error = FT_Err_Invalid_Stream_Operation;
if ( !error )
@@ -257,6 +257,5 @@ Exit:
}
#undef QALLOC
-#define __ftglue__
#include "fcaliastail.h"
#undef __ftglue__
diff --git a/fontconfig/src/makefile b/fontconfig/src/makefile
index a289c5f6e..091584172 100644
--- a/fontconfig/src/makefile
+++ b/fontconfig/src/makefile
@@ -1,14 +1,4 @@
-#INCLUDES = \
-# -I$(top_srcdir) \
-# -I$(top_srcdir)/src \
-# $(FREETYPE_CFLAGS) \
-# $(LIBXML2_CFLAGS) \
-# $(EXPAT_CFLAGS) \
-# $(WARN_CFLAGS) \
-# -DFC_CACHEDIR='"$(FC_CACHEDIR)"' \
-# -DFONTCONFIG_PATH='"$(CONFDIR)"'
-
load_makefile NORELDBG=1 ..\fc-case\makefile
load_makefile NORELDBG=1 ..\fc-glyphname\makefile
load_makefile NORELDBG=1 ..\fc-lang\makefile
@@ -31,6 +21,7 @@ CSRCS = \
fcmatch.c \
fcmatrix.c \
fcname.c \
+ fcobjs.c \
fcpat.c \
fcserialize.c \
fcstat.c \
diff --git a/fontconfig/test/Makefile.am b/fontconfig/test/Makefile.am
index 72da8d64a..3fd343a24 100644
--- a/fontconfig/test/Makefile.am
+++ b/fontconfig/test/Makefile.am
@@ -1,5 +1,5 @@
check_SCRIPTS=run-test.sh
-TESTS_ENVIRONMENT=src=${srcdir} sh
+TESTS_ENVIRONMENT=src=${srcdir} EXEEXT=${EXEEXT} sh
TESTS=run-test.sh
TESTDATA=4x6.pcf 8x16.pcf out.expected fonts.conf.in
@@ -7,3 +7,5 @@ TESTDATA=4x6.pcf 8x16.pcf out.expected fonts.conf.in
EXTRA_DIST=$(check_SCRIPTS) $(TESTDATA)
CLEANFILES=
+
+-include $(top_srcdir)/git.mk
diff --git a/fontconfig/test/run-test.sh b/fontconfig/test/run-test.sh
index e7174b289..24ca296bb 100644
--- a/fontconfig/test/run-test.sh
+++ b/fontconfig/test/run-test.sh
@@ -6,8 +6,8 @@ CACHEDIR=`pwd`/cache.dir
ECHO=true
-FCLIST=../fc-list/fc-list
-FCCACHE=../fc-cache/fc-cache
+FCLIST=../fc-list/fc-list$EXEEXT
+FCCACHE=../fc-cache/fc-cache$EXEEXT
FONT1=$TESTDIR/4x6.pcf
FONT2=$TESTDIR/8x16.pcf
diff --git a/libX11/src/xcms/Makefile.am b/libX11/src/xcms/Makefile.am
index 40212c01b..d147e23bf 100644
--- a/libX11/src/xcms/Makefile.am
+++ b/libX11/src/xcms/Makefile.am
@@ -9,7 +9,8 @@ AM_CPPFLAGS= \
-I$(top_srcdir)/src/xkb \
-I$(top_srcdir)/src/xlibi18n \
-I$(top_srcdir)/src \
- -D_BSD_SOURCE
+ -D_BSD_SOURCE \
+ -DXCMSDIR=\"$(X11dir)\"
AM_CFLAGS= \
$(X11_CFLAGS) \
@@ -84,7 +85,7 @@ libxcms_la_SOURCES = \
xyY.c \
Xcmsint.h
-X11dir = $(libdir)/X11
+X11dir = $(X11_DATADIR)
dist_X11_DATA = Xcms.txt
diff --git a/libX11/src/xcms/cmsColNm.c b/libX11/src/xcms/cmsColNm.c
index 8518adfd1..73977e5fc 100644
--- a/libX11/src/xcms/cmsColNm.c
+++ b/libX11/src/xcms/cmsColNm.c
@@ -53,7 +53,7 @@ static Status LoadColornameDB(void);
* #define declarations local to this package.
*/
#ifndef XCMSDB
-#define XCMSDB "/usr/lib/X11/Xcms.txt"
+#define XCMSDB XCMSDIR "/Xcms.txt"
#endif
#ifndef isgraph
diff --git a/libXau/AuFileName.c b/libXau/AuFileName.c
index bc7b177db..473fad110 100644
--- a/libXau/AuFileName.c
+++ b/libXau/AuFileName.c
@@ -45,12 +45,12 @@ XauFileName (void)
{
const char *slashDotXauthority = "/.Xauthority";
char *name;
- static int bsize;
+ static size_t bsize;
static int atexit_registered = 0;
#ifdef WIN32
char dir[128];
#endif
- int size;
+ size_t size;
if ((name = getenv ("XAUTHORITY")))
return name;
@@ -70,7 +70,7 @@ XauFileName (void)
if (size > bsize) {
if (buf)
free (buf);
- buf = malloc ((unsigned) size);
+ buf = malloc (size);
if (!buf)
return NULL;
diff --git a/libXau/AuRead.c b/libXau/AuRead.c
index 3c59632de..5d41f03f7 100644
--- a/libXau/AuRead.c
+++ b/libXau/AuRead.c
@@ -35,7 +35,7 @@ read_short (unsigned short *shortp, FILE *file)
{
unsigned char file_short[2];
- if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1)
+ if (fread ((char *) file_short, sizeof (file_short), 1, file) != 1)
return 0;
*shortp = file_short[0] * 256 + file_short[1];
return 1;
@@ -55,7 +55,7 @@ read_counted_string (unsigned short *countp, char **stringp, FILE *file)
data = malloc ((unsigned) len);
if (!data)
return 0;
- if (fread (data, (int) sizeof (char), (int) len, file) != len) {
+ if (fread (data, sizeof (char), len, file) != len) {
bzero (data, len);
free (data);
return 0;
diff --git a/libXau/AuWrite.c b/libXau/AuWrite.c
index 0924f8d06..1eb38a39f 100644
--- a/libXau/AuWrite.c
+++ b/libXau/AuWrite.c
@@ -36,7 +36,7 @@ write_short (unsigned short s, FILE *file)
file_short[0] = (s & (unsigned)0xff00) >> 8;
file_short[1] = s & 0xff;
- if (fwrite ((char *) file_short, (int) sizeof (file_short), 1, file) != 1)
+ if (fwrite ((char *) file_short, sizeof (file_short), 1, file) != 1)
return 0;
return 1;
}
@@ -46,7 +46,7 @@ write_counted_string (unsigned short count, char *string, FILE *file)
{
if (write_short (count, file) == 0)
return 0;
- if (fwrite (string, (int) sizeof (char), (int) count, file) != count)
+ if (fwrite (string, sizeof (char), count, file) != count)
return 0;
return 1;
}
diff --git a/libXau/include/X11/Xauth.h b/libXau/include/X11/Xauth.h
index f57a1b375..a707bed8c 100644
--- a/libXau/include/X11/Xauth.h
+++ b/libXau/include/X11/Xauth.h
@@ -27,6 +27,14 @@ in this Software without prior written authorization from The Open Group.
#ifndef _Xauth_h
#define _Xauth_h
+/* struct xauth is full of implicit padding to properly align the pointers
+ after the length fields. We can't clean that up without breaking ABI,
+ so tell clang not to bother complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
typedef struct xauth {
unsigned short family;
unsigned short address_length;
@@ -39,6 +47,10 @@ typedef struct xauth {
char *data;
} Xauth;
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
#ifndef _XAUTH_STRUCT_ONLY
# include <X11/Xfuncproto.h>
diff --git a/mesalib/Android.common.mk b/mesalib/Android.common.mk
index 18e5726fa..d0a5f1aa4 100644
--- a/mesalib/Android.common.mk
+++ b/mesalib/Android.common.mk
@@ -34,10 +34,8 @@ LOCAL_C_INCLUDES += \
$(MESA_TOP)/include
# define ANDROID_VERSION (e.g., 4.0.x => 0x0400)
-major := $(word 1, $(subst ., , $(PLATFORM_VERSION)))
-minor := $(word 2, $(subst ., , $(PLATFORM_VERSION)))
LOCAL_CFLAGS += \
- -DANDROID_VERSION=0x0$(major)0$(minor)
+ -DANDROID_VERSION=0x0$(MESA_ANDROID_MAJOR_VERSION)0$(MESA_ANDROID_MINOR_VERSION)
LOCAL_CFLAGS += \
-DHAVE_PTHREAD=1 \
diff --git a/mesalib/Android.mk b/mesalib/Android.mk
index 6a3014c81..80c0e1395 100644
--- a/mesalib/Android.mk
+++ b/mesalib/Android.mk
@@ -30,6 +30,11 @@
# module will also be built. DRI modules will be loaded by libGLES_mesa.
MESA_TOP := $(call my-dir)
+
+MESA_ANDROID_MAJOR_VERSION := $(word 1, $(subst ., , $(PLATFORM_VERSION)))
+MESA_ANDROID_MINOR_VERSION := $(word 2, $(subst ., , $(PLATFORM_VERSION)))
+MESA_ANDROID_VERSION := $(MESA_ANDROID_MAJOR_VERSION).$(MESA_ANDROID_MINOR_VERSION)
+
MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk
MESA_PYTHON2 := python
diff --git a/mesalib/bin/.gitignore b/mesalib/bin/.gitignore
index dfaa6d366..aa4577e91 100644
--- a/mesalib/bin/.gitignore
+++ b/mesalib/bin/.gitignore
@@ -6,3 +6,4 @@ install-sh
ylwrap
compile
ar-lib
+/test-driver
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index 1294740a4..1414ce826 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -73,7 +73,7 @@ AC_PATH_PROG([PERL], [perl])
AC_CHECK_PROG(INDENT, indent, indent, cat)
if test "x$INDENT" != "xcat"; then
- AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -T GLubyte -T GLbyte -T Bool')
+ AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -TGLubyte -TGLbyte -TBool')
fi
dnl Our fallback install-sh is a symlink to minstall. Use the existing
@@ -1677,7 +1677,8 @@ if test "x$enable_gallium_llvm" = xyes; then
if test "x$LLVM_CONFIG" != xno; then
LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'`
- if test "x$with_llvm_shared_libs" = xyes; then
+ LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
+ if test "x$with_llvm_shared_libs" = xyes; then
dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
LLVM_LIBS="-lLLVM-`$LLVM_CONFIG --version`"
else
@@ -1800,24 +1801,19 @@ gallium_require_drm_loader() {
radeon_llvm_check() {
LLVM_REQUIRED_VERSION_MAJOR="3"
LLVM_REQUIRED_VERSION_MINOR="2"
- LLVM_AVAILABLE_VERSION_MAJOR=`echo $LLVM_VERSION | cut -d. -f1`
- LLVM_AVAILABLE_VERSION_MINOR=`echo $LLVM_VERSION | cut -d. -f2`
- if test "$LLVM_AVAILABLE_VERSION_MAJOR" -lt "$LLVM_REQUIRED_VERSION_MAJOR" -o [ "$LLVM_AVAILABLE_VERSION_MAJOR" -eq "$LLVM_REQUIRED_VERSION_MAJOR" -a "$LLVM_AVAILABLE_VERSION_MINOR" -lt "$LLVM_REQUIRED_VERSION_MINOR" ] ; then
- AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer with AMDGPU target enabled is required.
+ if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
+ AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer with R600 target enabled is required.
To use the r600/radeonsi LLVM backend, you need to fetch the LLVM source from:
git://people.freedesktop.org/~tstellar/llvm master
- and build with --enable-experimental-targets=AMDGPU])
+ and build with --enable-experimental-targets=R600])
fi
- if test true && $LLVM_CONFIG --targets-built | grep -qv '\<AMDGPU\>' ; then
- AC_MSG_ERROR([LLVM AMDGPU Target not enabled.
- To use the r600/radeonsi LLVM backend, you need to fetch the LLVM source from:
- git://people.freedesktop.org/~tstellar/llvm master
- and build with --enable-experimental-targets=AMDGPU])
+ if test true && $LLVM_CONFIG --targets-built | grep -qv '\<R600\>' ; then
+ AC_MSG_ERROR([LLVM R600 Target not enabled. You can enable it when building the LLVM
+ sources with the --enable-experimental-targets=R600
+ configure flag])
fi
AC_MSG_WARN([Please ensure you use the latest llvm tree from git://people.freedesktop.org/~tstellar/llvm master before submitting a bug])
- if test "x$LLVM_VERSION" = "x3.2"; then
- LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --libs amdgpu`"
- fi
+ LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --libs r600`"
}
dnl Gallium drivers
diff --git a/mesalib/include/EGL/eglext.h b/mesalib/include/EGL/eglext.h
index a5c9009e1..b2b5a8038 100644
--- a/mesalib/include/EGL/eglext.h
+++ b/mesalib/include/EGL/eglext.h
@@ -34,7 +34,7 @@ extern "C" {
/* Header file version number */
/* Current version at http://www.khronos.org/registry/egl/ */
-/* $Revision: 19571 $ on $Date: 2012-10-31 10:10:33 -0700 (Wed, 31 Oct 2012) $ */
+/* $Revision: 19987 $ on $Date: 2012-12-13 16:46:46 -0800 (Thu, 13 Dec 2012) $ */
#define EGL_EGLEXT_VERSION 14
#ifndef EGL_KHR_config_attribs
@@ -250,7 +250,6 @@ struct EGLClientPixmapHI
EGLint iHeight;
EGLint iStride;
};
-
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
#endif /* EGL_EGLEXT_PROTOTYPES */
@@ -316,9 +315,7 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay
#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */
#ifndef EGL_NV_system_time
#define EGL_NV_system_time 1
-
typedef khronos_utime_nanoseconds_t EGLuint64NV;
-
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
@@ -470,10 +467,75 @@ EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint
typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
#endif
+#ifndef EGL_NV_post_convert_rounding
+#define EGL_NV_post_convert_rounding 1
+/* No tokens or entry points, just relaxes behavior of SwapBuffers */
+#endif
+
+#ifndef EGL_NV_native_query
+#define EGL_NV_native_query 1
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV( EGLDisplay dpy, EGLNativeDisplayType* display_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV( EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType* window);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV( EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType* pixmap);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC)(EGLDisplay dpy, EGLNativeDisplayType *display_id);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
+#endif
+
+#ifndef EGL_NV_3dvision_surface
+#define EGL_NV_3dvision_surface 1
+#define EGL_AUTO_STEREO_NV 0x3136
+#endif
+
+#ifndef EGL_ANDROID_framebuffer_target
+#define EGL_ANDROID_framebuffer_target 1
+#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
+#endif
+
+#ifndef EGL_ANDROID_blob_cache
+#define EGL_ANDROID_blob_cache 1
+typedef khronos_ssize_t EGLsizeiANDROID;
+typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
+typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC)(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#endif
+
+#ifndef EGL_ANDROID_image_native_buffer
+#define EGL_ANDROID_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_ANDROID 0x3140
+#endif
+
+#ifndef EGL_ANDROID_native_fence_sync
+#define EGL_ANDROID_native_fence_sync 1
+#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
+#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
+#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
+#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID( EGLDisplay dpy, EGLSyncKHR);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC)(EGLDisplay dpy, EGLSyncKHR);
+#endif
+
+#ifndef EGL_ANDROID_recordable
+#define EGL_ANDROID_recordable 1
+#define EGL_RECORDABLE_ANDROID 0x3142
+#endif
+
+#ifndef EGL_EXT_buffer_age
+#define EGL_EXT_buffer_age 1
+#define EGL_BUFFER_AGE_EXT 0x313D
+#endif
+
#include <EGL/eglmesaext.h>
#ifdef __cplusplus
}
#endif
-#endif
+#endif /* __eglext_h_ */
diff --git a/mesalib/src/.gitignore b/mesalib/src/.gitignore
index 5fc607b9e..ddfb40586 100644
--- a/mesalib/src/.gitignore
+++ b/mesalib/src/.gitignore
@@ -1 +1,3 @@
/Makefile
+*.trs
+*.log
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index 7c7e06219..95224020c 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -127,6 +127,10 @@ struct blitter_context_priv
void (*delete_fs_state)(struct pipe_context *, void *);
};
+static struct pipe_surface *
+util_blitter_get_next_surface_layer(struct pipe_context *pipe,
+ struct pipe_surface *surf);
+
struct blitter_context *util_blitter_create(struct pipe_context *pipe)
{
struct blitter_context_priv *ctx;
@@ -143,6 +147,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
ctx->base.pipe = pipe;
ctx->base.draw_rectangle = util_blitter_draw_rectangle;
+ ctx->base.get_next_surface_layer = util_blitter_get_next_surface_layer;
ctx->bind_fs_state = pipe->bind_fs_state;
ctx->delete_fs_state = pipe->delete_fs_state;
@@ -681,6 +686,11 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx,
}
break;
+ case PIPE_TEXTURE_CUBE_ARRAY:
+ for (i = 0; i < 4; i++)
+ ctx->vertices[i][1][3] = (float) (layer / 6); /*w*/
+ break;
+
case PIPE_TEXTURE_2D:
for (i = 0; i < 4; i++) {
ctx->vertices[i][1][2] = (float) sample; /*r*/
@@ -1056,14 +1066,28 @@ void util_blitter_custom_clear_depth(struct blitter_context *blitter,
void util_blitter_default_dst_texture(struct pipe_surface *dst_templ,
struct pipe_resource *dst,
unsigned dstlevel,
- unsigned dstz,
- const struct pipe_box *srcbox)
+ unsigned dstz)
{
memset(dst_templ, 0, sizeof(*dst_templ));
dst_templ->format = util_format_linear(dst->format);
dst_templ->u.tex.level = dstlevel;
dst_templ->u.tex.first_layer = dstz;
- dst_templ->u.tex.last_layer = dstz + srcbox->depth - 1;
+ dst_templ->u.tex.last_layer = dstz;
+}
+
+static struct pipe_surface *
+util_blitter_get_next_surface_layer(struct pipe_context *pipe,
+ struct pipe_surface *surf)
+{
+ struct pipe_surface dst_templ;
+
+ memset(&dst_templ, 0, sizeof(dst_templ));
+ dst_templ.format = surf->format;
+ dst_templ.u.tex.level = surf->u.tex.level;
+ dst_templ.u.tex.first_layer = surf->u.tex.first_layer + 1;
+ dst_templ.u.tex.last_layer = surf->u.tex.last_layer + 1;
+
+ return pipe->create_surface(pipe, surf->texture, &dst_templ);
}
void util_blitter_default_src_texture(struct pipe_sampler_view *src_templ,
@@ -1176,12 +1200,16 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
struct pipe_context *pipe = ctx->base.pipe;
struct pipe_surface *dst_view, dst_templ;
struct pipe_sampler_view src_templ, *src_view;
+ struct pipe_box dstbox;
assert(dst && src);
assert(src->target < PIPE_MAX_TEXTURE_TYPES);
+ u_box_3d(dstx, dsty, dstz, abs(srcbox->width), abs(srcbox->height),
+ abs(srcbox->depth), &dstbox);
+
/* Initialize the surface. */
- util_blitter_default_dst_texture(&dst_templ, dst, dst_level, dstz, srcbox);
+ util_blitter_default_dst_texture(&dst_templ, dst, dst_level, dstz);
dst_view = pipe->create_surface(pipe, dst, &dst_templ);
/* Initialize the sampler view. */
@@ -1189,8 +1217,7 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
src_view = pipe->create_sampler_view(pipe, src, &src_templ);
/* Copy. */
- util_blitter_blit_generic(blitter, dst_view, dstx, dsty,
- abs(srcbox->width), abs(srcbox->height),
+ util_blitter_blit_generic(blitter, dst_view, &dstbox,
src_view, srcbox, src->width0, src->height0,
mask, PIPE_TEX_FILTER_NEAREST, NULL,
copy_all_samples);
@@ -1201,8 +1228,7 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
void util_blitter_blit_generic(struct blitter_context *blitter,
struct pipe_surface *dst,
- int dstx, int dsty,
- unsigned dst_width, unsigned dst_height,
+ const struct pipe_box *dstbox,
struct pipe_sampler_view *src,
const struct pipe_box *srcbox,
unsigned src_width0, unsigned src_height0,
@@ -1214,6 +1240,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
struct pipe_context *pipe = ctx->base.pipe;
struct pipe_framebuffer_state fb_state;
enum pipe_texture_target src_target = src->texture->target;
+ unsigned src_samples = src->texture->nr_samples;
boolean has_depth, has_stencil, has_color;
boolean blit_stencil, blit_depth, blit_color;
void *sampler_state;
@@ -1238,9 +1265,6 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
return;
}
- /* XXX should handle 3d regions */
- assert(srcbox->depth == 1);
-
/* Check whether the states are properly saved. */
blitter_set_running_flag(ctx);
blitter_check_saved_vertex_states(ctx);
@@ -1252,6 +1276,9 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
/* Initialize framebuffer state. */
fb_state.width = dst->width;
fb_state.height = dst->height;
+ fb_state.nr_cbufs = blit_depth || blit_stencil ? 0 : 1;
+ fb_state.cbufs[0] = NULL;
+ fb_state.zsbuf = NULL;
if (blit_depth || blit_stencil) {
pipe->bind_blend_state(pipe, ctx->blend[0]);
@@ -1260,41 +1287,36 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
pipe->bind_depth_stencil_alpha_state(pipe,
ctx->dsa_write_depth_stencil);
ctx->bind_fs_state(pipe,
- blitter_get_fs_texfetch_depthstencil(ctx, src->texture->target,
- src->texture->nr_samples));
+ blitter_get_fs_texfetch_depthstencil(ctx, src_target,
+ src_samples));
} else if (blit_depth) {
pipe->bind_depth_stencil_alpha_state(pipe,
ctx->dsa_write_depth_keep_stencil);
ctx->bind_fs_state(pipe,
- blitter_get_fs_texfetch_depth(ctx, src->texture->target,
- src->texture->nr_samples));
+ blitter_get_fs_texfetch_depth(ctx, src_target,
+ src_samples));
} else { /* is_stencil */
pipe->bind_depth_stencil_alpha_state(pipe,
ctx->dsa_keep_depth_write_stencil);
ctx->bind_fs_state(pipe,
- blitter_get_fs_texfetch_stencil(ctx, src->texture->target,
- src->texture->nr_samples));
+ blitter_get_fs_texfetch_stencil(ctx, src_target,
+ src_samples));
}
- fb_state.nr_cbufs = 0;
- fb_state.zsbuf = dst;
} else {
pipe->bind_blend_state(pipe, ctx->blend[mask & PIPE_MASK_RGBA]);
pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil);
ctx->bind_fs_state(pipe,
- blitter_get_fs_texfetch_col(ctx, src->texture->target,
- src->texture->nr_samples));
-
- fb_state.nr_cbufs = 1;
- fb_state.cbufs[0] = dst;
- fb_state.zsbuf = 0;
+ blitter_get_fs_texfetch_col(ctx, src_target,
+ src_samples));
}
/* Set the linear filter only for scaled color non-MSAA blits. */
if (filter == PIPE_TEX_FILTER_LINEAR &&
!blit_depth && !blit_stencil &&
- src->texture->nr_samples <= 1 &&
- (dst_width != abs(srcbox->width) || dst_height != abs(srcbox->height))) {
+ src_samples <= 1 &&
+ (dstbox->width != abs(srcbox->width) ||
+ dstbox->height != abs(srcbox->height))) {
sampler_state = ctx->sampler_state_linear;
} else {
sampler_state = ctx->sampler_state;
@@ -1339,8 +1361,6 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
}
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
- pipe->set_framebuffer_state(pipe, &fb_state);
-
if (scissor) {
pipe->set_scissor_state(pipe, scissor);
}
@@ -1351,7 +1371,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
if ((src_target == PIPE_TEXTURE_1D ||
src_target == PIPE_TEXTURE_2D ||
src_target == PIPE_TEXTURE_RECT) &&
- src->texture->nr_samples <= 1) {
+ src_samples <= 1) {
/* Draw the quad with the draw_rectangle callback. */
/* Set texture coordinates. - use a pipe color union
@@ -1363,35 +1383,72 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
get_texcoords(src, src_width0, src_height0, srcbox->x, srcbox->y,
srcbox->x+srcbox->width, srcbox->y+srcbox->height, coord.f);
+ /* Set framebuffer state. */
+ if (blit_depth || blit_stencil) {
+ fb_state.zsbuf = dst;
+ } else {
+ fb_state.cbufs[0] = dst;
+ }
+ pipe->set_framebuffer_state(pipe, &fb_state);
+
/* Draw. */
pipe->set_sample_mask(pipe, ~0);
- blitter->draw_rectangle(blitter, dstx, dsty,
- dstx+dst_width, dsty+dst_height, 0,
+ blitter->draw_rectangle(blitter, dstbox->x, dstbox->y,
+ dstbox->x + dstbox->width,
+ dstbox->y + dstbox->height, 0,
UTIL_BLITTER_ATTRIB_TEXCOORD, &coord);
} else {
/* Draw the quad with the generic codepath. */
- if (copy_all_samples &&
- src->texture->nr_samples == dst->texture->nr_samples &&
- dst->texture->nr_samples > 1) {
- /* MSAA copy. */
- unsigned i, max_sample = MAX2(dst->texture->nr_samples, 1) - 1;
-
- for (i = 0; i <= max_sample; i++) {
- pipe->set_sample_mask(pipe, 1 << i);
- blitter_set_texcoords(ctx, src, src_width0, src_height0, srcbox->z,
- i, srcbox->x, srcbox->y,
+ int z;
+ for (z = 0; z < dstbox->depth; z++) {
+ struct pipe_surface *old;
+
+ /* Set framebuffer state. */
+ if (blit_depth || blit_stencil) {
+ fb_state.zsbuf = dst;
+ } else {
+ fb_state.cbufs[0] = dst;
+ }
+ pipe->set_framebuffer_state(pipe, &fb_state);
+
+ /* See if we need to blit a multisample or singlesample buffer. */
+ if (copy_all_samples &&
+ src_samples == dst->texture->nr_samples &&
+ dst->texture->nr_samples > 1) {
+ unsigned i, max_sample = MAX2(dst->texture->nr_samples, 1) - 1;
+
+ for (i = 0; i <= max_sample; i++) {
+ pipe->set_sample_mask(pipe, 1 << i);
+ blitter_set_texcoords(ctx, src, src_width0, src_height0,
+ srcbox->z + z,
+ i, srcbox->x, srcbox->y,
+ srcbox->x + srcbox->width,
+ srcbox->y + srcbox->height);
+ blitter_draw(ctx, dstbox->x, dstbox->y,
+ dstbox->x + dstbox->width,
+ dstbox->y + dstbox->height, 0);
+ }
+ } else {
+ pipe->set_sample_mask(pipe, ~0);
+ blitter_set_texcoords(ctx, src, src_width0, src_height0,
+ srcbox->z + z, 0,
+ srcbox->x, srcbox->y,
srcbox->x + srcbox->width,
srcbox->y + srcbox->height);
- blitter_draw(ctx, dstx, dsty,
- dstx+dst_width, dsty+dst_height, 0);
+ blitter_draw(ctx, dstbox->x, dstbox->y,
+ dstbox->x + dstbox->width,
+ dstbox->y + dstbox->height, 0);
+ }
+
+ /* Get the next surface or (if this is the last iteration)
+ * just unreference the last one. */
+ old = dst;
+ if (z < dstbox->depth-1) {
+ dst = ctx->base.get_next_surface_layer(ctx->base.pipe, dst);
+ }
+ if (z) {
+ pipe_surface_reference(&old, NULL);
}
- } else {
- pipe->set_sample_mask(pipe, ~0);
- blitter_set_texcoords(ctx, src, src_width0, src_height0, srcbox->z, 0,
- srcbox->x, srcbox->y,
- srcbox->x + srcbox->width,
- srcbox->y + srcbox->height);
- blitter_draw(ctx, dstx, dsty, dstx+dst_width, dsty+dst_height, 0);
}
}
@@ -1419,7 +1476,7 @@ util_blitter_blit(struct blitter_context *blitter,
/* Initialize the surface. */
util_blitter_default_dst_texture(&dst_templ, dst, info->dst.level,
- info->dst.box.z, &info->src.box);
+ info->dst.box.z);
dst_templ.format = info->dst.format;
dst_view = pipe->create_surface(pipe, dst, &dst_templ);
@@ -1429,9 +1486,7 @@ util_blitter_blit(struct blitter_context *blitter,
src_view = pipe->create_sampler_view(pipe, src, &src_templ);
/* Copy. */
- util_blitter_blit_generic(blitter, dst_view,
- info->dst.box.x, info->dst.box.y,
- info->dst.box.width, info->dst.box.height,
+ util_blitter_blit_generic(blitter, dst_view, &info->dst.box,
src_view, &info->src.box, src->width0, src->height0,
info->mask, info->filter,
info->scissor_enable ? &info->scissor : NULL, TRUE);
@@ -1761,7 +1816,8 @@ void util_blitter_custom_color(struct blitter_context *blitter,
blitter_disable_render_cond(ctx);
/* bind states */
- pipe->bind_blend_state(pipe, custom_blend);
+ pipe->bind_blend_state(pipe, custom_blend ? custom_blend
+ : ctx->blend[PIPE_MASK_RGBA]);
pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil);
ctx->bind_fs_state(pipe, blitter_get_fs_col(ctx, 1, FALSE));
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.h b/mesalib/src/gallium/auxiliary/util/u_blitter.h
index 0b5e4aa45..20e69ed5b 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.h
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.h
@@ -83,6 +83,15 @@ struct blitter_context
enum blitter_attrib_type type,
const union pipe_color_union *color);
+ /**
+ * Get the next surface layer for the pipe surface, i.e. make a copy
+ * of the surface and increment the first and last layer by 1.
+ *
+ * This callback is exposed, so that drivers can override it if needed.
+ */
+ struct pipe_surface *(*get_next_surface_layer)(struct pipe_context *pipe,
+ struct pipe_surface *surf);
+
/* Whether the blitter is running. */
boolean running;
@@ -217,14 +226,15 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
boolean copy_all_samples);
/**
- * Same as util_blitter_copy_texture with the capabilities of util_blitter_blit,
- * but dst and src are pipe_surface and pipe_sampler_view, respectively.
- * The mipmap level and dstz are part of the views.
+ * This is a generic implementation of pipe->blit, which accepts
+ * sampler/surface views instead of resources.
+ *
+ * The layer and mipmap level are specified by the views.
*
* Drivers can use this to change resource properties (like format, width,
* height) by changing how the views interpret them, instead of changing
- * pipe_resource directly. This is usually needed to accelerate copying of
- * compressed formats.
+ * pipe_resource directly. This is used to blit resources of formats which
+ * are not renderable.
*
* src_width0 and src_height0 are sampler_view-private properties that
* override pipe_resource. The blitter uses them for computation of texture
@@ -236,8 +246,7 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
*/
void util_blitter_blit_generic(struct blitter_context *blitter,
struct pipe_surface *dst,
- int dstx, int dsty,
- unsigned dst_width, unsigned dst_height,
+ const struct pipe_box *dstbox,
struct pipe_sampler_view *src,
const struct pipe_box *srcbox,
unsigned src_width0, unsigned src_height0,
@@ -255,8 +264,7 @@ void util_blitter_blit(struct blitter_context *blitter,
void util_blitter_default_dst_texture(struct pipe_surface *dst_templ,
struct pipe_resource *dst,
unsigned dstlevel,
- unsigned dstz,
- const struct pipe_box *srcbox);
+ unsigned dstz);
/**
* Helper function to initialize a view for copy_texture_view.
diff --git a/mesalib/src/gallium/auxiliary/util/u_dump_state.c b/mesalib/src/gallium/auxiliary/util/u_dump_state.c
index 09faffe73..d7df5b495 100644
--- a/mesalib/src/gallium/auxiliary/util/u_dump_state.c
+++ b/mesalib/src/gallium/auxiliary/util/u_dump_state.c
@@ -681,13 +681,14 @@ util_dump_transfer(FILE *stream, const struct pipe_transfer *state)
util_dump_struct_begin(stream, "pipe_transfer");
util_dump_member(stream, ptr, state, resource);
- /*util_dump_member(stream, uint, state, box);*/
-
+ util_dump_member(stream, uint, state, level);
+ util_dump_member(stream, uint, state, usage);
+ util_dump_member_begin(stream, "box");
+ util_dump_box(stream, &state->box);
+ util_dump_member_end(stream);
util_dump_member(stream, uint, state, stride);
util_dump_member(stream, uint, state, layer_stride);
- /*util_dump_member(stream, ptr, state, data);*/
-
util_dump_struct_end(stream);
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_format_zs.c b/mesalib/src/gallium/auxiliary/util/u_format_zs.c
index 816ef1420..ed45c52f9 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format_zs.c
+++ b/mesalib/src/gallium/auxiliary/util/u_format_zs.c
@@ -72,7 +72,7 @@ static INLINE uint16_t
z32_float_to_z16_unorm(float z)
{
const float scale = 0xffff;
- return (uint16_t)(z * scale);
+ return (uint16_t)(z * scale + 0.5f);
}
static INLINE float
diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h
index 582aacdca..2ff90c982 100644
--- a/mesalib/src/gallium/auxiliary/util/u_inlines.h
+++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h
@@ -421,6 +421,24 @@ pipe_transfer_map(struct pipe_context *context,
&box, transfer);
}
+static INLINE void *
+pipe_transfer_map_3d(struct pipe_context *context,
+ struct pipe_resource *resource,
+ unsigned level,
+ enum pipe_transfer_usage usage,
+ unsigned x, unsigned y, unsigned z,
+ unsigned w, unsigned h, unsigned d,
+ struct pipe_transfer **transfer)
+{
+ struct pipe_box box;
+ u_box_3d(x, y, z, w, h, d, &box);
+ return context->transfer_map(context,
+ resource,
+ level,
+ usage,
+ &box, transfer);
+}
+
static INLINE void
pipe_transfer_unmap( struct pipe_context *context,
struct pipe_transfer *transfer )
diff --git a/mesalib/src/gallium/auxiliary/util/u_surface.c b/mesalib/src/gallium/auxiliary/util/u_surface.c
index 5e771c950..37f48154f 100644
--- a/mesalib/src/gallium/auxiliary/util/u_surface.c
+++ b/mesalib/src/gallium/auxiliary/util/u_surface.c
@@ -56,61 +56,6 @@ u_surface_default_template(struct pipe_surface *surf,
surf->format = texture->format;
}
-/**
- * Helper to quickly create an RGBA rendering surface of a certain size.
- * \param textureOut returns the new texture
- * \param surfaceOut returns the new surface
- * \return TRUE for success, FALSE if failure
- */
-boolean
-util_create_rgba_texture(struct pipe_context *pipe,
- uint width, uint height, uint bind,
- struct pipe_resource **textureOut)
-{
- static const enum pipe_format rgbaFormats[] = {
- PIPE_FORMAT_B8G8R8A8_UNORM,
- PIPE_FORMAT_A8R8G8B8_UNORM,
- PIPE_FORMAT_A8B8G8R8_UNORM,
- PIPE_FORMAT_NONE
- };
- const uint target = PIPE_TEXTURE_2D;
- enum pipe_format format = PIPE_FORMAT_NONE;
- struct pipe_resource templ;
- struct pipe_surface surf_templ;
- struct pipe_screen *screen = pipe->screen;
- uint i;
-
- /* Choose surface format */
- for (i = 0; rgbaFormats[i]; i++) {
- if (screen->is_format_supported(screen, rgbaFormats[i],
- target, 0, bind)) {
- format = rgbaFormats[i];
- break;
- }
- }
- if (format == PIPE_FORMAT_NONE)
- return FALSE; /* unable to get an rgba format!?! */
-
- /* create texture */
- memset(&templ, 0, sizeof(templ));
- templ.target = target;
- templ.format = format;
- templ.last_level = 0;
- templ.width0 = width;
- templ.height0 = height;
- templ.depth0 = 1;
- templ.array_size = 1;
- templ.bind = bind;
-
- *textureOut = screen->resource_create(screen, &templ);
- if (!*textureOut)
- return FALSE;
-
- /* create surface */
- u_surface_default_template(&surf_templ, *textureOut);
- return TRUE;
-}
-
/**
* Copy 2D rect from one place to another.
diff --git a/mesalib/src/gallium/auxiliary/util/u_surface.h b/mesalib/src/gallium/auxiliary/util/u_surface.h
index fe950c818..d6184acbd 100644
--- a/mesalib/src/gallium/auxiliary/util/u_surface.h
+++ b/mesalib/src/gallium/auxiliary/util/u_surface.h
@@ -44,12 +44,6 @@ extern void
u_surface_default_template(struct pipe_surface *view,
const struct pipe_resource *texture);
-extern boolean
-util_create_rgba_texture(struct pipe_context *ctx,
- uint width, uint height, uint bind,
- struct pipe_resource **textureOut);
-
-
extern void
util_copy_rect(ubyte * dst, enum pipe_format format,
unsigned dst_stride, unsigned dst_x, unsigned dst_y,
diff --git a/mesalib/src/gallium/auxiliary/util/u_tile.c b/mesalib/src/gallium/auxiliary/util/u_tile.c
index f4b5cad0e..6c618a674 100644
--- a/mesalib/src/gallium/auxiliary/util/u_tile.c
+++ b/mesalib/src/gallium/auxiliary/util/u_tile.c
@@ -678,6 +678,28 @@ pipe_get_tile_z(struct pipe_transfer *pt,
}
}
break;
+ case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
+ {
+ const float *ptrc = (const float *)(map + y * pt->stride + x*8);
+ for (i = 0; i < h; i++) {
+ for (j = 0; j < w; j++) {
+ /* convert float Z to 32-bit Z */
+ if (ptrc[j] <= 0.0) {
+ pDest[j*2] = 0;
+ }
+ else if (ptrc[j] >= 1.0) {
+ pDest[j*2] = 0xffffffff;
+ }
+ else {
+ double z = ptrc[j] * 0xffffffff;
+ pDest[j*2] = (uint) z;
+ }
+ }
+ pDest += dstStride;
+ ptrc += pt->stride/4;
+ }
+ }
+ break;
default:
assert(0);
}
@@ -779,7 +801,7 @@ pipe_put_tile_z(struct pipe_transfer *pt,
break;
case PIPE_FORMAT_Z32_FLOAT:
{
- float *pDest = (float *) (map + y * pt->stride + x*2);
+ float *pDest = (float *) (map + y * pt->stride + x*4);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
/* convert 32-bit integer Z to float Z */
@@ -791,6 +813,20 @@ pipe_put_tile_z(struct pipe_transfer *pt,
}
}
break;
+ case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
+ {
+ float *pDest = (float *) (map + y * pt->stride + x*8);
+ for (i = 0; i < h; i++) {
+ for (j = 0; j < w; j++) {
+ /* convert 32-bit integer Z to float Z */
+ const double scale = 1.0 / 0xffffffffU;
+ pDest[j*2] = ptrc[j] * scale;
+ }
+ pDest += pt->stride/4;
+ ptrc += srcStride;
+ }
+ }
+ break;
default:
assert(0);
}
diff --git a/mesalib/src/glsl/glcpp/Makefile.am b/mesalib/src/glsl/glcpp/Makefile.am
index d8d39d295..1efc9dc1a 100644
--- a/mesalib/src/glsl/glcpp/Makefile.am
+++ b/mesalib/src/glsl/glcpp/Makefile.am
@@ -28,6 +28,7 @@ AM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa/ \
+ $(VISIBILITY_CFLAGS) \
$(LIBRARY_INCLUDES) \
$(DEFINES) \
$(LIBRARY_DEFINES) \
diff --git a/mesalib/src/glsl/ir_uniform.h b/mesalib/src/glsl/ir_uniform.h
index 913c53773..30e6f260d 100644
--- a/mesalib/src/glsl/ir_uniform.h
+++ b/mesalib/src/glsl/ir_uniform.h
@@ -80,6 +80,10 @@ struct gl_uniform_driver_storage {
struct gl_uniform_storage {
char *name;
+ /** Type of this uniform data stored.
+ *
+ * In the case of an array, it's the type of a single array element.
+ */
const struct glsl_type *type;
/**
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index ac036eaac..d211fda9d 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -474,8 +474,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
* able to change other state.
*/
save->TransformFeedbackNeedsResume =
- ctx->TransformFeedback.CurrentObject->Active &&
- !ctx->TransformFeedback.CurrentObject->Paused;
+ _mesa_is_xfb_active_and_unpaused(ctx);
if (save->TransformFeedbackNeedsResume)
_mesa_PauseTransformFeedback();
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index e47db23e0..133fb6370 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -32,6 +32,7 @@
#include "mtypes.h"
#include "enums.h"
#include "vbo/vbo.h"
+#include "transformfeedback.h"
#include <stdbool.h>
@@ -252,8 +253,7 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
* current transform feedback state as given by table X.1.
*
*/
- if (ctx->TransformFeedback.CurrentObject->Active &&
- !ctx->TransformFeedback.CurrentObject->Paused) {
+ if (_mesa_is_xfb_active_and_unpaused(ctx)) {
GLboolean pass = GL_TRUE;
switch (mode) {
@@ -316,6 +316,19 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
+ /* From the GLES3 specification, section 2.14.2 (Transform Feedback
+ * Primitive Capture):
+ *
+ * The error INVALID_OPERATION is also generated by DrawElements,
+ * DrawElementsInstanced, and DrawRangeElements while transform feedback
+ * is active and not paused, regardless of mode.
+ */
+ if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawElements(transform feedback active)");
+ return GL_FALSE;
+ }
+
if (count <= 0) {
if (count < 0)
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
@@ -434,6 +447,19 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
+ /* From the GLES3 specification, section 2.14.2 (Transform Feedback
+ * Primitive Capture):
+ *
+ * The error INVALID_OPERATION is also generated by DrawElements,
+ * DrawElementsInstanced, and DrawRangeElements while transform feedback
+ * is active and not paused, regardless of mode.
+ */
+ if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawElements(transform feedback active)");
+ return GL_FALSE;
+ }
+
if (count <= 0) {
if (count < 0)
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" );
@@ -486,6 +512,8 @@ GLboolean
_mesa_validate_DrawArrays(struct gl_context *ctx,
GLenum mode, GLint start, GLsizei count)
{
+ struct gl_transform_feedback_object *xfb_obj
+ = ctx->TransformFeedback.CurrentObject;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
@@ -507,6 +535,29 @@ _mesa_validate_DrawArrays(struct gl_context *ctx,
return GL_FALSE;
}
+ /* From the GLES3 specification, section 2.14.2 (Transform Feedback
+ * Primitive Capture):
+ *
+ * The error INVALID_OPERATION is generated by DrawArrays and
+ * DrawArraysInstanced if recording the vertices of a primitive to the
+ * buffer objects being used for transform feedback purposes would result
+ * in either exceeding the limits of any buffer object’s size, or in
+ * exceeding the end position offset + size − 1, as set by
+ * BindBufferRange.
+ *
+ * This is in contrast to the behaviour of desktop GL, where the extra
+ * primitives are silently dropped from the transform feedback buffer.
+ */
+ if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) {
+ size_t prim_count = vbo_count_tessellated_primitives(mode, count, 1);
+ if (xfb_obj->GlesRemainingPrims < prim_count) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawArrays(exceeds transform feedback size)");
+ return GL_FALSE;
+ }
+ xfb_obj->GlesRemainingPrims -= prim_count;
+ }
+
return GL_TRUE;
}
@@ -515,6 +566,8 @@ GLboolean
_mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint first,
GLsizei count, GLsizei numInstances)
{
+ struct gl_transform_feedback_object *xfb_obj
+ = ctx->TransformFeedback.CurrentObject;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
@@ -550,6 +603,30 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi
return GL_FALSE;
}
+ /* From the GLES3 specification, section 2.14.2 (Transform Feedback
+ * Primitive Capture):
+ *
+ * The error INVALID_OPERATION is generated by DrawArrays and
+ * DrawArraysInstanced if recording the vertices of a primitive to the
+ * buffer objects being used for transform feedback purposes would result
+ * in either exceeding the limits of any buffer object’s size, or in
+ * exceeding the end position offset + size − 1, as set by
+ * BindBufferRange.
+ *
+ * This is in contrast to the behaviour of desktop GL, where the extra
+ * primitives are silently dropped from the transform feedback buffer.
+ */
+ if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) {
+ size_t prim_count
+ = vbo_count_tessellated_primitives(mode, count, numInstances);
+ if (xfb_obj->GlesRemainingPrims < prim_count) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawArraysInstanced(exceeds transform feedback size)");
+ return GL_FALSE;
+ }
+ xfb_obj->GlesRemainingPrims -= prim_count;
+ }
+
return GL_TRUE;
}
@@ -563,6 +640,19 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
+ /* From the GLES3 specification, section 2.14.2 (Transform Feedback
+ * Primitive Capture):
+ *
+ * The error INVALID_OPERATION is also generated by DrawElements,
+ * DrawElementsInstanced, and DrawRangeElements while transform feedback
+ * is active and not paused, regardless of mode.
+ */
+ if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawElements(transform feedback active)");
+ return GL_FALSE;
+ }
+
if (count <= 0) {
if (count < 0)
_mesa_error(ctx, GL_INVALID_VALUE,
diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c
index a909e0eff..032af43b5 100644
--- a/mesalib/src/mesa/main/arrayobj.c
+++ b/mesalib/src/mesa/main/arrayobj.c
@@ -373,7 +373,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
save_array_object(ctx, newObj);
}
- if (!newObj->_Used) {
+ if (!newObj->EverBound) {
/* The "Interactions with APPLE_vertex_array_object" section of the
* GL_ARB_vertex_array_object spec says:
*
@@ -381,7 +381,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
* BindVertexArrayAPPLE, determines the semantic of the object."
*/
newObj->ARBsemantics = genRequired;
- newObj->_Used = GL_TRUE;
+ newObj->EverBound = GL_TRUE;
}
}
@@ -551,6 +551,8 @@ _mesa_IsVertexArray( GLuint id )
return GL_FALSE;
obj = lookup_arrayobj(ctx, id);
+ if (obj == NULL)
+ return GL_FALSE;
- return (obj != NULL) ? GL_TRUE : GL_FALSE;
+ return obj->EverBound;
}
diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c
index 76f0d4671..d10a57394 100644
--- a/mesalib/src/mesa/main/buffers.c
+++ b/mesalib/src/mesa/main/buffers.c
@@ -532,8 +532,8 @@ _mesa_ReadBuffer(GLenum buffer)
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
- if (_mesa_is_user_fbo(fb) && buffer == GL_NONE) {
- /* This is legal for user-created framebuffer objects */
+ if (buffer == GL_NONE) {
+ /* This is legal--it means that no buffer should be bound for reading. */
srcBuffer = -1;
}
else {
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index ce77b9f77..281cdd05c 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -1169,35 +1169,23 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
return ctx->API != API_OPENGLES && ctx->Extensions.ARB_texture_rg
? GL_RG : 0;
/* signed normalized texture formats */
- case GL_R8_SNORM:
- return ctx->Version >= 30
- || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
- ? GL_RED : 0;
case GL_RED_SNORM:
+ case GL_R8_SNORM:
case GL_R16_SNORM:
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
? GL_RED : 0;
- case GL_RG8_SNORM:
- return ctx->Version >= 30
- || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
- ? GL_RG : 0;
case GL_RG_SNORM:
+ case GL_RG8_SNORM:
case GL_RG16_SNORM:
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
? GL_RG : 0;
- case GL_RGB8_SNORM:
- return ctx->Version >= 30
- || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
- ? GL_RGB : 0;
case GL_RGB_SNORM:
+ case GL_RGB8_SNORM:
case GL_RGB16_SNORM:
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
? GL_RGB : 0;
- case GL_RGBA8_SNORM:
- return ctx->Version >= 30
- || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
- ? GL_RGBA : 0;
case GL_RGBA_SNORM:
+ case GL_RGBA8_SNORM:
case GL_RGBA16_SNORM:
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
? GL_RGBA : 0;
@@ -1207,24 +1195,6 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_snorm &&
ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
- case GL_LUMINANCE_SNORM:
- case GL_LUMINANCE8_SNORM:
- case GL_LUMINANCE16_SNORM:
- return ctx->API == API_OPENGL_COMPAT &&
- ctx->Extensions.EXT_texture_snorm &&
- ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
- case GL_LUMINANCE_ALPHA_SNORM:
- case GL_LUMINANCE8_ALPHA8_SNORM:
- case GL_LUMINANCE16_ALPHA16_SNORM:
- return ctx->API == API_OPENGL_COMPAT &&
- ctx->Extensions.EXT_texture_snorm &&
- ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
- case GL_INTENSITY_SNORM:
- case GL_INTENSITY8_SNORM:
- case GL_INTENSITY16_SNORM:
- return ctx->API == API_OPENGL_COMPAT &&
- ctx->Extensions.EXT_texture_snorm &&
- ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
case GL_R16F:
case GL_R32F:
return ctx->Version >= 30
@@ -1291,10 +1261,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RGB8I_EXT:
case GL_RGB16I_EXT:
case GL_RGB32I_EXT:
- return ctx->Version >= 30
- || (_mesa_is_desktop_gl(ctx) &&
- ctx->Extensions.EXT_texture_integer) ? GL_RGB : 0;
-
+ return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_integer
+ ? GL_RGB : 0;
case GL_R8UI:
case GL_R8I:
case GL_R16UI:
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index f3dbda2d3..273a79f7f 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -1574,7 +1574,8 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
goto invalid_value;
if (!ctx->Extensions.EXT_transform_feedback)
goto invalid_enum;
- v->value_int64 = ctx->TransformFeedback.CurrentObject->Size[index];
+ v->value_int64
+ = ctx->TransformFeedback.CurrentObject->RequestedSize[index];
return TYPE_INT64;
case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 67eaadd9f..7c513a1c5 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1595,7 +1595,7 @@ struct gl_array_object
/**
* Has this array object been bound?
*/
- GLboolean _Used;
+ GLboolean EverBound;
/** Vertex attribute arrays */
struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX];
@@ -1807,6 +1807,18 @@ struct gl_transform_feedback_object
GLboolean Paused; /**< Is transform feedback paused? */
GLboolean EndedAnytime; /**< Has EndTransformFeedback been called
at least once? */
+ GLboolean EverBound; /**< Has this object been bound? */
+
+ /**
+ * GLES: if Active is true, remaining number of primitives which can be
+ * rendered without overflow. This is necessary to track because GLES
+ * requires us to generate INVALID_OPERATION if a call to glDrawArrays or
+ * glDrawArraysInstanced would overflow transform feedback buffers.
+ * Undefined if Active is false.
+ *
+ * Not tracked for desktop GL since it's unnecessary.
+ */
+ unsigned GlesRemainingPrims;
/** The feedback buffers */
GLuint BufferNames[MAX_FEEDBACK_BUFFERS];
@@ -1814,8 +1826,19 @@ struct gl_transform_feedback_object
/** Start of feedback data in dest buffer */
GLintptr Offset[MAX_FEEDBACK_BUFFERS];
- /** Max data to put into dest buffer (in bytes) */
+
+ /**
+ * Max data to put into dest buffer (in bytes). Computed based on
+ * RequestedSize and the actual size of the buffer.
+ */
GLsizeiptr Size[MAX_FEEDBACK_BUFFERS];
+
+ /**
+ * Size that was specified when the buffer was bound. If the buffer was
+ * bound with glBindBufferBase() or glBindBufferOffsetEXT(), this value is
+ * zero.
+ */
+ GLsizeiptr RequestedSize[MAX_FEEDBACK_BUFFERS];
};
diff --git a/mesalib/src/mesa/main/pbo.c b/mesalib/src/mesa/main/pbo.c
index c73d7492f..0dc4c04eb 100644
--- a/mesalib/src/mesa/main/pbo.c
+++ b/mesalib/src/mesa/main/pbo.c
@@ -342,7 +342,8 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
}
if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth,
format, type, INT_MAX, pixels)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(invalid PBO access)");
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s%uD(invalid PBO access)",
+ funcName, dimensions);
return NULL;
}
@@ -351,7 +352,8 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
GL_MAP_READ_BIT,
unpack->BufferObj);
if (!buf) {
- _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped)");
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s%uD(PBO is mapped)", funcName,
+ dimensions);
return NULL;
}
@@ -368,7 +370,8 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
*/
const GLvoid *
_mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
- GLsizei imageSize, const GLvoid *pixels,
+ GLuint dimensions, GLsizei imageSize,
+ const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing,
const char *funcName)
{
@@ -381,7 +384,8 @@ _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
if ((const GLubyte *) pixels + imageSize >
((const GLubyte *) 0) + packing->BufferObj->Size) {
/* out of bounds read! */
- _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(invalid PBO access)");
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s%uD(invalid PBO access)",
+ funcName, dimensions);
return NULL;
}
@@ -390,7 +394,8 @@ _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
GL_MAP_READ_BIT,
packing->BufferObj);
if (!buf) {
- _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped");
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s%uD(PBO is mapped)", funcName,
+ dimensions);
return NULL;
}
diff --git a/mesalib/src/mesa/main/pbo.h b/mesalib/src/mesa/main/pbo.h
index 00a6e617f..9eba33514 100644
--- a/mesalib/src/mesa/main/pbo.h
+++ b/mesalib/src/mesa/main/pbo.h
@@ -81,7 +81,8 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
extern const GLvoid *
_mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
- GLsizei imageSize, const GLvoid *pixels,
+ GLuint dimensions, GLsizei imageSize,
+ const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing,
const char *funcName);
diff --git a/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c
index 3c3bfffd4..773bebf26 100644
--- a/mesalib/src/mesa/main/samplerobj.c
+++ b/mesalib/src/mesa/main/samplerobj.c
@@ -110,7 +110,7 @@ _mesa_reference_sampler_object_(struct gl_context *ctx,
/**
* Initialize the fields of the given sampler object.
*/
-void
+static void
_mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name)
{
sampObj->Name = name;
@@ -151,7 +151,7 @@ _mesa_new_sampler_object(struct gl_context *ctx, GLuint name)
/**
* Fallback for ctx->Driver.DeleteSamplerObject();
*/
-void
+static void
_mesa_delete_sampler_object(struct gl_context *ctx,
struct gl_sampler_object *sampObj)
{
@@ -606,6 +606,8 @@ _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteri(sampler %u)",
@@ -777,6 +779,8 @@ _mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteriv(sampler %u)",
@@ -956,6 +960,8 @@ _mesa_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterIiv(sampler %u)",
@@ -1042,6 +1048,8 @@ _mesa_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterIuiv(sampler %u)",
@@ -1127,6 +1135,8 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetSamplerParameteriv(sampler %u)",
@@ -1205,6 +1215,8 @@ _mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetSamplerParameterfv(sampler %u)",
@@ -1283,6 +1295,8 @@ _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -1362,6 +1376,8 @@ _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE,
diff --git a/mesalib/src/mesa/main/samplerobj.h b/mesalib/src/mesa/main/samplerobj.h
index ecff032c9..dce7c6c30 100644
--- a/mesalib/src/mesa/main/samplerobj.h
+++ b/mesalib/src/mesa/main/samplerobj.h
@@ -63,17 +63,10 @@ _mesa_reference_sampler_object(struct gl_context *ctx,
}
-extern void
-_mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name);
-
extern struct gl_sampler_object *
_mesa_new_sampler_object(struct gl_context *ctx, GLuint name);
extern void
-_mesa_delete_sampler_object(struct gl_context *ctx,
- struct gl_sampler_object *sampObj);
-
-extern void
_mesa_init_sampler_object_functions(struct dd_function_table *driver);
extern void
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 53e9d0486..1f0002f6f 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -45,6 +45,7 @@
#include "main/mtypes.h"
#include "main/shaderapi.h"
#include "main/shaderobj.h"
+#include "main/transformfeedback.h"
#include "main/uniforms.h"
#include "program/program.h"
#include "program/prog_parameter.h"
@@ -1383,12 +1384,10 @@ _mesa_UseProgram(GLhandleARB program)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *shProg;
- struct gl_transform_feedback_object *obj =
- ctx->TransformFeedback.CurrentObject;
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (obj->Active && !obj->Paused) {
+ if (_mesa_is_xfb_active_and_unpaused(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glUseProgram(transform feedback active)");
return;
@@ -1590,8 +1589,7 @@ _mesa_UseShaderProgramEXT(GLenum type, GLuint program)
return;
}
- if (ctx->TransformFeedback.CurrentObject->Active &&
- !ctx->TransformFeedback.CurrentObject->Paused) {
+ if (_mesa_is_xfb_active_and_unpaused(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glUseShaderProgramEXT(transform feedback is active)");
return;
diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c
index 33c580a88..077a967da 100644
--- a/mesalib/src/mesa/main/texcompress.c
+++ b/mesalib/src/mesa/main/texcompress.c
@@ -533,6 +533,10 @@ _mesa_get_compressed_fetch_func(gl_format format)
case MESA_FORMAT_RGBA_DXT1:
case MESA_FORMAT_RGBA_DXT3:
case MESA_FORMAT_RGBA_DXT5:
+ case MESA_FORMAT_SRGB_DXT1:
+ case MESA_FORMAT_SRGBA_DXT1:
+ case MESA_FORMAT_SRGBA_DXT3:
+ case MESA_FORMAT_SRGBA_DXT5:
return _mesa_get_dxt_fetch_func(format);
case MESA_FORMAT_RGB_FXT1:
case MESA_FORMAT_RGBA_FXT1:
diff --git a/mesalib/src/mesa/main/texcompress_rgtc.c b/mesalib/src/mesa/main/texcompress_rgtc.c
index fa9172aa2..1f8de25ec 100644
--- a/mesalib/src/mesa/main/texcompress_rgtc.c
+++ b/mesalib/src/mesa/main/texcompress_rgtc.c
@@ -364,9 +364,10 @@ fetch_signed_l_latc1(const GLubyte *map, const GLuint imageOffsets[],
GLint rowStride, GLint i, GLint j, GLint k,
GLfloat *texel)
{
- GLubyte red;
+ GLbyte red;
GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0;
- unsigned_fetch_texel_rgtc(rowStride, map + sliceOffset, i, j, &red, 1);
+ signed_fetch_texel_rgtc(rowStride, (GLbyte *) map + sliceOffset,
+ i, j, &red, 1);
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = BYTE_TO_FLOAT(red);
diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c
index 23a5a0868..4a81ad803 100644
--- a/mesalib/src/mesa/main/texcompress_s3tc.c
+++ b/mesalib/src/mesa/main/texcompress_s3tc.c
@@ -417,6 +417,80 @@ fetch_rgba_dxt5(const GLubyte *map, const GLuint imageOffsets[],
}
+static void
+fetch_srgb_dxt1(const GLubyte *map, const GLuint imageOffsets[],
+ GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ if (fetch_ext_rgb_dxt1) {
+ GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0;
+ GLubyte tex[4];
+ fetch_ext_rgb_dxt1(rowStride, map + sliceOffset, i, j, tex);
+ texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]);
+ texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]);
+ texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]);
+ texel[ACOMP] = UBYTE_TO_FLOAT(tex[ACOMP]);
+ }
+ else {
+ problem("srgb_dxt1");
+ }
+}
+
+static void
+fetch_srgba_dxt1(const GLubyte *map, const GLuint imageOffsets[],
+ GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ if (fetch_ext_rgba_dxt1) {
+ GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0;
+ GLubyte tex[4];
+ fetch_ext_rgba_dxt1(rowStride, map + sliceOffset, i, j, tex);
+ texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]);
+ texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]);
+ texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]);
+ texel[ACOMP] = UBYTE_TO_FLOAT(tex[ACOMP]);
+ }
+ else {
+ problem("srgba_dxt1");
+ }
+}
+
+static void
+fetch_srgba_dxt3(const GLubyte *map, const GLuint imageOffsets[],
+ GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ if (fetch_ext_rgba_dxt3) {
+ GLuint sliceOffset = k ? imageOffsets[k] : 0;
+ GLubyte tex[4];
+ fetch_ext_rgba_dxt3(rowStride, map + sliceOffset, i, j, tex);
+ texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]);
+ texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]);
+ texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]);
+ texel[ACOMP] = UBYTE_TO_FLOAT(tex[ACOMP]);
+ }
+ else {
+ problem("srgba_dxt3");
+ }
+}
+
+static void
+fetch_srgba_dxt5(const GLubyte *map, const GLuint imageOffsets[],
+ GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ if (fetch_ext_rgba_dxt5) {
+ GLuint sliceOffset = k ? imageOffsets[k] : 0;
+ GLubyte tex[4];
+ fetch_ext_rgba_dxt5(rowStride, map + sliceOffset, i, j, tex);
+ texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]);
+ texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]);
+ texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]);
+ texel[ACOMP] = UBYTE_TO_FLOAT(tex[ACOMP]);
+ }
+ else {
+ problem("srgba_dxt5");
+ }
+}
+
+
+
compressed_fetch_func
_mesa_get_dxt_fetch_func(gl_format format)
{
@@ -429,6 +503,14 @@ _mesa_get_dxt_fetch_func(gl_format format)
return fetch_rgba_dxt3;
case MESA_FORMAT_RGBA_DXT5:
return fetch_rgba_dxt5;
+ case MESA_FORMAT_SRGB_DXT1:
+ return fetch_srgb_dxt1;
+ case MESA_FORMAT_SRGBA_DXT1:
+ return fetch_srgba_dxt1;
+ case MESA_FORMAT_SRGBA_DXT3:
+ return fetch_srgba_dxt3;
+ case MESA_FORMAT_SRGBA_DXT5:
+ return fetch_srgba_dxt5;
default:
return NULL;
}
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index 69067df9f..d435c8269 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -683,6 +683,8 @@ legal_getteximage_target(struct gl_context *ctx, GLenum target)
case GL_TEXTURE_2D_ARRAY_EXT:
return (ctx->Extensions.MESA_texture_array ||
ctx->Extensions.EXT_texture_array);
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ return ctx->Extensions.ARB_texture_cube_map_array;
default:
return GL_FALSE;
}
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 7a0d944fd..33f81a25c 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -3507,7 +3507,8 @@ compressed_subtexture_error_check(struct gl_context *ctx, GLint dims,
GLint expectedSize;
GLboolean targetOK;
- if (dims == 2) {
+ switch (dims) {
+ case 2:
switch (target) {
case GL_TEXTURE_2D:
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
@@ -3520,12 +3521,17 @@ compressed_subtexture_error_check(struct gl_context *ctx, GLint dims,
break;
default:
targetOK = GL_FALSE;
+ break;
}
- }
- else {
- assert(dims == 1 || dims == 3);
- /* no 1D or 3D compressed textures at this time */
+ break;
+ case 3:
+ targetOK = (target == GL_TEXTURE_2D_ARRAY);
+ break;
+ default:
+ assert(dims == 1);
+ /* no 1D compressed textures at this time */
targetOK = GL_FALSE;
+ break;
}
if (!targetOK) {
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index 26c5b6703..751150937 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -4441,9 +4441,9 @@ _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims,
struct gl_texture_image *texImage,
GLsizei imageSize, const GLvoid *data)
{
- /* only 2D compressed images are supported at this time */
- if (dims != 2) {
- _mesa_problem(ctx, "Unexpected glCompressedTexImage1D/3D call");
+ /* only 2D and 3D compressed images are supported at this time */
+ if (dims == 1) {
+ _mesa_problem(ctx, "Unexpected glCompressedTexImage1D call");
return;
}
@@ -4454,11 +4454,11 @@ _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims,
ASSERT(texImage);
ASSERT(texImage->Width > 0);
ASSERT(texImage->Height > 0);
- ASSERT(texImage->Depth == 1);
+ ASSERT(texImage->Depth > 0);
/* allocate storage for texture data */
if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage)) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage%uD", dims);
return;
}
@@ -4487,45 +4487,49 @@ _mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims,
const GLubyte *src;
const gl_format texFormat = texImage->TexFormat;
GLuint bw, bh;
+ GLuint slice;
- if (dims != 2) {
- _mesa_problem(ctx, "Unexpected 1D/3D compressed texsubimage call");
+ if (dims == 1) {
+ _mesa_problem(ctx, "Unexpected 1D compressed texsubimage call");
return;
}
_mesa_get_format_block_size(texFormat, &bw, &bh);
/* get pointer to src pixels (may be in a pbo which we'll map here) */
- data = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, data,
+ data = _mesa_validate_pbo_compressed_teximage(ctx, dims, imageSize, data,
&ctx->Unpack,
- "glCompressedTexSubImage2D");
+ "glCompressedTexSubImage");
if (!data)
return;
srcRowStride = _mesa_format_row_stride(texFormat, width);
src = (const GLubyte *) data;
- /* Map dest texture buffer */
- ctx->Driver.MapTextureImage(ctx, texImage, 0,
- xoffset, yoffset, width, height,
- GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT,
- &dstMap, &dstRowStride);
+ for (slice = 0; slice < depth; slice++) {
+ /* Map dest texture buffer */
+ ctx->Driver.MapTextureImage(ctx, texImage, slice + zoffset,
+ xoffset, yoffset, width, height,
+ GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT,
+ &dstMap, &dstRowStride);
- if (dstMap) {
- bytesPerRow = srcRowStride; /* bytes per row of blocks */
- rows = (height + bh - 1) / bh; /* rows in blocks */
+ if (dstMap) {
+ bytesPerRow = srcRowStride; /* bytes per row of blocks */
+ rows = (height + bh - 1) / bh; /* rows in blocks */
- /* copy rows of blocks */
- for (i = 0; i < rows; i++) {
- memcpy(dstMap, src, bytesPerRow);
- dstMap += dstRowStride;
- src += srcRowStride;
- }
+ /* copy rows of blocks */
+ for (i = 0; i < rows; i++) {
+ memcpy(dstMap, src, bytesPerRow);
+ dstMap += dstRowStride;
+ src += srcRowStride;
+ }
- ctx->Driver.UnmapTextureImage(ctx, texImage, 0);
- }
- else {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2D");
+ ctx->Driver.UnmapTextureImage(ctx, texImage, slice + zoffset);
+ }
+ else {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage%uD",
+ dims);
+ }
}
_mesa_unmap_teximage_pbo(ctx, &ctx->Unpack);
diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c
index 22060c34c..1bf4beaeb 100644
--- a/mesalib/src/mesa/main/transformfeedback.c
+++ b/mesalib/src/mesa/main/transformfeedback.c
@@ -34,6 +34,7 @@
#include "bufferobj.h"
#include "context.h"
#include "hash.h"
+#include "macros.h"
#include "mfeatures.h"
#include "mtypes.h"
#include "transformfeedback.h"
@@ -79,6 +80,7 @@ reference_transform_feedback_object(struct gl_transform_feedback_object **ptr,
}
else {
obj->RefCount++;
+ obj->EverBound = GL_TRUE;
*ptr = obj;
}
}
@@ -177,6 +179,7 @@ new_transform_feedback(struct gl_context *ctx, GLuint name)
if (obj) {
obj->Name = name;
obj->RefCount = 1;
+ obj->EverBound = GL_FALSE;
}
return obj;
}
@@ -246,6 +249,83 @@ _mesa_init_transform_feedback_functions(struct dd_function_table *driver)
/**
+ * Fill in the correct Size value for each buffer in \c obj.
+ *
+ * From the GL 4.3 spec, section 6.1.1 ("Binding Buffer Objects to Indexed
+ * Targets"):
+ *
+ * BindBufferBase binds the entire buffer, even when the size of the buffer
+ * is changed after the binding is established. It is equivalent to calling
+ * BindBufferRange with offset zero, while size is determined by the size of
+ * the bound buffer at the time the binding is used.
+ *
+ * Regardless of the size specified with BindBufferRange, or indirectly with
+ * BindBufferBase, the GL will never read or write beyond the end of a bound
+ * buffer. In some cases this constraint may result in visibly different
+ * behavior when a buffer overflow would otherwise result, such as described
+ * for transform feedback operations in section 13.2.2.
+ */
+static void
+compute_transform_feedback_buffer_sizes(
+ struct gl_transform_feedback_object *obj)
+{
+ unsigned i = 0;
+ for (i = 0; i < MAX_FEEDBACK_BUFFERS; ++i) {
+ GLintptr offset = obj->Offset[i];
+ GLsizeiptr buffer_size
+ = obj->Buffers[i] == NULL ? 0 : obj->Buffers[i]->Size;
+ GLsizeiptr available_space
+ = buffer_size <= offset ? 0 : buffer_size - offset;
+ GLsizeiptr computed_size;
+ if (obj->RequestedSize[i] == 0) {
+ /* No size was specified at the time the buffer was bound, so allow
+ * writing to all available space in the buffer.
+ */
+ computed_size = available_space;
+ } else {
+ /* A size was specified at the time the buffer was bound, however
+ * it's possible that the buffer has shrunk since then. So only
+ * allow writing to the minimum of the specified size and the space
+ * available.
+ */
+ computed_size = MIN2(available_space, obj->RequestedSize[i]);
+ }
+
+ /* Legal sizes must be multiples of four, so round down if necessary. */
+ obj->Size[i] = computed_size & ~0x3;
+ }
+}
+
+
+/**
+ * Compute the maximum number of vertices that can be written to the currently
+ * enabled transform feedback buffers without overflowing any of them.
+ */
+unsigned
+_mesa_compute_max_transform_feedback_vertices(
+ const struct gl_transform_feedback_object *obj,
+ const struct gl_transform_feedback_info *info)
+{
+ unsigned max_index = 0xffffffff;
+ unsigned i;
+
+ for (i = 0; i < info->NumBuffers; ++i) {
+ unsigned stride = info->BufferStride[i];
+ unsigned max_for_this_buffer;
+
+ /* Skip any inactive buffers, which have a stride of 0. */
+ if (stride == 0)
+ continue;
+
+ max_for_this_buffer = obj->Size[i] / (4 * stride);
+ max_index = MIN2(max_index, max_for_this_buffer);
+ }
+
+ return max_index;
+}
+
+
+/**
** Begin API functions
**/
@@ -256,6 +336,7 @@ _mesa_BeginTransformFeedback(GLenum mode)
struct gl_transform_feedback_object *obj;
struct gl_transform_feedback_info *info;
GLuint i;
+ unsigned vertices_per_prim;
GET_CURRENT_CONTEXT(ctx);
obj = ctx->TransformFeedback.CurrentObject;
@@ -276,9 +357,13 @@ _mesa_BeginTransformFeedback(GLenum mode)
switch (mode) {
case GL_POINTS:
+ vertices_per_prim = 1;
+ break;
case GL_LINES:
+ vertices_per_prim = 2;
+ break;
case GL_TRIANGLES:
- /* legal */
+ vertices_per_prim = 3;
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glBeginTransformFeedback(mode)");
@@ -304,6 +389,20 @@ _mesa_BeginTransformFeedback(GLenum mode)
obj->Active = GL_TRUE;
ctx->TransformFeedback.Mode = mode;
+ compute_transform_feedback_buffer_sizes(obj);
+
+ if (_mesa_is_gles3(ctx)) {
+ /* In GLES3, we are required to track the usage of the transform
+ * feedback buffer and report INVALID_OPERATION if a draw call tries to
+ * exceed it. So compute the maximum number of vertices that we can
+ * write without overflowing any of the buffers currently being used for
+ * feedback.
+ */
+ unsigned max_vertices
+ = _mesa_compute_max_transform_feedback_vertices(obj, info);
+ obj->GlesRemainingPrims = max_vertices / vertices_per_prim;
+ }
+
assert(ctx->Driver.BeginTransformFeedback);
ctx->Driver.BeginTransformFeedback(ctx, mode, obj);
}
@@ -362,7 +461,7 @@ bind_buffer_range(struct gl_context *ctx, GLuint index,
obj->BufferNames[index] = bufObj->Name;
obj->Offset[index] = offset;
- obj->Size[index] = size;
+ obj->RequestedSize[index] = size;
}
@@ -421,7 +520,6 @@ _mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx,
struct gl_buffer_object *bufObj)
{
struct gl_transform_feedback_object *obj;
- GLsizeiptr size;
obj = ctx->TransformFeedback.CurrentObject;
@@ -436,12 +534,7 @@ _mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx,
return;
}
- /* default size is the buffer size rounded down to nearest
- * multiple of four.
- */
- size = bufObj->Size & ~0x3;
-
- bind_buffer_range(ctx, index, bufObj, 0, size);
+ bind_buffer_range(ctx, index, bufObj, 0, 0);
}
@@ -457,7 +550,6 @@ _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer,
struct gl_transform_feedback_object *obj;
struct gl_buffer_object *bufObj;
GET_CURRENT_CONTEXT(ctx);
- GLsizeiptr size;
if (target != GL_TRANSFORM_FEEDBACK_BUFFER) {
_mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferOffsetEXT(target)");
@@ -497,12 +589,7 @@ _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer,
return;
}
- /* default size is the buffer size rounded down to nearest
- * multiple of four.
- */
- size = (bufObj->Size - offset) & ~0x3;
-
- bind_buffer_range(ctx, index, bufObj, offset, size);
+ bind_buffer_range(ctx, index, bufObj, offset, 0);
}
@@ -708,14 +795,19 @@ _mesa_GenTransformFeedbacks(GLsizei n, GLuint *names)
GLboolean GLAPIENTRY
_mesa_IsTransformFeedback(GLuint name)
{
+ struct gl_transform_feedback_object *obj;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
- if (name && _mesa_lookup_transform_feedback_object(ctx, name))
- return GL_TRUE;
- else
+ if (name == 0)
return GL_FALSE;
+
+ obj = _mesa_lookup_transform_feedback_object(ctx, name);
+ if (obj == NULL)
+ return GL_FALSE;
+
+ return obj->EverBound;
}
@@ -734,8 +826,7 @@ _mesa_BindTransformFeedback(GLenum target, GLuint name)
return;
}
- if (ctx->TransformFeedback.CurrentObject->Active &&
- !ctx->TransformFeedback.CurrentObject->Paused) {
+ if (_mesa_is_xfb_active_and_unpaused(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBindTransformFeedback(transform is active, or not paused)");
return;
@@ -805,7 +896,7 @@ _mesa_PauseTransformFeedback(void)
obj = ctx->TransformFeedback.CurrentObject;
- if (!obj->Active || obj->Paused) {
+ if (!_mesa_is_xfb_active_and_unpaused(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glPauseTransformFeedback(feedback not active or already paused)");
return;
diff --git a/mesalib/src/mesa/main/transformfeedback.h b/mesalib/src/mesa/main/transformfeedback.h
index 01c2af359..c128746b3 100644
--- a/mesalib/src/mesa/main/transformfeedback.h
+++ b/mesalib/src/mesa/main/transformfeedback.h
@@ -25,9 +25,11 @@
#ifndef TRANSFORM_FEEDBACK_H
#define TRANSFORM_FEEDBACK_H
+#include <stdbool.h>
#include "compiler.h"
#include "glheader.h"
#include "mfeatures.h"
+#include "mtypes.h"
struct _glapi_table;
struct dd_function_table;
@@ -46,6 +48,11 @@ _mesa_validate_transform_feedback_buffers(struct gl_context *ctx);
extern void
_mesa_init_transform_feedback_functions(struct dd_function_table *driver);
+extern unsigned
+_mesa_compute_max_transform_feedback_vertices(
+ const struct gl_transform_feedback_object *obj,
+ const struct gl_transform_feedback_info *info);
+
/*** GL_EXT_transform_feedback ***/
@@ -106,4 +113,11 @@ _mesa_PauseTransformFeedback(void);
extern void GLAPIENTRY
_mesa_ResumeTransformFeedback(void);
+static inline bool
+_mesa_is_xfb_active_and_unpaused(const struct gl_context *ctx)
+{
+ return ctx->TransformFeedback.CurrentObject->Active &&
+ !ctx->TransformFeedback.CurrentObject->Paused;
+}
+
#endif /* TRANSFORM_FEEDBACK_H */
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index b6b73d16f..afe9a08c1 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -241,11 +241,14 @@ validate_uniform_parameters(struct gl_context *ctx,
return false;
}
- /* This case should be impossible. The implication is that a call like
- * glGetUniformLocation(prog, "foo[8]") was successful but "foo" is not an
- * array.
+ /* If the uniform is an array, check that array_index is in bounds.
+ * If not an array, check that array_index is zero.
+ * array_index is unsigned so no need to check for less than zero.
*/
- if (*array_index != 0 && shProg->UniformStorage[*loc].array_elements == 0) {
+ unsigned limit = shProg->UniformStorage[*loc].array_elements;
+ if (limit == 0)
+ limit = 1;
+ if (*array_index >= limit) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)",
caller, location);
return false;
@@ -732,9 +735,6 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
* will have already generated an error.
*/
if (uni->array_elements != 0) {
- if (offset >= uni->array_elements)
- return;
-
count = MIN2(count, (int) (uni->array_elements - offset));
}
@@ -889,9 +889,6 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
* will have already generated an error.
*/
if (uni->array_elements != 0) {
- if (offset >= uni->array_elements)
- return;
-
count = MIN2(count, (int) (uni->array_elements - offset));
}
@@ -1025,10 +1022,13 @@ _mesa_get_uniform_location(struct gl_context *ctx,
if (!found)
return GL_INVALID_INDEX;
- /* Since array_elements is 0 for non-arrays, this causes look-ups of 'a[0]'
- * to (correctly) fail if 'a' is not an array.
+ /* If the uniform is an array, fail if the index is out of bounds.
+ * (A negative index is caught above.) This also fails if the uniform
+ * is not an array, but the user is trying to index it, because
+ * array_elements is zero and offset >= 0.
*/
- if (array_lookup && shProg->UniformStorage[location].array_elements == 0) {
+ if (array_lookup
+ && offset >= (long) shProg->UniformStorage[location].array_elements) {
return GL_INVALID_INDEX;
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_array.c b/mesalib/src/mesa/state_tracker/st_atom_array.c
index 15f5d1c95..2437245bd 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_array.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_array.c
@@ -403,9 +403,9 @@ setup_interleaved_attribs(const struct st_vertex_program *vp,
const GLuint mesaAttr = vp->index_to_input[attr];
const struct gl_client_array *array = arrays[mesaAttr];
unsigned src_offset = (unsigned) (array->Ptr - low_addr);
- GLuint element_size = array->_ElementSize;
- assert(element_size == array->Size * _mesa_sizeof_type(array->Type));
+ assert(array->_ElementSize ==
+ _mesa_bytes_per_vertex_attrib(array->Size, array->Type));
velements[attr].src_offset = src_offset;
velements[attr].instance_divisor = array->InstanceDivisor;
@@ -474,7 +474,8 @@ setup_non_interleaved_attribs(struct st_context *st,
struct gl_buffer_object *bufobj = array->BufferObj;
GLsizei stride = array->StrideB;
- assert(array->_ElementSize == array->Size * _mesa_sizeof_type(array->Type));
+ assert(array->_ElementSize ==
+ _mesa_bytes_per_vertex_attrib(array->Size, array->Type));
if (_mesa_is_bufferobj(bufobj)) {
/* Attribute data is in a VBO.
diff --git a/mesalib/src/mesa/state_tracker/st_cb_flush.c b/mesalib/src/mesa/state_tracker/st_cb_flush.c
index 7c9f91f1b..b569e3b3c 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_flush.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_flush.c
@@ -76,15 +76,16 @@ display_front_buffer(struct st_context *st)
}
-void st_flush( struct st_context *st,
- struct pipe_fence_handle **fence )
+void st_flush(struct st_context *st,
+ struct pipe_fence_handle **fence,
+ enum pipe_flush_flags flags)
{
FLUSH_VERTICES(st->ctx, 0);
FLUSH_CURRENT(st->ctx, 0);
st_flush_bitmap_cache(st);
- st->pipe->flush( st->pipe, fence );
+ st->pipe->flush(st->pipe, fence, flags);
}
@@ -95,7 +96,7 @@ void st_finish( struct st_context *st )
{
struct pipe_fence_handle *fence = NULL;
- st_flush(st, &fence);
+ st_flush(st, &fence, 0);
if(fence) {
st->pipe->screen->fence_finish(st->pipe->screen, fence,
@@ -118,7 +119,7 @@ static void st_glFlush(struct gl_context *ctx)
* synchronization issues. Calling finish() here will just hide
* problems that need to be fixed elsewhere.
*/
- st_flush(st, NULL);
+ st_flush(st, NULL, 0);
if (is_front_buffer_dirty(st)) {
display_front_buffer(st);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_flush.h b/mesalib/src/mesa/state_tracker/st_cb_flush.h
index 598536ba0..003e2a2a9 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_flush.h
+++ b/mesalib/src/mesa/state_tracker/st_cb_flush.h
@@ -41,7 +41,8 @@ st_init_flush_functions(struct dd_function_table *functions);
extern void
st_flush(struct st_context *st,
- struct pipe_fence_handle **fence);
+ struct pipe_fence_handle **fence,
+ enum pipe_flush_flags flags);
extern void
st_finish(struct st_context *st);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_queryobj.c b/mesalib/src/mesa/state_tracker/st_cb_queryobj.c
index b10fd9335..98b61f576 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_queryobj.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_queryobj.c
@@ -72,6 +72,11 @@ st_DeleteQuery(struct gl_context *ctx, struct gl_query_object *q)
stq->pq = NULL;
}
+ if (stq->pq_begin) {
+ pipe->destroy_query(pipe, stq->pq_begin);
+ stq->pq_begin = NULL;
+ }
+
free(stq);
}
@@ -79,7 +84,8 @@ st_DeleteQuery(struct gl_context *ctx, struct gl_query_object *q)
static void
st_BeginQuery(struct gl_context *ctx, struct gl_query_object *q)
{
- struct pipe_context *pipe = st_context(ctx)->pipe;
+ struct st_context *st = st_context(ctx);
+ struct pipe_context *pipe = st->pipe;
struct st_query_object *stq = st_query_object(q);
unsigned type;
@@ -98,29 +104,46 @@ st_BeginQuery(struct gl_context *ctx, struct gl_query_object *q)
case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
type = PIPE_QUERY_PRIMITIVES_EMITTED;
break;
- case GL_TIME_ELAPSED_EXT:
- type = PIPE_QUERY_TIME_ELAPSED;
+ case GL_TIME_ELAPSED:
+ if (st->has_time_elapsed)
+ type = PIPE_QUERY_TIME_ELAPSED;
+ else
+ type = PIPE_QUERY_TIMESTAMP;
break;
default:
assert(0 && "unexpected query target in st_BeginQuery()");
return;
}
- if (stq->pq && stq->type != type) {
+ if (stq->type != type) {
/* free old query of different type */
- pipe->destroy_query(pipe, stq->pq);
- stq->pq = NULL;
+ if (stq->pq) {
+ pipe->destroy_query(pipe, stq->pq);
+ stq->pq = NULL;
+ }
+ if (stq->pq_begin) {
+ pipe->destroy_query(pipe, stq->pq_begin);
+ stq->pq_begin = NULL;
+ }
stq->type = PIPE_QUERY_TYPES; /* an invalid value */
}
- if (!stq->pq) {
- stq->pq = pipe->create_query(pipe, type);
- stq->type = type;
+ if (q->Target == GL_TIME_ELAPSED &&
+ type == PIPE_QUERY_TIMESTAMP) {
+ /* Determine time elapsed by emitting two timestamp queries. */
+ if (!stq->pq_begin) {
+ stq->pq_begin = pipe->create_query(pipe, type);
+ stq->type = type;
+ }
+ pipe->end_query(pipe, stq->pq_begin);
+ } else {
+ if (!stq->pq) {
+ stq->pq = pipe->create_query(pipe, type);
+ stq->type = type;
+ }
+ pipe->begin_query(pipe, stq->pq);
}
-
assert(stq->type == type);
-
- pipe->begin_query(pipe, stq->pq);
}
@@ -132,7 +155,9 @@ st_EndQuery(struct gl_context *ctx, struct gl_query_object *q)
st_flush_bitmap_cache(st_context(ctx));
- if (q->Target == GL_TIMESTAMP && !stq->pq) {
+ if ((q->Target == GL_TIMESTAMP ||
+ q->Target == GL_TIME_ELAPSED) &&
+ !stq->pq) {
stq->pq = pipe->create_query(pipe, PIPE_QUERY_TIMESTAMP);
stq->type = PIPE_QUERY_TIMESTAMP;
}
@@ -141,6 +166,33 @@ st_EndQuery(struct gl_context *ctx, struct gl_query_object *q)
}
+static boolean
+get_query_result(struct pipe_context *pipe,
+ struct st_query_object *stq,
+ boolean wait)
+{
+ if (!pipe->get_query_result(pipe,
+ stq->pq,
+ wait,
+ (void *)&stq->base.Result)) {
+ return FALSE;
+ }
+
+ if (stq->base.Target == GL_TIME_ELAPSED &&
+ stq->type == PIPE_QUERY_TIMESTAMP) {
+ /* Calculate the elapsed time from the two timestamp queries */
+ GLuint64EXT Result0 = 0;
+ assert(stq->pq_begin);
+ pipe->get_query_result(pipe, stq->pq_begin, TRUE, (void *)&Result0);
+ stq->base.Result -= Result0;
+ } else {
+ assert(!stq->pq_begin);
+ }
+
+ return TRUE;
+}
+
+
static void
st_WaitQuery(struct gl_context *ctx, struct gl_query_object *q)
{
@@ -151,10 +203,7 @@ st_WaitQuery(struct gl_context *ctx, struct gl_query_object *q)
assert(!stq->base.Ready);
while (!stq->base.Ready &&
- !pipe->get_query_result(pipe,
- stq->pq,
- TRUE,
- (void*)&q->Result))
+ !get_query_result(pipe, stq, TRUE))
{
/* nothing */
}
@@ -169,7 +218,7 @@ st_CheckQuery(struct gl_context *ctx, struct gl_query_object *q)
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_query_object *stq = st_query_object(q);
assert(!q->Ready); /* we should not get called if Ready is TRUE */
- q->Ready = pipe->get_query_result(pipe, stq->pq, FALSE, (void*)&q->Result);
+ q->Ready = get_query_result(pipe, stq, FALSE);
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_queryobj.h b/mesalib/src/mesa/state_tracker/st_cb_queryobj.h
index 03487b153..d5b107532 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_queryobj.h
+++ b/mesalib/src/mesa/state_tracker/st_cb_queryobj.h
@@ -39,6 +39,10 @@ struct st_query_object
{
struct gl_query_object base;
struct pipe_query *pq;
+
+ /* Begin TIMESTAMP query for GL_TIME_ELAPSED_EXT queries */
+ struct pipe_query *pq_begin;
+
unsigned type; /**< PIPE_QUERY_x */
};
diff --git a/mesalib/src/mesa/state_tracker/st_cb_syncobj.c b/mesalib/src/mesa/state_tracker/st_cb_syncobj.c
index f9f2348a3..94bf4861d 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_syncobj.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_syncobj.c
@@ -72,7 +72,7 @@ static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj,
assert(condition == GL_SYNC_GPU_COMMANDS_COMPLETE && flags == 0);
assert(so->fence == NULL);
- pipe->flush(pipe, &so->fence);
+ pipe->flush(pipe, &so->fence, 0);
}
static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index bf13526d2..02fc675ae 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -201,7 +201,7 @@ st_MapTextureImage(struct gl_context *ctx,
if (mode & GL_MAP_INVALIDATE_RANGE_BIT)
pipeMode |= PIPE_TRANSFER_DISCARD_RANGE;
- map = st_texture_image_map(st, stImage, slice, pipeMode, x, y, w, h);
+ map = st_texture_image_map(st, stImage, pipeMode, x, y, slice, w, h, 1);
if (map) {
*mapOut = map;
*rowStrideOut = stImage->transfer->stride;
@@ -572,37 +572,68 @@ decompress_with_blit(struct gl_context * ctx,
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
- struct st_texture_image *stImage = st_texture_image(texImage);
- struct st_texture_object *stObj = st_texture_object(texImage->TexObject);
+ struct pipe_screen *screen = pipe->screen;
const GLuint width = texImage->Width;
const GLuint height = texImage->Height;
- struct pipe_resource *dst_texture;
+ const GLuint depth = texImage->Depth;
+ struct pipe_resource *src = st_texture_object(texImage->TexObject)->pt;
+ struct pipe_resource *dst;
+ struct pipe_resource dst_templ;
+ enum pipe_format pipe_format;
+ gl_format mesa_format;
+ GLenum gl_target = texImage->TexObject->Target;
+ enum pipe_texture_target pipe_target;
struct pipe_blit_info blit;
unsigned bind = (PIPE_BIND_RENDER_TARGET | PIPE_BIND_TRANSFER_READ);
struct pipe_transfer *tex_xfer;
ubyte *map;
- /* create temp / dest surface */
- if (!util_create_rgba_texture(pipe, width, height, bind,
- &dst_texture)) {
- _mesa_problem(ctx, "util_create_rgba_texture() failed "
- "in decompress_with_blit()");
+ /* GetTexImage only returns a single face for cubemaps. */
+ if (gl_target == GL_TEXTURE_CUBE_MAP) {
+ gl_target = GL_TEXTURE_2D;
+ }
+
+ pipe_target = gl_target_to_pipe(gl_target);
+
+ /* Find the best match for the format+type combo. */
+ pipe_format = st_choose_format(pipe->screen, GL_RGBA8, format, type,
+ pipe_target, 0, bind);
+ if (pipe_format == PIPE_FORMAT_NONE) {
+ /* unable to get an rgba format!?! */
+ _mesa_problem(ctx, "%s: cannot find a supported format", __func__);
return;
}
- blit.src.resource = stObj->pt;
+ /* create the destination texture */
+ memset(&dst_templ, 0, sizeof(dst_templ));
+ dst_templ.target = pipe_target;
+ dst_templ.format = pipe_format;
+ dst_templ.bind = bind;
+ dst_templ.usage = PIPE_USAGE_STAGING;
+
+ st_gl_texture_dims_to_pipe_dims(gl_target, width, height, depth,
+ &dst_templ.width0, &dst_templ.height0,
+ &dst_templ.depth0, &dst_templ.array_size);
+
+ dst = screen->resource_create(screen, &dst_templ);
+ if (!dst) {
+ _mesa_problem(ctx, "%s: cannot create a temporary texture", __func__);
+ return;
+ }
+
+ blit.src.resource = src;
blit.src.level = texImage->Level;
- blit.src.format = util_format_linear(stObj->pt->format);
- blit.dst.resource = dst_texture;
+ blit.src.format = util_format_linear(src->format);
+ blit.dst.resource = dst;
blit.dst.level = 0;
- blit.dst.format = dst_texture->format;
+ blit.dst.format = dst->format;
blit.src.box.x = blit.dst.box.x = 0;
blit.src.box.y = blit.dst.box.y = 0;
- blit.src.box.z = 0; /* XXX compressed array textures? */
+ blit.src.box.z = texImage->Face;
blit.dst.box.z = 0;
blit.src.box.width = blit.dst.box.width = width;
blit.src.box.height = blit.dst.box.height = height;
- blit.src.box.depth = blit.dst.box.depth = 1;
+ blit.src.box.depth = blit.dst.box.depth = depth;
blit.mask = PIPE_MASK_RGBA;
blit.filter = PIPE_TEX_FILTER_NEAREST;
blit.scissor_enable = FALSE;
@@ -612,33 +643,38 @@ decompress_with_blit(struct gl_context * ctx,
pixels = _mesa_map_pbo_dest(ctx, &ctx->Pack, pixels);
- map = pipe_transfer_map(pipe, dst_texture, 0, 0,
- PIPE_TRANSFER_READ,
- 0, 0, width, height, &tex_xfer);
+ map = pipe_transfer_map_3d(pipe, dst, 0, PIPE_TRANSFER_READ,
+ 0, 0, 0, width, height, depth, &tex_xfer);
if (!map) {
goto end;
}
+ mesa_format = st_pipe_format_to_mesa_format(pipe_format);
+
/* copy/pack data into user buffer */
- if (_mesa_format_matches_format_and_type(stImage->base.TexFormat,
- format, type,
+ if (_mesa_format_matches_format_and_type(mesa_format, format, type,
ctx->Pack.SwapBytes)) {
/* memcpy */
- const uint bytesPerRow = width * util_format_get_blocksize(stImage->pt->format);
- /* map the dst_surface so we can read from it */
- GLuint row;
- for (row = 0; row < height; row++) {
- GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width,
- height, format, type, row, 0);
- memcpy(dest, map, bytesPerRow);
- map += tex_xfer->stride;
+ const uint bytesPerRow = width * util_format_get_blocksize(pipe_format);
+ GLuint row, slice;
+
+ for (slice = 0; slice < depth; slice++) {
+ ubyte *slice_map = map;
+
+ for (row = 0; row < height; row++) {
+ GLvoid *dest = _mesa_image_address3d(&ctx->Pack, pixels,
+ width, height, format,
+ type, slice, row, 0);
+ memcpy(dest, slice_map, bytesPerRow);
+ slice_map += tex_xfer->stride;
+ }
+ map += tex_xfer->layer_stride;
}
- pipe_transfer_unmap(pipe, tex_xfer);
}
else {
/* format translation via floats */
- GLuint row;
- enum pipe_format pformat = util_format_linear(dst_texture->format);
+ GLuint row, slice;
+ enum pipe_format pformat = util_format_linear(dst->format);
GLfloat *rgba;
rgba = malloc(width * 4 * sizeof(GLfloat));
@@ -647,20 +683,24 @@ decompress_with_blit(struct gl_context * ctx,
goto end;
}
- for (row = 0; row < height; row++) {
- const GLbitfield transferOps = 0x0; /* bypassed for glGetTexImage() */
- GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width,
- height, format, type, row, 0);
+ for (slice = 0; slice < depth; slice++) {
+ for (row = 0; row < height; row++) {
+ const GLbitfield transferOps = 0x0; /* bypassed for glGetTexImage() */
+ GLvoid *dest = _mesa_image_address3d(&ctx->Pack, pixels,
+ width, height, format,
+ type, slice, row, 0);
- if (ST_DEBUG & DEBUG_FALLBACK)
- debug_printf("%s: fallback format translation\n", __FUNCTION__);
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s: fallback format translation\n", __FUNCTION__);
- /* get float[4] rgba row from surface */
- pipe_get_tile_rgba_format(tex_xfer, map, 0, row, width, 1,
- pformat, rgba);
+ /* get float[4] rgba row from surface */
+ pipe_get_tile_rgba_format(tex_xfer, map, 0, row, width, 1,
+ pformat, rgba);
- _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format,
- type, dest, &ctx->Pack, transferOps);
+ _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format,
+ type, dest, &ctx->Pack, transferOps);
+ }
+ map += tex_xfer->layer_stride;
}
free(rgba);
@@ -671,7 +711,7 @@ end:
pipe_transfer_unmap(pipe, tex_xfer);
_mesa_unmap_pbo_dest(ctx, &ctx->Pack);
- pipe_resource_reference(&dst_texture, NULL);
+ pipe_resource_reference(&dst, NULL);
}
@@ -722,6 +762,9 @@ fallback_copy_texsubimage(struct gl_context *ctx,
GLvoid *texDest;
enum pipe_transfer_usage transfer_usage;
void *map;
+ unsigned dst_width = width;
+ unsigned dst_height = height;
+ unsigned dst_depth = 1;
if (ST_DEBUG & DEBUG_FALLBACK)
debug_printf("%s: fallback processing\n", __FUNCTION__);
@@ -730,6 +773,14 @@ fallback_copy_texsubimage(struct gl_context *ctx,
srcY = strb->Base.Height - srcY - height;
}
+ if (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY) {
+ /* Move y/height to z/depth for 1D array textures. */
+ destZ = destY;
+ destY = 0;
+ dst_depth = dst_height;
+ dst_height = 1;
+ }
+
map = pipe_transfer_map(pipe,
strb->texture,
strb->rtt_level,
@@ -745,9 +796,9 @@ fallback_copy_texsubimage(struct gl_context *ctx,
else
transfer_usage = PIPE_TRANSFER_WRITE;
- /* XXX this used to ignore destZ param */
- texDest = st_texture_image_map(st, stImage, destZ, transfer_usage,
- destX, destY, width, height);
+ texDest = st_texture_image_map(st, stImage, transfer_usage,
+ destX, destY, destZ,
+ dst_width, dst_height, dst_depth);
if (baseFormat == GL_DEPTH_COMPONENT ||
baseFormat == GL_DEPTH_STENCIL) {
@@ -775,8 +826,16 @@ fallback_copy_texsubimage(struct gl_context *ctx,
if (scaleOrBias) {
_mesa_scale_and_bias_depth_uint(ctx, width, data);
}
- pipe_put_tile_z(stImage->transfer, texDest, 0, row, width, 1,
- data);
+
+ if (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY) {
+ pipe_put_tile_z(stImage->transfer,
+ texDest + row*stImage->transfer->layer_stride,
+ 0, 0, width, 1, data);
+ }
+ else {
+ pipe_put_tile_z(stImage->transfer, texDest, 0, row, width, 1,
+ data);
+ }
}
}
else {
@@ -792,7 +851,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
if (tempSrc && texDest) {
const GLint dims = 2;
- const GLint dstRowStride = stImage->transfer->stride;
+ GLint dstRowStride;
struct gl_texture_image *texImage = &stImage->base;
struct gl_pixelstore_attrib unpack = ctx->DefaultPacking;
@@ -800,6 +859,13 @@ fallback_copy_texsubimage(struct gl_context *ctx,
unpack.Invert = GL_TRUE;
}
+ if (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY) {
+ dstRowStride = stImage->transfer->layer_stride;
+ }
+ else {
+ dstRowStride = stImage->transfer->stride;
+ }
+
/* get float/RGBA image from framebuffer */
/* XXX this usually involves a lot of int/float conversion.
* try to avoid that someday.
@@ -901,6 +967,43 @@ compatible_src_dst_formats(struct gl_context *ctx,
}
+/**
+ * Do pipe->blit. Return FALSE if the blitting is unsupported
+ * for the given formats.
+ */
+static GLboolean
+st_pipe_blit(struct pipe_context *pipe, struct pipe_blit_info *blit)
+{
+ struct pipe_screen *screen = pipe->screen;
+ unsigned dst_usage;
+
+ if (util_format_is_depth_or_stencil(blit->dst.format)) {
+ dst_usage = PIPE_BIND_DEPTH_STENCIL;
+ }
+ else {
+ dst_usage = PIPE_BIND_RENDER_TARGET;
+ }
+
+ /* try resource_copy_region in case the format is not supported
+ * for rendering */
+ if (util_try_blit_via_copy_region(pipe, blit)) {
+ return GL_TRUE; /* done */
+ }
+
+ /* check the format support */
+ if (!screen->is_format_supported(screen, blit->src.format,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW) ||
+ !screen->is_format_supported(screen, blit->dst.format,
+ PIPE_TEXTURE_2D, 0,
+ dst_usage)) {
+ return GL_FALSE;
+ }
+
+ pipe->blit(pipe, blit);
+ return GL_TRUE;
+}
+
/**
* Do a CopyTex[Sub]Image1/2/3D() using a hardware (blit) path if possible.
@@ -929,7 +1032,7 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
struct pipe_surface surf_tmpl;
unsigned dst_usage;
unsigned blit_mask;
- GLint srcY0, srcY1;
+ GLint srcY0, srcY1, yStep;
/* make sure finalize_textures has been called?
*/
@@ -950,10 +1053,12 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
if (do_flip) {
srcY1 = strb->Base.Height - srcY - height;
srcY0 = srcY1 + height;
+ yStep = -1;
}
else {
srcY0 = srcY;
srcY1 = srcY0 + height;
+ yStep = 1;
}
if (ctx->_ImageTransferState) {
@@ -965,16 +1070,6 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
goto fallback;
}
- if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
- /* 1D arrays might be thought of as 2D images but the actual layout
- * might not be that way. At some points, we convert OpenGL's 1D
- * array 'height' into gallium 'layers' and that prevents the blit
- * utility code from doing the right thing. Simpy use the memcpy-based
- * fallback.
- */
- goto fallback;
- }
-
/* Set the blit writemask. */
switch (texBaseFormat) {
case GL_DEPTH_STENCIL:
@@ -1055,27 +1150,38 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
blit.mask = blit_mask;
blit.filter = PIPE_TEX_FILTER_NEAREST;
- /* try resource_copy_region in case the format is not supported
- * for rendering */
- if (util_try_blit_via_copy_region(pipe, &blit)) {
- return; /* done */
- }
+ /* 1D array textures need special treatment.
+ * Blit rows from the source to layers in the destination. */
+ if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
+ int y, layer;
- /* check the format support */
- if (!screen->is_format_supported(screen, src_format,
- PIPE_TEXTURE_2D, 0,
- PIPE_BIND_SAMPLER_VIEW) ||
- !screen->is_format_supported(screen, dest_format,
- PIPE_TEXTURE_2D, 0,
- dst_usage)) {
- goto fallback;
- }
+ for (y = srcY0, layer = 0; layer < height; y += yStep, layer++) {
+ blit.src.box.y = y;
+ blit.src.box.height = 1;
+ blit.dst.box.y = 0;
+ blit.dst.box.height = 1;
+ blit.dst.box.z = destY + layer;
- pipe->blit(pipe, &blit);
+ if (!st_pipe_blit(pipe, &blit)) {
+ goto fallback;
+ }
+ }
+ }
+ else {
+ /* All the other texture targets. */
+ if (!st_pipe_blit(pipe, &blit)) {
+ goto fallback;
+ }
+ }
return;
}
/* try u_blit */
+ if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
+ /* u_blit cannot copy 1D array textures as required by CopyTexSubImage */
+ goto fallback;
+ }
+
color_writemask = compatible_src_dst_formats(ctx, &strb->Base, texImage);
if (!color_writemask ||
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index eeb7f0c4f..2be74b452 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -83,6 +83,7 @@ struct st_context
GLboolean clamp_frag_color_in_shader;
GLboolean clamp_vert_color_in_shader;
boolean has_stencil_export; /**< can do shader stencil export? */
+ boolean has_time_elapsed;
/* On old libGL's for linux we need to invalidate the drawables
* on glViewpport calls, this is set via a option.
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 262cc3d6c..e7cf4f3bb 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -371,6 +371,7 @@ void st_init_extensions(struct st_context *st)
{ o(ARB_shader_texture_lod), PIPE_CAP_SM3 },
{ o(ARB_shadow), PIPE_CAP_TEXTURE_SHADOW_MAP },
{ o(ARB_texture_non_power_of_two), PIPE_CAP_NPOT_TEXTURES },
+ { o(ARB_timer_query), PIPE_CAP_QUERY_TIMESTAMP },
{ o(ARB_transform_feedback2), PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME },
{ o(ARB_transform_feedback3), PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME },
@@ -382,7 +383,6 @@ void st_init_extensions(struct st_context *st)
{ o(EXT_texture_filter_anisotropic), PIPE_CAP_ANISOTROPIC_FILTER },
{ o(EXT_texture_mirror_clamp), PIPE_CAP_TEXTURE_MIRROR_CLAMP },
{ o(EXT_texture_swizzle), PIPE_CAP_TEXTURE_SWIZZLE },
- { o(EXT_timer_query), PIPE_CAP_TIMER_QUERY },
{ o(EXT_transform_feedback), PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS },
{ o(AMD_seamless_cubemap_per_texture), PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE },
@@ -652,9 +652,12 @@ void st_init_extensions(struct st_context *st)
if (ctx->Const.MaxDualSourceDrawBuffers > 0)
ctx->Extensions.ARB_blend_func_extended = GL_TRUE;
- if (screen->get_param(screen, PIPE_CAP_TIMER_QUERY) &&
- screen->get_param(screen, PIPE_CAP_QUERY_TIMESTAMP)) {
- ctx->Extensions.ARB_timer_query = GL_TRUE;
+ st->has_time_elapsed =
+ screen->get_param(screen, PIPE_CAP_QUERY_TIME_ELAPSED);
+
+ if (st->has_time_elapsed ||
+ ctx->Extensions.ARB_timer_query) {
+ ctx->Extensions.EXT_timer_query = GL_TRUE;
}
if (ctx->Extensions.ARB_transform_feedback2 &&
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c
index 30f5ca5ed..a3a67712a 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.c
+++ b/mesalib/src/mesa/state_tracker/st_manager.c
@@ -455,7 +455,13 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags,
struct pipe_fence_handle **fence)
{
struct st_context *st = (struct st_context *) stctxi;
- st_flush(st, fence);
+ enum pipe_flush_flags pipe_flags = 0;
+
+ if (flags & ST_FLUSH_END_OF_FRAME) {
+ pipe_flags |= PIPE_FLUSH_END_OF_FRAME;
+ }
+
+ st_flush(st, fence, pipe_flags);
if (flags & ST_FLUSH_FRONT)
st_manager_flush_frontbuffer(st);
}
diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c
index 5a4dcaab2..ee4d7622d 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_texture.c
@@ -232,8 +232,9 @@ st_texture_match_image(const struct pipe_resource *pt,
*/
GLubyte *
st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
- GLuint zoffset, enum pipe_transfer_usage usage,
- GLuint x, GLuint y, GLuint w, GLuint h)
+ enum pipe_transfer_usage usage,
+ GLuint x, GLuint y, GLuint z,
+ GLuint w, GLuint h, GLuint d)
{
struct st_texture_object *stObj =
st_texture_object(stImage->base.TexObject);
@@ -249,9 +250,9 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
else
level = stImage->base.Level;
- return pipe_transfer_map(st->pipe, stImage->pt, level,
- stImage->base.Face + zoffset,
- usage, x, y, w, h, &stImage->transfer);
+ return pipe_transfer_map_3d(st->pipe, stImage->pt, level, usage,
+ x, y, z + stImage->base.Face,
+ w, h, d, &stImage->transfer);
}
diff --git a/mesalib/src/mesa/state_tracker/st_texture.h b/mesalib/src/mesa/state_tracker/st_texture.h
index 62e975bb4..8a701009a 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.h
+++ b/mesalib/src/mesa/state_tracker/st_texture.h
@@ -176,12 +176,10 @@ st_texture_match_image(const struct pipe_resource *pt,
* well.
*/
extern GLubyte *
-st_texture_image_map(struct st_context *st,
- struct st_texture_image *stImage,
- GLuint zoffset,
+st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
enum pipe_transfer_usage usage,
- unsigned x, unsigned y,
- unsigned w, unsigned h);
+ GLuint x, GLuint y, GLuint z,
+ GLuint w, GLuint h, GLuint d);
extern void
st_texture_image_unmap(struct st_context *st,
diff --git a/mesalib/src/mesa/vbo/vbo.h b/mesalib/src/mesa/vbo/vbo.h
index 04930b971..49dab2314 100644
--- a/mesalib/src/mesa/vbo/vbo.h
+++ b/mesalib/src/mesa/vbo/vbo.h
@@ -156,7 +156,8 @@ void vbo_check_buffers_are_unmapped(struct gl_context *ctx);
void vbo_bind_arrays(struct gl_context *ctx);
size_t
-vbo_count_tessellated_primitives(const struct _mesa_prim *prim);
+vbo_count_tessellated_primitives(GLenum mode, GLuint count,
+ GLuint num_instances);
void
vbo_sw_primitive_restart(struct gl_context *ctx,
diff --git a/mesalib/src/mesa/vbo/vbo_exec.c b/mesalib/src/mesa/vbo/vbo_exec.c
index 361d7a3e4..5827f90c3 100644
--- a/mesalib/src/mesa/vbo/vbo_exec.c
+++ b/mesalib/src/mesa/vbo/vbo_exec.c
@@ -94,47 +94,51 @@ void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state )
/**
* Figure out the number of transform feedback primitives that will be output
- * by the given _mesa_prim command, assuming that no geometry shading is done
- * and primitive restart is not used.
+ * considering the drawing mode, number of vertices, and instance count,
+ * assuming that no geometry shading is done and primitive restart is not
+ * used.
*
- * This is intended for use by driver back-ends in implementing the
- * PRIMITIVES_GENERATED and TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN queries.
+ * This is used by driver back-ends in implementing the PRIMITIVES_GENERATED
+ * and TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN queries. It is also used to
+ * pre-validate draw calls in GLES3 (where draw calls only succeed if there is
+ * enough room in the transform feedback buffer for the result).
*/
size_t
-vbo_count_tessellated_primitives(const struct _mesa_prim *prim)
+vbo_count_tessellated_primitives(GLenum mode, GLuint count,
+ GLuint num_instances)
{
size_t num_primitives;
- switch (prim->mode) {
+ switch (mode) {
case GL_POINTS:
- num_primitives = prim->count;
+ num_primitives = count;
break;
case GL_LINE_STRIP:
- num_primitives = prim->count >= 2 ? prim->count - 1 : 0;
+ num_primitives = count >= 2 ? count - 1 : 0;
break;
case GL_LINE_LOOP:
- num_primitives = prim->count >= 2 ? prim->count : 0;
+ num_primitives = count >= 2 ? count : 0;
break;
case GL_LINES:
- num_primitives = prim->count / 2;
+ num_primitives = count / 2;
break;
case GL_TRIANGLE_STRIP:
case GL_TRIANGLE_FAN:
case GL_POLYGON:
- num_primitives = prim->count >= 3 ? prim->count - 2 : 0;
+ num_primitives = count >= 3 ? count - 2 : 0;
break;
case GL_TRIANGLES:
- num_primitives = prim->count / 3;
+ num_primitives = count / 3;
break;
case GL_QUAD_STRIP:
- num_primitives = prim->count >= 4 ? ((prim->count / 2) - 1) * 2 : 0;
+ num_primitives = count >= 4 ? ((count / 2) - 1) * 2 : 0;
break;
case GL_QUADS:
- num_primitives = (prim->count / 4) * 2;
+ num_primitives = (count / 4) * 2;
break;
default:
assert(!"Unexpected primitive type in count_tessellated_primitives");
num_primitives = 0;
break;
}
- return num_primitives * prim->num_instances;
+ return num_primitives * num_instances;
}
diff --git a/pixman/configure.ac b/pixman/configure.ac
index 81f068d9c..515e31218 100644
--- a/pixman/configure.ac
+++ b/pixman/configure.ac
@@ -64,7 +64,7 @@ AM_INIT_AUTOMAKE([foreign dist-bzip2])
# Suppress verbose compile lines
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-AM_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS(config.h)
AC_CANONICAL_HOST
diff --git a/pixman/pixman/pixman-bits-image.c b/pixman/pixman/pixman-bits-image.c
index 86d80c3f5..75a39a115 100644
--- a/pixman/pixman/pixman-bits-image.c
+++ b/pixman/pixman/pixman-bits-image.c
@@ -1114,7 +1114,7 @@ convert_a8 (const uint8_t *row, int x)
static force_inline uint32_t
convert_r5g6b5 (const uint8_t *row, int x)
{
- return CONVERT_0565_TO_0888 (*((uint16_t *)row + x));
+ return convert_0565_to_0888 (*((uint16_t *)row + x));
}
#define MAKE_SEPARABLE_CONVOLUTION_FETCHER(name, format, repeat_mode) \
diff --git a/pixman/pixman/pixman-combine-float.c b/pixman/pixman/pixman-combine-float.c
index c3d54f025..c916df8a3 100644
--- a/pixman/pixman/pixman-combine-float.c
+++ b/pixman/pixman/pixman-combine-float.c
@@ -42,6 +42,8 @@
#define force_inline __inline__
#endif
+#define IS_ZERO(f) (-FLT_MIN < (f) && (f) < FLT_MIN)
+
typedef float (* combine_channel_t) (float sa, float s, float da, float d);
static force_inline void
@@ -201,56 +203,56 @@ get_factor (combine_factor_t factor, float sa, float da)
break;
case SA_OVER_DA:
- if (da == 0.0f)
+ if (IS_ZERO (da))
f = 1.0f;
else
f = CLAMP (sa / da);
break;
case DA_OVER_SA:
- if (sa == 0.0f)
+ if (IS_ZERO (sa))
f = 1.0f;
else
f = CLAMP (da / sa);
break;
case INV_SA_OVER_DA:
- if (da == 0.0f)
+ if (IS_ZERO (da))
f = 1.0f;
else
f = CLAMP ((1.0f - sa) / da);
break;
case INV_DA_OVER_SA:
- if (sa == 0.0f)
+ if (IS_ZERO (sa))
f = 1.0f;
else
f = CLAMP ((1.0f - da) / sa);
break;
case ONE_MINUS_SA_OVER_DA:
- if (da == 0.0f)
+ if (IS_ZERO (da))
f = 0.0f;
else
f = CLAMP (1.0f - sa / da);
break;
case ONE_MINUS_DA_OVER_SA:
- if (sa == 0.0f)
+ if (IS_ZERO (sa))
f = 0.0f;
else
f = CLAMP (1.0f - da / sa);
break;
case ONE_MINUS_INV_DA_OVER_SA:
- if (sa == 0.0f)
+ if (IS_ZERO (sa))
f = 0.0f;
else
f = CLAMP (1.0f - (1.0f - da) / sa);
break;
case ONE_MINUS_INV_SA_OVER_DA:
- if (da == 0.0f)
+ if (IS_ZERO (da))
f = 0.0f;
else
f = CLAMP (1.0f - (1.0f - sa) / da);
@@ -403,11 +405,11 @@ blend_lighten (float sa, float s, float da, float d)
static force_inline float
blend_color_dodge (float sa, float s, float da, float d)
{
- if (d == 0.0f)
+ if (IS_ZERO (d))
return 0.0f;
else if (d * sa >= sa * da - s * da)
return sa * da;
- else if (sa - s == 0.0f)
+ else if (IS_ZERO (sa - s))
return sa * da;
else
return sa * sa * d / (sa - s);
@@ -420,7 +422,7 @@ blend_color_burn (float sa, float s, float da, float d)
return sa * da;
else if (sa * (da - d) >= s * da)
return 0.0f;
- else if (s == 0.0f)
+ else if (IS_ZERO (s))
return 0.0f;
else
return sa * (da - sa * (da - d) / s);
@@ -440,14 +442,14 @@ blend_soft_light (float sa, float s, float da, float d)
{
if (2 * s < sa)
{
- if (da == 0.0f)
+ if (IS_ZERO (da))
return d * sa;
else
return d * sa - d * (da - d) * (sa - 2 * s) / da;
}
else
{
- if (da == 0.0f)
+ if (IS_ZERO (da))
{
return 0.0f;
}
diff --git a/pixman/pixman/pixman-combine32.h b/pixman/pixman/pixman-combine32.h
index 875dde3cf..cdd56a61a 100644
--- a/pixman/pixman/pixman-combine32.h
+++ b/pixman/pixman/pixman-combine32.h
@@ -20,6 +20,47 @@
#define BLUE_8(x) ((x) & MASK)
/*
+ * ARMv6 has UQADD8 instruction, which implements unsigned saturated
+ * addition for 8-bit values packed in 32-bit registers. It is very useful
+ * for UN8x4_ADD_UN8x4, UN8_rb_ADD_UN8_rb and ADD_UN8 macros (which would
+ * otherwise need a lot of arithmetic operations to simulate this operation).
+ * Since most of the major ARM linux distros are built for ARMv7, we are
+ * much less dependent on runtime CPU detection and can get practical
+ * benefits from conditional compilation here for a lot of users.
+ */
+
+#if defined(USE_GCC_INLINE_ASM) && defined(__arm__) && \
+ !defined(__aarch64__) && (!defined(__thumb__) || defined(__thumb2__))
+#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \
+ defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || \
+ defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) || \
+ defined(__ARM_ARCH_6M__) || defined(__ARM_ARCH_7__) || \
+ defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || \
+ defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
+
+static force_inline uint32_t
+un8x4_add_un8x4 (uint32_t x, uint32_t y)
+{
+ uint32_t t;
+ asm ("uqadd8 %0, %1, %2" : "=r" (t) : "%r" (x), "r" (y));
+ return t;
+}
+
+#define UN8x4_ADD_UN8x4(x, y) \
+ ((x) = un8x4_add_un8x4 ((x), (y)))
+
+#define UN8_rb_ADD_UN8_rb(x, y, t) \
+ ((t) = un8x4_add_un8x4 ((x), (y)), (x) = (t))
+
+#define ADD_UN8(x, y, t) \
+ ((t) = (x), un8x4_add_un8x4 ((t), (y)))
+
+#endif
+#endif
+
+/*****************************************************************************/
+
+/*
* Helper macros.
*/
@@ -29,9 +70,11 @@
#define DIV_UN8(a, b) \
(((uint16_t) (a) * MASK + ((b) / 2)) / (b))
+#ifndef ADD_UN8
#define ADD_UN8(x, y, t) \
((t) = (x) + (y), \
(uint32_t) (uint8_t) ((t) | (0 - ((t) >> G_SHIFT))))
+#endif
#define DIV_ONE_UN8(x) \
(((x) + ONE_HALF + (((x) + ONE_HALF) >> G_SHIFT)) >> G_SHIFT)
@@ -56,6 +99,7 @@
/*
* x_rb = min (x_rb + y_rb, 255)
*/
+#ifndef UN8_rb_ADD_UN8_rb
#define UN8_rb_ADD_UN8_rb(x, y, t) \
do \
{ \
@@ -63,6 +107,7 @@
t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK); \
x = (t & RB_MASK); \
} while (0)
+#endif
/*
* x_rb = (x_rb * a_rb) / 255
@@ -208,6 +253,7 @@
/*
x_c = min(x_c + y_c, 255)
*/
+#ifndef UN8x4_ADD_UN8x4
#define UN8x4_ADD_UN8x4(x, y) \
do \
{ \
@@ -223,3 +269,4 @@
\
x = r1__ | (r2__ << G_SHIFT); \
} while (0)
+#endif
diff --git a/pixman/pixman/pixman-compiler.h b/pixman/pixman/pixman-compiler.h
index 2c9df716e..d38dfbe34 100644
--- a/pixman/pixman/pixman-compiler.h
+++ b/pixman/pixman/pixman-compiler.h
@@ -56,6 +56,10 @@
# define INT64_MAX (9223372036854775807)
#endif
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t)-1)
+#endif
+
#ifndef M_PI
# define M_PI 3.14159265358979323846
diff --git a/pixman/pixman/pixman-edge.c b/pixman/pixman/pixman-edge.c
index 8d498ab44..ad6dfc4cf 100644
--- a/pixman/pixman/pixman-edge.c
+++ b/pixman/pixman/pixman-edge.c
@@ -374,6 +374,7 @@ pixman_rasterize_edges (pixman_image_t *image,
pixman_fixed_t b)
{
return_if_fail (image->type == BITS);
+ return_if_fail (PIXMAN_FORMAT_TYPE (image->bits.format) == PIXMAN_TYPE_A);
if (image->bits.read_func || image->bits.write_func)
pixman_rasterize_edges_accessors (image, l, r, t, b);
diff --git a/pixman/pixman/pixman-fast-path.c b/pixman/pixman/pixman-fast-path.c
index 342975888..c625e0c4a 100644
--- a/pixman/pixman/pixman-fast-path.c
+++ b/pixman/pixman/pixman-fast-path.c
@@ -507,15 +507,15 @@ fast_composite_over_n_8_0565 (pixman_implementation_t *imp,
else
{
d = *dst;
- d = over (src, CONVERT_0565_TO_0888 (d));
+ d = over (src, convert_0565_to_0888 (d));
}
- *dst = CONVERT_8888_TO_0565 (d);
+ *dst = convert_8888_to_0565 (d);
}
else if (m)
{
d = *dst;
- d = over (in (src, m), CONVERT_0565_TO_0888 (d));
- *dst = CONVERT_8888_TO_0565 (d);
+ d = over (in (src, m), convert_0565_to_0888 (d));
+ *dst = convert_8888_to_0565 (d);
}
dst++;
}
@@ -541,7 +541,7 @@ fast_composite_over_n_8888_0565_ca (pixman_implementation_t *imp,
if (src == 0)
return;
- src16 = CONVERT_8888_TO_0565 (src);
+ src16 = convert_8888_to_0565 (src);
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1);
PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint32_t, mask_stride, mask_line, 1);
@@ -566,14 +566,14 @@ fast_composite_over_n_8888_0565_ca (pixman_implementation_t *imp,
else
{
d = *dst;
- d = over (src, CONVERT_0565_TO_0888 (d));
- *dst = CONVERT_8888_TO_0565 (d);
+ d = over (src, convert_0565_to_0888 (d));
+ *dst = convert_8888_to_0565 (d);
}
}
else if (ma)
{
d = *dst;
- d = CONVERT_0565_TO_0888 (d);
+ d = convert_0565_to_0888 (d);
s = src;
@@ -582,7 +582,7 @@ fast_composite_over_n_8888_0565_ca (pixman_implementation_t *imp,
ma = ~ma;
UN8x4_MUL_UN8x4_ADD_UN8x4 (d, ma, s);
- *dst = CONVERT_8888_TO_0565 (d);
+ *dst = convert_8888_to_0565 (d);
}
dst++;
}
@@ -729,9 +729,9 @@ fast_composite_over_8888_0565 (pixman_implementation_t *imp,
else
{
d = *dst;
- d = over (s, CONVERT_0565_TO_0888 (d));
+ d = over (s, convert_0565_to_0888 (d));
}
- *dst = CONVERT_8888_TO_0565 (d);
+ *dst = convert_8888_to_0565 (d);
}
dst++;
}
@@ -762,7 +762,7 @@ fast_composite_src_x888_0565 (pixman_implementation_t *imp,
while (w--)
{
s = *src++;
- *dst = CONVERT_8888_TO_0565 (s);
+ *dst = convert_8888_to_0565 (s);
dst++;
}
}
@@ -838,13 +838,13 @@ fast_composite_add_0565_0565 (pixman_implementation_t *imp,
if (s)
{
d = *dst;
- s = CONVERT_0565_TO_8888 (s);
+ s = convert_0565_to_8888 (s);
if (d)
{
- d = CONVERT_0565_TO_8888 (d);
+ d = convert_0565_to_8888 (d);
UN8x4_ADD_UN8x4 (s, d);
}
- *dst = CONVERT_8888_TO_0565 (s);
+ *dst = convert_8888_to_0565 (s);
}
dst++;
}
@@ -1094,7 +1094,7 @@ fast_composite_over_n_1_0565 (pixman_implementation_t *imp,
if (srca == 0xff)
{
- src565 = CONVERT_8888_TO_0565 (src);
+ src565 = convert_8888_to_0565 (src);
while (height--)
{
dst = dst_line;
@@ -1142,8 +1142,8 @@ fast_composite_over_n_1_0565 (pixman_implementation_t *imp,
}
if (bitcache & bitmask)
{
- d = over (src, CONVERT_0565_TO_0888 (*dst));
- *dst = CONVERT_8888_TO_0565 (d);
+ d = over (src, convert_0565_to_0888 (*dst));
+ *dst = convert_8888_to_0565 (d);
}
bitmask = UPDATE_BITMASK (bitmask);
dst++;
@@ -1176,7 +1176,7 @@ fast_composite_solid_fill (pixman_implementation_t *imp,
else if (dest_image->bits.format == PIXMAN_r5g6b5 ||
dest_image->bits.format == PIXMAN_b5g6r5)
{
- src = CONVERT_8888_TO_0565 (src);
+ src = convert_8888_to_0565 (src);
}
pixman_fill (dest_image->bits.bits, dest_image->bits.rowstride,
@@ -2067,12 +2067,12 @@ pixman_fill1 (uint32_t *bits,
int y,
int width,
int height,
- uint32_t xor)
+ uint32_t filler)
{
uint32_t *dst = bits + y * stride + (x >> 5);
int offs = x & 31;
- if (xor & 1)
+ if (filler & 1)
{
while (height--)
{
@@ -2097,11 +2097,11 @@ pixman_fill8 (uint32_t *bits,
int y,
int width,
int height,
- uint32_t xor)
+ uint32_t filler)
{
int byte_stride = stride * (int) sizeof (uint32_t);
uint8_t *dst = (uint8_t *) bits;
- uint8_t v = xor & 0xff;
+ uint8_t v = filler & 0xff;
int i;
dst = dst + y * byte_stride + x;
@@ -2122,12 +2122,12 @@ pixman_fill16 (uint32_t *bits,
int y,
int width,
int height,
- uint32_t xor)
+ uint32_t filler)
{
int short_stride =
(stride * (int)sizeof (uint32_t)) / (int)sizeof (uint16_t);
uint16_t *dst = (uint16_t *)bits;
- uint16_t v = xor & 0xffff;
+ uint16_t v = filler & 0xffff;
int i;
dst = dst + y * short_stride + x;
@@ -2148,7 +2148,7 @@ pixman_fill32 (uint32_t *bits,
int y,
int width,
int height,
- uint32_t xor)
+ uint32_t filler)
{
int i;
@@ -2157,7 +2157,7 @@ pixman_fill32 (uint32_t *bits,
while (height--)
{
for (i = 0; i < width; ++i)
- bits[i] = xor;
+ bits[i] = filler;
bits += stride;
}
@@ -2172,24 +2172,24 @@ fast_path_fill (pixman_implementation_t *imp,
int y,
int width,
int height,
- uint32_t xor)
+ uint32_t filler)
{
switch (bpp)
{
case 1:
- pixman_fill1 (bits, stride, x, y, width, height, xor);
+ pixman_fill1 (bits, stride, x, y, width, height, filler);
break;
case 8:
- pixman_fill8 (bits, stride, x, y, width, height, xor);
+ pixman_fill8 (bits, stride, x, y, width, height, filler);
break;
case 16:
- pixman_fill16 (bits, stride, x, y, width, height, xor);
+ pixman_fill16 (bits, stride, x, y, width, height, filler);
break;
case 32:
- pixman_fill32 (bits, stride, x, y, width, height, xor);
+ pixman_fill32 (bits, stride, x, y, width, height, filler);
break;
default:
diff --git a/pixman/pixman/pixman-filter.c b/pixman/pixman/pixman-filter.c
index c9d2dc74c..26b39d571 100644
--- a/pixman/pixman/pixman-filter.c
+++ b/pixman/pixman/pixman-filter.c
@@ -231,6 +231,8 @@ create_1d_filter (int *width,
*width = ceil (size);
p = params = malloc (*width * n_phases * sizeof (pixman_fixed_t));
+ if (!params)
+ return NULL;
step = 1.0 / n_phases;
@@ -309,7 +311,7 @@ pixman_filter_create_separable_convolution (int *n_values,
{
double sx = fabs (pixman_fixed_to_double (scale_x));
double sy = fabs (pixman_fixed_to_double (scale_y));
- pixman_fixed_t *horz, *vert, *params;
+ pixman_fixed_t *horz = NULL, *vert = NULL, *params = NULL;
int subsample_x, subsample_y;
int width, height;
@@ -319,9 +321,14 @@ pixman_filter_create_separable_convolution (int *n_values,
horz = create_1d_filter (&width, reconstruct_x, sample_x, sx, subsample_x);
vert = create_1d_filter (&height, reconstruct_y, sample_y, sy, subsample_y);
+ if (!horz || !vert)
+ goto out;
+
*n_values = 4 + width * subsample_x + height * subsample_y;
params = malloc (*n_values * sizeof (pixman_fixed_t));
+ if (!params)
+ goto out;
params[0] = pixman_int_to_fixed (width);
params[1] = pixman_int_to_fixed (height);
@@ -333,6 +340,7 @@ pixman_filter_create_separable_convolution (int *n_values,
memcpy (params + 4 + width * subsample_x, vert,
height * subsample_y * sizeof (pixman_fixed_t));
+out:
free (horz);
free (vert);
diff --git a/pixman/pixman/pixman-general.c b/pixman/pixman/pixman-general.c
index 0bf91e444..f175d771e 100644
--- a/pixman/pixman/pixman-general.c
+++ b/pixman/pixman/pixman-general.c
@@ -42,9 +42,7 @@ general_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
{
pixman_image_t *image = iter->image;
- if (image->type == SOLID)
- _pixman_solid_fill_iter_init (image, iter);
- else if (image->type == LINEAR)
+ if (image->type == LINEAR)
_pixman_linear_gradient_iter_init (image, iter);
else if (image->type == RADIAL)
_pixman_radial_gradient_iter_init (image, iter);
@@ -52,7 +50,9 @@ general_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
_pixman_conical_gradient_iter_init (image, iter);
else if (image->type == BITS)
_pixman_bits_image_src_iter_init (image, iter);
- else
+ else if (image->type == SOLID)
+ _pixman_log_error (FUNC, "Solid image not handled by noop");
+ else
_pixman_log_error (FUNC, "Pixman bug: unknown image type\n");
return TRUE;
diff --git a/pixman/pixman/pixman-glyph.c b/pixman/pixman/pixman-glyph.c
index 15b3f1fea..6d2c8bbb7 100644
--- a/pixman/pixman/pixman-glyph.c
+++ b/pixman/pixman/pixman-glyph.c
@@ -508,7 +508,7 @@ add_glyphs (pixman_glyph_cache_t *cache,
uint32_t glyph_flags = 0;
pixman_composite_func_t func = NULL;
pixman_implementation_t *implementation = NULL;
- uint32_t dest_format;
+ pixman_format_code_t dest_format;
uint32_t dest_flags;
pixman_box32_t dest_box;
pixman_composite_info_t info;
diff --git a/pixman/pixman/pixman-image.c b/pixman/pixman/pixman-image.c
index 6f076d5c6..65041b43b 100644
--- a/pixman/pixman/pixman-image.c
+++ b/pixman/pixman/pixman-image.c
@@ -888,7 +888,7 @@ pixman_image_get_format (pixman_image_t *image)
if (image->type == BITS)
return image->bits.format;
- return 0;
+ return PIXMAN_null;
}
uint32_t
diff --git a/pixman/pixman/pixman-implementation.c b/pixman/pixman/pixman-implementation.c
index a70892c75..ec467a619 100644
--- a/pixman/pixman/pixman-implementation.c
+++ b/pixman/pixman/pixman-implementation.c
@@ -242,12 +242,12 @@ _pixman_implementation_fill (pixman_implementation_t *imp,
int y,
int width,
int height,
- uint32_t xor)
+ uint32_t filler)
{
while (imp)
{
if (imp->fill &&
- ((*imp->fill) (imp, bits, stride, bpp, x, y, width, height, xor)))
+ ((*imp->fill) (imp, bits, stride, bpp, x, y, width, height, filler)))
{
return TRUE;
}
diff --git a/pixman/pixman/pixman-inlines.h b/pixman/pixman/pixman-inlines.h
index 13f901485..ce94e5248 100644
--- a/pixman/pixman/pixman-inlines.h
+++ b/pixman/pixman/pixman-inlines.h
@@ -314,36 +314,36 @@ scanline_func_name (dst_type_t *dst, \
\
if (a1 == 0xff) \
{ \
- *dst = CONVERT_ ## SRC_FORMAT ## _TO_ ## DST_FORMAT (s1); \
+ *dst = convert_ ## SRC_FORMAT ## _to_ ## DST_FORMAT (s1); \
} \
else if (s1) \
{ \
- d = CONVERT_ ## DST_FORMAT ## _TO_8888 (*dst); \
- s1 = CONVERT_ ## SRC_FORMAT ## _TO_8888 (s1); \
+ d = convert_ ## DST_FORMAT ## _to_8888 (*dst); \
+ s1 = convert_ ## SRC_FORMAT ## _to_8888 (s1); \
a1 ^= 0xff; \
UN8x4_MUL_UN8_ADD_UN8x4 (d, a1, s1); \
- *dst = CONVERT_8888_TO_ ## DST_FORMAT (d); \
+ *dst = convert_8888_to_ ## DST_FORMAT (d); \
} \
dst++; \
\
if (a2 == 0xff) \
{ \
- *dst = CONVERT_ ## SRC_FORMAT ## _TO_ ## DST_FORMAT (s2); \
+ *dst = convert_ ## SRC_FORMAT ## _to_ ## DST_FORMAT (s2); \
} \
else if (s2) \
{ \
- d = CONVERT_## DST_FORMAT ## _TO_8888 (*dst); \
- s2 = CONVERT_## SRC_FORMAT ## _TO_8888 (s2); \
+ d = convert_## DST_FORMAT ## _to_8888 (*dst); \
+ s2 = convert_## SRC_FORMAT ## _to_8888 (s2); \
a2 ^= 0xff; \
UN8x4_MUL_UN8_ADD_UN8x4 (d, a2, s2); \
- *dst = CONVERT_8888_TO_ ## DST_FORMAT (d); \
+ *dst = convert_8888_to_ ## DST_FORMAT (d); \
} \
dst++; \
} \
else /* PIXMAN_OP_SRC */ \
{ \
- *dst++ = CONVERT_ ## SRC_FORMAT ## _TO_ ## DST_FORMAT (s1); \
- *dst++ = CONVERT_ ## SRC_FORMAT ## _TO_ ## DST_FORMAT (s2); \
+ *dst++ = convert_ ## SRC_FORMAT ## _to_ ## DST_FORMAT (s1); \
+ *dst++ = convert_ ## SRC_FORMAT ## _to_ ## DST_FORMAT (s2); \
} \
} \
\
@@ -358,21 +358,21 @@ scanline_func_name (dst_type_t *dst, \
\
if (a1 == 0xff) \
{ \
- *dst = CONVERT_ ## SRC_FORMAT ## _TO_ ## DST_FORMAT (s1); \
+ *dst = convert_ ## SRC_FORMAT ## _to_ ## DST_FORMAT (s1); \
} \
else if (s1) \
{ \
- d = CONVERT_## DST_FORMAT ## _TO_8888 (*dst); \
- s1 = CONVERT_ ## SRC_FORMAT ## _TO_8888 (s1); \
+ d = convert_## DST_FORMAT ## _to_8888 (*dst); \
+ s1 = convert_ ## SRC_FORMAT ## _to_8888 (s1); \
a1 ^= 0xff; \
UN8x4_MUL_UN8_ADD_UN8x4 (d, a1, s1); \
- *dst = CONVERT_8888_TO_ ## DST_FORMAT (d); \
+ *dst = convert_8888_to_ ## DST_FORMAT (d); \
} \
dst++; \
} \
else /* PIXMAN_OP_SRC */ \
{ \
- *dst++ = CONVERT_ ## SRC_FORMAT ## _TO_ ## DST_FORMAT (s1); \
+ *dst++ = convert_ ## SRC_FORMAT ## _to_ ## DST_FORMAT (s1); \
} \
} \
}
diff --git a/pixman/pixman/pixman-mmx.c b/pixman/pixman/pixman-mmx.c
index 71c013318..7fae1067e 100755
--- a/pixman/pixman/pixman-mmx.c
+++ b/pixman/pixman/pixman-mmx.c
@@ -2088,7 +2088,7 @@ mmx_fill (pixman_implementation_t *imp,
int y,
int width,
int height,
- uint32_t xor)
+ uint32_t filler)
{
uint64_t fill;
__m64 vfill;
@@ -2108,7 +2108,7 @@ mmx_fill (pixman_implementation_t *imp,
byte_line = (uint8_t *)(((uint8_t *)bits) + stride * y + x);
byte_width = width;
stride *= 1;
- xor = (xor & 0xff) * 0x01010101;
+ filler = (filler & 0xff) * 0x01010101;
}
else if (bpp == 16)
{
@@ -2116,7 +2116,7 @@ mmx_fill (pixman_implementation_t *imp,
byte_line = (uint8_t *)(((uint16_t *)bits) + stride * y + x);
byte_width = 2 * width;
stride *= 2;
- xor = (xor & 0xffff) * 0x00010001;
+ filler = (filler & 0xffff) * 0x00010001;
}
else
{
@@ -2126,7 +2126,7 @@ mmx_fill (pixman_implementation_t *imp,
stride *= 4;
}
- fill = ((uint64_t)xor << 32) | xor;
+ fill = ((uint64_t)filler << 32) | filler;
vfill = to_m64 (fill);
#if defined __GNUC__ && defined USE_X86_MMX
@@ -2153,21 +2153,21 @@ mmx_fill (pixman_implementation_t *imp,
if (w >= 1 && ((uintptr_t)d & 1))
{
- *(uint8_t *)d = (xor & 0xff);
+ *(uint8_t *)d = (filler & 0xff);
w--;
d++;
}
if (w >= 2 && ((uintptr_t)d & 3))
{
- *(uint16_t *)d = (xor & 0xffff);
+ *(uint16_t *)d = (filler & 0xffff);
w -= 2;
d += 2;
}
while (w >= 4 && ((uintptr_t)d & 7))
{
- *(uint32_t *)d = xor;
+ *(uint32_t *)d = filler;
w -= 4;
d += 4;
@@ -2206,20 +2206,20 @@ mmx_fill (pixman_implementation_t *imp,
while (w >= 4)
{
- *(uint32_t *)d = xor;
+ *(uint32_t *)d = filler;
w -= 4;
d += 4;
}
if (w >= 2)
{
- *(uint16_t *)d = (xor & 0xffff);
+ *(uint16_t *)d = (filler & 0xffff);
w -= 2;
d += 2;
}
if (w >= 1)
{
- *(uint8_t *)d = (xor & 0xff);
+ *(uint8_t *)d = (filler & 0xff);
w--;
d++;
}
@@ -2254,7 +2254,7 @@ mmx_composite_src_x888_0565 (pixman_implementation_t *imp,
while (w && (uintptr_t)dst & 7)
{
s = *src++;
- *dst = CONVERT_8888_TO_0565 (s);
+ *dst = convert_8888_to_0565 (s);
dst++;
w--;
}
@@ -2277,7 +2277,7 @@ mmx_composite_src_x888_0565 (pixman_implementation_t *imp,
while (w)
{
s = *src++;
- *dst = CONVERT_8888_TO_0565 (s);
+ *dst = convert_8888_to_0565 (s);
dst++;
w--;
}
@@ -3160,13 +3160,13 @@ mmx_composite_add_0565_0565 (pixman_implementation_t *imp,
if (s)
{
d = *dst;
- s = CONVERT_0565_TO_8888 (s);
+ s = convert_0565_to_8888 (s);
if (d)
{
- d = CONVERT_0565_TO_8888 (d);
+ d = convert_0565_to_8888 (d);
UN8x4_ADD_UN8x4 (s, d);
}
- *dst = CONVERT_8888_TO_0565 (s);
+ *dst = convert_8888_to_0565 (s);
}
dst++;
w--;
@@ -3198,13 +3198,13 @@ mmx_composite_add_0565_0565 (pixman_implementation_t *imp,
if (s)
{
d = *dst;
- s = CONVERT_0565_TO_8888 (s);
+ s = convert_0565_to_8888 (s);
if (d)
{
- d = CONVERT_0565_TO_8888 (d);
+ d = convert_0565_to_8888 (d);
UN8x4_ADD_UN8x4 (s, d);
}
- *dst = CONVERT_8888_TO_0565 (s);
+ *dst = convert_8888_to_0565 (s);
}
dst++;
}
@@ -3851,7 +3851,7 @@ mmx_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask)
{
uint16_t s = *src++;
- *dst++ = CONVERT_0565_TO_8888 (s);
+ *dst++ = convert_0565_to_8888 (s);
w--;
}
@@ -3874,7 +3874,7 @@ mmx_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask)
{
uint16_t s = *src++;
- *dst++ = CONVERT_0565_TO_8888 (s);
+ *dst++ = convert_0565_to_8888 (s);
w--;
}
diff --git a/pixman/pixman/pixman-noop.c b/pixman/pixman/pixman-noop.c
index 850caa192..e39996d9d 100644
--- a/pixman/pixman/pixman-noop.c
+++ b/pixman/pixman/pixman-noop.c
@@ -77,25 +77,33 @@ noop_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
iter->get_scanline = _pixman_iter_get_scanline_noop;
}
else if (image->common.extended_format_code == PIXMAN_solid &&
- ((iter->image_flags & (FAST_PATH_BITS_IMAGE | FAST_PATH_NO_ALPHA_MAP)) ==
- (FAST_PATH_BITS_IMAGE | FAST_PATH_NO_ALPHA_MAP)))
+ (iter->image->type == SOLID ||
+ (iter->image_flags & FAST_PATH_NO_ALPHA_MAP)))
{
- bits_image_t *bits = &image->bits;
-
if (iter->iter_flags & ITER_NARROW)
{
- uint32_t color = bits->fetch_pixel_32 (bits, 0, 0);
uint32_t *buffer = iter->buffer;
uint32_t *end = buffer + iter->width;
+ uint32_t color;
+
+ if (image->type == SOLID)
+ color = image->solid.color_32;
+ else
+ color = image->bits.fetch_pixel_32 (&image->bits, 0, 0);
while (buffer < end)
*(buffer++) = color;
}
else
{
- argb_t color = bits->fetch_pixel_float (bits, 0, 0);
argb_t *buffer = (argb_t *)iter->buffer;
argb_t *end = buffer + iter->width;
+ argb_t color;
+
+ if (image->type == SOLID)
+ color = image->solid.color_float;
+ else
+ color = image->bits.fetch_pixel_float (&image->bits, 0, 0);
while (buffer < end)
*(buffer++) = color;
diff --git a/pixman/pixman/pixman-private.h b/pixman/pixman/pixman-private.h
index 99125a17e..e5ab873ed 100644
--- a/pixman/pixman/pixman-private.h
+++ b/pixman/pixman/pixman-private.h
@@ -263,9 +263,6 @@ void
_pixman_bits_image_dest_iter_init (pixman_image_t *image, pixman_iter_t *iter);
void
-_pixman_solid_fill_iter_init (pixman_image_t *image, pixman_iter_t *iter);
-
-void
_pixman_linear_gradient_iter_init (pixman_image_t *image, pixman_iter_t *iter);
void
@@ -455,7 +452,7 @@ typedef pixman_bool_t (*pixman_fill_func_t) (pixman_implementation_t *imp,
int y,
int width,
int height,
- uint32_t xor);
+ uint32_t filler);
typedef pixman_bool_t (*pixman_iter_init_func_t) (pixman_implementation_t *imp,
pixman_iter_t *iter);
@@ -542,7 +539,7 @@ _pixman_implementation_fill (pixman_implementation_t *imp,
int y,
int width,
int height,
- uint32_t xor);
+ uint32_t filler);
pixman_bool_t
_pixman_implementation_src_iter_init (pixman_implementation_t *imp,
@@ -884,22 +881,51 @@ pixman_list_move_to_front (pixman_list_t *list, pixman_link_t *link)
/* Conversion between 8888 and 0565 */
-#define CONVERT_8888_TO_0565(s) \
- ((((s) >> 3) & 0x001f) | \
- (((s) >> 5) & 0x07e0) | \
- (((s) >> 8) & 0xf800))
+static force_inline uint16_t
+convert_8888_to_0565 (uint32_t s)
+{
+ /* The following code can be compiled into just 4 instructions on ARM */
+ uint32_t a, b;
+ a = (s >> 3) & 0x1F001F;
+ b = s & 0xFC00;
+ a |= a >> 5;
+ a |= b >> 5;
+ return (uint16_t)a;
+}
-#define CONVERT_0565_TO_0888(s) \
- (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
- ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
- ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
+static force_inline uint32_t
+convert_0565_to_0888 (uint16_t s)
+{
+ return (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) |
+ ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) |
+ ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)));
+}
-#define CONVERT_0565_TO_8888(s) (CONVERT_0565_TO_0888(s) | 0xff000000)
+static force_inline uint32_t
+convert_0565_to_8888 (uint16_t s)
+{
+ return convert_0565_to_0888 (s) | 0xff000000;
+}
/* Trivial versions that are useful in macros */
-#define CONVERT_8888_TO_8888(s) (s)
-#define CONVERT_x888_TO_8888(s) ((s) | 0xff000000)
-#define CONVERT_0565_TO_0565(s) (s)
+
+static force_inline uint32_t
+convert_8888_to_8888 (uint32_t s)
+{
+ return s;
+}
+
+static force_inline uint32_t
+convert_x888_to_8888 (uint32_t s)
+{
+ return s | 0xff000000;
+}
+
+static force_inline uint16_t
+convert_0565_to_0565 (uint16_t s)
+{
+ return s;
+}
#define PIXMAN_FORMAT_IS_WIDE(f) \
(PIXMAN_FORMAT_A (f) > 8 || \
diff --git a/pixman/pixman/pixman-region.c b/pixman/pixman/pixman-region.c
index 8955fe760..2d6f1571c 100644
--- a/pixman/pixman/pixman-region.c
+++ b/pixman/pixman/pixman-region.c
@@ -202,7 +202,7 @@ PIXREGION_SZOF (size_t n)
return size + sizeof(region_data_type_t);
}
-static void *
+static region_data_type_t *
alloc_data (size_t n)
{
size_t sz = PIXREGION_SZOF (n);
diff --git a/pixman/pixman/pixman-solid-fill.c b/pixman/pixman/pixman-solid-fill.c
index 60d56d52a..5f9fef630 100644
--- a/pixman/pixman/pixman-solid-fill.c
+++ b/pixman/pixman/pixman-solid-fill.c
@@ -26,31 +26,6 @@
#endif
#include "pixman-private.h"
-void
-_pixman_solid_fill_iter_init (pixman_image_t *image, pixman_iter_t *iter)
-{
- if (iter->iter_flags & ITER_NARROW)
- {
- uint32_t *b = (uint32_t *)iter->buffer;
- uint32_t *e = b + iter->width;
- uint32_t color = iter->image->solid.color_32;
-
- while (b < e)
- *(b++) = color;
- }
- else
- {
- argb_t *b = (argb_t *)iter->buffer;
- argb_t *e = b + iter->width;
- argb_t color = image->solid.color_float;
-
- while (b < e)
- *(b++) = color;
- }
-
- iter->get_scanline = _pixman_iter_get_scanline_noop;
-}
-
static uint32_t
color_to_uint32 (const pixman_color_t *color)
{
diff --git a/pixman/pixman/pixman-sse2.c b/pixman/pixman/pixman-sse2.c
index 59ff915b6..97d63d1ad 100644..100755
--- a/pixman/pixman/pixman-sse2.c
+++ b/pixman/pixman/pixman-sse2.c
@@ -2881,7 +2881,7 @@ sse2_composite_src_x888_0565 (pixman_implementation_t *imp,
while (w && (uintptr_t)dst & 15)
{
s = *src++;
- *dst = CONVERT_8888_TO_0565 (s);
+ *dst = convert_8888_to_0565 (s);
dst++;
w--;
}
@@ -2901,7 +2901,7 @@ sse2_composite_src_x888_0565 (pixman_implementation_t *imp,
while (w)
{
s = *src++;
- *dst = CONVERT_8888_TO_0565 (s);
+ *dst = convert_8888_to_0565 (s);
dst++;
w--;
}
@@ -3321,7 +3321,7 @@ sse2_fill (pixman_implementation_t *imp,
int y,
int width,
int height,
- uint32_t xor)
+ uint32_t filler)
{
uint32_t byte_width;
uint8_t *byte_line;
@@ -3338,9 +3338,9 @@ sse2_fill (pixman_implementation_t *imp,
byte_width = width;
stride *= 1;
- b = xor & 0xff;
+ b = filler & 0xff;
w = (b << 8) | b;
- xor = (w << 16) | w;
+ filler = (w << 16) | w;
}
else if (bpp == 16)
{
@@ -3349,7 +3349,7 @@ sse2_fill (pixman_implementation_t *imp,
byte_width = 2 * width;
stride *= 2;
- xor = (xor & 0xffff) * 0x00010001;
+ filler = (filler & 0xffff) * 0x00010001;
}
else if (bpp == 32)
{
@@ -3363,7 +3363,7 @@ sse2_fill (pixman_implementation_t *imp,
return FALSE;
}
- xmm_def = create_mask_2x32_128 (xor, xor);
+ xmm_def = create_mask_2x32_128 (filler, filler);
while (height--)
{
@@ -3374,21 +3374,21 @@ sse2_fill (pixman_implementation_t *imp,
if (w >= 1 && ((uintptr_t)d & 1))
{
- *(uint8_t *)d = xor&0xff;
+ *(uint8_t *)d = filler&0xff;
w -= 1;
d += 1;
}
while (w >= 2 && ((uintptr_t)d & 3))
{
- *(uint16_t *)d = xor&0xffff;
+ *(uint16_t *)d = filler&0xffff;
w -= 2;
d += 2;
}
while (w >= 4 && ((uintptr_t)d & 15))
{
- *(uint32_t *)d = xor;
+ *(uint32_t *)d = filler;
w -= 4;
d += 4;
@@ -3439,7 +3439,7 @@ sse2_fill (pixman_implementation_t *imp,
while (w >= 4)
{
- *(uint32_t *)d = xor;
+ *(uint32_t *)d = filler;
w -= 4;
d += 4;
@@ -3447,14 +3447,14 @@ sse2_fill (pixman_implementation_t *imp,
if (w >= 2)
{
- *(uint16_t *)d = xor&0xffff;
+ *(uint16_t *)d = filler&0xffff;
w -= 2;
d += 2;
}
if (w >= 1)
{
- *(uint8_t *)d = xor&0xff;
+ *(uint8_t *)d = filler&0xff;
w -= 1;
d += 1;
}
@@ -5970,7 +5970,7 @@ sse2_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask)
{
uint16_t s = *src++;
- *dst++ = CONVERT_0565_TO_8888 (s);
+ *dst++ = convert_0565_to_8888 (s);
w--;
}
@@ -5995,7 +5995,7 @@ sse2_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask)
{
uint16_t s = *src++;
- *dst++ = CONVERT_0565_TO_8888 (s);
+ *dst++ = convert_0565_to_8888 (s);
w--;
}
diff --git a/pixman/pixman/pixman-trap.c b/pixman/pixman/pixman-trap.c
index f0935b217..7ccf91be3 100644
--- a/pixman/pixman/pixman-trap.c
+++ b/pixman/pixman/pixman-trap.c
@@ -491,6 +491,8 @@ pixman_composite_trapezoids (pixman_op_t op,
{
int i;
+ return_if_fail (PIXMAN_FORMAT_TYPE (mask_format) == PIXMAN_TYPE_A);
+
if (n_traps <= 0)
return;
@@ -521,8 +523,9 @@ pixman_composite_trapezoids (pixman_op_t op,
if (!get_trap_extents (op, dst, traps, n_traps, &box))
return;
- tmp = pixman_image_create_bits (
- mask_format, box.x2 - box.x1, box.y2 - box.y1, NULL, -1);
+ if (!(tmp = pixman_image_create_bits (
+ mask_format, box.x2 - box.x1, box.y2 - box.y1, NULL, -1)))
+ return;
for (i = 0; i < n_traps; ++i)
{
diff --git a/pixman/pixman/pixman.c b/pixman/pixman/pixman.c
index 0661f41b0..3fabed161 100644
--- a/pixman/pixman/pixman.c
+++ b/pixman/pixman/pixman.c
@@ -766,10 +766,10 @@ pixman_fill (uint32_t *bits,
int y,
int width,
int height,
- uint32_t xor)
+ uint32_t filler)
{
return _pixman_implementation_fill (
- get_implementation(), bits, stride, bpp, x, y, width, height, xor);
+ get_implementation(), bits, stride, bpp, x, y, width, height, filler);
}
static uint32_t
@@ -828,7 +828,7 @@ color_to_pixel (const pixman_color_t *color,
c = c >> 24;
else if (format == PIXMAN_r5g6b5 ||
format == PIXMAN_b5g6r5)
- c = CONVERT_8888_TO_0565 (c);
+ c = convert_8888_to_0565 (c);
#if 0
printf ("color: %x %x %x %x\n", color->alpha, color->red, color->green, color->blue);
diff --git a/pixman/test/lowlevel-blt-bench.c b/pixman/test/lowlevel-blt-bench.c
index 3afa926b0..2f97b7b24 100644
--- a/pixman/test/lowlevel-blt-bench.c
+++ b/pixman/test/lowlevel-blt-bench.c
@@ -616,6 +616,7 @@ tests_tbl[] =
{ "src_n_2x10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x2r10g10b10 },
{ "src_n_2a10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a2r10g10b10 },
{ "src_8888_0565", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_r5g6b5 },
+ { "src_0565_8888", PIXMAN_r5g6b5, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8r8g8b8 },
{ "src_8888_4444", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a4r4g4b4 },
{ "src_8888_2222", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a2r2g2b2 },
{ "src_8888_2x10", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x2r10g10b10 },
diff --git a/pixman/test/stress-test.c b/pixman/test/stress-test.c
index ee55c21ea..9d949afad 100644
--- a/pixman/test/stress-test.c
+++ b/pixman/test/stress-test.c
@@ -205,8 +205,29 @@ rand_y (pixman_image_t *image)
return log_rand ();
}
+static pixman_format_code_t
+random_format (pixman_bool_t prefer_alpha)
+{
+ pixman_format_code_t format;
+ int n = prng_rand_n (ARRAY_LENGTH (image_formats));
+
+ if (prefer_alpha && prng_rand_n (4) != 0)
+ {
+ do
+ {
+ format = image_formats[n++ % ARRAY_LENGTH (image_formats)];
+ } while (PIXMAN_FORMAT_TYPE (format) != PIXMAN_TYPE_A);
+ }
+ else
+ {
+ format = image_formats[n];
+ }
+
+ return format;
+}
+
static pixman_image_t *
-create_random_bits_image (void)
+create_random_bits_image (pixman_bool_t prefer_alpha)
{
pixman_format_code_t format;
pixman_indexed_t *indexed;
@@ -220,7 +241,7 @@ create_random_bits_image (void)
int n_coefficients = 0;
/* format */
- format = image_formats[prng_rand_n (ARRAY_LENGTH (image_formats))];
+ format = random_format (prefer_alpha);
indexed = NULL;
if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_COLOR)
@@ -389,7 +410,7 @@ set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map)
pixman_image_t *alpha_map;
int16_t x, y;
- alpha_map = create_random_bits_image ();
+ alpha_map = create_random_bits_image (FALSE);
if (alpha_map)
{
@@ -695,7 +716,7 @@ create_random_image (void)
{
default:
case 0:
- result = create_random_bits_image ();
+ result = create_random_bits_image (FALSE);
break;
case 1:
@@ -721,6 +742,39 @@ create_random_image (void)
return result;
}
+static void
+random_line (pixman_line_fixed_t *line, int width, int height)
+{
+ line->p1.x = prng_rand_n (width) << 16;
+ line->p1.y = prng_rand_n (height) << 16;
+ line->p2.x = prng_rand_n (width) << 16;
+ line->p2.y = prng_rand_n (height) << 16;
+}
+
+static pixman_trapezoid_t *
+create_random_trapezoids (int *n_traps, int height, int width)
+{
+ pixman_trapezoid_t *trapezoids;
+ int i;
+
+ *n_traps = prng_rand_n (16) + 1;
+
+ trapezoids = malloc (sizeof (pixman_trapezoid_t) * *n_traps);
+
+ for (i = 0; i < *n_traps; ++i)
+ {
+ pixman_trapezoid_t *t = &(trapezoids[i]);
+
+ t->top = prng_rand_n (height) << 16;
+ t->bottom = prng_rand_n (height) << 16;
+
+ random_line (&t->left, height, width);
+ random_line (&t->right, height, width);
+ }
+
+ return trapezoids;
+}
+
static const pixman_op_t op_list[] =
{
PIXMAN_OP_SRC,
@@ -792,31 +846,87 @@ run_test (uint32_t seed, pixman_bool_t verbose, uint32_t mod)
if (mod == 0 || (seed % mod) == 0)
printf ("Seed 0x%08x\n", seed);
}
-
- prng_srand (seed);
- source = create_random_image ();
- mask = create_random_image ();
- dest = create_random_bits_image ();
+ source = mask = dest = NULL;
+
+ prng_srand (seed);
- if (source && mask && dest)
+ if (prng_rand_n (8) == 0)
{
- set_general_properties (dest, TRUE);
-
- op = op_list [prng_rand_n (ARRAY_LENGTH (op_list))];
-
- pixman_image_composite32 (op,
- source, mask, dest,
- rand_x (source), rand_y (source),
- rand_x (mask), rand_y (mask),
- 0, 0,
- dest->bits.width,
- dest->bits.height);
+ int n_traps;
+ pixman_trapezoid_t *trapezoids;
+
+ dest = create_random_bits_image (TRUE);
+
+ if (dest)
+ {
+ set_general_properties (dest, TRUE);
+
+ trapezoids = create_random_trapezoids (
+ &n_traps, dest->bits.width, dest->bits.height);
+
+ if (trapezoids)
+ {
+ switch (prng_rand_n (3))
+ {
+ case 0:
+ pixman_rasterize_trapezoid (
+ dest, &trapezoids[prng_rand_n (n_traps)],
+ rand_x (dest), rand_y (dest));
+ break;
+
+ case 1:
+ source = create_random_image ();
+
+ if (source)
+ {
+ op = op_list [prng_rand_n (ARRAY_LENGTH (op_list))];
+
+ pixman_composite_trapezoids (
+ op, source, dest,
+ random_format (TRUE),
+ rand_x (source), rand_y (source),
+ rand_x (dest), rand_y (dest),
+ n_traps, trapezoids);
+ }
+ break;
+
+ case 2:
+ pixman_add_trapezoids (
+ dest, rand_x (dest), rand_y (dest), n_traps, trapezoids);
+ break;
+ }
+
+ free (trapezoids);
+ }
+ }
}
- if (source)
- pixman_image_unref (source);
- if (mask)
- pixman_image_unref (mask);
+ else
+ {
+ dest = create_random_bits_image (FALSE);
+ source = create_random_image ();
+ mask = create_random_image ();
+
+ if (source && mask && dest)
+ {
+ set_general_properties (dest, TRUE);
+
+ op = op_list [prng_rand_n (ARRAY_LENGTH (op_list))];
+
+ pixman_image_composite32 (op,
+ source, mask, dest,
+ rand_x (source), rand_y (source),
+ rand_x (mask), rand_y (mask),
+ 0, 0,
+ dest->bits.width,
+ dest->bits.height);
+ }
+ }
+
+ if (source)
+ pixman_image_unref (source);
+ if (mask)
+ pixman_image_unref (mask);
if (dest)
pixman_image_unref (dest);
}
diff --git a/xkbcomp/xkbcomp.c b/xkbcomp/xkbcomp.c
index 834c777ee..0dc5bc285 100644
--- a/xkbcomp/xkbcomp.c
+++ b/xkbcomp/xkbcomp.c
@@ -47,9 +47,6 @@
#include "tokens.h"
#include <X11/extensions/XKBgeom.h>
-#ifdef __UNIXOS2__
-#define chdir _chdir2
-#endif
#ifdef WIN32
#define S_IRGRP 0
diff --git a/xkbcomp/xkbpath.c b/xkbcomp/xkbpath.c
index f5b21e6b8..59f5645a5 100644
--- a/xkbcomp/xkbpath.c
+++ b/xkbcomp/xkbpath.c
@@ -214,9 +214,6 @@ XkbAddDirectoryToPath(const char *dir)
XkbClearIncludePath();
return True;
}
-#ifdef __UNIXOS2__
- dir = (char *) __XOS2RedirRoot(dir);
-#endif
len = strlen(dir);
if (len + 2 >= PATH_MAX)
{ /* allow for '/' and at least one character */
diff --git a/xorg-server/Xext/saver.c b/xorg-server/Xext/saver.c
index 7e071048f..07f652a26 100644
--- a/xorg-server/Xext/saver.c
+++ b/xorg-server/Xext/saver.c
@@ -840,7 +840,7 @@ ScreenSaverSetAttributes(ClientPtr client)
if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) {
fOK = FALSE;
for (idepth = 0; idepth < pScreen->numDepths; idepth++) {
- pDepth = (DepthPtr) & pScreen->allowedDepths[idepth];
+ pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
if ((depth == pDepth->depth) || (depth == 0)) {
for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) {
if (visual == pDepth->vids[ivisual]) {
diff --git a/xorg-server/Xi/Makefile.am b/xorg-server/Xi/Makefile.am
index 69c7886b9..af85bd049 100644
--- a/xorg-server/Xi/Makefile.am
+++ b/xorg-server/Xi/Makefile.am
@@ -78,6 +78,8 @@ libXi_la_SOURCES = \
ungrdevk.h \
xiallowev.c \
xiallowev.h \
+ xibarriers.c \
+ xibarriers.h \
xichangecursor.c \
xichangecursor.h \
xichangehierarchy.c \
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c
index 823e539e8..b34292594 100644
--- a/xorg-server/Xi/exevents.c
+++ b/xorg-server/Xi/exevents.c
@@ -1650,6 +1650,49 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
UpdateDeviceState(dev, &ev->device_event);
}
+static void
+ProcessBarrierEvent(InternalEvent *e, DeviceIntPtr dev)
+{
+ Mask filter;
+ WindowPtr pWin;
+ BarrierEvent *be = &e->barrier_event;
+ xEvent *ev;
+ int rc;
+ GrabPtr grab = dev->deviceGrab.grab;
+
+ if (!IsMaster(dev))
+ return;
+
+ if (dixLookupWindow(&pWin, be->window, serverClient, DixReadAccess) != Success)
+ return;
+
+ if (grab)
+ be->flags |= XIBarrierDeviceIsGrabbed;
+
+ rc = EventToXI2(e, &ev);
+ if (rc != Success) {
+ ErrorF("[Xi] event conversion from %s failed with code %d\n", __func__, rc);
+ return;
+ }
+
+ /* A client has a grab, deliver to this client if the grab_window is the
+ barrier window.
+
+ Otherwise, deliver normally to the client.
+ */
+ if (grab &&
+ CLIENT_ID(be->barrierid) == CLIENT_ID(grab->resource) &&
+ grab->window->drawable.id == be->window) {
+ DeliverGrabbedEvent(e, dev, FALSE);
+ } else {
+ filter = GetEventFilter(dev, ev);
+
+ DeliverEventsToWindow(dev, pWin, ev, 1,
+ filter, NullGrab);
+ }
+ free(ev);
+}
+
/**
* Process DeviceEvents and DeviceChangedEvents.
*/
@@ -1801,6 +1844,10 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
case ET_TouchEnd:
ProcessTouchEvent(ev, device);
break;
+ case ET_BarrierHit:
+ case ET_BarrierLeave:
+ ProcessBarrierEvent(ev, device);
+ break;
default:
ProcessDeviceEvent(ev, device);
break;
diff --git a/xorg-server/Xi/extinit.c b/xorg-server/Xi/extinit.c
index 7e3075551..619d0e468 100644
--- a/xorg-server/Xi/extinit.c
+++ b/xorg-server/Xi/extinit.c
@@ -122,6 +122,7 @@ SOFTWARE.
#include "xiqueryversion.h"
#include "xisetclientpointer.h"
#include "xiwarppointer.h"
+#include "xibarriers.h"
/* Masks for XI events have to be aligned with core event (partially anyway).
* If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
@@ -251,7 +252,8 @@ static int (*ProcIVector[]) (ClientPtr) = {
ProcXIChangeProperty, /* 57 */
ProcXIDeleteProperty, /* 58 */
ProcXIGetProperty, /* 59 */
- ProcXIGetSelectedEvents /* 60 */
+ ProcXIGetSelectedEvents, /* 60 */
+ ProcXIBarrierReleasePointer /* 61 */
};
/* For swapped clients */
@@ -316,7 +318,8 @@ static int (*SProcIVector[]) (ClientPtr) = {
SProcXIChangeProperty, /* 57 */
SProcXIDeleteProperty, /* 58 */
SProcXIGetProperty, /* 59 */
- SProcXIGetSelectedEvents /* 60 */
+ SProcXIGetSelectedEvents, /* 60 */
+ SProcXIBarrierReleasePointer /* 61 */
};
/*****************************************************************
@@ -646,7 +649,7 @@ SDeviceChangedEvent(xXIDeviceChangedEvent * from, xXIDeviceChangedEvent * to)
*to = *from;
memcpy(&to[1], &from[1], from->length * 4);
- any = (xXIAnyInfo *) & to[1];
+ any = (xXIAnyInfo *) &to[1];
for (i = 0; i < to->num_classes; i++) {
int length = any->length;
@@ -654,7 +657,7 @@ SDeviceChangedEvent(xXIDeviceChangedEvent * from, xXIDeviceChangedEvent * to)
case KeyClass:
{
xXIKeyInfo *ki = (xXIKeyInfo *) any;
- uint32_t *key = (uint32_t *) & ki[1];
+ uint32_t *key = (uint32_t *) &ki[1];
for (j = 0; j < ki->num_keycodes; j++, key++)
swapl(key);
@@ -765,7 +768,7 @@ SDeviceHierarchyEvent(xXIHierarchyEvent * from, xXIHierarchyEvent * to)
swapl(&to->flags);
swaps(&to->num_info);
- info = (xXIHierarchyInfo *) & to[1];
+ info = (xXIHierarchyInfo *) &to[1];
for (i = 0; i < from->num_info; i++) {
swaps(&info->deviceid);
swaps(&info->attachment);
@@ -839,6 +842,32 @@ STouchOwnershipEvent(xXITouchOwnershipEvent * from, xXITouchOwnershipEvent * to)
swapl(&to->child);
}
+static void
+SBarrierEvent(xXIBarrierEvent * from,
+ xXIBarrierEvent * to) {
+
+ *to = *from;
+
+ swaps(&from->sequenceNumber);
+ swapl(&from->length);
+ swaps(&from->evtype);
+ swapl(&from->time);
+ swaps(&from->deviceid);
+ swaps(&from->sourceid);
+ swapl(&from->event);
+ swapl(&from->root);
+ swapl(&from->root_x);
+ swapl(&from->root_y);
+
+ swapl(&from->dx.integral);
+ swapl(&from->dx.frac);
+ swapl(&from->dy.integral);
+ swapl(&from->dy.frac);
+ swapl(&from->dtime);
+ swapl(&from->barrier);
+ swapl(&from->eventid);
+}
+
/** Event swapping function for XI2 events. */
void
XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
@@ -885,6 +914,11 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
case XI_RawTouchEnd:
SRawEvent((xXIRawEvent *) from, (xXIRawEvent *) to);
break;
+ case XI_BarrierHit:
+ case XI_BarrierLeave:
+ SBarrierEvent((xXIBarrierEvent *) from,
+ (xXIBarrierEvent *) to);
+ break;
default:
ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
break;
@@ -1263,6 +1297,9 @@ XInputExtensionInit(void)
if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
FatalError("Failed to add callback to XI.\n");
+ if (!XIBarrierInit())
+ FatalError("Could not initialize barriers.\n");
+
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
SProcIDispatch, IResetProc, StandardMinorOpcode);
if (extEntry) {
diff --git a/xorg-server/Xi/gtmotion.c b/xorg-server/Xi/gtmotion.c
index 7c73e0b9c..1d39b2d1b 100644
--- a/xorg-server/Xi/gtmotion.c
+++ b/xorg-server/Xi/gtmotion.c
@@ -131,7 +131,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
num_events = v->numMotionEvents;
if (num_events) {
size = sizeof(Time) + (axes * sizeof(INT32));
- rep.nEvents = GetMotionHistory(dev, (xTimecoord **) & coords, /* XXX */
+ rep.nEvents = GetMotionHistory(dev, (xTimecoord **) &coords, /* XXX */
start.milliseconds, stop.milliseconds,
(ScreenPtr) NULL, FALSE);
}
diff --git a/xorg-server/Xi/makefile b/xorg-server/Xi/makefile
index a466c84f0..0c395d20e 100644
--- a/xorg-server/Xi/makefile
+++ b/xorg-server/Xi/makefile
@@ -36,6 +36,7 @@ CSRCS=allowev.c \
ungrdevb.c \
ungrdevk.c \
xiallowev.c \
+ xibarriers.c \
xichangecursor.c \
xichangehierarchy.c \
xigetclientpointer.c \
diff --git a/xorg-server/Xi/xibarriers.c b/xorg-server/Xi/xibarriers.c
new file mode 100644
index 000000000..7b7b83f1c
--- /dev/null
+++ b/xorg-server/Xi/xibarriers.c
@@ -0,0 +1,916 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright © 2002 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "xibarriers.h"
+#include "scrnintstr.h"
+#include "cursorstr.h"
+#include "dixevents.h"
+#include "servermd.h"
+#include "mipointer.h"
+#include "inputstr.h"
+#include "windowstr.h"
+#include "xace.h"
+#include "list.h"
+#include "exglobals.h"
+#include "eventstr.h"
+#include "mi.h"
+
+RESTYPE PointerBarrierType;
+
+static DevPrivateKeyRec BarrierScreenPrivateKeyRec;
+
+#define BarrierScreenPrivateKey (&BarrierScreenPrivateKeyRec)
+
+typedef struct PointerBarrierClient *PointerBarrierClientPtr;
+
+struct PointerBarrierDevice {
+ struct xorg_list entry;
+ int deviceid;
+ Time last_timestamp;
+ int barrier_event_id;
+ int release_event_id;
+ Bool hit;
+ Bool seen;
+};
+
+struct PointerBarrierClient {
+ XID id;
+ ScreenPtr screen;
+ Window window;
+ struct PointerBarrier barrier;
+ struct xorg_list entry;
+ /* num_devices/device_ids are devices the barrier applies to */
+ int num_devices;
+ int *device_ids; /* num_devices */
+
+ /* per_device keeps track of devices actually blocked by barriers */
+ struct xorg_list per_device;
+};
+
+typedef struct _BarrierScreen {
+ struct xorg_list barriers;
+} BarrierScreenRec, *BarrierScreenPtr;
+
+#define GetBarrierScreen(s) ((BarrierScreenPtr)dixLookupPrivate(&(s)->devPrivates, BarrierScreenPrivateKey))
+#define GetBarrierScreenIfSet(s) GetBarrierScreen(s)
+#define SetBarrierScreen(s,p) dixSetPrivate(&(s)->devPrivates, BarrierScreenPrivateKey, p)
+
+static struct PointerBarrierDevice *AllocBarrierDevice(void)
+{
+ struct PointerBarrierDevice *pbd = NULL;
+
+ pbd = malloc(sizeof(struct PointerBarrierDevice));
+ if (!pbd)
+ return NULL;
+
+ pbd->deviceid = -1; /* must be set by caller */
+ pbd->barrier_event_id = 1;
+ pbd->release_event_id = 0;
+ pbd->hit = FALSE;
+ pbd->seen = FALSE;
+ xorg_list_init(&pbd->entry);
+
+ return pbd;
+}
+
+static void FreePointerBarrierClient(struct PointerBarrierClient *c)
+{
+ struct PointerBarrierDevice *pbd = NULL, *tmp = NULL;
+
+ xorg_list_for_each_entry_safe(pbd, tmp, &c->per_device, entry) {
+ free(pbd);
+ }
+ free(c);
+}
+
+static struct PointerBarrierDevice *GetBarrierDevice(struct PointerBarrierClient *c, int deviceid)
+{
+ struct PointerBarrierDevice *pbd = NULL;
+
+ xorg_list_for_each_entry(pbd, &c->per_device, entry) {
+ if (pbd->deviceid == deviceid)
+ break;
+ }
+
+ BUG_WARN(!pbd);
+ return pbd;
+}
+
+static BOOL
+barrier_is_horizontal(const struct PointerBarrier *barrier)
+{
+ return barrier->y1 == barrier->y2;
+}
+
+static BOOL
+barrier_is_vertical(const struct PointerBarrier *barrier)
+{
+ return barrier->x1 == barrier->x2;
+}
+
+/**
+ * @return The set of barrier movement directions the movement vector
+ * x1/y1 → x2/y2 represents.
+ */
+int
+barrier_get_direction(int x1, int y1, int x2, int y2)
+{
+ int direction = 0;
+
+ /* which way are we trying to go */
+ if (x2 > x1)
+ direction |= BarrierPositiveX;
+ if (x2 < x1)
+ direction |= BarrierNegativeX;
+ if (y2 > y1)
+ direction |= BarrierPositiveY;
+ if (y2 < y1)
+ direction |= BarrierNegativeY;
+
+ return direction;
+}
+
+/**
+ * Test if the barrier may block movement in the direction defined by
+ * x1/y1 → x2/y2. This function only tests whether the directions could be
+ * blocked, it does not test if the barrier actually blocks the movement.
+ *
+ * @return TRUE if the barrier blocks the direction of movement or FALSE
+ * otherwise.
+ */
+BOOL
+barrier_is_blocking_direction(const struct PointerBarrier * barrier,
+ int direction)
+{
+ /* Barriers define which way is ok, not which way is blocking */
+ return (barrier->directions & direction) != direction;
+}
+
+static BOOL
+inside_segment(int v, int v1, int v2)
+{
+ if (v1 < 0 && v2 < 0) /* line */
+ return TRUE;
+ else if (v1 < 0) /* ray */
+ return v <= v2;
+ else if (v2 < 0) /* ray */
+ return v >= v1;
+ else /* line segment */
+ return v >= v1 && v <= v2;
+}
+
+#define T(v, a, b) (((float)v) - (a)) / ((b) - (a))
+#define F(t, a, b) ((t) * ((a) - (b)) + (a))
+
+/**
+ * Test if the movement vector x1/y1 → x2/y2 is intersecting with the
+ * barrier. A movement vector with the startpoint or endpoint adjacent to
+ * the barrier itself counts as intersecting.
+ *
+ * @param x1 X start coordinate of movement vector
+ * @param y1 Y start coordinate of movement vector
+ * @param x2 X end coordinate of movement vector
+ * @param y2 Y end coordinate of movement vector
+ * @param[out] distance The distance between the start point and the
+ * intersection with the barrier (if applicable).
+ * @return TRUE if the barrier intersects with the given vector
+ */
+BOOL
+barrier_is_blocking(const struct PointerBarrier * barrier,
+ int x1, int y1, int x2, int y2, double *distance)
+{
+ if (barrier_is_vertical(barrier)) {
+ float t, y;
+ t = T(barrier->x1, x1, x2);
+ if (t < 0 || t > 1)
+ return FALSE;
+
+ /* Edge case: moving away from barrier. */
+ if (x2 > x1 && t == 0)
+ return FALSE;
+
+ y = F(t, y1, y2);
+ if (!inside_segment(y, barrier->y1, barrier->y2))
+ return FALSE;
+
+ *distance = sqrt((pow(y - y1, 2) + pow(barrier->x1 - x1, 2)));
+ return TRUE;
+ }
+ else {
+ float t, x;
+ t = T(barrier->y1, y1, y2);
+ if (t < 0 || t > 1)
+ return FALSE;
+
+ /* Edge case: moving away from barrier. */
+ if (y2 > y1 && t == 0)
+ return FALSE;
+
+ x = F(t, x1, x2);
+ if (!inside_segment(x, barrier->x1, barrier->x2))
+ return FALSE;
+
+ *distance = sqrt((pow(x - x1, 2) + pow(barrier->y1 - y1, 2)));
+ return TRUE;
+ }
+}
+
+#define HIT_EDGE_EXTENTS 2
+static BOOL
+barrier_inside_hit_box(struct PointerBarrier *barrier, int x, int y)
+{
+ int x1, x2, y1, y2;
+ int dir;
+
+ x1 = barrier->x1;
+ x2 = barrier->x2;
+ y1 = barrier->y1;
+ y2 = barrier->y2;
+ dir = ~(barrier->directions);
+
+ if (barrier_is_vertical(barrier)) {
+ if (dir & BarrierPositiveX)
+ x1 -= HIT_EDGE_EXTENTS;
+ if (dir & BarrierNegativeX)
+ x2 += HIT_EDGE_EXTENTS;
+ }
+ if (barrier_is_horizontal(barrier)) {
+ if (dir & BarrierPositiveY)
+ y1 -= HIT_EDGE_EXTENTS;
+ if (dir & BarrierNegativeY)
+ y2 += HIT_EDGE_EXTENTS;
+ }
+
+ return x >= x1 && x <= x2 && y >= y1 && y <= y2;
+}
+
+static BOOL
+barrier_blocks_device(struct PointerBarrierClient *client,
+ DeviceIntPtr dev)
+{
+ int i;
+ int master_id;
+
+ /* Clients with no devices are treated as
+ * if they specified XIAllDevices. */
+ if (client->num_devices == 0)
+ return TRUE;
+
+ master_id = GetMaster(dev, POINTER_OR_FLOAT)->id;
+
+ for (i = 0; i < client->num_devices; i++) {
+ int device_id = client->device_ids[i];
+ if (device_id == XIAllDevices ||
+ device_id == XIAllMasterDevices ||
+ device_id == master_id)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ * Find the nearest barrier client that is blocking movement from x1/y1 to x2/y2.
+ *
+ * @param dir Only barriers blocking movement in direction dir are checked
+ * @param x1 X start coordinate of movement vector
+ * @param y1 Y start coordinate of movement vector
+ * @param x2 X end coordinate of movement vector
+ * @param y2 Y end coordinate of movement vector
+ * @return The barrier nearest to the movement origin that blocks this movement.
+ */
+static struct PointerBarrierClient *
+barrier_find_nearest(BarrierScreenPtr cs, DeviceIntPtr dev,
+ int dir,
+ int x1, int y1, int x2, int y2)
+{
+ struct PointerBarrierClient *c, *nearest = NULL;
+ double min_distance = INT_MAX; /* can't get higher than that in X anyway */
+
+ xorg_list_for_each_entry(c, &cs->barriers, entry) {
+ struct PointerBarrier *b = &c->barrier;
+ struct PointerBarrierDevice *pbd;
+ double distance;
+
+ pbd = GetBarrierDevice(c, dev->id);
+ if (pbd->seen)
+ continue;
+
+ if (!barrier_is_blocking_direction(b, dir))
+ continue;
+
+ if (!barrier_blocks_device(c, dev))
+ continue;
+
+ if (barrier_is_blocking(b, x1, y1, x2, y2, &distance)) {
+ if (min_distance > distance) {
+ min_distance = distance;
+ nearest = c;
+ }
+ }
+ }
+
+ return nearest;
+}
+
+/**
+ * Clamp to the given barrier given the movement direction specified in dir.
+ *
+ * @param barrier The barrier to clamp to
+ * @param dir The movement direction
+ * @param[out] x The clamped x coordinate.
+ * @param[out] y The clamped x coordinate.
+ */
+void
+barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
+ int *y)
+{
+ if (barrier_is_vertical(barrier)) {
+ if ((dir & BarrierNegativeX) & ~barrier->directions)
+ *x = barrier->x1;
+ if ((dir & BarrierPositiveX) & ~barrier->directions)
+ *x = barrier->x1 - 1;
+ }
+ if (barrier_is_horizontal(barrier)) {
+ if ((dir & BarrierNegativeY) & ~barrier->directions)
+ *y = barrier->y1;
+ if ((dir & BarrierPositiveY) & ~barrier->directions)
+ *y = barrier->y1 - 1;
+ }
+}
+
+void
+input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
+ int current_x, int current_y,
+ int dest_x, int dest_y,
+ int *out_x, int *out_y,
+ int *nevents, InternalEvent* events)
+{
+ /* Clamped coordinates here refer to screen edge clamping. */
+ BarrierScreenPtr cs = GetBarrierScreen(screen);
+ int x = dest_x,
+ y = dest_y;
+ int dir;
+ struct PointerBarrier *nearest = NULL;
+ PointerBarrierClientPtr c;
+ Time ms = GetTimeInMillis();
+ BarrierEvent ev = {
+ .header = ET_Internal,
+ .type = 0,
+ .length = sizeof (BarrierEvent),
+ .time = ms,
+ .deviceid = dev->id,
+ .sourceid = dev->id,
+ .dx = dest_x - current_x,
+ .dy = dest_y - current_y,
+ .root = screen->root->drawable.id,
+ };
+ InternalEvent *barrier_events = events;
+ DeviceIntPtr master;
+
+ if (nevents)
+ *nevents = 0;
+
+ if (xorg_list_is_empty(&cs->barriers) || IsFloating(dev))
+ goto out;
+
+ /**
+ * This function is only called for slave devices, but pointer-barriers
+ * are for master-devices only. Flip the device to the master here,
+ * continue with that.
+ */
+ master = GetMaster(dev, MASTER_POINTER);
+
+ /* How this works:
+ * Given the origin and the movement vector, get the nearest barrier
+ * to the origin that is blocking the movement.
+ * Clamp to that barrier.
+ * Then, check from the clamped intersection to the original
+ * destination, again finding the nearest barrier and clamping.
+ */
+ dir = barrier_get_direction(current_x, current_y, x, y);
+
+ while (dir != 0) {
+ struct PointerBarrierDevice *pbd;
+
+ c = barrier_find_nearest(cs, master, dir, current_x, current_y, x, y);
+ if (!c)
+ break;
+
+ nearest = &c->barrier;
+
+ pbd = GetBarrierDevice(c, master->id);
+ pbd->seen = TRUE;
+ pbd->hit = TRUE;
+
+ if (pbd->barrier_event_id == pbd->release_event_id)
+ continue;
+
+ ev.type = ET_BarrierHit;
+ barrier_clamp_to_barrier(nearest, dir, &x, &y);
+
+ if (barrier_is_vertical(nearest)) {
+ dir &= ~(BarrierNegativeX | BarrierPositiveX);
+ current_x = x;
+ }
+ else if (barrier_is_horizontal(nearest)) {
+ dir &= ~(BarrierNegativeY | BarrierPositiveY);
+ current_y = y;
+ }
+
+ ev.flags = 0;
+ ev.event_id = pbd->barrier_event_id;
+ ev.barrierid = c->id;
+
+ ev.dt = ms - pbd->last_timestamp;
+ ev.window = c->window;
+ pbd->last_timestamp = ms;
+
+ /* root x/y is filled in later */
+
+ barrier_events->barrier_event = ev;
+ barrier_events++;
+ *nevents += 1;
+ }
+
+ xorg_list_for_each_entry(c, &cs->barriers, entry) {
+ struct PointerBarrierDevice *pbd;
+ int flags = 0;
+
+ pbd = GetBarrierDevice(c, master->id);
+ pbd->seen = FALSE;
+ if (!pbd->hit)
+ continue;
+
+ if (barrier_inside_hit_box(&c->barrier, x, y))
+ continue;
+
+ pbd->hit = FALSE;
+
+ ev.type = ET_BarrierLeave;
+
+ if (pbd->barrier_event_id == pbd->release_event_id)
+ flags |= XIBarrierPointerReleased;
+
+ ev.flags = flags;
+ ev.event_id = pbd->barrier_event_id;
+ ev.barrierid = c->id;
+
+ ev.dt = ms - pbd->last_timestamp;
+ ev.window = c->window;
+ pbd->last_timestamp = ms;
+
+ /* root x/y is filled in later */
+
+ barrier_events->barrier_event = ev;
+ barrier_events++;
+ *nevents += 1;
+
+ /* If we've left the hit box, this is the
+ * start of a new event ID. */
+ pbd->barrier_event_id++;
+ }
+
+ out:
+ *out_x = x;
+ *out_y = y;
+}
+
+static void
+sort_min_max(INT16 *a, INT16 *b)
+{
+ INT16 A, B;
+ if (*a < 0 || *b < 0)
+ return;
+ A = *a;
+ B = *b;
+ *a = min(A, B);
+ *b = max(A, B);
+}
+
+static int
+CreatePointerBarrierClient(ClientPtr client,
+ xXFixesCreatePointerBarrierReq * stuff,
+ PointerBarrierClientPtr *client_out)
+{
+ WindowPtr pWin;
+ ScreenPtr screen;
+ BarrierScreenPtr cs;
+ int err;
+ int size;
+ int i;
+ struct PointerBarrierClient *ret;
+ CARD16 *in_devices;
+ DeviceIntPtr dev;
+
+ size = sizeof(*ret) + sizeof(DeviceIntPtr) * stuff->num_devices;
+ ret = malloc(size);
+
+ if (!ret) {
+ return BadAlloc;
+ }
+
+ xorg_list_init(&ret->per_device);
+
+ err = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ if (err != Success) {
+ client->errorValue = stuff->window;
+ goto error;
+ }
+
+ screen = pWin->drawable.pScreen;
+ cs = GetBarrierScreen(screen);
+
+ ret->screen = screen;
+ ret->window = stuff->window;
+ ret->num_devices = stuff->num_devices;
+ if (ret->num_devices > 0)
+ ret->device_ids = (int*)&ret[1];
+ else
+ ret->device_ids = NULL;
+
+ in_devices = (CARD16 *) &stuff[1];
+ for (i = 0; i < stuff->num_devices; i++) {
+ int device_id = in_devices[i];
+ DeviceIntPtr device;
+
+ if ((err = dixLookupDevice (&device, device_id,
+ client, DixReadAccess))) {
+ client->errorValue = device_id;
+ goto error;
+ }
+
+ if (!IsMaster (device)) {
+ client->errorValue = device_id;
+ err = BadDevice;
+ goto error;
+ }
+
+ ret->device_ids[i] = device_id;
+ }
+
+ /* Alloc one per master pointer, they're the ones that can be blocked */
+ xorg_list_init(&ret->per_device);
+ nt_list_for_each_entry(dev, inputInfo.devices, next) {
+ struct PointerBarrierDevice *pbd;
+
+ if (dev->type != MASTER_POINTER)
+ continue;
+
+ pbd = AllocBarrierDevice();
+ if (!pbd) {
+ err = BadAlloc;
+ goto error;
+ }
+ pbd->deviceid = dev->id;
+
+ xorg_list_add(&pbd->entry, &ret->per_device);
+ }
+
+ ret->id = stuff->barrier;
+ ret->barrier.x1 = stuff->x1;
+ ret->barrier.x2 = stuff->x2;
+ ret->barrier.y1 = stuff->y1;
+ ret->barrier.y2 = stuff->y2;
+ sort_min_max(&ret->barrier.x1, &ret->barrier.x2);
+ sort_min_max(&ret->barrier.y1, &ret->barrier.y2);
+ ret->barrier.directions = stuff->directions & 0x0f;
+ if (barrier_is_horizontal(&ret->barrier))
+ ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
+ if (barrier_is_vertical(&ret->barrier))
+ ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
+ xorg_list_add(&ret->entry, &cs->barriers);
+
+ *client_out = ret;
+ return Success;
+
+ error:
+ *client_out = NULL;
+ FreePointerBarrierClient(ret);
+ return err;
+}
+
+static int
+BarrierFreeBarrier(void *data, XID id)
+{
+ struct PointerBarrierClient *c;
+ Time ms = GetTimeInMillis();
+ DeviceIntPtr dev = NULL;
+ ScreenPtr screen;
+
+ c = container_of(data, struct PointerBarrierClient, barrier);
+ screen = c->screen;
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ struct PointerBarrierDevice *pbd;
+ int root_x, root_y;
+ BarrierEvent ev = {
+ .header = ET_Internal,
+ .type = ET_BarrierLeave,
+ .length = sizeof (BarrierEvent),
+ .time = ms,
+ /* .deviceid */
+ .sourceid = 0,
+ .barrierid = c->id,
+ .window = c->window,
+ .root = screen->root->drawable.id,
+ .dx = 0,
+ .dy = 0,
+ /* .root_x */
+ /* .root_y */
+ /* .dt */
+ /* .event_id */
+ .flags = XIBarrierPointerReleased,
+ };
+
+
+ if (dev->type != MASTER_POINTER)
+ continue;
+
+ pbd = GetBarrierDevice(c, dev->id);
+ if (!pbd->hit)
+ continue;
+
+ ev.deviceid = dev->id;
+ ev.event_id = pbd->barrier_event_id,
+ ev.dt = ms - pbd->last_timestamp,
+
+ GetSpritePosition(dev, &root_x, &root_y);
+ ev.root_x = root_x;
+ ev.root_y = root_y;
+
+ mieqEnqueue(dev, (InternalEvent *) &ev);
+ }
+
+ xorg_list_del(&c->entry);
+
+ FreePointerBarrierClient(c);
+ return Success;
+}
+
+static void add_master_func(pointer res, XID id, pointer devid)
+{
+ struct PointerBarrier *b;
+ struct PointerBarrierClient *barrier;
+ struct PointerBarrierDevice *pbd;
+ int *deviceid = devid;
+
+ b = res;
+ barrier = container_of(b, struct PointerBarrierClient, barrier);
+
+
+ pbd = AllocBarrierDevice();
+ pbd->deviceid = *deviceid;
+
+ xorg_list_add(&pbd->entry, &barrier->per_device);
+}
+
+static void remove_master_func(pointer res, XID id, pointer devid)
+{
+ struct PointerBarrierDevice *pbd;
+ struct PointerBarrierClient *barrier;
+ struct PointerBarrier *b;
+ DeviceIntPtr dev;
+ int *deviceid = devid;
+ int rc;
+ Time ms = GetTimeInMillis();
+
+ rc = dixLookupDevice(&dev, *deviceid, serverClient, DixSendAccess);
+ if (rc != Success)
+ return;
+
+ b = res;
+ barrier = container_of(b, struct PointerBarrierClient, barrier);
+
+ pbd = GetBarrierDevice(barrier, *deviceid);
+
+ if (pbd->hit) {
+ BarrierEvent ev = {
+ .header = ET_Internal,
+ .type =ET_BarrierLeave,
+ .length = sizeof (BarrierEvent),
+ .time = ms,
+ .deviceid = *deviceid,
+ .sourceid = 0,
+ .dx = 0,
+ .dy = 0,
+ .root = barrier->screen->root->drawable.id,
+ .window = barrier->window,
+ .dt = ms - pbd->last_timestamp,
+ .flags = XIBarrierPointerReleased,
+ .event_id = pbd->barrier_event_id,
+ .barrierid = barrier->id,
+ };
+
+ mieqEnqueue(dev, (InternalEvent *) &ev);
+ }
+
+ xorg_list_del(&pbd->entry);
+ free(pbd);
+}
+
+void XIBarrierNewMasterDevice(ClientPtr client, int deviceid)
+{
+ FindClientResourcesByType(client, PointerBarrierType, add_master_func, &deviceid);
+}
+
+void XIBarrierRemoveMasterDevice(ClientPtr client, int deviceid)
+{
+ FindClientResourcesByType(client, PointerBarrierType, remove_master_func, &deviceid);
+}
+
+int
+XICreatePointerBarrier(ClientPtr client,
+ xXFixesCreatePointerBarrierReq * stuff)
+{
+ int err;
+ struct PointerBarrierClient *barrier;
+ struct PointerBarrier b;
+
+ b.x1 = stuff->x1;
+ b.x2 = stuff->x2;
+ b.y1 = stuff->y1;
+ b.y2 = stuff->y2;
+
+ if (!barrier_is_horizontal(&b) && !barrier_is_vertical(&b))
+ return BadValue;
+
+ /* no 0-sized barriers */
+ if (barrier_is_horizontal(&b) && barrier_is_vertical(&b))
+ return BadValue;
+
+ /* no infinite barriers on the wrong axis */
+ if (barrier_is_horizontal(&b) && (b.y1 < 0 || b.y2 < 0))
+ return BadValue;
+
+ if (barrier_is_vertical(&b) && (b.x1 < 0 || b.x2 < 0))
+ return BadValue;
+
+ if ((err = CreatePointerBarrierClient(client, stuff, &barrier)))
+ return err;
+
+ if (!AddResource(stuff->barrier, PointerBarrierType, &barrier->barrier))
+ return BadAlloc;
+
+ return Success;
+}
+
+int
+XIDestroyPointerBarrier(ClientPtr client,
+ xXFixesDestroyPointerBarrierReq * stuff)
+{
+ int err;
+ void *barrier;
+
+ err = dixLookupResourceByType((void **) &barrier, stuff->barrier,
+ PointerBarrierType, client, DixDestroyAccess);
+ if (err != Success) {
+ client->errorValue = stuff->barrier;
+ return err;
+ }
+
+ if (CLIENT_ID(stuff->barrier) != client->index)
+ return BadAccess;
+
+ FreeResource(stuff->barrier, RT_NONE);
+ return Success;
+}
+
+int
+SProcXIBarrierReleasePointer(ClientPtr client)
+{
+ xXIBarrierReleasePointerInfo *info;
+ REQUEST(xXIBarrierReleasePointerReq);
+ int i;
+
+ info = (xXIBarrierReleasePointerInfo*) &stuff[1];
+
+ swaps(&stuff->length);
+ swapl(&stuff->num_barriers);
+ for (i = 0; i < stuff->num_barriers; i++, info++) {
+ swaps(&info->deviceid);
+ swapl(&info->barrier);
+ swapl(&info->eventid);
+ }
+
+ return (ProcXIBarrierReleasePointer(client));
+}
+
+int
+ProcXIBarrierReleasePointer(ClientPtr client)
+{
+ int i;
+ int err;
+ struct PointerBarrierClient *barrier;
+ struct PointerBarrier *b;
+ xXIBarrierReleasePointerInfo *info;
+
+ REQUEST(xXIBarrierReleasePointerReq);
+ REQUEST_AT_LEAST_SIZE(xXIBarrierReleasePointerReq);
+
+ info = (xXIBarrierReleasePointerInfo*) &stuff[1];
+ for (i = 0; i < stuff->num_barriers; i++, info++) {
+ struct PointerBarrierDevice *pbd;
+ DeviceIntPtr dev;
+ CARD32 barrier_id, event_id;
+ _X_UNUSED CARD32 device_id;
+
+ barrier_id = info->barrier;
+ event_id = info->eventid;
+
+ err = dixLookupDevice(&dev, info->deviceid, client, DixReadAccess);
+ if (err != Success) {
+ client->errorValue = BadDevice;
+ return err;
+ }
+
+ err = dixLookupResourceByType((void **) &b, barrier_id,
+ PointerBarrierType, client, DixReadAccess);
+ if (err != Success) {
+ client->errorValue = barrier_id;
+ return err;
+ }
+
+ if (CLIENT_ID(barrier_id) != client->index)
+ return BadAccess;
+
+
+ barrier = container_of(b, struct PointerBarrierClient, barrier);
+
+ pbd = GetBarrierDevice(barrier, dev->id);
+
+ if (pbd->barrier_event_id == event_id)
+ pbd->release_event_id = event_id;
+ }
+
+ return Success;
+}
+
+Bool
+XIBarrierInit(void)
+{
+ int i;
+
+ if (!dixRegisterPrivateKey(&BarrierScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ BarrierScreenPtr cs;
+
+ cs = (BarrierScreenPtr) calloc(1, sizeof(BarrierScreenRec));
+ if (!cs)
+ return FALSE;
+ xorg_list_init(&cs->barriers);
+ SetBarrierScreen(pScreen, cs);
+ }
+
+ PointerBarrierType = CreateNewResourceType(BarrierFreeBarrier,
+ "XIPointerBarrier");
+
+ return PointerBarrierType;
+}
diff --git a/xorg-server/Xi/xibarriers.h b/xorg-server/Xi/xibarriers.h
new file mode 100644
index 000000000..11e84ec9f
--- /dev/null
+++ b/xorg-server/Xi/xibarriers.h
@@ -0,0 +1,48 @@
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _XIBARRIERS_H_
+#define _XIBARRIERS_H_
+
+#include "resource.h"
+
+extern _X_EXPORT RESTYPE PointerBarrierType;
+
+struct PointerBarrier {
+ INT16 x1, x2, y1, y2;
+ CARD32 directions;
+};
+
+int
+barrier_get_direction(int, int, int, int);
+BOOL
+barrier_is_blocking(const struct PointerBarrier *, int, int, int, int,
+ double *);
+BOOL
+barrier_is_blocking_direction(const struct PointerBarrier *, int);
+void
+barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
+ int *y);
+
+#include <xfixesint.h>
+
+int
+XICreatePointerBarrier(ClientPtr client,
+ xXFixesCreatePointerBarrierReq * stuff);
+
+int
+XIDestroyPointerBarrier(ClientPtr client,
+ xXFixesDestroyPointerBarrierReq * stuff);
+
+Bool
+XIBarrierInit(void);
+
+int SProcXIBarrierReleasePointer(ClientPtr client);
+int ProcXIBarrierReleasePointer(ClientPtr client);
+
+void XIBarrierNewMasterDevice(ClientPtr client, int deviceid);
+void XIBarrierRemoveMasterDevice(ClientPtr client, int deviceid);
+
+#endif /* _XIBARRIERS_H_ */
diff --git a/xorg-server/Xi/xichangehierarchy.c b/xorg-server/Xi/xichangehierarchy.c
index 89f16d8be..e2f4b8a0a 100644
--- a/xorg-server/Xi/xichangehierarchy.c
+++ b/xorg-server/Xi/xichangehierarchy.c
@@ -52,6 +52,7 @@
#include "xkbsrv.h"
#include "xichangehierarchy.h"
+#include "xibarriers.h"
/**
* Send the current state of the device hierarchy to all clients.
@@ -79,7 +80,7 @@ XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
ev->flags = 0;
ev->num_info = inputInfo.numDevices;
- info = (xXIHierarchyInfo *) & ev[1];
+ info = (xXIHierarchyInfo *) &ev[1];
for (dev = inputInfo.devices; dev; dev = dev->next) {
info->deviceid = dev->id;
info->enabled = dev->enabled;
@@ -189,6 +190,8 @@ add_master(ClientPtr client, xXIAddMasterInfo * c, int flags[MAXDEVICES])
flags[XTestptr->id] |= XISlaveAttached;
flags[XTestkeybd->id] |= XISlaveAttached;
+ XIBarrierNewMasterDevice(client, ptr->id);
+
unwind:
free(name);
return rc;
@@ -293,6 +296,8 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
}
}
+ XIBarrierRemoveMasterDevice(client, ptr->id);
+
/* disable the remove the devices, XTest devices must be done first
else the sprites they rely on will be destroyed */
DisableDevice(XTestptr, FALSE);
@@ -304,15 +309,16 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
flags[keybd->id] |= XIDeviceDisabled;
flags[ptr->id] |= XIDeviceDisabled;
- RemoveDevice(XTestptr, FALSE);
- RemoveDevice(XTestkeybd, FALSE);
- RemoveDevice(keybd, FALSE);
- RemoveDevice(ptr, FALSE);
flags[XTestptr->id] |= XISlaveRemoved;
flags[XTestkeybd->id] |= XISlaveRemoved;
flags[keybd->id] |= XIMasterRemoved;
flags[ptr->id] |= XIMasterRemoved;
+ RemoveDevice(XTestptr, FALSE);
+ RemoveDevice(XTestkeybd, FALSE);
+ RemoveDevice(keybd, FALSE);
+ RemoveDevice(ptr, FALSE);
+
unwind:
return rc;
}
diff --git a/xorg-server/Xi/xiquerydevice.c b/xorg-server/Xi/xiquerydevice.c
index af7ea5394..1d1090046 100644
--- a/xorg-server/Xi/xiquerydevice.c
+++ b/xorg-server/Xi/xiquerydevice.c
@@ -303,7 +303,7 @@ ListKeyInfo(DeviceIntPtr dev, xXIKeyInfo * info)
info->length = sizeof(xXIKeyInfo) / 4 + info->num_keycodes;
info->sourceid = dev->key->sourceid;
- kc = (uint32_t *) & info[1];
+ kc = (uint32_t *) &info[1];
for (i = xkb->min_key_code; i <= xkb->max_key_code; i++, kc++)
*kc = i;
@@ -320,7 +320,7 @@ SwapKeyInfo(DeviceIntPtr dev, xXIKeyInfo * info)
swaps(&info->length);
swaps(&info->sourceid);
- for (i = 0, key = (uint32_t *) & info[1]; i < info->num_keycodes;
+ for (i = 0, key = (uint32_t *) &info[1]; i < info->num_keycodes;
i++, key++)
swapl(key);
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index 38ac240df..435a38f15 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -26,9 +26,9 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.13.99.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-10-04"
-RELEASE_NAME="Horchata"
+AC_INIT([xorg-server], 1.13.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-12-19"
+RELEASE_NAME="Egg Nog"
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
@@ -788,7 +788,7 @@ XPROTO="xproto >= 7.0.22"
RANDRPROTO="randrproto >= 1.4.0"
RENDERPROTO="renderproto >= 0.11"
XEXTPROTO="xextproto >= 7.1.99"
-INPUTPROTO="inputproto >= 2.1.99.6"
+INPUTPROTO="inputproto >= 2.2.99.1"
KBPROTO="kbproto >= 1.0.3"
FONTSPROTO="fontsproto"
FIXESPROTO="fixesproto >= 5.0"
diff --git a/xorg-server/dix/colormap.c b/xorg-server/dix/colormap.c
index c3078503a..9feb3e159 100644
--- a/xorg-server/dix/colormap.c
+++ b/xorg-server/dix/colormap.c
@@ -662,15 +662,15 @@ FreeCell(ColormapPtr pmap, Pixel i, int channel)
default: /* so compiler can see that everything gets initialized */
case PSEUDOMAP:
case REDMAP:
- pent = (EntryPtr) & pmap->red[i];
+ pent = (EntryPtr) &pmap->red[i];
pCount = &pmap->freeRed;
break;
case GREENMAP:
- pent = (EntryPtr) & pmap->green[i];
+ pent = (EntryPtr) &pmap->green[i];
pCount = &pmap->freeGreen;
break;
case BLUEMAP:
- pent = (EntryPtr) & pmap->blue[i];
+ pent = (EntryPtr) &pmap->blue[i];
pCount = &pmap->freeBlue;
break;
}
@@ -1404,7 +1404,7 @@ QueryColors(ColormapPtr pmap, int count, Pixel * ppixIn, xrgb * prgbList,
errVal = BadValue;
}
else {
- pent = (EntryPtr) & pmap->red[pixel];
+ pent = (EntryPtr) &pmap->red[pixel];
if (pent->fShared) {
prgb->red = pent->co.shco.red->color;
prgb->green = pent->co.shco.green->color;
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index c190b1bde..f82b81ec0 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -287,7 +287,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
dev->coreEvents = TRUE;
/* sprite defaults */
- dev->spriteInfo = (SpriteInfoPtr) & dev[1];
+ dev->spriteInfo = (SpriteInfoPtr) &dev[1];
/* security creation/labeling check
*/
@@ -949,7 +949,7 @@ CloseDevice(DeviceIntPtr dev)
free(dev->name);
- classes = (ClassesPtr) & dev->key;
+ classes = (ClassesPtr) &dev->key;
FreeAllDeviceClasses(classes);
if (IsMaster(dev)) {
diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c
index 283070046..b06017dd8 100755
--- a/xorg-server/dix/dispatch.c
+++ b/xorg-server/dix/dispatch.c
@@ -2500,7 +2500,7 @@ ProcListInstalledColormaps(ClientPtr client)
preply->type = X_Reply;
preply->sequenceNumber = client->sequence;
nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
- (pWin->drawable.pScreen, (Colormap *) & preply[1]);
+ (pWin->drawable.pScreen, (Colormap *) &preply[1]);
preply->nColormaps = nummaps;
preply->length = nummaps;
WriteReplyToClient(client, sizeof(xListInstalledColormapsReply), preply);
diff --git a/xorg-server/dix/eventconvert.c b/xorg-server/dix/eventconvert.c
index 422092971..de754e4d4 100644
--- a/xorg-server/dix/eventconvert.c
+++ b/xorg-server/dix/eventconvert.c
@@ -57,6 +57,7 @@ static int eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count);
static int eventToDeviceChanged(DeviceChangedEvent *ev, xEvent **dcce);
static int eventToDeviceEvent(DeviceEvent *ev, xEvent **xi);
static int eventToRawEvent(RawDeviceEvent *ev, xEvent **xi);
+static int eventToBarrierEvent(BarrierEvent *ev, xEvent **xi);
static int eventToTouchOwnershipEvent(TouchOwnershipEvent *ev, xEvent **xi);
/* Do not use, read comments below */
@@ -160,6 +161,8 @@ EventToCore(InternalEvent *event, xEvent **core_out, int *count_out)
case ET_TouchUpdate:
case ET_TouchEnd:
case ET_TouchOwnership:
+ case ET_BarrierHit:
+ case ET_BarrierLeave:
ret = BadMatch;
break;
default:
@@ -216,6 +219,8 @@ EventToXI(InternalEvent *ev, xEvent **xi, int *count)
case ET_TouchUpdate:
case ET_TouchEnd:
case ET_TouchOwnership:
+ case ET_BarrierHit:
+ case ET_BarrierLeave:
*count = 0;
*xi = NULL;
return BadMatch;
@@ -277,6 +282,9 @@ EventToXI2(InternalEvent *ev, xEvent **xi)
case ET_RawTouchUpdate:
case ET_RawTouchEnd:
return eventToRawEvent(&ev->raw_event, xi);
+ case ET_BarrierHit:
+ case ET_BarrierLeave:
+ return eventToBarrierEvent(&ev->barrier_event, xi);
default:
break;
}
@@ -451,7 +459,7 @@ appendKeyInfo(DeviceChangedEvent *dce, xXIKeyInfo * info)
info->length = sizeof(xXIKeyInfo) / 4 + info->num_keycodes;
info->sourceid = dce->sourceid;
- kc = (uint32_t *) & info[1];
+ kc = (uint32_t *) &info[1];
for (i = 0; i < info->num_keycodes; i++)
*kc++ = i + dce->keys.min_keycode;
@@ -782,6 +790,35 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
return Success;
}
+static int
+eventToBarrierEvent(BarrierEvent *ev, xEvent **xi)
+{
+ xXIBarrierEvent *barrier;
+ int len = sizeof(xXIBarrierEvent);
+
+ *xi = calloc(1, len);
+ barrier = (xXIBarrierEvent*) *xi;
+ barrier->type = GenericEvent;
+ barrier->extension = IReqCode;
+ barrier->evtype = GetXI2Type(ev->type);
+ barrier->length = bytes_to_int32(len - sizeof(xEvent));
+ barrier->deviceid = ev->deviceid;
+ barrier->sourceid = ev->sourceid;
+ barrier->time = ev->time;
+ barrier->event = ev->window;
+ barrier->root = ev->root;
+ barrier->dx = double_to_fp3232(ev->dx);
+ barrier->dy = double_to_fp3232(ev->dy);
+ barrier->dtime = ev->dt;
+ barrier->flags = ev->flags;
+ barrier->eventid = ev->event_id;
+ barrier->barrier = ev->barrierid;
+ barrier->root_x = double_to_fp1616(ev->root_x);
+ barrier->root_y = double_to_fp1616(ev->root_y);
+
+ return Success;
+}
+
/**
* Return the corresponding core type for the given event or 0 if no core
* equivalent exists.
@@ -929,6 +966,12 @@ GetXI2Type(enum EventType type)
case ET_TouchOwnership:
xi2type = XI_TouchOwnership;
break;
+ case ET_BarrierHit:
+ xi2type = XI_BarrierHit;
+ break;
+ case ET_BarrierLeave:
+ xi2type = XI_BarrierLeave;
+ break;
default:
break;
}
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index cf340669b..9d9565b95 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -219,6 +219,9 @@ static void CheckVirtualMotion(DeviceIntPtr pDev, QdEventPtr qe,
static void CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor,
Bool generateEvents, Bool confineToScreen,
ScreenPtr pScreen);
+static Bool IsWrongPointerBarrierClient(ClientPtr client,
+ DeviceIntPtr dev,
+ xEvent *event);
/** Key repeat hack. Do not use but in TryClientEvents */
extern BOOL EventIsKeyRepeat(xEvent *event);
@@ -2095,6 +2098,9 @@ DeliverEventToInputClients(DeviceIntPtr dev, InputClients * inputclients,
if (IsInterferingGrab(client, dev, events))
continue;
+ if (IsWrongPointerBarrierClient(client, dev, events))
+ continue;
+
mask = GetEventMask(dev, events, inputclients);
if (XaceHook(XACE_RECEIVE_ACCESS, client, win, events, count))
@@ -2449,6 +2455,8 @@ FixUpEventFromWindow(SpritePtr pSprite,
case XI_DeviceChanged:
case XI_HierarchyChanged:
case XI_PropertyEvent:
+ case XI_BarrierHit:
+ case XI_BarrierLeave:
return;
default:
break;
@@ -5048,7 +5056,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
grab = grabInfo->grab;
if (grab && grab->grabtype != grabtype)
*status = AlreadyGrabbed;
- if (grab && !SameClient(grab, client))
+ else if (grab && !SameClient(grab, client))
*status = AlreadyGrabbed;
else if ((!pWin->realized) ||
(confineTo &&
@@ -6083,3 +6091,19 @@ IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent *event)
return FALSE;
}
+
+/* PointerBarrier events are only delivered to the client that created that
+ * barrier */
+static Bool
+IsWrongPointerBarrierClient(ClientPtr client, DeviceIntPtr dev, xEvent *event)
+{
+ xXIBarrierEvent *ev = (xXIBarrierEvent*)event;
+
+ if (ev->type != GenericEvent || ev->extension != IReqCode)
+ return FALSE;
+
+ if (ev->evtype != XI_BarrierHit && ev->evtype != XI_BarrierLeave)
+ return FALSE;
+
+ return client->index != CLIENT_ID(ev->barrier);
+}
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c
index 68c614cc4..a158f98c9 100644
--- a/xorg-server/dix/getevents.c
+++ b/xorg-server/dix/getevents.c
@@ -931,10 +931,13 @@ scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask,
* @param[in,out] devy y desktop-wide coordinate in device coordinate system
* @param[in,out] screenx x coordinate in desktop coordinate system
* @param[in,out] screeny y coordinate in desktop coordinate system
+ * @param[out] nevents Number of barrier events added to events
+ * @param[in,out] events List of events barrier events are added to
*/
static ScreenPtr
positionSprite(DeviceIntPtr dev, int mode, ValuatorMask *mask,
- double *devx, double *devy, double *screenx, double *screeny)
+ double *devx, double *devy, double *screenx, double *screeny,
+ int *nevents, InternalEvent* events)
{
ScreenPtr scr = miPointerGetScreen(dev);
double tmpx, tmpy;
@@ -948,7 +951,7 @@ positionSprite(DeviceIntPtr dev, int mode, ValuatorMask *mask,
/* miPointerSetPosition takes care of crossing screens for us, as well as
* clipping to the current screen. Coordinates returned are in desktop
* coord system */
- scr = miPointerSetPosition(dev, mode, screenx, screeny);
+ scr = miPointerSetPosition(dev, mode, screenx, screeny, nevents, events);
/* If we were constrained, rescale x/y from the screen coordinates so
* the device valuators reflect the correct position. For screen
@@ -1339,6 +1342,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
int sx, sy; /* for POINTER_SCREEN */
ValuatorMask mask;
ScreenPtr scr;
+ int num_barrier_events = 0;
switch (type) {
case MotionNotify:
@@ -1415,7 +1419,10 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
}
scr = positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative,
- &mask, &devx, &devy, &screenx, &screeny);
+ &mask, &devx, &devy, &screenx, &screeny,
+ &num_barrier_events, events);
+ num_events += num_barrier_events;
+ events += num_barrier_events;
/* screenx, screeny are in desktop coordinates,
mask is in device coordinates per-screen (the event data)
@@ -1965,7 +1972,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
scr = scale_to_desktop(dev, &mask, &devx, &devy, &screenx, &screeny);
if (emulate_pointer)
scr = positionSprite(dev, Absolute, &mask,
- &devx, &devy, &screenx, &screeny);
+ &devx, &devy, &screenx, &screeny, NULL, NULL);
/* see fill_pointer_events for coordinate systems */
if (emulate_pointer)
diff --git a/xorg-server/dix/grabs.c b/xorg-server/dix/grabs.c
index fe7967415..3b02352df 100644
--- a/xorg-server/dix/grabs.c
+++ b/xorg-server/dix/grabs.c
@@ -219,7 +219,10 @@ CreateGrab(int client, DeviceIntPtr device, DeviceIntPtr modDevice,
grab->resource = FakeClientID(client);
grab->device = device;
grab->window = window;
- grab->eventMask = mask->core; /* same for XI */
+ if (grabtype == CORE || grabtype == XI)
+ grab->eventMask = mask->core; /* same for XI */
+ else
+ grab->eventMask = 0;
grab->deviceMask = 0;
grab->ownerEvents = param->ownerEvents;
grab->keyboardMode = param->this_device_mode;
diff --git a/xorg-server/dix/window.c b/xorg-server/dix/window.c
index 6932157d1..46cdfdee5 100644
--- a/xorg-server/dix/window.c
+++ b/xorg-server/dix/window.c
@@ -680,7 +680,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) {
fOK = FALSE;
for (idepth = 0; idepth < pScreen->numDepths; idepth++) {
- pDepth = (DepthPtr) & pScreen->allowedDepths[idepth];
+ pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
if ((depth == pDepth->depth) || (depth == 0)) {
for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) {
if (visual == pDepth->vids[ivisual]) {
diff --git a/xorg-server/exa/exa.c b/xorg-server/exa/exa.c
index d12344f79..f8e499c2b 100644
--- a/xorg-server/exa/exa.c
+++ b/xorg-server/exa/exa.c
@@ -620,8 +620,8 @@ exaCreateGC(GCPtr pGC)
swap(pExaScr, pScreen, CreateGC);
if ((ret = (*pScreen->CreateGC) (pGC))) {
- wrap(pExaGC, pGC, funcs, (GCFuncs *) & exaGCFuncs);
- wrap(pExaGC, pGC, ops, (GCOps *) & exaOps);
+ wrap(pExaGC, pGC, funcs, (GCFuncs *) &exaGCFuncs);
+ wrap(pExaGC, pGC, ops, (GCOps *) &exaOps);
}
swap(pExaScr, pScreen, CreateGC);
diff --git a/xorg-server/fb/fbgc.c b/xorg-server/fb/fbgc.c
index e6f8279b3..f4d7f3a99 100644
--- a/xorg-server/fb/fbgc.c
+++ b/xorg-server/fb/fbgc.c
@@ -64,8 +64,8 @@ const GCOps fbGCOps = {
Bool
fbCreateGC(GCPtr pGC)
{
- pGC->ops = (GCOps *) & fbGCOps;
- pGC->funcs = (GCFuncs *) & fbGCFuncs;
+ pGC->ops = (GCOps *) &fbGCOps;
+ pGC->funcs = (GCFuncs *) &fbGCFuncs;
/* fb wants to translate before scan conversion */
pGC->miTranslate = 1;
diff --git a/xorg-server/glx/glapi.c b/xorg-server/glx/glapi.c
index 334f33f9f..7b2fe9eb2 100644
--- a/xorg-server/glx/glapi.c
+++ b/xorg-server/glx/glapi.c
@@ -496,7 +496,7 @@ init_glapi_relocs(void)
char run_time_patch[] = {
0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */
};
- GLuint *offset = (GLuint *) & run_time_patch[2]; /* 32-bits for x86/32 */
+ GLuint *offset = (GLuint *) &run_time_patch[2]; /* 32-bits for x86/32 */
const GLubyte *const get_disp = (const GLubyte *) run_time_patch;
GLubyte *curr_func = (GLubyte *) gl_dispatch_functions_start;
diff --git a/xorg-server/glx/glxdri.c b/xorg-server/glx/glxdri.c
index 9e6254756..9355394c5 100644
--- a/xorg-server/glx/glxdri.c
+++ b/xorg-server/glx/glxdri.c
@@ -1072,7 +1072,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
/* Map the framebuffer region. */
status = drmMap(fd, hFB, framebuffer.size,
- (drmAddressPtr) & framebuffer.base);
+ (drmAddressPtr) &framebuffer.base);
if (status != 0) {
LogMessage(X_ERROR, "AIGLX error: drmMap of framebuffer failed (%s)\n",
strerror(-status));
diff --git a/xorg-server/glx/indirect_program.c b/xorg-server/glx/indirect_program.c
index 4d4c1a2f6..17204c17d 100644
--- a/xorg-server/glx/indirect_program.c
+++ b/xorg-server/glx/indirect_program.c
@@ -110,7 +110,7 @@ DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetTexImageReply *) & __glXReply)->width = compsize;
+ ((xGLXGetTexImageReply *) &__glXReply)->width = compsize;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
diff --git a/xorg-server/glx/indirect_texture_compression.c b/xorg-server/glx/indirect_texture_compression.c
index 77f4162f9..a1a946e5c 100644
--- a/xorg-server/glx/indirect_texture_compression.c
+++ b/xorg-server/glx/indirect_texture_compression.c
@@ -74,7 +74,7 @@ __glXDisp_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc)
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetTexImageReply *) & __glXReply)->width = compsize;
+ ((xGLXGetTexImageReply *) &__glXReply)->width = compsize;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -120,7 +120,7 @@ __glXDispSwap_GetCompressedTexImage(struct __GLXclientStateRec *cl,
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetTexImageReply *) & __glXReply)->width = compsize;
+ ((xGLXGetTexImageReply *) &__glXReply)->width = compsize;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
diff --git a/xorg-server/glx/renderpixswap.c b/xorg-server/glx/renderpixswap.c
index 9e6451065..79392409b 100644
--- a/xorg-server/glx/renderpixswap.c
+++ b/xorg-server/glx/renderpixswap.c
@@ -52,17 +52,17 @@ __glXDispSwap_SeparableFilter2D(GLbyte * pc)
hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
- __GLX_SWAP_INT((GLbyte *) & hdr->target);
- __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *) & hdr->width);
- __GLX_SWAP_INT((GLbyte *) & hdr->height);
- __GLX_SWAP_INT((GLbyte *) & hdr->format);
- __GLX_SWAP_INT((GLbyte *) & hdr->type);
+ __GLX_SWAP_INT((GLbyte *) &hdr->target);
+ __GLX_SWAP_INT((GLbyte *) &hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) &hdr->width);
+ __GLX_SWAP_INT((GLbyte *) &hdr->height);
+ __GLX_SWAP_INT((GLbyte *) &hdr->format);
+ __GLX_SWAP_INT((GLbyte *) &hdr->type);
/*
** Just invert swapBytes flag; the GL will figure out if it needs to swap
diff --git a/xorg-server/glx/singlepix.c b/xorg-server/glx/singlepix.c
index ec8887f53..10fd651df 100644
--- a/xorg-server/glx/singlepix.c
+++ b/xorg-server/glx/singlepix.c
@@ -151,9 +151,9 @@ __glXDisp_GetTexImage(__GLXclientState * cl, GLbyte * pc)
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetTexImageReply *) & __glXReply)->width = width;
- ((xGLXGetTexImageReply *) & __glXReply)->height = height;
- ((xGLXGetTexImageReply *) & __glXReply)->depth = depth;
+ ((xGLXGetTexImageReply *) &__glXReply)->width = width;
+ ((xGLXGetTexImageReply *) &__glXReply)->height = height;
+ ((xGLXGetTexImageReply *) &__glXReply)->depth = depth;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -253,8 +253,8 @@ GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
}
else {
__GLX_BEGIN_REPLY(compsize + compsize2);
- ((xGLXGetSeparableFilterReply *) & __glXReply)->width = width;
- ((xGLXGetSeparableFilterReply *) & __glXReply)->height = height;
+ ((xGLXGetSeparableFilterReply *) &__glXReply)->width = width;
+ ((xGLXGetSeparableFilterReply *) &__glXReply)->height = height;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize + compsize2);
}
@@ -331,8 +331,8 @@ GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetConvolutionFilterReply *) & __glXReply)->width = width;
- ((xGLXGetConvolutionFilterReply *) & __glXReply)->height = height;
+ ((xGLXGetConvolutionFilterReply *) &__glXReply)->width = width;
+ ((xGLXGetConvolutionFilterReply *) &__glXReply)->height = height;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -400,7 +400,7 @@ GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetHistogramReply *) & __glXReply)->width = width;
+ ((xGLXGetHistogramReply *) &__glXReply)->width = width;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -529,7 +529,7 @@ GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetColorTableReply *) & __glXReply)->width = width;
+ ((xGLXGetColorTableReply *) &__glXReply)->width = width;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
diff --git a/xorg-server/glx/singlepixswap.c b/xorg-server/glx/singlepixswap.c
index ac7de2ac3..7e20ed6bb 100644
--- a/xorg-server/glx/singlepixswap.c
+++ b/xorg-server/glx/singlepixswap.c
@@ -177,9 +177,9 @@ __glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc)
__GLX_SWAP_INT(&width);
__GLX_SWAP_INT(&height);
__GLX_SWAP_INT(&depth);
- ((xGLXGetTexImageReply *) & __glXReply)->width = width;
- ((xGLXGetTexImageReply *) & __glXReply)->height = height;
- ((xGLXGetTexImageReply *) & __glXReply)->depth = depth;
+ ((xGLXGetTexImageReply *) &__glXReply)->width = width;
+ ((xGLXGetTexImageReply *) &__glXReply)->height = height;
+ ((xGLXGetTexImageReply *) &__glXReply)->depth = depth;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -291,8 +291,8 @@ GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
__GLX_SWAP_REPLY_HEADER();
__GLX_SWAP_INT(&width);
__GLX_SWAP_INT(&height);
- ((xGLXGetSeparableFilterReply *) & __glXReply)->width = width;
- ((xGLXGetSeparableFilterReply *) & __glXReply)->height = height;
+ ((xGLXGetSeparableFilterReply *) &__glXReply)->width = width;
+ ((xGLXGetSeparableFilterReply *) &__glXReply)->height = height;
__GLX_SEND_VOID_ARRAY(compsize + compsize2);
}
@@ -377,8 +377,8 @@ GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
__GLX_SWAP_REPLY_HEADER();
__GLX_SWAP_INT(&width);
__GLX_SWAP_INT(&height);
- ((xGLXGetConvolutionFilterReply *) & __glXReply)->width = width;
- ((xGLXGetConvolutionFilterReply *) & __glXReply)->height = height;
+ ((xGLXGetConvolutionFilterReply *) &__glXReply)->width = width;
+ ((xGLXGetConvolutionFilterReply *) &__glXReply)->height = height;
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -453,7 +453,7 @@ GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
__GLX_BEGIN_REPLY(compsize);
__GLX_SWAP_REPLY_HEADER();
__GLX_SWAP_INT(&width);
- ((xGLXGetHistogramReply *) & __glXReply)->width = width;
+ ((xGLXGetHistogramReply *) &__glXReply)->width = width;
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -595,7 +595,7 @@ GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
__GLX_BEGIN_REPLY(compsize);
__GLX_SWAP_REPLY_HEADER();
__GLX_SWAP_INT(&width);
- ((xGLXGetColorTableReply *) & __glXReply)->width = width;
+ ((xGLXGetColorTableReply *) &__glXReply)->width = width;
__GLX_SEND_VOID_ARRAY(compsize);
}
diff --git a/xorg-server/glx/xfont.c b/xorg-server/glx/xfont.c
index a4130928a..5a7a8bfcd 100644
--- a/xorg-server/glx/xfont.c
+++ b/xorg-server/glx/xfont.c
@@ -169,7 +169,7 @@ __glXDisp_UseXFont(__GLXclientState * cl, GLbyte * pc)
}
CALL_GetIntegerv(GET_DISPATCH(),
- (GL_LIST_INDEX, (GLint *) & currentListIndex));
+ (GL_LIST_INDEX, (GLint *) &currentListIndex));
if (currentListIndex != 0) {
/*
** A display list is currently being made. It is an error
diff --git a/xorg-server/hw/dmx/config/Canvas.c b/xorg-server/hw/dmx/config/Canvas.c
index 34a47a2bf..f0586e509 100644
--- a/xorg-server/hw/dmx/config/Canvas.c
+++ b/xorg-server/hw/dmx/config/Canvas.c
@@ -76,7 +76,7 @@ CanvasExpose(Widget w, XEvent * event, Region region)
if (!XtIsRealized(w))
return;
- XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer) & data);
+ XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer) &data);
}
static void
@@ -162,4 +162,4 @@ CanvasClassRec canvasClassRec = {
}
};
-WidgetClass canvasWidgetClass = (WidgetClass) & canvasClassRec;
+WidgetClass canvasWidgetClass = (WidgetClass) &canvasClassRec;
diff --git a/xorg-server/hw/dmx/dmx_glxvisuals.c b/xorg-server/hw/dmx/dmx_glxvisuals.c
index 9fcc0e58d..f903b7491 100644
--- a/xorg-server/hw/dmx/dmx_glxvisuals.c
+++ b/xorg-server/hw/dmx/dmx_glxvisuals.c
@@ -61,7 +61,7 @@ GetGLXVisualConfigs(Display * dpy, int screen, int *nconfigs)
req->reqType = majorOpcode;
req->glxCode = X_GLXGetVisualConfigs;
req->screen = screen;
- if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
/* Something is busted. Punt. */
UnlockDisplay(dpy);
SyncHandle();
@@ -252,7 +252,7 @@ GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs)
*nconfigs = 0;
- if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
/* Something is busted. Punt. */
UnlockDisplay(dpy);
SyncHandle();
diff --git a/xorg-server/hw/dmx/dmxinit.c b/xorg-server/hw/dmx/dmxinit.c
index 94dbdd230..ec8a59e0d 100644
--- a/xorg-server/hw/dmx/dmxinit.c
+++ b/xorg-server/hw/dmx/dmxinit.c
@@ -740,10 +740,10 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
/* Check if GLX extension exists on all back-end servers */
for (i = 0; i < dmxNumScreens; i++)
glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
-#endif
if (serverGeneration == 1)
dmxAddExtensions(glxSupported);
+#endif
/* Tell dix layer about the backend displays */
for (i = 0; i < dmxNumScreens; i++) {
diff --git a/xorg-server/hw/dmx/dmxwindow.c b/xorg-server/hw/dmx/dmxwindow.c
index 855e56b9d..9b8a3840e 100644
--- a/xorg-server/hw/dmx/dmxwindow.c
+++ b/xorg-server/hw/dmx/dmxwindow.c
@@ -786,7 +786,7 @@ dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn, RegionPtr other_exposed)
if (pWinPriv->window) {
while (XCheckIfEvent(dmxScreen->beDisplay, &ev,
dmxWindowExposurePredicate,
- (XPointer) & pWinPriv->window)) {
+ (XPointer) &pWinPriv->window)) {
/* Handle expose events -- this should not be necessary
since the base window in which the root window was
created is guaranteed to be on top (override_redirect),
diff --git a/xorg-server/hw/dmx/examples/xinput.c b/xorg-server/hw/dmx/examples/xinput.c
index db6601030..6eddc6a67 100644
--- a/xorg-server/hw/dmx/examples/xinput.c
+++ b/xorg-server/hw/dmx/examples/xinput.c
@@ -303,8 +303,8 @@ main(int argc, char **argv)
XNextEvent(display, &event);
for (i = 0; i < cnt; i++) {
- XDeviceMotionEvent *e = (XDeviceMotionEvent *) & event;
- XDeviceButtonEvent *b = (XDeviceButtonEvent *) & event;
+ XDeviceMotionEvent *e = (XDeviceMotionEvent *) &event;
+ XDeviceButtonEvent *b = (XDeviceButtonEvent *) &event;
if (event.type == event_type[i]) {
printf("%s id=%lu (%d @ %d,%d; s=0x%04x, d=%d, t=%lu)"
diff --git a/xorg-server/hw/dmx/glxProxy/glxcmds.c b/xorg-server/hw/dmx/glxProxy/glxcmds.c
index 91011d109..45382748f 100644
--- a/xorg-server/hw/dmx/glxProxy/glxcmds.c
+++ b/xorg-server/hw/dmx/glxProxy/glxcmds.c
@@ -1276,7 +1276,7 @@ MakeCurrent(__GLXclientState * cl,
be_req->context =
(unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0);
be_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
- if (!_XReply(dpy, (xReply *) & be_reply, 0, False)) {
+ if (!_XReply(dpy, (xReply *) &be_reply, 0, False)) {
/* The make current failed */
UnlockDisplay(dpy);
@@ -1331,7 +1331,7 @@ MakeCurrent(__GLXclientState * cl,
be_new_req->context =
(unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0);
be_new_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
- if (!_XReply(dpy, (xReply *) & be_new_reply, 0, False)) {
+ if (!_XReply(dpy, (xReply *) &be_new_reply, 0, False)) {
/* The make current failed */
UnlockDisplay(dpy);
@@ -1362,7 +1362,7 @@ MakeCurrent(__GLXclientState * cl,
ext_req->context =
(unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0);
ext_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
- if (!_XReply(dpy, (xReply *) & ext_reply, 0, False)) {
+ if (!_XReply(dpy, (xReply *) &ext_reply, 0, False)) {
/* The make current failed */
UnlockDisplay(dpy);
@@ -2177,7 +2177,7 @@ __glXDoSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag)
finishReq->glxCode = X_GLsop_Finish;
finishReq->contextTag =
(tag ? GetCurrentBackEndTag(cl, tag, s) : 0);
- (void) _XReply(dpy, (xReply *) & reply, 0, False);
+ (void) _XReply(dpy, (xReply *) &reply, 0, False);
UnlockDisplay(dpy);
SyncHandle();
}
@@ -2605,7 +2605,7 @@ __glXQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
be_req->reqType = dmxScreen->glxMajorOpcode;
be_req->glxCode = X_GLXQueryServerString;
be_req->screen = DefaultScreen(dpy);
- _XReply(dpy, (xReply *) & be_reply, 0, False);
+ _XReply(dpy, (xReply *) &be_reply, 0, False);
len = (int) be_reply.length;
numbytes = (int) be_reply.n;
slop = numbytes * __GLX_SIZE_INT8 & 3;
@@ -2690,7 +2690,7 @@ __glXQueryServerString(__GLXclientState * cl, GLbyte * pc)
be_req->glxCode = X_GLXQueryServerString;
be_req->screen = DefaultScreen(dpy);
be_req->name = name;
- _XReply(dpy, (xReply *) & be_reply, 0, False);
+ _XReply(dpy, (xReply *) &be_reply, 0, False);
len = (int) be_reply.length;
numbytes = (int) be_reply.n;
slop = numbytes * __GLX_SIZE_INT8 & 3;
@@ -3045,7 +3045,7 @@ __glXGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc)
new_req.length = req->length;
new_req.screen = req->screen;
- return (__glXGetFBConfigs(cl, (GLbyte *) & new_req));
+ return (__glXGetFBConfigs(cl, (GLbyte *) &new_req));
}
int
@@ -3591,7 +3591,7 @@ __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
be_req->glxCode = X_GLXGetDrawableAttributes;
be_req->drawable = be_drawable;
be_req->length = req->length;
- if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
UnlockDisplay(dpy);
SyncHandle();
return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code));
diff --git a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c
index ac79cda22..ab3e7edc1 100644
--- a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c
+++ b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c
@@ -1051,7 +1051,7 @@ __glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc)
new_req.length = req->length;
new_req.screen = req->screen;
- return (__glXSwapGetFBConfigs(cl, (GLbyte *) & new_req));
+ return (__glXSwapGetFBConfigs(cl, (GLbyte *) &new_req));
}
int
diff --git a/xorg-server/hw/dmx/glxProxy/glxscreens.c b/xorg-server/hw/dmx/glxProxy/glxscreens.c
index f725bd138..2a1909244 100644
--- a/xorg-server/hw/dmx/glxProxy/glxscreens.c
+++ b/xorg-server/hw/dmx/glxProxy/glxscreens.c
@@ -88,7 +88,7 @@ CalcServerVersionAndExtensions(void)
req->glxCode = X_GLXQueryVersion;
req->majorVersion = GLX_SERVER_MAJOR_VERSION;
req->minorVersion = GLX_SERVER_MINOR_VERSION;
- _XReply(dpy, (xReply *) & reply, 0, False);
+ _XReply(dpy, (xReply *) &reply, 0, False);
UnlockDisplay(dpy);
SyncHandle();
@@ -147,7 +147,7 @@ CalcServerVersionAndExtensions(void)
req->glxCode = X_GLXQueryServerString;
req->screen = DefaultScreen(dpy);
req->name = GLX_EXTENSIONS;
- _XReply(dpy, (xReply *) & reply, 0, False);
+ _XReply(dpy, (xReply *) &reply, 0, False);
length = (int) reply.length;
numbytes = (int) reply.n;
diff --git a/xorg-server/hw/dmx/glxProxy/glxsingle.c b/xorg-server/hw/dmx/glxProxy/glxsingle.c
index 87842001f..e60cfeb70 100644
--- a/xorg-server/hw/dmx/glxProxy/glxsingle.c
+++ b/xorg-server/hw/dmx/glxProxy/glxsingle.c
@@ -249,7 +249,7 @@ __glXForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
/*
* get the reply from the back-end server
*/
- _XReply(dpy, (xReply *) & be_reply, 0, False);
+ _XReply(dpy, (xReply *) &be_reply, 0, False);
be_buf_size = be_reply.length << 2;
if (be_buf_size > 0) {
be_buf = (char *) malloc(be_buf_size);
@@ -348,7 +348,7 @@ __glXForwardAllWithReply(__GLXclientState * cl, GLbyte * pc)
/*
* get the reply from the back-end server
*/
- _XReply(dpy, (xReply *) & be_reply, 0, False);
+ _XReply(dpy, (xReply *) &be_reply, 0, False);
be_buf_size = be_reply.length << 2;
if (be_buf_size > 0) {
be_buf = (char *) malloc(be_buf_size);
@@ -919,7 +919,7 @@ __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
*(GLboolean *) (be_pc + 24) = swapBytes;
*(GLboolean *) (be_pc + 25) = lsbFirst;
- _XReply(dpy, (xReply *) & be_reply, 0, False);
+ _XReply(dpy, (xReply *) &be_reply, 0, False);
if (be_reply.length > 0) {
char *be_buf;
diff --git a/xorg-server/hw/dmx/glxProxy/glxvendor.c b/xorg-server/hw/dmx/glxProxy/glxvendor.c
index e5c8da144..5777c6acc 100644
--- a/xorg-server/hw/dmx/glxProxy/glxvendor.c
+++ b/xorg-server/hw/dmx/glxProxy/glxvendor.c
@@ -237,7 +237,7 @@ __glXVForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
/*
* get the reply from the back-end server
*/
- _XReply(dpy, (xReply *) & be_reply, 0, False);
+ _XReply(dpy, (xReply *) &be_reply, 0, False);
be_buf_size = be_reply.length << 2;
if (be_buf_size > 0) {
be_buf = (char *) malloc(be_buf_size);
@@ -331,7 +331,7 @@ __glXVForwardAllWithReply(__GLXclientState * cl, GLbyte * pc)
/*
* get the reply from the back-end server
*/
- _XReply(dpy, (xReply *) & be_reply, 0, False);
+ _XReply(dpy, (xReply *) &be_reply, 0, False);
be_buf_size = be_reply.length << 2;
if (be_buf_size > 0) {
be_buf = (char *) malloc(be_buf_size);
diff --git a/xorg-server/hw/dmx/glxProxy/renderpixswap.c b/xorg-server/hw/dmx/glxProxy/renderpixswap.c
index 3458e611c..32df0d5a8 100644
--- a/xorg-server/hw/dmx/glxProxy/renderpixswap.c
+++ b/xorg-server/hw/dmx/glxProxy/renderpixswap.c
@@ -39,10 +39,10 @@ __glXDispSwap_PolygonStipple(GLbyte * pc)
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
hdr->swapBytes = !hdr->swapBytes;
}
@@ -54,17 +54,17 @@ __glXDispSwap_Bitmap(GLbyte * pc)
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
- __GLX_SWAP_INT((GLbyte *) & hdr->width);
- __GLX_SWAP_INT((GLbyte *) & hdr->height);
- __GLX_SWAP_FLOAT((GLbyte *) & hdr->xorig);
- __GLX_SWAP_FLOAT((GLbyte *) & hdr->yorig);
- __GLX_SWAP_FLOAT((GLbyte *) & hdr->xmove);
- __GLX_SWAP_FLOAT((GLbyte *) & hdr->ymove);
+ __GLX_SWAP_INT((GLbyte *) &hdr->width);
+ __GLX_SWAP_INT((GLbyte *) &hdr->height);
+ __GLX_SWAP_FLOAT((GLbyte *) &hdr->xorig);
+ __GLX_SWAP_FLOAT((GLbyte *) &hdr->yorig);
+ __GLX_SWAP_FLOAT((GLbyte *) &hdr->xmove);
+ __GLX_SWAP_FLOAT((GLbyte *) &hdr->ymove);
hdr->swapBytes = !hdr->swapBytes;
@@ -77,19 +77,19 @@ __glXDispSwap_TexImage1D(GLbyte * pc)
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
- __GLX_SWAP_INT((GLbyte *) & hdr->target);
- __GLX_SWAP_INT((GLbyte *) & hdr->level);
- __GLX_SWAP_INT((GLbyte *) & hdr->components);
- __GLX_SWAP_INT((GLbyte *) & hdr->width);
- __GLX_SWAP_INT((GLbyte *) & hdr->height);
- __GLX_SWAP_INT((GLbyte *) & hdr->border);
- __GLX_SWAP_INT((GLbyte *) & hdr->format);
- __GLX_SWAP_INT((GLbyte *) & hdr->type);
+ __GLX_SWAP_INT((GLbyte *) &hdr->target);
+ __GLX_SWAP_INT((GLbyte *) &hdr->level);
+ __GLX_SWAP_INT((GLbyte *) &hdr->components);
+ __GLX_SWAP_INT((GLbyte *) &hdr->width);
+ __GLX_SWAP_INT((GLbyte *) &hdr->height);
+ __GLX_SWAP_INT((GLbyte *) &hdr->border);
+ __GLX_SWAP_INT((GLbyte *) &hdr->format);
+ __GLX_SWAP_INT((GLbyte *) &hdr->type);
/*
** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -105,19 +105,19 @@ __glXDispSwap_TexImage2D(GLbyte * pc)
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
- __GLX_SWAP_INT((GLbyte *) & hdr->target);
- __GLX_SWAP_INT((GLbyte *) & hdr->level);
- __GLX_SWAP_INT((GLbyte *) & hdr->components);
- __GLX_SWAP_INT((GLbyte *) & hdr->width);
- __GLX_SWAP_INT((GLbyte *) & hdr->height);
- __GLX_SWAP_INT((GLbyte *) & hdr->border);
- __GLX_SWAP_INT((GLbyte *) & hdr->format);
- __GLX_SWAP_INT((GLbyte *) & hdr->type);
+ __GLX_SWAP_INT((GLbyte *) &hdr->target);
+ __GLX_SWAP_INT((GLbyte *) &hdr->level);
+ __GLX_SWAP_INT((GLbyte *) &hdr->components);
+ __GLX_SWAP_INT((GLbyte *) &hdr->width);
+ __GLX_SWAP_INT((GLbyte *) &hdr->height);
+ __GLX_SWAP_INT((GLbyte *) &hdr->border);
+ __GLX_SWAP_INT((GLbyte *) &hdr->format);
+ __GLX_SWAP_INT((GLbyte *) &hdr->type);
/*
** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -133,25 +133,25 @@ __glXDispSwap_TexImage3D(GLbyte * pc)
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->imageHeight);
- __GLX_SWAP_INT((GLbyte *) & hdr->imageDepth);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipImages);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipVolumes);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *) & hdr->target);
- __GLX_SWAP_INT((GLbyte *) & hdr->level);
- __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *) & hdr->width);
- __GLX_SWAP_INT((GLbyte *) & hdr->height);
- __GLX_SWAP_INT((GLbyte *) & hdr->depth);
- __GLX_SWAP_INT((GLbyte *) & hdr->size4d);
- __GLX_SWAP_INT((GLbyte *) & hdr->border);
- __GLX_SWAP_INT((GLbyte *) & hdr->format);
- __GLX_SWAP_INT((GLbyte *) & hdr->type);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->imageHeight);
+ __GLX_SWAP_INT((GLbyte *) &hdr->imageDepth);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipImages);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipVolumes);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) &hdr->target);
+ __GLX_SWAP_INT((GLbyte *) &hdr->level);
+ __GLX_SWAP_INT((GLbyte *) &hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) &hdr->width);
+ __GLX_SWAP_INT((GLbyte *) &hdr->height);
+ __GLX_SWAP_INT((GLbyte *) &hdr->depth);
+ __GLX_SWAP_INT((GLbyte *) &hdr->size4d);
+ __GLX_SWAP_INT((GLbyte *) &hdr->border);
+ __GLX_SWAP_INT((GLbyte *) &hdr->format);
+ __GLX_SWAP_INT((GLbyte *) &hdr->type);
/*
** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -167,15 +167,15 @@ __glXDispSwap_DrawPixels(GLbyte * pc)
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
- __GLX_SWAP_INT((GLbyte *) & hdr->width);
- __GLX_SWAP_INT((GLbyte *) & hdr->height);
- __GLX_SWAP_INT((GLbyte *) & hdr->format);
- __GLX_SWAP_INT((GLbyte *) & hdr->type);
+ __GLX_SWAP_INT((GLbyte *) &hdr->width);
+ __GLX_SWAP_INT((GLbyte *) &hdr->height);
+ __GLX_SWAP_INT((GLbyte *) &hdr->format);
+ __GLX_SWAP_INT((GLbyte *) &hdr->type);
/*
** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -191,17 +191,17 @@ __glXDispSwap_TexSubImage1D(GLbyte * pc)
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
- __GLX_SWAP_INT((GLbyte *) & hdr->target);
- __GLX_SWAP_INT((GLbyte *) & hdr->level);
- __GLX_SWAP_INT((GLbyte *) & hdr->xoffset);
- __GLX_SWAP_INT((GLbyte *) & hdr->width);
- __GLX_SWAP_INT((GLbyte *) & hdr->format);
- __GLX_SWAP_INT((GLbyte *) & hdr->type);
+ __GLX_SWAP_INT((GLbyte *) &hdr->target);
+ __GLX_SWAP_INT((GLbyte *) &hdr->level);
+ __GLX_SWAP_INT((GLbyte *) &hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *) &hdr->width);
+ __GLX_SWAP_INT((GLbyte *) &hdr->format);
+ __GLX_SWAP_INT((GLbyte *) &hdr->type);
/*
** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -217,19 +217,19 @@ __glXDispSwap_TexSubImage2D(GLbyte * pc)
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
- __GLX_SWAP_INT((GLbyte *) & hdr->target);
- __GLX_SWAP_INT((GLbyte *) & hdr->level);
- __GLX_SWAP_INT((GLbyte *) & hdr->xoffset);
- __GLX_SWAP_INT((GLbyte *) & hdr->yoffset);
- __GLX_SWAP_INT((GLbyte *) & hdr->width);
- __GLX_SWAP_INT((GLbyte *) & hdr->height);
- __GLX_SWAP_INT((GLbyte *) & hdr->format);
- __GLX_SWAP_INT((GLbyte *) & hdr->type);
+ __GLX_SWAP_INT((GLbyte *) &hdr->target);
+ __GLX_SWAP_INT((GLbyte *) &hdr->level);
+ __GLX_SWAP_INT((GLbyte *) &hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *) &hdr->yoffset);
+ __GLX_SWAP_INT((GLbyte *) &hdr->width);
+ __GLX_SWAP_INT((GLbyte *) &hdr->height);
+ __GLX_SWAP_INT((GLbyte *) &hdr->format);
+ __GLX_SWAP_INT((GLbyte *) &hdr->type);
/*
** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -246,26 +246,26 @@ __glXDispSwap_TexSubImage3D(GLbyte * pc)
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->imageHeight);
- __GLX_SWAP_INT((GLbyte *) & hdr->imageDepth);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipImages);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipVolumes);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *) & hdr->target);
- __GLX_SWAP_INT((GLbyte *) & hdr->level);
- __GLX_SWAP_INT((GLbyte *) & hdr->xoffset);
- __GLX_SWAP_INT((GLbyte *) & hdr->yoffset);
- __GLX_SWAP_INT((GLbyte *) & hdr->zoffset);
- __GLX_SWAP_INT((GLbyte *) & hdr->width);
- __GLX_SWAP_INT((GLbyte *) & hdr->height);
- __GLX_SWAP_INT((GLbyte *) & hdr->depth);
- __GLX_SWAP_INT((GLbyte *) & hdr->size4d);
- __GLX_SWAP_INT((GLbyte *) & hdr->format);
- __GLX_SWAP_INT((GLbyte *) & hdr->type);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->imageHeight);
+ __GLX_SWAP_INT((GLbyte *) &hdr->imageDepth);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipImages);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipVolumes);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) &hdr->target);
+ __GLX_SWAP_INT((GLbyte *) &hdr->level);
+ __GLX_SWAP_INT((GLbyte *) &hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *) &hdr->yoffset);
+ __GLX_SWAP_INT((GLbyte *) &hdr->zoffset);
+ __GLX_SWAP_INT((GLbyte *) &hdr->width);
+ __GLX_SWAP_INT((GLbyte *) &hdr->height);
+ __GLX_SWAP_INT((GLbyte *) &hdr->depth);
+ __GLX_SWAP_INT((GLbyte *) &hdr->size4d);
+ __GLX_SWAP_INT((GLbyte *) &hdr->format);
+ __GLX_SWAP_INT((GLbyte *) &hdr->type);
/*
** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -281,16 +281,16 @@ __glXDispSwap_ColorTable(GLbyte * pc)
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
- __GLX_SWAP_INT((GLbyte *) & hdr->target);
- __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *) & hdr->width);
- __GLX_SWAP_INT((GLbyte *) & hdr->format);
- __GLX_SWAP_INT((GLbyte *) & hdr->type);
+ __GLX_SWAP_INT((GLbyte *) &hdr->target);
+ __GLX_SWAP_INT((GLbyte *) &hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) &hdr->width);
+ __GLX_SWAP_INT((GLbyte *) &hdr->format);
+ __GLX_SWAP_INT((GLbyte *) &hdr->type);
/*
** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -306,16 +306,16 @@ __glXDispSwap_ColorSubTable(GLbyte * pc)
(__GLXdispatchColorSubTableHeader *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
- __GLX_SWAP_INT((GLbyte *) & hdr->target);
- __GLX_SWAP_INT((GLbyte *) & hdr->start);
- __GLX_SWAP_INT((GLbyte *) & hdr->count);
- __GLX_SWAP_INT((GLbyte *) & hdr->format);
- __GLX_SWAP_INT((GLbyte *) & hdr->type);
+ __GLX_SWAP_INT((GLbyte *) &hdr->target);
+ __GLX_SWAP_INT((GLbyte *) &hdr->start);
+ __GLX_SWAP_INT((GLbyte *) &hdr->count);
+ __GLX_SWAP_INT((GLbyte *) &hdr->format);
+ __GLX_SWAP_INT((GLbyte *) &hdr->type);
/*
** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -331,16 +331,16 @@ __glXDispSwap_ConvolutionFilter1D(GLbyte * pc)
(__GLXdispatchConvolutionFilterHeader *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
- __GLX_SWAP_INT((GLbyte *) & hdr->target);
- __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *) & hdr->width);
- __GLX_SWAP_INT((GLbyte *) & hdr->format);
- __GLX_SWAP_INT((GLbyte *) & hdr->type);
+ __GLX_SWAP_INT((GLbyte *) &hdr->target);
+ __GLX_SWAP_INT((GLbyte *) &hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) &hdr->width);
+ __GLX_SWAP_INT((GLbyte *) &hdr->format);
+ __GLX_SWAP_INT((GLbyte *) &hdr->type);
/*
** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -356,17 +356,17 @@ __glXDispSwap_ConvolutionFilter2D(GLbyte * pc)
(__GLXdispatchConvolutionFilterHeader *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
- __GLX_SWAP_INT((GLbyte *) & hdr->target);
- __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *) & hdr->width);
- __GLX_SWAP_INT((GLbyte *) & hdr->height);
- __GLX_SWAP_INT((GLbyte *) & hdr->format);
- __GLX_SWAP_INT((GLbyte *) & hdr->type);
+ __GLX_SWAP_INT((GLbyte *) &hdr->target);
+ __GLX_SWAP_INT((GLbyte *) &hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) &hdr->width);
+ __GLX_SWAP_INT((GLbyte *) &hdr->height);
+ __GLX_SWAP_INT((GLbyte *) &hdr->format);
+ __GLX_SWAP_INT((GLbyte *) &hdr->type);
/*
** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -386,17 +386,17 @@ __glXDispSwap_SeparableFilter2D(GLbyte * pc)
hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
- __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *) & hdr->target);
- __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *) & hdr->width);
- __GLX_SWAP_INT((GLbyte *) & hdr->height);
- __GLX_SWAP_INT((GLbyte *) & hdr->format);
- __GLX_SWAP_INT((GLbyte *) & hdr->type);
+ __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) &hdr->target);
+ __GLX_SWAP_INT((GLbyte *) &hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) &hdr->width);
+ __GLX_SWAP_INT((GLbyte *) &hdr->height);
+ __GLX_SWAP_INT((GLbyte *) &hdr->format);
+ __GLX_SWAP_INT((GLbyte *) &hdr->type);
/*
** Just invert swapBytes flag; the GL will figure out if it needs to swap
diff --git a/xorg-server/hw/kdrive/ephyr/XF86dri.c b/xorg-server/hw/kdrive/ephyr/XF86dri.c
index 74bf67678..9d742f394 100644
--- a/xorg-server/hw/kdrive/ephyr/XF86dri.c
+++ b/xorg-server/hw/kdrive/ephyr/XF86dri.c
@@ -151,7 +151,7 @@ XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
GetReq(XF86DRIQueryVersion, req);
req->reqType = info->codes->major_opcode;
req->driReqType = X_XF86DRIQueryVersion;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
TRACE("QueryVersion... return False");
@@ -181,7 +181,7 @@ XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen, Bool *isCapable)
req->reqType = info->codes->major_opcode;
req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
req->screen = screen;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
TRACE("QueryDirectRenderingCapable... return False");
@@ -210,7 +210,7 @@ XF86DRIOpenConnection(Display * dpy, int screen,
req->reqType = info->codes->major_opcode;
req->driReqType = X_XF86DRIOpenConnection;
req->screen = screen;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
TRACE("OpenConnection... return False");
@@ -260,7 +260,7 @@ XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic)
req->screen = screen;
req->magic = magic;
rep.authenticated = 0;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) {
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse) || !rep.authenticated) {
UnlockDisplay(dpy);
SyncHandle();
TRACE("AuthConnection... return False");
@@ -311,7 +311,7 @@ XF86DRIGetClientDriverName(Display * dpy, int screen,
req->reqType = info->codes->major_opcode;
req->driReqType = X_XF86DRIGetClientDriverName;
req->screen = screen;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
TRACE("GetClientDriverName... return False");
@@ -362,7 +362,7 @@ XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID,
req->screen = screen;
*context = XAllocID(dpy);
req->context = *context;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
TRACE("CreateContext... return False");
@@ -421,7 +421,7 @@ XF86DRICreateDrawable(Display * dpy, int screen,
req->driReqType = X_XF86DRICreateDrawable;
req->screen = screen;
req->drawable = drawable;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
TRACE("CreateDrawable... return False");
@@ -503,7 +503,7 @@ XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
req->screen = screen;
req->drawable = drawable;
- if (!_XReply(dpy, (xReply *) & rep, 1, xFalse)) {
+ if (!_XReply(dpy, (xReply *) &rep, 1, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
TRACE("GetDrawableInfo... return False");
@@ -585,7 +585,7 @@ XF86DRIGetDeviceInfo(Display * dpy, int screen, drm_handle_t * hFrameBuffer,
req->reqType = info->codes->major_opcode;
req->driReqType = X_XF86DRIGetDeviceInfo;
req->screen = screen;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
TRACE("GetDeviceInfo... return False");
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
index 1a98a2dff..144c6e1ac 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
@@ -754,7 +754,7 @@ ProcXF86DRICreateContext(register ClientPtr client)
if (!ephyrDRICreateContext(stuff->screen,
stuff->visual,
&context_id,
- (drm_context_t *) & rep.hHWContext)) {
+ (drm_context_t *) &rep.hHWContext)) {
return BadValue;
}
@@ -964,7 +964,7 @@ ProcXF86DRICreateDrawable(ClientPtr client)
if (!ephyrDRICreateDrawable(stuff->screen,
remote_win,
- (drm_drawable_t *) & rep.hHWDrawable)) {
+ (drm_drawable_t *) &rep.hHWDrawable)) {
EPHYR_LOG_ERROR("failed to create dri drawable\n");
return BadValue;
}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c
index 392489a00..5c6c40f0b 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c
@@ -121,7 +121,7 @@ ephyrHostGLXQueryVersion(int *a_major, int *a_minor)
req->glxCode = X_GLXQueryVersion;
req->majorVersion = 2;
req->minorVersion = 1;
- _XReply(dpy, (xReply *) & reply, 0, False);
+ _XReply(dpy, (xReply *) &reply, 0, False);
UnlockDisplay(dpy);
SyncHandle();
@@ -207,7 +207,7 @@ ephyrHostGLXGetStringFromServer(int a_screen_number,
req->for_whom = default_screen;
req->name = a_string_name;
- _XReply(dpy, (xReply *) & reply, 0, False);
+ _XReply(dpy, (xReply *) &reply, 0, False);
length = reply.length * 4;
if (!length) {
@@ -303,7 +303,7 @@ ephyrHostGLXGetVisualConfigsInternal(enum VisualConfRequestType a_type,
break;
}
- if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
EPHYR_LOG_ERROR("unknown error\n");
UnlockDisplay(dpy);
goto out;
@@ -615,7 +615,7 @@ ephyrHostGLXMakeCurrent(int a_drawable, int a_readable,
}
memset(&reply, 0, sizeof(reply));
- if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
EPHYR_LOG_ERROR("failed to get reply from host\n");
UnlockDisplay(dpy);
SyncHandle();
@@ -735,7 +735,7 @@ ephyrHostIsContextDirect(int a_ctxt_id, int *a_is_direct)
req->reqType = major_opcode;
req->glxCode = X_GLXIsDirect;
req->context = remote_glx_ctxt_id;
- if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
EPHYR_LOG_ERROR("fail in reading reply from host\n");
UnlockDisplay(dpy);
SyncHandle();
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c
index 410e6b6e4..a4f25c159 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c
@@ -73,7 +73,7 @@ ephyrHostProxyDoForward(pointer a_request_buffer,
GetXReq(forward_req);
memmove(forward_req, in_req, 4);
- if (!_XReply(dpy, (xReply *) & reply, 0, FALSE)) {
+ if (!_XReply(dpy, (xReply *) &reply, 0, FALSE)) {
EPHYR_LOG_ERROR("failed to get reply\n");
goto out;
}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c
index 05a821b39..362aa055e 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c
@@ -304,7 +304,7 @@ ephyrHostXVAdaptorArrayAt(const EphyrHostXVAdaptorArray * a_this, int a_index)
if (a_index >= a_this->nb_adaptors)
return NULL;
- return (EphyrHostXVAdaptor *) & a_this->adaptors[a_index];
+ return (EphyrHostXVAdaptor *) &a_this->adaptors[a_index];
}
char
@@ -668,7 +668,7 @@ ephyrHostXVQueryImageAttributes(int a_port_id,
/*
* read the reply
*/
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
EPHYR_LOG_ERROR("QeryImageAttribute req failed\n");
goto out;
}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrvideo.c b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
index 67eadd121..55dbd2e3a 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
@@ -495,7 +495,7 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
port_priv_offset = a_this->adaptors[i].nPorts;
for (j = 0; j < a_this->adaptors[i].nPorts; j++) {
EphyrPortPriv *port_privs_base =
- (EphyrPortPriv *) & a_this->adaptors[i].
+ (EphyrPortPriv *) &a_this->adaptors[i].
pPortPrivates[port_priv_offset];
EphyrPortPriv *port_priv = &port_privs_base[j];
diff --git a/xorg-server/hw/xfree86/common/xf86cmap.c b/xorg-server/hw/xfree86/common/xf86cmap.c
index 25f84e579..85f35f8db 100644
--- a/xorg-server/hw/xfree86/common/xf86cmap.c
+++ b/xorg-server/hw/xfree86/common/xf86cmap.c
@@ -608,7 +608,7 @@ CMapRefreshColors(ColormapPtr pmap, int defs, int *indices)
case GrayScale:
for (i = 0; i < defs; i++) {
index = indices[i];
- entry = (EntryPtr) & pmap->red[index];
+ entry = (EntryPtr) &pmap->red[index];
if (entry->fShared) {
colors[index].red =
diff --git a/xorg-server/hw/xfree86/dri/xf86dri.c b/xorg-server/hw/xfree86/dri/xf86dri.c
index 0b2e8fa1b..086e833ed 100644
--- a/xorg-server/hw/xfree86/dri/xf86dri.c
+++ b/xorg-server/hw/xfree86/dri/xf86dri.c
@@ -280,7 +280,7 @@ ProcXF86DRICreateContext(register ClientPtr client)
if (!DRICreateContext(pScreen,
NULL,
- stuff->context, (drm_context_t *) & rep.hHWContext)) {
+ stuff->context, (drm_context_t *) &rep.hHWContext)) {
return BadValue;
}
@@ -329,7 +329,7 @@ ProcXF86DRICreateDrawable(ClientPtr client)
return rc;
if (!DRICreateDrawable(screenInfo.screens[stuff->screen], client,
- pDrawable, (drm_drawable_t *) & rep.hHWDrawable)) {
+ pDrawable, (drm_drawable_t *) &rep.hHWDrawable)) {
return BadValue;
}
diff --git a/xorg-server/hw/xfree86/i2c/fi1236.c b/xorg-server/hw/xfree86/i2c/fi1236.c
index 282fe7e34..2eb27ba6d 100644
--- a/xorg-server/hw/xfree86/i2c/fi1236.c
+++ b/xorg-server/hw/xfree86/i2c/fi1236.c
@@ -91,7 +91,7 @@ MT2032_getid(FI1236Ptr f)
CARD8 in;
in = 0x11;
- I2C_WriteRead(&(f->d), (I2CByte *) & in, 1, out, 4);
+ I2C_WriteRead(&(f->d), (I2CByte *) &in, 1, out, 4);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: Company code 0x%02x%02x, part code 0x%02x, revision code 0x%02x\n",
out[0], out[1], out[2], out[3]);
@@ -432,7 +432,7 @@ MT2032_get_afc_hint(FI1236Ptr f)
CARD8 AFC;
in = 0x0e;
- I2C_WriteRead(&(f->d), (I2CByte *) & in, 1, out, 2);
+ I2C_WriteRead(&(f->d), (I2CByte *) &in, 1, out, 2);
AFC = (out[0] >> 4) & 0x7;
#if 0
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC=%d TAD1=%d TAD2=%d\n",
@@ -467,7 +467,7 @@ MT2032_dump_status(FI1236Ptr f)
CARD8 TAD2, TAD1;
in = 0x0e;
- I2C_WriteRead(&(f->d), (I2CByte *) & in, 1, out, 2);
+ I2C_WriteRead(&(f->d), (I2CByte *) &in, 1, out, 2);
XOK = out[0] & 1;
LO1LK = (out[0] >> 2) & 1;
LO2LK = (out[0] >> 1) & 1;
@@ -589,12 +589,12 @@ FI1236_tune(FI1236Ptr f, CARD32 frequency)
if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W)) {
f->tuner_data.aux = 0x20;
- I2C_WriteRead(&(f->d), (I2CByte *) & (f->tuner_data), 5, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) &(f->tuner_data), 5, NULL, 0);
I2C_WriteRead(&(f->d), NULL, 0, &data, 1);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Tuner status %x\n", data);
}
else
- I2C_WriteRead(&(f->d), (I2CByte *) & (f->tuner_data), 4, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) &(f->tuner_data), 4, NULL, 0);
}
void
diff --git a/xorg-server/hw/xfree86/i2c/tda9850.c b/xorg-server/hw/xfree86/i2c/tda9850.c
index c2ce6971f..d258bda05 100644
--- a/xorg-server/hw/xfree86/i2c/tda9850.c
+++ b/xorg-server/hw/xfree86/i2c/tda9850.c
@@ -131,6 +131,6 @@ tda9850_getstatus(TDA9850Ptr t)
{
CARD16 status;
- I2C_WriteRead(&(t->d), NULL, 0, (I2CByte *) & status, 2);
+ I2C_WriteRead(&(t->d), NULL, 0, (I2CByte *) &status, 2);
return status;
}
diff --git a/xorg-server/hw/xquartz/GL/visualConfigs.c b/xorg-server/hw/xquartz/GL/visualConfigs.c
index e37eefbe4..03486cd66 100644
--- a/xorg-server/hw/xquartz/GL/visualConfigs.c
+++ b/xorg-server/hw/xquartz/GL/visualConfigs.c
@@ -58,40 +58,38 @@
#include "darwinfb.h"
/* Based originally on code from indirect.c which was based on code from i830_dri.c. */
-__GLXconfig *
-__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
-{
+__GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) {
int numConfigs = 0;
__GLXconfig *visualConfigs, *c;
struct glCapabilities caps;
struct glCapabilitiesConfig *conf;
int stereo, depth, aux, buffers, stencil, accum, color, msample;
- if (getGlCapabilities(&caps)) {
+ if(getGlCapabilities(&caps)) {
ErrorF("error from getGlCapabilities()!\n");
return NULL;
}
/*
- conf->stereo is 0 or 1, but we need at least 1 iteration of the loop,
- so we treat a true conf->stereo as 2.
+ conf->stereo is 0 or 1, but we need at least 1 iteration of the loop,
+ so we treat a true conf->stereo as 2.
- The depth size is 0 or 24. Thus we do 2 iterations for that.
+ The depth size is 0 or 24. Thus we do 2 iterations for that.
- conf->aux_buffers (when available/non-zero) result in 2 iterations instead of 1.
+ conf->aux_buffers (when available/non-zero) result in 2 iterations instead of 1.
- conf->buffers indicates whether we have single or double buffering.
+ conf->buffers indicates whether we have single or double buffering.
- conf->total_stencil_bit_depths
+ conf->total_stencil_bit_depths
- conf->total_color_buffers indicates the RGB/RGBA color depths.
+ conf->total_color_buffers indicates the RGB/RGBA color depths.
- conf->total_accum_buffers iterations for accum (with at least 1 if equal to 0)
+ conf->total_accum_buffers iterations for accum (with at least 1 if equal to 0)
- conf->total_depth_buffer_depths
+ conf->total_depth_buffer_depths
- conf->multisample_buffers iterations (with at least 1 if equal to 0). We add 1
- for the 0 multisampling config.
+ conf->multisample_buffers iterations (with at least 1 if equal to 0). We add 1
+ for the 0 multisampling config.
*/
@@ -99,57 +97,43 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
numConfigs = 0;
- for (conf = caps.configurations; conf; conf = conf->next) {
- if (conf->total_color_buffers <= 0)
+ for(conf = caps.configurations; conf; conf = conf->next) {
+ if(conf->total_color_buffers <= 0)
continue;
numConfigs += (conf->stereo ? 2 : 1)
- * (conf->aux_buffers ? 2 : 1)
- * conf->buffers
- * ((conf->total_stencil_bit_depths >
- 0) ? conf->total_stencil_bit_depths : 1)
- * conf->total_color_buffers
- * ((conf->total_accum_buffers >
- 0) ? conf->total_accum_buffers : 1)
- * conf->total_depth_buffer_depths
- * (conf->multisample_buffers + 1);
+ * (conf->aux_buffers ? 2 : 1)
+ * conf->buffers
+ * ((conf->total_stencil_bit_depths > 0) ? conf->total_stencil_bit_depths : 1)
+ * conf->total_color_buffers
+ * ((conf->total_accum_buffers > 0) ? conf->total_accum_buffers : 1)
+ * conf->total_depth_buffer_depths
+ * (conf->multisample_buffers + 1);
}
- if (numConfigsPtr)
+ if(numConfigsPtr)
*numConfigsPtr = numConfigs;
visualConfigs = calloc(sizeof(*visualConfigs), numConfigs);
- if (NULL == visualConfigs) {
+ if(NULL == visualConfigs) {
ErrorF("xcalloc failure when allocating visualConfigs\n");
freeGlCapabilities(&caps);
return NULL;
}
c = visualConfigs; /* current buffer */
- for (conf = caps.configurations; conf; conf = conf->next) {
- for (stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
- for (aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) {
- for (buffers = 0; buffers < conf->buffers; ++buffers) {
- for (stencil = 0;
- stencil < ((conf->total_stencil_bit_depths > 0) ?
- conf->
- total_stencil_bit_depths : 1);
- ++stencil) {
- for (color = 0; color < conf->total_color_buffers;
- ++color) {
- for (accum = 0;
- accum < ((conf->total_accum_buffers > 0) ?
- conf->
- total_accum_buffers : 1);
- ++accum) {
- for (depth = 0;
- depth < conf->total_depth_buffer_depths;
- ++depth) {
- for (msample = 0;
- msample <
- (conf->multisample_buffers + 1);
- ++msample) {
+ for(conf = caps.configurations; conf; conf = conf->next) {
+ for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
+ for(aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) {
+ for(buffers = 0; buffers < conf->buffers; ++buffers) {
+ for(stencil = 0; stencil < ((conf->total_stencil_bit_depths > 0) ?
+ conf->total_stencil_bit_depths : 1); ++stencil) {
+ for(color = 0; color < conf->total_color_buffers; ++color) {
+ for(accum = 0; accum < ((conf->total_accum_buffers > 0) ?
+ conf->total_accum_buffers : 1); ++accum) {
+ for(depth = 0; depth < conf->total_depth_buffer_depths; ++depth) {
+ for(msample = 0; msample < (conf->multisample_buffers + 1); ++msample) {
// Global
c->visualID = -1;
@@ -162,12 +146,10 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
c->indexBits = 0;
c->pixmapMode = 0; // TODO: What should this be?
- if (conf->accelerated) {
+ if(conf->accelerated) {
c->visualRating = GLX_NONE;
- }
- else {
- c->visualRating =
- GLX_SLOW_VISUAL_EXT;
+ } else {
+ c->visualRating = GLX_SLOW_VISUAL_EXT;
}
c->transparentPixel = GLX_NONE;
@@ -179,91 +161,52 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
c->visualSelectGroup = 0;
- c->swapMethod =
- GLX_SWAP_UNDEFINED_OML;
+ c->swapMethod = GLX_SWAP_UNDEFINED_OML;
// Stereo
c->stereoMode = stereo ? TRUE : FALSE;
// Aux buffers
- c->numAuxBuffers =
- aux ? conf->aux_buffers : 0;
+ c->numAuxBuffers = aux ? conf->aux_buffers : 0;
// Double Buffered
- c->doubleBufferMode =
- buffers ? TRUE : FALSE;
+ c->doubleBufferMode = buffers ? TRUE : FALSE;
// Stencil Buffer
- if (conf->total_stencil_bit_depths >
- 0) {
- c->stencilBits =
- conf->stencil_bit_depths[
- stencil];
- }
- else {
+ if(conf->total_stencil_bit_depths > 0) {
+ c->stencilBits = conf->stencil_bit_depths[stencil];
+ } else {
c->stencilBits = 0;
}
// Color
- if (GLCAPS_COLOR_BUF_INVALID_VALUE !=
- conf->color_buffers[color].a) {
- c->alphaBits =
- conf->color_buffers[color].a;
- }
- else {
+ if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->color_buffers[color].a) {
+ c->alphaBits = conf->color_buffers[color].a;
+ } else {
c->alphaBits = 0;
}
- c->redBits =
- conf->color_buffers[color].r;
- c->greenBits =
- conf->color_buffers[color].g;
- c->blueBits =
- conf->color_buffers[color].b;
-
- c->rgbBits = c->alphaBits +
- c->redBits +
- c->greenBits +
- c->blueBits;
-
- c->alphaMask =
- AM_ARGB(c->alphaBits, c->redBits,
- c->greenBits,
- c->blueBits);
- c->redMask =
- RM_ARGB(c->alphaBits, c->redBits,
- c->greenBits,
- c->blueBits);
- c->greenMask =
- GM_ARGB(c->alphaBits, c->redBits,
- c->greenBits,
- c->blueBits);
- c->blueMask =
- BM_ARGB(c->alphaBits, c->redBits,
- c->greenBits,
- c->blueBits);
+ c->redBits = conf->color_buffers[color].r;
+ c->greenBits = conf->color_buffers[color].g;
+ c->blueBits = conf->color_buffers[color].b;
+
+ c->rgbBits = c->alphaBits + c->redBits + c->greenBits + c->blueBits;
+
+ c->alphaMask = AM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
+ c->redMask = RM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
+ c->greenMask = GM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
+ c->blueMask = BM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
// Accumulation Buffers
- if (conf->total_accum_buffers > 0) {
- c->accumRedBits =
- conf->accum_buffers[accum].r;
- c->accumGreenBits =
- conf->accum_buffers[accum].g;
- c->accumBlueBits =
- conf->accum_buffers[accum].b;
- if (
- GLCAPS_COLOR_BUF_INVALID_VALUE
- !=
- conf->accum_buffers[accum].a)
- {
- c->accumAlphaBits =
- conf->accum_buffers[accum
- ].a;
- }
- else {
+ if(conf->total_accum_buffers > 0) {
+ c->accumRedBits = conf->accum_buffers[accum].r;
+ c->accumGreenBits = conf->accum_buffers[accum].g;
+ c->accumBlueBits = conf->accum_buffers[accum].b;
+ if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) {
+ c->accumAlphaBits = conf->accum_buffers[accum].a;
+ } else {
c->accumAlphaBits = 0;
}
- }
- else {
+ } else {
c->accumRedBits = 0;
c->accumGreenBits = 0;
c->accumBlueBits = 0;
@@ -271,17 +214,13 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
}
// Depth
- c->depthBits =
- conf->depth_buffers[depth];
+ c->depthBits = conf->depth_buffers[depth];
// MultiSample
- if (msample > 0) {
- c->samples =
- conf->multisample_samples;
- c->sampleBuffers =
- conf->multisample_buffers;
- }
- else {
+ if(msample > 0) {
+ c->samples = conf->multisample_samples;
+ c->sampleBuffers = conf->multisample_buffers;
+ } else {
c->samples = 0;
c->sampleBuffers = 0;
}
@@ -291,9 +230,7 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
* GLXPbuffers in direct mode.
*/
/* SGIX_fbconfig / GLX 1.3 */
- c->drawableType = GLX_WINDOW_BIT |
- GLX_PIXMAP_BIT |
- GLX_PBUFFER_BIT;
+ c->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;
c->renderType = GLX_RGBA_BIT;
c->xRenderable = GL_TRUE;
c->fbconfigID = -1;
@@ -310,8 +247,7 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
*/
c->maxPbufferWidth = 8192;
c->maxPbufferHeight = 8192;
- c->maxPbufferPixels =
- /*Do we need this?*/ 0;
+ c->maxPbufferPixels = /*Do we need this?*/ 0;
/*
* There is no introspection for this sort of thing
* with CGL. What should we do realistically?
@@ -337,12 +273,10 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
}
}
- (c - 1)->next = NULL;
+ (c-1)->next = NULL;
if (c - visualConfigs != numConfigs) {
- FatalError(
- "numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n",
- numConfigs, (int)(c - visualConfigs));
+ FatalError("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", numConfigs, (int)(c - visualConfigs));
}
freeGlCapabilities(&caps);
diff --git a/xorg-server/hw/xquartz/darwin.c b/xorg-server/hw/xquartz/darwin.c
index bf511801d..e0983d6ef 100644
--- a/xorg-server/hw/xquartz/darwin.c
+++ b/xorg-server/hw/xquartz/darwin.c
@@ -230,13 +230,15 @@ DarwinScreenInit(ScreenPtr pScreen, int argc, char **argv)
}
// TODO: Make PseudoColor visuals not suck in TrueColor mode
- // if(dfb->depth > 8)
- // miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0);
- if (dfb->depth > 15)
- miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor,
- RM_ARGB(0, 5, 5, 5), GM_ARGB(0, 5, 5,
- 5),
- BM_ARGB(0, 5, 5, 5));
+ // if(dfb->depth > 8)
+ // miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0);
+ //
+ // TODO: Re-add support for 15bit
+ // if (dfb->depth > 15)
+ // miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor,
+ // RM_ARGB(0, 5, 5, 5), GM_ARGB(0, 5, 5,
+ // 5),
+ // BM_ARGB(0, 5, 5, 5));
if (dfb->depth > 24)
miSetVisualTypesAndMasks(24, TrueColorMask, 8, TrueColor,
RM_ARGB(0, 8, 8, 8), GM_ARGB(0, 8, 8,
diff --git a/xorg-server/hw/xquartz/xpr/xprScreen.c b/xorg-server/hw/xquartz/xpr/xprScreen.c
index efe2aa882..e37601995 100644
--- a/xorg-server/hw/xquartz/xpr/xprScreen.c
+++ b/xorg-server/hw/xquartz/xpr/xprScreen.c
@@ -359,6 +359,10 @@ have_depth:
dfb->blueMask = 0;
break;
+#if 0
+ // Removed because Mountain Lion removed support for
+ // 15bit backing stores. We can possibly re-add
+ // this once libXplugin is updated to work around it.
case 15:
dfb->visuals = TrueColorMask; //LARGE_VISUALS;
dfb->preferredCVC = TrueColor;
@@ -369,6 +373,7 @@ have_depth:
dfb->greenMask = GM_ARGB(0, 5, 5, 5);
dfb->blueMask = BM_ARGB(0, 5, 5, 5);
break;
+#endif
// case 24:
default:
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c
index 0c638df1d..a35721e74 100644
--- a/xorg-server/hw/xwin/InitOutput.c
+++ b/xorg-server/hw/xwin/InitOutput.c
@@ -1072,7 +1072,7 @@ winCheckDisplayNumber(void)
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) & lpMsgBuf, 0, NULL);
+ (LPTSTR) &lpMsgBuf, 0, NULL);
ErrorF("winCheckDisplayNumber - CreateMutex failed: %s\n",
(LPSTR) lpMsgBuf);
LocalFree(lpMsgBuf);
diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c
index 10da5b515..37a03ff00 100755
--- a/xorg-server/hw/xwin/glx/indirect.c
+++ b/xorg-server/hw/xwin/glx/indirect.c
@@ -256,7 +256,7 @@ glxWinErrorMessage(void)
if (!FormatMessage
(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, last_error, 0,
- (LPTSTR) & errorbuffer, sizeof(errorbuffer), NULL)) {
+ (LPTSTR) &errorbuffer, sizeof(errorbuffer), NULL)) {
snprintf(errorbuffer, sizeof(errorbuffer), "Unknown error");
}
@@ -1532,7 +1532,7 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
}
draw->hDIB =
- CreateDIBSection(draw->dibDC, (BITMAPINFO *) & bmpHeader,
+ CreateDIBSection(draw->dibDC, (BITMAPINFO *) &bmpHeader,
DIB_RGB_COLORS, &pBits, 0, 0);
if (draw->dibDC == NULL) {
ErrorF("CreateDIBSection error: %s\n", glxWinErrorMessage());
diff --git a/xorg-server/hw/xwin/winclipboardxevents.c b/xorg-server/hw/xwin/winclipboardxevents.c
index 4bb6c12fa..4aff0659b 100644
--- a/xorg-server/hw/xwin/winclipboardxevents.c
+++ b/xorg-server/hw/xwin/winclipboardxevents.c
@@ -167,7 +167,7 @@ winClipboardFlushXEvents(HWND hwnd,
*/
iReturn = XSendEvent(pDisplay,
eventSelection.requestor,
- False, 0L, (XEvent *) & eventSelection);
+ False, 0L, (XEvent *) &eventSelection);
if (iReturn == BadValue || iReturn == BadWindow) {
ErrorF("winClipboardFlushXEvents - SelectionRequest - "
"XSendEvent () failed\n");
@@ -362,7 +362,7 @@ winClipboardFlushXEvents(HWND hwnd,
/* Notify the requesting window that the operation has completed */
iReturn = XSendEvent(pDisplay,
eventSelection.requestor,
- False, 0L, (XEvent *) & eventSelection);
+ False, 0L, (XEvent *) &eventSelection);
if (iReturn == BadValue || iReturn == BadWindow) {
ErrorF("winClipboardFlushXEvents - SelectionRequest - "
"XSendEvent () failed\n");
@@ -401,7 +401,7 @@ winClipboardFlushXEvents(HWND hwnd,
/* Notify the requesting window that the operation is complete */
iReturn = XSendEvent(pDisplay,
eventSelection.requestor,
- False, 0L, (XEvent *) & eventSelection);
+ False, 0L, (XEvent *) &eventSelection);
if (iReturn == BadValue || iReturn == BadWindow) {
/*
* Should not be a problem if XSendEvent fails because
diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c
index 77cf1c13f..8e8c6fd3d 100644..100755
--- a/xorg-server/hw/xwin/wincursor.c
+++ b/xorg-server/hw/xwin/wincursor.c
@@ -103,7 +103,7 @@ winPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
/* Translate the client area coords to screen coords */
MapWindowPoints(pScreenPriv->hwndScreen,
- HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+ HWND_DESKTOP, (LPPOINT) &rcClient, 2);
/*
* Update the Windows cursor position so that we don't
@@ -274,7 +274,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
if (!lpBits) {
/* Bicolor, use a palettized DIB */
winDebug("winLoadCursor: Trying two color cursor\n");
- pbmi = (BITMAPINFO *) & bi;
+ pbmi = (BITMAPINFO *) &bi;
memset(pbmi, 0, sizeof(BITMAPINFOHEADER));
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pbmi->bmiHeader.biWidth = pScreenPriv->cursor.sm_cx;
@@ -357,7 +357,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
CreateCompatibleBitmap(hDC, pScreenPriv->cursor.sm_cx,
pScreenPriv->cursor.sm_cy);
SetDIBits(hDC, hXor, 0, pScreenPriv->cursor.sm_cy, lpBits,
- (BITMAPINFO *) & bi, DIB_RGB_COLORS);
+ (BITMAPINFO *) &bi, DIB_RGB_COLORS);
ReleaseDC(NULL, hDC);
}
free(lpBits);
diff --git a/xorg-server/hw/xwin/winengine.c b/xorg-server/hw/xwin/winengine.c
index cf8a526a5..e597e2c49 100644
--- a/xorg-server/hw/xwin/winengine.c
+++ b/xorg-server/hw/xwin/winengine.c
@@ -108,7 +108,7 @@ winDetectSupportedEngines(void)
/* Try to query for DirectDraw4 interface */
ddrval = IDirectDraw_QueryInterface(lpdd,
&IID_IDirectDraw4,
- (LPVOID *) & lpdd4);
+ (LPVOID *) &lpdd4);
if (SUCCEEDED(ddrval)) {
/* We have DirectDraw4 */
winDebug (
diff --git a/xorg-server/hw/xwin/wingc.c b/xorg-server/hw/xwin/wingc.c
index 259d2e29d..aba398d0a 100644
--- a/xorg-server/hw/xwin/wingc.c
+++ b/xorg-server/hw/xwin/wingc.c
@@ -89,8 +89,8 @@ winCreateGCNativeGDI(GCPtr pGC)
winDebug ("winCreateGCNativeGDI - depth: %d\n", pGC->depth);
- pGC->ops = (GCOps *) & winGCOps;
- pGC->funcs = (GCFuncs *) & winGCFuncs;
+ pGC->ops = (GCOps *) &winGCOps;
+ pGC->funcs = (GCFuncs *) &winGCFuncs;
/* We want all coordinates passed to spans functions to be screen relative */
pGC->miTranslate = TRUE;
diff --git a/xorg-server/hw/xwin/winmsg.c b/xorg-server/hw/xwin/winmsg.c
index 3b08d4fde..7831a3b36 100644..100755
--- a/xorg-server/hw/xwin/winmsg.c
+++ b/xorg-server/hw/xwin/winmsg.c
@@ -82,7 +82,7 @@ winW32ErrorEx(const char *msg, DWORD errorcode)
NULL,
errorcode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) & buffer, 0, NULL)) {
+ (LPTSTR) &buffer, 0, NULL)) {
ErrorF(msg);
ErrorF("Unknown error in FormatMessage!\n");
}
diff --git a/xorg-server/hw/xwin/winmultiwindowicons.c b/xorg-server/hw/xwin/winmultiwindowicons.c
index 28bf35303..2e0c82604 100644
--- a/xorg-server/hw/xwin/winmultiwindowicons.c
+++ b/xorg-server/hw/xwin/winmultiwindowicons.c
@@ -255,7 +255,7 @@ NetWMToWinIconAlpha(uint32_t * icon)
ii.fIcon = TRUE;
ii.xHotspot = 0; /* ignored */
ii.yHotspot = 0; /* ignored */
- ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO *) & bmh,
+ ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO *) &bmh,
DIB_RGB_COLORS, (void **) &DIB_pixels, NULL,
0);
ReleaseDC(NULL, hdc);
diff --git a/xorg-server/hw/xwin/winmultiwindowshape.c b/xorg-server/hw/xwin/winmultiwindowshape.c
index 26cd715bc..0a00e79ee 100644
--- a/xorg-server/hw/xwin/winmultiwindowshape.c
+++ b/xorg-server/hw/xwin/winmultiwindowshape.c
@@ -133,7 +133,7 @@ winReshapeMultiWindow(WindowPtr pWin)
/* Translate client rectangle coords to screen coords */
/* NOTE: Only transforms top and left members */
- ClientToScreen(pWinPriv->hWnd, (LPPOINT) & rcClient);
+ ClientToScreen(pWinPriv->hWnd, (LPPOINT) &rcClient);
/* Get window rectangle */
if (!GetWindowRect(pWinPriv->hWnd, &rcWindow)) {
diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c
index 44da5041f..7ceee11a5 100644
--- a/xorg-server/hw/xwin/winmultiwindowwndproc.c
+++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c
@@ -488,7 +488,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) & lpMsgBuf, 0, NULL);
+ (LPTSTR) &lpMsgBuf, 0, NULL);
ErrorF("winTopLevelWindowProc - BitBlt failed: %s\n",
(LPSTR) lpMsgBuf);
diff --git a/xorg-server/hw/xwin/winpfbdd.c b/xorg-server/hw/xwin/winpfbdd.c
index e2ed49af8..53056e177 100644
--- a/xorg-server/hw/xwin/winpfbdd.c
+++ b/xorg-server/hw/xwin/winpfbdd.c
@@ -78,7 +78,7 @@ winAllocateFBPrimaryDD(ScreenPtr pScreen)
/* Get client area location in screen coords */
GetClientRect(pScreenPriv->hwndScreen, &rcClient);
MapWindowPoints(pScreenPriv->hwndScreen,
- HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+ HWND_DESKTOP, (LPPOINT) &rcClient, 2);
/* Create a DirectDraw object, store the address at lpdd */
ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL);
@@ -88,7 +88,7 @@ winAllocateFBPrimaryDD(ScreenPtr pScreen)
/* Get a DirectDraw2 interface pointer */
ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd,
&IID_IDirectDraw2,
- (LPVOID *) & pScreenPriv->pdd2);
+ (LPVOID *) &pScreenPriv->pdd2);
if (FAILED(ddrval)) {
ErrorF("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
(unsigned int) ddrval);
@@ -461,7 +461,7 @@ winActivateAppPrimaryDD(ScreenPtr pScreen)
/* Get client area in screen coords */
GetClientRect(pScreenPriv->hwndScreen, &rcClient);
MapWindowPoints(pScreenPriv->hwndScreen,
- HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+ HWND_DESKTOP, (LPPOINT) &rcClient, 2);
/* Setup a source rectangle */
rcSrc.left = 0;
@@ -526,7 +526,7 @@ winHotKeyAltTabPrimaryDD(ScreenPtr pScreen)
/* Get client area in screen coords */
GetClientRect(pScreenPriv->hwndScreen, &rcClient);
MapWindowPoints(pScreenPriv->hwndScreen,
- HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+ HWND_DESKTOP, (LPPOINT) &rcClient, 2);
/* Did we loose the primary surface? */
ddrval = IDirectDrawSurface2_IsLost(pScreenPriv->pddsPrimary);
diff --git a/xorg-server/hw/xwin/winpixmap.c b/xorg-server/hw/xwin/winpixmap.c
index ac883a84c..43c0c3c14 100644
--- a/xorg-server/hw/xwin/winpixmap.c
+++ b/xorg-server/hw/xwin/winpixmap.c
@@ -107,7 +107,7 @@ winCreatePixmapNativeGDI(ScreenPtr pScreen,
/* Create a DIB for the pixmap */
pPixmapPriv->hBitmap = winCreateDIBNativeGDI(iWidth, iHeight, iDepth,
&pPixmapPriv->pbBits,
- (BITMAPINFO **) & pPixmapPriv->
+ (BITMAPINFO **) &pPixmapPriv->
pbmih);
winDebug("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for "
diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c
index c0426ac0b..c6fddaf9b 100644..100755
--- a/xorg-server/hw/xwin/winscrinit.c
+++ b/xorg-server/hw/xwin/winscrinit.c
@@ -539,7 +539,7 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
&pScreenPriv->ptWMProc,
&pScreenPriv->ptXMsgProc,
&pScreenPriv->pmServerStarted,
- pScreenInfo->dwScreen, (HWND) & pScreenPriv->hwndScreen,
+ pScreenInfo->dwScreen, (HWND) &pScreenPriv->hwndScreen,
#ifdef XWIN_MULTIWINDOWINTWM
pScreenInfo->fInternalWM ||
#endif
diff --git a/xorg-server/hw/xwin/winsetsp.c b/xorg-server/hw/xwin/winsetsp.c
index fb9105132..001e50e11 100644..100755
--- a/xorg-server/hw/xwin/winsetsp.c
+++ b/xorg-server/hw/xwin/winsetsp.c
@@ -112,7 +112,7 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
0, 0,
*piWidths, 1,
pSrcs,
- (BITMAPINFO*)&bmi,
+ (BITMAPINFO *) &bmi,
DIB_RGB_COLORS, g_copyROP[pGC->alu]);
pSrcs += PixmapBytePad(*piWidths, pDrawable->depth);
@@ -155,7 +155,7 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
0, 0,
*piWidths, 1,
pSrcs,
- (BITMAPINFO *) & bmi,
+ (BITMAPINFO *) &bmi,
DIB_RGB_COLORS, g_copyROP[pGC->alu]);
pSrcs += PixmapBytePad(*piWidths, pDrawable->depth);
diff --git a/xorg-server/hw/xwin/winshaddd.c b/xorg-server/hw/xwin/winshaddd.c
index e35fe394c..5a117aace 100644
--- a/xorg-server/hw/xwin/winshaddd.c
+++ b/xorg-server/hw/xwin/winshaddd.c
@@ -220,7 +220,7 @@ winAllocateFBShadowDD(ScreenPtr pScreen)
/* Get a DirectDraw2 interface pointer */
ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd,
&IID_IDirectDraw2,
- (LPVOID *) & pScreenPriv->pdd2);
+ (LPVOID *) &pScreenPriv->pdd2);
if (FAILED(ddrval)) {
ErrorF("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
(unsigned int) ddrval);
@@ -487,7 +487,7 @@ winShadowUpdateDD(ScreenPtr pScreen, shadowBufPtr pBuf)
ptOrigin.x = pScreenInfo->dwXOffset;
ptOrigin.y = pScreenInfo->dwYOffset;
MapWindowPoints(pScreenPriv->hwndScreen,
- HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+ HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
/* Unlock the shadow surface, so we can blit */
ddrval = IDirectDrawSurface2_Unlock(pScreenPriv->pddsShadow, NULL);
@@ -830,7 +830,7 @@ winBltExposedRegionsShadowDD(ScreenPtr pScreen)
ptOrigin.y = pScreenInfo->dwYOffset;
MapWindowPoints(pScreenPriv->hwndScreen,
- HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+ HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
rcDest.left = ptOrigin.x;
rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
rcDest.top = ptOrigin.y;
@@ -973,7 +973,7 @@ winRedrawScreenShadowDD(ScreenPtr pScreen)
ptOrigin.x = pScreenInfo->dwXOffset;
ptOrigin.y = pScreenInfo->dwYOffset;
MapWindowPoints(pScreenPriv->hwndScreen,
- HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+ HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
rcDest.left = ptOrigin.x;
rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
rcDest.top = ptOrigin.y;
diff --git a/xorg-server/hw/xwin/winshadddnl.c b/xorg-server/hw/xwin/winshadddnl.c
index a50128668..af13aba52 100644
--- a/xorg-server/hw/xwin/winshadddnl.c
+++ b/xorg-server/hw/xwin/winshadddnl.c
@@ -344,7 +344,7 @@ winAllocateFBShadowDDNL(ScreenPtr pScreen)
/* Create a DirectDraw object, store the address at lpdd */
ddrval = (*g_fpDirectDrawCreate) (NULL,
- (LPDIRECTDRAW *) & pScreenPriv->pdd,
+ (LPDIRECTDRAW *) &pScreenPriv->pdd,
NULL);
if (FAILED(ddrval)) {
ErrorF("winAllocateFBShadowDDNL - Could not start "
@@ -357,7 +357,7 @@ winAllocateFBShadowDDNL(ScreenPtr pScreen)
/* Get a DirectDraw4 interface pointer */
ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd,
&IID_IDirectDraw4,
- (LPVOID *) & pScreenPriv->pdd4);
+ (LPVOID *) &pScreenPriv->pdd4);
if (FAILED(ddrval)) {
ErrorF("winAllocateFBShadowDDNL - Failed DD4 query: %08x\n",
(unsigned int) ddrval);
@@ -608,7 +608,7 @@ winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf)
ptOrigin.x = pScreenInfo->dwXOffset;
ptOrigin.y = pScreenInfo->dwYOffset;
MapWindowPoints(pScreenPriv->hwndScreen,
- HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+ HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
/*
* Handle small regions with multiple blits,
@@ -921,7 +921,7 @@ winBltExposedRegionsShadowDDNL(ScreenPtr pScreen)
ptOrigin.y = pScreenInfo->dwYOffset;
MapWindowPoints(pScreenPriv->hwndScreen,
- HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+ HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
rcDest.left = ptOrigin.x;
rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
rcDest.top = ptOrigin.y;
@@ -986,7 +986,7 @@ winRedrawScreenShadowDDNL(ScreenPtr pScreen)
ptOrigin.x = pScreenInfo->dwXOffset;
ptOrigin.y = pScreenInfo->dwYOffset;
MapWindowPoints(pScreenPriv->hwndScreen,
- HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+ HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
rcDest.left = ptOrigin.x;
rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
rcDest.top = ptOrigin.y;
diff --git a/xorg-server/hw/xwin/winshadgdi.c b/xorg-server/hw/xwin/winshadgdi.c
index 6bfe41179..9e981cea7 100644
--- a/xorg-server/hw/xwin/winshadgdi.c
+++ b/xorg-server/hw/xwin/winshadgdi.c
@@ -336,7 +336,7 @@ winAllocateFBShadowGDI(ScreenPtr pScreen)
pScreenPriv->hbmpShadow = CreateDIBSection(pScreenPriv->hdcScreen,
(BITMAPINFO *) pScreenPriv->
pbmih, DIB_RGB_COLORS,
- (VOID **) & pScreenInfo->pfb,
+ (VOID **) &pScreenInfo->pfb,
NULL, 0);
if (pScreenPriv->hbmpShadow == NULL || pScreenInfo->pfb == NULL) {
winW32Error ("winAllocateFBShadowGDI - CreateDIBSection failed:");
diff --git a/xorg-server/hw/xwin/winwin32rootless.c b/xorg-server/hw/xwin/winwin32rootless.c
index 55039bccd..b0de5697d 100644..100755
--- a/xorg-server/hw/xwin/winwin32rootless.c
+++ b/xorg-server/hw/xwin/winwin32rootless.c
@@ -559,7 +559,7 @@ winMWExtWMReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
/* Create region for non-client area */
GetWindowRect(pRLWinPriv->hWnd, &rcWindow);
GetClientRect(pRLWinPriv->hWnd, &rcClient);
- MapWindowPoints(pRLWinPriv->hWnd, HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+ MapWindowPoints(pRLWinPriv->hWnd, HWND_DESKTOP, (LPPOINT) &rcClient, 2);
OffsetRgn(hRgn, rcClient.left - rcWindow.left, rcClient.top - rcWindow.top);
OffsetRect(&rcClient, -rcWindow.left, -rcWindow.top);
OffsetRect(&rcWindow, -rcWindow.left, -rcWindow.top);
@@ -645,7 +645,7 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
hbmpNew = CreateDIBSection(pRLWinPriv->hdcScreen,
(BITMAPINFO *) pRLWinPriv->pbmihShadow,
DIB_RGB_COLORS,
- (VOID **) & pRLWinPriv->pfb, NULL, 0);
+ (VOID **) &pRLWinPriv->pfb, NULL, 0);
if (hbmpNew == NULL || pRLWinPriv->pfb == NULL) {
ErrorF("winMWExtWMStartDrawing - CreateDIBSection failed\n");
//return FALSE;
diff --git a/xorg-server/hw/xwin/winwin32rootlesswndproc.c b/xorg-server/hw/xwin/winwin32rootlesswndproc.c
index 46000efe4..13a9cd645 100644
--- a/xorg-server/hw/xwin/winwin32rootlesswndproc.c
+++ b/xorg-server/hw/xwin/winwin32rootlesswndproc.c
@@ -778,7 +778,7 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) & lpMsgBuf, 0, NULL);
+ (LPTSTR) &lpMsgBuf, 0, NULL);
ErrorF("winMWExtWMWindowProc - BitBlt failed: %s\n",
(LPSTR) lpMsgBuf);
@@ -1052,7 +1052,7 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (!pRLWinPriv->fMovingOrSizing
/*&& (pWinPos->flags & SWP_SHOWWINDOW) */ ) {
GetClientRect(hwnd, &rcClient);
- MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+ MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT) &rcClient, 2);
if (!(pWinPos->flags & SWP_NOMOVE)
&& !(pWinPos->flags & SWP_NOSIZE)) {
@@ -1252,7 +1252,7 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
GetClientRect(hwnd, &rcClient);
- MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+ MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT) &rcClient, 2);
#ifdef XWIN_MULTIWINDOWINTWM
if (winIsInternalWMRunning(pScreenInfo))
diff --git a/xorg-server/include/dix-config.h.in b/xorg-server/include/dix-config.h.in
index b270a3238..e1cb9eb51 100644
--- a/xorg-server/include/dix-config.h.in
+++ b/xorg-server/include/dix-config.h.in
@@ -429,6 +429,9 @@
/* Define to 1 if typeof works with your compiler. */
#undef HAVE_TYPEOF
+/* Define to __typeof__ if your compiler spells it that way. */
+#undef typeof
+
/* The compiler supported TLS storage class, prefering initial-exec if tls_model is supported */
#undef TLS
diff --git a/xorg-server/include/events.h b/xorg-server/include/events.h
index 222bf328b..c0ef45d5f 100644
--- a/xorg-server/include/events.h
+++ b/xorg-server/include/events.h
@@ -27,6 +27,7 @@
typedef struct _DeviceEvent DeviceEvent;
typedef struct _DeviceChangedEvent DeviceChangedEvent;
typedef struct _TouchOwnershipEvent TouchOwnershipEvent;
+typedef struct _BarrierEvent BarrierEvent;
#if XFreeXDGA
typedef struct _DGAEvent DGAEvent;
diff --git a/xorg-server/include/eventstr.h b/xorg-server/include/eventstr.h
index dd6fbeffb..38fab4f3c 100644
--- a/xorg-server/include/eventstr.h
+++ b/xorg-server/include/eventstr.h
@@ -72,6 +72,8 @@ enum EventType {
ET_RawTouchUpdate,
ET_RawTouchEnd,
ET_XQuartz,
+ ET_BarrierHit,
+ ET_BarrierLeave,
ET_Internal = 0xFF /* First byte */
};
@@ -130,7 +132,7 @@ struct _DeviceEvent {
*/
struct _TouchOwnershipEvent {
unsigned char header; /**< Always ET_Internal */
- enum EventType type; /**< One of EventType */
+ enum EventType type; /**< ET_TouchOwnership */
int length; /**< Length in bytes */
Time time; /**< Time in ms */
int deviceid; /**< Device to post this event for */
@@ -227,6 +229,25 @@ struct _RawDeviceEvent {
uint32_t flags; /**< Flags to be copied into the generated event */
};
+struct _BarrierEvent {
+ unsigned char header; /**< Always ET_Internal */
+ enum EventType type; /**< ET_BarrierHit, ET_BarrierLeave */
+ int length; /**< Length in bytes */
+ Time time; /**< Time in ms */
+ int deviceid; /**< Device to post this event for */
+ int sourceid; /**< The physical source device */
+ int barrierid;
+ Window window;
+ Window root;
+ double dx;
+ double dy;
+ double root_x;
+ double root_y;
+ int16_t dt;
+ int32_t event_id;
+ uint32_t flags;
+};
+
#ifdef XQUARTZ
#define XQUARTZ_EVENT_MAXARGS 5
struct _XQuartzEvent {
@@ -253,6 +274,7 @@ union _InternalEvent {
DeviceEvent device_event;
DeviceChangedEvent changed_event;
TouchOwnershipEvent touch_ownership_event;
+ BarrierEvent barrier_event;
#if XFreeXDGA
DGAEvent dga_event;
#endif
diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h
index 2387dbf4a..23a20b59d 100644
--- a/xorg-server/include/input.h
+++ b/xorg-server/include/input.h
@@ -678,4 +678,10 @@ extern _X_EXPORT void input_option_set_value(InputOption *opt,
extern _X_HIDDEN Bool point_on_screen(ScreenPtr pScreen, int x, int y);
extern _X_HIDDEN void update_desktop_dimensions(void);
+extern _X_HIDDEN void input_constrain_cursor(DeviceIntPtr pDev, ScreenPtr screen,
+ int current_x, int current_y,
+ int dest_x, int dest_y,
+ int *out_x, int *out_y,
+ int *nevents, InternalEvent* events);
+
#endif /* INPUT_H */
diff --git a/xorg-server/include/inputstr.h b/xorg-server/include/inputstr.h
index bb0a77963..17cee9854 100644
--- a/xorg-server/include/inputstr.h
+++ b/xorg-server/include/inputstr.h
@@ -71,7 +71,7 @@ extern _X_EXPORT int CountBits(const uint8_t * mask, int len);
* events to the protocol, the server will not support these events until
* this number here is bumped.
*/
-#define XI2LASTEVENT XI_RawTouchEnd
+#define XI2LASTEVENT XI_BarrierLeave
#define XI2MASKSIZE ((XI2LASTEVENT >> 3) + 1) /* no of bytes for masks */
/**
diff --git a/xorg-server/mi/mieq.c b/xorg-server/mi/mieq.c
index b2c7769ec..22f8c91bb 100644
--- a/xorg-server/mi/mieq.c
+++ b/xorg-server/mi/mieq.c
@@ -407,6 +407,10 @@ ChangeDeviceID(DeviceIntPtr dev, InternalEvent *event)
case ET_RawTouchUpdate:
event->raw_event.deviceid = dev->id;
break;
+ case ET_BarrierHit:
+ case ET_BarrierLeave:
+ event->barrier_event.deviceid = dev->id;
+ break;
default:
ErrorF("[mi] Unknown event type (%d), cannot change id.\n",
event->any.type);
diff --git a/xorg-server/mi/miinitext.c b/xorg-server/mi/miinitext.c
index 014939c80..38d19bc2f 100644
--- a/xorg-server/mi/miinitext.c
+++ b/xorg-server/mi/miinitext.c
@@ -212,10 +212,12 @@ EnableDisableExtension(const char *name, Bool enable)
void
EnableDisableExtensionError(const char *name, Bool enable)
{
- ExtensionToggle *ext = &ExtensionToggleList[0];
+ ExtensionToggle *ext;
+ int i;
Bool found = FALSE;
- for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
+ for (i = 0; i < ARRAY_SIZE(ExtensionToggleList); i++) {
+ ext = &ExtensionToggleList[i];
if ((strcmp(name, ext->name) == 0) && (ext->disablePtr == NULL)) {
ErrorF("[mi] Extension \"%s\" can not be disabled\n", name);
found = TRUE;
@@ -226,7 +228,8 @@ EnableDisableExtensionError(const char *name, Bool enable)
ErrorF("[mi] Extension \"%s\" is not recognized\n", name);
ErrorF("[mi] Only the following extensions can be run-time %s:\n",
enable ? "enabled" : "disabled");
- for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
+ for (i = 0; i < ARRAY_SIZE(ExtensionToggleList); i++) {
+ ext = &ExtensionToggleList[i];
if (ext->disablePtr != NULL) {
ErrorF("[mi] %s\n", ext->name);
}
diff --git a/xorg-server/mi/mipointer.c b/xorg-server/mi/mipointer.c
index f34506326..b8503f450 100644
--- a/xorg-server/mi/mipointer.c
+++ b/xorg-server/mi/mipointer.c
@@ -98,7 +98,7 @@ static void miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
static void miPointerMoveNoEvent(DeviceIntPtr pDev, ScreenPtr pScreen, int x,
int y);
-static InternalEvent *events; /* for WarpPointer MotionNotifies */
+static InternalEvent *mipointermove_events; /* for WarpPointer MotionNotifies */
Bool
miPointerInitialize(ScreenPtr pScreen,
@@ -143,7 +143,7 @@ miPointerInitialize(ScreenPtr pScreen,
pScreen->DeviceCursorInitialize = miPointerDeviceInitialize;
pScreen->DeviceCursorCleanup = miPointerDeviceCleanup;
- events = NULL;
+ mipointermove_events = NULL;
return TRUE;
}
@@ -160,8 +160,8 @@ miPointerCloseScreen(ScreenPtr pScreen)
pScreen->CloseScreen = pScreenPriv->CloseScreen;
free((pointer) pScreenPriv);
- FreeEventList(events, GetMaximumEventsNum());
- events = NULL;
+ FreeEventList(mipointermove_events, GetMaximumEventsNum());
+ mipointermove_events = NULL;
return (*pScreen->CloseScreen) (pScreen);
}
@@ -565,13 +565,16 @@ miPointerMoveNoEvent(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
*/
ScreenPtr
miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
- double *screeny)
+ double *screeny,
+ int *nevents, InternalEvent* events)
{
miPointerScreenPtr pScreenPriv;
ScreenPtr pScreen;
ScreenPtr newScreen;
int x, y;
Bool switch_screen = FALSE;
+ Bool should_constrain_barriers = FALSE;
+ int i;
miPointerPtr pPointer;
@@ -588,6 +591,25 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
x -= pScreen->x;
y -= pScreen->y;
+ should_constrain_barriers = (mode == Relative);
+
+ if (should_constrain_barriers) {
+ /* coordinates after clamped to a barrier */
+ int constrained_x, constrained_y;
+ int current_x, current_y; /* current position in per-screen coord */
+
+ current_x = MIPOINTER(pDev)->x - pScreen->y;
+ current_y = MIPOINTER(pDev)->y - pScreen->x;
+
+ input_constrain_cursor(pDev, pScreen,
+ current_x, current_y, x, y,
+ &constrained_x, &constrained_y,
+ nevents, events);
+
+ x = constrained_x;
+ y = constrained_y;
+ }
+
if (switch_screen) {
pScreenPriv = GetScreenPrivate(pScreen);
if (!pPointer->confined) {
@@ -619,6 +641,18 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
if (pPointer->x != x || pPointer->y != y || pPointer->pScreen != pScreen)
miPointerMoveNoEvent(pDev, pScreen, x, y);
+ /* check if we generated any barrier events and if so, update root x/y
+ * to the fully constrained coords */
+ if (should_constrain_barriers) {
+ for (i = 0; i < *nevents; i++) {
+ if (events[i].any.type == ET_BarrierHit ||
+ events[i].any.type == ET_BarrierLeave) {
+ events[i].barrier_event.root_x = x;
+ events[i].barrier_event.root_y = y;
+ }
+ }
+ }
+
/* Convert to desktop coordinates again */
x += pScreen->x;
y += pScreen->y;
@@ -676,17 +710,17 @@ miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
valuators[0] = x;
valuators[1] = y;
- if (!events) {
- events = InitEventList(GetMaximumEventsNum());
+ if (!mipointermove_events) {
+ mipointermove_events = InitEventList(GetMaximumEventsNum());
- if (!events) {
+ if (!mipointermove_events) {
FatalError("Could not allocate event store.\n");
return;
}
}
valuator_mask_set_range(&mask, 0, 2, valuators);
- nevents = GetPointerEvents(events, pDev, MotionNotify, 0,
+ nevents = GetPointerEvents(mipointermove_events, pDev, MotionNotify, 0,
POINTER_SCREEN | POINTER_ABSOLUTE |
POINTER_NORAW, &mask);
@@ -695,7 +729,7 @@ miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
darwinEvents_lock();
#endif
for (i = 0; i < nevents; i++)
- mieqEnqueue(pDev, &events[i]);
+ mieqEnqueue(pDev, &mipointermove_events[i]);
#ifdef XQUARTZ
darwinEvents_unlock();
#endif
diff --git a/xorg-server/mi/mipointer.h b/xorg-server/mi/mipointer.h
index 1500e216a..f89dff31e 100644
--- a/xorg-server/mi/mipointer.h
+++ b/xorg-server/mi/mipointer.h
@@ -115,7 +115,8 @@ miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y);
/* Moves the cursor to the specified position. May clip the co-ordinates:
* x and y are modified in-place. */
extern _X_EXPORT ScreenPtr
-miPointerSetPosition(DeviceIntPtr pDev, int mode, double *x, double *y);
+miPointerSetPosition(DeviceIntPtr pDev, int mode, double *x, double *y,
+ int *nevents, InternalEvent *events);
extern _X_EXPORT void
miPointerUpdateSprite(DeviceIntPtr pDev);
diff --git a/xorg-server/os/access.c b/xorg-server/os/access.c
index 97845994f..d3e7da599 100644
--- a/xorg-server/os/access.c
+++ b/xorg-server/os/access.c
@@ -641,7 +641,7 @@ in6_fillscopeid(struct sockaddr_in6 *sin6)
#if defined(__KAME__)
if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
sin6->sin6_scope_id =
- ntohs(*(u_int16_t *) & sin6->sin6_addr.s6_addr[2]);
+ ntohs(*(u_int16_t *) &sin6->sin6_addr.s6_addr[2]);
sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0;
}
#endif
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index e4c87bacd..518400cfd 100755
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -1697,7 +1697,7 @@ System(const char *cmdline)
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) & buffer, 0, NULL)) {
+ (LPTSTR) &buffer, 0, NULL)) {
ErrorF("[xkb] Starting '%s' failed!\n", cmdline);
}
else {
diff --git a/xorg-server/os/xdmcp.c b/xorg-server/os/xdmcp.c
index 6c5ebca5c..66c846d44 100644
--- a/xorg-server/os/xdmcp.c
+++ b/xorg-server/os/xdmcp.c
@@ -833,7 +833,7 @@ receive_packet(int socketfd)
XdmcpHeader header;
/* read message off socket */
- if (!XdmcpFill(socketfd, &buffer, (XdmcpNetaddr) & from, &fromlen))
+ if (!XdmcpFill(socketfd, &buffer, (XdmcpNetaddr) &from, &fromlen))
return;
/* reset retransmission backoff */
@@ -1149,7 +1149,7 @@ send_query_msg(void)
for (i = 0; i < NumBroadcastAddresses; i++)
XdmcpFlush(xdmcpSocket, &buffer,
- (XdmcpNetaddr) & BroadcastAddresses[i],
+ (XdmcpNetaddr) &BroadcastAddresses[i],
sizeof(struct sockaddr_in));
}
#if defined(IPv6) && defined(AF_INET6)
@@ -1188,7 +1188,7 @@ send_query_msg(void)
if (SOCKADDR_FAMILY(ManagerAddress) == AF_INET6)
socketfd = xdmcpSocket6;
#endif
- XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) & ManagerAddress,
+ XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) &ManagerAddress,
ManagerAddressLen);
}
}
@@ -1313,7 +1313,7 @@ send_request_msg(void)
socketfd = xdmcpSocket6;
#endif
if (XdmcpFlush(socketfd, &buffer,
- (XdmcpNetaddr) & req_sockaddr, req_socklen))
+ (XdmcpNetaddr) &req_sockaddr, req_socklen))
state = XDM_AWAIT_REQUEST_RESPONSE;
}
@@ -1406,7 +1406,7 @@ send_manage_msg(void)
if (SOCKADDR_FAMILY(req_sockaddr) == AF_INET6)
socketfd = xdmcpSocket6;
#endif
- XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) & req_sockaddr, req_socklen);
+ XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) &req_sockaddr, req_socklen);
}
static void
@@ -1463,7 +1463,7 @@ send_keepalive_msg(void)
if (SOCKADDR_FAMILY(req_sockaddr) == AF_INET6)
socketfd = xdmcpSocket6;
#endif
- XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) & req_sockaddr, req_socklen);
+ XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) &req_sockaddr, req_socklen);
}
static void
diff --git a/xorg-server/test/fixes.c b/xorg-server/test/fixes.c
index 7807c73ce..4ac6750e4 100644
--- a/xorg-server/test/fixes.c
+++ b/xorg-server/test/fixes.c
@@ -265,6 +265,32 @@ fixes_pointer_barriers_test(void)
x2 = x + 100;
assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+ /* ray vert barrier */
+ barrier.x1 = x;
+ barrier.x2 = x;
+ barrier.y1 = -1;
+ barrier.y2 = y + 100;
+
+ /* ray barrier simple case */
+ y1 = y;
+ y2 = y;
+ x1 = x + 50;
+ x2 = x - 50;
+ assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+ /* endpoint outside y range; should be blocked */
+ y1 = y - 1000;
+ y2 = y - 1000;
+ x1 = x + 50;
+ x2 = x - 50;
+ assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+ /* endpoint outside y range */
+ y1 = y + 150;
+ y2 = y + 150;
+ x1 = x + 50;
+ x2 = x - 50;
+ assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
}
static void
diff --git a/xorg-server/test/input.c b/xorg-server/test/input.c
index 191c81789..be988a4a3 100644
--- a/xorg-server/test/input.c
+++ b/xorg-server/test/input.c
@@ -406,7 +406,7 @@ _dix_test_xi_convert(DeviceEvent *ev, int expected_rc, int expected_count)
assert(kbp->same_screen == FALSE);
while (--count > 0) {
- deviceValuator *v = (deviceValuator *) & xi[count];
+ deviceValuator *v = (deviceValuator *) &xi[count];
assert(v->type == DeviceValuator);
assert(v->num_valuators <= 6);
diff --git a/xorg-server/test/xi2/protocol-eventconvert.c b/xorg-server/test/xi2/protocol-eventconvert.c
index bb3177cc1..aea380ed5 100644
--- a/xorg-server/test/xi2/protocol-eventconvert.c
+++ b/xorg-server/test/xi2/protocol-eventconvert.c
@@ -694,7 +694,7 @@ test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
assert(k->num_keycodes == in->keys.max_keycode -
in->keys.min_keycode + 1);
- kc = (uint32_t *) & k[1];
+ kc = (uint32_t *) &k[1];
for (j = 0; j < k->num_keycodes; j++) {
if (swap) {
swapl(&kc[j]);
@@ -984,6 +984,221 @@ test_convert_XITouchOwnershipEvent(void)
}
}
+static void
+test_XIBarrierEvent(BarrierEvent *in)
+{
+ xXIBarrierEvent *out, *swapped;
+ int count;
+ int rc;
+ int eventlen;
+ FP3232 value;
+
+ rc = EventToXI((InternalEvent*)in, (xEvent**)&out, &count);
+ assert(rc == BadMatch);
+
+ rc = EventToCore((InternalEvent*)in, (xEvent**)&out, &count);
+ assert(rc == BadMatch);
+
+ rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
+
+ assert(out->type == GenericEvent);
+ assert(out->extension == 0); /* IReqCode defaults to 0 */
+ assert(out->evtype == GetXI2Type(in->type));
+ assert(out->time == in->time);
+ assert(out->deviceid == in->deviceid);
+ assert(out->sourceid == in->sourceid);
+ assert(out->barrier == in->barrierid);
+ assert(out->flags == in->flags);
+ assert(out->event == in->window);
+ assert(out->root == in->root);
+ assert(out->dtime == in->dt);
+ assert(out->eventid == in->event_id);
+ assert(out->root_x == double_to_fp1616(in->root_x));
+ assert(out->root_y == double_to_fp1616(in->root_y));
+
+ value = double_to_fp3232(in->dx);
+ assert(out->dx.integral == value.integral);
+ assert(out->dx.frac == value.frac);
+ value = double_to_fp3232(in->dy);
+ assert(out->dy.integral == value.integral);
+ assert(out->dy.frac == value.frac);
+
+ eventlen = sizeof(xEvent) + out->length * 4;
+ swapped = calloc(1, eventlen);
+ XI2EventSwap((xGenericEvent *) out, (xGenericEvent *) swapped);
+
+ swaps(&swapped->sequenceNumber);
+ swapl(&swapped->length);
+ swaps(&swapped->evtype);
+ swaps(&swapped->deviceid);
+ swapl(&swapped->time);
+ swapl(&swapped->eventid);
+ swapl(&swapped->root);
+ swapl(&swapped->event);
+ swapl(&swapped->barrier);
+ swapl(&swapped->dtime);
+ swaps(&swapped->sourceid);
+ swapl(&swapped->root_x);
+ swapl(&swapped->root_y);
+ swapl(&swapped->dx.integral);
+ swapl(&swapped->dx.frac);
+ swapl(&swapped->dy.integral);
+ swapl(&swapped->dy.frac);
+
+ assert(memcmp(swapped, out, eventlen) == 0);
+
+ free(swapped);
+ free(out);
+}
+
+static void
+test_convert_XIBarrierEvent(void)
+{
+ BarrierEvent in;
+
+ memset(&in, 0, sizeof(in));
+ in.header = ET_Internal;
+ in.type = ET_BarrierHit;
+ in.length = sizeof(in);
+ in.time = 0;
+ in.deviceid = 1;
+ in.sourceid = 2;
+
+ test_XIBarrierEvent(&in);
+
+ in.deviceid = 1;
+ while(in.deviceid & 0xFFFF) {
+ test_XIBarrierEvent(&in);
+ in.deviceid <<= 1;
+ }
+ in.deviceid = 0;
+
+ in.sourceid = 1;
+ while(in.sourceid & 0xFFFF) {
+ test_XIBarrierEvent(&in);
+ in.sourceid <<= 1;
+ }
+ in.sourceid = 0;
+
+ in.flags = 1;
+ while(in.flags) {
+ test_XIBarrierEvent(&in);
+ in.flags <<= 1;
+ }
+
+ in.barrierid = 1;
+ while(in.barrierid) {
+ test_XIBarrierEvent(&in);
+ in.barrierid <<= 1;
+ }
+
+ in.dt = 1;
+ while(in.dt) {
+ test_XIBarrierEvent(&in);
+ in.dt <<= 1;
+ }
+
+ in.event_id = 1;
+ while(in.event_id) {
+ test_XIBarrierEvent(&in);
+ in.event_id <<= 1;
+ }
+
+ in.window = 1;
+ while(in.window) {
+ test_XIBarrierEvent(&in);
+ in.window <<= 1;
+ }
+
+ in.root = 1;
+ while(in.root) {
+ test_XIBarrierEvent(&in);
+ in.root <<= 1;
+ }
+
+ /* pseudo-random 16 bit numbers */
+ in.root_x = 1;
+ test_XIBarrierEvent(&in);
+ in.root_x = 1.3;
+ test_XIBarrierEvent(&in);
+ in.root_x = 264.908;
+ test_XIBarrierEvent(&in);
+ in.root_x = 35638.292;
+ test_XIBarrierEvent(&in);
+
+ in.root_x = -1;
+ test_XIBarrierEvent(&in);
+ in.root_x = -1.3;
+ test_XIBarrierEvent(&in);
+ in.root_x = -264.908;
+ test_XIBarrierEvent(&in);
+ in.root_x = -35638.292;
+ test_XIBarrierEvent(&in);
+
+ in.root_y = 1;
+ test_XIBarrierEvent(&in);
+ in.root_y = 1.3;
+ test_XIBarrierEvent(&in);
+ in.root_y = 264.908;
+ test_XIBarrierEvent(&in);
+ in.root_y = 35638.292;
+ test_XIBarrierEvent(&in);
+
+ in.root_y = -1;
+ test_XIBarrierEvent(&in);
+ in.root_y = -1.3;
+ test_XIBarrierEvent(&in);
+ in.root_y = -264.908;
+ test_XIBarrierEvent(&in);
+ in.root_y = -35638.292;
+ test_XIBarrierEvent(&in);
+
+ /* equally pseudo-random 32 bit numbers */
+ in.dx = 1;
+ test_XIBarrierEvent(&in);
+ in.dx = 1.3;
+ test_XIBarrierEvent(&in);
+ in.dx = 264.908;
+ test_XIBarrierEvent(&in);
+ in.dx = 35638.292;
+ test_XIBarrierEvent(&in);
+ in.dx = 2947813871.2342;
+ test_XIBarrierEvent(&in);
+
+ in.dx = -1;
+ test_XIBarrierEvent(&in);
+ in.dx = -1.3;
+ test_XIBarrierEvent(&in);
+ in.dx = -264.908;
+ test_XIBarrierEvent(&in);
+ in.dx = -35638.292;
+ test_XIBarrierEvent(&in);
+ in.dx = -2947813871.2342;
+ test_XIBarrierEvent(&in);
+
+ in.dy = 1;
+ test_XIBarrierEvent(&in);
+ in.dy = 1.3;
+ test_XIBarrierEvent(&in);
+ in.dy = 264.908;
+ test_XIBarrierEvent(&in);
+ in.dy = 35638.292;
+ test_XIBarrierEvent(&in);
+ in.dy = 2947813871.2342;
+ test_XIBarrierEvent(&in);
+
+ in.dy = -1;
+ test_XIBarrierEvent(&in);
+ in.dy = -1.3;
+ test_XIBarrierEvent(&in);
+ in.dy = -264.908;
+ test_XIBarrierEvent(&in);
+ in.dy = -35638.292;
+ test_XIBarrierEvent(&in);
+ in.dy = -2947813871.2342;
+ test_XIBarrierEvent(&in);
+}
+
int
main(int argc, char **argv)
{
@@ -992,6 +1207,7 @@ main(int argc, char **argv)
test_convert_XIDeviceEvent();
test_convert_XIDeviceChangedEvent();
test_convert_XITouchOwnershipEvent();
+ test_convert_XIBarrierEvent();
return 0;
}
diff --git a/xorg-server/test/xi2/protocol-xiquerydevice.c b/xorg-server/test/xi2/protocol-xiquerydevice.c
index 9d13bbb6f..c066daa35 100644
--- a/xorg-server/test/xi2/protocol-xiquerydevice.c
+++ b/xorg-server/test/xi2/protocol-xiquerydevice.c
@@ -171,7 +171,7 @@ reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void *closure)
(xkb->max_key_code - xkb->min_key_code + 1));
assert(any->length == (2 + ki->num_keycodes));
- kc = (uint32_t *) & ki[1];
+ kc = (uint32_t *) &ki[1];
for (k = 0; k < ki->num_keycodes; k++, kc++) {
if (client->swapped)
swapl(kc);
diff --git a/xorg-server/test/xi2/protocol-xiselectevents.c b/xorg-server/test/xi2/protocol-xiselectevents.c
index 8f6b947d4..183746f98 100644
--- a/xorg-server/test/xi2/protocol-xiselectevents.c
+++ b/xorg-server/test/xi2/protocol-xiselectevents.c
@@ -98,7 +98,7 @@ request_XISelectEvent(xXISelectEventsReq * req, int error)
xXIEventMask *mask, *next;
req->length = (sz_xXISelectEventsReq / 4);
- mask = (xXIEventMask *) & req[1];
+ mask = (xXIEventMask *) &req[1];
for (i = 0; i < req->num_masks; i++) {
req->length += sizeof(xXIEventMask) / 4 + mask->mask_len;
mask = (xXIEventMask *) ((char *) &mask[1] + mask->mask_len * 4);
@@ -111,7 +111,7 @@ request_XISelectEvent(xXISelectEventsReq * req, int error)
client.swapped = TRUE;
- mask = (xXIEventMask *) & req[1];
+ mask = (xXIEventMask *) &req[1];
for (i = 0; i < req->num_masks; i++) {
next = (xXIEventMask *) ((char *) &mask[1] + mask->mask_len * 4);
swaps(&mask->deviceid);
@@ -156,7 +156,7 @@ request_XISelectEvents_masks(xXISelectEventsReq * req)
int nmasks = (XI2LASTEVENT + 7) / 8;
unsigned char *bits;
- mask = (xXIEventMask *) & req[1];
+ mask = (xXIEventMask *) &req[1];
req->win = ROOT_WINDOW_ID;
/* if a clients submits more than 100 masks, consider it insane and untested */
@@ -312,7 +312,7 @@ test_XISelectEvents(void)
req->num_masks = 1;
printf("Triggering bogus mask length error\n");
- mask = (xXIEventMask *) & req[1];
+ mask = (xXIEventMask *) &req[1];
mask->deviceid = 0;
mask->mask_len = 0xFFFF;
request_XISelectEvent(req, BadLength);
@@ -320,7 +320,7 @@ test_XISelectEvents(void)
/* testing various device ids */
printf("Testing existing device ids.\n");
for (i = 0; i < 6; i++) {
- mask = (xXIEventMask *) & req[1];
+ mask = (xXIEventMask *) &req[1];
mask->deviceid = i;
mask->mask_len = 1;
req->win = ROOT_WINDOW_ID;
@@ -332,7 +332,7 @@ test_XISelectEvents(void)
for (i = 6; i <= 0xFFFF; i++) {
req->win = ROOT_WINDOW_ID;
req->num_masks = 1;
- mask = (xXIEventMask *) & req[1];
+ mask = (xXIEventMask *) &req[1];
mask->deviceid = i;
mask->mask_len = 1;
request_XISelectEvent(req, BadDevice);
diff --git a/xorg-server/xfixes/cursor.c b/xorg-server/xfixes/cursor.c
index e5cf4ad5b..87da4701a 100644..100755
--- a/xorg-server/xfixes/cursor.c
+++ b/xorg-server/xfixes/cursor.c
@@ -58,12 +58,11 @@
#include "windowstr.h"
#include "xace.h"
#include "list.h"
-#include "exglobals.h"
+#include "xibarriers.h"
static RESTYPE CursorClientType;
static RESTYPE CursorHideCountType;
static RESTYPE CursorWindowType;
-RESTYPE PointerBarrierType;
static CursorPtr CursorCurrent[MAXDEVICES];
static DevPrivateKeyRec CursorScreenPrivateKeyRec;
@@ -115,16 +114,6 @@ typedef struct _CursorHideCountRec {
XID resource;
} CursorHideCountRec;
-typedef struct PointerBarrierClient *PointerBarrierClientPtr;
-
-struct PointerBarrierClient {
- ScreenPtr screen;
- struct PointerBarrier barrier;
- struct xorg_list entry;
- int num_devices;
- int *device_ids; /* num_devices */
-};
-
/*
* Wrap DisplayCursor to catch cursor change events
*/
@@ -132,9 +121,7 @@ struct PointerBarrierClient {
typedef struct _CursorScreen {
DisplayCursorProcPtr DisplayCursor;
CloseScreenProcPtr CloseScreen;
- ConstrainCursorHarderProcPtr ConstrainCursorHarder;
CursorHideCountPtr pCursorHideCounts;
- struct xorg_list barriers;
} CursorScreenRec, *CursorScreenPtr;
#define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey))
@@ -200,11 +187,9 @@ CursorCloseScreen(ScreenPtr pScreen)
Bool ret;
_X_UNUSED CloseScreenProcPtr close_proc;
_X_UNUSED DisplayCursorProcPtr display_proc;
- _X_UNUSED ConstrainCursorHarderProcPtr constrain_proc;
Unwrap(cs, pScreen, CloseScreen, close_proc);
Unwrap(cs, pScreen, DisplayCursor, display_proc);
- Unwrap(cs, pScreen, ConstrainCursorHarder, constrain_proc);
deleteCursorHideCountsForScreen(pScreen);
ret = (*pScreen->CloseScreen) (pScreen);
free(cs);
@@ -1014,384 +999,15 @@ CursorFreeWindow(pointer data, XID id)
return 1;
}
-static BOOL
-barrier_is_horizontal(const struct PointerBarrier *barrier)
-{
- return barrier->y1 == barrier->y2;
-}
-
-static BOOL
-barrier_is_vertical(const struct PointerBarrier *barrier)
-{
- return barrier->x1 == barrier->x2;
-}
-
-/**
- * @return The set of barrier movement directions the movement vector
- * x1/y1 → x2/y2 represents.
- */
-int
-barrier_get_direction(int x1, int y1, int x2, int y2)
-{
- int direction = 0;
-
- /* which way are we trying to go */
- if (x2 > x1)
- direction |= BarrierPositiveX;
- if (x2 < x1)
- direction |= BarrierNegativeX;
- if (y2 > y1)
- direction |= BarrierPositiveY;
- if (y2 < y1)
- direction |= BarrierNegativeY;
-
- return direction;
-}
-
-/**
- * Test if the barrier may block movement in the direction defined by
- * x1/y1 → x2/y2. This function only tests whether the directions could be
- * blocked, it does not test if the barrier actually blocks the movement.
- *
- * @return TRUE if the barrier blocks the direction of movement or FALSE
- * otherwise.
- */
-BOOL
-barrier_is_blocking_direction(const struct PointerBarrier * barrier,
- int direction)
-{
- /* Barriers define which way is ok, not which way is blocking */
- return (barrier->directions & direction) != direction;
-}
-
-/**
- * Test if the movement vector x1/y1 → x2/y2 is intersecting with the
- * barrier. A movement vector with the startpoint or endpoint adjacent to
- * the barrier itself counts as intersecting.
- *
- * @param x1 X start coordinate of movement vector
- * @param y1 Y start coordinate of movement vector
- * @param x2 X end coordinate of movement vector
- * @param y2 Y end coordinate of movement vector
- * @param[out] distance The distance between the start point and the
- * intersection with the barrier (if applicable).
- * @return TRUE if the barrier intersects with the given vector
- */
-BOOL
-barrier_is_blocking(const struct PointerBarrier * barrier,
- int x1, int y1, int x2, int y2, double *distance)
-{
- BOOL rc = FALSE;
- float ua, ub, ud;
- int dir = barrier_get_direction(x1, y1, x2, y2);
-
- /* Algorithm below doesn't handle edge cases well, hence the extra
- * checks. */
- if (barrier_is_vertical(barrier)) {
- /* handle immediate barrier adjacency, moving away */
- if (dir & BarrierPositiveX && x1 == barrier->x1)
- return FALSE;
- if (dir & BarrierNegativeX && x1 == (barrier->x1 - 1))
- return FALSE;
- /* startpoint adjacent to barrier, moving towards -> block */
- if (dir & BarrierPositiveX && x1 == (barrier->x1 - 1) && y1 >= barrier->y1 && y1 <= barrier->y2) {
- *distance = 0;
- return TRUE;
- }
- if (dir & BarrierNegativeX && x1 == barrier->x1 && y1 >= barrier->y1 && y1 <= barrier->y2) {
- *distance = 0;
- return TRUE;
- }
- }
- else {
- /* handle immediate barrier adjacency, moving away */
- if (dir & BarrierPositiveY && y1 == barrier->y1)
- return FALSE;
- if (dir & BarrierNegativeY && y1 == (barrier->y1 - 1))
- return FALSE;
- /* startpoint adjacent to barrier, moving towards -> block */
- if (dir & BarrierPositiveY && y1 == (barrier->y1 - 1) && x1 >= barrier->x1 && x1 <= barrier->x2) {
- *distance = 0;
- return TRUE;
- }
- if (dir & BarrierNegativeY && y1 == barrier->y1 && x1 >= barrier->x1 && x1 <= barrier->x2) {
- *distance = 0;
- return TRUE;
- }
- }
-
- /* not an edge case, compute distance */
- ua = 0;
- ud = (barrier->y2 - barrier->y1) * (x2 - x1) - (barrier->x2 -
- barrier->x1) * (y2 - y1);
- if (ud != 0) {
- ua = ((barrier->x2 - barrier->x1) * (y1 - barrier->y1) -
- (barrier->y2 - barrier->y1) * (x1 - barrier->x1)) / ud;
- ub = ((x2 - x1) * (y1 - barrier->y1) -
- (y2 - y1) * (x1 - barrier->x1)) / ud;
- if (ua < 0 || ua > 1 || ub < 0 || ub > 1)
- ua = 0;
- }
-
- if (ua > 0 && ua <= 1) {
- double ix = barrier->x1 + ua * (barrier->x2 - barrier->x1);
- double iy = barrier->y1 + ua * (barrier->y2 - barrier->y1);
-
- *distance = sqrt(pow(x1 - ix, 2) + pow(y1 - iy, 2));
- rc = TRUE;
- }
-
- return rc;
-}
-
-static BOOL
-barrier_blocks_device(struct PointerBarrierClient *client,
- DeviceIntPtr dev)
-{
- int i;
- int master_id;
-
- /* Clients with no devices are treated as
- * if they specified XIAllDevices. */
- if (client->num_devices == 0)
- return TRUE;
-
- master_id = GetMaster(dev, POINTER_OR_FLOAT)->id;
-
- for (i = 0; i < client->num_devices; i++) {
- int device_id = client->device_ids[i];
- if (device_id == XIAllDevices ||
- device_id == XIAllMasterDevices ||
- device_id == master_id)
- return TRUE;
- }
-
- return FALSE;
-}
-
-/**
- * Find the nearest barrier that is blocking movement from x1/y1 to x2/y2.
- *
- * @param dir Only barriers blocking movement in direction dir are checked
- * @param x1 X start coordinate of movement vector
- * @param y1 Y start coordinate of movement vector
- * @param x2 X end coordinate of movement vector
- * @param y2 Y end coordinate of movement vector
- * @return The barrier nearest to the movement origin that blocks this movement.
- */
-static struct PointerBarrier *
-barrier_find_nearest(CursorScreenPtr cs, DeviceIntPtr dev,
- int dir,
- int x1, int y1, int x2, int y2)
-{
- struct PointerBarrierClient *c = NULL;
- struct PointerBarrier *nearest = NULL;
- double min_distance = INT_MAX; /* can't get higher than that in X anyway */
-
- xorg_list_for_each_entry(c, &cs->barriers, entry) {
- struct PointerBarrier *b = &c->barrier;
- double distance;
-
- if (!barrier_is_blocking_direction(b, dir))
- continue;
-
- if (!barrier_blocks_device(c, dev))
- continue;
-
- if (barrier_is_blocking(b, x1, y1, x2, y2, &distance)) {
- if (min_distance > distance) {
- min_distance = distance;
- nearest = b;
- }
- }
- }
-
- return nearest;
-}
-
-/**
- * Clamp to the given barrier given the movement direction specified in dir.
- *
- * @param barrier The barrier to clamp to
- * @param dir The movement direction
- * @param[out] x The clamped x coordinate.
- * @param[out] y The clamped x coordinate.
- */
-void
-barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
- int *y)
-{
- if (barrier_is_vertical(barrier)) {
- if ((dir & BarrierNegativeX) & ~barrier->directions)
- *x = barrier->x1;
- if ((dir & BarrierPositiveX) & ~barrier->directions)
- *x = barrier->x1 - 1;
- }
- if (barrier_is_horizontal(barrier)) {
- if ((dir & BarrierNegativeY) & ~barrier->directions)
- *y = barrier->y1;
- if ((dir & BarrierPositiveY) & ~barrier->directions)
- *y = barrier->y1 - 1;
- }
-}
-
-static void
-CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode,
- int *x, int *y)
-{
- CursorScreenPtr cs = GetCursorScreen(screen);
-
- if (!xorg_list_is_empty(&cs->barriers) && !IsFloating(dev) &&
- mode == Relative) {
- int ox, oy;
- int dir;
- int i;
- struct PointerBarrier *nearest = NULL;
-
- /* where are we coming from */
- miPointerGetPosition(dev, &ox, &oy);
-
- /* How this works:
- * Given the origin and the movement vector, get the nearest barrier
- * to the origin that is blocking the movement.
- * Clamp to that barrier.
- * Then, check from the clamped intersection to the original
- * destination, again finding the nearest barrier and clamping.
- */
- dir = barrier_get_direction(ox, oy, *x, *y);
-
-#define MAX_BARRIERS 2
- for (i = 0; i < MAX_BARRIERS; i++) {
- nearest = barrier_find_nearest(cs, dev, dir, ox, oy, *x, *y);
- if (!nearest)
- break;
-
- barrier_clamp_to_barrier(nearest, dir, x, y);
-
- if (barrier_is_vertical(nearest)) {
- dir &= ~(BarrierNegativeX | BarrierPositiveX);
- ox = *x;
- }
- else if (barrier_is_horizontal(nearest)) {
- dir &= ~(BarrierNegativeY | BarrierPositiveY);
- oy = *y;
- }
- }
- }
-
- if (cs->ConstrainCursorHarder) {
- screen->ConstrainCursorHarder = cs->ConstrainCursorHarder;
- screen->ConstrainCursorHarder(dev, screen, mode, x, y);
- screen->ConstrainCursorHarder = CursorConstrainCursorHarder;
- }
-}
-
-static int
-CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client,
- xXFixesCreatePointerBarrierReq * stuff,
- PointerBarrierClientPtr *client_out)
-{
- CursorScreenPtr cs = GetCursorScreen(screen);
- int err;
- int size;
- int i;
- CARD16 *in_devices;
- struct PointerBarrierClient *ret;
-
- size = sizeof(*ret) + sizeof(int) * stuff->num_devices;
- ret = malloc(size);
-
- *client_out = NULL;
-
- if (!ret) {
- return BadAlloc;
- }
-
- ret->screen = screen;
- ret->num_devices = stuff->num_devices;
- if (ret->num_devices > 0)
- ret->device_ids = (int*)&ret[1];
- else
- ret->device_ids = NULL;
-
- in_devices = (CARD16 *) &stuff[1];
- for (i = 0; i < stuff->num_devices; i++) {
- int device_id = in_devices[i];
- DeviceIntPtr device;
-
- if ((err = dixLookupDevice (&device, device_id,
- client, DixReadAccess))) {
- client->errorValue = device_id;
- goto error;
- }
-
- if (!IsMaster (device)) {
- client->errorValue = device_id;
- err = BadDevice;
- goto error;
- }
-
- ret->device_ids[i] = device_id;
- }
-
- ret->barrier.x1 = min(stuff->x1, stuff->x2);
- ret->barrier.x2 = max(stuff->x1, stuff->x2);
- ret->barrier.y1 = min(stuff->y1, stuff->y2);
- ret->barrier.y2 = max(stuff->y1, stuff->y2);
- ret->barrier.directions = stuff->directions & 0x0f;
- if (barrier_is_horizontal(&ret->barrier))
- ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
- if (barrier_is_vertical(&ret->barrier))
- ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
- xorg_list_add(&ret->entry, &cs->barriers);
-
- *client_out = ret;
- return Success;
-
- error:
- free(ret);
- return err;
-}
-
int
ProcXFixesCreatePointerBarrier(ClientPtr client)
{
- int err;
- WindowPtr pWin;
- struct PointerBarrierClient *barrier;
- struct PointerBarrier b;
-
REQUEST(xXFixesCreatePointerBarrierReq);
REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
LEGAL_NEW_RESOURCE(stuff->barrier, client);
- err = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
- if (err != Success) {
- client->errorValue = stuff->window;
- return err;
- }
-
- b.x1 = stuff->x1;
- b.x2 = stuff->x2;
- b.y1 = stuff->y1;
- b.y2 = stuff->y2;
-
- if (!barrier_is_horizontal(&b) && !barrier_is_vertical(&b))
- return BadValue;
-
- /* no 0-sized barriers */
- if (barrier_is_horizontal(&b) && barrier_is_vertical(&b))
- return BadValue;
-
- if ((err = CreatePointerBarrierClient(pWin->drawable.pScreen,
- client, stuff, &barrier)))
- return err;
-
- if (!AddResource(stuff->barrier, PointerBarrierType, &barrier->barrier))
- return BadAlloc;
-
- return Success;
+ return XICreatePointerBarrier(client, stuff);
}
int
@@ -1419,49 +1035,14 @@ SProcXFixesCreatePointerBarrier(ClientPtr client)
return ProcXFixesVector[stuff->xfixesReqType] (client);
}
-static int
-CursorFreeBarrier(void *data, XID id)
-{
- struct PointerBarrierClient *b = NULL, *barrier;
- ScreenPtr screen;
- CursorScreenPtr cs;
-
- barrier = container_of(data, struct PointerBarrierClient, barrier);
-
- screen = barrier->screen;
- cs = GetCursorScreen(screen);
-
- /* find and unlink from the screen private */
- xorg_list_for_each_entry(b, &cs->barriers, entry) {
- if (b == barrier) {
- xorg_list_del(&b->entry);
- break;
- }
- }
-
- free(barrier);
- return Success;
-}
-
int
ProcXFixesDestroyPointerBarrier(ClientPtr client)
{
- int err;
- void *barrier;
-
REQUEST(xXFixesDestroyPointerBarrierReq);
REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq);
- err = dixLookupResourceByType((void **) &barrier, stuff->barrier,
- PointerBarrierType, client, DixDestroyAccess);
- if (err != Success) {
- client->errorValue = stuff->barrier;
- return err;
- }
-
- FreeResource(stuff->barrier, RT_NONE);
- return Success;
+ return XIDestroyPointerBarrier(client, stuff);
}
int
@@ -1493,10 +1074,8 @@ XFixesCursorInit(void)
cs = (CursorScreenPtr) calloc(1, sizeof(CursorScreenRec));
if (!cs)
return FALSE;
- xorg_list_init(&cs->barriers);
Wrap(cs, pScreen, CloseScreen, CursorCloseScreen);
Wrap(cs, pScreen, DisplayCursor, CursorDisplayCursor);
- Wrap(cs, pScreen, ConstrainCursorHarder, CursorConstrainCursorHarder);
cs->pCursorHideCounts = NULL;
SetCursorScreen(pScreen, cs);
}
@@ -1506,9 +1085,6 @@ XFixesCursorInit(void)
"XFixesCursorHideCount");
CursorWindowType = CreateNewResourceType(CursorFreeWindow,
"XFixesCursorWindow");
- PointerBarrierType = CreateNewResourceType(CursorFreeBarrier,
- "XFixesPointerBarrier");
- return CursorClientType && CursorHideCountType && CursorWindowType &&
- PointerBarrierType;
+ return CursorClientType && CursorHideCountType && CursorWindowType;
}
diff --git a/xorg-server/xfixes/xfixes.h b/xorg-server/xfixes/xfixes.h
index 19af09f7d..98828710f 100644
--- a/xorg-server/xfixes/xfixes.h
+++ b/xorg-server/xfixes/xfixes.h
@@ -30,7 +30,6 @@
#include "resource.h"
extern _X_EXPORT RESTYPE RegionResType;
-extern _X_EXPORT RESTYPE PointerBarrierType;
extern _X_EXPORT int XFixesErrorBase;
#define VERIFY_REGION(pRegion, rid, client, mode) \
@@ -52,20 +51,6 @@ extern _X_EXPORT int XFixesErrorBase;
extern _X_EXPORT RegionPtr
XFixesRegionCopy(RegionPtr pRegion);
-struct PointerBarrier {
- CARD16 x1, x2, y1, y2;
- CARD32 directions;
-};
-
-extern int
- barrier_get_direction(int, int, int, int);
-extern BOOL
-barrier_is_blocking(const struct PointerBarrier *, int, int, int, int,
- double *);
-extern BOOL barrier_is_blocking_direction(const struct PointerBarrier *, int);
-extern void
-
-barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
- int *y);
+#include "xibarriers.h"
#endif /* _XFIXES_H_ */
diff --git a/xorg-server/xkb/xkb.c b/xorg-server/xkb/xkb.c
index d27d90d7e..ab84a9075 100755
--- a/xorg-server/xkb/xkb.c
+++ b/xorg-server/xkb/xkb.c
@@ -1646,8 +1646,8 @@ CheckKeyTypes(ClientPtr client,
xkbKTSetMapEntryWireDesc *mapWire;
xkbModsWireDesc *preWire;
- mapWire = (xkbKTSetMapEntryWireDesc *) & wire[1];
- preWire = (xkbModsWireDesc *) & mapWire[wire->nMapEntries];
+ mapWire = (xkbKTSetMapEntryWireDesc *) &wire[1];
+ preWire = (xkbModsWireDesc *) &mapWire[wire->nMapEntries];
for (n = 0; n < wire->nMapEntries; n++) {
if (client->swapped) {
swaps(&mapWire[n].virtualMods);
@@ -1757,8 +1757,8 @@ CheckKeySyms(ClientPtr client,
*errorRtrn = _XkbErrCode3(0x17, i + req->firstKeySym, wire->nSyms);
return 0;
}
- pSyms = (KeySym *) & wire[1];
- wire = (xkbSymMapWireDesc *) & pSyms[wire->nSyms];
+ pSyms = (KeySym *) &wire[1];
+ wire = (xkbSymMapWireDesc *) &pSyms[wire->nSyms];
}
map = &xkb->map->key_sym_map[i];
@@ -2035,7 +2035,7 @@ SetKeyTypes(XkbDescPtr xkb,
unsigned tmp;
mapWire = (xkbKTSetMapEntryWireDesc *) map;
- preWire = (xkbModsWireDesc *) & mapWire[wire->nMapEntries];
+ preWire = (xkbModsWireDesc *) &mapWire[wire->nMapEntries];
for (n = 0; n < wire->nMapEntries; n++) {
pOld->map[n].active = 1;
pOld->map[n].mods.mask = mapWire[n].realMods;
@@ -2094,7 +2094,7 @@ SetKeySyms(ClientPtr client,
oldMap = &xkb->map->key_sym_map[req->firstKeySym];
for (i = 0; i < req->nKeySyms; i++, oldMap++) {
- pSyms = (KeySym *) & wire[1];
+ pSyms = (KeySym *) &wire[1];
if (wire->nSyms > 0) {
newSyms = XkbResizeKeySyms(xkb, i + req->firstKeySym, wire->nSyms);
for (s = 0; s < wire->nSyms; s++) {
@@ -2112,7 +2112,7 @@ SetKeySyms(ClientPtr client,
oldMap->kt_index[3] = wire->ktIndex[3];
oldMap->group_info = wire->groupInfo;
oldMap->width = wire->width;
- wire = (xkbSymMapWireDesc *) & pSyms[wire->nSyms];
+ wire = (xkbSymMapWireDesc *) &pSyms[wire->nSyms];
}
first = req->firstKeySym;
last = first + req->nKeySyms - 1;
@@ -2404,7 +2404,7 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq * req,
}
if ((req->present & XkbKeyTypesMask) &&
- (!CheckKeyTypes(client, xkb, req, (xkbKeyTypeWireDesc **) & values,
+ (!CheckKeyTypes(client, xkb, req, (xkbKeyTypeWireDesc **) &values,
&nTypes, mapWidths))) {
client->errorValue = nTypes;
return BadValue;
@@ -2429,7 +2429,7 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq * req,
if ((req->present & XkbKeySymsMask) &&
(!CheckKeySyms(client, xkb, req, nTypes, mapWidths, symsPerKey,
- (xkbSymMapWireDesc **) & values, &error))) {
+ (xkbSymMapWireDesc **) &values, &error))) {
client->errorValue = error;
return BadValue;
}
@@ -2443,7 +2443,7 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq * req,
if ((req->present & XkbKeyBehaviorsMask) &&
(!CheckKeyBehaviors
- (xkb, req, (xkbBehaviorWireDesc **) & values, &error))) {
+ (xkb, req, (xkbBehaviorWireDesc **) &values, &error))) {
client->errorValue = error;
return BadValue;
}
@@ -2465,7 +2465,7 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq * req,
}
if ((req->present & XkbVirtualModMapMask) &&
(!CheckVirtualModMap
- (xkb, req, (xkbVModMapWireDesc **) & values, &error))) {
+ (xkb, req, (xkbVModMapWireDesc **) &values, &error))) {
client->errorValue = error;
return BadValue;
}
@@ -5092,7 +5092,7 @@ _CheckSetOverlay(char **wire_inout,
}
CHK_ATOM_ONLY(olWire->name);
ol = XkbAddGeomOverlay(section, olWire->name, olWire->nRows);
- rWire = (xkbOverlayRowWireDesc *) & olWire[1];
+ rWire = (xkbOverlayRowWireDesc *) &olWire[1];
for (r = 0; r < olWire->nRows; r++) {
register int k;
xkbOverlayKeyWireDesc *kWire;
@@ -5104,7 +5104,7 @@ _CheckSetOverlay(char **wire_inout,
return BadMatch;
}
row = XkbAddGeomOverlayRow(ol, rWire->rowUnder, rWire->nKeys);
- kWire = (xkbOverlayKeyWireDesc *) & rWire[1];
+ kWire = (xkbOverlayKeyWireDesc *) &rWire[1];
for (k = 0; k < rWire->nKeys; k++, kWire++) {
if (XkbAddGeomOverlayKey(ol, row,
(char *) kWire->over,
@@ -5158,7 +5158,7 @@ _CheckSetSections(XkbGeometryPtr geom,
section->width = sWire->width;
section->height = sWire->height;
section->angle = sWire->angle;
- rWire = (xkbRowWireDesc *) & sWire[1];
+ rWire = (xkbRowWireDesc *) &sWire[1];
for (r = 0; r < sWire->nRows; r++) {
register int k;
XkbRowPtr row;
@@ -5174,7 +5174,7 @@ _CheckSetSections(XkbGeometryPtr geom,
row->top = rWire->top;
row->left = rWire->left;
row->vertical = rWire->vertical;
- kWire = (xkbKeyWireDesc *) & rWire[1];
+ kWire = (xkbKeyWireDesc *) &rWire[1];
for (k = 0; k < rWire->nKeys; k++) {
XkbKeyPtr key;
@@ -5196,7 +5196,7 @@ _CheckSetSections(XkbGeometryPtr geom,
return BadMatch;
}
}
- rWire = (xkbRowWireDesc *) & kWire[rWire->nKeys];
+ rWire = (xkbRowWireDesc *) &kWire[rWire->nKeys];
}
wire = (char *) rWire;
if (sWire->nDoodads > 0) {
@@ -5260,7 +5260,7 @@ _CheckSetShapes(XkbGeometryPtr geom,
if (!ol)
return BadAlloc;
ol->corner_radius = olWire->cornerRadius;
- ptWire = (xkbPointWireDesc *) & olWire[1];
+ ptWire = (xkbPointWireDesc *) &olWire[1];
for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++) {
pt->x = ptWire[p].x;
pt->y = ptWire[p].y;
@@ -6344,7 +6344,7 @@ ProcXkbGetDeviceInfo(ClientPtr client)
xkbActionWireDesc *awire;
sz = rep.nBtnsRtrn * SIZEOF(xkbActionWireDesc);
- awire = (xkbActionWireDesc *) & dev->button->xkb_acts[rep.firstBtnRtrn];
+ awire = (xkbActionWireDesc *) &dev->button->xkb_acts[rep.firstBtnRtrn];
WriteToClient(client, sz, awire);
length -= sz;
}
diff --git a/xorg-server/xkb/xkbout.c b/xorg-server/xkb/xkbout.c
index cd1ae0b4e..7bb6ceafe 100644
--- a/xorg-server/xkb/xkbout.c
+++ b/xorg-server/xkb/xkbout.c
@@ -522,7 +522,7 @@ XkbWriteXKBSymbols(FILE * file,
for (s = 0; s < XkbKeyGroupWidth(xkb, i, g); s++) {
if (s != 0)
fprintf(file, ", ");
- WriteXKBAction(file, xkb, (XkbAnyAction *) & acts[s]);
+ WriteXKBAction(file, xkb, (XkbAnyAction *) &acts[s]);
}
fprintf(file, " ]");
acts += XkbKeyGroupsWidth(xkb, i);
diff --git a/xorg-server/xkeyboard-config/rules/base.o_s.part b/xorg-server/xkeyboard-config/rules/base.o_s.part
index b4772b4c6..7d880f438 100644
--- a/xorg-server/xkeyboard-config/rules/base.o_s.part
+++ b/xorg-server/xkeyboard-config/rules/base.o_s.part
@@ -6,7 +6,7 @@
altwin:left_meta_win = +altwin(left_meta_win)
altwin:hyper_win = +altwin(hyper_win)
altwin:alt_super_win = +altwin(alt_super_win)
- altwin:swap_lalt_lwin = +altwin(swap_lalt_lwin)
+ altwin:swap_alt_win = +altwin(swap_alt_win)
grp:switch = +group(switch)
grp:lswitch = +group(lswitch)
grp:win_switch = +group(win_switch)
diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in
index 8d8075004..4b18513e9 100644
--- a/xorg-server/xkeyboard-config/rules/base.xml.in
+++ b/xorg-server/xkeyboard-config/rules/base.xml.in
@@ -6196,8 +6196,8 @@
</option>
<option>
<configItem>
- <name>altwin:swap_lalt_lwin</name>
- <_description>Left Alt is swapped with Left Win</_description>
+ <name>altwin:swap_alt_win</name>
+ <_description>Alt is swapped with Win</_description>
</configItem>
</option>
</group>
diff --git a/xorg-server/xkeyboard-config/rules/compat/layoutsMapping.lst b/xorg-server/xkeyboard-config/rules/compat/layoutsMapping.lst
index cecda6d8a..a1a021855 100644
--- a/xorg-server/xkeyboard-config/rules/compat/layoutsMapping.lst
+++ b/xorg-server/xkeyboard-config/rules/compat/layoutsMapping.lst
@@ -14,7 +14,6 @@ iu ca(ike)
lo la
kan in(kan)
mi mao
-ml in(mal)
ogham ie(ogam)
ori ie(ori)
sapmi no(smi)
diff --git a/xorg-server/xkeyboard-config/symbols/altwin b/xorg-server/xkeyboard-config/symbols/altwin
index 92599128f..f7578b493 100644
--- a/xorg-server/xkeyboard-config/symbols/altwin
+++ b/xorg-server/xkeyboard-config/symbols/altwin
@@ -72,8 +72,21 @@ xkb_symbols "alt_super_win" {
};
partial modifier_keys
+xkb_symbols "swap_alt_win" {
+ include "altwin(swap_lalt_lwin)"
+ include "altwin(swap_ralt_rwin)"
+};
+
+partial hidden modifier_keys
xkb_symbols "swap_lalt_lwin" {
key <LALT> { type[Group1] = "ONE_LEVEL",
symbols[Group1] = [ Super_L ] };
key <LWIN> { [ Alt_L, Meta_L ] };
};
+
+partial hidden modifier_keys
+xkb_symbols "swap_ralt_rwin" {
+ key <RALT> { type[Group1] = "ONE_LEVEL",
+ symbols[Group1] = [ Super_R ] };
+ key <RWIN> { [ Alt_R, Meta_R ] };
+};
diff --git a/xorg-server/xkeyboard-config/symbols/cd.in b/xorg-server/xkeyboard-config/symbols/cd.in
index 78803dbcc..5e51535cc 100644
--- a/xorg-server/xkeyboard-config/symbols/cd.in
+++ b/xorg-server/xkeyboard-config/symbols/cd.in
@@ -24,10 +24,10 @@ xkb_symbols "basic" {
key <AE11> { [ minus, underscore, percent, degree ] };
key <AE12> { [ equal, plus, multiply, division ] };
- key <AD01> { [ a, A, ae, AE ] };
+ key <AD01> { [ a, A, ae, AE ] };
key <AD02> { [ z, Z ] };
key <AD03> { [ e, E, oe, OE ] };
- key <AD04> { [ r, R ] };
+ key <AD04> { [ r, R ] };
key <AD05> { [ t, T ] };
key <AD06> { [ y, Y ] };
key <AD07> { [ u, U, 0x01000289, 0x01000244 ] };
@@ -46,16 +46,16 @@ xkb_symbols "basic" {
key <AC07> { [ j, J ] };
key <AC08> { [ k, K ] };
key <AC09> { [ l, L ] };
- key <AC10> { [ m, M ] };
- key <AC11> { [0x01000254, 0x01000186 ] };
- key <LSGT> { [ backslash, bar ] };
+ key <AC10> { [ m, M ] };
+ key <AC11> { [0x01000254, 0x01000186 ] };
+ key <LSGT> { [ backslash, bar ] };
key <AB01> { [ w, W ] };
- key <AB02> { [ x, X ] };
+ key <AB02> { [ x, X ] };
key <AB03> { [ c, C, ccedilla, Ccedilla ] };
key <AB04> { [ v, V ] };
key <AB05> { [ b, B ] };
- key <AB06> { [ n, N ] };
+ key <AB06> { [ n, N, 0x01000014B, 0x0100014A ] };
key <AB07> { [ comma, question, 0x01000327 ] };
key <AB08> { [ semicolon, period ] };
key <AB09> { [ colon, slash ] };
diff --git a/xorg-server/xkeyboard-config/symbols/gr b/xorg-server/xkeyboard-config/symbols/gr
index f4364cf89..d7d126009 100644
--- a/xorg-server/xkeyboard-config/symbols/gr
+++ b/xorg-server/xkeyboard-config/symbols/gr
@@ -73,7 +73,7 @@ xkb_symbols "simple" {
key <AE12> { [ equal, plus ] }; // = +
key <AD11> { [ bracketleft, braceleft ] }; // [ {
- key <AD12> { [ bracketright, braceright ] }; // [ {
+ key <AD12> { [ bracketright, braceright ] }; // ] }
key <AC11> { [ apostrophe, quotedbl ] }; // ' "
@@ -180,7 +180,9 @@ xkb_symbols "polytonic" {
key <AD12> { [ dead_iota, VoidSymbol, dead_breve ] }; // ͺ ˘
key <AC10> { [ dead_acute, dead_psili ] }; // ´ ̓
- key <AC11> { [ dead_grave, dead_dasia ] }; // ` ̔
+ key <AC11> { type[Group1]="FOUR_LEVEL",
+ [ dead_grave, dead_dasia, apostrophe, quotedbl ] };
+ // ` ̔ ' "
};
partial alphanumeric_keys alternate_group