Commit Graph

188493 Commits

Author SHA1 Message Date
Alejandro Piñeiro
b6e473cd58 v3dv: move depth CFG bits setting to cmd buffer emission
As it depends on values that could be dynamic now. Technically we
could try to keep pre-emitting, just in case that info is provided
statically.

But for the dynamic case, we would still need to compute that bits,
and we would need to discard all the pre-emitted CFG set, and
recompute it completely (as right now cl_emit_with_prepacked doesn't
allow to override values).

It is also gets a simpler code by setting those flags in only one
codepath.

As we are here, we also move z_updates_enable from the pipeline to the
cmd_buffer. This values doesn't require a complex compute, so it is
easier to just keep it on one place.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27609>
2024-04-26 12:34:44 +00:00
Alejandro Piñeiro
9fa023f111 v3dv: DepthBoundsTestEnable is dynamic now
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27609>
2024-04-26 12:34:44 +00:00
Alejandro Piñeiro
29c8aca881 v3dv: CullMode and FrontFace are dynamic now
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27609>
2024-04-26 12:34:44 +00:00
Alejandro Piñeiro
e3061e6281 v3dv: provide implementation for CmdSetViewportWithCount
As with CmdSetViewport, we need to provide a custom implementation
because we want to call and save the outcome of viewport_compute_xform
when the viewport is set, not during emission.

We can just call v3dv_CmdSetViewport, as that one is already calling
vk_common_SetViewportWithCount.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27609>
2024-04-26 12:34:44 +00:00
Alejandro Piñeiro
f4d426fae6 v3dv: provide implementation for vkCmdBindVertexBuffers2
Mostly equal to vkCmdBindVertexBuffers, but adding strides, that with
VK_EXT_extended_dynamic_state become dynamic, and setting pSizes.

It is worth to note that at this moment we don't use
CmdBindVertexBuffers2 pSizes.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27609>
2024-04-26 12:34:44 +00:00
Alejandro Piñeiro
f2236065b7 v3dv: port dynamic state tracking to use Mesa Vulkan
Specifically to use the common vk_dynamic_graphics_state.

The advantage of using the common struct is not only reducing the size
of our custom one, but also using common helpers (like all those cmd
buffer setters), and a lot of the logic that in the future will be
used for other extensions.

Some notes:

 * We still keep dirty flags, for things like PIPELINE,
   DESCRIPTOR_SETS, etc. Other driver do the same. FWIW, this is also
   an improvement, as before we were mixing those with the per-spec
   Vulkan dynamic info.

 * For the port viewport/scissor we still keep some data on a custom
   structure, as we cache the translate/scale info that is derived
   from scissor/viewport, but used in three different places.

   For that we also maintain a custom implementation of
   CmdSetViewport, that computes translate/scale, and call the common
   implementation.

 * We make the same for color_write_enables. The vulkan runtime saves
   it as a 8-bit bitset, with a bit per attachment. But when combining
   with color_write_mask you need a 32bit with 4 bits set per
   attachment. To avoid recompute it during emission, we also cache
   the color_write_enables, using the runtime just to track the dirty
   status.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27609>
2024-04-26 12:34:44 +00:00
Karmjit Mahil
858154b84e ir3: Don't set saturation on flat.b
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10999

Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Reviewed-by: Job Noorman <jnoorman@igalia.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28935>
2024-04-26 11:39:26 +00:00
Erik Faye-Lund
3b3df7b8a9 panvk: avoid dereferencing a null-pointer
If we're passed a memory-info, but no memory-prop, we'd end up
dereferencing a null-pointer here. Let's use a fallback struct instead,
similar to what RADV does.

Fixes: d970fe2e9d ("panfrost: Add a Vulkan driver for Midgard/Bifrost GPUs")
CID: 1496060
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28856>
2024-04-26 11:18:18 +00:00
Erik Faye-Lund
8456588b1f panvk: drop needless null-checks
iview can't be null here, so let's drop these checks.

CID: 1596487
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28856>
2024-04-26 11:18:18 +00:00
Erik Faye-Lund
5df20cac22 panvk: do not leak bindings
There were nothing here cleaning this up.

CID: 1596490
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28856>
2024-04-26 11:18:17 +00:00
Erik Faye-Lund
8fd171b02d panvk: drop needless null-check
This argument is never null, and we already dereference it earlier.
Let's remove the needless check here.

CID: 1503115
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28856>
2024-04-26 11:18:17 +00:00
Erik Faye-Lund
9058d5ff62 panfrost: correct first-tracking for signature
If we unconditionally assign false to first *before* we use it, it's
never true when used. Instead, let's assign it *both* at the end *and*
when continuing.

Fixes: 4da88060d0 ("panfrost: Skip blit shader labelling if the buffer has no space")
CID: 1476270
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28856>
2024-04-26 11:18:17 +00:00
Erik Faye-Lund
f852f86a31 panfrost: check return-code of drmSyncobjWait
Realistically, this isn't going to fail. But let's return an error here
in case it does, just for good measure.

CID: 1558596
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28856>
2024-04-26 11:18:17 +00:00
Erik Faye-Lund
70dcdb3130 panfrost: assert that drmSyncobjWait returns 0
This is really just a small band-aid, and instead we should start
reporting errors from this function. But for now, let's just assert that
no error occurrecd, as that's slightly better than ignoring it.

CID: 1592892
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28856>
2024-04-26 11:18:17 +00:00
Erik Faye-Lund
f59e5ee5fb panfrost: check return-value from u_trim_pipe_prim
This is slightly cleaner than what we currently do. It shouldn't matter
in difference, though.

CID: 1515978
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28856>
2024-04-26 11:18:17 +00:00
Erik Faye-Lund
8deaf37047 panfrost: do not deref potentially null pointer
We need to check for failure to import *before* we dereference here.

Fixes: f94889d079 ("panfrost: Make pan_texture.{c,h} panfrost_bo agnostic")
CID: 1587376
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28856>
2024-04-26 11:18:17 +00:00
Boris Brezillon
186f7fa915 panfrost: do not write outside num_wg_sysval
This array has 3 components, because it's meant to hold the X, Y and Z
components of the work-group size sysval. However, mir_pick_ubo assumes
vec4 for the push-uniforms, which ends up promoting this to 4
components.

So let's make sure we don't write that last component. It's not going to
do anything good.

In practice, this leads to the viewport descriptor being smashed, which
doesn't actually do any real-world harm, because this only happens in
compute batches where that descriptor is unused. However, writing
outside of arrays is undefined behavior, so we should fix it regardless.

Fixes: 5006167061 ("panfrost: Hook-up indirect dispatch support")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28856>
2024-04-26 11:18:17 +00:00
Erik Faye-Lund
39f919707a panfrost: remove nonsensical assert
This checks against all valid targets, which is kinda confusing to read.
Let's just drop this.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28856>
2024-04-26 11:18:17 +00:00
Eric Engestrom
71fd7836f6 spirv: deduplicate default debug log level
`level` is already set to WARNING by default, so return it normally
instead of hard-coding WARNING again in the other code path.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28799>
2024-04-26 10:38:12 +00:00
Eric Engestrom
378bed6fa6 v3dv/ci: skip all the WSI tests, they are way too flaky to be worth it
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28934>
2024-04-26 10:16:11 +00:00
Eric Engestrom
1dadf950c3 rpi3/ci: drop duplicate comment without any corresponding actual skip line
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28934>
2024-04-26 10:16:11 +00:00
Alejandro Piñeiro
42183a9f2b v3dv/ci: dEQP-VK.dynamic_state.*.double_static_bind are fixed now
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28897>
2024-04-26 09:52:09 +00:00
Alejandro Piñeiro
e14f5252fa v3dv/cmd_buffer: always bind pipeline static state
Even if the pipeline is the same.

The followin sequence, used on
dEQP-VK.dynamic_state.*.double_static_bind tests, is valid:

   1. Bind pipeline with some static state.
   2. Set state command for that static state (to a bad value).
   3. Bind the same pipeline again.
   4. Draw.

So on 3 we need to ensure to load again the pipeline static state.

Fixes: dEQP-VK.dynamic_state.*.double_static_bind

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28897>
2024-04-26 09:52:09 +00:00
David Rosca
1f07f5a79b radv/video: Report maxBitrate in encode capabilities
Some cards can do higher bitrate, but 1000 Mbit/s should be high enough
for any practical use. It's also the value that AMF reports as max bitrate.

