platform/upstream/mesa.git
2 years agoiris: fix mapping compressed textures
Filip Gawin [Wed, 18 Aug 2021 07:57:09 +0000 (09:57 +0200)]
iris: fix mapping compressed textures

This code was originally made for crocus by Dave Airlie.
Iris is also affected, so this commit ports the fix.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12993>

2 years agoci: remove egl-copy-buffers from fail list
Qiang Yu [Fri, 26 Nov 2021 02:59:01 +0000 (10:59 +0800)]
ci: remove egl-copy-buffers from fail list

egl-copy-buffers test has been fixed for dri3. So remove
it from broadcom and freedreno ci fail list to prevent the
gitlab ci test fail:

  spec@egl 1.4@egl-copy-buffers,UnexpectedPass

Also remove it from radeonsi ci fail list since I verified
on radeonsi.

Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13868>

2 years agoloader/dri3: fix piglit egl-copy-buffer test
Qiang Yu [Fri, 19 Nov 2021 01:24:38 +0000 (09:24 +0800)]
loader/dri3: fix piglit egl-copy-buffer test

In the test no front buffer has been allocated on the client
side, so we get a segfault when access it directly.

eglCopyBuffers() just need to do server side copy, so we don't
really need to create a client side front buffer to perform
the copy.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13868>

2 years agonir: Fix read depth for predecessors
Mykhailo Skorokhodov [Mon, 1 Nov 2021 15:15:00 +0000 (17:15 +0200)]
nir: Fix read depth for predecessors

In some non-trivial cases (the amber script file in the merge
request description) phi instruction has more than 32 elements
in predecessors tree and that isn't recursion, just large tree.
In that case, phis not fully converted into a register or mov,
but successfully removed.

The fix removes the counter and adds container of visited blocks.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3690
Cc: mesa-stable
Signed-off-by: Mykhailo Skorokhodov <mykhailo.skorokhodov@globallogic.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13710>

2 years agoci: move windowoverlap exclusion to all-skips
Ilia Mirkin [Tue, 23 Nov 2021 03:34:47 +0000 (22:34 -0500)]
ci: move windowoverlap exclusion to all-skips

The test is just plain not built by our containers. Skip it everywhere.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13919>

2 years agonir/tests: add DCE test for loops following a jump
Rhys Perry [Tue, 20 Apr 2021 08:57:56 +0000 (09:57 +0100)]
nir/tests: add DCE test for loops following a jump

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10284>

2 years agonir/cf: fix insertion of loops/ifs after jumps
Rhys Perry [Tue, 20 Apr 2021 08:57:04 +0000 (09:57 +0100)]
nir/cf: fix insertion of loops/ifs after jumps

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10284>

2 years agonir/dce: fix DCE of loops with a halt or return instruction in the pre-header
Rhys Perry [Fri, 16 Apr 2021 12:18:33 +0000 (13:18 +0100)]
nir/dce: fix DCE of loops with a halt or return instruction in the pre-header

If there is a halt or return instruction right before a loop with a single
continue, we would have taken the fast path intended for loops without
continues.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 71a985d80b1 ("nir/dce: perform DCE for unlooped instructions in a single pass")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10284>

2 years agolima: fix blending with min/max ops
Vasily Khoruzhick [Wed, 24 Nov 2021 02:10:19 +0000 (18:10 -0800)]
lima: fix blending with min/max ops

It turns out that BLEND_MIN and BLEND_MAX in Utgard take blend factors
into account. My guess is that actual equation looks like:

OP(As * S + Ad * D, Ad) for alpha, and
OP(Cs * S + Cd * D, Cd) for color.

So we have to set S factor to 1 and D factor to 0 to be compliant with
GL spec.

Fixes following piglit tests:
spec@!opengl 1.4@blendminmax
spec@arb_blend_func_extended@arb_blend_func_extended-fbo-extended-blend
(with patch my for ES2_compatibility and EXT_blend_func_extended)

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13873>

2 years agolima: use 1 as blend factor for dst_alpha for SRC_ALPHA_SATURATE
Vasily Khoruzhick [Wed, 24 Nov 2021 06:31:04 +0000 (22:31 -0800)]
lima: use 1 as blend factor for dst_alpha for SRC_ALPHA_SATURATE

As per [1] alpha blend factors for Sa and Da should be 1 for
SRC_ALPHA_SATURATE

[1] https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_blend_func_extended.txt

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13873>

2 years agolima: implement dual source blend
Vasily Khoruzhick [Fri, 19 Nov 2021 04:53:18 +0000 (20:53 -0800)]
lima: implement dual source blend

It was a bit trickier to RE, since blob doesn't expose this
functionality at all, however we had a clue from the very beginning:
lima_blend_factor is 3 bits, i.e. 8 values, but only 5 of them were
used, it just waited till someone tried what 3 unused values do.

Interestingly enough, it turns out "5" works just as "0" (which is
PIPE_BLENDFACTOR_*SRC_*), but only if output register for gl_FragColor
is $0, So it looks suspiciously similar with PIPE_BLENDFACTOR_*SRC1_*
behavior, and looks like secondary output is taken from $0.

Since output regs for all other outputs are configured via RSW, there
must be a field in RSW for output register for secondary color, it's
likely 4 bits and it's currently set to 0 for reg $0.

Then it was just a matter of brute-forcing various consecutive 4 bits
in RSW - and indeed, setting top 4 bits of rsw->aux0 to the index of
gl_FragColor output register fixes blending tests when we use "5"
blend factor instead of "0".

So it must be a register number for gl_SecondaryFragColor. Unlike
gl_FragColor, the field is only repeated once in RSW.

Wire it up in compiler, and piglit arb_blend_func_extended now passes.

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13873>

2 years agoaco: properly update use counts if a extract is still used
Rhys Perry [Mon, 22 Nov 2021 11:03:03 +0000 (11:03 +0000)]
aco: properly update use counts if a extract is still used

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13909>

2 years agolima: disasm: call util_cpu_detect() to init CPU caps
Vasily Khoruzhick [Sat, 27 Nov 2021 02:04:51 +0000 (18:04 -0800)]
lima: disasm: call util_cpu_detect() to init CPU caps

It's needed by _mesa_half_to_float(), without this change it hits
assertion failure in util_get_cpu_caps().

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13968>

2 years agolima: disasm: use last argument as a filename
Vasily Khoruzhick [Sat, 27 Nov 2021 02:02:59 +0000 (18:02 -0800)]
lima: disasm: use last argument as a filename

Otherwise it fails to open a file.

Fixes: 9660427ab7b3 ("lima: Print usage if --help is any of the arguments.")
Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13968>

2 years agolima: fix crash with sparse samplers
Vasily Khoruzhick [Wed, 24 Nov 2021 02:02:33 +0000 (18:02 -0800)]
lima: fix crash with sparse samplers

Fixes following piglit tests:
spec@arb_fragment_program@fp-fragment-position
spec@arb_fragment_program@sparse-samplers

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13939>

2 years agoglthread: don't sync for more glGetIntegerv enums for glretrace
Marek Olšák [Sun, 28 Nov 2021 13:09:15 +0000 (08:09 -0500)]
glthread: don't sync for more glGetIntegerv enums for glretrace

This makes glretrace faster with glthread.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13970>

2 years agobroadcom/compiler: relax restriction on VPM inst in last thread end slot
Iago Toral Quiroga [Mon, 29 Nov 2021 11:39:24 +0000 (12:39 +0100)]
broadcom/compiler: relax restriction on VPM inst in last thread end slot

According to the documentation, only vpmwt is disallowed in the last delay
slot of the thread end.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13975>

2 years agoradv: dont call calloc when BVH is empty
Filip Gawin [Sat, 23 Oct 2021 14:59:13 +0000 (16:59 +0200)]
radv: dont call calloc when BVH is empty

Usage of pointer returned by calloc(0) is UB.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13503>

2 years agoradv/llvm: constify radv_shader_info
Samuel Pitoiset [Wed, 27 Oct 2021 09:20:15 +0000 (11:20 +0200)]
radv/llvm: constify radv_shader_info

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13542>

2 years agoradv/llvm: stop trying to eliminate VS outputs
Samuel Pitoiset [Wed, 27 Oct 2021 09:13:30 +0000 (11:13 +0200)]
radv/llvm: stop trying to eliminate VS outputs

This has no effects, except for XFB but that shouldn't really matter.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13542>

2 years agoradv: constify radv_shader_info in radv_declare_shader_args()
Samuel Pitoiset [Mon, 29 Nov 2021 08:29:58 +0000 (09:29 +0100)]
radv: constify radv_shader_info in radv_declare_shader_args()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13542>

2 years agoradv: copy the user SGPRs locations outside of radv_declare_shader_args()
Samuel Pitoiset [Mon, 29 Nov 2021 08:29:22 +0000 (09:29 +0100)]
radv: copy the user SGPRs locations outside of radv_declare_shader_args()

The shader locations are now directly stored in radv_shader_args which
makes sense because they are tied to the arguments. The locations are
then copied to radv_shader_info but they will be moved into a new
radv_shader_binary_info with upcoming changes.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13542>

2 years agoradv: configure the number of SGPRs/VGPRs directly from the arguments
Samuel Pitoiset [Wed, 27 Oct 2021 08:20:24 +0000 (10:20 +0200)]
radv: configure the number of SGPRs/VGPRs directly from the arguments

Instead of copying the values to radv_shader_info.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13542>

2 years agoradv: add a workaround to fix a segfault with Metro Exodus (Linux native)
Samuel Pitoiset [Wed, 24 Nov 2021 17:22:23 +0000 (18:22 +0100)]
radv: add a workaround to fix a segfault with Metro Exodus (Linux native)

The game calls vkGetSemaphoreCounterValue() with an invalid semaphore
handle and it crashes. This is an invalid Vulkan usage and it should
be fixed in the game. I reported the issue to the developers.

Workaround this temporarily (hopefully) by ignoring
vkGetSemaphoreCounterValue() if the semaphore is NULL from an internal
RADV layer.

Cc: 21.3 mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5119
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13956>

2 years agoradv: fix accessing NULL pointers when destroy the VRS image
Samuel Pitoiset [Fri, 26 Nov 2021 15:14:30 +0000 (16:14 +0100)]
radv: fix accessing NULL pointers when destroy the VRS image

Detected by UBSAN.

../src/amd/vulkan/radv_private.h:2939:1: runtime error: member access
within null pointer of type 'struct radv_device_memory'

../src/amd/vulkan/radv_private.h:2926:1: runtime error: member access
within null pointer of type 'struct radv_buffer'

../src/amd/vulkan/radv_private.h:2945:1: runtime error: member access
within null pointer of type 'struct radv_image'

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13965>

2 years agobroadcom/compiler: allow color TLB writes in last instruction
Iago Toral Quiroga [Thu, 25 Nov 2021 10:59:48 +0000 (11:59 +0100)]
broadcom/compiler: allow color TLB writes in last instruction

Only Z writes are disallowed.

total instructions in shared programs: 11578449 -> 11577369 (<.01%)
instructions in affected programs: 38132 -> 37052 (-2.83%)
helped: 1080
HURT: 0
Instructions are helped.

total max-temps in shared programs: 2334416 -> 2334395 (<.01%)
max-temps in affected programs: 218 -> 197 (-9.63%)
helped: 21
HURT: 0
Max-temps are helped.

total inst-and-stalls in shared programs: 11607890 -> 11606810 (<.01%)
inst-and-stalls in affected programs: 38265 -> 37185 (-2.82%)
helped: 1080
HURT: 0
Inst-and-stalls are helped.

total nops in shared programs: 338316 -> 337236 (-0.32%)
nops in affected programs: 2625 -> 1545 (-41.14%)
helped: 1080
HURT: 0
Nops are helped.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13964>

2 years agofreedreno/ir3: get the post-lowering clip/cull mask
Ilia Mirkin [Sun, 21 Nov 2021 00:17:43 +0000 (19:17 -0500)]
freedreno/ir3: get the post-lowering clip/cull mask

The variant may include a lowered gl_Clip/CullDistance array. So we have
to use the variant's info (which is not available). However we save off
the clip/cull masks already, so just reuse those.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13891>

2 years agofreedreno/ir3: indicate that clipdist arrays are in use
Ilia Mirkin [Sat, 20 Nov 2021 08:42:03 +0000 (03:42 -0500)]
freedreno/ir3: indicate that clipdist arrays are in use

We expose the compact array cap, which means that we get compact
clipdist arrays. Indicate this to the lowering pass so that it works for
gl_ClipDistance from fs, among others.

Fixes, among others, on a420,

tests/spec/glsl-1.30/execution/clipping/fs-clip-distance-interpolated.shader_test

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13891>

2 years agonir/lower_clip: support clipdist array + no vars
Ilia Mirkin [Tue, 23 Nov 2021 00:06:52 +0000 (19:06 -0500)]
nir/lower_clip: support clipdist array + no vars

This runs after the "to io" lowering on freedreno. Support this case.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>

2 years agonir/lower_clip: increment num_inputs/outputs by appropriate amount
Ilia Mirkin [Mon, 22 Nov 2021 22:54:50 +0000 (17:54 -0500)]
nir/lower_clip: increment num_inputs/outputs by appropriate amount

The inputs/outputs are meant to be in vec4 units.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>

2 years agonir/lower_clip: location offset goes into offset, not base
Ilia Mirkin [Mon, 22 Nov 2021 22:54:09 +0000 (17:54 -0500)]
nir/lower_clip: location offset goes into offset, not base

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>

2 years agonir/lower_clip: replace bogus comment about gl_ClipDistance reading in GL
Ilia Mirkin [Sun, 21 Nov 2021 08:18:25 +0000 (03:18 -0500)]
nir/lower_clip: replace bogus comment about gl_ClipDistance reading in GL

gl_ClipDistance most definitely can be read in fragment shaders since
GLSL 1.30. This is also accessible in ES with EXT_clip_cull_distance.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>

2 years agoegl/wayland: use surface dma-buf feedback to allocate surface buffers
Leandro Ribeiro [Mon, 26 Jul 2021 20:53:24 +0000 (17:53 -0300)]
egl/wayland: use surface dma-buf feedback to allocate surface buffers

As explained in "egl/wayland: add initial dma-buf feedback support", we
still don't use the per-surface dma-buf feedback. In this patch we start
to use it.

If per-surface dma-buf feedback is advertised, use it to allocate
surface buffers. Also, the dma-buf protocol states that the feedback is
resent only when the client is using a suboptimal format/modifier pair.
So listen for new per-surface feedback events and reallocate the surface
buffers based on them. We can't change the format of a buffer, but we
can pick a new modifier.

This patch is based on previous work of Scott Anderson (@ascent).

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: move loader_dri_create_image() calls to separate functions
Leandro Ribeiro [Tue, 8 Jun 2021 18:13:40 +0000 (15:13 -0300)]
egl/wayland: move loader_dri_create_image() calls to separate functions

In get_back_bo() we have two calls to loader_dri_create_image() and some
overhead. As in the next commit we add another call to this same
function and more overhead to get_back_bo(), it starts to lose
legibility.

So move loader_dri_create_image() calls to separate functions, allowing
us to have an easier to read get_back_bo(). It also adds some minor
style changes.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: add initial dma-buf feedback support
Leandro Ribeiro [Mon, 15 Nov 2021 16:51:12 +0000 (13:51 -0300)]
egl/wayland: add initial dma-buf feedback support

This bumps the supported dma-buf version up to 4 and adds the initial
dma-buf feedback implementation. It follows the changes in the dma-buf
protocol extension [1] to include the dma-buf feedback interface, which
should be incorporated by most Wayland compositors in the future.

From version 4 onwards, the dma-buf modifier events are not sent by the
compositor anymore, so we use the default feedback to pick the set of
formats/modifiers supported by the compositor. Also, we try to avoid the
wl_drm device event and instead use the dma-buf feedback main device. We
only fallback to wl_drm when the compositor advertises a device that
does not have a render node associated.

In this initial dma-buf feedback implementation we still don't do
anything with the per-surface dma-buf feedback, but in the next commits
we add proper support.

It's important to mention that this also bumps the minimal supported
version of wayland-protocols to 1.24, in order to include [1].

[1] https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/8

This patch is based on previous work of Scott Anderson (@ascent).

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoloader: add function to get render node from dev_t
Leandro Ribeiro [Mon, 15 Nov 2021 16:50:50 +0000 (13:50 -0300)]
loader: add function to get render node from dev_t

Add function loader_get_render_node() to help us to get a render node
from dev_t. If the device does not expose a render node, this new
function returns NULL.

As this function uses drmGetDeviceFromDevId(), we bump libdrm minimal
version to 2.4.109.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: remove unused constant EGL_DRI2_NUM_FORMATS
Leandro Ribeiro [Tue, 29 Jun 2021 00:18:31 +0000 (21:18 -0300)]
egl/wayland: remove unused constant EGL_DRI2_NUM_FORMATS

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: move formats and modifiers to a separate struct
Leandro Ribeiro [Mon, 28 Jun 2021 23:42:11 +0000 (20:42 -0300)]
egl/wayland: move formats and modifiers to a separate struct

This will allow us to remove EGL_DRI2_NUM_FORMATS (as explained in
"egl/wayland: remove unused constant EGL_DRI2_NUM_FORMATS") and it will
also help to add the dma-buf feedback support. Both changes happen in
the next commits.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: do not try to access memory if allocation failed
Leandro Ribeiro [Tue, 29 Jun 2021 00:06:17 +0000 (21:06 -0300)]
egl/wayland: do not try to access memory if allocation failed

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: deprecate drm_handle_format() and drm_handle_capabilities()
Leandro Ribeiro [Mon, 28 Jun 2021 22:28:35 +0000 (19:28 -0300)]
egl/wayland: deprecate drm_handle_format() and drm_handle_capabilities()

Most Wayland compositors have already implemented the dma-buf protocol
extension. So we can stop relying on the wl_drm events and start to
depend only on the dma-buf interface to receive format/modifier pairs
and create wl_buffer's. So we can deprecate drm_handle_format() and
drm_handle_capabilities().

Note that we still use the wl_drm interface to find out the DRM device
that the compositor is using, so we can't deprecate it fully for now. In
the future (when the dma-buf feedback interface is added to the dma-buf
protocol extension [1] and most compositors incorporate it) we may be
able to fully deprecate wl_drm.

[1] https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/8

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: replace EGL_DRI2_MAX_FORMATS by EGL_DRI2_NUM_FORMATS
Leandro Ribeiro [Mon, 28 Jun 2021 16:57:19 +0000 (13:57 -0300)]
egl/wayland: replace EGL_DRI2_MAX_FORMATS by EGL_DRI2_NUM_FORMATS

Currently we have a weird design. We have a hardcoded array (named
dri2_wl_visuals) with all the formats that we support, which are 9.

And we also have EGL_DRI2_MAX_FORMATS, which is a constant set to 10. In
patches in which people added new formats to dri2_wl_visuals, this
constant had its value increased. This is confusing, as its name gives
the idea that we can't support more formats.

This constant is only used to define the bitset size of
dri2_egl_display::formats. And it should work just fine if we created
this bitset with the number of formats supported.

To make things clearer, replace EGL_DRI2_MAX_FORMATS by
EGL_DRI2_NUM_FORMATS, which must be equal to ARRAY_SIZE(dri2_wl_visuals)
(i.e. the number of supported formats).

In the next commits we get rid of this constant completely, as it is
prone to errors.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: Remove unused wayland enum
Scott Anderson [Fri, 15 May 2020 08:42:45 +0000 (20:42 +1200)]
egl/wayland: Remove unused wayland enum

Signed-off-by: Scott Anderson <scott@anderso.nz>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl: remove unnecessary spaces after types
Leandro Ribeiro [Mon, 28 Jun 2021 20:36:33 +0000 (17:36 -0300)]
egl: remove unnecessary spaces after types

If we want to add a variable with a type name that is too long, we have
to realign all the variables within these structs. The other option is
to ignore and don't realign, and then we end up with a very ugly code.

So get rid of these unnecessary spaces, as they don't bring anything
useful. Instead, they are annoying.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoci: Upgrade to libdrm 2.4.109
Daniel Stone [Thu, 25 Nov 2021 22:16:26 +0000 (23:16 +0100)]
ci: Upgrade to libdrm 2.4.109

Required for being able to use drmGetDeviceFromDevId in the loader.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoci: Consistently build Wayland and protocols
Daniel Stone [Thu, 25 Nov 2021 15:59:44 +0000 (16:59 +0100)]
ci: Consistently build Wayland and protocols

Rather than relying on distro packages, build libwayland and
wayland-protocols from known versions everywhere we need it.

The only place we do not do so but rely on distro packages is the LAVA
rootfs, for which it does not matter right now since the version is
sufficiently new, but this could/should be cleaned up later.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoci: Use common build script for libwayland
Daniel Stone [Thu, 25 Nov 2021 15:49:03 +0000 (16:49 +0100)]
ci: Use common build script for libwayland

Rather than open-coding libwayland install for each container, create a
common build script like the rest, using both git and meson like the
rest.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoradv: advertise VK_KHR_synchronization2
Samuel Pitoiset [Tue, 12 Oct 2021 11:35:10 +0000 (13:35 +0200)]
radv: advertise VK_KHR_synchronization2

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: switch the remaining stages/access to VK_PIPELINE_STAGE_2/VK_ACCESS_2
Samuel Pitoiset [Tue, 12 Oct 2021 16:41:55 +0000 (18:41 +0200)]
radv: switch the remaining stages/access to VK_PIPELINE_STAGE_2/VK_ACCESS_2

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: add support for VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR
Samuel Pitoiset [Thu, 14 Oct 2021 09:10:09 +0000 (11:10 +0200)]
radv: add support for VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: add support for new pipeline stages and access masks
Samuel Pitoiset [Thu, 14 Oct 2021 08:52:20 +0000 (10:52 +0200)]
radv: add support for new pipeline stages and access masks

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: add support for creating device-only events
Samuel Pitoiset [Wed, 13 Oct 2021 12:40:59 +0000 (14:40 +0200)]
radv: add support for creating device-only events

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: add support for VkMemoryBarrier2KHR
Samuel Pitoiset [Tue, 12 Oct 2021 15:54:41 +0000 (17:54 +0200)]
radv: add support for VkMemoryBarrier2KHR

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: implement vkQueueSubmit2KHR()
Samuel Pitoiset [Thu, 14 Oct 2021 07:55:16 +0000 (09:55 +0200)]
radv: implement vkQueueSubmit2KHR()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: implement vkCmdWaitEvents2KHR()/vkCmdPipelineBarrier2KHR()
Samuel Pitoiset [Tue, 12 Oct 2021 16:41:34 +0000 (18:41 +0200)]
radv: implement vkCmdWaitEvents2KHR()/vkCmdPipelineBarrier2KHR()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: implement vkCmdWriteBufferMarker2AMD()
Samuel Pitoiset [Tue, 12 Oct 2021 16:32:21 +0000 (18:32 +0200)]
radv: implement vkCmdWriteBufferMarker2AMD()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: implement vkCmd{Reset,Set}Event2KHR()
Samuel Pitoiset [Tue, 12 Oct 2021 16:32:08 +0000 (18:32 +0200)]
radv: implement vkCmd{Reset,Set}Event2KHR()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: implement vkCmdWriteTimestamp2KHR()
Samuel Pitoiset [Tue, 12 Oct 2021 16:31:42 +0000 (18:31 +0200)]
radv: implement vkCmdWriteTimestamp2KHR()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradeonsi: print the shader stage for shader-db dumps
Marek Olšák [Wed, 24 Nov 2021 18:56:32 +0000 (13:56 -0500)]
radeonsi: print the shader stage for shader-db dumps

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13869>

2 years agoradeonsi: print source_sha1 as part of shader dumps
Marek Olšák [Thu, 18 Nov 2021 14:36:11 +0000 (09:36 -0500)]
radeonsi: print source_sha1 as part of shader dumps

It's not part of the shader key, but I don't know where else to put it.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13869>

2 years agonir: add shader_info::source_sha1, its initialization and printing
Marek Olšák [Thu, 18 Nov 2021 14:28:17 +0000 (09:28 -0500)]
nir: add shader_info::source_sha1, its initialization and printing

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13869>

2 years agoutil: add SHA1 printing and comparison functions
Marek Olšák [Thu, 18 Nov 2021 22:19:39 +0000 (17:19 -0500)]
util: add SHA1 printing and comparison functions

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13869>

2 years agomesa: don't compute the same SHA1 twice in glShaderSource
Marek Olšák [Fri, 19 Nov 2021 08:04:11 +0000 (03:04 -0500)]
mesa: don't compute the same SHA1 twice in glShaderSource

We can just use original_sha1.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13869>

2 years agomesa: add gl_linked_shader::linked_source_sha1
Marek Olšák [Thu, 18 Nov 2021 14:15:27 +0000 (09:15 -0500)]
mesa: add gl_linked_shader::linked_source_sha1

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13869>

2 years agomesa: add shader source SHA1s that are propagated up to glCompileShader
Marek Olšák [Thu, 18 Nov 2021 13:44:29 +0000 (08:44 -0500)]
mesa: add shader source SHA1s that are propagated up to glCompileShader

glCompileShader can use two different sources, so we need 2 different SHA1s
there. Successful compilation sets compiled_source_sha1.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13869>

2 years agomesa: rename gl_shader::sha1 to disk_cache_sha1
Marek Olšák [Thu, 18 Nov 2021 13:40:29 +0000 (08:40 -0500)]
mesa: rename gl_shader::sha1 to disk_cache_sha1

there will be more sha1s

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13869>

2 years agomesa: remove SourceChecksum from shader structures
Marek Olšák [Thu, 18 Nov 2021 13:37:47 +0000 (08:37 -0500)]
mesa: remove SourceChecksum from shader structures

it will be replaced by sha1.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13869>

2 years agoradeonsi: rename si_get_shader_wave_size and make it non-inline
Marek Olšák [Wed, 24 Nov 2021 18:21:18 +0000 (13:21 -0500)]
radeonsi: rename si_get_shader_wave_size and make it non-inline

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13878>

2 years agoradeonsi: centralize wave size computation in si_get_shader_wave_size
Marek Olšák [Thu, 18 Nov 2021 23:36:37 +0000 (18:36 -0500)]
radeonsi: centralize wave size computation in si_get_shader_wave_size

The big comment was not really true.

The other debug options are unused right now, but will be used again
in the future.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13878>

2 years agoradeonsi: don't use compute_wave_size directly
Marek Olšák [Fri, 19 Nov 2021 11:39:04 +0000 (06:39 -0500)]
radeonsi: don't use compute_wave_size directly

It will be removed.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13878>

2 years agoradeonsi: propagate si_shader::wave_size to VGT_SHADER_STAGES
Marek Olšák [Fri, 19 Nov 2021 09:44:27 +0000 (04:44 -0500)]
radeonsi: propagate si_shader::wave_size to VGT_SHADER_STAGES

instead of hardcoding them

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13878>

2 years agoradeonsi: clean up compute_wave_size use in si_compute_blit.c
Marek Olšák [Fri, 19 Nov 2021 09:31:54 +0000 (04:31 -0500)]
radeonsi: clean up compute_wave_size use in si_compute_blit.c

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13878>

2 years agoradeonsi: don't use si_get_wave_size in si_get_ir_cache_key
Marek Olšák [Thu, 18 Nov 2021 23:44:00 +0000 (18:44 -0500)]
radeonsi: don't use si_get_wave_size in si_get_ir_cache_key

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13878>

2 years agoradeonsi: use si_shader::wave_size
Marek Olšák [Fri, 19 Nov 2021 09:01:34 +0000 (04:01 -0500)]
radeonsi: use si_shader::wave_size

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13878>

2 years agoradeonsi: add si_shader::wave_size because it will vary
Marek Olšák [Fri, 19 Nov 2021 08:46:29 +0000 (03:46 -0500)]
radeonsi: add si_shader::wave_size because it will vary

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13878>

2 years agoradeonsi: add wave32 flag into prolog/epilog keys
Marek Olšák [Thu, 18 Nov 2021 23:19:45 +0000 (18:19 -0500)]
radeonsi: add wave32 flag into prolog/epilog keys

It will vary between shaders.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13878>

2 years agoradeonsi: don't print uninitialized inlined_uniform_values
Marek Olšák [Thu, 18 Nov 2021 22:36:14 +0000 (17:36 -0500)]
radeonsi: don't print uninitialized inlined_uniform_values

We don't set them and we don't read them if they are disabled, so don't
print them either. This silences valgrind warnings.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13878>

2 years agodriconf: enable glthread for Basemark GPU
Marek Olšák [Wed, 24 Nov 2021 21:40:01 +0000 (16:40 -0500)]
driconf: enable glthread for Basemark GPU

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13947>

2 years agodriconf: enable glthread for Minecraft
Marek Olšák [Wed, 24 Nov 2021 17:58:48 +0000 (12:58 -0500)]
driconf: enable glthread for Minecraft

+30% performance

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13947>

2 years agodriconf: enable glthread for all Unigine benchmarks
Marek Olšák [Wed, 24 Nov 2021 13:15:10 +0000 (08:15 -0500)]
driconf: enable glthread for all Unigine benchmarks

It helps.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13947>

2 years agoaco: fix right shift of exponent 32 detected by UBSAN
Samuel Pitoiset [Thu, 25 Nov 2021 06:36:10 +0000 (07:36 +0100)]
aco: fix right shift of exponent 32 detected by UBSAN

src/amd/compiler/aco_optimizer.cpp:1316:17: runtime error: shift
exponent 32 is too large for 32-bit type 'unsigned int'

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/13951>

2 years agoradv: fix OOB access for inline push constants detected by UBSAN
Samuel Pitoiset [Thu, 25 Nov 2021 11:33:57 +0000 (12:33 +0100)]
radv: fix OOB access for inline push constants detected by UBSAN

src/amd/vulkan/radv_cmd_buffer.c:3232:75: runtime error: index 252 out
of bounds for type 'uint8_t [128]'

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/13951>

2 years agoac/nir: fix left shift of 1 by 31 places detected by UBSAN
Samuel Pitoiset [Wed, 24 Nov 2021 13:18:47 +0000 (14:18 +0100)]
ac/nir: fix left shift of 1 by 31 places detected by UBSAN

src/amd/common/ac_nir_lower_ngg.c:1135:62: runtime error: left shift
of 1 by 31 places cannot be represented in type 'int

src/amd/common/ac_nir_lower_ngg.c:622:20: runtime error: left shift
of 1 by 31 places cannot be represented in type 'int'

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/13951>

2 years agoutil/cpu_detect, gallium: use cpu_family CPU_S390X instead of separate flag
Marius Hillenbrand [Thu, 25 Nov 2021 11:48:27 +0000 (12:48 +0100)]
util/cpu_detect, gallium: use cpu_family CPU_S390X instead of separate flag

to also get rid of the additional function that I introduced before.

Fixes: 82b261417e53 ("util/cpu_detect: Add flag for IBM Z (s390x)")

Signed-off-by: Marius Hillenbrand <mhillen@linux.ibm.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13958>

2 years agoir3/cp: Prevent setting an address on subgroup macros
Danylo Piliaiev [Tue, 23 Nov 2021 16:57:17 +0000 (18:57 +0200)]
ir3/cp: Prevent setting an address on subgroup macros

These macros expand to a mov in an if statement which breaks address
assumption that instruction which produces address and consumes it
are in the same block.

Fixes test:
 dEQP-VK.subgroups.ballot_broadcast.framebuffer.subgroupbroadcast_intvertex

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13931>

2 years agomesa: add a more straightforward callback for replacing shaders
Marek Olšák [Wed, 24 Nov 2021 17:49:08 +0000 (12:49 -0500)]
mesa: add a more straightforward callback for replacing shaders

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13946>

2 years agoir3/lower_subgroups: Fix potential infinite loop
Connor Abbott [Tue, 23 Nov 2021 15:21:24 +0000 (16:21 +0100)]
ir3/lower_subgroups: Fix potential infinite loop

I was trying to be clever here, skipping ahead to the newly-created
block and processing the remaining instructions after the split in the
same loop. But if the last instruction in a block was lowered, the saved
next instruction would be the head of the block before the split, not
the new block, and we would compare it to the new block so we wouldn't
stop like we were supposed to. Stop being so clever, and just restart
processing with the new block after lowering an instruction.

Because we're wrapping the actual transform in yet another loop, and the
restarting logic is a bit tricky, refactor the actual lowering into a
separate lower_instr function. Otherwise we'd be mixing the two and
indenting the actual logic even more.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13928>

2 years agodocs/release-calendar: remove additional 21.2 releases
Dylan Baker [Thu, 25 Nov 2021 05:25:02 +0000 (21:25 -0800)]
docs/release-calendar: remove additional 21.2 releases

21.3 is here, and will be releasing the .1 release before any of the
additional 21.2 releases would be made anyway.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13950>

2 years agodocs: update calendar and link releases notes for 21.2.6
Dylan Baker [Thu, 25 Nov 2021 05:24:37 +0000 (21:24 -0800)]
docs: update calendar and link releases notes for 21.2.6

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13950>

2 years agodocs: add sha256 sums for 21.2.6 relnotes
Dylan Baker [Thu, 25 Nov 2021 05:22:06 +0000 (21:22 -0800)]
docs: add sha256 sums for 21.2.6 relnotes

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13950>

2 years agodocs: add release notes for 21.2.6
Dylan Baker [Wed, 24 Nov 2021 23:47:39 +0000 (15:47 -0800)]
docs: add release notes for 21.2.6

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13950>

2 years agomeson: bump meson requirement to 0.53.0
Alejandro Piñeiro [Sun, 21 Nov 2021 21:45:15 +0000 (22:45 +0100)]
meson: bump meson requirement to 0.53.0

Needed to avoid the following error:
   meson.build:936:0: ERROR: Tried to access unknown option "cpp_rtti"

Fixes: ad8626741236 ("meson: Don't override built-in cpp_rtti option, error if it's invalid")

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13905>

2 years agoradv: Set RB+ registers correctly without framebuffer.
Bas Nieuwenhuizen [Mon, 8 Nov 2021 12:21:30 +0000 (13:21 +0100)]
radv: Set RB+ registers correctly without framebuffer.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13699>

2 years agoradv: Remove the skipping of framebuffer emission if we don't have a framebuffer.
Bas Nieuwenhuizen [Sun, 7 Nov 2021 19:30:01 +0000 (20:30 +0100)]
radv: Remove the skipping of framebuffer emission if we don't have a framebuffer.

This was plain broken. The solution is to not require any framebuffer
changes. Silently skipping results in broken behavior. e.g:

(secondary cmdbuffer with no framebuffer)
ClearAttachment 2

translated into

bind attachment 2 as attachment 0 (skipped)
clear attachment 0
restore original bindings (skipped)

which results in clearing attachment 0, not what we wanted. It is
a small wonder CTS doesn't find it until VK_KHR_dynamic_rendering.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13699>

2 years agoradv: Stop using a subpass for color clears.
Bas Nieuwenhuizen [Sun, 7 Nov 2021 19:19:49 +0000 (20:19 +0100)]
radv: Stop using a subpass for color clears.

They might not be available in secondary cmdbuffers with inheritance.

To avoid binding anything we need to create pipelines per attachment
index. I've excluded these from the "compile on device creation" set
because I think almost nobody will need them.

Alternative solution would be to reuse the same shader but muck with
a bunch of registers to shift them for the attachment index. That is
however a lot of complexity and has to execute on every pipeline
change, which is probably more expensive in overhead and definitely
in complexity.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13699>

2 years agoradv: Avoid using a new subpass for ds clears.
Bas Nieuwenhuizen [Sun, 7 Nov 2021 19:29:56 +0000 (20:29 +0100)]
radv: Avoid using a new subpass for ds clears.

If we have an inherited subpass in a cmdbuffer we can't really
emit any framebuffer data if it isn't provided.

Note we still do it for resolve clears, but we can't have that
in a secondary cmdbuffer with inherited renderpass.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13699>

2 years agoutil/u_trace: refcount payloads
Lionel Landwerlin [Sat, 20 Nov 2021 23:06:09 +0000 (01:06 +0200)]
util/u_trace: refcount payloads

When cloning a chunk of tracepoints, we cannot just copy the elements
of the traces[] array. We also need the payloads associated with
those.

This change introduces a new u_trace_payloaf_buf object that is
refcounted so that we can easily import traces[] elements and their
payloads from one utrace to another.

v2: use u_vector (Danylo)

v3: Delete outdate comment (Danylo)
    Fix assert (Danylo)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 0565c993f9eff9 ("u_trace: helpers for tracing tiling GPUs and re-usable VK cmdbuffers")
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13899>

2 years agoanv: fix execbuf syncobjs/syncobj_values array leak
Lionel Landwerlin [Wed, 24 Nov 2021 15:28:24 +0000 (17:28 +0200)]
anv: fix execbuf syncobjs/syncobj_values array leak

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 36ea90a3619f ("anv: Convert to the common sync and submit framework")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13945>

2 years agonir/lower_subgroups: fix left shift of -1
Rhys Perry [Thu, 16 Sep 2021 16:35:25 +0000 (17:35 +0100)]
nir/lower_subgroups: fix left shift of -1

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5365
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12901>

2 years agonir/lower_tex: don't calculate texture_mask for texture_index>=32
Rhys Perry [Thu, 16 Sep 2021 16:24:46 +0000 (17:24 +0100)]
nir/lower_tex: don't calculate texture_mask for texture_index>=32

With Vulkan, texture_index can be 32 or larger, which creates a shift
exponent larger than 31 (undefined behaviour). Since we don't use
texture_mask with Vulkan, just initialize it to 0.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5365
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12901>

2 years agoradv: stop running copy-propagation before nir_opt_deref
Rhys Perry [Tue, 23 Nov 2021 13:36:43 +0000 (13:36 +0000)]
radv: stop running copy-propagation before nir_opt_deref

spirv_to_nir() now does this.

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/13924>