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

mesa: Changes to 'upstream-unstable'



 SConstruct                                                |    8 
 VERSION                                                   |    2 
 bin/.cherry-ignore                                        |    9 
 docs/relnotes/17.2.2.html                                 |    3 
 docs/relnotes/17.2.3.html                                 |  180 ++++++++++++++
 include/EGL/eglmesaext.h                                  |    1 
 scons/gallium.py                                          |   22 -
 scons/llvm.py                                             |   16 -
 src/SConscript                                            |    2 
 src/amd/common/ac_llvm_build.c                            |    6 
 src/amd/common/ac_nir_to_llvm.c                           |    2 
 src/amd/common/sid.h                                      |    2 
 src/amd/vulkan/radv_formats.c                             |    6 
 src/amd/vulkan/radv_pipeline.c                            |    1 
 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c             |    2 
 src/compiler/glsl/blob.c                                  |   11 
 src/compiler/glsl/blob.h                                  |    6 
 src/compiler/glsl/glsl_to_nir.cpp                         |    2 
 src/compiler/glsl/lower_instructions.cpp                  |  167 ++++++++----
 src/compiler/nir/nir_intrinsics.h                         |    6 
 src/compiler/nir/nir_opcodes.py                           |    2 
 src/compiler/spirv/spirv_to_nir.c                         |    1 
 src/compiler/spirv/vtn_cfg.c                              |    2 
 src/egl/drivers/dri2/platform_wayland.c                   |   68 +++--
 src/egl/wayland/wayland-drm/wayland-drm.c                 |   10 
 src/gallium/auxiliary/gallivm/lp_bld_init.c               |    2 
 src/gallium/auxiliary/gallivm/lp_bld_misc.cpp             |   60 ++++
 src/gallium/auxiliary/util/u_cpu_detect.c                 |   32 +-
 src/gallium/drivers/freedreno/a5xx/fd5_emit.c             |    3 
 src/gallium/drivers/freedreno/freedreno_resource.c        |    6 
 src/gallium/drivers/llvmpipe/SConscript                   |    2 
 src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp |    4 
 src/gallium/drivers/nouveau/nv50/nv50_push.c              |    3 
 src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c     |    9 
 src/gallium/drivers/radeon/r600_pipe_common.c             |   11 
 src/gallium/drivers/radeon/r600_pipe_common.h             |    2 
 src/gallium/drivers/radeon/r600_texture.c                 |    5 
 src/gallium/drivers/radeon/r600_viewport.c                |   21 +
 src/gallium/drivers/radeonsi/si_descriptors.c             |   31 +-
 src/gallium/drivers/radeonsi/si_pipe.h                    |    2 
 src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c         |   25 +
 src/gallium/drivers/radeonsi/si_state.c                   |  125 +++++----
 src/gallium/drivers/radeonsi/si_state_draw.c              |   24 +
 src/gallium/drivers/radeonsi/si_state_shaders.c           |   16 -
 src/gallium/drivers/svga/SConscript                       |    2 
 src/gallium/drivers/swr/SConscript                        |    6 
 src/gallium/drivers/swr/rasterizer/core/utils.h           |    3 
 src/gallium/state_trackers/va/buffer.c                    |   12 
 src/gallium/state_trackers/va/image.c                     |   10 
 src/gallium/state_trackers/vdpau/surface.c                |    2 
 src/gallium/targets/dri/SConscript                        |    2 
 src/intel/compiler/brw_fs_cmod_propagation.cpp            |   25 +
 src/intel/compiler/brw_vec4_cmod_propagation.cpp          |   25 +
 src/intel/compiler/brw_vec4_nir.cpp                       |    9 
 src/intel/vulkan/anv_allocator.c                          |    2 
 src/intel/vulkan/anv_blorp.c                              |    4 
 src/intel/vulkan/anv_cmd_buffer.c                         |   61 +++-
 src/intel/vulkan/anv_private.h                            |    3 
 src/intel/vulkan/genX_cmd_buffer.c                        |    3 
 src/mesa/main/texstate.c                                  |    8 
 src/mesa/state_tracker/st_cb_eglimage.c                   |   96 +++----
 src/mesa/state_tracker/st_format.c                        |    3 
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp                |   33 ++
 src/util/u_queue.c                                        |   13 +
 64 files changed, 904 insertions(+), 338 deletions(-)

New commits:
commit 28dc4b64f2f75dc0a0a98e2b97f1dd3350f50e2d
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Thu Oct 19 13:10:20 2017 +0100

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

