[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

mesa: Changes to 'upstream-unstable'



 VERSION                                                |    2 
 docs/relnotes/13.0.2.html                              |    3 
 docs/relnotes/13.0.3.html                              |  176 ++++++++++++++
 src/amd/common/ac_nir_to_llvm.c                        |    2 
 src/amd/vulkan/radv_device.c                           |    3 
 src/amd/vulkan/radv_meta_bufimage.c                    |   27 ++
 src/compiler/Makefile.glsl.am                          |    5 
 src/compiler/glsl/builtin_functions.cpp                |   12 
 src/compiler/glsl/link_uniforms.cpp                    |    2 
 src/compiler/glsl/linker.cpp                           |    1 
 src/compiler/nir/nir_opt_undef.c                       |    4 
 src/compiler/spirv/vtn_glsl450.c                       |   23 +
 src/egl/main/eglapi.c                                  |    4 
 src/gallium/auxiliary/cso_cache/cso_cache.c            |    4 
 src/gallium/auxiliary/tgsi/tgsi_info.c                 |    1 
 src/gallium/drivers/radeon/r600_pipe_common.c          |    6 
 src/gallium/drivers/radeonsi/si_compute.c              |    1 
 src/gallium/drivers/radeonsi/si_descriptors.c          |   19 -
 src/gallium/drivers/radeonsi/si_pipe.c                 |    5 
 src/gallium/drivers/radeonsi/si_shader.c               |  183 ++++++++++----
 src/gallium/drivers/radeonsi/si_shader.h               |    2 
 src/gallium/drivers/radeonsi/si_state.c                |   25 +
 src/gallium/drivers/radeonsi/si_state_draw.c           |   24 +
 src/gallium/drivers/radeonsi/si_state_shaders.c        |    7 
 src/gallium/drivers/vc4/vc4_program.c                  |   27 +-
 src/intel/genxml/gen9.xml                              |    2 
 src/intel/vulkan/anv_allocator.c                       |   27 +-
 src/intel/vulkan/anv_descriptor_set.c                  |    1 
 src/intel/vulkan/anv_device.c                          |   52 ++--
 src/intel/vulkan/anv_gem.c                             |    6 
 src/intel/vulkan/anv_image.c                           |   16 -
 src/intel/vulkan/anv_private.h                         |   13 -
 src/intel/vulkan/genX_cmd_buffer.c                     |   36 +-
 src/mesa/drivers/dri/i965/Makefile.am                  |    7 
 src/mesa/drivers/dri/i965/brw_fs.cpp                   |   10 
 src/mesa/drivers/dri/i965/brw_fs.h                     |    6 
 src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp  |   19 -
 src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp      |    8 
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c          |    2 
 src/mesa/drivers/dri/i965/test_fs_copy_propagation.cpp |  213 +++++++++++++++++
 src/mesa/main/api_validate.c                           |    2 
 src/mesa/main/fbobject.c                               |    1 
 src/mesa/main/program_resource.c                       |  111 --------
 src/vulkan/wsi/wsi_common_queue.h                      |    1 
 44 files changed, 815 insertions(+), 286 deletions(-)

New commits:
commit bec04114d2612042bdf61183cfa3416b3a643b68
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Sat Dec 24 10:06:50 2016 +0000

    docs: add release notes for 13.0.3
    
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/docs/relnotes/13.0.3.html b/docs/relnotes/13.0.3.html
new file mode 100644
index 0000000..585dafa
--- /dev/null
+++ b/docs/relnotes/13.0.3.html
@@ -0,0 +1,176 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd";>
+<html lang="en">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
+  <title>Mesa Release Notes</title>
+  <link rel="stylesheet" type="text/css" href="../mesa.css">
+</head>
+<body>
+
+<div class="header">
+  <h1>The Mesa 3D Graphics Library</h1>
+</div>
+
+<iframe src="../contents.html"></iframe>
+<div class="content">
+
+<h1>Mesa 13.0.3 Release Notes / January 5, 2017</h1>
+
+<p>
+Mesa 13.0.3 is a bug fix release which fixes bugs found since the 13.0.2 release.
+</p>
+<p>
+Mesa 13.0.3 implements the OpenGL 4.4 API, but the version reported by
+glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
+glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 4.4.  OpenGL
+4.4 is <strong>only</strong> available if requested at context creation
+because compatibility contexts are not supported.
+</p>
+
+
+<h2>SHA256 checksums</h2>
+<pre>
+TBD
+</pre>
+
+
+<h2>New features</h2>
+<p>None</p>
+
+
+<h2>Bug fixes</h2>
+
+<ul>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77662";>Bug 77662</a> - Fail to render to different faces of depth-stencil cube map</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=92234";>Bug 92234</a> - [BDW] GPU hang in Shogun2</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=98329";>Bug 98329</a> - [dEQP, EGL, SKL, BDW, BSW] dEQP-EGL.functional.image.render_multiple_contexts.gles2_renderbuffer_depth16_depth_buffer</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99038";>Bug 99038</a> - [dEQP, EGL, SKL, BDW, BSW] dEQP-EGL.functional.negative_api.create_pixmap_surface crashes</li>
+
+</ul>
+
+
+<h2>Changes</h2>
+
+<p>Chad Versace (2):</p>
+<ul>
+  <li>i965/mt: Disable aux surfaces after making miptree shareable</li>
+  <li>egl: Fix crashes in eglCreate*Surface()</li>
+</ul>
+
+<p>Dave Airlie (4):</p>
+<ul>
+  <li>anv: set maxFragmentDualSrcAttachments to 1</li>
+  <li>radv: set maxFragmentDualSrcAttachments to 1</li>
+  <li>radv: fix another regression since shadow fixes.</li>
+  <li>radv: add missing license file to radv_meta_bufimage.</li>
+</ul>
+
+<p>Emil Velikov (5):</p>
+<ul>
+  <li>docs: add sha256 checksums for 13.0.2</li>
+  <li>anv: don't double-close the same fd</li>
+  <li>anv: don't leak memory if anv_init_wsi() fails</li>
+  <li>radv: don't leak the fd if radv_physical_device_init() succeeds</li>
+  <li>Update version to 13.0.3</li>
+</ul>
+
+<p>Eric Anholt (1):</p>
+<ul>
+  <li>vc4: In a loop break/continue, jump if everyone has taken the path.</li>
+</ul>
+
+<p>Gwan-gyeong Mun (3):</p>
+<ul>
+  <li>anv: Add missing error-checking to anv_block_pool_init (v2)</li>
+  <li>anv: Update the teardown in reverse order of the anv_CreateDevice</li>
+  <li>vulkan/wsi: Fix resource leak in success path of wsi_queue_init()</li>
+</ul>
+
+<p>Haixia Shi (1):</p>
+<ul>
+  <li>compiler/glsl: fix precision problem of tanh</li>
+</ul>
+
+<p>Ilia Mirkin (1):</p>
+<ul>
+  <li>mesa: only verify that enabled arrays have backing buffers</li>
+</ul>
+
+<p>Jason Ekstrand (8):</p>
+<ul>
+  <li>anv/cmd_buffer: Re-emit MEDIA_CURBE_LOAD when CS push constants are dirty</li>
+  <li>anv/image: Rename hiz_surface to aux_surface</li>
+  <li>anv/cmd_buffer: Remove the 1-D case from the HiZ QPitch calculation</li>
+  <li>genxml/gen9: Change the default of MI_SEMAPHORE_WAIT::RegisterPoleMode</li>
+  <li>anv/device: Return the right error for failed maps</li>
+  <li>anv/device: Implicitly unmap memory objects in FreeMemory</li>
+  <li>anv/descriptor_set: Write the state offset in the surface state free list.</li>
+  <li>spirv: Use a simpler and more correct implementaiton of tanh()</li>
+</ul>
+
+<p>Kenneth Graunke (1):</p>
+<ul>
+  <li>i965: Allocate at least some URB space even when max_vertices = 0.</li>
+</ul>
+
+<p>Marek Olšák (17):</p>
+<ul>
+  <li>radeonsi: always set all blend registers</li>
+  <li>radeonsi: set CB_BLEND1_CONTROL.ENABLE for dual source blending</li>
+  <li>radeonsi: disable RB+ blend optimizations for dual source blending</li>
+  <li>radeonsi: consolidate max-work-group-size computation</li>
+  <li>radeonsi: apply a multi-wave workgroup SPI bug workaround to affected CIK chips</li>
+  <li>radeonsi: apply a TC L1 write corruption workaround for SI</li>
+  <li>radeonsi: apply a tessellation bug workaround for SI</li>
+  <li>radeonsi: add a tess+GS hang workaround for VI dGPUs</li>
+  <li>radeonsi: apply the double EVENT_WRITE_EOP workaround to VI as well</li>
+  <li>cso: don't release sampler states that are bound</li>
+  <li>radeonsi: always restore sampler states when unbinding sampler views</li>
+  <li>radeonsi: fix incorrect FMASK checking in bind_sampler_states</li>
+  <li>radeonsi: allow specifying simm16 of emit_waitcnt at call sites</li>
+  <li>radeonsi: wait for outstanding memory instructions in TCS barriers</li>
+  <li>tgsi: fix the src type of TGSI_OPCODE_MEMBAR</li>
+  <li>radeonsi: wait for outstanding LDS instructions in memory barriers if needed</li>
+  <li>radeonsi: disable the constant engine (CE) on Carrizo and Stoney</li>
+</ul>
+
+<p>Matt Turner (3):</p>
+<ul>
+  <li>i965/fs: Rename opt_copy_propagate -&gt; opt_copy_propagation.</li>
+  <li>i965/fs: Add unit tests for copy propagation pass.</li>
+  <li>i965/fs: Reject copy propagation into SEL if not min/max.</li>
+</ul>
+
+<p>Nanley Chery (1):</p>
+<ul>
+  <li>mesa/fbobject: Update CubeMapFace when reusing textures</li>
+</ul>
+
+<p>Nicolai Hähnle (4):</p>
+<ul>
+  <li>radeonsi: fix isolines tess factor writes to control ring</li>
+  <li>radeonsi: update all GSVS ring descriptors for new buffer allocations</li>
+  <li>radeonsi: do not kill GS with memory writes</li>
+  <li>radeonsi: fix an off-by-one error in the bounds check for max_vertices</li>
+</ul>
+
+<p>Rhys Kidd (1):</p>
+<ul>
+  <li>glsl: Add pthread libs to cache_test</li>
+</ul>
+
+<p>Timothy Arceri (2):</p>
+<ul>
+  <li>mesa: fix active subroutine uniforms properly</li>
+  <li>Revert "nir: Turn imov/fmov of undef into undef."</li>
+</ul>
+
+
+</div>
+</body>
+</html>

commit a3d0bb354e762bf9e97d3a63a9470e3df1d2815d
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Sat Dec 24 10:00:26 2016 +0000

    Update version to 13.0.3
    
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/VERSION b/VERSION
index 347caf3..2cb4f2f 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-13.0.2
+13.0.3

commit 241dc4634f47113243ddc6d02d4d73fc6f4e98e9
Author: Rhys Kidd <rhyskidd@gmail.com>
Date:   Wed Oct 26 00:13:24 2016 -0400

    glsl: Add pthread libs to cache_test
    
    Fixes the following compile error, present when the SHA1 library is libgcrypt:
    
      CCLD     glsl/tests/cache-test
    glsl/.libs/libglsl.a(libmesautil_la-mesa-sha1.o): In function `call_once':
    /mesa/src/util/../../include/c11/threads_posix.h:96: undefined reference to `pthread_once'
    
    Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
    Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
    (cherry picked from commit 5c73ecaac487eba36e15f22be2e9396c4a0ffe46)

diff --git a/src/compiler/Makefile.glsl.am b/src/compiler/Makefile.glsl.am
index 80dfb73..15bea6b 100644
--- a/src/compiler/Makefile.glsl.am
+++ b/src/compiler/Makefile.glsl.am
@@ -62,8 +62,11 @@ glsl_tests_blob_test_LDADD =				\
 
 glsl_tests_cache_test_SOURCES =				\
 	glsl/tests/cache_test.c
+glsl_tests_cache_test_CFLAGS =				\
+	$(PTHREAD_CFLAGS)
 glsl_tests_cache_test_LDADD =				\
-	glsl/libglsl.la
+	glsl/libglsl.la					\
+	$(PTHREAD_LIBS)
 
 glsl_tests_general_ir_test_SOURCES =			\
 	glsl/tests/builtin_variable_test.cpp		\

commit e851f2748773f205d89ded0c540378dfcc5ad565
Author: Matt Turner <mattst88@gmail.com>
Date:   Mon Nov 28 15:21:51 2016 -0800

    i965/fs: Reject copy propagation into SEL if not min/max.
    
    We shouldn't ever see a SEL with conditional mod other than GE (for max)
    or L (for min), but we might see one with predication and no conditional
    mod.
    
    total instructions in shared programs: 8241806 -> 8241902 (0.00%)
    instructions in affected programs: 13284 -> 13380 (0.72%)
    HURT: 62
    
    total cycles in shared programs: 84165104 -> 84166244 (0.00%)
    cycles in affected programs: 75364 -> 76504 (1.51%)
    helped: 10
    HURT: 34
    
    Fixes generated code in at least Sanctum 2, Borderlands 2, Goat
    Simulator, XCOM: Enemy Unknown, and Shogun 2.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92234
    Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
    (cherry picked from commit 7bed52bb5fb4cfd5f91c902a654b3452f921da17)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index 31ba202..da02fb1 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -431,7 +431,9 @@ fs_visitor::try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry)
    if (entry->saturate) {
       switch(inst->opcode) {
       case BRW_OPCODE_SEL:
-         if (inst->src[1].file != IMM ||
+         if ((inst->conditional_mod != BRW_CONDITIONAL_GE &&
+              inst->conditional_mod != BRW_CONDITIONAL_L) ||
+             inst->src[1].file != IMM ||
              inst->src[1].f < 0.0 ||
              inst->src[1].f > 1.0) {
             return false;
diff --git a/src/mesa/drivers/dri/i965/test_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/test_fs_copy_propagation.cpp
index daba123..ed2f1e0 100644
--- a/src/mesa/drivers/dri/i965/test_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/test_fs_copy_propagation.cpp
@@ -163,6 +163,15 @@ TEST_F(copy_propagation_test, maxmax_sat_imm)
       { BRW_CONDITIONAL_L   , -1.5f, false },
       { BRW_CONDITIONAL_GE  ,  1.5f, false },
       { BRW_CONDITIONAL_L   ,  1.5f, false },
+
+      { BRW_CONDITIONAL_NONE, 0.5f, false },
+      { BRW_CONDITIONAL_Z   , 0.5f, false },
+      { BRW_CONDITIONAL_NZ  , 0.5f, false },
+      { BRW_CONDITIONAL_G   , 0.5f, false },
+      { BRW_CONDITIONAL_LE  , 0.5f, false },
+      { BRW_CONDITIONAL_R   , 0.5f, false },
+      { BRW_CONDITIONAL_O   , 0.5f, false },
+      { BRW_CONDITIONAL_U   , 0.5f, false },
    };
 
    for (unsigned i = 0; i < sizeof(test) / sizeof(test[0]); i++) {

commit 4dd3f7c9a09bff9aed35c4be9922e5a784c51b4a
Author: Matt Turner <mattst88@gmail.com>
Date:   Mon Nov 28 10:48:53 2016 -0800

    i965/fs: Add unit tests for copy propagation pass.
    
    Pretty basic, but it's a start.
    
    Acked-by: Jason Ekstrand <jason@jlekstrand.net>
    (cherry picked from commit 091a8a04adb28a2044e3baadba0af52a185b3bd0)
    [Emil Velikov: nir_shader_create() has only three arguments]
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/src/mesa/drivers/dri/i965/Makefile.am b/src/mesa/drivers/dri/i965/Makefile.am
index a192fc0..4b00977 100644
--- a/src/mesa/drivers/dri/i965/Makefile.am
+++ b/src/mesa/drivers/dri/i965/Makefile.am
@@ -106,6 +106,7 @@ TEST_LIBS = \
 
 TESTS = \
 	test_fs_cmod_propagation \
+	test_fs_copy_propagation \
 	test_fs_saturate_propagation \
         test_eu_compact \
 	test_vf_float_conversions \
@@ -121,6 +122,12 @@ test_fs_cmod_propagation_LDADD = \
 	$(top_builddir)/src/gtest/libgtest.la \
 	$(TEST_LIBS)
 
+test_fs_copy_propagation_SOURCES = \
+	test_fs_copy_propagation.cpp
+test_fs_copy_propagation_LDADD = \
+	$(top_builddir)/src/gtest/libgtest.la \
+	$(TEST_LIBS)
+
 test_fs_saturate_propagation_SOURCES = \
 	test_fs_saturate_propagation.cpp
 test_fs_saturate_propagation_LDADD = \
diff --git a/src/mesa/drivers/dri/i965/test_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/test_fs_copy_propagation.cpp
new file mode 100644
index 0000000..daba123
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/test_fs_copy_propagation.cpp
@@ -0,0 +1,204 @@
+/*
+ * Copyright © 2016 Intel Corporation
+ *
+ * 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.
+ */
+
+#include <gtest/gtest.h>
+#include "brw_fs.h"
+#include "brw_cfg.h"
+#include "program/program.h"
+
+using namespace brw;
+
+class copy_propagation_test : public ::testing::Test {
+   virtual void SetUp();
+
+public:
+   struct brw_compiler *compiler;
+   struct gen_device_info *devinfo;
+   struct gl_context *ctx;
+   struct brw_wm_prog_data *prog_data;
+   struct gl_shader_program *shader_prog;
+   fs_visitor *v;
+};
+
+class copy_propagation_fs_visitor : public fs_visitor
+{
+public:
+   copy_propagation_fs_visitor(struct brw_compiler *compiler,
+                               struct brw_wm_prog_data *prog_data,
+                               nir_shader *shader)
+      : fs_visitor(compiler, NULL, NULL, NULL,
+                   &prog_data->base, (struct gl_program *) NULL,
+                   shader, 8, -1) {}
+};
+
+
+void copy_propagation_test::SetUp()
+{
+   ctx = (struct gl_context *)calloc(1, sizeof(*ctx));
+   compiler = (struct brw_compiler *)calloc(1, sizeof(*compiler));
+   devinfo = (struct gen_device_info *)calloc(1, sizeof(*devinfo));
+   compiler->devinfo = devinfo;
+
+   prog_data = ralloc(NULL, struct brw_wm_prog_data);
+   nir_shader *shader =
+      nir_shader_create(NULL, MESA_SHADER_FRAGMENT, NULL);
+
+   v = new copy_propagation_fs_visitor(compiler, prog_data, shader);
+
+   devinfo->gen = 4;
+}
+
+static fs_inst *
+instruction(bblock_t *block, int num)
+{
+   fs_inst *inst = (fs_inst *)block->start();
+   for (int i = 0; i < num; i++) {
+      inst = (fs_inst *)inst->next;
+   }
+   return inst;
+}
+
+static bool
+copy_propagation(fs_visitor *v)
+{
+   const bool print = getenv("TEST_DEBUG");
+
+   if (print) {
+      fprintf(stderr, "= Before =\n");
+      v->cfg->dump(v);
+   }
+
+   bool ret = v->opt_copy_propagation();
+
+   if (print) {
+      fprintf(stderr, "\n= After =\n");
+      v->cfg->dump(v);
+   }
+
+   return ret;
+}
+
+TEST_F(copy_propagation_test, basic)
+{
+   const fs_builder &bld = v->bld;
+   fs_reg vgrf0 = v->vgrf(glsl_type::float_type);
+   fs_reg vgrf1 = v->vgrf(glsl_type::float_type);
+   fs_reg vgrf2 = v->vgrf(glsl_type::float_type);
+   fs_reg vgrf3 = v->vgrf(glsl_type::float_type);
+   bld.MOV(vgrf0, vgrf2);
+   bld.ADD(vgrf1, vgrf0, vgrf3);
+
+   /* = Before =
+    *
+    * 0: mov(8)        vgrf0  vgrf2
+    * 1: add(8)        vgrf1  vgrf0  vgrf3
+    *
+    * = After =
+    * 0: mov(8)        vgrf0  vgrf2
+    * 1: add(8)        vgrf1  vgrf2  vgrf3
+    */
+
+   v->calculate_cfg();
+   bblock_t *block0 = v->cfg->blocks[0];
+
+   EXPECT_EQ(0, block0->start_ip);
+   EXPECT_EQ(1, block0->end_ip);
+
+   EXPECT_TRUE(copy_propagation(v));
+   EXPECT_EQ(0, block0->start_ip);
+   EXPECT_EQ(1, block0->end_ip);
+
+   fs_inst *mov = instruction(block0, 0);
+   EXPECT_EQ(BRW_OPCODE_MOV, mov->opcode);
+   EXPECT_TRUE(mov->dst.equals(vgrf0));
+   EXPECT_TRUE(mov->src[0].equals(vgrf2));
+
+   fs_inst *add = instruction(block0, 1);
+   EXPECT_EQ(BRW_OPCODE_ADD, add->opcode);
+   EXPECT_TRUE(add->dst.equals(vgrf1));
+   EXPECT_TRUE(add->src[0].equals(vgrf2));
+   EXPECT_TRUE(add->src[1].equals(vgrf3));
+}
+
+TEST_F(copy_propagation_test, maxmax_sat_imm)
+{
+   const fs_builder &bld = v->bld;
+   fs_reg vgrf0 = v->vgrf(glsl_type::float_type);
+   fs_reg vgrf1 = v->vgrf(glsl_type::float_type);
+   fs_reg vgrf2 = v->vgrf(glsl_type::float_type);
+
+   static const struct {
+      enum brw_conditional_mod conditional_mod;
+      float immediate;
+      bool expected_result;
+   } test[] = {
+      /*   conditional mod,     imm, expected_result */
+      { BRW_CONDITIONAL_GE  ,  0.1f, true },
+      { BRW_CONDITIONAL_L   ,  0.1f, true },
+      { BRW_CONDITIONAL_GE  ,  0.5f, true },
+      { BRW_CONDITIONAL_L   ,  0.5f, true },
+      { BRW_CONDITIONAL_GE  ,  0.9f, true },
+      { BRW_CONDITIONAL_L   ,  0.9f, true },
+      { BRW_CONDITIONAL_GE  , -1.5f, false },
+      { BRW_CONDITIONAL_L   , -1.5f, false },
+      { BRW_CONDITIONAL_GE  ,  1.5f, false },
+      { BRW_CONDITIONAL_L   ,  1.5f, false },
+   };
+
+   for (unsigned i = 0; i < sizeof(test) / sizeof(test[0]); i++) {
+      fs_inst *mov = set_saturate(true, bld.MOV(vgrf0, vgrf1));
+      fs_inst *sel = set_condmod(test[i].conditional_mod,
+                                 bld.SEL(vgrf2, vgrf0,
+                                         brw_imm_f(test[i].immediate)));
+
+      v->calculate_cfg();
+
+      bblock_t *block0 = v->cfg->blocks[0];
+
+      EXPECT_EQ(0, block0->start_ip);
+      EXPECT_EQ(1, block0->end_ip);
+
+      EXPECT_EQ(test[i].expected_result, copy_propagation(v));
+      EXPECT_EQ(0, block0->start_ip);
+      EXPECT_EQ(1, block0->end_ip);
+
+      EXPECT_EQ(BRW_OPCODE_MOV, mov->opcode);
+      EXPECT_TRUE(mov->saturate);
+      EXPECT_TRUE(mov->dst.equals(vgrf0));
+      EXPECT_TRUE(mov->src[0].equals(vgrf1));
+
+      EXPECT_EQ(BRW_OPCODE_SEL, sel->opcode);
+      EXPECT_EQ(test[i].conditional_mod, sel->conditional_mod);
+      EXPECT_EQ(test[i].expected_result, sel->saturate);
+      EXPECT_TRUE(sel->dst.equals(vgrf2));
+      if (test[i].expected_result) {
+         EXPECT_TRUE(sel->src[0].equals(vgrf1));
+      } else {
+         EXPECT_TRUE(sel->src[0].equals(vgrf0));
+      }
+      EXPECT_TRUE(sel->src[1].equals(brw_imm_f(test[i].immediate)));
+
+      delete v->cfg;
+      v->cfg = NULL;
+   }
+}

commit a4f301816b7ed517a42cd338d7009d47caa52e1e
Author: Matt Turner <mattst88@gmail.com>
Date:   Mon Nov 28 10:45:08 2016 -0800

    i965/fs: Rename opt_copy_propagate -> opt_copy_propagation.
    
    Matches the vec4 backend, cmod propagation, and saturate propagation.
    
    Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
    (cherry picked from commit 6014da50ec41d1ad43fec94a625962ac3f2f10cb)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index afb1057..c4cbf84 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -5692,7 +5692,7 @@ fs_visitor::optimize()
 
       OPT(opt_algebraic);
       OPT(opt_cse);
-      OPT(opt_copy_propagate);
+      OPT(opt_copy_propagation);
       OPT(opt_predicated_break, this);
       OPT(opt_cmod_propagation);
       OPT(dead_code_eliminate);
@@ -5716,7 +5716,7 @@ fs_visitor::optimize()
    }
 
    if (OPT(lower_d2x)) {
-      OPT(opt_copy_propagate);
+      OPT(opt_copy_propagation);
       OPT(dead_code_eliminate);
    }
 
@@ -5728,12 +5728,12 @@ fs_visitor::optimize()
    OPT(lower_logical_sends);
 
    if (progress) {
-      OPT(opt_copy_propagate);
+      OPT(opt_copy_propagation);
       /* Only run after logical send lowering because it's easier to implement
        * in terms of physical sends.
        */
       if (OPT(opt_zero_samples))
-         OPT(opt_copy_propagate);
+         OPT(opt_copy_propagation);
       /* Run after logical send lowering to give it a chance to CSE the
        * LOAD_PAYLOAD instructions created to construct the payloads of
        * e.g. texturing messages in cases where it wasn't possible to CSE the
@@ -5762,7 +5762,7 @@ fs_visitor::optimize()
    if (devinfo->gen <= 5 && OPT(lower_minmax)) {
       OPT(opt_cmod_propagation);
       OPT(opt_cse);
-      OPT(opt_copy_propagate);
+      OPT(opt_copy_propagation);
       OPT(dead_code_eliminate);
    }
 
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index da01174..3a53768 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -133,11 +133,11 @@ public:
    bool opt_redundant_discard_jumps();
    bool opt_cse();
    bool opt_cse_local(bblock_t *block);
-   bool opt_copy_propagate();
+   bool opt_copy_propagation();
    bool try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry);
    bool try_constant_propagate(fs_inst *inst, acp_entry *entry);
-   bool opt_copy_propagate_local(void *mem_ctx, bblock_t *block,
-                                 exec_list *acp);
+   bool opt_copy_propagation_local(void *mem_ctx, bblock_t *block,
+                                   exec_list *acp);
    bool opt_drop_redundant_mov_to_flags();
    bool opt_register_renaming();
    bool register_coalesce();
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index e4e6816..31ba202 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -129,7 +129,7 @@ fs_copy_prop_dataflow::fs_copy_prop_dataflow(void *mem_ctx, cfg_t *cfg,
          foreach_in_list(acp_entry, entry, &out_acp[block->num][i]) {
             acp[next_acp] = entry;
 
-            /* opt_copy_propagate_local populates out_acp with copies created
+            /* opt_copy_propagation_local populates out_acp with copies created
              * in a block which are still live at the end of the block.  This
              * is exactly what we want in the COPY set.
              */
@@ -735,8 +735,8 @@ can_propagate_from(fs_inst *inst)
  * list.
  */
 bool
-fs_visitor::opt_copy_propagate_local(void *copy_prop_ctx, bblock_t *block,
-                                     exec_list *acp)
+fs_visitor::opt_copy_propagation_local(void *copy_prop_ctx, bblock_t *block,
+                                       exec_list *acp)
 {
    bool progress = false;
 
@@ -819,7 +819,7 @@ fs_visitor::opt_copy_propagate_local(void *copy_prop_ctx, bblock_t *block,
 }
 
 bool
-fs_visitor::opt_copy_propagate()
+fs_visitor::opt_copy_propagation()
 {
    bool progress = false;
    void *copy_prop_ctx = ralloc_context(NULL);
@@ -832,8 +832,8 @@ fs_visitor::opt_copy_propagate()
     * the set of copies available at the end of the block.
     */
    foreach_block (block, cfg) {
-      progress = opt_copy_propagate_local(copy_prop_ctx, block,
-                                          out_acp[block->num]) || progress;
+      progress = opt_copy_propagation_local(copy_prop_ctx, block,
+                                            out_acp[block->num]) || progress;
    }
 
    /* Do dataflow analysis for those available copies. */
@@ -852,7 +852,8 @@ fs_visitor::opt_copy_propagate()
          }
       }
 
-      progress = opt_copy_propagate_local(copy_prop_ctx, block, in_acp) || progress;
+      progress = opt_copy_propagation_local(copy_prop_ctx, block, in_acp) ||
+                 progress;
    }
 
    for (int i = 0; i < cfg->num_blocks; i++)

commit c682fdb77c1499fa424b943be1d242a499677144
Author: Timothy Arceri <timothy.arceri@collabora.com>
Date:   Thu Dec 15 16:51:13 2016 +1100

    Revert "nir: Turn imov/fmov of undef into undef."
    
    This reverts commit 6aa730000fea84a14b49828a4bb30761d43903bf.
    
    This was changing the size of the undef to always be 1 (the number of inputs
    to imov and fmov) which is wrong, we could be moving a vec4 for example.
    
    Acked-by: Kenneth Graunke <kenneth@whitecape.org>
    Cc: "13.0" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit a5502a721fd30fde4f5dc71421494329052f805b)

diff --git a/src/compiler/nir/nir_opt_undef.c b/src/compiler/nir/nir_opt_undef.c
index 0f8ba31..c4777a8 100644
--- a/src/compiler/nir/nir_opt_undef.c
+++ b/src/compiler/nir/nir_opt_undef.c
@@ -79,9 +79,7 @@ opt_undef_vecN(nir_builder *b, nir_alu_instr *alu)
 {
    if (alu->op != nir_op_vec2 &&
        alu->op != nir_op_vec3 &&
-       alu->op != nir_op_vec4 &&
-       alu->op != nir_op_fmov &&
-       alu->op != nir_op_imov)
+       alu->op != nir_op_vec4)
       return false;
 
    assert(alu->dest.dest.is_ssa);

commit 12618c1c90b8b2c59a523515eb2e4e55e7c8d17b
Author: Chad Versace <chadversary@chromium.org>
Date:   Tue Dec 13 14:23:55 2016 -0800

    egl: Fix crashes in eglCreate*Surface()
    
    Don't dereference a null EGLDisplay.
    
    Fixes tests
      dEQP-EGL.functional.negative_api.create_pbuffer_surface
      dEQP-EGL.functional.negative_api.create_pixmap_surface
    
    Reviewed-by: Mark Janes <mark.a.janes@intel.com>
    Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99038
    Cc: "13.0" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit 5e97b8f5ce975dfb66cc46e6b4cc1e89eb8c1dc0)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 697b6fe..471cf7e 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -849,7 +849,7 @@ _eglCreateWindowSurfaceCommon(_EGLDisplay *disp, EGLConfig config,
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
 
 #ifdef HAVE_SURFACELESS_PLATFORM
-   if (disp->Platform == _EGL_PLATFORM_SURFACELESS) {
+   if (disp && disp->Platform == _EGL_PLATFORM_SURFACELESS) {
       /* From the EGL_MESA_platform_surfaceless spec (v1):
        *
        *    eglCreatePlatformWindowSurface fails when called with a <display>
@@ -970,7 +970,7 @@ _eglCreatePixmapSurfaceCommon(_EGLDisplay *disp, EGLConfig config,
    EGLSurface ret;
 
 #if HAVE_SURFACELESS_PLATFORM
-   if (disp->Platform == _EGL_PLATFORM_SURFACELESS) {
+   if (disp && disp->Platform == _EGL_PLATFORM_SURFACELESS) {
       /* From the EGL_MESA_platform_surfaceless spec (v1):
        *
        *   [Like eglCreatePlatformWindowSurface,] eglCreatePlatformPixmapSurface

commit 63bdcc5c88441c4226d3717a5fb51e01b144bc2f
Author: Nanley Chery <nanley.g.chery@intel.com>
Date:   Tue Nov 15 16:42:23 2016 -0800

    mesa/fbobject: Update CubeMapFace when reusing textures
    
    Framebuffer attachments can be specified through FramebufferTexture*
    calls. Upon specifying a depth (or stencil) framebuffer attachment that
    internally reuses a texture, the cube map face of the new attachment
    would not be updated (defaulting to TEXTURE_CUBE_MAP_POSITIVE_X).
    Fix this issue by actually updating the CubeMapFace field.
    
    This bug manifested itself in BindFramebuffer calls performed on
    framebuffers whose stencil attachments internally reused a depth
    texture.  When binding a framebuffer, we walk through the framebuffer's
    attachments and update each one's corresponding gl_renderbuffer. Since
    the framebuffer's depth and stencil attachments may share a
    gl_renderbuffer and the walk visits the stencil attachment after
    the depth attachment, the uninitialized CubeMapFace forced rendering
    to TEXTURE_CUBE_MAP_POSITIVE_X.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77662
    Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    (cherry picked from commit 63318d34acd4a5edb271d57adf3b01e2e52552f8)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 9204606..64c4ab5 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2850,6 +2850,7 @@ reuse_framebuffer_texture_attachment(struct gl_framebuffer *fb,
    dst_att->Type = src_att->Type;
    dst_att->Complete = src_att->Complete;
    dst_att->TextureLevel = src_att->TextureLevel;
+   dst_att->CubeMapFace = src_att->CubeMapFace;
    dst_att->Zoffset = src_att->Zoffset;
    dst_att->Layered = src_att->Layered;
 }

commit fb9f0a1197e10f9b1c727b5b2956f36827308ad1
Author: Jason Ekstrand <jason.ekstrand@intel.com>
Date:   Fri Dec 9 09:34:50 2016 -0800

    spirv: Use a simpler and more correct implementaiton of tanh()
    
    The new implementation is more correct because it clamps the incoming value
    to 10 to avoid floating-point overflow.  It also uses a much reduced
    version of the formula which only requires 1 exp() rather than 2.  This
    fixes all of the dEQP-VK.glsl.builtin.precision.tanh.* tests.
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Cc: "13.0" <mesa-dev@lists.freedesktop.org>
    (cherry picked from commit da1c49171d0df185545cfbbd600e287f7c6160fa)

diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c
index cb0570d..fbc7ce6 100644
--- a/src/compiler/spirv/vtn_glsl450.c
+++ b/src/compiler/spirv/vtn_glsl450.c
@@ -565,16 +565,21 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
                                    build_exp(nb, nir_fneg(nb, src[0]))));
       return;
 
-   case GLSLstd450Tanh:
-      /* (0.5 * (e^x - e^(-x))) / (0.5 * (e^x + e^(-x))) */
-      val->ssa->def =
-         nir_fdiv(nb, nir_fmul(nb, nir_imm_float(nb, 0.5f),
-                                   nir_fsub(nb, build_exp(nb, src[0]),
-                                                build_exp(nb, nir_fneg(nb, src[0])))),
-                      nir_fmul(nb, nir_imm_float(nb, 0.5f),
-                                   nir_fadd(nb, build_exp(nb, src[0]),
-                                                build_exp(nb, nir_fneg(nb, src[0])))));
+   case GLSLstd450Tanh: {
+      /* tanh(x) := (0.5 * (e^x - e^(-x))) / (0.5 * (e^x + e^(-x)))
+       *
+       * With a little algebra this reduces to (e^2x - 1) / (e^2x + 1)
+       *
+       * We clamp x to (-inf, +10] to avoid precision problems.  When x > 10,
+       * e^2x is so much larger than 1.0 that 1.0 gets flushed to zero in the
+       * computation e^2x +/- 1 so it can be ignored.
+       */
+      nir_ssa_def *x = nir_fmin(nb, src[0], nir_imm_float(nb, 10));
+      nir_ssa_def *exp2x = build_exp(nb, nir_fmul(nb, x, nir_imm_float(nb, 2)));
+      val->ssa->def = nir_fdiv(nb, nir_fsub(nb, exp2x, nir_imm_float(nb, 1)),
+                                   nir_fadd(nb, exp2x, nir_imm_float(nb, 1)));
       return;
+   }
 
    case GLSLstd450Asinh:
       val->ssa->def = nir_fmul(nb, nir_fsign(nb, src[0]),

commit 41c688a6c31ac5b985a3318e082f78103f061977
Author: Haixia Shi <hshi@chromium.org>
Date:   Thu Dec 8 17:41:02 2016 -0800

    compiler/glsl: fix precision problem of tanh
    
    Clamp input scalar value to range [-10, +10] to avoid precision problems
    when the absolute value of input is too large.
    
    Fixes dEQP-GLES3.functional.shaders.builtin_functions.precision.tanh.* test
    failures.
    
    v2: added more explanation in the comment.
    v3: fixed a typo in the comment.
    
    Signed-off-by: Haixia Shi <hshi@chromium.org>
    Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Cc: "13.0" <mesa-dev@lists.freedesktop.org>
    (cherry picked from commit d4983390a869c3051929858a8b783be53d46b722)

diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index 3e4bcbb..3dead1a 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -3563,9 +3563,17 @@ builtin_builder::_tanh(const glsl_type *type)
    ir_variable *x = in_var(type, "x");
    MAKE_SIG(type, v130, 1, x);
 
+   /* Clamp x to [-10, +10] to avoid precision problems.
+    * When x > 10, e^(-x) is so small relative to e^x that it gets flushed to
+    * zero in the computation e^x + e^(-x). The same happens in the other
+    * direction when x < -10.
+    */
+   ir_variable *t = body.make_temp(type, "tmp");
+   body.emit(assign(t, min2(max2(x, imm(-10.0f)), imm(10.0f))));
+
    /* (e^x - e^(-x)) / (e^x + e^(-x)) */
-   body.emit(ret(div(sub(exp(x), exp(neg(x))),
-                     add(exp(x), exp(neg(x))))));
+   body.emit(ret(div(sub(exp(t), exp(neg(t))),
+                     add(exp(t), exp(neg(t))))));
 
    return sig;
 }

commit 0c2a66c5b6be5457b9aa8411804fdee32394cdd8
Author: Jason Ekstrand <jason.ekstrand@intel.com>
Date:   Thu Nov 10 16:43:35 2016 -0800

    anv/descriptor_set: Write the state offset in the surface state free list.
    
    When Kristian reworked descriptor set allocation, somehow he forgot to
    actually store the offset in the free list.  Somehow, this completely
    missed CTS testing until now... This fixes all 2744 of the new
    'dEQP-VK.texture.filtering.* tests in the latest CTS.
    
    Cc: "12.0 13.0" <mesa-dev@lists.freedesktop.org>
    Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
    (cherry picked from commit 37537b7d868ddca376e2553a4ea9e5e0033a961c)

diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c
index 17a1c8e..94c3f03 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -498,6 +498,7 @@ anv_descriptor_set_destroy(struct anv_device *device,
       struct surface_state_free_list_entry *entry =
          set->buffer_views[b].surface_state.map;
       entry->next = pool->surface_state_free_list;
+      entry->offset = set->buffer_views[b].surface_state.offset;
       pool->surface_state_free_list = entry;
    }
 

commit 626b85cc15d8a57954f956620c0b89c3a06559af
Author: Jason Ekstrand <jason.ekstrand@intel.com>
Date:   Mon Nov 7 17:25:07 2016 -0800

    anv/device: Implicitly unmap memory objects in FreeMemory
    
    From the Vulkan spec version 1.0.32 docs for vkFreeMemory:
    
       "If a memory object is mapped at the time it is freed, it is implicitly
       unmapped."
    
    Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
    Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
    Cc: "12.0 13.0" <mesa-dev@lists.freedesktop.org>
    (cherry picked from commit b1217eada9e32bf387d4d14615340aa5b5fd1f5c)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 9595fe3..5333856 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1243,6 +1243,9 @@ VkResult anv_AllocateMemory(
 
    mem->type_index = pAllocateInfo->memoryTypeIndex;
 
+   mem->map = NULL;
+   mem->map_size = 0;
+
    *pMem = anv_device_memory_to_handle(mem);
 
    return VK_SUCCESS;
@@ -1264,6 +1267,9 @@ void anv_FreeMemory(
    if (mem == NULL)
       return;
 


Reply to: