mesa.git
4 years agospirv: Use new global invocation offset system value
Jesse Natalie [Tue, 28 Jul 2020 17:37:09 +0000 (10:37 -0700)]
spirv: Use new global invocation offset system value

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5891>

4 years agonir: Add options to nir_lower_compute_system_values to control compute ID base lowering
Jesse Natalie [Fri, 21 Aug 2020 17:40:45 +0000 (10:40 -0700)]
nir: Add options to nir_lower_compute_system_values to control compute ID base lowering

If no options are provided, existing intrinsics are used.
If the lowering pass indicates there should be offsets used for global
invocation ID or work group ID, then those instructions are lowered to
include the offset.

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

4 years agonir: Move compute system value lowering to a separate pass
Jesse Natalie [Fri, 21 Aug 2020 17:18:14 +0000 (10:18 -0700)]
nir: Move compute system value lowering to a separate pass

The actual variable -> intrinsic lowering stays where it is, but
ops which convert one intrinsic to be implemented in terms of
another have moved.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5891>

4 years agocompiler/nir: make lowering global-id to local-id optional
Erik Faye-Lund [Mon, 13 Jan 2020 09:35:40 +0000 (10:35 +0100)]
compiler/nir: make lowering global-id to local-id optional

For D3D12, we don't want to lower this, as there's a dedicated global-id
system-value that might be faster to use, depending on the hardware.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5891>

4 years agonir: Add new system values and intrinsics for dealing with CL work offsets
Jesse Natalie [Mon, 27 Jul 2020 23:56:21 +0000 (16:56 -0700)]
nir: Add new system values and intrinsics for dealing with CL work offsets

New intrinsics are added for global invocation IDs and work group IDs to
deal with offsets in both. The only one of these that needs a system value
is global invocation offset, for CL's get_global_offset().

Note that CL requires very large work group sizes, so these intrinsics
are modified to be able to use 64bit values, for 64bit SPIR-V.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5891>

4 years agonir: Populate some places where existing system values were missing
Jesse Natalie [Fri, 29 May 2020 18:09:37 +0000 (11:09 -0700)]
nir: Populate some places where existing system values were missing

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5891>

4 years agoci/bare-metal: Try rebooting chezas again if they get stuck during tftp.
Eric Anholt [Wed, 19 Aug 2020 18:41:51 +0000 (11:41 -0700)]
ci/bare-metal: Try rebooting chezas again if they get stuck during tftp.

Occasionally something goes weird in the network and a group of chezas
will produce streams of these errors during the tftp process, eventually
timing out after 60 minutes in the job.  By the time we notice, the next
jobs seem to go through fine, so watch for them and try rebooting the
cheza to see if that gets our jobs to pass again.

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

4 years agoci/bare-metal: Retry booting chezas instead of failing when !POWER_GOOD
Eric Anholt [Wed, 19 Aug 2020 23:28:27 +0000 (16:28 -0700)]
ci/bare-metal: Retry booting chezas instead of failing when !POWER_GOOD

If we get this error, we can just try rebooting again and see if it comes
up then.  The POWER_GOOD failures are clustered in time, but it's better
to retry a few times in a row in one job (which has its own 60min timeout)
than to spuriously fail someone's pipeline.

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

4 years agoci/bare-metal: Convert the main cros-servo boot code to python
Eric Anholt [Wed, 19 Aug 2020 22:23:24 +0000 (15:23 -0700)]
ci/bare-metal: Convert the main cros-servo boot code to python

Switching this part to python makes the code clearer and cleans up our
logs as well.

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

4 years agoci/bare-metal: Use a new serial buffer tool.
Eric Anholt [Wed, 19 Aug 2020 20:00:25 +0000 (13:00 -0700)]
ci/bare-metal: Use a new serial buffer tool.

This one uses python threads to move some of our logic from shell
pipelines to python, and opens the door to doing better serial output
tracking in the future (the SerialBuffer.lines() method)

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

4 years agovirgl: update protocol headers
Chia-I Wu [Thu, 2 Jul 2020 18:40:43 +0000 (11:40 -0700)]
virgl: update protocol headers

Copied from virglrenderer.  Some in-development features are guarded by
VIRGL_RENDERER_UNSTABLE_APIS and they should not be used without knowing
the consequences.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6235>

4 years agovirgl: move protocol headers to a common place
Chia-I Wu [Thu, 2 Jul 2020 18:06:15 +0000 (11:06 -0700)]
virgl: move protocol headers to a common place

Tested with meson.  Android.mk changes are not tested.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6235>

4 years agoutil/ralloc: fix ralloc alignment.
Lepton Wu [Fri, 14 Aug 2020 02:14:13 +0000 (19:14 -0700)]
util/ralloc: fix ralloc alignment.

On some malloc implementation, malloc doesn't always align to 16
bytes even on 64 bits system. To make sure ralloc_header always
starts at the wanted alignment, just force the size to be aligned at
the alignment of ralloc_header. This fixes crashed on instruction
like "movaps %xmm0,0x10(%rax)" which requires aligned memory access.

Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6314>

4 years agosvga: fix draw elements with 8-bits indices
Charmaine Lee [Thu, 20 Aug 2020 22:45:47 +0000 (15:45 -0700)]
svga: fix draw elements with 8-bits indices

With commit 2122b902b80, u_index_translator can return U_TRANSLATE_MEMCPY
for 8-bits indices, and in this case we need to call the translation function
instead of a simple passthrough to the device.

