platform/upstream/mesa.git
3 years agoradeonsi: store si_context::xxx_shader members in union
Pierre-Eric Pelloux-Prayer [Fri, 12 Feb 2021 13:42:10 +0000 (14:42 +0100)]
radeonsi: store si_context::xxx_shader members in union

This allows to access them individually (sctx->shader.ps) or
using array indexing (sctx->shaders[PIPE_SHADER_FRAGMENT]).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8869>

3 years agoradeonsi: fix indentation issue in si_texture.c
Pierre-Eric Pelloux-Prayer [Thu, 21 Jan 2021 13:23:12 +0000 (14:23 +0100)]
radeonsi: fix indentation issue in si_texture.c

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8869>

3 years agobroadcom/compiler: don't dump shader-db stats for failed shaders
Iago Toral Quiroga [Mon, 15 Feb 2021 10:56:13 +0000 (11:56 +0100)]
broadcom/compiler: don't dump shader-db stats for failed shaders

Shaders that fail register allocation were dumped with an instruction
count of 0, so getting them to compile would show up as an instruction
count regression. Also, the LOST/GAINED stats depend on us not dumping
data for failed shaders, which is why we were always seeing 0/0 there.

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

3 years agobroadcom/compiler: use a helper function to decide on TMU spilling
Iago Toral Quiroga [Tue, 16 Feb 2021 09:05:14 +0000 (10:05 +0100)]
broadcom/compiler: use a helper function to decide on TMU spilling

As we add more compiler optimizations that can increase register pressure
we may decide to disallow TMU spilling in more cases so it is probably
better to move this to its own helper function.

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

3 years agobroadcom/compiler: don't emit redundant ldunif
Iago Toral Quiroga [Tue, 16 Feb 2021 08:07:04 +0000 (09:07 +0100)]
broadcom/compiler: don't emit redundant ldunif

If we emit a new uniform and that uniform has already been emitted
in the same block we can just reuse that.

There is a balancing game here between reducing ldunif instructions
and not increasing register pressure too much though, so we put
a limit to how far back we are willing to look for a previous
definition of the uniform. Based on shader-db results, 20 instructions
produces best results.

total instructions in shared programs: 14928266 -> 14907432 (-0.14%)
instructions in affected programs: 6431841 -> 6411007 (-0.32%)
helped: 15270
HURT: 10772
Instructions are helped.

total uniforms in shared programs: 3944672 -> 3840276 (-2.65%)
uniforms in affected programs: 1827184 -> 1722788 (-5.71%)
helped: 30423
HURT: 845
Uniforms are helped.

total inst-and-stalls in shared programs: 14957813 -> 14936873 (-0.14%)
inst-and-stalls in affected programs: 6475349 -> 6454409 (-0.32%)
helped: 15287
HURT: 10852
Inst-and-stalls are helped.

v2 (Eric):
 - consider ldunifrf too
 - check that no other instruction writes to the register

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

3 years agoturnip: VK_EXT_memory_budget implementation
Samuel Iglesias Gonsálvez [Wed, 13 Jan 2021 10:17:54 +0000 (11:17 +0100)]
turnip: VK_EXT_memory_budget implementation

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8524>

3 years agoturnip: keep track of memory heap usage, size and flags
Samuel Iglesias Gonsálvez [Wed, 13 Jan 2021 15:46:52 +0000 (16:46 +0100)]
turnip: keep track of memory heap usage, size and flags

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8524>

3 years agoutil: fix parsing of /proc/meminfo MemAvailable value
Samuel Iglesias Gonsálvez [Mon, 8 Feb 2021 11:29:42 +0000 (12:29 +0100)]
util: fix parsing of /proc/meminfo MemAvailable value

It was interpreting the value as hexadecimal when it is unsigned.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8524>

3 years agoetnaviv: Fix memory leak in etna_vertex_elements_state_create.
Vinson Lee [Sun, 14 Feb 2021 04:34:39 +0000 (20:34 -0800)]
etnaviv: Fix memory leak in etna_vertex_elements_state_create.

Fix defect reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_storage: Variable cs going out of scope leaks the storage it points to.

Fixes: c9e8b49b885 ("etnaviv: gallium driver for Vivante GPUs")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9034>

3 years agointel/fs: Shuffle can't handle source modifiers
Jason Ekstrand [Wed, 28 Oct 2020 21:28:46 +0000 (16:28 -0500)]
intel/fs: Shuffle can't handle source modifiers

On Gen7, we have to split shuffles into two MOVs for 64-bit types so we
can't handle source modifiers.  On Gen12.5, we have to use integer types
all the time so we can't use them there either.  Fixing that will be a
different commit but it interacts with this one.

Fixes: 90c9f29518d "i965/fs: Add support for nir_intrinsic_shuffle"
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9068>

3 years agonir/opt_large_constants: Handle generic pointers
Jason Ekstrand [Mon, 15 Feb 2021 06:23:40 +0000 (00:23 -0600)]
nir/opt_large_constants: Handle generic pointers

We already throw out any variables which may have a complex use so we
just need to make sure that our mode checks don't assert if we have a
deref which may_be but not must_be nir_var_function_temp.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9068>

