Commit graph

319 commits

Author SHA1 Message Date
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
David Rosca
20ad09af25 radeonsi: Map X6R10/X6R10X6G10 formats to R16/R16G16
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35177>
2025-08-20 14:01:06 +00:00
Marek Olšák
321c8ee8d1 radeonsi/gfx12: enable sparse textures
Reviewed-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
Pierre-Eric Pelloux-Prayer
ae1aeafe49 radeonsi/gfx12: dont use HTILE for imported textures
Same as other chips.

Reviewed-by: Ganesh Belgur Ramachandra <ganesh.belgurramachandra@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36228>
2025-07-21 19:22:40 +00:00
Pierre-Eric Pelloux-Prayer
7c2a9e8d2a radeonsi: fix refcount with memobj
The existing refcounting code is correct, unless si_texture_from_winsys_buffer
fails in which case we get a refcount error.

The error code path will use si_texture_reference(&tex, NULL), which
will drop a reference to the memobj buffer, but none was taken yet.

Reviewed-by: Ganesh Belgur Ramachandra <ganesh.belgurramachandra@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36228>
2025-07-21 19:22:40 +00:00
Yogesh Mohan Marimuthu
b55ee5f335 radeonsi: rename sctx->has_graphics to sctx->is_gfx_queue
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35106>
2025-07-13 20:05:26 +00:00
Yogesh Mohan Marimuthu
e18da57276 radeonsi: replace fprintf stderr using mesa_log helper functions
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
radeonsi driver error and warnings fprintf will only use mesa_log
helper functions.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35862>
2025-07-09 07:43:13 +00:00
Pierre-Eric Pelloux-Prayer
8731293170 radeonsi: fix potential overflows
Reported by static analysis. Multiplication may overflow
before being converted to the larger type, so fix this
by casting one of the operands to the destination type.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35877>
2025-07-04 15:26:38 +00:00
Samuel Pitoiset
251b23f6c2 ac/surface: fix aliasing DCC tilings with HiZ info on GFX12
DCC tilings info needs to be set for all surfaces, including
depth/stencil. But because this is a C union, settings those fields
for depth/stencil surfaces might accidentally overwrite HiZ info.

This fixes rendering issues with RADV_DEBUG=nohiz.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35515>
2025-06-16 05:56:45 +00:00
Pierre-Eric Pelloux-Prayer
1cc52dff05 radeonsi: allow sparse depth textures
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35206>
2025-06-11 12:11:28 +00:00
Pierre-Eric Pelloux-Prayer
0e9ba3031e radeonsi: allow msaa sparse textures on gfx10+
The hardware doesn't support the prt layouts, but we can use normal
layouts and ac_surface_addr_from_coord to determince which pages
need to be committed.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35206>
2025-06-11 12:11:27 +00:00
Mike Blumenkrantz
05f8b59c90 gallium: delete union pipe_surface_desc
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
this is no longer used

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35168>
2025-05-29 13:07:02 +00:00
Marek Olšák
dc70e1c198 radeonsi: determine VM_ALWAYS_VALID accurately
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34491>
2025-04-14 22:44:14 +00:00
Mike Blumenkrantz
9d359c6d10 gallium: delete pipe_surface::width and pipe_surface::height
these fields are misleading and should always be replaced by either:
* the framebuffer width/height
* explicit function params to specify width/height

Co-authored-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33946>
2025-03-14 17:37:32 +00:00
Marek Olšák
356f5b2d2e radeonsi: move buffer reallocation to a separate function
to be used later

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33482>
2025-03-06 21:10:51 +00:00
Marek Olšák
0f9c972453 radeonsi: use si_is_buffer_idle everywhere
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33482>
2025-03-06 21:10:50 +00:00
David Rosca
57228c12d5 radeonsi: Use gfx for TMZ buffer clears
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33601>
2025-02-20 07:28:46 +00:00
Pierre-Eric Pelloux-Prayer
6b20b06584 radeonsi: disable dcc when external shader stores are used
See comment.

Fixes: 666a6eb871 ("radeonsi/gfx12: disable display dcc for front buffer rendering")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12552
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33469>
2025-02-19 12:35:37 +00:00
Samuel Pitoiset
9993f3dd6a ac,radv,radeonsi: add new GFX12_DCC_WRITE_COMPRESS_DISABLE tiling flag
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33301>
2025-02-03 21:12:07 +00:00
Samuel Pitoiset
48d199f3dc ac/gpu_info: add gfx12_supports_display_dcc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33212>
2025-01-27 08:08:15 +00:00
Marek Olšák
f72a11f38d radeonsi: always use RADEON_USAGE_DISALLOW_SLOW_REPLY
All places are fine with getting a false negative as long as buffer_wait
returns quickly. This can improve performance.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32877>
2025-01-07 20:24:19 +00:00
Marek Olšák
d9dd485c02 radeonsi: re-enable non-TC-compatible HTILE for write-only Z/S
It caused the Blender corruption, but the previous commit likely fixes it.

The workaround regressed performance for Furmark and Plot3D with 8xMSAA.

If you want to enable the workaround again in the future, just add this
line back: sscreen->info.gfx_level >= GFX11 ||

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32885>
2025-01-06 23:10:40 +00:00
Marek Olšák
fa0bf725bc radeonsi: ignore PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY for TC-compatible HTILE
We enable it on demand anyway, which seems better than relying on a flag.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32885>
2025-01-06 23:10:40 +00:00
David Rosca
1d206ca94c radeonsi: Support PIPE_BIND_VIDEO_DECODE/ENCODE_DPB
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32303>
2024-12-02 13:48:22 +00:00
Pierre-Eric Pelloux-Prayer
d3798130ad radeonsi: disable DCC for PIPE_BIND_USE_FRONT_RENDERING
Front rendering and (display) DCC are causing artifacts on screen.

si_texture_get_handle deals with this problem by disabling dcc, but
we can make it simpler by not allocating DCC at all when this flag
is set.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32281>
2024-11-27 19:00:20 +00:00
Pierre-Eric Pelloux-Prayer
666a6eb871 radeonsi/gfx12: disable display dcc for front buffer rendering
Same logic as other chips, except we need to reallocate the texture
as we can't disable dcc.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32281>
2024-11-27 19:00:20 +00:00
Pierre-Eric Pelloux-Prayer
2ff67083e5 radeonsi: refuse to import texture with family_overriden being set
If the gfx version is overriden by the exporter process, the surface
layout might not be compatible with the importer process (which uses
the real gfx version).

So fail early, except if the layout is LINEAR (because it should work
on all gen) or a modifier is used (which should be rejected elsewhere
if not supported).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31841>
2024-11-08 13:31:02 +00:00
Marek Olšák
5d09374ffe radeonsi/gfx12: fix AMD_DEBUG=nodcc not working
surface->modifier is always 0 here. We should use the parameter instead.

Fixes: 3d05d86d88 (radeonsi/gfx12: add DCC)

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31910>
2024-11-04 19:45:54 +00:00
Marek Olšák
755fb7a262 amd: move Tonga and Iceland TC-compat HTILE workarounds to ac_gpu_info.c
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31910>
2024-11-04 19:45:54 +00:00
Marek Olšák
047532b1e1 radeonsi/gfx11: fix Z corruption for Blender
The corruption only happens with non-TC-compatible HTILE, so always use
TC-compatible HTILE.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11891
Cc: mesa-stable

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31910>
2024-11-04 19:45:54 +00:00
Pierre-Eric Pelloux-Prayer
bb08596645 radeonsi/gfx12: fill missing dcc tiling info
Display DCC support has been enabled in 0bb83a4060 but this TODO
was forgotten.
Now that the kernel is fixed, we can set the related fields.

Fixes: 0bb83a4060 ("ac/surface: finish display DCC for gfx12")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31683>
2024-10-18 14:03:46 +02:00
Marek Olšák
f8788b2a38 radeonsi: remove the make_texture_descriptor indirect function call
Call gfx10_make_texture_descriptor from si_make_texture_descriptor and
use si_make_texture_descriptor everywhere.