diff --git a/docs/relnotes/17.2.3.html b/docs/relnotes/17.2.3.html
new file mode 100644
index 0000000..e1a290b
--- /dev/null
+++ b/docs/relnotes/17.2.3.html
@@ -0,0 +1,180 @@
+<!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 17.2.3 Release Notes / October 19, 2017</h1>
+
+<p>
+Mesa 17.2.3 is a bug fix release which fixes bugs found since the 17.2.2 release.
+</p>
+<p>
+Mesa 17.2.3 implements the OpenGL 4.5 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.5.  OpenGL
+4.5 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=101832";>Bug 101832</a> - [PATCH][regression][bisect] Xorg fails to start after f50aa21456d82c8cb6fbaa565835f1acc1720a5d</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=102852";>Bug 102852</a> - Scons: Support the new Scons 3.0.0</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=102940";>Bug 102940</a> - Regression: Vulkan KMS rendering crashes since 17.2</li>
+
+</ul>
+
+
+<h2>Changes</h2>
+
+<p>Alex Smith (1):</p>
+<ul>
+  <li>radv: Add R16G16B16A16_SNORM fast clear support</li>
+</ul>
+
+<p>Bas Nieuwenhuizen (2):</p>
+<ul>
+  <li>nir/spirv: Allow loop breaks in a switch body.</li>
+  <li>radv: Only set the MTYPE flags on GFX9+.</li>
+</ul>
+
+<p>Ben Crocker (4):</p>
+<ul>
+  <li>gallivm: fix typo in debug_printf message</li>
+  <li>gallivm: allow additional llc options</li>
+  <li>gallivm/ppc64le: adjust VSX code generation control.</li>
+  <li>gallivm/ppc64le: allow environmental control of Altivec code generation</li>
+</ul>
+
+<p>Daniel Stone (2):</p>
+<ul>
+  <li>egl/wayland: Check queryImage return for wl_buffer</li>
+  <li>egl/wayland: Don't use dmabuf with no modifiers</li>
+</ul>
+
+<p>Dave Airlie (2):</p>
+<ul>
+  <li>radv: emit fmuladd instead of fma to llvm.</li>
+  <li>radv: lower ffma in nir.</li>
+</ul>
+
+<p>Emil Velikov (6):</p>
+<ul>
+  <li>cherry-ignore: add "anv: Remove unreachable cases from isl_format_for_size"</li>
+  <li>cherry-ignore: add "anv/wsi: Allocate enough memory for the entire image"</li>
+  <li>swr/rast: do not crash on NULL strings returned by getenv</li>
+  <li>wayland-drm: use a copy of the wayland_drm_callbacks struct</li>
+  <li>eglmesaext: add forward declaration for struct wl_buffers</li>
+  <li>Update version to 17.2.3</li>
+</ul>
+
+<p>Eric Engestrom (1):</p>
+<ul>
+  <li>scons: use python3-compatible print()</li>
+</ul>
+
+<p>Ilia Mirkin (2):</p>
+<ul>
+  <li>nv50/ir: fix 64-bit integer shifts</li>
+  <li>nv50,nvc0: fix push hint logic in presence of a start offset</li>
+</ul>
+
+<p>Jason Ekstrand (6):</p>
+<ul>
+  <li>intel/compiler: Don't cmod propagate into a saturated operation</li>
+  <li>intel/compiler: Don't propagate cmod into integer multiplies</li>
+  <li>glsl/blob: Return false from ensure_can_read on overrun</li>
+  <li>glsl/blob: Return false from grow_to_fit if we've ever failed</li>
+  <li>nir/opcodes: Fix constant-folding of ufind_msb</li>
+  <li>nir: Get rid of the variable on vote intrinsics</li>
+</ul>
+
+<p>Juan A. Suarez Romero (1):</p>
+<ul>
+  <li>docs: add sha256 checksums for 17.2.2</li>
+</ul>
+
+<p>Józef Kucia (3):</p>
+<ul>
+  <li>anv: Fix vkCmdFillBuffer()</li>
+  <li>spirv: Fix SpvOpAtomicISub</li>
+  <li>anv: Do not assert() on VK_ATTACHMENT_UNUSED</li>
+</ul>
+
+<p>Leo Liu (3):</p>
+<ul>
+  <li>st/va: use pipe transfer_map to map upload buffer</li>
+  <li>st/vdpau: don't re-allocate interlaced buffer with packed YUV format</li>
+  <li>st/va: don't re-allocate interlaced buffer with pakced format</li>
+</ul>
+
+<p>Lionel Landwerlin (4):</p>
+<ul>
+  <li>intel: compiler: vec4: add missing default 0 lod</li>
+  <li>anv/cmd_buffer: fix push descriptors with set &gt; 0</li>
+  <li>anv/cmd_buffer: Reset state in cmd_buffer_destroy</li>
+  <li>anv: bo_cache: allow importing a BO larger than needed</li>
+</ul>
+
+<p>Marek Olšák (3):</p>
+<ul>
+  <li>mesa: fix texture updates for ATI_fragment_shader</li>
+  <li>st/mesa: don't use pipe_surface for passing information about EGLImage</li>
+  <li>glsl_to_tgsi: fix instruction order for bindless textures</li>
+</ul>
+
+<p>Nicolai Hähnle (14):</p>
+<ul>
+  <li>st/glsl_to_tgsi: fix conditional assignments to packed shader outputs</li>
+  <li>amd/common: fix build_cube_select</li>
+  <li>radeonsi/gfx9: fix geometry shaders without output vertices</li>
+  <li>util/queue: fix a race condition in the fence code</li>
+  <li>glsl/lower_instruction: handle denorms and overflow in ldexp correctly</li>
+  <li>radeonsi: move current_rast_prim to r600_common_context</li>
+  <li>radeonsi: don't discard points and lines</li>
+  <li>radeonsi: deduce rast_prim correctly for tessellation point mode</li>
+  <li>radeonsi: fix maximum advertised point size / line width</li>
+  <li>st/mesa: don't clobber glGetInternalformat* buffer for GL_NUM_SAMPLE_COUNTS</li>
+  <li>st/glsl_to_tgsi: fix indirect access to 64-bit integer</li>
+  <li>st/glsl_to_tgsi: fix a use-after-free in merge_two_dsts</li>
+  <li>radeonsi: clamp depth comparison value only for fixed point formats</li>
+  <li>radeonsi: clamp border colors for upgraded depth textures</li>
+</ul>
+
+<p>Rob Clark (2):</p>
+<ul>
+  <li>freedreno/a5xx: align height to GMEM</li>
+  <li>freedreno/a5xx: fix missing restore state</li>
+</ul>
+
+
+</div>
+</body>
+</html>

