platform/upstream/mesa.git
3 years agogl_marshal.py: inline print_sync_dispatch
Marek Olšák [Sat, 26 Sep 2020 00:20:19 +0000 (20:20 -0400)]
gl_marshal.py: inline print_sync_dispatch

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7031>

3 years agomesa: factor out layout parsing for glInterleavedArrays
Marek Olšák [Sat, 26 Sep 2020 00:02:14 +0000 (20:02 -0400)]
mesa: factor out layout parsing for glInterleavedArrays

glthread will use it.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7031>

3 years agonir/constant_folding: Fold load_deref of nir_var_mem_constant
Jason Ekstrand [Thu, 3 Sep 2020 19:14:03 +0000 (14:14 -0500)]
nir/constant_folding: Fold load_deref of nir_var_mem_constant

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6974>

3 years agonir: Validate constant initializers
Jason Ekstrand [Fri, 2 Oct 2020 07:14:36 +0000 (02:14 -0500)]
nir: Validate constant initializers

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6974>

3 years agonir/constant_folding: Use nir_shader_instruction_pass
Jason Ekstrand [Thu, 1 Oct 2020 23:29:08 +0000 (18:29 -0500)]
nir/constant_folding: Use nir_shader_instruction_pass

This gets rid of so much boilerplate...

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6974>

3 years agonir/constant_folding: Use the builder
Jason Ekstrand [Thu, 1 Oct 2020 23:25:37 +0000 (18:25 -0500)]
nir/constant_folding: Use the builder

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6974>

3 years agoradv: remove VkPipelineCacheCreateInfo::flags assert
Mike Blumenkrantz [Tue, 6 Oct 2020 14:14:33 +0000 (10:14 -0400)]
radv: remove VkPipelineCacheCreateInfo::flags assert

flags are handled, so this just crashes for no reason

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

3 years agoiris: Fix a fast-clear skipping optimization
Nanley Chery [Tue, 29 Sep 2020 12:49:54 +0000 (05:49 -0700)]
iris: Fix a fast-clear skipping optimization

When support for multi-slice fast-clears was introduced for color
surfaces, an existing optimization for skipping fast-clears was not
updated (this optimization assumed single-slice fast-clears). As a
result, the driver began to skip multi-layer fast-clears if just the
first slice was in the CLEAR state (ignoring the state of the others).

A Civilization VI trace was the only workload I found to make use of
this optimization and it did so for 2D, non-array textures. Therefore,
this fix simply checks that the depth of the clear box is 1. It also
moves the single-slice aux-state query closer to the optimization to
clarify the need for the depth check.

Enables iris to pass a case of the fcc-write-after-clear piglit test,
[fast-clear tracking across layers 0 -> 1 -> (0,1)].

Fixes: 393f659ed83 ("iris: Enable fast clears on other miplevels and layers than 0.")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6973>

3 years agoanv: remove VkPipelineCacheCreateInfo::flags assert
Mike Blumenkrantz [Tue, 6 Oct 2020 14:14:33 +0000 (10:14 -0400)]
anv: remove VkPipelineCacheCreateInfo::flags assert

flags are handled, so this just crashes for no reason

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7029>

3 years agointel/dev: add a small non installable tool to print device info
Lionel Landwerlin [Thu, 1 Oct 2020 10:05:20 +0000 (13:05 +0300)]
intel/dev: add a small non installable tool to print device info

Mostly for debug purposes.

$ ./build/src/intel/dev/intel_device_info
/dev/dri/renderD128:
   name: Intel(R) UHD Graphics 620 (WHL GT2)
   gen: 9
   PCI id: 0x3ea0
   revision: 2
   slice0.subslice0: 11111111
   slice0.subslice1: 11111111
   slice0.subslice2: 11111111
   slices: 1
   subslices: 3
   EUs: 24
   EU threads: 168
   LLC: 1
   threads per EU: 7
   L3 banks: 4
   max VS  threads: 336
   max TCS threads: 336
   max TES threads: 336
   max GS  threads: 336
   max WM  threads: 256
   max CS  threads: 56
   timestamp frequency: 12000000

v2: Missing license (Marcin)
    Fix stderr usage (Marcin)

v3: Reformat topology printing (Marcin)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6957>

3 years agozink: enable pipe caps for ARB_timer_query
Mike Blumenkrantz [Fri, 10 Jul 2020 18:47:32 +0000 (14:47 -0400)]
zink: enable pipe caps for ARB_timer_query

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6923>

3 years agozink: add pipe_context::get_timestamp hook
Mike Blumenkrantz [Fri, 10 Jul 2020 18:46:18 +0000 (14:46 -0400)]
zink: add pipe_context::get_timestamp hook

this uses VK_EXT_calibrated_timestamps to read a timestamp immediately from
the device without using a batch, which is what the gallium api expects

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6923>

3 years agozink: handle TIME_ELAPSED queries
Mike Blumenkrantz [Mon, 17 Aug 2020 20:44:45 +0000 (16:44 -0400)]
zink: handle TIME_ELAPSED queries

these just need to write a timestamp at the start to diff against

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6923>

3 years agozink: handle timestamp queries
Mike Blumenkrantz [Fri, 10 Jul 2020 18:44:58 +0000 (14:44 -0400)]
zink: handle timestamp queries

a lot of this is just rejiggering code to allow timestamp queries to
take the same codepaths as "normal" queries instead of even more explicitly
special casing everything

