Commit graph

6811 commits

Author SHA1 Message Date
Yiwei Zhang
8aa2f1a94f panvk: add panvk_android_get_wsi_memory for AHB spec v8+
Android Vulkan loader relies on aliased ANB image support to advertise
KHR_swapchain spec v69+. This change adds panvk_android_get_wsi_memory
helper based on deep copied (and sanitized) image create info to perform
deferred image initialization and ANB memory alloc.

Also we switch to use VK_USE_PLATFORM_ANDROID_KHR instead.

Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
2025-08-22 21:39:12 +00:00
Yiwei Zhang
2f54020f29 panvk: ensure wsi memory is bound at offset 0
No apps or tests have hit the spec corner case yet, but in theory they
could pass invalid offset and expect the impl to ignore it for wsi alias
binding. This change ensures the offset is zero, which aligns with
common wsi side binding as well as obeying the dedicated allocation
requirement.

Fixes: 187956bd51 ("panvk: adopt wsi_common_get_memory")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
2025-08-22 21:39:11 +00:00
Yiwei Zhang
075d78115e panvk: implement deferred image creation
Implemented in the way without leaking concerns. The container
panvk_android_deferred_image will be freed up upon panvk_DestroyImage
with the strictly paired allocator obeying the spec.

Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
2025-08-22 21:39:11 +00:00
Yiwei Zhang
752ea7f6df panvk: resolve ANB (pre spec v8)
Before ANB spec v8, all ANB images are created and fully initialized
upon panvk_CreateImage.

Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
2025-08-22 21:39:10 +00:00
Yiwei Zhang
63db388543 panvk: stub out Android ANB and AHB image handling
ANB and AHB image handling will be implemented on top of
VK_EXT_image_drm_format_modifier impl. To be specific, they will be
resolved to VkImageDrmFormatModifierExplicitCreateInfoEXT when the
backing gralloc image is available:
- ANB: upon ANB image creation
- ANB alias: upon binding image to memory
- AHB: upon dedicated memory import

So for ANB alias and AHB, the initial VkImage creation only needs to
allocate the image object while the create info has to be deferred till
later to help with actual image layouting.

Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
2025-08-22 21:39:10 +00:00
Erik Faye-Lund
e098bf399a pan/va: check branch_offset for overflow
The branch offset needs to fit in 8 bits, and with the shr(3) modifier,
this means the max legal value is 2040. Let's verify that while packing.

CID: 1503283
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36724>
2025-08-21 08:45:33 +00:00
Erik Faye-Lund
f80506277d pan/midgard: fix check for negative texture offset
We need to sign-extend texture-offset before checking for negative
values, otherwise we'll never see them.

CID: 1457497
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36724>
2025-08-21 08:45:33 +00:00
Erik Faye-Lund
49183bfb79 pan/bi: use os_read_file-helper
We already have a more robust helper for this, so let's use it rather
than open-coding the same.

While we're at it, return early on error for readability here. There's
no need to continue the logic in those cases.

CID: 1444074
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36724>
2025-08-21 08:45:33 +00:00
Erik Faye-Lund
046710ce95 pan/clc: handle seek-error
lseek can return a negative value on error here. While it's not likely
to happen, let's add some error-checking here to prevent bad behavior if
we're unlucky.

CID: 1648299
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36724>
2025-08-21 08:45:33 +00:00
Erik Faye-Lund
f886e08f36 pan/decode: detect error on fseek
We do this for other calls to fseek here, so let's be consistent.

CID: 1659325
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36724>
2025-08-21 08:45:33 +00:00
Erik Faye-Lund
bf3605a189 pan/midgard: initialize last_next_tag to TAG_BREAK
If the shader contains zero words, we would try to use -1 as an index
into an array at the end of this function, which would be bad. But
shaders without any words are, uh, no point in disassembling in the
first place, so this seems like a theoretical bug in the first place.

