Commit Graph

817 Commits

Author SHA1 Message Date
Bas Nieuwenhuizen a22a4162d9 radv: Add support for setting a dynamic stack size.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12592>
2021-09-21 01:53:39 +00:00
Bas Nieuwenhuizen f5362742b9 radv: Add RT cache flushes.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12592>
2021-09-21 01:53:39 +00:00
Bas Nieuwenhuizen 1ca4fd31e6 radv: Add support for ray launch size.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12592>
2021-09-21 01:53:39 +00:00
Bas Nieuwenhuizen b6be96a2bd radv: Modify load_sbt_amd intrinsic to get the descriptor.
That way we can get the address to the entry, which is needed for
some nir builtins because extra data in the entry can be used as
shader input.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12592>
2021-09-21 01:53:39 +00:00
Samuel Pitoiset 966b780992 radv: rename radv_decompress_depth_stencil()
To radv_expand_depth_stencil() for consistency.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12452>
2021-09-20 15:17:42 +00:00
Samuel Pitoiset 1402c17e4f radv: optimize VRS when no depth stencil attachment is bound
This is allowed by the Vulkan spec and we have to handle this situation
internally. We used to create and bind a 4096x4096 image to copy the
VRS rates but this wasted too much VRAM (~33MiB). Now, the driver only
allocates a HTILE buffer (~1MiB) and bind it to the framebuffer.

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/12243>
2021-09-02 19:39:04 +00:00
Samuel Pitoiset ab635b024b radv: pass the HTILE buffer to radv_copy_vrs_htile()
Will be used to use a global HTILE buffer without an image.

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/12243>
2021-09-02 19:39:04 +00:00
Samuel Pitoiset ad60354a92 radv: optimize copying VRS rates to the global HTILE buffer
By skipping the read operation which is 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/12243>
2021-09-02 19:39:04 +00:00
Samuel Pitoiset df688e6941 radv: do not load/store the clear value for comp-to-single images
Images that are fast cleared with the comp-to-single mode clears DCC
to 0x10 which tells the hardware to get the clear value from the
main surface instead of the reg.

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/12565>
2021-08-30 07:18:19 +00:00
Samuel Pitoiset 80e5e059fa radv: fix pre-computing viewport xform when setting new viewports
viewportCount is the number of viewports in pViewports while
firstViewport is the index.

Fixes new CTS dEQP-VK.draw.depth_clamp.*_clamp_four_viewports

Fixes: a2ef92d7a5 ("radv: pre-calculate viewport transforms")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12353>
2021-08-17 08:20:02 +02:00
Samuel Pitoiset 7ae3881a4b radv: flush caches before performing separate depth/stencil aspect init
It's a RMW operation, also note that DB doesn't use L2 on GFX6-8.

Fixes test_clear_depth_stencil_view() and test_discard_resource() tests
from vkd3d-proton.

Cc: 21.2 mesa-stable
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/12223>
2021-08-09 16:35:41 +00:00
Bas Nieuwenhuizen 02b6015945 radv: Allocate space for inline push constants.
In the compute dispatch path we do not allocate a huge amount
of space to cover everything so the individual functions have to
allocate. This was missing here, causing a hang in Cyberpunk when
accessing the system menu at some locations with thread tracing
enabled.

Fixes: bd1186572f ("radv: add support for push constants inlining when possible")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12271>
2021-08-09 14:26:21 +00:00
Samuel Pitoiset 1db36422b9 radv: fix initializing the DS clear metadata value for separate aspects
We shouldn't overwrite the clear value of the other aspect (in case
separate depth/stencil layouts are used).

Found by inspection.

Cc: 21.2 mesa-stable
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/12222>
2021-08-09 10:41:39 +00:00
Timur Kristóf 74181ffcc5 radv: Write RSRC2_GS for NGGC when pipeline is dirty but not emitted.
The radv_emit_ngg_culling_state function won't write the
SPI_SHADER_PGM_RSRC2_GS register when it knows in advance that
radv_emit_graphics_pipeline will overwrite it anyway.

However, there is an unhandled case:

radv_emit_graphics_pipeline will not emit anything (including this
register) when the pipeline is already emitted. Hence, improve
the check in radv_emit_ngg_culling_state to consider this.

