mesa.git
4 years agoglsl: Add new expressions for INTEL_shader_integer_functions2
Ian Romanick [Tue, 11 Sep 2018 05:38:29 +0000 (22:38 -0700)]
glsl: Add new expressions for INTEL_shader_integer_functions2

v2: Re-write iadd64_saturate and isub64_saturate to avoid undefined
overflow behavior.  Also fix copy-and-paste bug in isub64_saturate.
Suggested by Caio.

v3: Avoid signed integer overflow for abs_sub(0, INT_MIN).  Noticed by
Caio.

v4: Alternate fix for signed integer overflow for abs_sub(0, INT_MIN).
I tried the previous methon in a small test program with -ftrapv, and it
failed.

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

4 years agomesa: Extension boilerplate for INTEL_shader_integer_functions2
Ian Romanick [Tue, 11 Sep 2018 00:54:56 +0000 (17:54 -0700)]
mesa: Extension boilerplate for INTEL_shader_integer_functions2

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

4 years agointel/compiler: Move Gen4/5 rounding to visitor
Matt Turner [Thu, 16 Jan 2020 19:17:14 +0000 (11:17 -0800)]
intel/compiler: Move Gen4/5 rounding to visitor

Gen4/5's rounding instructions operate differently than later Gens'.
They all return the floor of the input and the "Round-increment"
conditional modifier answers whether the result should be incremented by
1.0 to get the appropriate result for the operation (and thus its
behavior is determined by the round opcode; e.g., RNDZ vs RNDE).

Since this requires a second instruciton (a predicated ADD) that
consumes the result of the round instruction, the round instruction
cannot write its result directly to the (write-only) message registers.
By emitting the ADD in the generator, the backend thinks it's safe to
store the round's result directly to the message register file.

To avoid this, we move the emission of the ADD instruction to the NIR
translator so that the backend has the information it needs.

I suspect this also fixes code generated for RNDZ.SAT but since
Gen4/5 don't support GLSL 1.30 which adds the trunc() function, I
couldn't write a piglit test to confirm. My thinking is that if x=-0.5:

      sat(trunc(-0.5)) = 0.0

But on Gen4/5 where sat(trunc(x)) is implemented as

      rndz.r.f0  result, x             // result = floor(x)
                                       // set f0 if increment needed
      (+f0) add  result, result, 1.0   // fixup so result = trunc(x)

then putting saturate on both instructions will give the wrong result.

      floor(-0.5) = -1.0
      sat(floor(-0.5)) = 0.0
      // +1 increment would be needed since floor(-0.5) != trunc(-0.5)
      sat(sat(floor(-0.5)) + 1.0) = 1.0

Fixes: 6f394343b1f ("nir/algebraic: i2f(f2i()) -> trunc()")
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2355
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3459>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3459>

4 years agomeson: Do not require libdrm for DRI2 on hurd
Samuel Thibault [Sat, 28 Dec 2019 21:51:39 +0000 (22:51 +0100)]
meson: Do not require libdrm for DRI2 on hurd

Cc: 19.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3231>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3231>

4 years agoutil: Do not fail to build on unknown pthread_setname_np
Samuel Thibault [Sat, 28 Dec 2019 21:06:27 +0000 (22:06 +0100)]
util: Do not fail to build on unknown pthread_setname_np

This is only used for debugging, so better making porting on various systems
less hard.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3229>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3229>

4 years agoloader: #define PATH_MAX when undefined (eg. Hurd)
Samuel Thibault [Sat, 28 Dec 2019 21:00:57 +0000 (22:00 +0100)]
loader: #define PATH_MAX when undefined (eg. Hurd)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3228>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3228>

4 years agoutil/atomic: fix return type of p_atomic_add_return() fallback
Eric Engestrom [Sun, 8 Dec 2019 12:52:21 +0000 (12:52 +0000)]
util/atomic: fix return type of p_atomic_add_return() fallback

Fixes: 385d13f26d2b69db9423 ("util/atomic: Add a _return variant of p_atomic_add")
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3012>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3012>

4 years agogallium: dmabuf support for yuv formats that are not natively supported
James Xiong [Thu, 16 Jan 2020 18:19:34 +0000 (10:19 -0800)]
gallium: dmabuf support for yuv formats that are not natively supported

V2 (Kenneth Graunke):
   added a helper function to check if every format is supported

Signed-off-by: James Xiong <james.xiong@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2846>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2846>

4 years agointel/compiler: Return early if read() failed
Emmanuel Gil Peyrot [Wed, 20 Nov 2019 15:21:42 +0000 (16:21 +0100)]
intel/compiler: Return early if read() failed

This was the only warning I could see while compiling Iris.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2821>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2821>

4 years agointel/perf: adapt to platforms like Solaris without d_type in struct dirent
Alan Coopersmith [Wed, 6 Nov 2019 00:56:46 +0000 (16:56 -0800)]
intel/perf: adapt to platforms like Solaris without d_type in struct dirent

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
[Eric: factor out the is_dir_or_link() check and fix a bug in v1]
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
v3: include directory path when lstat'ing files
v4: fix inverted check in enumerate_sysfs_metrics()

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2258>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2258>

4 years agollvmpipe: drop LLVM < 3.4 support
Eric Engestrom [Sat, 16 Nov 2019 10:25:21 +0000 (10:25 +0000)]
llvmpipe: drop LLVM < 3.4 support

We don't support < 3.9 anymore, so this code is dead.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2760>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2760>

