Mesa (master): anv/state: if enabled, use anisotropic filtering also with VK_FILTER_NEAREST

2016-11-24 Thread Iago Toral Quiroga
Module: Mesa
Branch: master
Commit: b3fca516170e00fb937080a8b2ee47d137482898
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3fca516170e00fb937080a8b2ee47d137482898

Author: Iago Toral Quiroga 
Date:   Thu Nov 24 11:21:20 2016 +0100

anv/state: if enabled, use anisotropic filtering also with VK_FILTER_NEAREST

Fixes multiple Vulkan CTS tests that combine anisotropy and VK_FILTER_NEAREST
in dEQP-VK.texture.filtering_anisotropy.*

Reviewed-by: Lionel Landwerlin 
Reviewed-by: Jason Ekstrand 

---

 src/intel/vulkan/genX_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c
index 4122395..0f621f9 100644
--- a/src/intel/vulkan/genX_state.c
+++ b/src/intel/vulkan/genX_state.c
@@ -101,7 +101,7 @@ vk_to_gen_tex_filter(VkFilter filter, bool anisotropyEnable)
default:
   assert(!"Invalid filter");
case VK_FILTER_NEAREST:
-  return MAPFILTER_NEAREST;
+  return anisotropyEnable ? MAPFILTER_ANISOTROPIC : MAPFILTER_NEAREST;
case VK_FILTER_LINEAR:
   return anisotropyEnable ? MAPFILTER_ANISOTROPIC : MAPFILTER_LINEAR;
}

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): clover: Restore support for LLVM <= 3.9.

2016-11-24 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 95ddb37708ca16ccbd0f607d17a82be2de0d07b6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=95ddb37708ca16ccbd0f607d17a82be2de0d07b6

Author: Vedran Miletić 
Date:   Tue Nov 22 20:25:34 2016 +0100

clover: Restore support for LLVM <= 3.9.

The commit 8e430ff8b060b4e8e922bae24b3c57837da6ea77 broke support for
LLVM 3.9 and older versions in Clover. This patch restores it and
refactors the support using Clover compatibility layer for LLVM.

v2: merged #ifdef blocks
v3: added support for LLVM 3.6-3.8
v4: add missing #ifdef around 
v5: simplify using templates and lambda

Signed-off-by: Vedran Miletić 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98740
Tested-by[v4]: Pierre Moreau 
Tested-by: Vinson Lee 
Reviewed-by: Francisco Jerez 
Reviewed-by: Jan Vesely 

---

 .../state_trackers/clover/llvm/codegen/bitcode.cpp |  9 +++--
 src/gallium/state_trackers/clover/llvm/compat.hpp  | 18 ++
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp 
b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
index 5dcc4f8..d09207b 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
@@ -32,6 +32,7 @@
 ///
 
 #include "llvm/codegen.hpp"
+#include "llvm/compat.hpp"
 #include "llvm/metadata.hpp"
 #include "core/error.hpp"
 #include "util/algorithm.hpp"
@@ -99,13 +100,9 @@ clover::llvm::parse_module_library(const module , 
::llvm::LLVMContext ,
auto mod = ::llvm::parseBitcodeFile(::llvm::MemoryBufferRef(
 as_string(m.secs[0].data), " "), ctx);
 
-   if (::llvm::Error err = mod.takeError()) {
-  std::string msg;
-  ::llvm::handleAllErrors(std::move(err), [&](::llvm::ErrorInfoBase ) {
- msg = EIB.message();
- fail(r_log, error(CL_INVALID_PROGRAM), msg.c_str());
+   compat::handle_module_error(mod, [&](const std::string ) {
+ fail(r_log, error(CL_INVALID_PROGRAM), s);
   });
-   }
 
return std::unique_ptr<::llvm::Module>(std::move(*mod));
 }
diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp 
b/src/gallium/state_trackers/clover/llvm/compat.hpp
index a963cff..81592ce 100644
--- a/src/gallium/state_trackers/clover/llvm/compat.hpp
+++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
@@ -39,6 +39,11 @@
 #include 
 #include 
 #include 
+#if HAVE_LLVM >= 0x0400
+#include 
+#else
+#include 
+#endif
 
 #if HAVE_LLVM >= 0x0307
 #include 
@@ -158,6 +163,19 @@ namespace clover {
 #else
  const auto default_reloc_model = ::llvm::Reloc::Default;
 #endif
+
+ template void
+ handle_module_error(M , const F ) {
+#if HAVE_LLVM >= 0x0400
+if (::llvm::Error err = mod.takeError())
+   ::llvm::handleAllErrors(std::move(err), 
[&](::llvm::ErrorInfoBase ) {
+ f(eib.message());
+  });
+#else
+if (!mod)
+   f(mod.getError().message());
+#endif
+ }
   }
}
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): scons: Recognize LLVM_CONFIG environment variable.