Fixes: 9a95f5487f
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12237>
2021-08-06 12:18:37 +02:00
Timur Kristóf 61eb3debcf radv: Don't toggle PC oversubscription for NGG culling.
We are going to add this directly to the pipeline.
If a pipeline has such a shader, NGG culling is turned on
most of the time, so it's not useful to toggle this setting.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11905>
2021-08-04 15:37:05 +00:00
Samuel Pitoiset 87b0962fef radv: do not use radeon_set_context_reg_seq() for only one register
radeon_set_context_reg() is a shortcut for that.

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/12099>
2021-07-30 17:05:38 +02:00
Samuel Pitoiset f693b94d2f radv: reduce number of emitted DWORDS for contiguous context registers
radeon_set_context_reg() emits 3 DWORDS, while
radeon_set_context_reg_seq() + 2 values only needs 4 DWORDS.

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/12099>
2021-07-30 17:05:35 +02:00
Timur Kristóf 6e17931d21 radv: Use pre-computed viewport transform for NGG culling state.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11839>
2021-07-16 15:22:46 +00:00
Mike Blumenkrantz c9a478f1cd radv: remove unused variable from radv_emit_viewport
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11839>
2021-07-16 15:22:46 +00:00
Mike Blumenkrantz a2ef92d7a5 radv: pre-calculate viewport transforms
this requires more storage in the viewport struct, but it avoids
the need to repeatedly calculate the same transform if e.g., a meta
operation occurs, which can save about 5% cpu in some cases

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11839>
2021-07-16 15:22:46 +00:00
Mike Blumenkrantz 1e13cb1965 radv: merge si_write_viewport into radv_emit_viewport
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11839>
2021-07-16 15:22:46 +00:00
Timur Kristóf d07e5bde75 radv: Remove num_viewports from radv_skip_ngg_culling.
NGG culling is not compiled into shaders that can use multiple
viewports, so it's not necessary to check it here.

Fixes: 9a95f5487f
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11910>
2021-07-16 13:00:36 +00:00
Samuel Pitoiset 7a1cc56e40 radv: fix bounds checking for zero vertex stride on GFX6-7
GFX6 and GFX10+ have similar logic.

This fixes test_zero_vertex_stride from vkd3d-proton on
Pitcairn (GFX6) and on Bonaire (GFX7).

Cc: 21.2 mesa-stable
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/11904>
2021-07-16 08:30:07 +02:00
Samuel Pitoiset 1ea156f44c radv: only init the TC-compat ZRANGE metadata for the depth aspect
With separate depth/stencil layouts, if the depth aspect is first
initialized and then cleared, the ZRANGE_PRECISION metadata might
be different than 0. Initializing it again for the stencil aspect
will overwrite the value.

Fixes rendering glitches with Scarlet Nexus on GFX8-9.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5052
Cc: 21.1 21.2 mesa-stable
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/11883>
2021-07-15 07:21:50 +00:00
Timur Kristóf 9a95f5487f radv: New shader args for NGG culling settings and viewport.
Add new shader arguments in RADV for:
- NGG culling settings
- Viewport transform

These will be used by NGG culling shaders.

