Commit Graph

86506 Commits

Author SHA1 Message Date
Eric Anholt 1ee503c74d vc4: Add support for QPU scheduling of thread switch instructions.
This is vaguely based off of Jonas Pfeil's thread switch support branch.
2016-11-12 18:46:35 -08:00
Eric Anholt 4f527f1260 vc4: Add a thread switch QIR instruction.
This will eventually be generated at the QIR level, so that
vc4_qir_schedule.c can arrange the separation of tex_strb from tex_result
correctly.  It will also be important so that register allocation set the
register classes appropriately for values that are live across the switch.
2016-11-12 18:46:35 -08:00
Eric Anholt 93cdae44de vc4: Add a bit of QPU validation for threaded shaders.
These are both bugs we've run into along the way writing multithreaded FS
support.
2016-11-12 18:46:35 -08:00
Eric Anholt 977d8b526b vc4: Fix register class handling of DDX/DDY arguments.
I had this exactly backwards, but apparently the piglit tests were all
landing in r0-r3 anyway.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
2016-11-12 18:46:35 -08:00
Darren Salt 9b121512ac radv/pipeline: Don't dereference NULL dynamic state pointers
This is a port of commit a4a59172482d50318a5ae7f99021bcf0125e0f53:

   Add guards to prevent dereferencing NULL dynamic pipeline state. Asserts
   of pCreateInfo members are moved to the earliest points at which they
   should not be NULL.

This fixes a segfault, related to pColorBlendState, seen in Talos Principle
which I've observed after startup is completed and when exiting the menus,
depending on when Vulkan rendering is selected.

v2: moved the NULL check in radv_pipeline_init_blend_state to after the
declarations.
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
2016-11-12 15:06:27 +01:00
Rob Clark dfc001dccc freedreno/ir3: fixup ralloc fallout
Fixes fallout from acc23b04 ("ralloc: remove memset from ralloc_size").
We were still depending on zero'd allocations in a couple of places.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-11-12 08:57:03 -05:00
Steinar H. Gunderson 2e2562cabb Fix races during _mesa_HashWalk().
There is currently no protection against walking a hash (using
_mesa_HashWalk()) and modifying it at the same time, for instance by inserting
or deleting elements. This leads to segfaults in multithreaded code if e.g.
someone calls glTexImage2D (which may have to walk the list of FBOs) while
another thread is calling glDeleteFramebuffers on another thread with the two
contexts sharing lists.

The reason for this is that _mesa_HashWalk() doesn't actually take the mutex
that normally protects the hash; it takes an entirely different mutex.
Thus, walks are only protected against other walks, and there is also no
outer lock taking this. There is an old comment saying that this is to fix
problems with deadlock if the callback needs to take a mutex; we solve this
by changing the mutex to be recursive.

A demonstration Helgrind hit from a real application:

==13412== Possible data race during write of size 8 at 0x3498C6A8 by thread #1
==13412== Locks held: 2, at addresses 0x1AF09530 0x2B3DF400
==13412==    at 0x1F040C99: _mesa_hash_table_remove (hash_table.c:395)
==13412==    by 0x1EE98174: _mesa_HashRemove_unlocked (hash.c:350)
==13412==    by 0x1EE98174: _mesa_HashRemove (hash.c:365)
==13412==    by 0x1EE2372D: _mesa_DeleteFramebuffers (fbobject.c:2669)
==13412==    by 0x6105AA4: movit::ResourcePool::cleanup_unlinked_fbos(void*) (resource_pool.cpp:473)
==13412==    by 0x610615B: movit::ResourcePool::release_fbo(unsigned int) (resource_pool.cpp:442)
[...]
==13412== This conflicts with a previous read of size 8 by thread #20
==13412== Locks held: 2, at addresses 0x1AF09558 0x1AF73318
==13412==    at 0x1F040CD9: _mesa_hash_table_next_entry (hash_table.c:415)
==13412==    by 0x1EE982A8: _mesa_HashWalk (hash.c:426)
==13412==    by 0x1EED6DFD: _mesa_update_fbo_texture.part.33 (teximage.c:2683)
==13412==    by 0x1EED9410: _mesa_update_fbo_texture (teximage.c:3043)
==13412==    by 0x1EED9410: teximage (teximage.c:3073)
==13412==    by 0x1EEDA28F: _mesa_TexImage2D (teximage.c:3105)
==13412==    by 0x166A68: operator() (mixer.cpp:454)

