Commit graph

5426 commits

Author SHA1 Message Date
Sergi Blanch Torne
213f5e9152 Uprev Piglit to e9ab30aeaed97b69868cf4d6d6a3f70f3b53c362
93b4bd2e0a...e9ab30aeae

Signed-off-by: Sergi Blanch Torne <sergi.blanch.torne@collabora.com>
Reviewed-by: David Heidelberg <david@ixit.cz>
Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31058>
2024-09-19 15:41:32 +00:00
Erik Faye-Lund
cdef6cfa8c panvk: error-check get_fb_descs calls
These calls were missing error-handling, but all the pieces to do so are
already in place. Let's report the errors as appropriate.

Fixes: 5544d39f44 ("panvk: Add a CSF backend for panvk_queue/cmd_buffer")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31216>
2024-09-18 18:53:25 +00:00
Erik Faye-Lund
1cc4a23a46 panvk: drop unused define
This is unused since ac34183ec3 ("panvk: Move the VkPhysicalDevice logic
to panvk_physical_device.{c,h}"), let's remove the define.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31216>
2024-09-18 18:53:25 +00:00
Erik Faye-Lund
bd18ea5fcb panvk: remove out-of-date detail
This is no longer r62, it's r90. But we don't need to be explicit about
it, so let's be a bit more vague in the comment here.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31216>
2024-09-18 18:53:25 +00:00
Lars-Ivar Hesselberg Simonsen
d63da63f3f panvk: Fix use of cs_sync64_wait in cmd_wait_event
The sync objects used by events are of type panvk_cs_sync32, making this
mismatch hit an assert in cs_to_reg_tuple.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11886
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31221>
2024-09-18 17:08:48 +00:00
Boris Brezillon
8f053e10de panvk/csf: Unconditionally clean L2 and LS caches when closing a CS
We need a clean because descriptor/CS memory can be returned to the
command pool where they get recycled. If we don't clean dirty cache
lines, those cache lines might get evicted asynchronously and their
content pushed back to main memory after the CPU has written new stuff
there.

Reported-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Fixes: 5544d39f44 ("panvk: Add a CSF backend for panvk_queue/cmd_buffer")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Tested-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31225>
2024-09-18 16:34:54 +00:00
Boris Brezillon
c97f79ac0c pan/va: Optimize SSBO lowering on Valhall
For reads, we use the LD_PKA (AKA LD_BUFFER) so we can directly
pass the buffer index. For writes, we still convert the SSBO index
into a global address before doing a global load/store/atomic
operation, but we do that with an LEA_PKA instruction that takes
care of bounds checking.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31164>
2024-09-18 13:45:57 +00:00
Boris Brezillon
adadb097a3 nir/lower_ssbo: Add an option to conditionally lower loads
On Mali(Valhall), we have a way to load SSBO data without going through
an SSBO index -> global address translation, so let's provide a way
to tell nir_lower_ssbo() when it shouldn't lower loads.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31164>
2024-09-18 13:45:57 +00:00
Mary Guillemard
431c1d77d6 pan/va: Define the LEA_BUFFER instruction
Will be used for SSBO loads/stores on Valhall.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31164>
2024-09-18 13:45:57 +00:00
Boris Brezillon
339a136ce7 panvk: Fix valhall_pack_buf_idx() for SSBO store/atomic operations
We're not patching indices of store/atomic operations, which trips out
nir_lower_ssbo().

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31164
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31164>
2024-09-18 13:45:57 +00:00
Lars-Ivar Hesselberg Simonsen
589a7ac5a2 panvk: Fix paths that assume a fragment shader
A few places in PanVK assumes the fragment shader pointer is nonzero,
which is not true for some VulkanCTS tests (*nocolor*), causing
segfaults when dereferencing the pointer.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11881
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31203>
2024-09-18 08:37:55 +00:00
Boris Brezillon
b40ec57e36 panvk: Temporarily disable VK_FORMAT_D32_SFLOAT_S8_UINT on Valhall
Valhall doesn't support interleaved D32_S8X24 so let's not advertise
this format for now. Ultimately, we want to support it as a
multi-plane D32 + S8 format, and we probably want to switch Bifrost
to this layout too.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Tested-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Tested-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31165>
2024-09-17 13:13:58 +00:00
Boris Brezillon
7dc350ad76 pan/va: Accept DIM_SUBPASS[_MS] in valhall_tex_dimension()
We don't merge subpasses, so we can't turn subpass attachment
loads into tile buffer reads yet. Let's just treat those as
regular 2D textures for now (as we do on Bifrost).

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11875
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Tested-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31166>
2024-09-17 12:51:27 +00:00
Lars-Ivar Hesselberg Simonsen
f5dab1b77e panfrost: Fix near/far depth clip
Near/far depth clip was implemented by setting the low/high_depth_clamp
to -/+INFINITY, which is invalid on Mali.

This commit removes the modification of the depth clamp values and
enables depth clipping by setting the depth_cull_enable state in the ZS
descriptor for v9+ (the equivalent pre-v9 RSD state is already set
correctly) and setting the primitive cull flags correctly for both.

Finally, it disables PIPE_CAP_DEPTH_CLIP_DISABLE_SEPARATE for v9+, as
both plane clips are controlled by a single value.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11506
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31041>
2024-09-12 20:04:58 +00:00
Lars-Ivar Hesselberg Simonsen
5fd523fafb pan/genxml: Add pan_pack_nodefaults()
The new packing macro will not default initialize fields, which is
useful for structures used as override flags or in pan_merge().

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11506
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31041>
2024-09-12 20:04:58 +00:00
Lars-Ivar Hesselberg Simonsen
03c470d2ab panfrost: Move ForEachMacros into panfrost
This change moves panfrost specific ForEachMacros from the top level
.clang-format to the panfrost specific .clang-format.

This is done to avoid triggering CI for all drivers when making changes
to this list.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11506
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31041>
2024-09-12 20:04:58 +00:00
Boris Brezillon
387e6323f8 panvk/csf: Fix inverted address/destination register in CmdSetEvent2()
cs_load32_to() takes the destination register first, and the address
one next.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31147>
2024-09-12 19:29:08 +00:00
Boris Brezillon
a5c660d78a panvk/csf: Fix missing TSD pointer initialization on RUN_IDVS
The global thread storage descriptor can be allocated in the dispatch
path, which means the test on tsd != NULL might be true when the first
RUN_IDVS() happens, and we never set r24 to the TSD address.

Fix that by keeping a tsd field in panvk_cmd_graphics_state that's only
set in the draw path.

Reported-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Tested-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Tested-by: Alexandre ARNOUD <aarnoud@me.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31147>
2024-09-12 19:29:08 +00:00
Eric R. Smith
db371633e6 panfrost: improve swizzle inversion
panfrost_invert_swizzle produces a (one-sided) inverse, that is a
function g such that g(f(x)) = x. However, it is actually used in
some cases where we want a two-sided inverse, where we also have
f(g(x)) = x. An example is its use to pre-swizzle border color
values so that a later pass will un-swizzle them. If the swizzle
is not one-to-one this two sided inverse does not exist. However,
we can do better than the original code, e.g. for an RRR1 swizzle
inverse produced was originally B000, which when applied on the wrong
side results in BBB1 as output, whereas R000 would produce the
desired RRR1 output. Using the first valid component we see, rather
than the last one, is thus usually better.

The "correct" solution is to re-write all the code that uses
an inverse to handle non-unique inverses. But frankly these uses only
crop up in fairly niche cases like tests, and it's probably not worth
spending a lot of effort to deal with these edge cases when this
patch fixes most of them.

Fixes some failing piglit ext_framebuffer_multisample tests.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31060>
2024-09-11 19:29:16 +00:00
Boris Brezillon
5db135f66a panvk: Advertize v10 support
Patch panvk_macros.h to add a case for v10 and accept v10 devices.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Rebecca Mckeever
f8598e599e panvk: Add VkEvent support to the CSF backend
With its sync object primitive, CSF allows native event support.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
5544d39f44 panvk: Add a CSF backend for panvk_queue/cmd_buffer
With those two components implemented, we can now compile all common
per-arch source files.

Co-developed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
7049d31676 panvk: Add a read-write non-cached memory pool for CSF events
Events cross the device boundary and can be read/written by the host.
We could add the necessary cache flush and made those GPU-cached, but
it's way simpler to allocate non-cached memory.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
53fb1d99ca panvk: Transition to explicit VA assignment on v10+
Panthor allows us to control the GPU virtual address space,
which, among other things, will allow us to support sparse
bindings.

Let's tweak the device initialization and BO mapping to
takes this explicit VA management mode into account.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
ca79fc99cd panvk: Don't pretend we can compile for v9
The JM backend is not ready for v9 yet, so let's just drop it from the
list of architecture to build for.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
db1073357a panvk: Be robust against allocation failures in a command buffer context
When an allocation failure happens, the command buffer should be
flagged as invalid, and anything using this memory from the CPU side should
be skipped to avoid segfaults.

For allocations going through memory pools owned by a command buffer
we automate that with panvk_cmd_alloc_xx() macros.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
eb0b1c36f2 panvk: Move CmdPushConstants2KHR to panvk_vX_cmd_push_constant.c
Turns out the panvk_cmd_buffer structures for CSF/JM are similar enough
to make CmdPushConstants2KHR() generic. Let's move this function out
of the JM specific code.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
173939ed9b panvk: Move cmd_bind_shaders() to panvk_vX_shader.c
We had planned for a CSF specialization, but it turns out the CSF/JM
are almost the same and we can have something generic implemented in
panvk_vX_shader.c

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
0426c14c7a panvk: Move Cmd{Bind,Push}DescriptorSets implementation to cmd_desc_state.c
Turns out the panvk_cmd_buffer for CSF/JM have enough similarities to
make it possible to have a generic implementation in
panvk_vX_cmd_desc_state.c.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
aedb00ca08 panvk: Set the submit mode to THREADED_ON_DEMAND
It's needed for wait-before-submit, which drm_syncobjs don't
support.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
0429cc10d8 panvk: Prepare the panvk_device logic for CSF
The tiler heap is handled differently on CSF hardware, and we don't need
to allocate the tiler_heap buffer there.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
be96213634 panvk: Make sure push sets are reset when picked from the CommandPool
If we don't do that, we might end up with data from the previous user
of this set.

Fixes: 598a8d9d11 ("panvk: Collect allocated push sets at the command level")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
7f7e772bdf panvk: Don't make panvk_device size gen dependent
The panvk_device is used in gen-agnostic path, and which means we can't
make its size dependent on PAN_ARCH.

Fixes: 5067921349 ("panvk: Switch to vk_meta")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
6527cb742e panvk: Don't open-code vk_index_type_to_bytes()
While at it, store the index_size in bytes instead of bits.

Suggested-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
9f094cdeaf panvk: Fix valhall_pack_buf_idx()
The descriptor lowering pass can add UBO loads to read descriptors, and
these loads already assume a nir_address_format_32bit_index_offset
format.

Bail out if we detect that case in valhall_pack_buf_idx().

Reported-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Fixes: 27beadcbdb ("panvk: Extend the shader logic to support Valhall")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
343bff7903 panvk: Drop the NO_MMAP flag when PANVK_DEBUG=trace
We have buffers that are not supposed to be CPU-mapped but are useful to
check when tracing is enabled.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
bae5235405 panvk: Kill the set_dirty() macro
It's unused and we're not supposed to manually set the dirty bits
anyway.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
a651826b80 panvk: Fix the varying pool label
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
2805804dce pan/desc: Make vertex_count a Midgard field
We don't need to pass the vertex count around on Bifrost/Valhall, since
the tiler descriptor is generated outside of emit_fbd() on those gens.

Let's move vertex_count under the midgard struct to make that clear.
This implies maintaining a vertex_count at the panfrost_batch level
in the gallium driver, but that's fine.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:56 +00:00
Boris Brezillon
11fcb23f74 pan/desc: Add a struct for valhall/bifrost to the union in pan_tiler_context
Valhall has extra tiler parameters for multilayer rendering that we will
need for the framebuffer descriptor emission. Let's add proper struct
for Valhall and Bifrost instead of assuming a mali_ptr is all we'll ever
need.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:55 +00:00
Boris Brezillon
2149a04de3 pan/kmod: Don't cap VM bind operations to one
Looks like some leftovers from a debugging session.

Fixes: 97f6a62f7e ("pan/kmod: Add a backend for panthor")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:55 +00:00
Boris Brezillon
07b31b2204 pan/cs: Add a facility to restrict register access
If the CS register file is used in a stateful mode, some of the registers
will survive the RUN_xxx boundary, and even serve as a context for
subsequent RUN_xxx calls.

Having a way to restrict register access outside specific sections of
code is a handy debug feature, so let's expose the necessary bits to
allow that.

It takes the form of a reg permission callback that gets called every
time a register serves are a source or destination, to make sure this
is allowed in this context.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:55 +00:00
Boris Brezillon
07c463d06b pan/cs: Add inline specifiers to a bunch of cs_ helpers
Just to make things consistent with the rest of the file, the compiler
was probably already inlining those anyway.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:55 +00:00
Boris Brezillon
a87c43def7 pan/cs: Add an optional load/store tracker to make sure we don't omit waits
With load/store operations being asynchronous, it's pretty easy to omit
a WAIT(LS) and end up with inconsistent register values or corrupted
stores.

Add an optional load/store tracker to detect such cases early on.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:55 +00:00
Boris Brezillon
b1934057cb pan/cs: Allow sparse register set passed to loads/stores
When it comes to copying stuff around, it becomes handy to be able
to have a discontiguous range of register to load to/store from so
we don't have to move stuff around to make things contiguous in the
register file.

Allow that by making register count the last bit in the mask rather
than counting bits.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:55 +00:00
Boris Brezillon
1a5ce4a96e pan/cs: Add helpers to emit match (AKA switch-case) blocks
We need for the dynamic scoreboard assignment we will do in panvk.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:55 +00:00
Boris Brezillon
8f825a51a8 pan/cs: Accept val=undef when cs_branch_label() condition is ALWAYS
The register is not used in that case anyway, so we can pick r0 and
call it a day.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:55 +00:00
Boris Brezillon
f6c3fb11ea pan/cs: Make sure we're not passed cs_now() to asynchronous instructions
FLUSH_CACHE2 is both deferrable and asynchronous. That means we should
always pass an explicit slot to signal instead of picking zero as we do
in cs_now().

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
2024-09-11 12:58:55 +00:00
Mary Guillemard
e47e94f9f2 panvk: Ensure to clear dirty dynamic state in panvk_cmd_draw
This was missing and causing dynamic state to remain dirty once set.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Fixes: 1f57aae4e4 ("panvk: Move vkCmdDraw* functions to their own file")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31089>
2024-09-09 15:59:52 +00:00
Mary Guillemard
6b7f2fe25e panvk: Include new failures from VKCTS 1.3.9.1
Found with a full run, fraction runs seems to not trigger it so far.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31089>
2024-09-09 15:59:52 +00:00