Commit graph

10467 commits

Author SHA1 Message Date
David Rosca
cc7178b9eb radv/video: Use the new defines for H264 SPS info flags
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Also set gaps_in_frame_num_value_allowed_flag.

Cc: mesa-stable
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36225>
2025-07-25 09:32:08 +00:00
Konstantin Seurer
48d15c3cf8 radv/bvh: Specialize the update shader for geometryCount==1
The geometry data can be loaded from push constants in that case.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35445>
2025-07-25 09:05:13 +00:00
Konstantin Seurer
b20ab07e4a radv/bvh: Update leaf nodes before refitting
This should reduce latency between refitting nodes and their parent
nodes.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35445>
2025-07-25 09:05:13 +00:00
Konstantin Seurer
33a694fe9b radv: Initialize base IDs when doing a BVH update with src!=dst
Fixes: 2d48b2c ("radv: Use subgroup OPs for BVH updates on GFX12")
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35445>
2025-07-25 09:05:12 +00:00
Konstantin Seurer
4a4251dc16 radv/bvh: Use a fixed indices midpoint on GFX12
This saves a couple of loads inside the update shader.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35445>
2025-07-25 09:05:12 +00:00
Konstantin Seurer
7ad02416f6 radv/bvh: Fix flush in bit_writer_skip_to
If temp is not cleared, the next flushed dword will contain data from
the previous one.

Fixes: 97f6287 ("radv: Use the BVH8 format on GFX12")
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35445>
2025-07-25 09:05:11 +00:00
Konstantin Seurer
6201e24307 radv: Only write leaf node offsets when required
They are only used for serialization and position fetch which makes them
unnecessary most of the times.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35445>
2025-07-25 09:05:11 +00:00
Konstantin Seurer
703a154f29 radv: Add and use RADV_OFFSET_UNUSED
This deduplicates the logic to figure out what needs to be written.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35445>
2025-07-25 09:05:10 +00:00
David Rosca
1dda9d56cb radv/video: Disable rate control modes for H265 encode on VCN1
VCN1 doesn't have FW interface to enable cu_qp_delta with rate control
disabled, which means we can only support either rate control enabled or
disabled. Spec requires VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR
to always be supported, thus the rate control modes needs to be disabled
on VCN1.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36353>
2025-07-25 08:46:14 +00:00
David Rosca
627fdb368d radv/video: Fix session_init and rc_per_pic on VCN2
Cc: mesa-stable
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36353>
2025-07-25 08:46:14 +00:00
David Rosca
c11508ad41 radv/video: Fix setting H265 encode cu_qp_delta on VCN2
Fixes H265 encoding with rate control disabled.

Cc: mesa-stable
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36353>
2025-07-25 08:46:13 +00:00
David Rosca
70473690f5 radv/video: Fix encode bitstream buffer offset and alignment
Caused issues on VCN2.

Cc: mesa-stable
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36353>
2025-07-25 08:46:13 +00:00
David Rosca
a30f91b71a radv/video: Add more encode session params overrides
Cc: mesa-stable
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36353>
2025-07-25 08:46:13 +00:00
David Rosca
e3715df4ee radv/video: Send slice control, spec misc and deblocking params every frame
These params can change per frame, so we need to send the values
to firmware on every frame instead of only once at session init.