4 years agoegl: drop confusing mincore() error message
Eric Engestrom [Fri, 27 Dec 2019 20:59:26 +0000 (20:59 +0000)]
egl: drop confusing mincore() error message

A user came to me asking how to fix this error, but it's entirely
expected that `get_wl_surface_proxy()` on recent enough wayland
compositors will always print it.
Let's just remove the message altogether, it is basically never useful.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3219>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3219>

4 years agoaco: fix off-by-one error when initializing sgpr_live_in
Rhys Perry [Wed, 22 Jan 2020 11:51:31 +0000 (11:51 +0000)]
aco: fix off-by-one error when initializing sgpr_live_in

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2394
Fixes: 93c8ebfa780 ('aco: Initial commit of independent AMD compiler')
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3511>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3511>

4 years agoradv: fix double free corruption in radv_alloc_memory()
Samuel Pitoiset [Wed, 22 Jan 2020 07:40:11 +0000 (08:40 +0100)]
radv: fix double free corruption in radv_alloc_memory()

If the driver fails to allocate memory for some reasons, it shouldn't
free the 'mem' object twice.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2302
Fixes: 825ddfee599 ("radv: Handle device memory alloc failure with normal free.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3508>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3508>

4 years agogitlab-ci: Use single if for manual job rules entry
Michel Dänzer [Mon, 20 Jan 2020 17:39:50 +0000 (18:39 +0100)]
gitlab-ci: Use single if for manual job rules entry

I thought multiple ifs would all need to match, but looks like only the
last one (or either one?) does.

This should prevent a manual pipeline from getting created after merging
changes which can't affect the pipeline.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3474>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3474>

4 years agogitlab-ci: Set GIT_STRATEGY to none for the dummy job
Michel Dänzer [Mon, 20 Jan 2020 17:34:34 +0000 (18:34 +0100)]
gitlab-ci: Set GIT_STRATEGY to none for the dummy job

It doesn't need anything from the Git repository.

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

4 years agoutil/u_thread: Fix build under Haiku
X512 [Thu, 9 Jan 2020 00:59:21 +0000 (00:59 +0000)]
util/u_thread: Fix build under Haiku

4 years agohaiku/hgl: Fix build via header reordering
Alexander von Gluck IV [Thu, 9 Jan 2020 00:58:31 +0000 (00:58 +0000)]
haiku/hgl: Fix build via header reordering

4 years agoaco: fix operand kill flags when a temporary is used more than once
Rhys Perry [Tue, 21 Jan 2020 14:24:01 +0000 (14:24 +0000)]
aco: fix operand kill flags when a temporary is used more than once

Helps create v_mac_f32 from v_mad_f32(b, a, b)

Totals from affected shaders:
SGPRS: 35824 -> 35824 (0.00 %)
VGPRS: 33460 -> 33456 (-0.01 %)
Spilled SGPRs: 0 -> 0 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 0 -> 0 (0.00 %) dwords per thread
Code Size: 2187264 -> 2180976 (-0.29 %) bytes
LDS: 127 -> 127 (0.00 %) blocks
Max Waves: 3802 -> 3802 (0.00 %)

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

4 years agopanfrost/midgard: Add missing lowering passes for type/size conversion ops
Boris Brezillon [Mon, 20 Jan 2020 21:02:40 +0000 (22:02 +0100)]
panfrost/midgard: Add missing lowering passes for type/size conversion ops

Replace the manual type/size conversion lowering description by one
that's automatically generated and covers all type/size conversions.

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

4 years agopanfrost/midgard: Add 64 bits float <-> int converters
Boris Brezillon [Mon, 20 Jan 2020 21:05:14 +0000 (22:05 +0100)]
panfrost/midgard: Add 64 bits float <-> int converters

The 64 bit converter cases were missing, add them now.

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

4 years agopanfrost/midgard: Fix mir_print_instruction() for branch instructions
Boris Brezillon [Mon, 20 Jan 2020 20:44:49 +0000 (21:44 +0100)]
panfrost/midgard: Fix mir_print_instruction() for branch instructions

Branch instructions should not be treated as regular ALUs.

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

4 years agopanfrost/midgard: Add f2f64 support
Boris Brezillon [Mon, 20 Jan 2020 15:05:31 +0000 (16:05 +0100)]
panfrost/midgard: Add f2f64 support

So we can convert floats into doubles.

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

4 years agopanfrost/midgard: Factorize f2f and u2u handling
Boris Brezillon [Mon, 20 Jan 2020 15:03:52 +0000 (16:03 +0100)]
panfrost/midgard: Factorize f2f and u2u handling

Those size conversion operations work the same way apart from f2f
using an fmov op code and u2u using an imov. Let's handle them in the
same case block to avoid code duplication.

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

4 years agopanfrost/midgard: Make sure promote_fmov() only promotes 32-bit imovs
Boris Brezillon [Mon, 20 Jan 2020 14:55:21 +0000 (15:55 +0100)]
panfrost/midgard: Make sure promote_fmov() only promotes 32-bit imovs

mir_constant_float() assumes we're dealing with 32-bit integers/floats,
which is only the case if reg_mode is equal to midgard_reg_mode_32.

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

4 years agopanfrost/midgard: Rework mir_adjust_constants() to make it type/size agnostic
Boris Brezillon [Mon, 20 Jan 2020 14:44:48 +0000 (15:44 +0100)]
panfrost/midgard: Rework mir_adjust_constants() to make it type/size agnostic

Right now, constant combining is not supported in 16 bit mode, and 64
bit mode is simply ignored. Let's rework the function to make it
type/bit-size agnostic.

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

4 years agopanfrost/midgard: Use a union to manipulate embedded constants
Boris Brezillon [Mon, 20 Jan 2020 14:00:57 +0000 (15:00 +0100)]
panfrost/midgard: Use a union to manipulate embedded constants

Each instruction bundle can contain up to 16 constant bytes. The meaning
of those byte is instruction dependent: it depends on the instruction
native type (int, uint or float) and the instruction reg_mode (8, 16, 32
or 64 bit). Those different layouts can be exposed as a union to
facilitate constants manipulation.

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

4 years agoanv: ensure prog params are initialized with 0s
Lionel Landwerlin [Wed, 22 Jan 2020 13:49:25 +0000 (15:49 +0200)]
anv: ensure prog params are initialized with 0s

As a result of 9baa33cef01f our backend compiler leaves params pretty
much untouched. So in order to avoid storing uninitialized values in
the shader cache blobs, just 0 out this array.

I've considered not even allocating this array which works on gen8+
but the vec4 backend still makes a copy of this array and so it
crashes on memcpy on HSW.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 9baa33cef01f ("anv: Rework push constant handling")
Reported-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3516>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3516>

4 years agopanfrost: Fix crash in compute variant allocation
Alyssa Rosenzweig [Mon, 20 Jan 2020 21:01:53 +0000 (16:01 -0500)]
panfrost: Fix crash in compute variant allocation

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: d8a3501f1b2 ("panfrost: Dynamically allocate shader variants")
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3515>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3515>

4 years agoetnaviv: drm: Don't miscalculate timeout
Guido Günther [Wed, 22 Jan 2020 10:43:11 +0000 (11:43 +0100)]
etnaviv: drm: Don't miscalculate timeout

The current code overflows (s * 1000000000) for s >= 5 but that is
e.g. used in etna_bo_cpu_prep.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3509>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3509>

4 years agoegl: Fix _eglPointerIsDereferencable w/o mincore()
Alexander van der Grinten [Sun, 15 Dec 2019 10:25:37 +0000 (11:25 +0100)]
egl: Fix _eglPointerIsDereferencable w/o mincore()

On platforms without mincore(), _eglPointerIsDereferencable()
currently just checks whether p != NULL. This is not sufficient:
In the Wayland platform code (i.e., in get_wl_surface_proxy()),
_eglPointerIsDereferencable() is called on the version field
of `struct wl_egl_window` which is 3 on current versions of
Wayland. This causes a segfault when trying to dereference p.

Fix this behavior by assuming that the first page of the
process is never dereferencable.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3103>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3103>

4 years agoegl/android: fix buffer_count for applications setting max count
Tapani Pälli [Tue, 21 Jan 2020 11:01:51 +0000 (13:01 +0200)]
egl/android: fix buffer_count for applications setting max count

Problem with previous solution was that it did not take account that
some applications may set a max count for buffers. Therefore we need to
query both min and max and clamp our setting based on that.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2373
Fixes: be08e6a4496 ("egl/android: Restrict minimum triple buffering for android color_buffers")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3480>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3480>

4 years agoaco: Fix signedness compare warning.
Timur Kristóf [Tue, 21 Jan 2020 14:34:23 +0000 (15:34 +0100)]
aco: Fix signedness compare warning.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3483>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3483>

4 years agoaco: Fix maybe-uninitialized warnings.
Timur Kristóf [Tue, 21 Jan 2020 12:49:00 +0000 (13:49 +0100)]
aco: Fix maybe-uninitialized warnings.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3483>

4 years agoaco: Fix -Wstringop-overflow warnings in aco_span.
Timur Kristóf [Tue, 21 Jan 2020 12:43:13 +0000 (13:43 +0100)]
aco: Fix -Wstringop-overflow warnings in aco_span.

GCC does not understand how aco_span works.
This patch fixes it by casting the aco_span's this pointer
to uintptr_t rather than to a char pointer, effectively
telling GCC not to try to figure it out.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3483>

4 years agoradeon: Fix multiple definition error with radeon_debug
Timur Kristóf [Tue, 21 Jan 2020 15:36:54 +0000 (16:36 +0100)]
radeon: Fix multiple definition error with radeon_debug

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3488>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3488>

4 years agogallium: Fix a couple of multiple definition warnings.
Timur Kristóf [Tue, 21 Jan 2020 15:12:16 +0000 (16:12 +0100)]
gallium: Fix a couple of multiple definition warnings.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3488>

4 years agor600: Move get_pic_param to radeon_vce.c
Timur Kristóf [Tue, 21 Jan 2020 15:08:21 +0000 (16:08 +0100)]
r600: Move get_pic_param to radeon_vce.c

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3488>

4 years agoradeon: Move si_get_pic_param to radeon_vce.c
Timur Kristóf [Tue, 21 Jan 2020 15:04:33 +0000 (16:04 +0100)]
radeon: Move si_get_pic_param to radeon_vce.c

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3488>

4 years agointel/compiler: Fix array bounds warning on GCC 10.
Timur Kristóf [Tue, 21 Jan 2020 16:58:31 +0000 (17:58 +0100)]
intel/compiler: Fix array bounds warning on GCC 10.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
4 years agoturnip: Add support for non-zero (still constant) UBO buffer indices.
Eric Anholt [Wed, 22 Jan 2020 00:56:34 +0000 (16:56 -0800)]
turnip: Add support for non-zero (still constant) UBO buffer indices.

This was actually all ready to go at this point, and just needed to
increment by the value.

Fixes dEQP-VK.binding_model.shader_access.primary_cmd_buf.uniform_buffer.*

Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3504>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3504>

4 years agoturnip: fix array/matrix varyings
Jonathan Marek [Sun, 15 Dec 2019 23:56:47 +0000 (18:56 -0500)]
turnip: fix array/matrix varyings

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3109>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3109>

4 years agoturnip: remove tu_sort_variables_by_location
Jonathan Marek [Sun, 15 Dec 2019 23:55:39 +0000 (18:55 -0500)]
turnip: remove tu_sort_variables_by_location

nir_assign_io_var_locations already does sorting.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3109>

4 years agofreedreno/ir3: allow inputs with the same location
Jonathan Marek [Sun, 15 Dec 2019 23:54:26 +0000 (18:54 -0500)]
freedreno/ir3: allow inputs with the same location

turnip can have multiple inputs with the same location, and different
location_frac.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3109>

4 years agogitlab-ci: Skip ext_timer_query/time-elapsed
Matt Turner [Tue, 21 Jan 2020 23:23:39 +0000 (15:23 -0800)]
gitlab-ci: Skip ext_timer_query/time-elapsed

This test's result is unpredictable, so it may occasionally pass when we
expect it to fail, thus causing the CI pipeline to fail.

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

4 years agointel/compiler: Test compaction on Gen <= 12
Matt Turner [Wed, 6 Nov 2019 18:14:45 +0000 (10:14 -0800)]
intel/compiler: Test compaction on Gen <= 12

With the previous commits we can now enable the unit test on Gen <= 12.

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

4 years agointel/compiler: Validate fuzzed instructions
Matt Turner [Tue, 12 Nov 2019 00:11:34 +0000 (16:11 -0800)]
intel/compiler: Validate fuzzed instructions

... before giving them to the instruction compactor.

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

4 years agointel/compiler: Add unit tests for new EU validation checks
Matt Turner [Fri, 3 Jan 2020 20:59:32 +0000 (12:59 -0800)]
intel/compiler: Add unit tests for new EU validation checks

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

4 years agointel/compiler: Validate some instruction word encodings
Matt Turner [Thu, 2 Jan 2020 22:44:16 +0000 (14:44 -0800)]
intel/compiler: Validate some instruction word encodings

Specifically, execution size, register file, and register type. I did
not add validation for vertical stride and width because I don't believe
it's possible to have an otherwise valid instruction with an invalid
vertical stride or width, due to all of the other regioning
restrictions.

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

4 years agointel/compiler: Factor out brw_validate_instruction()
Matt Turner [Mon, 11 Nov 2019 23:19:07 +0000 (15:19 -0800)]
intel/compiler: Factor out brw_validate_instruction()

In order to fuzz test instructions, we first need to do some sanity
checking first. Factoring out this function allows us an easy way to
validate a single instruction.

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

4 years agointel/compiler: Handle invalid compacted immediates
Matt Turner [Wed, 6 Nov 2019 18:05:48 +0000 (10:05 -0800)]
intel/compiler: Handle invalid compacted immediates

16-bit immediates need to be replicated through the 32-bit immediate
field, so we should never see one that isn't.

This does happen however in the fuzzer unit test, so returning false
allows the fuzzer to reject this case.

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

4 years agointel/compiler: Handle invalid inputs to brw_reg_type_to_*()
Matt Turner [Thu, 2 Jan 2020 22:57:56 +0000 (14:57 -0800)]
intel/compiler: Handle invalid inputs to brw_reg_type_to_*()

Necessary to handle these cases when we test fuzzed instructions.

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

4 years agointel/compiler: Split hw_type tables
Matt Turner [Tue, 7 Jan 2020 08:27:23 +0000 (00:27 -0800)]
intel/compiler: Split hw_type tables

Previously we were sharing tables between generations that were nearly
identical (i.e., Gen8 3-src adds HF support) and used a small bit of
code to handle the differences. This is kind of a mess if you want to
reject 64-bit types on platforms that don't support 64-bit types, so
split the tables, allowing each generation's table to list exactly what
it supports.

Acked-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2635>

4 years agointel/compiler: Add a INVALID_{,HW_}REG_TYPE macros
Matt Turner [Mon, 6 Jan 2020 21:17:49 +0000 (13:17 -0800)]
intel/compiler: Add a INVALID_{,HW_}REG_TYPE macros

Since the enum brw_reg_type is packed, comparisons with -1 don't work
directly, necessitating the cast. Add a macro to avoid this confusion.

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

4 years agointel/compiler: Add NF some more places
Matt Turner [Thu, 2 Jan 2020 22:54:34 +0000 (14:54 -0800)]
intel/compiler: Add NF some more places

Necessary to handle these cases when we test fuzzed instructions.

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

4 years agointel/compiler: Limit compaction unit tests to specific gens
Matt Turner [Wed, 6 Nov 2019 18:13:24 +0000 (10:13 -0800)]
intel/compiler: Limit compaction unit tests to specific gens

Two of the tests emit instructions with MRF destinations, and MRFs
aren't present on Gen7+. I think we were just lucky that this didn't
cause a problem earlier since we were running the tests on Gen7-9.

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

4 years agointel/compiler: Don't disassemble align1 3-src operands on Gen < 10
Matt Turner [Tue, 21 Jan 2020 18:44:59 +0000 (10:44 -0800)]
intel/compiler: Don't disassemble align1 3-src operands on Gen < 10

Since the platforms don't support align1 3-src instructions, the
contents of these operands are not going to be meaningful. Just don't
print them to avoid hitting some assertions in brw_inst functions.

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

4 years agointel/compiler: Split has_64bit_types into float/int
Matt Turner [Mon, 13 Jan 2020 19:17:27 +0000 (11:17 -0800)]
intel/compiler: Split has_64bit_types into float/int

Gen7 has 64-bit floats but not 64-bit ints.

Acked-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2635>

4 years agointel/compiler: Extract GEN_* macros into separate file
Matt Turner [Thu, 31 Oct 2019 17:27:48 +0000 (10:27 -0700)]
intel/compiler: Extract GEN_* macros into separate file

Will be used by the instruction compaction unit test.

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

4 years agointel/compiler: Use ARRAY_SIZE()
Matt Turner [Thu, 16 Jan 2020 22:22:14 +0000 (14:22 -0800)]
intel/compiler: Use ARRAY_SIZE()

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

4 years agointel/fs: Don't emit control barrier if only one thread is used
Caio Marcelo de Oliveira Filho [Tue, 14 Jan 2020 20:03:22 +0000 (12:03 -0800)]
intel/fs: Don't emit control barrier if only one thread is used

When there's only one hardware thread (i.e. the dispatch width greater
or equal to the workgroup size), there's no need to use a barrier to
ensure all the invocations reach the same point in the shader, because
they are already running lock-step.

