Makefile.am                                           |    2 
 VERSION                                               |    2 
 bin/.cherry-ignore                                    |   16 +
 bin/get-pick-list.sh                                  |    2 
 bin/get-typod-pick-list.sh                            |   39 ++
 configure.ac                                          |    4 
 docs/relnotes/13.0.3.html                             |    3 
 docs/relnotes/13.0.4.html                             |  254 ++++++++++++++++++
 include/GL/internal/dri_interface.h                   |    2 
 include/vulkan/vk_icd.h                               |  110 +++++--
 src/amd/common/ac_nir_to_llvm.c                       |    4 
 src/amd/vulkan/Makefile.am                            |    8 
 src/amd/vulkan/radv_cmd_buffer.c                      |    4 
 src/amd/vulkan/radv_device.c                          |   45 +++
 src/amd/vulkan/radv_wsi.c                             |   12 
 src/compiler/glsl/opt_function_inlining.cpp           |    2 
 src/compiler/glsl/opt_minmax.cpp                      |    4 
 src/compiler/nir/nir_opt_undef.c                      |   12 
 src/compiler/nir/nir_search.c                         |   16 -
 src/compiler/spirv/vtn_cfg.c                          |    3 
 src/egl/drivers/dri2/platform_wayland.c               |    6 
 src/egl/main/eglapi.c                                 |   10 
 src/egl/main/eglcontext.c                             |   38 +-
 src/gallium/auxiliary/cso_cache/cso_context.c         |    1 
 src/gallium/auxiliary/hud/hud_cpufreq.c               |    1 
 src/gallium/auxiliary/vl/vl_zscan.c                   |    2 
 src/gallium/drivers/freedreno/freedreno_batch.c       |    2 
 src/gallium/drivers/freedreno/freedreno_batch_cache.c |    4 
 src/gallium/drivers/freedreno/freedreno_batch_cache.h |    2 
 src/gallium/drivers/freedreno/freedreno_context.c     |   17 -
 src/gallium/drivers/freedreno/freedreno_context.h     |    2 
 src/gallium/drivers/freedreno/freedreno_fence.c       |    7 
 src/gallium/drivers/freedreno/freedreno_fence.h       |    8 
 src/gallium/drivers/freedreno/freedreno_gmem.c        |    4 
 src/gallium/drivers/freedreno/freedreno_screen.c      |    4 
 src/gallium/drivers/nouveau/nouveau_video.c           |    2 
 src/gallium/drivers/nouveau/nv30/nv30_clear.c         |    2 
 src/gallium/drivers/nouveau/nv30/nv30_transfer.c      |    8 
 src/gallium/drivers/nouveau/nv50/nv50_surface.c       |    6 
 src/gallium/drivers/nouveau/nv50/nv50_vbo.c           |    2 
 src/gallium/drivers/nouveau/nv50/nv98_video.c         |    6 
 src/gallium/drivers/nouveau/nv50/nv98_video_bsp.c     |    7 
 src/gallium/drivers/nouveau/nv50/nv98_video_ppp.c     |    7 
 src/gallium/drivers/nouveau/nv50/nv98_video_vp.c      |    9 
 src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c      |    2 
 src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c           |    2 
 src/gallium/drivers/nouveau/nvc0/nvc0_video.c         |    6 
 src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c     |    7 
 src/gallium/drivers/nouveau/nvc0/nvc0_video_ppp.c     |    7 
 src/gallium/drivers/nouveau/nvc0/nvc0_video_vp.c      |    9 
 src/gallium/drivers/r600/sb/sb_dce_cleanup.cpp        |   25 +
 src/gallium/drivers/r600/sb/sb_gcm.cpp                |    7 
 src/gallium/drivers/r600/sb/sb_ir.cpp                 |    4 
 src/gallium/drivers/r600/sb/sb_ir.h                   |   14 
 src/gallium/drivers/r600/sb/sb_pass.h                 |    6 
 src/gallium/drivers/r600/sb/sb_valtable.cpp           |   42 +-
 src/gallium/drivers/radeonsi/si_descriptors.c         |   19 -
 src/gallium/drivers/radeonsi/si_shader.c              |    7 
 src/gallium/drivers/radeonsi/si_state.c               |    4 
 src/gallium/state_trackers/glx/xlib/Makefile.am       |    1 
 src/gallium/state_trackers/va/buffer.c                |    7 
 src/gallium/state_trackers/va/picture.c               |   11 
 src/gallium/state_trackers/va/va_private.h            |    1 
 src/gallium/state_trackers/vdpau/output.c             |    7 
 src/gallium/state_trackers/vdpau/surface.c            |   12 
 src/glx/dri3_glx.c                                    |   14 
 src/intel/isl/isl_format.c                            |    5 
 src/intel/vulkan/anv_device.c                         |   59 +++-
 src/intel/vulkan/anv_formats.c                        |    4 
 src/intel/vulkan/anv_image.c                          |    2 
 src/intel/vulkan/anv_wsi.c                            |   12 
 src/intel/vulkan/genX_cmd_buffer.c                    |    9 
 src/mapi/entry_x86-64_tls.h                           |   31 +-
 src/mesa/drivers/common/meta_generate_mipmap.c        |    1 
 src/mesa/drivers/dri/common/dri_util.c                |    4 
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp        |    8 
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp          |   16 -
 src/mesa/drivers/dri/i965/brw_vec4_generator.cpp      |   22 +
 src/mesa/drivers/dri/i965/gen8_draw_upload.c          |   34 +-
 src/mesa/drivers/dri/i965/genX_blorp_exec.c           |    4 
 src/mesa/drivers/dri/i965/hsw_sol.c                   |    3 
 src/mesa/main/shaderobj.c                             |   15 -
 src/mesa/main/texformat.c                             |    2 
 src/util/list.h                                       |    2 
 src/vulkan/wsi/wsi_common.h                           |   20 +
 src/vulkan/wsi/wsi_common_wayland.c                   |    2 
 src/vulkan/wsi/wsi_common_x11.c                       |   16 -
 87 files changed, 909 insertions(+), 277 deletions(-)

