platform/upstream/mesa.git
4 years agopan/mdg: defer branch packing
Italo Nicola [Wed, 29 Jul 2020 20:14:55 +0000 (20:14 +0000)]
pan/mdg: defer branch packing

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

4 years agopan/mdg: refactor emit_alu_bundle
Italo Nicola [Wed, 29 Jul 2020 20:50:21 +0000 (20:50 +0000)]
pan/mdg: refactor emit_alu_bundle

This refactor prepares emit_alu_bundle() for the next commit that
reconstructs branch instructions right before emission.
It also simplifies the code since the previous control flow was only
better when we had the prepacked fields in midgard_instruction.

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

4 years agopan/mdg: remove ins->alu
Italo Nicola [Thu, 23 Jul 2020 14:02:55 +0000 (14:02 +0000)]
pan/mdg: remove ins->alu

This commit removes the `ins->alu` field from midgard_instruction,
simplifying the code by just recreating midgard_vector_alu later when we
have to emit it.

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

4 years agopan/mdg: externalize mir_pack_mod
Italo Nicola [Thu, 30 Jul 2020 16:20:26 +0000 (16:20 +0000)]
pan/mdg: externalize mir_pack_mod

midgard_print.c requires mir_pack_mod to remove references to ins->alu.

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

4 years agopan/mdg: defer register packing
Italo Nicola [Thu, 30 Jul 2020 16:57:55 +0000 (16:57 +0000)]
pan/mdg: defer register packing

This commit moves the packing of registers and other things from
install_registers_instr() to midgard_emit.c, right before emitting the
binary.

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

4 years agopan/mdg: eliminate references to ins->load_store.op
Italo Nicola [Thu, 23 Jul 2020 19:24:39 +0000 (19:24 +0000)]
pan/mdg: eliminate references to ins->load_store.op

This commit makes `ins->op` the correct field to use with load_store
instructions.

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

4 years agopan/mdg: eliminate references to ins->texture.op
Italo Nicola [Wed, 29 Jul 2020 19:10:25 +0000 (19:10 +0000)]
pan/mdg: eliminate references to ins->texture.op

This commit makes the `ins->op` the correct field to use with texture
instructions.

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

4 years agopan/mdg: apply float outmods to textures
Italo Nicola [Wed, 15 Jul 2020 18:48:42 +0000 (18:48 +0000)]
pan/mdg: apply float outmods to textures

Texture instructions in midgard support float outmods, this commit makes
it so these instructions are emitted when the conditions are met.

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

4 years agopan/mdg: eliminate references to ins->alu.outmod
Italo Nicola [Wed, 15 Jul 2020 18:43:18 +0000 (18:43 +0000)]
pan/mdg: eliminate references to ins->alu.outmod

In an effort to simplify MIR by not prepacking instructions, this commit
removes references to `ins->alu.outmod` so that we can later remove the
`ins->alu` field from midgard_instruction.
Every place that was using `ins->alu.outmod` was changed to now use the
generic `ins->outmod` field instead.
We then reconstruct the outmod field right before emission.

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

4 years agopan/mdg: fix comment
Italo Nicola [Wed, 15 Jul 2020 09:23:18 +0000 (09:23 +0000)]
pan/mdg: fix comment

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

4 years agopan/mdg: eliminate references to ins->alu.reg_mode
Italo Nicola [Fri, 10 Jul 2020 09:36:58 +0000 (09:36 +0000)]
pan/mdg: eliminate references to ins->alu.reg_mode

In an effort to simplify MIR by not prepacking instructions, this commit
removes references to `ins->alu.reg_mode` so that we can later remove
the `ins->alu` field from midgard_instruction.
Every place that was using reg_mode was changed to now use the generic
`ins->src_type` field instead.
We then reconstruct the reg_mode field right before emission.

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

4 years agopan/mdg: eliminate references to ins->alu.op
Italo Nicola [Thu, 9 Jul 2020 12:02:57 +0000 (12:02 +0000)]
pan/mdg: eliminate references to ins->alu.op

In an effort to simplify MIR by not prepacking instructions, this commit
removes references to `ins->alu.op` so that we can later remove the
`ins->alu` field from midgard_instruction.
Every place that was using ins->op was changed to now use the generic
`ins->op` field instead.
We then reconstruct the `alu.op` field right before emission.
This new field is generic and can contain opcodes for ALU, texture or
load/store instructions. It should be used in conjunction with
`ins->type`, just like the current prepacked `op` field.

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

4 years agopan/mdg: prepare effective_writemask()
Italo Nicola [Fri, 10 Jul 2020 16:07:06 +0000 (16:07 +0000)]
pan/mdg: prepare effective_writemask()

In the next commits we will be removing the `alu` field from
midgard_instruction in order to simplify the code.
effective_writemask() doesn't actually use `alu` for anything, it only
needs to know the opcode.

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

4 years agopan/mdg: fix src_type in instructions that need a implicit zero
Italo Nicola [Fri, 10 Jul 2020 14:51:52 +0000 (14:51 +0000)]
pan/mdg: fix src_type in instructions that need a implicit zero

We were incorrectly assuming uint32 for src_type[1] regardless of
src_type[0].

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

4 years agodrm-shim: Return -EINVAL instead of abort()ing on unknown ioctls.
Eric Anholt [Mon, 20 Jul 2020 18:21:36 +0000 (11:21 -0700)]
drm-shim: Return -EINVAL instead of abort()ing on unknown ioctls.

I had this as abort() in my original implementation since I was doing
drm-shim and my kernel driver in parallel based around using a SW
simulator, and I wanted to always update both, but it means that people's
new feature detection code can easily end up breaing their drm-shim
shader-db runs (such as intel's kernel_has_dynamic_config_support()
checking for -ENOENT instead of -EINVAL for a feature, which showed up on
my personal runner but not fd.o's for reasons I'm unclear on).

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5994>

4 years agou_prim_restart: handle indirect draws
Mike Blumenkrantz [Sat, 11 Jul 2020 15:19:43 +0000 (11:19 -0400)]
u_prim_restart: handle indirect draws

this is pretty gross, but we need to map the indirect buffer to get the
index info and then use that for mapping the index buffer and translating
the restart index

Reviewed-by: Dave Airlie <airlied@redhat.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5886>

4 years agopanfrost: Android build fixes 2020 week 31
Roman Stratiienko [Tue, 28 Jul 2020 21:01:39 +0000 (00:01 +0300)]
panfrost: Android build fixes 2020 week 31

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6109>

4 years agoaco: optimize swizzled SALU 8/16-bit conversions
Rhys Perry [Fri, 29 May 2020 13:26:50 +0000 (14:26 +0100)]
aco: optimize swizzled SALU 8/16-bit conversions

We only need one s_bfe for a conversion with a swizzled source.

shader-db (parallel-rdp, Navi):
Totals from 487 (71.30% of 683) affected shaders:
SpillSGPRs: 3284 -> 3233 (-1.55%); split: -2.71%, +1.16%
SpillVGPRs: 2174 -> 2150 (-1.10%); split: -1.24%, +0.14%
CodeSize: 2497864 -> 2445544 (-2.09%); split: -2.11%, +0.01%
Instrs: 450613 -> 445104 (-1.22%); split: -1.27%, +0.05%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5259>

4 years agoradv: fix build on Android 7 (v2)
Mauro Rossi [Thu, 23 Jul 2020 20:50:32 +0000 (22:50 +0200)]
radv: fix build on Android 7 (v2)

Fixes the following building error:

external/mesa/src/amd/vulkan/radv_android.c:28:10: fatal error:
'vndk/hardware_buffer.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~

(v2) use the existing preprocessor condition #if ANDROID_API_LEVEL >= 26

Fixes: f36b527 "radv/android: Add android hardware buffer queries."
Reported-and-tested-by: youling 257 <youling257@gmail.com>
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6051>

4 years agonir: Get rid of __[u]int64_to_fp32() and __fp32_to_[u]int64()
Boris Brezillon [Tue, 21 Jul 2020 12:30:41 +0000 (14:30 +0200)]
nir: Get rid of __[u]int64_to_fp32() and __fp32_to_[u]int64()

Those are now handled by nir_lower_int64() which has native NIR
implementations.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5588>

4 years agointel: Set int64_options to ~0 when lowering 64b ops
Boris Brezillon [Mon, 13 Jul 2020 18:57:04 +0000 (20:57 +0200)]
intel: Set int64_options to ~0 when lowering 64b ops

That's more future proof than setting each bit manually. Looks like we
already miss nir_lower_ufind_msb64 because of that.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5588>

4 years agonir: Extend nir_lower_int64() to support i2f/f2i lowering
Boris Brezillon [Fri, 19 Jun 2020 15:28:09 +0000 (17:28 +0200)]
nir: Extend nir_lower_int64() to support i2f/f2i lowering

That's an attempt at replacing the complex __int64_to_float() and
__float_to_int64() implementations found in float64.glsl by a simpler
native NIR equivalent.

Thanks to that, we can have lower those conversion without having to
compile a GLSL shader, which would be quite annoying for OpenCL
kernels.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5588>

4 years agonir: Stop passing an options arg to nir_lower_int64()
Boris Brezillon [Mon, 13 Jul 2020 18:28:16 +0000 (20:28 +0200)]
nir: Stop passing an options arg to nir_lower_int64()

This information is exposed through shader->options->lower_int64_options.
Removing the extra arg forces drivers to initialize this field correctly.

This also allows us to check the int64 lowering options from each int64
lowering helper and decide if we should lower the instructions we
introduce.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5588>

4 years agofreedreno: Initialize lower_int64_options to a proper value
Boris Brezillon [Tue, 28 Jul 2020 08:26:54 +0000 (10:26 +0200)]
freedreno: Initialize lower_int64_options to a proper value

We're trying to get rid of the options argument passed to
nir_lower_int64() and use the nir_options.lower_int64_options instead.
But before we can do that we must patch nir_lower_int64() callers
that don't have this field properly set.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5588>

4 years agoaco: add GFX6/7 subdword lowering tests
Daniel Schürmann [Tue, 26 May 2020 20:56:18 +0000 (21:56 +0100)]
aco: add GFX6/7 subdword lowering tests

Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3521>

4 years agoaco/tests: add tests for sub-dword swaps
Rhys Perry [Mon, 6 Apr 2020 16:14:12 +0000 (17:14 +0100)]
aco/tests: add tests for sub-dword swaps

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3521>

4 years agoci: enable ACO tests
Rhys Perry [Wed, 3 Jun 2020 13:25:12 +0000 (14:25 +0100)]
ci: enable ACO tests

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3521>

4 years agoaco: add framework for testing isel and integration tests
Rhys Perry [Fri, 14 Feb 2020 11:32:18 +0000 (11:32 +0000)]
aco: add framework for testing isel and integration tests

And add some simple tests to demonstrate/test the pipeline builder and
glsl_scraper.py.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3521>

4 years agoaco: add a few tests for the assembler and optimizer
Rhys Perry [Wed, 22 Jan 2020 19:59:56 +0000 (19:59 +0000)]
aco: add a few tests for the assembler and optimizer

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3521>

4 years agoaco: add framework for unit testing
Rhys Perry [Wed, 22 Jan 2020 19:58:27 +0000 (19:58 +0000)]
aco: add framework for unit testing

And add some "tests" to test and document currently unused features of the
framework.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3521>

4 years agonir: Allow casts in nir_deref_instr_get[_const]_offset()
Boris Brezillon [Mon, 29 Jun 2020 13:36:49 +0000 (15:36 +0200)]
nir: Allow casts in nir_deref_instr_get[_const]_offset()

Allow casts in a deref chain so we can calculate an offset from
a base pointer dereference or have pointer type casts in the
middle of the chain (both are pretty common in CL).

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5682>

4 years agonir: Use a switch in build_deref_offset()/deref_instr_get_const_offset()
Boris Brezillon [Mon, 13 Jul 2020 12:40:38 +0000 (14:40 +0200)]
nir: Use a switch in build_deref_offset()/deref_instr_get_const_offset()

We are about to add support for casts when calculating offset, but let's
first turn the if()/else if()/else block into a switch() statement to
ease addition of new cases.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5682>

4 years agoci: Generate MinIO credentials within LAVA jobs
Tomeu Vizoso [Thu, 30 Jul 2020 09:09:38 +0000 (11:09 +0200)]
ci: Generate MinIO credentials within LAVA jobs

As these credentials are valid only for 15 minutes, generate them closer
to when they are going to be used.

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

4 years agoci/bare-metal: Capture the first devcoredump a job produces.
Eric Anholt [Wed, 22 Jul 2020 20:59:49 +0000 (13:59 -0700)]
ci/bare-metal: Capture the first devcoredump a job produces.

Connor recently ran into an issue where the chezas were hanging where his
GPUs weren't, and was blocked on getting some feedback on what was
happening.  A devcoredump will help non-cheza-having devs debug (or
hopefully with other intermittent fails).

Closes: #3187
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6036>

4 years agoci: Print URL to image diff when a trace replay fails
Tomeu Vizoso [Thu, 23 Jul 2020 14:46:46 +0000 (16:46 +0200)]
ci: Print URL to image diff when a trace replay fails

Developers can see how the rendering differed from the executed value.

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

4 years agoci: Upload reference images for traces
Tomeu Vizoso [Thu, 23 Jul 2020 14:24:10 +0000 (16:24 +0200)]
ci: Upload reference images for traces

After a trace succeeds, check if the rendered image already exists in
the repository of reference images, and upload it if it doesn't.

This image will be used for comparing with failed retraces.

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

4 years agointel/vec4: fix out of bounds read
Marcin Ślusarz [Fri, 24 Jul 2020 18:13:00 +0000 (20:13 +0200)]
intel/vec4: fix out of bounds read

NIR_MAX_VEC_COMPONENTS was bumped from 4 to 16 in a8ec4082
(2019.03.09, merged 2019.12.21)

float[4] array was added in acd7796a
(2019.06.11, merged 2019.07.11)

Found by Coverity.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3014

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Fixes: a8ec4082a41 ("nir+vtn: vec8+vec16 support")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>

4 years agoiris: quiet down static analyzers
Marcin Ślusarz [Fri, 24 Jul 2020 18:01:37 +0000 (20:01 +0200)]
iris: quiet down static analyzers

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>

4 years agomesa: quiet down static analyzers
Marcin Ślusarz [Fri, 24 Jul 2020 17:51:30 +0000 (19:51 +0200)]
mesa: quiet down static analyzers

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>

4 years agomesa: fix out of bounds access in glGetFramebufferParameterivEXT
Marcin Ślusarz [Fri, 24 Jul 2020 17:19:07 +0000 (19:19 +0200)]
mesa: fix out of bounds access in glGetFramebufferParameterivEXT

ColorDrawBuffer is an array of MAX_DRAW_BUFFERS == 8.

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Fixes: 7534c536ca0 ("mesa: add EXT_dsa (Named)Framebuffer functions")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>

4 years agoutil/format: initialize non-important components to 0
Marcin Ślusarz [Fri, 24 Jul 2020 16:59:41 +0000 (18:59 +0200)]
util/format: initialize non-important components to 0

Avoids copying random garbage from the stack.

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>

4 years agoutil: fix possible buffer overflow in util_get_process_exec_path
Marcin Ślusarz [Fri, 24 Jul 2020 16:14:24 +0000 (18:14 +0200)]
util: fix possible buffer overflow in util_get_process_exec_path

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Fixes: f8f1413070a ("util/u_process: add util_get_process_exec_path")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>

4 years agoglsl: catch out of bounds access in the debug version
Marcin Ślusarz [Fri, 24 Jul 2020 15:59:36 +0000 (17:59 +0200)]
glsl: catch out of bounds access in the debug version

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>

4 years agoutil: fix possible fd leaks in os_socket_listen_abstract
Marcin Ślusarz [Fri, 24 Jul 2020 15:51:25 +0000 (17:51 +0200)]
util: fix possible fd leaks in os_socket_listen_abstract

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Fixes: ef5266ebd50 ("util/os_socket: Add socket related functions.")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>

4 years agovulkan/util: add struct vk_pipeline_cache_header
Alejandro Piñeiro [Fri, 3 Jul 2020 22:54:19 +0000 (00:54 +0200)]
vulkan/util: add struct vk_pipeline_cache_header

Header is defined at vkGetPipelineCacheData spec, in any vulkan
version, and anv, tu and radv were using the same struct, and v3dv was
about to do the same.

Defining the same struct four times seemed odd, so let's define on a
common place.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6058>

4 years agofreedreno/a6xx: fixup draw state earlier
Rob Clark [Wed, 29 Jul 2020 17:14:34 +0000 (10:14 -0700)]
freedreno/a6xx: fixup draw state earlier

`fixup_draw_state()` was updating `ctx->dirty` after it had already been
copied into the emit struct, which had the result that we were not re-
emitting the rast state when primitive_restart changes.

Fixes: 4d8f42c8512 ("freedreno/a6xx: separate rast stateobj for prim restart")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3067
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6117>

4 years agofreedreno/a6xx: don't emit a bogus size for empty cb slots
Rob Clark [Wed, 29 Jul 2020 16:09:19 +0000 (09:09 -0700)]
freedreno/a6xx: don't emit a bogus size for empty cb slots

Noticed that asphalt9 had no uniforms bound, so cb[0] is null.  In
theory shouldn't cause a problem, since nothing is doing `ldc` against
cb[0], but to be safe we should use SIZE=0.

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

4 years agofreedreno/ir3: add missing track_ubo_use()
Rob Clark [Wed, 29 Jul 2020 15:37:29 +0000 (08:37 -0700)]
freedreno/ir3: add missing track_ubo_use()

We could lower *some* accesses to a UBO but not others.  In this case,
we would have a valid range, but would have skipped tracking that the
UBO is accessed as a UBO rather than push constants.

Fixes one issue with asphalt9, that was a result of having `ldc` without
having emit UBO state.

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

4 years agoegl/dri2: only take a dri2_dpy reference when binding a new context/surfaces
Frank Binns [Tue, 28 Jul 2020 14:50:30 +0000 (15:50 +0100)]
egl/dri2: only take a dri2_dpy reference when binding a new context/surfaces

This effectively reverts part of 2907faee, which changed dri2_make_current() to
always take a dri2_dpy reference regardless of whether or not a new context or
surface(s) were being bound. This led to a reference count imbalance as there
was no corresponding code added to drop a reference on the dri2_dpy. As a
consequence, any application that called eglInitialize() on a default/native
display after having called eglTerminate() would always get back the old
dri2_dpy, inheriting its previous state.

As the reference count is there to prevent the dri2_dpy from being destroyed
between eglTerminate() and eglInitialize() calls when a context is still bound,
a reference should only be taken when a successful call to
dri2_dpy->core->bindContext() has been made. Fix the issue by restoring the old
reference counting behaviour.

Fixes: 4e8f95f64d004 ("egl_dri2: Always unbind old contexts")
Fixes: 2907faee7a397 ("egl/dri2: try to bind old context if bindContext failed")
Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Nicolas Cortes <nicolas.g.cortes@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3328
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6105>

4 years agofreedreno/decode: cffdec warnings cleanup
Rob Clark [Wed, 29 Jul 2020 18:29:57 +0000 (11:29 -0700)]
freedreno/decode: cffdec warnings cleanup

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

4 years agofreedreno/rnn: headergen2 warnings cleanup
Rob Clark [Wed, 29 Jul 2020 18:25:13 +0000 (11:25 -0700)]
freedreno/rnn: headergen2 warnings cleanup

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

4 years agoiris: Delete shader variants when deleting the API-facing shader
Kenneth Graunke [Wed, 5 Jun 2019 20:12:58 +0000 (13:12 -0700)]
iris: Delete shader variants when deleting the API-facing shader

We were space-leaking iris_compiled_shader objects, leaving them around
basically forever - long after the associated iris_uncompiled_shader was
deleted.  Perhaps even more importantly, this left the BO containing the
assembly referenced, meaning those were never reclaimed either.  For
long running applications, this can leak quite a bit of memory.

Now, when freeing iris_uncompiled_shader, we hunt down any associated
iris_compiled_shader objects and pitch those (and their BO) as well.

One issue is that the shader variants can still be bound, because we
haven't done a draw that updates the compiled shaders yet.  This can
cause issues because state changes want to look at the old program to
know what to flag dirty.  It's a bit tricky to get right, so instead
we defer variant deletion until the shaders are properly unbound, by
stashing them on a "dead" list and tidying that each time we try and
delete some shader variants.

This ensures long running programs delete their shaders eventually.

Fixes: ed4ffb97158 ("iris: rework program cache interface")
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6075>

4 years agoaco: remove isel for GLSL-style barriers
Rhys Perry [Mon, 20 Jul 2020 13:34:21 +0000 (14:34 +0100)]
aco: remove isel for GLSL-style barriers

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5980>

4 years agoradv: use scoped barriers
Rhys Perry [Fri, 17 Jul 2020 18:17:10 +0000 (19:17 +0100)]
radv: use scoped barriers

fossil-db (LLVM, Navi):
Totals from 843 (0.62% of 135820) affected shaders:
SGPRs: 40456 -> 40480 (+0.06%); split: -0.10%, +0.16%
VGPRs: 39648 -> 39688 (+0.10%); split: -0.01%, +0.11%
CodeSize: 2936164 -> 2932508 (-0.12%); split: -0.21%, +0.09%
MaxWaves: 10828 -> 10827 (-0.01%)

fossil-db changes seem to be due to SPIR-V -> NIR emitting a workgroup
scope shared memory barrier instead of a group_memory_barrier.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5980>

4 years agoac/nir: implement scoped_barrier
Rhys Perry [Fri, 17 Jul 2020 18:16:08 +0000 (19:16 +0100)]
ac/nir: implement scoped_barrier

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5980>

4 years agonir/load_store_vectorize: fix indentation
Rhys Perry [Fri, 17 Jul 2020 16:15:26 +0000 (17:15 +0100)]
nir/load_store_vectorize: fix indentation

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5980>

4 years agonir: Filter modes of scoped memory barrier in nir_opt_load_store_vectorize
Caio Marcelo de Oliveira Filho [Sat, 11 Jan 2020 01:33:31 +0000 (17:33 -0800)]
nir: Filter modes of scoped memory barrier in nir_opt_load_store_vectorize

Otherwise a scoped memory barrier containing nir_var_mem_ubo (which
memoryBarrier() does lower to) would incorrectly prevent the
optimization to happen in UBOs.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5980>

4 years agonir: Add a find_variable_with_[driver_]location helper
Jason Ekstrand [Thu, 23 Jul 2020 04:37:27 +0000 (23:37 -0500)]
nir: Add a find_variable_with_[driver_]location helper

We've hand-rolled this loop 10 places and those are just the ones I
found easily.

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

4 years agonir/gl_nir_linker: Call add_vars_with_modes once for GL_PROGRAM_INPUT
Jason Ekstrand [Tue, 21 Jul 2020 16:55:27 +0000 (11:55 -0500)]
nir/gl_nir_linker: Call add_vars_with_modes once for GL_PROGRAM_INPUT

Now that nir_foreach_variable_with_modes can handle multiple modes at
one time, we can simplify things a bit and only walk the list once.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir/split_per_member_structs: Inline split_variables_in_list
Jason Ekstrand [Tue, 21 Jul 2020 16:32:38 +0000 (11:32 -0500)]
nir/split_per_member_structs: Inline split_variables_in_list

This lets us do one list walk instead of three.

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

4 years agonir: Use a single list for all shader variables
Jason Ekstrand [Mon, 20 Jul 2020 21:30:37 +0000 (16:30 -0500)]
nir: Use a single list for all shader variables

Instead of having separate lists of variables, roughly sorted by mode,
use a single list for all shader-level NIR variables.  This makes a few
list walks a bit longer here and there but list walks aren't a very
common thing in NIR at all.  On the other hand, it makes a lot of things
like validation, printing, etc. way simpler.  Also, there are a number
of cases where we move variables from inputs/outputs to globals and this
makes it way easier because we no longer have to move them between
lists.  We only have to deal with that if moving them from the shader to
a nir_function_impl.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agogallium/ttn: Use variable create/add helpers
Jason Ekstrand [Tue, 21 Jul 2020 17:15:27 +0000 (12:15 -0500)]
gallium/ttn: Use variable create/add helpers

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

4 years agomesa/ptn: Use nir_variable_create
Jason Ekstrand [Tue, 21 Jul 2020 17:09:28 +0000 (12:09 -0500)]
mesa/ptn: Use nir_variable_create

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

4 years agoaco: Use nir_foreach_variable_with_modes to walk SSBOs
Jason Ekstrand [Tue, 21 Jul 2020 16:57:21 +0000 (11:57 -0500)]
aco: Use nir_foreach_variable_with_modes to walk SSBOs

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agopanfrost: Use nir_foreach_variable_with_modes in pan_compile
Jason Ekstrand [Tue, 21 Jul 2020 23:13:34 +0000 (18:13 -0500)]
panfrost: Use nir_foreach_variable_with_modes in pan_compile

Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>

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

4 years agopanfrost/midgard: Make search_var take a nir_shader and mode
Jason Ekstrand [Mon, 20 Jul 2020 21:07:11 +0000 (16:07 -0500)]
panfrost/midgard: Make search_var take a nir_shader and mode

Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>

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

4 years agor600/sfn: Use nir_foreach_variable_with_modes in IO vectorization
Jason Ekstrand [Tue, 21 Jul 2020 23:21:56 +0000 (18:21 -0500)]
r600/sfn: Use nir_foreach_variable_with_modes in IO vectorization

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agor600/sfn/lower_tex: Get rid of the lower_sampler vector
Jason Ekstrand [Wed, 22 Jul 2020 16:26:14 +0000 (11:26 -0500)]
r600/sfn/lower_tex: Get rid of the lower_sampler vector

We can get the result type information easily from nir_tex_instr itself
by looking at dest_type.  There's no reason to construct a vector and
try to index into it.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agor600/sfn/lower_tess_io: Rework get_tcs_varying_offset
Jason Ekstrand [Mon, 20 Jul 2020 21:04:40 +0000 (16:04 -0500)]
r600/sfn/lower_tess_io: Rework get_tcs_varying_offset

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agofreedreno/ir3_cmdline: Rework i/o variable fixup
Jason Ekstrand [Mon, 20 Jul 2020 20:53:59 +0000 (15:53 -0500)]
freedreno/ir3_cmdline: Rework i/o variable fixup

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

4 years agolima/standalone: Rework i/o variable fixup
Jason Ekstrand [Mon, 20 Jul 2020 20:48:22 +0000 (15:48 -0500)]
lima/standalone: Rework i/o variable fixup

Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agofreedreno/ir3_lower_tess: Rework var list helpers
Jason Ekstrand [Mon, 20 Jul 2020 20:16:02 +0000 (15:16 -0500)]
freedreno/ir3_lower_tess: Rework var list helpers

They now take a nir_shader and a nir_variable_mode

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

4 years agonir/gl_nir_linker: Use nir_foreach_variable_with_modes
Jason Ekstrand [Tue, 21 Jul 2020 16:54:19 +0000 (11:54 -0500)]
nir/gl_nir_linker: Use nir_foreach_variable_with_modes

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir/lower_variable_initializers: Restrict the modes we lower
Jason Ekstrand [Tue, 21 Jul 2020 23:46:24 +0000 (18:46 -0500)]
nir/lower_variable_initializers: Restrict the modes we lower

This is not a functional change because these are the only modes we
handle.  All others get silently ignored.

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

4 years agonir/split_per_member_structs: Use nir_variable_with_modes_safe
Jason Ekstrand [Tue, 21 Jul 2020 16:31:00 +0000 (11:31 -0500)]
nir/split_per_member_structs: Use nir_variable_with_modes_safe

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

4 years agonir/lower_uniforms_to_ubo: Use nir_foreach_variable_with_modes
Jason Ekstrand [Tue, 21 Jul 2020 16:22:23 +0000 (11:22 -0500)]
nir/lower_uniforms_to_ubo: Use nir_foreach_variable_with_modes

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

4 years agonir/lower_two_sided_color: Use nir_variable_create
Jason Ekstrand [Tue, 21 Jul 2020 16:18:29 +0000 (11:18 -0500)]
nir/lower_two_sided_color: Use nir_variable_create

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

4 years agonir/io_to_vector: Use nir_foreach_variable_with_modes
Jason Ekstrand [Tue, 21 Jul 2020 16:13:04 +0000 (11:13 -0500)]
nir/io_to_vector: Use nir_foreach_variable_with_modes

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

4 years agonir/lower_io_to_temporaries: Use a separate list for new inputs
Jason Ekstrand [Tue, 21 Jul 2020 14:51:05 +0000 (09:51 -0500)]
nir/lower_io_to_temporaries: Use a separate list for new inputs

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

4 years agonir: Use a nir_shader and mode in lower_clip_cull_distance_arrays
Jason Ekstrand [Mon, 20 Jul 2020 22:34:42 +0000 (17:34 -0500)]
nir: Use a nir_shader and mode in lower_clip_cull_distance_arrays

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir/lower_amul: Add a variable mode check
Jason Ekstrand [Mon, 20 Jul 2020 22:31:04 +0000 (17:31 -0500)]
nir/lower_amul: Add a variable mode check

This loop should only apply to UBOs and SSBOs because max_slot is never
used for normal uniforms.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir: Split nir_index_vars into two functions
Jason Ekstrand [Mon, 20 Jul 2020 21:49:46 +0000 (16:49 -0500)]
nir: Split nir_index_vars into two functions

We also very slightly change the semantics.  It no longer is one index
per list for global variables and is a single index over-all.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir/split_vars: Add mode checks to list walks
Jason Ekstrand [Mon, 20 Jul 2020 20:04:45 +0000 (15:04 -0500)]
nir/split_vars: Add mode checks to list walks

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agost/nir: Rework fixup_varying_slots
Jason Ekstrand [Mon, 20 Jul 2020 20:57:45 +0000 (15:57 -0500)]
st/nir: Rework fixup_varying_slots

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir/linking: Rework some internal helpers
Jason Ekstrand [Mon, 20 Jul 2020 22:15:27 +0000 (17:15 -0500)]
nir/linking: Rework some internal helpers

Instead of taking a variable list, take a nir_shader and mode.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir: Take a shader and variable mode in nir_assign_io_var_locations
Jason Ekstrand [Mon, 20 Jul 2020 19:42:53 +0000 (14:42 -0500)]
nir: Take a shader and variable mode in nir_assign_io_var_locations

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir: Take a nir_shader and variable mode in assign_var_locations
Jason Ekstrand [Mon, 20 Jul 2020 19:51:04 +0000 (14:51 -0500)]
nir: Take a nir_shader and variable mode in assign_var_locations

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir: Add and use a nir_variable_list_for_mode helper
Jason Ekstrand [Mon, 20 Jul 2020 19:32:01 +0000 (14:32 -0500)]
nir: Add and use a nir_variable_list_for_mode helper

We also add a new list iterator which takes a modes bitfield and
automatically figures out which list to use.  In the future, this
iterator will work for multiple modes but today it assumes a single mode
thanks to the behavior of nir_variable_list_for_mode.  This also doesn't
work for function_temp variables.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir: Add a nir_foreach_gl_uniform_variable helper for GL linking
Jason Ekstrand [Mon, 20 Jul 2020 19:09:50 +0000 (14:09 -0500)]
nir: Add a nir_foreach_gl_uniform_variable helper for GL linking

There are a bunch of cases where we really do want to walk the list that
is nir->uniforms because we want all things declared "uniform" in the
GLSL.  Add a helper for this but restrict it to the GL linking code.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir: Add a nir_foreach_uniform_variable helper
Jason Ekstrand [Sat, 18 Jul 2020 23:45:18 +0000 (18:45 -0500)]
nir: Add a nir_foreach_uniform_variable helper

This one's a bit more complex because it filters off only those
variables with mode == nir_var_uniform.  As such, it's not exactly a
drop-in replacement for nir_foreach_variable(var, &nir->uniforms).

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir: Add a nir_foreach_function_temp_variable helper
Jason Ekstrand [Wed, 20 May 2020 15:18:14 +0000 (10:18 -0500)]
nir: Add a nir_foreach_function_temp_variable helper

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir: Add nir_foreach_shader_in/out_variable helpers
Jason Ekstrand [Sat, 18 Jul 2020 23:24:25 +0000 (18:24 -0500)]
nir: Add nir_foreach_shader_in/out_variable helpers

Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir/dead_variables: Respect the modes passed to remove_dead_vars
Jason Ekstrand [Tue, 21 Jul 2020 20:15:43 +0000 (15:15 -0500)]
nir/dead_variables: Respect the modes passed to remove_dead_vars

For the most part, this doesn't actually matter today.  We already only
call remove_dead_vars on the lists that are specified in the modes.  The
only functional change here is for the uniform, mem_ubo, and mem_ssbo
modes because they share a list.  If nir_remove_dead_variables is called
with a mode of nir_var_uniform, it will no longer remove UBOs or SSBOs,
for instance.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agonir: Take a mode in remove_unused_io_vars
Jason Ekstrand [Wed, 20 May 2020 15:09:05 +0000 (10:09 -0500)]
nir: Take a mode in remove_unused_io_vars

Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

4 years agodocs: change "Fixes:" tag example to match git fixes output
Frank Binns [Tue, 28 Jul 2020 16:54:05 +0000 (17:54 +0100)]
docs: change "Fixes:" tag example to match git fixes output

The "Fixes:" tag example has the commit title in double quotes, whereas the
suggested git fixes alias, a couple of lines below, also adds some outer
parenthesis.

Although there doesn't appear to be a consistent format for the "Fixes:" tag,
other than it should be a git commit sha followed by the commit title, the
information in the docs should at least be consistent. As the "Fixes:" tag was
inspired by the Linux kernel, which does have parenthesis, update the example to
match the git fixes output.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6106>

4 years agofreedreno/rnn: add schema validation
Rob Clark [Tue, 28 Jul 2020 16:15:05 +0000 (09:15 -0700)]
freedreno/rnn: add schema validation

Now that all the schema validation issues are fixed, enable xml
validation according to stylesheet in rnn.

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

4 years agofreedreno/rnn: schema updates for dynamic/irregular offsets
Rob Clark [Tue, 28 Jul 2020 18:56:32 +0000 (11:56 -0700)]
freedreno/rnn: schema updates for dynamic/irregular offsets

Really we want to require one-of offset/offsets/doffsets.

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

4 years agofreedreno/registers/mdp5: fix validation error
Rob Clark [Tue, 28 Jul 2020 18:54:58 +0000 (11:54 -0700)]
freedreno/registers/mdp5: fix validation error

Empty enums are not allowed.

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

4 years agofreedreno/rnn: fix use-group
Rob Clark [Tue, 28 Jul 2020 18:53:26 +0000 (11:53 -0700)]
freedreno/rnn: fix use-group

The schema describes the attribute as "ref" rather than "name".  Which
makes more sense.

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

4 years agofreedreno/rnn: allow name to be optional in arrays
Rob Clark [Tue, 28 Jul 2020 18:01:02 +0000 (11:01 -0700)]
freedreno/rnn: allow name to be optional in arrays

We are using unnamed arrays to describe repeating portions of a pm4
packet.  So allow the name to be optional.  Instead of just using
the empty-string hack, drop the attribute.

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