Commit graph

201327 commits

Author SHA1 Message Date
Alyssa Rosenzweig
007f60c8b8 util/u_printf: add singleton implementation
Currently, nir_lower_printf depends on a per-nir_shader table, writing out
indices into the printf buffer. This works for real OpenCL implementations
(rusticl, microsoft) which can associate the printf buffer with a particular
kernel, I guess. (Actually it's not clear to me that it works well there either
but that's not my problem.)

This mechanism is unsuitable for internal driver shaders, where printfs with
unique format strings can come from many different nir_shaders. There are two
current solutions in tree to this for driver CL:

* Honeykrisp: Only use one single nir_shader (libagx). This prevents us from
  using printf in common CL and requires extra driver tracking. It won't work
  with my upcoming vtn_bindgen rework, which is why I'm addressing this now.

* Anv: Offset format-string indices by a dynamic "base identifier" using relocs
  or a push constant, then pool format strings into a table from nir_shader's
  across the device. The problem here is that these indices now depend on the
  order that nir_shaders are seen (which causes a mess for caching if relocs are
  used, or requires extra push constants and extra bookkeping if relocs aren't
  used). And the driver tracking required to do this pooling correctly is even
  more complicated than what Honeykrisp does. I do not want every driver in-tree
  needing to go down this path, and it wouldn't work with my upcoming
  vtn_bindgen.

This MR introduces an alternate approach: rather than writing indices into the
table, we instead hash the format string itself and write the hash. That doesn't
depend on what nir_shader we came from, so we can freely mix & match and get
consistent hashes. That greatly alleviates driver tracking burden. To make that
possible, we need a global hash table mapping hashed format identifiers to the
format strings themselves.

That approach still requires a step to "register" format strings into the table.
That step would not be required if we wrote the actual strings themselves into
the table, but that was ruled out for performance/code size reasons. However, we
do not want drivers to need to explicitly register all the strings they use,
because once we have OpenCL in common code via vtn_bindgen2, drivers won't know
all the strings they use. Fortunately, there's a neat solution for that too.

By making this global table a singleton (with internal locking), vtn_bindgen2
can automatically register format strings via a static constructor. In
conjunction with the infrastructure added here, that eliminates all driver
bookkeeping required for format-strings.

The code itself is inspired by the glsl type singleton. Is it pretty? Not
really, but it gets the job done well.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33067>
2025-01-17 18:09:45 +00:00
Alyssa Rosenzweig
48dbfba17a util: add u_printf_hash helper
for hash-based printf. this just shells out to XXH - convenience wrapper.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33067>
2025-01-17 18:09:45 +00:00
Alyssa Rosenzweig
e1368f0a30 nir,util: move printf serializing into util
there's nothing NIR specific here and these routines will be useful otherwise.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33067>
2025-01-17 18:09:45 +00:00
Alyssa Rosenzweig
47e16cab5e nir/lower_printf: drop default max buffer size
no uses and it doesn't make sense.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33067>
2025-01-17 18:09:45 +00:00
Alyssa Rosenzweig
621ff262bc nir/lower_printf: drop null check
we derefernce options above.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33067>
2025-01-17 18:09:45 +00:00
Alyssa Rosenzweig
e7a1d704d0 intel: set max_buffer_size to nir_lower_printf
instead of relying on an implicit value which doesn't make much sense.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33067>
2025-01-17 18:09:45 +00:00
Gurchetan Singh
61d66a6ea7 gfxstream: fix some integration bugs
- Fix end2end test target (AOSP-only)
- Fix decoder to use host vk_util.h, not guest
- typo fixes

Reviewed-by: Marcin Radomski <dextero@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33077>
2025-01-17 17:26:45 +00:00
Samuel Pitoiset
78f5dfca86 vulkan: Update XML and headers to 1.4.305
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33089>
2025-01-17 16:42:27 +00:00
Mike Blumenkrantz
667745857d lavapipe: handle VK_REMAINING_ARRAY_LAYERS with HIC
this otherwise goes oob and crashes

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33071>
2025-01-17 15:35:09 +00:00
Lu Yao
7679102b45 zink: fix decomposed_attrs val error when zink_vs_key->size is 4
decomposed_attrs and decomposed_attrs_without_w should get from vs->u32
when zink_vs_key->size is 4.

Fixes: 19fbdb9064 ("zink: move shader keys to be persistent on pipeline state")
Signed-off-by: Lu Yao <yaolu@kylinos.cn>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33079>
2025-01-17 14:51:49 +00:00
Karol Herbst
0b6446efe2 rusticl/mem: use get_res_for_access instead of get_res_of_dev
Fixes multi-device cl_mem support.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32581>
2025-01-17 14:09:39 +00:00
Karol Herbst
2c2c06b93e rusticl/mem: add Allocation::is_user_alloc_for_dev
get_res_of_dev will entirely be reworked, but there is one user only
wanting to know if the allocation is a user_ptr one.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32581>
2025-01-17 14:09:39 +00:00
Karol Herbst
de8b2f108e rusticl/mem: rework last user of get_parent() and remove it
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32581>
2025-01-17 14:09:39 +00:00
Karol Herbst
944f47f103 rusticl/mem: reimplement has_same_parent and rename it to backing_memory_eq
We actually want to know if the backing memory is the same, it's also
easier to implement than checking on the parent memory object.

This will also allow for more flexibility if more memory types are
supported, e.g. proper SVM allocations.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32581>
2025-01-17 14:09:39 +00:00
Karol Herbst
787d3b0ffc rusticl/mem: add Allocation type
This will handle the raw memory operations in the future, mostly focused
on guaranteeing consistency across devices.

It also handles sub allocation because it is the better place of tracking
this.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32581>
2025-01-17 14:09:38 +00:00
Karol Herbst
e118fb6492 rusticl/mem: simplify is_svm implementation
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32581>
2025-01-17 14:09:38 +00:00
Karol Herbst
e74ad38204 rusticl/device: add unsynchronized mapping functions to helper context
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32581>
2025-01-17 14:09:38 +00:00
Zan Dobersek
0cf29bf0ce freedreno/a7xx: fix fd_lrzfc_layout
Various vkd3d-proton tests run via Turnip exposed an issue with the
a7xx-specific instantiation of the fd_lrzfc_layout struct used to allocate
memory for LRZ fast-clear operations.

The correct layout is quite bigger in size, and the duplicated FC buffers
are positioned at the beginning and the end of it. Smaller part of the area
in the middle is used for metadata, but it already seems to be used more
extensively than how we currently understand it.

Fixes in vkd3d-proton on tu/a750:
  test_clear_depth_stencil_view
  test_copy_texture
  test_early_depth_stencil_tests

Signed-off-by: Zan Dobersek <zdobersek@igalia.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33080>
2025-01-17 13:32:38 +00:00
Caleb Callaway
aae9a2c399 docs: clarify ASPM performance tips
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33052>
2025-01-17 13:21:38 +00:00
Valentine Burley
de6f654b60 pan/ci: Document some flakes
Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33086>
2025-01-17 12:50:20 +00:00
Erik Faye-Lund
90d5366b2a pan/ci: drop empty trailing variables-list
This job is somehow failing to expand $RUNNER_TAG, and it seems to have
happened around the time that the last entry from the variables list was
removed.

Let's remove this, it's no longer needed anyway. And it seems to fix the
problem, so yay.

Fixes: 61d9c47944 ("ci/lava: Use CI_JOB_TIMEOUT instead of separate variable")
Reviewed-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33086>
2025-01-17 12:50:20 +00:00
Vignesh Raman
3f8046fd3e ci: export RESULTS_DIR in crosvm-script.sh
Export the RESULTS_DIR environment variable in crosvm-script.sh
to ensure it points to the correct directory. Without this,
artifacts are not generated because the results directory is
created in the wrong location after the directory changes in the VM.

Also fix https://www.shellcheck.net/wiki/SC2129 shellcheck error.

Suggested-by: Eric Engestrom <eric@igalia.com>
Signed-off-by: Vignesh Raman <vignesh.raman@collabora.com>
Reviewed-by: Eric Engestrom <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33023>
2025-01-17 12:08:49 +00:00
Erik Faye-Lund
2f168fe92c docs/features: mark panfrost as supporting GL_OES_texture_view
We've been supporting this for a while, let's make sure it's documented
correctly.

Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33057>
2025-01-17 12:00:14 +00:00
Erik Faye-Lund
1e8a017de3 docs/features: add a few missing extensions
Here's a few extensions we've forgotten to report in features.txt

Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33057>
2025-01-17 12:00:14 +00:00
Samuel Pitoiset
c84b1dda0b ac/nir: fix skipping streamout when no buffers are bound on GFX12
RadeonSI compiles shader variants with streamout disabled but RADV
doesn't do that. The alternative solution is to set the streamout
buffer size to 0 to indicate that streamout isn't bound.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33058>
2025-01-17 11:24:55 +00:00
Samuel Pitoiset
ede0d534ef radv: add GFX12 support to the null winsys
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33063>
2025-01-17 10:51:49 +00:00
Erik Faye-Lund
3f8a524c20 pan/ci: add some occasional flakes
Seen here:
- https://gitlab.freedesktop.org/mesa/mesa/-/jobs/69214799
- https://gitlab.freedesktop.org/mesa/mesa/-/jobs/69214804
- https://gitlab.freedesktop.org/mesa/mesa/-/jobs/69355263
- https://gitlab.freedesktop.org/mesa/mesa/-/jobs/69431828
- https://gitlab.freedesktop.org/mesa/mesa/-/jobs/69487494
- https://gitlab.freedesktop.org/mesa/mesa/-/jobs/69487495

Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33028>
2025-01-17 10:27:21 +00:00
Pierre-Eric Pelloux-Prayer
3842d10dd7 radeonsi: do not use std::max
Use MAX2 and abs to avoid build failures on some platforms.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12434
Fixes: dc293ffe50 ("radeonsi: fallback to util_blitter_draw_rectangle")
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32959>
2025-01-17 09:55:45 +00:00
Pierre-Eric Pelloux-Prayer
9d4d9e6150 ac/llvm: enable wqm for ac_build_quad_swizzle from ac_build_fs_interp_mov
Without this, WQM is only used for the lds_param_load like this:

   s_wqm_b64 exec, exec
   lds_param_load v5, attr0.x wait_vdst:15
   s_mov_b64 exec, s[0:1]
   v_mov_b32_dpp v5, v5 quad_perm:[0,0,0,0] row_mask:0xf bank_mask:0xf

With this change we get:
   s_wqm_b64 exec, exec
   lds_param_load v5, attr0.x wait_vdst:15
   s_mov_b64 exec, s[0:1]
   ...
   s_wqm_b64 exec, exec
   v_mov_b32_dpp v5, v5 quad_perm:[0,0,0,0] row_mask:0xf bank_mask:0xf
   s_mov_b64 exec, s[0:1]

This fixes KHR-GL46.shaders.uniform_block.random.nested_structs_instance_arrays.0
and other similar tests with LLVM.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32959>
2025-01-17 09:55:45 +00:00
Pierre-Eric Pelloux-Prayer
182d662ccf ac/llvm: add wqm param to ac_build_quad_swizzle
And to ac_build_dpp because it's used from quad_swizzle.

No functional changes but will be used in the next commit.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32959>
2025-01-17 09:55:45 +00:00
Pierre-Eric Pelloux-Prayer
b4e94cf421 ttn: init source_blake3 and name from tgsi_shader_info
All TTN shaders have the same name ('TTN') and the same empty blake3.
Having a unique name and blake3 makes it easier to distinguish them
when using NIR_DEBUG=print...

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> (v1)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32959>
2025-01-17 09:55:45 +00:00
Pierre-Eric Pelloux-Prayer
59a3f38ff6 radeonsi: clear the debug callback on ctx destroy
The debug callback depends on the context to operate properly,
so we need to clear it on destroy to avoid a use-after-free.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12035
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32959>
2025-01-17 09:55:45 +00:00
Georg Lehmann
71cb394b02 aco: implement some more std::vector functions for small_vec
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33043>
2025-01-17 09:25:48 +00:00
Georg Lehmann
31de188bc2 aco: support less trivial component types in small_vec
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33043>
2025-01-17 09:25:48 +00:00
Georg Lehmann
15cba08db0 aco: guard small_vector move/copy operator against self assignment
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33043>
2025-01-17 09:25:48 +00:00
David Rosca
3c7c059cee radeonsi: Enable implemented VCE/UVD encode features
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
b6b5261f4c radeonsi/uvd_enc: Set input pic swizzle mode on GFX9
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
73657d4246 radeonsi/uvd_enc: Support raw packed headers
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
da9de889aa radeonsi/uvd_enc: Support dynamic rate control changes
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
186980de26 radeonsi/uvd_enc: Support min/max QP and max frame size
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
035adff0e2 radeonsi/uvd_enc: Support temporal layer rate control
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
7b1210a026 radeonsi/uvd_enc: Support intra refresh
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
8a2266ab0b radeonsi/uvd_enc: Support slice encoding
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
dac4e4bd6a radeonsi/uvd_enc: Support quality presets
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
d4d4a64168 radeonsi/uvd_enc: Support VBAQ
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
89d43c0fd3 radeonsi/uvd_enc: Support Pre-Encode
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
7570311269 radeonsi/uvd_enc: Consider input surface size for padding
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
1f5e857d85 radeonsi/uvd_enc: Use app DPB management
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
98f711859d radeonsi/uvd_enc: Rework DPB allocation
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00
David Rosca
ccb450b91c radeonsi/uvd: Set decode target swizzle mode on GFX9
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32829>
2025-01-17 08:53:05 +00:00