key point here is that we need to convert vulkan-level timestamp "ticks" to
nanoseconds like the gallium api expects

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6923>

3 years agointel/perf: fix crash when no perf queries are supported
Lionel Landwerlin [Tue, 6 Oct 2020 08:38:54 +0000 (11:38 +0300)]
intel/perf: fix crash when no perf queries are supported

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: ec1fa1d51ff614 ("intel/perf: fix raw query kernel metric selection")
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7024>

3 years agoutil: drop non-posix header fnmatch
Michel Zou [Mon, 5 Oct 2020 18:11:26 +0000 (20:11 +0200)]
util: drop non-posix header fnmatch

Seems fnmatch usage was removed but not the include

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7013>

3 years agoCI: Disable Panfrost T7xx CI
Daniel Stone [Sat, 3 Oct 2020 10:53:06 +0000 (11:53 +0100)]
CI: Disable Panfrost T7xx CI

The lab is having some more maintenance work this morning to continue
expanding capacity and improving resilience.

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

3 years agoxmlconfig: fix scandir_filter
Mike Blumenkrantz [Tue, 6 Oct 2020 01:21:16 +0000 (21:21 -0400)]
xmlconfig: fix scandir_filter

this was changed from a fnmatch usage to strcmp, and the return value
was flipped, breaking matching

also fix the formatting of the changed lines

Fixes: 4f37161a8f2: ("util/xmlconfig: Indent to Mesa style.")

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7018>

3 years agospirv: Make the clc_shader const
Jason Ekstrand [Tue, 6 Oct 2020 00:21:29 +0000 (19:21 -0500)]
spirv: Make the clc_shader const

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7016>

3 years agoturnip/kgsl: Add strerror decode in BO init failure.
Eric Anholt [Tue, 22 Sep 2020 18:28:02 +0000 (11:28 -0700)]
turnip/kgsl: Add strerror decode in BO init failure.

Just covering more of the error paths.

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

3 years agoturnip: Report device loss through _mesa_loge() instead of fprintf.
Eric Anholt [Tue, 22 Sep 2020 02:41:06 +0000 (19:41 -0700)]
turnip: Report device loss through _mesa_loge() instead of fprintf.

We drop the file/line, but there are only a couple of places calling this
and they have unique strings anyway.

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

3 years agoturnip: Always enable TU_DEBUG=startup on debug drivers.
Eric Anholt [Mon, 5 Oct 2020 21:31:26 +0000 (14:31 -0700)]
turnip: Always enable TU_DEBUG=startup on debug drivers.

For Android, it's hard to inject environment variables for testing, and I
figure if you've got a debug driver then you'd love to see about driver
init failures anyway.

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

3 years agoturnip: Extend the coverage of TU_DEBUG=startup.
Eric Anholt [Wed, 16 Sep 2020 02:42:41 +0000 (19:42 -0700)]
turnip: Extend the coverage of TU_DEBUG=startup.

I found while debugging KGSL that we were missing failure output for a
bunch of the error paths.

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

3 years agoturnip: Mark the vk_errorf helper as bring printflike.
Eric Anholt [Mon, 5 Oct 2020 21:22:40 +0000 (14:22 -0700)]
turnip: Mark the vk_errorf helper as bring printflike.

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

3 years agoturnip: Use mesa's normal PRINTFLIKE macro instead of our own.
Eric Anholt [Wed, 16 Sep 2020 02:29:13 +0000 (19:29 -0700)]
turnip: Use mesa's normal PRINTFLIKE macro instead of our own.

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

3 years agoturnip: Don't expose VK_ANDROID_native_buffer on non-Android.
Eric Anholt [Mon, 21 Sep 2020 16:35:23 +0000 (09:35 -0700)]
turnip: Don't expose VK_ANDROID_native_buffer on non-Android.

The code is only there when compiling that platform.

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

3 years agoanv: Implement VK_EXT_transform_feedback on Gen7
Jason Ekstrand [Sun, 4 Oct 2020 14:15:36 +0000 (09:15 -0500)]
anv: Implement VK_EXT_transform_feedback on Gen7

Things work a little different on Gen7 than they do on Gen8+.  In
particular, SOBufferEnable lives in 3DSTATE_STREAMOUT but BufferPitch
lives in 3DSTATE_SO_BUFFER.  This leaves us having to marshal data
around a bit more than we did on Gen8.  Still, it's not too bad.

Normally, I don't spend much time on Gen7 but XFB just became a hard
requirement for DXVK so it stopped working for all our Haswell users.
Let's get them happily playing their games again. 😸

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3532
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6997>

3 years agoandroid: panfrost: use python3 for generated sources rules
Mauro Rossi [Sat, 3 Oct 2020 22:25:34 +0000 (00:25 +0200)]
android: panfrost: use python3 for generated sources rules

Scripts are python3 ready

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6996>

3 years agoandroid: pan/bi: Use new disassembler (v2)
Mauro Rossi [Sat, 3 Oct 2020 22:14:29 +0000 (00:14 +0200)]
android: pan/bi: Use new disassembler (v2)

(v2) bifrost_gen_disasm.c generated source belongs to libpanfrost_bifrost_disasm

Fixes the following build errors, which happen with Android P, but not with Android Q

