mesa.git
4 years agopan/bi: Fix swizzle for second argument to ST_VARY
Alyssa Rosenzweig [Wed, 11 Mar 2020 19:17:25 +0000 (15:17 -0400)]
pan/bi: Fix swizzle for second argument to ST_VARY

Off-by-one.

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

4 years agopan/bi: Implement nir_op_ffma
Alyssa Rosenzweig [Wed, 11 Mar 2020 19:15:41 +0000 (15:15 -0400)]
pan/bi: Implement nir_op_ffma

We have native FMA which works for graphics usage (unlike Midgard where
it's really reserved for compute for various reasons), let's use it.

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

4 years agopan/bi: Add dead code elimination pass
Alyssa Rosenzweig [Wed, 11 Mar 2020 19:10:32 +0000 (15:10 -0400)]
pan/bi: Add dead code elimination pass

Now that we have liveness analysis, we can cleanup the IR considerably.

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

4 years agopan/bi: Add liveness analysis pass
Alyssa Rosenzweig [Wed, 11 Mar 2020 18:54:49 +0000 (14:54 -0400)]
pan/bi: Add liveness analysis pass

Now that all the guts are shared with Midgard, it's just a matter of
wiring it in.

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

4 years agopan/bi: Add bi_max_temp helper
Alyssa Rosenzweig [Wed, 11 Mar 2020 18:51:57 +0000 (14:51 -0400)]
pan/bi: Add bi_max_temp helper

Instead of trying to reindex all the times, just be okay with consistent
but sparse indices, then figuring out the max index is easy enough.

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

4 years agopan/bi: Add bi_next/prev_op helpers
Alyssa Rosenzweig [Wed, 11 Mar 2020 18:48:55 +0000 (14:48 -0400)]
pan/bi: Add bi_next/prev_op helpers

From Midgard. These are surprisingly helpful.

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

4 years agopan/bi: Add bi_bytemask_of_read_components helpers
Alyssa Rosenzweig [Wed, 11 Mar 2020 18:46:01 +0000 (14:46 -0400)]
pan/bi: Add bi_bytemask_of_read_components helpers

Same purpose as the Midgard version, but the implementation is
*dramatically* simpler thanks to our more regular IR.

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

4 years agopan/bi: Paste over bi_has_arg
Alyssa Rosenzweig [Wed, 11 Mar 2020 18:40:01 +0000 (14:40 -0400)]
pan/bi: Paste over bi_has_arg

While we're at it, cleanup the Midgard one.

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

4 years agopanfrost: Sync Midgard/Bifrost control flow
Alyssa Rosenzweig [Wed, 11 Mar 2020 18:35:38 +0000 (14:35 -0400)]
panfrost: Sync Midgard/Bifrost control flow

We can move e v e n more code to be shared and let bi_block inherit from
pan_block, which will allow us to use the shared data flow analysis.

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

4 years agopanfrost: Move liveness analysis to root panfrost/
Alyssa Rosenzweig [Wed, 11 Mar 2020 17:58:10 +0000 (13:58 -0400)]
panfrost: Move liveness analysis to root panfrost/

This way we can share the code with Bifrost.

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

4 years agopan/midgard: Subclass midgard_block from pan_block
Alyssa Rosenzweig [Wed, 11 Mar 2020 12:36:31 +0000 (08:36 -0400)]
pan/midgard: Subclass midgard_block from pan_block

Promote as much as we feasibly can while keeping it Midgard/Bifrost
agnostic.

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

4 years agopan/midgard: Sync midgard_block field names with Bifrost
Alyssa Rosenzweig [Wed, 11 Mar 2020 12:22:08 +0000 (08:22 -0400)]
pan/midgard: Sync midgard_block field names with Bifrost

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

4 years agopan/midgard: Decontextualize liveness analysis core
Alyssa Rosenzweig [Wed, 11 Mar 2020 12:09:29 +0000 (08:09 -0400)]
pan/midgard: Decontextualize liveness analysis core

We mostly just need the temp_count from it.

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

4 years agopan/midgard: Localize `visited` tracking
Alyssa Rosenzweig [Wed, 11 Mar 2020 12:03:28 +0000 (08:03 -0400)]
pan/midgard: Localize `visited` tracking

Instead of a property on the block, just track it within the function to
minimize IR dependencies.

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

4 years agopan/bi: Implement sysvals
Alyssa Rosenzweig [Tue, 10 Mar 2020 20:20:18 +0000 (16:20 -0400)]
pan/bi: Implement sysvals

Now that it's all abstracted nicely with an implementation shared with
Midgard, this is pretty easy to get.

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

4 years agopan/bi: Switch to panfrost_program
Alyssa Rosenzweig [Tue, 10 Mar 2020 20:09:44 +0000 (16:09 -0400)]
pan/bi: Switch to panfrost_program

...now that it's shared.

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

4 years agopanfrost: Move Midgard sysval code to common Panfrost
Alyssa Rosenzweig [Tue, 10 Mar 2020 20:06:30 +0000 (16:06 -0400)]
panfrost: Move Midgard sysval code to common Panfrost

We'll use this all as-is in Bifrost.

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

4 years agopan/midgard: Remove dest_override sysval argument
Alyssa Rosenzweig [Tue, 10 Mar 2020 20:19:33 +0000 (16:19 -0400)]
pan/midgard: Remove dest_override sysval argument

Unused, noticed while working on porting over to Bifrost.

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

4 years agopan/midgard: Decontextualize midgard_nir_assign_sysval_body
Alyssa Rosenzweig [Tue, 10 Mar 2020 20:00:56 +0000 (16:00 -0400)]
pan/midgard: Decontextualize midgard_nir_assign_sysval_body

Now all sysval code should be fairly generic.

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

4 years agopan/midgard: Remove indexing dependency of sysvals
Alyssa Rosenzweig [Tue, 10 Mar 2020 19:54:17 +0000 (15:54 -0400)]
pan/midgard: Remove indexing dependency of sysvals

Ideally we would sync the compilers to use the same indexing scheme but
that's a lot more Midgard refactoring than I have time for right now.
This is good enough honestly.

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

4 years agopan/midgard: Adjust sysval-related prototypes
Alyssa Rosenzweig [Tue, 10 Mar 2020 19:48:52 +0000 (15:48 -0400)]
pan/midgard: Adjust sysval-related prototypes

We'd like to share this big chunk of code with Bifrost but that requires
removing the compiler_context parameter... which is totally unused in
fact!

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

4 years agopan/midgard: Remove unused iterators
Alyssa Rosenzweig [Wed, 11 Mar 2020 12:37:58 +0000 (08:37 -0400)]
pan/midgard: Remove unused iterators

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

4 years agopanfrost: Promote midgard_program to panfrost/util
Alyssa Rosenzweig [Tue, 10 Mar 2020 19:41:56 +0000 (15:41 -0400)]
panfrost: Promote midgard_program to panfrost/util

We'll want Bifrost to reuse the same linking mechanisms for the most
part.

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

4 years agogitlab-ci: build RADV in meson-i386 to avoid 32-bit build failures
Samuel Pitoiset [Wed, 4 Mar 2020 08:37:46 +0000 (09:37 +0100)]
gitlab-ci: build RADV in meson-i386 to avoid 32-bit build failures

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4044>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4044>

4 years agoradv: fix 32-bits build (again)
Samuel Pitoiset [Wed, 11 Mar 2020 15:07:18 +0000 (16:07 +0100)]
radv: fix 32-bits build (again)

Fixes: dcfc08f5b8a ("radv/sqtt: describe begin/end command buffers with user markers")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4044>

4 years agomesa: don't unroll glMultiDrawElements with user indices for gallium
Marek Olšák [Wed, 12 Feb 2020 22:49:45 +0000 (17:49 -0500)]
mesa: don't unroll glMultiDrawElements with user indices for gallium

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

4 years agogallium: add PIPE_CAP_DRAW_INFO_START_WITH_USER_INDICES
Marek Olšák [Fri, 14 Feb 2020 21:01:50 +0000 (16:01 -0500)]
gallium: add PIPE_CAP_DRAW_INFO_START_WITH_USER_INDICES

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

4 years agovbo: fix vbo_copy_vertices for GL_PATCHES and adjacency primitive types
Marek Olšák [Sun, 8 Mar 2020 21:58:49 +0000 (17:58 -0400)]
vbo: fix vbo_copy_vertices for GL_PATCHES and adjacency primitive types

Fixes: 4c6323c49f1 - vbo: handle GS and tess primitive types when splitting Begin/End
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3591>

4 years agovbo: fix transitions from glVertexN to glVertexM where M < N
Marek Olšák [Thu, 27 Feb 2020 21:04:00 +0000 (16:04 -0500)]
vbo: fix transitions from glVertexN to glVertexM where M < N

Fixes: 1f6e53e2 "vbo: don't store glVertex values temporarily into exec"
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3591>

4 years agovbo: use vbo_exec_wrap_upgrade_vertex for glVertex in ATTR_UNION
Marek Olšák [Thu, 27 Feb 2020 20:46:11 +0000 (15:46 -0500)]
vbo: use vbo_exec_wrap_upgrade_vertex for glVertex in ATTR_UNION

We can't decrease the size for glVertex before a flush,
so use vbo_exec_wrap_upgrade_vertex directly.

Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3591>

4 years agost/mesa: keep serialized NIR instead of nir_shader in st_program
Marek Olšák [Sat, 2 Nov 2019 03:55:58 +0000 (23:55 -0400)]
st/mesa: keep serialized NIR instead of nir_shader in st_program

This decreases memory usage, because serialized NIR is more compact.

The first variant is created from nir_shader for uncached shaders.
All other variants are created from serialized NIR.

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

4 years agogitlab-ci: Don't restrict ppc64el/s390x build jobs to gstreamer runners
Michel Dänzer [Tue, 10 Mar 2020 09:16:47 +0000 (10:16 +0100)]
gitlab-ci: Don't restrict ppc64el/s390x build jobs to gstreamer runners

The packet runners have beefier CPUs now and don't seem to run into
test timeouts anymore.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4128>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4128>

4 years agogitlab-ci: Sort packages to install alphabetically
Andres Gomez [Sat, 7 Mar 2020 23:32:17 +0000 (01:32 +0200)]
gitlab-ci: Sort packages to install alphabetically

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
4 years agogitlab-ci: Remove unneeded python3-pilkit dependency
Andres Gomez [Sat, 7 Mar 2020 23:30:45 +0000 (01:30 +0200)]
gitlab-ci: Remove unneeded python3-pilkit dependency

It was added with tracie, but it doesn't depend on it.

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
4 years agogitlab-ci: Fix indentation and dangerous "\" in the last multiline line
Andres Gomez [Sat, 7 Mar 2020 23:29:02 +0000 (01:29 +0200)]
gitlab-ci: Fix indentation and dangerous "\" in the last multiline line

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
4 years agovc4: Fix query_dmabuf_modifiers mis-reporting external_only property
Chris Lord [Thu, 5 Mar 2020 16:37:53 +0000 (16:37 +0000)]
vc4: Fix query_dmabuf_modifiers mis-reporting external_only property

vc4_screen_query_dmabuf_modifiers doesn't consider that the given format
may only be supported by lowering, which only happens for external
textures.

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

4 years agoaco: Don't store TCS outputs to LDS when we're sure that none are read.
Timur Kristóf [Mon, 9 Mar 2020 15:27:54 +0000 (16:27 +0100)]
aco: Don't store TCS outputs to LDS when we're sure that none are read.

This allows us not to write an output to LDS, even if it has
an indirect offset.

No pipeline DB changes.

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

4 years agoaco: Only write TCS outputs to LDS when they are read by the TCS.
Timur Kristóf [Sat, 7 Mar 2020 00:51:39 +0000 (01:51 +0100)]
aco: Only write TCS outputs to LDS when they are read by the TCS.

Note that tess factors are always read at the end of the shader,
so those are still always saved to LDS.

Totals from affected shaders:
VGPRS: 25244 -> 25164 (-0.32 %)
Code Size: 1768268 -> 1690804 (-4.38 %) bytes
Max Waves: 4947 -> 4953 (0.12 %)

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

4 years agoaco: Store tess factors in VMEM only at the end of the shader.
Timur Kristóf [Fri, 6 Mar 2020 19:24:55 +0000 (21:24 +0200)]
aco: Store tess factors in VMEM only at the end of the shader.

This optimizes out several superfluous stores of the tess factors,
especially if the shader wrote those outputs multiple times.

Pipeline DB changes on GFX10:
Totals from affected shaders:
SGPRS: 30384 -> 29536 (-2.79 %)
Code Size: 2260720 -> 2214484 (-2.05 %) bytes

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

4 years agoaco: Don't generate an if when the first part of a merged HS or GS is empty.
Timur Kristóf [Mon, 24 Feb 2020 14:27:43 +0000 (15:27 +0100)]
aco: Don't generate an if when the first part of a merged HS or GS is empty.

In some cases (eg. in a few tessellation CTS tests) the VS part of
a merged HS is completely empty. Let's not generate a divergent if
in these cases. (LLVM also doesn't do it.)

No pipeline DB changes, only affects the CTS.

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

4 years agoradv: Enable ACO on all stages.
Timur Kristóf [Sat, 29 Feb 2020 10:59:58 +0000 (11:59 +0100)]
radv: Enable ACO on all stages.

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

4 years agoaco: Enable running TES as ES, including merged TES+GS.
Timur Kristóf [Sat, 29 Feb 2020 10:57:58 +0000 (11:57 +0100)]
aco: Enable running TES as ES, including merged TES+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/3964>

4 years agoradv: Enable ACO for TES when there is no GS.
Timur Kristóf [Thu, 27 Feb 2020 19:05:16 +0000 (20:05 +0100)]
radv: Enable ACO for TES when there is no 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/3964>

4 years agoaco: Implement loading TES inputs.
Timur Kristóf [Fri, 28 Feb 2020 14:27:41 +0000 (15:27 +0100)]
aco: Implement loading TES inputs.

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

4 years agoaco: Enable streamout when TES runs on the HW VS stage.
Timur Kristóf [Fri, 6 Mar 2020 11:52:35 +0000 (13:52 +0200)]
aco: Enable streamout when TES runs on the HW VS stage.

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

4 years agoaco: Store TES outputs when TES runs on the HW VS stage.
Timur Kristóf [Fri, 6 Mar 2020 11:51:17 +0000 (13:51 +0200)]
aco: Store TES outputs when TES runs on the HW VS stage.

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

4 years agoaco: Use TES output info when TES runs on the VS stage.
Timur Kristóf [Thu, 27 Feb 2020 18:59:37 +0000 (19:59 +0100)]
aco: Use TES output info when TES runs on the VS stage.

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

4 years agoaco: Setup tessellation evaluation shader variables.
Timur Kristóf [Thu, 27 Feb 2020 18:56:35 +0000 (19:56 +0100)]
aco: Setup tessellation evaluation shader variables.

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

4 years agoradv: Enable ACO for tessellation control shaders.
Timur Kristóf [Wed, 26 Feb 2020 17:31:34 +0000 (18:31 +0100)]
radv: Enable ACO for tessellation control 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/3964>

4 years agoaco: Fix LS VGPR init bug on affected hardware.
Timur Kristóf [Mon, 9 Mar 2020 11:44:03 +0000 (12:44 +0100)]
aco: Fix LS VGPR init bug on affected hardware.

Vega 10 and Raven have a HW bug: when the HS thread count is zero,
the LS input arguments are loaded in the wrong registers. This commit
works around this by using the registers where the data actually is,
for the affected arguments.

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

4 years agoaco: Store VS outputs correctly when tessellation is used.
Timur Kristóf [Tue, 18 Feb 2020 16:51:05 +0000 (17:51 +0100)]
aco: Store VS outputs correctly when tessellation is used.

When tessellation is used, the VS runs on the HW LS stage (merged
into HS on GFX9-10). This commit enables such VS to store its
outputs properly in LDS so that the TCS can load them as its
per-vertex inputs.

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

4 years agoaco: Implement tessellation control shader input/output.
Timur Kristóf [Fri, 21 Feb 2020 16:46:15 +0000 (17:46 +0100)]
aco: Implement tessellation control shader input/output.

Tessellation control shaders can have per-vertex inputs,
and both per-vertex and per-patch outputs. TCS can not only store,
but also load their outputs.

The TCS outputs are stored in RING_HS_TESS_OFFCHIP in VMEM, which
is where the TES reads them from. Additionally, the are also stored
in LDS to make sure they can be loaded fast when read by the TCS.

Tessellation factors are always just stored in LDS.
At the end of the shader, the first shader invocation reads these
from LDS and writes them to RING_HS_TESS_FACTOR in VMEM, and
additionally to RING_HS_TESS_OFFCHIP when they are read by
the Tessellation Evaluation Shader.

This implementation matches the memory layouts used by radv_nir_to_llvm.

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

4 years agoaco: Fix combining DS additions in the optimizer.
Timur Kristóf [Mon, 9 Mar 2020 16:07:41 +0000 (17:07 +0100)]
aco: Fix combining DS additions in the optimizer.

Previously, it was calculated incorrectly for 64-bit writes and reads.

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

4 years agoaco: Slight fix to lds_store and lds_load.
Timur Kristóf [Wed, 26 Feb 2020 17:24:42 +0000 (18:24 +0100)]
aco: Slight fix to lds_store and lds_load.

This commit fixes lds_store and lds_load so that they can
properly support 32 and 64-bit loads and stores; and makes
them a little more reusable so they can be used by
tessellation control 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/3964>

4 years agoaco: Refactor VS output stores in preparation for tessellation.
Timur Kristóf [Fri, 28 Feb 2020 15:20:01 +0000 (16:20 +0100)]
aco: Refactor VS output stores in preparation for tessellation.

This commit takes the new helpers into use by the VS output
store function. This function is also where the VS outputs will
be handled when the VS runs on the HW LS stage.

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

4 years agoaco: Refactor load_per_vertex_input in preparation for tessellation.
Timur Kristóf [Fri, 28 Feb 2020 15:06:19 +0000 (16:06 +0100)]
aco: Refactor load_per_vertex_input in preparation for tessellation.

This commit carves out the GS per-vertex input load, and takes the
new helper functions into use.

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

4 years agoaco: Introduce new helpers for calculating address offsets.
Timur Kristóf [Fri, 28 Feb 2020 14:50:54 +0000 (15:50 +0100)]
aco: Introduce new helpers for calculating address offsets.

These helpers are going to make it unnecessary to reimplement the
(almost) same address offset calculation in mulitple places.

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

4 years agoaco: Introduce new VMEM load/store helpers.
Timur Kristóf [Fri, 28 Feb 2020 14:48:01 +0000 (15:48 +0100)]
aco: Introduce new VMEM load/store helpers.

These are going to be used for loading and storing inputs
and outputs in various stages, such as GS, TCS and TES.

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

4 years agoaco: Remove esgs_itemsize from LDS alignment calculation.
Timur Kristóf [Tue, 18 Feb 2020 19:21:20 +0000 (20:21 +0100)]
aco: Remove esgs_itemsize from LDS alignment calculation.

It was problematic to have it, because some shader stages might
not even know about the esgs_itemsize, for example TCS and
the merged VS+TCS stages.

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

4 years agoaco: Extract LDS alignment calculation to a separate function.
Timur Kristóf [Tue, 18 Feb 2020 15:54:44 +0000 (16:54 +0100)]
aco: Extract LDS alignment calculation to a separate function.

This function is going to be reused in multiple functions when
storing or loading something in the LDS.

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

4 years agoaco: Remove vertex_geometry_gs assertion from merged shaders.
Timur Kristóf [Wed, 12 Feb 2020 13:27:05 +0000 (14:27 +0100)]
aco: Remove vertex_geometry_gs assertion from merged shaders.

We are going to support more kinds of merged shaders, such
as vertex_tess_control_hs and tess_eval_geometry_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/3964>

4 years agoaco: Use mesa shader stage when loading inputs.
Timur Kristóf [Tue, 18 Feb 2020 14:55:54 +0000 (15:55 +0100)]
aco: Use mesa shader stage when loading inputs.

This makes it more clear which stages should load these inputs.

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

4 years agoaco: Setup correct HW stages when tessellation is used.
Timur Kristóf [Wed, 12 Feb 2020 14:33:02 +0000 (15:33 +0100)]
aco: Setup correct HW stages when tessellation is used.

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

4 years agoaco: Implement load_view_index for TCS and TES.
Timur Kristóf [Sat, 7 Mar 2020 17:26:52 +0000 (18:26 +0100)]
aco: Implement load_view_index for TCS and TES.

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

4 years agoaco: Implement memory_barrier_tcs_patch.
Timur Kristóf [Fri, 6 Mar 2020 12:02:03 +0000 (14:02 +0200)]
aco: Implement memory_barrier_tcs_patch.

TCS outputs are going to be written to LDS, so it
has to use memory_barrier_shared in order to ensure
that it waits for LDS writes.

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

4 years agoaco: Implement control_barrier for tessellation control shaders.
Timur Kristóf [Wed, 26 Feb 2020 16:41:04 +0000 (17:41 +0100)]
aco: Implement control_barrier for tessellation control 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/3964>

4 years agoaco: Implement load_invocation_id for tessellation control shaders.
Timur Kristóf [Wed, 12 Feb 2020 13:28:29 +0000 (14:28 +0100)]
aco: Implement load_invocation_id for tessellation control 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/3964>

4 years agoaco: Implement load_patch_vertices_in.
Timur Kristóf [Tue, 25 Feb 2020 12:20:36 +0000 (13:20 +0100)]
aco: Implement load_patch_vertices_in.

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

4 years agoaco: Implement load_primitive_id for tessellation shaders.
Timur Kristóf [Mon, 24 Feb 2020 16:10:13 +0000 (17:10 +0100)]
aco: Implement load_primitive_id for tessellation 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/3964>

4 years agoaco: Implement load_tess_coord.
Timur Kristóf [Mon, 17 Feb 2020 15:56:39 +0000 (16:56 +0100)]
aco: Implement load_tess_coord.

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

4 years agoaco: Setup tessellation control shader variables.
Timur Kristóf [Wed, 12 Feb 2020 14:22:17 +0000 (15:22 +0100)]
aco: Setup tessellation control shader variables.

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

4 years agoaco: Extract setup_gs_variables into a separate function.
Timur Kristóf [Wed, 12 Feb 2020 13:23:17 +0000 (14:23 +0100)]
aco: Extract setup_gs_variables into a separate function.

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

4 years agoradv: Move some helper functions to the radv_shader.h header file.
Timur Kristóf [Mon, 24 Feb 2020 14:44:48 +0000 (15:44 +0100)]
radv: Move some helper functions to the radv_shader.h header file.

Move calculate_tess_lds_size and get_tcs_num_patches to radv_shader.h
ACO will need to call these functions too.

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

4 years agovdpau: remove bogus assert
Pierre-Eric Pelloux-Prayer [Sun, 8 Mar 2020 08:01:42 +0000 (09:01 +0100)]
vdpau: remove bogus assert

The assert introduced by 24f2b0a8560 triggers when an application
requests a chroma_type that's different to the one from the
PIPE_VIDEO_CAP_PREFERED_FORMAT (before this change the chroma_type
was set but ignored).

So restore this behavior and ignore the chroma_type.

Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Fixes: 24f2b0a8560 ("gallium/video: remove pipe_video_buffer.chroma_format")
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4104>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4104>

4 years agoradv: do not recursively begin/end render pass for meta operations
Samuel Pitoiset [Tue, 10 Mar 2020 17:35:15 +0000 (18:35 +0100)]
radv: do not recursively begin/end render pass for meta operations

To avoid breaking SQTT user markers that are emitted to report
barriers and layout transitions to RGP.

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

4 years agolima/gpir: print acc ops even if we have only one source
Vasily Khoruzhick [Tue, 10 Mar 2020 08:11:11 +0000 (01:11 -0700)]
lima/gpir: print acc ops even if we have only one source

floor and sign have only one source, so we need to print acc ops
even if src1 is unused.

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4110>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4110>

4 years agolima/gpir: improve disassembler output
Vasily Khoruzhick [Sun, 8 Mar 2020 23:38:21 +0000 (16:38 -0700)]
lima/gpir: improve disassembler output

Print each op at new line and add unit name suffix for each op.
It improves readability a bit and gives us a hint what unit
was used for particular op.

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4110>

4 years agolima: print gp uniforms if gp debug is enabled
Vasily Khoruzhick [Sun, 8 Mar 2020 18:05:12 +0000 (11:05 -0700)]
lima: print gp uniforms if gp debug is enabled

Since we keep other constants there as well it's useful for reading disassembly.

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4110>

4 years agogitlab-ci: add rules:changes for RADV
Samuel Pitoiset [Mon, 9 Mar 2020 16:53:51 +0000 (17:53 +0100)]
gitlab-ci: add rules:changes for RADV

Including mesa_core_file_list is probably not the best but it's
better than nothing.

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

4 years agogallium: hud_context: Fix scalar initializer warning.
John Stultz [Tue, 10 Mar 2020 03:27:35 +0000 (03:27 +0000)]
gallium: hud_context: Fix scalar initializer warning.

When trying to build mesa/master under AOSP, I've run into the
following error:

external/mesa3d/src/gallium/auxiliary/hud/hud_context.c:1821:31: error: braces around scalar initializer [-Werror,-Wbraced-scalar-init]
   struct sigaction action = {{0}};
                              ^~~
1 error generated.

This patch addresses this by switching to using memset instead of
using an initializer.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4141>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4141>

4 years agopanfrost: Move pan_afbc.c file to the the right Makefile.source file
John Stultz [Tue, 10 Mar 2020 03:37:44 +0000 (03:37 +0000)]
panfrost: Move pan_afbc.c file to the the right Makefile.source file

It seems pan_afbc.c was added to the wrong Makefile.sources file.

So fix this, so we don't run into build issues with mesa/master
trying to build under AOSP.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4141>

4 years agofreedreno: Add ir3_cf.c and ir3_delay.c to Makefile.sources
John Stultz [Tue, 10 Mar 2020 03:14:34 +0000 (03:14 +0000)]
freedreno: Add ir3_cf.c and ir3_delay.c to Makefile.sources

This patch adds missing ir3_cf.c and ir3_delay.c files to
the Makefile.sources file to address build issues seen
when trying to build mesa/master on AOSP

Signed-off-by: John Stultz <john.stultz@linaro.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4141>

4 years agogallium/cso_context: remove cso_delete_xxx_shader helpers to fix the live cache
Marek Olšák [Thu, 5 Mar 2020 20:09:28 +0000 (15:09 -0500)]
gallium/cso_context: remove cso_delete_xxx_shader helpers to fix the live cache

With the live shader cache, equivalent shaders can be backed by the same
CSO. This breaks the logic that identifies whether the shader being deleted
is bound.

For example, having shaders A and B, you can bind shader A and delete
shader B. Deleting shader B will unbind shader A if they are equivalent.

Pierre-Eric figured out the root cause for this issue.

Fixes: 0db74f479b9 - radeonsi: use the live shader cache
Closes: #2596
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4078>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4078>

4 years agovulkan/wsi: fix cleanup when dup() fails
Eric Engestrom [Tue, 10 Mar 2020 17:54:41 +0000 (18:54 +0100)]
vulkan/wsi: fix cleanup when dup() fails

Fixes: f5433e4d6ce247b86dae ("vulkan/wsi: Add modifiers support to wsi_create_native_image")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4137>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4137>

4 years agoRevert "gallium: make handles of set_global_binding 64 bit"
Karol Herbst [Tue, 10 Mar 2020 22:41:26 +0000 (22:41 +0000)]
Revert "gallium: make handles of set_global_binding 64 bit"

This reverts commit e1ffb72a05f9b50ee47767aaadbab3e47896ee14

4 years agogallium: make handles of set_global_binding 64 bit
Karol Herbst [Fri, 28 Feb 2020 14:54:08 +0000 (15:54 +0100)]
gallium: make handles of set_global_binding 64 bit

needed by CL

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4072>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4072>

4 years agopan/bi: Implement comparison opcodes via BI_CMP
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:21:35 +0000 (08:21 -0400)]
pan/bi: Implement comparison opcodes via BI_CMP

Pretty straightforward for the moment. Ideally these would be fused into
csel/branches but that will come a bit later.

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

4 years agopan/bi: Print source types unconditionally
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:47:39 +0000 (08:47 -0400)]
pan/bi: Print source types unconditionally

We track them all now, let's use them.

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

4 years agopan/bi: Specify comparison op for BI_CMP
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:47:20 +0000 (08:47 -0400)]
pan/bi: Specify comparison op for BI_CMP

...and adjust printing so we can use it as an op name.

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

4 years agopan/bi: Lower b2f to bcsel
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:33:11 +0000 (08:33 -0400)]
pan/bi: Lower b2f to bcsel

Since we can get a zero for free and a one inlined into the constant,
the obvious turns out to be efficient (while allowing flexibility for
boolean size).

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

4 years agopan/bi: Implement nir_op_bcsel
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:32:56 +0000 (08:32 -0400)]
pan/bi: Implement nir_op_bcsel

No condition fusing yet.

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

4 years agopan/bi: Import algebraic pass from midgard
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:20:59 +0000 (08:20 -0400)]
pan/bi: Import algebraic pass from midgard

We'll need some of these at least.

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

4 years agopan/bi: Add isub op
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:03:20 +0000 (08:03 -0400)]
pan/bi: Add isub op

Can't be a regular ADD since there's no negate modifier for integers
(it's a different opcode entirely).

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

4 years agopan/bi: Disable lower_sub
Alyssa Rosenzweig [Tue, 10 Mar 2020 11:56:14 +0000 (07:56 -0400)]
pan/bi: Disable lower_sub

For float, fixing up the modifier ourselves is easy. For int, we have a
dedicated isub instruction anyway.

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

4 years agopan/bi: Implement fabs, fneg as fmov with mods
Alyssa Rosenzweig [Tue, 10 Mar 2020 11:52:24 +0000 (07:52 -0400)]
pan/bi: Implement fabs, fneg as fmov with mods

Fusing will come later with the appropriate NIR support.

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

4 years agopan/bi: Handle special ops in NIR->BIR
Alyssa Rosenzweig [Tue, 10 Mar 2020 01:20:20 +0000 (21:20 -0400)]
pan/bi: Handle special ops in NIR->BIR

Only on supported GPUs at the moment; for older Bifrost that don't
support these, I'm not sure yet where the right place to do the lowering
is. NIR algebraic rules would be "nice" but probably impractical -- but
it wouldn't be hard to do it directly in BIR (as a lowering pass or
alternative implementation).

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

