mesa.git
3 years agogallium/swr: Fix compilation warnings
jzielins [Mon, 6 Jul 2020 15:38:02 +0000 (17:38 +0200)]
gallium/swr: Fix compilation warnings

In some places in SWR cod objects are initialized using
memset/memcpy. This is usually done to enable
allocating those objects in aligned memory.
It generates compilation warnings though,
which are worked around by casting the pointers to void*
before calling memset/memcpy.

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

3 years agofreedreno/a6xx: Force gl_Layer to 0 when necessary
Connor Abbott [Fri, 3 Jul 2020 10:04:03 +0000 (12:04 +0200)]
freedreno/a6xx: Force gl_Layer to 0 when necessary

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

3 years agotu: Force gl_Layer to 0 when necessary
Connor Abbott [Fri, 3 Jul 2020 10:03:00 +0000 (12:03 +0200)]
tu: Force gl_Layer to 0 when necessary

In particular this will help us implement input attachments correctly
with layered rendering.

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

3 years agoir3: Add layer_zero variant bit
Connor Abbott [Fri, 3 Jul 2020 10:01:17 +0000 (12:01 +0200)]
ir3: Add layer_zero variant bit

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

3 years agopan/decode: Make mapped memory read-only while decoding
Icecream95 [Mon, 22 Jun 2020 10:49:53 +0000 (22:49 +1200)]
pan/decode: Make mapped memory read-only while decoding

This will help catch any bugs where descriptors are accidentally
modified.

v2: Use a dynarray of ro memory mappings rather than iterating through
    the mmap hash table.

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

3 years agopanfrost: Expose MSAA 4x
Alyssa Rosenzweig [Tue, 30 Jun 2020 19:19:47 +0000 (15:19 -0400)]
panfrost: Expose MSAA 4x

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

3 years agopanfrost: Save sample_mask before blitting
Alyssa Rosenzweig [Fri, 3 Jul 2020 18:16:20 +0000 (14:16 -0400)]
panfrost: Save sample_mask before blitting

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

3 years agopanfrost: Enable MSAA if we render to such a surface
Alyssa Rosenzweig [Fri, 3 Jul 2020 16:04:53 +0000 (12:04 -0400)]
panfrost: Enable MSAA if we render to such a surface

We hit this case for clears of MSAA surfaces without draws.

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

3 years agopanfrost: Set depth/stencil_layer_stride accordingly
Alyssa Rosenzweig [Fri, 3 Jul 2020 16:04:36 +0000 (12:04 -0400)]
panfrost: Set depth/stencil_layer_stride accordingly

Same logic as colour layer stride, I think.

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

3 years agopanfrost: Identify depth/stencil layer strides
Alyssa Rosenzweig [Fri, 3 Jul 2020 15:27:48 +0000 (11:27 -0400)]
panfrost: Identify depth/stencil layer strides

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

3 years agopanfrost: Implement alpha-to-coverage
Alyssa Rosenzweig [Thu, 2 Jul 2020 15:17:37 +0000 (11:17 -0400)]
panfrost: Implement alpha-to-coverage

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

3 years agopanfrost: Pass sample_mask to the hardware
Alyssa Rosenzweig [Thu, 2 Jul 2020 14:07:08 +0000 (10:07 -0400)]
panfrost: Pass sample_mask to the hardware

Gallium computes it for us.

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

3 years agopanfrost: Identify coverage_mask
Alyssa Rosenzweig [Thu, 2 Jul 2020 14:06:33 +0000 (10:06 -0400)]
panfrost: Identify coverage_mask

The driver specifies the mask directly.

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

3 years agopanfrost: Don't advertise MSAA 2x
Alyssa Rosenzweig [Tue, 30 Jun 2020 20:53:38 +0000 (16:53 -0400)]
panfrost: Don't advertise MSAA 2x

Let the frontend promote to MSAA 4x if the app requests it. We don't
support MSAA 2x.

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

3 years agopanfrost: Set layer_stride for multisampled rendering
Alyssa Rosenzweig [Tue, 30 Jun 2020 20:49:52 +0000 (16:49 -0400)]
panfrost: Set layer_stride for multisampled rendering

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

3 years agopanfrost: Include pointer for each sample
Alyssa Rosenzweig [Tue, 30 Jun 2020 20:43:47 +0000 (16:43 -0400)]
panfrost: Include pointer for each sample

Treating it like an array/3D texture.

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

3 years agopanfrost: Index texture by sample
Alyssa Rosenzweig [Tue, 30 Jun 2020 20:43:32 +0000 (16:43 -0400)]
panfrost: Index texture by sample

This will allow MSAA to route through.

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

3 years agopanfrost: Allocate space for multisampling
Alyssa Rosenzweig [Tue, 30 Jun 2020 20:29:16 +0000 (16:29 -0400)]
panfrost: Allocate space for multisampling

As an effective depth. Ugly but matches the blob.

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

3 years agopanfrost: Identify layer_stride
Alyssa Rosenzweig [Tue, 30 Jun 2020 20:21:18 +0000 (16:21 -0400)]
panfrost: Identify layer_stride

For MSAA.

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

3 years agopanfrost: Set depth to sample_count for MSAA 2D
Alyssa Rosenzweig [Tue, 30 Jun 2020 19:41:24 +0000 (15:41 -0400)]
panfrost: Set depth to sample_count for MSAA 2D

Treated like a 3D texture.

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

3 years agopan/mdg: Use _VTX tag for texelFetch in frag shaders
Alyssa Rosenzweig [Tue, 30 Jun 2020 19:41:43 +0000 (15:41 -0400)]
pan/mdg: Use _VTX tag for texelFetch in frag shaders

Probably a misnomer, let's match what the blob seemingly does though? At
least in blit shaders?

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

3 years agopan/mdg: Handle nir_texop_txf_ms
Alyssa Rosenzweig [Tue, 30 Jun 2020 19:32:01 +0000 (15:32 -0400)]
pan/mdg: Handle nir_texop_txf_ms

Same as nir_texop_txf, the special case where sample = 0.

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

3 years agopan/mdg: Handle nir_tex_src_ms_index
Alyssa Rosenzweig [Tue, 30 Jun 2020 19:31:39 +0000 (15:31 -0400)]
pan/mdg: Handle nir_tex_src_ms_index

Goes in .z for a txf_ms coordinate, same as a shadow comparator so we
reuse the impl.

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

3 years agopan/mdg: Handle GLSL_SAMPLER_DIM_MS
Alyssa Rosenzweig [Tue, 30 Jun 2020 19:31:30 +0000 (15:31 -0400)]
pan/mdg: Handle GLSL_SAMPLER_DIM_MS

Same as 2D.

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

3 years agopan/mdg: Allow ignoring move mode
Alyssa Rosenzweig [Fri, 3 Jul 2020 13:20:44 +0000 (09:20 -0400)]
pan/mdg: Allow ignoring move mode

Ensures we can gaurantee we'll pick something, which matters for
depth/stencil export.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: de41c4c103d ("pan/mdg: Prioritize non-moves on VADD/VLUT")
Tested-by: Icecream95 <ixn@keemail.me>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5782>

3 years agopan/decode: Identify layered MSAA flag
Alyssa Rosenzweig [Mon, 6 Jul 2020 22:45:16 +0000 (18:45 -0400)]
pan/decode: Identify layered MSAA flag

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

3 years agopan/decode: Fix MSAA texture decoding
Alyssa Rosenzweig [Tue, 30 Jun 2020 20:21:30 +0000 (16:21 -0400)]
pan/decode: Fix MSAA texture decoding

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

3 years agopan/mdg: Fix indirect UBO swizzles
Alyssa Rosenzweig [Mon, 6 Jul 2020 14:57:04 +0000 (10:57 -0400)]
pan/mdg: Fix indirect UBO swizzles

Helps a lot of vertex shaders dramatically.

total instructions in shared programs: 48491 -> 48252 (-0.49%)
instructions in affected programs: 3091 -> 2852 (-7.73%)
helped: 30
HURT: 0
helped stats (abs) min: 1 max: 35 x̄: 7.97 x̃: 5
helped stats (rel) min: 0.57% max: 21.60% x̄: 7.98% x̃: 6.85%
95% mean confidence interval for instructions value: -11.11 -4.83
95% mean confidence interval for instructions %-change: -10.17% -5.80%
Instructions are helped.

total bundles in shared programs: 23392 -> 23105 (-1.23%)
bundles in affected programs: 2017 -> 1730 (-14.23%)
helped: 35
HURT: 0
helped stats (abs) min: 1 max: 34 x̄: 8.20 x̃: 7
helped stats (rel) min: 1.11% max: 34.69% x̄: 15.52% x̃: 18.42%
95% mean confidence interval for bundles value: -10.91 -5.49
95% mean confidence interval for bundles %-change: -19.28% -11.77%
Bundles are helped.

total quadwords in shared programs: 39586 -> 39611 (0.06%)
quadwords in affected programs: 1717 -> 1742 (1.46%)
helped: 5
HURT: 24
helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
helped stats (rel) min: 0.83% max: 3.57% x̄: 2.45% x̃: 2.78%
HURT stats (abs)   min: 1 max: 2 x̄: 1.25 x̃: 1
HURT stats (rel)   min: 1.00% max: 3.77% x̄: 2.17% x̃: 1.89%
95% mean confidence interval for quadwords value: 0.50 1.22
95% mean confidence interval for quadwords %-change: 0.61% 2.13%
Quadwords are HURT.

total registers in shared programs: 3337 -> 3272 (-1.95%)
registers in affected programs: 373 -> 308 (-17.43%)
helped: 34
HURT: 0
helped stats (abs) min: 1 max: 5 x̄: 1.91 x̃: 1
helped stats (rel) min: 6.25% max: 33.33% x̄: 16.76% x̃: 16.03%
95% mean confidence interval for registers value: -2.31 -1.51
95% mean confidence interval for registers %-change: -19.15% -14.37%
Registers are helped.

total threads in shared programs: 2593 -> 2615 (0.85%)
threads in affected programs: 22 -> 44 (100.00%)
helped: 21
HURT: 0
helped stats (abs) min: 1 max: 2 x̄: 1.05 x̃: 1
helped stats (rel) min: 100.00% max: 100.00% x̄: 100.00% x̃: 100.00%
95% mean confidence interval for threads value: 0.95 1.15
95% mean confidence interval for threads %-change: 100.00% 100.00%
Threads are [helped].

total loops in shared programs: 6 -> 6 (0.00%)
loops in affected programs: 0 -> 0
helped: 0
HURT: 0

total spills in shared programs: 17 -> 1 (-94.12%)
spills in affected programs: 16 -> 0
helped: 2
HURT: 0

total fills in shared programs: 35 -> 5 (-85.71%)
fills in affected programs: 30 -> 0
helped: 2
HURT: 0

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

3 years agopan/mdg: Respect type/mask in mir_lower_special_reads
Alyssa Rosenzweig [Mon, 6 Jul 2020 14:33:29 +0000 (10:33 -0400)]
pan/mdg: Respect type/mask in mir_lower_special_reads

Fixes RA issues with the lowered moves, as well as enabling more
aggressive scheduling (hence the slight shdaer-db win).