commit ea38f4c33a5babf38c0258f176b2f82a65102314
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Thu Oct 19 13:02:58 2017 +0100

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

diff --git a/VERSION b/VERSION
index d3b2c4f..afbe633 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-17.2.2
+17.2.3

commit 23c08dabc35290857b9903798981464ac4ecd0a4
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Thu Oct 12 11:39:46 2017 +0100

    eglmesaext: add forward declaration for struct wl_buffers
    
    The user does not need to know the specifics of the struct, as only a
    pointer to it is used.
    
    Just forward declare the struct making the header self-contained.
    
    v2: Remove deprecation warning text/bugzilla - patch does no help there.
    
    Cc: Greg V <greg@unrelenting.technology>
    Fixes: 5cddb1ce3c9 ("wayland: Add an extension to create wl_buffers from
    EGLImages")
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
    Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
    (cherry picked from commit 66ebdfbd44cb62c58a7711fb72566f07d801809a)

diff --git a/include/EGL/eglmesaext.h b/include/EGL/eglmesaext.h
index cff1bc6..5bf6306 100644
--- a/include/EGL/eglmesaext.h
+++ b/include/EGL/eglmesaext.h
@@ -70,6 +70,7 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYWAYLANDBUFFERWL) (EGLDisplay dpy, st
 #ifndef EGL_WL_create_wayland_buffer_from_image
 #define EGL_WL_create_wayland_buffer_from_image 1
 
+struct wl_buffer;
 #ifdef EGL_EGLEXT_PROTOTYPES
 EGLAPI struct wl_buffer * EGLAPIENTRY eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImageKHR image);
 #endif

commit dc9bd1dadec8efcccfff3e67708b9f79d073831c
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Wed Sep 27 19:49:11 2017 +0100

    wayland-drm: use a copy of the wayland_drm_callbacks struct
    
    The callbacks may be called even when they are no longer valid.
    Say, the user is dlclose(ing) libEGL while the buffers are being
    destroyed.
    
    Cc: mesa-stable@lists.freedesktop.org
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
    Reviewed-by: Daniel Stone <daniels@collabora.com>
    Tested-by: Derek Foreman <derekf@osg.samsung.com>
    (cherry picked from commit 0cfd6f6cfc9e90c12e4bad17dc47e7ce4cf1b9ac)

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
index 4fc1252..674cd10 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -47,7 +47,7 @@ struct wl_drm {
 	char *device_name;
         uint32_t flags;
 
-	struct wayland_drm_callbacks *callbacks;
+	struct wayland_drm_callbacks callbacks;
 
         struct wl_buffer_interface buffer_interface;
 };
@@ -58,7 +58,7 @@ destroy_buffer(struct wl_resource *resource)
 	struct wl_drm_buffer *buffer = resource->data;
 	struct wl_drm *drm = buffer->drm;
 
-	drm->callbacks->release_buffer(drm->user_data, buffer);
+	drm->callbacks.release_buffer(drm->user_data, buffer);
 	free(buffer);
 }
 
