Marek Olšák [Thu, 12 Nov 2020 21:37:40 +0000 (16:37 -0500)]
st/mesa: fix uninitialized/random clip plane state vars in lower_ucp
Fixes:
584f27326c1 - st/mesa: factor ucp-lowering logic into helper
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Thu, 12 Nov 2020 00:11:09 +0000 (19:11 -0500)]
mesa: allocate the attribute stack on demand
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sat, 3 Oct 2020 04:55:57 +0000 (00:55 -0400)]
mesa: remove gl_texture_object references from glPush/PopAttrib stack
I don't see why this is needed and it's not used anywhere.
As long as apps don't call glDeleteTextures, nothing will release them.
And even if they do, we don't use the saved textures anywhere.
Also, BindTexture will fail for deleted textures anyway, so they can't be
popped. The existing code already binds the Name that was saved, not
the texture object that was saved.
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 5 Oct 2020 01:48:51 +0000 (21:48 -0400)]
mesa: more optimizations in glPopAttrib (colormask, drawbuffers, coord replace)
Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 5 Oct 2020 01:32:12 +0000 (21:32 -0400)]
mesa: optimize out no-op calls in glPopAttrib
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sun, 4 Oct 2020 06:26:19 +0000 (02:26 -0400)]
mesa: skip _mesa_set_enable in glPopAttrib if there are no changes
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sun, 4 Oct 2020 05:31:30 +0000 (01:31 -0400)]
mesa: reduce the size of gl_texture_attrib_node::Texture by about 90%
Let's get rid of the big memcpy.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sat, 3 Oct 2020 04:48:30 +0000 (00:48 -0400)]
mesa: optimize saving/restoring bound textures for glPush/PopAttrib
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 5 Oct 2020 06:45:03 +0000 (02:45 -0400)]
mesa: reorganize gl_texture and sampler structures for glPush/PopAttrib
Put the fields saved by glPush/PopAttrib into the sub-structure declared
as Attrib. This will make glPush/PopAttrib much faster because it will
only save and restore that structure.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sat, 3 Oct 2020 07:58:01 +0000 (03:58 -0400)]
mesa: add a fast path for restoring light attributes in glPopAttrib
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sat, 3 Oct 2020 07:39:28 +0000 (03:39 -0400)]
mesa: add a fast path for restoring fixed-func tex state in glPopAttrib
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sat, 3 Oct 2020 05:13:10 +0000 (01:13 -0400)]
mesa: rewrite glPushAttrib/glPopAttrib to get rid of malloc
This was inevitable. This gets rid of the malloc/free calls and chaining
each push group in a linked list. Now the whole attribute stack is declared
statically in gl_context.
Yes, this improves performance a lot.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Tue, 6 Oct 2020 00:10:31 +0000 (20:10 -0400)]
mesa: treat glPopMatrix as a no-op state change if it doesn't change the matrix
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Tue, 6 Oct 2020 01:20:47 +0000 (21:20 -0400)]
mesa: memset matrices at initialization to enable memcpy on it
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Tue, 6 Oct 2020 00:38:51 +0000 (20:38 -0400)]
mesa: canonicalize matrix in glPushMatrix to make glPopMatrix possibly a no-op
If there are no changes to the matrix, we can move pop the stack but not
update any state constants.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Tue, 6 Oct 2020 01:01:31 +0000 (21:01 -0400)]
mesa: consider glPushMatrix a no-op change from the driver perspective
It doesn't change any states.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Tue, 6 Oct 2020 00:02:46 +0000 (20:02 -0400)]
mesa: skip glMultMatrix if the matrix is identity
This happens a lot with viewperf and it causes unnecessary constant buffer
updates.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 5 Oct 2020 09:51:22 +0000 (05:51 -0400)]
mesa: fix crashes in the no_error case of invalid glUniform calls
I copied error conditions from validate_uniform_parameters.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Fri, 2 Oct 2020 19:54:10 +0000 (15:54 -0400)]
st/mesa: replace st_context::state::constants with a mask
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 03:00:22 +0000 (23:00 -0400)]
st/mesa: add a faster path for uploading state parameters into constant buffers
The old path copies state parameters into the parameter list, and then
the driver copies them into a buffer.
The optional new path loads state parameters into a buffer directly.
This increases performance by 5% in one subtest of viewperf.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 02:57:10 +0000 (22:57 -0400)]
gallium: add PIPE_CAP_PREFER_REAL_BUFFER_IN_CONSTBUF0
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 02:57:37 +0000 (22:57 -0400)]
mesa: add helpers for drivers to load state parameters into buffers
Drivers should upload only UniformBytes of uniforms and constants,
and then use _mesa_upload_state_parameters to upload state parameters.
This allows removing one copy of state parameters.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 19:15:36 +0000 (15:15 -0400)]
mesa: merge light state parameters for faster uploads (disabled)
Disabled because of CI failures.
Invoke fetch_state only once for all lights in the best case instead
of 8*8 times.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 17:31:34 +0000 (13:31 -0400)]
mesa: merge matrix state parameters for faster uploads (disabled)
Disabled because of CI failures.
Instead of separate state vars for each row and invoking fetch_state 4x:
state.matrix.modelview.row[0]
state.matrix.modelview.row[1]
state.matrix.modelview.row[2]
state.matrix.modelview.row[3]
The rows are now merged and fetch_state is invoked once:
state.matrix.modelview.row[0..3]
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 02:15:06 +0000 (22:15 -0400)]
mesa: take advantage of sorted parameters in _mesa_load_state_parameters
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 01:42:46 +0000 (21:42 -0400)]
mesa: put constants before state vars for ARB programs
This moves state vars to the end of the parameter list, so that state vars
can be loaded directly into a buffer instead of loaded into the parameter list.
Also, state vars don't need to be searched in the parameter list anymore,
because we will know their index range. (this will make gallium faster)
This commit just wraps a for loop around the existing code.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 01:42:46 +0000 (21:42 -0400)]
mesa: put constants before state vars for ffvp
This moves state vars to the end of the parameter list, so that state vars
can be loaded directly into a buffer instead of loaded into the parameter list.
Also, state vars don't need to be searched in the parameter list anymore,
because we will know their index range. (this will make gallium faster)
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 20:11:06 +0000 (16:11 -0400)]
mesa: restructure gl_light vars to match the layout of gl_LightSource uniforms
this will make uploads faster
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 04:22:30 +0000 (00:22 -0400)]
mesa: optimize setting gl_Light state parameters
The order of enums is a preparation for a future commit, but if you are
guessing that I just want to copy all light params into a constant buffer
with one memcpy, you are right.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Tue, 29 Sep 2020 01:54:04 +0000 (21:54 -0400)]
mesa: demystify material_attrib()
the next commit would break this magic math
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 17:02:59 +0000 (13:02 -0400)]
mesa: allow multi-slot program parameters
also the removed comment was incorrect.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 15:51:48 +0000 (11:51 -0400)]
mesa: fix printing state parameters
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 13:57:33 +0000 (09:57 -0400)]
mesa: remove redundant _math_matrix_analyse calls in fetch_state
Only program matrices needed this. Other matrices are updated in
_mesa_update_state_locked.
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 13:30:51 +0000 (09:30 -0400)]
mesa: rework matrix statevar enums to remove excessive branching in fetch_state
Instead of having $matrix and $modifier as separate enums, combine them
to 1 enum $matrix_$modifier.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 12:53:42 +0000 (08:53 -0400)]
mesa: don't allocate matrices with malloc
There is no reason for it. This removes a pointer indirection.
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 12 Oct 2020 09:24:57 +0000 (05:24 -0400)]
util: add a common ALIGN16 macro for m_matrix and u_threaded_context
to prevent conflicts in the next commit
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 04:24:36 +0000 (00:24 -0400)]
mesa: replace _mesa_problem with unreachable in fetch_state
let's get this out of release builds
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Mon, 28 Sep 2020 03:53:41 +0000 (23:53 -0400)]
mesa: don't read from destination memory when computing state parameter values
The destination memory can be uncached, e.g. a buffer object.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sun, 27 Sep 2020 16:36:13 +0000 (12:36 -0400)]
mesa: skip redundant uniform updates for glUniformHandle
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sun, 27 Sep 2020 16:36:13 +0000 (12:36 -0400)]
mesa: skip redundant uniform updates for glUniformMatrix
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sun, 27 Sep 2020 16:36:13 +0000 (12:36 -0400)]
mesa: skip redundant uniform updates for glUniform
Viewperf does a lot of redundant uniform updates - 60-80% in some tests.
Those are sometimes the only state changes between draw calls.
This improves performance by 33% in one viewperf subtest.
If you are worried about CPU overhead in the non-redundant case,
glthread is the solution.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sun, 27 Sep 2020 15:28:59 +0000 (11:28 -0400)]
mesa: move sampler condition for flushing into mesa_flush_vertices_for_uniforms
This is just a code consolidation. It might fix something, not sure.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sun, 27 Sep 2020 15:19:46 +0000 (11:19 -0400)]
mesa: call FLUSH_VERTICES before changing sampler uniforms
Fixes:
9545139ce5f "mesa: skip FLUSH_VERTICES() if no samplers were changed"
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sun, 27 Sep 2020 20:56:40 +0000 (16:56 -0400)]
mesa: don't print GL errors in release builds if MESA_DEBUG=silent
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Sat, 21 Nov 2020 00:49:24 +0000 (19:49 -0500)]
mesa: properly disallow param list reallocation
This can more easily detect shader variants adding too many state
parameters and causing a reallocation.
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Fri, 20 Nov 2020 23:12:17 +0000 (18:12 -0500)]
mesa: track ParameterValues size separately
This is needed for multi-slot parameters.
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Marek Olšák [Fri, 20 Nov 2020 22:58:16 +0000 (17:58 -0500)]
mesa: don't duplicate allocation code in _mesa_new_parameter_list_sized
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
Indrajit Kumar Das [Fri, 16 Oct 2020 04:39:02 +0000 (10:09 +0530)]
radeonsi/gfx10: fix overflow and primitive queries
This aligns the offsets to match the memory layout of the query buffer
defined by gfx10_sh_query_buffer_mem and calls si_launch_grid_internal
to flush caches and wait for completion of shaders prior to retrieving
results.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7181>
Iago Toral Quiroga [Tue, 1 Dec 2020 09:49:27 +0000 (10:49 +0100)]
v3dv: ignore filter in TFU blit path
The filter is only relevant to handle blits that invole scaling, but
our TFU path doesn't handle any kind of scaling so we can safely
ignore it.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7845>
Iago Toral Quiroga [Tue, 1 Dec 2020 09:12:54 +0000 (10:12 +0100)]
v3dv: add a helper to choose a compatible TFU format
We are now doing this in 3 different places so it makes sense.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7845>
Iago Toral Quiroga [Tue, 1 Dec 2020 09:13:42 +0000 (10:13 +0100)]
v3dv: handle Z mirroring in the TFU blit path
The TFU path only activates for blits that are really copies
(no linear filtering, no scaling, same pixel format, etc.), and
we do it slice by slice, so we can easily handle mirroring of the
Z coordinate for 3D images by reversing the order of the layers
as we copy them.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7845>
Iago Toral Quiroga [Tue, 1 Dec 2020 07:50:46 +0000 (08:50 +0100)]
v3dv: expand the formats that can be handled in the TFU blit path
Same as with other TFU paths, we only handle exact copies without
conversion, so we can rewrite the format to use a compatible TFU format
based on its texel size, which allows us to use this path with more
formats.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7845>
James Park [Fri, 27 Nov 2020 06:10:03 +0000 (22:10 -0800)]
aco: Avoid extra bitfield padding
MSVC may insert padding for data type switches.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785>
James Park [Fri, 27 Nov 2020 06:09:15 +0000 (22:09 -0800)]
aco: Stub sections that don't have _WIN32 support
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785>
James Park [Fri, 27 Nov 2020 06:08:42 +0000 (22:08 -0800)]
aco: Fix warnings for bools in bitwise logic
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785>
James Park [Fri, 27 Nov 2020 06:07:32 +0000 (22:07 -0800)]
aco: Initialize union within Operand for MSVC
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785>
James Park [Fri, 27 Nov 2020 06:07:07 +0000 (22:07 -0800)]
aco: Use u_memstream instead of POSIX memstream
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785>
James Park [Fri, 27 Nov 2020 06:06:22 +0000 (22:06 -0800)]
aco: Replace indexed array initialization
Use std::array instead to make MSVC happy.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785>
James Park [Fri, 27 Nov 2020 06:05:00 +0000 (22:05 -0800)]
aco: Const correct aco_compiler_statistics
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785>
James Park [Fri, 27 Nov 2020 06:04:29 +0000 (22:04 -0800)]
aco: Declare num_reduce_ops for array size
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785>
James Park [Fri, 27 Nov 2020 06:03:27 +0000 (22:03 -0800)]
aco: Remove nonstandard parentheses
Remove parentheses in cases where a parenthesized type is followed by an
initializer list.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785>
James Park [Fri, 27 Nov 2020 05:33:11 +0000 (21:33 -0800)]
aco: Add missing C++ includes
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785>
James Park [Fri, 27 Nov 2020 05:31:30 +0000 (21:31 -0800)]
aco: Fix warnings about unsafe integer/bool mix
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785>
James Park [Fri, 27 Nov 2020 05:29:13 +0000 (21:29 -0800)]
aco: Define NOMINMAX in Meson build file
Fix conflicts between std::min/max and Win32 min/max.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785>
Rhys Perry [Tue, 1 Dec 2020 09:54:31 +0000 (09:54 +0000)]
aco: use FALLTHROUGH macro
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7844>
Rhys Perry [Tue, 1 Dec 2020 09:54:18 +0000 (09:54 +0000)]
radv: use FALLTHROUGH macro
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7844>
Samuel Pitoiset [Tue, 24 Nov 2020 13:56:55 +0000 (14:56 +0100)]
radv/llvm,aco: always split typed vertex buffer loads on GFX6 and GFX10+
To avoid any alignment issues that triggers memory violations and
eventually a GPU. This can happen if the stride (static or dynamic)
is unaligned and also if the VBO offset is aligned to scalar
(eg. stride is 8 and VBO offset is 2 for R16G16B16A16_SNORM).
The AMD Windows driver also always splits typed vertex fetches.
fossils-db (Sienna Cichlid):
Totals from 56508 (40.54% of 139391) affected shaders:
SGPRs: 2643545 -> 2664516 (+0.79%); split: -0.19%, +0.98%
VGPRs: 2007472 -> 1995408 (-0.60%); split: -0.74%, +0.13%
CodeSize:
70596372 ->
73913312 (+4.70%); split: -0.00%, +4.70%
MaxWaves: 772653 -> 774916 (+0.29%); split: +0.37%, -0.08%
Instrs:
14074162 ->
14567072 (+3.50%); split: -0.00%, +3.51%
Cycles:
69281276 ->
71253252 (+2.85%); split: -0.00%, +2.85%
VMEM:
22047039 ->
25554196 (+15.91%); split: +17.20%, -1.29%
SMEM: 4120370 -> 4360820 (+5.84%); split: +7.41%, -1.58%
VClause: 416913 -> 438361 (+5.14%); split: -1.86%, +7.01%
SClause: 536739 -> 542637 (+1.10%); split: -0.33%, +1.43%
Copies: 977194 -> 970015 (-0.73%); split: -2.43%, +1.69%
Branches: 241205 -> 241193 (-0.00%); split: -0.06%, +0.06%
PreVGPRs: 1505645 -> 1505379 (-0.02%)
This fixes GPU hangs with bin/draw-vertices from Piglit on GFX10+
with Zink.
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7751>
Dave Airlie [Mon, 30 Nov 2020 23:15:10 +0000 (09:15 +1000)]
zink: allow the backend to optimise shaders.
I can't think of any reason for ever requesting this here,
maybe in some future with parallel threads optimised compiles
and where vulkan drivers respect this bit.
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7840>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:38:41 +0000 (11:38 +0100)]
glx: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:38:18 +0000 (11:38 +0100)]
tgsi: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:38:11 +0000 (11:38 +0100)]
egl: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:38:05 +0000 (11:38 +0100)]
amd/ac: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:30:08 +0000 (11:30 +0100)]
nir/ntt: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:30:01 +0000 (11:30 +0100)]
gallivm: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:29:49 +0000 (11:29 +0100)]
llvmpipe: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:29:45 +0000 (11:29 +0100)]
radeon: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:29:35 +0000 (11:29 +0100)]
gallium: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:29:26 +0000 (11:29 +0100)]
softpipe: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:29:09 +0000 (11:29 +0100)]
gallium/util: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:28:57 +0000 (11:28 +0100)]
vbo: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:28:49 +0000 (11:28 +0100)]
gallium/winsys: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:28:07 +0000 (11:28 +0100)]
radeonsi: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:15:59 +0000 (11:15 +0100)]
compiler/spirv: update fallthrough comments
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:04:00 +0000 (11:04 +0100)]
src/mesa: update fallthrough comments
clang doesn't support /* fallthrough */ so switch to fallthrough
attribute.
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:03:46 +0000 (11:03 +0100)]
xxhash: update fallthrough comments
clang doesn't support /* fallthrough */ so switch to fallthrough
attribute.
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:03:20 +0000 (11:03 +0100)]
gallium: update fallthrough comments
clang doesn't support /* fallthrough */ so switch to fallthrough
attribute.
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 10:02:00 +0000 (11:02 +0100)]
nir: update fallthrough comments
clang doesn't support /* fallthrough */ so switch to fallthrough
attribute.
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Pierre-Eric Pelloux-Prayer [Tue, 24 Nov 2020 17:02:49 +0000 (18:02 +0100)]
util: add a FALLTROUGH macro
Not all compilers support __atttribute__((fallthrough)) so use a macro.
v2: use C++17 / C18 standard attribute (Tony Wasserka)
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> (v1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747>
Lionel Landwerlin [Tue, 20 Oct 2020 07:41:48 +0000 (10:41 +0300)]
spirv: add support for KHR_fragment_shading_rate
v2: Use VARYING (Samuel)
v3: Only allow VERTEX & GEOMETRY stages (Samuel)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7795>
Lionel Landwerlin [Fri, 27 Nov 2020 10:26:34 +0000 (12:26 +0200)]
compiler/nir: introduce a new helper to get varying name
As we now reuse the enums to remain within 64 values, we need to get
the proper name using the stage.
v2: Use enum type for parameter (Jason)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7795>
Lionel Landwerlin [Tue, 20 Oct 2020 07:41:00 +0000 (10:41 +0300)]
nir: wire shading rate variables
v2: Fixup comment about bits in nir_intrinsics.py
v3: Use varying for primitive shading rate builtin (samuel)
v4: Reoder switch alphabetically
Make divergence of frag_shading_rate an option
v5: Remove stage check for frag_shading_rate in divergence (Samuel)
v6: s/frag_shading_rate_per_subgroup/single_frag_shading_rate_per_subgroup/ (Jason)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7795>
James Park [Mon, 30 Nov 2020 10:00:48 +0000 (02:00 -0800)]
vulkan/util: Consolidate typed_memcpy
Collapse typed_memcpy definitions into one header.
Use do/while(0) pattern to fix MSVC compilation.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7830>
James Park [Mon, 30 Nov 2020 08:57:55 +0000 (00:57 -0800)]
util: Add os_localtime
MSVC does not have localtime_r, so add abstraction.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7829>
Kenneth Graunke [Tue, 1 Dec 2020 00:14:55 +0000 (16:14 -0800)]
nir/algebraic: Avoid creating new fp64 ops when using softfp64
In commit
00b28a50b2c492eee25ef3f75538aabe1e569ff1, Marek extended
a number of optimizations that had been 32-bit specific to work on
other bit-sizes.
Most optimizations preserve the data type across the transformation.
In other words, an optimization which generates e.g. fp64 operations
only does so when the source expression also contains fp64 operations.
These transformations are fine with respect to lowering, because we
will lower away all expressions that would trigger the search portion
of the expression, and so we'd never apply those rules.
However, a few of the rules create new operations that run afoul of
lowering passes. For example,
('bcsel', a, 1.0, 0.0) => ('b2f', a)
where the result is a double would simply be a selection between two
different 64-bit constants. The replacement expression, on the other
hand, involves a nir_op_b2f64 ALU operation. If we're run after
nir_lower_doubles, then it may not be legal to generate such an
expression anymore (at least without running lowering again, which we
don't do today).
Regressions due to this are blocking the 20.3 release, so for now, we
take the easy route and simply disallow those few rules when doing full
softfp64 lowering, which fixes the immediate problem. But it doesn't
solve the long-term problem in an extensible manner.
In the future, we may want to add a `lowered_alu_ops` bitfield to the
NIR shader, and as lowering passes are run, mark them as taboo. Then,
we could have each algebraic transformation track which operations it
creates in the replacement expression. With both of those in place,
nir_replace_instr could compare the transformation's list of ALU ops
against `lowered_alu_ops` and implicitly skip rules that generate
forbidden ALU operations.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3504
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7841>
Rob Clark [Wed, 25 Nov 2020 00:54:52 +0000 (16:54 -0800)]
mesa: Use os_get_option() for MESA_*_OVERRIDE
This will allow for overriding via setprop mesa.*.override on android.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7763>
Rob Clark [Tue, 24 Nov 2020 20:38:47 +0000 (12:38 -0800)]
util: Add property_get() fallback for android
Environment variables aren't the easiest thing to use on android. So
add a fallback to android's property mechanism for os_get_option().
This is slightly complicated by the fact that the assumption that the
return value of os_get_option() need not be freed.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7763>
Jason Ekstrand [Mon, 30 Nov 2020 20:02:06 +0000 (14:02 -0600)]
intel/fs: DISCARD_JUMP does not have side-effects
This accidentally snuck into
75209d5bd1f6e93 due to a rebase fail.
Fixes:
75209d5bd1f6e93 "intel/fs: Add and implement intel-specific..."
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3897
Tested-by: Mark Janes <mark.a.janes@intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7839>
Jason Ekstrand [Mon, 30 Nov 2020 16:41:35 +0000 (10:41 -0600)]
nir: Use the right argument order for load_scratch_base_ptr
Fixes:
c9bcad25737 "nir: add generated intrinsic builders"
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7836>
Iago Toral Quiroga [Mon, 30 Nov 2020 06:44:28 +0000 (07:44 +0100)]
v3dv: check return value of drmGetMagic
Fixes coverty issue:
** CID 1470345: Error handling issues (CHECKED_RETURN)
/src/broadcom/vulkan/v3dv_device.c: 407 in v3dv_drm_handle_device()
Calling "drmGetMagic" without checking return value (as is done
elsewhere 5 out of 6 times).
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7828>
Iago Toral Quiroga [Mon, 30 Nov 2020 09:15:57 +0000 (10:15 +0100)]
v3dv: expand format coverage in TFU path for buffer to image copies
Just like we do for image copies, since we are not doing any pixel
format conversions, we can translate the image format to a compatible
format that is supported by the TFU.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7809>