total instructions in shared programs: 48539 -> 48491 (-0.10%)
instructions in affected programs: 4400 -> 4352 (-1.09%)
helped: 13
HURT: 0
helped stats (abs) min: 1 max: 8 x̄: 3.69 x̃: 3
helped stats (rel) min: 0.50% max: 1.89% x̄: 1.06% x̃: 1.10%
95% mean confidence interval for instructions value: -5.05 -2.33
95% mean confidence interval for instructions %-change: -1.29% -0.84%
Instructions are helped.

total bundles in shared programs: 23447 -> 23392 (-0.23%)
bundles in affected programs: 2224 -> 2169 (-2.47%)
helped: 21
HURT: 1
helped stats (abs) min: 1 max: 8 x̄: 2.67 x̃: 2
helped stats (rel) min: 0.89% max: 20.00% x̄: 9.04% x̃: 2.40%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 1.20% max: 1.20% x̄: 1.20% x̃: 1.20%
95% mean confidence interval for bundles value: -3.51 -1.49
95% mean confidence interval for bundles %-change: -12.52% -4.63%
Bundles are helped.

total quadwords in shared programs: 39651 -> 39586 (-0.16%)
quadwords in affected programs: 5557 -> 5492 (-1.17%)
helped: 38
HURT: 1
helped stats (abs) min: 1 max: 2 x̄: 1.74 x̃: 2
helped stats (rel) min: 0.61% max: 14.29% x̄: 3.92% x̃: 1.20%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 0.69% max: 0.69% x̄: 0.69% x̃: 0.69%
95% mean confidence interval for quadwords value: -1.87 -1.47
95% mean confidence interval for quadwords %-change: -5.55% -2.05%
Quadwords are helped.

total registers in shared programs: 3336 -> 3337 (0.03%)
registers in affected programs: 21 -> 22 (4.76%)
helped: 1
HURT: 2
helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
helped stats (rel) min: 11.11% max: 11.11% x̄: 11.11% x̃: 11.11%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 16.67% max: 16.67% x̄: 16.67% x̃: 16.67%

total threads in shared programs: 2592 -> 2593 (0.04%)
threads in affected programs: 1 -> 2 (100.00%)
helped: 1
HURT: 0

total spills in shared programs: 17 -> 17 (0.00%)
spills in affected programs: 0 -> 0
helped: 0
HURT: 0

total fills in shared programs: 35 -> 35 (0.00%)
fills in affected programs: 0 -> 0
helped: 0
HURT: 0

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

3 years agoir3: use empirical size for params as used by the shader
Ilia Mirkin [Sun, 5 Jul 2020 05:58:01 +0000 (01:58 -0400)]
ir3: use empirical size for params as used by the shader

For example only some UCPs may be used by the shader, triggering asserts
that too many consts are being uploaded.

While we're at it, also fix the const size when loading UCPs, since
otherwise it doesn't correspond to what the shader is actually using.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5752>

3 years agobifrost: Set RTZ rounding mode for f2i conversion
Chris Forbes [Sat, 4 Jul 2020 22:26:42 +0000 (15:26 -0700)]
bifrost: Set RTZ rounding mode for f2i conversion

Fixes dEQP-GLES2.functional.shaders.conversions.scalar_to_scalar.float_to_int_fragment

Signed-off-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5779>

3 years agotu: Enable KHR_variable_pointers
Connor Abbott [Mon, 29 Jun 2020 17:33:50 +0000 (19:33 +0200)]
tu: Enable KHR_variable_pointers

Passes dEQP-VK.spirv_assembly.instruction.graphics.variable_pointers.*
and dEQP-VK.spirv_assembly.instruction.compute.variable_pointers.*

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

3 years agotu: Rewrite variable lowering
Connor Abbott [Mon, 29 Jun 2020 17:18:20 +0000 (19:18 +0200)]
tu: Rewrite variable lowering

Don't lower to offsets, instead use nir_lower_explicit_io here and
use actual pointers for UBO's and SSBO's. This makes
KHR_variable_pointers trivial. This also fixes asserts with shared
variables, which are now supposed to be lowered with
nir_lower_explicit_io.

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

3 years agoanv: garbage collect timeline semaphore when querying value
Lionel Landwerlin [Mon, 6 Jul 2020 14:11:35 +0000 (17:11 +0300)]
anv: garbage collect timeline semaphore when querying value

If we don't garbage collect the timeline, the value never progresses
even though work completed.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3226
Fixes: 34f32a6d664807 ("anv: implement VK_KHR_timeline_semaphore")
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5774>

3 years agov3d: Enable perpendicular line caps when line smoothing
Neil Roberts [Mon, 22 Jun 2020 10:50:18 +0000 (12:50 +0200)]
v3d: Enable perpendicular line caps when line smoothing

V3D has a bit to set the line caps to be perpendicular to the line
rather than aligned to the edges of the framebuffer. I don’t know what
the disadvantages are of enabling this, but I noticed by experimentation
that enabling line smoothing on the Intel driver also enables nicer line
caps, so it seems nice to enable it here too.

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

3 years agov3d: Add a lowering pass for line smoothing
Neil Roberts [Mon, 22 Jun 2020 12:26:02 +0000 (14:26 +0200)]
v3d: Add a lowering pass for line smoothing

When line smoothing is enabled, the driver now increases the width of
the line so that it can add some semi-transparent pixels to either side
of the line. A lowering pass is added which modifies the alpha component
of every write to fragment output 0 so that if the fragment is outside
the width of the line then the alpha is reduced. It additionally
discards fragments that are completely invisible. It might seem bad to
use discard on a tiled renderer but the assumption is that any bad
effects from using discard will also happen anyway because of enabling
alpha blending.

v2: Disable the line smoothing pass entirely when the framebuffer
    contains an integer colour output or one with no alpha channel.
    Calculate the coverage once upfront and store in a global variable
    instead of calculating each time an output write is modified. Also
    do the conditional discard once upfront.
v3: Don’t check whether the output buffer has an alpha channel. Only
    look at output 0. Use aa_line_width intrinsic instead of calculating
    the real line width in the shader. Clamp the coverage as part of the
    global variable, not per output write.

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

3 years agov3d: Handle the line width intrinsics
Neil Roberts [Mon, 22 Jun 2020 07:52:25 +0000 (09:52 +0200)]
v3d: Handle the line width intrinsics

Adds new QUNIFORMs to store the line widths.

v2: Also handle the aa_line_width intrinsic

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

3 years agonir: Add intrinsics for the line width
Neil Roberts [Mon, 22 Jun 2020 07:49:33 +0000 (09:49 +0200)]
nir: Add intrinsics for the line width

The first intrinsic is intended to expose the value set by glLineWidth
to shaders internally. The second intrinsic exposes the value actually
sent to the hardware. This may be wider than the first one in order to
implement anti-aliasing. These will be used in later patches to
implement a line smoothing lowering pass.

v2: Add a second intrinsic for the expanded line width for
    anti-aliasing.

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

3 years agov3d: Implement the line coord intrinsic
Neil Roberts [Mon, 22 Jun 2020 12:25:08 +0000 (14:25 +0200)]
v3d: Implement the line coord intrinsic

The line coord intrinsic is loaded from the implicit varying stored in
the same slot as the point coord when drawing lines.

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

3 years agocompiler: Add a system value for the line coord
Neil Roberts [Fri, 3 Jul 2020 10:57:36 +0000 (12:57 +0200)]
compiler: Add a system value for the line coord

The line coord is a coordinate along the axis perpendicular to the line.
It is in the range [0,1] between the two edges of the line. It is
available at least on Broadcom hardware.

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

3 years agointel/perf: move query_mask and location out of gen_perf_query_counter
Marcin Ślusarz [Tue, 16 Jun 2020 12:40:21 +0000 (14:40 +0200)]
intel/perf: move query_mask and location out of gen_perf_query_counter

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

3 years agoiris: remove iris_monitor_config
Marcin Ślusarz [Tue, 9 Jun 2020 12:54:10 +0000 (14:54 +0200)]
iris: remove iris_monitor_config

perf_cfg is enough - it already contains almost all necessary
information and is constructed in a more optimal way (O(n) vs O(n^2)
- it uses hash table to build the unique counter list).

"Almost all", because it doesn't contain OA raw counters, but
we should have not exposed them anyway. Quoting Mark Janes:
"I see no reason to include the OA raw counters in the list that
are provided to the user. They are unusable.
The MDAPI library can be used to configure raw counters in a way
that provides esoteric metrics, but that library is written against
INTEL_performance_query."

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

3 years agoa4xx: hook up centroid ij coords
Ilia Mirkin [Mon, 6 Jul 2020 03:16:33 +0000 (23:16 -0400)]
a4xx: hook up centroid ij coords

This is necessary now that the compiler respects centroid interpolation,
even in non-MSAA mode. Otherwise the interpolation doesn't work. Fixes a
bunch of dEQP centroid transform feedback tests.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5778>

3 years agonir: Add docs to nir_lower[_explicit]_io
Jason Ekstrand [Thu, 11 Jun 2020 21:08:06 +0000 (16:08 -0500)]
nir: Add docs to nir_lower[_explicit]_io

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5418>

3 years agonir: Remove shared support from lower_io
Jason Ekstrand [Wed, 10 Jun 2020 17:51:01 +0000 (12:51 -0500)]
nir: Remove shared support from lower_io

No drivers are using this anymore so we can delete it and not keep
maintaining this legacy code-path.  If any drivers want this in the
future, they should use nir_lower_varst_to_explicit_types followed by
nir_lower_explicit_io.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5418>

3 years agonir: Assert that nir_lower_io is only called with allowed modes
Jason Ekstrand [Wed, 10 Jun 2020 17:47:50 +0000 (12:47 -0500)]
nir: Assert that nir_lower_io is only called with allowed modes

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5418>

3 years agopanfrost: Only call nir_lower_io on shader_in/out
Jason Ekstrand [Wed, 10 Jun 2020 22:54:25 +0000 (17:54 -0500)]
panfrost: Only call nir_lower_io on shader_in/out

Gallium drivers should never see nir_var_uniform because gallium lowers
regular uniforms to a UBO.  No GL driver should ever see either
nir_var_mem_shared because that's lowered in GLSL IR.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5418>

3 years agov3d: Only call nir_lower_io on shader_in/out
Jason Ekstrand [Wed, 10 Jun 2020 23:02:39 +0000 (18:02 -0500)]
v3d: Only call nir_lower_io on shader_in/out

Gallium drivers should never see nir_var_uniform because gallium lowers
regular uniforms to a UBO.  No GL driver should ever see either
nir_var_mem_shared because that's lowered in GLSL IR.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5418>

3 years agovc4: Only call nir_lower_io on shader_in/out
Jason Ekstrand [Wed, 10 Jun 2020 22:53:18 +0000 (17:53 -0500)]
vc4: Only call nir_lower_io on shader_in/out

Gallium drivers should never see nir_var_uniform because gallium lowers
regular uniforms to a UBO.  No GL driver should ever see either
nir_var_mem_shared because that's lowered in GLSL IR.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5418>

3 years agonouveau: Only call nir_lower_io on shader_in/out
Jason Ekstrand [Wed, 10 Jun 2020 22:50:37 +0000 (17:50 -0500)]
nouveau: Only call nir_lower_io on shader_in/out

Gallium drivers should never see nir_var_uniform because gallium lowers
regular uniforms to a UBO.  No GL driver should ever see either
nir_var_mem_shared because that's lowered in GLSL IR.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5418>

