platform/upstream/mesa.git
3 years agoradv: configure the VRS HTILE encoding size
Samuel Pitoiset [Fri, 9 Apr 2021 11:30:01 +0000 (13:30 +0200)]
radv: configure the VRS HTILE encoding size

Any depth buffer can potentially use VRS.

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

3 years agoradv: determine if attachment VRS is enabled
Samuel Pitoiset [Mon, 22 Mar 2021 16:55:40 +0000 (17:55 +0100)]
radv: determine if attachment VRS is enabled

When VRS attachment, any depth buffer can potentially be used for VRS.
We also have to create a global depth buffer if the app doesn't
provide one.

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

3 years agoradv: do not enable DCC for fragment shading rate attachments
Samuel Pitoiset [Mon, 22 Mar 2021 16:49:24 +0000 (17:49 +0100)]
radv: do not enable DCC for fragment shading rate attachments

That's unnecessary.

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

3 years agoradv: do not allow MSAA with fragment shading rate attachments
Samuel Pitoiset [Wed, 7 Apr 2021 14:48:59 +0000 (16:48 +0200)]
radv: do not allow MSAA with fragment shading rate attachments

The Vulkan spec requires the implementation to only supports
VK_SAMPLE_COUNT_1_BIT with fragment shading rate attachments.

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

3 years agoradv: expose R8_UINT as the only supported format for VRS attachments
Samuel Pitoiset [Fri, 9 Apr 2021 11:58:15 +0000 (13:58 +0200)]
radv: expose R8_UINT as the only supported format for VRS attachments

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

3 years agoac/surface: store the HTILE pitch to the surface
Samuel Pitoiset [Wed, 7 Apr 2021 13:41:05 +0000 (15:41 +0200)]
ac/surface: store the HTILE pitch to the surface

This will be used to copy VRS rates to the HTILE buffer.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10187>

3 years agoac/surface: implement HtileAddrFromCoord in NIR
Samuel Pitoiset [Wed, 7 Apr 2021 11:34:51 +0000 (13:34 +0200)]
ac/surface: implement HtileAddrFromCoord in NIR

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10187>

3 years agoac/surface: copy the HTILE equations to the surface
Samuel Pitoiset [Wed, 7 Apr 2021 13:59:24 +0000 (15:59 +0200)]
ac/surface: copy the HTILE equations to the surface

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10187>

3 years agoac/surface: increase gfx9_meta_equation::gfx10_bits by 4 elements
Samuel Pitoiset [Tue, 13 Apr 2021 11:38:08 +0000 (13:38 +0200)]
ac/surface: increase gfx9_meta_equation::gfx10_bits by 4 elements

For the HTILE equation.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10187>

3 years agoac/surface: rename gfx9_dcc_equation to gfx9_meta_equation
Samuel Pitoiset [Tue, 13 Apr 2021 11:32:44 +0000 (13:32 +0200)]
ac/surface: rename gfx9_dcc_equation to gfx9_meta_equation

gfx9_meta_equation will be used to store the HTILE equation.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10187>

3 years agoac/surface: add a test of HtileAddrFromCoord prototype outside of addrlib
Samuel Pitoiset [Tue, 6 Apr 2021 08:48:41 +0000 (10:48 +0200)]
ac/surface: add a test of HtileAddrFromCoord prototype outside of addrlib

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10187>

3 years agoac/surface: rename ac_surface_dcc_address_test.c
Samuel Pitoiset [Tue, 13 Apr 2021 11:53:09 +0000 (13:53 +0200)]
ac/surface: rename ac_surface_dcc_address_test.c

This file will also contain HTILE equation tests.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10187>

3 years agoamd/addrlib: expose HTILE address equations to drivers on GFX10+
Samuel Pitoiset [Mon, 5 Apr 2021 14:13:34 +0000 (16:13 +0200)]
amd/addrlib: expose HTILE address equations to drivers on GFX10+

Similar to the DCC address equations. Only GFX10+ because this
is for copying VRS rates to the HTILE buffer.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10187>

3 years agolavapipe: ask pipe-driver for int16 support
Erik Faye-Lund [Fri, 9 Apr 2021 08:47:27 +0000 (10:47 +0200)]
lavapipe: ask pipe-driver for int16 support

We shouldn't assume the driver can deal with int16 unless it reports
that it can.

... And LLVMpipe isn't quite there yet, see this MR for details:

https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10185

Fixes: b38879f8c5f ("vallium: initial import of the vulkan frontend")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10189>

3 years agolavapipe: check all graphics stages
Erik Faye-Lund [Mon, 12 Apr 2021 15:56:34 +0000 (17:56 +0200)]
lavapipe: check all graphics stages

For these caps, we need to check all stages to be sure we've got things
right.

Again, this is probably benign, because LLVMpipe should support the same
value for all stages.

Fixes: b38879f8c5f ("vallium: initial import of the vulkan frontend")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10189>

3 years agolavapipe: check all vertex-stages
Erik Faye-Lund [Mon, 12 Apr 2021 15:16:12 +0000 (17:16 +0200)]
lavapipe: check all vertex-stages

We should really check for the minimum of all supported vertex-stages
here, not just the vertex-shader.

This shouldn't make any real-world difference, because we really only
support LLVMpipe here, and that driver has the same limits for all
stages. But it seems better to actually check all stages instead of just
assuming.

Fixes: b38879f8c5f ("vallium: initial import of the vulkan frontend")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10189>

3 years agolavapipe: do not subtract 8 from enum
Erik Faye-Lund [Mon, 12 Apr 2021 15:47:25 +0000 (17:47 +0200)]
lavapipe: do not subtract 8 from enum

This seems arbitrary, and makes us check for PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS
instead of PIPE_SHADER_CAP_MAX_SHADER_IMAGES, which isn't what we want.

The end result is that we accidentally exposed 128 shader images,
instead of 16. This can lead to us writing outside of the array of
shader images in llvmpipe_set_shader_images, among other bad things.

Fixes: b38879f8c5f ("vallium: initial import of the vulkan frontend")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10189>

3 years agost/nine: Default tearfree_discard to true
Axel Davy [Sat, 10 Apr 2021 21:53:07 +0000 (23:53 +0200)]
st/nine: Default tearfree_discard to true

With tearfree_discard=false, we tear when rendering
fullscreen apps with vsync off.

This is a feature in the sense it's the same as the native
implementation. This also means lower input lag.

However I think most users will prefer to have no tearing,
and don't care about sub refresh-rate input lag.

Thus it's better to default tearfree_discard to true.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Default thread_submit to true
Axel Davy [Sat, 10 Apr 2021 21:40:20 +0000 (23:40 +0200)]
st/nine: Default thread_submit to true

When rendering fullscreen with vsync on at
a rate close to the refresh rate, you can
miss pageflips by submitting buffers for pageflip
that end up not finished being rendered when the pageflip is due.

With Nine in this situation you could get half the refresh
rate fps before this patch.

Due to the way the presentation backend is implemented,
it's not possible to easily detect the situation and adapt (use
one more backbuffer, but only in this scenario to not increase input
lap when the issue is not present).

thread_submit doesn't have this issue.

Let's default thread_submit to true.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Improve performance with thread_submit
Axel Davy [Fri, 12 Mar 2021 20:28:39 +0000 (21:28 +0100)]
st/nine: Improve performance with thread_submit

Use the Async flush flag to return faster during
Present() when thread_submit is used.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Bump num of backbuffers for tearfree thread_submit
Axel Davy [Mon, 8 Mar 2021 17:44:32 +0000 (18:44 +0100)]
st/nine: Bump num of backbuffers for tearfree thread_submit

Running some high fps benchmarks, thread_submit gets
subpar fps with the option tearfree_discard.
Increasing the number of backbuffers fixes it.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Lower texture_memory_limit default
Axel Davy [Sat, 10 Apr 2021 21:01:16 +0000 (23:01 +0200)]
st/nine: Lower texture_memory_limit default

512 MB is too ambitious as default value.
128 MB seems safer, and users can increase the limit
manually for the few games that would benefit from it.

Also fixes a typo in the description

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Make it optional to use a sw renderer
Axel Davy [Sat, 10 Apr 2021 20:52:47 +0000 (22:52 +0200)]
st/nine: Make it optional to use a sw renderer

Until the problem described in
https://gitlab.freedesktop.org/mesa/mesa/-/issues/4489
is fixed, the advantages of using a sw renderer for the
sw rendering in nine are too small compared to the
disadvantages.

Add an option to control whether we use a sw renderer,
and make it so by default we don't.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Allow to override the vram size
Axel Davy [Mon, 15 Mar 2021 21:35:26 +0000 (22:35 +0100)]
st/nine: Allow to override the vram size

This can be useful for debugging, or for some apps
not supporting >= 4GB of vram.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Disable buffer_upload when csmt is off
Axel Davy [Mon, 8 Mar 2021 17:48:23 +0000 (18:48 +0100)]
st/nine: Disable buffer_upload when csmt is off

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Use PIPE_MAP_ONCE for persistent buffers
Axel Davy [Sat, 13 Mar 2021 21:39:28 +0000 (22:39 +0100)]
st/nine: Use PIPE_MAP_ONCE for persistent buffers

This enables radeonsi to really unmap on release,
which reduces virtual memory usage.

Do it only on 32 bits, as it can reduce performance if the
allocation is reused.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Add fallback for YUV formats
Axel Davy [Sat, 10 Apr 2021 19:58:59 +0000 (21:58 +0200)]
st/nine: Add fallback for YUV formats

Adds alternative format to store YUV textures/surfaces.

These will be converted on upload to the alternative format.
Fixes: https://github.com/iXit/wine-nine-standalone/issues/39

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Do not memset buffers twice
Axel Davy [Sat, 10 Apr 2021 21:22:06 +0000 (23:22 +0200)]
st/nine: Do not memset buffers twice

No need to apply memset on an allocation
from align_calloc.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Have NOOVERWRITE win over DISCARD
Axel Davy [Sat, 27 Mar 2021 21:33:06 +0000 (22:33 +0100)]
st/nine: Have NOOVERWRITE win over DISCARD

I held for a long time the belief DISCARD wins
over NOOVERWRITE, backed by experiments.

But probably both behaviours are ok.
For perf it is better to have NOOVERWRITE win.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Add logging to Ex function
Axel Davy [Mon, 15 Mar 2021 22:42:47 +0000 (23:42 +0100)]
st/nine: Add logging to Ex function

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Complete *Ex stubs
Axel Davy [Mon, 15 Mar 2021 21:22:05 +0000 (22:22 +0100)]
st/nine: Complete *Ex stubs

Returning D3D_OK instead of an error when it
makes sense.
Return the value passed previously (or the default)
when it makes sense.
Add (void)variable for unused input variables.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Pseudo implement Create*Ex functions
Axel Davy [Mon, 15 Mar 2021 21:02:37 +0000 (22:02 +0100)]
st/nine: Pseudo implement Create*Ex functions

It seems some apps use them.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Improve Reset on Ex devices
Axel Davy [Fri, 12 Mar 2021 14:07:06 +0000 (15:07 +0100)]
st/nine: Improve Reset on Ex devices

Found with wine tests

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Pseudo implement set/getClipstatus
Axel Davy [Wed, 10 Mar 2021 21:38:14 +0000 (22:38 +0100)]
st/nine: Pseudo implement set/getClipstatus

Not sure why any app would use this in production,
it seems like a debugging feature. Still some do make
the calls.

Fixes: https://github.com/iXit/wine-nine-standalone/issues/99

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Catch redundant scissor and viewport settings
Axel Davy [Fri, 12 Mar 2021 14:57:13 +0000 (15:57 +0100)]
st/nine: Catch redundant scissor and viewport settings

The redundancy check is done in the nine_context function,
rather than the device function, in order to also filter
calls from SetRenderTarget and Reset*.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Fix ff has_aNrm computation
Axel Davy [Sat, 27 Mar 2021 12:45:17 +0000 (13:45 +0100)]
st/nine: Fix ff has_aNrm computation

In some cases the wrong computation led the
normal to be zero instead of the correct value,
which led to artifacts.

Fixes: https://github.com/iXit/wine-nine-standalone/issues/105

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Fix ps ff BLENDTEXTUREALPHA
Axel Davy [Sat, 27 Mar 2021 11:36:34 +0000 (12:36 +0100)]
st/nine: Fix ps ff BLENDTEXTUREALPHA

This ff ps operation has the texture alpha as input.
Thus we need to sample the texture.

Fixes: https://github.com/iXit/wine-nine-standalone/issues/105

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Refuse depth buffers as rendertargets
Axel Davy [Sat, 20 Mar 2021 12:50:45 +0000 (13:50 +0100)]
st/nine: Refuse depth buffers as rendertargets

If we allow them, some apps try to use them
as rendertargets.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Clamp max_anisotropy
Axel Davy [Thu, 18 Mar 2021 22:36:28 +0000 (23:36 +0100)]
st/nine: Clamp max_anisotropy

GL does the same.

Fixes the low texture quality issue of
https://github.com/iXit/wine-nine-standalone/issues/21

The are some indications it might not be the native
behaviour (which makes sense, the native filtering
of states seems more to not update internal states
when the passed value is invalid).
However it's better visually to have anisotropic filtering
enabled in these buggy cases.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Ignore swizzle on samplers
Axel Davy [Thu, 11 Mar 2021 17:33:24 +0000 (18:33 +0100)]
st/nine: Ignore swizzle on samplers

Prevents a crash running wine tests

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Increase number of constants of vs1_sw
Axel Davy [Fri, 12 Mar 2021 12:38:59 +0000 (13:38 +0100)]
st/nine: Increase number of constants of vs1_sw

Wine tests seem to indicate more the 256 should
be supported for this case, but I couldn't find the
doc for how much it should be. Use the vs >= 2
settings for now.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Remove errors on unsupported lock flags
Axel Davy [Fri, 12 Mar 2021 20:28:57 +0000 (21:28 +0100)]
st/nine: Remove errors on unsupported lock flags

Some applications seem to pass undefined flags...
And we shouldn't return an error.

Found investigating:
https://github.com/iXit/wine-nine-standalone/issues/100

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Handle D3DFMT_NULL multisampling
Axel Davy [Thu, 11 Mar 2021 19:55:48 +0000 (20:55 +0100)]
st/nine: Handle D3DFMT_NULL multisampling

