Commit Graph

138133 Commits

Author SHA1 Message Date
Axel Davy c5f75bc200 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>
2021-04-14 08:33:14 +00:00
Axel Davy 26a42f1053 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>
2021-04-14 08:33:14 +00:00
Axel Davy 5702b15cd9 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>
2021-04-14 08:33:14 +00:00
Axel Davy 7ac9c9c667 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>
2021-04-14 08:33:14 +00:00
Axel Davy 25d203a116 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>
2021-04-14 08:33:14 +00:00
Axel Davy 805cedd207 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>
2021-04-14 08:33:14 +00:00
Axel Davy 1797a6eb04 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>
2021-04-14 08:33:14 +00:00
Axel Davy 4953d19518 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>
2021-04-14 08:33:14 +00:00
Axel Davy 8c72f7506e 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>
2021-04-14 08:33:14 +00:00
Axel Davy 006338f702 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>
2021-04-14 08:33:14 +00:00
Axel Davy ee580c96ef 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>
2021-04-14 08:33:14 +00:00
Axel Davy a1bb1b9b07 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>
2021-04-14 08:33:13 +00:00
Axel Davy e0caa05d42 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>
2021-04-14 08:33:13 +00:00
Axel Davy a0288fa3b7 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>
2021-04-14 08:33:13 +00:00
Axel Davy 9e9644666e 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>
2021-04-14 08:33:13 +00:00
Axel Davy a849923aea 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>
2021-04-14 08:33:13 +00:00
Axel Davy 619c53489f 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>
2021-04-14 08:33:13 +00:00
Axel Davy 787b03d5f6 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>
2021-04-14 08:33:13 +00:00
Axel Davy 138615a094 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>
2021-04-14 08:33:13 +00:00
Axel Davy 70f8d78aa7 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>
2021-04-14 08:33:13 +00:00
Axel Davy de66d503f7 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>
2021-04-14 08:33:13 +00:00
Axel Davy 1272640d55 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>
2021-04-14 08:33:13 +00:00
Axel Davy d03f401fda 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>
2021-04-14 08:33:13 +00:00
Axel Davy 17dc334b81 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>
2021-04-14 08:33:13 +00:00
Axel Davy 586cede4b6 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>
2021-04-14 08:33:13 +00:00
Axel Davy f5a1f3c98d 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>
2021-04-14 08:33:13 +00:00
Axel Davy a6cce52908 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>
2021-04-14 08:33:13 +00:00
Axel Davy 68024fc0cc 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>
2021-04-14 08:33:13 +00:00
Axel Davy 2146494d08 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>
2021-04-14 08:33:13 +00:00
Axel Davy 8df04b1b2d 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>
2021-04-14 08:33:13 +00:00
Axel Davy a5f2084c1b 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>
2021-04-14 08:33:13 +00:00
Axel Davy 29cc19e54f 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>
2021-04-14 08:33:13 +00:00
Axel Davy 204bc8981f 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>
2021-04-14 08:33:13 +00:00
Axel Davy d9e79bfe4f 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>
2021-04-14 08:33:13 +00:00
Juan A. Suarez Romero 9e5762c387 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>
2021-04-14 08:06:55 +00:00
Stéphane Marchesin d6db4d2e08 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>
2021-04-14 07:37:34 +00:00
Pierre-Eric Pelloux-Prayer a86450e00a 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>
2021-04-14 07:00:00 +00:00
Pierre-Eric Pelloux-Prayer 8fd912b9ae 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>
2021-04-14 07:00:00 +00:00
Pierre-Eric Pelloux-Prayer 93183480fc 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>
2021-04-14 07:00:00 +00:00
Pierre-Eric Pelloux-Prayer 6938aa7534 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>
2021-04-14 07:00:00 +00:00
Pierre-Eric Pelloux-Prayer 5c3931fbc5 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>
2021-04-14 07:00:00 +00:00
Pierre-Eric Pelloux-Prayer 3d5c4db23e radeonsi: use SI_CONTEXT_FLAG_AUX when recreating the aux context
Fixes: e6a0f243ea ("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>
2021-04-14 07:00:00 +00:00
Pierre-Eric Pelloux-Prayer 646c5db06f 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>
2021-04-14 07:00:00 +00:00
Pierre-Eric Pelloux-Prayer bc71f689f1 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>
2021-04-14 07:00:00 +00:00
Pierre-Eric Pelloux-Prayer 3a56f06998 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>
2021-04-14 06:35:30 +00:00
Pierre-Eric Pelloux-Prayer 15e24850b7 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: 363c1ef0c0 ("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>
2021-04-14 07:50:20 +02:00
Marek Olšák 165a69d2f7 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>
2021-04-14 01:42:49 +00:00
Marek Olšák 30ab38ba6d 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>
2021-04-13 21:10:43 -04:00
Marek Olšák c53f25b668 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>
2021-04-13 21:10:43 -04:00
Marek Olšák 5efdf4afac 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>
2021-04-13 21:10:43 -04:00