platform/upstream/mesa.git
3 years agozink: inline program cache structs
Mike Blumenkrantz [Wed, 9 Jun 2021 22:42:26 +0000 (18:42 -0400)]
zink: inline program cache structs

derefs--

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

3 years agozink: return early when getting resource modifer if no modifier is used
Mike Blumenkrantz [Wed, 25 Aug 2021 01:56:25 +0000 (21:56 -0400)]
zink: return early when getting resource modifer if no modifier is used

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

3 years agozink: verify program key sizes before checking for default variant
Mike Blumenkrantz [Wed, 25 Aug 2021 20:13:10 +0000 (16:13 -0400)]
zink: verify program key sizes before checking for default variant

currently keys for shaders are always the same size, but this will change
in the future, at which point the keysize becomes relevant

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

3 years agomicrosoft/compiler: Miscellaneous fixes from running clang-format
Michael Tang [Tue, 24 Aug 2021 02:00:55 +0000 (19:00 -0700)]
microsoft/compiler: Miscellaneous fixes from running clang-format

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

3 years agomicrosoft/compiler: Emit a flat interpolation method for SV_SampleIndex
Michael Tang [Tue, 24 Aug 2021 23:53:33 +0000 (16:53 -0700)]
microsoft/compiler: Emit a flat interpolation method for SV_SampleIndex

We do not want to set an interpolation method for vertex shader inputs.

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

3 years agomicrosoft/compiler: Set the SampleFrequency runtime metadata
Michael Tang [Tue, 24 Aug 2021 01:53:28 +0000 (18:53 -0700)]
microsoft/compiler: Set the SampleFrequency runtime metadata

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

3 years agomicrosoft/compiler: More robustly handle setting Register=-1
Michael Tang [Tue, 24 Aug 2021 01:48:50 +0000 (18:48 -0700)]
microsoft/compiler: More robustly handle setting Register=-1

This is the 'N/A mask' case in the DXIL disassembly.

This logic is taken from: https://github.com/microsoft/DirectXShaderCompiler/blob/7c9e487afd17b7726229d8ceb3242a412134afe7/tools/clang/tools/dxcompiler/dxcdisassembler.cpp#L106

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

3 years agomicrosoft/compiler: Add support for SV_SampleIndex intrinsic
Michael Tang [Tue, 24 Aug 2021 02:08:08 +0000 (19:08 -0700)]
microsoft/compiler: Add support for SV_SampleIndex intrinsic

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

3 years agopan/bi: Fix format specifiers in disassembler
Alyssa Rosenzweig [Tue, 24 Aug 2021 20:44:28 +0000 (16:44 -0400)]
pan/bi: Fix format specifiers in disassembler

Flagged by cppcheck.

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

3 years agopan/bi: Remove unused clause_start field
Alyssa Rosenzweig [Tue, 24 Aug 2021 20:41:27 +0000 (16:41 -0400)]
pan/bi: Remove unused clause_start field

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

3 years agopan/bi: Assert l != NULL in bi_ra
Alyssa Rosenzweig [Tue, 24 Aug 2021 20:40:54 +0000 (16:40 -0400)]
pan/bi: Assert l != NULL in bi_ra

Confuses cppcheck; indeed, the proof is confusing.

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

3 years agopan/bi: Simplify condition
Alyssa Rosenzweig [Tue, 24 Aug 2021 20:40:35 +0000 (16:40 -0400)]
pan/bi: Simplify condition

Flagged by cppcheck.

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

3 years agopanfrost: Remove unused functions
Alyssa Rosenzweig [Tue, 24 Aug 2021 20:37:15 +0000 (16:37 -0400)]
panfrost: Remove unused functions

Flagged by cppcheck.

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

3 years agopanfrost: Remove stale TODOs and XXXs
Alyssa Rosenzweig [Tue, 24 Aug 2021 18:41:14 +0000 (14:41 -0400)]
panfrost: Remove stale TODOs and XXXs

These don't meaningfully apply but their comments never got updated.

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

3 years agopanfrost: Remove CACHE_LINE_SIZE #define
Alyssa Rosenzweig [Tue, 24 Aug 2021 18:40:24 +0000 (14:40 -0400)]
panfrost: Remove CACHE_LINE_SIZE #define

Not only is it unused, it's totally wrong. Not even a little right.

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

3 years agollvmpipe: rip out cylindrical wrap support
Erik Faye-Lund [Mon, 23 Aug 2021 12:37:42 +0000 (14:37 +0200)]
llvmpipe: rip out cylindrical wrap support

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

3 years agosoftpipe: rip out cylindrical wrap support
Erik Faye-Lund [Mon, 23 Aug 2021 12:29:21 +0000 (14:29 +0200)]
softpipe: rip out cylindrical wrap support

This is never used, so let's just remove it.

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

3 years agogallium/tgsi: rip out cylindrical wrap support
Erik Faye-Lund [Mon, 23 Aug 2021 12:25:07 +0000 (14:25 +0200)]
gallium/tgsi: rip out cylindrical wrap support

We never enable this feature, so let's rip it out completely.

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

3 years agogallium/tgsi: rip out cylindrical wrap from ureg
Erik Faye-Lund [Mon, 23 Aug 2021 12:11:52 +0000 (14:11 +0200)]
gallium/tgsi: rip out cylindrical wrap from ureg

We always pass zero to these arguments, so this feature isn't in use.

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

3 years agogallium/tgsi: remove unused helper
Erik Faye-Lund [Mon, 23 Aug 2021 12:06:24 +0000 (14:06 +0200)]
gallium/tgsi: remove unused helper

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

3 years agodraw/llvmpipe: correct exponent calculation for negative z
Erik Faye-Lund [Wed, 18 Aug 2021 09:40:51 +0000 (11:40 +0200)]
draw/llvmpipe: correct exponent calculation for negative z

If the z components here contain negative values, we'll end up with the
wrong maximum value.

This updated equation is taken from the D3D11 functional spec (section
15.10 Depth Bias), which is a bit more clear than the OpenGL spec.

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

3 years agoradv: allow storage images with VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 on GFX10.3+
Samuel Pitoiset [Tue, 17 Aug 2021 08:52:21 +0000 (10:52 +0200)]
radv: allow storage images with VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 on GFX10.3+

It should be supported.

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

3 years agofreedreno/a6xx: Fix a6xx gen4 compute shaders
Rob Clark [Sat, 21 Aug 2021 17:58:58 +0000 (10:58 -0700)]
freedreno/a6xx: Fix a6xx gen4 compute shaders

I believe the addition of these new regs is related to the changes made
for LPAC ring, so let's key off of that.

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

3 years agofreedreno/a6xx: Register updates for a6xx gen4
Rob Clark [Sat, 21 Aug 2021 18:55:19 +0000 (11:55 -0700)]
freedreno/a6xx: Register updates for a6xx gen4

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

3 years agofreedreno/a6xx: Updates for tess_use_shared
Rob Clark [Sat, 21 Aug 2021 17:14:16 +0000 (10:14 -0700)]
freedreno/a6xx: Updates for tess_use_shared

The formula for calculating these two values seems to depend on
tess_use_shared, ie. a6xx_gen3 and a6xx_gen4 match.  The existing
calculation matches a6xx_gen1 and a6xx_gen2.

The new formula is based on traces varying # of output (from VS)
varyings from (1..31)*vec4 and vertices from (1..31) and coming up
with something that matches the blob.  Once hs_input_size*4 divided
by tcs_vertices_out goes above 64, this deviates a bit from the
blob, but AFAICT it is safe to pick a larger values.

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

3 years agofreedreno/a6xx: Fix streamout with tess_use_shared
Rob Clark [Wed, 18 Aug 2021 22:28:00 +0000 (15:28 -0700)]
freedreno/a6xx: Fix streamout with tess_use_shared

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

3 years agofreedreno/a6xx: Rast updates for a6xx gen3
Rob Clark [Sat, 21 Aug 2021 18:00:22 +0000 (11:00 -0700)]
freedreno/a6xx: Rast updates for a6xx gen3

Not really sure what these new regs are, but blob emits them as part of
rasterizer state starting with a650.

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

3 years agofreedreno/a6xx: Register updates for a6xx gen3
Rob Clark [Sat, 21 Aug 2021 18:54:30 +0000 (11:54 -0700)]
freedreno/a6xx: Register updates for a6xx gen3

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

3 years agofreedreno/a6xx: Set type for PC_HS_INPUT_SIZE
Rob Clark [Sat, 21 Aug 2021 17:27:02 +0000 (10:27 -0700)]
freedreno/a6xx: Set type for PC_HS_INPUT_SIZE

It is an unsigned integer.. display it as such.

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

3 years agofreedreno/common: Fix comment typo
Rob Clark [Fri, 20 Aug 2021 20:47:41 +0000 (13:47 -0700)]
freedreno/common: Fix comment typo

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

3 years agopanfrost: Raise maximum texture size
Alyssa Rosenzweig [Tue, 10 Aug 2021 17:41:28 +0000 (13:41 -0400)]
panfrost: Raise maximum texture size

The hardware can handle much larger textures than we allowed. The game
"Cathedral" requires larger textures for some bizarre reason. Raise the
limit so the game runs, syncing MAX_MIP_LEVELS, the comments, and the CAPs.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Closes: #5203
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12312>

3 years agoaco: remove redundant s_and exec after nir_op_inot
Daniel Schürmann [Wed, 23 Jun 2021 15:11:09 +0000 (17:11 +0200)]
aco: remove redundant s_and exec after nir_op_inot