This is more readable.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30904>
2024-09-23 20:34:13 +00:00
Marek Olšák
653bcd85e0 radeonsi: remove barriers around clears using aux_context.compute_resource_init
Nothing else uses that context, so all barriers are unnecessary.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31291>
2024-09-20 19:49:45 +00:00
Marek Olšák
58b512ddd6 radeonsi: execute clears at resource allocation using compute instead of gfx
This adds an additional aux_context, so that the gfx queue isn't stalled
due to clearing buffers or initializing DCC.

This aux context will only be used by resource_create, which will allow
us to remove all barriers around the clears because there are no others
users of those buffers on that context.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31291>
2024-09-20 19:49:45 +00:00
Marek Olšák
c99b55092f radeonsi: move barriers out of si_execute_clears
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31291>
2024-09-20 19:49:45 +00:00
Marek Olšák
3de719045a radeonsi/gfx12: disallow DCC for protected content
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31168>
2024-09-14 11:03:44 -04:00
Pierre-Eric Pelloux-Prayer
b7b10b971a radeonsi: add si_screen helper
Add a si_screen cast helper, with 2 purposes:
* correctly cast from pipe_screen to si_screen using get_driver_pipe_screen
* check that the result's type is correct

It's only useful when intending to use pipe_resource::screen as a si_screen.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30587>
2024-09-09 09:13:51 +00:00
Pierre-Eric Pelloux-Prayer
a55b9c0c60 radeonsi: consider DBG(NO_TILING) when filtering modifiers
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30257>
2024-07-22 10:09:34 +00:00
Pierre-Eric Pelloux-Prayer
94f2b3f7bc radeonsi: consider PIPE_BIND_LINEAR when filtering modifiers
If PIPE_BIND_LINEAR is set the only valid modifier we can use is
DRM_FORMAT_MOD_LINEAR.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30257>
2024-07-22 10:09:34 +00:00
Pierre-Eric Pelloux-Prayer
f12ccea6c7 radeonsi: reject modifiers with DCC when NO_EXPORTED_DCC is used
Otherwise AMD_DEBUG=noexporteddcc will be ignored when modifier are
used.
Similarly to AMD_DEBUG=nodcc handling, this makes the application
unable to import buffers with DCC as well - the alternative would be
to implement the filtering only in the texture creation path, so in
the si_modifier_supports_resource function.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30257>
2024-07-22 10:09:34 +00:00
Pierre-Eric Pelloux-Prayer
252485b0e2 radeonsi: fix si_get_dmabuf_modifier_planes for gfx12
DCC_RETILE/DCC only makes sense if TILE_VERSION is lower than
AMD_FMT_MOD_TILE_VER_GFX12.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30159>
2024-07-13 02:44:17 +00:00
Marek Olšák
acb3d5f132 radeonsi/gfx12: always set BO metadata, not just during export
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30063>
2024-07-13 01:32:48 +00:00
Pierre-Eric Pelloux-Prayer
19e342b877 radeonsi: handle DBG(TEX) after tc_compatible_htile is set
Otherwise the value printed might be incorrect.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29612>
2024-06-26 14:02:13 +00:00
Marek Olšák
3d05d86d88 radeonsi/gfx12: add DCC
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29510>
2024-06-06 01:01:46 +00:00
Samuel Pitoiset
78b4d356f3 ac,radv,radeonsi: add ac_gpu_info::has_tc_compatible_htile
It's apparently not supported on GFX12.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29417>
2024-05-30 11:05:03 +00:00
Samuel Pitoiset
2487a87552 ac,radv,radeonsi: add function to determine if alpha should be on MSB
The only difference for RADV is that the helper now converts SRGB
formats to non-SRGB but that shouldn't change anything in practice.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29308>
2024-05-22 08:17:31 +02:00
Samuel Pitoiset
7f0430bb36 ac,radv,radeonsi: add a function to translate colorswap
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29265>
2024-05-20 13:41:02 +00:00
Marek Olšák
b91220a825 radeonsi: remove slow code from si_msaa_resolve_blit_via_CB
This is mainly a cleanup. It wasn't faster.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29053>
2024-05-15 06:42:33 +00:00
Marek Olšák
f703dfd1bb radeonsi: add gfx12
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29007>
2024-05-11 22:14:06 -04:00
Marek Olšák
eb7d747651 radeonsi: add workarounds for DCC MSAA for gfx9-10
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28846>
2024-04-30 06:47:21 +00:00