2016-11-24 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: f07da5aa5e2e6021f02104235429b670f6b468ec
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f07da5aa5e2e6021f02104235429b670f6b468ec

Author: Vinson Lee 
Date:   Tue Nov 22 17:01:35 2016 -0800

scons: Recognize LLVM_CONFIG environment variable.

Signed-off-by: Vinson Lee 
Reviewed-by: Emil Velikov 
Reviewed-by: Jose Fonseca 

---

 common.py  |  2 +-
 scons/llvm.py  | 17 +
 src/gallium/drivers/swr/SConscript |  3 ++-
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/common.py b/common.py
index 704ad2e..24a7e8a 100644
--- a/common.py
+++ b/common.py
@@ -59,7 +59,7 @@ if target_platform == 'windows' and host_platform != 
'windows':
 
 
 # find default_llvm value
-if 'LLVM' in os.environ:
+if 'LLVM' in os.environ or 'LLVM_CONFIG' in os.environ:
 default_llvm = 'yes'
 else:
 default_llvm = 'no'
diff --git a/scons/llvm.py b/scons/llvm.py
index 977e47a..2d0f05b 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -194,11 +194,12 @@ def generate(env):
 # that.
 env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT'])
 else:
-if not env.Detect('llvm-config'):
-print 'scons: llvm-config script not found'
+llvm_config = os.environ.get('LLVM_CONFIG', 'llvm-config')
+if not env.Detect(llvm_config):
+print 'scons: %s script not found' % llvm_config
 return
 
-llvm_version = env.backtick('llvm-config --version').rstrip()
+llvm_version = env.backtick('%s --version' % llvm_config).rstrip()
 llvm_version = distutils.version.LooseVersion(llvm_version)
 
 if llvm_version < 
distutils.version.LooseVersion(required_llvm_version):
@@ -208,7 +209,7 @@ def generate(env):
 try:
 # Treat --cppflags specially to prevent NDEBUG from disabling
 # assertion failures in debug builds.
-cppflags = env.ParseFlags('!llvm-config --cppflags')
+cppflags = env.ParseFlags('!%s --cppflags' % llvm_config)
 try:
 cppflags['CPPDEFINES'].remove('NDEBUG')
 except ValueError:
@@ -216,16 +217,16 @@ def generate(env):
 env.MergeFlags(cppflags)
 
 # Match llvm --fno-rtti flag
-cxxflags = env.backtick('llvm-config --cxxflags').split()
+cxxflags = env.backtick('%s --cxxflags' % llvm_config).split()
 if '-fno-rtti' in cxxflags:
 env.Append(CXXFLAGS = ['-fno-rtti'])
 
 components = ['engine', 'mcjit', 'bitwriter', 'x86asmprinter', 
'mcdisassembler', 'irreader']
 
-env.ParseConfig('llvm-config --libs ' + ' '.join(components))
-env.ParseConfig('llvm-config --ldflags')
+env.ParseConfig('%s --libs ' % llvm_config + ' '.join(components))
+env.ParseConfig('%s --ldflags' % llvm_config)
 if llvm_version >= distutils.version.LooseVersion('3.5'):
-env.ParseConfig('llvm-config --system-libs')
+env.ParseConfig('%s --system-libs' % llvm_config)
 env.Append(CXXFLAGS = ['-std=c++11'])
 except OSError:
 print 'scons: llvm-config version %s failed' % llvm_version
diff --git a/src/gallium/drivers/swr/SConscript 
b/src/gallium/drivers/swr/SConscript
index 0de51a7..3f0517b 100644
--- a/src/gallium/drivers/swr/SConscript
+++ b/src/gallium/drivers/swr/SConscript
@@ -31,7 +31,8 @@ if env['platform'] == 'windows':
 # on windows there is no llvm-config, so LLVM is defined
 llvm_includedir = os.path.join(os.environ['LLVM'], 'include')
 else:
-llvm_includedir = env.backtick('llvm-config --includedir').rstrip()
+llvm_config = os.environ.get('LLVM_CONFIG', 'llvm-config')
+llvm_includedir = env.backtick('%s --includedir' % llvm_config).rstrip()
 print "llvm include dir %s" % llvm_includedir
 
 # the loader is included in the mesa lib itself

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): radv: Don't generate radv_timestamp.h

2016-11-24 Thread Bas Nieuwenhuizen
Module: Mesa
Branch: master
Commit: a794f0901719eb2689cbbabd5724fa89a2cfecd2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a794f0901719eb2689cbbabd5724fa89a2cfecd2

Author: Bas Nieuwenhuizen 
Date:   Tue Nov 22 21:28:28 2016 +0100

radv: Don't generate radv_timestamp.h

Not needed anymore.

Signed-off-by: Bas Nieuwenhuizen 
Reviewed-by: Dave Airlie 
Reviewed-by: Emil Velikov 

---

 src/amd/vulkan/Makefile.am  | 6 --
 src/amd/vulkan/Makefile.sources | 3 +--
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am
index c559a95..6e184c0 100644
--- a/src/amd/vulkan/Makefile.am
+++ b/src/amd/vulkan/Makefile.am
@@ -119,12 +119,6 @@ radv_entrypoints.c : radv_entrypoints_gen.py 
$(vulkan_include_HEADERS)
$(AM_V_GEN) cat $(vulkan_include_HEADERS) |\
$(PYTHON2) $(srcdir)/radv_entrypoints_gen.py code > $@
 
-.PHONY: radv_timestamp.h
-
-radv_timestamp.h:
-   @echo "Updating radv_timestamp.h"
-   $(AM_V_GEN) echo "#define RADV_TIMESTAMP \"$(TIMESTAMP_CMD)\"" > $@
-
 vk_format_table.c: vk_format_table.py \
   vk_format_parse.py \
vk_format_layout.csv
diff --git a/src/amd/vulkan/Makefile.sources b/src/amd/vulkan/Makefile.sources
index d163b98..425a00f 100644
--- a/src/amd/vulkan/Makefile.sources
+++ b/src/amd/vulkan/Makefile.sources
@@ -72,6 +72,5 @@ VULKAN_WSI_X11_FILES := \
 
 VULKAN_GENERATED_FILES := \
radv_entrypoints.c \
-   radv_entrypoints.h \
-   radv_timestamp.h
+   radv_entrypoints.h
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): 49 new commits

2016-11-24 Thread Emil Velikov
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f7b58a378ca94cf1c2637d640ce5b9fb8f8519a6
Author: Eduardo Lima Mitev 
Date:   Fri Oct 28 14:34:39 2016 +0200

vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfacePresentModesKHR

x11_surface_get_present_modes() is currently asserting that the number of
elements in pPresentModeCount must be greater than or equal to the number
of present modes available. This is buggy because pPresentModeCount
elements are later copied from the internal modes' array, so if
pPresentModeCount is greater, it will overflow it.

On top of that, this assertion violates the spec. From the Vulkan 1.0
(revision 32, with KHR extensions), page 581 of the PDF:

"If the value of pPresentModeCount is less than the number of
 presentation modes supported, at most pPresentModeCount values will be
 written. If pPresentModeCount is smaller than the number of
 presentation modes supported for the given surface, VK_INCOMPLETE
 will be returned instead of VK_SUCCESS to indicate that not all the
 available values were returned."

So, the correct behavior is: if pPresentModeCount is greater than the
internal number of formats, it is clamped to that many present modes. But
if it is lesser than that, then pPresentModeCount elements are copied,
and the call returns VK_INCOMPLETE.

This fix is similar (but simpler and more readable) than the one I provided
in 750d8cad72a for vkGetPhysicalDeviceSurfaceFormatsKHR, which was suffering
from the same problem.

Reviewed-by: Eric Engestrom 
(cherry picked from commit b677b99db5c48ffd1eeef538b962080ac5fd65d9)
Nominated-by: Emil Velikov 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=28c6c8d09e6bb468bfc53a57e12e579411c30941
Author: Eduardo Lima Mitev 
Date:   Tue Oct 25 10:20:12 2016 +0200

vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfaceFormatsKHR

x11_surface_get_formats() is currently asserting that the number of
elements in pSurfaceFormats must be greater than or equal to the number
of formats available. This is buggy because pSurfaceFormatsCount
elements are later copied from the internal formats' array, so if
pSurfaceFormatCount is greater, it will overflow it.

On top of that, this assertion violates the spec. From the Vulkan 1.0
(revision 32, with KHR extensions), page 579 of the PDF:

"If pSurfaceFormats is NULL, then the number of format pairs supported
 for the given surface is returned in pSurfaceFormatCount. Otherwise,
 pSurfaceFormatCount must point to a variable set by the user to the
 number of elements in the pSurfaceFormats array, and on return the
 variable is overwritten with the number of structures actually written
 to pSurfaceFormats. If the value of pSurfaceFormatCount is less than
 the number of format pairs supported, at most pSurfaceFormatCount
 structures will be written. If pSurfaceFormatCount is smaller than
 the number of format pairs supported for the given surface,
 VK_INCOMPLETE will be returned instead of VK_SUCCESS to indicate that
 not all the available values were returned."

So, the correct behavior is: if pSurfaceFormatCount is greater than the
internal number of formats, it is clamped to that many formats. But
if it is lesser than that, then pSurfaceFormatCount elements are copied,
and the call returns VK_INCOMPLETE.

Reviewed-by: Dave Airlie 
(cherry picked from commit 750d8cad72a532d977df10ffbbdd1902bd06f50b)
Nominated-by: Emil Velikov 

Squashed with commit:

vulkan/wsi/x11: Smplify implementation of 
vkGetPhysicalDeviceSurfaceFormatsKHR

This patch simplifies x11_surface_get_formats(). It is actually just a
readability improvement over the patch I provided earlier this week
(750d8cad72).

Reviewed-by: Eric Engestrom 
(cherry picked from commit 129da274261b6e79f459e24428591f137bf92ed1)

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9eea4ba5abe59f40bc89e681586e4d3b1fbda4c8
Author: Iago Toral Quiroga 
Date:   Mon Nov 14 12:36:57 2016 +0100

anv/format: handle unsupported formats properly

According to the spec for vkGetPhysicalDeviceImageFormatProperties:

"If format is not a supported image format, or if the combination of format,
 type, tiling, usage, and flags is not supported for images, then
 vkGetPhysicalDeviceImageFormatProperties returns 
VK_ERROR_FORMAT_NOT_SUPPORTED."

Makes the following Vulkan CTS tests report 'Not Supported' instead of 
crashing:


Mesa (master): radv: fix texel fetch offset with 2d arrays.

2016-11-24 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: bb8ac183404541ca8dee31563709d5aca8de0e73
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb8ac183404541ca8dee31563709d5aca8de0e73

Author: Dave Airlie 
Date:   Thu Nov 24 03:10:52 2016 +

radv: fix texel fetch offset with 2d arrays.

The code didn't limit the offsets to the number supplied, so
if we expected 3 but only got 2 we were accessing undefined memory.

This fixes random failures in:
dEQP-VK.glsl.texture_functions.texelfetchoffset.sampler2darray_*

Reviewed-by: Bas Nieuwenhuizen 
Cc: "13.0" 
Signed-off-by: Dave Airlie 

---

 src/amd/common/ac_nir_to_llvm.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 06645be..76d6d88 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3601,12 +3601,13 @@ static void visit_tex(struct nir_to_llvm_context *ctx, 
nir_tex_instr *instr)
if (offsets && instr->op == nir_texop_txf) {
nir_const_value *const_offset =
nir_src_as_const_value(instr->src[const_src].src);
-
+   int num_offsets = instr->src[const_src].src.ssa->num_components;
assert(const_offset);
-   if (instr->coord_components > 2)
+   num_offsets = MIN2(num_offsets, instr->coord_components);
+   if (num_offsets > 2)
address[2] = LLVMBuildAdd(ctx->builder,
  address[2], 
LLVMConstInt(ctx->i32, const_offset->i32[2], false), "");
-   if (instr->coord_components > 1)
+   if (num_offsets > 1)
address[1] = LLVMBuildAdd(ctx->builder,
  address[1], 
LLVMConstInt(ctx->i32, const_offset->i32[1], false), "");
address[0] = LLVMBuildAdd(ctx->builder,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit