Commit graph

200653 commits

Author SHA1 Message Date
Caterina Shablia
f77a50e45e pan/bi: add a MEMORY_BARRIER pseudo-instruction
This is purely a scheduling barrier for memory instructions. We
need this to implement subgroup barriers.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32710>
2025-01-22 21:49:52 +00:00
Caterina Shablia
39bd5cba68 pan/bi: lower the rest of subgroup ops using nir_lower_subgroups
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32710>
2025-01-22 21:49:51 +00:00
Caterina Shablia
d5c5528e06 pan/bi: lower some subgroup intrinsics
Lower vote_any, vote_all, load_subgroup_id, load_subgroup_size and
load_num_workgroups.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32710>
2025-01-22 21:49:51 +00:00
Caterina Shablia
1b59b9edee pan/bi: handle ballot, ballot_relaxed and as_uniform
Implement as_uniform with a simple mov, as the HW doesn't have
uniform registers (registers shared by all threads in the warp)
like some other hardware does.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32710>
2025-01-22 21:49:51 +00:00
Caterina Shablia
a73a0592d6 pan/bi: handle read_invocation
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32710>
2025-01-22 21:49:51 +00:00
Caterina Shablia
47ed7d90af pan/va: fix WMASK packing
WMASK's subgroup argument wasn't being encoded so we'd always
end up with a WMASK.subgroup2.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32710>
2025-01-22 21:49:51 +00:00
Caterina Shablia
a96de77f8b pan/bi: fix a typo
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32710>
2025-01-22 21:49:51 +00:00
Lars-Ivar Hesselberg Simonsen
7b949dd8c4 panvk: Use LD_VAR_BUF[_IMM] when possible
If we determine that the amount of varyings will fit within the 8-bit
offset of LD_VAR_BUF[_IMM], instruct the compiler to use it for varyings
and skip setting up Attribute Descriptors.

This should save a bit of memory and overhead in reading varyings.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32969>
2025-01-22 20:57:18 +00:00
Lars-Ivar Hesselberg Simonsen
de86641d3f panvk: Limit AD allocation to max var loads in v9+
Introduce a varying load count pass to get the maximum amount of varying
loads from a fragment shader (prior to optimization passes), in order to
only allocate as many Attribute Descriptors as required. This will
generally lead to smaller buffers in SRT0 for fragment shaders.

As the amount of ADs is now dynamic based on the shader, we need to
lower varying loads early for fragment shaders in v9+, as the amount of
ADs will determine the offset for dummy_sampler, required during
nir_lower_descriptors.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32969>
2025-01-22 20:57:18 +00:00
Lars-Ivar Hesselberg Simonsen
6d5ae5b3af panvk: Use LD_VAR[_IMM] + ADs for varyings
The current implementation uses LD_VAR_BUF[_IMM] to look up varyings,
which limits the number of varying components to 64 due to an 8-bit
offset value.

As this does not align to maxVertexOutputComponents (128), this change
replaces the use of LD_VAR_BUF[_IMM] with LD_VAR[_IMM] + Attribute
Descriptors, which do not have this limitation.

As allocating Attribute Descriptors is potentially expensive, this can
be further optimized by falling back to LD_VAR_BUF[_IMM] in cases where
we can ensure we do not use more than 64 varying components.

This change currently does not change behavior for gallium/panfrost,
though that should be done as well.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32969>
2025-01-22 20:57:18 +00:00
Lars-Ivar Hesselberg Simonsen
7881d19d01 pan/genxml: Fix vertex_packet Attribute on v9+
The fields "Attribute stride" and "Packet stride" are in the wrong
order, and "Packet stride" should not be shr() modified.

This has probably not shown up as an issue before due to the use of
LD_VAR_BUF[_IMM] for varyings, which does not require us to create
Attribute Descriptors with type vertex_packet.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32969>
2025-01-22 20:57:18 +00:00
Valentine Burley
d57beebc8d freedreno/ci: Update expectations
Most of these results changed in https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31942.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33158>
2025-01-22 20:26:15 +00:00
Mike Blumenkrantz
e1e622dfb0 zink: fix viewport detection when switching last stage shaders
the previous code checked e.g., VS -> GS binding, but it did not
correctly handle VS -> VS in order to toggle viewport state

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33144>
2025-01-22 17:07:53 +00:00
duncan.hopkins
4fa9c7d241 zink: stop zink_set_primitive_emulation_keys producing geometry shaders on platforms that do not support them.
If line smooth, stipple, quad_prims and a collection of other things are needed, zink produces a geometry shader to create them.

This code is disabling that from happening when there is no geometry shader support.
This removes a constant barrage of validation issues when trying to draw basic triangles.
Some of this missing functionality will be added back in later.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33059>
2025-01-22 16:41:31 +00:00
Martin Roukala (né Peres)
6a4c99adf1 radeonsi/ci: update the vangogh expectations
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33128>
2025-01-22 16:10:55 +00:00
Martin Roukala (né Peres)
7f2d03b81b zink/ci: update RADV expectations
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33128>
2025-01-22 16:10:55 +00:00
Martin Roukala (né Peres)
78624c41e3 zink/ci: update nvk expectations
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33128>
2025-01-22 16:10:55 +00:00
Marek Olšák
c4a8790fd7 zink/ci: skip KHR-Single-GL46...SizedDeclarationsPrimitive due to random timeout
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33157>
2025-01-22 15:32:25 +00:00
Pierre-Eric Pelloux-Prayer
d27748a76f radeonsi: use ac_drm_device_get_cookie
Instead of the raw ac_drm_device pointer which will be different
for each call to ac_drm_device_initialize.

Fixes: a565f2994f ("amd: move all uses of libdrm_amdgpu to ac_linux_drm")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33081>
2025-01-22 14:55:56 +00:00
Pierre-Eric Pelloux-Prayer
6cee989915 amd: add ac_drm_device_get_cookie
This returns the underlying device pointer but as an opaque
uintptr_t.
This will be required because libdrm_amdgpu will return the
same device when called multiple times from the same process.

radeonsi relies on the pointer value to identify if the device
are the same and adjust the synchronisation logic based on that.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33081>
2025-01-22 14:55:56 +00:00
Erik Faye-Lund
ff91457761 pan/compiler: don't pass midgard_instruction by value
This is a large struct, so let's pass it by reference instead of by
value.

Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32851>
2025-01-22 13:50:44 +00:00
Erik Faye-Lund
80bacbba23 pan/midgard: constify pointers
This makes it easier to reason about what arguments are going to be
modified and what aren't.

Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32851>
2025-01-22 13:50:44 +00:00
Erik Faye-Lund
430f7e991f pan/midgard: use macros for mir_prev_op / mir_next_op
The benefit of macros here is that they don't care about constness,
which is going to be benefitial once we stricten constness a bit here.

Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32851>
2025-01-22 13:50:43 +00:00
David Rosca
a3871da932 radeonsi: Fix reporting support for AV1 Profile2
This reported support for Profile2 on all VCNs that support Profile0
and reported no supported formats if Profile2 was not supported.
Instead, we should not advertise the Profile2 at all if not supported.

Fixes: e359b3c525 ("radeonsi/vcn: support 12bit YUV420 AV1 decoding")
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33092>
2025-01-22 13:17:50 +00:00
David Rosca
927f963726 gallium/auxiliary: Remove util_compute_blit
Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919>
2025-01-22 12:49:04 +00:00
David Rosca
762a86c937 frontends/va: Implement format conversions in PutImage/GetImage
Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919>
2025-01-22 12:49:04 +00:00
David Rosca
b3e666248b frontends/va: Support rotation and mirror for processing
Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919>
2025-01-22 12:49:04 +00:00
David Rosca
7b2a1812cf frontends/va: Refactor vlVaPostProcCompositor to be usable outside processing
Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919>
2025-01-22 12:49:04 +00:00
David Rosca
b7661be269 frontends/va: Stop using util_compute_blit
The progressive YUV shader used in vl_compositor_yuv_deint_full
does the same thing as util_compute_blit, but it also supports rotation.
Remove vlVaPostProcBlit and instead move the code to vlVaPostProcCompositor.

Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919>
2025-01-22 12:49:04 +00:00
David Rosca
24d69bdfe9 frontends/va: Disable color conversion for luma-only source formats
Fixes Y8_400 -> RGB conversion.

Cc: mesa-stable
Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919>
2025-01-22 12:49:04 +00:00
David Rosca
375e301837 frontends/va: Simplify format check in PutSurface
Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919>
2025-01-22 12:49:04 +00:00
David Rosca
3bbdc54a15 gallium/vl: Implement rotation and mirror in cs compositor
Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919>
2025-01-22 12:49:03 +00:00
David Rosca
dd4777736c gallium/vl: Use matrix for scale and crop in cs compositor
Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919>
2025-01-22 12:49:03 +00:00
David Rosca
a1db69a8c3 gallium/vl: Clear remaining planes in YUV conversion
Fixes Y8_400 -> YUV conversion.

Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919>
2025-01-22 12:49:03 +00:00
David Rosca
7fac4e3c79 gallium/vl: Add vl compositor layer mirror
Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919>
2025-01-22 12:49:03 +00:00
David Rosca
746ba9f2d2 gallium/vl: Fix sampler view components for Y8_400 format
Copy sampler view for last component to remaining components.
Fixes sampling from Y8_400 luma-only format.

Fixes: 8a20e634ce ("gallium/vl: Add plane order for Y8_400 format")
Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919>
2025-01-22 12:49:03 +00:00
Lars-Ivar Hesselberg Simonsen
358dcdabba panvk: Fix valgrind issue in panvk_compile_shaders
Ensure we've read all the relevant NIR state before freeing it for the
current shader.

Also ensure we free the shaders in the same order we compile them.

Fixes: d93f9d6d1a ("panvk: use static noperspective when statically linking VS and FS")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33011>
2025-01-22 12:12:21 +00:00
Lars-Ivar Hesselberg Simonsen
eabf8054b8 panvk: Fix valgrind issue in nir_lower_descriptors
Initialize progress to false as it might not be set by NIR_PASS()

Fixes: 258979d69c ("panvk: Wrap our descriptor lowering passes in NIR_PASS()")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33011>
2025-01-22 12:12:21 +00:00
Erik Faye-Lund
365cd04375 panfrost: do not artificially limit texture-sizes
We're already limiting the maximum texture-size based on the available
system memory, so we shouldn't really need to limit this here. In
addition, the state-tracker also limits the max framebuffer size to
16384, so we don't have to worry about limiting this to the framebuffer
size either.

So I don't think we have a good reason to artificially limit the texture
size here. This allows us to support larger textures than 8192, which is
especially useful to support OpenCL images with RustiCL.

Unfortunately, while the HW supports up to 64k texture sizes, Gallium
currently caps us at 32k. So let's stick with that as the new limit for
now.

Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32866>
2025-01-22 10:09:24 +00:00
Erik Faye-Lund
3a5c606d20 panfrost: limit maximum texture size
We don't want huge textures to take up large amounts of system memory.

On a system with 1GB of RAM, this would limit us to 256 MB, which is the
same memory usage as a texture of 8192 x 8192 with 4 bytes per
component, which is what we currently limit max texture size to anyway.

The goal here is really to allow using larger textures on systems with
more memory, but that bit comes in a later patch in this series.

Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32866>
2025-01-22 10:09:24 +00:00
Erik Faye-Lund
c205777cb6 panfrost: reuse tiler hierarchy mask selection from panvk
We're doing a better job at selecting the tiler hierarchy mask in PanVK,
so let's move that to common code and reuse it for the Gallium driver as
well.

The logic to disable the first level for large tile-sizes has been left
at the call-sites, because this is specific to V10 GPUs and later, so it
doesn't apply to the JM code-paths.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32866>
2025-01-22 10:09:24 +00:00
Jose Maria Casanova Crespo
bfd29a55e5 v3d: Apply FBO resources invalidations on job creation
We can handle invalidation of the FBO attachments at job
creation. It solves that we were skipping invalidations in jobs
that had been created by a clear call, as before this change
invalidations were only taken into account the first draw calls
of the job. In these cases where there is a clear after FB
invalidation the resource attachment was tracked as invalidated
for more time than expected. So the stores of the job with the
clear were not being loaded by the next job attaching it because
of the not correct application of the invalidation.

Fixes: 6c46890325 ("v3d: avoid load/store of tile buffer on invalidated framebuffer")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12456
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33148>
2025-01-22 09:31:32 +00:00
Marek Olšák
09aa19fb64 gallium/u_threaded: sort cases in batch_execute by their occurrence
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33087>
2025-01-22 01:28:43 -05:00
Marek Olšák
f8c730158b gallium/u_threaded: inline all tc_call functions
There are no calls anymore. It's just a loop with a switch now, which should
be implemented as a jump table by the compiler. The only calls are to
the pipe_context functions.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33087>
2025-01-22 01:20:31 -05:00
Marek Olšák
3692a50398 gallium/u_threaded: replace the function table with a switch and direct calls
gcc should generate a jump table for the switch, so it should be faster than
indirect calls after we inline the calls in the next commit.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33087>
2025-01-22 01:20:31 -05:00
Marek Olšák
c2983d93da gallium/u_threaded: use TC_END_BATCH to terminate the loop
TC_END_BATCH (TC_NUM_CALLS) is always present as the batch terminator,
so use it

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33087>
2025-01-22 01:20:31 -05:00
Marek Olšák
1776a12949 gallium/u_threaded: make the execute function table private
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33087>
2025-01-22 01:20:31 -05:00
Marek Olšák
8f4173cadf gallium/u_threaded: move tc_batch_execute after all call functions
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33087>
2025-01-22 01:20:31 -05:00
Marek Olšák
bdd85c8393 nir: remove handling IO variables from passes used by st/mesa
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33146>
2025-01-22 02:15:04 +00:00
Marek Olšák
2c5deaa98b st/mesa: inline st_finalize_nir_before_variants
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33146>
2025-01-22 02:15:04 +00:00