3 years agonir: Fix parameter order in the bcsel-of-shuffle optimization
Jason Ekstrand [Mon, 15 Feb 2021 21:48:55 +0000 (15:48 -0600)]
nir: Fix parameter order in the bcsel-of-shuffle optimization

Fixes: 4ff4d4e56966a40 "nir/opt_intrinsic: Optimize bcsel(b, shuffle..."
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9068>

3 years agonir: Don't optimize bcsel-of-shuffle across blocks
Jason Ekstrand [Thu, 4 Feb 2021 21:45:11 +0000 (15:45 -0600)]
nir: Don't optimize bcsel-of-shuffle across blocks

We can't move the shuffle to a new block so this only works if the
shuffle and the bcsel are in the same block.  Fortunately, in the
motivating case, this is true.

Also, we have to be careful around discard.  We could try really hard to
just avoid moving them past discard but we choose to simply bail if we
see a discard instead.

Fixes: 4ff4d4e56966a40 "nir/opt_intrinsic: Optimize bcsel(b, shuffle..."
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9068>

3 years agonouveau: Use format modifiers in buffer allocation
James Jones [Fri, 31 Jan 2020 23:30:28 +0000 (15:30 -0800)]
nouveau: Use format modifiers in buffer allocation

The nvc0 nouveau backend already claimed to support format modifiers, but
in practice it ignored them when allocating buffers outside of a
perfunctory check for the linear modifier in the first element of the
format modifier list.

This change deduces the supported modifiers, if any, for a given miptree
creation request, prioritizes them based on performance and memory waste
properties, compares the requested modifiers against the prioritized list
of supported modifiers, and overrides the internal layout calculations
based on the layout defined by the resulting modifier.

Additionally, if modifiers are provided and none are compatible with the
miptree creation request, the function now fails.  This brings the nouveau
behavior in line with other drivers such as i965 and etnaviv.

Signed-off-by: James Jones <jajones@nvidia.com>
Tested-by: Karol Herbst <kherbst@redhat.com>
Tested-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3724>

3 years agonouveau: no modifier != the invalid modifier
James Jones [Fri, 31 Jan 2020 05:18:41 +0000 (21:18 -0800)]
nouveau: no modifier != the invalid modifier

Other drivers fail resource allocation when a list of modifiers for the
resource is provided but none are supported. This includes cases when the
never-supported DRM_FORMAT_MOD_INVALID modifier is explicitly passed.  To
enable matching that functionality in nouveau, use an empty modifier list
rather than creating a one-entry list containing only
DRM_FORMAT_MOD_INVALID when the non-modifier resource creation function is
used.

This change stops short of failing allocations when no modifier is
specified, because the current code ignores all modifiers except the linear
modifier when creating resources, so there is not yet a framework in place
to determine which modifiers are valid for a given resource creation
request, and hence no way to reject only those which are invalid.

Signed-off-by: James Jones <jajones@nvidia.com>
Tested-by: Karol Herbst <kherbst@redhat.com>
Tested-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3724>

3 years agonouveau: Use DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D
James Jones [Fri, 31 Jan 2020 07:21:12 +0000 (23:21 -0800)]
nouveau: Use DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D

Replace existing usage of the NVIDIA_16BX2_BLOCK format modifiers with
parameterized use of the more general macro.  Nouveau will now report
support for slightly different modifiers depending on whether the
underlying chip is a tegra GPU or not, and will potentially report valid
format modifiers for more resource types, but overall this should be a
functional no-op for existing applications.

Signed-off-by: James Jones <jajones@nvidia.com>
Tested-by: Karol Herbst <kherbst@redhat.com>
Tested-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3724>

3 years agonouveau: Stash supported sector layout in screen
James Jones [Fri, 13 Sep 2019 21:08:27 +0000 (14:08 -0700)]
nouveau: Stash supported sector layout in screen

Older Tegra GPUs use a different sector bit swizzling layout than desktop
and Xavier GPUs. Hence their format modifiers must be differentiated from
those of other GPUs.  As a precursor to supporting more expressive block
linear format modifiers, deduce the sector layout used for a given GPU from
its chipset and stash the layout in the nouveau screen structure.

Signed-off-by: James Jones <jajones@nvidia.com>
Tested-by: Karol Herbst <kherbst@redhat.com>
Tested-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3724>

3 years agozink: add a disk cache for pipeline objects
Mike Blumenkrantz [Tue, 6 Oct 2020 15:42:27 +0000 (11:42 -0400)]
zink: add a disk cache for pipeline objects

this writes the pipeline cache to disk on shutdown

ideally we'd rather write this incrementally any time we make a new pipeline,
but that ends up breaking the disk cache infrastructure since we're always writing
to the same file, so this is the best we can do for now

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9094>

3 years agozink: create a VkPipelineCache object on the screen and use it
Mike Blumenkrantz [Tue, 6 Oct 2020 14:13:58 +0000 (10:13 -0400)]
zink: create a VkPipelineCache object on the screen and use it

this enables reuse of shaders across pipelines

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9094>