There are many more interactions than just these two possible.

Cc: 11.2 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Steinar H. Gunderson <steinar+mesa@gunderson.no>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
2016-11-12 12:42:07 +11:00
Kenneth Graunke 07566ad4b6 i965: Drop tabs in brw_state.h. 2016-11-11 17:12:46 -08:00
Daniel Scharrer 0b98e885e7 ac/nir/llvm: Fix setting function attributes for intrinsics
This fixes a NULL pointer dereference for intrinsics with more than
one function attribute introduced in commit 2fdaf38.
The fix is ported from the lp_build_intrinsic changes in commit 8bdd52c.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
2016-11-11 22:40:32 +01:00
Kenneth Graunke 74d5d393df i965: Update a comment: s/brw_state_cache/brw_program_cache/g
Tim renamed this recently - stop referring to it by the old name.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2016-11-11 13:19:18 -08:00
Laurent Carlier 3ff9f8c532 clover: fix building since llvm r286566
pretty trivial fix
2016-11-11 19:45:22 +00:00
Emil Velikov 6ff948ece1 egl/wayland: fix return value in dri2_wl_swrast_commit_backbuffer
The function returns "void" rather than int. We could rework that, yet
again there will be no benefit since all the callers have no use of it.

Fixes: 9ca6711faa ("Revert "wayland: Block for the frame callback in
get_back_bo not dri2_swap_buffers"")
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-11-11 17:33:37 +00:00
Brian Paul 92ec47a6ba glsl: define __STDC_FORMAT_MACROS to get PRIx64 macro
Otherwise, inttypes.h may not define the macro for C++ on MinGW.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98681
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-11-11 09:43:29 -07:00
Brian Paul f9052536c9 mesa: fix comment indentation in bind_buffers_check_offset_and_size()
Trivial.
2016-11-11 09:43:29 -07:00
Emil Velikov db45f1eaab glsl: automake: add opt_add_neg_to_sub.h to the sources list
Otherwise it'll be missing in the release tarball.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-11-11 14:46:12 +00:00
Timothy Arceri e36f0878cf i965: update gl_PrimitiveIDIn to be a system variable
Now that we have switched to using nir_shader_gather_info() we
can remove the hacks and just use the system variable.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-11-11 20:39:09 +11:00
Timothy Arceri 00620782c9 i965: use nir_shader_gather_info() over do_set_program_inouts()
This takes us one step closer to being able to drop the GLSL IR
optimisation passes during linking in favour of the NIR passes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-11-11 20:39:09 +11:00
Timothy Arceri e86fc2c285 i965: remove remaining tabs in brw_program_cache.c
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2016-11-11 20:39:09 +11:00
Timothy Arceri 663fc64965 i965: rename brw_state_cache_check_size() to brw_program_cache_check_size()
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2016-11-11 20:39:09 +11:00
Timothy Arceri 0d897be973 i965: rename brw_state_cache.c -> brw_program_cache.c
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2016-11-11 20:39:09 +11:00
Jason Ekstrand a5e88e66e6 i965/gs: Allow primitive id to be a system value
This allows for gl_PrimitiveId to come in as a system value rather than as
an input.  This is the way it will come in from SPIR-V. We keeps the input
path working for now so we don't break GL.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
2016-11-10 22:43:59 -08:00
Jason Ekstrand e73d136a02 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>
2016-11-10 22:40:59 -08:00
Jason Ekstrand 4fa0ca80ee vulkan/wsi: Report the correct min/maxImageCount
From the Vulkan spec 1.0.32 section 29.6 docs for vkAcquireNextImageKHR:

   "Let n be the total number of images in the swapchain, m be the value of
   VkSurfaceCapabilitiesKHR::minImageCount, and a be the number of
   presentable images that the application has currently acquired (i.e.
   images acquired with vkAcquireNextImageKHR, but not yet presented with
   vkQueuePresentKHR).  vkAcquireNextImageKHR can always succeed if a ≤ n -
   m at the time vkAcquireNextImageKHR is called. vkAcquireNextImageKHR
   should not be called if a > n - m with a timeout of UINT64_MAX; in such
   a case, vkAcquireNextImageKHR may block indefinitely."

