Emil Velikov [Mon, 14 Nov 2016 10:58:11 +0000 (10:58 +0000)]
docs: add release notes for 13.0.1
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit
f2f487ebbb808010528edd69000694bfe525f87b)
Juan A. Suarez Romero [Tue, 8 Nov 2016 10:59:44 +0000 (11:59 +0100)]
i965/vec4: skip registers already marked as no_spill
Do not evaluate spill costs for registers that were already marked as
no_spill.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Kenneth Graunke [Sat, 12 Nov 2016 19:55:30 +0000 (11:55 -0800)]
glsl: Don't crash on function names with invalid identifiers.
Karol Herbst's fuzzing efforts noticed that we would segfault on:
void bug() {
2(0);
}
We just need to bail if the function name isn't an identifier.
Based on a bug fix by Karol Herbst.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97422
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Kenneth Graunke [Sat, 12 Nov 2016 19:27:17 +0000 (11:27 -0800)]
glsl: Fix assert fails when assignment expressions are in array sizes.
Karol Herbst's fuzzing efforts discovered that we would hit the
following assert:
assert(dummy_instructions.is_empty());
when processing an illegal array size expression of
float[(1=1)?1:1] t;
In do_assignment, we realized we needed an rvalue for (1 = 1), and
generated a temporary variable and assignment from the RHS. We've
already flagged an error (non-lvalue in assignment), and return a bogus
value as the rvalue. But process_array_size sees the bogus value, which
happened to be a constant expression, and rightly assumes that
processing a constant expression shouldn't have generated any code.
instructions.
To handle this, make do_assignment not generate any temps or assignments
when it's already raised an error - just return an error value directly.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98694
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Jonas Pfeil [Fri, 11 Nov 2016 01:52:03 +0000 (17:52 -0800)]
vc4: Add simulator kernel validation for multithreaded fragment shaders.
This is Jonas Pfeil's code from the kernel, brought back to Mesa by
anholt.
Eric Anholt [Fri, 11 Nov 2016 01:50:34 +0000 (17:50 -0800)]
vc4: Mark threaded FSes as non-singlethread in the CL.
Eric Anholt [Fri, 11 Nov 2016 01:28:20 +0000 (17:28 -0800)]
vc4: Flag the last thread switch in the program as the last.
We don't allow the last thread switch to be inside control flow, to be
sure that we hit the last state exactly once. If the last texturing was
in control flow, fall back to single threaded.
Eric Anholt [Fri, 11 Nov 2016 01:16:04 +0000 (17:16 -0800)]
vc4: Add THRSW nodes after each tex sample setup in multithreaded mode.
This is a suboptimal implementation, but Jonas Pfeil found that it was
still a massive performance gain.
Eric Anholt [Fri, 11 Nov 2016 01:04:21 +0000 (17:04 -0800)]
vc4: Add some spec citations about texture fifo management.
Eric Anholt [Fri, 11 Nov 2016 21:26:00 +0000 (13:26 -0800)]
vc4: Use ra14/rb14 as the spilling registers.
This makes the raddr fixups compatible with FS threading.
Eric Anholt [Thu, 10 Nov 2016 23:10:15 +0000 (15:10 -0800)]
vc4: Add support for register allocation for threaded shaders.
We have two major requirements: Make sure that only the bottom half of the
physical reg space is used, and make sure that none of our values are live
in an accumulator across a switch.
Eric Anholt [Thu, 10 Nov 2016 22:55:26 +0000 (14:55 -0800)]
vc4: Split register class setup for physical files from accumulators.
Eric Anholt [Thu, 10 Nov 2016 22:37:36 +0000 (14:37 -0800)]
vc4: Use register allocator CLASS_BIT_R0_R3 to clean up CLASS_B.
We have had no reason to separate ability to store in an accumulator from
ability to store in B, but with FS threading, we need to be able to force
values to be stored only in the physical regfiles.
Eric Anholt [Fri, 11 Nov 2016 02:02:37 +0000 (18:02 -0800)]
vc4: Add support for QPU scheduling of thread switch instructions.
This is vaguely based off of Jonas Pfeil's thread switch support branch.
Eric Anholt [Thu, 10 Nov 2016 23:23:19 +0000 (15:23 -0800)]
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.
Eric Anholt [Fri, 11 Nov 2016 22:15:55 +0000 (14:15 -0800)]
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.
Eric Anholt [Fri, 11 Nov 2016 22:04:42 +0000 (14:04 -0800)]
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>
Darren Salt [Sun, 16 Oct 2016 19:32:19 +0000 (20:32 +0100)]
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>
Rob Clark [Thu, 10 Nov 2016 21:08:39 +0000 (16:08 -0500)]
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>
Steinar H. Gunderson [Sat, 5 Nov 2016 14:28:37 +0000 (15:28 +0100)]
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>
Kenneth Graunke [Sat, 12 Nov 2016 01:12:13 +0000 (17:12 -0800)]
i965: Drop tabs in brw_state.h.
Daniel Scharrer [Fri, 11 Nov 2016 20:36:36 +0000 (21:36 +0100)]
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>
Kenneth Graunke [Fri, 11 Nov 2016 21:18:51 +0000 (13:18 -0800)]
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>
Laurent Carlier [Fri, 11 Nov 2016 13:00:26 +0000 (14:00 +0100)]
clover: fix building since llvm r286566
pretty trivial fix
Emil Velikov [Fri, 11 Nov 2016 16:27:59 +0000 (16:27 +0000)]
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:
9ca6711faa0 ("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>
Brian Paul [Fri, 11 Nov 2016 16:16:34 +0000 (09:16 -0700)]
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>
Brian Paul [Fri, 11 Nov 2016 15:11:40 +0000 (08:11 -0700)]
mesa: fix comment indentation in bind_buffers_check_offset_and_size()
Trivial.
Emil Velikov [Fri, 11 Nov 2016 14:45:02 +0000 (14:45 +0000)]
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>
Timothy Arceri [Tue, 25 Oct 2016 10:55:17 +0000 (21:55 +1100)]
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>
Timothy Arceri [Thu, 27 Oct 2016 01:22:36 +0000 (12:22 +1100)]
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>
Timothy Arceri [Fri, 11 Nov 2016 04:08:42 +0000 (15:08 +1100)]
i965: remove remaining tabs in brw_program_cache.c
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Timothy Arceri [Fri, 11 Nov 2016 04:06:28 +0000 (15:06 +1100)]
i965: rename brw_state_cache_check_size() to brw_program_cache_check_size()
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Timothy Arceri [Fri, 11 Nov 2016 04:01:24 +0000 (15:01 +1100)]
i965: rename brw_state_cache.c -> brw_program_cache.c
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Jason Ekstrand [Fri, 11 Nov 2016 06:36:39 +0000 (22:36 -0800)]
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>
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>
Jason Ekstrand [Fri, 4 Nov 2016 22:42:48 +0000 (15:42 -0700)]
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>
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>
Tapani Pälli [Thu, 10 Nov 2016 08:20:26 +0000 (10:20 +0200)]
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>
Tapani Pälli [Tue, 8 Nov 2016 10:49:18 +0000 (12:49 +0200)]
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>
Tapani Pälli [Wed, 9 Nov 2016 07:02:39 +0000 (09:02 +0200)]
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>
Tapani Pälli [Wed, 9 Nov 2016 06:58:12 +0000 (08:58 +0200)]
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>
Dave Airlie [Fri, 11 Nov 2016 01:44:10 +0000 (11:44 +1000)]
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>
Emil Velikov [Fri, 11 Nov 2016 01:57:50 +0000 (01:57 +0000)]
docs: add news item and link release notes for 12.0.4
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Emil Velikov [Fri, 11 Nov 2016 01:55:08 +0000 (01:55 +0000)]
docs: add sha256 checksums for 12.0.4
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit
7b9d7257b27c15547ffab8d73d10d8a850af364a)
Emil Velikov [Fri, 11 Nov 2016 01:53:32 +0000 (01:53 +0000)]
docs: add release notes for 12.0.4
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit
3776e97f9d366db8a720e2412ece6a1059999858)
Brian Paul [Fri, 11 Nov 2016 00:29:28 +0000 (17:29 -0700)]
glsl: include inttypes.h for PRIx64 macro
To fix MinGW build.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Dave Airlie [Thu, 10 Nov 2016 00:32:08 +0000 (10:32 +1000)]
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>
Jason Ekstrand [Thu, 10 Nov 2016 22:09:08 +0000 (14:09 -0800)]
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>
Jason Ekstrand [Thu, 10 Nov 2016 22:08:43 +0000 (14:08 -0800)]
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>
Ian Romanick [Thu, 15 Sep 2016 18:37:32 +0000 (11:37 -0700)]
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>
Ian Romanick [Thu, 15 Sep 2016 18:36:16 +0000 (11:36 -0700)]
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>
Ian Romanick [Thu, 15 Sep 2016 18:26:28 +0000 (11:26 -0700)]
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>
Ian Romanick [Thu, 15 Sep 2016 18:24:12 +0000 (11:24 -0700)]
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>
Ian Romanick [Thu, 15 Sep 2016 18:18:35 +0000 (11:18 -0700)]
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>
Ian Romanick [Wed, 14 Sep 2016 20:52:42 +0000 (13:52 -0700)]
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>
Ian Romanick [Thu, 15 Sep 2016 18:09:34 +0000 (11:09 -0700)]
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>
Timothy Arceri [Thu, 27 Oct 2016 01:21:52 +0000 (12:21 +1100)]
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>
Kenneth Graunke [Wed, 2 Mar 2016 01:41:02 +0000 (17:41 -0800)]
mesa/compiler: move MAX_VARYING to shader_enums.h
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Timothy Arceri [Tue, 25 Oct 2016 06:04:31 +0000 (17:04 +1100)]
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>
Kenneth Graunke [Mon, 26 Sep 2016 05:19:07 +0000 (22:19 -0700)]
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>
Samuel Pitoiset [Sat, 5 Nov 2016 16:23:33 +0000 (17:23 +0100)]
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>
Tim Rowley [Thu, 26 May 2016 20:06:07 +0000 (15:06 -0500)]
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>
Ian Romanick [Tue, 8 Nov 2016 19:14:49 +0000 (11:14 -0800)]
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>
Ian Romanick [Tue, 8 Nov 2016 19:06:05 +0000 (11:06 -0800)]
glcpp: Handle '#version 0' and other invalid values
The #version directive can only handle decimal constants. Enforce that
the value is a decimal constant.
Section 3.3 (Preprocessor) of the GLSL 4.50 spec says:
The language version a shader is written to is specified by
#version number profile opt
where number must be a version of the language, following the same
convention as __VERSION__ above.
The same section also says:
__VERSION__ will substitute a decimal integer reflecting the version
number of the OpenGL shading language.
Use a separate flag to track whether or not the #version line has been
encountered. Any possible sentinel (0 is currently used) could be
specified in a #version directive. This would lead to trying to
(internally) redefine __VERSION__. Since there is no parser location
for this addition, NULL is passed. This eventually results in a NULL
dereference and a segfault.
Attempts to use -1 as the sentinel would also fail if '#version
4294967295' or '#version
18446744073709551615' were used. We should
have piglit tests for both of these.
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>
Ian Romanick [Wed, 9 Nov 2016 20:45:39 +0000 (12:45 -0800)]
linker: Remove unnecessary overload of program_resource_visitor::visit_field
It looks like I added this version as a short-hand for users that didn't
need the fuller version. I don't think there's any real utility in
that. I'm not sure what my thinking was there. Maybe if those users
overloaded the recursion function could just call the compact version to
avoid passing some parameters? None of the users do that.
Either way, having this extra overload is not useful. Delete it.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Emil Velikov [Thu, 10 Nov 2016 18:50:13 +0000 (18:50 +0000)]
radv: automake: list correct file in the EXTRA_DIST
Earlier commit renamed the file radeon_icd.json{,.in} but missed one
reference of the file - in EXTRA_DIST.
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Fixes:
0f434a68a ("radv: Suffix the radeon_icd file with the host CPU")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Marek Olšák [Wed, 9 Nov 2016 12:04:09 +0000 (13:04 +0100)]
mesa: remove LowerShaderSharedVariables
always true for compute shaders
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Marek Olšák [Mon, 7 Nov 2016 21:56:21 +0000 (22:56 +0100)]
glsl: handle partial swizzles in opt_dead_code_local correctly
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Marek Olšák [Fri, 4 Nov 2016 11:57:53 +0000 (12:57 +0100)]
glsl: don't run loop passes if loop unrolling is disabled
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Marek Olšák [Sun, 6 Nov 2016 21:27:56 +0000 (22:27 +0100)]
radeonsi: fix r600_texture::tc_compatible_htile
htile_size is now always non-zero if HTILE is allocated.
It seems to have caused no issues.
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Marek Olšák [Sat, 5 Nov 2016 17:32:26 +0000 (18:32 +0100)]
radeonsi: accept is_store in image_fetch_rsrc instead of dcc_off
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Marek Olšák [Sat, 5 Nov 2016 17:26:09 +0000 (18:26 +0100)]
radeonsi: don't rely on tgsi_scan::images_buffers
the instruction knows the target
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Marek Olšák [Fri, 4 Nov 2016 11:41:34 +0000 (12:41 +0100)]
radeonsi: re-order cases in si_get_shader_param
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Marek Olšák [Fri, 4 Nov 2016 11:31:53 +0000 (12:31 +0100)]
radeonsi: increase MAX_CONTROL_FLOW_DEPTH AKA MaxIfDepth
we don't want to lower deep IFs unconditionally
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Emil Velikov [Thu, 10 Nov 2016 15:10:34 +0000 (15:10 +0000)]
Revert "configure.ac: honour LLVM_LIBDIR when linking against LLVM"
This reverts commit
a39ad185932eab4f25a0cb2b112c10d8700ef242.
The commit aims to address "missing" -L/foo/bar during linking stage. At
the same time it doesn't add the -L and yet the LLVM_LDFLAGS [which
provide -L/foo/bar] are already used throughout.
Seems like something pretty unique (broken?) on my end. Since the commit
introduces issues (due to the missing -L) revert until we get to the
root of it (PEBKAC or a genuine issue).
Nicolai Hähnle [Fri, 4 Nov 2016 09:39:45 +0000 (10:39 +0100)]
radeonsi: fix/silence unused variable warnings in optimized builds
I'm leaving num_out_sgpr around since it's not in a fast path, and besides
the compiler should be able to optimize it away easily. The alternative
with #if/#endif would be extremely ugly.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Nicolai Hähnle [Wed, 9 Nov 2016 11:44:47 +0000 (12:44 +0100)]
gallivm: fix [IU]MUL_HI regression harder
The fix in commit
88f791db75e9f065bac8134e0937e1b76600aa36 was insufficient
for radeonsi because the vector case was not handled properly. It seems
piglit only covers the scalar case, unfortunately.
Fixes GL45-CTS.shader_bitfield_operation.[iu]mulExtended.*
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Daniel Stone [Wed, 1 Jun 2016 08:59:06 +0000 (09:59 +0100)]
Revert "wayland: Block for the frame callback in get_back_bo not dri2_swap_buffers"
This reverts commit
25cc889004aad6d1cab9edd76db898658e347b97, though
since the code has changed, it was applied manually.
The intent of moving blocking from SwapBuffers to get_back_bo, was to
avoid unnecessary triple-buffering by ensuring that the compositor had
fully processed the previous frame before we started rendering. This
means that the only time we would have to resort to triple-buffering
would be when the buffer is directly scanned out, thus saving an extra
buffer for composition anyway.
The 'repaint window' changes introduced in Weston since then, however,
have narrowed the window of time between the frame event being sent and
the repaint loop needing to conclude, to 7ms by default, in order to
reduce latency. This means however that blocking in get_back_bo gives a
maximum of 7ms for the entire GL submission to begin and complete.
Not only this, but if a client is using buffer_age to avoid full
repaints, the buffer-age request will stall in get_back_bo until the
frame callback completes, meaning that the client cannot even calculate
the repaint area before the 7ms window.
The combination of the two meant that WebKit-GTK+ was failing to
achieve full framerate on a Minnowboard, due to spending a great deal of
its time attempting to query the age of the next buffer before redraw.
Revert to the previous behaviour of allowing rendering to begin but
delaying SwapBuffers, unless and until we can find a more gentle
behaviour.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Derek Foreman <derekf@osg.samsung.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Iago Toral Quiroga [Fri, 4 Nov 2016 12:37:58 +0000 (13:37 +0100)]
glsl: validate output blocks against input blocks
Until now were validating in/out blocks by listing the inputs in the
consumer stage and then, for each output of the producer, we checked that
it was a match if it was consumed. This method does not catch the case
where the consumer has an input that is not present as an output in the
producer stage, because it only generates link errors for outputs present
in the producer stage that don't match the inputs in the consumer stage.
The current method does catch the case were an output from the producer
stage is not consumed, which is irrelevant and is ignored.
By reversing the way we do this, we can detect this situation, so this
patch lists the outputs of the producer stage and then validates inputs
of the consumer stage against them. If we see an input in the consumer
for which there is no associated output in the producer, we produce a
link error.
The only exception to this is the special built-in input block gl_in[],
since this is implicitly generated for geometry and tessellation stages,
but we don't generate it if the producer stage does not write to any of
the pre-defined outputs (for example, if the vertex shader does not write
to gl_Position, etc). Since writing to these is not mandatory, do not
produce a link error in that case. There is a CTS tessellation test
(GL45-CTS.tessellation_shader.program_object_properties) that has an
empty vertex shader (so it does not produce gl_in[]) and would fail to
link if we don't do this.
This fixes the following dEQP test:
dEQP-GLES31.functional.shaders.linkage.io_block.missing_output_block
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98245
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Dave Airlie [Thu, 10 Nov 2016 04:12:32 +0000 (14:12 +1000)]
radv: fixup botched llvm API changes.
Reported-by: Jan Vesely <jan.vesely@rutgers.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Thu, 10 Nov 2016 03:04:54 +0000 (13:04 +1000)]
ac/nir/llvm: adopt to new LLVM attribute API.
Ported from corresponding changes to gallivm.
tested build against 3.9 and master.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Jason Ekstrand [Wed, 9 Nov 2016 18:21:03 +0000 (10:21 -0800)]
vulkan/wsi/wayland: Clean up some error handling paths
This gets rid of all the memory leaks reported by the WSI CTS tests.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Jason Ekstrand [Wed, 9 Nov 2016 18:20:31 +0000 (10:20 -0800)]
vulkan/wsi/wayland: Include pthread.h
We use pthreads and, for some reason, it wasn't getting included
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
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>
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>
Jason Ekstrand [Tue, 8 Nov 2016 01:23:44 +0000 (17:23 -0800)]
anv/device: Add some asserts to MapMemory
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Jason Ekstrand [Wed, 2 Nov 2016 16:11:11 +0000 (09:11 -0700)]
anv: Rework fences
Our previous fence implementation was very simple. Fences had two states:
signaled and unsignaled. However, this didn't properly handle all of the
edge-cases that we need to handle. In order to handle the case where the
client calls vkGetFenceStatus on a fence that has not yet been submitted
via vkQueueSubmit, we need a three-status system. In order to handle the
case where the client calls vkWaitForFences on fences which have not yet
been submitted, we need more complex logic and a condition variable. It's
rather annoying but, so long as the client doesn't do that, we should still
hit the fast path and use i915_gem_wait to do all our waiting.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Jason Ekstrand [Wed, 2 Nov 2016 21:45:37 +0000 (14:45 -0700)]
anv/wsi: Set the fence to signaled in AcquireNextImageKHR
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Jason Ekstrand [Sat, 8 Oct 2016 06:02:25 +0000 (23:02 -0700)]
anv/gen8: Stall when needed in Cmd(Set|Reset)Event
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Ilia Mirkin [Sat, 5 Nov 2016 13:31:21 +0000 (09:31 -0400)]
glsl: record number of components used in each slot for varying packing
Instead of packing varyings into vec4's, keep track of how many
components each slot uses and create varyings with matching types. This
ensures that we don't end up using more components than the orginal
shader, which is especially important for geometry shader output limits.
This comes up for NVIDIA hw, where the limit is 1024 output components
for a GS, and the hardware complains *loudly* if you even think about
going over.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Ilia Mirkin [Sat, 5 Nov 2016 01:01:18 +0000 (21:01 -0400)]
glsl: fix slot_end calculations and simplify reserved_slots check
The previous code was confused about whether slot_end was inclusive or
exclusive. Make it so that it is inclusive consistently, and use it for
setting the new location. This also avoids discrepancies in how
num_components is calculated vs the more manual approach taken for the
former reserved_slots check.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Ilia Mirkin [Wed, 9 Nov 2016 19:31:25 +0000 (14:31 -0500)]
swr: correct setting of independentAlphaBlendEnable
This setting is for whether color and alpha have different blend
settings, not for whether blending is enabled on a per-RT basis.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
Ilia Mirkin [Wed, 9 Nov 2016 17:07:42 +0000 (12:07 -0500)]
swr: [rasterizer] add a .dir-locals.el to support 4-space indents
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
Ilia Mirkin [Wed, 9 Nov 2016 06:19:34 +0000 (01:19 -0500)]
swr: set halfz rasterizer setting
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
Ilia Mirkin [Wed, 9 Nov 2016 06:18:05 +0000 (01:18 -0500)]
swr: [rasterizer core] allow an OpenGL driver to specify halfz clipping
With ARB_clip_control, GL may also do 0..1 depth clipping, not just
-1..1. This removes clip's reliance on driver type. DX users will need
to be updated to set the new clipHalfZ flag to get proper clipping
functionality.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
Ilia Mirkin [Wed, 9 Nov 2016 06:16:32 +0000 (01:16 -0500)]
swr: fix support for inverted depth scales
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
Ilia Mirkin [Tue, 8 Nov 2016 00:12:23 +0000 (19:12 -0500)]
swr: [rasterizer jitter] fix logic op to work with unorm/snorm
Most logic op usage is probably going to end up with normalized
textures. Scale the floating point values and convert to integer before
performing the logic operations.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
Eric Anholt [Mon, 7 Nov 2016 20:25:47 +0000 (12:25 -0800)]
vc4: Clamp the shadow comparison value.
Fixes piglit glsl-fs-shadow2D-clamp-z.
Cc: <mesa-stable@lists.freedesktop.org>
Eric Anholt [Mon, 7 Nov 2016 18:52:32 +0000 (10:52 -0800)]
vc4: Don't pair up TLB scoreboard locking instructions early in QPU sched.
Jonas Pfeil noticed that we were putting passthrough tlb_z writes early in
the shader, despite QIR and QPU scheduling both trying to delay scoreboard
locking for as long as possible.
The problem was that when trying to pair up QPU instructions, at some
point the passthrough tlb_z would be the last one available and it would
get paired, even if the other half would open up other instructions to be
scheduled and we could have paired tlb_z with something later in the
program. Also, since passthrough z is just a mov, it pairs up really
easily.
The proper fix would probably be to flip the order of scheduling
instructions so we went from bottom to top (also relevant for branch delay
slot scheduling).
However, we can do a quick fix here to just not schedule a TLB lock until
there's nothing but TLB left in the program, at a slight instruction cost
(est .61% cycle count in shader-db) but a major fragment shader
parallelism win.
glmark2 results:
texture:texture-filter=linear: +1.24481% +/- 0.626117% (n=15)
bump:bump-render=height: 1.24991% +/- 0.154793% (n=136,133 -- screensaver
outliers removed)
Eric Anholt [Mon, 7 Nov 2016 18:16:45 +0000 (10:16 -0800)]
vc4: Print a reg pressure estimate in our reg allocation failure dump.