However, since the only thing we *really* care about last_next_tag is if
is TAG_BREAK or not, let's initialize it to TAG_BREAK instead. This
means we'll avoid a bogus print at the end here, even if we ended up
calling this on an empty shader.

CID: 1458835
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36724>
2025-08-21 08:45:33 +00:00
Erik Faye-Lund
979382ffaa pan/midgard: r1w should be set
r1.w should be written, so let's add an assert here instead of making
lcra_add_node_interference() overrun a buffer here.

CID: 1510007
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36724>
2025-08-21 08:45:32 +00:00
Erik Faye-Lund
22ebe3e9e8 pan/bi: use ralloc
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36724>
2025-08-21 08:45:32 +00:00
Erik Faye-Lund
4bedd8c35c pan/bi: bail from optimizing on oom
Allocations can fail, and since this is an optimization pass, let's just
skip the pass and let some other code deal with the OOM situation.

Fixes: 800a861431 ("pan/bi: Fuse FCMP/ICMP on Valhall")
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36724>
2025-08-21 08:45:32 +00:00
Erik Faye-Lund
a369800822 pan/bi: plug leak
We need to free the LUT here also.

Fixes: 800a861431 ("pan/bi: Fuse FCMP/ICMP on Valhall")
CID: 1659312
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36724>
2025-08-21 08:45:32 +00:00
Yiwei Zhang
961d3a73b0 panvk: no need to set DRI_CONF_VK_KHR_PRESENT_WAIT
That was a legacy thing only needed for the original present_id/wait
suport.

Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36835>
2025-08-21 07:53:15 +00:00
Boris Brezillon
590ad83b98 panfrost: Use pan_image_test_modifier_with_format() to do our modifier check
Now that we have pan_image_test_modifier_with_format(), use it do our
native modifier check. This involves fully describing the YUV lowering
even for formats that don't have a native YUV-as-RGB fallback.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35761>
2025-08-21 07:27:05 +00:00
Boris Brezillon
33eff977f6 panvk: Use pan_image_test_props() to do our modifier check
It's not necessarily shorter, because of the pan_image_props
initialization but we're likely to omit details when doing the check.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35761>
2025-08-21 07:27:05 +00:00
Boris Brezillon
a909e1e6ff pan/image: Provide two helpers to check image viability
pan_image_test_props() checks all the image properties at once, and
pan_image_test_modifier_with_format() just a <modifier,format> pair.

This will allow us to use the check done in pan_mod instead of
duplicating the same set of rules in panvk/panfrost and possibly having
one that's ahead of the other.

There are still checks we can't do at the pan_mod/image level, like
anything involving format lowering, but that's okay.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35761>
2025-08-21 07:27:05 +00:00
Boris Brezillon
d818700dba pan/mod: Replace ::supports_format() by ::test_props()
pan_mod_handler::supports_format() is not used yet, and will be too
limited for panvk, so let's provide a callback that will check all
image properties at once instead of just the <modifier,format> pair.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35761>
2025-08-21 07:27:04 +00:00
Boris Brezillon
0812e945e1 pan/mod: Add a pan_mod_get_handler() implementation when PAN_ARCH is defined
This allows us to call pan_mod_get_handler() from static inline
functions defined in headers that are included from per-gen and
gen-agnostic source files.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35761>
2025-08-21 07:27:04 +00:00
Mary Guillemard
1d03897564 pan/bi: Run opt_sink and opt_move in preprocess
We can do some movement for UBO and SSBO after they are lowered in
preprocess.

We already do this in postprocess but this now also catch SSBOs as they
are lowered in postprocess.

Overall, reduce fills (less load from TLS) in fossils (excluding
parallel-rdp as it crash still):

Totals:
Instrs: 115242 -> 115046 (-0.17%); split: -0.20%, +0.03%
CodeSize: 1168896 -> 1164928 (-0.34%); split: -0.35%, +0.01%
Estimated normalized CVT cycles: 762.015625 -> 757.109375 (-0.64%); split: -0.75%, +0.11%
Estimated normalized Load/Store cycles: 12693.0 -> 12680.0 (-0.10%); split: -0.11%, +0.01%
Number of spill instructions: 358 -> 359 (+0.28%)
Number of fill instructions: 1600 -> 1584 (-1.00%)