Results for SKL running Iris for shader-db tests with compute shaders

    total sends in shared programs: 18361 -> 18339 (-0.12%)
    sends in affected programs: 904 -> 882 (-2.43%)
    helped: 9
    HURT: 0
    helped stats (abs) min: 1 max: 5 x̄: 2.44 x̃: 2
    helped stats (rel) min: 0.84% max: 21.43% x̄: 7.82% x̃: 2.67%
    95% mean confidence interval for sends value: -3.31 -1.58
    95% mean confidence interval for sends %-change: -14.67% -0.97%
    Sends are helped.

Shaders from Aztec Ruins, Car Chase, Manhattan and DeusEx are helped.

Results for ICL and TGL are similar to SKL.

Results for BDW are similar to SKL except for DeusEx shader that has a
workgroup size 16 but in BDW picks the SIMD8.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3226>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3226>

4 years agointel/fs: Don't emit fence for shared memory if only one thread is used
Caio Marcelo de Oliveira Filho [Tue, 31 Dec 2019 09:01:27 +0000 (01:01 -0800)]
intel/fs: Don't emit fence for shared memory if only one thread is used

When there's only one hardware thread (i.e. the dispatch width greater
or equal to the workgroup size), there's no need to synchronize shared
memory access (SLM) since all the requests from a single thread are
already synchronized.  In such case, we just add a scheduling fence.

