[Mesa-dev] [PATCH 4/4] OpenSWR build changes
Tim Rowley
timothy.o.rowley at intel.com
Thu Feb 18 01:53:45 UTC 2016
---
configure.ac | 18 ++++
scons/custom.py | 2 +-
scons/llvm.py | 8 +-
src/gallium/Makefile.am | 6 ++
src/gallium/SConscript | 3 +
src/gallium/drivers/swr/.clang-format | 64 ++++++++++++++
src/gallium/drivers/swr/Automake.inc | 30 +++++++
src/gallium/drivers/swr/Makefile.am | 37 ++++++++
src/gallium/drivers/swr/Makefile.sources | 23 +++++
src/gallium/drivers/swr/Makefile.sources-arch | 111 ++++++++++++++++++++++++
src/gallium/drivers/swr/SConscript | 31 +++++++
src/gallium/drivers/swr/SConscript-arch | 117 ++++++++++++++++++++++++++
src/gallium/drivers/swr/avx/Makefile.am | 112 ++++++++++++++++++++++++
src/gallium/drivers/swr/avx2/Makefile.am | 112 ++++++++++++++++++++++++
src/gallium/targets/libgl-gdi/SConscript | 8 +-
src/gallium/targets/libgl-xlib/Makefile.am | 5 ++
src/gallium/targets/libgl-xlib/SConscript | 4 +
src/gallium/targets/osmesa/Makefile.am | 6 ++
src/gallium/targets/osmesa/SConscript | 4 +
19 files changed, 696 insertions(+), 5 deletions(-)
create mode 100644 src/gallium/drivers/swr/.clang-format
create mode 100644 src/gallium/drivers/swr/Automake.inc
create mode 100644 src/gallium/drivers/swr/Makefile.am
create mode 100644 src/gallium/drivers/swr/Makefile.sources
create mode 100644 src/gallium/drivers/swr/Makefile.sources-arch
create mode 100644 src/gallium/drivers/swr/SConscript
create mode 100644 src/gallium/drivers/swr/SConscript-arch
create mode 100644 src/gallium/drivers/swr/avx/Makefile.am
create mode 100644 src/gallium/drivers/swr/avx2/Makefile.am
diff --git a/configure.ac b/configure.ac
index 57330cb..1c8aaaa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2191,6 +2191,16 @@ radeon_llvm_check() {
fi
}
+swr_llvm_check() {
+ gallium_require_llvm $1
+ if test ${LLVM_VERSION_INT} -lt 306; then
+ AC_MSG_ERROR([LLVM version 3.6 or later required when building $1])
+ fi
+ if test "x$enable_gallium_llvm" != "xyes"; then
+ AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
+ fi
+}
+
dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
if test -n "$with_gallium_drivers"; then
gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
@@ -2263,6 +2273,10 @@ if test -n "$with_gallium_drivers"; then
HAVE_GALLIUM_LLVMPIPE=yes
fi
;;
+ xswr)
+ swr_llvm_check "swr"
+ HAVE_GALLIUM_SWR=yes
+ ;;
xvc4)
HAVE_GALLIUM_VC4=yes
gallium_require_drm "vc4"
@@ -2352,6 +2366,7 @@ AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes)
+AM_CONDITIONAL(HAVE_GALLIUM_SWR, test "x$HAVE_GALLIUM_SWR" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_VC4, test "x$HAVE_GALLIUM_VC4" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_VIRGL, test "x$HAVE_GALLIUM_VIRGL" = xyes)
@@ -2461,6 +2476,9 @@ AC_CONFIG_FILES([Makefile
src/gallium/drivers/rbug/Makefile
src/gallium/drivers/softpipe/Makefile
src/gallium/drivers/svga/Makefile
+ src/gallium/drivers/swr/Makefile
+ src/gallium/drivers/swr/avx/Makefile
+ src/gallium/drivers/swr/avx2/Makefile
src/gallium/drivers/trace/Makefile
src/gallium/drivers/vc4/Makefile
src/gallium/drivers/virgl/Makefile
diff --git a/scons/custom.py b/scons/custom.py
index 043793b..a5a3410 100644
--- a/scons/custom.py
+++ b/scons/custom.py
@@ -132,7 +132,7 @@ def code_generate(env, script, target, source, command):
script_src = env.File(script).srcnode()
# This command creates generated code *in the build directory*.
- command = command.replace('$SCRIPT', script_src.path)
+ command = command.replace('$SCRIPT', script_src.rstr())
action = SCons.Action.Action(command, "$CODEGENCOMSTR")
code = env.Command(target, source, action)
diff --git a/scons/llvm.py b/scons/llvm.py
index 1fc8a3f..30742ff 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -98,6 +98,7 @@ def generate(env):
print 'scons: LLVM version %s found, but %s is required' % (llvm_version, required_llvm_version)
return
+ env['llvm_includedir'] = os.path.join(llvm_dir, 'include')
env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
env.AppendUnique(CPPDEFINES = [
'__STDC_LIMIT_MACROS',
@@ -128,7 +129,8 @@ def generate(env):
'LLVMX86Info', 'LLVMX86AsmPrinter', 'LLVMX86Utils',
'LLVMMCJIT', 'LLVMTarget', 'LLVMExecutionEngine',
'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser',
- 'LLVMBitReader', 'LLVMMC', 'LLVMCore', 'LLVMSupport'
+ 'LLVMBitReader', 'LLVMMC', 'LLVMCore', 'LLVMSupport',
+ 'LLVMIRReader', 'LLVMAsmParser', 'LLVMX86AsmParser'
])
elif llvm_version >= distutils.version.LooseVersion('3.5'):
env.Prepend(LIBS = [
@@ -198,12 +200,14 @@ def generate(env):
pass
env.MergeFlags(cppflags)
+ env['llvm_includedir'] = env.backtick('llvm-config --includedir').rstrip()
+
# Match llvm --fno-rtti flag
cxxflags = env.backtick('llvm-config --cxxflags').split()
if '-fno-rtti' in cxxflags:
env.Append(CXXFLAGS = ['-fno-rtti'])
- components = ['engine', 'mcjit', 'bitwriter', 'x86asmprinter', 'mcdisassembler']
+ components = ['engine', 'mcjit', 'bitwriter', 'x86asmprinter', 'mcdisassembler', 'irreader']
env.ParseConfig('llvm-config --libs ' + ' '.join(components))
env.ParseConfig('llvm-config --ldflags')
diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am
index e42a8f1..086e170 100644
--- a/src/gallium/Makefile.am
+++ b/src/gallium/Makefile.am
@@ -78,6 +78,12 @@ SUBDIRS += drivers/llvmpipe
endif
endif
+if HAVE_GALLIUM_SWR
+SUBDIRS += drivers/swr
+SUBDIRS += drivers/swr/avx
+SUBDIRS += drivers/swr/avx2
+endif
+
## vc4/rpi
if HAVE_GALLIUM_VC4
SUBDIRS += drivers/vc4 winsys/vc4/drm
diff --git a/src/gallium/SConscript b/src/gallium/SConscript
index 0c3a374..17a51e7 100644
--- a/src/gallium/SConscript
+++ b/src/gallium/SConscript
@@ -20,6 +20,9 @@ SConscript([
'drivers/trace/SConscript',
])
+if env['platform'] != 'windows':
+ SConscript('drivers/swr/SConscript')
+
#
# Winsys
#
diff --git a/src/gallium/drivers/swr/.clang-format b/src/gallium/drivers/swr/.clang-format
new file mode 100644
index 0000000..0ec65a5
--- /dev/null
+++ b/src/gallium/drivers/swr/.clang-format
@@ -0,0 +1,64 @@
+---
+Language: Cpp
+AccessModifierOffset: -3
+AlignAfterOpenBracket: true
+AlignEscapedNewlinesLeft: false
+AlignOperands: false
+AlignTrailingComments: false
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AlwaysBreakAfterDefinitionReturnType: true
+AlwaysBreakTemplateDeclarations: false
+AlwaysBreakBeforeMultilineStrings: false
+BreakBeforeBinaryOperators: NonAssignment
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: true
+BinPackParameters: false
+BinPackArguments: false
+ColumnLimit: 78
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 3
+DerivePointerAlignment: false
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: false
+IndentWrappedFunctionNames: false
+IndentFunctionDeclarationAfterType: false
+MaxEmptyLinesToKeep: 2
+KeepEmptyLinesAtTheStartOfBlocks: true
+NamespaceIndentation: Inner
+ObjCBlockIndentWidth: 3
+ObjCSpaceAfterProperty: true
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakString: 1000
+PenaltyBreakFirstLessLess: 120
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 0
+PointerAlignment: Right
+SpacesBeforeTrailingComments: 1
+Cpp11BracedListStyle: true
+Standard: Cpp11
+IndentWidth: 3
+TabWidth: 8
+UseTab: Never
+BreakBeforeBraces: Linux
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+SpacesInAngles: false
+SpaceInEmptyParentheses: false
+SpacesInCStyleCastParentheses: false
+SpaceAfterCStyleCast: false
+SpacesInContainerLiterals: true
+SpaceBeforeAssignmentOperators: true
+ContinuationIndentWidth: 3
+CommentPragmas: '^ IWYU pragma:'
+ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+SpaceBeforeParens: ControlStatements
+DisableFormat: false
+...
+
diff --git a/src/gallium/drivers/swr/Automake.inc b/src/gallium/drivers/swr/Automake.inc
new file mode 100644
index 0000000..1eff818
--- /dev/null
+++ b/src/gallium/drivers/swr/Automake.inc
@@ -0,0 +1,30 @@
+# Copyright (C) 2015 Intel Corporation. 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_GALLIUM_SWR
+
+TARGET_CPPFLAGS += -DGALLIUM_SWR
+TARGET_LIB_DEPS += \
+ $(top_builddir)/src/gallium/drivers/swr/libmesaswr.la
+ $(top_builddir)/src/gallium/drivers/swr/avx/libswrAVX.la
+ $(top_builddir)/src/gallium/drivers/swr/avx2/libswrAVX2.la
+
+endif
diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am
new file mode 100644
index 0000000..f3a4321
--- /dev/null
+++ b/src/gallium/drivers/swr/Makefile.am
@@ -0,0 +1,37 @@
+# Copyright (C) 2015 Intel Corporation. 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.
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+include Makefile.sources
+include $(top_srcdir)/src/gallium/Automake.inc
+
+AM_CXXFLAGS = \
+ $(GALLIUM_DRIVER_CFLAGS) \
+ -std=c++11 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
+
+noinst_LTLIBRARIES = libmesaswr.la
+
+libmesaswr_la_SOURCES = $(CXX_SOURCES)
+
+libmesaswr_la_LDFLAGS =
+
+EXTRA_DIST = SConscript SConscript-arch Makefile.sources-arch
diff --git a/src/gallium/drivers/swr/Makefile.sources b/src/gallium/drivers/swr/Makefile.sources
new file mode 100644
index 0000000..4317a85
--- /dev/null
+++ b/src/gallium/drivers/swr/Makefile.sources
@@ -0,0 +1,23 @@
+# Copyright (C) 2015 Intel Corporation. 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.
+
+CXX_SOURCES := \
+ swr_loader.cpp
diff --git a/src/gallium/drivers/swr/Makefile.sources-arch b/src/gallium/drivers/swr/Makefile.sources-arch
new file mode 100644
index 0000000..7ed0faf
--- /dev/null
+++ b/src/gallium/drivers/swr/Makefile.sources-arch
@@ -0,0 +1,111 @@
+# Copyright (C) 2015 Intel Corporation. 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.
+
+CXX_SOURCES := \
+ swr_clear.cpp \
+ swr_context.cpp \
+ swr_context.h \
+ swr_context_llvm.h \
+ swr_draw.cpp \
+ swr_public.h \
+ swr_resource.h \
+ swr_screen.cpp \
+ swr_screen.h \
+ swr_state.cpp \
+ swr_state.h \
+ swr_tex_sample.cpp \
+ swr_tex_sample.h \
+ swr_scratch.h \
+ swr_scratch.cpp \
+ swr_shader.cpp \
+ swr_memory.h \
+ swr_fence.h \
+ swr_fence.cpp \
+ swr_query.h \
+ swr_query.cpp
+
+COMMON_CXX_SOURCES := \
+ rasterizer/common/containers.hpp \
+ rasterizer/common/formats.cpp \
+ rasterizer/common/formats.h \
+ rasterizer/common/isa.hpp \
+ rasterizer/common/os.h \
+ rasterizer/common/rdtsc_buckets.cpp \
+ rasterizer/common/rdtsc_buckets.h \
+ rasterizer/common/rdtsc_buckets_shared.h \
+ rasterizer/common/rdtsc_buckets_shared.h \
+ rasterizer/common/simdintrin.h \
+ rasterizer/common/swr_assert.cpp \
+ rasterizer/common/swr_assert.h
+
+CORE_CXX_SOURCES := \
+ rasterizer/core/api.cpp \
+ rasterizer/core/api.h \
+ rasterizer/core/arena.cpp \
+ rasterizer/core/arena.h \
+ rasterizer/core/backend.cpp \
+ rasterizer/core/backend.h \
+ rasterizer/core/blend.h \
+ rasterizer/core/clip.cpp \
+ rasterizer/core/clip.h \
+ rasterizer/core/context.h \
+ rasterizer/core/depthstencil.h \
+ rasterizer/core/fifo.hpp \
+ rasterizer/core/format_traits.h \
+ rasterizer/core/format_types.h \
+ rasterizer/core/frontend.cpp \
+ rasterizer/core/frontend.h \
+ rasterizer/core/knobs.h \
+ rasterizer/core/knobs_init.h \
+ rasterizer/core/multisample.cpp \
+ rasterizer/core/multisample.h \
+ rasterizer/core/pa_avx.cpp \
+ rasterizer/core/pa.h \
+ rasterizer/core/rasterizer.cpp \
+ rasterizer/core/rasterizer.h \
+ rasterizer/core/rdtsc_core.cpp \
+ rasterizer/core/rdtsc_core.h \
+ rasterizer/core/state.h \
+ rasterizer/core/threads.cpp \
+ rasterizer/core/threads.h \
+ rasterizer/core/tilemgr.cpp \
+ rasterizer/core/tilemgr.h \
+ rasterizer/core/utils.cpp \
+ rasterizer/core/utils.h
+
+JITTER_CXX_SOURCES := \
+ rasterizer/jitter/blend_jit.cpp \
+ rasterizer/jitter/blend_jit.h \
+ rasterizer/jitter/builder.cpp \
+ rasterizer/jitter/builder.h \
+ rasterizer/jitter/builder_misc.cpp \
+ rasterizer/jitter/builder_misc.h \
+ rasterizer/jitter/fetch_jit.cpp \
+ rasterizer/jitter/fetch_jit.h \
+ rasterizer/jitter/JitManager.cpp \
+ rasterizer/jitter/JitManager.h \
+ rasterizer/jitter/streamout_jit.cpp \
+ rasterizer/jitter/streamout_jit.h
+
+MEMORY_CXX_SOURCES := \
+ rasterizer/memory/ClearTile.cpp \
+ rasterizer/memory/LoadTile.cpp \
+ rasterizer/memory/StoreTile.cpp
diff --git a/src/gallium/drivers/swr/SConscript b/src/gallium/drivers/swr/SConscript
new file mode 100644
index 0000000..b688054
--- /dev/null
+++ b/src/gallium/drivers/swr/SConscript
@@ -0,0 +1,31 @@
+from sys import executable as python_cmd
+import distutils.version
+import os.path
+
+Import('*')
+
+if not env['llvm']:
+ print 'warning: LLVM disabled: not building swr'
+ Return()
+
+swr_arch = 'avx'
+SConscript('SConscript-arch', variant_dir='avx', duplicate=0, exports='swr_arch')
+swr_arch = 'avx2'
+SConscript('SConscript-arch', variant_dir='avx2', duplicate=0, exports='swr_arch')
+
+env = env.Clone()
+
+env.MSVC2013Compat()
+
+source = env.ParseSourceList('Makefile.sources', [
+ 'CXX_SOURCES'
+])
+
+swr = env.ConvenienceLibrary(
+ target = 'swr',
+ source = source,
+ )
+
+env.Alias('swr', swr)
+
+Export('swr')
diff --git a/src/gallium/drivers/swr/SConscript-arch b/src/gallium/drivers/swr/SConscript-arch
new file mode 100644
index 0000000..b20a1f8
--- /dev/null
+++ b/src/gallium/drivers/swr/SConscript-arch
@@ -0,0 +1,117 @@
+from sys import executable as python_cmd
+import distutils.version
+import os.path
+
+Import('*')
+
+if not env['llvm']:
+ print 'warning: LLVM disabled: not building swr'
+ Return()
+
+env = env.Clone()
+
+env.MSVC2013Compat()
+
+env.Append(CPPDEFINES = [
+ '__STDC_CONSTANT_MACROS',
+ '__STDC_LIMIT_MACROS',
+ ])
+
+if not env['msvc'] :
+ env.Append(CCFLAGS = [
+ '-std=c++11',
+ ])
+
+env.Prepend(CPPPATH = [
+ 'rasterizer',
+ 'rasterizer/core',
+ 'rasterizer/jitter',
+ 'rasterizer/scripts',
+ 'rasterizer/jitter',
+ ])
+
+env.CodeGenerate(
+ target = 'rasterizer/scripts/gen_knobs.cpp',
+ script = 'rasterizer/scripts/gen_knobs.py',
+ source = [],
+ command = python_cmd + ' $SCRIPT ' + Dir('rasterizer/scripts').abspath
+)
+
+env.CodeGenerate(
+ target = 'rasterizer/scripts/gen_knobs.h',
+ script = 'rasterizer/scripts/gen_knobs.py',
+ source = [],
+ command = python_cmd + ' $SCRIPT ' + Dir('rasterizer/scripts').abspath
+)
+
+env.CodeGenerate(
+ target = 'rasterizer/jitter/state_llvm.h',
+ script = 'rasterizer/jitter/scripts/gen_llvm_types.py',
+ source = 'rasterizer/core/state.h',
+ command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET'
+)
+
+env.CodeGenerate(
+ target = 'rasterizer/jitter/builder_gen.h',
+ script = 'rasterizer/jitter/scripts/gen_llvm_ir_macros.py',
+ source = os.path.join(env['llvm_includedir'], 'llvm/IR/IRBuilder.h'),
+ command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET --gen_h'
+)
+
+env.CodeGenerate(
+ target = 'rasterizer/jitter/builder_gen.cpp',
+ script = 'rasterizer/jitter/scripts/gen_llvm_ir_macros.py',
+ source = os.path.join(env['llvm_includedir'], 'llvm/IR/IRBuilder.h'),
+ command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET --gen_cpp'
+)
+
+env.CodeGenerate(
+ target = 'rasterizer/jitter/builder_x86.h',
+ script = 'rasterizer/jitter/scripts/gen_llvm_ir_macros.py',
+ source = '',
+ command = python_cmd + ' $SCRIPT --output $TARGET --gen_x86_h'
+)
+
+env.CodeGenerate(
+ target = 'rasterizer/jitter/builder_x86.cpp',
+ script = 'rasterizer/jitter/scripts/gen_llvm_ir_macros.py',
+ source = '',
+ command = python_cmd + ' $SCRIPT --output $TARGET --gen_x86_cpp'
+)
+
+source = [
+ 'rasterizer/scripts/gen_knobs.cpp', 'rasterizer/scripts/gen_knobs.h',
+ 'rasterizer/jitter/builder_gen.cpp', 'rasterizer/jitter/builder_gen.h',
+ 'rasterizer/jitter/builder_x86.cpp', 'rasterizer/jitter/builder_x86.h',
+ ]
+
+source += env.ParseSourceList('../Makefile.sources-arch', [
+ 'CXX_SOURCES',
+ 'COMMON_CXX_SOURCES',
+ 'CORE_CXX_SOURCES',
+ 'JITTER_CXX_SOURCES',
+ 'MEMORY_CXX_SOURCES'
+])
+
+# remove headers, as scons thinks they are static objects for the .so
+source = [x for x in source if not x.endswith(tuple(['.h','.hpp']))]
+
+env.Prepend(LIBS = [ mesautil, mesa, gallium ])
+
+Import('swr_arch')
+
+if swr_arch == 'avx':
+ env.Append(CPPDEFINES = ['KNOB_ARCH=KNOB_ARCH_AVX'])
+ env.Append(CCFLAGS = ['-march=core-avx-i'])
+ swrAVX = env.SharedLibrary(target = 'swrAVX', source = source)
+ env.Alias('swrAVX', swrAVX)
+ Export('swrAVX')
+elif swr_arch == 'avx2':
+ env.Append(CPPDEFINES = ['KNOB_ARCH=KNOB_ARCH_AVX2'])
+ env.Append(CCFLAGS = ['-march=core-avx2'])
+ swrAVX2 = env.SharedLibrary(target = 'swrAVX2', source = source)
+ env.Alias('swrAVX2', swrAVX2)
+ Export('swrAVX2')
+else:
+ print "unknown swr architecture"
+ exit(1)
diff --git a/src/gallium/drivers/swr/avx/Makefile.am b/src/gallium/drivers/swr/avx/Makefile.am
new file mode 100644
index 0000000..c09fb5a
--- /dev/null
+++ b/src/gallium/drivers/swr/avx/Makefile.am
@@ -0,0 +1,112 @@
+# Copyright (C) 2015 Intel Corporation. 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.
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+include ../Makefile.sources-arch
+include $(top_srcdir)/src/gallium/Automake.inc
+
+VPATH = $(srcdir) $(srcdir)/..
+
+AM_CXXFLAGS = \
+ $(GALLIUM_DRIVER_CFLAGS) \
+ -std=c++11 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS \
+ -march=core-avx-i -DKNOB_ARCH=KNOB_ARCH_AVX \
+ $(LLVM_CFLAGS)
+
+lib_LTLIBRARIES = libswrAVX.la
+
+libswrAVX_la_SOURCES = $(CXX_SOURCES)
+
+libswrAVX_la_LDFLAGS =
+
+BUILT_SOURCES = \
+ rasterizer/scripts/gen_knobs.cpp \
+ rasterizer/scripts/gen_knobs.h \
+ rasterizer/jitter/state_llvm.h \
+ rasterizer/jitter/builder_gen.h \
+ rasterizer/jitter/builder_gen.cpp \
+ rasterizer/jitter/builder_x86.h \
+ rasterizer/jitter/builder_x86.cpp
+
+rasterizer/scripts/gen_knobs.cpp rasterizer/scripts/gen_knobs.h: rasterizer/scripts/gen_knobs.py rasterizer/scripts/knob_defs.py rasterizer/scripts/templates/knobs.template
+ $(PYTHON2) $(PYTHON_FLAGS) \
+ $(srcdir)/../rasterizer/scripts/gen_knobs.py \
+ rasterizer/scripts
+
+rasterizer/jitter/state_llvm.h: rasterizer/jitter/scripts/gen_llvm_types.py rasterizer/core/state.h
+ $(PYTHON2) $(PYTHON_FLAGS) \
+ $(srcdir)/../rasterizer/jitter/scripts/gen_llvm_types.py \
+ --input $(srcdir)/../rasterizer/core/state.h \
+ --output rasterizer/jitter/state_llvm.h
+
+rasterizer/jitter/builder_gen.h: rasterizer/jitter/scripts/gen_llvm_ir_macros.py $(LLVM_INCLUDEDIR)/llvm/IR/IRBuilder.h
+ $(PYTHON2) $(PYTHON_FLAGS) \
+ $(srcdir)/../rasterizer/jitter/scripts/gen_llvm_ir_macros.py \
+ --input $(LLVM_INCLUDEDIR)/llvm/IR/IRBuilder.h \
+ --output rasterizer/jitter/builder_gen.h \
+ --gen_h
+
+rasterizer/jitter/builder_gen.cpp: rasterizer/jitter/scripts/gen_llvm_ir_macros.py $(LLVM_INCLUDEDIR)/llvm/IR/IRBuilder.h
+ $(PYTHON2) $(PYTHON_FLAGS) \
+ $(srcdir)/../rasterizer/jitter/scripts/gen_llvm_ir_macros.py \
+ --input $(LLVM_INCLUDEDIR)/llvm/IR/IRBuilder.h \
+ --output rasterizer/jitter/builder_gen.cpp \
+ --gen_cpp
+
+rasterizer/jitter/builder_x86.h: rasterizer/jitter/scripts/gen_llvm_ir_macros.py
+ $(PYTHON2) $(PYTHON_FLAGS) \
+ $(srcdir)/../rasterizer/jitter/scripts/gen_llvm_ir_macros.py \
+ --output rasterizer/jitter/builder_x86.h \
+ --gen_x86_h
+
+rasterizer/jitter/builder_x86.cpp: rasterizer/jitter/scripts/gen_llvm_ir_macros.py
+ $(PYTHON2) $(PYTHON_FLAGS) \
+ $(srcdir)/../rasterizer/jitter/scripts/gen_llvm_ir_macros.py \
+ --output rasterizer/jitter/builder_x86.cpp \
+ --gen_x86_cpp
+
+libswrAVX_la_SOURCES += \
+ $(COMMON_CXX_SOURCES) \
+ $(CORE_CXX_SOURCES) \
+ $(JITTER_CXX_SOURCES) \
+ $(MEMORY_CXX_SOURCES) \
+ rasterizer/scripts/gen_knobs.cpp \
+ rasterizer/scripts/gen_knobs.h \
+ rasterizer/jitter/builder_gen.cpp \
+ rasterizer/jitter/builder_gen.h \
+ rasterizer/jitter/builder_x86.cpp \
+ rasterizer/jitter/builder_x86.h
+
+AM_CXXFLAGS += \
+ -I$(srcdir)/../rasterizer \
+ -I$(srcdir)/../rasterizer/core \
+ -I$(srcdir)/../rasterizer/jitter \
+ -I$(builddir)/rasterizer/scripts \
+ -I$(builddir)/rasterizer/jitter
+
+libswrAVX_la_LIBADD = \
+ $(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ $(top_builddir)/src/mesa/libmesagallium.la
+
+include $(top_srcdir)/install-gallium-links.mk
+
+EXTRA_DIST = SConscript
diff --git a/src/gallium/drivers/swr/avx2/Makefile.am b/src/gallium/drivers/swr/avx2/Makefile.am
new file mode 100644
index 0000000..3a63395
--- /dev/null
+++ b/src/gallium/drivers/swr/avx2/Makefile.am
@@ -0,0 +1,112 @@
+# Copyright (C) 2015 Intel Corporation. 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.
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+include ../Makefile.sources-arch
+include $(top_srcdir)/src/gallium/Automake.inc
+
+VPATH = $(srcdir) $(srcdir)/..
+
+AM_CXXFLAGS = \
+ $(GALLIUM_DRIVER_CFLAGS) \
+ -std=c++11 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS \
+ -march=core-avx2 -DKNOB_ARCH=KNOB_ARCH_AVX2 \
+ $(LLVM_CFLAGS)
+
+lib_LTLIBRARIES = libswrAVX2.la
+
+libswrAVX2_la_SOURCES = $(CXX_SOURCES)
+
+libswrAVX2_la_LDFLAGS =
+
+BUILT_SOURCES = \
+ rasterizer/scripts/gen_knobs.cpp \
+ rasterizer/scripts/gen_knobs.h \
+ rasterizer/jitter/state_llvm.h \
+ rasterizer/jitter/builder_gen.h \
+ rasterizer/jitter/builder_gen.cpp \
+ rasterizer/jitter/builder_x86.h \
+ rasterizer/jitter/builder_x86.cpp
+
+rasterizer/scripts/gen_knobs.cpp rasterizer/scripts/gen_knobs.h: rasterizer/scripts/gen_knobs.py rasterizer/scripts/knob_defs.py rasterizer/scripts/templates/knobs.template
+ $(PYTHON2) $(PYTHON_FLAGS) \
+ $(srcdir)/../rasterizer/scripts/gen_knobs.py \
+ rasterizer/scripts
+
+rasterizer/jitter/state_llvm.h: rasterizer/jitter/scripts/gen_llvm_types.py rasterizer/core/state.h
+ $(PYTHON2) $(PYTHON_FLAGS) \
+ $(srcdir)/../rasterizer/jitter/scripts/gen_llvm_types.py \
+ --input $(srcdir)/../rasterizer/core/state.h \
+ --output rasterizer/jitter/state_llvm.h
+
+rasterizer/jitter/builder_gen.h: rasterizer/jitter/scripts/gen_llvm_ir_macros.py $(LLVM_INCLUDEDIR)/llvm/IR/IRBuilder.h
+ $(PYTHON2) $(PYTHON_FLAGS) \
+ $(srcdir)/../rasterizer/jitter/scripts/gen_llvm_ir_macros.py \
+ --input $(LLVM_INCLUDEDIR)/llvm/IR/IRBuilder.h \
+ --output rasterizer/jitter/builder_gen.h \
+ --gen_h
+
+rasterizer/jitter/builder_gen.cpp: rasterizer/jitter/scripts/gen_llvm_ir_macros.py $(LLVM_INCLUDEDIR)/llvm/IR/IRBuilder.h
+ $(PYTHON2) $(PYTHON_FLAGS) \
+ $(srcdir)/../rasterizer/jitter/scripts/gen_llvm_ir_macros.py \
+ --input $(LLVM_INCLUDEDIR)/llvm/IR/IRBuilder.h \
+ --output rasterizer/jitter/builder_gen.cpp \
+ --gen_cpp
+
+rasterizer/jitter/builder_x86.h: rasterizer/jitter/scripts/gen_llvm_ir_macros.py
+ $(PYTHON2) $(PYTHON_FLAGS) \
+ $(srcdir)/../rasterizer/jitter/scripts/gen_llvm_ir_macros.py \
+ --output rasterizer/jitter/builder_x86.h \
+ --gen_x86_h
+
+rasterizer/jitter/builder_x86.cpp: rasterizer/jitter/scripts/gen_llvm_ir_macros.py
+ $(PYTHON2) $(PYTHON_FLAGS) \
+ $(srcdir)/../rasterizer/jitter/scripts/gen_llvm_ir_macros.py \
+ --output rasterizer/jitter/builder_x86.cpp \
+ --gen_x86_cpp
+
+libswrAVX2_la_SOURCES += \
+ $(COMMON_CXX_SOURCES) \
+ $(CORE_CXX_SOURCES) \
+ $(JITTER_CXX_SOURCES) \
+ $(MEMORY_CXX_SOURCES) \
+ rasterizer/scripts/gen_knobs.cpp \
+ rasterizer/scripts/gen_knobs.h \
+ rasterizer/jitter/builder_gen.cpp \
+ rasterizer/jitter/builder_gen.h \
+ rasterizer/jitter/builder_x86.cpp \
+ rasterizer/jitter/builder_x86.h
+
+AM_CXXFLAGS += \
+ -I$(srcdir)/../rasterizer \
+ -I$(srcdir)/../rasterizer/core \
+ -I$(srcdir)/../rasterizer/jitter \
+ -I$(builddir)/rasterizer/scripts \
+ -I$(builddir)/rasterizer/jitter
+
+libswrAVX2_la_LIBADD = \
+ $(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ $(top_builddir)/src/mesa/libmesagallium.la
+
+include $(top_srcdir)/install-gallium-links.mk
+
+EXTRA_DIST = SConscript
diff --git a/src/gallium/targets/libgl-gdi/SConscript b/src/gallium/targets/libgl-gdi/SConscript
index 3a63e3e..39ee91b 100644
--- a/src/gallium/targets/libgl-gdi/SConscript
+++ b/src/gallium/targets/libgl-gdi/SConscript
@@ -27,8 +27,12 @@ if True:
drivers += [softpipe]
if env['llvm']:
- env.Append(CPPDEFINES = 'HAVE_LLVMPIPE')
- drivers += [llvmpipe]
+ if 'swr' in COMMAND_LINE_TARGETS :
+ env.Append(CPPDEFINES = 'HAVE_SWR')
+ drivers += [swr]
+ else:
+ env.Append(CPPDEFINES = 'HAVE_LLVMPIPE')
+ drivers += [llvmpipe]
if env['gcc'] and env['machine'] != 'x86_64':
# DEF parser in certain versions of MinGW is busted, as does not behave as
diff --git a/src/gallium/targets/libgl-xlib/Makefile.am b/src/gallium/targets/libgl-xlib/Makefile.am
index d99caae..527d01b 100644
--- a/src/gallium/targets/libgl-xlib/Makefile.am
+++ b/src/gallium/targets/libgl-xlib/Makefile.am
@@ -84,4 +84,9 @@ endif
EXTRA_lib at GL_LIB@_la_DEPENDENCIES = libgl-xlib.sym
EXTRA_DIST = SConscript libgl-xlib.sym
+if HAVE_GALLIUM_SWR
+lib at GL_LIB@_la_LIBADD += $(top_builddir)/src/gallium/drivers/swr/libmesaswr.la $(LLVM_LIBS)
+AM_CPPFLAGS += -DGALLIUM_SWR
+endif
+
include $(top_srcdir)/install-gallium-links.mk
diff --git a/src/gallium/targets/libgl-xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript
index e1c78dd..73c2413 100644
--- a/src/gallium/targets/libgl-xlib/SConscript
+++ b/src/gallium/targets/libgl-xlib/SConscript
@@ -47,6 +47,10 @@ if env['llvm']:
env.Append(CPPDEFINES = ['GALLIUM_LLVMPIPE'])
env.Prepend(LIBS = [llvmpipe])
+if env['llvm']:
+ env.Append(CPPDEFINES = ['GALLIUM_SWR'])
+ env.Prepend(LIBS = [swr])
+
if env['platform'] != 'darwin':
env.Append(SHLINKFLAGS = [
# Disallow undefined symbols
diff --git a/src/gallium/targets/osmesa/Makefile.am b/src/gallium/targets/osmesa/Makefile.am
index 38e515f..5d39486 100644
--- a/src/gallium/targets/osmesa/Makefile.am
+++ b/src/gallium/targets/osmesa/Makefile.am
@@ -74,6 +74,12 @@ lib at OSMESA_LIB@_la_LDFLAGS += $(LLVM_LDFLAGS)
lib at OSMESA_LIB@_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
endif
+if HAVE_GALLIUM_SWR
+AM_CPPFLAGS += -DGALLIUM_SWR
+lib at OSMESA_LIB@_la_LDFLAGS += $(LLVM_LDFLAGS)
+lib at OSMESA_LIB@_la_LIBADD += $(top_builddir)/src/gallium/drivers/swr/libmesaswr.la $(LLVM_LIBS)
+endif
+
EXTRA_lib at OSMESA_LIB@_la_DEPENDENCIES = osmesa.sym
EXTRA_DIST = \
osmesa.sym \
diff --git a/src/gallium/targets/osmesa/SConscript b/src/gallium/targets/osmesa/SConscript
index eeaacbc..fb9c879 100644
--- a/src/gallium/targets/osmesa/SConscript
+++ b/src/gallium/targets/osmesa/SConscript
@@ -29,6 +29,10 @@ if env['llvm']:
env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
env.Prepend(LIBS = [llvmpipe])
+if env['llvm']:
+ env.Append(CPPDEFINES = ['GALLIUM_SWR'])
+ env.Prepend(LIBS = [swr])
+
if env['platform'] == 'windows':
if env['gcc'] and env['machine'] != 'x86_64':
sources += ['osmesa.mingw.def']
--
1.9.1
More information about the mesa-dev
mailing list