OSDN Git Service

android-x86/external-mesa.git
7 years agoRevert "android: disable asm temporarily" android-x86-6.0-r2
Chih-Wei Huang [Fri, 13 Jan 2017 13:29:21 +0000 (21:29 +0800)]
Revert "android: disable asm temporarily"

This reverts commit 6c1c7ac07e507b7a9b331edd049fb0edb2205cc6.

7 years agoMerge remote-tracking branch 'mesa/13.0' into nougat-x86
Chih-Wei Huang [Sun, 8 Jan 2017 16:30:27 +0000 (00:30 +0800)]
Merge remote-tracking branch 'mesa/13.0' into nougat-x86

7 years agodocs: add sha256 checksums for 13.0.3
Emil Velikov [Thu, 5 Jan 2017 15:59:07 +0000 (15:59 +0000)]
docs: add sha256 checksums for 13.0.3

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: add release notes for 13.0.3
Emil Velikov [Sat, 24 Dec 2016 10:06:50 +0000 (10:06 +0000)]
docs: add release notes for 13.0.3

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoUpdate version to 13.0.3
Emil Velikov [Sat, 24 Dec 2016 10:00:26 +0000 (10:00 +0000)]
Update version to 13.0.3

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoglsl: Add pthread libs to cache_test
Rhys Kidd [Wed, 26 Oct 2016 04:13:24 +0000 (00:13 -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)

7 years agoi965/fs: Reject copy propagation into SEL if not min/max.
Matt Turner [Mon, 28 Nov 2016 23:21:51 +0000 (15:21 -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)

7 years agoi965/fs: Add unit tests for copy propagation pass.
Matt Turner [Mon, 28 Nov 2016 18:48:53 +0000 (10:48 -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>
7 years agoi965/fs: Rename opt_copy_propagate -> opt_copy_propagation.
Matt Turner [Mon, 28 Nov 2016 18:45:08 +0000 (10:45 -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)

7 years agoRevert "nir: Turn imov/fmov of undef into undef."
Timothy Arceri [Thu, 15 Dec 2016 05:51:13 +0000 (16:51 +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)

7 years agoegl: Fix crashes in eglCreate*Surface()
Chad Versace [Tue, 13 Dec 2016 22:23:55 +0000 (14:23 -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)

7 years agomesa/fbobject: Update CubeMapFace when reusing textures
Nanley Chery [Wed, 16 Nov 2016 00:42:23 +0000 (16:42 -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)

7 years agospirv: Use a simpler and more correct implementaiton of tanh()
Jason Ekstrand [Fri, 9 Dec 2016 17:34:50 +0000 (09:34 -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)

7 years agocompiler/glsl: fix precision problem of tanh
Haixia Shi [Fri, 9 Dec 2016 01:41:02 +0000 (17:41 -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)

7 years agoanv/descriptor_set: Write the state offset in the surface state free list.
Jason Ekstrand [Fri, 11 Nov 2016 00:43:35 +0000 (16:43 -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)

7 years agoanv/device: Implicitly unmap memory objects in FreeMemory
Jason Ekstrand [Tue, 8 Nov 2016 01:25:07 +0000 (17:25 -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)

7 years agoanv/device: Return the right error for failed maps
Jason Ekstrand [Tue, 8 Nov 2016 01:24:24 +0000 (17:24 -0800)]
anv/device: Return the right error for failed maps

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 920f34a2d9f14f023aee5203baa110c971519ee8)

7 years agoradeonsi: fix an off-by-one error in the bounds check for max_vertices
Nicolai Hähnle [Tue, 6 Dec 2016 20:03:03 +0000 (21:03 +0100)]
radeonsi: fix an off-by-one error in the bounds check for max_vertices

The spec actually says that calling EmitStreamVertex is undefined when
you exceed max_vertices. But we do need to avoid trampling over memory
outside the GSVS ring.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 88509518b01d7c1d7436a790bf9be5cf3c41a528)

7 years agoradeonsi: do not kill GS with memory writes
Nicolai Hähnle [Tue, 29 Nov 2016 15:33:31 +0000 (16:33 +0100)]
radeonsi: do not kill GS with memory writes

Vertex emits beyond the specified maximum number of vertices are supposed to
have no effect, which is why we used to always kill GS that reached the limit.

However, if the GS also writes to memory (SSBO, atomics, shader images), then
we must keep going and only skip the vertex emit itself.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 7655bccce80c9690ecb850304d15238ef1e0d622)

7 years agoradeonsi: update all GSVS ring descriptors for new buffer allocations
Nicolai Hähnle [Mon, 28 Nov 2016 19:30:41 +0000 (20:30 +0100)]
radeonsi: update all GSVS ring descriptors for new buffer allocations

Fixes GL45-CTS.gtf40.GL3Tests.transform_feedback3.transform_feedback3_geometry_instanced.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 7b5b3d63c5f33bbd49f4b11c282603baa9371c10)

7 years agoi965/mt: Disable aux surfaces after making miptree shareable
Chad Versace [Sat, 10 Dec 2016 00:18:11 +0000 (16:18 -0800)]
i965/mt: Disable aux surfaces after making miptree shareable

The entire goal of intel_miptree_make_shareable() is to permanently
disable the miptree's aux surfaces. So set
intel_mipmap_tree:disable_aux_buffers after the function's done with
discarding down the aux surfaces.

References: https://bugs.freedesktop.org/show_bug.cgi?id=98329
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Nanley Chery <nanley.g.chery@intel.com
Cc: Haixia Shi <hshi@chromium.org>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 1c8be049bea786c2c054a770025976beba5b8636)

7 years agoradv: add missing license file to radv_meta_bufimage.
Dave Airlie [Wed, 30 Nov 2016 01:51:19 +0000 (01:51 +0000)]
radv: add missing license file to radv_meta_bufimage.

Just noticed this file was missing license and any
explaination of what is in it.

(stable just for license header reasons)
Reviewed by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 2a33049c70020d4a6587ff3774c86575877af371)

7 years agoradeonsi: disable the constant engine (CE) on Carrizo and Stoney
Marek Olšák [Wed, 7 Dec 2016 22:01:56 +0000 (23:01 +0100)]
radeonsi: disable the constant engine (CE) on Carrizo and Stoney

It must be disabled until the kernel bug is fixed, and then we'll enable CE
based on the DRM version.

Cc: 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 31f988a9d6d05f4aaea4d0455e509a5f6b667d9c)

7 years agoradeonsi: wait for outstanding LDS instructions in memory barriers if needed
Marek Olšák [Fri, 2 Dec 2016 18:40:40 +0000 (19:40 +0100)]
radeonsi: wait for outstanding LDS instructions in memory barriers if needed

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 13c34cf8ca43d0f9c1e1a663e6a3783b0938dfd9)

7 years agotgsi: fix the src type of TGSI_OPCODE_MEMBAR
Marek Olšák [Fri, 2 Dec 2016 18:17:52 +0000 (19:17 +0100)]
tgsi: fix the src type of TGSI_OPCODE_MEMBAR

It's a literal integer. The next commit will need this.

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 16ba04d6deea4f89cbaec00a001d5c2ac841692b)

7 years agoradeonsi: wait for outstanding memory instructions in TCS barriers
Marek Olšák [Fri, 2 Dec 2016 18:10:11 +0000 (19:10 +0100)]
radeonsi: wait for outstanding memory instructions in TCS barriers

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 16f49c16c79a67f174b92672d546f909425f7fc3)

7 years agoradeonsi: allow specifying simm16 of emit_waitcnt at call sites
Marek Olšák [Fri, 2 Dec 2016 17:56:21 +0000 (18:56 +0100)]
radeonsi: allow specifying simm16 of emit_waitcnt at call sites

The next commit will use this.

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 15e96c70b0b668a2626326d3572a247e41885c18)

7 years agoradeonsi: fix incorrect FMASK checking in bind_sampler_states
Marek Olšák [Fri, 2 Dec 2016 01:57:30 +0000 (02:57 +0100)]
radeonsi: fix incorrect FMASK checking in bind_sampler_states

Cc: 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 38d4859b9465146189c234cd372de9d3eee86a92)

7 years agoradeonsi: always restore sampler states when unbinding sampler views
Marek Olšák [Fri, 2 Dec 2016 01:18:25 +0000 (02:18 +0100)]
radeonsi: always restore sampler states when unbinding sampler views

Cc: 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit b3a2aa9cba46bd6c8de22390b3b1ce9ac6c27988)

7 years agocso: don't release sampler states that are bound
Marek Olšák [Fri, 2 Dec 2016 14:39:25 +0000 (15:39 +0100)]
cso: don't release sampler states that are bound

This fixes random radeonsi GPU hangs in Batman Arkham: Origins (Wine) and
probably many other games too.

cso_cache deletes sampler states when the cache size is too big and doesn't
check which sampler states are bound, causing use-after-free in drivers.
Because of that, radeonsi uploaded garbage sampler states and the hardware
went bananas. Other drivers may have experienced similar issues.

Cc: 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
(cherry picked from commit 6dc96de303290e8d1fc294da478c4f370be98dea)

7 years agoradeonsi: fix isolines tess factor writes to control ring
Nicolai Hähnle [Mon, 5 Dec 2016 13:39:50 +0000 (14:39 +0100)]
radeonsi: fix isolines tess factor writes to control ring

Fixes piglit arb_tessellation_shader/execution/isoline{_no_tcs}.shader_test.

Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit d3931a355fd5d309d5bcfe2655249f029e84d355)
[Emil Velikov: there is no si_shader_key::part in branch]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agogenxml/gen9: Change the default of MI_SEMAPHORE_WAIT::RegisterPoleMode
Jason Ekstrand [Tue, 6 Dec 2016 06:09:35 +0000 (22:09 -0800)]
genxml/gen9: Change the default of MI_SEMAPHORE_WAIT::RegisterPoleMode

We would really like it to be false as that's what you get on hardware that
doesn't have RegisterPoleMode (Sky Lake for example).  While we're at it,
we change it to a boolean.  This fixes dEQP-VK.synchronization.smoke.events
on Broxton.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit eb7b51d62ae541ff351b4335c6d2f2e1a3a8bbce)

7 years agoi965: Allocate at least some URB space even when max_vertices = 0.
Kenneth Graunke [Sat, 15 Oct 2016 00:59:36 +0000 (17:59 -0700)]
i965: Allocate at least some URB space even when max_vertices = 0.

Allocating zero URB space is a really bad idea.  The hardware has to
give threads a handle to their URB space, and threads have to use that
to terminate the thread.  Having it be an empty region just breaks a
lot of assumptions.  Hence, why we asserted that it isn't possible.

Unfortunately, it /is/ possible prior to Gen8, if max_vertices = 0.
In theory a geometry shader could do SSBO/image access and maybe
still accomplish something.  In reality, this is tripped up by
conformance tests.

Gen8+ already avoids this problem by placing the vertex count DWord
in the URB entry header.  This fixes things on earlier generations.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit a41f5dcb141a11ca5ca0c765c305027b0f0b609e)

7 years agoradv: fix another regression since shadow fixes.
Dave Airlie [Mon, 5 Dec 2016 00:13:49 +0000 (10:13 +1000)]
radv: fix another regression since shadow fixes.

This fixes:
dEQP-VK.glsl.texture_gather.basic.2d.depth32f.*

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 8033f78f94c7c6349e1c6a4d63fe3accb34b36f1)

7 years agomesa: only verify that enabled arrays have backing buffers
Ilia Mirkin [Wed, 30 Nov 2016 22:04:06 +0000 (17:04 -0500)]
mesa: only verify that enabled arrays have backing buffers

We were previously also verifying that no backing buffers were available
when an array wasn't enabled. This is has no basis in the spec, and it
causes GLupeN64 to fail as a result.

Fixes: c2e146f487 ("mesa: error out in indirect draw when vertex bindings mismatch")
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
(cherry picked from commit 7c16552f8dcc869b14cf7ef443a1b5de83b07973)

7 years agovc4: In a loop break/continue, jump if everyone has taken the path.
Eric Anholt [Thu, 1 Dec 2016 01:27:37 +0000 (17:27 -0800)]
vc4: In a loop break/continue, jump if everyone has taken the path.

This should be a win for most loops, which tend to have uniform control
flow.

More importantly, it exposes important information to live variables: that
the break/continue here means that our jump target may have access to
values that were live on our input.  Previously, we were just setting the
exec mask and letting control flow fall through, so an intervening def
between the break and the end of the loop would appear to live variables
as if it screened off the variable, when it didn't actually.

Fixes a regression in glsl-vs-loop-redundant-condition.shader_test when a
perturbing of register allocation caused a live variable to get stomped.

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 8e5ec33f1151dd82402bdfdaa4fff7c284e49a1c)

7 years agoradeonsi: apply the double EVENT_WRITE_EOP workaround to VI as well
Marek Olšák [Tue, 29 Nov 2016 22:35:09 +0000 (23:35 +0100)]
radeonsi: apply the double EVENT_WRITE_EOP workaround to VI as well

Internal docs don't mention it, but they also don't mention that the bug
has been fixed (like other CI bugs fixed in VI).

Vulkan does this too.

v2: also update r600_gfx_write_fence_dwords

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v1)
(cherry picked from commit bacf9b4e735cc9d96acd2d507dfb2fc8831966a3)

7 years agoradeonsi: add a tess+GS hang workaround for VI dGPUs
Marek Olšák [Tue, 29 Nov 2016 20:19:52 +0000 (21:19 +0100)]
radeonsi: add a tess+GS hang workaround for VI dGPUs

ported from Vulkan

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit a816c7fe07bf16325c11bc692486ffb6d1e8b670)

7 years agoradeonsi: apply a tessellation bug workaround for SI
Marek Olšák [Tue, 29 Nov 2016 19:41:23 +0000 (20:41 +0100)]
radeonsi: apply a tessellation bug workaround for SI

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 78c4528ae7709fbe94d917d034cfd60535b5dcf3)
[Emil Velikov: resolve trivial conflict]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/gallium/drivers/radeonsi/si_state_draw.c

7 years agoradeonsi: apply a TC L1 write corruption workaround for SI
Marek Olšák [Tue, 29 Nov 2016 19:16:50 +0000 (20:16 +0100)]
radeonsi: apply a TC L1 write corruption workaround for SI

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 72e46c98896d0cb13fc7d70b7a4193a84d72a5fc)

7 years agoradeonsi: apply a multi-wave workgroup SPI bug workaround to affected CIK chips
Marek Olšák [Tue, 29 Nov 2016 18:25:03 +0000 (19:25 +0100)]
radeonsi: apply a multi-wave workgroup SPI bug workaround to affected CIK chips

All codepaths are handled except for clover.

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 72d48fcd8eb5862c72d27e5462c289c5de65396e)

7 years agoradeonsi: consolidate max-work-group-size computation
Marek Olšák [Tue, 29 Nov 2016 18:23:20 +0000 (19:23 +0100)]
radeonsi: consolidate max-work-group-size computation

The next commit will need this.

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit ec36c63b4f417973a6d50d79281f4834682c4555)

7 years agoradeonsi: disable RB+ blend optimizations for dual source blending
Marek Olšák [Sat, 26 Nov 2016 14:52:05 +0000 (15:52 +0100)]
radeonsi: disable RB+ blend optimizations for dual source blending

This fixes dual source blending on Stoney. The fix was copied from Vulkan.
The problem was discovered during internal testing.

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 5e5573b1bf8565f38e9b770b5357d069e80ff00d)

7 years agoradeonsi: set CB_BLEND1_CONTROL.ENABLE for dual source blending
Marek Olšák [Sat, 26 Nov 2016 14:43:39 +0000 (15:43 +0100)]
radeonsi: set CB_BLEND1_CONTROL.ENABLE for dual source blending

copied from Vulkan

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit ff50c44a5fb4411715da828af5b8706c8a456d26)

7 years agoradeonsi: always set all blend registers
Marek Olšák [Sat, 26 Nov 2016 14:39:06 +0000 (15:39 +0100)]
radeonsi: always set all blend registers

better safe than sorry

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 87b208a54e67b6b01845efa2ec20a96963399920)

7 years agomesa: fix active subroutine uniforms properly
Timothy Arceri [Sat, 26 Nov 2016 23:31:01 +0000 (10:31 +1100)]
mesa: fix active subroutine uniforms properly

07fe2d565b introduced a big hack in order to return
NumSubroutineUniforms when querying ACTIVE_RESOURCES for
<shader>_SUBROUTINE_UNIFORM interfaces. However this is the
wrong fix we are meant to be returning the number of active
resources i.e. the count of subroutine uniforms in the
resource list which is what the code was previously doing,
anything else will cause trouble when trying to retrieve
the resource properties based on the ACTIVE_RESOURCES count.

The real problem is that NumSubroutineUniforms was counting
array elements as separate uniforms but the innermost array
is always considered a single uniform so we fix that count
instead which was counted incorrectly in 7fa0250f9.

Idealy we could probably completely remove
NumSubroutineUniforms and just compute its value when needed
from the resource list but this works for now.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: 13.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 0303201dfb73c16751d5519cca7480fa678d429a)
[Emil Velikov: LinkStatus is in gl_shader_program]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/mesa/main/program_resource.c

7 years agoanv/cmd_buffer: Remove the 1-D case from the HiZ QPitch calculation
Jason Ekstrand [Sat, 26 Nov 2016 06:09:30 +0000 (22:09 -0800)]
anv/cmd_buffer: Remove the 1-D case from the HiZ QPitch calculation

The 1-D special case doesn't actually apply to depth or HiZ.  I discovered
this while converting BLORP over to genxml and ISL.  The reason is that the
1-D special case only applies to the new Sky Lake 1-D layout which is only
used for LINEAR 1-D images.  For tiled 1-D images, such as depth buffers,
the old gen4 2-D layout is used and the QPitch should be in rows.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit f469235a6e0c239166ba803e121994063b47ddd3)

7 years agoanv/image: Rename hiz_surface to aux_surface
Jason Ekstrand [Tue, 25 Oct 2016 02:31:36 +0000 (19:31 -0700)]
anv/image: Rename hiz_surface to aux_surface

(cherry picked from commit c3eb58664e5e537b21a75172916b42bd4b5504b3)

7 years agoradv: set maxFragmentDualSrcAttachments to 1
Dave Airlie [Tue, 29 Nov 2016 01:16:56 +0000 (11:16 +1000)]
radv: set maxFragmentDualSrcAttachments to 1

Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit eaf0768b8f9a9fd76b44a4d60826ef1f42fc6a46)

7 years agoanv: set maxFragmentDualSrcAttachments to 1
Dave Airlie [Tue, 29 Nov 2016 01:16:56 +0000 (11:16 +1000)]
anv: set maxFragmentDualSrcAttachments to 1

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit f9ab60202d48c72afa6a6f2a8c27db1e0777ed16)

7 years agovulkan/wsi: Fix resource leak in success path of wsi_queue_init()
Gwan-gyeong Mun [Fri, 25 Nov 2016 14:39:04 +0000 (23:39 +0900)]
vulkan/wsi: Fix resource leak in success path of wsi_queue_init()

It fixes leakage of pthread_condattr resource on wsi_queue_init()

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
(cherry picked from commit 65ea559465df527d8a2998380c7eb2554780a2ba)

7 years agoanv: Update the teardown in reverse order of the anv_CreateDevice
Gwan-gyeong Mun [Fri, 25 Nov 2016 14:34:46 +0000 (23:34 +0900)]
anv: Update the teardown in reverse order of the anv_CreateDevice

This updates releasing of resource in reverse order of the anv_CreateDevice
to anv_DestroyDevice.
And it fixes resource leak in pthread_mutex, pthread_cond, anv_gem_context.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit b178652b41410483dcd82aba495eab6bc892ab15)

7 years agoanv: Add missing error-checking to anv_block_pool_init (v2)
Gwan-gyeong Mun [Fri, 25 Nov 2016 14:34:42 +0000 (23:34 +0900)]
anv: Add missing error-checking to anv_block_pool_init (v2)

When the memfd_create() and u_vector_init() fail on anv_block_pool_init(),
this patch makes to return VK_ERROR_INITIALIZATION_FAILED.
All of initialization success on anv_block_pool_init(), it makes to return
VK_SUCCESS.

CID 1394319

v2: Fixes from Emil's review:
  a) Add the return type for propagating the return value to caller.
  b) Changed anv_block_pool_init() to return VK_ERROR_INITIALIZATION_FAILED
     on failure of initialization.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit ecc618b0d88e462270ffedf01502ede4c60fdad9)

7 years agoradv: don't leak the fd if radv_physical_device_init() succeeds
Emil Velikov [Thu, 24 Nov 2016 20:30:44 +0000 (20:30 +0000)]
radv: don't leak the fd if radv_physical_device_init() succeeds

radv_amdgpu_winsys_create() does not take ownership of the fd, thus we
end up leaking it as we return with VK_SUCCESS.

Cc: Dave Airlie <airlied@redhat.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
(cherry picked from commit 78707a15f205f9c2f45dc43ccbb99eb43029dc78)

7 years agoanv: don't leak memory if anv_init_wsi() fails
Emil Velikov [Thu, 24 Nov 2016 20:30:43 +0000 (20:30 +0000)]
anv: don't leak memory if anv_init_wsi() fails

brw_compiler_create() rzalloc-ates memory which we forgot to free.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit a1cf494f7740c2afb851ffc3248e2cfa54d74ead)

7 years agoanv: don't double-close the same fd
Emil Velikov [Thu, 24 Nov 2016 20:30:42 +0000 (20:30 +0000)]
anv: don't double-close the same fd

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 3af81715470f8d656fe8b8e35475ed2b5fc766da)

7 years agoanv/cmd_buffer: Re-emit MEDIA_CURBE_LOAD when CS push constants are dirty
Jason Ekstrand [Tue, 22 Nov 2016 04:21:24 +0000 (20:21 -0800)]
anv/cmd_buffer: Re-emit MEDIA_CURBE_LOAD when CS push constants are dirty

This can happen even if the binding table isn't changed.  For instance, you
could have dynamic offsets with your descriptor set.  This fixes the new
stress.lots-of-surface-state.cs.dynamic cricible test.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 054e48ee0ead7e5a81d28220e3890c7dfc410188)

Conflicts:
src/intel/vulkan/genX_cmd_buffer.c

