mesa.git
4 years agofreedreno/a6xx: Program SP_2D_SRC_FORMAT outside blit loop
Kristian H. Kristensen [Thu, 2 Jul 2020 11:00:42 +0000 (04:00 -0700)]
freedreno/a6xx: Program SP_2D_SRC_FORMAT outside blit loop

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

4 years agofreedreno/a6xx: Set src and dst rects outside blit loop
Kristian H. Kristensen [Thu, 2 Jul 2020 10:54:58 +0000 (03:54 -0700)]
freedreno/a6xx: Set src and dst rects outside blit loop

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

4 years agofreedreno/a6xx: Don't set unknown bit when tiling differs
Kristian H. Kristensen [Thu, 2 Jul 2020 10:49:57 +0000 (03:49 -0700)]
freedreno/a6xx: Don't set unknown bit when tiling differs

There is a bit here that's sometimes set, but it's generally not
related to whether tiling differs between src and dst.  Let's stop
setting it until we know more.

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

4 years agofreedreno/a6xx: Split out src and dst setup helpers for blit
Kristian H. Kristensen [Thu, 2 Jul 2020 10:42:19 +0000 (03:42 -0700)]
freedreno/a6xx: Split out src and dst setup helpers for blit

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

4 years agofreedreno/a6xx: Move fd6_ifmt into fd6_blitter.c
Kristian H. Kristensen [Thu, 2 Jul 2020 10:05:12 +0000 (03:05 -0700)]
freedreno/a6xx: Move fd6_ifmt into fd6_blitter.c

It's only used in this file.

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

4 years agofreedreno/a6xx: Don't blit with R2D_RAW
Kristian H. Kristensen [Wed, 1 Jul 2020 21:50:52 +0000 (14:50 -0700)]
freedreno/a6xx: Don't blit with R2D_RAW

Map all formats to a valid ifmt.  FMT6_10_10_10_2_UNORM_DEST still
doesn't work on the blitter so keep that one on the u_blitter path.

Fixes
dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.*
with FD_MESA_DEBUG=nogmem.

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

4 years agoturnip: drop GS clear path
Jonathan Marek [Tue, 7 Jul 2020 17:12:14 +0000 (13:12 -0400)]
turnip: drop GS clear path

We didn't know how to write layer id without GS, since that's the only way
to do it through VK/GL, and the blob didn't implement this clear case (and
failed cases where it was absolutely necessary). However now we know how to
set it after some educated guesses and looking at tess/geom traces, so the
GS path can be dropped.

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

4 years agoturnip: clean up primitive output state
Jonathan Marek [Tue, 7 Jul 2020 14:37:40 +0000 (10:37 -0400)]
turnip: clean up primitive output state

We only need to emit one set of primitive output registers. This may differ
from the blob, because it seems to try to allow using the same pipeline
with tess/geom enabled/disabled.

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

4 years agofreedreno/regs: update primitive output related registers
Jonathan Marek [Tue, 7 Jul 2020 04:08:33 +0000 (00:08 -0400)]
freedreno/regs: update primitive output related registers

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

4 years agofreedreno/ir3: Fix uninit var warning.
Eric Anholt [Wed, 8 Jul 2020 20:49:31 +0000 (13:49 -0700)]
freedreno/ir3: Fix uninit var warning.

It's a decent bit of analysis to see that the initialization will always
happen, and my compiler isn't doing so in at least one configuration.

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

4 years agofreedreno/ir3_cmdline: Fix an uninit var warning.
Eric Anholt [Thu, 9 Jul 2020 23:15:16 +0000 (16:15 -0700)]
freedreno/ir3_cmdline: Fix an uninit var warning.

You could only access entry through the initialized path, but we can clean
up the compiler warning by not keeping the other var.

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

4 years agoturnip: implement VK_EXT_private_data
Hyunjun Ko [Mon, 13 Jul 2020 03:12:56 +0000 (03:12 +0000)]
turnip: implement VK_EXT_private_data

Which is using base class's implementation.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5539>

4 years agoturnip: Use the common base object type and struct.
Hyunjun Ko [Mon, 13 Jul 2020 03:08:15 +0000 (03:08 +0000)]
turnip: Use the common base object type and struct.

v2. Define new helper function to avoid duplicated a pair of function calls.
v3. Move new helper functions to vk_object.h and call them.
v4. Merge 2 commits to use commomn base object type and struct into one.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5539>

4 years agotu: Fix wrong copies of sampler descriptor.
Hyunjun Ko [Tue, 14 Jul 2020 00:47:30 +0000 (00:47 +0000)]
tu: Fix wrong copies of sampler descriptor.

Found this with the following patch but it exists since adding ycbcr
sampler to the struct.

Fixes: d070a7ba0cfb11f1e01774b9dd3775ab7cd0c4ea
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5539>

4 years agovulkan: Adds helpers for vk_object (de)alloation and (de)initialization.
Hyunjun Ko [Wed, 1 Jul 2020 05:05:25 +0000 (05:05 +0000)]
vulkan: Adds helpers for vk_object (de)alloation and (de)initialization.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5539>

4 years agogitlab-ci: reduce a630 runner load
Rob Clark [Tue, 14 Jul 2020 02:00:57 +0000 (19:00 -0700)]
gitlab-ci: reduce a630 runner load

They seem to be sometimes taking a while to boot, which is triggering CI
timeouts.  (Possibly tftp server in bad shape?)  Cut out non-essential
a630 CI jobs, and reduce the gles3/gles31 jobs to compensate.

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

4 years agomeson/intel: add missing dep on git_sha1.h
Eric Engestrom [Mon, 13 Jul 2020 16:14:01 +0000 (18:14 +0200)]
meson/intel: add missing dep on git_sha1.h

Fixes: 805b32cab90547a576af ("intel: add identifier for debug purposes")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Dylan Baker <dylanx.c.baker@intel.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5882>

4 years agozink: use type of src[0] for ntv store and load ops
Mike Blumenkrantz [Wed, 17 Jun 2020 19:06:27 +0000 (15:06 -0400)]
zink: use type of src[0] for ntv store and load ops

in some cases (e.g., gl_ClipDistance) the nir_variable type doesn't match
the needed destination type, so we can simplify this code to just use
the destination type

fixes spec@glsl-1.10@execution@interpolation@interpolation-none-gl_backcolor-smooth-vertex

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

4 years agozink: add lengthy comment and remove assert from discard_if ntv pass
Mike Blumenkrantz [Sun, 14 Jun 2020 21:24:29 +0000 (17:24 -0400)]
zink: add lengthy comment and remove assert from discard_if ntv pass

as in the comment, while we may want to try verifying that discard will be
the last instruction in a block, it's a bit problematic given that other nir
passes we're doing may insert instructions after a discard as part of e.g.,
nir_opt_dead_cf in the process of removing another block

fixes shaders@glsl-fs-discard-04

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

4 years agozink: handle ntv case of nested loop instructions more permissively
Mike Blumenkrantz [Wed, 10 Jun 2020 15:09:47 +0000 (11:09 -0400)]
zink: handle ntv case of nested loop instructions more permissively

if the last instruction in a loop's body terminates a block, e.g., from
a nested loop with a jump as its final instruction, then no block will
have been started when returning to the original loop, and there's no need
to emit a branch

fixes shaders@glsl-vs-continue-in-switch-in-do-while

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

4 years agozink: use right vulkan type for GL_PRIMITIVES_GENERATED queries
Mike Blumenkrantz [Thu, 9 Jul 2020 19:59:29 +0000 (15:59 -0400)]
zink: use right vulkan type for GL_PRIMITIVES_GENERATED queries

VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT includes
primitives which won't get drawn due to e.g., not enough vertices emitted
by geometry shader

fixes spec@glsl-1.50@gs-emits-too-few-verts

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

4 years agozink: only reset query pool on query end if current batch isn't in renderpass
Mike Blumenkrantz [Mon, 8 Jun 2020 13:59:44 +0000 (09:59 -0400)]
zink: only reset query pool on query end if current batch isn't in renderpass

reset can't be performed during a renderpass, so we need to defer that until a
time when we're definitely not in a renderpass, such as when we're starting a
new query or resuming a query

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

4 years agozink: properly handle query pool overflows
Mike Blumenkrantz [Mon, 25 May 2020 14:59:57 +0000 (10:59 -0400)]
zink: properly handle query pool overflows

inline a query result value to each query object so we can stash the partial
result just before we do a pool reset, which will always happen during the
suspend/resume query mechanism that swaps active queries from a flushed batch
to the next batch

once (or if) the "real" call to fetch query results is called, we can dump the
inlined value into the fetch value and return the full results

fixes mesa/mesa#3000

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

4 years agozink: only stall during query destroy for xfb queries
Mike Blumenkrantz [Mon, 25 May 2020 14:55:17 +0000 (10:55 -0400)]
zink: only stall during query destroy for xfb queries

xfb queries allocate vk buffer objects in the underlying driver which
can be deallocated while an xfb query is in-flight if we attempt to
defer it due to the way that gl xfb is translated to vk, so we need to
continue forcing this behavior in that case

for other query types, we can safely defer here until the current batch has
finished rather than block

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