Cc: mesa-stable
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36353>
2025-07-25 08:46:12 +00:00
David Rosca
947e647df8 radv/video: Always send the latency command
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36353>
2025-07-25 08:46:12 +00:00
David Rosca
8368e3519e radv/video: Set H264 encode cabac_init_idc and Cb/Cr QP offsets
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36353>
2025-07-25 08:46:11 +00:00
David Rosca
df42301531 radv/video: Remove disabled slice header code for field encoding
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36353>
2025-07-25 08:46:11 +00:00
David Rosca
75c01206dc radv: Reject linear modifier for video decode DPB
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36311>
2025-07-25 07:28:41 +00:00
David Rosca
b242c27c15 radv/video: Remove 10 to 8bit dithering support
Only one format is supported now, so this is not needed.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36311>
2025-07-25 07:28:41 +00:00
David Rosca
4659be2c8b radv/video: Rework GetPhysicalDeviceVideoFormatPropertiesKHR
Check if the profile is supported. Only return one format that
is supported by all requested profiles. Return error if the
requested profiles can't share the same format.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36311>
2025-07-25 07:28:41 +00:00
David Rosca
52fa173557 radv/video: Add radv_video_is_profile_supported
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36311>
2025-07-25 07:28:40 +00:00
David Rosca
8f6ceed8f5 radv/video: Set encodeInputPictureGranularity for AV1 encode
Fixes: 37e71a5cb2 ("radv/video: add support for AV1 encoding")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36311>
2025-07-25 07:28:40 +00:00
David Rosca
fd0c70aded radv/video: Add bit depth and profile check for VP9 decode
Fixes: b8ac2d47e7 ("radv/video: add KHR_video_decode_vp9 support.")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36311>
2025-07-25 07:28:40 +00:00
David Rosca
bdad9e7e48 radv/video: Add bit depth and profile check for AV1 encode
Fixes: 37e71a5cb2 ("radv/video: add support for AV1 encoding")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36311>
2025-07-25 07:28:39 +00:00
Marek Olšák
09e607c385 nir: add access to load_smem_amd (for ACCESS_CAN_SPECULATE)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36099>
2025-07-24 18:41:38 +00:00
Samuel Pitoiset
e64b0eda56 radv: remove dead ES emit code on GFX12
This is never reached because VS as ES means it's merged into GS as NGG.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36293>
2025-07-24 11:03:27 +00:00
Samuel Pitoiset
081c7ec7b1 radv: emit PGM_HI_PS in the gfx preamble on GFX12
It never changes.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36293>
2025-07-24 11:03:27 +00:00
Samuel Pitoiset
0cd745c386 radv: fix a memleak with GS copy shader NIR
Really need to refactor this code...

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36317>
2025-07-24 08:09:00 +00:00
Marek Olšák
8308e394ef radv: don't sink VS input loads and move them to the top
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This is likely to be faster.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35950>
2025-07-24 06:31:17 +00:00
Marek Olšák
4c8a757951 radv,radeonsi: mark VS input loads and poly stipple load speculatable
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35950>
2025-07-24 06:31:17 +00:00
Marek Olšák
543fddb01b ac/llvm: always use opaque pointers
LLVM removed typed pointers a long time ago. These types and bitcasts
had no effect.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35950>
2025-07-24 06:31:16 +00:00
Alyssa Rosenzweig
8a1a410389 treewide: use SWAP macro
Via Coccinelle patch + manual clean up:

    @@
    identifier temporary, a, b;
    type T;
    @@

    -T temporary = a;
    -a = b;
    -b = temporary;
    +SWAP(a, b);

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36297>
2025-07-23 19:49:47 +00:00
David Rosca
ad11e826b7 radv/video: Don't allow DRM format modifier tiling on GFX < 9
Fixes: 566ea76d8e ("radv/video: Support DRM format modifier tiling")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36288>
2025-07-22 16:19:54 +00:00
Konstantin Seurer
e5af8152eb radv/rra/gfx12: Add validation
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35166>
2025-07-22 14:40:33 +00:00
Konstantin Seurer
a61f78b8f4 radv/rra/gfx12: Handle box nodes without children
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35166>
2025-07-22 14:40:33 +00:00
Konstantin Seurer
f33623ea5f radv/rra: Increase rra_validation_context::location
31 bytes aren't always enough for storing the string.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35166>
2025-07-22 14:40:33 +00:00
Konstantin Seurer
e62c464e4e radv/rra: Only write used BLAS
Halves the size of cp2077 captures.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35166>
2025-07-22 14:40:33 +00:00
Natalie Vock
87ebe6b31a radv/winsys: Support vm_always_valid in the NULL winsys
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
A few device features (most importantly bufferDeviceAddress) are behind
a check for has_vm_always_valid. When replaying fossilize captures using
SPIR-V capabilities like PhysicalStorageBuffer addresses (which itself
depends on bufferDeviceAddress) on a null device, these features will be
hidden and replay will fail. Claim vm_always_valid support in the null
winsys - it's not like we'll ever create any BOs anyway.

Fixes: df1224c8 ("radv: rework VM_ALWAYS_VALID handling")
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36221>
2025-07-22 07:38:25 +00:00
Samuel Pitoiset
9f725cf348 radv: reject 1D block-compresed formats with mips on GFX6
GFX6 has general issues with 1D BCn formats.

Fixes recent VKCTS coverage
dEQP-VK.api.copy_and_blit.*image_to_buffer.1d_images.mip_copies_*.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36259>
2025-07-22 06:09:54 +00:00
Samuel Pitoiset
1323a1194e radv: fix reporting instance/vertex_count for direct draws with RGP on GFX12
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This is a cursed interaction with RGP...

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36188>
2025-07-22 05:52:10 +00:00
Samuel Pitoiset
aa80a08598 radv: simplify emitting SQTT shaders relocation for GFX6-GFX11.5
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36188>
2025-07-22 05:52:10 +00:00
Samuel Pitoiset
9965a344ae radv: fix SQTT shaders relocation on GFX12
This fixes reporting ISA and instruction timing with RGP.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13525
Fixes: 098c15bfc9 ("radv: use paired shader registers for graphics on GFX12")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36188>
2025-07-22 05:52:10 +00:00
Georg Lehmann
0fce848b54 radv: vectorize 8/16bit bitfield_select
No Foz-DB changes.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36141>
2025-07-21 20:42:32 +00:00
Alyssa Rosenzweig
b7304f180e radv: remove redundant nir->info.internal = true
this is already set when building the gs copy shader since it is a nir_builder
simple shader

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36050>
2025-07-21 12:11:42 +00:00
Alyssa Rosenzweig
6b34e2174e nir: introduce ergonomic tex builder
for intrinsics, we have these really nice builders using designated initializers
+ macros to specify optional indices. texture instrs have even more craziness
involved, but we can do the same trick. this commit takes the existing "fixed
form" deref-centric tex builders and generalizes them to work with non-deref
textures, making it useful also for GL and late VK passes, while providing an
API that strives to be ergonomic and consistent.

this series only implements a subset of possible texture operations for now, but
more generalizing could be added as people have need.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36050>
2025-07-21 12:11:41 +00:00
David Rosca
566ea76d8e radv/video: Support DRM format modifier tiling
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36192>
2025-07-21 10:56:34 +00:00
David Rosca
211dc09e0f radv/video: Fix encode when using layered source image
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Found by inspection.

Cc: mesa-stable
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36214>
2025-07-21 09:52:47 +00:00
Samuel Pitoiset
49e49d7dde radv: add RADV_DEBUG=novideo to disable all video extensions
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
It's useful when video support has issues.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36186>
2025-07-21 07:20:12 +00:00
Samuel Pitoiset
af22d5c97d radv: use vk_optimize_depth_stencil_state() for optimal settings
For apps that aren't optimized.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36168>
2025-07-21 06:53:40 +00:00
Samuel Pitoiset
79c02a3388 radv: adjust conservative rasterization configuration on GFX12
PAL doesn't set these two registers either.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36196>
2025-07-21 06:26:48 +00:00