mesa.git
4 years agoRevert "llvmpipe: Use the default behavior of ALLOW_MAPPED_BUFFERS."
Dave Airlie [Thu, 23 Jul 2020 05:50:19 +0000 (15:50 +1000)]
Revert "llvmpipe: Use the default behavior of ALLOW_MAPPED_BUFFERS."

This reverts commit 6ec49066498097c2647d030ebe1b99a00bc38734.

This broke:
GTF-GL45.gtf21.GL3Tests.texture_lod_bias.*

not sure why but revert for now.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6042>

4 years agollvmpipe/ms: fix sign extension bug in rasterizer.
Dave Airlie [Tue, 21 Jul 2020 06:32:08 +0000 (16:32 +1000)]
llvmpipe/ms: fix sign extension bug in rasterizer.

/glcts --deqp-surface-width=1024 --deqp-surface-height=64  --deqp-case=KHR-GL45.texture_view.view_sampling  --deqp-surface-type=fbo
was failing but only for width 1024.

The test was filling a 4x4 ms texture, but leaving the viewport set to 1024x64.

This was resulting in this code incorrectly sign extending a value, and passing
it into the mask generator and getting the wrong values. Explicit cast
avoids the sign extension and fixes the above test.

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

4 years agointel/ir/gen12+: Work around FS performance regressions due to SIMD32 discard divergence.
Francisco Jerez [Sun, 31 May 2020 21:56:40 +0000 (14:56 -0700)]
intel/ir/gen12+: Work around FS performance regressions due to SIMD32 discard divergence.

This avoids some performance regressions on Gen12 platforms caused by
SIMD32 fragment shaders reported in titles like Dota2, TF2, Xonotic,
and GFXBench5 Car Chase and Aztec Ruins.

The most obvious pattern in the regressing shaders I identified among
these workloads is that they all had non-uniform discard statements,
which are handled rather optimistically by the current IR analysis
pass: No penalty is currently applied to the SIMD32 variant of the
shader in the form of differing branching weights like we do for other
control flow instructions in order to account for the greater
likelihood of divergence of a SIMD32 shader.

Simply changing that by giving the same treatment to discard
statements as we give to other branching instructions seemed to hurt
more than it helped on platforms earlier than Gen12, since it reversed
most of the improvement obtained from SIMD32 fragment shaders in
Manhattan for no measurable benefit in other workloads (Manhattan has
a handful of shaders with statically non-uniform discard statements
which actually perform better in SIMD32 mode due to their approximate
dynamic uniformity).  For that reason this change is applied to Gen12+
platforms only.

I've been running a number of tests trying to understand the
difference in behavior between Gen12 and earlier platforms, and most
of the evidence I've gathered seems to point at EU fusion being the
culprit: Unlike previous generations, on Gen12 EUs are arranged in
pairs which execute instructions in lockstep, giving an effective warp
size of 64 threads in SIMD32 mode, which seems to increase the
likelihood for control flow divergence in some of the affected shaders
significantly.

Fixes: 188a3659aea6dec9acf1 "intel/ir: Import shader performance analysis pass."
Reported-by: Caleb Callaway <caleb.callaway@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5910>

4 years agoglx: Fix build and warnings with -Dglx=dri -Dglx-direct=false
Adam Jackson [Thu, 16 Jul 2020 21:29:26 +0000 (17:29 -0400)]
glx: Fix build and warnings with -Dglx=dri -Dglx-direct=false

Acked-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5958>

4 years agosoftpipe: Enable PIPE_CAP_TGSI_ANY_REG_AS_ADDRESS;
Eric Anholt [Wed, 15 Jan 2020 21:07:43 +0000 (13:07 -0800)]
softpipe: Enable PIPE_CAP_TGSI_ANY_REG_AS_ADDRESS;

tgsi_exec.c uses the generic src load path for indirects, so we don't
actually need addr regs.  Saves extra intructions.

shader-db results:
total instructions in shared programs: 3346685 -> 3249052 (-2.92%)
instructions in affected programs: 961832 -> 864199 (-10.15%)

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

4 years agosoftpipe: Enable PIPE_CAP_TGSI_TEXCOORD.
Eric Anholt [Thu, 23 Jan 2020 19:43:04 +0000 (11:43 -0800)]
softpipe: Enable PIPE_CAP_TGSI_TEXCOORD.

The tgsi_exec path can handle it, and otherwise when we start using NIR
our MAX_VARYINGS value will cause us to have VARYING_SLOT_VARx above the
maximum.

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

4 years agosoftpipe: Add support for reporting shader-db output.
Eric Anholt [Tue, 21 Jul 2020 22:55:40 +0000 (15:55 -0700)]
softpipe: Add support for reporting shader-db output.

In doing the softpipe NIR and NIR-to-TGSI transition, I want to make sure
I don't make shaders significantly worse, so I need shader-db output.

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

4 years agosoftpipe: Convert to comma-separated SOFTPIPE_DEBUG for debug options.
Eric Anholt [Tue, 21 Jul 2020 22:11:56 +0000 (15:11 -0700)]
softpipe: Convert to comma-separated SOFTPIPE_DEBUG for debug options.

This makes us more like other drivers, and avoids having tons of different
names (particularly when you want to dump vs and fs in debugging).  In the
process, having a debug flag for vertex shaders just falls out.

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

4 years agosoftpipe: Refactor pipe_shader_state setup.
Eric Anholt [Wed, 1 Jan 2020 00:31:54 +0000 (16:31 -0800)]
softpipe: Refactor pipe_shader_state setup.

We had repeated code that I want to repeatedly change for adding
nir-to-tgsi.

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

4 years agollvmpipe: enable robust buffer access + GL 4.3, GLES 3.2 and robust buffer access...
Dave Airlie [Sun, 19 Jul 2020 23:22:34 +0000 (09:22 +1000)]
llvmpipe: enable robust buffer access + GL 4.3, GLES 3.2 and robust buffer access behaviour

Turning on robust buffer access enables GLES 3.2, also
finished GL 4.3 support.

The post depth coverage fail is expected, it's a test bug
This also introduce a fail in the invalid flag test that I can't reproduce out of CI.

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

4 years agollvmpipe: add device reset query context hook.
Dave Airlie [Sun, 19 Jul 2020 23:21:39 +0000 (09:21 +1000)]
llvmpipe: add device reset query context hook.

Add the device reset query hook needed for robustness

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

4 years agoglx/drisw: add robustness support
Dave Airlie [Sun, 19 Jul 2020 23:55:30 +0000 (09:55 +1000)]
glx/drisw: add robustness support

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

4 years agodrisw: add robustness extension support.
Dave Airlie [Sun, 19 Jul 2020 23:21:06 +0000 (09:21 +1000)]
drisw: add robustness extension support.

Port the code from dri2 so that drisw drivers can support the
robustness extension

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

4 years agollvmpipe/draw: handle constant buffer limits and robustness (v1.1)
Dave Airlie [Sun, 29 Dec 2019 23:59:28 +0000 (09:59 +1000)]
llvmpipe/draw: handle constant buffer limits and robustness (v1.1)

TGSI expect vec4 of constants for it's current code paths, and when
doing indirect accesses it does the comparison on vec4 indexes,
however NIR does the indexing on packed float indexes.

This also align the compute path with the other shaders, and
should improve robustness (at least under Vulkan)

Fixes:
KHR-NoContext.gl43.robust_buffer_access_behavior.uniform_buffer

v1.1:
rename variable to something more meaningful (Roland)

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

4 years agollvmpipe: enable EXT_texture_shadow_lod
Dave Airlie [Thu, 16 Jul 2020 00:50:14 +0000 (10:50 +1000)]
llvmpipe: enable EXT_texture_shadow_lod

The driver passes all the CTS tests for this.

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

4 years agonir/lower_io: Add support for global scratch addressing
Jason Ekstrand [Tue, 14 Jul 2020 18:32:19 +0000 (13:32 -0500)]
nir/lower_io: Add support for global scratch addressing

This provides an alternate lowering for scratch in which it uses global
reads/writes and bases scratch addresses on a base pointer.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5927>

4 years agonir/lower_io: Use b2b for shader and function temporaries
Jason Ekstrand [Wed, 15 Jul 2020 19:09:06 +0000 (14:09 -0500)]
nir/lower_io: Use b2b for shader and function temporaries

This way we can avoid some unnecessary conversions because there's no
need to sanitize to 0/1 for scratch.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5927>

4 years agonir/lower_io: Choose to set access based on intrinsic metadata
Jason Ekstrand [Wed, 15 Jul 2020 18:32:10 +0000 (13:32 -0500)]
nir/lower_io: Choose to set access based on intrinsic metadata

This should be far more reliable than trying to keep opcode lists
up-to-date.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5927>

4 years agonir: Allow for system values with variable numbers of destination components
Jason Ekstrand [Tue, 14 Jul 2020 18:27:53 +0000 (13:27 -0500)]
nir: Allow for system values with variable numbers of destination components

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5927>

4 years agodocs/releasing: improve wording
Eric Engestrom [Wed, 8 Jul 2020 23:26:31 +0000 (01:26 +0200)]
docs/releasing: improve wording

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5833>

4 years agobin/gen_release_notes: automatically commit release notes
Eric Engestrom [Wed, 8 Jul 2020 23:25:39 +0000 (01:25 +0200)]
bin/gen_release_notes: automatically commit release notes

Cc: mesa-stable
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5833>

4 years agopost_version.py: fix relnotes links
Eric Engestrom [Wed, 15 Jul 2020 21:53:59 +0000 (23:53 +0200)]
post_version.py: fix relnotes links

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5928>

4 years agopost_version.py: update the files in the current worktree, not the one with the scrip...
Eric Engestrom [Tue, 23 Jun 2020 00:24:00 +0000 (02:24 +0200)]
post_version.py: update the files in the current worktree, not the one with the script that we run

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5928>

4 years agopost_version.py: stop using non-existent functions and fix commit message
Eric Engestrom [Tue, 23 Jun 2020 00:22:58 +0000 (02:22 +0200)]
post_version.py: stop using non-existent functions and fix commit message

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5928>

4 years agopost_version.py: drop incorrect conf.py changes
Eric Engestrom [Tue, 23 Jun 2020 00:16:57 +0000 (02:16 +0200)]
post_version.py: drop incorrect conf.py changes

This needs to be done in the mesa3d.org repo; see
https://gitlab.freedesktop.org/mesa/mesa3d.org/-/merge_requests/19

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5928>

4 years agopost_version.py: don't generate relnotes twice
Eric Engestrom [Tue, 23 Jun 2020 00:16:25 +0000 (02:16 +0200)]
post_version.py: don't generate relnotes twice

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5928>

4 years agodocs: update calendar and link releases notes for 20.1.4
Eric Engestrom [Wed, 22 Jul 2020 21:07:14 +0000 (23:07 +0200)]
docs: update calendar and link releases notes for 20.1.4

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

4 years agodocs: add release notes for 20.1.4
Eric Engestrom [Wed, 22 Jul 2020 20:40:50 +0000 (22:40 +0200)]
docs: add release notes for 20.1.4

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

4 years agogitlab-ci: Test AMD's Raven with traces
Andres Gomez [Fri, 24 Apr 2020 16:32:42 +0000 (19:32 +0300)]
gitlab-ci: Test AMD's Raven with traces

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6014>

4 years agoi915: Remove a bunch of default handling of pipe caps.
Eric Anholt [Mon, 6 Jan 2020 23:11:35 +0000 (15:11 -0800)]
i915: Remove a bunch of default handling of pipe caps.

u_screen will return 0 for all of these, which means that this is one
less driver to see in git grep when I'm checking who exposes a cap.
The exception is the texel/gather offsets and stream output
components, which will not be exposed since we don't expose the
corresponding GLSL version.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3298>

4 years agosvga: Remove a bunch of default handling of pipe caps.
Eric Anholt [Mon, 6 Jan 2020 22:51:16 +0000 (14:51 -0800)]
svga: Remove a bunch of default handling of pipe caps.

u_screen will return 0 for all of these, which means that this is one
less driver to see in git grep when I'm checking who exposes a cap.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3298>

4 years agoswr: Use the default behavior of ALLOW_MAPPED_BUFFERS.
Eric Anholt [Mon, 6 Jan 2020 22:43:59 +0000 (14:43 -0800)]
swr: Use the default behavior of ALLOW_MAPPED_BUFFERS.

Since this is a software rasterizer, we really don't care whether the
buffers are "mapped" since it's just malloc.  This will drop a bit of
pointless CPU overhead to throw errors.

Reviewed-by: Jan Zielinski <jan.zielinski@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3298>

4 years agoswr: Remove a bunch of default handling of pipe caps.
Eric Anholt [Mon, 6 Jan 2020 22:43:42 +0000 (14:43 -0800)]
swr: Remove a bunch of default handling of pipe caps.

u_screen will return 0 for all of these, which means that this is one
less driver to see in git grep when I'm checking who exposes a cap.

Reviewed-by: Jan Zielinski <jan.zielinski@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3298>

4 years agovirgl: Remove a bunch of default handling of pipe caps.
Eric Anholt [Mon, 6 Jan 2020 22:38:50 +0000 (14:38 -0800)]
virgl: Remove a bunch of default handling of pipe caps.

u_screen will return 0 for all of these, which means that this is one
less driver to see in git grep when I'm checking who exposes a cap.

Reviewed-by Gert Wollny <gert.wollny@collabora.com>

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

4 years agosoftpipe: Use the default behavior of ALLOW_MAPPED_BUFFERS.
Eric Anholt [Mon, 6 Jan 2020 22:35:33 +0000 (14:35 -0800)]
softpipe: Use the default behavior of ALLOW_MAPPED_BUFFERS.

Since this is a software rasterizer, we really don't care whether the
buffers are "mapped" since it's just malloc.  This will drop a bit of
pointless CPU overhead to throw errors.

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

4 years agosoftpipe: Remove a bunch of default handling of pipe caps.
Eric Anholt [Mon, 6 Jan 2020 22:31:47 +0000 (14:31 -0800)]
softpipe: Remove a bunch of default handling of pipe caps.

u_screen will return 0 for all of these, which means that this is one
less driver to see in git grep when I'm checking who exposes a cap.

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

4 years agollvmpipe: Use the default behavior of ALLOW_MAPPED_BUFFERS.
Eric Anholt [Mon, 6 Jan 2020 22:25:08 +0000 (14:25 -0800)]
llvmpipe: Use the default behavior of ALLOW_MAPPED_BUFFERS.

Since this is a software rasterizer, we really don't care whether the
buffers are "mapped" since it's just malloc.  This will drop a bit of
pointless CPU overhead to throw errors.

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

4 years agollvmpipe: Remove a bunch of default handling of pipe caps.
Eric Anholt [Mon, 6 Jan 2020 22:22:12 +0000 (14:22 -0800)]
llvmpipe: Remove a bunch of default handling of pipe caps.

u_screen will return 0 for all of these, which means that this is one
less driver to see in git grep when I'm checking who uses a cap.

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

4 years agoci: Fix the overwriting of traces.yml for baremetal
Tomeu Vizoso [Tue, 21 Jul 2020 13:46:06 +0000 (15:46 +0200)]
ci: Fix the overwriting of traces.yml for baremetal

When the lava files were moved out of the container, this stopped
working which caused the traces job for Freedreno to not run any traces
at all.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Fixes: dcd171f5e9bd ("gitlab-ci: More stable URL for kernel and ramdisk artifacts, for LAVA")
Acked-by: Andres Gomez <agomez@igalia.com>
Acked-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6021>

4 years agoci: Update checksums for freedreno traces.
Eric Anholt [Wed, 22 Jul 2020 16:52:07 +0000 (09:52 -0700)]
ci: Update checksums for freedreno traces.

Hand-verified by looking at our artifacts compared to an i965 capture I
had.

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

4 years agoradeon/vcn: increase render_pic_list size
Thong Thai [Tue, 21 Jul 2020 21:04:47 +0000 (17:04 -0400)]
radeon/vcn: increase render_pic_list size

Increase the maximum number of possible decoder reference picture
frames from 16 to 32.

Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6016>

4 years agoradeonsi: enable preemption if the kernel enabled it
Marek Olšák [Thu, 18 Jun 2020 05:07:04 +0000 (01:07 -0400)]
radeonsi: enable preemption if the kernel enabled it

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

4 years agoradeonsi: set up IBs for preemption
Marek Olšák [Thu, 18 Jun 2020 05:06:12 +0000 (01:06 -0400)]
radeonsi: set up IBs for preemption

- Execute cs_preamble_state as a separate IB with different flags.
- Set the PREEMPT flag for the main IB.

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

4 years agoradeonsi: don't restore states at the beginning of IBs if they're shadowed
Marek Olšák [Tue, 10 Mar 2020 22:46:17 +0000 (18:46 -0400)]
radeonsi: don't restore states at the beginning of IBs if they're shadowed

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

4 years agoradeonsi: add debug code for register shadowing
Marek Olšák [Sun, 24 May 2020 12:34:23 +0000 (08:34 -0400)]
radeonsi: add debug code for register shadowing

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

4 years agoradeonsi: add reg shadowing codepaths to GS and tess ring setup
Marek Olšák [Tue, 16 Jun 2020 18:01:16 +0000 (14:01 -0400)]
radeonsi: add reg shadowing codepaths to GS and tess ring setup

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

4 years agoradeonsi: implement CP register shadowing
Marek Olšák [Mon, 15 Jun 2020 20:34:52 +0000 (16:34 -0400)]
radeonsi: implement CP register shadowing

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

4 years agoradeonsi: reorder code in update_gs_ring_buffers and init_tess_factor_ring
Marek Olšák [Tue, 16 Jun 2020 17:57:24 +0000 (13:57 -0400)]
radeonsi: reorder code in update_gs_ring_buffers and init_tess_factor_ring

to reduce the churn when adding codepaths for shadowed registers

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

4 years agoradeonsi: make cs_preamble_state optional
Marek Olšák [Thu, 18 Jun 2020 04:51:19 +0000 (00:51 -0400)]
radeonsi: make cs_preamble_state optional

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

4 years agowinsys/amdgpu: make amdgpu_bo_unmap non-static
Marek Olšák [Thu, 18 Jun 2020 04:51:44 +0000 (00:51 -0400)]
winsys/amdgpu: make amdgpu_bo_unmap non-static

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

4 years agoac: add tables for CP register shadowing
Marek Olšák [Mon, 15 Jun 2020 20:31:43 +0000 (16:31 -0400)]
ac: add tables for CP register shadowing

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

4 years agoac: add helper ac_get_register_name
Marek Olšák [Sun, 24 May 2020 12:30:39 +0000 (08:30 -0400)]
ac: add helper ac_get_register_name

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

4 years agoradeonsi: sort registers in si_init_cs_preamble_state according to GPU gen
Marek Olšák [Tue, 7 Jul 2020 04:02:19 +0000 (00:02 -0400)]
radeonsi: sort registers in si_init_cs_preamble_state according to GPU gen

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

4 years agoradeonsi: sort registers in si_emit_initial_compute_regs according to GPU gen
Marek Olšák [Tue, 7 Jul 2020 04:02:19 +0000 (00:02 -0400)]
radeonsi: sort registers in si_emit_initial_compute_regs according to GPU gen

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

4 years agoradeonsi/gfx10: set the correct value for OFFCHIP_BUFFERING
Marek Olšák [Tue, 7 Jul 2020 03:51:25 +0000 (23:51 -0400)]
radeonsi/gfx10: set the correct value for OFFCHIP_BUFFERING

Copied from PAL. Higher values break tessellation, which I was only able
to reproduce with register shadowing enabled.

Fixes: 0bf3e6fae7f82b4f16fbcbb05a1ae47f7930e189 "radeonsi/gfx10: double the number of tessellation offchip buffers per SE"
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5798>

4 years agoradeonsi: add missing initialization of registers
Marek Olšák [Tue, 7 Jul 2020 02:05:00 +0000 (22:05 -0400)]
radeonsi: add missing initialization of registers

(random initial gfx10 commit:)
Fixes: 78cdf9a99f0 - amd/addrlib: add gfx10 support
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5798>

4 years agodocs: add some very basic documentation about zink
Erik Faye-Lund [Sun, 19 Jul 2020 10:13:40 +0000 (12:13 +0200)]
docs: add some very basic documentation about zink

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5967>

4 years agoradv/winsys: be more robust when a CS failed during recording
Samuel Pitoiset [Sun, 12 Jul 2020 17:13:18 +0000 (19:13 +0200)]
radv/winsys: be more robust when a CS failed during recording

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

4 years agoradv/winsys: return a Vulkan error code when binding virtual buffers/images
Samuel Pitoiset [Tue, 21 Jul 2020 13:55:38 +0000 (15:55 +0200)]
radv/winsys: return a Vulkan error code when binding virtual buffers/images

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

4 years agoradv/winsys: remove useless check when binding virtual buffers/images
Samuel Pitoiset [Tue, 21 Jul 2020 13:51:13 +0000 (15:51 +0200)]
radv/winsys: remove useless check when binding virtual buffers/images

Size must be greater than 0.

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

4 years agoradv/winsys: check more allocation failures
Samuel Pitoiset [Sun, 12 Jul 2020 14:00:35 +0000 (16:00 +0200)]
radv/winsys: check more allocation failures

While we are at it, use local variables first to make sure to
not leak memory if something bad happens.

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

4 years agoradv: add missing return values check for some winsys calls
Samuel Pitoiset [Sun, 12 Jul 2020 16:35:25 +0000 (18:35 +0200)]
radv: add missing return values check for some winsys calls

Make sure to handle errors properly.

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

4 years agonir/tests: Add tests for opt_if_simplification
Danylo Piliaiev [Tue, 21 Jul 2020 12:51:55 +0000 (15:51 +0300)]
nir/tests: Add tests for opt_if_simplification

Test cases:

opt_if_simplification - the most trivial test case.

opt_if_simplification_single_source_phi_after_if - tests that
opt_if_simplification correctly handles single-source phis after
the if, found in https://gitlab.freedesktop.org/mesa/mesa/-/issues/3282

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5945>

4 years agonir/opt_if: Fix opt_if_simplification when else branch has jump
Danylo Piliaiev [Thu, 16 Jul 2020 18:09:08 +0000 (21:09 +0300)]
nir/opt_if: Fix opt_if_simplification when else branch has jump

Consider the following case:

 if ssa_1 {
    block block_2:
    /* succs: block_4 */
 } else {
    block block_3:
    ...
    break
    /* succs: block_5 */
 }

 block block_4:
 vec1 32 ssa_100 = phi block_2: ssa_2

After block_3 extraction and reinsertion, phi->pred becomes invalid
and isn't updated by reinsertion since it is unreachable from block_3.

Call nir_opt_remove_phis_block before moving block to eliminate single
source phis after the if.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3282
Fixes: e3e929f8c342b32dc8f5296adf8fb337866fa40a
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5945>

4 years agozink: omit Lod image operand in ntv when not using an image texture dim
Mike Blumenkrantz [Thu, 2 Jul 2020 15:46:28 +0000 (11:46 -0400)]
zink: omit Lod image operand in ntv when not using an image texture dim

according to spec, this is invalid (and it's not being used anyway)

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

4 years agozink: add some asserts for building access chains in ntv
Mike Blumenkrantz [Fri, 26 Jun 2020 19:14:20 +0000 (15:14 -0400)]
zink: add some asserts for building access chains in ntv

we're never going to pass a 0 here, and it's going to be an error if we do

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

4 years agozink: handle texelFetchOffset with offsets
Mike Blumenkrantz [Tue, 23 Jun 2020 19:14:34 +0000 (15:14 -0400)]
zink: handle texelFetchOffset with offsets

we need to explicitly add the offset in this case since it's not available
as a spirv param

fixes spec@glsl-1.30@execution@fs-texelfetchoffset-2d

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

4 years agozink: use helper function to handle uvec/bvec types
Mike Blumenkrantz [Wed, 10 Jun 2020 15:00:16 +0000 (11:00 -0400)]
zink: use helper function to handle uvec/bvec types

bit_size of 1 means we use a bool type here, 32 means uint, so we can just
handle that automatically for all relevant cases

ref shaders@glsl-vs-continue-in-switch-in-do-while

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

4 years agoaco: fix scratch loads which cross element_size boundaries
Daniel Schürmann [Mon, 20 Jul 2020 10:07:55 +0000 (12:07 +0200)]
aco: fix scratch loads which cross element_size boundaries

Previously, we've set element_size == 16 which causes loads from
packed vec3 arrays to cross the boundary and return wrong data.
This patch sets element_size = 4 and splits loads into single channel.
Fixes all of dEQP-VK.subgroups.ballot_broadcast.*

Cc: 20.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5977>

4 years agomesa/program: fix shadow property for samplers
Erik Faye-Lund [Mon, 20 Jul 2020 16:06:47 +0000 (18:06 +0200)]
mesa/program: fix shadow property for samplers

When creating a sampler-type, we need to pass the correct vaclue for
the "is_shadow"-parameter to glsl_sampler_type(), otherwise the compiler
backend will have no clue about this being a shadow-sampler.

Fixes: 1c0f92d8a8c ("nir: Create sampler variables in prog_to_nir.")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5986>

4 years agoci: Disable trace testing on Mali T760
Tomeu Vizoso [Wed, 22 Jul 2020 12:23:15 +0000 (14:23 +0200)]
ci: Disable trace testing on Mali T760

The machine is showing random mis-renderings and we don't have time now
to investigate. Comment it out for now so CI pipelines don't fail due to
it.

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

4 years agoradv: advertise VK_EXT_shader_atomic_float
Samuel Pitoiset [Mon, 20 Jul 2020 16:38:17 +0000 (18:38 +0200)]
radv: advertise VK_EXT_shader_atomic_float

No hw support for float atomic add for buffer and (sparse) images.

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

4 years agoac/nir: add support for nir_intrinsic_shared_atomic_fadd
Samuel Pitoiset [Tue, 21 Jul 2020 08:49:36 +0000 (10:49 +0200)]
ac/nir: add support for nir_intrinsic_shared_atomic_fadd

Only LLVM 10+ has support.

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

4 years agoaco: add support for nir_intrinsic_shared_atomic_fadd
Samuel Pitoiset [Tue, 21 Jul 2020 08:44:29 +0000 (10:44 +0200)]
aco: add support for nir_intrinsic_shared_atomic_fadd

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

4 years agoci: Test with more traces
Tomeu Vizoso [Tue, 21 Jul 2020 08:19:17 +0000 (10:19 +0200)]
ci: Test with more traces

Use some more traces from traces-db in the existing jobs.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Andres Gomez <agomez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6008>

4 years agoci: Prefix tracie artifacts with the device name
Tomeu Vizoso [Tue, 21 Jul 2020 12:04:42 +0000 (14:04 +0200)]
ci: Prefix tracie artifacts with the device name

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Andres Gomez <agomez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6008>

4 years agoci: Use smaller glxgears trace
Tomeu Vizoso [Tue, 21 Jul 2020 08:13:56 +0000 (10:13 +0200)]
ci: Use smaller glxgears trace

A smaller version of this trace has been pushed to traces-db, so update
to use this instead.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Andres Gomez <agomez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6008>

4 years agoci: Upload images of failed replays to MinIO
Tomeu Vizoso [Tue, 21 Jul 2020 08:48:43 +0000 (10:48 +0200)]
ci: Upload images of failed replays to MinIO

For the llvmpipe and virgl jobs.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Andres Gomez <agomez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6008>

4 years agonvc0: add documentation for nve4+ (Kepler) COPY class
Rhys Kidd [Mon, 20 Jul 2020 03:07:48 +0000 (13:07 +1000)]
nvc0: add documentation for nve4+ (Kepler) COPY class

Has been utilised within nouveau in place of the former M2MF class, which was
dropped for Kepler in PGRAPH in favour of:

  - a new P2MF object that only does simple upload; and
  - PCOPY took over responsibility of M2MF's other DMA functions.

Autogenerated headers from envytools commit 32659e654170cb03038ccf2cb165decd3a2409d6

NVIDIA documentation released at:
  https://github.com/NVIDIA/open-gpu-doc/blob/master/classes/dma-copy/cla0b5.h

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5982>

4 years agonvc0: fix macro define for NVE4_COPY()
Rhys Kidd [Mon, 20 Jul 2020 11:10:25 +0000 (21:10 +1000)]
nvc0: fix macro define for NVE4_COPY()

Fixes: e44089b2f79 ("nvc0: add initial support for nve4+ (Kepler) chipsets")
Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5982>

4 years agoanv: properly handle fence import of sync_fd = -1
Lionel Landwerlin [Sat, 18 Jul 2020 19:51:44 +0000 (22:51 +0300)]
anv: properly handle fence import of sync_fd = -1

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 43e8808b82b9eb ("anv: Add support for the SYNC_FD handle type for fences")
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5964>

4 years agomeson: Add mising git_sha1.h dependency.
Bas Nieuwenhuizen [Tue, 21 Jul 2020 23:50:47 +0000 (01:50 +0200)]
meson: Add mising git_sha1.h dependency.

Fixes: 606dff1b73f "vulkan/overlay: Add support for a control socket."
Reviewed-by: Dylan Baker <dylan.c.baker@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6019>

4 years agoaco: fix includes in aco_ir.cpp
Rhys Perry [Tue, 21 Jul 2020 20:48:06 +0000 (21:48 +0100)]
aco: fix includes in aco_ir.cpp

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3300
Fixes: e75946cfefc ('aco: move some setup code into helpers')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6015>

4 years agoturnip: disable tiling for NV12/IYUV formats
Jonathan Marek [Thu, 9 Jul 2020 01:00:07 +0000 (21:00 -0400)]
turnip: disable tiling for NV12/IYUV formats

The last change to my previous MR to disable UBWC for the formats ended up
breaking a few tests for A640 at least, because tiled-but-not-UBWC can be
broken in some cases.

Fixes: 1a83279da57f2e ("turnip: enable 420_UNORM formats")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5817>

4 years agofreedreno/ir3: Fix SSBO size for bindless SSBO's
Connor Abbott [Tue, 21 Jul 2020 14:20:14 +0000 (16:20 +0200)]
freedreno/ir3: Fix SSBO size for bindless SSBO's

We theoretically could push these sizes to the const file
opportunistically, which appears to be what the blob does, but the
maximum number of SSBO's is way too big to do that unconditionally. Just
use resinfo to get the size for now.

Fixes on turnip: dEQP-VK.ssbo.unsized_array_length.*

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

4 years agoaco: fix copy of uninitialized boolean
Rhys Perry [Fri, 3 Apr 2020 16:44:47 +0000 (17:44 +0100)]
aco: fix copy of uninitialized boolean

This should be harmless but UBSan seems to complain.

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

4 years agoradv: fix invalid conversion warnings in vk_format.h
Rhys Perry [Wed, 19 Feb 2020 11:45:59 +0000 (11:45 +0000)]
radv: fix invalid conversion warnings in vk_format.h

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

4 years agoaco: print ACO IR before scheduling instead of after
Rhys Perry [Tue, 18 Feb 2020 16:10:46 +0000 (16:10 +0000)]
aco: print ACO IR before scheduling instead of after

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

4 years agoaco: make validate() usable in tests
Rhys Perry [Thu, 30 Jan 2020 11:49:20 +0000 (11:49 +0000)]
aco: make validate() usable in tests

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

4 years agoaco: move some setup code into helpers
Rhys Perry [Wed, 22 Jan 2020 19:57:20 +0000 (19:57 +0000)]
aco: move some setup code into helpers

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

4 years agoegl/dri2: try to bind old context if bindContext failed
Luigi Santivetti [Tue, 30 Jun 2020 13:59:45 +0000 (14:59 +0100)]
egl/dri2: try to bind old context if bindContext failed

This change mostly touches error handling code paths, where a
bug was found when the DRI driver failed to bind a new DRI
context. Specifically, the reason for it to fail was the window
system unable (for whatever reason) to provide the DRI drawable
with a buffer. In this instance, Mesa un-does the EGL bindings,
but doesn't restore the old DRI context, hence remaining in a
funny state. It's worth mentioning that despite trying, there
is no guarantee that the old DRI context can be restored,
depending on the runtime.

Before this change, if bindContext() failed then
dri2_make_current() would rebind the old EGL context and
surfaces and return EGL_BAD_MATCH. However, it wouldn't rebind
the DRI context and surfaces, thus leaving it in an
inconsistent and unrecoverable state.

After this change, dri2_make_current() tries to bind the old
DRI context and surfaces when bindContext() failed. If unable
to do so, it leaves EGL and the DRI driver in a consistent
state, it reports an error and returns EGL_BAD_MATCH.

Fixes: 4e8f95f64d004aa1 ("egl_dri2: Always unbind old contexts")
Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5707>

4 years agodri2: do not conflate unbind and bindContext() failure
Luigi Santivetti [Tue, 30 Jun 2020 10:32:49 +0000 (11:32 +0100)]
dri2: do not conflate unbind and bindContext() failure

dri2_make_current() has become hard to follow, address this by
splitting the semantic of needing a call to bindContext() and
its failure.

Cc: mesa-stable
Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5707>

4 years agodri2: dri2_make_current() fold multiple if blocks
Luigi Santivetti [Tue, 30 Jun 2020 09:14:08 +0000 (10:14 +0100)]
dri2: dri2_make_current() fold multiple if blocks

dri2_make_current() has become long and convoluted. Address
this by folding together multiple if blocks checking for the
same variable.

Cc: mesa-stable
Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5707>

4 years agoaco: use nir_addition_might_overflow to combine additions into SMEM
Rhys Perry [Tue, 12 Nov 2019 17:51:34 +0000 (17:51 +0000)]
aco: use nir_addition_might_overflow to combine additions into SMEM

fossil-db (Navi):
Totals from 24656 (18.14% of 135946) affected shaders:
CodeSize: 120077160 -> 118877304 (-1.00%); split: -1.01%, +0.01%
Instrs: 23192657 -> 22979553 (-0.92%); split: -0.94%, +0.02%
VMEM: 165151115 -> 151861460 (-8.05%); split: +0.14%, -8.19%
SMEM: 18133265 -> 16709635 (-7.85%); split: +0.28%, -8.13%
VClause: 385011 -> 384447 (-0.15%); split: -0.16%, +0.02%
SClause: 954884 -> 838266 (-12.21%); split: -12.34%, +0.12%

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

4 years agonir: add nir_unsigned_upper_bound and nir_addition_might_overflow
Rhys Perry [Tue, 12 Nov 2019 17:51:19 +0000 (17:51 +0000)]
nir: add nir_unsigned_upper_bound and nir_addition_might_overflow

This adds a nir_unsigned_upper_bound() helper which does something similar
to nir_analyze_range() except it tries to obtain the largest possible
value instead of it's relation to zero.

It also adds nir_addition_might_overflow(), which uses this helper to try
to prove that an unsigned addition does not wrap around.

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

4 years agoaco: add NUW flag
Rhys Perry [Tue, 15 Oct 2019 16:25:57 +0000 (17:25 +0100)]
aco: add NUW flag

This (combined with a pass to actually set the corresponding NIR flags)
should help fix a lot of the regressions from the SMEM addition combining
change.

fossil-db (Navi):
Totals from 12 (0.01% of 135946) affected shaders:
CodeSize: 12376 -> 12304 (-0.58%)
Instrs: 2436 -> 2422 (-0.57%)
VMEM: 1105 -> 1096 (-0.81%)
SClause: 133 -> 130 (-2.26%)

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

4 years agoaco: allow overflow for some SMEM instructions
Rhys Perry [Fri, 17 Jul 2020 14:01:41 +0000 (15:01 +0100)]
aco: allow overflow for some SMEM instructions

fossil-db (Navi):
Totals from 10184 (7.49% of 135946) affected shaders:
CodeSize: 83419748 -> 82430824 (-1.19%); split: -1.19%, +0.01%
Instrs: 16054612 -> 15908523 (-0.91%); split: -0.93%, +0.02%
VMEM: 1608018 -> 1581829 (-1.63%); split: +0.20%, -1.83%
SMEM: 577031 -> 563492 (-2.35%); split: +0.10%, -2.45%
VClause: 242643 -> 242512 (-0.05%); split: -0.06%, +0.00%
SClause: 640966 -> 569897 (-11.09%)

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

4 years agoaco: be more careful combining additions that could wrap into loads/stores
Rhys Perry [Tue, 15 Oct 2019 16:00:55 +0000 (17:00 +0100)]
aco: be more careful combining additions that could wrap into loads/stores

SMEM does the addition with 64-bits, not 32. So if the original code
relied on wrapping around (for example, for subtraction), it would break.

Apparently swizzled MUBUF accesses also have issues with combining
additions that could overflow. Normal MUBUF accesses seem fine.

fossil-db (Navi):
Totals from 27219 (20.02% of 135946) affected shaders:
CodeSize: 128303256 -> 131062756 (+2.15%); split: -0.00%, +2.15%
Instrs: 24818911 -> 25280558 (+1.86%); split: -0.01%, +1.87%
VMEM: 162311926 -> 177226874 (+9.19%); split: +9.36%, -0.17%
SMEM: 18182559 -> 20218734 (+11.20%); split: +11.53%, -0.34%
VClause: 423635 -> 424398 (+0.18%); split: -0.02%, +0.20%
SClause: 865384 -> 1104986 (+27.69%); split: -0.00%, +27.69%

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

4 years agogitlab-ci/traces: updated paths and checksums for POLARIS10 traces
Andres Gomez [Wed, 8 Jul 2020 18:33:58 +0000 (21:33 +0300)]
gitlab-ci/traces: updated paths and checksums for POLARIS10 traces

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5890>

4 years agogitlab-ci: get the last frame from a gfxr trace using gfxrecon-info
Andres Gomez [Mon, 13 Jul 2020 22:11:26 +0000 (01:11 +0300)]
gitlab-ci: get the last frame from a gfxr trace using gfxrecon-info

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5890>