4 years agozink: use #define for number of queries per-pool
Mike Blumenkrantz [Mon, 25 May 2020 14:54:23 +0000 (10:54 -0400)]
zink: use #define for number of queries per-pool

just to ensure we're consistent internally

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

4 years agozink: rework query handling
Mike Blumenkrantz [Mon, 25 May 2020 14:38:40 +0000 (10:38 -0400)]
zink: rework query handling

this hooks up query objects to the batches that they're actively running on
(and the related fence) in order to manage the lifetimes of queries more
efficiently by calling vkCmdResetQueryPool only on init and when the query
pool has been completely used up. additionally, this resolves some vk spec
issues related to destroying pools with active queries

note that any time a query pool is completely used up, results are lost,
which is a very slight improvement on the previous abort() that was triggered
in that scenario

ref mesa/mesa#3000

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

4 years agopanfrost: Fix outmods on int to float conversions
Italo Nicola [Mon, 13 Jul 2020 16:19:08 +0000 (16:19 +0000)]
panfrost: Fix outmods on int to float conversions

No shader-db changes (Alyssa).

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

4 years agodocs/submittingpatches: add more than one `Cc: mesa-stable` example to the examples...
Eric Engestrom [Mon, 13 Jul 2020 13:05:41 +0000 (15:05 +0200)]
docs/submittingpatches: add more than one `Cc: mesa-stable` example to the examples list

Starting with that very example :)

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5880>

4 years agodocs/features: Update ASTC entries for Panfrost
Alyssa Rosenzweig [Fri, 10 Jul 2020 21:49:47 +0000 (17:49 -0400)]
docs/features: Update ASTC entries for Panfrost

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

4 years agopanfrost: Map PIPE_{DXT, RGTC, BPTC} to MALI_BCn
Alyssa Rosenzweig [Fri, 10 Jul 2020 21:30:14 +0000 (17:30 -0400)]
panfrost: Map PIPE_{DXT, RGTC, BPTC} to MALI_BCn

Mali (and Vulkan) uses D3D naming conventions for these formats where
Gallium/Mesa uses OpenGL names, but the formats are equivalent. sRGB is
communicated out-of-band on Mali; otherwise, it appears to be a 1:1
mapping.

On supported devices, this exposes GL_EXT_texture_compression_rgtc and
GL_ARB_texture_compression_bptc, so update features.txt

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

4 years agopanfrost: Filter compressed texture formats
Alyssa Rosenzweig [Fri, 10 Jul 2020 21:18:00 +0000 (17:18 -0400)]
panfrost: Filter compressed texture formats

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

4 years agopanfrost: Pipe in compressed texture feature mask
Alyssa Rosenzweig [Fri, 10 Jul 2020 14:42:24 +0000 (10:42 -0400)]
panfrost: Pipe in compressed texture feature mask

So we can query at run-time as part of Gallium's checks.

v2: More explicit naming.

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

4 years agopanfrost: Add format codes for new compressed textures
Alyssa Rosenzweig [Fri, 10 Jul 2020 14:17:44 +0000 (10:17 -0400)]
panfrost: Add format codes for new compressed textures

Compressed formats line up with CONFIG_TEX_COMPRESSED_FORMAT_ENABLE
documented on
https://releases.linaro.org/archive/14.07/android/images/armv8-android-juno-lsk/

None of the new formats have been seen in the wild.

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

4 years agopanfrost: Compact unused BO flag bits
Alyssa Rosenzweig [Mon, 13 Jul 2020 14:07:56 +0000 (10:07 -0400)]
panfrost: Compact unused BO flag bits

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

4 years agopanfrost: Remove panfrost_bo_access type
Alyssa Rosenzweig [Tue, 26 May 2020 18:47:21 +0000 (14:47 -0400)]
panfrost: Remove panfrost_bo_access type

It's just whether it writes or not, which is already implied by the
presence/absence of a writer. So no need to track explicitly.

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

4 years agopanfrost: Remove PAN_BO_DONT_REUSE
Alyssa Rosenzweig [Tue, 26 May 2020 17:10:41 +0000 (13:10 -0400)]
panfrost: Remove PAN_BO_DONT_REUSE

Equivalent to SHARED.

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

4 years agopanfrost: Remove PAN_BO_COHERENT_LOCAL
Alyssa Rosenzweig [Tue, 26 May 2020 17:08:40 +0000 (13:08 -0400)]
panfrost: Remove PAN_BO_COHERENT_LOCAL

Ancient relic from kbase. Panfrost kernel doesn't need this.

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

4 years agopanfrost: Merge PAN_BO_IMPORTED/PAN_BO_EXPORTED
Alyssa Rosenzweig [Tue, 26 May 2020 17:07:23 +0000 (13:07 -0400)]
panfrost: Merge PAN_BO_IMPORTED/PAN_BO_EXPORTED

Always checked together and really signal the same property from
different perspectives.

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

4 years agopanfrost: Index BOs from the BO map sparse array
Alyssa Rosenzweig [Tue, 26 May 2020 16:04:42 +0000 (12:04 -0400)]
panfrost: Index BOs from the BO map sparse array

Now we have a central store of them, so we may remove active_bo.

v2: Squash two patches together to prevent a race condition mid-series.

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

4 years agopanfrost: Add a sparse array to map GEM handles to BOs
Alyssa Rosenzweig [Mon, 25 May 2020 23:48:30 +0000 (19:48 -0400)]
panfrost: Add a sparse array to map GEM handles to BOs

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

4 years agopanfrost: Fix write to free'd memory
Alyssa Rosenzweig [Thu, 9 Jul 2020 23:13:59 +0000 (19:13 -0400)]
panfrost: Fix write to free'd memory

No clue how this worked before.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Fixes: 82f18b713ac ("panfrost: Keep track of active BOs")
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5859>

4 years agopanfrost: Fix fence leak
Alyssa Rosenzweig [Tue, 26 May 2020 20:57:44 +0000 (16:57 -0400)]
panfrost: Fix fence leak

When overwriting the writer, we need to release the old reference.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Fixes: 2dad9fde505 ("panfrost: Start tracking inter-batch dependencies")
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5859>

4 years agoaco: add 32-bit integer addition to can_swap_operands
Rhys Perry [Tue, 30 Jun 2020 15:16:18 +0000 (16:16 +0100)]
aco: add 32-bit integer addition to can_swap_operands

fossil-db (Navi):
Totals from 167 (0.12% of 135946) affected shaders:
CodeSize: 484892 -> 482628 (-0.47%)

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

4 years agoradv: use lower_shuffle_to_swizzle_amd
Rhys Perry [Tue, 23 Jun 2020 16:38:37 +0000 (17:38 +0100)]
radv: use lower_shuffle_to_swizzle_amd

Affects a few shaders in Detroit: Become Human and Doom Eternal.

fossil-db (Navi):
Totals from 9 (0.01% of 135946) affected shaders:
CodeSize: 31188 -> 25096 (-19.53%)
Instrs: 6136 -> 4999 (-18.53%)

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

4 years agonir/lower_subgroups: add lower_shuffle_to_swizzle_amd
Rhys Perry [Tue, 23 Jun 2020 16:37:37 +0000 (17:37 +0100)]
nir/lower_subgroups: add lower_shuffle_to_swizzle_amd

masked_swizzle_amd can be much faster than shuffle.

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

4 years agonir/lower_subgroups: pass options struct to lower_shuffle
Rhys Perry [Mon, 6 Jul 2020 16:59:08 +0000 (17:59 +0100)]
nir/lower_subgroups: pass options struct to lower_shuffle

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

4 years agoaco: implement <32-bit masked_swizzle_amd
Rhys Perry [Thu, 2 Jul 2020 11:15:28 +0000 (12:15 +0100)]
aco: implement <32-bit masked_swizzle_amd

This is needed since we will be lowering some 8/16-bit shuffles to
masked_swizzle_amd.

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

4 years agoaco: optimize some masked swizzles to DPP
Rhys Perry [Thu, 2 Jul 2020 11:12:12 +0000 (12:12 +0100)]
aco: optimize some masked swizzles to DPP

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

4 years agoaco: read 0 from inactive lanes when using dpp
Rhys Perry [Mon, 29 Jun 2020 18:48:54 +0000 (19:48 +0100)]
aco: read 0 from inactive lanes when using dpp

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

4 years agopanfrost: Enable framebuffer fetch
Icecream95 [Mon, 6 Jul 2020 00:03:46 +0000 (12:03 +1200)]
panfrost: Enable framebuffer fetch

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopanfrost: Extend fetched framebuffer results
Alyssa Rosenzweig [Fri, 10 Jul 2020 17:54:06 +0000 (13:54 -0400)]
panfrost: Extend fetched framebuffer results

So NIR doesn't complain about invalid swizzles when reading a format
with less than 4 channels.

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

4 years agopanfrost: Always use SOFTWARE for pure formats
Alyssa Rosenzweig [Fri, 10 Jul 2020 16:12:36 +0000 (12:12 -0400)]
panfrost: Always use SOFTWARE for pure formats

Otherwise we end up implicitly converting ints to floating point.
Likewise for floats which again have strange interactions.

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

4 years agopanfrost: Generate shader variants on framebuffer bind
Alyssa Rosenzweig [Fri, 10 Jul 2020 16:12:14 +0000 (12:12 -0400)]
panfrost: Generate shader variants on framebuffer bind

If we keyed the shader for the framebuffer.

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

4 years agopanfrost: Use f2fmp for framebuffer lowering conversions
Icecream95 [Thu, 9 Jul 2020 01:26:26 +0000 (13:26 +1200)]
panfrost: Use f2fmp for framebuffer lowering conversions

This allows the conversion to be removed when the output is needed as
f32 anyway, for example for highp framebuffer fetch.

v2: Also change operations such as i2i16 to i2imp (Alyssa).

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopanfrost: Stop keying on rt format when using native loads
Icecream95 [Tue, 7 Jul 2020 03:06:08 +0000 (15:06 +1200)]
panfrost: Stop keying on rt format when using native loads

Native loads are the same for any format, so we can use the same
shader variant for all framebuffer formats with a native load.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopanfrost: Implement texture_barrier
Icecream95 [Thu, 9 Jul 2020 23:19:07 +0000 (11:19 +1200)]
panfrost: Implement texture_barrier

This is needed for KHR_blend_equation_advanced with a blend
barrier.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopan/mdg: Use a 32-bit ld_color_buffer op when needed
Icecream95 [Thu, 9 Jul 2020 11:44:41 +0000 (23:44 +1200)]
pan/mdg: Use a 32-bit ld_color_buffer op when needed

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopan/mdg: Set the z/s store intrinsic base correctly
Icecream95 [Wed, 8 Jul 2020 04:00:51 +0000 (16:00 +1200)]
pan/mdg: Set the z/s store intrinsic base correctly

When EXT_shader_framebuffer_fetch is used and only depth and/or
stencil are written, we can't rely on the first output being to
depth/stencil.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopan/mdg: Support MRT in output load lowering
Icecream95 [Mon, 6 Jul 2020 07:54:56 +0000 (19:54 +1200)]
pan/mdg: Support MRT in output load lowering

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopan/mdg: Handle non-blend framebuffer lowering
Icecream95 [Mon, 6 Jul 2020 07:34:49 +0000 (19:34 +1200)]
pan/mdg: Handle non-blend framebuffer lowering

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopan/mdg: Emit a tilebuffer wait loop when needed
Icecream95 [Wed, 8 Jul 2020 01:15:09 +0000 (13:15 +1200)]
pan/mdg: Emit a tilebuffer wait loop when needed

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopan/mdg: Do the pan_lower_framebuffer pass later
Icecream95 [Mon, 6 Jul 2020 07:30:37 +0000 (19:30 +1200)]
pan/mdg: Do the pan_lower_framebuffer pass later

The pass is useful for EXT_shader_framebuffer_fetch, not just blend
shaders, so we should do it with the other lowering passes in
midgard_compile_shader_nir.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopanfrost: Add a bitset of render targets read by shaders
Icecream95 [Mon, 6 Jul 2020 07:41:28 +0000 (19:41 +1200)]
panfrost: Add a bitset of render targets read by shaders

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopanfrost: Add rt formats to shader state
Icecream95 [Mon, 6 Jul 2020 07:40:05 +0000 (19:40 +1200)]
panfrost: Add rt formats to shader state

load_output lowering will depend on the framebuffer formats.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopan/mdg: Use the writeout tag for tilebuffer wait loops
Icecream95 [Mon, 6 Jul 2020 22:11:53 +0000 (10:11 +1200)]
pan/mdg: Use the writeout tag for tilebuffer wait loops

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopan/mdg: Handle tilebuffer wait loops
Icecream95 [Sun, 5 Jul 2020 12:22:22 +0000 (00:22 +1200)]
pan/mdg: Handle tilebuffer wait loops

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agopanfrost: Clamp pure int pixels
Alyssa Rosenzweig [Fri, 10 Jul 2020 17:57:58 +0000 (13:57 -0400)]
panfrost: Clamp pure int pixels

We need saturate, not wrap semantic. Could optimize to a .isat/.usat
modifier but that's for future.

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

4 years agopanfrost: Fix MALI_READS_TILEBUFFER
Icecream95 [Sun, 5 Jul 2020 12:19:55 +0000 (00:19 +1200)]
panfrost: Fix MALI_READS_TILEBUFFER

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agonir: Add a base value to load_raw_output_pan
Icecream95 [Mon, 6 Jul 2020 07:49:11 +0000 (19:49 +1200)]
nir: Add a base value to load_raw_output_pan

This is the render target the read instruction uses.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

4 years agoglx: drop always-true #ifdef
Eric Engestrom [Sat, 23 May 2020 00:21:29 +0000 (02:21 +0200)]
glx: drop always-true #ifdef

Meson already guarantees we have at least xdamage >= 1.1

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5862>

4 years agoegl/wayland: add missing newline between functions
Eric Engestrom [Fri, 22 May 2020 23:44:52 +0000 (01:44 +0200)]
egl/wayland: add missing newline between functions

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5862>

4 years agoegl: Build surfaceless platform on Android
Roman Stratiienko [Sat, 11 Jul 2020 21:10:19 +0000 (00:10 +0300)]
egl: Build surfaceless platform on Android

Fixes: a38e21d6683a ("egl: always compile surfaceless")
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5866>

4 years agoradv: advertise VK_EXT_extended_dynamic_state
Samuel Pitoiset [Mon, 13 Apr 2020 09:00:02 +0000 (11:00 +0200)]
radv: advertise VK_EXT_extended_dynamic_state

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

4 years agoradv: add support for dynamic vertex input binding stride
Samuel Pitoiset [Mon, 13 Apr 2020 12:35:44 +0000 (14:35 +0200)]
radv: add support for dynamic vertex input binding stride

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

4 years agoradv: add support for dynamic depth/stencil states
Samuel Pitoiset [Mon, 13 Apr 2020 12:47:08 +0000 (14:47 +0200)]
radv: add support for dynamic depth/stencil states

Out-of-order rasterization is disabled if a pipeline uses an
extended dynamic depth/stencil state because the driver doesn't
support enabling/disabling out-of-order dynamically.

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

4 years agoradv: add support for dynamic and scissor count
Samuel Pitoiset [Mon, 13 Apr 2020 11:35:33 +0000 (13:35 +0200)]
radv: add support for dynamic and scissor count

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

4 years agoradv: add support for dynamic primitive topology
Samuel Pitoiset [Mon, 13 Apr 2020 11:14:59 +0000 (13:14 +0200)]
radv: add support for dynamic primitive topology

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

4 years agoradv: add support for dynamic cull mode and front face
Samuel Pitoiset [Mon, 13 Apr 2020 09:33:44 +0000 (11:33 +0200)]
radv: add support for dynamic cull mode and front face

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

4 years agoradv: declare new extended dynamic states
Samuel Pitoiset [Mon, 13 Apr 2020 09:29:28 +0000 (11:29 +0200)]
radv: declare new extended dynamic states

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

4 years agoradv: add VK_EXT_extended_dynamic_state but leave it disabled
Samuel Pitoiset [Tue, 30 Jun 2020 08:56:53 +0000 (10:56 +0200)]
radv: add VK_EXT_extended_dynamic_state but leave it disabled

To make sure the new prototypes are declared.

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

4 years agoradv: rework dynamic viewports/scissors support
Samuel Pitoiset [Tue, 30 Jun 2020 08:38:11 +0000 (10:38 +0200)]
radv: rework dynamic viewports/scissors support

The number of viewports/scissors is currently static because it can
only be specified at pipeline creation, but it doesn't hurt to
assume it's dynamic. Will help for supporting setting the number
of viewports/scissors dynamically.

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

4 years agoradv: remove the secure compile support feature
Samuel Pitoiset [Sun, 12 Jul 2020 11:59:14 +0000 (13:59 +0200)]
radv: remove the secure compile support feature

Steam was the only client of this feature and it seems no longer used.

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

4 years agonouveau: avoid LTO ODR warning (v2)
Dave Airlie [Mon, 13 Jul 2020 00:53:19 +0000 (10:53 +1000)]
nouveau: avoid LTO ODR warning (v2)

../src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp:69:8: warning: type ‘struct opProperties’ violates the C++ One Definition Rule [-Wodr]
   69 | struct opProperties
      |        ^
../src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp:88:8: note: a different type is defined in another translation unit
   88 | struct opProperties
      |        ^
../src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp:77:17: note: the first difference of corresponding definitions is field ‘fShared’
   77 |    unsigned int fShared : 3;
      |                 ^
../src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp:96:17: note: a field with different name is defined in another translation unit
   96 |    unsigned int fImmd  : 4; // last bit indicates if full immediate is suppoted

nvc0 code also has the same thing.

v2: rename both paths (Karol)

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5873>

4 years agonvc0: set sampler index mode to independently on gv100 compute
Karol Herbst [Sun, 12 Jul 2020 22:13:54 +0000 (00:13 +0200)]
nvc0: set sampler index mode to independently on gv100 compute

We don't use linked texture/samplers. Fixes a bunch of CTS issues which
also seem to fail a bit randomly depending on what tests ran before and
such, so the list is incomplete.

Fixes:
KHR-GL46.texture_gather.*
KHR-GL46.compute_shader.resource-texture
KHR-GL46.multi_bind.dispatch_bind_samplers
KHR-GL46.multi_bind.dispatch_bind_textures
KHR-GL46.shading_language_420pack.binding_sampler_array
KHR-GL46.shading_language_420pack.binding_sampler_single
KHR-GL46.shading_language_420pack.binding_samplers
KHR-GL46.stencil_texturing.functional
KHR-GL46.texture_gather.incomplete-texture-last-comp

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5874>

4 years agoradv: return VK_ERROR_DEVICE_LOST if wait-for-idle failed or expired
Samuel Pitoiset [Fri, 10 Jul 2020 12:45:19 +0000 (14:45 +0200)]
radv: return VK_ERROR_DEVICE_LOST if wait-for-idle failed or expired

When ctx_wait_idle failed, something really bad happened likely
a GPU hang. Make sure to return the appropriate Vulkan error code
in this case.

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

4 years agospirv: Allow block-decorated struct types for constants
Jason Ekstrand [Fri, 10 Jul 2020 20:58:39 +0000 (15:58 -0500)]
spirv: Allow block-decorated struct types for constants

Whenever a struct type is decorated Block or BufferBlock we turn that
into a GLSL_TYPE_INTERFACE.  Since these decorations can end up random
places, we should allow them for constants.

Closes: #3252
Fixes: 9d0ae777dd6 "spirv: Use interface type for block and buffer..."
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5855>

4 years agospirv: Skip phis in unreachable blocks in the second phi pass
Jason Ekstrand [Fri, 10 Jul 2020 21:09:27 +0000 (16:09 -0500)]
spirv: Skip phis in unreachable blocks in the second phi pass

Closes: #3253
Fixes: 22fdb2f8551 "nir/spirv: Update to the latest revision"
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5855>

4 years agonvc0: set local mem size for compute on gv100
Karol Herbst [Thu, 9 Jul 2020 21:52:56 +0000 (23:52 +0200)]
nvc0: set local mem size for compute on gv100

This is required when the shader uses local memory for arrays or spills.
I really dislike how it's done right now, but oh well, it's the same for
other gens.

Fixes CTS tests:
KHR-GL46.shading_language_420pack.binding_image_array
KHR-GL46.shading_language_420pack.length_of_compute_result

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5840>

4 years agofreedreno: fix layout pitchalign field not being set for imported buffers
Jonathan Marek [Sat, 11 Jul 2020 17:49:51 +0000 (13:49 -0400)]
freedreno: fix layout pitchalign field not being set for imported buffers

The pitchalign value was being left to 0 and then wrapping around when
the base offset was subtracted in texture state.

Fixes: 979e7e3680792 ("freedreno/layout: layout simplifications and pitch from level 0 pitch")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5864>

4 years agonir: allow nir_lower_clip_halfz to run in geometry shaders
Mike Blumenkrantz [Wed, 8 Jul 2020 16:43:23 +0000 (12:43 -0400)]
nir: allow nir_lower_clip_halfz to run in geometry shaders

the final output of gl_Position needs this transform, and geometry shaders
must write this value for stream 0 if rasterization is enabled

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5851>

4 years agonir: allow nir_lower_point_size_mov to run in geometry shader
Mike Blumenkrantz [Wed, 8 Jul 2020 15:59:16 +0000 (11:59 -0400)]
nir: allow nir_lower_point_size_mov to run in geometry shader

geometry shaders may need to emit PSIZ as well

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5851>

4 years agointel/compiler: don't propagate cmp to add if add is saturated
Yevhenii Kolesnikov [Thu, 12 Mar 2020 17:42:37 +0000 (19:42 +0200)]
intel/compiler: don't propagate cmp to add if add is saturated

From the Kaby Lake PRM Vol. 7 "Assigning Conditional Flags":

   * Note that the [post condition signal] bits generated at
     the output of a compute are before the .sat.

Paragraph about post_zero does not mention saturation, but
testing it on actual GPUs shows that conditional modifiers
are applied after saturation.

   * post_zero bit: This bit reflects whether the final
     result is zero after all the clamping, normalizing,
     or format conversion logic.

For signed types we don't care about saturation: it won't
change the result of conditional modifier.

For floating and unsigned types there two special cases,
when we can remove inst even if scan_inst is saturated: G
and LE. Since conditional modifiers are just comparations
against zero, saturating positive values to the upper
limit never changes the result of comparation.

For negative values:
(sat(x) >  0) == (x >  0) --- false
(sat(x) <= 0) == (x <= 0) --- true

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2610
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4167>

4 years agoaco: don't create phis with undef operands in the boolean phi pass
Rhys Perry [Fri, 10 Jul 2020 15:31:31 +0000 (16:31 +0100)]
aco: don't create phis with undef operands in the boolean phi pass

We can create better merge code is we pass on undef.

