platform/upstream/mesa.git
4 years agoradv: Fix event write cmdbuffer allocation when tracing.
Bas Nieuwenhuizen [Thu, 8 Oct 2020 10:34:30 +0000 (12:34 +0200)]
radv: Fix event write cmdbuffer allocation when tracing.

The trace emit is another 7 words.

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

4 years agoradv: remove one leftover TODO in the shader info pass
Samuel Pitoiset [Tue, 6 Oct 2020 06:46:15 +0000 (08:46 +0200)]
radv: remove one leftover TODO in the shader info pass

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7022>

4 years agoradv/llvm: reduce LDS size for tess by using NIR IO assigned locations
Samuel Pitoiset [Fri, 2 Oct 2020 11:36:05 +0000 (13:36 +0200)]
radv/llvm: reduce LDS size for tess by using NIR IO assigned locations

To match ACO.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7022>

4 years agoradv/llvm: reduce the ESGS itemsize by using NIR IO assigned locations
Samuel Pitoiset [Fri, 2 Oct 2020 11:21:18 +0000 (13:21 +0200)]
radv/llvm: reduce the ESGS itemsize by using NIR IO assigned locations

There is no longer gaps in the ESGS ring.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7022>

4 years agoradv/llvm: switch to NIR IO assigned locations
Samuel Pitoiset [Tue, 6 Oct 2020 06:38:58 +0000 (08:38 +0200)]
radv/llvm: switch to NIR IO assigned locations

To match ACO.

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

4 years agoac/nir: pass the variable location to store_tcs_outputs
Samuel Pitoiset [Mon, 5 Oct 2020 08:22:00 +0000 (10:22 +0200)]
ac/nir: pass the variable location to store_tcs_outputs

It's actually simpler for the backend to know the variable location.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7022>

4 years agoac,radv,radeonsi: stop multiplying driver_location by 4
Samuel Pitoiset [Mon, 5 Oct 2020 13:41:33 +0000 (15:41 +0200)]
ac,radv,radeonsi: stop multiplying driver_location by 4

It's no longer needed to do that.

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

4 years agoradv/llvm: stop assigning driver_location in NIR->LLVM
Samuel Pitoiset [Mon, 5 Oct 2020 13:36:27 +0000 (15:36 +0200)]
radv/llvm: stop assigning driver_location in NIR->LLVM

It's already assigned just after NIR linking shaders.

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

4 years agonir: Allow more deref modes in phis
Jason Ekstrand [Thu, 8 Oct 2020 04:05:25 +0000 (23:05 -0500)]
nir: Allow more deref modes in phis

In particular, OpenCL needs to allow shader_temp and function_temp
through because they're 100% real pointers.

Fixes piglit CL calls.cl

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

4 years agoandroid: util: Move xxd.py to util
Mauro Rossi [Sat, 10 Oct 2020 12:48:22 +0000 (14:48 +0200)]
android: util: Move xxd.py to util

Android porting of gen rules as per 22ffc05266c6 ("util: Move xxd.py to util")

Fixes the following building error:

ninja: error: 'external/mesa/src/compiler/glsl/xxd.py', needed by 'out/target/product/x86_64/gen/STATIC_LIBRARIES/libmesa_glsl_intermediates/glsl/float64_glsl.h', missing and no known rule to make it

Fixes: 22ffc05266c6 ("util: Move xxd.py to util")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7087>

4 years agovc4: enable lower_isign for VC4
Jose Maria Casanova Crespo [Sat, 10 Oct 2020 11:19:39 +0000 (12:19 +0100)]
vc4: enable lower_isign for VC4

Since 1e7d82c8813647 ("nir/algebraic: always lower idiv
to shifts if bitops are allowed") idiv is lowered and
generates a isign operation.

VC4 HW doesn't support isign and lower_isign wasn't enabled.
Enabling it fixes the regressions caused by this new
optimization on piglit tests shaders/glsl-fs-loop-nested.

Fixes: 1e7d82c8813647 ("nir/algebraic: always lower idiv to shifts if bitops are allowed")
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7089>

4 years agopan/bi: Range check newc/oldc when rewriting
Alyssa Rosenzweig [Sat, 10 Oct 2020 20:46:49 +0000 (16:46 -0400)]
pan/bi: Range check newc/oldc when rewriting

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

4 years agopan/bi: Disable mediump output lowering
Alyssa Rosenzweig [Fri, 9 Oct 2020 14:45:44 +0000 (10:45 -0400)]
pan/bi: Disable mediump output lowering

Without fp16, this is useless for now.

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

4 years agopanfrost: Temporarily disable FP16 on Bifrost
Alyssa Rosenzweig [Fri, 9 Oct 2020 14:44:21 +0000 (10:44 -0400)]
panfrost: Temporarily disable FP16 on Bifrost

There are some missing bits for FP16 to work on more complicated Bifrost
tests. Towards conformance let's disable FP16 on Bifrost and reenable
when these issues are sorted (principally, swizzle lowering).

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

4 years agopanfrost: Set "shader modifies coverage?" flag
Alyssa Rosenzweig [Thu, 8 Oct 2020 23:59:15 +0000 (19:59 -0400)]
panfrost: Set "shader modifies coverage?" flag

Principally when DISCARD is used.

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

4 years agopanfrost: Update XML for Bifrost early-z/FPK
Alyssa Rosenzweig [Thu, 8 Oct 2020 23:46:21 +0000 (19:46 -0400)]
panfrost: Update XML for Bifrost early-z/FPK

Had bits scrambled during RE.

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

4 years agopan/bi: Implement FETCH
Alyssa Rosenzweig [Thu, 8 Oct 2020 23:30:44 +0000 (19:30 -0400)]
pan/bi: Implement FETCH

For texelFetch. A few earlier header fields were wrong.

Fixes dEQP-GLES2.functional.texture.mipmap.2d.generate.rgba8888_fastest

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

4 years agopan/bi: Add bi_emit_lod_cube helper
Alyssa Rosenzweig [Thu, 8 Oct 2020 23:31:41 +0000 (19:31 -0400)]
pan/bi: Add bi_emit_lod_cube helper

There's a different LOD format used for TXF that will be able to
accomodate cube maps as well.

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

4 years agopan/bi: Map NIR tex ops to Bifrost ops
Alyssa Rosenzweig [Thu, 8 Oct 2020 23:01:29 +0000 (19:01 -0400)]
pan/bi: Map NIR tex ops to Bifrost ops

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

4 years agopanfrost: Fix faults on block-based formats on Bifrost
Alyssa Rosenzweig [Thu, 8 Oct 2020 22:51:43 +0000 (18:51 -0400)]
panfrost: Fix faults on block-based formats on Bifrost

Fixes

dEQP-GLES2.functional.texture.filtering.2d.nearest_nearest_clamp_etc1

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

4 years agopan/bi: Use new block dimension helper
Alyssa Rosenzweig [Thu, 8 Oct 2020 22:35:17 +0000 (18:35 -0400)]
pan/bi: Use new block dimension helper

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

4 years agopanfrost: Add panfrost_block_dim helper
Alyssa Rosenzweig [Thu, 8 Oct 2020 22:34:48 +0000 (18:34 -0400)]
panfrost: Add panfrost_block_dim helper

So we can calculate strides of block-based formats correctly. Will help
us down the road for Bifrost AFBC.

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

4 years agopan/bi: Don't terminate helper threads
Alyssa Rosenzweig [Thu, 8 Oct 2020 18:36:56 +0000 (14:36 -0400)]
pan/bi: Don't terminate helper threads

Fixes our filtering fails. Roughly equivalent to the .kill texture
bit on Midgard. We'll need to port the dataflow analysis over along with
the .skip analysis, but for now this will suffice.

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

4 years agopan/bi: Fix message type printing
Alyssa Rosenzweig [Thu, 8 Oct 2020 18:21:49 +0000 (14:21 -0400)]
pan/bi: Fix message type printing

Lazy copy/pasting fail.

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

4 years agopanfrost: Set helper_invocation_enable for Bifrost
Alyssa Rosenzweig [Wed, 7 Oct 2020 22:50:34 +0000 (18:50 -0400)]
panfrost: Set helper_invocation_enable for Bifrost

Actually, this is for barriers, field name is wrong. But it's the same
as Midgard.

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

4 years agopan/bi: Implement txb
Alyssa Rosenzweig [Wed, 7 Oct 2020 22:32:32 +0000 (18:32 -0400)]
pan/bi: Implement txb

Also uses the 8.8 signed fixed-point format.

dEQP-GLES2.functional.shaders.texture_functions.fragment.texture2d_bias

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

4 years agopanfrost: Add some missing Bifrost texture XML
Alyssa Rosenzweig [Wed, 7 Oct 2020 02:00:49 +0000 (22:00 -0400)]
panfrost: Add some missing Bifrost texture XML

Still incomplete due to many states, but this is a start.

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

4 years agopanfrost: Fix Bifrost high LOD clamp
Alyssa Rosenzweig [Wed, 7 Oct 2020 01:46:56 +0000 (21:46 -0400)]
panfrost: Fix Bifrost high LOD clamp

Broke mipmapping.

Fixes: ad0b32cdbd5 ("panfrost: XMLify Bifrost textures")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>

4 years agopanfrost: Fix Bifrost filter selection
Alyssa Rosenzweig [Wed, 7 Oct 2020 01:31:18 +0000 (21:31 -0400)]
panfrost: Fix Bifrost filter selection

Point sampling is jargon for nearest, apparently. Fixes

dEQP-GLES2.functional.texture.filtering.2d.nearest_nearest_clamp_rgba8888_pot

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

4 years agopanfrost: Add missing XML for Bifrost samplers
Alyssa Rosenzweig [Wed, 7 Oct 2020 01:29:05 +0000 (21:29 -0400)]
panfrost: Add missing XML for Bifrost samplers

This is now complete and mostly canonical.

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

4 years agopan/bi: Prefer 'texture_index' to 'image_index'
Alyssa Rosenzweig [Tue, 6 Oct 2020 16:28:47 +0000 (12:28 -0400)]
pan/bi: Prefer 'texture_index' to 'image_index'

They're not images. Making the executive decision to fix the notation.
Not canonical.

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

4 years agopan/bi: Rewrite to fit dest = src constraint
Alyssa Rosenzweig [Tue, 6 Oct 2020 16:14:32 +0000 (12:14 -0400)]
pan/bi: Rewrite to fit dest = src constraint

Needed for TEXC as well as atomics.

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

4 years agopan/bi: Pack TEXC
Alyssa Rosenzweig [Tue, 6 Oct 2020 15:50:12 +0000 (11:50 -0400)]
pan/bi: Pack TEXC

1-line change, thanks to the generator magic.

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

4 years agopan/bi: Handle nir_tex_src_lod
Alyssa Rosenzweig [Tue, 6 Oct 2020 15:46:50 +0000 (11:46 -0400)]
pan/bi: Handle nir_tex_src_lod

We need to emit some lowering code to convert it to the 8:8 format
expected by the hardware.

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

4 years agopan/bi: Add data register passing infrastructure
Alyssa Rosenzweig [Tue, 6 Oct 2020 15:32:55 +0000 (11:32 -0400)]
pan/bi: Add data register passing infrastructure

Lower to a COMBINE, which in turn will lower to moves so RA does the
right thing.

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

4 years agopan/bi: Stub out TEXC handling
Alyssa Rosenzweig [Tue, 6 Oct 2020 15:18:16 +0000 (11:18 -0400)]
pan/bi: Stub out TEXC handling

We still need to handle actual complex texturing instructions, as well
as packing, but this is the start.

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

4 years agopan/bi: Add texture operator descriptor
Alyssa Rosenzweig [Wed, 23 Sep 2020 17:57:52 +0000 (13:57 -0400)]
pan/bi: Add texture operator descriptor

Used to encode all the different texture modes.

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

4 years agopan/bi: Pack skip bit for texture operations
Alyssa Rosenzweig [Tue, 6 Oct 2020 14:45:11 +0000 (10:45 -0400)]
pan/bi: Pack skip bit for texture operations

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

4 years agopan/bi: Encode skip bit into IR
Alyssa Rosenzweig [Tue, 6 Oct 2020 14:42:39 +0000 (10:42 -0400)]
pan/bi: Encode skip bit into IR

Currently unset.

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

4 years agopan/bi: Streamline TEXC/TEXS naming/selection
Alyssa Rosenzweig [Tue, 6 Oct 2020 14:40:16 +0000 (10:40 -0400)]
pan/bi: Streamline TEXC/TEXS naming/selection

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

4 years agopan/bi: Use canonical texture op names in IR
Alyssa Rosenzweig [Tue, 6 Oct 2020 14:31:04 +0000 (10:31 -0400)]
pan/bi: Use canonical texture op names in IR

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

4 years agopan/bi: Fix simple txl test
Alyssa Rosenzweig [Tue, 6 Oct 2020 14:24:56 +0000 (10:24 -0400)]
pan/bi: Fix simple txl test

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 731dfc6066d ("pan/bi: Allow vertex txl with lod=0 as compact")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>

4 years agopan/bi: Expose GL 2.1 on Bifrost
Alyssa Rosenzweig [Fri, 2 Oct 2020 20:41:53 +0000 (16:41 -0400)]
pan/bi: Expose GL 2.1 on Bifrost

Needed for glamor. These features should work fine.

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

4 years agopan/bi: Handle vector moves
Alyssa Rosenzweig [Fri, 2 Oct 2020 19:49:55 +0000 (15:49 -0400)]
pan/bi: Handle vector moves

And fix the bad assertion that let this slip.

Like combines, nir_op_vec can be vector, and we need to lower this
ourselves. Thankfully, the lowering is simple.

Fixes
dEQP-GLES2.functional.shaders.loops.for_uniform_iterations.nested_tricky_dataflow_1_*

Fixes: b2c6cf2b6db ("pan/bi: Eliminate writemasks in the IR")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>

4 years agopan/bi: Pass flow_control through directly
Alyssa Rosenzweig [Fri, 2 Oct 2020 19:13:29 +0000 (15:13 -0400)]
pan/bi: Pass flow_control through directly

More than just a single bool!

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

4 years agopan/bi: Use canonical flow control enum
Alyssa Rosenzweig [Fri, 2 Oct 2020 19:03:58 +0000 (15:03 -0400)]
pan/bi: Use canonical flow control enum

Merges multiple bits and adds some new combinations. The semantics are
the compiler are evidently wrong, we'll fix that next.

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

4 years agopan/bi: Use canonical term dependency
Alyssa Rosenzweig [Fri, 2 Oct 2020 18:12:45 +0000 (14:12 -0400)]
pan/bi: Use canonical term dependency

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

4 years agopan/bi: Use canonical term "message type"
Alyssa Rosenzweig [Fri, 2 Oct 2020 18:02:25 +0000 (14:02 -0400)]
pan/bi: Use canonical term "message type"

These identify the type of message produced by a message-passing
instruction, rather than information about the clause per se.

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

4 years agopan/bi: Print message types as strings
Alyssa Rosenzweig [Fri, 2 Oct 2020 18:01:22 +0000 (14:01 -0400)]
pan/bi: Print message types as strings

Even if we're not in verbose mode to match the canonical syntax.

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

4 years agopan/bi: Add missing message types
Alyssa Rosenzweig [Fri, 2 Oct 2020 17:57:59 +0000 (13:57 -0400)]
pan/bi: Add missing message types

Names are not canonical but that's ok.

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

4 years agopan/bi: Expand clause type to 5-bit
Alyssa Rosenzweig [Fri, 2 Oct 2020 17:54:09 +0000 (13:54 -0400)]
pan/bi: Expand clause type to 5-bit

The upper bit is reserved.

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

4 years agopan/bi: Use canonical name for staging registers
Alyssa Rosenzweig [Fri, 2 Oct 2020 17:53:03 +0000 (13:53 -0400)]
pan/bi: Use canonical name for staging registers

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

4 years agopan/bi: Use canonical next_clause_prefetch
Alyssa Rosenzweig [Fri, 2 Oct 2020 17:46:35 +0000 (13:46 -0400)]
pan/bi: Use canonical next_clause_prefetch

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

4 years agopan/bi: Canonicalize terminate_discarded_threads
Alyssa Rosenzweig [Fri, 2 Oct 2020 17:27:15 +0000 (13:27 -0400)]
pan/bi: Canonicalize terminate_discarded_threads

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

4 years agopan/bi: Use canonical floating-point modes
Alyssa Rosenzweig [Fri, 2 Oct 2020 17:23:33 +0000 (13:23 -0400)]
pan/bi: Use canonical floating-point modes

First few pre-clause modifiers.

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

4 years agopan/bi: Cull unnecessary edges on the CF graph
Alyssa Rosenzweig [Fri, 2 Oct 2020 17:06:54 +0000 (13:06 -0400)]
pan/bi: Cull unnecessary edges on the CF graph

If a block ends in an unconditional jump, we don't need to record a
fallthrough successor as well, since it's unreachable.

Likely harmless but makes the IR harder to parse with messy CF graphs.

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

4 years agopan/bi: Drop if 0'd combine lowering
Alyssa Rosenzweig [Fri, 2 Oct 2020 16:49:44 +0000 (12:49 -0400)]
pan/bi: Drop if 0'd combine lowering

This is supposed to be optimized but actually just broken. When we look
at optimizing this later we'll probably want a more straightforward copy
prop pass instead.

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

4 years agopan/bi: Fix memory corruption in scheduler
Alyssa Rosenzweig [Sun, 27 Sep 2020 23:45:50 +0000 (19:45 -0400)]
pan/bi: Fix memory corruption in scheduler

If empty the last will be bogus, I think. Missing Rust hard right around
now.

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

4 years agopan/decode: Ensure mappings are zeroed
Alyssa Rosenzweig [Thu, 24 Sep 2020 23:13:43 +0000 (19:13 -0400)]
pan/decode: Ensure mappings are zeroed

Fixes valgrind error when running with =sync

==30966== Conditional jump or move depends on uninitialised value(s)
==30966==    at 0x5B424E8: pandecode_find_mapped_gpu_mem_containing (decode_common.c:56)
==30966==    by 0x5B4CFB7: pandecode_jc (decode.c:2075)
==30966==    by 0x5ABBFA7: panfrost_batch_submit_ioctl (pan_job.c:1020)
==30966==    by 0x5ABD397: panfrost_batch_submit_jobs (pan_job.c:1042)
==30966==    by 0x5ABD397: panfrost_batch_submit (pan_job.c:1109)

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

4 years agopan/bi: Add copy for register COMBINEs
Alyssa Rosenzweig [Fri, 2 Oct 2020 16:27:25 +0000 (12:27 -0400)]
pan/bi: Add copy for register COMBINEs

Fixes:

dEQP-GLES2.functional.shaders.loops.for_constant_iterations.infinite_with_conditional_break_fragment

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

4 years agoci: piglit: conditionally build OpenCL tests
Christian Gmeiner [Fri, 9 Oct 2020 09:00:23 +0000 (11:00 +0200)]
ci: piglit: conditionally build OpenCL tests

For baremetal piglit this is not yet needed.

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

4 years agovc4: Enable lower_umax and lower_umin
Jose Maria Casanova Crespo [Fri, 9 Oct 2020 16:40:45 +0000 (18:40 +0200)]
vc4: Enable lower_umax and lower_umin

VC4 doesn't have support for UMAX and UMIN integer operations. So
we should avoid algebraic optimizations that generate umax/umin ops.

Fixes: 8e1b75b330954a ("nir/algebraic: optimize iand/ior of (n)eq zero")
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7083>

4 years agonir/algebraic: optimize iand/ior of (n)eq zero when umax/umin not available
Jose Maria Casanova Crespo [Fri, 9 Oct 2020 16:33:26 +0000 (18:33 +0200)]
nir/algebraic: optimize iand/ior of (n)eq zero when umax/umin not available

Before 8e1b75b330954a ("nir/algebraic: optimize iand/ior of (n)eq zero") this
optimization didn't need the use of umax/umin. VC4 HW supports only signed
integer max/min operations.

lower_umin and lower_umax are added to allow enabling previous optimizations
behaviour for this cases.

Fixes: 8e1b75b330954a ("nir/algebraic: optimize iand/ior of (n)eq zero")
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7083>

4 years agopanfrost: Add a debug flag to disable AFBC
Icecream95 [Fri, 9 Oct 2020 09:39:40 +0000 (22:39 +1300)]
panfrost: Add a debug flag to disable AFBC

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

4 years agoradeonsi: disable SDMA on gfx6-7 and gfx10.3 to decrease CPU overhead
Marek Olšák [Tue, 6 Oct 2020 10:51:36 +0000 (06:51 -0400)]
radeonsi: disable SDMA on gfx6-7 and gfx10.3 to decrease CPU overhead

same as gfx8-10

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7055>

4 years agoradeonsi: update the DMA perf test
Marek Olšák [Mon, 5 Oct 2020 04:55:55 +0000 (00:55 -0400)]
radeonsi: update the DMA perf test

- don't test 2 waves/SA
- create the compute shader only once per subtest
- use only 1 TIME_ELAPSED query per subtest
- don't invalidate sL0 (it's not used)
- don't invalidate L2 for L2_LRU to test L2 throughput
- don't flush the CS after every run
- remove unused min/max computation

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7055>

4 years agowinsys/amdgpu: apply the VM alignment optimization to the physical alignment too
Marek Olšák [Mon, 5 Oct 2020 05:06:33 +0000 (01:06 -0400)]
winsys/amdgpu: apply the VM alignment optimization to the physical alignment too

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7055>

4 years agowinsys/amdgpu: rework the VM alignment optimizations
Marek Olšák [Mon, 5 Oct 2020 05:05:44 +0000 (01:05 -0400)]
winsys/amdgpu: rework the VM alignment optimizations

- don't increase the alignment past 2 MB
- apply the second tweak to older chips too

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7055>

4 years agoac/surface: fix valgrind warnings in DCC retile tile lookups
Marek Olšák [Tue, 6 Oct 2020 11:06:30 +0000 (07:06 -0400)]
ac/surface: fix valgrind warnings in DCC retile tile lookups

==12920== Conditional jump or move depends on uninitialised value(s)
==12920==    at 0x8F39391: util_fast_urem32 (fast_urem_by_const.h:71)
==12920==    by 0x8F39391: hash_table_search (hash_table.c:285)
==12920==    by 0x8B06D5D: ac_compute_dcc_retile_tile_indices (ac_surface.c:136)

Fixes: a37aeb128d5f7c "amd/common: Cache intra-tile addresses for retile map."

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7055>

4 years agoCI: build our own spirv tools
Dave Airlie [Fri, 9 Oct 2020 02:07:31 +0000 (12:07 +1000)]
CI: build our own spirv tools

This causes a lot of hiccups on the CL tests, but I've got most of
them fixed in another MR in pieces.

This should at least give a much more realistic baseline.

v2: use script in both places

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7073>

4 years agoci: fix deqp clone + fetch
Dave Airlie [Fri, 9 Oct 2020 19:53:12 +0000 (05:53 +1000)]
ci: fix deqp clone + fetch

This was taking > 10 minutes and I got bored, don't do a depth 1 fetch
in the first place just to do a proper fetch later.

Acked-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7073>

4 years agodisk_cache: build option for disabled-by-default
John Bates [Thu, 1 Oct 2020 01:35:02 +0000 (18:35 -0700)]
disk_cache: build option for disabled-by-default

On some systems it is problematic to have the shader cache enabled
by default. This adds a build option to support the disk cache but
keep it disabled unless the environment variable
MESA_GLSL_CACHE_DISABLE=false.

For example, on Chrome OS, Chrome already has it's own shader
disk cache implementation so it disables the mesa feature. Tests
do not want the shader disk cache enabled because it can cause
inconsistent performance results and the default 1GB for the
disk cache could lead to problems that require more effort to
work around. The Mesa shader disk cache is useful for VMs though,
where it is easy to configure the feature with environment
variables. With the current version of Mesa, Chrome OS would need
to have a system-wide environment variable to disable the disk
cache everywhere except where needed. More elegant to just build
Mesa with the cache feature disabled by default.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6967>