When D3DFMT_NULL is set as render target,
we must take the multisampling state
from the depth buffer.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Enable multisampling also without depth buffer
Axel Davy [Thu, 11 Mar 2021 19:45:39 +0000 (20:45 +0100)]
st/nine: Enable multisampling also without depth buffer

Found with wine tests.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Fix alpha to coverage states
Axel Davy [Thu, 11 Mar 2021 19:43:04 +0000 (20:43 +0100)]
st/nine: Fix alpha to coverage states

The sequence of states to disable NVidia alpha
to coverage was disabling AMD alpha to coverage.
This patch fixes it.

Found with wine tests.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Improve Surface GetContainer
Axel Davy [Fri, 12 Mar 2021 14:07:45 +0000 (15:07 +0100)]
st/nine: Improve Surface GetContainer

Prevents a crash in wine tests. Not sure
this behaviour is the correct one, but at
least it'll check the IID passed is the device
before returning it.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Prevent negative reference count
Axel Davy [Sat, 27 Mar 2021 19:55:58 +0000 (20:55 +0100)]
st/nine: Prevent negative reference count

Apparently this is a thing, according to wine tests

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Fix value of pipe_draw_info's max_index vertex
Axel Davy [Sat, 6 Mar 2021 13:40:35 +0000 (14:40 +0100)]
st/nine: Fix value of pipe_draw_info's max_index vertex

max_index didn't include draw.start

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Fix read outside bounds for some textures
Axel Davy [Sun, 28 Mar 2021 16:32:15 +0000 (18:32 +0200)]
st/nine: Fix read outside bounds for some textures

According to wine tests, some apps can allocate very
small ATI1/ATI2 textures levels.

The issue is that the CPU versions of these textures are stored
in buffers which size is the same as if the format was uncompressed.

Thus the content filled cannot possibly be correct for these levels.

The tests seems to hint when rendering with these levels the output
is bad, but at least it the runtime shouldn't crash when using them.

Previously nine would read outside bounds (found with asan) in this
scenario, as the gallium helper copies a full compressed block.

Instead do not copy anything for these levels.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Fix compilation warnings
Axel Davy [Sun, 28 Mar 2021 16:31:57 +0000 (18:31 +0200)]
st/nine: Fix compilation warnings

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Fix reading invalid pointer
Axel Davy [Sun, 28 Mar 2021 16:30:40 +0000 (18:30 +0200)]
st/nine: Fix reading invalid pointer

Apparently it is incorrect to use the pointer in
LIST_FOR_EACH_ENTRY like I used to.
Found with asan.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Prevent use after free on dtor
Axel Davy [Sun, 28 Mar 2021 10:26:48 +0000 (12:26 +0200)]
st/nine: Prevent use after free on dtor

Found with asan.
This->device was accessed after This was destroyed.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Fix invalid NULL check
Axel Davy [Sat, 10 Apr 2021 21:19:10 +0000 (23:19 +0200)]
st/nine: Fix invalid NULL check

Found with clang warnings.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Add missing breaks
Axel Davy [Sat, 10 Apr 2021 21:18:20 +0000 (23:18 +0200)]
st/nine: Add missing breaks

This makes clang warnings happier.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Fix cubetexture early destruction
Axel Davy [Fri, 12 Mar 2021 12:47:09 +0000 (13:47 +0100)]
st/nine: Fix cubetexture early destruction

When the surface creation fails, the dtor
can face NULL pointers for the surfaces.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Fix crash on texture creation failure
Axel Davy [Fri, 12 Mar 2021 12:16:13 +0000 (13:16 +0100)]
st/nine: Fix crash on texture creation failure

Fixes regression introduced by:
a179ea2e "st/nine: Use the texture memory helper"

The device is used on texture/surface dtor since this commit.
We need to early fill the device field in case of error.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agost/nine: Disable fpu exceptions during init
Axel Davy [Fri, 12 Mar 2021 12:03:01 +0000 (13:03 +0100)]
st/nine: Disable fpu exceptions during init

Prevents a crash in wine tests. The crash
seems to happen in llvmpipe.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

3 years agoci: Update VK-GL-CTS to 1.2.6.0
Juan A. Suarez Romero [Mon, 12 Apr 2021 15:23:06 +0000 (17:23 +0200)]
ci: Update VK-GL-CTS to 1.2.6.0

v2:
 - Bump up MESA_ROOTFS_TAG instead of arm_build (Michel)

Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10136>

3 years agovirgl: Add simple disk cache
Stéphane Marchesin [Tue, 13 Apr 2021 04:26:26 +0000 (06:26 +0200)]
virgl: Add simple disk cache

Since virgl has no backend compilation, this is just a disk cache for the
frontend. As such it is very simple and only implements enough for
get_disk_shader_cache() to work.

With portal2 apitrace:
Before: 100.65 fps
After: 129.051 fps

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