Totals from 22585 (15.04% of 150170) affected shaders: (GFX10.3)
VGPRs: 1474048 -> 1473904 (-0.01%)
CodeSize: 155238876 -> 155187688 (-0.03%); split: -0.06%, +0.03%
MaxWaves: 385086 -> 385122 (+0.01%)
Instrs: 29297735 -> 29284442 (-0.05%); split: -0.08%, +0.04%
Latency: 675841742 -> 675764151 (-0.01%); split: -0.02%, +0.01%
InvThroughput: 174859037 -> 174854796 (-0.00%); split: -0.01%, +0.01%
VClause: 479790 -> 479781 (-0.00%); split: -0.01%, +0.00%
SClause: 1106900 -> 1106615 (-0.03%); split: -0.03%, +0.01%
Copies: 1829037 -> 1828042 (-0.05%); split: -0.09%, +0.03%
Branches: 859971 -> 859967 (-0.00%); split: -0.00%, +0.00%
PreSGPRs: 1341850 -> 1342356 (+0.04%); split: -0.01%, +0.04%
PreVGPRs: 1327322 -> 1327034 (-0.02%)

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11573>

3 years agoaco: Fix to_uniform_bool_instr when operands are not suitable.
Timur Kristóf [Wed, 25 Aug 2021 10:13:39 +0000 (12:13 +0200)]
aco: Fix to_uniform_bool_instr when operands are not suitable.

Don't attempt to transform uniform boolean instructions when
their operands are unsuitable. This can happen eg. due to other
optimizations that combine SALU instructions which clear out
the uniform instruction labels.

Cc: mesa-stable
Fixes: 8a32f57fff56b3b94f1b5589feba38016f39427c
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11573>

3 years agonir: prevent peephole from generating invalid NIR
Lionel Landwerlin [Mon, 23 Aug 2021 13:45:20 +0000 (16:45 +0300)]
nir: prevent peephole from generating invalid NIR

We can't append instructions following a return/halt instruction
because the control flow helpers will modify the successor of the
block containing the return/halt. And the NIR validator enforces that
the return/halt must have the end of the function as successor.

This tends to happen following lower_shader_calls lowering which
inserts halts. This probably doesn't prevent the optimization, it'll
just happen in one of the return shaders after the halt has been
removed.

v2: Move prev block ending check earlier in the function (Daniel)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12506>

3 years agoci: update the list of expected failures/skips for RADV
Samuel Pitoiset [Wed, 25 Aug 2021 10:06:16 +0000 (12:06 +0200)]
ci: update the list of expected failures/skips for RADV

Against CTS 1.2.7.0.
Tested chips are Pitcairn, Polaris10, Navi14 and Sienna Cichlid.

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

3 years agoiris/ci: Add manual jobs for tracking performance
Tomeu Vizoso [Fri, 6 Aug 2021 09:10:02 +0000 (11:10 +0200)]
iris/ci: Add manual jobs for tracking performance

Use Piglit's replay profile to measure and store the time that frames
take to render in the GPU.

This job won't run automatically in regular pipelines, but will be
triggered automatically by a script for every successful pre-merge
pipeline.

This is because we want to generate performance data for every relevant
commit merged in main, but we don't want to keep a device busy during
the pre-merge run.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12236>

3 years agonir/opt_algebraic: optimize fmax(-fmin(b, a), b) -> fmax(fabs(b), -a)
Samuel Pitoiset [Tue, 24 Aug 2021 06:35:59 +0000 (08:35 +0200)]
nir/opt_algebraic: optimize fmax(-fmin(b, a), b) -> fmax(fabs(b), -a)

and fmin(-fmax(b, a)) to fmin(-fabs(b), -a).

fossils-db (Sienna Cichlid):
Totals from 34 (0.02% of 150170) affected shaders:
CodeSize: 388540 -> 387748 (-0.20%)
Instrs: 74621 -> 74423 (-0.27%)
Latency: 1039407 -> 1039011 (-0.04%)
InvThroughput: 208364 -> 208150 (-0.10%)

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

3 years agocrocus: add missing fs dirty on reduced prim change.
Dave Airlie [Wed, 25 Aug 2021 02:31:54 +0000 (22:31 -0400)]
crocus: add missing fs dirty on reduced prim change.

the reduced prim is used to decide some line antialiasing settings.
this fixes mesa-demos antialias

Fixes: f3630548f1da ("crocus: initial gallium driver for Intel gfx 4-7")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12536>

3 years agocrocus: add missing line smooth bits.
Dave Airlie [Wed, 25 Aug 2021 02:00:47 +0000 (22:00 -0400)]
crocus: add missing line smooth bits.

Just noticed this in passing.

Fixes: f3630548f1da ("crocus: initial gallium driver for Intel gfx 4-7")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12536>

3 years agozink: fix pipeline caching
Mike Blumenkrantz [Tue, 24 Aug 2021 22:32:17 +0000 (18:32 -0400)]
zink: fix pipeline caching

this was apparently always broken, but in a very, very subtle way
where the hash table would compare the current pipeline state against
itself instead of using the cache entry's state

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

3 years agozink: fix program init flag
Mike Blumenkrantz [Tue, 24 Aug 2021 21:59:44 +0000 (17:59 -0400)]
zink: fix program init flag

this was accidentally !! instead of ! as intended

Fixes: c4702204bc3 ("zink: optimize shader recalc")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12535>

3 years agospirv_to_dxil: Run nir_lower_tex during compilation
Michael Tang [Fri, 20 Aug 2021 21:53:02 +0000 (14:53 -0700)]
spirv_to_dxil: Run nir_lower_tex during compilation