Fixes piglit spec@nv_primitive_restart tests.

Fixes: 2122b902b8 "gallium/indices: don't expand prim-type for 8-bit indices"
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6414>

4 years agowinsys/svga: fix display corruption after surface_init
Charmaine Lee [Thu, 20 Aug 2020 23:43:00 +0000 (16:43 -0700)]
winsys/svga: fix display corruption after surface_init

When we initialize the buffer surface, do not map the existing storage
with DONTBLOCK, leave it as a synchronized map.
This patch also sets the surface rebind flag after it is bound to a
new buffer and sets the surface buffer pointer accordingly.

This fixes display corruption issue seen with running steam.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6415>

4 years agost/mesa: increase size of gl_register_file bitfields
Charmaine Lee [Fri, 21 Aug 2020 00:11:22 +0000 (17:11 -0700)]
st/mesa: increase size of gl_register_file bitfields

Bump up the size of the bitfields for gl_register_file type for MSVC.
Also add ASSERT_BITFIELD_SIZE check where this bitfield is used.

Fixes spec@arb_shader_atomic_counter_ops tests in MSVC.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6417>

4 years agonir: rename nir_op_fne to nir_op_fneu
Karol Herbst [Tue, 18 Aug 2020 17:51:57 +0000 (19:51 +0200)]
nir: rename nir_op_fne to nir_op_fneu

It was always fneu but naming it fne causes confusion from time to time. So
lets rename it. Later we also want to add other unordered and fne, this is
a smaller preparation for that.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6377>

4 years agobifrost: use nir_intrinsic_has_type
Rhys Perry [Thu, 20 Aug 2020 13:01:58 +0000 (14:01 +0100)]
bifrost: use nir_intrinsic_has_type

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6402>

4 years agoaco: use nir_intrinsic_has_access
Rhys Perry [Thu, 20 Aug 2020 13:01:36 +0000 (14:01 +0100)]
aco: use nir_intrinsic_has_access

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6402>

4 years agonir: add and use nir_intrinsic_has_ helpers
Rhys Perry [Thu, 20 Aug 2020 13:01:23 +0000 (14:01 +0100)]
nir: add and use nir_intrinsic_has_ helpers

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6402>

4 years agoaco: fix non-rtz pack_half_2x16
Rhys Perry [Mon, 17 Aug 2020 10:28:07 +0000 (11:28 +0100)]
aco: fix non-rtz pack_half_2x16

We were using the wrong conversion opcode. The high bits are also not
zero'd on GFX10, which can cause v_cvt_pk_u16_u32 to clamp.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: df645fa369d ('aco: implement VK_KHR_shader_float_controls')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6346>

4 years agoglsl: Eliminate out-of-bounds triop_vector_insert
Danylo Piliaiev [Tue, 18 Aug 2020 07:41:31 +0000 (10:41 +0300)]
glsl: Eliminate out-of-bounds triop_vector_insert

Section 5.11 (Out-of-Bounds Accesses) of the GLSL 4.60 spec says:

 "In the subsections described above for array, vector, matrix and
  structure accesses, any out-of-bounds access produced undefined
  behavior.... Out-of-bounds writes may be discarded or overwrite
  other variables of the active program."

Fixes crashes when dereferencing gl_ClipDistance and gl_TessLevel*, e.g:

  int index = -1;
  gl_ClipDistance[index] = -1;

When LowerCombinedClipCullDistance is true.

CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6363>

4 years agoglsl: Eliminate assigments to out-of-bounds elements of vector
Danylo Piliaiev [Mon, 17 Aug 2020 15:22:47 +0000 (18:22 +0300)]
glsl: Eliminate assigments to out-of-bounds elements of vector

Several optimization paths, including constant folding, can lead to
indexing vector with an out of bounds index.

Out-of-bounds writes could be eliminated per spec:

Section 5.11 (Out-of-Bounds Accesses) of the GLSL 4.60 spec says:

"In the subsections described above for array, vector, matrix and
 structure accesses, any out-of-bounds access produced undefined
 behavior.... Out-of-bounds writes may be discarded or overwrite
 other variables of the active program."

Fixes piglit tests:
spec@glsl-1.20@execution@vector-out-of-bounds-access@fs-vec4-out-of-bounds-1
spec@glsl-1.20@execution@vector-out-of-bounds-access@fs-vec4-out-of-bounds-6

CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6363>

4 years agoir_constant: Return zero on out-of-bounds vector accesses
Danylo Piliaiev [Mon, 17 Aug 2020 15:13:24 +0000 (18:13 +0300)]
ir_constant: Return zero on out-of-bounds vector accesses

Several optimization paths, including constant folding, can lead to
accessing an ir_constant vector with an out of bounds index.

Return 0 since GL_ARB_robustness and GL_KHR_robustness encourage
us to do so.

Fixes piglit tests:
spec@glsl-1.20@execution@vector-out-of-bounds-access@fs-vec4-out-of-bounds-2
spec@glsl-1.20@execution@vector-out-of-bounds-access@fs-vec4-out-of-bounds-4
spec@glsl-1.20@execution@vector-out-of-bounds-access@fs-vec4-out-of-bounds-5

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2604
CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6363>

4 years agoanv: support fd==-1 in ImportSemaphoreFdKHR
Ricardo Quesada [Thu, 2 Jul 2020 13:46:11 +0000 (06:46 -0700)]
anv: support fd==-1 in ImportSemaphoreFdKHR

If fd==-1 is passed in ImportSemaphoreFdKHR, instead of importing the
fd, in creates an already signaled syncobj.

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

4 years agoaco: add ACO_DEBUG=force-waitcnt to emit wait-states
Samuel Pitoiset [Wed, 19 Aug 2020 08:40:35 +0000 (10:40 +0200)]
aco: add ACO_DEBUG=force-waitcnt to emit wait-states

Sounds useful for debugging missing wait-states and for improving
detection of the faulty instruction in case of memory violations.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6386>

4 years agowgl: Switch to Win10 version defines to enable usage of Win10 WGL callbacks
Jesse Natalie [Tue, 17 Mar 2020 17:53:33 +0000 (10:53 -0700)]
wgl: Switch to Win10 version defines to enable usage of Win10 WGL callbacks

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

4 years agoradv: ignore BB labels when splitting the disassembly string
Samuel Pitoiset [Wed, 19 Aug 2020 11:42:57 +0000 (13:42 +0200)]
radv: ignore BB labels when splitting the disassembly string

Ignore everything that is not an instruction. This should fix
the annotated UMR disassembly.

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

4 years agoanv: take depth in to account in anv_GetImageSubresourceLayout
Tapani Pälli [Thu, 20 Aug 2020 09:49:46 +0000 (12:49 +0300)]
anv: take depth in to account in anv_GetImageSubresourceLayout

Fixes dEQP-VK.image.subresource_layout.3d* tests on gen9.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6400>

4 years agoiris: Add missing newline to debug log message
Caleb Callaway [Thu, 20 Aug 2020 00:12:10 +0000 (17:12 -0700)]
iris: Add missing newline to debug log message

Without this newline, log messages get lumped together on a single line,
making the debug log difficult to read.

Reviewed-by: Mark Janes <mark.a.janes@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6413>

4 years agoci/freedreno: List more common flakes reported recently.
Eric Anholt [Wed, 19 Aug 2020 17:51:50 +0000 (10:51 -0700)]
ci/freedreno: List more common flakes reported recently.

Now that adding to our flakes list won't disturb the test order
(potentially just moving the flake to a different result), we can be more
aggressive in listing new flakes.

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6392>

4 years agoci/freedreno: Move our skips lists over to being known-flakes lists.
Eric Anholt [Wed, 19 Aug 2020 17:43:54 +0000 (10:43 -0700)]
ci/freedreno: Move our skips lists over to being known-flakes lists.

This makes sure that we keep executing the tests so that we can get our
alerts in IRC and know whether the tests are still flaking.  It also keeps
us from having adjustments to the skip list causing failures/flakes to
move to different tests (as seen with a530 having to move some xfails
around after changing the skip list)

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6392>

4 years agoci/deqp-runner: Add a post-deqp-run filter list for known flakes.
Eric Anholt [Wed, 19 Aug 2020 17:30:12 +0000 (10:30 -0700)]
ci/deqp-runner: Add a post-deqp-run filter list for known flakes.

So far, we've been putting our known flakes that intermittently fail CI
into the skips list.  This has two downsides:

1) You don't know when the flakes stop happening and when to delist them
   from skips, unless you go do a bunch of manual runs with the skips list
   cleared.

2) If the flake was because the previous test left some broken state in
   the HW, you may just move your intermittent to a new test.

With this new path, you can list your flakes in the flakes file to keep
them from erroring out people's pipelines.  They still get run and
reported as is.

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6392>

4 years agoci/deqp-runner: Drop unused "count" variable
Eric Anholt [Wed, 19 Aug 2020 17:17:17 +0000 (10:17 -0700)]
ci/deqp-runner: Drop unused "count" variable

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6392>

4 years agoci/deqp-runner: Drop stale comment from deqp-runner.sh.
Eric Anholt [Wed, 19 Aug 2020 17:15:12 +0000 (10:15 -0700)]
ci/deqp-runner: Drop stale comment from deqp-runner.sh.

We don't rerun to detect flakes ourselves any more since the runner does
it internally.

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6392>

4 years agonir: Use 'unsigned' instead of enum types in nir_variable::data
Jesse Natalie [Wed, 19 Aug 2020 21:34:11 +0000 (14:34 -0700)]
nir: Use 'unsigned' instead of enum types in nir_variable::data

MSVC treats enums as signed, so storing values that use the topmost
bit of the explicitly sized field loads as a negative value instead.

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

4 years agonir: Add an LOD parameter to image_*_size
Jason Ekstrand [Wed, 19 Aug 2020 23:21:33 +0000 (18:21 -0500)]
nir: Add an LOD parameter to image_*_size

The OpenCL image_width/height/depth functions have variants which can
take an LOD parameter.  More importantly, LLVM-SPIRV-Translator always
generates OpImageQuerySizeLod even if the LOD is guaranteed to be zero.
Given that over half the hardware out there has an LOD field for image
size queries (based on a rudimentary scan through their NIR -> whatever
code), we may as well just add the source to the NIR intrinsic.  If this
is ever a problem for anyone, the lowering is pretty trivial.

I've also added asserts to everyone's drivers that should alert them if
they ever see an LOD other than zero.  This will never happen with GL or
Vulkan so there's no need for panic.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6396>

4 years agobroadcom/compiler: Enable PER_QUAD for UBO and SSBO loads.
Arcady Goldmints-Orlov [Mon, 10 Aug 2020 03:17:01 +0000 (22:17 -0500)]
broadcom/compiler: Enable PER_QUAD for UBO and SSBO loads.

Helper invocations need to be able to read from UBOs since those values
can be used for flow control, but writes from helper invocations need to
be dropped.

Fixes CTS tests:
  dEQP-VK.glsl.derivate.*.uniform_loop.*

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6356>

4 years agobroadcom/compiler: Add a constant folding pass after nir_lower_io
Arcady Goldmints-Orlov [Sat, 25 Jul 2020 15:39:31 +0000 (10:39 -0500)]
broadcom/compiler: Add a constant folding pass after nir_lower_io

The nir_lower_io pass produces a bunch of constant arithmetic, and
assumes that constant folding will simplify it away.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6356>

4 years agobroadcom/compiler: support nir_intrinsic_load_sample_id
Arcady Goldmints-Orlov [Sat, 25 Jul 2020 20:20:02 +0000 (15:20 -0500)]
broadcom/compiler: support nir_intrinsic_load_sample_id

This adds support for the intrinsic as well as the vir_SAMPID
instruction that corresponds to it in vir.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6356>

4 years agoclover/spirv: pass list of supported extensions to the translator
Karol Herbst [Sat, 15 Aug 2020 19:49:05 +0000 (21:49 +0200)]
clover/spirv: pass list of supported extensions to the translator

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5038>

4 years agoclover/nir: Register callback for translation messages (v2)
Pierre Moreau [Sun, 10 May 2020 21:21:56 +0000 (23:21 +0200)]
clover/nir: Register callback for translation messages (v2)

This allows us to add SPIR-V to NIR translation failure messages to the
program’s compilation log, which can then be queried by the user.

v2: Replace the if-statement in `debug_function()` with an assert.

Signed-off-by: Pierre Moreau <dev@pmoreau.org>
Reviewed-by: Serge Martin <edb@sigluy.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5038>

4 years agoclover/llvm: Use the highest supported SPIR-V version (v4)
Pierre Moreau [Mon, 18 May 2020 16:08:37 +0000 (18:08 +0200)]
clover/llvm: Use the highest supported SPIR-V version (v4)

v2:
   a) Move `supported_spirv_verssions()` to `spirv::` (Francisco Jerez)
   b) Introduce a `SPV_MAKE_VERSION` macro to avoid making mistakes and
     making it more readable than its uint representation.
v3: Replaced an if-statement with a `std::min()` in
    `spirv::get_spirv_translator_options()` (Karol Herbst)
v4: Turn `SPV_MAKE_VERSION()` into a function (Francisco Jerez)

Signed-off-by: Pierre Moreau <dev@pmoreau.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5038>

4 years agomeson: Raise minimum version for SPIR-V OpenCL deps (v4)
Pierre Moreau [Tue, 5 May 2020 11:44:12 +0000 (13:44 +0200)]
meson: Raise minimum version for SPIR-V OpenCL deps (v4)

SPIRV-LLVM-Translator had API-breaking changes during version 0.2.1.
Since the new API was being used, a higher version has to be requested.

While at it and since SPIRV-LLVM-Translator added a new API to request a
specific SPIR-V version as well as allowed SPIR-V extensions, increase
the version number to the first including those new features.

v2: Require an LLVM version which is compatible with the
    SPIRV-LLVM-Translator that was found; that requirement was
    previously implicit and would be ensured when that library was
    built. Making it explicit will help in cases where multiple versions
    of LLVM might be installed.
v3: fix use of undefined _minimum_llvmspirvlib_version_array
v4 (Karol): fix creating the minimum requested version
            Simplifing the code

Signed-off-by: Pierre Moreau <dev@pmoreau.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Serge Martin <edb@sigluy.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5038>

4 years agoclover/spirv: Print linked SPIR-V module if asked
Pierre Moreau [Tue, 5 May 2020 11:14:26 +0000 (13:14 +0200)]
clover/spirv: Print linked SPIR-V module if asked

Signed-off-by: Pierre Moreau <dev@pmoreau.org>
Reviewed-by: Serge Martin <edb@sigluy.net>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5038>

4 years agoclover/spirv: Remove unused tuple header
Pierre Moreau [Tue, 5 May 2020 11:16:55 +0000 (13:16 +0200)]
clover/spirv: Remove unused tuple header

Fixes: 21473865050 ("clover/spirv: Add functions for parsing arguments, linking programs, etc.")
Signed-off-by: Pierre Moreau <dev@pmoreau.org>
Reviewed-by: Serge Martin <edb@sigluy.net>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5038>

4 years agoclover/spirv: rework handling of spirv extensions
Karol Herbst [Sat, 15 Aug 2020 11:19:52 +0000 (13:19 +0200)]
clover/spirv: rework handling of spirv extensions

What extensions we support depends on spirv_to_nir but it doesn't give us a
list. So hardcode one and add extensions we know we support and hit in the
wild.

v2: move into spirv lib

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5038>

4 years agopanfrost: Fix alignment on Bifrost
Alyssa Rosenzweig [Thu, 20 Aug 2020 17:36:46 +0000 (13:36 -0400)]
panfrost: Fix alignment on Bifrost

This was real "fun" to debug...

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 373a204bdd7 ("panfrost: Pass alignments explicitly")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6410>

4 years agotu: Enable VK_KHR_multiview
Connor Abbott [Thu, 2 Jul 2020 09:34:54 +0000 (11:34 +0200)]
tu: Enable VK_KHR_multiview

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

4 years agotu: Implement multiview pipeline state
Connor Abbott [Thu, 2 Jul 2020 09:33:42 +0000 (11:33 +0200)]
tu: Implement multiview pipeline state

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

4 years agotu: Add multiview lowering pass
Connor Abbott [Mon, 13 Jul 2020 17:27:53 +0000 (19:27 +0200)]
tu: Add multiview lowering pass

For now this only handles an a630 quirk where PC_MULTIVIEW_MASK doesn't
exist. However in the future it will also handle multi-position output.

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

4 years agotu: Implement multiview query interactions
Connor Abbott [Thu, 2 Jul 2020 09:12:13 +0000 (11:12 +0200)]
tu: Implement multiview query interactions

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

4 years agotu: Improve timestamp queries
Connor Abbott [Thu, 2 Jul 2020 09:07:34 +0000 (11:07 +0200)]
tu: Improve timestamp queries

As the original comment says, we can't really give the user what they
want if there's a timestamp inside a GMEM renderpass, but we can give
them a better approximation of it. At least sysmem renderpasses will now
have an accurate timestamp.

Also, don't emit the WFI if it's not necessary, based on the stage
flags.

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

4 years agotu: Implement multiview clear/resolve interactions
Connor Abbott [Thu, 2 Jul 2020 09:25:54 +0000 (11:25 +0200)]
tu: Implement multiview clear/resolve interactions

Loads, stores, clears, and resolves now happen per-view. Since we only
support multiview with sysmem rendering, we only implement this for
sysmem clears and resolves.

There aren't any tests that mix multiview and MSAA, so no coverage of
the resolve path.

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

4 years agotu: Parse multiview render pass info
Connor Abbott [Thu, 2 Jul 2020 09:16:50 +0000 (11:16 +0200)]
tu: Parse multiview render pass info

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

4 years agotu: Translate VkRenderPassMultiviewCreateInfo to VkRenderPassCreateInfo2
Connor Abbott [Thu, 2 Jul 2020 08:46:27 +0000 (10:46 +0200)]
tu: Translate VkRenderPassMultiviewCreateInfo to VkRenderPassCreateInfo2

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

4 years agoir3: Add support for gl_ViewIndex in VS & FS
Connor Abbott [Wed, 1 Jul 2020 14:46:22 +0000 (16:46 +0200)]
ir3: Add support for gl_ViewIndex in VS & FS

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

4 years agofreedreno/a6xx: Add multiview registers
Connor Abbott [Tue, 30 Jun 2020 11:04:50 +0000 (13:04 +0200)]
freedreno/a6xx: Add multiview registers

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

4 years agofreedreno/a6xx: disable LRZ when color channels are masked
Rob Clark [Thu, 20 Aug 2020 18:14:36 +0000 (11:14 -0700)]
freedreno/a6xx: disable LRZ when color channels are masked

From the PoV of early-z tests, having masked color channels is basically
like blend, ie. we do actually care about the fragments (or at least
parts of them) from previous draws.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6409>

4 years agofreedreno/cffdump: add arg to filter by process name
Rob Clark [Thu, 20 Aug 2020 18:13:32 +0000 (11:13 -0700)]
freedreno/cffdump: add arg to filter by process name

Usueful when you have a cmdstream trace which consists of multiple
different processes.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6409>

4 years agonir: Shrink store intrinsic num_components to the size used by the writemask.
Eric Anholt [Thu, 23 Jul 2020 21:32:13 +0000 (14:32 -0700)]
nir: Shrink store intrinsic num_components to the size used by the writemask.

This cuts a bunch of vector setup for undef components in the i965 vec4
backend.  Noticed while looking into codegen regressions in nir-to-tgsi.

brw results:
total instructions in shared programs: 3893221 -> 3881461 (-0.30%)
total cycles in shared programs: 113792154 -> 113810288 (0.02%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6054>

4 years agonir: Expand opt_undef to handle undef channels in a store intrinsic.
Eric Anholt [Thu, 23 Jul 2020 21:24:15 +0000 (14:24 -0700)]
nir: Expand opt_undef to handle undef channels in a store intrinsic.

Instead of only handling all-undef stores, shrink the writemask to just
the defined channels.  Cleans up a bunch of writemasks on prog_to_nir
output in particular.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6054>

4 years agonir/opt_undef: Handle a couple more normal store intrinsics.
Eric Anholt [Thu, 23 Jul 2020 20:39:56 +0000 (13:39 -0700)]
nir/opt_undef: Handle a couple more normal store intrinsics.

They've got the value in the same slot as the others, and the same undef
behavior should be fine.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6054>

4 years agoradv: Move nir_opt_shrink_vectors() into the opt loop.
Eric Anholt [Wed, 19 Aug 2020 16:16:15 +0000 (09:16 -0700)]
radv: Move nir_opt_shrink_vectors() into the opt loop.

Upcoming changes to opt_undef will result in this pass doing more work and
generating vector MOVs that need re-scalarizing (which is inside of the
main opt loop).

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6054>

4 years agopanfrost: Reduce attribute buffer allocations
Alyssa Rosenzweig [Mon, 17 Aug 2020 18:49:52 +0000 (14:49 -0400)]
panfrost: Reduce attribute buffer allocations

With vertex ID / instance ID in use, vs->attribute_count will be
expanded appropriately. Without them in use, everything is 1:1 (or 1:2
in the worst case of NPOT everything).

Down to 3 slabs + 64184 bytes.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Don't reserve for NPOT w/o instancing
Alyssa Rosenzweig [Mon, 17 Aug 2020 18:46:56 +0000 (14:46 -0400)]
panfrost: Don't reserve for NPOT w/o instancing

It's impossible. Down to 5 slabs + 45368.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Don't overallocate attributes
Alyssa Rosenzweig [Mon, 17 Aug 2020 18:42:41 +0000 (14:42 -0400)]
panfrost: Don't overallocate attributes

We only need vertex ID / instance ID if the shader actually requests it.
Cuts -bideas's beginning from (7 slab + 63352 bytes) to (7 slabs +
32568).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Fix attribute buffer underallocation
Alyssa Rosenzweig [Mon, 17 Aug 2020 18:37:44 +0000 (14:37 -0400)]
panfrost: Fix attribute buffer underallocation

Breaks on the pathological where everything is NPOT.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: e646c861fc6 ("panfrost: Use packs for vertex attribute buffers")
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Pass alignments explicitly
Alyssa Rosenzweig [Mon, 17 Aug 2020 18:27:57 +0000 (14:27 -0400)]
panfrost: Pass alignments explicitly

In most cases, GPU data structures need only be self-aligned; the
worst-case 128 byte alignment is wasteful. By passing explicit
alignments, we can reduce memory usage, avoid extra allocations, and
improve descriptor cache locality.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Free batch->dependencies
Alyssa Rosenzweig [Tue, 18 Aug 2020 12:41:37 +0000 (08:41 -0400)]
panfrost: Free batch->dependencies

On glmark2-es2 -bterrain:

594.05KB leaked over 9282 calls from:
    panfrost_batch_update_bo_access
      at ../src/gallium/drivers/panfrost/pan_job.c:462
      in /home/alyssa/rockchip_dri.so
    panfrost_batch_add_bo
      at ../src/gallium/drivers/panfrost/pan_job.c:560
    panfrost_batch_add_bo
      at ../src/gallium/drivers/panfrost/pan_job.c:519
      in /home/alyssa/rockchip_dri.so
    panfrost_batch_add_resource_bos
      at ../src/gallium/drivers/panfrost/pan_job.c:569
    panfrost_batch_add_fbo_bos
      at ../src/gallium/drivers/panfrost/pan_job.c:588
      in /home/alyssa/rockchip_dri.so
    panfrost_create_batch
      at ../src/gallium/drivers/panfrost/pan_job.c:126

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Cc: mesa-stable
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Use memctx for sysvals
Alyssa Rosenzweig [Tue, 18 Aug 2020 12:31:42 +0000 (08:31 -0400)]
panfrost: Use memctx for sysvals

8.74KB leaked over 52 calls from:
    0xffffbb5b9fc3
      in ??
    _mesa_hash_table_init
      at ../src/util/hash_table.c:163
      in /home/alyssa/rockchip_dri.so
    _mesa_hash_table_create
      at ../src/util/hash_table.c:186
    _mesa_hash_table_u64_create
      at ../src/util/hash_table.c:701
      in /home/alyssa/rockchip_dri.so
    panfrost_nir_assign_sysvals
      at ../src/panfrost/util/pan_sysval.c:130
      in /home/alyssa/rockchip_dri.so
    midgard_compile_shader_nir
      at ../src/panfrost/midgard/midgard_compile.c:2905
      in /home/alyssa/rockchip_dri.so

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Cc: mesa-stable
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopan/mdg: Free previous liveness
Alyssa Rosenzweig [Tue, 18 Aug 2020 12:26:40 +0000 (08:26 -0400)]
pan/mdg: Free previous liveness

Before we drop the reference.

160 calls with 0B peak consumption from:
    0xffffbd9d2fc3
      in ??
    pan_compute_liveness
      at ../src/panfrost/util/pan_liveness.c:127
      in /home/alyssa/rockchip_dri.so
    mir_compute_liveness
      at ../src/panfrost/midgard/midgard_liveness.c:55
      in /home/alyssa/rockchip_dri.so
    midgard_opt_dead_code_eliminate
      at ../src/panfrost/midgard/midgard_opt_dce.c:118
      in /home/alyssa/rockchip_dri.so

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Cc: mesa-stable
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Free hash_to_temp map
Alyssa Rosenzweig [Tue, 18 Aug 2020 12:23:13 +0000 (08:23 -0400)]
panfrost: Free hash_to_temp map

No need to put it on the context, we can keep it local in mir_squeeze
and drop when we're done.

15.77KB leaked over 85 calls from:
    0xffffaed3bfc3
      in ??
    _mesa_hash_table_rehash
      at ../src/util/hash_table.c:368
      in /home/alyssa/rockchip_dri.so
    hash_table_insert
      at ../src/util/hash_table.c:403
      in /home/alyssa/rockchip_dri.so
    find_or_allocate_temp
      at ../src/panfrost/midgard/mir_squeeze.c:48
      in /home/alyssa/rockchip_dri.so
    find_or_allocate_temp
      at ../src/panfrost/midgard/mir_squeeze.c:35
      in /home/alyssa/rockchip_dri.so
    mir_squeeze_index
      at ../src/panfrost/midgard/mir_squeeze.c:76

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Cc: mesa-stable
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Free NIR of blit shaders
Alyssa Rosenzweig [Tue, 18 Aug 2020 12:10:25 +0000 (08:10 -0400)]
panfrost: Free NIR of blit shaders

After we compile from NIR to a native binary, we can throw away the NIR.

17.47KB leaked over 104 calls from:
    0xffff87dcafc3
      in ??
    _mesa_hash_table_init
      at ../src/util/hash_table.c:163
      in /home/alyssa/rockchip_dri.so
    _mesa_hash_table_create
      at ../src/util/hash_table.c:186
    nir_lower_vars_to_ssa_impl
      at ../src/compiler/nir/nir_lower_vars_to_ssa.c:717
      in /home/alyssa/rockchip_dri.so
    nir_lower_vars_to_ssa
      at ../src/compiler/nir/nir_lower_vars_to_ssa.c:817
    optimise_nir
      at ../src/panfrost/midgard/midgard_compile.c:504
      in /home/alyssa/rockchip_dri.so
    midgard_compile_shader_nir
      at ../src/panfrost/midgard/midgard_compile.c:2895
      in /home/alyssa/rockchip_dri.so
    panfrost_build_blit_shader
      at ../src/panfrost/lib/pan_blit.c:103
      in /home/alyssa/rockchip_dri.so

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Cc: mesa-stable
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Free cloned NIR shader
Alyssa Rosenzweig [Tue, 18 Aug 2020 12:07:15 +0000 (08:07 -0400)]
panfrost: Free cloned NIR shader

Fixes heaptrack leak:

19.37KB leaked over 63 calls from:
    0xffff92bbefc3
      in ??
    nir_alu_instr_create
      at ../src/compiler/nir/nir.c:442
      in /home/alyssa/rockchip_dri.so
    clone_alu
      at ../src/compiler/nir/nir_clone.c:277
      in /home/alyssa/rockchip_dri.so
    clone_instr
      at ../src/compiler/nir/nir_clone.c:495
      in /home/alyssa/rockchip_dri.so
    clone_block
      at ../src/compiler/nir/nir_clone.c:544
    clone_cf_list
      at ../src/compiler/nir/nir_clone.c:594
    clone_function_impl
      at ../src/compiler/nir/nir_clone.c:672
      in /home/alyssa/rockchip_dri.so
    nir_shader_clone
      at ../src/compiler/nir/nir_clone.c:744
      in /home/alyssa/rockchip_dri.so
    panfrost_shader_compile
      at ../src/gallium/drivers/panfrost/pan_assemble.c:154
      in /home/alyssa/rockchip_dri.so

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Cc: mesa-stable
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Fix blend leak for render targets 5-8
Alyssa Rosenzweig [Mon, 17 Aug 2020 23:57:54 +0000 (19:57 -0400)]
panfrost: Fix blend leak for render targets 5-8

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 375d4c2c74d ("panfrost: Extend blending to MRT")
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Keep finalized blend state constant
Alyssa Rosenzweig [Mon, 17 Aug 2020 23:52:20 +0000 (19:52 -0400)]
panfrost: Keep finalized blend state constant

It's probably fine, but the writes to an uninitialized struct make me
nervous. Let's do the obvious thing instead.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Drop depth-only case in blend finalize
Alyssa Rosenzweig [Mon, 17 Aug 2020 23:43:24 +0000 (19:43 -0400)]
panfrost: Drop depth-only case in blend finalize

Since last commit, we don't call this function at all if there's no
matching colour buffer (it wouldn't make sense to!)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Explicitly handle nr_cbufs=0 case
Alyssa Rosenzweig [Mon, 17 Aug 2020 23:41:48 +0000 (19:41 -0400)]
panfrost: Explicitly handle nr_cbufs=0 case

Avoids some indirection around colour buffer count.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Drop implicit blend pooling
Alyssa Rosenzweig [Mon, 17 Aug 2020 23:32:59 +0000 (19:32 -0400)]
panfrost: Drop implicit blend pooling

We dropped blend shader pools a long time ago for various reasons, but
the indirection required remained. Oops.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Share tiler_heap across batches/contexts
Alyssa Rosenzweig [Mon, 17 Aug 2020 17:14:54 +0000 (13:14 -0400)]
panfrost: Share tiler_heap across batches/contexts

There's only one tiler, so this is safe. (The blob does the same
optimization.) This avoids allocating multiple heaps for multiple
batches, which wastes memory and CPU time.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopan/decode: Don't try to dereference heap mapping
Alyssa Rosenzweig [Mon, 17 Aug 2020 17:48:26 +0000 (13:48 -0400)]
pan/decode: Don't try to dereference heap mapping

It might not be mapped from our perspective, we shouldn't crash on that
just for a validation that isn't actually correct.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Avoid minimum stack allocations
Alyssa Rosenzweig [Mon, 17 Aug 2020 16:30:49 +0000 (12:30 -0400)]
panfrost: Avoid minimum stack allocations

If stack isn't used, don't allocate it - simple as that.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Introduce invisible pool
Alyssa Rosenzweig [Mon, 17 Aug 2020 14:31:02 +0000 (10:31 -0400)]
panfrost: Introduce invisible pool

Whereas the main batch->pool is CPU read/write, the new
batch->invisible_pool is not. This enables GPU-internal structures that
the CPU must allocate from a pool dynamically but does not read,
corresponding to the BO_INVISIBLE create flag.

The use case is speeding up varying allocation by skipping the
CPU-side mmap/munmap.

We simultaneously half the pool's minimal allocation to avoid negatively
affecting memory usage.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agopanfrost: Pre-allocate memory for pool
Alyssa Rosenzweig [Fri, 14 Aug 2020 23:08:57 +0000 (19:08 -0400)]
panfrost: Pre-allocate memory for pool

Seeing random BO creates in the middle of command stream generation is
annoying, let's preallocate memory so CPU profiling is less random.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

4 years agoiris: Fix headerless sampler messages in compute shaders with preemption
Kenneth Graunke [Tue, 18 Aug 2020 20:56:22 +0000 (13:56 -0700)]
iris: Fix headerless sampler messages in compute shaders with preemption

We were failing to set the "Headerless Message for Preemptable Contexts"
bit in SAMPLER_MODE in the compute context.  Other drivers use a single
hardware context, so setting it on the render engine was sufficient to
flip it in both pipelines.  But iris uses a separate hardware context
for compute, so we were only getting these set for the render context.

Thanks to Jason Ekstrand for catching this bug.

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

4 years agoaco: fix file leak in ra_fail()
Samuel Pitoiset [Thu, 20 Aug 2020 07:41:46 +0000 (09:41 +0200)]
aco: fix file leak in ra_fail()

Fixes: c2b1978aa47 ("aco: rework the way various compilation/validation errors are reported")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6399>

4 years agonir/opt_large_constants: Fix a type/deref_type typo
Jason Ekstrand [Thu, 20 Aug 2020 13:46:43 +0000 (08:46 -0500)]
nir/opt_large_constants: Fix a type/deref_type typo

Fixes: df9596353a60 "nir/large_constants: Handle incomplete derefs"
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6403>

4 years agogitlab: ask for more detailed info about GPU
Marcin Ślusarz [Mon, 17 Aug 2020 09:55:29 +0000 (11:55 +0200)]
gitlab: ask for more detailed info about GPU

PCIID is only printed by lspci/lshw on demand.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6345>

4 years agoradv: fix null memcpy and zero-sized malloc
Rhys Perry [Fri, 14 Aug 2020 16:40:13 +0000 (17:40 +0100)]
radv: fix null memcpy and zero-sized malloc

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

4 years agoradv: align pipeline cache entry and header sizes
Rhys Perry [Thu, 6 Aug 2020 13:39:04 +0000 (14:39 +0100)]
radv: align pipeline cache entry and header sizes

Fixes UBSan error:
../src/amd/vulkan/radv_pipeline_cache.c:603:42: runtime error: member access within misaligned address 0x00000152ebcc for type 'struct cache_entry', which requires 8 byte alignment

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

4 years agoradv: don't pass null to _mesa_sha1_update
Rhys Perry [Wed, 5 Aug 2020 20:03:22 +0000 (21:03 +0100)]
radv: don't pass null to _mesa_sha1_update

This could then pass NULL to memcpy. Fixes UBSan error:
../src/util/sha1/sha1.c:140:8: runtime error: null pointer passed as argument 2, which is declared to never be null

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

4 years agonir: fix memory leak in nir_cf_list_clone
Rhys Perry [Thu, 6 Aug 2020 13:17:31 +0000 (14:17 +0100)]
nir: fix memory leak in nir_cf_list_clone

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6206>

4 years agonir: fix potential left shift of a negative value
Rhys Perry [Wed, 5 Aug 2020 20:03:31 +0000 (21:03 +0100)]
nir: fix potential left shift of a negative value

Fixes UBSan error:
src/compiler/nir/nir_constant_expressions.c:36573:32: runtime error: left shift of negative value -1

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6206>

4 years agoutil: add a alignof() macro
Rhys Perry [Thu, 6 Aug 2020 13:53:36 +0000 (14:53 +0100)]
util: add a alignof() macro

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6206>

4 years agogitlab: ask inxi output to be in code blocks
Rhys Perry [Tue, 18 Aug 2020 12:23:59 +0000 (13:23 +0100)]
gitlab: ask inxi output to be in code blocks

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6365>

4 years agoradv,aco: report ACO errors/warnings back via VK_EXT_debug_report
Samuel Pitoiset [Fri, 14 Aug 2020 11:59:16 +0000 (13:59 +0200)]
radv,aco: report ACO errors/warnings back via VK_EXT_debug_report

To help developers.

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

4 years agoaco: rework the way various compilation/validation errors are reported
Samuel Pitoiset [Fri, 14 Aug 2020 08:42:27 +0000 (10:42 +0200)]
aco: rework the way various compilation/validation errors are reported

The upcoming change will allow to report all ACO errors (or warnings)
directly to the app via VK_EXT_debug_report. This is similar to what
we already do for reporting various SPIRV->NIR errors.

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

4 years agoaco: rename DEBUG_VALIDATE to DEBUG_VALIDATE_IR
Samuel Pitoiset [Tue, 18 Aug 2020 06:14:06 +0000 (08:14 +0200)]
aco: rename DEBUG_VALIDATE to DEBUG_VALIDATE_IR

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

4 years agoanv: null check for buffer before reading size
Tapani Pälli [Tue, 18 Aug 2020 12:16:37 +0000 (15:16 +0300)]
anv: null check for buffer before reading size

v2: move assignment under existing check (Nanley)

Fixes: b9a05447a19 ("anv: dynamic vertex input binding stride and size support")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6369>