aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libX11/nls/Makefile.am285
-rw-r--r--libX11/nls/xmlrules.in59
-rw-r--r--libX11/specs/xmlrules.in126
-rw-r--r--mesalib/SConstruct341
-rw-r--r--mesalib/common.py9
-rw-r--r--mesalib/configure.ac430
-rw-r--r--mesalib/docs/egl.html643
-rw-r--r--mesalib/docs/opengles.html139
-rw-r--r--mesalib/docs/openvg.html104
-rw-r--r--mesalib/docs/relnotes-7.11.html172
-rw-r--r--mesalib/scons/custom.py3
-rw-r--r--mesalib/scons/gallium.py25
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_debug.c1488
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.c58
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.h246
-rw-r--r--mesalib/src/glsl/SConscript362
-rw-r--r--mesalib/src/mapi/glapi/SConscript169
-rw-r--r--mesalib/src/mesa/main/fbobject.c4
-rw-r--r--mesalib/src/mesa/main/teximage.c6
-rw-r--r--mesalib/src/mesa/main/texobj.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c16
-rw-r--r--xorg-server/configure.ac2
-rw-r--r--xorg-server/doc/dtrace/Makefile.am2
-rw-r--r--xorg-server/docbook.am6
-rw-r--r--xorg-server/exa/exa_unaccel.c2
25 files changed, 2309 insertions, 2390 deletions
diff --git a/libX11/nls/Makefile.am b/libX11/nls/Makefile.am
index cf7971ff7..cabaf40e1 100644
--- a/libX11/nls/Makefile.am
+++ b/libX11/nls/Makefile.am
@@ -1,141 +1,144 @@
-
-x11localedir = $(X11_LOCALEDATADIR)
-specdir = $(docdir)/Compose
-
-include $(top_srcdir)/specs/xmlrules.in
-
-EXTRA_DIST = locale.alias.pre compose.dir.pre locale.dir.pre \
- compose-check.pl compose-chart.pl
-
-x11locale_DATA = locale.alias locale.dir compose.dir
-
-CLEANFILES += \
- locale.alias locale.alias.l1 locale.alias.l2 \
- compose.dir compose.dir.l1 compose.dir.l2 \
- locale.dir locale.dir.l1 locale.dir.l2 \
- XLC_LOCALE
-
-locales = \
- am_ET.UTF-8 \
- armscii-8 \
- C \
- el_GR.UTF-8 \
- en_US.UTF-8 \
- fi_FI.UTF-8 \
- georgian-academy \
- georgian-ps \
- ibm-cp1133 \
- iscii-dev \
- isiri-3342 \
- iso8859-1 \
- iso8859-10 \
- iso8859-11 \
- iso8859-13 \
- iso8859-14 \
- iso8859-15 \
- iso8859-2 \
- iso8859-3 \
- iso8859-4 \
- iso8859-5 \
- iso8859-6 \
- iso8859-7 \
- iso8859-8 \
- iso8859-9 \
- iso8859-9e \
- ja \
- ja.JIS \
- ja_JP.UTF-8 \
- ja.S90 \
- ja.SJIS \
- ja.U90 \
- ko \
- koi8-c \
- koi8-r \
- koi8-u \
- ko_KR.UTF-8 \
- microsoft-cp1251 \
- microsoft-cp1255 \
- microsoft-cp1256 \
- mulelao-1 \
- nokhchi-1 \
- pt_BR.UTF-8 \
- ru_RU.UTF-8 \
- tatar-cyr \
- th_TH \
- th_TH.UTF-8 \
- tscii-0 \
- vi_VN.tcvn \
- vi_VN.viscii \
- zh_CN \
- zh_CN.gb18030 \
- zh_CN.gbk \
- zh_CN.UTF-8 \
- zh_HK.big5 \
- zh_HK.big5hkscs \
- zh_HK.UTF-8 \
- zh_TW \
- zh_TW.big5 \
- zh_TW.UTF-8
-
-include $(top_srcdir)/cpprules.in
-
-# Global data files
-
-locale.alias: locale.alias.pre
- $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $(srcdir)/locale.alias.pre | $(CPP_SED_MAGIC) > locale.alias.l1
- sed -e '/^[^#][^ ]*:/s/://' -e '/^[^#].*[ ].*:/d' \
- < locale.alias.l1 > locale.alias.l2
- cat locale.alias.l2 locale.alias.l1 > locale.alias
-
-compose.dir: compose.dir.pre
- $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $(srcdir)/compose.dir.pre | $(CPP_SED_MAGIC) > compose.dir.l1
- sed -e '/^[^#][^ ]*:/s/://' -e '/^[^#].*[ ].*:/d' \
- < compose.dir.l1 > compose.dir.l2
- cat compose.dir.l2 compose.dir.l1 > compose.dir
-
-locale.dir: locale.dir.pre
- $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $(srcdir)/locale.dir.pre | $(CPP_SED_MAGIC) > locale.dir.l1
- sed -e '/^[^#][^ ]*:/s/://' -e '/^[^#].*[ ].*:/d' \
- < locale.dir.l1 > locale.dir.l2
- cat locale.dir.l2 locale.dir.l1 > locale.dir
-
-if HAVE_PERL
-doc_sources = Compose/index.xml
-
-Compose/index.xml:
- @$(MKDIR_P) $(@D)
- $(AM_V_GEN)$(PERL) $(srcdir)/compose-chart.pl \
- --index --output="$@" $(locales)
-
-clean-local: clean-Compose-dir
-clean-Compose-dir:
- -rm -rf Compose
-endif HAVE_PERL
-
-
-# Per-locale data files
-
-nobase_dist_x11locale_DATA = $(locales:%=%/XI18N_OBJS)
-
-nobase_x11locale_DATA = $(locales:%=%/XLC_LOCALE) $(locales:%=%/Compose)
-EXTRA_DIST += $(nobase_x11locale_DATA:%=%.pre)
-CLEANFILES += $(nobase_x11locale_DATA)
-
-if HAVE_PERL
-TESTS_ENVIRONMENT = $(PERL)
-TESTS = $(srcdir)/compose-check.pl
-
-COMPOSE_CHARTS = $(locales:%=%/Compose.xml)
-doc_sources += $(locales:%=Compose/%.xml)
-CLEANFILES += $(COMPOSE_CHARTS) $(doc_sources)
-
-XMLTO_FLAGS += -o $(@D)
-
-%/Compose.xml: %/Compose
- $(AM_V_GEN)$(PERL) $(srcdir)/compose-chart.pl \
- --locale="$(@D)" --output="$@" $<
-
-Compose/%.xml: %/Compose.xml
- $(AM_V_GEN)cp $< $@
-
-endif HAVE_PERL
+
+x11localedir = $(X11_LOCALEDATADIR)
+specdir = $(docdir)/Compose
+CLEANFILES =
+XMLTO_FLAGS =
+SUFFIXES =
+
+include $(top_srcdir)/nls/xmlrules.in
+
+EXTRA_DIST = locale.alias.pre compose.dir.pre locale.dir.pre \
+ compose-check.pl compose-chart.pl
+
+x11locale_DATA = locale.alias locale.dir compose.dir
+
+CLEANFILES += \
+ locale.alias locale.alias.l1 locale.alias.l2 \
+ compose.dir compose.dir.l1 compose.dir.l2 \
+ locale.dir locale.dir.l1 locale.dir.l2 \
+ XLC_LOCALE
+
+locales = \
+ am_ET.UTF-8 \
+ armscii-8 \
+ C \
+ el_GR.UTF-8 \
+ en_US.UTF-8 \
+ fi_FI.UTF-8 \
+ georgian-academy \
+ georgian-ps \
+ ibm-cp1133 \
+ iscii-dev \
+ isiri-3342 \
+ iso8859-1 \
+ iso8859-10 \
+ iso8859-11 \
+ iso8859-13 \
+ iso8859-14 \
+ iso8859-15 \
+ iso8859-2 \
+ iso8859-3 \
+ iso8859-4 \
+ iso8859-5 \
+ iso8859-6 \
+ iso8859-7 \
+ iso8859-8 \
+ iso8859-9 \
+ iso8859-9e \
+ ja \
+ ja.JIS \
+ ja_JP.UTF-8 \
+ ja.S90 \
+ ja.SJIS \
+ ja.U90 \
+ ko \
+ koi8-c \
+ koi8-r \
+ koi8-u \
+ ko_KR.UTF-8 \
+ microsoft-cp1251 \
+ microsoft-cp1255 \
+ microsoft-cp1256 \
+ mulelao-1 \
+ nokhchi-1 \
+ pt_BR.UTF-8 \
+ ru_RU.UTF-8 \
+ tatar-cyr \
+ th_TH \
+ th_TH.UTF-8 \
+ tscii-0 \
+ vi_VN.tcvn \
+ vi_VN.viscii \
+ zh_CN \
+ zh_CN.gb18030 \
+ zh_CN.gbk \
+ zh_CN.UTF-8 \
+ zh_HK.big5 \
+ zh_HK.big5hkscs \
+ zh_HK.UTF-8 \
+ zh_TW \
+ zh_TW.big5 \
+ zh_TW.UTF-8
+
+include $(top_srcdir)/cpprules.in
+
+# Global data files
+
+locale.alias: locale.alias.pre
+ $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $(srcdir)/locale.alias.pre | $(CPP_SED_MAGIC) > locale.alias.l1
+ sed -e '/^[^#][^ ]*:/s/://' -e '/^[^#].*[ ].*:/d' \
+ < locale.alias.l1 > locale.alias.l2
+ cat locale.alias.l2 locale.alias.l1 > locale.alias
+
+compose.dir: compose.dir.pre
+ $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $(srcdir)/compose.dir.pre | $(CPP_SED_MAGIC) > compose.dir.l1
+ sed -e '/^[^#][^ ]*:/s/://' -e '/^[^#].*[ ].*:/d' \
+ < compose.dir.l1 > compose.dir.l2
+ cat compose.dir.l2 compose.dir.l1 > compose.dir
+
+locale.dir: locale.dir.pre
+ $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $(srcdir)/locale.dir.pre | $(CPP_SED_MAGIC) > locale.dir.l1
+ sed -e '/^[^#][^ ]*:/s/://' -e '/^[^#].*[ ].*:/d' \
+ < locale.dir.l1 > locale.dir.l2
+ cat locale.dir.l2 locale.dir.l1 > locale.dir
+
+if HAVE_PERL
+doc_sources = Compose/index.xml
+
+Compose/index.xml:
+ @$(MKDIR_P) $(@D)
+ $(AM_V_GEN)$(PERL) $(srcdir)/compose-chart.pl \
+ --index --output="$@" $(locales)
+
+clean-local: clean-Compose-dir
+clean-Compose-dir:
+ -rm -rf Compose
+endif HAVE_PERL
+
+
+# Per-locale data files
+
+nobase_dist_x11locale_DATA = $(locales:%=%/XI18N_OBJS)
+
+nobase_x11locale_DATA = $(locales:%=%/XLC_LOCALE) $(locales:%=%/Compose)
+EXTRA_DIST += $(nobase_x11locale_DATA:%=%.pre)
+CLEANFILES += $(nobase_x11locale_DATA)
+
+if HAVE_PERL
+TESTS_ENVIRONMENT = $(PERL)
+TESTS = $(srcdir)/compose-check.pl
+
+COMPOSE_CHARTS = $(locales:%=%/Compose.xml)
+doc_sources += $(locales:%=Compose/%.xml)
+CLEANFILES += $(COMPOSE_CHARTS) $(doc_sources)
+
+XMLTO_FLAGS += -o $(@D)
+
+%/Compose.xml: %/Compose
+ $(AM_V_GEN)$(PERL) $(srcdir)/compose-chart.pl \
+ --locale="$(@D)" --output="$@" $<
+
+Compose/%.xml: %/Compose.xml
+ $(AM_V_GEN)cp $< $@
+
+endif HAVE_PERL
diff --git a/libX11/nls/xmlrules.in b/libX11/nls/xmlrules.in
new file mode 100644
index 000000000..5a6be24f5
--- /dev/null
+++ b/libX11/nls/xmlrules.in
@@ -0,0 +1,59 @@
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (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.
+#
+
+if HAVE_XMLTO
+spec_DATA = $(doc_sources:.xml=.html)
+
+if HAVE_FOP
+spec_DATA += $(doc_sources:.xml=.ps) $(doc_sources:.xml=.pdf)
+endif
+
+if HAVE_XMLTO_TEXT
+spec_DATA += $(doc_sources:.xml=.txt)
+endif
+
+if HAVE_STYLESHEETS
+XMLTO_FLAGS += \
+ -m $(XSL_STYLESHEET) \
+ --stringparam img.src.path=$(abs_builddir)/ \
+ --stringparam html.stylesheet=$(STYLESHEET_SRCDIR)/xorg.css
+endif
+
+CLEANFILES += $(spec_DATA)
+
+%.txt: %.xml $(dist_spec_DATA)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
+
+%.html: %.xml $(dist_spec_DATA)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
+
+%.pdf: %.xml $(dist_spec_DATA)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
+
+%.ps: %.xml $(dist_spec_DATA)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop ps $<
+
+chunked-html: $(doc_sources)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) -o html xhtml $(doc_sources)
+
+endif HAVE_XMLTO
diff --git a/libX11/specs/xmlrules.in b/libX11/specs/xmlrules.in
index b58ff5f08..8b105f334 100644
--- a/libX11/specs/xmlrules.in
+++ b/libX11/specs/xmlrules.in
@@ -1,67 +1,59 @@
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (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.
-#
-
-CLEANFILES =
-SUFFIXES =
-XMLTO_FLAGS =
-
-if HAVE_XMLTO
-spec_DATA = $(doc_sources:.xml=.html)
-
-if HAVE_FOP
-spec_DATA += $(doc_sources:.xml=.ps) $(doc_sources:.xml=.pdf)
-endif
-
-if HAVE_XMLTO_TEXT
-spec_DATA += $(doc_sources:.xml=.txt)
-endif
-
-if HAVE_STYLESHEETS
-XMLTO_FLAGS += \
- -m $(XSL_STYLESHEET) \
- --stringparam img.src.path=$(abs_builddir)/ \
- --stringparam html.stylesheet=$(STYLESHEET_SRCDIR)/xorg.css
-endif
-
-CLEANFILES += $(spec_DATA)
-
-SUFFIXES += .xml .ps .pdf .txt .html
-
-%.txt: %.xml $(dist_spec_DATA)
- $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
-
-%.html: %.xml $(dist_spec_DATA)
- $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
-
-%.pdf: %.xml $(dist_spec_DATA)
- $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
-
-%.ps: %.xml $(dist_spec_DATA)
- $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop ps $<
-
-chunked-html: $(doc_sources)
- $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) -o html xhtml $(doc_sources)
-
-CLEANFILES += html
-
-endif HAVE_XMLTO
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (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.
+#
+
+if HAVE_XMLTO
+spec_DATA = $(doc_sources:.xml=.html)
+
+if HAVE_FOP
+spec_DATA += $(doc_sources:.xml=.ps) $(doc_sources:.xml=.pdf)
+endif
+
+if HAVE_XMLTO_TEXT
+spec_DATA += $(doc_sources:.xml=.txt)
+endif
+
+if HAVE_STYLESHEETS
+XMLTO_FLAGS = \
+ -m $(XSL_STYLESHEET) \
+ --stringparam img.src.path=$(abs_builddir)/ \
+ --stringparam html.stylesheet=$(STYLESHEET_SRCDIR)/xorg.css
+endif
+
+CLEANFILES = $(spec_DATA)
+
+%.txt: %.xml $(dist_spec_DATA)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
+
+%.html: %.xml $(dist_spec_DATA)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
+
+%.pdf: %.xml $(dist_spec_DATA)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
+
+%.ps: %.xml $(dist_spec_DATA)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop ps $<
+
+chunked-html: $(doc_sources)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) -o html xhtml $(doc_sources)
+
+endif HAVE_XMLTO
diff --git a/mesalib/SConstruct b/mesalib/SConstruct
index 7773719af..029daa1c6 100644
--- a/mesalib/SConstruct
+++ b/mesalib/SConstruct
@@ -1,181 +1,160 @@
-#######################################################################
-# Top-level SConstruct
-#
-# For example, invoke scons as
-#
-# scons build=debug llvm=yes machine=x86
-#
-# to set configuration variables. Or you can write those options to a file
-# named config.py:
-#
-# # config.py
-# build='debug'
-# llvm=True
-# machine='x86'
-#
-# Invoke
-#
-# scons -h
-#
-# to get the full list of options. See scons manpage for more info.
-#
-
-import os
-import os.path
-import sys
-import SCons.Util
-
-import common
-
-#######################################################################
-# Configuration options
-
-opts = Variables('config.py')
-common.AddOptions(opts)
-
-env = Environment(
- options = opts,
- tools = ['gallium'],
- toolpath = ['#scons'],
- ENV = os.environ,
-)
-
-# Backwards compatability with old target configuration variable
-try:
- targets = ARGUMENTS['targets']
-except KeyError:
- pass
-else:
- targets = targets.split(',')
- print 'scons: warning: targets option is deprecated; pass the targets on their own such as'
- print
- print ' scons %s' % ' '.join(targets)
- print
- COMMAND_LINE_TARGETS.append(targets)
-
-
-Help(opts.GenerateHelpText(env))
-
-# fail early for a common error on windows
-if env['gles']:
- try:
- import libxml2
- except ImportError:
- raise SCons.Errors.UserError, "GLES requires libxml2-python to build"
-
-#######################################################################
-# Environment setup
-
-# Includes
-env.Prepend(CPPPATH = [
- '#/include',
-])
-env.Append(CPPPATH = [
- '#/src/gallium/include',
- '#/src/gallium/auxiliary',
- '#/src/gallium/drivers',
- '#/src/gallium/winsys',
-])
-
-if env['msvc']:
- env.Append(CPPPATH = ['#include/c99'])
-
-# Embedded
-if env['platform'] == 'embedded':
- env.Append(CPPDEFINES = [
- '_POSIX_SOURCE',
- ('_POSIX_C_SOURCE', '199309L'),
- '_SVID_SOURCE',
- '_BSD_SOURCE',
- '_GNU_SOURCE',
-
- 'PTHREADS',
- ])
- env.Append(LIBS = [
- 'm',
- 'pthread',
- 'dl',
- ])
-
-# Posix
-if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
- env.Append(CPPDEFINES = [
- '_POSIX_SOURCE',
- ('_POSIX_C_SOURCE', '199309L'),
- '_SVID_SOURCE',
- '_BSD_SOURCE',
- '_GNU_SOURCE',
- 'PTHREADS',
- 'HAVE_POSIX_MEMALIGN',
- ])
- if env['gcc']:
- env.Append(CFLAGS = ['-fvisibility=hidden'])
- if env['platform'] == 'darwin':
- env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
- env.Append(LIBS = [
- 'm',
- 'pthread',
- 'dl',
- ])
-
-# for debugging
-#print env.Dump()
-
-
-#######################################################################
-# Invoke host SConscripts
-#
-# For things that are meant to be run on the native host build machine, instead
-# of the target machine.
-#
-
-# Create host environent
-if env['crosscompile'] and env['platform'] != 'embedded':
- host_env = Environment(
- options = opts,
- # no tool used
- tools = [],
- toolpath = ['#scons'],
- ENV = os.environ,
- )
-
- # Override options
- host_env['platform'] = common.host_platform
- host_env['machine'] = common.host_machine
- host_env['toolchain'] = 'default'
- host_env['llvm'] = False
-
- host_env.Tool('gallium')
-
- host_env['hostonly'] = True
- assert host_env['crosscompile'] == False
-
- if host_env['msvc']:
- host_env.Append(CPPPATH = ['#include/c99'])
-
- target_env = env
- env = host_env
- Export('env')
-
- SConscript(
- 'src/SConscript',
- variant_dir = host_env['build_dir'],
- duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
- )
-
- env = target_env
-
-Export('env')
-
-#######################################################################
-# Invoke SConscripts
-
-# TODO: Build several variants at the same time?
-# http://www.scons.org/wiki/SimultaneousVariantBuilds
-
-SConscript(
- 'src/SConscript',
- variant_dir = env['build_dir'],
- duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
-)
-
+#######################################################################
+# Top-level SConstruct
+#
+# For example, invoke scons as
+#
+# scons build=debug llvm=yes machine=x86
+#
+# to set configuration variables. Or you can write those options to a file
+# named config.py:
+#
+# # config.py
+# build='debug'
+# llvm=True
+# machine='x86'
+#
+# Invoke
+#
+# scons -h
+#
+# to get the full list of options. See scons manpage for more info.
+#
+
+import os
+import os.path
+import sys
+import SCons.Util
+
+import common
+
+#######################################################################
+# Configuration options
+
+opts = Variables('config.py')
+common.AddOptions(opts)
+
+env = Environment(
+ options = opts,
+ tools = ['gallium'],
+ toolpath = ['#scons'],
+ ENV = os.environ,
+)
+
+opts.Save('config.py', env)
+
+# Backwards compatability with old target configuration variable
+try:
+ targets = ARGUMENTS['targets']
+except KeyError:
+ pass
+else:
+ targets = targets.split(',')
+ print 'scons: warning: targets option is deprecated; pass the targets on their own such as'
+ print
+ print ' scons %s' % ' '.join(targets)
+ print
+ COMMAND_LINE_TARGETS.append(targets)
+
+
+Help(opts.GenerateHelpText(env))
+
+# fail early for a common error on windows
+if env['gles']:
+ try:
+ import libxml2
+ except ImportError:
+ raise SCons.Errors.UserError, "GLES requires libxml2-python to build"
+
+#######################################################################
+# Environment setup
+
+# Includes
+env.Prepend(CPPPATH = [
+ '#/include',
+])
+env.Append(CPPPATH = [
+ '#/src/gallium/include',
+ '#/src/gallium/auxiliary',
+ '#/src/gallium/drivers',
+ '#/src/gallium/winsys',
+])
+
+if env['msvc']:
+ env.Append(CPPPATH = ['#include/c99'])
+
+# for debugging
+#print env.Dump()
+
+
+#######################################################################
+# Invoke host SConscripts
+#
+# For things that are meant to be run on the native host build machine, instead
+# of the target machine.
+#
+
+# Create host environent
+if env['crosscompile'] and not env['embedded']:
+ host_env = Environment(
+ options = opts,
+ # no tool used
+ tools = [],
+ toolpath = ['#scons'],
+ ENV = os.environ,
+ )
+
+ # Override options
+ host_env['platform'] = common.host_platform
+ host_env['machine'] = common.host_machine
+ host_env['toolchain'] = 'default'
+ host_env['llvm'] = False
+
+ host_env.Tool('gallium')
+
+ host_env['hostonly'] = True
+ assert host_env['crosscompile'] == False
+
+ if host_env['msvc']:
+ host_env.Append(CPPPATH = ['#include/c99'])
+
+ target_env = env
+ env = host_env
+ Export('env')
+
+ SConscript(
+ 'src/SConscript',
+ variant_dir = host_env['build_dir'],
+ duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
+ )
+
+ env = target_env
+
+Export('env')
+
+#######################################################################
+# Invoke SConscripts
+
+# TODO: Build several variants at the same time?
+# http://www.scons.org/wiki/SimultaneousVariantBuilds
+
+SConscript(
+ 'src/SConscript',
+ variant_dir = env['build_dir'],
+ duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
+)
+
+
+########################################################################
+# List all aliases
+
+try:
+ from SCons.Node.Alias import default_ans
+except ImportError:
+ pass
+else:
+ aliases = default_ans.keys()
+ aliases.sort()
+ env.Help('\n')
+ env.Help('Recognized targets:\n')
+ for alias in aliases:
+ env.Help(' %s\n' % alias)
diff --git a/mesalib/common.py b/mesalib/common.py
index 0a3dcdcf5..8f13186f5 100644
--- a/mesalib/common.py
+++ b/mesalib/common.py
@@ -79,14 +79,17 @@ def AddOptions(opts):
from SCons.Options.EnumOption import EnumOption
opts.Add(EnumOption('build', 'build type', 'debug',
allowed_values=('debug', 'checked', 'profile', 'release')))
- opts.Add(BoolOption('quiet', 'quiet command lines', 'yes'))
+ opts.Add(BoolOption('verbose', 'verbose output', 'no'))
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
opts.Add(EnumOption('platform', 'target platform', host_platform,
- allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'embedded', 'cygwin', 'sunos', 'freebsd8')))
+ allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'cygwin', 'sunos', 'freebsd8')))
+ opts.Add(BoolOption('embedded', 'embedded build', 'no'))
opts.Add('toolchain', 'compiler toolchain', default_toolchain)
opts.Add(BoolOption('gles', 'EXPERIMENTAL: enable OpenGL ES support', 'no'))
opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes'))
opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no'))
- opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
+ opts.Add(BoolOption('quiet', 'DEPRECATED: quiet command lines', 'yes'))
+ if host_platform == 'windows':
+ opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index 69513c1c4..c9dd8a70c 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -507,7 +507,7 @@ if test "x$enable_selinux" = "xyes"; then
DEFINES="$DEFINES -DMESA_SELINUX"
fi
-dnl Determine which APIs to support
+dnl Options for APIs
AC_ARG_ENABLE([opengl],
[AS_HELP_STRING([--disable-opengl],
[disable support for standard OpenGL API @<:@default=no@:>@])],
@@ -523,32 +523,51 @@ AC_ARG_ENABLE([gles2],
[enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
[enable_gles2="$enableval"],
[enable_gles2=no])
-AC_ARG_ENABLE([gles-overlay],
- [AS_HELP_STRING([--enable-gles-overlay],
- [DEPRECATED. Same as --enable-gles1 and --enable-gles2])],
- [enable_gles1="$enableval"; enable_gles2="$enableval"],
- [])
-
AC_ARG_ENABLE([openvg],
[AS_HELP_STRING([--enable-openvg],
[enable support for OpenVG API @<:@default=no@:>@])],
[enable_openvg="$enableval"],
[enable_openvg=no])
+AC_ARG_ENABLE([xorg],
+ [AS_HELP_STRING([--enable-xorg],
+ [enable support for X.Org DDX API @<:@default=no@:>@])],
+ [enable_xorg="$enableval"],
+ [enable_xorg=no])
+AC_ARG_ENABLE([d3d1x],
+ [AS_HELP_STRING([--enable-d3d1x],
+ [enable support for Direct3D 10 & 11 low-level API @<:@default=no@:>@])],
+ [enable_d3d1x="$enableval"],
+ [enable_d3d1x=no])
+AC_ARG_ENABLE([egl],
+ [AS_HELP_STRING([--disable-egl],
+ [disable EGL library @<:@default=enabled@:>@])],
+ [enable_egl="$enableval"],
+ [enable_egl=yes])
+AC_ARG_ENABLE([gallium_egl],
+ [AS_HELP_STRING([--enable-gallium-egl],
+ [enable optional EGL state tracker (not required
+ for EGL support in Gallium with OpenGL and OpenGL ES)
+ @<:@default=disable@:>@])],
+ [enable_gallium_egl="$enableval"],
+ [enable_gallium_egl=no])
-dnl smooth the transition; should be removed eventually
-if test "x$enable_openvg" = xno; then
- case "x$with_state_trackers" in
- x*vega*)
- AC_MSG_WARN([vega state tracker is enabled without --enable-openvg])
- enable_openvg=yes
- ;;
- esac
-fi
+# Option for Gallium drivers
+GALLIUM_DRIVERS_DEFAULT="r300,r600,swrast"
+
+AC_ARG_WITH([gallium-drivers],
+ [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],
+ [comma delimited Gallium drivers list, e.g.
+ "i915,i965,nouveau,r300,r600,svga,swrast"
+ @<:@default=r300,r600,swrast@:>@])],
+ [with_gallium_drivers="$withval"],
+ [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
if test "x$enable_opengl" = xno -a \
"x$enable_gles1" = xno -a \
"x$enable_gles2" = xno -a \
- "x$enable_openvg" = xno; then
+ "x$enable_openvg" = xno -a \
+ "x$enable_xorg" = xno -a \
+ "x$enable_d3d1x" = xno; then
AC_MSG_ERROR([at least one API should be enabled])
fi
@@ -657,11 +676,6 @@ if test "x$enable_gles2" = xyes; then
CORE_DIRS="$CORE_DIRS mapi/es2api"
fi
-# build vgapi if OpenVG is enabled
-if test "x$enable_openvg" = xyes; then
- CORE_DIRS="$CORE_DIRS mapi/vgapi"
-fi
-
# build glsl and mesa if OpenGL or OpenGL ES is enabled
case "x$enable_opengl$enable_gles1$enable_gles2" in
x*yes*)
@@ -674,11 +688,14 @@ xlib)
DRIVER_DIRS="x11"
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
+ GALLIUM_STATE_TRACKERS_DIRS="glx $GALLIUM_STATE_TRACKERS_DIRS"
;;
dri)
SRC_DIRS="$SRC_DIRS glx"
DRIVER_DIRS="dri"
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri"
+ GALLIUM_STATE_TRACKERS_DIRS="dri $GALLIUM_STATE_TRACKERS_DIRS"
+ HAVE_ST_DRI="yes"
;;
osmesa)
DRIVER_DIRS="osmesa"
@@ -1184,23 +1201,18 @@ AC_SUBST([OSMESA_PC_LIB_PRIV])
dnl
dnl EGL configuration
dnl
-AC_ARG_ENABLE([egl],
- [AS_HELP_STRING([--disable-egl],
- [disable EGL library @<:@default=enabled@:>@])],
- [enable_egl="$enableval"],
- [enable_egl=yes])
+EGL_CLIENT_APIS=""
+
if test "x$enable_egl" = xno; then
if test "x$mesa_driver" = xno; then
AC_MSG_ERROR([cannot disable EGL when there is no mesa driver])
fi
- if test "x$enable_openvg" = xyes; then
- AC_MSG_ERROR([cannot enable OpenVG without EGL])
- fi
fi
if test "x$enable_egl" = xyes; then
SRC_DIRS="$SRC_DIRS egl"
EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS -lpthread"
EGL_DRIVERS_DIRS=""
+
if test "$enable_static" != yes; then
# build egl_glx when libGL is built
if test "$mesa_driver" = xlib -o "$mesa_driver" = dri; then
@@ -1233,6 +1245,72 @@ AC_SUBST([EGL_LIB_DEPS])
AC_SUBST([EGL_DRIVERS_DIRS])
dnl
+dnl EGL Gallium configuration
+dnl
+if test "x$enable_gallium_egl" = xyes; then
+ if test "x$with_gallium_drivers" = x; then
+ AC_MSG_ERROR([cannot enable egl_gallium without Gallium])
+ fi
+ if test "x$enable_egl" = xno; then
+ AC_MSG_ERROR([cannot enable egl_gallium without EGL])
+ fi
+
+ GALLIUM_STATE_TRACKERS_DIRS="egl $GALLIUM_STATE_TRACKERS_DIRS"
+ GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
+ HAVE_ST_EGL="yes"
+fi
+
+dnl
+dnl X.Org DDX configuration
+dnl
+if test "x$enable_xorg" = xyes; then
+ PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
+ PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
+ PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
+ PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
+ HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
+ HAVE_XEXTPROTO_71="no")
+ GALLIUM_STATE_TRACKERS_DIRS="xorg $GALLIUM_STATE_TRACKERS_DIRS"
+ HAVE_ST_XORG=yes
+fi
+
+dnl
+dnl OpenVG configuration
+dnl
+VG_LIB_DEPS=""
+
+if test "x$enable_openvg" = xyes; then
+ if test "x$enable_egl" = xno; then
+ AC_MSG_ERROR([cannot enable OpenVG without EGL])
+ fi
+ if test "x$with_gallium_drivers" = x; then
+ AC_MSG_ERROR([cannot enable OpenVG without Gallium])
+ fi
+ if test "x$enable_gallium_egl" = xno; then
+ AC_MSG_ERROR([cannot enable OpenVG without egl_gallium])
+ fi
+
+ EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
+ VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS -lpthread"
+ CORE_DIRS="$CORE_DIRS mapi/vgapi"
+ GALLIUM_STATE_TRACKERS_DIRS="vega $GALLIUM_STATE_TRACKERS_DIRS"
+ HAVE_ST_VEGA=yes
+fi
+
+dnl
+dnl D3D1X configuration
+dnl
+
+if test "x$enable_d3d1x" = xyes; then
+ if test "x$with_gallium_drivers" = x; then
+ AC_MSG_ERROR([cannot enable D3D1X without Gallium])
+ fi
+
+ GALLIUM_STATE_TRACKERS_DIRS="d3d1x $GALLIUM_STATE_TRACKERS_DIRS"
+ HAVE_ST_D3D1X=yes
+fi
+
+dnl
dnl GLU configuration
dnl
AC_ARG_ENABLE([glu],
@@ -1448,17 +1526,11 @@ AC_SUBST([PROGRAM_DIRS])
dnl
dnl Gallium configuration
dnl
-AC_ARG_ENABLE([gallium],
- [AS_HELP_STRING([--disable-gallium],
- [build gallium @<:@default=enabled@:>@])],
- [enable_gallium="$enableval"],
- [enable_gallium=yes])
-if test "x$enable_gallium" = xno -a "x$enable_openvg" = xyes; then
- AC_MSG_ERROR([cannot enable OpenVG without Gallium])
-fi
-if test "x$enable_gallium" = xyes; then
+if test "x$with_gallium_drivers" != x; then
SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
+else
+ LLVM_CONFIG=no
fi
AC_SUBST([LLVM_CFLAGS])
@@ -1466,160 +1538,23 @@ AC_SUBST([LLVM_LIBS])
AC_SUBST([LLVM_LDFLAGS])
AC_SUBST([LLVM_VERSION])
-dnl
-dnl Gallium state trackers configuration
-dnl
-
-AC_ARG_ENABLE([gallium-egl],
- [AS_HELP_STRING([--enable-gallium-egl],
- [enable gallium EGL state tracker @<:@default=auto@:>@])],
- [enable_gallium_egl="$enableval"],
- [enable_gallium_egl=auto])
-if test "x$enable_gallium_egl" = xauto; then
- case "$mesa_driver" in
- dri|no)
- enable_gallium_egl=$enable_egl
- ;;
- *)
- enable_gallium_egl=$enable_openvg
- ;;
- esac
-fi
-case "x$enable_egl$enable_gallium_egl" in
-xnoyes)
- AC_MSG_ERROR([cannot build Gallium EGL state tracker without EGL])
-esac
-AC_ARG_WITH([state-trackers],
- [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
- [comma delimited state_trackers list, e.g.
- "egl,glx" @<:@default=auto@:>@])],
- [with_state_trackers="$withval"],
- [with_state_trackers=yes])
-
-case "$with_state_trackers" in
-no)
- GALLIUM_STATE_TRACKERS_DIRS=""
- ;;
-yes)
- # look at what else is built
- case "$mesa_driver" in
- xlib)
- GALLIUM_STATE_TRACKERS_DIRS=glx
- ;;
- dri)
- GALLIUM_STATE_TRACKERS_DIRS="dri"
- HAVE_ST_DRI="yes"
- # Have only tested st/xorg on 1.6.0 servers
- PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
- HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
- HAVE_ST_XORG="no")
- ;;
- esac
-
- if test "x$enable_egl" = xyes; then
- if test "$enable_openvg" = yes; then
- GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vega"
- st_egl="yes"
- fi
-
- if test "$enable_gallium_egl" = yes; then
- GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
- HAVE_ST_EGL="yes"
- fi
- fi
- ;;
-*)
- # verify the requested state tracker exist
- state_trackers=""
- _state_trackers=`IFS=', '; echo $with_state_trackers`
- for tracker in $_state_trackers; do
- case "$tracker" in
- dri)
- if test "x$mesa_driver" != xdri; then
- AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
- fi
- HAVE_ST_DRI="yes"
- ;;
- egl)
- if test "x$enable_egl" != xyes; then
- AC_MSG_ERROR([cannot build egl state tracker without EGL library])
- fi
- HAVE_ST_EGL="yes"
- ;;
- xorg)
- PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
- PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
- PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
- HAVE_ST_XORG="yes"
- ;;
- vega)
- if test "x$enable_openvg" != xyes; then
- AC_MSG_ERROR([cannot build vega state tracker without --enable-openvg])
- fi
- have_st_vega="yes"
- ;;
- esac
-
- if test -n "$tracker"; then
- test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
- AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
- if test -n "$state_trackers"; then
- state_trackers="$state_trackers $tracker"
- else
- state_trackers="$tracker"
- fi
- fi
- done
- GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
-
- # append --enable-openvg/--enable-gallium-egl to --with-state-trackers
- if test "x$have_st_vega" != xyes -a "x$enable_openvg" = xyes; then
- AC_MSG_ERROR([--with-state-trackers specified but vega is missing])
- fi
- if test "x$HAVE_ST_EGL" != xyes -a "x$enable_gallium_egl" = xyes; then
- AC_MSG_ERROR([--with-state-trackers specified but egl is missing])
- fi
- ;;
-esac
-
-
-EGL_CLIENT_APIS=""
-VG_LIB_DEPS=""
case "x$enable_opengl$enable_gles1$enable_gles2" in
x*yes*)
EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
;;
esac
-if test "x$enable_openvg" = xyes; then
- EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
- VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS -lpthread"
-fi
AC_SUBST([VG_LIB_DEPS])
AC_SUBST([EGL_CLIENT_APIS])
-if test "x$HAVE_ST_EGL" = xyes; then
- GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
-fi
-
-if test "x$HAVE_ST_XORG" = xyes; then
- PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
- HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
- HAVE_XEXTPROTO_71="no")
-fi
-
AC_ARG_WITH([egl-platforms],
[AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
[comma delimited native platforms libEGL supports, e.g.
"x11,drm" @<:@default=auto@:>@])],
[with_egl_platforms="$withval"],
[with_egl_platforms=yes])
-AC_ARG_WITH([egl-displays],
- [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
- [DEPRECATED. Use --with-egl-platforms instead])],
- [with_egl_platforms="$withval"])
EGL_PLATFORMS=""
WAYLAND_EGL_LIB_DEPS=""
@@ -1704,6 +1639,9 @@ AC_ARG_ENABLE([gallium-llvm],
[build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
[enable_gallium_llvm="$enableval"],
[enable_gallium_llvm=auto])
+if test "x$with_gallium_drivers" = x; then
+ enable_gallium_llvm=no
+fi
if test "x$enable_gallium_llvm" = xauto; then
case "$host_cpu" in
i*86|x86_64) enable_gallium_llvm=yes;;
@@ -1749,108 +1687,46 @@ gallium_require_llvm() {
fi
}
-
-dnl
-dnl Gallium SVGA configuration
-dnl
-AC_ARG_ENABLE([gallium-svga],
- [AS_HELP_STRING([--enable-gallium-svga],
- [build gallium SVGA @<:@default=disabled@:>@])],
- [enable_gallium_svga="$enableval"],
- [enable_gallium_svga=auto])
-if test "x$enable_gallium_svga" = xyes; then
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
- gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx"
-elif test "x$enable_gallium_svga" = xauto; then
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
-fi
-
-dnl
-dnl Gallium i915 configuration
-dnl
-AC_ARG_ENABLE([gallium-i915],
- [AS_HELP_STRING([--enable-gallium-i915],
- [build gallium i915 @<:@default=disabled@:>@])],
- [enable_gallium_i915="$enableval"],
- [enable_gallium_i915=auto])
-if test "x$enable_gallium_i915" = xyes; then
- GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
- gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
-elif test "x$enable_gallium_i915" = xauto; then
+dnl Gallium drivers
+if test "x$with_gallium_drivers" != x; then
+ # This is for compile-testing
+ GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965 r300 svga"
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
-fi
-dnl
-dnl Gallium i965 configuration
-dnl
-AC_ARG_ENABLE([gallium-i965],
- [AS_HELP_STRING([--enable-gallium-i965],
- [build gallium i965 @<:@default=disabled@:>@])],
- [enable_gallium_i965="$enableval"],
- [enable_gallium_i965=auto])
-if test "x$enable_gallium_i965" = xyes; then
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
- gallium_check_st "i965/drm" "dri-i965" "xorg-i965"
-elif test "x$enable_gallium_i965" = xauto; then
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
-fi
-
-dnl
-dnl Gallium Radeon r300g configuration
-dnl
-AC_ARG_ENABLE([gallium-r300],
- [AS_HELP_STRING([--disable-gallium-r300],
- [build R300 driver @<:@default=enabled@:>@])],
- [enable_gallium_r300="$enableval"],
- [enable_gallium_r300=yes])
-
-if test "x$enable_gallium_r300" = xyes && test "x$mesa_driver" = xdri; then
- gallium_require_llvm "Gallium R300"
-
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
- gallium_check_st "radeon/drm" "dri-r300" "xorg-r300"
-fi
-
-dnl
-dnl Gallium Radeon r600g configuration
-dnl
-AC_ARG_ENABLE([gallium-r600],
- [AS_HELP_STRING([--enable-gallium-r600],
- [build gallium r600 @<:@default=disabled@:>@])],
- [enable_gallium_r600="$enableval"],
- [enable_gallium_r600=auto])
-if test "x$enable_gallium_r600" = xyes; then
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
- gallium_check_st "r600/drm" "dri-r600"
-fi
-
-dnl
-dnl Gallium Nouveau configuration
-dnl
-AC_ARG_ENABLE([gallium-nouveau],
- [AS_HELP_STRING([--enable-gallium-nouveau],
- [build gallium nouveau @<:@default=disabled@:>@])],
- [enable_gallium_nouveau="$enableval"],
- [enable_gallium_nouveau=no])
-if test "x$enable_gallium_nouveau" = xyes; then
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0"
- gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
-fi
-
-dnl
-dnl Gallium swrast configuration
-dnl
-AC_ARG_ENABLE([gallium-swrast],
- [AS_HELP_STRING([--enable-gallium-swrast],
- [build gallium swrast @<:@default=auto@:>@])],
- [enable_gallium_swrast="$enableval"],
- [enable_gallium_swrast=auto])
-if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
- if test "x$HAVE_ST_DRI" = xyes; then
- GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
- fi
+ gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
+ for driver in $gallium_drivers; do
+ case "x$driver" in
+ xsvga)
+ gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx"
+ ;;
+ xi915)
+ gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
+ ;;
+ xi965)
+ gallium_check_st "i965/drm" "dri-i965" "xorg-i965"
+ ;;
+ xr300)
+ gallium_require_llvm "Gallium R300"
+ gallium_check_st "radeon/drm" "dri-r300" "xorg-r300"
+ ;;
+ xr600)
+ GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
+ gallium_check_st "r600/drm" "dri-r600"
+ ;;
+ xnouveau)
+ GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0"
+ gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
+ ;;
+ xswrast)
+ if test "x$HAVE_ST_DRI" = xyes; then
+ GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
+ fi
+ ;;
+ *)
+ AC_MSG_ERROR([Unknown Gallium driver: $driver])
+ ;;
+ esac
+ done
fi
dnl prepend CORE_DIRS to SRC_DIRS
@@ -1925,7 +1801,7 @@ if test "$enable_egl" = yes; then
egl_drivers="$egl_drivers builtin:egl_$d"
done
- if test "$enable_gallium" = yes -a "$HAVE_ST_EGL" = yes; then
+ if test "x$HAVE_ST_EGL" = xyes; then
echo " EGL drivers: ${egl_drivers} egl_gallium"
echo " EGL Gallium STs:$EGL_CLIENT_APIS"
else
diff --git a/mesalib/docs/egl.html b/mesalib/docs/egl.html
index 9eb7b44cc..5b750070c 100644
--- a/mesalib/docs/egl.html
+++ b/mesalib/docs/egl.html
@@ -1,323 +1,320 @@
-<html>
-
-<title>Mesa EGL</title>
-
-<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
-
-<body>
-
-<h1>Mesa EGL</h1>
-
-<p>The current version of EGL in Mesa implements EGL 1.4. More information
-about EGL can be found at
-<a href="http://www.khronos.org/egl/" target="_parent">
-http://www.khronos.org/egl/</a>.</p>
-
-<p>The Mesa's implementation of EGL uses a driver architecture. The main
-library (<code>libEGL</code>) is window system neutral. It provides the EGL
-API entry points and helper functions for use by the drivers. Drivers are
-dynamically loaded by the main library and most of the EGL API calls are
-directly dispatched to the drivers.</p>
-
-<p>The driver in use decides the window system to support.</p>
-
-<h2>Build EGL</h2>
-
-<ol>
-<li>
-<p>Run <code>configure</code> with the desired client APIs and enable
-the driver for your hardware. For example</p>
-
-<pre>
- $ ./configure --enable-gles2 --enable-openvg --enable-gallium-nouveau
-</pre>
-
-<p>The main library and OpenGL is enabled by default. The first option above
-enables <a href="opengles.html">OpenGL ES 2.x</a>. The second option enables
-<a href="openvg.html">OpenVG</a>.</p>
-
-</li>
-
-<li>Build and install Mesa as usual.</li>
-</ol>
-
-<p>In the given example, it will build and install <code>libEGL</code>,
-<code>libGL</code>, <code>libGLESv1_CM</code>, <code>libGLESv2</code>,
-<code>libOpenVG</code>, and one or more EGL drivers.</p>
-
-<h3>Configure Options</h3>
-
-<p>There are several options that control the build of EGL at configuration
-time</p>
-
-<ul>
-<li><code>--enable-egl</code>
-
-<p>By default, EGL is enabled. When disabled, the main library and the drivers
-will not be built.</p>
-
-</li>
-
-<li><code>--with-egl-driver-dir</code>
-
-<p>The directory EGL drivers should be installed to. If not specified, EGL
-drivers will be installed to <code>${libdir}/egl</code>.</p>
-
-</li>
-
-<li><code>--with-egl-platforms</code>
-
-<p>List the platforms (window systems) to support. Its argument is a comma
-seprated string such as <code>--with-egl-platforms=x11,drm</code>. It decides
-the platforms a driver may support. The first listed platform is also used by
-the main library to decide the native platform: the platform the EGL native
-types such as <code>EGLNativeDisplayType</code> or
-<code>EGLNativeWindowType</code> defined for.</p>
-
-<p>The available platforms are <code>x11</code>, <code>drm</code>,
-<code>fbdev</code>, and <code>gdi</code>. The <code>gdi</code> platform can
-only be built with SCons. Unless for special needs, the build system should
-select the right platforms automatically.</p>
-
-</li>
-
-<li><code>--enable-gles1</code> and <code>--enable-gles2</code>
-
-<p>These options enable OpenGL ES support in OpenGL. The result is one big
-internal library that supports multiple APIs.</p>
-
-</li>
-
-<li><code>--enable-openvg</code>
-
-<p>OpenVG must be explicitly enabled by this option.</p>
-
-</li>
-
-<li><code>--enable-gallium-egl</code>
-
-<p>Explicitly enable or disable <code>egl_gallium</code>.</p>
-
-</li>
-
-</ul>
-
-<h2>Use EGL</h2>
-
-<h3>Demos</h3>
-
-<p>There are demos for the client APIs supported by EGL. They can be found in
-mesa/demos repository.</p>
-
-<h3>Environment Variables</h3>
-
-<p>There are several environment variables that control the behavior of EGL at
-runtime</p>
-
-<ul>
-<li><code>EGL_DRIVERS_PATH</code>
-
-<p>By default, the main library will look for drivers in the directory where
-the drivers are installed to. This variable specifies a list of
-colon-separated directories where the main library will look for drivers, in
-addition to the default directory. This variable is ignored for setuid/setgid
-binaries.</p>
-
-<p>This variable is usually set to test an uninstalled build. For example, one
-may set</p>
-
-<pre>
- $ export LD_LIBRARY_PATH=$mesa/lib
- $ export EGL_DRIVERS_PATH=$mesa/lib/egl
-</pre>
-
-<p>to test a build without installation</p>
-
-</li>
-
-<li><code>EGL_DRIVER</code>
-
-<p>This variable specifies a full path to or the name of an EGL driver. It
-forces the specified EGL driver to be loaded. It comes in handy when one wants
-to test a specific driver. This variable is ignored for setuid/setgid
-binaries.</p>
-
-</li>
-
-<li><code>EGL_PLATFORM</code>
-
-<p>This variable specifies the native platform. The valid values are the same
-as those for <code>--with-egl-platforms</code>. When the variable is not set,
-the main library uses the first platform listed in
-<code>--with-egl-platforms</code> as the native platform.</p>
-
-<p>Extensions like <code>EGL_MESA_drm_display</code> define new functions to
-create displays for non-native platforms. These extensions are usually used by
-applications that support non-native platforms. Setting this variable is
-probably required only for some of the demos found in mesa/demo repository.</p>
-
-</li>
-
-<li><code>EGL_LOG_LEVEL</code>
-
-<p>This changes the log level of the main library and the drivers. The valid
-values are: <code>debug</code>, <code>info</code>, <code>warning</code>, and
-<code>fatal</code>.</p>
-
-</li>
-
-<li><code>EGL_SOFTWARE</code>
-
-<p>For drivers that support both hardware and software rendering, setting this
-variable to true forces the use of software rendering.</p>
-
-</li>
-</ul>
-
-<h2>EGL Drivers</h2>
-
-<ul>
-<li><code>egl_dri2</code>
-
-<p>This driver supports both <code>x11</code> and <code>drm</code> platforms.
-It functions as a DRI driver loader. For <code>x11</code> support, it talks to
-the X server directly using (XCB-)DRI2 protocol.</p>
-
-<p>This driver can share DRI drivers with <code>libGL</code>.</p>
-
-</li>
-
-<li><code>egl_gallium</code>
-
-<p>This driver is based on Gallium3D. It supports all rendering APIs and
-hardwares supported by Gallium3D. It is the only driver that supports OpenVG.
-The supported platforms are X11, DRM, FBDEV, and GDI.</p>
-
-<p>This driver comes with its own hardware drivers
-(<code>pipe_&lt;hw&gt;</code>) and client API modules
-(<code>st_&lt;api&gt;</code>).</p>
-
-</li>
-
-<li><code>egl_glx</code>
-
-<p>This driver provides a wrapper to GLX. It uses exclusively GLX to implement
-the EGL API. It supports both direct and indirect rendering when the GLX does.
-It is accelerated when the GLX is. As such, it cannot provide functions that
-is not available in GLX or GLX extensions.</p>
-</li>
-</ul>
-
-<h2>Packaging</h2>
-
-<p>The ABI between the main library and its drivers are not stable. Nor is
-there a plan to stabilize it at the moment. Of the EGL drivers,
-<code>egl_gallium</code> has its own hardware drivers and client API modules.
-They are considered internal to <code>egl_gallium</code> and there is also no
-stable ABI between them. These should be kept in mind when packaging for
-distribution.</p>
-
-<p>Generally, <code>egl_dri2</code> is preferred over <code>egl_gallium</code>
-when the system already has DRI drivers. As <code>egl_gallium</code> is loaded
-before <code>egl_dri2</code> when both are available, <code>egl_gallium</code>
-may either be disabled with <code>--disable-gallium-egl</code> or packaged
-separately.</p>
-
-<h2>Developers</h2>
-
-<p>The sources of the main library and the classic drivers can be found at
-<code>src/egl/</code>. The sources of the <code>egl</code> state tracker can
-be found at <code>src/gallium/state_trackers/egl/</code>.</p>
-
-<p>The suggested way to learn to write a EGL driver is to see how other drivers
-are written. <code>egl_glx</code> should be a good reference. It works in any
-environment that has GLX support, and it is simpler than most drivers.</p>
-
-<h3>Lifetime of Display Resources</h3>
-
-<p>Contexts and surfaces are examples of display resources. They might live
-longer than the display that creates them.</p>
-
-<p>In EGL, when a display is terminated through <code>eglTerminate</code>, all
-display resources should be destroyed. Similarly, when a thread is released
-throught <code>eglReleaseThread</code>, all current display resources should be
-released. Another way to destory or release resources is through functions
-such as <code>eglDestroySurface</code> or <code>eglMakeCurrent</code>.</p>
-
-<p>When a resource that is current to some thread is destroyed, the resource
-should not be destroyed immediately. EGL requires the resource to live until
-it is no longer current. A driver usually calls
-<code>eglIs&lt;Resource&gt;Bound</code> to check if a resource is bound
-(current) to any thread in the destroy callbacks. If it is still bound, the
-resource is not destroyed.</p>
-
-<p>The main library will mark destroyed current resources as unlinked. In a
-driver's <code>MakeCurrent</code> callback,
-<code>eglIs&lt;Resource&gt;Linked</code> can then be called to check if a newly
-released resource is linked to a display. If it is not, the last reference to
-the resource is removed and the driver should destroy the resource. But it
-should be careful here because <code>MakeCurrent</code> might be called with an
-uninitialized display.</p>
-
-<p>This is the only mechanism provided by the main library to help manage the
-resources. The drivers are responsible to the correct behavior as defined by
-EGL.</p>
-
-<h3><code>EGL_RENDER_BUFFER</code></h3>
-
-<p>In EGL, the color buffer a context should try to render to is decided by the
-binding surface. It should try to render to the front buffer if the binding
-surface has <code>EGL_RENDER_BUFFER</code> set to
-<code>EGL_SINGLE_BUFFER</code>; If the same context is later bound to a
-surface with <code>EGL_RENDER_BUFFER</code> set to
-<code>EGL_BACK_BUFFER</code>, the context should try to render to the back
-buffer. However, the context is allowed to make the final decision as to which
-color buffer it wants to or is able to render to.</p>
-
-<p>For pbuffer surfaces, the render buffer is always
-<code>EGL_BACK_BUFFER</code>. And for pixmap surfaces, the render buffer is
-always <code>EGL_SINGLE_BUFFER</code>. Unlike window surfaces, EGL spec
-requires their <code>EGL_RENDER_BUFFER</code> values to be honored. As a
-result, a driver should never set <code>EGL_PIXMAP_BIT</code> or
-<code>EGL_PBUFFER_BIT</code> bits of a config if the contexts created with the
-config won't be able to honor the <code>EGL_RENDER_BUFFER</code> of pixmap or
-pbuffer surfaces.</p>
-
-<p>It should also be noted that pixmap and pbuffer surfaces are assumed to be
-single-buffered, in that <code>eglSwapBuffers</code> has no effect on them. It
-is desirable that a driver allocates a private color buffer for each pbuffer
-surface created. If the window system the driver supports has native pbuffers,
-or if the native pixmaps have more than one color buffers, the driver should
-carefully attach the native color buffers to the EGL surfaces, re-route them if
-required.</p>
-
-<p>There is no defined behavior as to, for example, how
-<code>glDrawBuffer</code> interacts with <code>EGL_RENDER_BUFFER</code>. Right
-now, it is desired that the draw buffer in a client API be fixed for pixmap and
-pbuffer surfaces. Therefore, the driver is responsible to guarantee that the
-client API renders to the specified render buffer for pixmap and pbuffer
-surfaces.</p>
-
-<h3><code>EGLDisplay</code> Mutex</h3>
-
-The <code>EGLDisplay</code> will be locked before calling any of the dispatch
-functions (well, except for GetProcAddress which does not take an
-<code>EGLDisplay</code>). This guarantees that the same dispatch function will
-not be called with the sample display at the same time. If a driver has access
-to an <code>EGLDisplay</code> without going through the EGL APIs, the driver
-should as well lock the display before using it.
-
-<h3>TODOs</h3>
-
-<ul>
-<li>Pass the conformance tests</li>
-<li>Mixed use of OpenGL, OpenGL ES 1.1, and OpenGL ES 2.0 is supported. But
-which one of <code>libGL.so</code>, <code>libGLESv1_CM.so</code>, and
-<code>libGLESv2.so</code> should an application link to? Bad things may happen
-when, say, an application is linked to <code>libGLESv2.so</code> and
-<code>libcairo</code>, which is linked to <code>libGL.so</code> instead.</li>
-
-</ul>
-
-</body>
-</html>
+<html>
+
+<title>Mesa EGL</title>
+
+<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
+
+<body>
+
+<h1>Mesa EGL</h1>
+
+<p>The current version of EGL in Mesa implements EGL 1.4. More information
+about EGL can be found at
+<a href="http://www.khronos.org/egl/" target="_parent">
+http://www.khronos.org/egl/</a>.</p>
+
+<p>The Mesa's implementation of EGL uses a driver architecture. The main
+library (<code>libEGL</code>) is window system neutral. It provides the EGL
+API entry points and helper functions for use by the drivers. Drivers are
+dynamically loaded by the main library and most of the EGL API calls are
+directly dispatched to the drivers.</p>
+
+<p>The driver in use decides the window system to support.</p>
+
+<h2>Build EGL</h2>
+
+<ol>
+<li>
+<p>Run <code>configure</code> with the desired client APIs and enable
+the driver for your hardware. For example</p>
+
+<pre>
+ $ ./configure --enable-gles1 --enable-gles2 \
+ --with-dri-drivers=... \
+ --with-gallium-drivers=...
+</pre>
+
+<p>The main library and OpenGL is enabled by default. The first two options
+above enables <a href="opengles.html">OpenGL ES 1.x and 2.x</a>. The last two
+options enables the listed classic and and Gallium drivers respectively.</p>
+
+</li>
+
+<li>Build and install Mesa as usual.</li>
+</ol>
+
+<p>In the given example, it will build and install <code>libEGL</code>,
+<code>libGL</code>, <code>libGLESv1_CM</code>, <code>libGLESv2</code>, and one
+or more EGL drivers.</p>
+
+<h3>Configure Options</h3>
+
+<p>There are several options that control the build of EGL at configuration
+time</p>
+
+<ul>
+<li><code>--enable-egl</code>
+
+<p>By default, EGL is enabled. When disabled, the main library and the drivers
+will not be built.</p>
+
+</li>
+
+<li><code>--with-egl-driver-dir</code>
+
+<p>The directory EGL drivers should be installed to. If not specified, EGL
+drivers will be installed to <code>${libdir}/egl</code>.</p>
+
+</li>
+
+<li><code>--enable-gallium-egl</code>
+
+<p>Enable the optional <code>egl_gallium</code> driver.</p>
+
+</li>
+
+<li><code>--with-egl-platforms</code>
+
+<p>List the platforms (window systems) to support. Its argument is a comma
+seprated string such as <code>--with-egl-platforms=x11,drm</code>. It decides
+the platforms a driver may support. The first listed platform is also used by
+the main library to decide the native platform: the platform the EGL native
+types such as <code>EGLNativeDisplayType</code> or
+<code>EGLNativeWindowType</code> defined for.</p>
+
+<p>The available platforms are <code>x11</code>, <code>drm</code>,
+<code>fbdev</code>, and <code>gdi</code>. The <code>gdi</code> platform can
+only be built with SCons. Unless for special needs, the build system should
+select the right platforms automatically.</p>
+
+</li>
+
+<li><code>--enable-gles1</code> and <code>--enable-gles2</code>
+
+<p>These options enable OpenGL ES support in OpenGL. The result is one big
+internal library that supports multiple APIs.</p>
+
+</li>
+
+<li><code>--enable-shared-glapi</code>
+
+<p>By default, <code>libGL</code> has its own copy of <code>libglapi</code>.
+This options makes <code>libGL</code> use the shared <code>libglapi</code>. This
+is required if applications mix OpenGL and OpenGL ES.</p>
+
+</li>
+
+<li><code>--enable-openvg</code>
+
+<p>OpenVG must be explicitly enabled by this option.</p>
+
+</li>
+
+</ul>
+
+<h2>Use EGL</h2>
+
+<h3>Demos</h3>
+
+<p>There are demos for the client APIs supported by EGL. They can be found in
+mesa/demos repository.</p>
+
+<h3>Environment Variables</h3>
+
+<p>There are several environment variables that control the behavior of EGL at
+runtime</p>
+
+<ul>
+<li><code>EGL_DRIVERS_PATH</code>
+
+<p>By default, the main library will look for drivers in the directory where
+the drivers are installed to. This variable specifies a list of
+colon-separated directories where the main library will look for drivers, in
+addition to the default directory. This variable is ignored for setuid/setgid
+binaries.</p>
+
+<p>This variable is usually set to test an uninstalled build. For example, one
+may set</p>
+
+<pre>
+ $ export LD_LIBRARY_PATH=$mesa/lib
+ $ export EGL_DRIVERS_PATH=$mesa/lib/egl
+</pre>
+
+<p>to test a build without installation</p>
+
+</li>
+
+<li><code>EGL_DRIVER</code>
+
+<p>This variable specifies a full path to or the name of an EGL driver. It
+forces the specified EGL driver to be loaded. It comes in handy when one wants
+to test a specific driver. This variable is ignored for setuid/setgid
+binaries.</p>
+
+</li>
+
+<li><code>EGL_PLATFORM</code>
+
+<p>This variable specifies the native platform. The valid values are the same
+as those for <code>--with-egl-platforms</code>. When the variable is not set,
+the main library uses the first platform listed in
+<code>--with-egl-platforms</code> as the native platform.</p>
+
+<p>Extensions like <code>EGL_MESA_drm_display</code> define new functions to
+create displays for non-native platforms. These extensions are usually used by
+applications that support non-native platforms. Setting this variable is
+probably required only for some of the demos found in mesa/demo repository.</p>
+
+</li>
+
+<li><code>EGL_LOG_LEVEL</code>
+
+<p>This changes the log level of the main library and the drivers. The valid
+values are: <code>debug</code>, <code>info</code>, <code>warning</code>, and
+<code>fatal</code>.</p>
+
+</li>
+
+<li><code>EGL_SOFTWARE</code>
+
+<p>For drivers that support both hardware and software rendering, setting this
+variable to true forces the use of software rendering.</p>
+
+</li>
+</ul>
+
+<h2>EGL Drivers</h2>
+
+<ul>
+<li><code>egl_dri2</code>
+
+<p>This driver supports both <code>x11</code> and <code>drm</code> platforms.
+It functions as a DRI driver loader. For <code>x11</code> support, it talks to
+the X server directly using (XCB-)DRI2 protocol.</p>
+
+<p>This driver can share DRI drivers with <code>libGL</code>.</p>
+
+</li>
+
+<li><code>egl_gallium</code>
+
+<p>This driver is based on Gallium3D. It supports all rendering APIs and
+hardwares supported by Gallium3D. It is the only driver that supports OpenVG.
+The supported platforms are X11, DRM, FBDEV, and GDI.</p>
+
+<p>This driver comes with its own hardware drivers
+(<code>pipe_&lt;hw&gt;</code>) and client API modules
+(<code>st_&lt;api&gt;</code>).</p>
+
+</li>
+
+<li><code>egl_glx</code>
+
+<p>This driver provides a wrapper to GLX. It uses exclusively GLX to implement
+the EGL API. It supports both direct and indirect rendering when the GLX does.
+It is accelerated when the GLX is. As such, it cannot provide functions that
+is not available in GLX or GLX extensions.</p>
+</li>
+</ul>
+
+<h2>Packaging</h2>
+
+<p>The ABI between the main library and its drivers are not stable. Nor is
+there a plan to stabilize it at the moment. Of the EGL drivers,
+<code>egl_gallium</code> has its own hardware drivers and client API modules.
+They are considered internal to <code>egl_gallium</code> and there is also no
+stable ABI between them. These should be kept in mind when packaging for
+distribution.</p>
+
+<p>Generally, <code>egl_dri2</code> is preferred over <code>egl_gallium</code>
+when the system already has DRI drivers. As <code>egl_gallium</code> is loaded
+before <code>egl_dri2</code> when both are available, <code>egl_gallium</code>
+is disabled by default.</p>
+
+<h2>Developers</h2>
+
+<p>The sources of the main library and the classic drivers can be found at
+<code>src/egl/</code>. The sources of the <code>egl</code> state tracker can
+be found at <code>src/gallium/state_trackers/egl/</code>.</p>
+
+<p>The suggested way to learn to write a EGL driver is to see how other drivers
+are written. <code>egl_glx</code> should be a good reference. It works in any
+environment that has GLX support, and it is simpler than most drivers.</p>
+
+<h3>Lifetime of Display Resources</h3>
+
+<p>Contexts and surfaces are examples of display resources. They might live
+longer than the display that creates them.</p>
+
+<p>In EGL, when a display is terminated through <code>eglTerminate</code>, all
+display resources should be destroyed. Similarly, when a thread is released
+throught <code>eglReleaseThread</code>, all current display resources should be
+released. Another way to destory or release resources is through functions
+such as <code>eglDestroySurface</code> or <code>eglMakeCurrent</code>.</p>
+
+<p>When a resource that is current to some thread is destroyed, the resource
+should not be destroyed immediately. EGL requires the resource to live until
+it is no longer current. A driver usually calls
+<code>eglIs&lt;Resource&gt;Bound</code> to check if a resource is bound
+(current) to any thread in the destroy callbacks. If it is still bound, the
+resource is not destroyed.</p>
+
+<p>The main library will mark destroyed current resources as unlinked. In a
+driver's <code>MakeCurrent</code> callback,
+<code>eglIs&lt;Resource&gt;Linked</code> can then be called to check if a newly
+released resource is linked to a display. If it is not, the last reference to
+the resource is removed and the driver should destroy the resource. But it
+should be careful here because <code>MakeCurrent</code> might be called with an
+uninitialized display.</p>
+
+<p>This is the only mechanism provided by the main library to help manage the
+resources. The drivers are responsible to the correct behavior as defined by
+EGL.</p>
+
+<h3><code>EGL_RENDER_BUFFER</code></h3>
+
+<p>In EGL, the color buffer a context should try to render to is decided by the
+binding surface. It should try to render to the front buffer if the binding
+surface has <code>EGL_RENDER_BUFFER</code> set to
+<code>EGL_SINGLE_BUFFER</code>; If the same context is later bound to a
+surface with <code>EGL_RENDER_BUFFER</code> set to
+<code>EGL_BACK_BUFFER</code>, the context should try to render to the back
+buffer. However, the context is allowed to make the final decision as to which
+color buffer it wants to or is able to render to.</p>
+
+<p>For pbuffer surfaces, the render buffer is always
+<code>EGL_BACK_BUFFER</code>. And for pixmap surfaces, the render buffer is
+always <code>EGL_SINGLE_BUFFER</code>. Unlike window surfaces, EGL spec
+requires their <code>EGL_RENDER_BUFFER</code> values to be honored. As a
+result, a driver should never set <code>EGL_PIXMAP_BIT</code> or
+<code>EGL_PBUFFER_BIT</code> bits of a config if the contexts created with the
+config won't be able to honor the <code>EGL_RENDER_BUFFER</code> of pixmap or
+pbuffer surfaces.</p>
+
+<p>It should also be noted that pixmap and pbuffer surfaces are assumed to be
+single-buffered, in that <code>eglSwapBuffers</code> has no effect on them. It
+is desirable that a driver allocates a private color buffer for each pbuffer
+surface created. If the window system the driver supports has native pbuffers,
+or if the native pixmaps have more than one color buffers, the driver should
+carefully attach the native color buffers to the EGL surfaces, re-route them if
+required.</p>
+
+<p>There is no defined behavior as to, for example, how
+<code>glDrawBuffer</code> interacts with <code>EGL_RENDER_BUFFER</code>. Right
+now, it is desired that the draw buffer in a client API be fixed for pixmap and
+pbuffer surfaces. Therefore, the driver is responsible to guarantee that the
+client API renders to the specified render buffer for pixmap and pbuffer
+surfaces.</p>
+
+<h3><code>EGLDisplay</code> Mutex</h3>
+
+The <code>EGLDisplay</code> will be locked before calling any of the dispatch
+functions (well, except for GetProcAddress which does not take an
+<code>EGLDisplay</code>). This guarantees that the same dispatch function will
+not be called with the sample display at the same time. If a driver has access
+to an <code>EGLDisplay</code> without going through the EGL APIs, the driver
+should as well lock the display before using it.
+
+</body>
+</html>
diff --git a/mesalib/docs/opengles.html b/mesalib/docs/opengles.html
index 28b0acc20..0fee488e1 100644
--- a/mesalib/docs/opengles.html
+++ b/mesalib/docs/opengles.html
@@ -1,78 +1,61 @@
-<html>
-
-<title>OpenGL ES</title>
-
-<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
-
-<body>
-
-<h1>OpenGL ES</h1>
-
-<p>Mesa implements OpenGL ES 1.1 and OpenGL ES 2.0. More informations about
-OpenGL ES can be found at <a href="http://www.khronos.org/opengles/"
-target="_parent"> http://www.khronos.org/opengles/</a>.</p>
-
-<p>OpenGL ES depends on a working EGL implementation. Please refer to
-<a href="egl.html">Mesa EGL</a> for more information about EGL.</p>
-
-<h2>Build the Libraries</h2>
-<ol>
-<li>Run <code>configure</code> with <code>--enable-gles1 --enable-gles2</code> and enable the Gallium driver for your hardware.</li>
-<li>Build and install Mesa as usual.</li>
-</ol>
-
-Alternatively, if XCB-DRI2 is installed on the system, one can use
-<code>egl_dri2</code> EGL driver with OpenGL|ES-enabled DRI drivers
-
-<ol>
-<li>Run <code>configure</code> with <code>--enable-gles1 --enable-gles2</code>.</li>
-<li>Build and install Mesa as usual.</li>
-</ol>
-
-<p>Both methods will install libGLESv1_CM, libGLESv2, libEGL, and one or more
-EGL drivers for your hardware.</p>
-
-<h2>Run the Demos</h2>
-
-<p>There are some demos in <code>progs/egl/</code>. You can use them to test
-your build. For example,</p>
-
-<pre>
- $ cd progs/egl/eglut
- $ make
- $ cd ../opengles1
- $ make
- $ ./torus_x11
-</pre>
-
-<h2>Developers</h2>
-
-<h3>Internal Libraries</h3>
-
-<table border="1" style="text-align: center;">
- <tr><td>Library Name</td><td>Used By</td><td>Enabled</td><td>OpenGL</td><td>OpenGL ES 1.x</td><td>OpenGL ES 2.x</td></tr>
- <tr><td><code>libmesa.a</td><td>Classic DRI drivers</td><td>y</td><td>y</td><td>--enable-gles1</td><td>--enable-gles2</td></tr>
- <tr><td><code>libmesagallium.a</td><td>Gallium EGL and DRI drivers</td><td>y</td><td>y</td><td>--enable-gles1</td><td>--enable-gles2</td></tr>
-</table>
-
-<h3>Dispatch Table</h3>
-
-<p>OpenGL ES has an additional indirection when dispatching fucntions</p>
-
-<pre>
- Mesa: glFoo() --&gt; _mesa_Foo()
- OpenGL ES: glFoo() --&gt; _es_Foo() --&gt; _mesa_Foo()
-</pre>
-
-<p>The indirection serves several purposes</p>
-
-<ul>
-<li>When a function is in Mesa and the type matches, it checks the arguments and calls the Mesa function.</li>
-<li>When a function is in Mesa but the type mismatches, it checks and converts the arguments before calling the Mesa function.</li>
-<li>When a function is not available in Mesa, or accepts arguments that are not available in OpenGL, it provides its own implementation.</li>
-</ul>
-
-<p>Other than the last case, OpenGL ES uses <code>APIspec.xml</code> to generate functions to check and/or converts the arguments.</p>
-
-</body>
-</html>
+<html>
+
+<title>OpenGL ES</title>
+
+<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
+
+<body>
+
+<h1>OpenGL ES</h1>
+
+<p>Mesa implements OpenGL ES 1.1 and OpenGL ES 2.0. More informations about
+OpenGL ES can be found at <a href="http://www.khronos.org/opengles/"
+target="_parent"> http://www.khronos.org/opengles/</a>.</p>
+
+<p>OpenGL ES depends on a working EGL implementation. Please refer to
+<a href="egl.html">Mesa EGL</a> for more information about EGL.</p>
+
+<h2>Build the Libraries</h2>
+<ol>
+<li>Run <code>configure</code> with <code>--enable-gles1 --enable-gles2</code> and enable the Gallium driver for your hardware.</li>
+<li>Build and install Mesa as usual.</li>
+</ol>
+
+Alternatively, if XCB-DRI2 is installed on the system, one can use
+<code>egl_dri2</code> EGL driver with OpenGL|ES-enabled DRI drivers
+
+<ol>
+<li>Run <code>configure</code> with <code>--enable-gles1 --enable-gles2</code>.</li>
+<li>Build and install Mesa as usual.</li>
+</ol>
+
+<p>Both methods will install libGLESv1_CM, libGLESv2, libEGL, and one or more
+EGL drivers for your hardware.</p>
+
+<h2>Run the Demos</h2>
+
+<p>There are some demos in <code>mesa/demos</code> repository.</p>
+
+<h2>Developers</h2>
+
+<h3>Dispatch Table</h3>
+
+<p>OpenGL ES has an additional indirection when dispatching fucntions</p>
+
+<pre>
+ Mesa: glFoo() --&gt; _mesa_Foo()
+ OpenGL ES: glFoo() --&gt; _es_Foo() --&gt; _mesa_Foo()
+</pre>
+
+<p>The indirection serves several purposes</p>
+
+<ul>
+<li>When a function is in Mesa and the type matches, it checks the arguments and calls the Mesa function.</li>
+<li>When a function is in Mesa but the type mismatches, it checks and converts the arguments before calling the Mesa function.</li>
+<li>When a function is not available in Mesa, or accepts arguments that are not available in OpenGL, it provides its own implementation.</li>
+</ul>
+
+<p>Other than the last case, OpenGL ES uses <code>APIspec.xml</code> to generate functions to check and/or converts the arguments.</p>
+
+</body>
+</html>
diff --git a/mesalib/docs/openvg.html b/mesalib/docs/openvg.html
index cb2e2b651..81e50b65f 100644
--- a/mesalib/docs/openvg.html
+++ b/mesalib/docs/openvg.html
@@ -1,52 +1,52 @@
-<HTML>
-
-<TITLE>OpenVG State Tracker</TITLE>
-
-<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
-
-<BODY>
-
-<body bgcolor="#eeeeee">
-
-<H1>OpenVG State Tracker</H1>
-
-<p>
-The current version of the OpenVG state tracker implements OpenVG 1.0.
-</p>
-<p>
-More informations about OpenVG can be found at
-<a href="http://www.khronos.org/openvg/" target="_parent">
-http://www.khronos.org/openvg/</a> .
-</p>
-<p>
-The OpenVG state tracker depends on the Gallium architecture and a working EGL implementation.
-Please refer to <a href="egl.html">Mesa EGL</a> for more information about EGL.
-</p>
-
-
-<h2>Building the library</h2>
-<ol>
-<li>Run <code>configure</code> with <code>--enable-openvg</code>. If you do
-not need OpenGL, you can add <code>--disable-opengl</code> to save the
-compilation time.</li>
-
-<li>Build and install Mesa as usual.</li>
-</ol>
-
-<h3>Sample build</h3>
-A sample build looks as follows:
-<pre>
- $ ./configure --disable-opengl --enable-openvg
- $ make
- $ make install
-</pre>
-
-<p>It will install <code>libOpenVG.so</code>, <code>libEGL.so</code>, and one
-or more EGL drivers.</p>
-
-<h2>OpenVG Demos</h2>
-
-<p>OpenVG demos can be found in mesa/demos repository.</p>
-
-</body>
-</html>
+<HTML>
+
+<TITLE>OpenVG State Tracker</TITLE>
+
+<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
+
+<BODY>
+
+<body bgcolor="#eeeeee">
+
+<H1>OpenVG State Tracker</H1>
+
+<p>
+The current version of the OpenVG state tracker implements OpenVG 1.1.
+</p>
+<p>
+More informations about OpenVG can be found at
+<a href="http://www.khronos.org/openvg/" target="_parent">
+http://www.khronos.org/openvg/</a> .
+</p>
+<p>
+The OpenVG state tracker depends on the Gallium architecture and a working EGL implementation.
+Please refer to <a href="egl.html">Mesa EGL</a> for more information about EGL.
+</p>
+
+
+<h2>Building the library</h2>
+<ol>
+<li>Run <code>configure</code> with <code>--enable-openvg</code> and
+<code>--enable-gallium-egl</code>. If you do not need OpenGL, you can add
+<code>--disable-opengl</code> to save the compilation time.</li>
+
+<li>Build and install Mesa as usual.</li>
+</ol>
+
+<h3>Sample build</h3>
+A sample build looks as follows:
+<pre>
+ $ ./configure --disable-opengl --enable-openvg --enable-gallium-egl
+ $ make
+ $ make install
+</pre>
+
+<p>It will install <code>libOpenVG.so</code>, <code>libEGL.so</code>, and one
+or more EGL drivers.</p>
+
+<h2>OpenVG Demos</h2>
+
+<p>OpenVG demos can be found in mesa/demos repository.</p>
+
+</body>
+</html>
diff --git a/mesalib/docs/relnotes-7.11.html b/mesalib/docs/relnotes-7.11.html
index b80179aaf..c81ac9f15 100644
--- a/mesalib/docs/relnotes-7.11.html
+++ b/mesalib/docs/relnotes-7.11.html
@@ -1,86 +1,86 @@
-<HTML>
-
-<head>
-<TITLE>Mesa Release Notes</TITLE>
-<link rel="stylesheet" type="text/css" href="mesa.css">
-<meta http-equiv="content-type" content="text/html; charset=utf-8" />
-</head>
-
-<BODY>
-
-<body bgcolor="#eeeeee">
-
-<H1>Mesa 7.11 Release Notes / (release date TBD)</H1>
-
-<p>
-Mesa 7.11 is a new development release.
-People who are concerned with stability and reliability should stick
-with a previous release or wait for Mesa 7.11.1.
-</p>
-<p>
-Mesa 7.11 implements the OpenGL 2.1 API, but the version reported by
-glGetString(GL_VERSION) depends on the particular driver being used.
-Some drivers don't support all the features required in OpenGL 2.1.
-</p>
-<p>
-See the <a href="install.html">Compiling/Installing page</a> for prerequisites
-for DRI hardware acceleration.
-</p>
-
-
-<h2>MD5 checksums</h2>
-<pre>
-tbd
-</pre>
-
-
-<h2>New features</h2>
-<ul>
-<li>GL_ARB_ES2_compatibility (gallium drivers)
-<li>GL_ARB_color_buffer_float (gallium drivers, i965)
-<li>GL_ARB_draw_buffers_blend (gallium)
-<li>GL_ARB_draw_instanced extension (gallium drivers, swrast)
-<li>GL_ARB_instanced_arrays extension (gallium drivers)
-<li>GL_ARB_occlusion_query2 (gallium drivers, swrast)
-<li>GL_ARB_robustness (all drivers)
-<li>GL_ARB_sampler_objects (gallium drivers)
-<li>GL_ARB_seamless_cube_map (gallium r600)
-<li>GL_ARB_shader_texture_lod (gallium drivers)
-<li>GL_ARB_sync (gallium drivers only, intel support was in 7.6)
-<li>GL_ARB_texture_compression_rgtc (gallium drivers, swrast, i965)
-<li>GL_ARB_texture_float (gallium, i965)
-<li>GL_EXT_packed_float (gallium r600)
-<li>GL_EXT_texture_compression_latc (gallium drivers, swrast)
-<li>GL_EXT_texture_compression_rgtc (gallium drivers, swrast, i965)
-<li>GL_EXT_texture_filter_anisotropic (swrast)
-<li>GL_EXT_texture_shared_exponent (gallium drivers, swrast)
-<li>GL_EXT_texture_sRGB_decode (gallium drivers, swrast, i965)
-<li>GL_EXT_texture_snorm (gallium drivers)
-<li>GL_AMD_draw_buffers_blend (alias of the ARB variant)
-<li>GL_AMD_seamless_cubemap_per_texture (gallium r600)
-<li>GL_AMD_shader_stencil_export (alias of the ARB variant)
-<li>GL_ATI_draw_buffers (all drivers)
-<li>GL_ATI_texture_compression_3dc (gallium drivers, swrast)
-<li>GL_ATI_texture_float (gallium, i965)
-<li>GL_NV_conditional_render (i965)
-<li>GL_NV_texture_barrier (gallium drivers)
-</ul>
-
-
-<h2>Bug fixes</h2>
-<ul>
-</ul>
-
-
-<h2>Changes</h2>
-<ul>
-<li>The Windows MSVC project files have been removed.
-They haven't been maintained in quite a while.
-Building with SCons is an alternative.
-<li>Removed GL_SGI_texture_color_table support from swrast driver - the only
-driver that implemented it.
-</ul>
-
-
-</body>
-</html>
+<HTML>
+
+<head>
+<TITLE>Mesa Release Notes</TITLE>
+<link rel="stylesheet" type="text/css" href="mesa.css">
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+</head>
+
+<BODY>
+
+<body bgcolor="#eeeeee">
+
+<H1>Mesa 7.11 Release Notes / (release date TBD)</H1>
+
+<p>
+Mesa 7.11 is a new development release.
+People who are concerned with stability and reliability should stick
+with a previous release or wait for Mesa 7.11.1.
+</p>
+<p>
+Mesa 7.11 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+</p>
+<p>
+See the <a href="install.html">Compiling/Installing page</a> for prerequisites
+for DRI hardware acceleration.
+</p>
+
+
+<h2>MD5 checksums</h2>
+<pre>
+tbd
+</pre>
+
+
+<h2>New features</h2>
+<ul>
+<li>GL_ARB_ES2_compatibility (gallium drivers)
+<li>GL_ARB_color_buffer_float (gallium drivers, i965)
+<li>GL_ARB_draw_buffers_blend (gallium)
+<li>GL_ARB_draw_instanced extension (gallium drivers, swrast)
+<li>GL_ARB_instanced_arrays extension (gallium drivers)
+<li>GL_ARB_occlusion_query2 (gallium drivers, swrast)
+<li>GL_ARB_robustness (all drivers)
+<li>GL_ARB_sampler_objects (gallium drivers)
+<li>GL_ARB_seamless_cube_map (gallium r600)
+<li>GL_ARB_shader_texture_lod (gallium drivers, i965)
+<li>GL_ARB_sync (gallium drivers only, intel support was in 7.6)
+<li>GL_ARB_texture_compression_rgtc (gallium drivers, swrast, i965)
+<li>GL_ARB_texture_float (gallium, i965)
+<li>GL_EXT_packed_float (gallium r600)
+<li>GL_EXT_texture_compression_latc (gallium drivers, swrast)
+<li>GL_EXT_texture_compression_rgtc (gallium drivers, swrast, i965)
+<li>GL_EXT_texture_filter_anisotropic (swrast)
+<li>GL_EXT_texture_shared_exponent (gallium drivers, swrast)
+<li>GL_EXT_texture_sRGB_decode (gallium drivers, swrast, i965)
+<li>GL_EXT_texture_snorm (gallium drivers)
+<li>GL_AMD_draw_buffers_blend (alias of the ARB variant)
+<li>GL_AMD_seamless_cubemap_per_texture (gallium r600)
+<li>GL_AMD_shader_stencil_export (alias of the ARB variant)
+<li>GL_ATI_draw_buffers (all drivers)
+<li>GL_ATI_texture_compression_3dc (gallium drivers, swrast)
+<li>GL_ATI_texture_float (gallium, i965)
+<li>GL_NV_conditional_render (i965)
+<li>GL_NV_texture_barrier (gallium drivers)
+</ul>
+
+
+<h2>Bug fixes</h2>
+<ul>
+</ul>
+
+
+<h2>Changes</h2>
+<ul>
+<li>The Windows MSVC project files have been removed.
+They haven't been maintained in quite a while.
+Building with SCons is an alternative.
+<li>Removed GL_SGI_texture_color_table support from swrast driver - the only
+driver that implemented it.
+</ul>
+
+
+</body>
+</html>
diff --git a/mesalib/scons/custom.py b/mesalib/scons/custom.py
index a2c690f65..029f99b99 100644
--- a/mesalib/scons/custom.py
+++ b/mesalib/scons/custom.py
@@ -157,7 +157,8 @@ def createCodeGenerateMethod(env):
def generate(env):
"""Common environment generation code"""
- if env.get('quiet', True):
+ verbose = env.get('verbose', False) or not env.get('quiet', True)
+ if not verbose:
quietCommandLines(env)
# Custom builders and methods
diff --git a/mesalib/scons/gallium.py b/mesalib/scons/gallium.py
index a94bf7364..9d08efdd1 100644
--- a/mesalib/scons/gallium.py
+++ b/mesalib/scons/gallium.py
@@ -247,6 +247,8 @@ def generate(env):
# configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
build_topdir = 'build'
build_subdir = env['platform']
+ if env['embedded']:
+ build_subdir = 'embedded-' + build_subdir
if env['machine'] != 'generic':
build_subdir += '-' + env['machine']
if env['build'] != 'release':
@@ -277,6 +279,18 @@ def generate(env):
cppdefines += ['NDEBUG']
if env['build'] == 'profile':
cppdefines += ['PROFILE']
+ if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
+ cppdefines += [
+ '_POSIX_SOURCE',
+ ('_POSIX_C_SOURCE', '199309L'),
+ '_SVID_SOURCE',
+ '_BSD_SOURCE',
+ '_GNU_SOURCE',
+ 'PTHREADS',
+ 'HAVE_POSIX_MEMALIGN',
+ ]
+ if env['platform'] == 'darwin':
+ cppdefines += ['_DARWIN_C_SOURCE']
if platform == 'windows':
cppdefines += [
'WIN32',
@@ -349,8 +363,8 @@ def generate(env):
if platform == 'wince':
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE']
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE_OGL']
- if platform == 'embedded':
- cppdefines += ['PIPE_OS_EMBEDDED']
+ if env['embedded']:
+ cppdefines += ['PIPE_SUBSYSTEM_EMBEDDED']
env.Append(CPPDEFINES = cppdefines)
# C compiler options
@@ -403,6 +417,8 @@ def generate(env):
ccflags += ['-m64']
if platform == 'darwin':
ccflags += ['-fno-common']
+ if env['platform'] != 'windows':
+ ccflags += ['-fvisibility=hidden']
# See also:
# - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
ccflags += [
@@ -595,7 +611,10 @@ def generate(env):
env['LINK'] = env['CXX']
# Default libs
- env.Append(LIBS = [])
+ libs = []
+ if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
+ libs += ['m', 'pthread', 'dl']
+ env.Append(LIBS = libs)
# Load tools
env.Tool('lex')
diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.c b/mesalib/src/gallium/auxiliary/util/u_debug.c
index 79b1fb3c1..004df439f 100644
--- a/mesalib/src/gallium/auxiliary/util/u_debug.c
+++ b/mesalib/src/gallium/auxiliary/util/u_debug.c
@@ -1,744 +1,744 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * Copyright (c) 2008 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "pipe/p_config.h"
-
-#include "pipe/p_compiler.h"
-#include "os/os_stream.h"
-#include "util/u_debug.h"
-#include "pipe/p_format.h"
-#include "pipe/p_state.h"
-#include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_memory.h"
-#include "util/u_string.h"
-#include "util/u_math.h"
-#include "util/u_tile.h"
-#include "util/u_prim.h"
-#include "util/u_surface.h"
-
-#include <limits.h> /* CHAR_BIT */
-#include <ctype.h> /* isalnum */
-
-void _debug_vprintf(const char *format, va_list ap)
-{
-#if defined(PIPE_OS_WINDOWS) || defined(PIPE_OS_EMBEDDED)
- /* We buffer until we find a newline. */
- static char buf[4096] = {'\0'};
- size_t len = strlen(buf);
- int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap);
- if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) {
- os_log_message(buf);
- buf[0] = '\0';
- }
-#else
- /* Just print as-is to stderr */
- vfprintf(stderr, format, ap);
-#endif
-}
-
-
-#ifdef DEBUG
-void debug_print_blob( const char *name,
- const void *blob,
- unsigned size )
-{
- const unsigned *ublob = (const unsigned *)blob;
- unsigned i;
-
- debug_printf("%s (%d dwords%s)\n", name, size/4,
- size%4 ? "... plus a few bytes" : "");
-
- for (i = 0; i < size/4; i++) {
- debug_printf("%d:\t%08x\n", i, ublob[i]);
- }
-}
-#endif
-
-
-static boolean
-debug_get_option_should_print(void)
-{
- static boolean first = TRUE;
- static boolean value = FALSE;
-
- if (!first)
- return value;
-
- /* Oh hey this will call into this function,
- * but its cool since we set first to false
- */
- first = FALSE;
- value = debug_get_bool_option("GALLIUM_PRINT_OPTIONS", FALSE);
- /* XXX should we print this option? Currently it wont */
- return value;
-}
-
-const char *
-debug_get_option(const char *name, const char *dfault)
-{
- const char *result;
-
- result = os_get_option(name);
- if(!result)
- result = dfault;
-
- if (debug_get_option_should_print())
- debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? result : "(null)");
-
- return result;
-}
-
-boolean
-debug_get_bool_option(const char *name, boolean dfault)
-{
- const char *str = os_get_option(name);
- boolean result;
-
- if(str == NULL)
- result = dfault;
- else if(!util_strcmp(str, "n"))
- result = FALSE;
- else if(!util_strcmp(str, "no"))
- result = FALSE;
- else if(!util_strcmp(str, "0"))
- result = FALSE;
- else if(!util_strcmp(str, "f"))
- result = FALSE;
- else if(!util_strcmp(str, "F"))
- result = FALSE;
- else if(!util_strcmp(str, "false"))
- result = FALSE;
- else if(!util_strcmp(str, "FALSE"))
- result = FALSE;
- else
- result = TRUE;
-
- if (debug_get_option_should_print())
- debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? "TRUE" : "FALSE");
-
- return result;
-}
-
-
-long
-debug_get_num_option(const char *name, long dfault)
-{
- long result;
- const char *str;
-
- str = os_get_option(name);
- if(!str)
- result = dfault;
- else {
- long sign;
- char c;
- c = *str++;
- if(c == '-') {
- sign = -1;
- c = *str++;
- }
- else {
- sign = 1;
- }
- result = 0;
- while('0' <= c && c <= '9') {
- result = result*10 + (c - '0');
- c = *str++;
- }
- result *= sign;
- }
-
- if (debug_get_option_should_print())
- debug_printf("%s: %s = %li\n", __FUNCTION__, name, result);
-
- return result;
-}
-
-static boolean str_has_option(const char *str, const char *name)
-{
- /* Empty string. */
- if (!*str) {
- return FALSE;
- }
-
- /* OPTION=all */
- if (!util_strcmp(str, "all")) {
- return TRUE;
- }
-
- /* Find 'name' in 'str' surrounded by non-alphanumeric characters. */
- {
- const char *start = str;
- unsigned name_len = strlen(name);
-
- /* 'start' is the beginning of the currently-parsed word,
- * we increment 'str' each iteration.
- * if we find either the end of string or a non-alphanumeric character,
- * we compare 'start' up to 'str-1' with 'name'. */
-
- while (1) {
- if (!*str || !isalnum(*str)) {
- if (str-start == name_len &&
- !memcmp(start, name, name_len)) {
- return TRUE;
- }
-
- if (!*str) {
- return FALSE;
- }
-
- start = str+1;
- }
-
- str++;
- }
- }
-
- return FALSE;
-}
-
-unsigned long
-debug_get_flags_option(const char *name,
- const struct debug_named_value *flags,
- unsigned long dfault)
-{
- unsigned long result;
- const char *str;
- const struct debug_named_value *orig = flags;
- int namealign = 0;
-
- str = os_get_option(name);
- if(!str)
- result = dfault;
- else if (!util_strcmp(str, "help")) {
- result = dfault;
- _debug_printf("%s: help for %s:\n", __FUNCTION__, name);
- for (; flags->name; ++flags)
- namealign = MAX2(namealign, strlen(flags->name));
- for (flags = orig; flags->name; ++flags)
- _debug_printf("| %*s [0x%0*lx]%s%s\n", namealign, flags->name,
- (int)sizeof(unsigned long)*CHAR_BIT/4, flags->value,
- flags->desc ? " " : "", flags->desc ? flags->desc : "");
- }
- else {
- result = 0;
- while( flags->name ) {
- if (str_has_option(str, flags->name))
- result |= flags->value;
- ++flags;
- }
- }
-
- if (debug_get_option_should_print()) {
- if (str) {
- debug_printf("%s: %s = 0x%lx (%s)\n", __FUNCTION__, name, result, str);
- } else {
- debug_printf("%s: %s = 0x%lx\n", __FUNCTION__, name, result);
- }
- }
-
- return result;
-}
-
-
-void _debug_assert_fail(const char *expr,
- const char *file,
- unsigned line,
- const char *function)
-{
- _debug_printf("%s:%u:%s: Assertion `%s' failed.\n", file, line, function, expr);
-#if defined(PIPE_OS_WINDOWS) && !defined(PIPE_SUBSYSTEM_WINDOWS_USER)
- if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", FALSE))
-#else
- if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", TRUE))
-#endif
- os_abort();
- else
- _debug_printf("continuing...\n");
-}
-
-
-const char *
-debug_dump_enum(const struct debug_named_value *names,
- unsigned long value)
-{
- static char rest[64];
-
- while(names->name) {
- if(names->value == value)
- return names->name;
- ++names;
- }
-
- util_snprintf(rest, sizeof(rest), "0x%08lx", value);
- return rest;
-}
-
-
-const char *
-debug_dump_enum_noprefix(const struct debug_named_value *names,
- const char *prefix,
- unsigned long value)
-{
- static char rest[64];
-
- while(names->name) {
- if(names->value == value) {
- const char *name = names->name;
- while (*name == *prefix) {
- name++;
- prefix++;
- }
- return name;
- }
- ++names;
- }
-
-
-
- util_snprintf(rest, sizeof(rest), "0x%08lx", value);
- return rest;
-}
-
-
-const char *
-debug_dump_flags(const struct debug_named_value *names,
- unsigned long value)
-{
- static char output[4096];
- static char rest[256];
- int first = 1;
-
- output[0] = '\0';
-
- while(names->name) {
- if((names->value & value) == names->value) {
- if (!first)
- util_strncat(output, "|", sizeof(output));
- else
- first = 0;
- util_strncat(output, names->name, sizeof(output) - 1);
- output[sizeof(output) - 1] = '\0';
- value &= ~names->value;
- }
- ++names;
- }
-
- if (value) {
- if (!first)
- util_strncat(output, "|", sizeof(output));
- else
- first = 0;
-
- util_snprintf(rest, sizeof(rest), "0x%08lx", value);
- util_strncat(output, rest, sizeof(output) - 1);
- output[sizeof(output) - 1] = '\0';
- }
-
- if(first)
- return "0";
-
- return output;
-}
-
-
-#ifdef DEBUG
-void debug_print_format(const char *msg, unsigned fmt )
-{
- debug_printf("%s: %s\n", msg, util_format_name(fmt));
-}
-#endif
-
-
-
-static const struct debug_named_value pipe_prim_names[] = {
-#ifdef DEBUG
- DEBUG_NAMED_VALUE(PIPE_PRIM_POINTS),
- DEBUG_NAMED_VALUE(PIPE_PRIM_LINES),
- DEBUG_NAMED_VALUE(PIPE_PRIM_LINE_LOOP),
- DEBUG_NAMED_VALUE(PIPE_PRIM_LINE_STRIP),
- DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLES),
- DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLE_STRIP),
- DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLE_FAN),
- DEBUG_NAMED_VALUE(PIPE_PRIM_QUADS),
- DEBUG_NAMED_VALUE(PIPE_PRIM_QUAD_STRIP),
- DEBUG_NAMED_VALUE(PIPE_PRIM_POLYGON),
-#endif
- DEBUG_NAMED_VALUE_END
-};
-
-
-const char *u_prim_name( unsigned prim )
-{
- return debug_dump_enum(pipe_prim_names, prim);
-}
-
-
-
-#ifdef DEBUG
-int fl_indent = 0;
-const char* fl_function[1024];
-
-int debug_funclog_enter(const char* f, const int line, const char* file)
-{
- int i;
-
- for (i = 0; i < fl_indent; i++)
- debug_printf(" ");
- debug_printf("%s\n", f);
-
- assert(fl_indent < 1023);
- fl_function[fl_indent++] = f;
-
- return 0;
-}
-
-void debug_funclog_exit(const char* f, const int line, const char* file)
-{
- --fl_indent;
- assert(fl_indent >= 0);
- assert(fl_function[fl_indent] == f);
-}
-
-void debug_funclog_enter_exit(const char* f, const int line, const char* file)
-{
- int i;
- for (i = 0; i < fl_indent; i++)
- debug_printf(" ");
- debug_printf("%s\n", f);
-}
-#endif
-
-
-
-#ifdef DEBUG
-/**
- * Dump an image to a .raw or .ppm file (depends on OS).
- * \param format PIPE_FORMAT_x
- * \param cpp bytes per pixel
- * \param width width in pixels
- * \param height height in pixels
- * \param stride row stride in bytes
- */
-void debug_dump_image(const char *prefix,
- unsigned format, unsigned cpp,
- unsigned width, unsigned height,
- unsigned stride,
- const void *data)
-{
-#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
- static unsigned no = 0;
- char filename[256];
- WCHAR wfilename[sizeof(filename)];
- ULONG_PTR iFile = 0;
- struct {
- unsigned format;
- unsigned cpp;
- unsigned width;
- unsigned height;
- } header;
- unsigned char *pMap = NULL;
- unsigned i;
-
- util_snprintf(filename, sizeof(filename), "\\??\\c:\\%03u%s.raw", ++no, prefix);
- for(i = 0; i < sizeof(filename); ++i)
- wfilename[i] = (WCHAR)filename[i];
-
- pMap = (unsigned char *)EngMapFile(wfilename, sizeof(header) + height*width*cpp, &iFile);
- if(!pMap)
- return;
-
- header.format = format;
- header.cpp = cpp;
- header.width = width;
- header.height = height;
- memcpy(pMap, &header, sizeof(header));
- pMap += sizeof(header);
-
- for(i = 0; i < height; ++i) {
- memcpy(pMap, (unsigned char *)data + stride*i, cpp*width);
- pMap += cpp*width;
- }
-
- EngUnmapFile(iFile);
-#elif defined(PIPE_OS_UNIX)
- /* write a ppm file */
- char filename[256];
- FILE *f;
-
- util_snprintf(filename, sizeof(filename), "%s.ppm", prefix);
-
- f = fopen(filename, "w");
- if (f) {
- int i, x, y;
- int r, g, b;
- const uint8_t *ptr = (uint8_t *) data;
-
- /* XXX this is a hack */
- switch (format) {
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- r = 2;
- g = 1;
- b = 0;
- break;
- default:
- r = 0;
- g = 1;
- b = 1;
- }
-
- fprintf(f, "P6\n");
- fprintf(f, "# ppm-file created by osdemo.c\n");
- fprintf(f, "%i %i\n", width, height);
- fprintf(f, "255\n");
- fclose(f);
-
- f = fopen(filename, "ab"); /* reopen in binary append mode */
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- i = y * stride + x * cpp;
- fputc(ptr[i + r], f); /* write red */
- fputc(ptr[i + g], f); /* write green */
- fputc(ptr[i + b], f); /* write blue */
- }
- }
- fclose(f);
- }
- else {
- fprintf(stderr, "Can't open %s for writing\n", filename);
- }
-#endif
-}
-
-/* FIXME: dump resources, not surfaces... */
-void debug_dump_surface(struct pipe_context *pipe,
- const char *prefix,
- struct pipe_surface *surface)
-{
- struct pipe_resource *texture;
- struct pipe_transfer *transfer;
- void *data;
-
- if (!surface)
- return;
-
- /* XXX: this doesn't necessarily work, as the driver may be using
- * temporary storage for the surface which hasn't been propagated
- * back into the texture. Need to nail down the semantics of views
- * and transfers a bit better before we can say if extra work needs
- * to be done here:
- */
- texture = surface->texture;
-
- transfer = pipe_get_transfer(pipe, texture, surface->u.tex.level,
- surface->u.tex.first_layer,
- PIPE_TRANSFER_READ,
- 0, 0, surface->width, surface->height);
-
- data = pipe->transfer_map(pipe, transfer);
- if(!data)
- goto error;
-
- debug_dump_image(prefix,
- texture->format,
- util_format_get_blocksize(texture->format),
- util_format_get_nblocksx(texture->format, surface->width),
- util_format_get_nblocksy(texture->format, surface->height),
- transfer->stride,
- data);
-
- pipe->transfer_unmap(pipe, transfer);
-error:
- pipe->transfer_destroy(pipe, transfer);
-}
-
-
-void debug_dump_texture(struct pipe_context *pipe,
- const char *prefix,
- struct pipe_resource *texture)
-{
- struct pipe_surface *surface, surf_tmpl;
-
- if (!texture)
- return;
-
- /* XXX for now, just dump image for layer=0, level=0 */
- memset(&surf_tmpl, 0, sizeof(surf_tmpl));
- u_surface_default_template(&surf_tmpl, texture, 0 /* no bind flag - not a surface */);
- surface = pipe->create_surface(pipe, texture, &surf_tmpl);
- if (surface) {
- debug_dump_surface(pipe, prefix, surface);
- pipe->surface_destroy(pipe, surface);
- }
-}
-
-
-#pragma pack(push,2)
-struct bmp_file_header {
- uint16_t bfType;
- uint32_t bfSize;
- uint16_t bfReserved1;
- uint16_t bfReserved2;
- uint32_t bfOffBits;
-};
-#pragma pack(pop)
-
-struct bmp_info_header {
- uint32_t biSize;
- int32_t biWidth;
- int32_t biHeight;
- uint16_t biPlanes;
- uint16_t biBitCount;
- uint32_t biCompression;
- uint32_t biSizeImage;
- int32_t biXPelsPerMeter;
- int32_t biYPelsPerMeter;
- uint32_t biClrUsed;
- uint32_t biClrImportant;
-};
-
-struct bmp_rgb_quad {
- uint8_t rgbBlue;
- uint8_t rgbGreen;
- uint8_t rgbRed;
- uint8_t rgbAlpha;
-};
-
-void
-debug_dump_surface_bmp(struct pipe_context *pipe,
- const char *filename,
- struct pipe_surface *surface)
-{
-#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
- struct pipe_transfer *transfer;
- struct pipe_resource *texture = surface->texture;
-
- transfer = pipe_get_transfer(pipe, texture, surface->u.tex.level,
- surface->u.tex.first_layer, PIPE_TRANSFER_READ,
- 0, 0, surface->width, surface->height);
-
- debug_dump_transfer_bmp(pipe, filename, transfer);
-
- pipe->transfer_destroy(pipe, transfer);
-#endif
-}
-
-void
-debug_dump_transfer_bmp(struct pipe_context *pipe,
- const char *filename,
- struct pipe_transfer *transfer)
-{
-#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
- float *rgba;
-
- if (!transfer)
- goto error1;
-
- rgba = MALLOC(transfer->box.width *
- transfer->box.height *
- transfer->box.depth *
- 4*sizeof(float));
- if(!rgba)
- goto error1;
-
- pipe_get_tile_rgba(pipe, transfer, 0, 0,
- transfer->box.width, transfer->box.height,
- rgba);
-
- debug_dump_float_rgba_bmp(filename,
- transfer->box.width, transfer->box.height,
- rgba, transfer->box.width);
-
- FREE(rgba);
-error1:
- ;
-#endif
-}
-
-void
-debug_dump_float_rgba_bmp(const char *filename,
- unsigned width, unsigned height,
- float *rgba, unsigned stride)
-{
-#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
- struct os_stream *stream;
- struct bmp_file_header bmfh;
- struct bmp_info_header bmih;
- unsigned x, y;
-
- if(!rgba)
- goto error1;
-
- bmfh.bfType = 0x4d42;
- bmfh.bfSize = 14 + 40 + height*width*4;
- bmfh.bfReserved1 = 0;
- bmfh.bfReserved2 = 0;
- bmfh.bfOffBits = 14 + 40;
-
- bmih.biSize = 40;
- bmih.biWidth = width;
- bmih.biHeight = height;
- bmih.biPlanes = 1;
- bmih.biBitCount = 32;
- bmih.biCompression = 0;
- bmih.biSizeImage = height*width*4;
- bmih.biXPelsPerMeter = 0;
- bmih.biYPelsPerMeter = 0;
- bmih.biClrUsed = 0;
- bmih.biClrImportant = 0;
-
- stream = os_file_stream_create(filename);
- if(!stream)
- goto error1;
-
- os_stream_write(stream, &bmfh, 14);
- os_stream_write(stream, &bmih, 40);
-
- y = height;
- while(y--) {
- float *ptr = rgba + (stride * y * 4);
- for(x = 0; x < width; ++x)
- {
- struct bmp_rgb_quad pixel;
- pixel.rgbRed = float_to_ubyte(ptr[x*4 + 0]);
- pixel.rgbGreen = float_to_ubyte(ptr[x*4 + 1]);
- pixel.rgbBlue = float_to_ubyte(ptr[x*4 + 2]);
- pixel.rgbAlpha = 255;
- os_stream_write(stream, &pixel, 4);
- }
- }
-
- os_stream_close(stream);
-error1:
- ;
-#endif
-}
-
-#endif
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright (c) 2008 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "pipe/p_config.h"
+
+#include "pipe/p_compiler.h"
+#include "os/os_stream.h"
+#include "util/u_debug.h"
+#include "pipe/p_format.h"
+#include "pipe/p_state.h"
+#include "util/u_inlines.h"
+#include "util/u_format.h"
+#include "util/u_memory.h"
+#include "util/u_string.h"
+#include "util/u_math.h"
+#include "util/u_tile.h"
+#include "util/u_prim.h"
+#include "util/u_surface.h"
+
+#include <limits.h> /* CHAR_BIT */
+#include <ctype.h> /* isalnum */
+
+void _debug_vprintf(const char *format, va_list ap)
+{
+#if defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_EMBEDDED)
+ /* We buffer until we find a newline. */
+ static char buf[4096] = {'\0'};
+ size_t len = strlen(buf);
+ int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap);
+ if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) {
+ os_log_message(buf);
+ buf[0] = '\0';
+ }
+#else
+ /* Just print as-is to stderr */
+ vfprintf(stderr, format, ap);
+#endif
+}
+
+
+#ifdef DEBUG
+void debug_print_blob( const char *name,
+ const void *blob,
+ unsigned size )
+{
+ const unsigned *ublob = (const unsigned *)blob;
+ unsigned i;
+
+ debug_printf("%s (%d dwords%s)\n", name, size/4,
+ size%4 ? "... plus a few bytes" : "");
+
+ for (i = 0; i < size/4; i++) {
+ debug_printf("%d:\t%08x\n", i, ublob[i]);
+ }
+}
+#endif
+
+
+static boolean
+debug_get_option_should_print(void)
+{
+ static boolean first = TRUE;
+ static boolean value = FALSE;
+
+ if (!first)
+ return value;
+
+ /* Oh hey this will call into this function,
+ * but its cool since we set first to false
+ */
+ first = FALSE;
+ value = debug_get_bool_option("GALLIUM_PRINT_OPTIONS", FALSE);
+ /* XXX should we print this option? Currently it wont */
+ return value;
+}
+
+const char *
+debug_get_option(const char *name, const char *dfault)
+{
+ const char *result;
+
+ result = os_get_option(name);
+ if(!result)
+ result = dfault;
+
+ if (debug_get_option_should_print())
+ debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? result : "(null)");
+
+ return result;
+}
+
+boolean
+debug_get_bool_option(const char *name, boolean dfault)
+{
+ const char *str = os_get_option(name);
+ boolean result;
+
+ if(str == NULL)
+ result = dfault;
+ else if(!util_strcmp(str, "n"))
+ result = FALSE;
+ else if(!util_strcmp(str, "no"))
+ result = FALSE;
+ else if(!util_strcmp(str, "0"))
+ result = FALSE;
+ else if(!util_strcmp(str, "f"))
+ result = FALSE;
+ else if(!util_strcmp(str, "F"))
+ result = FALSE;
+ else if(!util_strcmp(str, "false"))
+ result = FALSE;
+ else if(!util_strcmp(str, "FALSE"))
+ result = FALSE;
+ else
+ result = TRUE;
+
+ if (debug_get_option_should_print())
+ debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? "TRUE" : "FALSE");
+
+ return result;
+}
+
+
+long
+debug_get_num_option(const char *name, long dfault)
+{
+ long result;
+ const char *str;
+
+ str = os_get_option(name);
+ if(!str)
+ result = dfault;
+ else {
+ long sign;
+ char c;
+ c = *str++;
+ if(c == '-') {
+ sign = -1;
+ c = *str++;
+ }
+ else {
+ sign = 1;
+ }
+ result = 0;
+ while('0' <= c && c <= '9') {
+ result = result*10 + (c - '0');
+ c = *str++;
+ }
+ result *= sign;
+ }
+
+ if (debug_get_option_should_print())
+ debug_printf("%s: %s = %li\n", __FUNCTION__, name, result);
+
+ return result;
+}
+
+static boolean str_has_option(const char *str, const char *name)
+{
+ /* Empty string. */
+ if (!*str) {
+ return FALSE;
+ }
+
+ /* OPTION=all */
+ if (!util_strcmp(str, "all")) {
+ return TRUE;
+ }
+
+ /* Find 'name' in 'str' surrounded by non-alphanumeric characters. */
+ {
+ const char *start = str;
+ unsigned name_len = strlen(name);
+
+ /* 'start' is the beginning of the currently-parsed word,
+ * we increment 'str' each iteration.
+ * if we find either the end of string or a non-alphanumeric character,
+ * we compare 'start' up to 'str-1' with 'name'. */
+
+ while (1) {
+ if (!*str || !isalnum(*str)) {
+ if (str-start == name_len &&
+ !memcmp(start, name, name_len)) {
+ return TRUE;
+ }
+
+ if (!*str) {
+ return FALSE;
+ }
+
+ start = str+1;
+ }
+
+ str++;
+ }
+ }
+
+ return FALSE;
+}
+
+unsigned long
+debug_get_flags_option(const char *name,
+ const struct debug_named_value *flags,
+ unsigned long dfault)
+{
+ unsigned long result;
+ const char *str;
+ const struct debug_named_value *orig = flags;
+ int namealign = 0;
+
+ str = os_get_option(name);
+ if(!str)
+ result = dfault;
+ else if (!util_strcmp(str, "help")) {
+ result = dfault;
+ _debug_printf("%s: help for %s:\n", __FUNCTION__, name);
+ for (; flags->name; ++flags)
+ namealign = MAX2(namealign, strlen(flags->name));
+ for (flags = orig; flags->name; ++flags)
+ _debug_printf("| %*s [0x%0*lx]%s%s\n", namealign, flags->name,
+ (int)sizeof(unsigned long)*CHAR_BIT/4, flags->value,
+ flags->desc ? " " : "", flags->desc ? flags->desc : "");
+ }
+ else {
+ result = 0;
+ while( flags->name ) {
+ if (str_has_option(str, flags->name))
+ result |= flags->value;
+ ++flags;
+ }
+ }
+
+ if (debug_get_option_should_print()) {
+ if (str) {
+ debug_printf("%s: %s = 0x%lx (%s)\n", __FUNCTION__, name, result, str);
+ } else {
+ debug_printf("%s: %s = 0x%lx\n", __FUNCTION__, name, result);
+ }
+ }
+
+ return result;
+}
+
+
+void _debug_assert_fail(const char *expr,
+ const char *file,
+ unsigned line,
+ const char *function)
+{
+ _debug_printf("%s:%u:%s: Assertion `%s' failed.\n", file, line, function, expr);
+#if defined(PIPE_OS_WINDOWS) && !defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+ if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", FALSE))
+#else
+ if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", TRUE))
+#endif
+ os_abort();
+ else
+ _debug_printf("continuing...\n");
+}
+
+
+const char *
+debug_dump_enum(const struct debug_named_value *names,
+ unsigned long value)
+{
+ static char rest[64];
+
+ while(names->name) {
+ if(names->value == value)
+ return names->name;
+ ++names;
+ }
+
+ util_snprintf(rest, sizeof(rest), "0x%08lx", value);
+ return rest;
+}
+
+
+const char *
+debug_dump_enum_noprefix(const struct debug_named_value *names,
+ const char *prefix,
+ unsigned long value)
+{
+ static char rest[64];
+
+ while(names->name) {
+ if(names->value == value) {
+ const char *name = names->name;
+ while (*name == *prefix) {
+ name++;
+ prefix++;
+ }
+ return name;
+ }
+ ++names;
+ }
+
+
+
+ util_snprintf(rest, sizeof(rest), "0x%08lx", value);
+ return rest;
+}
+
+
+const char *
+debug_dump_flags(const struct debug_named_value *names,
+ unsigned long value)
+{
+ static char output[4096];
+ static char rest[256];
+ int first = 1;
+
+ output[0] = '\0';
+
+ while(names->name) {
+ if((names->value & value) == names->value) {
+ if (!first)
+ util_strncat(output, "|", sizeof(output));
+ else
+ first = 0;
+ util_strncat(output, names->name, sizeof(output) - 1);
+ output[sizeof(output) - 1] = '\0';
+ value &= ~names->value;
+ }
+ ++names;
+ }
+
+ if (value) {
+ if (!first)
+ util_strncat(output, "|", sizeof(output));
+ else
+ first = 0;
+
+ util_snprintf(rest, sizeof(rest), "0x%08lx", value);
+ util_strncat(output, rest, sizeof(output) - 1);
+ output[sizeof(output) - 1] = '\0';
+ }
+
+ if(first)
+ return "0";
+
+ return output;
+}
+
+
+#ifdef DEBUG
+void debug_print_format(const char *msg, unsigned fmt )
+{
+ debug_printf("%s: %s\n", msg, util_format_name(fmt));
+}
+#endif
+
+
+
+static const struct debug_named_value pipe_prim_names[] = {
+#ifdef DEBUG
+ DEBUG_NAMED_VALUE(PIPE_PRIM_POINTS),
+ DEBUG_NAMED_VALUE(PIPE_PRIM_LINES),
+ DEBUG_NAMED_VALUE(PIPE_PRIM_LINE_LOOP),
+ DEBUG_NAMED_VALUE(PIPE_PRIM_LINE_STRIP),
+ DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLES),
+ DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLE_STRIP),
+ DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLE_FAN),
+ DEBUG_NAMED_VALUE(PIPE_PRIM_QUADS),
+ DEBUG_NAMED_VALUE(PIPE_PRIM_QUAD_STRIP),
+ DEBUG_NAMED_VALUE(PIPE_PRIM_POLYGON),
+#endif
+ DEBUG_NAMED_VALUE_END
+};
+
+
+const char *u_prim_name( unsigned prim )
+{
+ return debug_dump_enum(pipe_prim_names, prim);
+}
+
+
+
+#ifdef DEBUG
+int fl_indent = 0;
+const char* fl_function[1024];
+
+int debug_funclog_enter(const char* f, const int line, const char* file)
+{
+ int i;
+
+ for (i = 0; i < fl_indent; i++)
+ debug_printf(" ");
+ debug_printf("%s\n", f);
+
+ assert(fl_indent < 1023);
+ fl_function[fl_indent++] = f;
+
+ return 0;
+}
+
+void debug_funclog_exit(const char* f, const int line, const char* file)
+{
+ --fl_indent;
+ assert(fl_indent >= 0);
+ assert(fl_function[fl_indent] == f);
+}
+
+void debug_funclog_enter_exit(const char* f, const int line, const char* file)
+{
+ int i;
+ for (i = 0; i < fl_indent; i++)
+ debug_printf(" ");
+ debug_printf("%s\n", f);
+}
+#endif
+
+
+
+#ifdef DEBUG
+/**
+ * Dump an image to a .raw or .ppm file (depends on OS).
+ * \param format PIPE_FORMAT_x
+ * \param cpp bytes per pixel
+ * \param width width in pixels
+ * \param height height in pixels
+ * \param stride row stride in bytes
+ */
+void debug_dump_image(const char *prefix,
+ unsigned format, unsigned cpp,
+ unsigned width, unsigned height,
+ unsigned stride,
+ const void *data)
+{
+#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
+ static unsigned no = 0;
+ char filename[256];
+ WCHAR wfilename[sizeof(filename)];
+ ULONG_PTR iFile = 0;
+ struct {
+ unsigned format;
+ unsigned cpp;
+ unsigned width;
+ unsigned height;
+ } header;
+ unsigned char *pMap = NULL;
+ unsigned i;
+
+ util_snprintf(filename, sizeof(filename), "\\??\\c:\\%03u%s.raw", ++no, prefix);
+ for(i = 0; i < sizeof(filename); ++i)
+ wfilename[i] = (WCHAR)filename[i];
+
+ pMap = (unsigned char *)EngMapFile(wfilename, sizeof(header) + height*width*cpp, &iFile);
+ if(!pMap)
+ return;
+
+ header.format = format;
+ header.cpp = cpp;
+ header.width = width;
+ header.height = height;
+ memcpy(pMap, &header, sizeof(header));
+ pMap += sizeof(header);
+
+ for(i = 0; i < height; ++i) {
+ memcpy(pMap, (unsigned char *)data + stride*i, cpp*width);
+ pMap += cpp*width;
+ }
+
+ EngUnmapFile(iFile);
+#elif defined(PIPE_OS_UNIX)
+ /* write a ppm file */
+ char filename[256];
+ FILE *f;
+
+ util_snprintf(filename, sizeof(filename), "%s.ppm", prefix);
+
+ f = fopen(filename, "w");
+ if (f) {
+ int i, x, y;
+ int r, g, b;
+ const uint8_t *ptr = (uint8_t *) data;
+
+ /* XXX this is a hack */
+ switch (format) {
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
+ r = 2;
+ g = 1;
+ b = 0;
+ break;
+ default:
+ r = 0;
+ g = 1;
+ b = 1;
+ }
+
+ fprintf(f, "P6\n");
+ fprintf(f, "# ppm-file created by osdemo.c\n");
+ fprintf(f, "%i %i\n", width, height);
+ fprintf(f, "255\n");
+ fclose(f);
+
+ f = fopen(filename, "ab"); /* reopen in binary append mode */
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ i = y * stride + x * cpp;
+ fputc(ptr[i + r], f); /* write red */
+ fputc(ptr[i + g], f); /* write green */
+ fputc(ptr[i + b], f); /* write blue */
+ }
+ }
+ fclose(f);
+ }
+ else {
+ fprintf(stderr, "Can't open %s for writing\n", filename);
+ }
+#endif
+}
+
+/* FIXME: dump resources, not surfaces... */
+void debug_dump_surface(struct pipe_context *pipe,
+ const char *prefix,
+ struct pipe_surface *surface)
+{
+ struct pipe_resource *texture;
+ struct pipe_transfer *transfer;
+ void *data;
+
+ if (!surface)
+ return;
+
+ /* XXX: this doesn't necessarily work, as the driver may be using
+ * temporary storage for the surface which hasn't been propagated
+ * back into the texture. Need to nail down the semantics of views
+ * and transfers a bit better before we can say if extra work needs
+ * to be done here:
+ */
+ texture = surface->texture;
+
+ transfer = pipe_get_transfer(pipe, texture, surface->u.tex.level,
+ surface->u.tex.first_layer,
+ PIPE_TRANSFER_READ,
+ 0, 0, surface->width, surface->height);
+
+ data = pipe->transfer_map(pipe, transfer);
+ if(!data)
+ goto error;
+
+ debug_dump_image(prefix,
+ texture->format,
+ util_format_get_blocksize(texture->format),
+ util_format_get_nblocksx(texture->format, surface->width),
+ util_format_get_nblocksy(texture->format, surface->height),
+ transfer->stride,
+ data);
+
+ pipe->transfer_unmap(pipe, transfer);
+error:
+ pipe->transfer_destroy(pipe, transfer);
+}
+
+
+void debug_dump_texture(struct pipe_context *pipe,
+ const char *prefix,
+ struct pipe_resource *texture)
+{
+ struct pipe_surface *surface, surf_tmpl;
+
+ if (!texture)
+ return;
+
+ /* XXX for now, just dump image for layer=0, level=0 */
+ memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+ u_surface_default_template(&surf_tmpl, texture, 0 /* no bind flag - not a surface */);
+ surface = pipe->create_surface(pipe, texture, &surf_tmpl);
+ if (surface) {
+ debug_dump_surface(pipe, prefix, surface);
+ pipe->surface_destroy(pipe, surface);
+ }
+}
+
+
+#pragma pack(push,2)
+struct bmp_file_header {
+ uint16_t bfType;
+ uint32_t bfSize;
+ uint16_t bfReserved1;
+ uint16_t bfReserved2;
+ uint32_t bfOffBits;
+};
+#pragma pack(pop)
+
+struct bmp_info_header {
+ uint32_t biSize;
+ int32_t biWidth;
+ int32_t biHeight;
+ uint16_t biPlanes;
+ uint16_t biBitCount;
+ uint32_t biCompression;
+ uint32_t biSizeImage;
+ int32_t biXPelsPerMeter;
+ int32_t biYPelsPerMeter;
+ uint32_t biClrUsed;
+ uint32_t biClrImportant;
+};
+
+struct bmp_rgb_quad {
+ uint8_t rgbBlue;
+ uint8_t rgbGreen;
+ uint8_t rgbRed;
+ uint8_t rgbAlpha;
+};
+
+void
+debug_dump_surface_bmp(struct pipe_context *pipe,
+ const char *filename,
+ struct pipe_surface *surface)
+{
+#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
+ struct pipe_transfer *transfer;
+ struct pipe_resource *texture = surface->texture;
+
+ transfer = pipe_get_transfer(pipe, texture, surface->u.tex.level,
+ surface->u.tex.first_layer, PIPE_TRANSFER_READ,
+ 0, 0, surface->width, surface->height);
+
+ debug_dump_transfer_bmp(pipe, filename, transfer);
+
+ pipe->transfer_destroy(pipe, transfer);
+#endif
+}
+
+void
+debug_dump_transfer_bmp(struct pipe_context *pipe,
+ const char *filename,
+ struct pipe_transfer *transfer)
+{
+#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
+ float *rgba;
+
+ if (!transfer)
+ goto error1;
+
+ rgba = MALLOC(transfer->box.width *
+ transfer->box.height *
+ transfer->box.depth *
+ 4*sizeof(float));
+ if(!rgba)
+ goto error1;
+
+ pipe_get_tile_rgba(pipe, transfer, 0, 0,
+ transfer->box.width, transfer->box.height,
+ rgba);
+
+ debug_dump_float_rgba_bmp(filename,
+ transfer->box.width, transfer->box.height,
+ rgba, transfer->box.width);
+
+ FREE(rgba);
+error1:
+ ;
+#endif
+}
+
+void
+debug_dump_float_rgba_bmp(const char *filename,
+ unsigned width, unsigned height,
+ float *rgba, unsigned stride)
+{
+#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
+ struct os_stream *stream;
+ struct bmp_file_header bmfh;
+ struct bmp_info_header bmih;
+ unsigned x, y;
+
+ if(!rgba)
+ goto error1;
+
+ bmfh.bfType = 0x4d42;
+ bmfh.bfSize = 14 + 40 + height*width*4;
+ bmfh.bfReserved1 = 0;
+ bmfh.bfReserved2 = 0;
+ bmfh.bfOffBits = 14 + 40;
+
+ bmih.biSize = 40;
+ bmih.biWidth = width;
+ bmih.biHeight = height;
+ bmih.biPlanes = 1;
+ bmih.biBitCount = 32;
+ bmih.biCompression = 0;
+ bmih.biSizeImage = height*width*4;
+ bmih.biXPelsPerMeter = 0;
+ bmih.biYPelsPerMeter = 0;
+ bmih.biClrUsed = 0;
+ bmih.biClrImportant = 0;
+
+ stream = os_file_stream_create(filename);
+ if(!stream)
+ goto error1;
+
+ os_stream_write(stream, &bmfh, 14);
+ os_stream_write(stream, &bmih, 40);
+
+ y = height;
+ while(y--) {
+ float *ptr = rgba + (stride * y * 4);
+ for(x = 0; x < width; ++x)
+ {
+ struct bmp_rgb_quad pixel;
+ pixel.rgbRed = float_to_ubyte(ptr[x*4 + 0]);
+ pixel.rgbGreen = float_to_ubyte(ptr[x*4 + 1]);
+ pixel.rgbBlue = float_to_ubyte(ptr[x*4 + 2]);
+ pixel.rgbAlpha = 255;
+ os_stream_write(stream, &pixel, 4);
+ }
+ }
+
+ os_stream_close(stream);
+error1:
+ ;
+#endif
+}
+
+#endif
diff --git a/mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.c b/mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.c
index 04149525e..374fc336b 100644
--- a/mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.c
+++ b/mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.c
@@ -152,9 +152,9 @@ void u_vbuf_mgr_destroy(struct u_vbuf_mgr *mgrb)
}
-static void u_vbuf_translate_begin(struct u_vbuf_mgr_priv *mgr,
- int min_index, int max_index,
- boolean *upload_flushed)
+static enum u_vbuf_return_flags
+u_vbuf_translate_begin(struct u_vbuf_mgr_priv *mgr,
+ int min_index, int max_index)
{
struct translate_key key;
struct translate_element *te;
@@ -166,6 +166,7 @@ static void u_vbuf_translate_begin(struct u_vbuf_mgr_priv *mgr,
struct pipe_resource *out_buffer = NULL;
unsigned i, num_verts, out_offset;
struct pipe_vertex_element new_velems[PIPE_MAX_ATTRIBS];
+ boolean upload_flushed = FALSE;
memset(&key, 0, sizeof(key));
memset(tr_elem_index, 0xff, sizeof(tr_elem_index));
@@ -248,7 +249,7 @@ static void u_vbuf_translate_begin(struct u_vbuf_mgr_priv *mgr,
u_upload_alloc(mgr->b.uploader,
key.output_stride * min_index,
key.output_stride * num_verts,
- &out_offset, &out_buffer, upload_flushed,
+ &out_offset, &out_buffer, &upload_flushed,
(void**)&out_map);
out_offset -= key.output_stride * min_index;
@@ -308,6 +309,8 @@ static void u_vbuf_translate_begin(struct u_vbuf_mgr_priv *mgr,
}
pipe_resource_reference(&out_buffer, NULL);
+
+ return upload_flushed ? U_VBUF_UPLOAD_FLUSHED : 0;
}
static void u_vbuf_translate_end(struct u_vbuf_mgr_priv *mgr)
@@ -510,14 +513,15 @@ void u_vbuf_mgr_set_vertex_buffers(struct u_vbuf_mgr *mgrb,
mgr->b.nr_real_vertex_buffers = count;
}
-static void u_vbuf_upload_buffers(struct u_vbuf_mgr_priv *mgr,
- int min_index, int max_index,
- unsigned instance_count,
- boolean *upload_flushed)
+static enum u_vbuf_return_flags
+u_vbuf_upload_buffers(struct u_vbuf_mgr_priv *mgr,
+ int min_index, int max_index,
+ unsigned instance_count)
{
unsigned i, nr = mgr->ve->count;
unsigned count = max_index + 1 - min_index;
boolean uploaded[PIPE_MAX_ATTRIBS] = {0};
+ enum u_vbuf_return_flags retval = 0;
for (i = 0; i < nr; i++) {
unsigned index = mgr->ve->ve[i].vertex_buffer_index;
@@ -537,6 +541,11 @@ static void u_vbuf_upload_buffers(struct u_vbuf_mgr_priv *mgr,
} else if (vb->stride) {
first = vb->stride * min_index;
size = vb->stride * count;
+
+ /* Unusual case when stride is smaller than the format size.
+ * XXX This won't work with interleaved arrays. */
+ if (mgr->ve->native_format_size[i] > vb->stride)
+ size += mgr->ve->native_format_size[i] - vb->stride;
} else {
first = 0;
size = mgr->ve->native_format_size[i];
@@ -551,11 +560,14 @@ static void u_vbuf_upload_buffers(struct u_vbuf_mgr_priv *mgr,
vb->buffer_offset -= first;
uploaded[index] = TRUE;
- *upload_flushed = *upload_flushed || flushed;
+ if (flushed)
+ retval |= U_VBUF_UPLOAD_FLUSHED;
} else {
assert(mgr->b.real_vertex_buffer[index]);
}
}
+
+ return retval;
}
static void u_vbuf_mgr_compute_max_index(struct u_vbuf_mgr_priv *mgr)
@@ -597,14 +609,13 @@ static void u_vbuf_mgr_compute_max_index(struct u_vbuf_mgr_priv *mgr)
}
}
-void u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgrb,
- const struct pipe_draw_info *info,
- boolean *buffers_updated,
- boolean *uploader_flushed)
+enum u_vbuf_return_flags
+u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgrb,
+ const struct pipe_draw_info *info)
{
struct u_vbuf_mgr_priv *mgr = (struct u_vbuf_mgr_priv*)mgrb;
- boolean bufs_updated = FALSE, upload_flushed = FALSE;
int min_index, max_index;
+ enum u_vbuf_return_flags retval = 0;
u_vbuf_mgr_compute_max_index(mgr);
@@ -617,27 +628,20 @@ void u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgrb,
/* Translate vertices with non-native layouts or formats. */
if (mgr->incompatible_vb_layout || mgr->ve->incompatible_layout) {
- u_vbuf_translate_begin(mgr, min_index, max_index, &upload_flushed);
+ retval |= u_vbuf_translate_begin(mgr, min_index, max_index);
if (mgr->fallback_ve) {
- bufs_updated = TRUE;
+ retval |= U_VBUF_BUFFERS_UPDATED;
}
}
/* Upload user buffers. */
if (mgr->any_user_vbs) {
- u_vbuf_upload_buffers(mgr, min_index, max_index, info->instance_count,
- &upload_flushed);
- bufs_updated = TRUE;
- }
-
- /* Set the return values. */
- if (buffers_updated) {
- *buffers_updated = bufs_updated;
- }
- if (uploader_flushed) {
- *uploader_flushed = upload_flushed;
+ retval |= u_vbuf_upload_buffers(mgr, min_index, max_index,
+ info->instance_count);
+ retval |= U_VBUF_BUFFERS_UPDATED;
}
+ return retval;
}
void u_vbuf_mgr_draw_end(struct u_vbuf_mgr *mgrb)
diff --git a/mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.h b/mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.h
index 0ef27744c..4e6372435 100644
--- a/mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.h
+++ b/mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.h
@@ -1,121 +1,125 @@
-/**************************************************************************
- *
- * Copyright 2011 Marek Olšák <maraeo@gmail.com>
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef U_VBUF_MGR_H
-#define U_VBUF_MGR_H
-
-/* This module builds upon u_upload_mgr and translate_cache and takes care of
- * user buffer uploads and vertex format fallbacks. It's designed
- * for the drivers which don't always use the Draw module. (e.g. for HWTCL)
- */
-
-#include "pipe/p_context.h"
-#include "pipe/p_state.h"
-#include "util/u_transfer.h"
-
-/* The manager.
- * This structure should also be used to access vertex buffers
- * from a driver. */
-struct u_vbuf_mgr {
- /* This is what was set in set_vertex_buffers.
- * May contain user buffers. */
- struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
- unsigned nr_vertex_buffers;
-
- /* Contains only real vertex buffers.
- * Hardware drivers should use real_vertex_buffers[i]
- * instead of vertex_buffers[i].buffer. */
- struct pipe_resource *real_vertex_buffer[PIPE_MAX_ATTRIBS];
- int nr_real_vertex_buffers;
-
- /* Precomputed max_index for hardware vertex buffers. */
- unsigned max_index;
-
- /* This uploader can optionally be used by the driver.
- *
- * Allowed functions:
- * - u_upload_alloc
- * - u_upload_data
- * - u_upload_buffer
- * - u_upload_flush */
- struct u_upload_mgr *uploader;
-};
-
-struct u_vbuf_resource {
- struct u_resource b;
- uint8_t *user_ptr;
-};
-
-/* Opaque type containing information about vertex elements for the manager. */
-struct u_vbuf_mgr_elements;
-
-enum u_fetch_alignment {
- U_VERTEX_FETCH_BYTE_ALIGNED,
- U_VERTEX_FETCH_DWORD_ALIGNED
-};
-
-
-struct u_vbuf_mgr *
-u_vbuf_mgr_create(struct pipe_context *pipe,
- unsigned upload_buffer_size,
- unsigned upload_buffer_alignment,
- unsigned upload_buffer_bind,
- enum u_fetch_alignment fetch_alignment);
-
-void u_vbuf_mgr_destroy(struct u_vbuf_mgr *mgr);
-
-struct u_vbuf_mgr_elements *
-u_vbuf_mgr_create_vertex_elements(struct u_vbuf_mgr *mgr,
- unsigned count,
- const struct pipe_vertex_element *attrs,
- struct pipe_vertex_element *native_attrs);
-
-void u_vbuf_mgr_bind_vertex_elements(struct u_vbuf_mgr *mgr,
- void *cso,
- struct u_vbuf_mgr_elements *ve);
-
-void u_vbuf_mgr_destroy_vertex_elements(struct u_vbuf_mgr *mgr,
- struct u_vbuf_mgr_elements *ve);
-
-void u_vbuf_mgr_set_vertex_buffers(struct u_vbuf_mgr *mgr,
- unsigned count,
- const struct pipe_vertex_buffer *bufs);
-
-void u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgr,
- const struct pipe_draw_info *info,
- boolean *buffers_updated,
- boolean *uploader_flushed);
-
-void u_vbuf_mgr_draw_end(struct u_vbuf_mgr *mgr);
-
-
-static INLINE struct u_vbuf_resource *u_vbuf_resource(struct pipe_resource *r)
-{
- return (struct u_vbuf_resource*)r;
-}
-
-#endif
+/**************************************************************************
+ *
+ * Copyright 2011 Marek Olšák <maraeo@gmail.com>
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef U_VBUF_MGR_H
+#define U_VBUF_MGR_H
+
+/* This module builds upon u_upload_mgr and translate_cache and takes care of
+ * user buffer uploads and vertex format fallbacks. It's designed
+ * for the drivers which don't always use the Draw module. (e.g. for HWTCL)
+ */
+
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "util/u_transfer.h"
+
+/* The manager.
+ * This structure should also be used to access vertex buffers
+ * from a driver. */
+struct u_vbuf_mgr {
+ /* This is what was set in set_vertex_buffers.
+ * May contain user buffers. */
+ struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
+ unsigned nr_vertex_buffers;
+
+ /* Contains only real vertex buffers.
+ * Hardware drivers should use real_vertex_buffers[i]
+ * instead of vertex_buffers[i].buffer. */
+ struct pipe_resource *real_vertex_buffer[PIPE_MAX_ATTRIBS];
+ int nr_real_vertex_buffers;
+
+ /* Precomputed max_index for hardware vertex buffers. */
+ unsigned max_index;
+
+ /* This uploader can optionally be used by the driver.
+ *
+ * Allowed functions:
+ * - u_upload_alloc
+ * - u_upload_data
+ * - u_upload_buffer
+ * - u_upload_flush */
+ struct u_upload_mgr *uploader;
+};
+
+struct u_vbuf_resource {
+ struct u_resource b;
+ uint8_t *user_ptr;
+};
+
+/* Opaque type containing information about vertex elements for the manager. */
+struct u_vbuf_mgr_elements;
+
+enum u_fetch_alignment {
+ U_VERTEX_FETCH_BYTE_ALIGNED,
+ U_VERTEX_FETCH_DWORD_ALIGNED
+};
+
+enum u_vbuf_return_flags {
+ U_VBUF_BUFFERS_UPDATED = 1,
+ U_VBUF_UPLOAD_FLUSHED = 2
+};
+
+
+struct u_vbuf_mgr *
+u_vbuf_mgr_create(struct pipe_context *pipe,
+ unsigned upload_buffer_size,
+ unsigned upload_buffer_alignment,
+ unsigned upload_buffer_bind,
+ enum u_fetch_alignment fetch_alignment);
+
+void u_vbuf_mgr_destroy(struct u_vbuf_mgr *mgr);
+
+struct u_vbuf_mgr_elements *
+u_vbuf_mgr_create_vertex_elements(struct u_vbuf_mgr *mgr,
+ unsigned count,
+ const struct pipe_vertex_element *attrs,
+ struct pipe_vertex_element *native_attrs);
+
+void u_vbuf_mgr_bind_vertex_elements(struct u_vbuf_mgr *mgr,
+ void *cso,
+ struct u_vbuf_mgr_elements *ve);
+
+void u_vbuf_mgr_destroy_vertex_elements(struct u_vbuf_mgr *mgr,
+ struct u_vbuf_mgr_elements *ve);
+
+void u_vbuf_mgr_set_vertex_buffers(struct u_vbuf_mgr *mgr,
+ unsigned count,
+ const struct pipe_vertex_buffer *bufs);
+
+enum u_vbuf_return_flags
+u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgr,
+ const struct pipe_draw_info *info);
+
+void u_vbuf_mgr_draw_end(struct u_vbuf_mgr *mgr);
+
+
+static INLINE struct u_vbuf_resource *u_vbuf_resource(struct pipe_resource *r)
+{
+ return (struct u_vbuf_resource*)r;
+}
+
+#endif
diff --git a/mesalib/src/glsl/SConscript b/mesalib/src/glsl/SConscript
index 5d97756e1..1441cc74b 100644
--- a/mesalib/src/glsl/SConscript
+++ b/mesalib/src/glsl/SConscript
@@ -1,181 +1,181 @@
-import common
-
-Import('*')
-
-from sys import executable as python_cmd
-
-env = env.Clone()
-
-env.Prepend(CPPPATH = [
- '#include',
- '#src/mapi',
- '#src/mesa',
- '#src/glsl',
- '#src/glsl/glcpp',
-])
-
-# Make glcpp/glcpp-parse.h and glsl_parser.h reacheable from the include path
-env.Append(CPPPATH = [Dir('.').abspath])
-
-env.Append(YACCFLAGS = '-d')
-
-parser_env = env.Clone()
-parser_env.Append(YACCFLAGS = [
- '--defines=%s' % File('glsl_parser.h').abspath,
- '-p', '_mesa_glsl_',
-])
-
-glcpp_lexer = env.CFile('glcpp/glcpp-lex.c', 'glcpp/glcpp-lex.l')
-glcpp_parser = env.CFile('glcpp/glcpp-parse.c', 'glcpp/glcpp-parse.y')
-glsl_lexer = parser_env.CXXFile('glsl_lexer.cpp', 'glsl_lexer.ll')
-glsl_parser = parser_env.CXXFile('glsl_parser.cpp', 'glsl_parser.yy')
-
-glsl_sources = [
- glcpp_lexer,
- glcpp_parser[0],
- 'glcpp/pp.c',
- 'ast_expr.cpp',
- 'ast_function.cpp',
- 'ast_to_hir.cpp',
- 'ast_type.cpp',
- glsl_lexer,
- glsl_parser[0],
- 'glsl_parser_extras.cpp',
- 'glsl_types.cpp',
- 'glsl_symbol_table.cpp',
- 'hir_field_selection.cpp',
- 'ir_basic_block.cpp',
- 'ir_clone.cpp',
- 'ir_constant_expression.cpp',
- 'ir.cpp',
- 'ir_expression_flattening.cpp',
- 'ir_function_can_inline.cpp',
- 'ir_function.cpp',
- 'ir_hierarchical_visitor.cpp',
- 'ir_hv_accept.cpp',
- 'ir_import_prototypes.cpp',
- 'ir_print_visitor.cpp',
- 'ir_reader.cpp',
- 'ir_rvalue_visitor.cpp',
- 'ir_set_program_inouts.cpp',
- 'ir_validate.cpp',
- 'ir_variable.cpp',
- 'ir_variable_refcount.cpp',
- 'linker.cpp',
- 'link_functions.cpp',
- 'loop_analysis.cpp',
- 'loop_controls.cpp',
- 'loop_unroll.cpp',
- 'lower_discard.cpp',
- 'lower_if_to_cond_assign.cpp',
- 'lower_instructions.cpp',
- 'lower_jumps.cpp',
- 'lower_mat_op_to_vec.cpp',
- 'lower_noise.cpp',
- 'lower_variable_index_to_cond_assign.cpp',
- 'lower_vec_index_to_cond_assign.cpp',
- 'lower_vec_index_to_swizzle.cpp',
- 'lower_vector.cpp',
- 'opt_algebraic.cpp',
- 'opt_constant_folding.cpp',
- 'opt_constant_propagation.cpp',
- 'opt_constant_variable.cpp',
- 'opt_copy_propagation.cpp',
- 'opt_copy_propagation_elements.cpp',
- 'opt_dead_code.cpp',
- 'opt_dead_code_local.cpp',
- 'opt_dead_functions.cpp',
- 'opt_discard_simplification.cpp',
- 'opt_function_inlining.cpp',
- 'opt_if_simplification.cpp',
- 'opt_noop_swizzle.cpp',
- 'opt_redundant_jumps.cpp',
- 'opt_structure_splitting.cpp',
- 'opt_swizzle_swizzle.cpp',
- 'opt_tree_grafting.cpp',
- 'ralloc.c',
- 's_expression.cpp',
- 'strtod.c',
-]
-
-if env['msvc']:
- env.Prepend(CPPPATH = ['#/src/getopt'])
- env.PrependUnique(LIBS = [getopt])
-
-if env['crosscompile'] and env['platform'] != 'embedded':
- Import('builtin_glsl_function')
-else:
- # Copy these files to avoid generation object files into src/mesa/program
- env.Prepend(CPPPATH = ['#src/mesa/program'])
- env.Command('hash_table.c', '#src/mesa/program/hash_table.c', Copy('$TARGET', '$SOURCE'))
- env.Command('symbol_table.c', '#src/mesa/program/symbol_table.c', Copy('$TARGET', '$SOURCE'))
-
- main_obj = env.StaticObject('main.cpp')
-
- mesa_objs = env.StaticObject([
- 'hash_table.c',
- 'symbol_table.c',
- ])
-
- builtin_compiler = env.Program(
- target = 'builtin_compiler',
- source = main_obj + glsl_sources + ['builtin_stubs.cpp'] + mesa_objs,
- )
-
- # SCons builtin dependency scanner doesn't detect that glsl_lexer.ll
- # depends on glsl_parser.h
- env.Depends(builtin_compiler, glsl_parser)
-
- builtin_glsl_function = env.CodeGenerate(
- target = 'builtin_function.cpp',
- script = 'builtins/tools/generate_builtins.py',
- source = builtin_compiler,
- command = python_cmd + ' $SCRIPT $SOURCE > $TARGET'
- )
-
- env.Depends(builtin_glsl_function, ['builtins/tools/generate_builtins.py', 'builtins/tools/texture_builtins.py'] + Glob('builtins/ir/*'))
-
- Export('builtin_glsl_function')
-
- if env['hostonly']:
- Return()
-
-
-glsl_sources += builtin_glsl_function
-
-glsl = env.ConvenienceLibrary(
- target = 'glsl',
- source = glsl_sources,
-)
-
-# SCons builtin dependency scanner doesn't detect that glsl_lexer.ll depends on
-# glsl_parser.h
-env.Depends(glsl, glsl_parser)
-
-Export('glsl')
-
-# Skip building these programs as they will cause SCons error "Two environments
-# with different actions were specified for the same target"
-if env['crosscompile'] or env['platform'] == 'embedded':
- Return()
-
-env = env.Clone()
-
-if env['platform'] == 'windows':
- env.PrependUnique(LIBS = [
- 'user32',
- ])
-
-env.Prepend(LIBS = [glsl])
-
-glsl2 = env.Program(
- target = 'glsl2',
- source = main_obj + mesa_objs,
-)
-env.Alias('glsl2', glsl2)
-
-glcpp = env.Program(
- target = 'glcpp/glcpp',
- source = ['glcpp/glcpp.c'] + mesa_objs,
-)
-env.Alias('glcpp', glcpp)
+import common
+
+Import('*')
+
+from sys import executable as python_cmd
+
+env = env.Clone()
+
+env.Prepend(CPPPATH = [
+ '#include',
+ '#src/mapi',
+ '#src/mesa',
+ '#src/glsl',
+ '#src/glsl/glcpp',
+])
+
+# Make glcpp/glcpp-parse.h and glsl_parser.h reacheable from the include path
+env.Append(CPPPATH = [Dir('.').abspath])
+
+env.Append(YACCFLAGS = '-d')
+
+parser_env = env.Clone()
+parser_env.Append(YACCFLAGS = [
+ '--defines=%s' % File('glsl_parser.h').abspath,
+ '-p', '_mesa_glsl_',
+])
+
+glcpp_lexer = env.CFile('glcpp/glcpp-lex.c', 'glcpp/glcpp-lex.l')
+glcpp_parser = env.CFile('glcpp/glcpp-parse.c', 'glcpp/glcpp-parse.y')
+glsl_lexer = parser_env.CXXFile('glsl_lexer.cpp', 'glsl_lexer.ll')
+glsl_parser = parser_env.CXXFile('glsl_parser.cpp', 'glsl_parser.yy')
+
+glsl_sources = [
+ glcpp_lexer,
+ glcpp_parser[0],
+ 'glcpp/pp.c',
+ 'ast_expr.cpp',
+ 'ast_function.cpp',
+ 'ast_to_hir.cpp',
+ 'ast_type.cpp',
+ glsl_lexer,
+ glsl_parser[0],
+ 'glsl_parser_extras.cpp',
+ 'glsl_types.cpp',
+ 'glsl_symbol_table.cpp',
+ 'hir_field_selection.cpp',
+ 'ir_basic_block.cpp',
+ 'ir_clone.cpp',
+ 'ir_constant_expression.cpp',
+ 'ir.cpp',
+ 'ir_expression_flattening.cpp',
+ 'ir_function_can_inline.cpp',
+ 'ir_function.cpp',
+ 'ir_hierarchical_visitor.cpp',
+ 'ir_hv_accept.cpp',
+ 'ir_import_prototypes.cpp',
+ 'ir_print_visitor.cpp',
+ 'ir_reader.cpp',
+ 'ir_rvalue_visitor.cpp',
+ 'ir_set_program_inouts.cpp',
+ 'ir_validate.cpp',
+ 'ir_variable.cpp',
+ 'ir_variable_refcount.cpp',
+ 'linker.cpp',
+ 'link_functions.cpp',
+ 'loop_analysis.cpp',
+ 'loop_controls.cpp',
+ 'loop_unroll.cpp',
+ 'lower_discard.cpp',
+ 'lower_if_to_cond_assign.cpp',
+ 'lower_instructions.cpp',
+ 'lower_jumps.cpp',
+ 'lower_mat_op_to_vec.cpp',
+ 'lower_noise.cpp',
+ 'lower_variable_index_to_cond_assign.cpp',
+ 'lower_vec_index_to_cond_assign.cpp',
+ 'lower_vec_index_to_swizzle.cpp',
+ 'lower_vector.cpp',
+ 'opt_algebraic.cpp',
+ 'opt_constant_folding.cpp',
+ 'opt_constant_propagation.cpp',
+ 'opt_constant_variable.cpp',
+ 'opt_copy_propagation.cpp',
+ 'opt_copy_propagation_elements.cpp',
+ 'opt_dead_code.cpp',
+ 'opt_dead_code_local.cpp',
+ 'opt_dead_functions.cpp',
+ 'opt_discard_simplification.cpp',
+ 'opt_function_inlining.cpp',
+ 'opt_if_simplification.cpp',
+ 'opt_noop_swizzle.cpp',
+ 'opt_redundant_jumps.cpp',
+ 'opt_structure_splitting.cpp',
+ 'opt_swizzle_swizzle.cpp',
+ 'opt_tree_grafting.cpp',
+ 'ralloc.c',
+ 's_expression.cpp',
+ 'strtod.c',
+]
+
+if env['msvc']:
+ env.Prepend(CPPPATH = ['#/src/getopt'])
+ env.PrependUnique(LIBS = [getopt])
+
+if env['crosscompile'] and not env['embedded']:
+ Import('builtin_glsl_function')
+else:
+ # Copy these files to avoid generation object files into src/mesa/program
+ env.Prepend(CPPPATH = ['#src/mesa/program'])
+ env.Command('hash_table.c', '#src/mesa/program/hash_table.c', Copy('$TARGET', '$SOURCE'))
+ env.Command('symbol_table.c', '#src/mesa/program/symbol_table.c', Copy('$TARGET', '$SOURCE'))
+
+ main_obj = env.StaticObject('main.cpp')
+
+ mesa_objs = env.StaticObject([
+ 'hash_table.c',
+ 'symbol_table.c',
+ ])
+
+ builtin_compiler = env.Program(
+ target = 'builtin_compiler',
+ source = main_obj + glsl_sources + ['builtin_stubs.cpp'] + mesa_objs,
+ )
+
+ # SCons builtin dependency scanner doesn't detect that glsl_lexer.ll
+ # depends on glsl_parser.h
+ env.Depends(builtin_compiler, glsl_parser)
+
+ builtin_glsl_function = env.CodeGenerate(
+ target = 'builtin_function.cpp',
+ script = 'builtins/tools/generate_builtins.py',
+ source = builtin_compiler,
+ command = python_cmd + ' $SCRIPT $SOURCE > $TARGET'
+ )
+
+ env.Depends(builtin_glsl_function, ['builtins/tools/generate_builtins.py', 'builtins/tools/texture_builtins.py'] + Glob('builtins/ir/*'))
+
+ Export('builtin_glsl_function')
+
+ if env['hostonly']:
+ Return()
+
+
+glsl_sources += builtin_glsl_function
+
+glsl = env.ConvenienceLibrary(
+ target = 'glsl',
+ source = glsl_sources,
+)
+
+# SCons builtin dependency scanner doesn't detect that glsl_lexer.ll depends on
+# glsl_parser.h
+env.Depends(glsl, glsl_parser)
+
+Export('glsl')
+
+# Skip building these programs as they will cause SCons error "Two environments
+# with different actions were specified for the same target"
+if env['crosscompile'] or env['embedded']:
+ Return()
+
+env = env.Clone()
+
+if env['platform'] == 'windows':
+ env.PrependUnique(LIBS = [
+ 'user32',
+ ])
+
+env.Prepend(LIBS = [glsl])
+
+glsl2 = env.Program(
+ target = 'glsl2',
+ source = main_obj + mesa_objs,
+)
+env.Alias('glsl2', glsl2)
+
+glcpp = env.Program(
+ target = 'glcpp/glcpp',
+ source = ['glcpp/glcpp.c'] + mesa_objs,
+)
+env.Alias('glcpp', glcpp)
diff --git a/mesalib/src/mapi/glapi/SConscript b/mesalib/src/mapi/glapi/SConscript
index d2bc3bafc..a7764745e 100644
--- a/mesalib/src/mapi/glapi/SConscript
+++ b/mesalib/src/mapi/glapi/SConscript
@@ -1,88 +1,81 @@
-#######################################################################
-# SConscript for glapi
-
-
-Import('*')
-
-if env['platform'] != 'winddk':
-
- env = env.Clone()
-
- env.Append(CPPDEFINES = [
- 'MAPI_MODE_UTIL',
- ])
-
- if env['platform'] == 'windows':
- env.Append(CPPDEFINES = [
- '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
- 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
- ])
- if env['gles']:
- env.Append(CPPDEFINES = ['_GLAPI_DLL_EXPORTS'])
- else:
- # prevent _glapi_* from being declared __declspec(dllimport)
- env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
-
- env.Append(CPPPATH = [
- '#/src/mapi',
- '#/src/mesa',
- ])
-
- glapi_sources = [
- 'glapi_dispatch.c',
- 'glapi_entrypoint.c',
- 'glapi_getproc.c',
- 'glapi_nop.c',
- 'glthread.c',
- 'glapi.c',
- ]
-
- mapi_sources = [
- 'u_current.c',
- 'u_execmem.c',
- 'u_thread.c',
- ]
- for s in mapi_sources:
- o = env.SharedObject(s[:-2], '../mapi/' + s)
- glapi_sources.append(o)
-
- #
- # Assembly sources
- #
- if env['gcc'] and env['platform'] != 'windows':
- if env['machine'] == 'x86':
- env.Append(CPPDEFINES = [
- 'USE_X86_ASM',
- 'USE_MMX_ASM',
- 'USE_3DNOW_ASM',
- 'USE_SSE_ASM',
- ])
- glapi_sources += [
- 'glapi_x86.S',
- ]
- elif env['machine'] == 'x86_64':
- env.Append(CPPDEFINES = [
- 'USE_X86_64_ASM',
- ])
- glapi_sources += [
- 'glapi_x86-64.S'
- ]
- elif env['machine'] == 'ppc':
- env.Append(CPPDEFINES = [
- 'USE_PPC_ASM',
- 'USE_VMX_ASM',
- ])
- glapi_sources += [
- ]
- elif env['machine'] == 'sparc':
- glapi_sources += [
- 'glapi_sparc.S'
- ]
- else:
- pass
-
- glapi = env.ConvenienceLibrary(
- target = 'glapi',
- source = glapi_sources,
- )
- Export('glapi')
+#######################################################################
+# SConscript for glapi
+
+
+Import('*')
+
+if env['platform'] != 'winddk':
+
+ env = env.Clone()
+
+ env.Append(CPPDEFINES = [
+ 'MAPI_MODE_UTIL',
+ ])
+
+ if env['platform'] == 'windows':
+ env.Append(CPPDEFINES = [
+ '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
+ 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
+ ])
+ if env['gles']:
+ env.Append(CPPDEFINES = ['_GLAPI_DLL_EXPORTS'])
+ else:
+ # prevent _glapi_* from being declared __declspec(dllimport)
+ env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
+
+ env.Append(CPPPATH = [
+ '#/src/mapi',
+ '#/src/mesa',
+ ])
+
+ glapi_sources = [
+ 'glapi_dispatch.c',
+ 'glapi_entrypoint.c',
+ 'glapi_getproc.c',
+ 'glapi_nop.c',
+ 'glthread.c',
+ 'glapi.c',
+ ]
+
+ mapi_sources = [
+ 'u_current.c',
+ 'u_execmem.c',
+ 'u_thread.c',
+ ]
+ for s in mapi_sources:
+ o = env.SharedObject(s[:-2], '../mapi/' + s)
+ glapi_sources.append(o)
+
+ #
+ # Assembly sources
+ #
+ if env['gcc'] and env['platform'] != 'windows':
+ if env['machine'] == 'x86':
+ env.Append(CPPDEFINES = [
+ 'USE_X86_ASM',
+ ])
+ glapi_sources += [
+ 'glapi_x86.S',
+ ]
+ elif env['machine'] == 'x86_64':
+ env.Append(CPPDEFINES = [
+ 'USE_X86_64_ASM',
+ ])
+ glapi_sources += [
+ 'glapi_x86-64.S'
+ ]
+ elif env['machine'] == 'sparc':
+ env.Append(CPPDEFINES = [
+ 'USE_SPARC_ASM',
+ ])
+ glapi_sources += [
+ 'glapi_sparc.S'
+ ]
+ else:
+ pass
+
+ glapi = env.ConvenienceLibrary(
+ target = 'glapi',
+ source = glapi_sources,
+ )
+ Export('glapi')
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 07853e03c..8cc3fd49a 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -1556,7 +1556,7 @@ check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
GLuint i;
ASSERT(ctx->Driver.RenderTexture);
- if (is_winsys_fbo(fb));
+ if (is_winsys_fbo(fb))
return; /* can't render to texture with winsys framebuffers */
for (i = 0; i < BUFFER_COUNT; i++) {
@@ -1576,7 +1576,7 @@ check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
static void
check_end_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
{
- if (is_winsys_fbo(fb));
+ if (is_winsys_fbo(fb))
return; /* can't render to texture with winsys framebuffers */
if (ctx->Driver.FinishRenderTexture) {
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 0827cb883..40398a8af 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1685,11 +1685,15 @@ texture_error_check( struct gl_context *ctx,
/* additional checks for depth textures */
if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) {
- /* Only 1D, 2D and rectangular textures supported, not 3D or cubes */
+ /* Only 1D, 2D, rect and array textures supported, not 3D or cubes */
if (target != GL_TEXTURE_1D &&
target != GL_PROXY_TEXTURE_1D &&
target != GL_TEXTURE_2D &&
target != GL_PROXY_TEXTURE_2D &&
+ target != GL_TEXTURE_1D_ARRAY &&
+ target != GL_PROXY_TEXTURE_1D_ARRAY &&
+ target != GL_TEXTURE_2D_ARRAY &&
+ target != GL_PROXY_TEXTURE_2D_ARRAY &&
target != GL_TEXTURE_RECTANGLE_ARB &&
target != GL_PROXY_TEXTURE_RECTANGLE_ARB) {
if (!isProxy)
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index fdf12817c..565a3a2d8 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -879,6 +879,8 @@ unbind_texobj_from_fbo(struct gl_context *ctx,
for (j = 0; j < BUFFER_COUNT; j++) {
if (fb->Attachment[j].Type == GL_TEXTURE &&
fb->Attachment[j].Texture == texObj) {
+ /* Vertices are already flushed by _mesa_DeleteTextures */
+ ctx->NewState |= _NEW_BUFFERS;
_mesa_remove_attachment(ctx, fb->Attachment + j);
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 358357125..45e476671 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -1108,7 +1108,7 @@ static struct format_mapping format_map[] = {
* Return first supported format from the given list.
*/
static enum pipe_format
-find_supported_format(struct pipe_screen *screen,
+find_supported_format(struct pipe_screen *screen,
const enum pipe_format formats[],
enum pipe_texture_target target,
unsigned sample_count,
@@ -1188,9 +1188,6 @@ st_choose_renderbuffer_format(struct pipe_screen *screen,
}
-/**
- * Called via ctx->Driver.chooseTextureFormat().
- */
gl_format
st_ChooseTextureFormat_renderable(struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type, GLboolean renderable)
@@ -1206,11 +1203,10 @@ st_ChooseTextureFormat_renderable(struct gl_context *ctx, GLint internalFormat,
* that in advance. Specify potential render target flags now.
*/
bindings = PIPE_BIND_SAMPLER_VIEW;
- if (renderable == GL_TRUE) {
- if (_mesa_is_depth_format(internalFormat) ||
- _mesa_is_depth_or_stencil_format(internalFormat))
+ if (renderable) {
+ if (_mesa_is_depth_or_stencil_format(internalFormat))
bindings |= PIPE_BIND_DEPTH_STENCIL;
- else
+ else
bindings |= PIPE_BIND_RENDER_TARGET;
}
@@ -1231,6 +1227,10 @@ st_ChooseTextureFormat_renderable(struct gl_context *ctx, GLint internalFormat,
return st_pipe_format_to_mesa_format(pFormat);
}
+
+/**
+ * Called via ctx->Driver.ChooseTextureFormat().
+ */
gl_format
st_ChooseTextureFormat(struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type)
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index 22566c9ef..145e4c32c 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -38,7 +38,7 @@ m4_ifndef([XORG_MACROS_VERSION],
XORG_MACROS_VERSION(1.14)
XORG_DEFAULT_OPTIONS
XORG_WITH_DOXYGEN(1.6.1)
-XORG_CHECK_SGML_DOCTOOLS(1.7)
+XORG_CHECK_SGML_DOCTOOLS(1.8)
XORG_ENABLE_DOCS
XORG_ENABLE_DEVEL_DOCS
XORG_WITH_XMLTO(0.0.20)
diff --git a/xorg-server/doc/dtrace/Makefile.am b/xorg-server/doc/dtrace/Makefile.am
index aaf5a1267..df26d2b9e 100644
--- a/xorg-server/doc/dtrace/Makefile.am
+++ b/xorg-server/doc/dtrace/Makefile.am
@@ -1,6 +1,5 @@
if ENABLE_DOCS
-if HAVE_XMLTO
if XSERVER_DTRACE
# Main DocBook/XML files (DOCTYPE book)
@@ -13,5 +12,4 @@ shelfdir = $(docdir)
include $(top_srcdir)/docbook.am
endif XSERVER_DTRACE
-endif HAVE_XMLTO
endif ENABLE_DOCS
diff --git a/xorg-server/docbook.am b/xorg-server/docbook.am
index 7ab7a0050..f1861c0e1 100644
--- a/xorg-server/docbook.am
+++ b/xorg-server/docbook.am
@@ -20,6 +20,7 @@ shelf_DATA =
# DocBook/XML file with chapters, appendix and images it includes
dist_shelf_DATA = $(docbook) $(chapters)
+if HAVE_XMLTO
#
# Generate DocBook/XML output formats with or without stylesheets
#
@@ -72,7 +73,7 @@ if HAVE_STYLESHEETS
if HAVE_XSLTPROC
# DocBook/XML generated document cross-reference database
-sgmldbs_DATA = $(docbook:.xml=.html.db) $(docbook:.xml=.fo.db)
+shelf_DATA += $(docbook:.xml=.html.db) $(docbook:.xml=.fo.db)
# Generate DocBook/XML document cross-reference database
# Flags for the XSL Transformation processor generating xref target databases
@@ -92,5 +93,6 @@ XSLTPROC_FLAGS = \
endif HAVE_XSLTPROC
endif HAVE_STYLESHEETS
+endif HAVE_XMLTO
-CLEANFILES = $(shelf_DATA) $(sgmldbs_DATA)
+CLEANFILES = $(shelf_DATA)
diff --git a/xorg-server/exa/exa_unaccel.c b/xorg-server/exa/exa_unaccel.c
index 078b91c77..df416d5ac 100644
--- a/xorg-server/exa/exa_unaccel.c
+++ b/xorg-server/exa/exa_unaccel.c
@@ -143,7 +143,7 @@ ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
RegionInitBoxes (&reg, pbox, nbox)) {
PixmapPtr pPixmap = exaGetDrawablePixmap(pDst);
- exaGetDrawableDeltas(pSrc, pPixmap, &xoff, &yoff);
+ exaGetDrawableDeltas(pDst, pPixmap, &xoff, &yoff);
RegionTranslate(&reg, xoff, yoff);
pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_DEST, &reg);
RegionUninit(&reg);