To be able to identify that case for all platforms, move the handling
of platforms prior to Gen11 (which don't have a separate SLM fence)
after the optimization.

Results for SKL running Iris for shader-db tests with compute shaders

    total sends in shared programs: 18395 -> 18361 (-0.18%)
    sends in affected programs: 938 -> 904 (-3.62%)
    helped: 9
    HURT: 0
    helped stats (abs) min: 1 max: 5 x̄: 3.78 x̃: 4
    helped stats (rel) min: 1.56% max: 26.32% x̄: 10.33% x̃: 2.60%
    95% mean confidence interval for sends value: -4.85 -2.71
    95% mean confidence interval for sends %-change: -19.12% -1.54%
    Sends are helped.

Shaders from Aztec Ruins, Car Chase, Manhattan and DeusEx are helped.

Results for ICL and TGL are similar to SKL.

Results for BDW are similar to SKL except for DeusEx shader that has a
workgroup size 16 but in BDW picks the SIMD8.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3226>

4 years agointel/fs: Add workgroup_size() helper
Caio Marcelo de Oliveira Filho [Tue, 14 Jan 2020 20:22:47 +0000 (12:22 -0800)]
intel/fs: Add workgroup_size() helper

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3226>

4 years agointel/fs: Add FS_OPCODE_SCHEDULING_FENCE
Caio Marcelo de Oliveira Filho [Thu, 2 Jan 2020 23:27:58 +0000 (15:27 -0800)]
intel/fs: Add FS_OPCODE_SCHEDULING_FENCE

Like a SHADER_OPCODE_MEMORY_FENCE but doesn't doesn't generate any
assembly code.

Will be used when the compiler shouldn't reorder certain instructions
but there's no need to generate code for the HW to do it -- as the
ordering will be guaranteed by other means.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3226>

4 years agogallium: check all planes' pipe formats in case of multi-samplers
Dongwon Kim [Wed, 15 Jan 2020 04:01:41 +0000 (20:01 -0800)]
gallium: check all planes' pipe formats in case of multi-samplers

Current code only checks whether first plane's format is supported
in case YUV format sampling is done by sampling each plane separately.
It would be safer to check other planes' as well.

Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2863>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2863>

4 years agoanv: Drop some workarounds that are no longer necessary
Kenneth Graunke [Fri, 17 Jan 2020 00:35:00 +0000 (16:35 -0800)]
anv: Drop some workarounds that are no longer necessary

These workarounds are no longer required by 10th Gen hardware.

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

4 years agoiris: Drop some workarounds which are no longer necessary
Kenneth Graunke [Fri, 17 Jan 2020 00:34:10 +0000 (16:34 -0800)]
iris: Drop some workarounds which are no longer necessary

These workarounds are no longer required by 10th Gen hardware.

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

4 years agoturnip: Disable UBWC on images used as storage images.
Eric Anholt [Thu, 16 Jan 2020 00:58:21 +0000 (16:58 -0800)]
turnip: Disable UBWC on images used as storage images.

The closed GL driver doesn't use UBWC on any storage images.  It does tile
mostly (skipping tiling on writeonly images, it seems), but for freedreno
we've been enabling tiling in all cases and it's fine.  We do need to
disable UBWC, as tests fail otherwise and just plugging in the equivalent
UBWC regs like we were setting up a texture isn't enough.

Fixes dEQP-VK.image.atomic_operations.*

Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3433>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3433>

4 years agoturnip: Add limited support for storage images.
Eric Anholt [Mon, 9 Dec 2019 21:31:35 +0000 (13:31 -0800)]
turnip: Add limited support for storage images.

So far this doesn't handle the texture state-based storage image access
loads, and doesn't support descriptor arrays (same as SSBOs).  The texture
side is more tricky, since we have another remapping table to work around.

This is enough to get some of dEQP-VK.image.atomic_operations.* working.

Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3433>

4 years agoturnip: Refactor the intrinsic lowering.
Eric Anholt [Thu, 19 Dec 2019 00:30:37 +0000 (16:30 -0800)]
turnip: Refactor the intrinsic lowering.

Too many things in one function, split them out based on the intrinsic.

Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3433>

4 years agoturnip: Fix some whitespace around binary operators.
Eric Anholt [Fri, 20 Dec 2019 00:47:08 +0000 (16:47 -0800)]
turnip: Fix some whitespace around binary operators.

Conforms to mesa style and the rest of turnip.

Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3433>

4 years agoradeonsi: Drop PIPE_CAP_TGSI_ANY_REG_AS_ADDRESS.
Eric Anholt [Mon, 6 Jan 2020 23:13:04 +0000 (15:13 -0800)]
radeonsi: Drop PIPE_CAP_TGSI_ANY_REG_AS_ADDRESS.

Now that we don't expose TGSI, we can stop exposing the flag.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3493>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3493>

4 years agor300: Remove a bunch of default handling of pipe caps.
Eric Anholt [Mon, 6 Jan 2020 23:01:36 +0000 (15:01 -0800)]
r300: 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: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3493>

4 years agor600: Remove a bunch of default handling of pipe caps.
Eric Anholt [Mon, 6 Jan 2020 22:56:46 +0000 (14:56 -0800)]
r600: 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: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3493>

4 years agoradeonsi: Remove a bunch of default handling of pipe caps.
Eric Anholt [Mon, 6 Jan 2020 22:52:57 +0000 (14:52 -0800)]
radeonsi: 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: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3493>

4 years agoanv: don't report error with other vendor DRM devices
Lionel Landwerlin [Tue, 21 Jan 2020 16:19:18 +0000 (18:19 +0200)]
anv: don't report error with other vendor DRM devices

Enumeration should just skip unsupported DRM devices.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 34c8621c3b37 ("anv: Allow enumerating multiple physical devices")
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2386
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3481>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3481>

4 years agofreedreno: Stop scattered remapping of SSBOs/images to IBOs.
Eric Anholt [Fri, 20 Dec 2019 22:02:55 +0000 (14:02 -0800)]
freedreno: Stop scattered remapping of SSBOs/images to IBOs.

Just make it be all SSBOs then all storage images.  The remapping table
was there to make it so that the big gap present from gallium's atomic
lowering would get cleaned up, but that's no longer case.  The table has
made it very hard to support Vulkan storage images, so it's time for it to
go.

This does mean that an SSBO/IBO that is only loaded (or size-queried) will
now occupy a slot in the table where it wouldn't before.  This seems like
a minor cost compared to being able to drop this much logic.

With the remapping table gone, SSBO array handling for turnip just falls
out.

Fixes many array cases of
dEQP-VK.binding_model.shader_access.primary_cmd_buf.storage_buffer.*

Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Jonathan Marek <jonathan@marek.ca> (turnip)
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3240>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3240>

4 years agocompiler: Add a note about how num_ssbos works in the program info.
Eric Anholt [Mon, 30 Dec 2019 20:01:25 +0000 (12:01 -0800)]
compiler: Add a note about how num_ssbos works in the program info.

These numbers are always confusing, and it's particularly so for this
field where it has a different meaning in different info structs.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3240>

4 years agonir: Drop the ssbo_offset to atomic lowering.
Eric Anholt [Fri, 20 Dec 2019 21:52:06 +0000 (13:52 -0800)]
nir: Drop the ssbo_offset to atomic lowering.

The arguments passed in were:
- prog->info.num_ssbos
- prog->nir->info.num_ssbos
- arbitrary values for standalone compilers

The num_ssbos should match between the prog's info and prog->nir's info
until this lowering happens.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3240>

4 years agogallium: Pack the atomic counters just above the SSBOs.
Eric Anholt [Fri, 20 Dec 2019 21:30:04 +0000 (13:30 -0800)]
gallium: Pack the atomic counters just above the SSBOs.

We carve out half the SSBO space for atomics, and we were just binding
them way up there.  freedreno was then using a remapping table to map the
sparse buffer index back down, since space in the descriptor array is a
shared resource that may limit parallelism.  That remapping table
generated inside of the ir3 compiler is getting thoroughly in the way of
implementing vulkan descriptor sets.

We will be able to get rid of the freedreno's remapping table, and
hopefully save shared resources on other hardware, by packing the atomics
tightly above the SSBOs (like i965 does).  We already rebind the shader
buffers on program change if either the old or new program has SSBOs or
ABOs, so this doesn't necessarily increase the program state change cost
(the only cost increase I can come up with is if you're using the same
atomic counter without rebinding it across changes of programs with
varying SSBO counts, meaning it would now bounce around index space).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3240>

4 years agomesa: Make atomic lowering put atomics above SSBOs.
Eric Anholt [Fri, 20 Dec 2019 17:02:07 +0000 (09:02 -0800)]
mesa: Make atomic lowering put atomics above SSBOs.

Gallium arbitrarily (it seems) put atomics below SSBOs, resulting in a
bunch of extra index management, and surprising shader code when you would
see your SSBOs up at index 16.  It makes a lot more sense to see atomics
converted to SSBOs appear as magic high numbers.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3240>

4 years agoturnip: Refactor linkage state setup.
Eric Anholt [Fri, 20 Dec 2019 22:26:44 +0000 (14:26 -0800)]
turnip: Refactor linkage state setup.

As I touch this for descriptor set reworks, I don't want to have to update
it twice.

Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3240>

4 years agonouveau/nvc0: add extern keyword to nvc0_miptree_vtbl.
Timur Kristóf [Tue, 21 Jan 2020 16:11:22 +0000 (17:11 +0100)]
nouveau/nvc0: add extern keyword to nvc0_miptree_vtbl.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
4 years agoanv: initialize clear_color_is_zero_one
Tapani Pälli [Tue, 21 Jan 2020 14:48:11 +0000 (16:48 +0200)]
anv: initialize clear_color_is_zero_one

Fixes following valgrind warning:

   ==12508== Conditional jump or move depends on uninitialised value(s)
   ==12508==    at 0x2CCD8B79: cmd_buffer_begin_subpass (genX_cmd_buffer.c:4599)
   ==12508==    by 0x2CCDA72B: gen9_CmdBeginRenderPass (genX_cmd_buffer.c:5275)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3487>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3487>

4 years agopanfrost/midgard: Print the actual source register for store operations
Boris Brezillon [Mon, 20 Jan 2020 21:00:48 +0000 (22:00 +0100)]
panfrost/midgard: Print the actual source register for store operations

Store operation use r26/r27 but have a word->reg set to 0 or 1 (base is
r26). Let's take this base offset into account in
print_load_store_instr().

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

4 years agopanfrost: Add pandecode entries for ASTC/ETC formats
Alyssa Rosenzweig [Thu, 16 Jan 2020 15:43:03 +0000 (10:43 -0500)]
panfrost: Add pandecode entries for ASTC/ETC formats

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

4 years agopanfrost: Add ASTC texture formats
Icecream95 [Sat, 11 Jan 2020 06:19:45 +0000 (19:19 +1300)]
panfrost: Add ASTC texture formats

Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3414>

4 years agopanfrost: Add ETC1/ETC2 texture formats
Icecream95 [Sat, 11 Jan 2020 07:00:38 +0000 (20:00 +1300)]
panfrost: Add ETC1/ETC2 texture formats

Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3414>

4 years agopanfrost: Rework linear<--->tiled conversions
Alyssa Rosenzweig [Wed, 15 Jan 2020 18:15:01 +0000 (13:15 -0500)]
panfrost: Rework linear<--->tiled conversions

There's a lot going on here (it's a ton of commits squashed together
since otherwise this would be impossible to review...)