4 years agoradv: use radv_optimize_nir() less in radv_link_shaders()
Rhys Perry [Mon, 21 Sep 2020 14:56:40 +0000 (15:56 +0100)]
radv: use radv_optimize_nir() less in radv_link_shaders()

fossil-db (Navi):
Totals from 11 (0.01% of 137413) affected shaders:
CodeSize: 99372 -> 99480 (+0.11%)
Instrs: 19119 -> 19110 (-0.05%)
Cycles: 222144 -> 222000 (-0.06%)

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

4 years agoradv: move optimizations in shader_compile_to_nir() to after io_to_scalar
Rhys Perry [Mon, 21 Sep 2020 13:32:36 +0000 (14:32 +0100)]
radv: move optimizations in shader_compile_to_nir() to after io_to_scalar

This results in at least one less radv_optimize_nir() iteration.

No fossil-db changes.

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

4 years agonir: return progress from nir_lower_io_to_scalar_early
Rhys Perry [Mon, 21 Sep 2020 14:56:25 +0000 (15:56 +0100)]
nir: return progress from nir_lower_io_to_scalar_early

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

4 years agopanfrost: Move the blend shader cache at the context level
Boris Brezillon [Thu, 8 Oct 2020 12:17:23 +0000 (14:17 +0200)]
panfrost: Move the blend shader cache at the context level

Blend shaders can be shared among blend states, so let's move the blend
shader one level up so we don't have to re-create/re-compile shaders
when another blend state already asked for it.

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

4 years agopanfrost: Get rid of the constant patching done on blend shader binaries
Boris Brezillon [Thu, 8 Oct 2020 08:58:53 +0000 (10:58 +0200)]
panfrost: Get rid of the constant patching done on blend shader binaries

When constants are used in the blend equation we simply recompile the
shader.

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

4 years agopanfrost: Let compile_blend_shader() allocate the blend shader object
Boris Brezillon [Thu, 8 Oct 2020 08:52:30 +0000 (10:52 +0200)]
panfrost: Let compile_blend_shader() allocate the blend shader object

This way we avoid an extra copy in panfrost_get_blend_shader().
Note that the allocation is attached to the blend state object
which simplifies the delete_blend_state() path.

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

4 years agopanfrost: Don't leak NIR blend shaders
Boris Brezillon [Thu, 8 Oct 2020 08:20:45 +0000 (10:20 +0200)]
panfrost: Don't leak NIR blend shaders

Right now we create shaders that are not attached to any memory
context, leading to memory leaks. Ideally, we should free the NIR
shader as soon as we've turned it into a binary, but there's no
function explicitly destroy a shader. Let's attach those to the blend
state so they get destroyed when this state is freed.

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