Fixes: 54d499818c ("radv/video: add initial support for encoding with h264.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28736>
2024-04-26 09:18:29 +00:00
David Rosca
c210bb7952 radv/video: Check encode profiles and bit depth in capabilities query
Fixes: 967e4e09de ("radv/video: add h265 encode support")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28736>
2024-04-26 09:18:29 +00:00
David Rosca
2d0282f576 radv/video: Set correct bit depth and format for 10bit input
Fixes: 967e4e09de ("radv/video: add h265 encode support")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11011
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28736>
2024-04-26 09:18:29 +00:00
Rhys Perry
ae866966e6 aco/tests: add tests for divergent merge phi with undef
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28661>
2024-04-26 08:39:01 +00:00
Rhys Perry
0f61e0c27e aco/tests: add tests for hidden breaks/continues
ACO might add breaks/continues which didn't exist in the NIR.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28661>
2024-04-26 08:39:01 +00:00
Daniel Schürmann
6b3e14ba83 aco/optimizer: remove p_linear_phi handling from optimizer
We remove trivial phis during value numbering, now.
And the undef optimization seems to have no positive effect.

Totals from 22 (0.03% of 79206) affected shaders: (GFX10.3)

Instrs: 168529 -> 168260 (-0.16%)
CodeSize: 912692 -> 911704 (-0.11%)
Latency: 2607549 -> 2607335 (-0.01%)
InvThroughput: 1124171 -> 1124109 (-0.01%)
SClause: 5694 -> 5698 (+0.07%)
Copies: 23503 -> 23364 (-0.59%)
Branches: 8185 -> 8058 (-1.55%)
PreSGPRs: 1536 -> 1531 (-0.33%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28661>
2024-04-26 08:39:01 +00:00
Daniel Schürmann
2d0c6647f0 aco: use SGPR phi lowering for all scalar phis
No fossil-db changes.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28661>
2024-04-26 08:39:01 +00:00
Daniel Schürmann
6ec6899bff aco: use SGPR phi lowering for all loop header phis
No fossil-db changes.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28661>
2024-04-26 08:39:01 +00:00
Daniel Schürmann
7c01193299 aco: use SGPR phi lowering for uniform phis in divergent merge blocks
The fossil changes are due to a slightly different register allocation
from a reversed order of phi instructions.

Totals from 1620 (2.04% of 79395) affected shaders: (GFX10.3)

Instrs: 730683 -> 732621 (+0.27%); split: -0.02%, +0.28%
CodeSize: 3888464 -> 3898488 (+0.26%); split: -0.00%, +0.26%
Latency: 3274291 -> 3275549 (+0.04%); split: -0.02%, +0.06%
InvThroughput: 606625 -> 606661 (+0.01%); split: -0.00%, +0.01%
VClause: 9541 -> 9538 (-0.03%)
SClause: 17296 -> 17272 (-0.14%); split: -0.16%, +0.02%
Copies: 81392 -> 83231 (+2.26%); split: -0.17%, +2.43%
Branches: 27023 -> 27020 (-0.01%); split: -0.03%, +0.02%
VALU: 383380 -> 382749 (-0.16%)
SALU: 160895 -> 163369 (+1.54%); split: -0.03%, +1.57%
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28661>
2024-04-26 08:39:01 +00:00
Daniel Schürmann
9ab5e7fe5d aco/lower_phis: implement SGPR phi lowering
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28661>
2024-04-26 08:39:01 +00:00
Daniel Schürmann
f2d32e1c13 aco/lower_phis: generalize init_state() so that it works with any scalar phis
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28661>
2024-04-26 08:39:01 +00:00
Daniel Schürmann
55130069b8 aco/vn: copy-propagate trivial phis
Totals from 154 (0.19% of 79395) affected shaders: (GFX11)

Instrs: 102420 -> 101702 (-0.70%); split: -0.71%, +0.01%
CodeSize: 534060 -> 530620 (-0.64%); split: -0.65%, +0.01%
Latency: 560180 -> 559723 (-0.08%); split: -0.10%, +0.01%
InvThroughput: 62769 -> 61708 (-1.69%); split: -1.72%, +0.03%
Copies: 6929 -> 6260 (-9.66%); split: -9.68%, +0.03%
Branches: 1636 -> 1609 (-1.65%)
PreVGPRs: 5913 -> 5906 (-0.12%)
VALU: 52681 -> 52012 (-1.27%); split: -1.27%, +0.00%
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28661>
2024-04-26 08:39:01 +00:00
Daniel Schürmann
6e3446422f aco: introduce aco_opcode::p_boolean_phi
This opcode is only used during instruction selection and
immediately lowered to linear phis afterwards.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28661>
2024-04-26 08:39:01 +00:00
Daniel Schürmann
3b832fe2ab aco/lower_phis: simplify check for uniform predecessors
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28661>
2024-04-26 08:39:01 +00:00
Konstantin Seurer
d6c9b1d03f radv: Handle all dependencies of CmdWaitEvents2
The spec describes pDependencyInfos as an array with eventCount elements.

cc: mesa-stable

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10579
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28896>
2024-04-26 08:09:22 +00:00
Samuel Pitoiset
7c0b73e0aa radv/rt: rework the helper that hashes a ray tracing pipeline
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28860>
2024-04-26 07:40:09 +00:00
Samuel Pitoiset
58fb6db649 radv/rt: pass radv_ray_tracing_state_key to radv_rt_pipeline_compile()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28860>
2024-04-26 07:40:09 +00:00
Samuel Pitoiset
7be635719c radv/rt: add radv_ray_tracing_state_key
This struct contains all information for compiling a pipeline
(stages, stage keys and groups). It will be used to generate a unique
pipeline hash.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28860>
2024-04-26 07:40:09 +00:00
Colin Marc
ec78cbce4c radv/video: don't truncate frame_num and POC to 32
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28719>
2024-04-26 06:38:44 +00:00
Ryan Neph
ee7e0168a1 venus: reclaim signal semaphore feedback resources for wasteful clients
Pending feedback resources (cmds, buffers, slots) for timeline semaphores are
generally reclaimed for re-use during subsequent semaphore waits/queries or any
queue submission containing at least one "wait" semaphore.

They are never reclaimed in the unexpected case when all submissions only
contain "signal" timeline semaphores, which consume such resources but
are never subsequently queried or waited upon.

This strange behavior is observed in several Valve games (Portal 2,
L4D2, CS2), which all run natively on linux with their own internal
distributions of DXVK v2.0 (at time of this MR submission). A Cursory
analysis of recent DXVK history indicates that it may be gone by v2.1.

The consequence is rapid guest memory leak and host Vk resource leak,
resulting in a crash within 1-2 minutes.

Fix that leak by running the reclaimation procedure for submissions with
_any_ accompanying semaphores.

Fixes: d63432012d ("venus: refactor semaphore feedback")
Signed-off-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28915>
2024-04-26 06:17:37 +00:00
Yiwei Zhang
fdc21a95aa venus: workaround excessive dma-buf import failure on turnip
Workaround dEQP-VK.wsi.android.swapchain.simulate_oom.* test failures on
turnip where excessive imports can fail, and venus has to propagate oom.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28941>
2024-04-26 05:56:42 +00:00
Yiwei Zhang
824a8542d7 venus: silence a stack array false alarm
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28914>
2024-04-26 05:37:02 +00:00
Yiwei Zhang
3e16d25d1a venus: avoid client allocators for ring internals
There're many cases in which the ring submissions must succeed. We don't
worry about real oom since things would fail earlier. For simulated oom
from random intentional allocs, there isn't robust way to fail those
must succeeds. e.g. the commands that don't have return codes or valid
error return struct defaults. So real oom propagation is still at best
effort.

Cc: mesa-stable
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28914>
2024-04-26 05:37:02 +00:00
Lionel Landwerlin
9926aedc96 anv: enable EDS3 AlphaToCoverageEnable & RasterizationSamples
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10647
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27803>
2024-04-26 05:13:03 +00:00
Lionel Landwerlin
ada806baa3 anv: remove fs_msaa_flags from the graphics pipeline
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27803>
2024-04-26 05:13:03 +00:00
Lionel Landwerlin
ddf31d2f40 anv: move 3DSTATE_MULTISAMPLE to partial emission
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27803>
2024-04-26 05:13:03 +00:00
Lionel Landwerlin
815d2e3e8b anv: move 3DSTATE_PS to partial packing
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27803>
2024-04-26 05:13:03 +00:00