mesa.git
4 years agomeson: Enable -Werror=int-conversion.
Bas Nieuwenhuizen [Thu, 31 Oct 2019 11:00:52 +0000 (12:00 +0100)]
meson: Enable -Werror=int-conversion.

I think implicit conversions here are almost always wrong:

1) wrong argument position ptr vs. int
2) will often have issues with 32-bit platforms.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2570>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2570>

4 years agoturnip: Use VK_NULL_HANDLE instead of NULL.
Bas Nieuwenhuizen [Thu, 2 Jan 2020 11:29:29 +0000 (12:29 +0100)]
turnip: Use VK_NULL_HANDLE instead of NULL.

Only occurrence of implicitly converting pointer->int.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2570>

4 years agoamd/common: Always initialize gfx9 mipmap offset/pitch.
Bas Nieuwenhuizen [Tue, 31 Dec 2019 20:28:23 +0000 (21:28 +0100)]
amd/common: Always initialize gfx9 mipmap offset/pitch.

The WSI expects pitch to be meaningful even for tiled
textures.

(It is used for the pitch in modesetting and X11)

Fixes: 824bd0830e8 "radv: return the correct pitch for linear mipmaps on GFX10"
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2301
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2304
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3245>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3245>

4 years agonir: print non-uniform tex fields.
Bas Nieuwenhuizen [Wed, 1 Jan 2020 13:47:14 +0000 (14:47 +0100)]
nir: print non-uniform tex fields.

To ease debugging in the future.

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

4 years agonir: Add clone/hash/serialize support for non-uniform tex instructions.
Bas Nieuwenhuizen [Wed, 1 Jan 2020 13:42:58 +0000 (14:42 +0100)]
nir: Add clone/hash/serialize support for non-uniform tex instructions.

These were missed when the fields got added. Added it everywhere where
texture_index got used and it made sense.

Found this in "The Surge 2", where the inliner does not copy the fields,
resulting in corruption and hangs.

Fixes: 3bd54576415 "nir: Add a lowering pass for non-uniform resource access"
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1203
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3246>

4 years agopan/midgard: Optimize branches with inverted arguments
Afonso Bordado [Fri, 27 Dec 2019 17:09:51 +0000 (17:09 +0000)]
pan/midgard: Optimize branches with inverted arguments

Remove the invert on arguments to branches, and invert the branch
condition instead. This saves one instruction per inverted argument.

Closes #2088

Signed-off-by: Afonso Bordado <afonsobordado@az8.co>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Move midgard_is_branch_unit to helpers
Afonso Bordado [Fri, 27 Dec 2019 20:36:36 +0000 (20:36 +0000)]
pan/midgard: Move midgard_is_branch_unit to helpers

Signed-off-by: Afonso Bordado <afonsobordado@az8.co>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agoetnaviv: Do not filter out PIPE_FORMAT_S8_UINT_Z24_UNORM on pre-HALTI2
Marek Vasut [Mon, 23 Dec 2019 13:40:59 +0000 (14:40 +0100)]
etnaviv: Do not filter out PIPE_FORMAT_S8_UINT_Z24_UNORM on pre-HALTI2

The format PIPE_FORMAT_S8_UINT_Z24_UNORM is supported even on pre-HALTI
hardware like GCnano. Do not report it as unsupported format.

This fixes the following dEQP on GCnano:
dEQP-GLES2.functional.fbo.completeness.renderable.texture.color0.depth_stencil_unsigned_int_24_8

Fixes: 64c7cdcae51 ("etnaviv: add missing formats")
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3200>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3200>

4 years agoetnaviv: Report correct number of vertex buffers
Marek Vasut [Tue, 31 Dec 2019 10:53:55 +0000 (11:53 +0100)]
etnaviv: Report correct number of vertex buffers

The GCnano has only 4 vertex buffers instead of 16. This information
can be extracted from the GPU status registers and is already stored
in screen->specs.stream_count. Use PIPE_CAP_MAX_VERTEX_BUFFERS to
report this information and permit u_vbuf to reorganize the shaders
to fit.

This fixes the following dEQP on GCnano:
dEQP-GLES2.functional.shaders.conversions.vector_combine.float_float_float_float_to_vec4_vertex

This fixes all the other dEQP-GLES2.functional.shaders.conversions.*
which used to fail on GCnano.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3241>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3241>

4 years agoaco: Fix uniform i2i64.
Timur Kristóf [Tue, 31 Dec 2019 12:39:56 +0000 (13:39 +0100)]
aco: Fix uniform i2i64.

Fixes 240 failing test cases in dEQP-VK.spirv_assembly which
were failing due to a bad s_ashr_i32 instruction. This commit
fixes the instruction format along with the definitions of the
instruction.

Fixes: 11f43caaeca166c96ae49dbd506b6f58dd4a13fb
Cc: 19.3 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
4 years agoandroid: Fix u_format_table.c being generated twice
Robert Foss [Fri, 20 Dec 2019 14:06:33 +0000 (15:06 +0100)]
android: Fix u_format_table.c being generated twice

Two competing rules for defining u_format_table.c exists,
which is an error.

Additionally the more general rule lacks the inclusion of
format/u_format.csv.

Fixes: 882ca6dfb0 ("util: Move gallium's PIPE_FORMAT utils to /util/format/")
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
4 years agopan/midgard: Remove prepacked_branch
Alyssa Rosenzweig [Tue, 31 Dec 2019 00:02:23 +0000 (19:02 -0500)]
pan/midgard: Remove prepacked_branch

It's an ugly hack that's no longer used.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Convert fragment writeout to proper branches
Alyssa Rosenzweig [Mon, 30 Dec 2019 23:53:04 +0000 (18:53 -0500)]
pan/midgard: Convert fragment writeout to proper branches

This eliminates the only use of prepacked_branch, which is a such a
hack anyway.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agowinsys/radeon: initialize pte_fragment_size
Marek Olšák [Fri, 27 Dec 2019 23:02:33 +0000 (18:02 -0500)]
winsys/radeon: initialize pte_fragment_size

Cc: 19.2 19.3 <mesa-stable@lists.freedesktop.org>
Closes: #2179
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agoRevert "u_vbuf: Regard non-constant vbufs with non-instance elements as free"
Marek Olšák [Mon, 30 Dec 2019 23:41:04 +0000 (18:41 -0500)]
Revert "u_vbuf: Regard non-constant vbufs with non-instance elements as free"

This reverts commit c6ef79c488bb5fffde31e7065fd3e575f3c25fb5.

It broke torcs.

4 years agopanfrost: Respect glPointSize()
Alyssa Rosenzweig [Mon, 30 Dec 2019 17:55:50 +0000 (12:55 -0500)]
panfrost: Respect glPointSize()

We have native support for this somehow. Fixes the mesa demo `points`

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Remove MRT indirection in blend shaders
Alyssa Rosenzweig [Mon, 30 Dec 2019 17:13:45 +0000 (12:13 -0500)]
panfrost: Remove MRT indirection in blend shaders

Since we have a separate blend shader for each render target, let's
simplify this structure and reduce the options memory footprint by 88%
or something goofy like that.

Should also enable separate blending per render target.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Implement integer varyings
Alyssa Rosenzweig [Fri, 27 Dec 2019 21:01:34 +0000 (16:01 -0500)]
panfrost: Implement integer varyings

We need to actually work out the varying format on demand, rather than
assuming rgba32f.

Fixes dEQP-GLES3.functional.fragment_out.basic.int.*

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Disable some CAPs we want lowered
Alyssa Rosenzweig [Fri, 27 Dec 2019 20:33:33 +0000 (15:33 -0500)]
panfrost: Disable some CAPs we want lowered

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Identify glProvokingVertex flag
Alyssa Rosenzweig [Fri, 27 Dec 2019 20:33:21 +0000 (15:33 -0500)]
panfrost: Identify glProvokingVertex flag

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Implement flat shading
Alyssa Rosenzweig [Fri, 27 Dec 2019 20:32:50 +0000 (15:32 -0500)]
pan/midgard: Implement flat shading

We need to shuffle around some lowerings but it's just a flag.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Use type-appropriate st_vary
Alyssa Rosenzweig [Fri, 27 Dec 2019 19:25:00 +0000 (14:25 -0500)]
pan/midgard: Use type-appropriate st_vary

We would like to store (u)ints as well.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Promote tilebuffer reads to 32-bit
Alyssa Rosenzweig [Wed, 25 Dec 2019 04:58:28 +0000 (23:58 -0500)]
pan/midgard: Promote tilebuffer reads to 32-bit

Fixes (among others)
dEQP-GLES3.functional.fbo.render.shared_colorbuffer_clear.tex2d_rgba16f

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agoglsl: Set .flat for gl_FrontFacing
Alyssa Rosenzweig [Mon, 30 Dec 2019 16:40:29 +0000 (11:40 -0500)]
glsl: Set .flat for gl_FrontFacing

It is a boolean.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3237>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3237>

4 years agoradv: return the correct pitch for linear mipmaps on GFX10
Samuel Pitoiset [Mon, 30 Dec 2019 12:47:30 +0000 (13:47 +0100)]
radv: return the correct pitch for linear mipmaps on GFX10

On GFX9, the pitch of a level is always the pitch of the entire image
but not on GFX10.

This fixes graphics glithes with Halo - The Master Chief Collection.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2188
CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agometa: Cleanup function for DrawTex
Yevhenii Kolesnikov [Fri, 19 Jul 2019 12:10:25 +0000 (15:10 +0300)]
meta: Cleanup function for DrawTex

Buffer object was never freed, causing memory leaks.

Fixes: 76cfe2bc443 ("meta: Don't pollute the buffer object namespace in _mesa_meta_DrawTex")
CC: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1390>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1390>

4 years agogallium/gallivm/tgsi: enable tessellation shaders
Jan Zielinski [Thu, 12 Dec 2019 15:03:46 +0000 (16:03 +0100)]
gallium/gallivm/tgsi: enable tessellation shaders

Tessellation Control and Evaluation shaders are implementing
tessellation and require special handling of their inputs
and outputs.

TCS can write out not only per-vertex, but also per-patch
(per-primitive) attributes and tessellation factor values
that control the tessellator.

TES can read TCS outputs, plus must be feeded with new
system values (tessellation coordinates) that are
outputs of the tessellator fixed function.

TCS can also contain calls to barrier() function (similar
to compute shaders).

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Alok Hota <alok.hota@intel.com>
4 years agollvmpipe: enable ARB_shader_group_vote.
Dave Airlie [Fri, 13 Dec 2019 04:44:59 +0000 (14:44 +1000)]
llvmpipe: enable ARB_shader_group_vote.

This just adds the NIR paths for shader group vote.

v2: drop feq for now. (Roland)

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

4 years agoamd/common: Handle alignment of 96-bit formats.
Bas Nieuwenhuizen [Mon, 23 Dec 2019 01:02:20 +0000 (02:02 +0100)]
amd/common: Handle alignment of 96-bit formats.

addrlib doesn't quite do it right, so do it ourselves.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2162
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agopanfrost: Fix Makefile.sources
Caio Marcelo de Oliveira Filho [Sat, 28 Dec 2019 04:02:25 +0000 (20:02 -0800)]
panfrost: Fix Makefile.sources

Add missing `\`.  Fixes Android build.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Fixes: de077c20788e9cccd0ef ("panfrost: Remove mali_alt_func")
4 years agomesa: avoid returning a value in a void function
Eric Engestrom [Fri, 27 Dec 2019 21:50:24 +0000 (21:50 +0000)]
mesa: avoid returning a value in a void function

Fixes: 1d1722e91070d7c37687 ("mesa: add EXT_dsa NamedProgram functions")
Cc: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agomeson: simplify install_megadrivers.py invocation
Eric Engestrom [Tue, 26 Mar 2019 10:55:37 +0000 (10:55 +0000)]
meson: simplify install_megadrivers.py invocation

Note: `find_program()` needs a shebang on scripts.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
4 years agonine: fix empty-body-issues
Eric Engestrom [Thu, 31 Oct 2019 01:26:05 +0000 (01:26 +0000)]
nine: fix empty-body-issues

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Fixes: 8d43e2b2ded0fe3c82d4 ("meson: add -Werror=empty-body to disallow `if(x);`")
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
4 years agoamd: fix empty-body issues
Eric Engestrom [Mon, 28 Oct 2019 23:47:48 +0000 (23:47 +0000)]
amd: fix empty-body issues

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Fixes: 8d43e2b2ded0fe3c82d4 ("meson: add -Werror=empty-body to disallow `if(x);`")
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
4 years agou_format: move format tests to util/tests/
Eric Engestrom [Sat, 16 Nov 2019 19:14:56 +0000 (19:14 +0000)]
u_format: move format tests to util/tests/

Suggested-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
4 years agoutil/format: add trivial srgb<->linear conversion test
Eric Engestrom [Thu, 7 Nov 2019 17:33:19 +0000 (17:33 +0000)]
util/format: add trivial srgb<->linear conversion test

This would've caught 8829f9ccb0267d113283 ("u_format: add ETC2 to
util_format_srgb/util_format_linear").

Suggested-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
4 years agoutil/format: add PIPE_FORMAT_ASTC_*x*x*_SRGB to util_format_{srgb,linear}()
Eric Engestrom [Thu, 7 Nov 2019 18:08:09 +0000 (18:08 +0000)]
util/format: add PIPE_FORMAT_ASTC_*x*x*_SRGB to util_format_{srgb,linear}()

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
4 years agoutil/format: remove left-over util_format_description_table declaration
Eric Engestrom [Thu, 7 Nov 2019 17:29:00 +0000 (17:29 +0000)]
util/format: remove left-over util_format_description_table declaration

Fixes: 3c45c4bc44310c1af4f0 ("util: Cope with the fact that formats in u_format.csv are not ordered.")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
4 years agogallivm: fixup const int64 builder.
Dave Airlie [Fri, 27 Dec 2019 19:41:44 +0000 (05:41 +1000)]
gallivm: fixup const int64 builder.

Pointed out by Ilia.

Fixes: 84ba00877496 (gallivm: add 64-bit const int creator.)
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agoradeonsi/gfx10: improve performance for TES using PrimID but not exporting it
Marek Olšák [Tue, 17 Dec 2019 02:05:05 +0000 (21:05 -0500)]
radeonsi/gfx10: improve performance for TES using PrimID but not exporting it

This field is really for the primitive export to the pixel shader.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agoradeonsi/gfx10: enable NGG passthrough for eligible shaders
Marek Olšák [Tue, 17 Dec 2019 00:09:21 +0000 (19:09 -0500)]
radeonsi/gfx10: enable NGG passthrough for eligible shaders

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agoradeonsi/gfx10: don't declare any LDS for NGG if it's not used
Marek Olšák [Tue, 17 Dec 2019 00:00:00 +0000 (19:00 -0500)]
radeonsi/gfx10: don't declare any LDS for NGG if it's not used

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agopanfrost: Remove 32-bit next_job path
Alyssa Rosenzweig [Fri, 27 Dec 2019 18:03:22 +0000 (13:03 -0500)]
panfrost: Remove 32-bit next_job path

It has been unused for a while; let's just remove the abstraction.
Technically the hardware does support 32-bit job descriptors, but we
don't and we can't keep them from breaking so let's not pretend they
work.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
4 years agopanfrost; Update comment about work/uniform_count
Alyssa Rosenzweig [Fri, 27 Dec 2019 18:01:17 +0000 (13:01 -0500)]
panfrost; Update comment about work/uniform_count

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Remove mali_alt_func
Alyssa Rosenzweig [Fri, 27 Dec 2019 17:56:03 +0000 (12:56 -0500)]
panfrost: Remove mali_alt_func

There's only one way to encode comparison functions in the command
stream, not two. It's just that the semantics for texture comparisons
are flipped from the semantics of stencil comparison. We can factor out
that flip to common Panfrost code, rather than tying it to a second
Gallium routine.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Add missing #include in common header
Alyssa Rosenzweig [Fri, 27 Dec 2019 17:56:56 +0000 (12:56 -0500)]
panfrost: Add missing #include in common header

Fixes way back when...

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Add pan_attributes.c to Android.mk
Alyssa Rosenzweig [Fri, 27 Dec 2019 17:54:35 +0000 (12:54 -0500)]
panfrost: Add pan_attributes.c to Android.mk

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 31305e1b285 ("panfrost: Move instancing routines to encoder/")
4 years agopanfrost: Implement remaining texture wrap modes
Alyssa Rosenzweig [Fri, 27 Dec 2019 17:42:53 +0000 (12:42 -0500)]
panfrost: Implement remaining texture wrap modes

Somehow we have native hardware for all of these. Suspected by staring
at the bit pattern; confirmed by poking in various texture wrap modes
into the textures mesa demo and seeing what happens.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Inline away MALI_NEGATIVE
Alyssa Rosenzweig [Fri, 27 Dec 2019 17:16:09 +0000 (12:16 -0500)]
panfrost: Inline away MALI_NEGATIVE

It's an awfully fancy way to add one...

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Remove MALI_ATTR_INTERNAL
Alyssa Rosenzweig [Fri, 27 Dec 2019 17:11:37 +0000 (12:11 -0500)]
panfrost: Remove MALI_ATTR_INTERNAL

It's a relic from before we understood the varying builtins. It should
never actually come up if the builtins are decoded correctly.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Update information on fixed attributes/varyings
Alyssa Rosenzweig [Fri, 27 Dec 2019 17:10:24 +0000 (12:10 -0500)]
panfrost: Update information on fixed attributes/varyings

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Remove MALI_SPECIAL_ATTRIBUTE_BASE defines
Alyssa Rosenzweig [Fri, 27 Dec 2019 17:08:45 +0000 (12:08 -0500)]
panfrost: Remove MALI_SPECIAL_ATTRIBUTE_BASE defines

These are conventions by the blob (a convention we happent to follow).
They are not at all intrinsic to the hardware, so now that the
convention is implemented within the Midgard stack, these defines are
wholly unused. Remove them.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Fix minor typo
Alyssa Rosenzweig [Fri, 27 Dec 2019 17:07:45 +0000 (12:07 -0500)]
pan/midgard: Fix minor typo

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reported-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
4 years agoandroid: radv: build radv_shader_args.c
Mauro Rossi [Sun, 8 Dec 2019 08:40:36 +0000 (09:40 +0100)]
android: radv: build radv_shader_args.c

Updates radv Makefile.sources and fixes the following building error:

external/mesa/src/amd/vulkan/radv_shader.c:1122:
error: undefined reference to 'radv_declare_shader_args'

Fixes: 3b14336 ("ac/nir, radv, radeonsi: Switch to using ac_shader_args")
Fixes: 66c703b ("radv: Move argument declaration out of nir_to_llvm")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
4 years agoandroid: radeonsi,ac: fix building error due to ac changes
Mauro Rossi [Sun, 8 Dec 2019 08:40:36 +0000 (09:40 +0100)]
android: radeonsi,ac: fix building error due to ac changes

Updates amd Makefile.sources and fixes the following building errors:

external/mesa/src/gallium/drivers/radeonsi/si_compute_prim_discard.c:338: error: undefined reference to 'ac_add_arg'
external/mesa/src/gallium/drivers/radeonsi/si_compute_prim_discard.c:340: error: undefined reference to 'ac_add_arg'
external/mesa/src/gallium/drivers/radeonsi/si_compute_prim_discard.c:341: error: undefined reference to 'ac_add_arg'
external/mesa/src/gallium/drivers/radeonsi/si_compute_prim_discard.c:342: error: undefined reference to 'ac_add_arg'

Fixes: 9885af3 ("ac: Add a shared interface between radv, radeonsi, LLVM and ACO")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
4 years agoandroid: radv: fix vk_format_table.c generated source build
Mauro Rossi [Sun, 8 Dec 2019 08:40:36 +0000 (09:40 +0100)]
android: radv: fix vk_format_table.c generated source build

RADV Android build rules are now getting the wrong vk_format.h
from src/vulkan/util include, the simplest way to fix is to add
src/amd/vulkan include prior to src/vulkan/util include

Fixes the following building errors:

out/target/product/x86_64/obj_x86/STATIC_LIBRARIES/libmesa_radv_common_intermediates/vk_format_table.c:39:4:
 error: use of undeclared identifier 'VK_FORMAT_LAYOUT_PLAIN'
...
out/target/product/x86_64/obj_x86/STATIC_LIBRARIES/libmesa_radv_common_intermediates/vk_format_table.c:131:8:
error: use of undeclared identifier 'VK_FORMAT_TYPE_UNSIGNED'; did you mean 'UTIL_FORMAT_TYPE_UNSIGNED'?
      {VK_FORMAT_TYPE_UNSIGNED, true, false, false, 4, 0},      /* x = a */
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Fixes: 3a28281 ("util: Add a mapping from VkFormat to PIPE_FORMAT.")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
4 years agoandroid: util: Add a mapping from VkFormat to PIPE_FORMAT.
Mauro Rossi [Sun, 8 Dec 2019 08:40:36 +0000 (09:40 +0100)]
android: util: Add a mapping from VkFormat to PIPE_FORMAT.

Updates Makefile.sources and fixes the following building error:

In file included from external/mesa/src/vulkan/util/vk_format.c:24:
In file included from external/mesa/src/vulkan/util/vk_format.h:28:
external/mesa/src/util/format/u_format.h:33:10: fatal error: 'pipe/p_format.h' file not found
#include "pipe/p_format.h"
         ^~~~~~~~~~~~~~~~~
1 error generated.

Fixes: 3a28281 ("util: Add a mapping from VkFormat to PIPE_FORMAT.")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agoandroid: nir: add a load/store vectorization pass
Mauro Rossi [Sun, 8 Dec 2019 08:40:36 +0000 (09:40 +0100)]
android: nir: add a load/store vectorization pass

Fixes the following aco building error:

external/mesa/src/amd/compiler/aco_instruction_selection_setup.cpp:846:
error: undefined reference to 'nir_opt_load_store_vectorize'

Fixes: ce9205c ("nir: add a load/store vectorization pass")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agollvmpipe: add debug option to enable OpenCL support.
Dave Airlie [Tue, 10 Dec 2019 04:55:43 +0000 (14:55 +1000)]
llvmpipe: add debug option to enable OpenCL support.

LP_DEBUG=cl will enable CL support for now.

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agogallivm/nir: add vec8/16 support
Dave Airlie [Thu, 12 Dec 2019 01:48:48 +0000 (11:48 +1000)]
gallivm/nir: add vec8/16 support

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agogallivm/nir: lower packing
Dave Airlie [Fri, 13 Dec 2019 03:17:48 +0000 (13:17 +1000)]
gallivm/nir: lower packing

This fixes some CL upsample tests, which lower into packing that needs
lowering.

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agollvmpipe: lower hadd/add_sat
Dave Airlie [Thu, 12 Dec 2019 05:33:51 +0000 (15:33 +1000)]
llvmpipe: lower hadd/add_sat

Fixes some CL piglits.

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agogallivm: handle non-32 bit undefined
Dave Airlie [Thu, 12 Dec 2019 02:42:25 +0000 (12:42 +1000)]
gallivm: handle non-32 bit undefined

other sized undefs caused llvm asserts

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agollvmpipe/nir: use nir_max_vec_components in more places
Dave Airlie [Thu, 12 Dec 2019 01:48:31 +0000 (11:48 +1000)]
llvmpipe/nir: use nir_max_vec_components in more places

This is prep work for when vec8/16 have landed.

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agollvmpipe: add support for compute shader params
Dave Airlie [Tue, 10 Dec 2019 04:55:34 +0000 (14:55 +1000)]
llvmpipe: add support for compute shader params

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agollvmpipe: handle serialized nir as a shader type.
Dave Airlie [Tue, 10 Dec 2019 04:55:17 +0000 (14:55 +1000)]
llvmpipe: handle serialized nir as a shader type.

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agogallivm/llvmpipe: add support for global operations.
Dave Airlie [Tue, 10 Dec 2019 04:53:51 +0000 (14:53 +1000)]
gallivm/llvmpipe: add support for global operations.

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agogallivm/llvmpipe: add support for block size intrinsic
Dave Airlie [Tue, 10 Dec 2019 04:52:49 +0000 (14:52 +1000)]
gallivm/llvmpipe: add support for block size intrinsic

We have to pass the main block size into the coroutine
and into the shader.

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agogallivm/llvmpipe: add support for work dimension intrinsic.
Dave Airlie [Tue, 10 Dec 2019 04:51:57 +0000 (14:51 +1000)]
gallivm/llvmpipe: add support for work dimension intrinsic.

We have to pass the work_dim given by the user into the shader.

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agotgsi/mesa: handle KERNEL case
Dave Airlie [Tue, 10 Dec 2019 04:49:00 +0000 (14:49 +1000)]
tgsi/mesa: handle KERNEL case

Translate to compute for now.

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agogallivm/nir: allow 8/16-bit conversion and comparison.
Dave Airlie [Thu, 12 Dec 2019 05:03:01 +0000 (15:03 +1000)]
gallivm/nir: allow 8/16-bit conversion and comparison.

This adds the convert to 8/16 and support for 8/16 comparsions

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agogallivm: pick integer builders for alu instructions.
Dave Airlie [Thu, 12 Dec 2019 05:02:14 +0000 (15:02 +1000)]
gallivm: pick integer builders for alu instructions.

This allows these to be used with non 32-bit types.

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agogallivm: add support for 8-bit/16-bit integer builders
Dave Airlie [Tue, 10 Dec 2019 04:47:07 +0000 (14:47 +1000)]
gallivm: add support for 8-bit/16-bit integer builders

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agollvmpipe/gallivm: add kernel inputs
Dave Airlie [Tue, 10 Dec 2019 04:45:19 +0000 (14:45 +1000)]
llvmpipe/gallivm: add kernel inputs

compute shaders need kernel input support

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agogallivm: add 64-bit const int creator.
Dave Airlie [Tue, 10 Dec 2019 04:41:55 +0000 (14:41 +1000)]
gallivm: add 64-bit const int creator.

Acked-by: Roland Scheidegger <sroland@vmware.com>
4 years agonir: sanitize work group intrinsics to always be 32-bit.
Dave Airlie [Wed, 11 Dec 2019 23:39:21 +0000 (09:39 +1000)]
nir: sanitize work group intrinsics to always be 32-bit.

This saves handling them in the backend later.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
4 years agoradv: Expose all sample counts for integer formats as well.
Bas Nieuwenhuizen [Tue, 24 Dec 2019 13:44:03 +0000 (14:44 +0100)]
radv: Expose all sample counts for integer formats as well.

Things work the same between float and integer.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2261
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
4 years agopanfrost: Route gl_VertexID through cmdstream
Alyssa Rosenzweig [Thu, 19 Dec 2019 19:00:24 +0000 (14:00 -0500)]
panfrost: Route gl_VertexID through cmdstream

It shows up as a special (magic?) attribute. We could try to be clever
and only include the extra record if gl_VertexID is actually read, but
honestly that's just extra complexity for no good reason. Might as well
just always include it; this won't be a real bottleneck, I don't think.

Fixes dEQP-GLES3.functional.shaders.builtin_variable.vertex_id.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Extend attribute_count for vertex builtins
Alyssa Rosenzweig [Thu, 19 Dec 2019 18:39:14 +0000 (13:39 -0500)]
panfrost: Extend attribute_count for vertex builtins

They stretch beyond the usual limit for attributes so are included
implicitly.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Lower gl_VertexID/gl_InstanceID to attributes
Alyssa Rosenzweig [Thu, 19 Dec 2019 18:31:21 +0000 (13:31 -0500)]
pan/midgard: Lower gl_VertexID/gl_InstanceID to attributes

We have special records for these, put in a fixed location by convention
per the blob.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Factor out emit_attr_read
Alyssa Rosenzweig [Thu, 19 Dec 2019 18:24:17 +0000 (13:24 -0500)]
pan/midgard: Factor out emit_attr_read

We will load attributes directly for gl_VertexID.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Unset vertex_id_zero_based
Alyssa Rosenzweig [Thu, 19 Dec 2019 18:17:03 +0000 (13:17 -0500)]
panfrost: Unset vertex_id_zero_based

We don't want the lowering; we have native gl_VertexID.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/decode: Handle gl_VertexID/gl_InstanceID
Alyssa Rosenzweig [Thu, 19 Dec 2019 17:28:42 +0000 (12:28 -0500)]
pan/decode: Handle gl_VertexID/gl_InstanceID

Just like varyings have special records for point coordinates (etc),
attributes have special records for vertex/instance ID. We can parse
these fairly easily, although they don't line up exactly with normal
attribute records.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Remove pan_shift_odd
Alyssa Rosenzweig [Thu, 19 Dec 2019 21:46:43 +0000 (16:46 -0500)]
panfrost: Remove pan_shift_odd

Padded counts are numbers of the form:

   n = (2k + 1) * 2^s

for k, s integers. Rather than explicitly store k and s separately and
then compute this formula on demand, it's much cleaner to store the
padded number itself, which is what you manipulate most of the time.
When you do need k,s it is easy to factor by noticing the bitwise
representation:

   s = ctz(n)
   k = n >> (s + 1)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Slight cleanup of Gallium's pan_attribute.c
Alyssa Rosenzweig [Thu, 19 Dec 2019 21:46:28 +0000 (16:46 -0500)]
panfrost: Slight cleanup of Gallium's pan_attribute.c

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/decode: Fix reference computation for invocations
Alyssa Rosenzweig [Wed, 25 Dec 2019 03:33:47 +0000 (22:33 -0500)]
pan/decode: Fix reference computation for invocations

Slight bug with instancing. No harm done but let's get rid of the
pandecode warning, it's just noise.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Fix off-by-one in pan_invocation.c
Alyssa Rosenzweig [Wed, 25 Dec 2019 03:33:13 +0000 (22:33 -0500)]
panfrost: Fix off-by-one in pan_invocation.c

When instance_count=2, the packing code was broken. Fixes a dEQP test.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Factor out panfrost_compute_magic_divisor
Alyssa Rosenzweig [Wed, 25 Dec 2019 02:35:52 +0000 (21:35 -0500)]
panfrost: Factor out panfrost_compute_magic_divisor

The algorithm doesn't need to be tangled up in details about the
attribute records themselves. We'll need to compute magic divisors for
gl_InstanceID in a second.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Move instancing routines to encoder/
Alyssa Rosenzweig [Thu, 19 Dec 2019 21:39:56 +0000 (16:39 -0500)]
panfrost: Move instancing routines to encoder/

Nothing Gallium specific or stateful about them.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Factor batch/resource out of instancing routines
Alyssa Rosenzweig [Thu, 19 Dec 2019 21:26:43 +0000 (16:26 -0500)]
panfrost: Factor batch/resource out of instancing routines

They don't need them; this will allow us to move the code into encoder/
which in turn will make the messy Gallium code less scary.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Rename pan_instancing.c -> pan_attributes.c
Alyssa Rosenzweig [Thu, 19 Dec 2019 21:04:59 +0000 (16:04 -0500)]
panfrost: Rename pan_instancing.c -> pan_attributes.c

Let's follow the naming convention that panfrost command stream code is
organized by command stream structure.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Compute destination override
Alyssa Rosenzweig [Wed, 13 Nov 2019 12:58:48 +0000 (07:58 -0500)]
pan/midgard: Compute destination override

We shift over the mask in this case.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Add mir_upper_override helper
Alyssa Rosenzweig [Wed, 13 Nov 2019 02:22:53 +0000 (21:22 -0500)]
pan/midgard: Add mir_upper_override helper

Checks if we should emit a dest_override=upper, given a mask.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Support loads from R11G11B10 in a blend shader
Alyssa Rosenzweig [Mon, 16 Dec 2019 19:42:17 +0000 (14:42 -0500)]
pan/midgard: Support loads from R11G11B10 in a blend shader

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Enable lower_(un)pack_* lowering
Alyssa Rosenzweig [Tue, 24 Dec 2019 19:01:33 +0000 (14:01 -0500)]
pan/midgard: Enable lower_(un)pack_* lowering

These show up in some blend shaders. Let's use the shared lowering and
remove our own.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Increase PIPE_SHADER_CAP_MAX_OUTPUTS to 16
Tomeu Vizoso [Thu, 19 Dec 2019 15:01:15 +0000 (16:01 +0100)]
panfrost: Increase PIPE_SHADER_CAP_MAX_OUTPUTS to 16

GL ES 3.0 requires it to be higher, and stuff seems to work just fine.

Fixes: dEQP-GLES3.functional.implementation_limits.max_vertex_output_components
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
4 years agopanfrost: Handle Z24_UNORM_S8_UINT as MALI_Z32_UNORM
Tomeu Vizoso [Thu, 19 Dec 2019 11:51:06 +0000 (12:51 +0100)]
panfrost: Handle Z24_UNORM_S8_UINT as MALI_Z32_UNORM

Fixes dEQP-GLES3.functional.texture.format.sized.2d.depth24_stencil8_pot

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
4 years agopan/midgard: Implement shadow cubemaps
Alyssa Rosenzweig [Fri, 20 Dec 2019 22:25:05 +0000 (17:25 -0500)]
pan/midgard: Implement shadow cubemaps

We need to reshuffle to sync up the shadow coordinate temporary with the
cubemap coordinate temporary. Once that's in place, it's simple enough
(we load the shadow coordinate into .z like 2D).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Generalize temp coordinate to non-2D
Alyssa Rosenzweig [Fri, 20 Dec 2019 22:01:29 +0000 (17:01 -0500)]
pan/midgard: Generalize temp coordinate to non-2D

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Do witchcraft on texture offsets
Alyssa Rosenzweig [Fri, 20 Dec 2019 18:48:24 +0000 (13:48 -0500)]
pan/midgard: Do witchcraft on texture offsets

My latest divination spell has uncovered a pattern in the aether.
Although the swizzle is unaligned, its format is otherwise standard.
Document this, removing the old incorrect understanding of the swizzle
(which coincided on common special swizzles only).

Fixes dEQP-GLES3.functional.shaders.texture_functions.texelfetchoffset.sampler2d_fixed_fragment

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>