diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2016-04-15 13:34:04 -0700 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2016-04-15 13:35:16 -0700 |
commit | d8b85c96d13bee1b6f6276b4a1477b82415f94f7 (patch) | |
tree | 9815e1650731952be6297201b25889ceff6c9d9d | |
parent | 17a181bfa6fc7eb9f7c301ee14388ebee5833588 (diff) | |
parent | 1a100d4f2827cdfed67b563fba7ef2d9ea6a926b (diff) |
Merge remote-tracking branch 'public/master' into vulkan
-rw-r--r-- | configure.ac | 51 | ||||
-rw-r--r-- | m4/ax_cxx_compile_stdcxx.m4 | 558 | ||||
-rw-r--r-- | src/compiler/nir/nir_print.c | 34 | ||||
-rw-r--r-- | src/gallium/auxiliary/target-helpers/sw_helper.h | 15 | ||||
-rw-r--r-- | src/gallium/drivers/swr/Automake.inc | 8 | ||||
-rw-r--r-- | src/gallium/drivers/swr/Makefile.am | 5 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_tiling.c | 8 | ||||
-rw-r--r-- | src/gallium/targets/dri/Makefile.am | 1 | ||||
-rw-r--r-- | src/gallium/targets/pipe-loader/Makefile.am | 19 | ||||
-rw-r--r-- | src/mesa/drivers/x11/fakeglx.c | 79 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xmesaP.h | 1 |
11 files changed, 137 insertions, 642 deletions
diff --git a/configure.ac b/configure.ac index 2aa46dccdb..9226a0d99a 100644 --- a/configure.ac +++ b/configure.ac @@ -1550,27 +1550,24 @@ fi # Vulkan driver configuration # -# Keep this in sync with the --with-vulkan-drivers help string default value -VULKAN_DRIVERS_DEFAULT="intel" - AC_ARG_WITH([vulkan-drivers], [AS_HELP_STRING([--with-vulkan-drivers@<:@=DIRS...@:>@], [comma delimited Vulkan drivers list, e.g. "intel" - @<:@default=intel@:>@])], + @<:@default=no@:>@])], [with_vulkan_drivers="$withval"], - [with_vulkan_drivers="$VULKAN_DRIVERS_DEFAULT"]) + [with_vulkan_drivers="no"]) # Doing '--without-vulkan-drivers' will set this variable to 'no'. Clear it # here so that the script doesn't choke on an unknown driver name later. -case "$with_vulkan_drivers" in - yes) with_vulkan_drivers="$VULKAN_DRIVERS_DEFAULT" ;; - no) with_vulkan_drivers='' ;; +case "x$with_vulkan_drivers" in + xyes) with_vulkan_drivers="$VULKAN_DRIVERS_DEFAULT" ;; + xno) with_vulkan_drivers='' ;; esac AC_ARG_WITH([vulkan-icddir], [AS_HELP_STRING([--with-vulkan-icddir=DIR], - [directory for the Vulkan driver icd files @<:@${libdir}/dri@:>@])], + [directory for the Vulkan driver icd files @<:@${sysconfdir}/vulkan/icd.d@:>@])], [VULKAN_ICD_INSTALL_DIR="$withval"], [VULKAN_ICD_INSTALL_DIR='${sysconfdir}/vulkan/icd.d']) AC_SUBST([VULKAN_ICD_INSTALL_DIR]) @@ -2318,15 +2315,20 @@ if test -n "$with_gallium_drivers"; then fi ;; xswr) - AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory]) swr_llvm_check "swr" - AC_MSG_CHECKING([whether $CXX supports AVX/AVX2]) + AC_MSG_CHECKING([whether $CXX supports c++11/AVX/AVX2]) AVX_CXXFLAGS="-march=core-avx-i" AVX2_CXXFLAGS="-march=core-avx2" AC_LANG_PUSH([C++]) save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="-std=c++11 $CXXFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],[], + [AC_MSG_ERROR([c++11 compiler support not detected])]) + CXXFLAGS="$save_CXXFLAGS" + + save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$AVX_CXXFLAGS $CXXFLAGS" AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],[], [AC_MSG_ERROR([AVX compiler support not detected])]) @@ -2431,6 +2433,9 @@ 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_SWRAST, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes -o \ + "x$HAVE_GALLIUM_LLVMPIPE" = xyes -o \ + "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) @@ -2503,12 +2508,26 @@ AC_SUBST([XA_MINOR], $XA_MINOR) AC_SUBST([XA_TINY], $XA_TINY) AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY") -PKG_CHECK_MODULES(VALGRIND, [valgrind], - [have_valgrind=yes], [have_valgrind=no]) -if test "x$have_valgrind" = "xyes"; then - AC_DEFINE([HAVE_VALGRIND], 1, - [Use valgrind intrinsics to suppress false warnings]) +AC_ARG_ENABLE(valgrind, + [AS_HELP_STRING([--enable-valgrind], + [Build mesa with valgrind support (default: auto)])], + [VALGRIND=$enableval], [VALGRIND=auto]) +if test "x$VALGRIND" != xno; then + PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no]) fi +AC_MSG_CHECKING([whether to enable Valgrind support]) +if test "x$VALGRIND" = xauto; then + VALGRIND="$have_valgrind" +fi + +if test "x$VALGRIND" = "xyes"; then + if ! test "x$have_valgrind" = xyes; then + AC_MSG_ERROR([Valgrind support required but not present]) + fi + AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings]) +fi + +AC_MSG_RESULT([$VALGRIND]) dnl Restore LDFLAGS and CPPFLAGS LDFLAGS="$_SAVE_LDFLAGS" diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 deleted file mode 100644 index 079e17d2a6..0000000000 --- a/m4/ax_cxx_compile_stdcxx.m4 +++ /dev/null @@ -1,558 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the specified -# version of the C++ standard. If necessary, add switches to CXXFLAGS to -# enable support. VERSION may be '11' (for the C++11 standard) or '14' -# (for the C++14 standard). -# -# The second argument, if specified, indicates whether you insist on an -# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -# -std=c++11). If neither is specified, you get whatever works, with -# preference for an extended mode. -# -# The third argument, if specified 'mandatory' or if left unspecified, -# indicates that baseline support for the specified C++ standard is -# required and that the macro should error out if no mode with that -# support is found. If specified 'optional', then configuration proceeds -# regardless, after defining HAVE_CXX${VERSION} if and only if a -# supporting mode is found. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com> -# Copyright (c) 2012 Zack Weinberg <zackw@panix.com> -# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu> -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com> -# Copyright (c) 2015 Paul Norman <penorman@mac.com> -# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu> -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 1 - -dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro -dnl (serial version number 13). - -AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl - m4_if([$1], [11], [], - [$1], [14], [], - [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])], - [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$2], [], [], - [$2], [ext], [], - [$2], [noext], [], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], - [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], - [$3], [optional], [ax_cxx_compile_cxx$1_required=false], - [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) - AC_LANG_PUSH([C++])dnl - ac_success=no - AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, - ax_cv_cxx_compile_cxx$1, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [ax_cv_cxx_compile_cxx$1=yes], - [ax_cv_cxx_compile_cxx$1=no])]) - if test x$ax_cv_cxx_compile_cxx$1 = xyes; then - ac_success=yes - fi - - m4_if([$2], [noext], [], [dnl - if test x$ac_success = xno; then - for switch in -std=gnu++$1 -std=gnu++0x; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXXFLAGS="$ac_save_CXXFLAGS"]) - if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" - ac_success=yes - break - fi - done - fi]) - - m4_if([$2], [ext], [], [dnl - if test x$ac_success = xno; then - dnl HP's aCC needs +std=c++11 according to: - dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf - dnl Cray's crayCC needs "-h std=c++11" - for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXXFLAGS="$ac_save_CXXFLAGS"]) - if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" - ac_success=yes - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx$1_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) - fi - else - if test x$ac_success = xno; then - HAVE_CXX$1=0 - AC_MSG_NOTICE([No compiler with C++$1 support was found]) - else - HAVE_CXX$1=1 - AC_DEFINE(HAVE_CXX$1,1, - [define if the compiler supports basic C++$1 syntax]) - fi - - AC_SUBST(HAVE_CXX$1) - fi -]) - - -dnl Test body for checking C++11 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 -) - - -dnl Test body for checking C++14 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 -) - - -dnl Tests for new features in C++11 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -namespace cxx11 -{ - - namespace test_static_assert - { - - template <typename T> - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual void f() {} - }; - - struct Derived : public Base - { - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check<void> single_type; - typedef check<check<void>> double_type; - typedef check<check<check<void>>> triple_type; - typedef check<check<check<check<void>>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same<T, T> - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same<int, decltype(0)>::value == true, ""); - static_assert(is_same<int, decltype(c)>::value == false, ""); - static_assert(is_same<int, decltype(v)>::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same<int, decltype(ac)>::value == true, ""); - static_assert(is_same<int, decltype(av)>::value == true, ""); - static_assert(is_same<int, decltype(sumi)>::value == true, ""); - static_assert(is_same<int, decltype(sumf)>::value == false, ""); - static_assert(is_same<int, decltype(add(c, v))>::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template <int...> - struct sum; - - template <int N0, int... N1toN> - struct sum<N0, N1toN...> - { - static constexpr auto value = N0 + sum<N1toN...>::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template<typename T> - using member = typename T::member_type; - - template<typename T> - void func(...) {} - - template<typename T> - void func(member<T>*) {} - - void test(); - - void test() { func<foo>(0); } - - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - -]]) - - -dnl Tests for new features in C++14 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ - -// If the compiler admits that it is not ready for C++14, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201402L - -#error "This is not a C++14 compiler" - -#else - -namespace cxx14 -{ - - namespace test_polymorphic_lambdas - { - - int - test() - { - const auto lambda = [](auto&&... args){ - const auto istiny = [](auto x){ - return (sizeof(x) == 1UL) ? 1 : 0; - }; - const int aretiny[] = { istiny(args)... }; - return aretiny[0]; - }; - return lambda(1, 1L, 1.0f, '1'); - } - - } - - namespace test_binary_literals - { - - constexpr auto ivii = 0b0000000000101010; - static_assert(ivii == 42, "wrong value"); - - } - - namespace test_generalized_constexpr - { - - template < typename CharT > - constexpr unsigned long - strlen_c(const CharT *const s) noexcept - { - auto length = 0UL; - for (auto p = s; *p; ++p) - ++length; - return length; - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("x") == 1UL, ""); - static_assert(strlen_c("test") == 4UL, ""); - static_assert(strlen_c("another\0test") == 7UL, ""); - - } - - namespace test_lambda_init_capture - { - - int - test() - { - auto x = 0; - const auto lambda1 = [a = x](int b){ return a + b; }; - const auto lambda2 = [a = lambda1(x)](){ return a; }; - return lambda2(); - } - - } - - namespace test_digit_seperators - { - - constexpr auto ten_million = 100'000'000; - static_assert(ten_million == 100000000, ""); - - } - - namespace test_return_type_deduction - { - - auto f(int& x) { return x; } - decltype(auto) g(int& x) { return x; } - - template < typename T1, typename T2 > - struct is_same - { - static constexpr auto value = false; - }; - - template < typename T > - struct is_same<T, T> - { - static constexpr auto value = true; - }; - - int - test() - { - auto x = 0; - static_assert(is_same<int, decltype(f(x))>::value, ""); - static_assert(is_same<int&, decltype(g(x))>::value, ""); - return x; - } - - } - -} // namespace cxx14 - -#endif // __cplusplus >= 201402L - -]]) diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 84e926905b..229539d44e 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -315,6 +315,30 @@ print_constant(nir_constant *c, const struct glsl_type *type, print_state *state } } +static const char * +get_variable_mode_str(nir_variable_mode mode) +{ + switch (mode) { + case nir_var_shader_in: + return "shader_in"; + case nir_var_shader_out: + return "shader_out"; + case nir_var_uniform: + return "uniform"; + case nir_var_shader_storage: + return "shader_storage"; + case nir_var_system_value: + return "system"; + case nir_var_shared: + return "shared"; + case nir_var_param: + case nir_var_global: + case nir_var_local: + default: + return ""; + } +} + static void print_var_decl(nir_variable *var, print_state *state) { @@ -326,13 +350,9 @@ print_var_decl(nir_variable *var, print_state *state) const char *const samp = (var->data.sample) ? "sample " : ""; const char *const patch = (var->data.patch) ? "patch " : ""; const char *const inv = (var->data.invariant) ? "invariant " : ""; - const char *const mode[] = { "shader_in ", "shader_out ", "", "", - "uniform ", "shader_storage ", "shared ", - "system "}; - - fprintf(fp, "%s%s%s%s%s%s ", - cent, samp, patch, inv, mode[var->data.mode], - glsl_interp_qualifier_name(var->data.interpolation)); + fprintf(fp, "%s%s%s%s%s %s ", + cent, samp, patch, inv, get_variable_mode_str(var->data.mode), + glsl_interp_qualifier_name(var->data.interpolation)); glsl_print_type(var->type, fp); diff --git a/src/gallium/auxiliary/target-helpers/sw_helper.h b/src/gallium/auxiliary/target-helpers/sw_helper.h index ae5f3de92b..5e4e9f78af 100644 --- a/src/gallium/auxiliary/target-helpers/sw_helper.h +++ b/src/gallium/auxiliary/target-helpers/sw_helper.h @@ -9,7 +9,7 @@ /* Helper function to choose and instantiate one of the software rasterizers: - * llvmpipe, softpipe. + * llvmpipe, softpipe, swr. */ #ifdef GALLIUM_SOFTPIPE @@ -20,6 +20,10 @@ #include "llvmpipe/lp_public.h" #endif +#ifdef GALLIUM_SWR +#include "swr/swr_public.h" +#endif + #ifdef GALLIUM_VIRGL #include "virgl/virgl_public.h" #include "virgl/vtest/virgl_vtest_public.h" @@ -44,10 +48,15 @@ sw_screen_create_named(struct sw_winsys *winsys, const char *driver) #endif #if defined(GALLIUM_SOFTPIPE) - if (screen == NULL) + if (screen == NULL && strcmp(driver, "softpipe") == 0) screen = softpipe_create_screen(winsys); #endif +#if defined(GALLIUM_SWR) + if (screen == NULL && strcmp(driver, "swr") == 0) + screen = swr_create_screen(winsys); +#endif + return screen; } @@ -62,6 +71,8 @@ sw_screen_create(struct sw_winsys *winsys) default_driver = "llvmpipe"; #elif defined(GALLIUM_SOFTPIPE) default_driver = "softpipe"; +#elif defined(GALLIUM_SWR) + default_driver = "swr"; #else default_driver = ""; #endif diff --git a/src/gallium/drivers/swr/Automake.inc b/src/gallium/drivers/swr/Automake.inc new file mode 100644 index 0000000000..a51921455a --- /dev/null +++ b/src/gallium/drivers/swr/Automake.inc @@ -0,0 +1,8 @@ +if HAVE_GALLIUM_SWR + +TARGET_DRIVERS += swrast +TARGET_CPPFLAGS += -DGALLIUM_SWR +TARGET_LIB_DEPS += \ + $(top_builddir)/src/gallium/drivers/swr/libmesaswr.la + +endif diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am index d6d6e7dc61..b1ff4233b5 100644 --- a/src/gallium/drivers/swr/Makefile.am +++ b/src/gallium/drivers/swr/Makefile.am @@ -22,7 +22,7 @@ include Makefile.sources include $(top_srcdir)/src/gallium/Automake.inc -AM_CXXFLAGS = $(GALLIUM_DRIVER_CFLAGS) +AM_CXXFLAGS = $(GALLIUM_DRIVER_CFLAGS) -std=c++11 noinst_LTLIBRARIES = libmesaswr.la @@ -30,7 +30,8 @@ libmesaswr_la_SOURCES = $(LOADER_SOURCES) COMMON_CXXFLAGS = \ $(GALLIUM_DRIVER_CFLAGS) \ - $(LLVM_CFLAGS) \ + $(LLVM_CXXFLAGS) \ + -std=c++11 \ -I$(builddir)/rasterizer/scripts \ -I$(builddir)/rasterizer/jitter \ -I$(srcdir)/rasterizer \ diff --git a/src/gallium/drivers/vc4/vc4_tiling.c b/src/gallium/drivers/vc4/vc4_tiling.c index cf86eb0fa3..2a803ab62b 100644 --- a/src/gallium/drivers/vc4/vc4_tiling.c +++ b/src/gallium/drivers/vc4/vc4_tiling.c @@ -140,8 +140,8 @@ vc4_load_lt_image(void *dst, uint32_t dst_stride, { uint32_t utile_w = vc4_utile_width(cpp); uint32_t utile_h = vc4_utile_height(cpp); - uint32_t xstart = box->x / utile_w; - uint32_t ystart = box->y / utile_h; + uint32_t xstart = box->x; + uint32_t ystart = box->y; for (uint32_t y = 0; y < box->height; y += utile_h) { for (int x = 0; x < box->width; x += utile_w) { @@ -161,8 +161,8 @@ vc4_store_lt_image(void *dst, uint32_t dst_stride, { uint32_t utile_w = vc4_utile_width(cpp); uint32_t utile_h = vc4_utile_height(cpp); - uint32_t xstart = box->x / utile_w; - uint32_t ystart = box->y / utile_h; + uint32_t xstart = box->x; + uint32_t ystart = box->y; for (uint32_t y = 0; y < box->height; y += utile_h) { for (int x = 0; x < box->width; x += utile_w) { diff --git a/src/gallium/targets/dri/Makefile.am b/src/gallium/targets/dri/Makefile.am index 2666524fbf..f42dd25a56 100644 --- a/src/gallium/targets/dri/Makefile.am +++ b/src/gallium/targets/dri/Makefile.am @@ -86,6 +86,7 @@ include $(top_srcdir)/src/gallium/drivers/virgl/Automake.inc include $(top_srcdir)/src/gallium/drivers/softpipe/Automake.inc include $(top_srcdir)/src/gallium/drivers/llvmpipe/Automake.inc +include $(top_srcdir)/src/gallium/drivers/swr/Automake.inc if HAVE_GALLIUM_STATIC_TARGETS diff --git a/src/gallium/targets/pipe-loader/Makefile.am b/src/gallium/targets/pipe-loader/Makefile.am index 0b516de0b5..18b403f733 100644 --- a/src/gallium/targets/pipe-loader/Makefile.am +++ b/src/gallium/targets/pipe-loader/Makefile.am @@ -192,16 +192,18 @@ pipe_vmwgfx_la_LIBADD = \ endif -if HAVE_GALLIUM_SOFTPIPE -AM_CPPFLAGS += -DGALLIUM_SOFTPIPE - +if HAVE_GALLIUM_SWRAST pipe_LTLIBRARIES += pipe_swrast.la pipe_swrast_la_SOURCES = pipe_swrast.c nodist_EXTRA_pipe_swrast_la_SOURCES = dummy.cpp +pipe_swrast_la_LIBADD = $(PIPE_LIBS) -pipe_swrast_la_LIBADD = \ - $(PIPE_LIBS) \ +if HAVE_GALLIUM_SOFTPIPE +AM_CPPFLAGS += -DGALLIUM_SOFTPIPE + +pipe_swrast_la_LIBADD += \ $(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la +endif if HAVE_GALLIUM_LLVMPIPE AM_CPPFLAGS += -DGALLIUM_LLVMPIPE @@ -210,6 +212,13 @@ pipe_swrast_la_LIBADD += \ $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la endif +if HAVE_GALLIUM_SWR +AM_CPPFLAGS += -DGALLIUM_SWR + +pipe_swrast_la_LIBADD += \ + $(top_builddir)/src/gallium/drivers/swr/libmesaswr.la +endif + pipe_swrast_la_LIBADD += \ $(GALLIUM_PIPE_LOADER_WINSYS_LIBS) diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 2f4d966973..394800f02e 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -256,7 +256,6 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, GLboolean ximageFlag = GL_TRUE; XMesaVisual xmvis; GLint i; - GLboolean comparePointers; if (dbFlag) { /* Check if the MESA_BACK_BUFFER env var is set */ @@ -279,12 +278,6 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, return NULL; } - /* Comparing IDs uses less memory but sometimes fails. */ - /* XXX revisit this after 3.0 is finished. */ - if (getenv("MESA_GLX_VISUAL_HACK")) - comparePointers = GL_TRUE; - else - comparePointers = GL_FALSE; /* Force the visual to have an alpha channel */ if (getenv("MESA_GLX_FORCE_ALPHA")) @@ -306,9 +299,8 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, && (v->mesa_visual.accumGreenBits >= accumGreenSize || accumGreenSize == 0) && (v->mesa_visual.accumBlueBits >= accumBlueSize || accumBlueSize == 0) && (v->mesa_visual.accumAlphaBits >= accumAlphaSize || accumAlphaSize == 0)) { - /* now either compare XVisualInfo pointers or visual IDs */ - if ((!comparePointers && v->visinfo->visualid == vinfo->visualid) - || (comparePointers && v->vishandle == vinfo)) { + /* now compare visual IDs */ + if (v->visinfo->visualid == vinfo->visualid) { return v; } } @@ -323,10 +315,6 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, accumBlueSize, accumAlphaSize, 0, level, GLX_NONE_EXT ); if (xmvis) { - /* Save a copy of the pointer now so we can find this visual again - * if we need to search for it in find_glx_visual(). - */ - xmvis->vishandle = vinfo; /* Allocate more space for additional visual */ VisualTable = realloc(VisualTable, sizeof(XMesaVisual) * (NumVisuals + 1)); /* add xmvis to the list */ @@ -442,13 +430,6 @@ find_glx_visual( Display *dpy, XVisualInfo *vinfo ) } } - /* if that fails, try to match pointers */ - for (i=0;i<NumVisuals;i++) { - if (VisualTable[i]->display==dpy && VisualTable[i]->vishandle==vinfo) { - return VisualTable[i]; - } - } - return NULL; } @@ -745,27 +726,39 @@ choose_x_overlay_visual( Display *dpy, int scr, vislist = XGetVisualInfo( dpy, VisualIDMask | VisualScreenMask, &vistemplate, &count ); + if (!vislist) { + /* no matches */ + continue; + } + if (count!=1) { /* something went wrong */ + free(vislist); continue; } if (preferred_class!=DONT_CARE && preferred_class!=vislist->CLASS) { /* wrong visual class */ + free(vislist); continue; } /* Color-index rendering is not supported. Make sure we have True/DirectColor */ - if (vislist->CLASS != TrueColor && vislist->CLASS != DirectColor) + if (vislist->CLASS != TrueColor && vislist->CLASS != DirectColor) { + free(vislist); continue; + } - if (deepvis==NULL || vislist->depth > deepest) { - /* YES! found a satisfactory visual */ - free(deepvis); - deepest = vislist->depth; - deepvis = vislist; - /* DEBUG tt = ov->transparent_type;*/ - /* DEBUG tv = ov->value; */ + if (deepvis!=NULL && vislist->depth <= deepest) { + free(vislist); + continue; } + + /* YES! found a satisfactory visual */ + free(deepvis); + deepest = vislist->depth; + deepvis = vislist; + /* DEBUG tt = ov->transparent_type;*/ + /* DEBUG tv = ov->value; */ } /*DEBUG @@ -1225,6 +1218,7 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig ) stereo_flag, depth_size, stencil_size, accumRedSize, accumGreenSize, accumBlueSize, accumAlphaSize, level, numAux ); + free(vis); } return xmvis; @@ -1241,16 +1235,11 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) xmvis = choose_visual(dpy, screen, list, GL_FALSE); if (xmvis) { -#if 0 - return xmvis->vishandle; -#else - /* create a new vishandle - the cached one may be stale */ - xmvis->vishandle = malloc(sizeof(XVisualInfo)); - if (xmvis->vishandle) { - memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo)); + XVisualInfo* visinfo = malloc(sizeof(XVisualInfo)); + if (visinfo) { + memcpy(visinfo, xmvis->visinfo, sizeof(XVisualInfo)); } - return xmvis->vishandle; -#endif + return visinfo; } else return NULL; @@ -1931,6 +1920,7 @@ Fake_glXGetFBConfigs( Display *dpy, int screen, int *nelements ) for (i = 0; i < *nelements; i++) { results[i] = create_glx_visual(dpy, visuals + i); } + free(visuals); return (GLXFBConfig *) results; } return NULL; @@ -1974,16 +1964,11 @@ Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config ) { if (dpy && config) { XMesaVisual xmvis = (XMesaVisual) config; -#if 0 - return xmvis->vishandle; -#else - /* create a new vishandle - the cached one may be stale */ - xmvis->vishandle = malloc(sizeof(XVisualInfo)); - if (xmvis->vishandle) { - memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo)); + XVisualInfo* visinfo = malloc(sizeof(XVisualInfo)); + if (visinfo) { + memcpy(visinfo, xmvis->visinfo, sizeof(XVisualInfo)); } - return xmvis->vishandle; -#endif + return visinfo; } else { return NULL; diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index d7a934e8df..6cd020f2ed 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -78,7 +78,6 @@ struct xmesa_visual { int screen, visualID; int visualType; XMesaVisualInfo visinfo; /* X's visual info (pointer to private copy) */ - XVisualInfo *vishandle; /* Only used in fakeglx.c */ GLint BitsPerPixel; /* True bits per pixel for XImages */ GLboolean ximage_flag; /* Use XImage for back buffer (not pixmap)? */ |