Samuel Pitoiset
5062f6196f
radv: replace DGC before/after dispatch helpers with the new ones
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36355 >
2025-08-04 11:05:46 +00:00
Samuel Pitoiset
8c37fbd531
radv: add radv_{before,after}_dispatch() functions
...
Similar to graphics.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36355 >
2025-08-04 11:05:46 +00:00
Samuel Pitoiset
23e6494148
radv: handle compute/rt prefetch like graphics
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36355 >
2025-08-04 11:05:46 +00:00
Samuel Pitoiset
b7e5bda3e2
radv: rework graphics shaders/vbos prefetch sligthly
...
To add compute/rt support.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36355 >
2025-08-04 11:05:46 +00:00
Samuel Pitoiset
23bc1cac86
radv: stop passing compute shader to radv_dispatch()
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36355 >
2025-08-04 11:05:45 +00:00
Samuel Pitoiset
40ceece75f
radv: invalidate compute/rt descriptors at pipeline bind time
...
No need to delay this.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36355 >
2025-08-04 11:05:45 +00:00
Konstantin Seurer
596ee84f16
radv: Use vk_acceleration_struct_vtx_format_supported
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36441 >
2025-08-04 08:43:07 +00:00
Alyssa Rosenzweig
82ae8b1d33
treewide: simplify nir_def_rewrite_uses_after
...
Most of the time with nir_def_rewrite_uses_after, you want to rewrite after the
replacement. Make that the default thing to be more ergonomic and to drop
parent_instr uses.
We leave nir_def_rewrite_uses_after_instr defined if you really want the old
signature with an arbitrary after point.
Via Coccinelle patch:
@@
expression a, b;
@@
-nir_def_rewrite_uses_after(a, b, b->parent_instr)
+nir_def_rewrite_uses_after_def(a, b)
Followed by a bunch of sed.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36489 >
2025-08-01 15:34:24 +00:00
Alyssa Rosenzweig
cc6e3b84cb
treewide: use nir_def_as_*
...
Via Coccinelle patch:
@@
expression definition;
@@
-nir_instr_as_alu(definition->parent_instr)
+nir_def_as_alu(definition)
@@
expression definition;
@@
-nir_instr_as_intrinsic(definition->parent_instr)
+nir_def_as_intrinsic(definition)
@@
expression definition;
@@
-nir_instr_as_phi(definition->parent_instr)
+nir_def_as_phi(definition)
@@
expression definition;
@@
-nir_instr_as_load_const(definition->parent_instr)
+nir_def_as_load_const(definition)
@@
expression definition;
@@
-nir_instr_as_deref(definition->parent_instr)
+nir_def_as_deref(definition)
@@
expression definition;
@@
-nir_instr_as_tex(definition->parent_instr)
+nir_def_as_tex(definition)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36489 >
2025-08-01 15:34:24 +00:00
Antonio Ospite
ddf2aa3a4d
build: avoid redefining unreachable() which is standard in C23
...
In the C23 standard unreachable() is now a predefined function-like
macro in <stddef.h>
See https://android.googlesource.com/platform/bionic/+/HEAD/docs/c23.md#is-now-a-predefined-function_like-macro-in
And this causes build errors when building for C23:
-----------------------------------------------------------------------
In file included from ../src/util/log.h:30,
from ../src/util/log.c:30:
../src/util/macros.h:123:9: warning: "unreachable" redefined
123 | #define unreachable(str) \
| ^~~~~~~~~~~
In file included from ../src/util/macros.h:31:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:456:9: note: this is the location of the previous definition
456 | #define unreachable() (__builtin_unreachable ())
| ^~~~~~~~~~~
-----------------------------------------------------------------------
So don't redefine it with the same name, but use the name UNREACHABLE()
to also signify it's a macro.
Using a different name also makes sense because the behavior of the
macro was extending the one of __builtin_unreachable() anyway, and it
also had a different signature, accepting one argument, compared to the
standard unreachable() with no arguments.
This change improves the chances of building mesa with the C23 standard,
which for instance is the default in recent AOSP versions.
All the instances of the macro, including the definition, were updated
with the following command line:
git grep -l '[^_]unreachable(' -- "src/**" | sort | uniq | \
while read file; \
do \
sed -e 's/\([^_]\)unreachable(/\1UNREACHABLE(/g' -i "$file"; \
done && \
sed -e 's/#undef unreachable/#undef UNREACHABLE/g' -i src/intel/isl/isl_aux_info.c
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36437 >
2025-07-31 17:49:42 +00:00
Georg Lehmann
4683187f49
radv/nir/lower_cmat: load gfx11 8bit ACC using the B layout to get aligned loads
...
This allows us to use aligned loads that can be vectorized, without any
downside as 8bit scalar loads always write 16bits of a register.
Foz-DB Navi31:
Totals from 10 out of 14 FSR4 shader:
MaxWaves: 71 -> 68 (-4.23%)
Instrs: 60146 -> 59781 (-0.61%); split: -0.67%, +0.06%
CodeSize: 412448 -> 413428 (+0.24%); split: -0.11%, +0.35%
VGPRs: 2112 -> 2160 (+2.27%)
SpillVGPRs: 89 -> 68 (-23.60%)
Scratch: 11776 -> 8704 (-26.09%)
Latency: 196628 -> 193770 (-1.45%); split: -2.62%, +1.17%
InvThroughput: 224944 -> 226274 (+0.59%); split: -0.02%, +0.61%
VClause: 862 -> 796 (-7.66%)
Copies: 3166 -> 3342 (+5.56%); split: -6.22%, +11.78%
Branches: 37 -> 38 (+2.70%)
PreSGPRs: 311 -> 312 (+0.32%)
PreVGPRs: 2153 -> 2214 (+2.83%); split: -1.35%, +4.18%
VALU: 51073 -> 51448 (+0.73%); split: -0.03%, +0.77%
SALU: 1072 -> 1074 (+0.19%)
VMEM: 3275 -> 2765 (-15.57%)
VOPD: 1739 -> 1783 (+2.53%); split: +7.99%, -5.46%
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36117 >
2025-07-30 07:25:51 +00:00
Marek Olšák
8d3e76c250
nir: split nir_move_load_frag_coord from nir_move_load_input
...
It's a pure system value on AMD, not an input.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36357 >
2025-07-29 16:20:48 -04:00
Antonio Ospite
0dd8051f34
radv: fix returning _Bool instead of pointer
...
When building for C23 the compiler warns about returning a boolean when
a different type is expected instead.
Change the code to return NULL instead of false, fixing the following
errors:
-----------------------------------------------------------------------
../src/amd/vulkan/radv_pipeline_cache.c: In function ‘radv_pipeline_cache_object_search’:
../src/amd/vulkan/radv_pipeline_cache.c:338:14: error: incompatible types when returning type ‘_Bool’ but ‘struct radv_pipeline_cache_object *’ was expected
338 | return false;
| ^~~~~
../src/amd/vulkan/radv_pipeline_cache.c:352:14: error: incompatible types when returning type ‘_Bool’ but ‘struct radv_pipeline_cache_object *’ was expected
352 | return false;
| ^~~~~
-----------------------------------------------------------------------
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36323 >
2025-07-29 14:07:06 +00:00
llyyr
c869971d05
radv: don't set HOST_IMAGE_TRANSFER_BIT if host_image_copy not enabled
...
This can't work if the extension isn't enabled, so only set if the
extension is enabled.
Fixes: d89b11011f ("radv: add support for formats with host-transfer")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36400 >
2025-07-29 13:48:59 +00:00
David Rosca
cc7178b9eb
radv/video: Use the new defines for H264 SPS info flags
...
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
...
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