New commits:
commit 3255d10da4c2703bfdfcefd8f59b0d8f21dbb43f
Author: Emil Velikov <emil.veli...@collabora.com>
Date:   Wed Feb 1 10:10:38 2017 +0000

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

diff --git a/docs/relnotes/13.0.4.html b/docs/relnotes/13.0.4.html
new file mode 100644
index 0000000..52105b7
--- /dev/null
+++ b/docs/relnotes/13.0.4.html
@@ -0,0 +1,254 @@
+<!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.4 Release Notes / February 1, 2017</h1>
+
+<p>
+Mesa 13.0.4 is a bug fix release which fixes bugs found since the 13.0.3 
release.
+</p>
+<p>
+Mesa 13.0.4 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=92634";>Bug 92634</a> 
- gallium's vl_mpeg12_decoder does not work with st/va</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=94512";>Bug 94512</a> 
- X segfaults with glx-tls enabled in a x32 environment</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=94900";>Bug 94900</a> 
- HD6950 GPU lockup loop with various steam games (octodad[always], saints row 
4[always], dead island[always], grid autosport[sometimes])</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=98263";>Bug 98263</a> 
- [radv] The Talos Principle fails to launch with &quot;Fatal error: Cannot set 
display mode.&quot;</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=98914";>Bug 98914</a> 
- mesa-vdpau-drivers: breaks vdpau for mpeg2video</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=98975";>Bug 98975</a> 
- Wasteland 2 Directors Cut: Hangs. GPU fault</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99030";>Bug 99030</a> 
- [HSW, regression] transform feedback fails on Linux 4.8</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99085";>Bug 99085</a> 
- [EGL] dEQP-EGL.functional.sharing.gles2.multithread intermittent</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99097";>Bug 99097</a> 
- [vulkancts] dEQP-VK.image.store regression</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99100";>Bug 99100</a> 
- [SKL,BDW,BSW,KBL] dEQP-VK.glsl.return.return_in_dynamic_loop_dynamic_vertex 
regression</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99144";>Bug 99144</a> 
- Incorrect rendering using glDrawArraysInstancedBaseInstance and first != 0 on 
Skylake</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99154";>Bug 99154</a> 
- Link time error when using multiple builtin functions</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99158";>Bug 99158</a> 
- vdpau segfaults and gpu locks with kodi on R9285</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99185";>Bug 99185</a> 
- dEQP-EGL.functional.image.modify.tex_rgb5_a1_tex_subimage_rgba8</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99188";>Bug 99188</a> 
- 
dEQP-EGL.functional.create_context_ext.robust_gl_30.rgb565_no_depth_no_stencil</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99210";>Bug 99210</a> 
- ES3-CTS.functional.texture.mipmap.cube.generate.rgba5551_*</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99354";>Bug 99354</a> 
- [G71] &quot;Assertion `bkref' failed&quot; reproducible with glmark2</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99450";>Bug 99450</a> 
- [amdgpu] Payday 2 visual glitches on some models</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=99451";>Bug 99451</a> 
- polygon offset use after free</li>
+
+</ul>
+
+
+<h2>Changes</h2>
+
+<p>Andres Rodriguez (2):</p>
+<ul>
+  <li>vulkan/wsi: clarify the severity of lack of DRI3 v2</li>
+  <li>radv: fix include order for installed headers v2</li>
+</ul>
+
+<p>Arda Coskunses (2):</p>
+<ul>
+  <li>vulkan/wsi/x11: don't crash on null visual</li>
+  <li>vulkan/wsi/x11: don't crash on null wsi x11 connection</li>
+</ul>
+
+<p>Bas Nieuwenhuizen (1):</p>
+<ul>
+  <li>radv: Support loader interface version 3.</li>
+</ul>
+
+<p>Chad Versace (10):</p>
+<ul>
+  <li>egl: Check config's surface types in eglCreate*Surface()</li>
+  <li>dri: Add __DRI_IMAGE_FORMAT_ARGB1555</li>
+  <li>mesa/texformat: Handle GL_RGBA + GL_UNSIGNED_SHORT_5_5_5_1</li>
+  <li>egl: Emit correct error when robust context creation fails</li>
+  <li>anv: Handle vkGetPhysicalDeviceQueueFamilyProperties with count == 0</li>
+  <li>mesa/shaderobj: Fix races on refcounts</li>
+  <li>meta: Disable dithering during glGenerateMipmap</li>
+  <li>vulkan: Add new cast macros for VkIcd types</li>
+  <li>vulkan: Update vk_icd.h to interface version 3</li>
+  <li>anv: Support loader interface version 3 (patch v2)</li>
+</ul>
+
+<p>Christian König (1):</p>
+<ul>
+  <li>vl/zscan: fix "Fix trivial sign compare warnings"</li>
+</ul>
+
+<p>Chuck Atkins (1):</p>
+<ul>
+  <li>glx: Add missing glproto dependency for gallium-xlib glx</li>
+</ul>
+
+<p>Damien Grassart (1):</p>
+<ul>
+  <li>anv: return count of queue families written</li>
+</ul>
+
+<p>Dave Airlie (1):</p>
+<ul>
+  <li>radv: flush smem for uniform buffer bit.</li>
+</ul>
+
+<p>Emil Velikov (10):</p>
+<ul>
+  <li>docs: add sha256 checksums for 13.0.3</li>
+  <li>cherry-ignore: add couple of intel_miptree_copy related patches</li>
+  <li>cherry-ignore: add radv: Call nir_lower_constant_initializers."</li>
+  <li>get-typod-pick-list.sh: add new script</li>
+  <li>cherry-ignore: add "_mesa_ClampColor extension/version fix"</li>
+  <li>cherry-ignore: add wayland race condition fix</li>
+  <li>egl/wayland: use the destroy_window_callback for swrast</li>
+  <li>automake: use shared llvm libs for make distcheck</li>
+  <li>get-pick-list.sh: Require explicit "13.0" for nominating stable 
patches</li>
+  <li>Update version to 13.0.4</li>
+</ul>
+
+<p>Francisco Jerez (1):</p>
+<ul>
+  <li>anv: Fix uniform and storage buffer offset alignment limits.</li>
+</ul>
+
+<p>Fredrik Höglund (2):</p>
+<ul>
+  <li>radv: fix dual source blending</li>
+  <li>dri3: Fix MakeCurrent without a default framebuffer</li>
+</ul>
+
+<p>Grazvydas Ignotas (1):</p>
+<ul>
+  <li>mapi: update the asm code to support x32</li>
+</ul>
+
+<p>Heiko Przybyl (1):</p>
+<ul>
+  <li>r600/sb: Fix loop optimization related hangs on eg</li>
+</ul>
+
+<p>Ilia Mirkin (1):</p>
+<ul>
+  <li>nouveau: take extra push space into account for pushbuf_space calls</li>
+</ul>
+
+<p>Jason Ekstrand (4):</p>
+<ul>
+  <li>i965/generator/tex: Handle an immediate sampler with an indirect 
texture</li>
+  <li>anv/formats: Use the real format for B4G4R4A4_UNORM_PACK16 on gen8</li>
+  <li>nir/search: Only allow matching SSA values</li>
+  <li>isl: Mark A4B4G4R4_UNORM as supported on gen8</li>
+</ul>
+
+<p>Jonas Ådahl (1):</p>
+<ul>
+  <li>egl/wayland: Cleanup private display connection when init fails</li>
+</ul>
+
+<p>Kenneth Graunke (7):</p>
+<ul>
+  <li>i965: Don't bail on vertex element processing if we need draw 
params.</li>
+  <li>i965: Fix last slot calculations</li>
+  <li>i965: Fix texturing in the vec4 TCS and GS backends.</li>
+  <li>spirv: Move cursor before calling vtn_ssa_value() in phi 2nd pass.</li>
+  <li>i965: Make BLORP disable the NP Z PMA stall fix.</li>
+  <li>glsl: Use ir_var_temporary when generating inline functions.</li>
+  <li>i965: Properly flush in hsw_pause_transform_feedback().</li>
+</ul>
+
+<p>Marek Olšák (4):</p>
+<ul>
+  <li>vdpau: call texture_get_handle while the mutex is being held</li>
+  <li>va: call texture_get_handle while the mutex is being held</li>
+  <li>radeonsi: for the tess barrier, only use emit_waitcnt on SI and LLVM 
3.9+</li>
+  <li>radeonsi: don't forget to add HTILE to the buffer list for texturing</li>
+</ul>
+
+<p>Michel Dänzer (1):</p>
+<ul>
+  <li>cso: Don't restore nr_samplers in cso_restore_fragment_samplers</li>
+</ul>
+
+<p>Nanley Chery (3):</p>
+<ul>
+  <li>anv/cmd_buffer: Fix arrayed depth/stencil attachments</li>
+  <li>anv/cmd_buffer: Fix programmed HiZ qpitch</li>
+  <li>anv/image: Disable HiZ for depth buffer arrays</li>
+</ul>
+
+<p>Nayan Deshmukh (1):</p>
+<ul>
+  <li>st/va: delay calling begin_frame until we have all parameters</li>
+</ul>
+
+<p>Rob Clark (1):</p>
+<ul>
+  <li>freedreno: some fence cleanup</li>
+</ul>
+
+<p>Samuel Pitoiset (1):</p>
+<ul>
+  <li>gallium/hud: add missing break in hud_cpufreq_graph_install()</li>
+</ul>
+
+<p>Timothy Arceri (3):</p>
+<ul>
+  <li>nir: Turn imov/fmov of undef into undef</li>
+  <li>glsl: fix opt_minmax redundancy checks against baserange</li>
+  <li>util: fix list_is_singular()</li>
+</ul>
+
+<p>Zachary Michaels (1):</p>
+<ul>
+  <li>radeonsi: Always leave poly_offset in a valid state</li>
+</ul>
+
+
+</div>
+</body>
+</html>

commit c6c7e98208f648f2f159fbb0ee4889754ffdf4f1
Author: Emil Velikov <emil.veli...@collabora.com>
Date:   Wed Feb 1 10:04:14 2017 +0000

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

diff --git a/VERSION b/VERSION
index 2cb4f2f..1b8bd35 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-13.0.3
+13.0.4

commit 9185a3385beff97fe2f0857b6fae95dc8db9d4e5
Author: Emil Velikov <emil.veli...@collabora.com>
Date:   Wed Jan 25 13:34:42 2017 +0000

    get-pick-list.sh: Require explicit "13.0" for nominating stable patches
    
    A nomination unadorned with a specific version is now interpreted as
    being aimed at the 17.0 branch, which was recently opened.
    
    Signed-off-by: Emil Velikov <emil.veli...@collabora.com>

diff --git a/bin/get-pick-list.sh b/bin/get-pick-list.sh
index 0902fd0..98bf692 100755
--- a/bin/get-pick-list.sh
+++ b/bin/get-pick-list.sh
@@ -14,7 +14,7 @@ git log --reverse --grep="cherry picked from commit" 
origin/master..HEAD |\
        sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 
's/)//' > already_picked
 
 # Grep for commits that were marked as a candidate for the stable tree.
-git log --reverse --pretty=%H -i --grep='^\([[:space:]]*NOTE: 
.*[Cc]andidate\|CC:.*mesa-stable\)' HEAD..origin/master |\
+git log --reverse --pretty=%H -i --grep='^\([[:space:]]*NOTE: 
.*[Cc]andidate\|CC:.*13\.0.*mesa-stable\)' HEAD..origin/master |\
 while read sha
 do
        # Check to see whether the patch is on the ignore list.

commit b602f4f5bd1dc259bf01cf218271be7305e76d45
Author: Nayan Deshmukh <nayan26deshm...@gmail.com>
Date:   Fri Jan 13 18:45:31 2017 +0530

    st/va: delay calling begin_frame until we have all parameters
    
    If begin_frame is called before setting intra_matrix and
    non_intra_matrix it leads to segmentation faults when
    vl_mpeg12_decoder.c is used.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92634
    Signed-off-by: Nayan Deshmukh <nayan26deshm...@gmail.com>
    Reviewed-by: Christian König <christian.koe...@amd.com>
    (cherry picked from commit 4b0e9babc673bc4dd834127086982e290b2a3a42)
    
    Squashed with commit:
    
    st/va: make sure that we call begin_frame() only once v2
    
    This fixes "st/va: delay calling begin_frame until we have all parameters".
    
    v2: call begin frame after decoder (re)creation as well.
    
    Signed-off-by: Christian König <christian.koe...@amd.com>
    Reviewed-by: Nayan Deshmukh <nayan26deshm...@gmail.com>
    Tested-by: Andy Furniss <adf.li...@gmail.com>
    (cherry picked from commit 1338d912f52b69f76ef75d1ad313893db77d4da8)
    [Emil Velikov: resolve trivial conflicts]
    Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
    
    Conflicts:
        src/gallium/state_trackers/va/va_private.h

diff --git a/src/gallium/state_trackers/va/picture.c 
b/src/gallium/state_trackers/va/picture.c
index a8102a4..bf592ee 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -81,7 +81,7 @@ vlVaBeginPicture(VADriverContextP ctx, VAContextID 
context_id, VASurfaceID rende
    }
 
    if (context->decoder->entrypoint != PIPE_VIDEO_ENTRYPOINT_ENCODE)
-      context->decoder->begin_frame(context->decoder, context->target, 
&context->desc.base);
+      context->needs_begin_frame = true;
 
    return VA_STATUS_SUCCESS;
 }
@@ -179,8 +179,7 @@ handlePictureParameterBuffer(vlVaDriver *drv, vlVaContext 
*context, vlVaBuffer *
       if (!context->decoder)
          return VA_STATUS_ERROR_ALLOCATION_FAILED;
 
-      context->decoder->begin_frame(context->decoder, context->target,
-         &context->desc.base);
+      context->needs_begin_frame = true;
    }
 
    return vaStatus;
@@ -310,6 +309,12 @@ handleVASliceDataBufferType(vlVaContext *context, 
vlVaBuffer *buf)
    buffers[num_buffers] = buf->data;
    sizes[num_buffers] = buf->size;
    ++num_buffers;
+
+   if (context->needs_begin_frame) {
+      context->decoder->begin_frame(context->decoder, context->target,
+         &context->desc.base);
+      context->needs_begin_frame = false;
+   }
    context->decoder->decode_bitstream(context->decoder, context->target, 
&context->desc.base,
       num_buffers, (const void * const*)buffers, sizes);
 }
diff --git a/src/gallium/state_trackers/va/va_private.h 
b/src/gallium/state_trackers/va/va_private.h
index c9a6a41..655f90e 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -244,6 +244,7 @@ typedef struct {
    struct vl_deint_filter *deint;
    struct vlVaBuffer *coded_buf;
    int target_id;
+   bool needs_begin_frame;
 } vlVaContext;
 
 typedef struct {

commit 12ba860584f8fa4c4208d36f6f3e464689691b50
Author: Heiko Przybyl <lil_...@web.de>
Date:   Sun Nov 20 14:42:28 2016 +0100

    r600/sb: Fix loop optimization related hangs on eg
    
    Make sure unused ops and their references are removed, prior to entering
    the GCM (global code motion) pass, to stop GCM from breaking the loop
    logic and thus hanging the GPU.
    
    Turns out, that sb has problems with loops and node optimizations
    regarding associative folding:
    
    - the global code motion (gcm) pass moves ops up a loop level/basic block
    until they've fulfilled their total usage count
    - if there are ops folded into others, the usage count won't be
    fulfilled and thus the op moved way up to the top
    - within GCM the op would be visited and their deps would be moved
    alongside it, to fulfill the src constaints
    - in a loop, an unused op is moved out of the loop and GCM would move
    the src value ops up as well
    - now here arises the problem: if the loop counter is one of the src
    values it would get moved up as well, the loop break condition would
    never get hit and the shader turn into an endless loop, resulting in the
    GPU hanging and being reset
    
    A reduced (albeit nonsense) piglit example would be:
    
    [require]
    GLSL >= 1.20
    
    [fragment shader]
    
    uniform int SIZE;
    uniform vec4 lights[512];
    
    void main()
    {
        float x = 0;
        for(int i = 0; i < SIZE; i++)
            x += lights[2*i+1].x;
    }
    
    [test]
    uniform int SIZE 1
    draw rect -1 -1 2 2
    
    Which gets optimized to:
    
    ===== SHADER #12 OPT ================================== PS/BARTS/EVERGREEN 
=====
    ===== 42 dw ===== 1 gprs ===== 2 stack 
=========================================
    ALU 3 @24
         1      y: MOV                R0.y,  0
                t: MULLO_UINT         R0.w,  [0x00000002 2.8026e-45].x, R0.z
    
    LOOP_START_DX10 @22
    PUSH @6
    ALU 1 @30 KC0[CB0:0-15]
         2 M    x: PRED_SETGE_INT     __.x,  R0.z, KC0[0].x
    JUMP @14 POP:1
    LOOP_BREAK @20
    POP @14 POP:1
    ALU 2 @32
         3      x: ADD_INT            R0.x,  R0.w, [0x00000002 2.8026e-45].x
    
    TEX 1 @36
                   VFETCH             R0.x___, R0.x,   RID:0   MFC:16 UCF:0 
FMT[..]
    ALU 1 @40
         4      y: ADD                R0.y,  R0.y, R0.x
    LOOP_END @4
    EXPORT_DONE        PIXEL 0     R0.____  EOP
    ===== SHADER_END 
===============================================================
    
    Notice R0.z being the loop counter/break condition relevant register
    and being never incremented at all. Also some of the loop content
    has been moved out of it, to fulfill the requirements for the one unused
    op.
    
    With a debug build of mesa this would produce an error like
    error at : PRED_SETGE_INT     __, __, EM.2,    R1.x.2||FP@R0.z, C0.x
      : operand value R1.x.2||FP@R0.z was not previously written to its gpr
    and the compilation would fail due to this. On a release build it gets
    passed to the GPU.
    
    When using this patch, the loop remains intact:
    
    ===== SHADER #12 OPT ================================== PS/BARTS/EVERGREEN 
=====
    ===== 48 dw ===== 1 gprs ===== 2 stack 
=========================================
    ALU 2 @24
         1      y: MOV                R0.y,  0
                z: MOV                R0.z,  0
    LOOP_START_DX10 @22
    PUSH @6
    ALU 1 @28 KC0[CB0:0-15]
         2 M    x: PRED_SETGE_INT     __.x,  R0.z, KC0[0].x
    JUMP @14 POP:1
    LOOP_BREAK @20
    POP @14 POP:1
    ALU 4 @30
         3      t: MULLO_UINT         T0.x,  [0x00000002 2.8026e-45].x, R0.z
    
         4      x: ADD_INT            R0.x,  T0.x, [0x00000002 2.8026e-45].x
    
    TEX 1 @40
                   VFETCH             R0.x___, R0.x,   RID:0   MFC:16 UCF:0 
FMT[..]
    ALU 2 @44
         5      y: ADD                R0.y,  R0.y, R0.x
                z: ADD_INT            R0.z,  R0.z, 1
    LOOP_END @4
    EXPORT_DONE        PIXEL 0     R0.____  EOP
    ===== SHADER_END 
===============================================================
    
    Piglit: ./piglit summary console -d results/*_gpu_noglx
            name: unpatched_gpu_noglx patched_gpu_noglx
            ----  ------------------- -----------------
            pass:               18016             18021
            fail:                 748               743
            crash:                  7                 7
            skip:                1124              1124
            timeout:                0                 0
            warn:                  13                13
            incomplete:             0                 0
            dmesg-warn:             0                 0
            dmesg-fail:             0                 0
            changes:                0                 5
            fixes:                  0                 5
            regressions:            0                 0
            total:              19908             19908
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94900
    Tested-by: Heiko Przybyl <lil_...@web.de>
    Tested-on: Barts PRO HD6850
    Signed-off-by: Heiko Przybyl <lil_...@web.de>
    Signed-off-by: Marek Olšák <marek.ol...@amd.com>
    (cherry picked from commit e933246013eef376804662f3fcf4646c143c6c88)
    Nominated-by: Andreas Boll <andreas.boll....@gmail.com>

diff --git a/src/gallium/drivers/r600/sb/sb_dce_cleanup.cpp 
b/src/gallium/drivers/r600/sb/sb_dce_cleanup.cpp
index 79aef91..abae2bf 100644
--- a/src/gallium/drivers/r600/sb/sb_dce_cleanup.cpp
+++ b/src/gallium/drivers/r600/sb/sb_dce_cleanup.cpp
@@ -30,6 +30,18 @@
 
 namespace r600_sb {
 
+int dce_cleanup::run() {
+       int r;
+
+       // Run cleanup for as long as there are unused nodes.
+       do {
+               nodes_changed = false;
+               r = vpass::run();
+       } while (r == 0 && nodes_changed);
+
+       return r;
+}
+
 bool dce_cleanup::visit(node& n, bool enter) {
        if (enter) {
        } else {
@@ -110,7 +122,18 @@ bool dce_cleanup::visit(region_node& n, bool enter) {
 void dce_cleanup::cleanup_dst(node& n) {
        if (!cleanup_dst_vec(n.dst) && remove_unused &&
                        !n.dst.empty() && !(n.flags & NF_DONT_KILL) && n.parent)
+       {
+               // Delete use references to the removed node from the src 
values.
+               for (vvec::iterator I = n.src.begin(), E = n.src.end(); I != E; 
++I) {
+                       value* v = *I;
+                       if (v && v->def && v->uses.size())
+                       {
+                               v->remove_use(&n);
+                       }
+               }
                n.remove();
+               nodes_changed = true;
+       }
 }
 
 bool dce_cleanup::visit(container_node& n, bool enter) {
@@ -130,7 +153,7 @@ bool dce_cleanup::cleanup_dst_vec(vvec& vv) {
                if (v->gvn_source && v->gvn_source->is_dead())
                        v->gvn_source = NULL;
 
-               if (v->is_dead() || (remove_unused && !v->is_rel() && !v->uses))
+               if (v->is_dead() || (remove_unused && !v->is_rel() && 
!v->uses.size()))
                        v = NULL;
                else
                        alive = true;
diff --git a/src/gallium/drivers/r600/sb/sb_gcm.cpp 
b/src/gallium/drivers/r600/sb/sb_gcm.cpp
index 236b2ea..9c75389 100644
--- a/src/gallium/drivers/r600/sb/sb_gcm.cpp
+++ b/src/gallium/drivers/r600/sb/sb_gcm.cpp
@@ -199,10 +199,9 @@ void gcm::td_release_val(value *v) {
                sblog << "\n";
        );
 
-       use_info *u = v->uses;
-       while (u) {
+       for (uselist::iterator I = v->uses.begin(), E = v->uses.end(); I != E; 
++I) {
+               use_info *u = *I;
                if (u->op->parent != &pending) {
-                       u = u->next;
                        continue;
                }
 
@@ -212,6 +211,7 @@ void gcm::td_release_val(value *v) {
                        sblog << "\n";
                );
 
+               assert(uses[u->op] > 0);
                if (--uses[u->op] == 0) {
                        GCM_DUMP(
                                sblog << "td        released : ";
@@ -222,7 +222,6 @@ void gcm::td_release_val(value *v) {
                        pending.remove_node(u->op);
                        ready.push_back(u->op);
                }
-               u = u->next;
        }
 
 }
diff --git a/src/gallium/drivers/r600/sb/sb_ir.cpp 
b/src/gallium/drivers/r600/sb/sb_ir.cpp
index 5226893..d989dce 100644
--- a/src/gallium/drivers/r600/sb/sb_ir.cpp
+++ b/src/gallium/drivers/r600/sb/sb_ir.cpp
@@ -255,7 +255,7 @@ void container_node::expand() {
 void node::remove() {parent->remove_node(this);
 }
 
-value_hash node::hash_src() {
+value_hash node::hash_src() const {
 
        value_hash h = 12345;
 
@@ -269,7 +269,7 @@ value_hash node::hash_src() {
 }
 
 
-value_hash node::hash() {
+value_hash node::hash() const {
 
        if (parent && parent->subtype == NST_LOOP_PHI_CONTAINER)
                return 47451;
diff --git a/src/gallium/drivers/r600/sb/sb_ir.h 
b/src/gallium/drivers/r600/sb/sb_ir.h
index 4fc4da2..74c0549 100644
--- a/src/gallium/drivers/r600/sb/sb_ir.h
+++ b/src/gallium/drivers/r600/sb/sb_ir.h
@@ -446,15 +446,16 @@ enum use_kind {
 };
 
 struct use_info {
-       use_info *next;
        node *op;
        use_kind kind;
        int arg;
 
-       use_info(node *n, use_kind kind, int arg, use_info* next)
-               : next(next), op(n), kind(kind), arg(arg) {}
+       use_info(node *n, use_kind kind, int arg)
+               : op(n), kind(kind), arg(arg) {}
 };
 
+typedef std::list< use_info * > uselist;
+
 enum constraint_kind {
        CK_SAME_REG,
        CK_PACKED_BS,
@@ -498,7 +499,7 @@ public:
        value_hash ghash;
 
        node *def, *adef;
-       use_info *uses;
+       uselist uses;
 
        ra_constraint *constraint;
        ra_chunk *chunk;
@@ -585,6 +586,7 @@ public:
        }
 
        void add_use(node *n, use_kind kind, int arg);
+       void remove_use(const node *n);
 
        value_hash hash();
        value_hash rel_hash();
@@ -790,8 +792,8 @@ public:
        void replace_with(node *n);
        void remove();
 
-       virtual value_hash hash();
-       value_hash hash_src();
+       virtual value_hash hash() const;
+       value_hash hash_src() const;
 
        virtual bool fold_dispatch(expr_handler *ex);
 
diff --git a/src/gallium/drivers/r600/sb/sb_pass.h 
b/src/gallium/drivers/r600/sb/sb_pass.h
index 0346df1..e878f8c 100644
--- a/src/gallium/drivers/r600/sb/sb_pass.h
+++ b/src/gallium/drivers/r600/sb/sb_pass.h
@@ -124,7 +124,9 @@ class dce_cleanup : public vpass {
 public:
 
        dce_cleanup(shader &s) : vpass(s),
-               remove_unused(s.dce_flags & DF_REMOVE_UNUSED) {}
+               remove_unused(s.dce_flags & DF_REMOVE_UNUSED), 
nodes_changed(false) {}
+
+       virtual int run();
 
        virtual bool visit(node &n, bool enter);
        virtual bool visit(alu_group_node &n, bool enter);
@@ -140,6 +142,8 @@ private:
        void cleanup_dst(node &n);
        bool cleanup_dst_vec(vvec &vv);
 
+       // Did we alter/remove nodes during a single pass?
+       bool nodes_changed;
 };
 
 
diff --git a/src/gallium/drivers/r600/sb/sb_valtable.cpp 
b/src/gallium/drivers/r600/sb/sb_valtable.cpp
index eb242b1..a8b7b49 100644
--- a/src/gallium/drivers/r600/sb/sb_valtable.cpp
+++ b/src/gallium/drivers/r600/sb/sb_valtable.cpp
@@ -220,17 +220,33 @@ void value::add_use(node* n, use_kind kind, int arg) {
        dump::dump_op(n);
        sblog << "     kind " << kind << "    arg " << arg << "\n";
        }
-       uses = new use_info(n, kind, arg, uses);
+       uses.push_back(new use_info(n, kind, arg));
 }
 
-unsigned value::use_count() {
-       use_info *u = uses;
-       unsigned c = 0;
-       while (u) {
-               ++c;
-               u = u->next;
+struct use_node_comp {
+       explicit use_node_comp(const node *n) : n(n) {}
+       bool operator() (const use_info *u) {
+               return u->op->hash() == n->hash();
+       }
+
+       private:
+               const node *n;
+};
+
+void value::remove_use(const node *n) {
+       uselist::iterator it =
+               std::find_if(uses.begin(), uses.end(), use_node_comp(n));
+
+       if (it != uses.end())
+       {
+               // TODO assert((*it)->kind == kind) ?
+               // TODO assert((*it)->arg == arg) ?
+               uses.erase(it);
        }
-       return c;
+}
+
+unsigned value::use_count() {
+       return uses.size();
 }
 
 bool value::is_global() {
@@ -274,13 +290,7 @@ bool value::is_prealloc() {
 }
 
 void value::delete_uses() {
-       use_info *u, *c = uses;
-       while (c) {
-               u = c->next;
-               delete c;
-               c = u;
-       }
-       uses = NULL;
+       uses.erase(uses.begin(), uses.end());
 }
 
 void ra_constraint::update_values() {
@@ -468,7 +478,7 @@ bool r600_sb::sb_value_set::add_vec(vvec& vv) {
 bool r600_sb::sb_value_set::contains(value* v) {
        unsigned b = v->uid - 1;
        if (b < bs.size())
-               return bs.get(v->uid - 1);
+               return bs.get(b);
        else
                return false;
 }

commit b9fd9a693b00bf4e0e773d972113a71663885d82
Author: Kenneth Graunke <kenn...@whitecape.org>
Date:   Fri Jan 6 00:09:53 2017 -0800

    i965: Properly flush in hsw_pause_transform_feedback().
    
    Fixes a number of transform feedback tests when run with Linux 4.8,
    which allows us to use the MI_LOAD_REGISTER_REG command, at which point
    we started using this new broken path.
    
    ES3-CTS.functional.transform_feedback.array_element.interleaved.lines.*
    and Piglit's arb_transform_feedback2/draw-auto are both fixed by this
    patch, for example.
    
    Thanks to Chris Wilson for catching this mistake!
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99030
    Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
    Reviewed-by: Anuj Phogat <anuj.pho...@gmail.com>
    (cherry picked from commit 2138347a45fa6dad1934b1c58a9e7d7f53194828)

diff --git a/src/mesa/drivers/dri/i965/hsw_sol.c 
b/src/mesa/drivers/dri/i965/hsw_sol.c
index e299b02..b0dd150 100644
--- a/src/mesa/drivers/dri/i965/hsw_sol.c
+++ b/src/mesa/drivers/dri/i965/hsw_sol.c
@@ -201,6 +201,9 @@ hsw_pause_transform_feedback(struct gl_context *ctx,
       (struct brw_transform_feedback_object *) obj;
 
    if (brw->is_haswell) {
+      /* Flush any drawing so that the counters have the right values. */
+      brw_emit_mi_flush(brw);
+
       /* Save the SOL buffer offset register values. */
       for (int i = 0; i < BRW_MAX_XFB_STREAMS; i++) {
          BEGIN_BATCH(3);

commit 830b1051ab5dbeeaa0ead7f975dcf48d423db35b
Author: Andres Rodriguez <andre...@gmail.com>
Date:   Wed Jan 18 17:48:36 2017 -0500

    radv: fix include order for installed headers v2
    
    In situations where libdrm_amdgpu and mesa are installed to the same
    location, the mesa installed headers will take precedence over the git
    source headers.
    
    This is due to the AMDGPU_CFLAGS containing the install directory.
    
    This situation can cause build errors if the git version of a header is
    newer than the currently installed version of a header (e.g. git pull
    updates vulkan.h)
    
    Note: using the same install prefix for mesa and libdrm is probably a
    common occurrence since it is described in the radeonBuildHowTo wiki:
    https://www.x.org/wiki/radeonBuildHowTo/
    
    v2: added sign-off
    
    Signed-off-by: Andres Rodriguez <andre...@gmail.com>
    Reviewed-by: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl>
    Reviewed-by: Emil Velikov <emil.veli...@collabora.com>
    (cherry picked from commit a3ad6a34c6ba222ec93a2cfd0cac205c62574eb7)
    Nominated-by: Emil Velikov <emil.veli...@collabora.com>

diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am
index c559a95..47cbc4a 100644
--- a/src/amd/vulkan/Makefile.am
+++ b/src/amd/vulkan/Makefile.am
@@ -32,9 +32,6 @@ lib_LTLIBRARIES = libvulkan_radeon.la
 # The gallium includes are for the util/u_math.h include from main/macros.h
 
 AM_CPPFLAGS = \
-       $(AMDGPU_CFLAGS) \
-       $(VALGRIND_CFLAGS) \
-       $(DEFINES) \
        -I$(top_srcdir)/include \
        -I$(top_builddir)/src \
        -I$(top_srcdir)/src \
@@ -48,7 +45,10 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/src/mesa \
        -I$(top_srcdir)/src/mesa/drivers/dri/common \
        -I$(top_srcdir)/src/gallium/auxiliary \
-       -I$(top_srcdir)/src/gallium/include
+       -I$(top_srcdir)/src/gallium/include \
+       $(AMDGPU_CFLAGS) \
+       $(VALGRIND_CFLAGS) \
+       $(DEFINES)
 
 AM_CFLAGS = \
        $(VISIBILITY_CFLAGS) \

commit 15432c29beea8f663e1dee282b82c3299c8f8b93
Author: Andres Rodriguez <andre...@gmail.com>
Date:   Wed Jan 18 18:07:56 2017 -0500

    vulkan/wsi: clarify the severity of lack of DRI3 v2
    
    The current message sounds like a small warning, clarify that it can
    result in lack of presentation support and application crashes.
    
    v2: add "if they do" (Bas)
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98263
    Signed-off-by: Andres Rodriguez <andre...@gmail.com>
    Acked-by: Jason ekstrand <ja...@jlekstrand.net>
    Acked-by: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl>
    Reviewed-by: Emil Velikov <emil.veli...@collabora.com>
    (cherry picked from commit e0674e740bf84085dec898ffd87bdeb2027e620f)
    Nominated-by: Emil Velikov <emil.veli...@collabora.com>

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 351481b..633b1a3 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -265,7 +265,8 @@ VkBool32 wsi_get_physical_device_xcb_presentation_support(
       return false;
 
    if (!wsi_conn->has_dri3) {
-      fprintf(stderr, "vulkan: No DRI3 support\n");
+      fprintf(stderr, "vulkan: No DRI3 support detected - required for 
presentation\n");
+      fprintf(stderr, "Note: Buggy applications may crash, if they do please 
report to vendor\n");
       return false;
    }
 
@@ -313,7 +314,8 @@ x11_surface_get_support(VkIcdSurfaceBase *icd_surface,
       return VK_ERROR_OUT_OF_HOST_MEMORY;
 
    if (!wsi_conn->has_dri3) {

Reply via email to