With minImageCount == 2 (as it was previously, the client is allowed to
acquire all but one image withoutblocking.  If we really need 4 images for
mailbox mode + pageflipping, then we need to request a minimum of 4 images
up-front.  This is a bit unfortunate because it means we will always
consume 4 images.  In the future, we may be able to optimize this a bit by
waiting until the server starts to flip and returning OUT_OF_DATE to get
the client to re-allocate with more images or something like that.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
2016-11-10 22:40:51 -08:00
Kevin Strasser 932bb3f0dd 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>
2016-11-10 22:40:44 -08:00
Tapani Pälli 3ca600fe71 android/i965: add libmesa_i965_compiler static library
this will be shared between OpenGL and Vulkan drivers

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-11-11 07:59:29 +02:00
Tapani Pälli 1c2de8977b android: add SPIRV_FILES to libmesa_nir
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-11-11 07:59:29 +02:00
Tapani Pälli 23d1799f7d anv: use STATIC_ASSERT instead of static_assert
fixes following compilation warnings on Android build:

"warning: implicit declaration of function 'static_assert' is invalid in
C99 [-Wimplicit-function-declaration]"

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-11-11 07:59:29 +02:00
Tapani Pälli ec725dc140 util: use STATIC_ASSERT instead of static_assert
fixes following compilation warnings on Android build:

"warning: implicit declaration of function 'static_assert' is invalid in
C99 [-Wimplicit-function-declaration]"

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-11-11 07:59:29 +02:00
Dave Airlie 98969808ff vulkan: import latest public vulkan headers + and fix drivers.
I just noticed the new vulkan headers changed a prototype,
so I've decided to import them and fix the drivers to use the
new API.

Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-11-11 12:33:07 +10:00
Emil Velikov e4c465e230 docs: add news item and link release notes for 12.0.4
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-11-11 01:57:50 +00:00
Emil Velikov 33c2958930 docs: add sha256 checksums for 12.0.4
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 7b9d7257b27c15547ffab8d73d10d8a850af364a)
2016-11-11 01:56:19 +00:00
Emil Velikov d82bbf34df docs: add release notes for 12.0.4
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 3776e97f9d366db8a720e2412ece6a1059999858)
2016-11-11 01:56:18 +00:00
Brian Paul d881e1c024 glsl: include inttypes.h for PRIx64 macro
To fix MinGW build.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2016-11-10 17:59:18 -07:00
Dave Airlie 2de85eb97a radv: fix texturesamples to handle single sample case
We can only read the valid samples if this is an MSAA
texture, which means the type field must be 0x14 or 0x15.

This fixes:
dEQP-VK.glsl.texture_functions.query.texturesamples.*

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-11-11 09:35:43 +10:00
Jason Ekstrand a6c3d0f92b anv/cmd_buffer: Enable a CS stall workaround for Sky Lake gt4
This fixes hangs in Dota2

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
2016-11-10 15:21:18 -08:00
Jason Ekstrand 1e3e347fd5 anv/cmd_buffer: Take a command buffer instead of a batch in two helpers
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
2016-11-10 15:21:18 -08:00
Ian Romanick e9acae8486 glsl/standalone: Add the ability to generate ir_builder code
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2016-11-10 14:30:49 -08:00
Ian Romanick 191d9a5195 glsl: Add a C++ code generator that uses ir_builder to rebuild a program
This is only in libstandalone currently because it will only be used in
the stand-alone compiler.