3 years agoradeonsi: avoid querying gpu state if possible
Pierre-Eric Pelloux-Prayer [Mon, 12 Apr 2021 06:28:46 +0000 (08:28 +0200)]
radeonsi: avoid querying gpu state if possible

No-op dispatch should only be setup for full reset, not soft-recovery resets.

The same trick cannot be used in si_get_reset_status because EGL expects
us to return GL_***_CONTEXT_RESET even if it has been fixed by a soft
recovery.

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

3 years agoamdgpu,radeon: add full_reset_only param to ctx_query_reset_status
Pierre-Eric Pelloux-Prayer [Mon, 12 Apr 2021 08:04:02 +0000 (10:04 +0200)]
amdgpu,radeon: add full_reset_only param to ctx_query_reset_status

Using this boolean the caller tells if it wants to ignore resets
fixed by a soft recovery.

When true, amdgpu can skip the call to libdrm if no cs has been
rejected (since only full gpu reset cause cs rejections).

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

3 years agoradeonsi: re-create the aux context in si_create_context
Pierre-Eric Pelloux-Prayer [Mon, 12 Apr 2021 06:03:41 +0000 (08:03 +0200)]
radeonsi: re-create the aux context in si_create_context

If a GPU reset occurs, all contexts need to be recreated.
So instead of re-creating the aux context during the flush
of a normal context, we build a new one if we detect that
it needs to be updated.

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

3 years agoradeonsi: only recreate the aux_context when soft recovery failed
Pierre-Eric Pelloux-Prayer [Fri, 9 Apr 2021 16:15:23 +0000 (18:15 +0200)]
radeonsi: only recreate the aux_context when soft recovery failed

When a GPU hang is detected in the kernel, it can uses 2 different
mechanism to recovery: a soft recovery or a hard reset.

Soft recovery doesn't lose the vram content so contexts are still
valid. In this case we don't need to recreate the aux context.

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

3 years agoradeonsi: do not recreate the aux context from the aux context
Pierre-Eric Pelloux-Prayer [Fri, 9 Apr 2021 16:13:56 +0000 (18:13 +0200)]
radeonsi: do not recreate the aux context from the aux context

This will cause a deadlock since si_get_reset_status is called
from flush, which is called with aux_context_lock taken.

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

3 years agoradeonsi: use SI_CONTEXT_FLAG_AUX when recreating the aux context
Pierre-Eric Pelloux-Prayer [Fri, 9 Apr 2021 16:12:21 +0000 (18:12 +0200)]
radeonsi: use SI_CONTEXT_FLAG_AUX when recreating the aux context

Fixes: e6a0f243ea1 ("radeonsi: update pipe_screen::num_contexts")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10179>

3 years agoradeonsi: submit cs to failed context instead of skipping them
Pierre-Eric Pelloux-Prayer [Fri, 9 Apr 2021 16:08:44 +0000 (18:08 +0200)]
radeonsi: submit cs to failed context instead of skipping them

Skipping the submission would trigger asserts in debug builds
or cause memory corruption.

Instead the cs is submitted as ususual but the kernel won't submit
it to the hardware (and will return ECANCELED) if the context
is really lost (= not soft-recovered).

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

3 years agoamdgpu,radeon: add needs_reset param to ctx_query_reset_status
Pierre-Eric Pelloux-Prayer [Fri, 9 Apr 2021 16:04:56 +0000 (18:04 +0200)]
amdgpu,radeon: add needs_reset param to ctx_query_reset_status

The kernel can do different types of recovery (soft recovery, GPU reset).

Since they both increase gpu_reset_counter, this will cause all contexts
to report AMDGPU_CTX_QUERY2_FLAGS_RESET, which is a bit misleading: if
a single context was soft-recovered, the others are fine and we don't need
special processing.

This commit uses the AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST to distinguish
between the 2 kind of reset and later commits will use this information.

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

3 years agodriconf: add workarounds for Teardown
Pierre-Eric Pelloux-Prayer [Mon, 12 Apr 2021 09:05:47 +0000 (11:05 +0200)]
driconf: add workarounds for Teardown

Based on the comments from https://gitlab.freedesktop.org/mesa/mesa/-/issues/3714.

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

3 years agogallium/u_threaded: skip refcounting only once
Pierre-Eric Pelloux-Prayer [Mon, 12 Apr 2021 08:56:27 +0000 (10:56 +0200)]
gallium/u_threaded: skip refcounting only once

If info->take_index_buffer_ownership is true we can skip
refcounting but only for the first iteration of the loop.
The next iterations have to use tc_set_resource_reference.

Fixes: 363c1ef0c0e ("gallium/u_threaded: split draws that don't fit in a batch")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10171>

3 years agonir: handle mediump varyings in varying compaction helpers
Marek Olšák [Thu, 11 Feb 2021 22:59:02 +0000 (17:59 -0500)]
nir: handle mediump varyings in varying compaction helpers

