Commit graph

216778 commits

Author SHA1 Message Date
Karol Herbst
85480200f8 nak: simplify SM80 HMMA latency categorization
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37941>
2025-10-21 20:12:30 +00:00
Karol Herbst
3bbf3f7826 nak: ensure deref has a ptr_stride in cmat load/store lowering
With untyped pointer we might get a deref_cast with a 0 ptr_stride. But we
were supposed to ignore the stride information on the pointer anyway, so
let's do that properly now.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Fixes: 05dca16143 ("nak: extract nir_intrinsic_cmat_load lowering into a function")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37941>
2025-10-21 20:12:30 +00:00
Karol Herbst
f632bfc715 nak: extract cmat load/store element offset calculation
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Fixes: 05dca16143 ("nak: extract nir_intrinsic_cmat_load lowering into a function")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37941>
2025-10-21 20:12:30 +00:00
Konstantin Seurer
d423554e9e radv/bvh: Pair compress triangles in more cases
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36965>
2025-10-21 19:32:55 +00:00
Konstantin Seurer
c0f332f1cb vulkan/bvh: Add leaf.h to vk_bvh_includes
Otherwise, the shader will not recompile when the file was modified.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36965>
2025-10-21 19:32:55 +00:00
Konstantin Seurer
020bd86d30 vulkan: Remove the vk_ir_triangle_node::id field
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36965>
2025-10-21 19:32:55 +00:00
Konstantin Seurer
c18a7d0e2b radv: Emit compressed primitive nodes on GFX12
The normal encode pass writes batches to a section in build scratch
memory. Those batches contain information about the internal node and
the primitive nodes. The encoder is split to avoid the register
pressure of the compressor and maximize occupancy.

The compressor works in two passes because one pass can not guarantee
that every primitive node (except) has at least two triangles. This
guarantee is used to advertise a smaller acceleration structure size to
the application.

During compression, every invocation processes at most two triangles.
Groups of 8 invocations are used to support the maximum triangle count
of 16 that the hardware supports.

The first step of compression is loading the triangle(s). Shared
vertices are deduplicated early to avoid doing it in the compression
loop. The compression loop tries to add triangles to a list of triangles
until the computed node size needed for storing the triangles reaches
the hardware node size. For this, each invocation first deduplicates
vertices with the triangles that have already been picked. It then
computes the node size of the picked triangles plus the candidate
triangles of the current invocation. The invocation that computed the
smallest size is added to the list.

Because it may not be possible to fit every triangle into the same node,
there can be multiple hardware nodes which are written in parallel for
optimal performance. If there are no nodes with only one triangle, all
nodes are written. If there is, compression of the batch is aborted and
the index of the batch is written to build scratch memory. The second
compression pass will repeat the steps above but only for those aborted
batches. The nodes with only one triangle can and are now merged.

It can not be determined during box node encode which triangles will be
compressed together so the encoder also has to fix up the parent box
node's child infos.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36965>
2025-10-21 19:32:55 +00:00
Konstantin Seurer
c5f9fe5e3b radv/rra/gfx12: Properly validate geometry indices
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36965>
2025-10-21 19:32:54 +00:00
Konstantin Seurer
82728380a2 vulkan/bvh: Add some debug helpers
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36965>
2025-10-21 19:32:54 +00:00
Konstantin Seurer
639cc4d937 vulkan: Bump MAX_ENCODE_PASSES to 4
Triangle compression will be performed in two extra passes.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36965>
2025-10-21 19:32:54 +00:00
Konstantin Seurer
6a53aae6b2 vulkan: Add vk_ir_header::driver_internal
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36965>
2025-10-21 19:32:54 +00:00
Konstantin Seurer
2ee8bfefe6 radv/bvh: Add radv_first_active_invocation
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36965>
2025-10-21 19:32:53 +00:00
Yiwei Zhang
bd53bbbc57 panvk: support VK_EXT_external_memory_acquire_unmodified
Upon acquiring an external image from external/foreign queue family,
skip AFBC metadata invalidation if the app has explicitly requested
acquireUnmodifiedMemory. This also applies to CRC which may or may not
get hooked up later.

Reviewed-by: John Anthony <john.anthony@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37972>
2025-10-21 19:15:58 +00:00
Konstantin Seurer
990f1868ec vulkan/cmd_queue: Free all elements of struct arrays
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37710>
2025-10-21 19:50:47 +02:00
Konstantin Seurer
a3e77fe5d2 vulkan/cmd_queue: Fix indentation for struct array copies
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37710>
2025-10-21 19:49:54 +02:00
Faith Ekstrand
38950083ae panvk: Fix integer dot product properties
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
We already set has_[su]dot_4x8[_sat] in nir_shader_compiler_options so
we're already getting the opcodes.  We just need to advertise the
features properly.  If bifrost_compile.h is to be believed, those are
all available starting at gen 9.

Closes: https://gitlab.freedesktop.org/panfrost/mesa/-/issues/218
Closes: https://gitlab.freedesktop.org/panfrost/mesa/-/issues/219
Fixes: f7f9b3d170 ("panvk: Move to vk_properties")
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37980>
2025-10-21 17:24:41 +00:00
Silvio Vilerino
d380e54422 d3d12: Fix d3d12_video_enc.cpp(4794,33): Error C4244: initializing: conversion from uint64_t to SIZE_T, possible loss of data
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:23:36 -07:00
Silvio Vilerino
44d8e999e2 mediafoundation: Also set pSyncObjectQueue = m_spStagingQueue when DX11 input sample
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:23:31 -07:00
Silvio Vilerino
d2cbbccaaa mediafoundation: Only wait on pSyncObjectQueue for stats completion if any stat was enabled
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:23:27 -07:00
Silvio Vilerino
4f7aa40222 mediafoundation: Allocate pro-rated buffer sizes for multi-slice encoding
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:23:21 -07:00
Silvio Vilerino
b454c35318 mediafoundation: Only use sliced mode when CODECAPI_AVEncSliceGenerationMode is set, disregarding num slices configured
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:23:11 -07:00
Silvio Vilerino
71aecf4a93 mediafoundation: SliceGeneration=1: Zero copy IMFSample output with wrapped ID3D12Resource frame/slice buffers
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:23:06 -07:00
Silvio Vilerino
45e56e4c96 d3d12: Only check for GetDeviceRemovedReason in debug builds
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:23:01 -07:00
Silvio Vilerino
4e1bb2111f d3d12: d3d12_promote_to_permanent_residency to accept res array batch
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:22:56 -07:00
Silvio Vilerino
07224f6d15 d3d12: Make output metadata frame buffer READBACK and use direct Map() in get_feedback
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:22:48 -07:00
Silvio Vilerino
e4d8a49fcd d3d12: Only check H264 video caps if configuration changed between frames
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:22:40 -07:00
Silvio Vilerino
8fd82cb339 d3d12: d3d12_video_encoder_get_slice_bitstream_data use regular Map/Unmap
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:22:34 -07:00
Silvio Vilerino
1dc76fcaa8 d3d12: Use readback heaps for staging bitstream allocations
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:22:30 -07:00
Silvio Vilerino
9b131f1407 d3d12: Video Encode - Make some parameters const & instead of by value
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:22:24 -07:00
Silvio Vilerino
1ffefc3e32 d3d12: Use cached heap allocations for output bitstreams instead of allocating per frame
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:22:18 -07:00
Silvio Vilerino
adbb07e927 d3d12: Use cached heap allocations for barriers instead of allocating per frame
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:22:14 -07:00
Silvio Vilerino
b076cfdf22 d3d12: Remove unused d3d12_video_encoder::m_transitionsBeforeCloseCmdList
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:22:10 -07:00
Silvio Vilerino
6f9c49f6f5 d3d12: Only check HEVC video caps if configuration changed between frames
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:22:05 -07:00
Silvio Vilerino
e3ab866fea d3d12: Only call CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO when video format changes
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:22:01 -07:00
Silvio Vilerino
ca2a1e470a d3d12: Remove per frame allocation slice_sizes(picture->num_slice_descriptors)
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:21:54 -07:00
Silvio Vilerino
53e07e78c7 d3d12: Cache ID3D12VideoEncodeCommandList4 instance if supported
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:21:50 -07:00
Silvio Vilerino
b1ea2b06eb d3d12: Cache ID3D12VideoEncoderHeap1 instance if supported
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:21:46 -07:00
Silvio Vilerino
a51c3b5bd0 d3d12: Cache ID3D12VideoDevice4 instance if supported
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:21:41 -07:00
Silvio Vilerino
702e299f33 d3d12: Remove multiple index calc in d3d12_video_encoder_prepare_input_buffers
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:21:36 -07:00
Silvio Vilerino
2ffaa9a9f4 d3d12: Remove multiple index calc in d3d12_video_encoder_begin_frame
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:21:31 -07:00
Silvio Vilerino
712607bbec d3d12: Optimize d3d12_video_encoder_flush
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:21:26 -07:00
Silvio Vilerino
63db1254ff d3d12: Use a separate queue for encode resolve operations
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:21:21 -07:00
Silvio Vilerino
416398aecb mediafoundation: Only attach stats to last slice mfsample
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:21:17 -07:00
Silvio Vilerino
80c8994455 mediafoundation: Add pLastSliceFence shortcircuit wait for auto slice mode async slices mode
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:21:12 -07:00
Silvio Vilerino
fd546c1cde mediafoundation: Refactor frame, multi slice and combine slice IMFSample emission to make it simpler
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:21:07 -07:00
Silvio Vilerino
f4f619e26e d3d12: Implement last slice signal by splitting Encode/Resolve in two ECL
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:21:01 -07:00
Silvio Vilerino
134274488d mediafoundation: Attach stats deferred buffers to all samples for simplicity
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:20:55 -07:00
Silvio Vilerino
b4592bbb77 mediafoundation: Add some more trace logging
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:20:49 -07:00
Silvio Vilerino
43112ce1a4 mediafoundation: Emit multiple MFSamples per slice when CODECAPI_AVEncSliceGenerationMode = 1i
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:20:43 -07:00
Silvio Vilerino
3de675eef5 mediafoundation: Prepare for multi sample multi slice
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:20:38 -07:00