v2: Change the signature of the generated function.  The ir_factory is
created in the generator, and an availability predicate is taken as a
parameter.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-11-10 14:30:49 -08:00
Ian Romanick 984f16bbd7 glsl: Generate strings that are the enum names without the ir_*op_ prefix
For many expressions, this is different from the printable name.  The
printable name for ir_binop_add is "+", but we want "add".  This is
needed for ir_builder_print_visitor.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-11-10 14:30:49 -08:00
Ian Romanick d0028b2e1c glsl/standalone: Enable par-linking
If the user did not request full linking, link the shader with the
built-in functions, inline them, and eliminate them.  Previous to this
you'd see all these calls to "dot" and "max" in the output.  This
prevented a lot of expected optimizations and cluttered the output.
This gives it some chance of being useful.

v2: Rebase on top of Ken's "built-ins now" work.

v3: Don't do_common_optimizations if par-linking fails.  Update expected
output of warnings tests to prevent 'make check' regressions.

v4: Optimize harder.  Most important, do function inlining.  Otherwise
it's quite impractical for one function in a file to call another
function in the same file.

v5: Add some code simplifications and an assertion suggested by Iago.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2016-11-10 14:30:49 -08:00
Ian Romanick 4dc759c8c2 glsl/standalone: Optimize dead variable declarations
We didn't bother with this in the regular compiler because it doesn't
change the generated code.  In the stand-alone compiler, this can
clutter the output with useless variables.  It's especially bad after
functions are inlined but the foo_retval declarations remain.

v2: Use set_foreach.  Suggested by Tapani.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2016-11-10 14:30:49 -08:00
Ian Romanick f45a2a93ae glsl/standalone: Optimize add-of-neg to subtract
This just makes the output of the standalone compiler a little more
compact.

v2: Fix indexing typo noticed by Iago.  Move the add_neg_to_sub_visitor
to it's own header file.  Add a unit test that exercises the visitor.
Both the neg_a_plus_b and neg_a_plus_neg_b tests reproduced the bug that
Iago discovered.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-11-10 14:30:49 -08:00
Ian Romanick 9788b3b6f3 glsl/linker: Allow link_intrastage_shaders when there is no main()
This enables a sort of par-linking.  The primary use for this feature is
resolving built-in functions in the stand-alone compiler.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2016-11-10 14:30:49 -08:00
Timothy Arceri 7372d2153a nir: update nir_gather_info to only mark used array/matrix elements
This is based on the code from the GLSL IR pass however unlike the GLSL IR
pass it also supports arrays of arrays.

As well as implementing the logic from the GLSL IR pass we add some
additional intrinsic cases to catch more system values.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-11-11 09:17:07 +11:00
Kenneth Graunke 53d1f4251f mesa/compiler: move MAX_VARYING to shader_enums.h
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
2016-11-11 09:17:07 +11:00
Timothy Arceri cd52b4fb16 nir: add more helpers to nir_types.cpp
These new helpers will be used in nir_gather_info.c in a following patch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-11-11 09:17:07 +11:00
Kenneth Graunke ad9d4a4f8d nir: Generalize the "is per-vertex variable?" helpers and export them.
I want this function for nir_gather_info(), and realized it's basically
the same as the ones in nir_lower_io().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
2016-11-11 09:17:07 +11:00
Samuel Pitoiset 561f2208bd nvc0: support MP performance counters on Maxwell
This adds some performance counters/metrics for SM50/SM52.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Pierre Moreau <pierre.morrow@free.fr>
2016-11-10 22:13:49 +01:00
Tim Rowley b9578b683d gallium: detect avx512 cpu features
v3: fix check for xmm/ymm test
v2: style code, add avx512 to cpu dump

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2016-11-10 15:03:21 -06:00
Ian Romanick c8c46641af glsl: Parse 0 as a preprocessor INTCONSTANT
This allows a more reasonable error message for '#version 0' of

    0:1(10): error: GLSL 0.00 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES

instead of

    0:1(10): error: syntax error, unexpected $undefined, expecting INTCONSTANT

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97420
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Cc: mesa-stable@lists.freedesktop.org
Cc: Juan A. Suarez Romero <jasuarez@igalia.com>
Cc: Karol Herbst <karolherbst@gmail.com>
2016-11-10 10:57:59 -08:00