4 years agopanfrost: Allocate blit_blend with ralloc()
Boris Brezillon [Thu, 8 Oct 2020 08:49:12 +0000 (10:49 +0200)]
panfrost: Allocate blit_blend with ralloc()

This way we can use blend states as memory context which will help
simplify the blend shader creation/destruction logic.

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

4 years agopanfrost: Pass compile arguments through a struct
Boris Brezillon [Thu, 8 Oct 2020 08:09:56 +0000 (10:09 +0200)]
panfrost: Pass compile arguments through a struct

So we can extend it more easily without having to patch all callers.

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

4 years agopanfrost: Move the blend constant mask extraction out of make_fixed_blend_mode()
Boris Brezillon [Thu, 8 Oct 2020 08:25:13 +0000 (10:25 +0200)]
panfrost: Move the blend constant mask extraction out of make_fixed_blend_mode()

This way we can get a constant mask for the blend shader case too.

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

4 years agopanfrost: Constify the rt_fmts arg passed to pan_lower_framebuffer()
Boris Brezillon [Thu, 8 Oct 2020 08:04:48 +0000 (10:04 +0200)]
panfrost: Constify the rt_fmts arg passed to pan_lower_framebuffer()

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

4 years agoradv: Set fce metadata correctly on DCC initialization.
Bas Nieuwenhuizen [Mon, 5 Oct 2020 11:45:36 +0000 (13:45 +0200)]
radv: Set fce metadata correctly on DCC initialization.

The fce metadata can always be set to false as we don't care about
the compressed clear color.

Avoiding useless fast clear eliminates improves basemark performance by
1%-1.5%.

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

4 years agoaco/ngg: Calculate workgroup size of NGG shaders.
Timur Kristóf [Mon, 5 Oct 2020 13:30:18 +0000 (15:30 +0200)]
aco/ngg: Calculate workgroup size of NGG shaders.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Allocate NGG GS space early for const vertex/primitive counts.
Timur Kristóf [Fri, 2 Oct 2020 15:10:43 +0000 (17:10 +0200)]
aco/ngg: Allocate NGG GS space early for const vertex/primitive counts.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Use more efficient LDS layout to help reduce bank conflicts.
Timur Kristóf [Fri, 2 Oct 2020 12:31:40 +0000 (14:31 +0200)]
aco/ngg: Use more efficient LDS layout to help reduce bank conflicts.

The LLVM backend has a trick which helps reduce LDS bank conflicts
by swizzling the LDS address where each vertex is emitted.
This commit implements the same thing for ACO.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoradv/aco: Enable NGG GS by default.
Timur Kristóf [Thu, 1 Oct 2020 14:59:18 +0000 (16:59 +0200)]
radv/aco: Enable NGG GS by default.

ACO NGG GS now supports everything we need except streamout
(aka. transform feedback), but we don't use NGG anyway when
streamout is needed.

Also add a note to the new features txt.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Add shader query support to NGG GS.
Timur Kristóf [Thu, 1 Oct 2020 11:50:43 +0000 (13:50 +0200)]
aco/ngg: Add shader query support to NGG GS.