3 years agozink: hook up valid_buffer_range for buffer resources using util_range
Mike Blumenkrantz [Thu, 3 Sep 2020 14:44:11 +0000 (10:44 -0400)]
zink: hook up valid_buffer_range for buffer resources using util_range

this lets us avoid stalling during transfer map in some cases

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9062>

3 years agozink: add flag for no-oping fence finish
Mike Blumenkrantz [Tue, 29 Sep 2020 19:06:07 +0000 (15:06 -0400)]
zink: add flag for no-oping fence finish

if a fence hasn't been activated then we don't need to wait on it

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9067>

3 years agofreedreno/ir3: Add missing shader prog cache invalidation
Rob Clark [Thu, 11 Feb 2021 22:37:00 +0000 (14:37 -0800)]
freedreno/ir3: Add missing shader prog cache invalidation

I'm not aware of actually hitting this case, but we need to consider
more than just vs/fs when shader state is deleted.

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

3 years agofreedreno/ir3: Async shader compile
Rob Clark [Sat, 30 Jan 2021 20:36:55 +0000 (12:36 -0800)]
freedreno/ir3: Async shader compile

Draw-time variants are still synchronous, but I'm not sure there is much
(easy) benefit from generating them asynchronously.  Without patching
the cmdstream later before batch submit, we'd end up waiting for them
immediately.  But we should mostly only hit draw-time variants for
desktop GL (and mostly legacy features).

Note: new xfb xfail on a5xx, but most of the xfb tests are already xfail
so I think we just managed to change the timing a bit, rather than this
being related to async compile.

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

3 years agofreedreno/ir3: Reshuffle compute state creation
Rob Clark [Sat, 6 Feb 2021 19:30:00 +0000 (11:30 -0800)]
freedreno/ir3: Reshuffle compute state creation

There was just a single remaining caller of ir3_shader_create_compute(),
so fold that into ir3_shader_compute_state_create().

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

3 years agofreedreno/ir3: Reshuffle ir3_shader_create()
Rob Clark [Sat, 30 Jan 2021 20:20:23 +0000 (12:20 -0800)]
freedreno/ir3: Reshuffle ir3_shader_create()

This had only a single caller, so no need to be exported.  With
that done, fold the ir3_shader creation (ie. the cheap part) into
ir3_shader_state_create(), and rename what is left.

This is prep to moving initial variant creation to a work queue.

It does slightly change the error handling, in that we don't
cleanup the shader hwcso.  We wouldn't be able to do this anyways
with async compile.  But it ends up using the same error handling
paths that we'd hit if we got a compile failure for a draw-time
variant.

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

3 years agofreedreno/ir3: Add ir3_screen_fini()
Rob Clark [Sat, 30 Jan 2021 19:12:36 +0000 (11:12 -0800)]
freedreno/ir3: Add ir3_screen_fini()

Move ir3_compiler_destroy() into ir3_screen_fini().  This gives us a
good place to cleanup an sync compile queue.

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

3 years agofreedreno/ir3: Move ir3_compiler_create()
Rob Clark [Sat, 30 Jan 2021 19:07:42 +0000 (11:07 -0800)]
freedreno/ir3: Move ir3_compiler_create()

All the ir3 using backends already call ir3_screen_init(), so lets just
move compiler creation there.

In a subsequent patch, we'll add initialization of the queue for async
compile.

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

3 years agofreedreno/ir3: Add ir3_shader_state
Rob Clark [Sat, 30 Jan 2021 18:55:41 +0000 (10:55 -0800)]
freedreno/ir3: Add ir3_shader_state

Initially just a wrapper for ir3_shader, but this is where we'll hook in
the bookkeeping for async compile.

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

3 years agofreedreno/ir3+a5xx+a6xx: De-duplicate create_compute_state()
Rob Clark [Sat, 6 Feb 2021 19:20:27 +0000 (11:20 -0800)]
freedreno/ir3+a5xx+a6xx: De-duplicate create_compute_state()

These were identical between a5xx and a6xx, so move into shared helper
that can be directly plugged into pctx, similar to the various 3d shader
state creation.

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

3 years agofreedreno/a6xx: Drop fd6_compute_stateobj
Rob Clark [Mon, 1 Feb 2021 19:16:17 +0000 (11:16 -0800)]
freedreno/a6xx: Drop fd6_compute_stateobj

It wasn't really doing anything useful.

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

3 years agofreedreno/a5xx: Drop fd5_compute_stateobj
Rob Clark [Mon, 1 Feb 2021 19:14:47 +0000 (11:14 -0800)]
freedreno/a5xx: Drop fd5_compute_stateobj

It wasn't really doing anything useful.

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

3 years agofreedreno: Misc cleanup
Rob Clark [Sat, 30 Jan 2021 17:55:37 +0000 (09:55 -0800)]
freedreno: Misc cleanup

Some whitespace cleanup + comment addition.

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

3 years agozink: use nir_shader_instructions_pass for draw params pass
Mike Blumenkrantz [Mon, 14 Sep 2020 18:45:06 +0000 (14:45 -0400)]
zink: use nir_shader_instructions_pass for draw params pass

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9090>

3 years agoclover: Add -fgnu89-inline to Clang command line
Jesse Natalie [Tue, 16 Feb 2021 18:42:13 +0000 (10:42 -0800)]
clover: Add -fgnu89-inline to Clang command line

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