Squashed with commit:

anv/cmd_buffer: Emit CS push constants after binding tables

Emitting binding tables can cause push constants to be dirtied if the
shader uses images so we need to handle push constants later.

(cherry picked from commit 7a2cfd4adb891fb93e84fd8aedfbe387a8a2c781)

7 years agoMerge remote-tracking branch 'mesa/13.0' into nougat-x86
Chih-Wei Huang [Wed, 7 Dec 2016 05:01:00 +0000 (13:01 +0800)]
Merge remote-tracking branch 'mesa/13.0' into nougat-x86

7 years agodocs: add sha256 checksums for 13.0.2
Emil Velikov [Mon, 28 Nov 2016 15:28:01 +0000 (15:28 +0000)]
docs: add sha256 checksums for 13.0.2

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: add release notes for 13.0.2
Emil Velikov [Mon, 28 Nov 2016 15:06:08 +0000 (15:06 +0000)]
docs: add release notes for 13.0.2

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoUpdate version to 13.0.2
Emil Velikov [Mon, 28 Nov 2016 15:02:48 +0000 (15:02 +0000)]
Update version to 13.0.2

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradv: fix 3D clears with baseMiplevel
Dave Airlie [Mon, 28 Nov 2016 07:03:11 +0000 (07:03 +0000)]
radv: fix 3D clears with baseMiplevel

This fixes:
dEQP-VK.api.image_clearing.clear_color_image.3d*

These were hitting an assert as the code wasn't taking the
baseMipLevel into account when minify the image depth.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 09c0c17bc3609a5f5d3ba1df26820406ff5449bf)

7 years agoradv/ac/llvm: shadow samplers only return one value.
Dave Airlie [Mon, 24 Oct 2016 21:47:13 +0000 (07:47 +1000)]
radv/ac/llvm: shadow samplers only return one value.

The intrinsic engine asserts in llvm due to this.

Reported-by: Christoph Haag <haagch+mesadev@frickel.club>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit b56b54cbf1d8e70c87a434da5350d11533e5fed8)

Squashed with commit:

radv/ac/llvm: fix regression with shadow samplers fix

This fixes b56b54cbf1d8e70c87a434da5350d11533e5fed8:
radv/ac/llvm: shadow samplers only return one value

It makes sure we only do that for shadow sampling, as
opposed to sizing requests.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit b2e217369e1ca4bf9d7741721559a4506b1f0ce8)

Squashed with commit:

radv: brown-paper bag for a forgotten else.

This fixes the fix:
radv/ac/llvm: fix regression with shadow samplers fix

Signed-off-by: Dave Airlie <airlied@redhat.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 020978af12ef6d598bc5efeae3704c0eb8cdafd2)

7 years agoradv/si: fix optimal micro tile selection
Dave Airlie [Thu, 24 Nov 2016 00:04:35 +0000 (10:04 +1000)]
radv/si: fix optimal micro tile selection

The same fix was posted for radeonsi, so port it here.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 9838db8f643354e485f74664b92b902fe0b95c4f)

7 years agoradv: honour the number of properties available
Emil Velikov [Thu, 24 Nov 2016 18:14:58 +0000 (18:14 +0000)]
radv: honour the number of properties available

Cap up-to the number of properties available while copying the data.
Otherwise we might crash and/or leak data.

Cc: Dave Airlie <airlied@redhat.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit a025c5b2c7c9c6862006b13c9b8ab46c3acf8e53)

7 years agoradv: fix texel fetch offset with 2d arrays.
Dave Airlie [Thu, 24 Nov 2016 03:10:52 +0000 (03:10 +0000)]
radv: fix texel fetch offset with 2d arrays.

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

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

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit bb8ac183404541ca8dee31563709d5aca8de0e73)

7 years agovulkan/wsi/x11: Implement FIFO mode.
Jason Ekstrand [Thu, 3 Nov 2016 23:59:08 +0000 (16:59 -0700)]
vulkan/wsi/x11: Implement FIFO mode.

This implements VK_PRESENT_MODE_FIFO_KHR for X11.  Unfortunately, due to
the way the present extension works, we have to manage the queue of
presented images in a separate thread.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit e73d136a02308088cacab842790c7670e5d07b23)

7 years agovulkan/wsi: Add a thread-safe queue implementation
Kevin Strasser [Thu, 3 Nov 2016 01:18:44 +0000 (18:18 -0700)]
vulkan/wsi: Add a thread-safe queue implementation

In order to support FIFO mode without blocking the application on calls
to vkQueuePresentKHR it is necessary to enqueue the request and defer
calling the server until the next vblank period. The xcb present api
doesn't offer a way to register a callback, so we will have to spawn a
worker thread that will wait for a request to be added to the queue, call
to the server, and then make the image available for reuse.  This commit
introduces the queue data structure needed to implement this.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 932bb3f0ddf22a9cbdf6d45089547765027b4397)

7 years agovulkan/wsi/x11: add support for IMMEDIATE present mode
Dave Airlie [Wed, 26 Oct 2016 03:05:51 +0000 (13:05 +1000)]
vulkan/wsi/x11: add support for IMMEDIATE present mode

We shouldn't be using ASYNC here, that would be used
for immediate mode, so let's implement that.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit ca035006c86a5055c8e640f49c858f04770681eb)

7 years agovulkan/wsi: store present mode in swapchain base class
Dave Airlie [Wed, 26 Oct 2016 02:58:34 +0000 (12:58 +1000)]
vulkan/wsi: store present mode in swapchain base class

This just moves this up a level as x11 will need it to
implement things properly.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 1cdca1eb16ab33da338dda076794efd4bf859f7b)