3 years agolima: Only call nir_lower_io on shader_in/out
Jason Ekstrand [Wed, 10 Jun 2020 22:49:13 +0000 (17:49 -0500)]
lima: Only call nir_lower_io on shader_in/out

Gallium drivers should never see nir_var_uniform because gallium lowers
regular uniforms to a UBO.  No GL driver should ever see either
nir_var_mem_shared because that's lowered in GLSL IR.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5418>

3 years agofreedreno: Only call nir_lower_io on shader_in/out
Jason Ekstrand [Wed, 10 Jun 2020 22:42:15 +0000 (17:42 -0500)]
freedreno: Only call nir_lower_io on shader_in/out

Gallium drivers should never see nir_var_uniform because gallium lowers
regular uniforms to a UBO.  No GL driver should ever see either
nir_var_mem_shared because that's lowered in GLSL IR.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5418>

3 years agoir3: mark ucp_enables as allowed values on all keys
Ilia Mirkin [Sun, 5 Jul 2020 04:19:08 +0000 (00:19 -0400)]
ir3: mark ucp_enables as allowed values on all keys

Both vertex and fragment shaders need to have the lowering.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5751>

3 years agoetnaviv: replace prims-emitted query
Christian Gmeiner [Sun, 5 Jul 2020 11:32:19 +0000 (13:32 +0200)]
etnaviv: replace prims-emitted query

As we do not support stream output buffers we only count the primitives
processed by the pipeline. Use the correct query type.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5754>

3 years agoa4xx: add polygon offset clamp, fix units
Ilia Mirkin [Mon, 6 Jul 2020 02:06:48 +0000 (22:06 -0400)]
a4xx: add polygon offset clamp, fix units

For some reason, in order to get all tests to pass, pretty much all
hardware (across vendors) has to program in offset_units * 2. This fixes
dEQP-GLES3.functional.polygon_offset.float32_displacement_with_units.

While we're at it, add polygon offset clamp support.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5763>

3 years agoa4xx: add noperspective interpolation support
Ilia Mirkin [Sun, 5 Jul 2020 02:13:32 +0000 (22:13 -0400)]
a4xx: add noperspective interpolation support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5753>

3 years agonir: add vec2_index_32bit_offset address format
Connor Abbott [Mon, 29 Jun 2020 17:47:57 +0000 (19:47 +0200)]
nir: add vec2_index_32bit_offset address format

For turnip, we use the "bindless" model on a6xx. Loads and stores with
the bindless model require a bindless base, which is an immediate field
in the instruction that selects between 5 different 64-bit "bindless
base registers", a 32-bit descriptor index that's added to the base, and
the usual 32-bit offset. The bindless base usually, but not always,
corresponds to the Vulkan descriptor set.  We can handle the case where
the base is non-constant by using a bunch of if-statements, to make it a
little easier in core NIR, and this seems to be what Qualcomm's driver
does too. Therefore, the pointer format we need to use in NIR has a vec2
index, for the bindless base and descriptor index. Plumb this format
through core NIR.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5683>

3 years agonir: Refactor load/store intrinsic helper
Connor Abbott [Mon, 29 Jun 2020 17:16:26 +0000 (19:16 +0200)]
nir: Refactor load/store intrinsic helper

Add the possibility to specify the source components. This is necessary
to let the UBO/SSBO index have more than one component, and it also lets
us remove a few hand-rolled load intrinsic definitions.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5683>

3 years agofreedreno/regs: document SS6_UBO state src
Jonathan Marek [Thu, 2 Jul 2020 02:32:06 +0000 (22:32 -0400)]
freedreno/regs: document SS6_UBO state src

Document this new a6xx_state_src value seen in A640/A650 tess traces.

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

3 years agofreedreno/fdperf: prefer render node
Rob Clark [Sun, 5 Jul 2020 18:47:15 +0000 (11:47 -0700)]
freedreno/fdperf: prefer render node

Avoid inadvertantly becoming master if fdperf happens to be the first
thing to open the device.

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

3 years agofreedreno/fdperf: better compatible string matching
Rob Clark [Sun, 5 Jul 2020 18:35:01 +0000 (11:35 -0700)]
freedreno/fdperf: better compatible string matching

Previously we would match the start of the compatible string, in
a couple of cases, in order to match compatible strings like
"qcom,adreno-630.2".  But these cases would always list a more
generic compatible (ie. "qcom,adreno") as a later choice.  So if
we parse all the compatible strings, we can do a more precise
exact match.

This avoids us accidentially matching on "qcom,adreno-smmu" and
the hilarity that ensues.

Fixes: 5a13507164a ("freedreno/perfcntrs: add fdperf")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5762>

3 years agofreedreno/fdperf: fix print of base address
Rob Clark [Sun, 5 Jul 2020 18:25:42 +0000 (11:25 -0700)]
freedreno/fdperf: fix print of base address

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

3 years agowsi/x11: Log swapchain status changes
Jason Ekstrand [Sat, 27 Jun 2020 18:44:28 +0000 (13:44 -0500)]
wsi/x11: Log swapchain status changes

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

3 years agovulkan/wsi: Don't consider VK_SUBOPTIMAL_KHR to be an error condition
Jason Ekstrand [Sat, 27 Jun 2020 13:50:47 +0000 (08:50 -0500)]
vulkan/wsi: Don't consider VK_SUBOPTIMAL_KHR to be an error condition

This was causing vkAcquireNextImageKHR to not signal the fences and
semaphores.  In the case where the semaphore was brand new, this could
cause an unsignalled syncobj to be passed into execbuffer2 which it will
reject with -EINVAL leading to VK_ERROR_DEVICE_LOST.  Thanks to Henrik
Rydgård who works on the PPSSPP project for helping me figure this out.