3 years agomicrosoft/clc: Add test with inline function
Jesse Natalie [Tue, 16 Feb 2021 18:14:37 +0000 (10:14 -0800)]
microsoft/clc: Add test with inline function

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

3 years agomicrosoft/clc: Add -fgnu89-inline to clang args
Jesse Natalie [Tue, 16 Feb 2021 18:13:51 +0000 (10:13 -0800)]
microsoft/clc: Add -fgnu89-inline to clang args

Without this, inline functions don't have their body emitted in the
resulting LLVM IR, meaning the kernel will fail to link.

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

3 years agospirv: Delete the impl for prototype-only functions
Jason Ekstrand [Fri, 23 Oct 2020 17:26:03 +0000 (12:26 -0500)]
spirv: Delete the impl for prototype-only functions

Previously, when we had a prototype-only function in SPIR-V, we would
compile it just fine and the function would have an impl that did
nothing.  This commit changes that so that the nir_function::impl is
NULL to indicate a prototype-only function.

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

3 years agospirv: Store the nir_function in vtn_function
Jason Ekstrand [Fri, 23 Oct 2020 17:25:27 +0000 (12:25 -0500)]
spirv: Store the nir_function in vtn_function

This is a better mapping as not all nir_functions have impls.

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

3 years agozink: add nir_intrinsic_memory_barrier_image handling
Mike Blumenkrantz [Tue, 16 Feb 2021 18:19:08 +0000 (13:19 -0500)]
zink: add nir_intrinsic_memory_barrier_image handling

this is the last one

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

3 years agofrontends/va : Fix memory leaks incase of error returns
SureshGuttula [Thu, 11 Feb 2021 17:36:17 +0000 (23:06 +0530)]
frontends/va : Fix memory leaks incase of error returns

Incase of error returns missed the free calls for config and context.
This patch handling in freeing them

Signed-off-by: SureshGuttula <sguttula@amd.com>
Reviewed-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8993>

3 years agoCI: Use a sha for the Windows SPIRV-LLVM-Translator dependency
Jesse Natalie [Fri, 12 Feb 2021 16:53:58 +0000 (08:53 -0800)]
CI: Use a sha for the Windows SPIRV-LLVM-Translator dependency

Acked-by: Daniel Stone (daniels@collabora.com)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9018>

3 years agozink: fix device codegen extension detection
Mike Blumenkrantz [Tue, 16 Feb 2021 16:09:35 +0000 (11:09 -0500)]
zink: fix device codegen extension detection

the logic for this was broken and failed to detect any extensions other
than the first one listed. instead, we must follow this logic chain:
1. check the extension name
  2a. if this is an extension that got promoted to core, check the @since version
    3a. if current version >= @since version
      4a. if the extension has required features/properties, check those
      4b. else set supported
    3b. else
      4a. if the extension has required features/properties, check those
      4b. else set supported
  2b. else
    4a. if the extension has required features/properties, check those
    4b. else set supported

Fixes: efe6f00e345 ("zink/codegen: do not enable extensions that are now core")

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9081>

3 years agonir/algebraic: Covert up-cast of down-cast to extract on Intel
Jason Ekstrand [Thu, 4 Feb 2021 19:27:08 +0000 (13:27 -0600)]
nir/algebraic: Covert up-cast of down-cast to extract on Intel

This starts generating extract for bit sizes other than 32 but our
back-end handles that just fine.

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

3 years agonir/algebraic: Clean up up-cast of down-cast when we can
Jason Ekstrand [Thu, 4 Feb 2021 17:55:43 +0000 (11:55 -0600)]
nir/algebraic: Clean up up-cast of down-cast when we can

There are a bunch of cases where we can pretty quickly determine that
the high bits don't matter.  In these cases, delete the casts.

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

3 years agonir: Add some range analysis for used bits
Jason Ekstrand [Thu, 4 Feb 2021 17:38:40 +0000 (11:38 -0600)]
nir: Add some range analysis for used bits

This isn't 100% accurate, of course, but it should be good enough for
what we're about to do with it.

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

3 years agointel/nir: Lower 8-bit phis on Gen11+
Jason Ekstrand [Thu, 4 Feb 2021 16:41:21 +0000 (10:41 -0600)]
intel/nir: Lower 8-bit phis on Gen11+

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

3 years agonir/lower_bit_size: Support phi instructions
Jason Ekstrand [Thu, 4 Feb 2021 16:38:37 +0000 (10:38 -0600)]
nir/lower_bit_size: Support phi instructions

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

3 years agonir: Add a couple helpers for phis and cursors
Jason Ekstrand [Thu, 4 Feb 2021 16:38:21 +0000 (10:38 -0600)]
nir: Add a couple helpers for phis and cursors

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

3 years agovirgl: Return total video memory if available
Rohan Garg [Fri, 12 Feb 2021 11:49:28 +0000 (12:49 +0100)]
virgl: Return total video memory if available

Signed-off-by: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9009>

3 years agovirgl: update headers
Rohan Garg [Fri, 12 Feb 2021 11:49:19 +0000 (12:49 +0100)]
virgl: update headers

Signed-off-by: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9009>

3 years agofrontends/va/config: Fix check for packed header config
Thong Thai [Fri, 12 Feb 2021 18:42:42 +0000 (13:42 -0500)]
frontends/va/config: Fix check for packed header config

Fixes: b4651890be4 ("frontends/va: Update conditional checks for code stability.")
Signed-off-by: Thong Thai <thong.thai@amd.com>
Tested-by: James Zhu <James.Zhu@amd.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4285
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9020>

3 years agogitlab-ci: add intel APL and GLK devices with manual triggers
Gustavo Padovan [Fri, 18 Dec 2020 03:40:02 +0000 (00:40 -0300)]
gitlab-ci: add intel APL and GLK devices with manual triggers

This add support for the Intel Apollo Lake and Gemini Lake families,
however the job will be disabled by default unless the developer
manually hit play for the iris-apl-traces and iris-glk-traces jobs in
GitLab CI.

These devices are still under experimental level support in
the Lava lab and are not guaranteed to work reliably yet. Once they
become reliable and more resilient we will enable them by default in
MesaCI.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8162>

3 years agogitlab-ci: build the iris gallium driver as well
Gustavo Padovan [Wed, 16 Dec 2020 17:05:15 +0000 (14:05 -0300)]
gitlab-ci: build the iris gallium driver as well

For now we will start with iris. Our main focus is to enable the devices
to be used in MesaCI.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8162>

3 years agogitlab-ci: extend x86_64 kernel config to suport Intel devices
Gustavo Padovan [Wed, 16 Dec 2020 10:39:19 +0000 (07:39 -0300)]
gitlab-ci: extend x86_64 kernel config to suport Intel devices

There are extra kernel config options we need to enable for Intel.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8162>

3 years agointel/compiler: Free resources on test teardown
Rohan Garg [Wed, 10 Feb 2021 15:43:08 +0000 (16:43 +0100)]
intel/compiler: Free resources on test teardown

Ensure that all resources are properly released by
properly parenting them to a memory context and releasing
the context during test teardown.

Signed-off-by: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8162>

3 years agointel/genxml: Free resource before exiting
Rohan Garg [Wed, 10 Feb 2021 14:20:25 +0000 (15:20 +0100)]
intel/genxml: Free resource before exiting

Signed-off-by: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8162>

3 years agopan/bi: Use the correct size for UBO loads
Icecream95 [Thu, 11 Feb 2021 10:51:10 +0000 (23:51 +1300)]
pan/bi: Use the correct size for UBO loads

Multiply by the destination bit size to get the number of bits to
load instead of assuming 32 bits.

Fixes: 2e57684d2d3 ("pan/bi: Implement load_ubo with the builder")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9071>

3 years agoradv: Do pipe misalignment check per plane.
Bas Nieuwenhuizen [Tue, 16 Feb 2021 12:46:55 +0000 (13:46 +0100)]
radv: Do pipe misalignment check per plane.

Fixes: 4c99d6ff54b ("radv: flush L2 for images affected by the pipe misaligned issue on GFX10+")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9078>

3 years agobroadcom/compiler: Merge instructions more efficiently
Arcady Goldmints-Orlov [Sun, 31 Jan 2021 19:53:55 +0000 (14:53 -0500)]
broadcom/compiler: Merge instructions more efficiently

Instructions are allowed to access up to two rf registers, or one rf
register and a small immediate. This change allows qpu_merge_inst to
take full advantage of this by allowint the merging of two instructions
if they have no more than two different rf registers between them,
or one rf register and one small immediate. qpu_merge_inst rewrites
the instructions as needed to pack everything into raddr_a and raddr_b
in the merged instruction.

shader-db stats:
total instructions in shared programs: 19938769 -> 18929664 (-5.06%)
instructions in affected programs: 17929438 -> 16920333 (-5.63%)
helped: 95008
HURT: 242
helped stats (abs) min: 1 max: 785 x̄: 10.62 x̃: 7
helped stats (rel) min: 0.30% max: 21.25% x̄: 5.37% x̃: 4.98%
HURT stats (abs)   min: 1 max: 2 x̄: 1.10 x̃: 1
HURT stats (rel)   min: 0.30% max: 3.12% x̄: 1.62% x̃: 1.54%
95% mean confidence interval for instructions value: -10.67 -10.52
95% mean confidence interval for instructions %-change: -5.37% -5.33%
Instructions are helped.

total max-temps in shared programs: 3122664 -> 3112446 (-0.33%)
max-temps in affected programs: 124881 -> 114663 (-8.18%)
helped: 5445
HURT: 0
helped stats (abs) min: 1 max: 15 x̄: 1.88 x̃: 1
helped stats (rel) min: 1.49% max: 40.54% x̄: 8.97% x̃: 6.67%
95% mean confidence interval for max-temps value: -1.91 -1.84
95% mean confidence interval for max-temps %-change: -9.12% -8.81%
Max-temps are helped.

total sfu-stalls in shared programs: 38028 -> 41231 (8.42%)
sfu-stalls in affected programs: 6053 -> 9256 (52.92%)
helped: 664
HURT: 3380
helped stats (abs) min: 1 max: 2 x̄: 1.04 x̃: 1
helped stats (rel) min: 9.09% max: 100.00% x̄: 70.81% x̃: 100.00%
HURT stats (abs)   min: 1 max: 4 x̄: 1.15 x̃: 1
HURT stats (rel)   min: 0.00% max: 300.00% x̄: 46.39% x̃: 25.00%
95% mean confidence interval for sfu-stalls value: 0.76 0.82
95% mean confidence interval for sfu-stalls %-change: 25.03% 29.26%
Sfu-stalls are HURT.

total inst-and-stalls in shared programs: 19976797 -> 18970895 (-5.04%)
inst-and-stalls in affected programs: 17963129 -> 16957227 (-5.60%)
helped: 95017
HURT: 245
helped stats (abs) min: 1 max: 785 x̄: 10.59 x̃: 7
helped stats (rel) min: 0.30% max: 21.25% x̄: 5.35% x̃: 4.95%
HURT stats (abs)   min: 1 max: 2 x̄: 1.09 x̃: 1
HURT stats (rel)   min: 0.30% max: 3.12% x̄: 1.61% x̃: 1.54%
95% mean confidence interval for inst-and-stalls value: -10.64 -10.48
95% mean confidence interval for inst-and-stalls %-change: -5.35% -5.31%
Inst-and-stalls are helped.

v2 (Iago):
 - moved early return for naddrs > 2 even earlier.
 - only update {add,mul}.b mux if instruction has more than one operand.
 - don't OR b->raddr_{a,b} if we are not merging add/mul instructions.
 - don't initialize packed to 0.
 - minor style fixes.

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

3 years agomeson: invalid keyword argument dependencies
Michel Zou [Tue, 2 Feb 2021 08:52:47 +0000 (09:52 +0100)]
meson: invalid keyword argument dependencies

Fixes: e4cc52c0 (vulkan: Add common extension tables)
Reviewed-by: Dylan Baker <dylan.c.baker@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8821>

3 years agoradv: only apply the MRT output NaN fixup to non-meta shaders
Samuel Pitoiset [Mon, 15 Feb 2021 10:40:45 +0000 (11:40 +0100)]
radv: only apply the MRT output NaN fixup to non-meta shaders

We only want this workaround to be applied for game shaders.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4163
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/9048>

3 years agoci: Update baremetal kernel to 5.11 plus patches
Christian Gmeiner [Mon, 15 Feb 2021 12:59:02 +0000 (13:59 +0100)]
ci: Update baremetal kernel to 5.11 plus patches

For imx6 we need the following fec ethernet fix:
 c730ab423bfa ("net: fec: Fix temporary RMII clock reset on link up")

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9046>

3 years agolavapipe: add support for missing 10/10/10/2 formats.
Dave Airlie [Mon, 8 Feb 2021 00:26:42 +0000 (10:26 +1000)]
lavapipe: add support for missing 10/10/10/2 formats.

The snorm formats don't work for blitting, so don't expose
them for that.

This passes all CTS tests that it enables.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8907>

3 years agolavapipe: add support for 2/10/10/10 scaled formats.
Dave Airlie [Mon, 8 Feb 2021 00:26:13 +0000 (10:26 +1000)]
lavapipe: add support for 2/10/10/10 scaled formats.

These will be used for zink CI testing.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8907>

3 years agollvmpipe: don't support scaled formats outside vertex buffers
Dave Airlie [Mon, 8 Feb 2021 00:24:25 +0000 (10:24 +1000)]
llvmpipe: don't support scaled formats outside vertex buffers

Scaled formats are usually only needed as vertex buffer formats,
don't expose them as supported for other things.

Lavapipe will use this to export the correct formats support.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8907>

3 years agoutil/format: add helper to check if a format is scaled.
Dave Airlie [Mon, 8 Feb 2021 04:58:50 +0000 (14:58 +1000)]
util/format: add helper to check if a format is scaled.

lavapipe/llvmpipe need this to rule out scaled formats for non-vertex
format usage. Note NONE is defined as scaled in u_format, but for
the purposes of this helper I don't want it to be considered scaled.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8907>

3 years agozink: support nir_intrinsic_group_memory_barrier
Mike Blumenkrantz [Tue, 16 Feb 2021 01:25:02 +0000 (20:25 -0500)]
zink: support nir_intrinsic_group_memory_barrier

needed for cts

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9073>

3 years agofeatures: mark off GL 4.6 and ES 3.1 for zink
Mike Blumenkrantz [Tue, 16 Feb 2021 01:03:04 +0000 (20:03 -0500)]
features: mark off GL 4.6 and ES 3.1 for zink

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>

3 years agozink: GLSL 460
Mike Blumenkrantz [Thu, 20 Aug 2020 20:09:31 +0000 (16:09 -0400)]
zink: GLSL 460

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>

3 years agozink: PIPE_CAP_GL_SPIRV
Mike Blumenkrantz [Thu, 20 Aug 2020 20:05:11 +0000 (16:05 -0400)]
zink: PIPE_CAP_GL_SPIRV

still needs a bunch of fixing, but 75% of tests pass

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>