Totals from 127 (15.82% of 803) affected shaders:
Instrs: 31753 -> 31557 (-0.62%); split: -0.73%, +0.12%
CodeSize: 335104 -> 331136 (-1.18%); split: -1.22%, +0.04%
Estimated normalized CVT cycles: 205.546875 -> 200.640625 (-2.39%); split: -2.78%, +0.40%
Estimated normalized Load/Store cycles: 3935.0 -> 3922.0 (-0.33%); split: -0.36%, +0.03%
Number of spill instructions: 124 -> 125 (+0.81%)
Number of fill instructions: 452 -> 436 (-3.54%)

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36776>
2025-08-20 12:11:43 +00:00
Mary Guillemard
7e86653a6f pan/bi: remove dead variables in preprocess
This should have no effect apart cleaning up NIR_DEBUG print outputs a
bit.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36776>
2025-08-20 12:11:43 +00:00
Mary Guillemard
bc8a277551 pan/bi: Split bi_optimize_nir and run bi_optimize_loop_nir in preprocess
We now have bi_optimize_loop_nir following optimize_nir from NAK.

Overall the more we can cleanup early the better, shouldn't cause much
changes.

For fossils/sascha-willems:
Totals:
Instrs: 40884 -> 40879 (-0.01%); split: -0.02%, +0.01%
Estimated normalized FMA cycles: 588.078125 -> 588.015625 (-0.01%)
Estimated normalized CVT cycles: 249.875 -> 249.859375 (-0.01%); split: -0.04%, +0.04%

Totals from 9 (1.44% of 627) affected shaders:
Instrs: 1521 -> 1516 (-0.33%); split: -0.66%, +0.33%
Estimated normalized FMA cycles: 9.1875 -> 9.125 (-0.68%)
Estimated normalized CVT cycles: 11.125 -> 11.109375 (-0.14%); split: -0.98%, +0.84%

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36776>
2025-08-20 12:11:43 +00:00
Mary Guillemard
6ab7a03aef panfrost: Split texture lowering passes
We now have lower_texture_early and lower_texture.

lower_texture_early handle nir_lower_tex and (in the future) could handle
anything that is backend specific that need to happen before nir_lower_io.

lower_texture handles actual lowering of backend specific things that
must happen after nir_lower_tex and nir_lower_io.

This allows us to finally not run nir_lower_tex two times in panvk.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36776>
2025-08-20 12:11:43 +00:00
Mary Guillemard
310eabacc0 panfrost: Move nir_lower_io outside of postprocess
Moving it out of there will allow us to shuffle and move API specific parts
out of there.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36776>
2025-08-20 12:11:43 +00:00
Mary Guillemard
a3f935c850 panfrost: Split compilers preprocess_nir
As we are going to move texture and IO lowering, this split preprocess
functions in two, one handling preprocess the other postprocess.

The split is done right before lower_io and has no functional change for
now.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36776>
2025-08-20 12:11:43 +00:00
Mary Guillemard
04e9a93339 panvk: Lower sampler and texture index in case of offset
We are going to move to run nir_lower_tex once and before
lower_descriptors.

To avoid needing to rerun it, let's never generate a sampler or texture
index in lower_descriptors when offset is present.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36776>
2025-08-20 12:11:43 +00:00
Mary Guillemard
62bfd3f132 panvk: Remove unused color_output_var function in fb_preload
Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36776>
2025-08-20 12:11:43 +00:00
Mary Guillemard
5aba96d4ac pan/bi: Stop exposing bifrost_nir_lower_load_output
Unused outside of pan/bi and also remove orphan bifrost_nir_lower_xfb
declaration.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36776>
2025-08-20 12:11:43 +00:00
Mary Guillemard
7ba81b5f95 pan/bi: Move pan_lower_sample_pos to next block
This should only run on frag shaders, let's group it the same way we
have it in midgard compiler.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36776>
2025-08-20 12:11:43 +00:00
Erik Faye-Lund
03b7054c30 pan/midgard: avoid implicit cast-warning on Clang
BITFIELD_MASK() returns a 32-bit unsigned integer, and Clang complains
if we assign it to a 16-bit unsigned integer without a cast. Let's add
that cast.