In each GS thread, we calculate the number of "real" primitives that
were emitted (points, lines, triangles, not strips). Then we
accumulate the number of "real" primitives emitted by the
entire threadgroup in GDS.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Place workgroup barrier outside control flow for NGG GS.
Timur Kristóf [Fri, 2 Oct 2020 08:29:27 +0000 (10:29 +0200)]
aco/ngg: Place workgroup barrier outside control flow for NGG GS.

Merged shaders have a workgroup barrier which makes sure that
the first half is completed in every wave before the 2nd half
is started.

This barrier is located in divergent control flow, so that waves
that don't have any invocations in the 2nd half can finish as early
as possible. This is problematic for NGG GS because it has more
workgroup barriers after the 2nd half.

So, for NGG GS we need to put the barrier outside
control flow because otherwise the waves that have 0 GS threads
won't be able to wait for the waves which have non-zero GS threads.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Implement NGG GS output.
Timur Kristóf [Fri, 2 Oct 2020 08:29:06 +0000 (10:29 +0200)]
aco/ngg: Implement NGG GS output.

We store emitted GS vertices in LDS.
Then, at the end of the shader, the emitted vertices are compacted
and each thread loads a single vertex from LDS in order to export
a primitive as needed, and the vertex attributes.

The reason this is done is because there is an impedance mismatch
between how API GS and the NGG HW works. API GS can emit an arbitrary
number of vertices and primites in each thread, but NGG HW can only
export one vertex per thread.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Implement workgroup reduce / exclusive scan for NGG GS.
Timur Kristóf [Thu, 10 Sep 2020 16:37:01 +0000 (18:37 +0200)]
aco/ngg: Implement workgroup reduce / exclusive scan for NGG GS.

This function calculates two things at once:

1. The total number of vertices emitted by the threadgroup.
2. Exclusive scan of emitted vertex count accross the threadgroup.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Create LDS layout for NGG GS.
Timur Kristóf [Thu, 10 Sep 2020 16:36:04 +0000 (18:36 +0200)]
aco/ngg: Create LDS layout for NGG GS.

For NGG GS, we need to store the following in LDS:

1. The ESGS ring, similarly to legacy ESGS.
2. Emitted vertices from the GS threads.
3. Temporary space used by the workgroup scan.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Setup NGG GS.
Timur Kristóf [Thu, 10 Sep 2020 16:36:27 +0000 (18:36 +0200)]
aco/ngg: Setup NGG GS.

Make it possible for ACO to recognize when to use HW NGG GS.
Also add a few notes about the various GS stages in the comments.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Allow NGG GS to create VS exports.
Timur Kristóf [Mon, 14 Sep 2020 07:58:56 +0000 (09:58 +0200)]
aco/ngg: Allow NGG GS to create VS exports.

NGG GS need to use the same instructions to export vertex
attributes at the end.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Allow NGG GS to load per-vertex GS inputs.
Timur Kristóf [Mon, 14 Sep 2020 07:58:38 +0000 (09:58 +0200)]
aco/ngg: Allow NGG GS to load per-vertex GS inputs.

They work the same way as in legacy GS, so we can reuse that.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Allow NGG GS to store ES outputs.
Timur Kristóf [Wed, 30 Sep 2020 12:41:54 +0000 (14:41 +0200)]
aco/ngg: Allow NGG GS to store ES outputs.

We can reuse the existing ES output code.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Clean up and reorganize NGG VS/TES code.
Timur Kristóf [Thu, 1 Oct 2020 16:32:37 +0000 (18:32 +0200)]
aco/ngg: Clean up and reorganize NGG VS/TES code.

Make the NGG VS/TES code easier to follow, give better names to
some functions and make ngg_nogs_early_prim_export a variable.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Make primitive export packing less prone to error.
Timur Kristóf [Tue, 29 Sep 2020 22:41:12 +0000 (00:41 +0200)]
aco/ngg: Make primitive export packing less prone to error.

Use lshl_or instead of lshl_add, which makes it more robust in
handling -1 and -2 indices which will now just become null
exports, which is what we want.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>

4 years agoaco/ngg: Refactor ngg_emit_prim_export in preparation for NGG GS.
Timur Kristóf [Thu, 10 Sep 2020 16:34:18 +0000 (18:34 +0200)]
aco/ngg: Refactor ngg_emit_prim_export in preparation for NGG GS.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6964>