3 years agozink: enable pipeline statistics cap
Mike Blumenkrantz [Thu, 20 Aug 2020 19:13:31 +0000 (15:13 -0400)]
zink: enable pipeline statistics cap

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>

3 years agozink: enable PIPE_CAP_QUERY_SO_OVERFLOW
Mike Blumenkrantz [Thu, 20 Aug 2020 17:39:10 +0000 (13:39 -0400)]
zink: enable PIPE_CAP_QUERY_SO_OVERFLOW

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>

3 years agozink: enable PIPE_CAP_POLYGON_OFFSET_CLAMP
Mike Blumenkrantz [Thu, 20 Aug 2020 12:54:53 +0000 (08:54 -0400)]
zink: enable PIPE_CAP_POLYGON_OFFSET_CLAMP

this is already handled

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>

3 years agozink: enable PIPE_CAP_DRAW_PARAMETERS
Mike Blumenkrantz [Wed, 19 Aug 2020 18:51:31 +0000 (14:51 -0400)]
zink: enable PIPE_CAP_DRAW_PARAMETERS

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>

3 years agozink: enable PIPE_CAP_TGSI_VOTE
Mike Blumenkrantz [Wed, 19 Aug 2020 18:33:28 +0000 (14:33 -0400)]
zink: enable PIPE_CAP_TGSI_VOTE

ARB_shader_group_vote

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>

3 years agozink: add util function for submitting the compute batch
Mike Blumenkrantz [Sun, 6 Sep 2020 14:55:12 +0000 (10:55 -0400)]
zink: add util function for submitting the compute batch

sometimes we just want to submit this and not wait on it

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9063>

3 years agozink: rewrite drawid based on shader key value
Mike Blumenkrantz [Fri, 29 Jan 2021 22:10:03 +0000 (17:10 -0500)]
zink: rewrite drawid based on shader key value

same as basevertex

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>

3 years agozink: break out push constant creation in compiler and add drawid value
Mike Blumenkrantz [Fri, 29 Jan 2021 22:09:34 +0000 (17:09 -0500)]
zink: break out push constant creation in compiler and add drawid value

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>

3 years agozink: add a vs shader key for rewriting gl_DrawID
Mike Blumenkrantz [Fri, 29 Jan 2021 22:03:14 +0000 (17:03 -0500)]
zink: add a vs shader key for rewriting gl_DrawID

if we get a direct draw, we have to rewrite the drawid for it to work as expected

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>

3 years agozink: add a draw_id param to vs push constants
Mike Blumenkrantz [Wed, 19 Aug 2020 22:41:06 +0000 (18:41 -0400)]
zink: add a draw_id param to vs push constants

gallium always gives us multidraws as individual draws, so we need to feed
this through to the shader

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>

3 years agozink: wrap shader gl_BaseVertex access with a bcsel based on push constant state
Mike Blumenkrantz [Wed, 19 Aug 2020 21:59:13 +0000 (17:59 -0400)]
zink: wrap shader gl_BaseVertex access with a bcsel based on push constant state

vulkan has different mechanics than gl for this variable based on whether the
current draw is indexed, so we need to rewrite the access here for that case

this also requires that we add some padding to the tcs shader injection to
account for new members being added to the push constant

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>

3 years agozink: add push constant value to indicate whether the current draw is indexed
Mike Blumenkrantz [Wed, 19 Aug 2020 21:58:22 +0000 (17:58 -0400)]
zink: add push constant value to indicate whether the current draw is indexed

due to semantic differences between gl and vk variables, this is going to be
necessary for gl_BaseVertex

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>

3 years agozink: rework tcs injection to be more compatible with new push const struct
Mike Blumenkrantz [Wed, 2 Sep 2020 16:54:30 +0000 (12:54 -0400)]
zink: rework tcs injection to be more compatible with new push const struct

we can simplify the push constant loader to directly take the struct member
index here and then pass that directly to simplify things for future use

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>

3 years agozink: create a struct for tracking push constant layout
Mike Blumenkrantz [Wed, 19 Aug 2020 20:42:04 +0000 (16:42 -0400)]
zink: create a struct for tracking push constant layout

it'll be helpful to update this as we add more values here so we can
avoid having to update all the users

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>

3 years agozink: add handling for ARB_shader_draw_parameters variables in ntv
Mike Blumenkrantz [Wed, 19 Aug 2020 18:50:47 +0000 (14:50 -0400)]
zink: add handling for ARB_shader_draw_parameters variables in ntv

* gl_DrawID
* gl_BaseVertex
* gl_BaseInstance (was already semi-handled)

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>

3 years agozink: handle 1bit undef values in ntv
Mike Blumenkrantz [Mon, 15 Feb 2021 20:22:46 +0000 (15:22 -0500)]
zink: handle 1bit undef values in ntv

spirv requires that 1bit values be bool types, not uints

Fixes: 93af00502eb ("zink: use uvec for undefs")

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

3 years agozink: fix slot mapping for legacy gl io with tess stages
Mike Blumenkrantz [Fri, 12 Feb 2021 17:27:47 +0000 (12:27 -0500)]
zink: fix slot mapping for legacy gl io with tess stages

