Commit graph

71246 commits

Author SHA1 Message Date
Karol Herbst
cbc838b7d1 rusticl: reference resource in sampler and image view wrappers
Since b3133e250e ("gallium: add pipe_context::resource_release to
eliminate buffer refcounting") we need to take a reference for every bound
buffer object.

As we create image views on buffers, and kinda take partly reference
already just do it properly for now so we don't end up with
use-after-frees in drivers.

Fixes: dee9600a ("zink: eliminate buffer refcounting to improve performance")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37350>
2025-09-15 16:56:22 +00:00
Julian Orth
efc2bb64ce kms-swrast: export dmabufs with DRM_RDWR
This is required for the dmabufs to be usable with llvmpipe.

Fixes #13609

Signed-off-by: Julian Orth <ju.orth@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37088>
2025-09-15 14:50:00 +00:00
Mike Blumenkrantz
dfcdae378a zink: don't use screen ralloc context for screen::pipeline_libs
set_rehash will realloc this memory, which triggers a UAF on screen destroy

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37370>
2025-09-15 14:29:38 +00:00
Mike Blumenkrantz
f7480771c6 zink: stop unsetting zink_gfx_pipeline::modules on shader unbind
this conflicts with the optimal_key

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37370>
2025-09-15 14:29:38 +00:00
Patrick Lerda
06da0e7310 r600: fix emit_ssbo_atomic_op when ssbo_image_offset is non-zero
The value read was incorrect.

This change was tested on palm, barts and cayman, it fixes all the variants
of the advanced-sso-simple test:
khr-gl4[56]/es_31_compatibility/shader_image_load_store/advanced-sso-simple: fail pass
khr-gles31/core/shader_image_load_store/advanced-sso-simple: fail pass

Cc: mesa-stable
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37225>
2025-09-15 13:57:34 +00:00
Boris Brezillon
62dcc4c01b panfrost: Explictly filter out AFBC(SNORM)
We are about to allow any type that is not FLOAT on v9+ at the
pan_afbc_format() level, but this regresses
dEQP-GLES31.functional.copy_image.non_compressed.viewclass_16_bits.*_snorm*
tests because of the clamping that's done on values that fall outside
the [-2^(b-1)+1, 2^(b-1)-1] range (b being the number of bits in the
SNORM component).

In order to fix that, we would have to use a _UNORM type when copying,
but:

1. There are many places where internal copies can happen and it's hard
   to identify all of them
2. If we do it at the panfrost_blit_no_afbc_legalization() level, we
   might do format re-interpretation that's not wanted by the gallium
   layer

Given AFBC(SNORM) has not been supported so far, let's just go for the
simple solution and filter it out explicitly in panfrost_should_afbc().

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37158>
2025-09-15 10:59:04 +00:00
Boris Brezillon
05c2d45c3c panfrost: Explicitly reject AFBC(Z32)
We are about to extend pan_afbc_format() to support AFBC(Z32),
but the the AFBC(Z32) + S8 combination doesn't work on v7-, so
we need to filter AFBC(Z32) out in panfrost_should_afbc() on
v7-.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37158>
2025-09-15 10:59:04 +00:00
Boris Brezillon
2668316917 panfrost: Fix panfrost_batch_to_fb_info() for stencil-only attachments
Stencil-only attachments should go in the stencil view, not the
depth/stencil one.

Cc: mesa-stable
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37158>
2025-09-15 10:59:04 +00:00
Christian Gmeiner
2a5d515922 etnaviv: Support PIPE_FORMAT_S8_UINT stencil format
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37014>
2025-09-15 10:45:17 +00:00
Christian Gmeiner
fda092729d etnaviv: rs: Support 8bpp for clears
Needs a GPU with S8 support.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37014>
2025-09-15 10:45:17 +00:00
Georg Lehmann
76df6cd321 nir: remove has_ddx_intrinsics option
I thought this was already gone but apparently not quite.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37362>
2025-09-15 10:16:27 +00:00
Qiang Yu
0a266f0256 radeonsi: really support eglExportDMABUFImageQueryMESA
Now it should return explicite modifier and plane number.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31658>
2025-09-15 09:39:19 +00:00
Qiang Yu
41cde01b0b gallium: add PIPE_RESOURCE_PARAM_DISJOINT_PLANES
To query if a DRI_IMAGE has separate plane buffer handle.

radeonsi's DCC compressed dri image has multiple planes
(compressed data and metadata). But they share the same
buffer with different offsets, so we only need one buffer
handle for them.

This attribute is used to distinguish single buffer multi
plane image from multi buffer multi plane image.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31658>
2025-09-15 09:39:19 +00:00
Valentine Burley
c00bb4c1fe zink/ci: Disable ASan leak detection and re-enable zink-anv-cml-asan
The CML job runs into leaks in various tests, and the only way to
re-enable the job is to disable leak detection for now.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37330>
2025-09-15 09:20:14 +00:00
Jose Maria Casanova Crespo
72d7864c6b v3d: Don't enable Early-z with discards when stencil updates are enabled
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This fixes font rendering artifacts when Chromium/Firefox use Office365
PowerPoint set into fullscreen presentation mode.

Fixes: 5b951bcdd7 ("v3d: Enable Early-Z with discards when depth updates are disabled")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37349>
2025-09-15 09:06:25 +00:00
Qiang Yu
ea5e190b91 panfrost: fix lowered multi plane resource offset/stride param get
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
EGL is going to really export each plane's offset/stride, panfrost
need to fix for passing the piglit test:
  spec@ext_image_dma_buf_import@ext_image_dma_buf_import-export

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13853
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37247>
2025-09-15 06:39:43 +00:00
Qiang Yu
95579b7af6 panfrost: fix image plane array copy
Reference the original code, each plane resource have
the same image plane array.

Fixes: 53e5e07c4b ("pan: Add the concept of modifier handler")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37247>
2025-09-15 06:39:43 +00:00
Georg Lehmann
2cda56e8b7 ac/llvm: remove unused ballot size
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37294>
2025-09-14 13:21:20 +00:00
Mike Blumenkrantz
393958a02e zink: use a better array loop sizing for gfx descriptor program init
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
this will be more consistent if the array is ever resized

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37358>
2025-09-14 07:56:15 -04:00
Mike Blumenkrantz
a7c320e652 zink: some minor tweaks to descriptor template code
no functional changes

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37358>
2025-09-14 07:56:15 -04:00
Mike Blumenkrantz
b17235968e zink: break out setting draw-time dynamic state into separate function
no functional changes

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37358>
2025-09-14 07:56:15 -04:00
Mike Blumenkrantz
2712dc2179 zink: add enum zink_pipeline_idx to distinguish between types of pipelines
used for array indexing in many cases

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37358>
2025-09-14 07:56:15 -04:00
Mike Blumenkrantz
ea4d64531d zink: unify ntv code for loading shared/scratch memory
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37358>
2025-09-14 07:56:15 -04:00
Mike Blumenkrantz
d74eff651b zink: unify ntv code for storing shared/scratch memory
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37358>
2025-09-14 07:56:15 -04:00
Mike Blumenkrantz
b6f0826ce5 zink: make zink_descriptor_util_push_layouts_get() static
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37358>
2025-09-14 07:56:15 -04:00
Mike Blumenkrantz
4e50969e83 zink: delete weird prog->pipelines sizing
this was a tiny micro-optimization for not allocating hash tables, but
really it just makes the code more confusing for no reason

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37358>
2025-09-14 07:56:15 -04:00
Mike Blumenkrantz
308744e789 zink: mark dirty_gfx_stages using util function
more extensible for mesh

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37358>
2025-09-14 07:56:05 -04:00
Mike Blumenkrantz
dce29ae35f Revert "util/vbuf: stop nooping set_vertex_buffers calls"
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This reverts commit cccca8d140.

did not mean for this to merge

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37353>
2025-09-13 11:18:09 -04:00
Mike Blumenkrantz
cccca8d140 util/vbuf: stop nooping set_vertex_buffers calls
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
this sucks, but if the gallium expectation is that changing vertex state
always requires a vb update, vbuf can no longer deduplicate repeated
calls

Fixes: 1638d486ff ("gallium/u_threaded,st/mesa: add a merged set_vertex_elements_and_buffers call")

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37277>
2025-09-13 12:20:31 +00:00
Mike Blumenkrantz
d63374498d zink: eliminate even more calls to sync functions
many times (especially in viewperf), vertex buffers and draw buffers
have no prior access, which means incurring a heavy call to the barrier
function which will just return a no-op anyway

instead, have an inline helper to no-op these cases and just add the
expected access

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37277>
2025-09-13 12:20:30 +00:00
Mike Blumenkrantz
58ed06ad68 zink: only remove buffer deferred sync on release
this is otherwise just a huge amount of overhead whenever
descriptors are unbound

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37277>
2025-09-13 12:20:29 +00:00
Mike Blumenkrantz
1abc337e94 zink: delete some function decls that no longer exist
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37277>
2025-09-13 12:20:28 +00:00
Mike Blumenkrantz
5ef8453228 zink: use memcpy for vbo bind
there's no more refcounting here so this is fine

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37277>
2025-09-13 12:20:28 +00:00
Mike Blumenkrantz
aee0379414 zink: rescope some zink_set_vertex_buffers_internal variables
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37277>
2025-09-13 12:20:27 +00:00
Mike Blumenkrantz
f8c96df9d2 zink: move vbo unbind to bind_vertex_state
set_vertex_buffers is required to be called after the bind_state call,
which means some code can be moved out of the higher frequency call site

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37277>
2025-09-13 12:20:27 +00:00
Mike Blumenkrantz
06a8e7b87e zink: move zink_bind_vertex_elements_state() to zink_context.c
needed in order to handle unbinding

no functional changes

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37277>
2025-09-13 12:20:26 +00:00
Mike Blumenkrantz
f99503faa2 zink: use velems buffer count in blitter instead of gfx mask
small simplification

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37277>
2025-09-13 12:20:26 +00:00
Mike Blumenkrantz
a730c83dd0 zink: split update_res_bind_count
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37277>
2025-09-13 12:20:26 +00:00
Mike Blumenkrantz
c96bb8d1c4 zink: ALWAYS_INLINE zink_set_vertex_buffers_internal
otherwise the specialization is useless

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37277>
2025-09-13 12:20:25 +00:00
Mike Blumenkrantz
26f4cc39b5 zink: add a fastpath for nooping vertex and draw buffer barriers
even doing this mechanism inside the barrier function doesn't yield
anywhere near the same gains (~15-20% in viewperf catia), mostly for
the draw buffers, so I'd assume it's just added register pressure
from the huge draw function

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37277>
2025-09-13 12:20:25 +00:00
Mike Blumenkrantz
efd8e46891 zink: support NV_representative_fragment_test
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37081>
2025-09-13 11:28:44 +00:00
Mike Blumenkrantz
34641b44c6 mesa: support GL_NV_representative_fragment test
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37081>
2025-09-13 11:28:44 +00:00
Robert Mader
5cc0d1b681 kms-dri-sw: Implement create_mapped()
Following the example of dri_sw_winsys, in order to support
importing client-allocated (u)dmabufs into GL renderers as well
as KMS.
This crucially allows Wayland compositors running on vkms + llvmpipe
to behave much more like on HW GPUs/display engines, making CI testing
more robust and intuitive.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37305>
2025-09-13 06:47:58 +00:00
Robert Mader
306feaf3a4 sw_winsys: Add winsys_handle to displaytarget_create_mapped
The main intention is to allow to pass dmabuf handles, however as its
type differs depending on platform, just pass the whole whandle.

Also make use of it in llvmpipe_resource_from_handle(), in preparation
for the next commit.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37305>
2025-09-13 06:47:58 +00:00
Corentin Noël
63cd410c29 virgl: Skip resource destruction only when there are actually needed references
Suggested by Jan Alexander Steffens in https://gitlab.freedesktop.org/mesa/mesa/-/issues/13844#note_3087461

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13844
Fixes: 6c1c116a0f
cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37346>
2025-09-13 00:44:49 +00:00
Mike Blumenkrantz
c02d5d79b7 zink: add another tu flake
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37318>
2025-09-12 22:09:50 +00:00
Mike Blumenkrantz
69f90bfe29 zink: add some pre-checks before calling query update/suspend/resume
these trigger lots of context switches which impact perf

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37318>
2025-09-12 22:09:50 +00:00
Mike Blumenkrantz
9d19d7f6de zink: move draw state flag resets into their blocks
incredibly, this shows up in perf

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37318>
2025-09-12 22:09:50 +00:00
Mike Blumenkrantz
74b7b5b661 zink: simplify index type access to normal array
the sizes are 1/2/4, so just use that array index

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37318>
2025-09-12 22:09:50 +00:00
Mike Blumenkrantz
c852c25cdc zink: always use vkCmdBindVertexBuffers2
this cuts out a small amount of overhead in drivers that wrap
vkCmdBindVertexBuffers onto vkCmdBindVertexBuffers2

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37318>
2025-09-12 22:09:50 +00:00