7 years agovulkan/wsi/x11: handle timeouts properly in next image acquire (v1.1)
Dave Airlie [Wed, 26 Oct 2016 01:51:27 +0000 (11:51 +1000)]
vulkan/wsi/x11: handle timeouts properly in next image acquire (v1.1)

For 0 timeout, just poll for an event, and if none, return
For UINT64_MAX timeout, just wait for special event blocked
For other timeouts get the xcb fd and block on it, decreasing
the timeout if we get woken up for non-special events.

v1.1: return VK_TIMEOUT for poll timeouts.
handle timeout going negative.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 787c172aed0ae88ca6a8c1a193d9dd744fbdc918)

7 years agoMerge remote-tracking branch 'mesa/13.0' into nougat-x86
Chih-Wei Huang [Fri, 25 Nov 2016 04:05:07 +0000 (12:05 +0800)]
Merge remote-tracking branch 'mesa/13.0' into nougat-x86

7 years agovulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfacePresentModesKHR
Eduardo Lima Mitev [Fri, 28 Oct 2016 12:34:39 +0000 (14:34 +0200)]
vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfacePresentModesKHR

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

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

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

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

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

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
(cherry picked from commit b677b99db5c48ffd1eeef538b962080ac5fd65d9)
Nominated-by: Emil Velikov <emil.velikov@collabora.com>
7 years agovulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfaceFormatsKHR
Eduardo Lima Mitev [Tue, 25 Oct 2016 08:20:12 +0000 (10:20 +0200)]
vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfaceFormatsKHR

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

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

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

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

Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 750d8cad72a532d977df10ffbbdd1902bd06f50b)
Nominated-by: Emil Velikov <emil.velikov@collabora.com>
Squashed with commit:

vulkan/wsi/x11: Smplify implementation of vkGetPhysicalDeviceSurfaceFormatsKHR

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

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
(cherry picked from commit 129da274261b6e79f459e24428591f137bf92ed1)

7 years agoanv/format: handle unsupported formats properly
Iago Toral Quiroga [Mon, 14 Nov 2016 11:36:57 +0000 (12:36 +0100)]
anv/format: handle unsupported formats properly

According to the spec for vkGetPhysicalDeviceImageFormatProperties:

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

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

dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_unorm
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_snorm
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_uscaled
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_sscaled
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_uint
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_sint
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_srgb
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_unorm
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_snorm
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_uscaled
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_sscaled
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_uint
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_sint
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_srgb
dEQP-VK.api.image_clearing.clear_color_image.1d_r4g4_unorm_pack8
dEQP-VK.api.image_clearing.clear_color_image.1d_r8_srgb
dEQP-VK.api.image_clearing.clear_color_image.1d_r8g8_srgb
dEQP-VK.api.image_clearing.clear_color_image.1d_r8g8b8_srgb
dEQP-VK.api.image_clearing.clear_color_image.1d_b5g5r5a1_unorm_pack16

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
(cherry picked from commit 35deeda66f5fcbccb24f8eda42c8a4f67bb106c9)

Squashed with:

anv/format: handle unsupported formats earlier

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 277f868e6682b9ee398ed326425274c3d1898417)

7 years agoanv: fix enumeration of properties
Emil Velikov [Thu, 6 Oct 2016 13:12:27 +0000 (14:12 +0100)]
anv: fix enumeration of properties

Driver should enumerate only up-to min2(num_available, num_requested)
properties and return VK_INCOMPLETE if the # of requested props is
smaller than the ones available.

Presently we assert out in such cases.

Inspired by a similar fix for RADV.

v2: Use MIN2 + typed_memcpy (Jason).

Should fix: dEQP-VK.api.info.device.extensions

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 5cc07d854c85e30c5aa1ced626b4b6500f8cd74c)

7 years agogbm: request correct version of the DRI2_FENCE extension
Lucas Stach [Tue, 22 Nov 2016 10:12:35 +0000 (11:12 +0100)]
gbm: request correct version of the DRI2_FENCE extension

There is no version 2 of the DRI2_FENCE extension. So only a request
for version 1 has a chance to succeed.

Fixes: 74b1969d717f (gbm: wire up fence extension)
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit d9a3ad94cac34c51603660af6647290d238f64bc)

7 years agoanv/cmd_buffer: Emit a CS stall before setting a CS pipeline
Jason Ekstrand [Tue, 22 Nov 2016 04:22:53 +0000 (20:22 -0800)]
anv/cmd_buffer: Emit a CS stall before setting a CS pipeline

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit f680a01ad4ed360b44cd1b9d3c447a95cedbccd5)

7 years agoanv/cmd_buffer: Handle running out of binding tables in compute shaders
Jason Ekstrand [Tue, 22 Nov 2016 04:17:24 +0000 (20:17 -0800)]
anv/cmd_buffer: Handle running out of binding tables in compute shaders

If we try to allocate a binding table and fail, we have to get a new
binding table block, re-emit STATE_BASE_ADDRESS, and then try again.  We
already handle this correctly for 3D and blorp but it never got handled for
CS.  This fixes the new stress.lots-of-surface-state.cs.static crucible test.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 722ab3de9f0e30e1dfbbd2b5217330b85f53bcec)

7 years agoanv: Fix unintentional integer overflow in anv_CreateDmaBufImageINTEL
Gwan-gyeong Mun [Sun, 20 Nov 2016 11:44:22 +0000 (20:44 +0900)]
anv: Fix unintentional integer overflow in anv_CreateDmaBufImageINTEL

Since both pCreateInfo->strideInBytes and pCreateInfo->extent.height
are of uint32_t type 32-bit arithmetic will be used.

Fix unintentional integer overflow by casting to uint64_t before
multifying.

CID 1394321

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com>
[Emil Velikov: cast only of the arguments]
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit e074a08a6ded3260f13111d0e23961dea2da2442)