e.g., gl_BackColor is a thing

Fixes: aec03553e1b ("zink: fix tess shader i/o variables")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9019>

3 years agozink: add support for pipeline statistics queries
Mike Blumenkrantz [Thu, 20 Aug 2020 19:11:57 +0000 (15:11 -0400)]
zink: add support for pipeline statistics queries

so easy!

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9010>

3 years agozink: hook up cs invocation queries to the compute batch
Mike Blumenkrantz [Thu, 20 Aug 2020 19:10:55 +0000 (15:10 -0400)]
zink: hook up cs invocation queries to the compute batch

compute batches are separate, so we have to run these queries on the
appropriate batch to see the expected results

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9010>

3 years agozink: unset generated TCS if its parent TESS is unset
Mike Blumenkrantz [Mon, 15 Feb 2021 19:09:51 +0000 (14:09 -0500)]
zink: unset generated TCS if its parent TESS is unset

ensure this doesn't get pulled in during the next program update

Fixes: 334759d8509 ("zink: implement passthrough tcs shader injection")

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9057>

3 years agoaco: fix assertion in insert_exec_mask pass
Daniel Schürmann [Mon, 15 Feb 2021 10:31:13 +0000 (11:31 +0100)]
aco: fix assertion in insert_exec_mask pass

Fixes: a56ddca4e80a6ef7bb0c44edb4e5b6169510aaca ('aco: make all exec accesses non-temporaries ')
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9047>

3 years agoaco: fix transition_to_{WQM,Exact} if exec.back() is not in exec
Rhys Perry [Mon, 15 Feb 2021 11:24:22 +0000 (11:24 +0000)]
aco: fix transition_to_{WQM,Exact} if exec.back() is not in exec

This can happen at merge blocks.

fossil-db (GFX10.3):
Totals from 25229 (17.25% of 146267) affected shaders:
CodeSize: 58575920 -> 58571376 (-0.01%); split: -0.01%, +0.00%
Instrs: 10979245 -> 10978109 (-0.01%); split: -0.01%, +0.00%
SClause: 591817 -> 591816 (-0.00%)
Copies: 604987 -> 603851 (-0.19%); split: -0.19%, +0.00%
Cycles: 96088796 -> 96084252 (-0.00%); split: -0.00%, +0.00%
VMEM: 10470372 -> 10470368 (-0.00%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: a56ddca4e80 ("aco: make all exec accesses non-temporaries")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4299
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9047>

3 years agomesa: add debug code to catch missing _mesa_update_valid_to_render_state calls
Marek Olšák [Wed, 3 Feb 2021 19:41:56 +0000 (14:41 -0500)]
mesa: add debug code to catch missing _mesa_update_valid_to_render_state calls

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>

3 years agomesa: inline draw validate functions
Marek Olšák [Tue, 26 Jan 2021 06:34:45 +0000 (01:34 -0500)]
mesa: inline draw validate functions

This just moves the functions to draw.c.

Our CPU overhead is so low now that this increases performance by a few %.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>

3 years agomesa: inline _mesa_set_draw_vao and set_varying_vp_inputs for draw calls
Marek Olšák [Tue, 26 Jan 2021 06:22:30 +0000 (01:22 -0500)]
mesa: inline _mesa_set_draw_vao and set_varying_vp_inputs for draw calls

This just moves the functions to draw.c. It's inlined because the function
name disappears in the profiler. It improves performance.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>

3 years agomesa: gather errors and call _mesa_error only once in validate_Draw
Marek Olšák [Mon, 25 Jan 2021 04:48:06 +0000 (23:48 -0500)]
mesa: gather errors and call _mesa_error only once in validate_Draw

This mainly skips all the jumping around various _mesa_error calls that
are never taken. There is a tiny measurable improvement in CPU overhead.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>

3 years agomesa: precompute draw time determination of enabled vertex arrays
Marek Olšák [Mon, 25 Jan 2021 22:07:29 +0000 (17:07 -0500)]
mesa: precompute draw time determination of enabled vertex arrays

Another draw time optimization that precomputes the value only when
_VPMode is changed.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>

3 years agomesa: precompute _mesa_get_vao_vp_inputs
Marek Olšák [Tue, 26 Jan 2021 00:02:39 +0000 (19:02 -0500)]
mesa: precompute _mesa_get_vao_vp_inputs

It's called for every draw, so this is important.

All inputs of _mesa_get_vao_vp_inputs are changed when
update_attribute_map_mode is called, so we can just compute
the value there.

The assertion ensures correct behavior in debug builds.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>

3 years agomesa: set _DrawVAOEnabledAttribs only when it changes
Marek Olšák [Mon, 25 Jan 2021 22:15:43 +0000 (17:15 -0500)]
mesa: set _DrawVAOEnabledAttribs only when it changes

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>

3 years agomesa: move gl_context::varying_vp_inputs into ctx->VertexProgram._VaryingInputs
Marek Olšák [Mon, 25 Jan 2021 21:53:34 +0000 (16:53 -0500)]
mesa: move gl_context::varying_vp_inputs into ctx->VertexProgram._VaryingInputs

This is where it belongs.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>