@@ -97,7 +97,7 @@ create_buffer(struct wl_client *client, struct wl_resource *resource,
 	buffer->offset[2] = offset2;
 	buffer->stride[2] = stride2;
 
-        drm->callbacks->reference_buffer(drm->user_data, name, fd, buffer);
+        drm->callbacks.reference_buffer(drm->user_data, name, fd, buffer);
 	if (buffer->driver_buffer == NULL) {
 		wl_resource_post_error(resource,
 				       WL_DRM_ERROR_INVALID_NAME,
@@ -189,7 +189,7 @@ drm_authenticate(struct wl_client *client,
 {
 	struct wl_drm *drm = resource->data;
 
-	if (drm->callbacks->authenticate(drm->user_data, id) < 0)
+	if (drm->callbacks.authenticate(drm->user_data, id) < 0)
 		wl_resource_post_error(resource,
 				       WL_DRM_ERROR_AUTHENTICATE_FAIL,
 				       "authenicate failed");
@@ -270,7 +270,7 @@ wayland_drm_init(struct wl_display *display, char *device_name,
 
 	drm->display = display;
 	drm->device_name = strdup(device_name);
-	drm->callbacks = callbacks;
+	drm->callbacks = *callbacks;
 	drm->user_data = user_data;
         drm->flags = flags;
 

commit d001ff12674b86dcff529d09477ab99cfa122a20
Author: Jason Ekstrand <jason.ekstrand@intel.com>
Date:   Mon Aug 28 17:06:24 2017 -0700

    nir: Get rid of the variable on vote intrinsics
    
    This looks like a copy+paste error.  They don't actually write into that
    variable as would be implied by putting the return there.
    
    Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
    Cc: mesa-stable@lists.freedesktop.org
    (cherry picked from commit 3442c9fc3ebd5de2c9d6c0b9ce541f182809fe82)

diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 4b3dbcf..9f5e92a 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -1158,8 +1158,6 @@ nir_visitor::visit(ir_call *ir)
       case nir_intrinsic_vote_eq: {
          nir_ssa_dest_init(&instr->instr, &instr->dest, 1, 32, NULL);
 
-         instr->variables[0] = evaluate_deref(&instr->instr, ir->return_deref);
-
          ir_rvalue *value = (ir_rvalue *) ir->actual_parameters.get_head();
          instr->src[0] = nir_src_for_ssa(evaluate_rvalue(value));
 
diff --git a/src/compiler/nir/nir_intrinsics.h b/src/compiler/nir/nir_intrinsics.h
index 96ecfbc..70da545 100644
--- a/src/compiler/nir/nir_intrinsics.h
+++ b/src/compiler/nir/nir_intrinsics.h
@@ -121,9 +121,9 @@ BARRIER(memory_barrier_shared)
 INTRINSIC(discard_if, 1, ARR(1), false, 0, 0, 0, xx, xx, xx, 0)
 
 /** ARB_shader_group_vote intrinsics */
-INTRINSIC(vote_any, 1, ARR(1), true, 1, 1, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
-INTRINSIC(vote_all, 1, ARR(1), true, 1, 1, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
-INTRINSIC(vote_eq,  1, ARR(1), true, 1, 1, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
+INTRINSIC(vote_any, 1, ARR(1), true, 1, 0, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
+INTRINSIC(vote_all, 1, ARR(1), true, 1, 0, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
+INTRINSIC(vote_eq,  1, ARR(1), true, 1, 0, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
 
 /**
  * Basic Geometry Shader intrinsics.

commit 88a16c895b3be95ba50887eaba27f69a3602b649
Author: Jason Ekstrand <jason.ekstrand@intel.com>
Date:   Mon Aug 28 15:05:11 2017 -0700

    nir/opcodes: Fix constant-folding of ufind_msb
    
    We didn't fold correctly in the case of 0x1 because we never let the
    loop counter hit 0.  Switching it to bit >= 0 solves this problem.
    
    Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
    Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
    Cc: mesa-stable@lists.freedesktop.org
    (cherry picked from commit a0947921eb01f4c037de28b753fc10f86a25fc65)

diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index 39c01a7..a64a28e 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -308,7 +308,7 @@ for (unsigned bit = 0; bit < 32; bit++) {
 
 unop_convert("ufind_msb", tint32, tuint32, """
 dst = -1;
-for (int bit = 31; bit > 0; bit--) {
+for (int bit = 31; bit >= 0; bit--) {
    if ((src0 >> bit) & 1) {
       dst = bit;
       break;

commit b640bf38ca68d8e451f5de8c03a092b6ccc6a66b
Author: Jason Ekstrand <jason.ekstrand@intel.com>
Date:   Wed Oct 11 13:32:45 2017 -0700

    glsl/blob: Return false from grow_to_fit if we've ever failed
    
    Otherwise we could have a failure followed by a smaller write that
    succeeds and get a corrupted blob.  If we ever OOM, we should stop.
    
    v2 (Jason Ekstrand):
     - Initialize the new boolean member in create_blob
    
    Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
    Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
    Cc: mesa-stable@lists.freedesktop.org
    (cherry picked from commit e03717efbd9493f91624bca86d730ef9abfdb324)

diff --git a/src/compiler/glsl/blob.c b/src/compiler/glsl/blob.c
index e837cdf..65e1376 100644
--- a/src/compiler/glsl/blob.c
+++ b/src/compiler/glsl/blob.c
@@ -46,6 +46,9 @@ grow_to_fit(struct blob *blob, size_t additional)
    size_t to_allocate;
    uint8_t *new_data;
 
+   if (blob->out_of_memory)
+      return false;
+
    if (blob->size + additional <= blob->allocated)
       return true;
 
@@ -57,8 +60,10 @@ grow_to_fit(struct blob *blob, size_t additional)
    to_allocate = MAX2(to_allocate, blob->allocated + additional);
 
    new_data = realloc(blob->data, to_allocate);
-   if (new_data == NULL)
+   if (new_data == NULL) {
+      blob->out_of_memory = true;
       return false;
+   }
 
    blob->data = new_data;
    blob->allocated = to_allocate;
@@ -104,6 +109,7 @@ blob_create()
    blob->data = NULL;
    blob->allocated = 0;
    blob->size = 0;
+   blob->out_of_memory = false;
 
    return blob;
 }
diff --git a/src/compiler/glsl/blob.h b/src/compiler/glsl/blob.h
index 940c81e..4cbbb01 100644
--- a/src/compiler/glsl/blob.h
+++ b/src/compiler/glsl/blob.h
@@ -55,6 +55,12 @@ struct blob {
 
    /** The number of bytes that have actual data written to them. */
    size_t size;
+
+   /**
+    * True if we've ever failed to realloc or if we go pas the end of a fixed
+    * allocation blob.
+    */
+   bool out_of_memory;
 };
 
 /* When done reading, the caller can ensure that everything was consumed by

commit 4d1ae3283c1ecb31e9c06723da735dfc7435e2e2
Author: Jason Ekstrand <jason.ekstrand@intel.com>
Date:   Wed Oct 11 10:56:48 2017 -0700

    glsl/blob: Return false from ensure_can_read on overrun
    
    Otherwise, if you have a large read fail and then try to do a small
    read, the small read may succeed even though it's at the wrong offset.
    
    Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
    Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
    Cc: mesa-stable@lists.freedesktop.org
    (cherry picked from commit 7118851374074bd92887bfabd47ce39c9be412fd)

diff --git a/src/compiler/glsl/blob.c b/src/compiler/glsl/blob.c
index 3c4aed8..e837cdf 100644
--- a/src/compiler/glsl/blob.c
+++ b/src/compiler/glsl/blob.c
@@ -207,6 +207,9 @@ blob_reader_init(struct blob_reader *blob, uint8_t *data, size_t size)
 static bool
 ensure_can_read(struct blob_reader *blob, size_t size)
 {
+   if (blob->overrun)
+      return false;
+
    if (blob->current < blob->end && blob->end - blob->current >= size)
       return true;
 

commit d56aa9fe43cd0fa30b1aa92f534fe9e676a9a59e
Author: Eric Engestrom <eric.engestrom@imgtec.com>
Date:   Tue Sep 19 13:56:34 2017 +0100

    scons: use python3-compatible print()
    
    These changes were generated using python's `2to3` tool.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102852
    Reported-by: Alex Granni <liviuprodea@yahoo.com>
    Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
    Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
    (cherry picked from commit 7d48219b3ac78895315ea6cef3ced3e55d3d92f0)

diff --git a/SConstruct b/SConstruct
index 696718c..0215aa8 100644
--- a/SConstruct
+++ b/SConstruct
@@ -50,10 +50,10 @@ except KeyError:
     pass
 else:
     targets = targets.split(',')
-    print 'scons: warning: targets option is deprecated; pass the targets on their own such as'
-    print
-    print '  scons %s' % ' '.join(targets)
-    print
+    print('scons: warning: targets option is deprecated; pass the targets on their own such as')
+    print()
+    print('  scons %s' % ' '.join(targets))
+    print()
     COMMAND_LINE_TARGETS.append(targets)
 
 
diff --git a/scons/gallium.py b/scons/gallium.py
index 1e35ef4..e394bf8 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -257,16 +257,16 @@ def generate(env):
     # Backwards compatability with the debug= profile= options
     if env['build'] == 'debug':
         if not env['debug']:
-            print 'scons: warning: debug option is deprecated and will be removed eventually; use instead'
-            print
-            print ' scons build=release'
-            print
+            print('scons: warning: debug option is deprecated and will be removed eventually; use instead')
+            print('')
+            print(' scons build=release')
+            print('')
             env['build'] = 'release'
         if env['profile']:
-            print 'scons: warning: profile option is deprecated and will be removed eventually; use instead'
-            print
-            print ' scons build=profile'
-            print
+            print('scons: warning: profile option is deprecated and will be removed eventually; use instead')
+            print('')
+            print(' scons build=profile')
+            print('')
             env['build'] = 'profile'
     if False:
         # Enforce SConscripts to use the new build variable
@@ -300,7 +300,7 @@ def generate(env):
     env['build_dir'] = build_dir
     env.SConsignFile(os.path.join(build_dir, '.sconsign'))
     if 'SCONS_CACHE_DIR' in os.environ:
-        print 'scons: Using build cache in %s.' % (os.environ['SCONS_CACHE_DIR'],)
+        print('scons: Using build cache in %s.' % (os.environ['SCONS_CACHE_DIR'],))
         env.CacheDir(os.environ['SCONS_CACHE_DIR'])
     env['CONFIGUREDIR'] = os.path.join(build_dir, 'conf')
     env['CONFIGURELOG'] = os.path.join(os.path.abspath(build_dir), 'config.log')
@@ -385,8 +385,8 @@ def generate(env):
     if env['embedded']:
         cppdefines += ['PIPE_SUBSYSTEM_EMBEDDED']
     if env['texture_float']:
-        print 'warning: Floating-point textures enabled.'
-        print 'warning: Please consult docs/patents.txt with your lawyer before building Mesa.'
+        print('warning: Floating-point textures enabled.')
+        print('warning: Please consult docs/patents.txt with your lawyer before building Mesa.')
         cppdefines += ['TEXTURE_FLOAT_ENABLED']
     env.Append(CPPDEFINES = cppdefines)
 
diff --git a/scons/llvm.py b/scons/llvm.py
index d6a2168..eaa2ecb 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -68,13 +68,13 @@ def generate(env):
     if env['platform'] == 'windows':
         # XXX: There is no llvm-config on Windows, so assume a standard layout
         if llvm_dir is None:
-            print 'scons: LLVM environment variable must be specified when building for windows'
+            print('scons: LLVM environment variable must be specified when building for windows')
             return
 
         # Try to determine the LLVM version from llvm/Config/config.h
         llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/llvm-config.h')
         if not os.path.exists(llvm_config):
-            print 'scons: could not find %s' % llvm_config
+            print('scons: could not find %s' % llvm_config)
             return
         llvm_version_major_re = re.compile(r'^#define LLVM_VERSION_MAJOR ([0-9]+)')
         llvm_version_minor_re = re.compile(r'^#define LLVM_VERSION_MINOR ([0-9]+)')
@@ -92,10 +92,10 @@ def generate(env):
             llvm_version = distutils.version.LooseVersion('%s.%s' % (llvm_version_major, llvm_version_minor))
 
         if llvm_version is None:
-            print 'scons: could not determine the LLVM version from %s' % llvm_config
+            print('scons: could not determine the LLVM version from %s' % llvm_config)
             return
         if llvm_version < distutils.version.LooseVersion(required_llvm_version):
-            print 'scons: LLVM version %s found, but %s is required' % (llvm_version, required_llvm_version)
+            print('scons: LLVM version %s found, but %s is required' % (llvm_version, required_llvm_version))
             return
 
         env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
@@ -231,14 +231,14 @@ def generate(env):
     else:
         llvm_config = os.environ.get('LLVM_CONFIG', 'llvm-config')
         if not env.Detect(llvm_config):
-            print 'scons: %s script not found' % llvm_config
+            print('scons: %s script not found' % llvm_config)
             return
 
         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):
-            print 'scons: LLVM version %s found, but %s is required' % (llvm_version, required_llvm_version)
+            print('scons: LLVM version %s found, but %s is required' % (llvm_version, required_llvm_version))
             return
 
         try:
@@ -264,13 +264,13 @@ def generate(env):
                 env.ParseConfig('%s --system-libs' % llvm_config)
                 env.Append(CXXFLAGS = ['-std=c++11'])
         except OSError:
-            print 'scons: llvm-config version %s failed' % llvm_version
+            print('scons: llvm-config version %s failed' % llvm_version)
             return
 
     assert llvm_version is not None
     env['llvm'] = True
 
-    print 'scons: Found LLVM version %s' % llvm_version
+    print('scons: Found LLVM version %s' % llvm_version)
     env['LLVM_VERSION'] = llvm_version
 
     # Define HAVE_LLVM macro with the major/minor version number (e.g., 0x0206 for 2.6)
diff --git a/src/SConscript b/src/SConscript
index 37b3f85..5e84398 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -28,7 +28,7 @@ def write_git_sha1_h_file(filename):
         try:
             subprocess.Popen(args, stdout=f).wait()
         except:
-            print "Warning: exception in write_git_sha1_h_file()"
+            print("Warning: exception in write_git_sha1_h_file()")
             return
 
     if not os.path.exists(filename) or not filecmp.cmp(tempfile, filename):
diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript
index fbbd22a..74d7a9e 100644
--- a/src/gallium/drivers/llvmpipe/SConscript
+++ b/src/gallium/drivers/llvmpipe/SConscript
@@ -4,7 +4,7 @@ import distutils.version
 Import('*')
 
 if not env['llvm']:
-    print 'warning: LLVM disabled: not building llvmpipe'
+    print('warning: LLVM disabled: not building llvmpipe')
     Return()
 
 env = env.Clone()
diff --git a/src/gallium/drivers/svga/SConscript b/src/gallium/drivers/svga/SConscript
index 2d60ceb..9c4806c 100644
--- a/src/gallium/drivers/svga/SConscript
+++ b/src/gallium/drivers/svga/SConscript
@@ -5,7 +5,7 @@ env = env.Clone()
 env.MSVC2013Compat()
 
 if env['suncc']:
-	print 'warning: not building svga'
+	print('warning: not building svga')
 	Return()
 
 env.Append(CPPDEFINES = [
diff --git a/src/gallium/drivers/swr/SConscript b/src/gallium/drivers/swr/SConscript
index c578d7a..b40830b 100644
--- a/src/gallium/drivers/swr/SConscript
+++ b/src/gallium/drivers/swr/SConscript
@@ -8,12 +8,12 @@ if not env['swr']:
     Return()
 
 if not env['llvm']:
-    print 'warning: LLVM disabled: not building swr'
+    print('warning: LLVM disabled: not building swr')
     env['swr'] = False
     Return()
 
 if env['LLVM_VERSION'] < distutils.version.LooseVersion('3.9'):
-    print "warning: swr requires LLVM >= 3.9: not building swr"
+    print("warning: swr requires LLVM >= 3.9: not building swr")
     env['swr'] = False
     Return()
 
@@ -28,7 +28,7 @@ if env['platform'] == 'windows':
 else:
     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
+    print("llvm include dir %s" % llvm_includedir)
 
 if not env['msvc'] :
     env.Append(CCFLAGS = [
diff --git a/src/gallium/targets/dri/SConscript b/src/gallium/targets/dri/SConscript
index d7a8cbd..f5c2818 100644
--- a/src/gallium/targets/dri/SConscript
+++ b/src/gallium/targets/dri/SConscript
@@ -3,7 +3,7 @@ Import('*')
 env = drienv.Clone()
 
 if env['suncc']:
-    print 'warning: not building dri-vmwgfx'
+    print('warning: not building dri-vmwgfx')
     Return()
 
 env.Append(CPPPATH = [

commit 3b657e4ff537a03ec99ad27dba36e31aa2fccf57
Author: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Date:   Sun Oct 8 21:58:23 2017 +0200

    radv: Only set the MTYPE flags on GFX9+.
    
    Older kernels fail the va_op with this flag set. If the kernel
    supports GFX9 usefully, it will also support this flag.
    
    Fixes: e8d57802fea "radv/gfx9: allocate events from uncached VA space"
    Reviewed-by: Dave Airlie <airlied@redhat.com>
    (cherry picked from commit 96f80c8d4d97771b5450d6d15ddb3b172c7d69cf)

diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
index 1c56c55..0e587f5 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
@@ -342,7 +342,7 @@ radv_amdgpu_winsys_bo_create(struct radeon_winsys *_ws,
 
 
 	uint32_t va_flags = 0;
-	if (flags & RADEON_FLAG_VA_UNCACHED)
+	if ((flags & RADEON_FLAG_VA_UNCACHED) && ws->info.chip_class >= GFX9)
 		va_flags |= AMDGPU_VM_MTYPE_UC;
 	r = radv_amdgpu_bo_va_op(ws->dev, buf_handle, 0, size, va, va_flags, AMDGPU_VA_OP_MAP);
 	if (r)

commit 99d3661bce9362ad106e606f2e3cd8c51fd89595
Author: Daniel Stone <daniels@collabora.com>
Date:   Mon Oct 2 16:40:53 2017 +0100

    egl/wayland: Don't use dmabuf with no modifiers
    
    The dmabuf interface requires a valid modifier to be sent. If we don't
    explicitly get a modifier from the driver, we can't know what to send;
    it must be inferred from legacy side-channels (or assumed to linear, if
    none exists).
    
    If we have no modifier, then we can only have a single-plane format
    anyway, so fall back to the old wl_drm buffer import path.
    
    Fixes: a65db0ad1c ("st/dri: don't expose modifiers in EGL if the driver doesn't implement them")
    Fixes: 02cc359372 ("egl/wayland: Use linux-dmabuf interface for buffers")
    Signed-off-by: Daniel Stone <daniels@collabora.com>
    Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
    Reported-by: Andy Furniss <adf.lists@gmail.com>
    Cc: Marek Olšák <marek.olsak@amd.com>
    (cherry picked from commit b65d6dafd602813c56ccc59a5d8ddb473fddfd74)

diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index af19d8c..b4b412c 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -720,6 +720,7 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
    struct wl_buffer *ret;
    EGLBoolean query;
    int width, height, fourcc, num_planes;
+   uint64_t modifier = DRM_FORMAT_MOD_INVALID;
 
    query = dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_WIDTH, &width);
    query &= dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_HEIGHT,
@@ -734,10 +735,8 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
    if (!query)
       num_planes = 1;
 
-   if (dri2_dpy->wl_dmabuf && dri2_dpy->image->base.version >= 15) {
-      struct zwp_linux_buffer_params_v1 *params;
+   if (dri2_dpy->image->base.version >= 15) {
       int mod_hi, mod_lo;
-      int i;
 
       query = dri2_dpy->image->queryImage(image,
                                           __DRI_IMAGE_ATTRIB_MODIFIER_UPPER,
@@ -745,10 +744,15 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
       query &= dri2_dpy->image->queryImage(image,
                                            __DRI_IMAGE_ATTRIB_MODIFIER_LOWER,
                                            &mod_lo);
-      if (!query) {
-         mod_hi = DRM_FORMAT_MOD_INVALID >> 32;
-         mod_lo = DRM_FORMAT_MOD_INVALID & 0xffffffff;
+      if (query) {
+         modifier = (uint64_t) mod_hi << 32;
+         modifier |= (uint64_t) (mod_lo & 0xffffffff);
       }
+   }
+
+   if (dri2_dpy->wl_dmabuf && modifier != DRM_FORMAT_MOD_INVALID) {
+      struct zwp_linux_buffer_params_v1 *params;
+      int i;
 
       /* We don't need a wrapper for wl_dmabuf objects, because we have to
        * create the intermediate params object; we can set the queue on this,
@@ -791,7 +795,7 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
          }
 
          zwp_linux_buffer_params_v1_add(params, fd, i, offset, stride,
-                                        mod_hi, mod_lo);
+                                        modifier >> 32, modifier & 0xffffffff);
          close(fd);
       }
 

commit 0f6e89dfe0ca779b2ff90a9a5bde66d668fe6b2b
Author: Daniel Stone <daniels@collabora.com>
Date:   Mon Oct 2 16:40:53 2017 +0100

    egl/wayland: Check queryImage return for wl_buffer
    
    When creating a wl_buffer from a DRIImage, we extract all the DRIImage
    information via queryImage. Check whether or not it actually succeeds,
    either bailing out if the query was critical, or providing sensible
    fallbacks for information which was not available in older DRIImage
    versions.
    
    Fixes: a65db0ad1c ("st/dri: don't expose modifiers in EGL if the driver doesn't implement them")
    Fixes: 02cc359372 ("egl/wayland: Use linux-dmabuf interface for buffers")
    Signed-off-by: Daniel Stone <daniels@collabora.com>
    Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
    Reported-by: Andy Furniss <adf.lists@gmail.com>
    Cc: Marek Olšák <marek.olsak@amd.com>
    (cherry picked from commit 6273d2f2693c365ac84e8808577d16698a6ae46a)

diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 8d81364..af19d8c 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -718,23 +718,37 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
                  __DRIimage *image)
 {
    struct wl_buffer *ret;
+   EGLBoolean query;
    int width, height, fourcc, num_planes;
 
-   dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_WIDTH, &width);
-   dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_HEIGHT, &height);
-   dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FOURCC, &fourcc);
-   dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_NUM_PLANES,
-                               &num_planes);
+   query = dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_WIDTH, &width);
+   query &= dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_HEIGHT,
+                                        &height);
+   query &= dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FOURCC,
+                                        &fourcc);
+   if (!query)
+      return NULL;
+
+   query = dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_NUM_PLANES,
+                                       &num_planes);
+   if (!query)
+      num_planes = 1;
 
    if (dri2_dpy->wl_dmabuf && dri2_dpy->image->base.version >= 15) {
       struct zwp_linux_buffer_params_v1 *params;
       int mod_hi, mod_lo;
       int i;
 
-      dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_MODIFIER_UPPER,
-                                  &mod_hi);
-      dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_MODIFIER_LOWER,
-                                  &mod_lo);
+      query = dri2_dpy->image->queryImage(image,
+                                          __DRI_IMAGE_ATTRIB_MODIFIER_UPPER,
+                                          &mod_hi);
+      query &= dri2_dpy->image->queryImage(image,
+                                           __DRI_IMAGE_ATTRIB_MODIFIER_LOWER,
+                                           &mod_lo);
+      if (!query) {
+         mod_hi = DRM_FORMAT_MOD_INVALID >> 32;
+         mod_lo = DRM_FORMAT_MOD_INVALID & 0xffffffff;
+      }
 
       /* We don't need a wrapper for wl_dmabuf objects, because we have to
        * create the intermediate params object; we can set the queue on this,
@@ -745,7 +759,8 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
 
       for (i = 0; i < num_planes; i++) {
          __DRIimage *p_image;
-         int stride, offset, fd;
+         int stride, offset;
+         int fd = -1;
 
          if (i == 0)
             p_image = image;
@@ -756,14 +771,25 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
             return NULL;
          }
 
-         dri2_dpy->image->queryImage(p_image, __DRI_IMAGE_ATTRIB_FD, &fd);
-         dri2_dpy->image->queryImage(p_image, __DRI_IMAGE_ATTRIB_STRIDE,
-                                     &stride);
-         dri2_dpy->image->queryImage(p_image, __DRI_IMAGE_ATTRIB_OFFSET,
-                                     &offset);
+         query = dri2_dpy->image->queryImage(p_image,
+                                             __DRI_IMAGE_ATTRIB_FD,
+                                             &fd);
+         query &= dri2_dpy->image->queryImage(p_image,
+                                              __DRI_IMAGE_ATTRIB_STRIDE,
+                                              &stride);
+         query &= dri2_dpy->image->queryImage(p_image,
+                                              __DRI_IMAGE_ATTRIB_OFFSET,
+                                              &offset);
          if (image != p_image)
             dri2_dpy->image->destroyImage(p_image);
 
+         if (!query) {
+            if (fd >= 0)
+               close(fd);
+            zwp_linux_buffer_params_v1_destroy(params);
+            return NULL;
+         }
+
          zwp_linux_buffer_params_v1_add(params, fd, i, offset, stride,
                                         mod_hi, mod_lo);
          close(fd);

commit bee97ec32ebc805d4b3c05b079d300d50903bae6
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Mon Sep 18 11:29:21 2017 +0100

    swr/rast: do not crash on NULL strings returned by getenv
    
    The current convenience function GetEnv feeds the results of getenv
    directly into std::string(). That is a bad idea, since the variable
    may be unset, thus we feed NULL into the C++ construct.


Reply to: