platform/upstream/mesa.git
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>

2 years agospirv: run nir_copy_prop before nir_rematerialize_derefs_in_use_blocks_impl
Rhys Perry [Tue, 23 Nov 2021 13:27:14 +0000 (13:27 +0000)]
spirv: run nir_copy_prop before nir_rematerialize_derefs_in_use_blocks_impl

spirv_to_nir sometimes wraps derefs in vec2 or mov instructions as part of
its texture handling. These get in the way of
nir_rematerialize_derefs_in_use_blocks_impl. Running copy propagation
should get rid of the extra move instructions and get us back to intact
deref chains for everything except variable pointer use-cases.

fossil-db (Sienna Cichlid):
Totals from 6 (0.00% of 134572) affected shaders:
CodeSize: 92656 -> 93088 (+0.47%)
Instrs: 17060 -> 17138 (+0.46%)
Latency: 224408 -> 227539 (+1.40%)
InvThroughput: 37402 -> 37924 (+1.40%)
VClause: 408 -> 402 (-1.47%)
Copies: 1065 -> 1107 (+3.94%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5668
Fixes: 14a12b771d0 ("spirv: Rework our handling of images and samplers")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13924>

2 years agovulkan: Unlock before return.
Sergii Melikhov [Tue, 23 Nov 2021 08:17:42 +0000 (10:17 +0200)]
vulkan: Unlock before return.

Fix defect reported by Coverity Scan CID-1494382.

Missing unlock (LOCK): Returning without unlocking queue->submit.mutex.

Fixes: 9bffd81f1cb7c ("vulkan: Add common implementations of vkQueueSubmit and vkQueueWaitIdle")

Signed-off-by: Sergii Melikhov <sergii.v.melikhov@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13933>

2 years agoradv: fix max_render_backends for Sienna Cichlid null winsys
Rhys Perry [Tue, 23 Nov 2021 14:27:46 +0000 (14:27 +0000)]
radv: fix max_render_backends for Sienna Cichlid null winsys

This affects NGG culling.

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

2 years agoradv: make RADV_FORCE_FAMILY case-insensitive
Rhys Perry [Tue, 23 Nov 2021 14:26:01 +0000 (14:26 +0000)]
radv: make RADV_FORCE_FAMILY case-insensitive

So I don't have to update my scripts each time I switch between
before/after cfc5c2abfd1.

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

2 years agoac/surface: allow gfx6-8 to enter the gfx9 DCC codepath for SI_FORCE_FAMILY
Marek Olšák [Wed, 15 Sep 2021 19:28:46 +0000 (15:28 -0400)]
ac/surface: allow gfx6-8 to enter the gfx9 DCC codepath for SI_FORCE_FAMILY

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

2 years agoac/gpu_info: don't fail on amdgpu_query_video_caps_info failures
Marek Olšák [Mon, 1 Nov 2021 14:50:04 +0000 (10:50 -0400)]
ac/gpu_info: don't fail on amdgpu_query_video_caps_info failures

When VCN is unsupported, we don't want to break GL or Vulkan.

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

2 years agobroadcom/compiler: make shaderdb debug output compatible with shaderdb's report tool
Alejandro Piñeiro [Mon, 22 Nov 2021 23:46:48 +0000 (00:46 +0100)]
broadcom/compiler: make shaderdb debug output compatible with shaderdb's report tool

Even although the option is called shaderdb, it is not really used by
shaderdb (for V3D shaderdb uses the debug option "precompile"). And in
fact, right now the output format is not compatible with shaderdb.

This commit tries to fix that, and as we are here, also try to make
the option more useful for the Vulkan case, as that debug option also
works with v3dv.

We can't really fully imitate shaderdb use with OpenGL (run with a set
of glsl shader tests), but we can at least assign a unique name (the
pipeline sha1 in text format) so we can compare executions of the same
vulkan application. For that remember to disable the on-disk cache.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13938>

2 years agomesa: add allow_glsl_compat_shaders for shader-db
Marek Olšák [Fri, 19 Nov 2021 04:14:01 +0000 (23:14 -0500)]
mesa: add allow_glsl_compat_shaders for shader-db

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

2 years agomesa: don't add attenuation constants if ffvp doesn't use them
Marek Olšák [Mon, 1 Nov 2021 16:00:06 +0000 (12:00 -0400)]
mesa: don't add attenuation constants if ffvp doesn't use them

This slightly decreases the size of constant buffers.

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

2 years agoradv: implement optimized MSAA copies using FMASK
Samuel Pitoiset [Fri, 20 Aug 2021 14:19:40 +0000 (16:19 +0200)]
radv: implement optimized MSAA copies using FMASK

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

2 years agoradv: make radv_copy_buffer() a non-static function
Samuel Pitoiset [Mon, 23 Aug 2021 12:50:10 +0000 (14:50 +0200)]
radv: make radv_copy_buffer() a non-static function

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

2 years agoradv: make radv_break_on_count() a non-static function
Samuel Pitoiset [Tue, 16 Nov 2021 10:36:31 +0000 (11:36 +0100)]
radv: make radv_break_on_count() a non-static function

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

2 years agoamd/addrlib: Use get_supported_arguments to get compiler args.
Georg Lehmann [Fri, 25 Jun 2021 15:15:08 +0000 (17:15 +0200)]
amd/addrlib: Use get_supported_arguments to get compiler args.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11609>

2 years agomeson: Remove some unnecessary loops.
Georg Lehmann [Fri, 25 Jun 2021 15:07:41 +0000 (17:07 +0200)]
meson: Remove some unnecessary loops.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11609>

2 years agomeson: Use get_supported_arguments more often.
Georg Lehmann [Fri, 25 Jun 2021 15:05:31 +0000 (17:05 +0200)]
meson: Use get_supported_arguments more often.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11609>

2 years agolima/ppir: implement gl_FragDepth support
Vasily Khoruzhick [Wed, 17 Nov 2021 06:43:52 +0000 (22:43 -0800)]
lima/ppir: implement gl_FragDepth support

Mali4x0 supports writing depth and stencil from fragment shader
and we've been using it quite a while for depth/stencil buffer reload.

The missing part was specifying output register for depth/stencil.
To figure it out, I changed reload shader to use register $4 as output
and poked RSW bits (or rather consecutive 4 bit groups) until tests
that rely on reload started to pass again.

It turns out that register number for gl_FragDepth/gl_FragStencil is in
rsw->depth_test and register number for gl_FragColor is in
rsw->multi_sample and it's repeated 4 times for some reason (likely for
MSAA?)

With this knowledge we now can modify ppir compiler to support multiple
store_output intrinsics.

To do that just add destination SSA for store_output to the registers
list for regalloc and mark them explicitly as output. Since it's never
read in shader we have to take care about it in liveness analysis -
basically just mark it alive from the time when it's written to the end
of the block. If it's live only in the last instruction, mark it as
live_internal, so regalloc doesn't clobber it.

Then just let regalloc do its job, and then copy register number to the
shader state and program it in RSW.

The tricky part is gl_FragStencil, since it resides in the same register
as gl_FragDepth and with the current design of the compiler it's hard to
merge them. However gl_FragStencil doesn't seem to be part of GL2
or GLES2, so we can just leave it not implemented.

Also we need to take care of stop bit for instructions - now we can't
just set it in every instruction that stores output, since there may be
several outputs. So if there's any store_output instructions in the
block just mark that block has a stop, and set stop bit in the last
instruction in the block. The only exception is discard - we always need
to set stop bit in discard instruction.

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

2 years agolima/ppir: check if mul node is a source of add node before inserting
Vasily Khoruzhick [Wed, 17 Nov 2021 04:24:25 +0000 (20:24 -0800)]
lima/ppir: check if mul node is a source of add node before inserting

We can't insert mul node into add node instruction if it's a virtual dep
(sequence or write_or_read dep), so use ppir_node_has_single_src_succ
in addition to ppir_node_has_single_succ.

We can't use ppir_node_has_single_src_succ alone, since node may have
a virtual dependency in addition to source dependency, and we can't
insert it either in this case.

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

2 years agosvga: fix bitwise/logical and mixup
Thomas H.P. Andersen [Sun, 1 Aug 2021 10:52:56 +0000 (12:52 +0200)]
svga: fix bitwise/logical and mixup

The function need_temp_reg_initialization looks suspecious.

It will only ever return true if we get past this if:
if (!(emit->info.indirect_files && (1u << TGSI_FILE_TEMPORARY)) ...

Using the logical && means the intended initialization done
based on the result of this check is not performed.

This code was both introduced and altered in MR 5317.
ccb4ea5a introduces the function.
ba37d408 is a collection of performance improvements and misc
fixes. This altered the if from using bitwise to logical and.

This commit changes it back to bitwise.

Spotted from a compile warning.

Fixes: ba37d408da3 ("svga: Performance fixes")

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12157>

2 years agonine: remove dead code
Thomas H.P. Andersen [Sat, 31 Jul 2021 13:07:59 +0000 (15:07 +0200)]
nine: remove dead code

This line gets the cap but does not store it. The line has existed
unchanged since the original import in fdd96578.

Fixes a compile warning

Acked-by: Axel Davy davyaxel0@gmail.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12155>

2 years agoandroid.mk: Add missing variables to the make target
Roman Stratiienko [Mon, 22 Nov 2021 16:57:01 +0000 (18:57 +0200)]
android.mk: Add missing variables to the make target

Android build system may use different internal variables to specify
cflags/cppflags.
Small change in product confguration may force Android to use diffrent
set of variables, therefore we should keep all of them attached to the
make rule's target.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5549
Fixes: 8621bd8d5e67 ("android: Add scripts to build using meson")
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Acked-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13914>

2 years agolavapipe: fix unused variable
Michel Zou [Sat, 20 Nov 2021 12:53:13 +0000 (13:53 +0100)]
lavapipe: fix unused variable

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13892>

2 years agovulkan: fix uninitialized variables
Michel Zou [Sat, 20 Nov 2021 12:52:42 +0000 (13:52 +0100)]
vulkan: fix uninitialized variables

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13892>

2 years agoturnip: implement VK_KHR_buffer_device_address
Danylo Piliaiev [Mon, 26 Jul 2021 10:55:39 +0000 (13:55 +0300)]
turnip: implement VK_KHR_buffer_device_address

We don't advertise bufferDeviceAddressCaptureReplay capability and
neither does blob, because at the moment there is no way to allocate
bo with predefined iova.

There is no support of any arithmetic with addresses since shaderInt64
is not enabled. However, we could enable int64 support whenever we want.

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

2 years agofreedreno/ir3: handle global atomics
Danylo Piliaiev [Mon, 26 Jul 2021 10:50:03 +0000 (13:50 +0300)]
freedreno/ir3: handle global atomics

Only for a6xx since we don't know the instructions for global
atomics on previous gens. Per Qualcomm's docs in OpenCL atomics
are only supported since a5xx together with Generic memory space.

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

2 years agofreedreno/ir3: add a6xx global atomics and separate atomic opcodes
Danylo Piliaiev [Fri, 22 Jan 2021 17:51:56 +0000 (19:51 +0200)]
freedreno/ir3: add a6xx global atomics and separate atomic opcodes

Separating atomic opcodes makes possible to express a6xx global
atomics which take iova in SRC1. They would be needed by
VK_KHR_buffer_device_address.
The change also makes easier to distiguish atomics in conditions.

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

2 years agollvmpipe: Use lp_build_round_arch on IBM Z (s390x)
Marius Hillenbrand [Thu, 18 Nov 2021 17:27:35 +0000 (18:27 +0100)]
llvmpipe: Use lp_build_round_arch on IBM Z (s390x)

LLVM has all the required intrinsics available on IBM Z, so use them for
rounding operations (they will be implemented as a single instruction).
This change makes the test case lp_test_arit pass, because it avoids
using the buggy generic code.

v2: update .gitlab-ci/cross-xfail-s390x to reflect passing lp_test_arit

Signed-off-by: Marius Hillenbrand <mhillen@linux.ibm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13927>

2 years agoutil/cpu_detect: Add flag for IBM Z (s390x)
Marius Hillenbrand [Thu, 18 Nov 2021 17:25:41 +0000 (18:25 +0100)]
util/cpu_detect: Add flag for IBM Z (s390x)

As preparation for changing the behavior of LLVMpipe on IBM Z, add a
flag to detect that platform. As it is always known at compile-time, we
do not add it to the struct for cpu flags to avoid inflating that
struct's size.

Signed-off-by: Marius Hillenbrand <mhillen@linux.ibm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13927>

2 years agofreedreno/ir3: remove unused actual_in counting
Ilia Mirkin [Sat, 20 Nov 2021 23:48:34 +0000 (18:48 -0500)]
freedreno/ir3: remove unused actual_in counting

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

2 years agovirgl: Link shader program
Antonio Caggiano [Thu, 4 Nov 2021 13:51:19 +0000 (14:51 +0100)]
virgl: Link shader program

Add a new command associated to glLinkProgram. With this we should be
able to compile and link shaders when requested by the user, thus
avoiding that to happen in the middle of a frame.

Together with the command we pass an array of shader handles attached to
the program, where each position of the array corresponds to a pipe
shader type.

Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13674>

2 years agogallium: add a link shader hook
Antonio Caggiano [Thu, 4 Nov 2021 13:50:38 +0000 (14:50 +0100)]
gallium: add a link shader hook

Allow drivers to register a callback for when a shader program is linked.

Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13674>

2 years agobroadcom/compiler: don't move ldvary earlier if current instruction has ldunif
Iago Toral Quiroga [Tue, 23 Nov 2021 07:49:53 +0000 (08:49 +0100)]
broadcom/compiler: don't move ldvary earlier if current instruction has ldunif

If we did, we would have the instruction coming right after ldvary write
to the same implicit destination as ldvary at the same time. We prevent
this when merging instructions, but we should make sure we prevent this
when we move ldvary around for pipelining too.

Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13921>

2 years agoradv: fix emitting VBO when vertex input dynamic state is used
Samuel Pitoiset [Thu, 18 Nov 2021 09:44:21 +0000 (10:44 +0100)]
radv: fix emitting VBO when vertex input dynamic state is used

In the following scenario:
    CmdBindPipeline()
    CmdBindVertexBuffers()
    CmdSetVertexInput()
    CmdDraw()
    CmdBindVertexBuffers()
    CmdSetVertexInput()
    CmdDraw()

The VBO won't be updated for the second draw because the state is
cleared when the dynamic state is emitted and the pipeline isn't dirty.

Found by inspection.

Cc: 21.3 mesa-stable
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/13855>

2 years agoradv/winsys: report the real family name instead of OVERRIDDEN
Samuel Pitoiset [Tue, 16 Nov 2021 07:57:44 +0000 (08:57 +0100)]
radv/winsys: report the real family name instead of OVERRIDDEN

When RADV_FORCE_FAMILY is used, this helps pre-compiling shaders to
make sure cache entries will match real hardware.

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

2 years agoac: change family names to uppercase in ac_get_family_name()
Samuel Pitoiset [Tue, 16 Nov 2021 07:55:04 +0000 (08:55 +0100)]
ac: change family names to uppercase in ac_get_family_name()

To print the same device name as real hw.

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

2 years agoradv: convert remaining enums/structs to 1.2 versions
Samuel Pitoiset [Fri, 19 Nov 2021 16:02:43 +0000 (17:02 +0100)]
radv: convert remaining enums/structs to 1.2 versions

Some were missing.

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

2 years agointel/compiler: Prepare disasm for 16-bit sampler params
Sagar Ghuge [Tue, 21 Sep 2021 23:16:51 +0000 (16:16 -0700)]
intel/compiler: Prepare disasm for 16-bit sampler params

v2:
- Update descriptor helper (Jason)

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11766>

2 years agointel/fs: Define and set correct sampler simd mode
Sagar Ghuge [Tue, 14 Jul 2020 01:32:14 +0000 (18:32 -0700)]
intel/fs: Define and set correct sampler simd mode

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11766>

2 years agointel/compiler: Deprecate ld2dms and use ld2dms_w instead
Topi Pohjolainen [Wed, 8 Jul 2020 06:23:36 +0000 (23:23 -0700)]
intel/compiler: Deprecate ld2dms and use ld2dms_w instead

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11766>

2 years agointel/compiler: Add new variant for TXF_CMS_W
Topi Pohjolainen [Wed, 8 Jul 2020 06:54:00 +0000 (23:54 -0700)]
intel/compiler: Add new variant for TXF_CMS_W

This allows, for example, fs_inst::components_read() without passing
devinfo as extra argument.

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11766>

2 years agointel/compiler: Prepare ld2dms_w for 4 mcs components
Topi Pohjolainen [Wed, 8 Jul 2020 06:18:53 +0000 (23:18 -0700)]
intel/compiler: Prepare ld2dms_w for 4 mcs components

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11766>

2 years agointel/compiler: Demote sampler params to 16-bit for CMS/UMS/MCS
Topi Pohjolainen [Wed, 8 Jul 2020 06:32:51 +0000 (23:32 -0700)]
intel/compiler: Demote sampler params to 16-bit for CMS/UMS/MCS

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11766>

2 years agointel/compiler/fs: Add support for 16-bit sampler msg payload
Topi Pohjolainen [Wed, 8 Jul 2020 05:26:08 +0000 (22:26 -0700)]
intel/compiler/fs: Add support for 16-bit sampler msg payload

For SIMD8 half float payload, each component takes a full register, so
we can use existing LOAD_PAYLOAD infrastruture for required padding by
alternating plain 8-wide half float vector and null vector.

Also this patch removes an unwanted assertion from
opt_copy_propagation_local for LOAD_PAYLOAD.

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11766>

2 years agointel/compiler: Add helper to support half float payload with padding
Sagar Ghuge [Thu, 16 Sep 2021 05:26:54 +0000 (22:26 -0700)]
intel/compiler: Add helper to support half float payload with padding

To support SIMD8 half float payloads, each component takes one full
32bit wide register in both SIMD8H and SIMD16H mode. So we can make use
of existing LOAD_PAYLOAD infrastructure alternating a half float vector
and a null vector, in order to handle required padding.

v2: (Francisco)
- Skip header sources
- Fix comparision units
- Don't allocate VGRF for padded source

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Suggested-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11766>

2 years agointel/compiler: Fix instruction size written calculation
Sagar Ghuge [Wed, 13 Oct 2021 18:14:43 +0000 (11:14 -0700)]
intel/compiler: Fix instruction size written calculation

We are always aligning to REG_SIZE but when we have payload sources less
than REG_SIZE, size written is miscalculated.

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11766>

2 years agointel/compiler: Don't hardcode padding source type to 32bit
Sagar Ghuge [Thu, 16 Sep 2021 02:18:34 +0000 (19:18 -0700)]
intel/compiler: Don't hardcode padding source type to 32bit

We can use LOAD_PAYLOAD infrastructure in order to handle 16bit float
payload. Let's rely on source type for padding sources, if not set
previously then default one would be 32-bit.

This patch will be used later in the series to handle 16-bit float
payloads.

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11766>

2 years agointel/compiler: Handle new sampler descriptor fields for 16bit sampler
Topi Pohjolainen [Wed, 8 Jul 2020 00:40:49 +0000 (17:40 -0700)]
intel/compiler: Handle new sampler descriptor fields for 16bit sampler

Update return format field and add SIMD Mode [2] field in sampler
descriptor. Now we can tell sampler to return data in either 32/16 bit
format precision.

v1:
- Drop unnecessary descriptor fields (Jason)
- Handle return format (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11766>

2 years agointel/compiler: Set correct return format for brw_SAMPLE
Sagar Ghuge [Wed, 13 Oct 2021 23:53:44 +0000 (16:53 -0700)]
intel/compiler: Set correct return format for brw_SAMPLE

on GFX8 onwards, we have only single bit to determine correct return
format.

v2:
- Define macro and use it instead of hardcoded value. (Lionel)

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11766>

2 years agonir: Un-inline more of nir_builder.h.
Emma Anholt [Sat, 20 Nov 2021 00:50:03 +0000 (16:50 -0800)]
nir: Un-inline more of nir_builder.h.

Cuts another 470KB of libnir.a in my release build.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13889>

2 years agonir: Un-inline nir_builder_alu_instr_finish_and_insert()
Emma Anholt [Sat, 20 Nov 2021 00:24:00 +0000 (16:24 -0800)]
nir: Un-inline nir_builder_alu_instr_finish_and_insert()

This function is big and I don't think it will won't get meaningfully
constant-propagated during inlining without LTO.  Move it to a .c file so
we just have one copy, saving 2.8MB from libnir.a on an amd64 release
build.

      text       data        bss      total filename
before:
  18953406    7768312     687260   27408978 build-release/driver-symlinks/iris_dri.so
   9734366    5542453     481692   15758511 build-release/lib/libvulkan_intel.so
  28687772   13310765    1168952   43167489 (TOTALS)

after:
  15478350    7767864     687260   23933474 build-release/driver-symlinks/iris_dri.so
   6810366    5541685     481692   12833743 build-release/lib/libvulkan_intel.so
  22288716   13309549    1168952   36767217 (TOTALS)

No statistically significant performance difference on iris shader-db, n=8.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13889>

2 years agonir: apply interpolated input intrinsics setting when lowering clipdist
Ilia Mirkin [Sun, 21 Nov 2021 08:12:51 +0000 (03:12 -0500)]
nir: apply interpolated input intrinsics setting when lowering clipdist

For drivers that use this in fragment shaders, load_input is going to
produce incorrect results (flat-shaded values).

Fixes clipping tests on a4xx.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13900>

2 years agonir: always keep the clip distance array size updated
Ilia Mirkin [Sun, 21 Nov 2021 08:04:32 +0000 (03:04 -0500)]
nir: always keep the clip distance array size updated

Drivers expect to know the number of clip distances irrespective of
whether compact arrays are used or not.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13900>

2 years agoaco/spill: use spills_entry instead of spills_exit to kill linear VGPRs
Rhys Perry [Tue, 16 Nov 2021 17:33:11 +0000 (17:33 +0000)]
aco/spill: use spills_entry instead of spills_exit to kill linear VGPRs

If a predecessor has only spilled constants (no temporaries), spills_exit
will be empty.

fossil-db (Sienna Cichlid):
Totals from 2 (0.00% of 128647) affected shaders:
Latency: 139106 -> 139104 (-0.00%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5633
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13821>

2 years agofreedreno/a[345]xx: fix unorm/snorm blend factors when they're "over"
Ilia Mirkin [Sun, 21 Nov 2021 18:40:38 +0000 (13:40 -0500)]
freedreno/a[345]xx: fix unorm/snorm blend factors when they're "over"

The float value may be out of range, so must be clamped to the allowed
range. Unclear if a3xx also has a SNORM factor that we're just missing
there, but that will be a separate investigation.

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