7 years agoutil/disk_cache: close a previously opened handle in disk_cache_put (v2)
Gwan-gyeong Mun [Mon, 21 Nov 2016 15:21:23 +0000 (00:21 +0900)]
util/disk_cache: close a previously opened handle in disk_cache_put (v2)

We're missing the close() to the matching open().

CID 1373407

v2: Fixes from Emil Velikov's review
    Update the teardown in reverse order of the setup/init.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (v1)
(cherry picked from commit 69cc7d90f9f60d95cd570a4e87755a474554d41f)

7 years agoi965/hsw: Set integer mode in sampling state for stencil texturing
Jordan Justen [Sat, 19 Nov 2016 22:52:29 +0000 (14:52 -0800)]
i965/hsw: Set integer mode in sampling state for stencil texturing

Fixes:

ES31-CTS.functional.texture.border_clamp.formats.depth24_stencil8_sample_stencil.nearest_size_pot
ES31-CTS.functional.texture.border_clamp.formats.depth24_stencil8_sample_stencil.nearest_size_npot
ES31-CTS.functional.texture.border_clamp.formats.depth32f_stencil8_sample_stencil.nearest_size_pot
ES31-CTS.functional.texture.border_clamp.formats.depth32f_stencil8_sample_stencil.nearest_size_npot
ES31-CTS.functional.texture.border_clamp.unused_channels.depth24_stencil8_sample_stencil
ES31-CTS.functional.texture.border_clamp.unused_channels.depth32f_stencil8_sample_stencil

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 44c5ed02d1b173c061c3188e245d384fd4c0abba)

7 years agoglsl/lower_output_reads: fix geometry shader output handling with conditional emit
Nicolai Hähnle [Thu, 17 Nov 2016 20:55:38 +0000 (21:55 +0100)]
glsl/lower_output_reads: fix geometry shader output handling with conditional emit

Consider a geometry shader that contains code like this:

   some_out = expr;

   if (cond) {
      ...
      EmitVertex();
   } else {
      ...
      EmitVertex();
   }

Both branches should see the correct value of some_out.

Since this is a rather subtle and rare case, I'm submitting a piglit test
for this as well.

GLSL says that the values of output variables are undefined after
EmitVertex(). With this change, the values will now be defined and
unmodified. This may reduce optimization opportunities in the probably
quite rare case where subsequent compiler passes cannot prove that the
value of the output variable is overwritten.

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 0d383a79a8f13bb00ed5e5d84f41071b43c7e92d)

7 years agoradeonsi: store group_size_variable in struct si_compute
Nicolai Hähnle [Fri, 18 Nov 2016 14:18:10 +0000 (15:18 +0100)]
radeonsi: store group_size_variable in struct si_compute

For compute shaders, we free the selector after the shader has been
compiled, so we need to save this bit somewhere else.  Also, make sure that
this type of bug cannot re-appear, by NULL-ing the selector pointer after
we're done with it.

This bug has been there since the feature was added, but was only exposed
in piglit arb_compute_variable_group_size-local-size by commit
9bfee7047b70cb0aa026ca9536465762f96cb2b1 (which is totally unrelated).

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 42d5e91a2ae235c007c5d17935be9bb1c4ff388e)

7 years agoanv: Implement a depth stall restriction on gen7
Jason Ekstrand [Sat, 19 Nov 2016 22:05:06 +0000 (14:05 -0800)]
anv: Implement a depth stall restriction on gen7

Fixes around 60 Vulkan CTS tests on Haswell

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit a8b85f1f772ef45cdeba9d5d205d105e689c3bdf)

7 years agoradv: spir-v allows texture size query with and without lod.
Dave Airlie [Fri, 18 Nov 2016 03:58:30 +0000 (03:58 +0000)]
radv: spir-v allows texture size query with and without lod.

The translation to llvm was failing here due to required lod.

This fixes some new  SteamVR shaders.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit b1340fd708bb873617b8a529ac45cbc9507bd6c4)

7 years agoradv: fix image view creation for depth and stencil only
Dave Airlie [Tue, 15 Nov 2016 06:46:50 +0000 (06:46 +0000)]
radv: fix image view creation for depth and stencil only

This fixes the image view for sampling just the depth.

It removes some pointless swizzle code, and adds
a missing case for the x8_d24 format.

Fixes:
dEQP-VK.renderpass.formats.d32_sfloat_s8_uint.input.*
dEQP-VK.renderpass.formats.d24_unorm_s8_uint.input.*
dEQP-VK.renderpass.formats.x8_d24_unorm_pack32.input.*

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 6d7be52d90cd5f4798b9612e8a68f6d6d9e31c33)

7 years agoradv: make sure to flush input attachments correctly.
Dave Airlie [Wed, 16 Nov 2016 23:41:29 +0000 (23:41 +0000)]
radv: make sure to flush input attachments correctly.

This fixes 9 of the
dEQP-VK.renderpass.attachment_allocation.input_output.*
tests.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 51a44c0021398177d56f86b7fb8d63673186a380)

7 years agoi965: Fix GS push inputs with enhanced layouts.
Kenneth Graunke [Mon, 14 Nov 2016 23:59:57 +0000 (15:59 -0800)]
i965: Fix GS push inputs with enhanced layouts.

We weren't taking first_component into account when handling GS push
inputs.  We hardly ever push GS inputs, so this was not caught by
existing tests.  When I started using component qualifiers for the
gl_ClipDistance arrays, glsl-1.50-transform-feedback-type-and-size
started catching this.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit c4be6e0b8d91746eccf334b9e20861af4036d06a)