We need this to get e.g. a default lod for some instructions when it is
not provided.

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

3 years agocrocus: drop u_primconvert header.
Dave Airlie [Tue, 24 Aug 2021 21:28:54 +0000 (07:28 +1000)]
crocus: drop u_primconvert header.

This is just leftover.

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

3 years agozink: add better TODO note for surface swizzles
Mike Blumenkrantz [Tue, 6 Apr 2021 14:29:28 +0000 (10:29 -0400)]
zink: add better TODO note for surface swizzles

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

3 years agozink: make void swizzle clamping util public
Mike Blumenkrantz [Tue, 6 Apr 2021 14:22:03 +0000 (10:22 -0400)]
zink: make void swizzle clamping util public

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

3 years agozink: make component mapping function a static inline
Mike Blumenkrantz [Tue, 6 Apr 2021 14:20:27 +0000 (10:20 -0400)]
zink: make component mapping function a static inline

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

3 years agozink: move void format detection function to zink_format
Mike Blumenkrantz [Tue, 6 Apr 2021 14:18:41 +0000 (10:18 -0400)]
zink: move void format detection function to zink_format

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

3 years agonine: replace unnecessary dynamic-sized array with bitfield
Mike Blumenkrantz [Mon, 23 Aug 2021 14:43:22 +0000 (10:43 -0400)]
nine: replace unnecessary dynamic-sized array with bitfield

PIPE_MAX_VERTEX_STREAMS is 4, so this can be simplified to reduce cpu usage

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

3 years agopanfrost: Take a ctx when submitting/destroying
Alyssa Rosenzweig [Tue, 17 Aug 2021 17:22:42 +0000 (17:22 +0000)]
panfrost: Take a ctx when submitting/destroying

This reduces the number of batch->ctx shenanigans we do, and in turn
should reduce raciness.

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

3 years agospirv: Add support for SPV_KHR_integer_dot_product
Ian Romanick [Mon, 14 Jun 2021 21:12:36 +0000 (14:12 -0700)]
spirv: Add support for SPV_KHR_integer_dot_product

v2 (Ivan): Add missing capability enum handling.

v3 (idr): Properly handle cases where dest_size != 32.

v4 (idr): Rewrite most of the error checking to use vtn_fail_if.  Use
nir_ssa_def with vtn_push_nir_ssa instead of vtn_ssa_value with
vtn_push_ssa_value.  All suggested by Jason.  Massive rewrite of the
handling of packed 4x8 saturating opcodes.  Based on some observations
made by Jason.

v5 (idr): Remove some debugging cruft accidentally added in v4.  Noticed
by Jason.

v6: Emit packed versions of vectored instructions when possible.
Suggested by Jason.

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

3 years agospirv: Update headers and metadata from latest Khronos commit
Ian Romanick [Mon, 14 Jun 2021 21:11:08 +0000 (14:11 -0700)]
spirv: Update headers and metadata from latest Khronos commit