Group mediump varyings and don't put 16-bit and 32-bit components
in the same vec4.

... and reply to the comment there.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10224>

3 years agoradeonsi: enable FP16 for mediump on gfx9+ if radeonsi_fp16=true
Marek Olšák [Fri, 4 Sep 2020 17:48:30 +0000 (13:48 -0400)]
radeonsi: enable FP16 for mediump on gfx9+ if radeonsi_fp16=true

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

3 years agoradeonsi: kill 16-bit VS outputs if PS doesn't use them or doing Z-only draw
Marek Olšák [Mon, 29 Mar 2021 11:54:11 +0000 (07:54 -0400)]
radeonsi: kill 16-bit VS outputs if PS doesn't use them or doing Z-only draw

The kill_outputs logic uses our internal IO indices. Just add indices for
16-bit varyings. We don't have enough free indices to use, but we can reuse
the indices that GLES doesn't have. Those are all the legacy desktop GL
varyings.

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

3 years agoradeonsi: optimize and legalize 16-bit samplers
Marek Olšák [Thu, 11 Feb 2021 08:24:57 +0000 (03:24 -0500)]
radeonsi: optimize and legalize 16-bit samplers

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

3 years agoradeonsi: implement 16-bit VS inputs
Marek Olšák [Sun, 14 Feb 2021 11:48:43 +0000 (06:48 -0500)]
radeonsi: implement 16-bit VS inputs

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

3 years agoradeonsi: implement 16-bit VS->PS varyings
Marek Olšák [Wed, 10 Feb 2021 16:08:25 +0000 (11:08 -0500)]
radeonsi: implement 16-bit VS->PS varyings

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

3 years agoac/llvm: implement 16-bit packed VS outputs and FS inputs
Marek Olšák [Wed, 10 Feb 2021 03:06:09 +0000 (22:06 -0500)]
ac/llvm: implement 16-bit packed VS outputs and FS inputs

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

3 years agoglx: Lift sending the MakeCurrent request to top-level code
Adam Jackson [Tue, 14 Nov 2017 20:13:04 +0000 (15:13 -0500)]
glx: Lift sending the MakeCurrent request to top-level code

Somewhat terrifyingly, we never sent this for direct contexts, which
means the server never knew the context/drawable bindings. To handle
this sanely, pull the request code up out of the indirect backend, and
rewrite the context switch path to call it as appropriate.  This
attempts to preserve the existing behavior of not calling unbind() on
the context if its refcount would not drop to zero.

Of course, you can't just do this indiscriminately, because this is GLX
and extant X servers have bugs and everything is terrible. To wit:

- For 1.20.x prior to 1.20.6, you can bind a direct context once, but
the second time you try to modify the context's binding you will get
GLXBadContextTag. This includes unbinding the context. And "deleting"
the context will leak memory, because it will still appear to be
current.

- For 1.19 and earlier, glXMakeCurrent(dpy, None, ctx) should be legal
for GL 3.0+ contexts, but the server will throw BadMatch.

To guard against this, we only send the request for indirect contexts
unless the server is known good, and only mention one context at a time
in such a request; if switching between contexts, we first unbind the
old, and then bind the new. Note that the second VendorRelease() version
is to catch XFree86 4.x and Xorg [67].x, which almost certainly have the
above bugs. Other servers might report different version numbers here,
but we can't do direct rendering against them, so this should be safe.

Fixes: mesa/mesa#4418
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9992>

3 years agoglx: Be more robust against null fbconfigs
Adam Jackson [Mon, 12 Apr 2021 15:33:17 +0000 (11:33 -0400)]
glx: Be more robust against null fbconfigs

These can happen along the internal paths for no-config contexts, and we
shouldn't crash.

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9992>

3 years agoglx: Move {Bind,Release}TexImage from context to screen vtable
Adam Jackson [Fri, 19 Mar 2021 17:39:01 +0000 (13:39 -0400)]
glx: Move {Bind,Release}TexImage from context to screen vtable

All the other operations on drawables live there, be consistent.

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

3 years agoglx: Don't pointlesly add -D_REENTRANT to libGL's cflags
Adam Jackson [Thu, 25 Mar 2021 22:13:46 +0000 (18:13 -0400)]
glx: Don't pointlesly add -D_REENTRANT to libGL's cflags

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

3 years agoglx: Remove some #if 0'd DRI config attribute fetch
Adam Jackson [Wed, 24 Mar 2021 16:15:03 +0000 (12:15 -0400)]
glx: Remove some #if 0'd DRI config attribute fetch

We've never read any of this out. The transparency stuff we've never
implemented and the shift/mask stuff doesn't vary independently enough
to need to match on.

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

3 years agoglx: Clean up fbconfig attribute handling
Adam Jackson [Thu, 25 Mar 2021 17:51:51 +0000 (13:51 -0400)]
glx: Clean up fbconfig attribute handling

Move the macros defining the expected number of attributes into the same
file as their consumer, remove a pointless maximum, and allocate more
space for attribs on the stack to avoid malloc in the common case.
glxext.c knows about 46 config attribs, 46 - 18 = 28, round up to 32 to
future proof a bit.

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

3 years agoglx: Default sRGBCapable in the same place as the other config attribs
Adam Jackson [Thu, 25 Mar 2021 17:41:41 +0000 (13:41 -0400)]
glx: Default sRGBCapable in the same place as the other config attribs

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

3 years agoaux/trace: use ralloc_free for ralloc()ed state pointers
Mike Blumenkrantz [Tue, 13 Apr 2021 22:21:28 +0000 (18:21 -0400)]
aux/trace: use ralloc_free for ralloc()ed state pointers

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

3 years agointel, anv: propagate robustness setting to nir_opt_load_store_vectorize
Iván Briano [Fri, 9 Apr 2021 21:42:53 +0000 (14:42 -0700)]
intel, anv: propagate robustness setting to nir_opt_load_store_vectorize

Closes #4309
Fixes dEQP-VK-robustness.robustness2.*.readonly.*

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10147>

3 years agointel: fix querying mip levels on null surfaces on SKL and prior
Jason Ekstrand [Tue, 6 Apr 2021 22:54:07 +0000 (15:54 -0700)]
intel: fix querying mip levels on null surfaces on SKL and prior

When a surface of type SURFTYPE_NULL is accessed by resinfo, the MIPCount
returned is undefined instead of 0.

Closes #4309
Fixes dEQP-VK.robustness.robustness2.*.sampled_image.*.null_descriptor.*

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10147>

3 years agoglsl: build without bison
Ella-0 [Wed, 27 Jan 2021 14:16:08 +0000 (14:16 +0000)]
glsl: build without bison

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

3 years agodocs: Add some notes on building for macOS
Alyssa Rosenzweig [Sat, 10 Apr 2021 02:14:14 +0000 (07:44 +0530)]
docs: Add some notes on building for macOS

I intend this page to grow as I explore more about Mesa/Darwin.

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

3 years agoaco/cssa: don't create parallelcopies for constants and exec
Daniel Schürmann [Mon, 22 Feb 2021 13:58:37 +0000 (14:58 +0100)]
aco/cssa: don't create parallelcopies for constants and exec

if we are able to spill these directly.

Totals from 4913 (3.60% of 136546) affected shaders (Raven):
SpillSGPRs: 16021 -> 15451 (-3.56%); split: -3.87%, +0.31%
CodeSize: 58102020 -> 57371464 (-1.26%); split: -1.26%, +0.00%
Instrs: 11411454 -> 11230105 (-1.59%); split: -1.59%, +0.00%
Latency: 555706331 -> 550058635 (-1.02%); split: -1.07%, +0.05%
InvThroughput: 273023354 -> 271854469 (-0.43%); split: -0.44%, +0.01%
SClause: 385168 -> 385371 (+0.05%); split: -0.01%, +0.06%
Copies: 1342084 -> 1175762 (-12.39%); split: -12.40%, +0.01%
Branches: 392619 -> 378662 (-3.55%); split: -3.56%, +0.00%

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>

3 years agoaco/cssa: rewrite lower_to_cssa pass
Daniel Schürmann [Thu, 18 Feb 2021 20:07:08 +0000 (21:07 +0100)]
aco/cssa: rewrite lower_to_cssa pass

The previous pass was based on misconceptions and
rounded up with bug fixes. The new pass is entirely
rewritten and basically just one-to-one from the paper:
 "Revisiting Out-of-SSA Translation for Correctness, CodeQuality, and Efficiency"
 by B. Boissinot et al.
It also incorporates the value-equality testing.

The regressions are mainly due to creating parallelcopies for
exec phis at loop headers (mitigated in the next commit).

Totals from 4933 (3.61% of 136546) affected shaders (Raven):
SpillSGPRs: 16249 -> 16527 (+1.71%); split: -0.28%, +1.99%
SpillVGPRs: 1771 -> 1595 (-9.94%)
CodeSize: 57544436 -> 58280304 (+1.28%); split: -0.00%, +1.28%
Scratch: 176128 -> 179200 (+1.74%)
Instrs: 11265783 -> 11445884 (+1.60%); split: -0.00%, +1.60%
Latency: 552596156 -> 555880540 (+0.59%); split: -0.53%, +1.13%
InvThroughput: 271431862 -> 273097423 (+0.61%); split: -0.18%, +0.79%
VClause: 160240 -> 160241 (+0.00%); split: -0.02%, +0.02%
SClause: 386863 -> 386685 (-0.05%); split: -0.07%, +0.02%
Copies: 1180801 -> 1345633 (+13.96%); split: -0.02%, +13.98%
Branches: 379129 -> 393052 (+3.67%); split: -0.01%, +3.69%

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>

3 years agoaco: add new reindex_ssa() pass
Daniel Schürmann [Thu, 4 Mar 2021 15:46:54 +0000 (16:46 +0100)]
aco: add new reindex_ssa() pass

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>

3 years agoaco: fix kill flags on phi operands
Daniel Schürmann [Thu, 4 Mar 2021 15:31:22 +0000 (16:31 +0100)]
aco: fix kill flags on phi operands

Fossil-db changes are likely due to how the CSSA pass works.
Totals from 1782 (1.31% of 136546) affected shaders (Raven):
CodeSize: 25333292 -> 25294020 (-0.16%); split: -0.16%, +0.00%
Instrs: 4916059 -> 4908218 (-0.16%); split: -0.16%, +0.00%
Latency: 282860167 -> 282707176 (-0.05%); split: -0.08%, +0.03%
InvThroughput: 136487564 -> 136394958 (-0.07%); split: -0.12%, +0.05%
VClause: 74791 -> 74795 (+0.01%)
Copies: 542115 -> 534280 (-1.45%); split: -1.48%, +0.04%
Branches: 168977 -> 168966 (-0.01%); split: -0.01%, +0.01%

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>

3 years agoaco: lower p_spill with constants correctly
Daniel Schürmann [Mon, 22 Feb 2021 13:55:45 +0000 (14:55 +0100)]
aco: lower p_spill with constants correctly

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>

3 years agoaco/spill: use correct next_use_distances at loop header
Daniel Schürmann [Fri, 26 Mar 2021 13:12:43 +0000 (13:12 +0000)]
aco/spill: use correct next_use_distances at loop header

To decide which variables to spill, we must use the distances at the
beginning of the loop-header, and not the distances at the end of the
loop-preheader. The difference are that the former includes phis which are
viable to be spilled as opposed to the phi operands which would be reloaded
by add_coupling_code(), ending up in potentially too high register pressure
before the loop.

Totals from 206 (0.15% of 136546) affected shaders (Raven):
SpillSGPRs: 5154 -> 5000 (-2.99%)
CodeSize: 3654072 -> 3647184 (-0.19%); split: -0.19%, +0.00%
Instrs: 701482 -> 700526 (-0.14%); split: -0.14%, +0.00%
Latency: 40988780 -> 40872506 (-0.28%); split: -0.29%, +0.00%
InvThroughput: 20364560 -> 20306006 (-0.29%)
SClause: 20192 -> 20198 (+0.03%)
Copies: 77732 -> 77688 (-0.06%); split: -0.08%, +0.03%
Branches: 24204 -> 24050 (-0.64%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>

3 years agoaco/spill: refactor live-in registerDemand calculation
Daniel Schürmann [Mon, 22 Feb 2021 17:02:24 +0000 (18:02 +0100)]
aco/spill: refactor live-in registerDemand calculation

This also fixes some hypothetical issue for loops without phis
and for loops with higher register pressure at the end of the
loop preheader.

No fossil-db changes.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>

3 years agoaco/spill: refactor some more spill decision taking
Daniel Schürmann [Mon, 22 Feb 2021 14:58:46 +0000 (15:58 +0100)]
aco/spill: refactor some more spill decision taking

No fossil-db changes.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>

3 years agoaco/spill: don't count phis as variable access
Daniel Schürmann [Mon, 22 Feb 2021 13:57:28 +0000 (14:57 +0100)]
aco/spill: don't count phis as variable access

This increases the chance of evicting phis
if these have longer next-use distances.

Totals from 6 (0.00% of 146267) affected shaders (Navi10):
CodeSize: 476992 -> 464388 (-2.64%)
Instrs: 81785 -> 79952 (-2.24%)
VClause: 2380 -> 2374 (-0.25%)
Copies: 26836 -> 25131 (-6.35%)
Branches: 2494 -> 2492 (-0.08%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>

3 years agoaco/spill: spill phi constants and exec directly to VGPR
Daniel Schürmann [Mon, 22 Feb 2021 13:06:05 +0000 (14:06 +0100)]
aco/spill: spill phi constants and exec directly to VGPR

This lets us avoid some CSSA copies.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>

3 years agoaco/spill: reload spilled exec masks directly to exec
Daniel Schürmann [Mon, 22 Feb 2021 10:00:22 +0000 (11:00 +0100)]
aco/spill: reload spilled exec masks directly to exec

This handles the case of
   exec = p_linear_phi %a, %b
where %a or %b might have been spilled.
By directly reloading these variables into the exec mask register,
we can avoid additional CSSA parallelcopies.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>

3 years agoaco/spill: refactor spill decision taking
Daniel Schürmann [Wed, 17 Feb 2021 17:29:48 +0000 (18:29 +0100)]
aco/spill: refactor spill decision taking

No fossil-db changes.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>