Fixes: ca3cfbf6f1e00 "vk: Add an initial implementation of the actual..."
Fixes: 778b51f491cfe "vulkan/wsi: Add a hooks for signaling semaphores..."
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5672>

3 years agoRevert "radv: add support for MRTs compaction to avoid holes"
Bas Nieuwenhuizen [Sun, 5 Jul 2020 17:20:50 +0000 (19:20 +0200)]
Revert "radv: add support for MRTs compaction to avoid holes"

This reverts commit 7a5e6fd25f2e132ef4cacc3a5b714c4e153227b0.

Since we have two different users bisecting issues to this commit, let's
revert.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: 7a5e6fd25f2 "radv: add support for MRTs compaction to avoid holes"
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3202
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3228
(Other report in https://gitlab.freedesktop.org/mesa/mesa/-/issues/3151#note_558589)

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

3 years agoradv: Always enable PERFECT_ZPASS_COUNTS.
Bas Nieuwenhuizen [Sun, 5 Jul 2020 16:57:35 +0000 (18:57 +0200)]
radv: Always enable PERFECT_ZPASS_COUNTS.

We have an issue with early depth testing and discard, where
non-perfect counts count the tile if the early depth test succeeds.

We could spend a lot of effort to set this conditionally based
on the presence of the two conditions, but in the presence of
inherited queries let's try this first.

Changing PERFECT_ZPASS_COUNTS since I'm pretty sure this has a lower
performance impact than always using late depth testing.

CC: <mesa-stable@lists.freedesktop.org>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3218
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5757>

3 years agoradv: Set handle types in Android semaphore/fence import.
Bas Nieuwenhuizen [Sun, 5 Jul 2020 17:57:29 +0000 (19:57 +0200)]
radv: Set handle types in Android semaphore/fence import.

Seems like we forgot to set it all this time ...

Fixes: b1444c9ccb0 "radv: Implement VK_ANDROID_native_buffer."
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5759>

3 years agoradv: disable FMASK compression when drawing with GENERAL layout
Samuel Pitoiset [Tue, 3 Dec 2019 13:01:28 +0000 (14:01 +0100)]
radv: disable FMASK compression when drawing with GENERAL layout

Fixes: 96063100 "radv: enable shaderStorageImageMultisample feature on GFX8+"
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3219
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/855
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/3165>

3 years agoRevert "nir: Support sysval tess levels in SPIR-V to NIR"
Jonathan Marek [Sat, 4 Jul 2020 02:11:16 +0000 (22:11 -0400)]
Revert "nir: Support sysval tess levels in SPIR-V to NIR"

This reverts commit d2d4677b56efa0003065b61e39c1ef977c83f7da.

The option is not used by any driver.

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

3 years agoRevert "nir: Add an option for lowering TessLevelInner/Outer to vecs"
Jonathan Marek [Sat, 4 Jul 2020 02:10:40 +0000 (22:10 -0400)]
Revert "nir: Add an option for lowering TessLevelInner/Outer to vecs"

This reverts commit d2df0761200ba9680f0d22defaa02c33fb051fcf.

The option is not used by any driver.

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

3 years agofreedreno/ir3: fix/rework tess levels
Jonathan Marek [Fri, 3 Jul 2020 15:34:47 +0000 (11:34 -0400)]
freedreno/ir3: fix/rework tess levels

The previous version assumes tess level outputs will only be written once
in the shader, however its not possible to guarantee that.

It also assumes all invocations will write all the levels, which is also
not guaranteed.

This is required to fix the "tesselation" and "terraintessellation" demos
with turnip.

The comment about nir_lower_io_to_temporaries in lower_tess_ctrl_block is
removed because nir_lower_io_to_temporaries specifically skips TESS_CTRL
shaders so the comment doesn't make sense.

The split load for tess levels workaround is removed, the new version only
has scalar access unless if ever gets vectorized.

This sets NIR_COMPACT_ARRAYS cap to avoid the glsl tess vec lowering with
gallium. It seems this will also disable "LowerCombinedClipCullDistance",
which I'm not sure was needed or not.

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

3 years agofreedreno/layout: fix explicit layout offset not added to slice offset
Jonathan Marek [Sun, 5 Jul 2020 18:38:30 +0000 (14:38 -0400)]
freedreno/layout: fix explicit layout offset not added to slice offset

Accidentally broke this when rebasing the offending commit.

My use case with non-zero explicit offset is UV plane of UBWC NV12, and
only the UBWC slice offset is used for the UBWC sampler, so I didn't catch
it immediately.

Fixes: d53dc6c37680eba8e8 ("freedreno/fdl6: rework layout code a bit (reduce linear align to 64 bytes)")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5761>

3 years agoamd/addrlib: fix another C++ one definition rule violation
Bas Nieuwenhuizen [Sat, 27 Jun 2020 23:29:40 +0000 (01:29 +0200)]
amd/addrlib: fix another C++ one definition rule violation

Clashes with the SI definition.

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

3 years agoiris: return max counter value for AMD_performance_monitor
Marcin Ślusarz [Mon, 15 Jun 2020 12:26:26 +0000 (14:26 +0200)]
iris: return max counter value for AMD_performance_monitor

glGetPerfMonitorCounterInfoAMD(..., ..., GL_COUNTER_RANGE_AMD, ...)
returned NAN (binary representation of uint64_t(-1) as float) as
a max value.

Fixes: 0fd4359733e6 ("iris/perf: implement routines to return counter info")
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5473>

3 years agost/mesa: fix reporting of float perf counters max value
Marcin Ślusarz [Mon, 15 Jun 2020 11:48:43 +0000 (13:48 +0200)]
st/mesa: fix reporting of float perf counters max value

Some Piglit tests (rightfully) fail because of min >= max when exposed
to perf counters that do not explicitly define their max value.

Failing tests:
spec/amd_performance_monitor/api/test_counter_info
spec/amd_performance_monitor/vc4/test_counter_info

u32/u64 changes are no-ops.

Fixes: 4cd1cfb9831d ("st/mesa: implement GL_AMD_performance_monitor")
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5473>

3 years agollvmpipe: enable GL 4.2
Dave Airlie [Mon, 6 Jul 2020 03:07:20 +0000 (13:07 +1000)]
llvmpipe: enable GL 4.2

mostly just docs patch, features were all complete already

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

3 years agollvmpipe: bump to GL support to GL 4.1
Dave Airlie [Thu, 2 Jul 2020 21:07:12 +0000 (07:07 +1000)]
llvmpipe: bump to GL support to GL 4.1

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

3 years agollvmpipe: bump texture/scene limits to enable GL 4.1
Dave Airlie [Thu, 2 Jul 2020 23:47:50 +0000 (09:47 +1000)]
llvmpipe: bump texture/scene limits to enable GL 4.1

Do we need to make this more dynamic? or have some options for vmware
embedded?

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

3 years agomesa/version: only enable GL4.1 with correct limits.
Dave Airlie [Thu, 2 Jul 2020 23:38:44 +0000 (09:38 +1000)]
mesa/version: only enable GL4.1 with correct limits.

I haven't tested all the limits, but these two should be enough
for driver writers to realise.

I've also submitted a minmax test for piglit to test this.

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

3 years agoturnip: enable 420_UNORM formats
Jonathan Marek [Fri, 10 Apr 2020 16:48:31 +0000 (12:48 -0400)]
turnip: enable 420_UNORM formats

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

3 years agoturnip: support multi-image layouts
Jonathan Marek [Wed, 13 May 2020 00:11:25 +0000 (20:11 -0400)]
turnip: support multi-image layouts

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

3 years agoturnip: clear_blit: pass aspect mask to setup function
Jonathan Marek [Thu, 16 Apr 2020 00:58:26 +0000 (20:58 -0400)]
turnip: clear_blit: pass aspect mask to setup function

Avoids having to duplicate logic to figure out the write mask on D24S8

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

3 years agost/mesa: allow R8 to not be exposed as renderable by driver
Ilia Mirkin [Mon, 18 May 2020 18:00:58 +0000 (14:00 -0400)]
st/mesa: allow R8 to not be exposed as renderable by driver

A3xx GPUs support RG8 and RGBA8, but not R8 for rendering. Add RG8 as
fallbacks for integer formats, and require a renderable format to be
picked for all R8 variants.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5748>

3 years agomesa/glformats: make _mesa_gles_error_check_format_and_type() more consistent
Eric Engestrom [Fri, 3 Jul 2020 00:40:26 +0000 (02:40 +0200)]
mesa/glformats: make _mesa_gles_error_check_format_and_type() more consistent

Let's consistently use the following code format instead of relying on
falling through to `default`:

    if (!req)
       return GL_INVALID_OPERATION;
    break;

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5729>

3 years agodrirc: Add picom to adaptive_sync exclusion list
Benjamin Cheng [Fri, 3 Jul 2020 21:59:52 +0000 (17:59 -0400)]
drirc: Add picom to adaptive_sync exclusion list

The compton compositor is unmaintained, with a new fork named picom taking
its place. As with the other compositors (including compton), adaptive
sync should not be enabled.

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

3 years agoturnip: fix tess param bo size calculation
Jonathan Marek [Thu, 2 Jul 2020 15:53:33 +0000 (11:53 -0400)]
turnip: fix tess param bo size calculation

ir3 already calculates the stride in the tess param bo, so use that instead
of a incorrect calculation. The calculation of per_vertex_output_size /
per_patch_output_size is wrong because it counts dwords instead of bytes,
and what it counts for per_vertex_output_size is a per-patch size because
the glsl type is already an array of # vertex/patch elements.

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

3 years agonir: Add nir_lower_clip_disable.c to SCons build.
Vinson Lee [Sat, 4 Jul 2020 00:43:51 +0000 (17:43 -0700)]
nir: Add nir_lower_clip_disable.c to SCons build.

Fixes: fb2fe802f638 ("nir: add lowering pass for clip plane enabling")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3217
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5741>

3 years agogitlab-ci: Enable -Werror in `meson-classic` job
Timothy Arceri [Fri, 3 Jul 2020 03:10:09 +0000 (13:10 +1000)]
gitlab-ci: Enable -Werror in `meson-classic` job

It's warning-clean.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5730>

3 years agonouveau: fix pointer-sign warning
Timothy Arceri [Fri, 3 Jul 2020 01:37:45 +0000 (11:37 +1000)]
nouveau: fix pointer-sign warning

Fixes: e630271e0ec3 ("mesa: don't ever set NullBufferObj in gl_vertex_array_binding")
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5730>

3 years agoutil: Avoid strict aliasing bugs in xxhash.
Eric Anholt [Fri, 29 May 2020 22:23:51 +0000 (15:23 -0700)]
util: Avoid strict aliasing bugs in xxhash.

XXH32 is doing access through u32 *, and with strict aliasing the compiler
gets to assume that those are independent of the u16 writes we did in
fd6_texture_key setup, and based on various tweaks to the code, would
result in bad hashes computed after inlining.  The failure was:

../src/util/hash_table.c:326:_mesa_hash_table_search_pre_hashed: Assertion
`ht->key_hash_function == ((void *)0) || hash == ht->key_hash_function(key)'
failed.)

By setting these two flags, we always take the unaligned,
memcpy-the-32-bit-data path.  I believe this should be same perf on x86
(which will happily unaligned load 32 bits in the end), while it will be
slower on arm (where you have to a special unaligned load operation iirc).
This should still be far faster than our old hash.

Fixes: edd62619a1c4 ("freedreno: replace fnv1a hash function with xxhash")
Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5271>

3 years agodraw/clip: fix viewport index for geometry shaders
Dave Airlie [Thu, 2 Jul 2020 05:37:16 +0000 (15:37 +1000)]
draw/clip: fix viewport index for geometry shaders

The old code updated the viewport index on the first vertex in
a primitive, however it was picking the first vertex wrong
when used with geometry shaders.

This code has access to the prim info with the primitive lengths
so instead keep track of when a new primitive starts by tracking
the lengths and updating the viewport index then. The prim info
is only valid after a GS or prim assembly, so enable prim assembly
if a vertex shader ever uses viewport index.

This fixes:
piglit arb_viewport_array-render-viewport-2
KHR-GLES31.core.viewport_array.draw_to_single_layer_with_multiple_viewports,Fail
KHR-GLES31.core.viewport_array.draw_mulitple_viewports_with_single_invocation,Fail
KHR-GLES31.core.viewport_array.draw_multiple_layers,Fail
KHR-GLES31.core.viewport_array.depth_range,Fail

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

3 years agodraw/clip: cleanup viewport index handling code.
Dave Airlie [Thu, 2 Jul 2020 05:29:32 +0000 (15:29 +1000)]
draw/clip: cleanup viewport index handling code.

This moves code around, and adds initial clamping

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

3 years agoturnip: vsc improvements
Jonathan Marek [Thu, 18 Jun 2020 22:08:58 +0000 (18:08 -0400)]
turnip: vsc improvements

* Remove scratch_bo from cmdbuffer, use a device-global bo instead, which
  also includes border color (and eventually shaders for 3D blit path)
* Use CP_SET_BIN_DATA5_OFFSET to allow setting VSC buffer addresses only
  once at the start of the cmdstream
* Use scratch bo mechanism for a resizable VSC buffer
* Use feedback from "vsc_draw_overflow" and "vsc_prim_overflow" values to
  increase the size of VSC buffer when beginning to record a new cmdbuffer

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

3 years agoturnip: rework render_tiles loop
Jonathan Marek [Fri, 19 Jun 2020 00:51:11 +0000 (20:51 -0400)]
turnip: rework render_tiles loop

Loop through pipes and then loop over the tiles in that pipe instead of
looping over all tiles then having to calculate the pipe # and slot #.

Mainly this avoids the hard to follow "config_get_tile" logic, but should
also be a gain due to better use of cache with the VSC data.

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

3 years agoturnip: make tiling config part of framebuffer state
Jonathan Marek [Fri, 19 Jun 2020 00:39:39 +0000 (20:39 -0400)]
turnip: make tiling config part of framebuffer state

Compute the tiling config at framebuffer creation time. A framebuffer will b
be re-used multiple times, so this will avoid having to re-calculate the
tiling config every time a command buffer is recorded.

The tiling config already couldn't use the render area's x1/y1 because of
hw binning, this move makes it so the render area isn't used at all for the
tiling config.

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

3 years agoRevert "loader/dri3: Check for window destruction in dri3_wait_for_event_locked"
Michel Dänzer [Thu, 2 Jul 2020 16:49:26 +0000 (18:49 +0200)]
Revert "loader/dri3: Check for window destruction in dri3_wait_for_event_locked"

This reverts commit d7d7687829875e401690219d4a72458fb2bbe4de.

It caused freezes with e.g. kwin_x11 due to hitting the 1s timeout.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3214
Reopens: https://gitlab.freedesktop.org/mesa/mesa/-/issues/116
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5722>

3 years agomeson: Add versioning for xvmc tracker
Emmanuel Vadot [Wed, 1 Jul 2020 09:54:32 +0000 (11:54 +0200)]
meson: Add versioning for xvmc tracker

The xvmc tracker used to be versionned with autotool but this seems to have been
lost in the meson switch.

Fixes: 22a817af8a89eb3c762f ("meson: build gallium xvmc state tracker")
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5708>

3 years agost/program: use nir_lower_clip_disable instead of nir_lower_clip_vs conditionally
Mike Blumenkrantz [Wed, 17 Jun 2020 13:40:51 +0000 (09:40 -0400)]
st/program: use nir_lower_clip_disable instead of nir_lower_clip_vs conditionally

if the shader already outputs gl_ClipDistance, nir_lower_clip_vs will create
duplicate variables when what we want is to just change the existing values

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

3 years agonir: add lowering pass for clip plane enabling
Mike Blumenkrantz [Wed, 17 Jun 2020 13:35:46 +0000 (09:35 -0400)]
nir: add lowering pass for clip plane enabling

a pass which rewrites gl_ClipDistance[n] to an undef if the corresponding
clip plane is disabled in the rasterizer state

this pass is needed for zink to handle api disables of clip planes

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

3 years agov3d/tex: handle correctly coordinates for cube/cubearrays images
Alejandro Piñeiro [Fri, 26 Jun 2020 13:32:31 +0000 (15:32 +0200)]
v3d/tex: handle correctly coordinates for cube/cubearrays images

When fetching for cube maps, we need to interpret them as 2d texture
arrays, being the third coordinate the index for the face.

Fixes Vulkan CTS tests like the following using v3dv:

dEQP-VK.binding_model.shader_access.primary_cmd_buf.storage_image.fragment.single_descriptor.cube_base_mip
dEQP-VK.binding_model.shader_access.primary_cmd_buf.storage_image.compute.multiple_descriptor_sets.multiple_contiguous_descriptors.cube_array_base_mip

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