This corresponds to e7b49d7 ("Implement SPV_INTEL_optnone extension
(#230)") in https://github.com/KhronosGroup/SPIRV-Headers.

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

3 years agonir/algebraic: Add some extract optimizations
Ian Romanick [Fri, 20 Aug 2021 00:52:54 +0000 (17:52 -0700)]
nir/algebraic: Add some extract optimizations

These help quite a bit when vectored versions of SpvOpSDotKHR and
friends are emitted as packed versions and then lowered.

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

3 years agonir/algebraic: Add lowering for dot_4x8 instructions
Ian Romanick [Wed, 9 Jun 2021 21:53:49 +0000 (14:53 -0700)]
nir/algebraic: Add lowering for dot_4x8 instructions

v2: Fix copy-and-paste bugs in lowering patterns.

v3: Add has_sudot_4x8 flag.  Requested by Rhys.

v4: Since the names of the opcodes changed from dp4 to dot_4x8, also
change the names of the lowering helpers.  Suggested by Jason.

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

3 years agointel/compiler: Basic support for DP4A instruction
Ian Romanick [Wed, 24 Feb 2021 02:46:53 +0000 (18:46 -0800)]
intel/compiler: Basic support for DP4A instruction

v2: Very significant rebase on changes to previous commits.
Specifically, brw_fs_nir.cpp changes were pretty much rewritten from
scratch after changing the NIR opcode names and types.

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

3 years agonir/algebraic: Basic patterns for dot_4x8
Ian Romanick [Wed, 24 Feb 2021 03:12:49 +0000 (19:12 -0800)]
nir/algebraic: Basic patterns for dot_4x8

v2: Add and modify patterns to let constant folding do better.

v3: Remove '(is_not_zero)' from the patterns that try to combine
addends.  I honestly don't know why I had it there in the first place,
and nothing in my deep git logs could help clue me in.  Noticed by
Alyssa.  Remover patterns that detect open-coded udot_4x8.  Suggested by
Alyssa and Jason.  Add missing sudot_4x8 patterns.

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

3 years agonir/opcodes: Add integer dot-product opcodes
Ian Romanick [Wed, 24 Feb 2021 01:33:04 +0000 (17:33 -0800)]
nir/opcodes: Add integer dot-product opcodes

Six opcodes are added: sdot_4x8_iadd, udot_4x8_uadd, sudot_4x8_iadd,
sdot_4x8_iadd_sat, udot_4x8_uadd_sate, and sudot_4x8_iadd_sat.  These
represent the combinations of integer dot-product and add that operate
on packed source vectors.  That is, the four 8-bit values for each
vector is stored in a single 32-bit integer.

Some hardware may prefer to operate on unpacked byte vectors.  When such
hardware comes to Mesa, we'll have to figure out how to name things.

v2: Add nir_op_iudp4a and nir_op_iudp4a_sat instructions.  These opcodes
are not 2-source commutative.

v3: Rename all opcodes to be more like some existing 4x8 opcodes.
Suggested by Timur.  Change type of packed vector sources to uint32,
change types of constant folding variables to have explicit size, and
delete some extra casts.  All suggested by Jason.

v4: Fix typo previously noticed by Alyssa but missed in v2.

v5: Add has_sudot_4x8 flag.  Requested by Rhys.

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

3 years agonir/lower_bit_size: Support add_sat and sub_sat
Ian Romanick [Thu, 29 Jul 2021 01:16:24 +0000 (18:16 -0700)]
nir/lower_bit_size: Support add_sat and sub_sat

Without this, lowered saturating ALU instructions would only clamp to
the range of the new type instead of the range of the old type.

v2: Use nir_iclamp.  Suggested by Jason. Use new
u_{int,uint}N_{min,max}() helpers.

Fixes: 090e2824079 ("nir: Add a saturated unsigned integer add opcode")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12142>

3 years agopanfrost: Replace writers pointer with hash table
Alyssa Rosenzweig [Tue, 17 Aug 2021 17:16:54 +0000 (17:16 +0000)]
panfrost: Replace writers pointer with hash table

This ensures each context can have a separate batch writing a resource
and we don't race trying to flush each other's batches. Unfortunately
the extra hash table operations regress draw-overhead numbers by about
8% but I'd rather eat the overhead and have an obviously correct
implementation than leave known buggy code in tree.

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

3 years agopanfrost: Remove writer = NULL assignments
Alyssa Rosenzweig [Tue, 17 Aug 2021 17:06:56 +0000 (17:06 +0000)]
panfrost: Remove writer = NULL assignments

These already happened.

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

3 years agopanfrost: Remove rsrc->track.users
Alyssa Rosenzweig [Tue, 17 Aug 2021 16:46:46 +0000 (16:46 +0000)]
panfrost: Remove rsrc->track.users

No longer needed.

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

3 years agopanfrost: Prefer batch->resources to rsrc->users
Alyssa Rosenzweig [Tue, 17 Aug 2021 16:45:17 +0000 (16:45 +0000)]
panfrost: Prefer batch->resources to rsrc->users

This expresses the semantic of the flush only applying to batches within
the context, not globally, in line with OpenGL's multithreading rules.

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

3 years agopanfrost: Add foreach_batch iterator
Alyssa Rosenzweig [Tue, 17 Aug 2021 16:40:53 +0000 (16:40 +0000)]
panfrost: Add foreach_batch iterator

Using the active mask.

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

3 years agopanfrost: Maintain a bitmap of active batches
Alyssa Rosenzweig [Tue, 17 Aug 2021 16:39:40 +0000 (16:39 +0000)]
panfrost: Maintain a bitmap of active batches

This is on the context, so no concurrency issues. This will allow us to
efficiently iterate active batches.

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

3 years agopanfrost: Cache number of users of a resource
Alyssa Rosenzweig [Tue, 17 Aug 2021 16:05:07 +0000 (16:05 +0000)]
panfrost: Cache number of users of a resource

This can be tracked efficiently with atomics, and reduces the places we
use the rsrc->track.users bitmap which has concurrency issues.

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

3 years agopanfrost: Switch resources from an array to a set
Alyssa Rosenzweig [Tue, 17 Aug 2021 15:59:07 +0000 (15:59 +0000)]
panfrost: Switch resources from an array to a set

This will help us reduce shared state and simplify multithreading, at
the expense of additional CPU overhead.

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

3 years agozink: stop referencing framebuffers
Mike Blumenkrantz [Wed, 9 Jun 2021 21:11:42 +0000 (17:11 -0400)]
zink: stop referencing framebuffers

this is a waste of cycles now that surfaces are accurately tracked;
no-attachment fbs are still deferred to avoid premature deletion

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

3 years agozink: defer deletion of no-attachment framebuffers
Mike Blumenkrantz [Tue, 24 Aug 2021 15:28:22 +0000 (11:28 -0400)]
zink: defer deletion of no-attachment framebuffers

the ref on these is owned by the context, so defer deletion to avoid
premature destruction if the fb might be in use

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

3 years agopanfrost: Inline add_fbo_bos
Alyssa Rosenzweig [Mon, 16 Aug 2021 23:55:50 +0000 (23:55 +0000)]
panfrost: Inline add_fbo_bos

Only used once, it's just complicating the batch cache interface.

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

3 years agopanfrost: Remove get_fresh_batch
Alyssa Rosenzweig [Mon, 16 Aug 2021 23:53:07 +0000 (23:53 +0000)]
panfrost: Remove get_fresh_batch

Unused, and of dubious value.

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

3 years agopanfrost: Move bo->label assignment into the lock
Alyssa Rosenzweig [Thu, 12 Aug 2021 23:25:49 +0000 (23:25 +0000)]
panfrost: Move bo->label assignment into the lock

We already took the lock, we just unlocked too early. Since the label is
reset in the BO cache, this is racy. Minimal impact in practice but is
still /wrong/ and caught by helgrind.

Fixes: 3fa1f93dace ("panfrost: Label all BOs in userspace")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12525>

3 years agopanfrost: Don't use ralloc for resources
Alyssa Rosenzweig [Thu, 12 Aug 2021 23:20:44 +0000 (23:20 +0000)]
panfrost: Don't use ralloc for resources

ralloc is not thread safe, so we cannot use a pipe_screen as a ralloc
context unless we lock the screen. The allocation patterns for resources
are trivial, so just use malloc/calloc/free directly instead of ralloc.
This fixes a segfault in:

dEQP-EGL.functional.sharing.gles2.multithread.random.images.copytexsubimage2d.1

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

3 years agopanfrost: Simplify get_fresh_batch_for_fbo
Alyssa Rosenzweig [Thu, 12 Aug 2021 21:17:29 +0000 (21:17 +0000)]
panfrost: Simplify get_fresh_batch_for_fbo

Makes the code easier to read, too.

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

3 years agopanfrost: Remove null check in batch_cleanup
Alyssa Rosenzweig [Thu, 12 Aug 2021 21:10:55 +0000 (21:10 +0000)]
panfrost: Remove null check in batch_cleanup

Shouldn't happen.

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

3 years agopanfrost: Protect the variants array with a lock
Alyssa Rosenzweig [Thu, 12 Aug 2021 20:17:48 +0000 (20:17 +0000)]
panfrost: Protect the variants array with a lock

Without a lock, two threads may bind the same shader CSO simultaneously,
allocate the same variant simultaneously, and then race each other in
the compiler. This manifests in various ways, most commonly failing the
assertion that UBO pushing has only run once. The simple_mtx_t solution
is used in Iris. Fixes the crash in:

dEQP-EGL.functional.sharing.gles2.multithread.simple.buffers.bufferdata_render

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

3 years agopanfrost/ci: Don't skip matrix inverse tests
Alyssa Rosenzweig [Tue, 24 Aug 2021 00:12:54 +0000 (20:12 -0400)]
panfrost/ci: Don't skip matrix inverse tests

Older versions of these tests were buggy and failed on Bifrost. The test
bug has been resolved upstream, but the skip list was not updated when
dEQP was uprevved with the fix. Run the tests.

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

3 years agopanfrost/ci: Switch to suite support
Alyssa Rosenzweig [Tue, 10 Aug 2021 18:22:02 +0000 (14:22 -0400)]
panfrost/ci: Switch to suite support

Use the new deqp-runner suite support to combine our dEQP-GLES2,
dEQP-GLES3, and dEQP-GLES31 jobs into a single job. This simplifies load
balancing, enabling us to expand our test coverage without impacting
wall clock time.

With the new infrastructure in place, we add KHR-GLES* jobs for Mali
G52. This would have caught some recent regressions. Once we hit
conformance it's essential we remain conformant.

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

3 years agonir/gcm: pin some instructions which require uniform sources
Rhys Perry [Wed, 18 Aug 2021 09:52:20 +0000 (10:52 +0100)]
nir/gcm: pin some instructions which require uniform sources

fossil-db (Sienna Cichlid, GCM enabled):
Totals from 6192 (4.12% of 150170) affected shaders:
VGPRs: 548392 -> 542040 (-1.16%)
SpillSGPRs: 3702 -> 3990 (+7.78%); split: -0.54%, +8.32%
CodeSize: 62418488 -> 62481516 (+0.10%); split: -0.07%, +0.17%
MaxWaves: 70582 -> 71718 (+1.61%)
Instrs: 11768497 -> 11795079 (+0.23%); split: -0.07%, +0.30%
Latency: 445891848 -> 523561297 (+17.42%); split: -0.07%, +17.49%
InvThroughput: 115675481 -> 121494913 (+5.03%); split: -0.09%, +5.12%
VClause: 164914 -> 164934 (+0.01%); split: -0.05%, +0.06%
SClause: 405991 -> 395302 (-2.63%); split: -2.64%, +0.00%
Copies: 907216 -> 926429 (+2.12%); split: -1.11%, +3.23%
Branches: 456373 -> 457478 (+0.24%); split: -0.13%, +0.38%
PreSGPRs: 648030 -> 642953 (-0.78%); split: -0.88%, +0.10%
PreVGPRs: 522425 -> 516355 (-1.16%); split: -1.16%, +0.00%

Seems to affect Detroit: Become Human and Cyberpunk 2077. The Cyberpunk
2077 changes look like a fixed bug. At least some of the Detroit: Become
Human changes could probably be removed with better divergence analysis.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12444>

3 years agonir: consider push constant loads as always dynamically uniform
Rhys Perry [Wed, 18 Aug 2021 10:02:21 +0000 (11:02 +0100)]
nir: consider push constant loads as always dynamically uniform

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12444>

3 years agoradv: call nir_lower_flrp() after the first radv_optimize_nir()
Daniel Schürmann [Wed, 24 Jun 2020 16:47:09 +0000 (17:47 +0100)]
radv: call nir_lower_flrp() after the first radv_optimize_nir()

instead of inside the optimization loop

Totals from 2504 (1.67% of 150170) affected shaders: (GFX10.3)
VGPRs: 162592 -> 162416 (-0.11%); split: -0.12%, +0.01%
CodeSize: 18399756 -> 18383552 (-0.09%); split: -0.10%, +0.01%
MaxWaves: 42654 -> 42748 (+0.22%)
Instrs: 3499404 -> 3497075 (-0.07%); split: -0.08%, +0.01%
Latency: 87087238 -> 87064270 (-0.03%); split: -0.06%, +0.03%
InvThroughput: 21159621 -> 21150546 (-0.04%); split: -0.05%, +0.01%
VClause: 56653 -> 56667 (+0.02%); split: -0.00%, +0.03%
Copies: 226332 -> 226423 (+0.04%); split: -0.15%, +0.19%
Branches: 110027 -> 110025 (-0.00%); split: -0.05%, +0.04%
PreSGPRs: 168087 -> 168076 (-0.01%); split: -0.01%, +0.00%
PreVGPRs: 160814 -> 160705 (-0.07%)

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

3 years agonir/opt_algebraic: optimize flrp(fadd, fadd, x) only if fadd are used_once
Daniel Schürmann [Fri, 23 Jul 2021 10:16:12 +0000 (12:16 +0200)]
nir/opt_algebraic: optimize flrp(fadd, fadd, x) only if fadd are used_once

Totals from 201 (0.13% of 150170) affected shaders: (GFX10.3)
VGPRs: 13880 -> 13856 (-0.17%)
CodeSize: 1517328 -> 1518124 (+0.05%); split: -0.04%, +0.10%
MaxWaves: 3184 -> 3192 (+0.25%)
Instrs: 285487 -> 285569 (+0.03%); split: -0.06%, +0.08%
Latency: 7774066 -> 7780877 (+0.09%); split: -0.10%, +0.19%
InvThroughput: 1936341 -> 1935287 (-0.05%); split: -0.07%, +0.02%
SClause: 11446 -> 11448 (+0.02%); split: -0.01%, +0.03%
Copies: 17500 -> 17506 (+0.03%); split: -0.51%, +0.55%
Branches: 8174 -> 8180 (+0.07%); split: -0.13%, +0.21%
PreVGPRs: 12507 -> 12427 (-0.64%)

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

3 years agonir/loop_analyze: consider instruction cost of nir_op_flrp
Daniel Schürmann [Fri, 23 Jul 2021 10:15:57 +0000 (12:15 +0200)]
nir/loop_analyze: consider instruction cost of nir_op_flrp

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

3 years agovenus: use uint32_t in vn_ring_submit
Chia-I Wu [Fri, 20 Aug 2021 22:20:58 +0000 (15:20 -0700)]
venus: use uint32_t in vn_ring_submit

And in vn_ring_write_buffer as well, to fix the assert in
vn_ring_write_buffer.

The ring code uses 32-bit unsigned integers and relies on that their
overflow/underflow behavior is well-defined.  When ring->shared.head is
about to overflow and ring->cur has overflowed, this expression

  ring->cur + size - vn_ring_load_head(ring)

gives an incorrect result when size is 64-bit.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12494>

3 years agoglthread: implement glGetUniformLocation without syncing
Marek Olšák [Thu, 19 Aug 2021 00:16:38 +0000 (20:16 -0400)]
glthread: implement glGetUniformLocation without syncing

We already have the infrastructure for querying shader program properties
without syncing. This just uses it. _mesa_error_glthread_safe sets a GL
error from the producer thread.

This decreases CPU overhead for viewperf/snx.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12490>

3 years agogallium: change pipe_draw_info::mode to uint8_t on MSVC to make it 1 byte large
Marek Olšák [Fri, 20 Aug 2021 02:51:11 +0000 (22:51 -0400)]
gallium: change pipe_draw_info::mode to uint8_t on MSVC to make it 1 byte large

needed by u_threaded_context

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12480>

3 years agogallium: use a packed enum to make pipe_prim_mode 1-byte large with __GNUC__
Marek Olšák [Fri, 20 Aug 2021 14:46:54 +0000 (10:46 -0400)]
gallium: use a packed enum to make pipe_prim_mode 1-byte large with __GNUC__

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12480>

3 years agozink: only force all buffer rebinds if rebinds exist on other contexts
Mike Blumenkrantz [Thu, 3 Jun 2021 19:28:44 +0000 (15:28 -0400)]
zink: only force all buffer rebinds if rebinds exist on other contexts

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

3 years agozink: rebind all buffers on replacement
Mike Blumenkrantz [Thu, 3 Jun 2021 19:20:34 +0000 (15:20 -0400)]
zink: rebind all buffers on replacement

in theory it's possible to trigger cases where rebinds aren't based on the
current context, so ensure that (very unlikely) case is handled

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

3 years agozink: count streamout rebinds when doing buffer rebinds
Mike Blumenkrantz [Thu, 3 Jun 2021 19:31:48 +0000 (15:31 -0400)]
zink: count streamout rebinds when doing buffer rebinds

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

3 years agozink: add bind counts for so bindings
Mike Blumenkrantz [Thu, 3 Jun 2021 19:07:58 +0000 (15:07 -0400)]
zink: add bind counts for so bindings

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

3 years agozink: split out buffer rebinds to helper functions
Mike Blumenkrantz [Thu, 3 Jun 2021 18:55:20 +0000 (14:55 -0400)]
zink: split out buffer rebinds to helper functions

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

3 years agozink: make descriptor update functions return the updated resource
Mike Blumenkrantz [Thu, 3 Jun 2021 19:09:24 +0000 (15:09 -0400)]
zink: make descriptor update functions return the updated resource

convenience++

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

3 years agozink: clear out all ubo rebinds first if they exist
Mike Blumenkrantz [Fri, 14 May 2021 23:07:27 +0000 (19:07 -0400)]
zink: clear out all ubo rebinds first if they exist

these are the second most common rebind, so iterate them all first

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

3 years agoradv: use nir_vector_insert_imm in lower_intrinsics
Rhys Perry [Thu, 19 Aug 2021 09:41:07 +0000 (10:41 +0100)]
radv: use nir_vector_insert_imm in lower_intrinsics

This creates a single nir_op_vecn instead of a nir_op_vecn and several
copies.

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

3 years agonir/lower_io: use nir_vector_insert_imm()
Rhys Perry [Thu, 19 Aug 2021 09:40:17 +0000 (10:40 +0100)]
nir/lower_io: use nir_vector_insert_imm()

This creates a single nir_op_vecn instead of a nir_op_vecn and several
copies.

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

3 years agogitlab-ci: Fix octopus device type and tag
Guilherme Gallo [Mon, 23 Aug 2021 13:30:37 +0000 (10:30 -0300)]
gitlab-ci: Fix octopus device type and tag

* This month, the octopus device was renamed on Collabora's LAVA lab, so
  we need to update it to get it working again on Mesa CI.

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

3 years agoRevert "nir/opt_algebraic: optimize fmax(-fmin(b, a), b) -> fmax(b, -a)"
Samuel Pitoiset [Tue, 24 Aug 2021 06:04:06 +0000 (08:04 +0200)]
Revert "nir/opt_algebraic: optimize fmax(-fmin(b, a), b) -> fmax(b, -a)"

This is wrong for negative values.

This reverts commit 07cd30ca293d1eb6980f69f330f9d182652cf902.

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

3 years agolavapipe: fix reported subpixel precision for lines
Erik Faye-Lund [Mon, 9 Aug 2021 06:40:42 +0000 (08:40 +0200)]
lavapipe: fix reported subpixel precision for lines

We have no reason to report a subpixel precision of 4 for lines; in fact
LLVMpipe uses 8 subpixel bits for lines, similar to other primitives.
But let's use the pipe-cap for this instead of hard-coding it.

Fixes: 9fbf6b2abff ("lavapipe: implement VK_EXT_line_rasterization")
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12277>

3 years agobroadcom/compiler: Fix qpu.flags.muf typo.
Vinson Lee [Mon, 16 Aug 2021 07:47:26 +0000 (00:47 -0700)]
broadcom/compiler: Fix qpu.flags.muf typo.

Fix defect reported by Coverity Scan.

Same on both sides (CONSTANT_EXPRESSION_RESULT)
pointless_expression: The expression inst->qpu.flags.auf !=
V3D_QPU_UF_NONE || inst->qpu.flags.auf != V3D_QPU_UF_NONE does not
accomplish anything because it evaluates to either of its identical
operands, inst->qpu.flags.auf != V3D_QPU_UF_NONE.

Fixes: 3f2c54a27ff ("broadcom/compiler: rewrite partial update liveness tracking")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12385>

3 years agollvmpipe: improve polygon-offset precision
Erik Faye-Lund [Mon, 23 Aug 2021 14:07:47 +0000 (16:07 +0200)]
llvmpipe: improve polygon-offset precision

This performs the polygon offset addition after interpolation, which
prevents floating-point cancellation issues completely.

This does mean that we have to perform a single floating-point addition
more per fragment than before, unless we also want to spend a bit in
the fragment-shader variant key to avoid this.

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

3 years agollvmpipe: split coefficient calculation and store
Erik Faye-Lund [Mon, 23 Aug 2021 13:52:46 +0000 (15:52 +0200)]
llvmpipe: split coefficient calculation and store

This will be used for some underhanded smuggling of values in the next
commit.

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