While we're at it, add an assert() to make it clear to the compiler that
the condition in BITFIELD_MASK() can be optimized away.

Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36606>
2025-08-20 00:05:36 +00:00
Erik Faye-Lund
e5fda871fd panvk: avoid implicit cast-warning on Clang
BITFIELD_MASK() returns a 32-bit unsigned integer, and Clang complains
if we assign it to a 16-bit unsigned integer without a cast. Let's add
that cast.

While we're at it, add an assert() to make it clear to the compiler that
the condition in BITFIELD_MASK() can be optimized away.

Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36606>
2025-08-20 00:05:36 +00:00
Erik Faye-Lund
fed682c506 pan/lib: do not duplicate enum mali_pixel_kill
The enum pan_earlyzs is just enum mali_pixel_kill under a different
name, which was needed because the enum was missing from common.xml.

However, because pan_earlyzs_lut is used in files that are both included
with PAN_ARCH unset and set to values including values lower than 6, we
get issues with the way genxml/common_pack.h gets included, resulting in
the enum not being defined.

We don't really depend on the values for this, only on the size. So
let's just use unsigned values in the struct instead, to side-step the
issue.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36606>
2025-08-20 00:05:36 +00:00
Erik Faye-Lund
0dcf510c05 pan: use translate_s_format for stencil
While this was also using translate_zs_format() before the commit in
question, that's didn't lead to any real issues, because only a single
value was legal here before. While it's not entirely in-spec to use
other values, it seems the HW doesn't mind.

But when this logic was reworked, the typed field was used instead. This
lead to a compiler warning on Clang.

Let's correct this properly here, rather than papering over the compiler
warning.

Fixes: 7a763bb0a3 ("pan/genxml: Rework the RT/ZS emission logic")
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36606>
2025-08-20 00:05:36 +00:00
Erik Faye-Lund
30cc9f5b3d pan/util: use nir_component_mask instead of BITFIELD_MASK
To generate a nir_component_mask_t, we should use nir_component_mask,
not BITFIELD_MASK()...

But we're also generating the same mask twice here, so let's just
store that to a variable and reuse the mask when shifting it while we're
at it.

Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36606>
2025-08-20 00:05:36 +00:00
Eric Engestrom
69b0245f13 panfrost/meson: drop invalid C++ arg
cc1plus: warning: command-line option ‘-Wno-override-init’ is valid for C/ObjC but not for C++

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36840>
2025-08-19 23:44:22 +00:00
Aksel Hjerpbakk
0e339c7a64 panvk: clear big_bos on cmd pool reset with release bit
Clear big bos cache if the the user calls vkResetCommandPool with
VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT.

Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36713>
2025-08-19 16:41:31 +00:00
Aksel Hjerpbakk
0e88dd575f panvk: pool large TLS allocations
Cache TLS in the case of large spilling. For content that is spilling
large amounts of TLS this can bring substantial uplifts in
performance.

Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36713>
2025-08-19 16:41:31 +00:00
Romaric Jodin
910ac069c5 panfrost/perfetto: Use Android-internal perfetto
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This enables ninja-to-soong to generate an Android.bp that builds Mesa
against Android's libperfetto_client_experimental library.