FAILED: out/target/product/x86_64/obj_x86/SHARED_LIBRARIES/gallium_dri_intermediates/LINKED/gallium_dri.so
...
external/mesa/src/panfrost/bifrost/disassemble.c:678: error: undefined reference to 'bi_disasm_fma'
external/mesa/src/panfrost/bifrost/disassemble.c:679: error: undefined reference to 'bi_disasm_add'

Fixes: 792b51713 ("android: pan/bi: Use new disassembler")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6996>

3 years agoturnip: implement timestamp fences/semaphores for kgsl backend
Jonathan Marek [Mon, 5 Oct 2020 02:06:18 +0000 (22:06 -0400)]
turnip: implement timestamp fences/semaphores for kgsl backend

This gets fences and semaphores working for kgsl (minus import/export).

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7000>

3 years agobroadcom/simulator: update to a newer simulator
Alejandro Piñeiro [Wed, 23 Sep 2020 21:54:44 +0000 (23:54 +0200)]
broadcom/simulator: update to a newer simulator

Some headers were moved, and macros renamed.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7007>

3 years agozink: hook up driconf
Mike Blumenkrantz [Wed, 23 Sep 2020 19:42:18 +0000 (15:42 -0400)]
zink: hook up driconf

we need this

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7009>

3 years agoac/nir,radv: fix invalid IR when loading inline uniform blocks
Samuel Pitoiset [Mon, 28 Sep 2020 13:47:38 +0000 (15:47 +0200)]
ac/nir,radv: fix invalid IR when loading inline uniform blocks

Fixes dEQP-VK.binding_model.descriptorset_random.* and
dEQP-VK.binding_model.descriptor_copy.*.

Fixes: 05b6612b4ec ("radv: do not lower UBO/SSBO access to offsets")
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/6977>

3 years agoradv: remove dead deref code in the shader info pass
Samuel Pitoiset [Wed, 30 Sep 2020 07:59:56 +0000 (09:59 +0200)]
radv: remove dead deref code in the shader info pass

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

3 years agoradv: remove unused gs.writes_memory in the shader info pass
Samuel Pitoiset [Wed, 30 Sep 2020 07:58:16 +0000 (09:58 +0200)]
radv: remove unused gs.writes_memory in the shader info pass

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

3 years agoac,radv,radeonsi: remove unused parameters in the shader ABI IO
Samuel Pitoiset [Wed, 30 Sep 2020 07:57:00 +0000 (09:57 +0200)]
ac,radv,radeonsi: remove unused parameters in the shader ABI IO

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6931>

3 years agoradeonsi: remove dead code in TCS/TES/GS since const_index is always 0
Samuel Pitoiset [Wed, 30 Sep 2020 07:51:08 +0000 (09:51 +0200)]
radeonsi: remove dead code in TCS/TES/GS since const_index is always 0

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6931>

3 years agoac/nir: remove dead shader IO code
Samuel Pitoiset [Wed, 30 Sep 2020 07:26:18 +0000 (09:26 +0200)]
ac/nir: remove dead shader IO code

RADV/LLVM and RadeonSI now lower IO.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6931>

3 years agoac/nir: remove dead global load/store/atomic derefs code
Samuel Pitoiset [Wed, 30 Sep 2020 07:21:31 +0000 (09:21 +0200)]
ac/nir: remove dead global load/store/atomic derefs code

RADV/LLVM now lowers global operations and RadeonSI doesn't use that.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6931>

3 years agoradv/llvm: enable lower_unpack_half_2x16
Samuel Pitoiset [Wed, 30 Sep 2020 13:01:46 +0000 (15:01 +0200)]
radv/llvm: enable lower_unpack_half_2x16

To match ACO.

fossils-db (Navi10):
Totals from 294 (0.22% of 136420) affected shaders:
SGPRs: 16504 -> 16496 (-0.05%)
VGPRs: 19008 -> 19124 (+0.61%); split: -0.06%, +0.67%
SpillVGPRs: 511 -> 476 (-6.85%); split: -7.63%, +0.78%
CodeSize: 1688852 -> 1687932 (-0.05%); split: -0.10%, +0.05%
Scratch: 305152 -> 307200 (+0.67%)
MaxWaves: 2877 -> 2878 (+0.03%)

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

3 years agoac/llvm: implement nir_op_unpack_half_2x16_split_{x,y}
Samuel Pitoiset [Wed, 30 Sep 2020 13:09:54 +0000 (15:09 +0200)]
ac/llvm: implement nir_op_unpack_half_2x16_split_{x,y}

nir_unpack_half_2x16_split_{x,y}_flush_to_zero don't have to be
implemented because RADV/LLVM doesn't allow flushing denorms
for 16-bit floating point.

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

3 years agoradv/llvm: lower VS IO
Samuel Pitoiset [Wed, 30 Sep 2020 07:15:54 +0000 (09:15 +0200)]
radv/llvm: lower VS IO

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

3 years agoradv/llvm: gather VS input usage mask from load_input
Samuel Pitoiset [Fri, 25 Sep 2020 15:14:13 +0000 (17:14 +0200)]
radv/llvm: gather VS input usage mask from load_input

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

3 years agoradv/llvm: lower TCS IO
Samuel Pitoiset [Wed, 30 Sep 2020 06:46:19 +0000 (08:46 +0200)]
radv/llvm: lower TCS IO

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

3 years agoradv/llvm: gather TCS outputs from the output variables
Samuel Pitoiset [Tue, 29 Sep 2020 17:13:23 +0000 (19:13 +0200)]
radv/llvm: gather TCS outputs from the output variables

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

3 years agoradv/llvm: lower TES IO
Samuel Pitoiset [Tue, 29 Sep 2020 17:12:37 +0000 (19:12 +0200)]
radv/llvm: lower TES IO

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

3 years agoradv/llvm: lower GS IO
Samuel Pitoiset [Tue, 29 Sep 2020 15:05:57 +0000 (17:05 +0200)]
radv/llvm: lower GS IO

The LLVM bakend expects 64-bit IO to be lowered to 32-bit but
it's unclear if we want to do that for ACO at this point.

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

3 years agoradv/llvm: assign driver locations for VS, TCS, TES and GS correctly
Samuel Pitoiset [Tue, 29 Sep 2020 17:18:14 +0000 (19:18 +0200)]
radv/llvm: assign driver locations for VS, TCS, TES and GS correctly

RADV/LLVM doesn't use assigned IO locations (yet).

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

3 years agoac/nir: remove dead load/store deref code for temporary variables
Samuel Pitoiset [Fri, 2 Oct 2020 14:35:14 +0000 (16:35 +0200)]
ac/nir: remove dead load/store deref code for temporary variables

They should have been lowered before reaching the backend.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6984>

3 years agoac/llvm: adjust dmask when image stores are shrinked using the format
Samuel Pitoiset [Fri, 2 Oct 2020 12:58:15 +0000 (14:58 +0200)]
ac/llvm: adjust dmask when image stores are shrinked using the format

It looks like GFX10 doesn't care about dmask if it's greater than
the number of components stored but it matters on GFX8-9 (I haven't
checked older gens).

Fixes: 1b4d968106d ("ac/llvm: fix invalid IR if image stores are shrinked using the format")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6982>

3 years agovc4: Avoid negative scissor caused by no intersection
Jose Maria Casanova Crespo [Thu, 1 Oct 2020 23:55:07 +0000 (00:55 +0100)]
vc4: Avoid negative scissor caused by no intersection

This fixes 6 tests that were crashing on VC4 since
EGL_KHR_swap_buffers_with_damage was enabled.

dEQP-EGL.functional.swap_buffers_with_damage.*.buffer_age_render

Cc: 20.2 <mesa-stable>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6976>

3 years agov3d: Update the TEXTURE_SHADER_STATE when there’s a new buf for a tex
Neil Roberts [Tue, 29 Sep 2020 15:24:51 +0000 (17:24 +0200)]
v3d: Update the TEXTURE_SHADER_STATE when there’s a new buf for a tex

When a texture is mapped with the DISCARD_WHOLE_RESOURCE flag set,
v3d_map_usage_prep will try to allocate a new buffer for the resource.
Previously, if the resource was used in a bound texture then nothing
would cause it to update the sampler view with the offset for the new
buffer. This commit just adds that in by looking at all sampler views
and calling v3d_create_texture_shader_state_bo for each one that
references this resource.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6914>

3 years agov3d: Split the creating of TEXTURE_SHADER_STATE into a helper function
Neil Roberts [Tue, 29 Sep 2020 15:22:37 +0000 (17:22 +0200)]
v3d: Split the creating of TEXTURE_SHADER_STATE into a helper function

This extracts the part of v3d_create_sampler_view that creates and fills
in the buffer for the TEXTURE_SHADER_STATE record into a helper
function. This will be used in a later patch to update the record when
the information changes.

v2: Also put the part that creates the buffer into the helper function
    so that it won’t override the contents of an inflight buffer.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6914>

3 years agov3d: Make the function to set tex dirty state for a stage global
Neil Roberts [Tue, 29 Sep 2020 15:20:31 +0000 (17:20 +0200)]
v3d: Make the function to set tex dirty state for a stage global

This moves the static function v3d_dirty_tex_state_for_shader_type from
v3dx_state.c to v3d_context.c and adds a declaration for it in the
header so that it can be used as a general utility function in a later
patch.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6914>

3 years agoturnip: remove pre-emption marker
Jonathan Marek [Sun, 4 Oct 2020 02:00:31 +0000 (22:00 -0400)]
turnip: remove pre-emption marker

turnip doesn't implement pre-emption, this hasn't been a problem with drm
backend since the kernel driver doesn't implement it either, however this
causes issues with kgsl backend.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6994>

3 years agoglsl: Initialize ast_node member field location.path in constructor.
Vinson Lee [Tue, 29 Sep 2020 01:20:32 +0000 (18:20 -0700)]
glsl: Initialize ast_node member field location.path in constructor.

Fix defect reported by Coverity Scan.

Uninitialized pointer field (UNINIT_CTOR)
uninit_member: Non-static class member field location.path is not
initialized in this constructor nor in any functions that it calls.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6905>

3 years agointel/vec4: Remove leftover code from Gen8+ removal.
Vinson Lee [Tue, 29 Sep 2020 23:58:47 +0000 (16:58 -0700)]
intel/vec4: Remove leftover code from Gen8+ removal.

Remove code missed in commit 2a49007411bb ("intel/vec4: Remove all
support for Gen8+ [v2]").

Fix defect reported by Coverity Scan.

Logically dead code (DEADCODE)
dead_error_begin: Execution cannot reach this statement:
mcs.swizzle = 80U;

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6927>

3 years agofreedreno: Move rsc NULL check to before rsc dereferences.
Vinson Lee [Mon, 28 Sep 2020 23:16:37 +0000 (16:16 -0700)]
freedreno: Move rsc NULL check to before rsc dereferences.

Fix defect reported by Coverity Scan.

Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking rsc suggests that it may be
null, but it has already been dereferenced on all paths leading
to the check.

Fixes: 6173cc19c45d ("freedreno: gallium driver for adreno")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6903>

3 years agoiris: Fix the constant data address calculation
Jason Ekstrand [Fri, 2 Oct 2020 22:41:15 +0000 (17:41 -0500)]
iris: Fix the constant data address calculation

In 536727c46517, we switched iris to patching the constant data address
into the shader but, thanks to my lack of understanding how iris works,
I got the calculation wrong.  I didn't realize, we needed to call
iris_bo_offset_from_base_address to get the BO offset from the start of
instruction state base address.

Fixes: 536727c465170c "iris: Patch constant data pointers into shaders"
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3596
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6992>

3 years agonv50/ir: Initialize Source members.
Vinson Lee [Fri, 18 Sep 2020 00:05:56 +0000 (17:05 -0700)]
nv50/ir: Initialize Source members.

Fix defects reported by Coverity Scan.

uninit_member: Non-static class member insns is not initialized in this
constructor nor in any functions that it calls.
uninit_member: Non-static class member clipVertexOutput is not
initialized in this constructor nor in any functions that it calls.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6769>

3 years agoradv: Fix asserts using assign instead of compare.
Vinson Lee [Mon, 28 Sep 2020 23:01:03 +0000 (16:01 -0700)]
radv: Fix asserts using assign instead of compare.

Fix defects reported by Coverity Scan.

Assign instead of compare (PW.ASSIGN_WHERE_COMPARE_MEANT)
assign_where_compare_meant: use of "=" where "==" may have been
intended

Fixes: d8cdcd4adf7a ("radv: use syncobj for wsi fence")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6902>

3 years agolima: Print usage if --help is any of the arguments.
Vinson Lee [Tue, 29 Sep 2020 01:35:04 +0000 (18:35 -0700)]
lima: Print usage if --help is any of the arguments.

Fix defect reported by Coverity Scan.

Structurally dead code (UNREACHABLE)
unreachable: Since the loop increment n++; is unreachable, the loop body
will never execute more than once.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6906>

3 years agoandroid: Disable the user XML config parsing.
Eric Anholt [Tue, 29 Sep 2020 16:37:50 +0000 (09:37 -0700)]
android: Disable the user XML config parsing.

The android platform is not interested in this feature of Mesa.  There are
currently workarounds for apps on Android, and no support for it in the
xmlconfig code.  Even if there we do need workarounds eventually, we'll
want to bake them in as structs rather than have this awkward external
dependency for parsing user-readable data installed by Mesa for
Mesa-internal details.

This gets rid of the expat dependency in the turnip driver.

Note that rather than have more #ifdefs in the file, I've opted to move
the code to have more logical locations since the structs refactor had
left less-used helpers scattered across the file.

Acked-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6916>

3 years agoutil/xmlconfig: Drop use of XML_Char in parsing.
Eric Anholt [Fri, 11 Sep 2020 20:36:24 +0000 (13:36 -0700)]
util/xmlconfig: Drop use of XML_Char in parsing.

We don't define the use-16-bit-unicode defines (and our strings are plain
utf8), so it's just char.  This will let me use some of this code in the
absence of expat.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6916>

3 years agodriconf: Stop quoting true/false in boolean option definitions.
Eric Anholt [Tue, 29 Sep 2020 16:28:18 +0000 (09:28 -0700)]
driconf: Stop quoting true/false in boolean option definitions.

Now that we're not trying to evade preprocessor macro expansion in
preprocessor string concatenation, we can use plain old bools in option
setup.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6916>

3 years agodriconf: Make the driver's declarations be structs instead of XML.
Eric Anholt [Fri, 25 Sep 2020 19:56:22 +0000 (12:56 -0700)]
driconf: Make the driver's declarations be structs instead of XML.

We can generate the XML if anybody actually queries it, but this reduces
the amount of work in driver setup and means that we'll be able to support
driconf option queries on Android without libexpat.

This updates the driconf interface struct version for i965, i915, and
radeon to use the new getXml entrypoint to call the on-demand xml
generation.  Note that our loaders (egl, glx) implement the v2 function
interface and don't use .xml when that's set, and the X server doesn't use
this interface at all.

XML generation tested on iris and i965 using adriconf

Acked-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6916>

3 years agodriconf: Use DRI_CONF_OPT_I for remaining int options
Eric Anholt [Tue, 29 Sep 2020 17:23:52 +0000 (10:23 -0700)]
driconf: Use DRI_CONF_OPT_I for remaining int options

Now that we have a single range in the option and start==end means "no
range", we can switch over these non-ranged int options.  This will ease
later refactors.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6916>

3 years agodriconf: Delete disjoint range support.
Eric Anholt [Mon, 28 Sep 2020 18:21:00 +0000 (11:21 -0700)]
driconf: Delete disjoint range support.

The only user was radeon/r200, which was using it to have something that
looks a lot like an enum value return a float from the config option.
Just convert that option to a plain float value (for compat with existing
driconfs) with the min and max of its disjoint range as the range.  The
driver's option handling code already correctly deals with other values in
the range.

The disjoint range support was a bunch of extra parsing for this dead
driver, and made turning driconf into static structs difficult.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6916>

3 years agoutil/xmlconfig: Indent to Mesa style.
Eric Anholt [Thu, 10 Sep 2020 23:54:38 +0000 (16:54 -0700)]
util/xmlconfig: Indent to Mesa style.

I'm heavily editing this code, and having Mesa's style not apply sucks.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6916>

3 years agoutil/xmlconfig: Drop silly open-coded strdup.
Eric Anholt [Thu, 10 Sep 2020 23:45:14 +0000 (16:45 -0700)]
util/xmlconfig: Drop silly open-coded strdup.

The comment about using "malloc"?  The strdup man page says 'Memory for
the new string is obtained with malloc(3), and can be freed with free(3)'

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6916>

3 years agodriconf: Make a DRI_CONF_OPT_S() for string options.
Eric Anholt [Sat, 26 Sep 2020 00:06:07 +0000 (17:06 -0700)]
driconf: Make a DRI_CONF_OPT_S() for string options.

This gets rid of most of the remaining special case option definitions.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6916>

3 years agor200: Reuse DRI_CONF_OPT_F for texture_blend_quality.
Eric Anholt [Fri, 25 Sep 2020 22:35:16 +0000 (15:35 -0700)]
r200: Reuse DRI_CONF_OPT_F for texture_blend_quality.

I missed this one in the nested macros conversion.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6916>

3 years agodriconf: Fix extra quoting on "Jimenez'".
Eric Anholt [Mon, 28 Sep 2020 22:44:21 +0000 (15:44 -0700)]
driconf: Fix extra quoting on "Jimenez'".

We're in a "" C string, no need to add extra '\'.  Fixes an extra '\' in
adriconf's interface.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6916>

3 years agodriconf: Eliminate the DRI_CONF_OPT_BEGIN_B macro.
Eric Anholt [Fri, 25 Sep 2020 22:06:11 +0000 (15:06 -0700)]
driconf: Eliminate the DRI_CONF_OPT_BEGIN_B macro.

Since the nested-sections rework, this use in the testcase was the only
remaining one.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6916>

3 years agointel/fs: Don't use NoDDClk/NoDDClr for split SHUFFLEs
Jason Ekstrand [Fri, 2 Oct 2020 18:37:05 +0000 (13:37 -0500)]
intel/fs: Don't use NoDDClk/NoDDClr for split SHUFFLEs

When I copied and pasted the code from MOV_INDIRECT for handling the
dependency controls, I missed a subtle difference between MOV_INDIRECT
and SHUFFLE.  Specifically, MOV_INDIRECT gets lowered to a narrow
instruction on Gen7 by the SIMD width lowering whereas SHUFFLE has to
split it in the generator.  Therefore, the check safety check for
whether or not we can use dependency control has to be based on the
lowered width rather than the width of the original instruction.

Fixes: a8ac61b0ee2fd "intel/fs: NoMask initialize the address..."
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3593
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6989>

3 years agoandroid: util: add log.c to Makefile.sources
Mauro Rossi [Thu, 1 Oct 2020 22:42:32 +0000 (00:42 +0200)]
android: util: add log.c to Makefile.sources

Fixes the following building errors:

external/mesa/src/intel/vulkan/anv_android.c:627: error: undefined reference to 'mesa_log'
...
external/mesa/src/intel/vulkan/anv_device.c:164: error: undefined reference to 'mesa_log'

Fixes: 13ea7db76 ("mesa: Promote Intel's simple logging façade for Android to util/")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6972>

3 years agopanfrost: decode: Flag pandecode_log_typed() as PRINTFLIKE
Boris Brezillon [Tue, 29 Sep 2020 08:25:56 +0000 (10:25 +0200)]
panfrost: decode: Flag pandecode_log_typed() as PRINTFLIKE

This way we can catch mismatch between the format string and the
arguments.

Suggested-by: Kristian H. Kristensen <hoegsberg@google.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6886>

3 years agopanfrost: decode: Fix decode_bifrost_constant() prototype
Boris Brezillon [Thu, 24 Sep 2020 06:49:36 +0000 (08:49 +0200)]
panfrost: decode: Fix decode_bifrost_constant() prototype

We expect a float, not an integer.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6886>

3 years agoradv: Use atomics to read query results.
Bas Nieuwenhuizen [Wed, 30 Sep 2020 11:07:43 +0000 (13:07 +0200)]
radv: Use atomics to read query results.

The volatile pattern gives me flaky results for 32-bit builds on
ChromeOS Android. This is because on 32-bit the volatile 64-bit
loads gets split into 2 32-bit loads each.

So if we read the lower dword first and then the upper dword, it
can happen that the upper dword is already changed but the lower
dword isn't yet. In particular for occlusion queries this gives
false readings, as the upper dword commonly only constains the
ready bit.

With the GCC atomic intrinsics we get a call to __atomic_load_8
in libatomic.so which does the right thing.

An alternative fix would be to  explicitly split the 32-bit loads
in the right order and do a bunch of retries if things change, though
that gets messy quickly and for 32-bit builds only doesn't feel worth
it that much.

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

3 years agopan/bi: Fix assert when writing vertex outputs
Alyssa Rosenzweig [Fri, 2 Oct 2020 16:02:36 +0000 (12:02 -0400)]
pan/bi: Fix assert when writing vertex outputs