1. We have a fast path for linear->tiled for whole (aligned) tiles, but we
have to use a slow path for unaligned accesses. We can get a pretty
major win for partial updates by using this slow path simply on the
borders of the update region, and then hit the fast path for the
tile-aligned interior. This does require some shuffling.

2. Mark the LUTs constant, which allows the compiler to inline them,
which pairs well with loop unrolling (eliminating the memory accesses
and just becoming some immediates.. which are not as immediate on
aarch64 as I'd like..)

3. Add fast path for bpp1/2/8/16. These use the same algorithm and we
have native types for them, so may as well get the fast path.

4. Drop generic path for bpp != 1/2/8/16, since these formats are
generally awful and there's no way to tile them efficienctly and
honestly there's not a good reason too either. Lima doesn't support any
of these formats; Panfrost can make the opinionated choice to make them
linear.

5. Specialize the unaligned routines. They don't have to be fully
generic, they just can't assume alignment. So now they should be nearly
as fast as the aligned versions (which get some extra tricks to be even
faster but the difference might be neglible on some workloads).

6. Specialize also for the size of the tile, to allow 4x4 tiling as well
as 16x16 tiling. This allows compressed textures to be efficiently tiled
with the same routines (so we add support for tiling ASTC/ETC textures
while we're at it)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Vasily Khoruzhick <anarsoul@gmail.com> #lima on Mali400
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3414>

4 years agopanfrost,lima: De-Galliumize tiling routines
Alyssa Rosenzweig [Tue, 14 Jan 2020 17:52:02 +0000 (12:52 -0500)]
panfrost,lima: De-Galliumize tiling routines

There's an implicit dependence on Gallium here that will add more
complexity than needed when testing/optimizing out of driver as well as
potentially Vulkanizing. We don't need a full pipe_box, just the x/y/w/h
properties directly.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Vasily Khoruzhick <anarsoul@gmail.com> #lima on Mali400
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3414>

4 years agopanfrost: Compile tiling routines with -O3
Alyssa Rosenzweig [Tue, 14 Jan 2020 17:27:47 +0000 (12:27 -0500)]
panfrost: Compile tiling routines with -O3

These are major hot spots for panfrost and lima; better let the compiler
do its thing even on debug builds.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Vasily Khoruzhick <anarsoul@gmail.com> #lima on Mali400
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3414>

4 years agoradv: Remove syncobj_handle variable in header.
Bas Nieuwenhuizen [Tue, 21 Jan 2020 10:49:55 +0000 (11:49 +0100)]
radv: Remove syncobj_handle variable in header.

I strongly suspect it was supposed to be a typedef. However, used
nowhere, we should remove it.

Fixes: eaa56eab6da "radv: initial support for shared semaphores (v2)"
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2385
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3479>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3479>

4 years agogitlab-ci/lava: add pipeline information in the lava job name
Neil Armstrong [Tue, 15 Oct 2019 13:22:07 +0000 (15:22 +0200)]
gitlab-ci/lava: add pipeline information in the lava job name

In order to have more informations in the LAVA jobs list, add the
current pipeline URL and commit ref name in the LAVA job name.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2337>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2337>

4 years agogallium/gallivm: enable linking lp_bld_printf function with C++ code
Jan Zielinski [Mon, 20 Jan 2020 12:57:36 +0000 (13:57 +0100)]
gallium/gallivm: enable linking lp_bld_printf function with C++ code

To enable linking functions declared in lp_bld_printf.h file with C++,
we need to add appropriate macros to the header.

Reviewed-by: Krzysztof Raszkowski <krzysztof.raszkowski@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3470>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3470>

4 years agoiris: Fix value of out-of-bounds accesses for vertex attributes
Danylo Piliaiev [Wed, 15 Jan 2020 16:56:42 +0000 (18:56 +0200)]
iris: Fix value of out-of-bounds accesses for vertex attributes

Having VERTEX_BUFFER_STATE.BufferSize greater than the size of
a bound vertex buffer allows shader to read uninitialized vertex
attributes from BO, instead of allowing hardware to return zeroes
on out-of-bounds access.

OpenGL spec "6.4 Effects of Accessing Outside Buffer Bounds" says:

"Robust buffer access can be enabled by creating a context with robust access
 enabled through the window system binding APIs. When enabled, any command
 unable to generate a GL error as described above, such as buffer object accesses
 from the active program, will not read or modify memory outside of the data
 store of the buffer object and will not result in GL interruption or termination.
 Out-of-bounds reads may return values from within the buffer object or zero
 values."

Fixes three webgl tests:
 conformance/rendering/out-of-bounds-array-buffers.html
 conformance2/rendering/out-of-bounds-index-buffers-after-copying.html
 conformance2/rendering/element-index-uint.html

See #1996

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3427>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3427>

4 years agoci: Re-enable CI for lima on mali450
Vasily Khoruzhick [Thu, 19 Dec 2019 06:15:11 +0000 (22:15 -0800)]
ci: Re-enable CI for lima on mali450

Amend fails and skips lists basing on lists from Andreas Baierl,
shard mali400 job across two devices since it takes close to 10min
and rename jobs to lima-mali400-test and lima-mali450-test.

Also don't set MESA_GLES_VERSION_OVERRIDE=3.0 for lima since we don't support
GLES 3.0 and lower DEQP_PARALLEL to 3 for jobs on H3.

Keep mali400 jobs disabled atm since they take too much time to complete
and we also get some unexplicable failures in dEQP-GLES2.functional.default_vertex_attrib.*

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3163>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3163>

4 years agoci: lava: pass CI_NODE_INDEX and CI_NODE_TOTAL to lava jobs
Vasily Khoruzhick [Fri, 17 Jan 2020 03:37:32 +0000 (19:37 -0800)]
ci: lava: pass CI_NODE_INDEX and CI_NODE_TOTAL to lava jobs

deqp-runner.sh uses it to determine whether we split job across multiple
devices and if we do what's the node index.

With this change we now can set 'parallel: N' in job description if we want
to split the job.

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

4 years agoturnip: fix invalid VK_ERROR_OUT_OF_POOL_MEMORY
Hyunjun Ko [Fri, 17 Jan 2020 07:23:03 +0000 (07:23 +0000)]
turnip: fix invalid VK_ERROR_OUT_OF_POOL_MEMORY

When VK_DESCRIPTOR_TYPE_SAMPLER is provided, it doesn't need to be
counted as a buffer count. Otherwise it leads to mismatch of allocated
buffer size, hitting VK_ERROR_OUT_OF_POOL_MEMORY finally.

Fixes: c39afe68f0390d45130c1317b3b7e65f55542c36
Also fixes amber tests:
./tests/cases/address_modes_float.amber
./tests/cases/address_modes_int.amber
./tests/cases/magfilter_linear.amber
./tests/cases/magfilter_nearest.amber

Reviewed-by: Jonathan Marek <jonathan@marek.ca>
4 years agoclover: Initialize Asm Parsers
Jan Vesely [Sun, 19 Jan 2020 02:27:01 +0000 (21:27 -0500)]
clover: Initialize Asm Parsers

Fixes piglits that use ADMGCN inline assembly:
program@execute@calls
program@execute@amdgcn-mubuf-negative-vaddr

CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
4 years agoanv: Allow enumerating multiple physical devices
Jason Ekstrand [Sat, 18 Jan 2020 05:52:50 +0000 (23:52 -0600)]
anv: Allow enumerating multiple physical devices

Instead of having a single physical device in anv_instance, have a
linked list of them.  What we have now works today because we our GPUs
are build into the CPU and so you're guaranteed to only ever have one of
them.  One day, that will change and we want ANV to be ready.

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