4 years agopan/bi: Add BI_SPECIAL_* enum
Alyssa Rosenzweig [Tue, 10 Mar 2020 01:20:03 +0000 (21:20 -0400)]
pan/bi: Add BI_SPECIAL_* enum

To disambiguate the different special ops from each other.

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

4 years agopan/bi: Add a bunch of ALU ops
Alyssa Rosenzweig [Tue, 10 Mar 2020 01:10:41 +0000 (21:10 -0400)]
pan/bi: Add a bunch of ALU ops

These are all regular ALU ops found in GLES2 which makes them
particularly nice targets at the moment. Just translate straight to our
IR.

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

4 years agopan/bi: Implement fsat as mov.sat
Alyssa Rosenzweig [Tue, 10 Mar 2020 01:02:51 +0000 (21:02 -0400)]
pan/bi: Implement fsat as mov.sat

Soon we'll have a NIR support to handle this the Right Way along with
pos and sat_signed support, but we'll always need the fallback anyway.

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

4 years agopan/bi: Allow inlining constants
Alyssa Rosenzweig [Tue, 10 Mar 2020 00:32:00 +0000 (20:32 -0400)]
pan/bi: Allow inlining constants

This will allow us to optimize out the constant moves (although that
will require a DCE pass which has yet to be written).

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