7 years agomesa: fix empty program log length
Tapani Pälli [Wed, 17 Aug 2016 07:37:45 +0000 (10:37 +0300)]
mesa: fix empty program log length

In case we have empty log (""), we should return 0. This fixes
Khronos WebGL conformance test 'program-infolog'.

From OpenGL ES 3.1 (and OpenGL 4.5 Core) spec:
   "If pname is INFO_LOG_LENGTH , the length of the info log, including
    a null terminator, is returned. If there is no info log, zero is
    returned."

v2: apply same fix for get_shaderiv and _mesa_GetProgramPipelineiv (Ian)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (v1)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97321
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit ec4e71f75e9b8a1c427994efa32a61593e3172f9)

7 years agomesa: Drop PATH_MAX usage.
Kenneth Graunke [Tue, 15 Nov 2016 19:53:33 +0000 (11:53 -0800)]
mesa: Drop PATH_MAX usage.

GNU/Hurd does not define PATH_MAX since it doesn't have such arbitrary
limitation, so this failed to compile.  Apparently glibc does not
enforce PATH_MAX restrictions anyway, so it's kind of a hoax:

https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html

MSVC uses a different name (_MAX_PATH) as well, which is annoying.

We don't really need it.  We can simply asprintf() the filenames.
If the filename exceeds an OS path limit, presumably fopen() will
fail, and we already check that.  (We actually use ralloc_asprintf
because Mesa provides that everywhere, and it doesn't look like we've
provided an implementation of GNU's asprintf() for all platforms.)

Fixes the build on GNU/Hurd.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98632
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 9bfee7047b70cb0aa026ca9536465762f96cb2b1)
[Emil Velikov: s|prog->Id|base->Id|]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/mesa/main/arbprogram.c

7 years agoi965: Fix compute shader crash.
Kenneth Graunke [Thu, 17 Nov 2016 04:24:25 +0000 (20:24 -0800)]
i965: Fix compute shader crash.

Fixes crashes when starting Deus Ex: Mankind Divided.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit ca76e6b5213c92432b9f3a641cb26f5861d53e09)

7 years agoanv/blorp: Ignore clears for attachments first used as resolve destinations
Jason Ekstrand [Fri, 28 Oct 2016 05:42:02 +0000 (22:42 -0700)]
anv/blorp: Ignore clears for attachments first used as resolve destinations

Otherwise, we'll try to clear it the first time it's used as a draw so if
you do some multisampled rendering, resolve to an attachment, and then draw
on top of the single-sampled attachment, we might accidentally clear it.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit ccdf9af39265ef3478fac4d13b19e9d17fbbcab7)

7 years agonir/spirv: Fix handling of gl_PrimitiveId
Jason Ekstrand [Fri, 11 Nov 2016 06:31:32 +0000 (22:31 -0800)]
nir/spirv: Fix handling of gl_PrimitiveId

Before, we were always treating it as an output which bogus.  The only
stage in which this it can be an output is the geometry stage.  In all
other stages, it's an input which, in the back-end, we actually want to be
a system value.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 955714759257e81f01f013c84d2bd7f14a0ec04f)

7 years agoanv/fence: Handle ANV_FENCE_CREATE_SIGNALED_BIT
Jason Ekstrand [Fri, 11 Nov 2016 05:46:13 +0000 (21:46 -0800)]
anv/fence: Handle ANV_FENCE_CREATE_SIGNALED_BIT

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 1c97432ce88ea272ff7d906cd36f70e09dafcab9)

7 years agoanv: Handle null in all destructors
Jason Ekstrand [Fri, 11 Nov 2016 05:32:32 +0000 (21:32 -0800)]
anv: Handle null in all destructors

This fixes a bunch of new CTS tests which look for exactly this.  Even in
the cases where we just call vk_free to free a CPU data structure, we still
handle NULL explicitly.  This way we're less likely to forget to handle
NULL later should we actually do something less trivial.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 49f08ad77f51cc344e4bfe60ba9f8d9fccfbd753)
[Emil Velikov: color_rt_surface_state is still around]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/intel/vulkan/anv_image.c

7 years agoi965/glk: Add basic Geminilake support
Ben Widawsky [Thu, 10 Nov 2016 18:20:11 +0000 (10:20 -0800)]
i965/glk: Add basic Geminilake support

v2: s/bdw/gen; Add the 2x6 config
v3: Add min_ds_entries

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 2193fb0e1f437b53672a03f74e40d4aebc503f9e)

7 years agoi965: Reorder PCI ID list to match release order
Ben Widawsky [Tue, 18 Oct 2016 20:50:08 +0000 (13:50 -0700)]
i965: Reorder PCI ID list to match release order

I have some OCD...

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
(cherry picked from commit ffd9060b2388dcb4bc4d4e564dab23541f641830)

7 years agoi965: Add some APL and KBL SKU strings
Ben Widawsky [Tue, 18 Oct 2016 20:32:08 +0000 (13:32 -0700)]
i965: Add some APL and KBL SKU strings

We got a couple for products that exist on ark.intel.com, so let's just
put them in now.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
(cherry picked from commit b8509c8936bdb3deaeac86e2ee9716c06d4e0865)

Squashed with commit:

i965: Fix KBL typo in string

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 19a01f8139f74d98548c87a0fd3cc2ff9c60b46b)

7 years agoac/nir/llvm: fix channel in texture gather lowering code.
Dave Airlie [Tue, 15 Nov 2016 07:30:09 +0000 (07:30 +0000)]
ac/nir/llvm: fix channel in texture gather lowering code.

This fixes a number of CTS tests like:
dEQP-VK.glsl.texture_gather.basic.2d.rgba8ui.size_npot.clamp_to_edge_repeat

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 713522fb8d4366d29be18edc3d5f33faba1cb7c4)