Varying stores require us to generate a LEA_ATTR_IMM instruction, which
is a load.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 0aa08ae2f67 ("nir: Split NIR_INTRINSIC_TYPE into separate src/dest indices")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6985>

3 years agozink: use sizeof(vec4) multiplier for nir_lower_uniforms_to_ubo
Mike Blumenkrantz [Fri, 26 Jun 2020 22:16:15 +0000 (18:16 -0400)]
zink: use sizeof(vec4) multiplier for nir_lower_uniforms_to_ubo

we do everything ubo-related padded out to the size of a vec4, so ensure
that we're getting load offsets using the same alignment

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6981>

3 years agozink: correctly set up ubo bindings and buffer indices
Mike Blumenkrantz [Fri, 26 Jun 2020 19:49:03 +0000 (15:49 -0400)]
zink: correctly set up ubo bindings and buffer indices

var->data.binding is only set for vulkan drivers (though it also will
get incremented after nir_lower_uniforms_to_ubo), so we have to generate
our own values here.

to do this, we iterate backwards over the ubos to account for the
"first" ubos being at the end of the list, and we must also ensure that we
remap the buffer index correctly based on whether we're running our
nir_lower_uniforms_to_ubo pass

note that running nir_lower_uniforms_to_ubo unconditionally would require
us to add a number of checks in this patch for !shader->num_uniforms in
order to properly adjust to the altered instructions which become 1-indexed
instead of 0-indexed when this pass is run with no uniforms present

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6981>

3 years agozink: don't emit ubos or bindings for ubo variables
Mike Blumenkrantz [Fri, 26 Jun 2020 19:46:44 +0000 (15:46 -0400)]
zink: don't emit ubos or bindings for ubo variables

we want to only emit the full ubo block here to be used in the binding
table, not each ubo member variable, the likes of which are denoted by
having var->data.location != 0

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6981>

3 years agozink: emit ubo variables sized based on the overall ubo block size
Mike Blumenkrantz [Fri, 26 Jun 2020 19:44:03 +0000 (15:44 -0400)]
zink: emit ubo variables sized based on the overall ubo block size

if we're creating a block containing multiple variables, we want to create
the whole block at once, not just each individual variable, as we have no
way to reference individual variables in vulkan due to the requirement
for VkDescriptorSetLayoutBinding members to have different binding values

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6981>

3 years agozink: always emit descriptor set 0 in ntv
Mike Blumenkrantz [Fri, 26 Jun 2020 19:42:49 +0000 (15:42 -0400)]
zink: always emit descriptor set 0 in ntv

the nir_variable value is only set for vulkan drivers and will always
be 0 here

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6981>

3 years agozink: fix shader buffer size caps to use 65536
Mike Blumenkrantz [Fri, 26 Jun 2020 19:17:32 +0000 (15:17 -0400)]
zink: fix shader buffer size caps to use 65536

using max(Uniform|Storage)BufferRange yields some insane values that aren't
consistent with reality

affects PIPE_CAP_MAX_SHADER_BUFFER_SIZE and PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6981>

3 years agozink: run nir_lower_uniforms_to_ubo conditionally
Mike Blumenkrantz [Fri, 26 Jun 2020 19:15:07 +0000 (15:15 -0400)]
zink: run nir_lower_uniforms_to_ubo conditionally

if a shader has no uniforms then this pass just messes with the instructions
pointlessly and forces us to need workarounds later on in ntv

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6981>

3 years agozink: correctly handle ARB_arrays_of_arrays in ntv for samplers
Mike Blumenkrantz [Mon, 22 Jun 2020 19:11:16 +0000 (15:11 -0400)]
zink: correctly handle ARB_arrays_of_arrays in ntv for samplers

this extension allows for array nesting with no clear limitations, so we need
to ensure that we use the "unrolled" array size in a couple places in order to
correctly bind and access these types of arrays in shaders

fixes spec@arb_separate_shader_objects@active sampler conflict and others

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6981>

3 years agoaco/tests: add disassembler tests to reproduce the add3+clamp crash
Samuel Pitoiset [Thu, 1 Oct 2020 08:11:33 +0000 (10:11 +0200)]
aco/tests: add disassembler tests to reproduce the add3+clamp crash

Like some other v_add instructions, LLVM fails to disassemble
v_add3_u32 + clamp.

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

3 years agoaco: apply the clamped integer addition disassembly workaround for v_add3
Samuel Pitoiset [Thu, 1 Oct 2020 08:12:44 +0000 (10:12 +0200)]
aco: apply the clamped integer addition disassembly workaround for v_add3

LLVM fails to disassemble v_add3 + clamp.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3563
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/6961>

3 years agopan/mdg: map uabs_i/usub to i/uabsdiff
Italo Nicola [Sat, 19 Sep 2020 10:36:08 +0000 (10:36 +0000)]
pan/mdg: map uabs_i/usub to i/uabsdiff

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6823>

3 years agopan/mdg: remove unused arg from ALU_CHECK_CMP and ALU_CASE_CMP
Italo Nicola [Wed, 23 Sep 2020 05:41:38 +0000 (05:41 +0000)]
pan/mdg: remove unused arg from ALU_CHECK_CMP and ALU_CASE_CMP

Since commit eb28a366 there's no need for the sext parameter.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6837>

3 years agoaco: fix get_buffer_resource_flags()
Rhys Perry [Thu, 1 Oct 2020 18:51:38 +0000 (19:51 +0100)]
aco: fix get_buffer_resource_flags()

Looks like a rebase error. After switching to derefs, we have to look
through a nir_op_mov.

fossil-db (Navi):
Totals from 846 (0.62% of 137413) affected shaders:
SGPRs: 36856 -> 44144 (+19.77%); split: -0.20%, +19.97%
VGPRs: 35968 -> 27852 (-22.56%); split: -22.64%, +0.08%
SpillSGPRs: 1366 -> 1662 (+21.67%); split: -0.95%, +22.62%
SpillVGPRs: 1909 -> 1893 (-0.84%)
CodeSize: 5209588 -> 5146536 (-1.21%); split: -1.89%, +0.68%
Scratch: 221184 -> 217088 (-1.85%)
MaxWaves: 11488 -> 14266 (+24.18%); split: +24.20%, -0.02%
Instrs: 994831 -> 974318 (-2.06%); split: -2.53%, +0.47%
Cycles: 45719692 -> 45843260 (+0.27%); split: -0.99%, +1.26%
VMEM: 147562 -> 94468 (-35.98%); split: +9.75%, -45.74%
SMEM: 32122 -> 66023 (+105.54%); split: +120.34%, -14.80%
VClause: 41051 -> 20565 (-49.90%); split: -50.00%, +0.09%
SClause: 18076 -> 40142 (+122.07%)
Copies: 100092 -> 103521 (+3.43%); split: -0.98%, +4.40%
Branches: 51244 -> 51533 (+0.56%); split: -0.02%, +0.58%
PreSGPRs: 32290 -> 34267 (+6.12%)
PreVGPRs: 27458 -> 25290 (-7.90%); split: -7.91%, +0.01%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: 05b6612b4ec ('radv: do not lower UBO/SSBO access to offsets')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6966>

3 years agonir: Add a pass to lower vec3s to vec4s
Jason Ekstrand [Fri, 25 Sep 2020 22:43:33 +0000 (17:43 -0500)]
nir: Add a pass to lower vec3s to vec4s

LLVM loves take advantage of the fact that vec3s in OpenCL are 16B
aligned and so it can just read/write them as vec4s.  This results in a
LOT of vec4->vec3 casts on loads and stores.  One solution to this
problem is to get rid of all vec3 variables.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6871>

3 years agonir/opt_deref: Add an optimization for bitcasts
Jason Ekstrand [Fri, 25 Sep 2020 21:03:36 +0000 (16:03 -0500)]
nir/opt_deref: Add an optimization for bitcasts

LLVM loves take advantage of the fact that vec3s in OpenCL are 16B
aligned so it can just read/write them as vec4s.  This is questionably
legal except that it uses a xyz write-mask when it does it.  The result
is a LOT of vec4->vec3 casts on loads and stores.  This optimization
detects this case as well as other bit-cast cases and rewrites them to
get rid of the cast.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6871>

3 years agonir/opt_deref: Add an instruction type switch
Jason Ekstrand [Sat, 15 Aug 2020 16:02:46 +0000 (11:02 -0500)]
nir/opt_deref: Add an instruction type switch

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6871>

3 years agonir: Add component mask re-interpret helpers
Jason Ekstrand [Fri, 25 Sep 2020 21:01:03 +0000 (16:01 -0500)]
nir: Add component mask re-interpret helpers

These are based on the ones which already existed in the load/store
vectorization pass but I made some improvements while moving them.  In
particular,

 1. They're both faster if the bit sizes are equal
 2. The check is faster if old_bit_size > new_bit_size
 3. The check now fails if it would use more than NIR_MAX_VEC_COMPONENTS

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6871>

3 years agonir/opt_load_store_vectorize: Use bit sizes when checking mask compatibility
Jason Ekstrand [Fri, 25 Sep 2020 21:29:23 +0000 (16:29 -0500)]
nir/opt_load_store_vectorize: Use bit sizes when checking mask compatibility

Without this, it was checking bit size compatibility with bit sizes such
as 96 which is clearly invalid.

No shader-db changes on Ice Lake

Fixes: ce9205c03bd20d "nir: add a load/store vectorization pass"
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6871>

3 years agonir: Add a memcpy optimization pass
Jason Ekstrand [Fri, 25 Sep 2020 18:02:25 +0000 (13:02 -0500)]
nir: Add a memcpy optimization pass

This pass attempts to optimize three broad categories of memcpy:

 1. Self-copies: These we can discard out-of-hand.

 2. Vector copies: It doesn't matter what the vector size is or if the
    source and destination have different vector types, it's still easy
    enough to emit a load/store pair.

 3. Tightly packed copies:  In the case where a type is tightly packed
    (no padding bits), we can replace the memcpy with a copy_deref
    instruction which the optimizer is far better at handling.

This has proven capable of getting rid of many of the memcpy instances
in some rather gnarly OpenCL C kernels I've been looking at, even after
coming out of LLVM's optimizer.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6871>

3 years agonir: Handle memcpy in copy_prop_vars and combine_stores
Jason Ekstrand [Sat, 26 Sep 2020 04:42:08 +0000 (23:42 -0500)]
nir: Handle memcpy in copy_prop_vars and combine_stores

Fixes: b2899f72657 "nir: Add a new memcpy intrinsic"
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6871>