Additionally, some tweaks are made to some config registers
in order to make culling shaders more efficient.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10525>
2021-07-13 23:56:33 +00:00
Samuel Pitoiset 29f264f258 ac,radv: implement the cs_regalloc_hang HW bug workaround
Might fix spurious failures on GFX6 and some GFX7 chips.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11675>
2021-07-09 13:37:37 +00:00
Mike Blumenkrantz a4713ddb56 radv: implement VK_EXT_multi_draw
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11532>
2021-07-06 13:16:56 +00:00
Mike Blumenkrantz ba30adce07 radv: add a gfx10 bug workaround for NOT_EOP
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11532>
2021-07-06 13:16:56 +00:00
Mike Blumenkrantz d9132fcb50 radv: split indexed draw cases based on whether drawid is used
fewer conditionals in the draw loop = less overhead

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11532>
2021-07-06 13:16:56 +00:00
Mike Blumenkrantz 5aaf45f5e1 radv: determine if hardware can emit NOT_EOP before emitting
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11532>
2021-07-06 13:16:56 +00:00
Mike Blumenkrantz d28329ed02 radv: emit drawid for multidraws
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11532>
2021-07-06 13:16:56 +00:00
Mike Blumenkrantz 00206b1664 radv: emit NOT_EOP for multi indexed draws
this is never emitted currently because drawCount is always 1

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11532>
2021-07-06 13:16:56 +00:00
Mike Blumenkrantz 72e75092a9 radv: use multidraw iteration for direct draws
there's still no arrays of draw info being passed, but this takes care of
all the work for it

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11532>
2021-07-06 13:16:56 +00:00
Rhys Perry 307a4bf4ab radv: use null vertex descriptor if num_records=0
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11642>
2021-07-06 13:00:35 +00:00
Rhys Perry a2ac660eb7 radv: adjust num_records when offset>stride
If an attribute's offset is larger than the stride, the compiler will
increase the vertex index and use offset%stride instead as the offset.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5007
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11642>
2021-07-06 13:00:35 +00:00
Rhys Perry e4fbb200fc radv: don't ever convert num_records to bytes if it's zero
If num_records==0, this conversion doesn't work. We should just keep it at
zero.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5007
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11642>
2021-07-06 13:00:35 +00:00
Bas Nieuwenhuizen f9cc94af7b radv/winsys: Add support for a fixed VA address for replay.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10570>
2021-07-05 17:27:51 +00:00
Bas Nieuwenhuizen 8025b4120f radv/winsys: Return vulkan errors for buffer creation.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10570>
2021-07-05 17:27:51 +00:00
Samuel Pitoiset 9a95aba377 radv: implement VK_EXT_color_write_enable
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/11530>
2021-07-02 10:02:02 +00:00
Mike Blumenkrantz c0397a42ce radv: pre-calc vertex buffer descriptor size on pipeline object
util_bitcount has a nonzero cost, and calling it like this in a hotpath
generates unnecessary overhead

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11525>
2021-06-30 13:42:42 +00:00
Samuel Pitoiset 8efa897168 radv: implement dynamic logic op
This is part of VK_EXT_extended_dynamic_state2.

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/10880>
2021-06-22 15:32:31 +00:00
Samuel Pitoiset 977355c6e5 radv: fix dynamic culling and depth/stencil related dynamic states
To avoid overwriting previous dynamic state with default state from
the pipeline.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4926
Cc: 21.1 mesa-stable
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/11375>
2021-06-18 16:27:57 +00:00
Mike Blumenkrantz 651c6b16ff radv: move pipe_misaligned and l2_coherent image checks to flags set on init
this should save 4-5% cpu in some cases

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11462>
2021-06-18 16:02:26 +00:00
Bas Nieuwenhuizen f7c622307d radv: Don't skip barriers that only change queues.
We depend on the queue mask for some decisions ...

CC: mesa-stable
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10802>
2021-06-14 11:20:59 +00:00
Samuel Pitoiset a234840e60 radv: do not launch an IB2 for secondary cmdbuf with INDIRECT_MULTI on GFX7
It's illegal to emit DRAW_{INDEX}_INDIRECT_MULTI from an IB2 on GFX7.

PAL applies this workaround for indirect dispatches and also on
GFX8-9 but it doesn't seem needed.

This fixes various GPU hangs on Bonaire (GFX7).

Cc: 21.1 mesa-stable
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/11214>
2021-06-10 08:31:08 +02:00
Mike Blumenkrantz 79742d41c0 radv: declare index_va in a single call for indexed draw packet emit
this is an extreme hotpath, so having a single calculation in a const
variable is slightly better for compiler microoptimizing

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11124>
2021-06-02 13:31:43 +00:00
Rhys Perry 0f8fef1261 radv: make attrib_end variable in radv_flush_vertex_descriptors 32-bit
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: 1e9dc0474e ("radv: make radv_pipeline::attrib_ends 32bit")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11089>
2021-05-31 18:28:12 +00:00
Samuel Pitoiset 69ae02151d radv: remove DFSM
DFSM has never been enabled by default because it was slower.
RadeonSI is also dropping support for this because they discovered
that's actually not efficient in practice.

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/10968>
2021-05-26 17:22:14 +00:00
Samuel Pitoiset 9984ebf173 radv: use radv_dcc_enabled() for the FB mip flush workaround
This has no effects because radv_image_has_CB_metadata() still
accounts for DCC which is incorrect. This should be changed.

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/10667>
2021-05-26 06:59:35 +00:00
Samuel Pitoiset ff38e3aadd radv: only mark DCC as compressed when drawing if layout allows it
Just having DCC enabled on the base level doesn't mean we are
using compressed rendering.

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/10667>
2021-05-26 06:59:35 +00:00