Following:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36561

Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36807>
2025-08-19 15:02:06 +00:00
Olivia Lee
e278a89fdd panvk/perfetto: improve clock synchronization using CLOCK_MONOTONIC_RAW
On Mali, GPU timestamp cycle counts are mapped to the arch counter, and
so advance at the same rate as CNTVCT (with a fixed offset). The kernel
applies gradual NTP adjustments to CLOCK_BOOTTIME by modifying the rate
of the cycle->ns conversion slightly from the nominal frequency of the
clock, which causes it to drift from the GPU clock's ns values (which
just use the nominal frequency). On a rock5b, I measured this drift in
the 25-30µs/s range.

Perfetto's clock synchronization applies a fixed offset between each
clock snapshot, and so does not handle clocks with significantly
different rates and infrequent snapshots well. For panvk, we emit
snapshots once per second, and so the drift results in an error of
~25µs right before the next snapshot. This is significant for measuring
the latency of CPU<->GPU operations, and shows up as a sawtooth pattern
on the measured latency distribution over time.

CLOCK_MONOTONIC_RAW does not have the NTP adjustment, and so the only
source of drift is error in the shift/mult approximation that the kernel
uses for cycle->ns. This error is very small, and so by emitting CPU
trace events against CLOCK_MONOTONIC_RAW instead of CLOCK_BOOTTIME, we
can get much more accurate synchronization.

Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34390>
2025-08-19 09:50:36 +00:00
Olivia Lee
78d3b9cd0a perfetto: allow specifying clock domain for cpu timestamps
Everything is currently using CLOCK_BOOTTIME, which is perfetto's
default, and matches the previous behavior. On some hardware, different
clocks may be better synchronized with the gpu clock.

Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34390>
2025-08-19 09:50:36 +00:00
Christoph Pillmayer
992fbee7be panvk: Fix preserved metadata in lower_input_attachment_load
lower_input_attachment_load inserts control flow so we should not claim
we preserve nir_metadata_control_flow.

Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36789>
2025-08-18 07:46:34 +00:00
Emma Anholt
9e61e72e9f vk/runtime: Set GPU_MULTI_WAIT on the drm syncobj type.
DRM syncobjs always let you wait repeatedly on them, so we can set the
flag in the core instead of having each driver override it once they try
to enable the emulated timeline semaphores.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36563>
2025-08-13 18:57:42 +00:00
Mike Blumenkrantz
c7045e3e63 perfetto: unify init
util_perfetto_init() was called in some places, util_cpu_trace_init()
was called in other places, and some places used tracing without ever
calling either of them

util_cpu_trace_init() is now guaranteed to be called:
* on gallium screen create
* on VK instance create

thus no driver/frontend/etc should ever need to call this manually

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36628>
2025-08-12 13:17:43 +00:00
Caterina Shablia
f53bf77d47 panvk/csf: plop the stage and access masks into panvk_sync_scope
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Stage and access masks often go together. Representing the two
with a single value lets us have neater code.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36176>
2025-08-12 12:43:10 +00:00
Caterina Shablia
1f7af54da9 panvk: do not zero AFBC when an image is being bound
Binding an image must not write anything into the memory it's
being bound to.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36176>
2025-08-12 12:43:10 +00:00
Caterina Shablia
ed6f6c723f panvk: call cmd_transition_image_layout for each image memory barrier
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36176>
2025-08-12 12:43:10 +00:00
Caterina Shablia
c95f899305 panvk: add a meta command for transitioning image layout
Currently the only thing this function ever does is clear AFBC
metadata when transitioning away from UNDEFINED.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36176>
2025-08-12 12:43:10 +00:00
Caterina Shablia
8e3fb838ac panvk/csf: change get_cs_deps to be add_cs_deps
Make get_cs_deps accumulate the dependencies. This is useful when
implementing layout transitions. Layout transitions away from
UNDEFINED are implemented with a compute dispatch sandwiched
in-between src and dst, specified in the image barrier. When
implementing device event wait and the event dependency needs a
layout transition, we can defer emitting the barrier that syncs
layout transition dispatches with dst until after we have emitted
all dispatches, avoiding sync between the said transition
dispatches.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36176>
2025-08-12 12:43:10 +00:00