Commit graph

190782 commits

Author SHA1 Message Date
Karmjit Mahil
688d8217a5 tu,freedreno: Add pkt_field_{get,set} helper macro
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
It's very common needing to extract or overwrite a certain field
in an already packed register value, so add macros to do that
instead of manually doing that each time.

Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35088>
2025-05-29 10:54:28 +01:00
Danylo Piliaiev
398f14ca3d freedreno: Use fast variants of {BC4/BC5}_SNORM formats
Hardware has two types of BC4 and BC5: fast and not.
The exact perf difference is not tested, but these distinct formats
could be seen in the public docs:
Qualcomm Adreno GPU > Spec Sheet -> Texture format
https://docs.qualcomm.com/bundle/publicresource/topics/80-78185-2/spec_sheets.html?product=1601111740035277#panel-0-0-1

Found when scanning prop driver's cmdstream seeing unknown format.

Passes:
dEQP-VK.*bc4*
dEQP-VK.*bc5*

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33945>
2025-05-29 09:01:17 +00:00
Samuel Pitoiset
fe2c93a788 ac/nir: enable 64-bit lowering for bitfield_extract
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35187>
2025-05-29 08:45:41 +02:00
Samuel Pitoiset
cecf6675be nir/lower_int64: add bitfield_extract lowering
This will be used by RADV for ACO/LLVM.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35187>
2025-05-29 08:45:40 +02:00
Olivia Lee
104ea2e4cf panfrost: legalize afbc before zs and rt clears
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
In panfrost_clear_depth_stencil and panfrost_clear_render_target, we
start the blit context before binding the clear targets. If we don't
legalize AFBC beforehand, we get a recursive blit crash. panfrost_clear
does not need this because the resource should already be legalized in
panfrost_batch_add_surface.

Fixes the following piglit tests with pan_force_afbc_packing:
 - spec@arb_clear_texture@arb_clear_texture-base-formats
 - spec@arb_clear_texture@arb_clear_texture-simple
 - spec@arb_clear_texture@arb_clear_texture-sized-formats

Fixes: 17a62ff993 ("panfrost: legalize afbc before blitting")
Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34992>
2025-05-29 01:50:31 +00:00
Olivia Lee
bed54fa402 panfrost: fix assertion failure compiling image conversion shaders
In 59a3e12039, we changed the UBO->push optimization in panfrost to
only push UBOs that are available in a CPU buffer. We require
first_ubo_is_default_ubo, to ensure that UBO0 will be a user buffer. We
weren't setting this flag for the image conversion shaders, so got an
assertion failure compiling them. This can be triggered by the
panvk_force_afbc_packing driconf option.

The conversion shader info UBO isn't exactly a "default" UBO in the
sense of being lowered from uniforms, but it is a user buffer, so
setting the flag should be fine.

Fixes: 59a3e12039 ("panfrost: do not push "true" UBOs")
Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
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/34992>
2025-05-29 01:50:31 +00:00
Yiwei Zhang
749265da0d vulkan/wsi: split cmd record for img2buf blit and img2img blit
There's no behavior change, but to prepare for the next img2buf blit
improvement, except adding asserts to make clear of the existing blit
code paths.

v2: use switch with unreachable default per @gfxstrand has suggested

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35220>
2025-05-29 01:20:27 +00:00
Yiwei Zhang
2af2314fb2 vulkan/wsi: include missing barrier for transferring to blit dst image
Fixes: 2975a7f453 ("vulkan/wsi: Add support for image -> image blits")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35220>
2025-05-29 01:20:27 +00:00
Pohsiang (John) Hsu
79bc373b1e mediafoundation: move readme.md to docs folder
Reviewed-by: Yubo Xie <yuboxie@microsoft.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35219>
2025-05-29 01:03:34 +00:00
Pohsiang (John) Hsu
0107d94632 mediafoundation: add mechanism to disable async and h.264 unwrapped POC (commented out for now) according to gpu/version
Reviewed-by: Yubo Xie <yuboxie@microsoft.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35219>
2025-05-29 01:03:34 +00:00
Pohsiang (John) Hsu
061085708a mediafoundation: on use LTR, synchronize the active ltr bitmap to the one passed in
Reviewed-by: Yubo Xie <yuboxie@microsoft.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35219>
2025-05-29 01:03:34 +00:00
Pohsiang (John) Hsu
22d84522ed mediafoundation: get device vendor id, device id, and driver version
Reviewed-by: Yubo Xie <yuboxie@microsoft.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35219>
2025-05-29 01:03:34 +00:00
Pohsiang (John) Hsu
5ee854c4eb mediafoundation: add ETW event for perf analysis
Add perf ETW events using TraceLogging API, the following are adding:

- MFT receives fence (FenceCompletion).
- MFT has output MFSample (METransformHaveOutput).
- MFT calls to pipe end_frame (PipeEndFrame) -- bracketed.
- MFT calls to pipe flush (PipeFlush) -- bracketed.
- MFT submits a frame to pipe (PipeSubmitFrame) -- bracketed from begine_frame to encode_bitstream/encode_bitstream_sliced
- MFT processinput (ProcessInput) -- bracketed
- MFT processoutput (ProcessOutput) -- bracketed

The ETW provider(s) are:

- H264Enc: 0000e264-0dc9-401d-b9b8-05e4eca4977e
- H265Enc: 0000e265-0dc9-401d-b9b8-05e4eca4977e
- AV1Enc:  0000eaa1-0dc9-401d-b9b8-05e4eca4977e

Note that the provider is mostly the same as the WPPTrace provider for each codec, with the additional 'e' (e.g. 0000e264 vs 00000264)

Reviewed-by: Yubo Xie <yuboxie@microsoft.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35219>
2025-05-29 01:03:34 +00:00
Lucas Stach
a8009e7c11 etnaviv: move TS allocation to resource allocation
Allocate TS together with the tracked resource, which gets rid
of the resource mutation on surface creation and the diversion
between the interal and shared TS handling.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34488>
2025-05-29 00:48:07 +00:00
Lucas Stach
83ab7a8d58 etnaviv: add resource render compatible check
Untangle the convoluted render compatible check from
etna_render_handle_incompatible to make it easier to read and move it
into a separate function so it can be reused from other callers.

As this is intended to be called also at resource creation time, where
we don't know the exact level of the resource that might be rendered to,
the stride check for linear resources is made a bit more conservative by
checking that the last level (the one with the smallest stride) still
meets the render target stride alignment requirement.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34488>
2025-05-29 00:48:07 +00:00
Lucas Stach
4717022cb0 etnaviv: drop ts_offset from etna_surface
TS is only allocated for single layer surfaces, so there is no need to
cache a ts_offset taking into account the layer offset in etna_surface.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34488>
2025-05-29 00:48:07 +00:00
Lucas Stach
50940ce393 etnaviv: don't pretend to support TS for array or 3D textures
etna_screen_resource_alloc_ts is only called for textures that have a
single layer and slice, as we don't want to duplicate the driver side
TS tracking information per layer or depth slice. Stop pretending to
support allocating TS for such resources.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34488>
2025-05-29 00:48:06 +00:00
Nanley Chery
965d3ec7d4 intel/isl: Fix isl_surf_image_has_unique_tiles()
Prevent the function from unnecessarily returning false by:
* Comparing the image tile range with that of every LOD instead of only
  LOD0.
* Using the correct comparison check for the exclusive tile end ranges.

Fixes: 8dad01903a ("intel: Add and use isl _surf_image_has_unique_tiles()")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35192>
2025-05-29 00:11:45 +00:00
Paulo Zanoni
ecc90e1bb3 intel/isl: don't clamp num_elements to (1 << 27)
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
The BSpec page for Structure_RENDER_SURFACE_STATE says:

  "For typed buffer and structured buffer surfaces, the number of
   entries in the buffer ranges from 1 to 2^27. For raw buffer
   surfaces, the number of entries in the buffer is the number of
   bytes which can range from 1 to 2^30. After subtracting one from
   the number of entries, software must place the fields of the
   resulting 27-bit value into the Height, Width, and Depth fields as
   indicated, right-justified in each field. Unused upper bits must be
   set to zero."

According to the vkd3d-proton developers, this is what is happening
with the applications:

  "There's also the problematic case of games using typed descriptors
   but passing non-typed buffer descriptors, which is an extremely
   common app bug that works on all D3D12 drivers that we need to work
   around by creating typed views."

Previously, we had an assert() to check for "num_elements > (1 <<
27)", but that assert was preventing us from running games such as
Marvel's Spider-Man Remastered and Assassin's Creed: Valhalla in Debug
mode. So not only I removed the assert, but I also made the code clamp
num_elements to the maximum of (1 << 27) based on my incorrect
interpretation of the paragraph quoted above from BSpec.

What I did not realize was that num_elements is being used just to
calculate Structure_RENDER_SURFACE_STATE Height, Width and Depth, and
our register bit fields on SKL and newer are big enough to fit any
number of num_elements up to 2^32, not only 2^27. Clamping
num_elements results in an incorrect value for S.Depth, which
generates visual corruption in some games.

On Marvel's Spider-Man Remastered, without this patch the texture of
the asphalt in some streets (like the very first one you jump to when
the game starts) gets rendered incorrectly.

Testcase: vkd3d-proton/d3d12/test_large_texel_buffer_view
Link: https://github.com/HansKristian-Work/vkd3d-proton/issues/2071
Link: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12827
Fixes: f3c7e14f09 ("isl: don't assert(num_elements > (1ull << 27))")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35032>
2025-05-28 23:45:54 +00:00
Olivia Lee
97e54511a5 panvk: advertise VK_EXT_shader_subgroup_vote and VK_EXT_shader_subgroup_ballot
These are already supported in the compiler.

Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35218>
2025-05-28 23:20:09 +00:00
Valentine Burley
46539edf03 ci: Rename debian-testing to debian-x86_64
This matches the naming scheme used for debian-arm32 and debian-arm64.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35173>
2025-05-28 22:46:13 +00:00
Olivia Lee
6f5f5ca4b2 pan/va: allow using both FAU and small constants in the same instruction
Normally we aren't able to mix FAU srcs from different pages. We
consider small constants (BIR_FAU_IMMEDIATE) to be page 0, and so were
previously always pulling small constants out with a MOV in instructions
that also use FAUs. This is not necessary. Message unit instructions
have no restrictions on small constant use and execution unit
instructions allow mixing small constants with FAU srcs as long as we
don't use more than 64 bits.

shader-db results on G610:

total instrs in shared programs: 673595 -> 672719 (-0.13%)
instrs in affected programs: 111294 -> 110418 (-0.79%)
helped: 293
HURT: 9
helped stats (abs) min: 1.0 max: 27.0 x̄: 3.12 x̃: 2
helped stats (rel) min: 0.08% max: 10.53% x̄: 1.71% x̃: 1.02%
HURT stats (abs)   min: 1.0 max: 15.0 x̄: 4.33 x̃: 3
HURT stats (rel)   min: 0.06% max: 12.20% x̄: 2.07% x̃: 0.49%
95% mean confidence interval for instrs value: -3.38 -2.42
95% mean confidence interval for instrs %-change: -1.80% -1.39%
Instrs are helped.

total cycles in shared programs: 34260.22 -> 34257.44 (<.01%)
cycles in affected programs: 143.53 -> 140.75 (-1.94%)
helped: 78
HURT: 1
helped stats (abs) min: 0.015625 max: 0.296875 x̄: 0.04 x̃: 0
helped stats (rel) min: 0.32% max: 5.71% x̄: 1.78% x̃: 1.32%
HURT stats (abs)   min: 0.046875 max: 0.046875 x̄: 0.05 x̃: 0
HURT stats (rel)   min: 1.90% max: 1.90% x̄: 1.90% x̃: 1.90%
95% mean confidence interval for cycles value: -0.05 -0.02
95% mean confidence interval for cycles %-change: -1.98% -1.49%
Cycles are helped.

total cvt in shared programs: 4097.12 -> 4083.44 (-0.33%)
cvt in affected programs: 706.75 -> 693.06 (-1.94%)
helped: 293
HURT: 9
helped stats (abs) min: 0.015625 max: 0.421875 x̄: 0.05 x̃: 0
helped stats (rel) min: 0.19% max: 45.45% x̄: 6.38% x̃: 2.53%
HURT stats (abs)   min: 0.015625 max: 0.234375 x̄: 0.07 x̃: 0
HURT stats (rel)   min: 0.15% max: 50.00% x̄: 7.85% x̃: 1.90%
95% mean confidence interval for cvt value: -0.05 -0.04
95% mean confidence interval for cvt %-change: -7.03% -4.89%
Cvt are helped.

total code size in shared programs: 6205824 -> 6198528 (-0.12%)
code size in affected programs: 395648 -> 388352 (-1.84%)
helped: 57
HURT: 2
helped stats (abs) min: 128.0 max: 256.0 x̄: 132.49 x̃: 128
helped stats (rel) min: 0.08% max: 25.00% x̄: 6.96% x̃: 5.26%
HURT stats (abs)   min: 128.0 max: 128.0 x̄: 128.00 x̃: 128
HURT stats (rel)   min: 1.12% max: 2.86% x̄: 1.99% x̃: 1.99%
95% mean confidence interval for code size value: -137.46 -109.86
95% mean confidence interval for code size %-change: -8.19% -5.12%
Code size are helped.

total threads in shared programs: 22203 -> 22204 (<.01%)
threads in affected programs: 1 -> 2 (100.00%)
helped: 1
HURT: 0

Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-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/35154>
2025-05-28 22:21:46 +00:00
Matt Turner
37016468a5 intel/compiler: Align human-readable send message info
This fprintf() was added in commit cce3bea2a7 ("i965/disasm: Align send
instruction meta-information with dst.")) to align the human-readable
send message info (e.g. "render MsgDesc: RT write ...") with the
destination register on the previous line.

Two months later we disabled printing the instruction offset in commit
662f1ccc24 ("i965: Disable hex offset printing in disassembly."),
thereby unaligning the human-readable send message info for the next 11
years.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35077>
2025-05-28 21:54:40 +00:00
Faith Ekstrand
9924ad4e8b nouveau: Move codegen back to the src/gallium/drivers/nouveau
Reviewed-by: Lorenzo Rossi <snowycoder@gmail.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30403>
2025-05-28 21:01:26 +00:00
Faith Ekstrand
ac45243ec1 nak: Unconditionally call lower_io_to_temporaries in preprocess_nir
We're calling it for fragment shaders and NVK is calling it for
eerything before invoking NAK so we may as well call it unconditionally
in NAK and skip calling it in NVK.

Reviewed-by: Lorenzo Rossi <snowycoder@gmail.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30403>
2025-05-28 21:01:26 +00:00
Faith Ekstrand
f70d0425c8 nvk: Stop doubling root descriptors
Reviewed-by: Lorenzo Rossi <snowycoder@gmail.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30403>
2025-05-28 21:01:26 +00:00
Faith Ekstrand
cee45c8bf5 nvk: Only pass texture handles to NAK
Codegen expects to get the handle in both the sampler and texture handle
sources.  NAK only cares about texture_handle.  Now that we don't care
about codegen anymore, we can drop the extra source.

Reviewed-by: Lorenzo Rossi <snowycoder@gmail.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30403>
2025-05-28 21:01:26 +00:00
Faith Ekstrand
511a490f8b nvk: Inline nvk_compile_nir_with_nak()
With codegen gone, there's no point in hanging onto this helper.

Reviewed-by: Lorenzo Rossi <snowycoder@gmail.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30403>
2025-05-28 21:01:26 +00:00
Faith Ekstrand
6d35ee3888 nvk: Remove codegen support
Reviewed-by: Lorenzo Rossi <snowycoder@gmail.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30403>
2025-05-28 21:01:26 +00:00
Faith Ekstrand
9cf78d6532 nvk: Don't disable features based on NVK_USE_NAK
Now that NAK is the default for everything, if someone explicitly
switches to codegen, they get what they get.

Reviewed-by: Lorenzo Rossi <snowycoder@gmail.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30403>
2025-05-28 21:01:26 +00:00
José Roberto de Souza
573e992b99 intel/tools: Skip dump of binaries in unknown sections
In current Xe KMD error dump it will remove the GuC log from dump
but would also drop any new binary added to error dump.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33249>
2025-05-28 20:26:55 +00:00
José Roberto de Souza
a4cf7dde4b intel/tools: Rename and better detect topic changes
Xe KMD added topics without our notice in the past and that may happen
in future so better rename XE_TOPIC_INVALID to XE_TOPIC_UNKNOWN
and better detect topic changes.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33249>
2025-05-28 20:26:55 +00:00
José Roberto de Souza
52e9d25aa0 intel/tools: Replace error_decode_xe_read_hw_sp_or_ctx_line() by a more generic function
error_decode_xe_read_hw_sp_or_ctx_line() is too specific, replacing
it by a more generic function that later will be used in other places
too.

Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33249>
2025-05-28 20:26:55 +00:00
Mike Blumenkrantz
b89e0fa226 tc: rework resource usage tracking to be lighter
this (conceptually) flattens out the batches into a wrapping id which
is used to determine whether a resource has in-flight work pending

the code cleanup is nice, but evaluating performance of this is difficult.
in testing a heavy use case of unsynchronized subdata:
* 10% fewer driver flushes (good)
* 20% fewer direct unsynchronized uploads (bad? or possibly hidden race conditions fixed...)

Fixes: 9cc06f817c ("tc: allow unsynchronized texture_subdata calls where possible")

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35026>
2025-05-28 20:00:36 +00:00
Karol Herbst
c7d09eca27 rusticl: add memory debugging
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Karol Herbst
da4de8d7e3 rusticl: add support for coarse-grain buffer SVM
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Karol Herbst
6e13e438d1 rusticl/kernel: add an SVM kernel argument value
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Karol Herbst
2fb8bb3c49 rusticl: move SVM allocation into core
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Karol Herbst
b65652b4be rusticl: implement cl_ext_buffer_device_address
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Karol Herbst
35a9829391 rusticl/kernel: rework validation in clSetKernelExecInfo
We should use the cl_slice code to get proper validation, which also makes
it simpler to read out data and gets rid of some UB there.

This also fixes CL_KERNEL_EXEC_INFO_SVM_PTRS with param_value being null.

Cc: mesa-stable
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Karol Herbst
c5411351ad rusticl/mesa: add util_vma_heap wrapper
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Karol Herbst
875fc911b6 rusticl/mesa: wrap new VM interfaces SVM edition
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Karol Herbst
1ff64f6ac1 rusticl/mesa: wrap new VM interfaces
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Karol Herbst
4027f0f30a lp: implement resource_get_address
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Karol Herbst
c449d1d063 zink: implement resource_get_address
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Karol Herbst
a04569b2ea zink: set unordered_read/write after buffer_barrier in set_global_binding
Fixes: a6e9e0f0d7 ("zink: add set_global_binding")
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Karol Herbst
8658529e88 gallium: new VM interfaces for SVM
The old interfaces added back in clover's time were modeled after a very
bindful resource model.

However SVM (shared virtual memory) requires us to be way more flexible.

The new interfaces allow frontends to create a cut-out in the GPU's vm and
to assign addresses themselves. This gives us the following benefits:
 - The frontend is empowered to synchronize resource addresses between
   several devices. cl_mem objects in OpenCL span across a set of multiple
   devices and SVM requires them to have the same VMA across all of them.
 - Coarse grain SVM can be implemented without bothering drivers too much
   as the frontend can be responsible to make sure a host allocation with
   a specific VMA matches a GPU allocation with the identical VMA.
 - Support for Global variables in the CrossWorkgroup storage class
   Initializers. Those can depend on addresses of CrossWorkgroup memory,
   if the frontend can just assign a VMA, this address can be passed as a
   constant to spirv_to_nir and folded without the need to support
   spilling of constant initializers.

Drivers not able to give us a vm-cutout are left with implementing
cl_ext_buffer_device_address instead.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Karol Herbst
9d7441dcb0 gallium: add fixed address resource API
cl_ext_buffer_device_address requires us to set a fixed address for a
given memory allocation. As this extension is intended to be implemented
on top of vulkan we have to take its limitations into account.

For SVM we'll add proper VM management interfaces, but zink won't be able
to implement those, so here we are.

The old interfaces added back in clover's time were modeled after a very
bindful resource model and the frontend was require to bind all the used
resources ahead of launch_grid.

cl_ext_buffer_device_address and also SVM however will require us to
dynamically attach a list of buffers used in a dispatch with known
addresses, hence set_global_binding isn't really suited for those use
cases.

So PIPE_RESOURCE_FLAG_FIXED_ADDRESS is added to tell a driver that the
address of a resource needs to stay the same over its lifetime, which then
can be queried via pipe_screen::resource_get_address.

All such buffers then can be either bound via set_global_binding or passed
in via pipe_grid_info::globals.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
2025-05-28 19:21:46 +00:00
Yiwei Zhang
28f051a024 panvk: drop bo refcount from panvk_image
The bound bo validity is blessed by the spec VU. No need to beat VVL in
userspace icd.

Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35197>
2025-05-28 18:06:57 +00:00
Yiwei Zhang
e9b7c88775 panvk: drop bo tracking from panvk_buffer
No longer needed.

Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35197>
2025-05-28 18:06:57 +00:00