fossil-db (Navi):
Totals from 1208 (0.89% of 135946) affected shaders:
SGPRs: 66864 -> 66200 (-0.99%); split: -1.04%, +0.05%
SpillSGPRs: 1179 -> 1156 (-1.95%)
CodeSize: 6516672 -> 6469564 (-0.72%); split: -0.76%, +0.04%
Instrs: 1232680 -> 1220859 (-0.96%); split: -0.97%, +0.01%

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

4 years agoaco: optimize boolean phis with uniform selections
Rhys Perry [Thu, 9 Jan 2020 16:51:34 +0000 (16:51 +0000)]
aco: optimize boolean phis with uniform selections

Even though the boolean can be divergent, the control flow can be (at
least partially) uniform. For example, we don't have to create any
s_andn2_b64/s_and_b64/s_or_b64 instructions with this code:
a = ...
loop {
    b = bool_phi a, c
    if (uniform)
        break
    c = ...
}
d = phi c

fossil-db (Navi):
Totals from 5506 (4.05% of 135946) affected shaders:
SGPRs: 605720 -> 604024 (-0.28%)
SpillSGPRs: 52025 -> 51733 (-0.56%)
CodeSize: 65221188 -> 64957808 (-0.40%); split: -0.41%, +0.00%
Instrs: 12637881 -> 12584610 (-0.42%); split: -0.42%, +0.00%

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

4 years agoaco: create better code for boolean phis with constant operands
Rhys Perry [Mon, 6 Jan 2020 16:50:41 +0000 (16:50 +0000)]
aco: create better code for boolean phis with constant operands

fossil-db (Navi):
Totals from 6394 (4.70% of 135946) affected shaders:
SGPRs: 651408 -> 651344 (-0.01%)
SpillSGPRs: 52102 -> 52019 (-0.16%)
CodeSize: 68369664 -> 68229180 (-0.21%); split: -0.21%, +0.00%
Instrs: 13236611 -> 13202126 (-0.26%); split: -0.26%, +0.00%

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

4 years agoaco: rework boolean phi pass
Rhys Perry [Mon, 6 Jan 2020 15:46:28 +0000 (15:46 +0000)]
aco: rework boolean phi pass

The pass should now create much less linear phis.

Removes piles of phis and lots of sgpr spilling from Detroit: Become
Human and parallel-rdp.

fossil-db (Navi):
Totals from 7654 (5.63% of 135946) affected shaders:
SGPRs: 796224 -> 787616 (-1.08%); split: -1.08%, +0.00%
VGPRs: 576164 -> 572116 (-0.70%); split: -0.70%, +0.00%
SpillSGPRs: 147695 -> 52258 (-64.62%)
SpillVGPRs: 2167 -> 2102 (-3.00%)
CodeSize: 80671680 -> 76240420 (-5.49%); split: -5.50%, +0.01%
Scratch: 137216 -> 135168 (-1.49%)
MaxWaves: 54235 -> 54707 (+0.87%)
Instrs: 15569429 -> 14820569 (-4.81%); split: -4.82%, +0.01%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Co-authored-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3388>

4 years agollvmpipe/cs: fix image/sampler binding for compute
Dave Airlie [Fri, 10 Jul 2020 05:46:54 +0000 (15:46 +1000)]
llvmpipe/cs: fix image/sampler binding for compute

The compute shader dirtying is a bit wrong here, since we don't
have a second stage like for fragment shaders, so dirty the compute
shader whenever a sampler or image changes, (ssbo/contexts don't
needs this).

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

4 years agollvmpipe: flush resources on sampler view binding
Dave Airlie [Thu, 23 Apr 2020 02:32:53 +0000 (12:32 +1000)]
llvmpipe: flush resources on sampler view binding

The resource may have been written to as images previously.

KHR-GL45.shader_image_load_store.advanced-sync-imageAccess2

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

4 years agollvmpipe: denote NEW fs when images change.
Dave Airlie [Thu, 9 Apr 2020 03:27:09 +0000 (13:27 +1000)]
llvmpipe: denote NEW fs when images change.

The fragment shader needs to be regenerated here,
so flag the same as for sampler views.

This causes correct flushing:
KHR-GL46.shader_image_load_store.non-layered_binding

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

4 years agonv50/ir/tgsi: move call to tgsi_scan_shader inside Source constructor
Karol Herbst [Fri, 10 Jul 2020 18:23:42 +0000 (20:23 +0200)]
nv50/ir/tgsi: move call to tgsi_scan_shader inside Source constructor

We actually need it there already, we just missed to move it.

Fixes: 66ed9792edb702 ("nv50: Clear nv50_ir_prog_info of dead and codegen specific variables")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5849>