Commit graph

63984 commits

Author SHA1 Message Date
Gert Wollny
dd267ab434 zink: move zink_resource_copies_reset out of exportable_lock
The function takes care of synchronization by itself, so no need to also
protect the call by ctx->batch.state->exportable_lock.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27327>
2024-02-01 21:22:25 +01:00
Gert Wollny
01e64bbf36 zink/sync: remove duplicate assignments in UNSYNCHRONIZED case
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27327>
2024-02-01 21:22:25 +01:00
Gert Wollny
ef548bf040 zink: extract update_unordered_access_and_get_cmdbuf
Use template specialization to handle the static control flow based
on template parameters during code generation instead of relying
on the optimizer to remove the unused code path.

v2: - Fix function opening brace location (zmike)
    - remove accidently added dead code

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27327>
2024-02-01 21:22:25 +01:00
Gert Wollny
ceca832662 zink: extract emit_memory_barrier::for_buffer from zink_resource_buffer_barrier
Use template specialization to handle the static control flow based
on template parameters during code generation instead of relying
on the optimizer to remove the unused code path.

v2: - move function opening braces to new line and fix indetion (zmike)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27327>
2024-02-01 21:22:25 +01:00
Gert Wollny
8c1ddcace9 zink: extract emit_memory_barrier from zink_resource_image_barrier
Replace the generic true/false by an enum to make the intent clearer.

Factor out the emission of the barrier, and use template specialization
to pick the type of barrier that is to be emitted, because with template
specialization the control flow is avoided altogether, whereas with
the static code flow it is up to the optimizer to remove the unused bits -
which may not happen in debug builds.

v2: Fix function start braces (zmike)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27327>
2024-02-01 21:22:25 +01:00
Gert Wollny
2cac3adf31 zink: remove duplicate check and assignment in zink_resource_image_needs_barrier
zink_resource_image_barrier already checks and sets the
pipeline and the flags.

v2: make zink_resource_image_needs_barrier private (zmike)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27327>
2024-02-01 21:22:25 +01:00
Gert Wollny
de354a48b9 zink: extract check_unordered_exec from zink_get_cmdbuf
Avoid some code duplication and interleaving of resource checks

v2: Use ALWAYS_INLINE (zmike)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27327>
2024-02-01 21:22:25 +01:00
Yiwei Zhang
569437221d gallium: refactor to use DETECT_OS_ANDROID
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27374>
2024-02-01 19:29:49 +00:00
Roland Scheidegger
e04eed2827 auxiliary/draw: fix streamout overflow calculation
If the stride is larger than the component with the largest offset plus
the size of that component, it is still considered an overflow if there's
not enough space in the buffer to fit the whole stride-sized thing,
even when there would be enough space to actually write all components.
This is actually much simpler too, since we don't need to verify the
individual components at all (stride is guaranteed to be larger or equal
to the component with the largest offset plus the size of that component).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27368>
2024-02-01 17:10:40 +00:00
Luc Ma
03371887d5 gallium/u_blitter: Fix a few uninitialized fb_state
An uninitialized pipe_framebuffer_state maybe causes some issues
if someone is about to use its members such as `fb_state.layers`.

Signed-off-by: Luc Ma <luc@sietium.com>
Reported-by: Mark Zhou <mark@sietium.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27332>
2024-02-01 10:59:53 +00:00
Pierre-Eric Pelloux-Prayer
e4f7754977 radeonsi: try to disable dcc if compute_blit is the only option
COMPUTE contexts have no blitter so there are no fallback to
si_can_use_compute_blit failing.

One solution would be to disable DCC globally when a COMPUTE context is
created but I'm not 100% sure it's a good idea.

Until then this commit can fix a number of cases and will also prevent
crashing if si_compute_blit fails.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10296
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27295>
2024-02-01 09:28:31 +01:00
Dave Airlie
ff50e80574 zink: use sparse residency for buffers.
GL ARB_sparse_buffer allows unbound regions in buffers.
VK sparseBinding insists all regions must be bound before first use.

This means we need to use sparseResidencyBuffer to back GL
sparse buffers to get the same semantics.

Fixes GL and piglit sparse buffer tests on zink/nvk.

Fixes: c90246b682 ("zink: implement sparse buffer creation/mapping")
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27404>
2024-02-01 01:08:22 +00:00
Max R
253968fc60 d3d10umd: Use flush_frontbuffer for Present
This is required to allow gallium drivers to display instead of
forcing software display. On llvmpipe/softpipe for sw display
gdi_sw_winsys will be used. While "hardware" drivers will be
able to call pfnPresentCb to present without CPU copy.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Jose Fonseca <jose.fonseca@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27333>
2024-01-31 20:04:38 +00:00
Max R
2b5e257690 winsys/gdi: Custom acquisition of hDC
In d3d10umd it is required to pass D3DKMT_PRESENT in
context_private of flush_frontbuffer, but wgl passes HDC in it.
To accomidate this when gdi_sw_winsys is created functions that
acquire and release hdc from context_private are passed.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Feng Jiang <jiangfeng@kylinos.cn>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27333>
2024-01-31 20:04:38 +00:00
Max R
be4b1c2639 winsys/gdi: Handle R8G8B8 formats
R8G8B8 is often used by d3d11 applications.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Feng Jiang <jiangfeng@kylinos.cn>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27333>
2024-01-31 20:04:37 +00:00
Mike Blumenkrantz
529e7ab975 lavapipe: RM2024 extension promotions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27296>
2024-01-31 18:17:55 +00:00
Friedrich Vock
f3b892b74a aux/trace: Guard triggers behind __normal_user
Reviewed-by: Eric Engestrom <eric@igalia.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27381>
2024-01-31 17:28:11 +00:00
Gert Wollny
4824238dd9 zink: Fix return type and values of create_buffer and create_images
Fixes: f6383e03f9
    zink: use enums as return values in resource_object_create

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10532
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27387>
2024-01-31 14:56:55 +00:00
Mike Blumenkrantz
0a97d1ebfa zink: fix descriptor buffer unmaps on screen destroy
descriptor buffer uses mapped buffers. mapping/unmapping buffers
uses a ctx in the function params, but at this time there is no ctx.
since the ctx is not actually used for unmapping descriptor buffers,
this can instead use a special buffer unmap function to avoid invalid access

Fixes: b06f6e00fb ("zink: fix heap-use-after-free on batch_state with sub-allocated pipe_resources")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27344>
2024-01-31 04:08:20 +00:00
Mike Blumenkrantz
c900cca96c zink: always map descriptor buffers as COHERENT
this is already implied since the buffers must be BAR-allocated,
but it ensures the context isn't accessed during unmap

Fixes: b06f6e00fb ("zink: fix heap-use-after-free on batch_state with sub-allocated pipe_resources")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27344>
2024-01-31 04:08:20 +00:00
Sil Vilerino
01a99f5d4d d3d12: d3d12_video_encoder_negotiate_current_h264_slices_configuration to use correct mode when intra-refresh is on
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27367>
2024-01-31 01:49:52 +00:00
Martin Roukala (né Peres)
62797f036f zink/ci: update polaris10's expectations after piglit uprev
Fixes: 1c29869c20 ("Uprev Piglit to e9316bcd12544aaf7e753ce37fe50d64165d9598")
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27357>
2024-01-30 23:32:00 +00:00
Martin Roukala (né Peres)
a0bf21e72f zink/ci: update navi31's expectations after piglit uprev
Fixes: 1c29869c20 ("Uprev Piglit to e9316bcd12544aaf7e753ce37fe50d64165d9598")
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27357>
2024-01-30 23:32:00 +00:00
Gert Wollny
f6383e03f9 zink: use enums as return values in resource_object_create
(As suggested by Mike).

With that replace the goto statements for error cleanup by
a switch/case.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
3d203b5477 zink: remove duplicate arguments and use VkMemoryRequirements locally
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
9c3e733779 zink: simplify call to get_export_flags
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
472bca9469 zink: Move more code to create_image and create_buffer
With that resource_object_create only contains the common
initzialization, the error handling and then calls seperate
functions to create buffers or images.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
0b88f68067 zink: extract allocate_bo_and_update_obj from resource_object_create
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
df9cbe431e zink: drop duplicate assignment to obj->alignment
The value resource_object_create obj->alignment is set again in
allocate_bo and the assignment uses a few more tests there.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
063949063c zink: extract debug_resource_mem from resource_object_create
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
7180670e28 zink: extract update_obj_info from resource_object_create
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
081e5d1109 zink: extract function update_alloc_info from resource_object_create
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
1d0e9001cd zink: extract function create_image from resource_object_create
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
eb394f5316 zink: redesign the allocation try loop to test all heaps
Before the first time an allocation failed the heap was changed,
now we only change the heap type when checking all heaps results
in allocation failure.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
252e877a87 zink: extract function allocate_bo from resource_create_object
v2: move reworking the loop to a new commit (Mike)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
3806586c6e zink: extract get_export_flags from resource_object_create
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
e22c525aa0 zink: reduce number of #ifdefs in resource_create_object
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
a5fd408a74 zink: factor out get_image_memory_requirement in resource_object_create
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
55f3941076 zink: factor out get_format_feature_flags in resource_object_create
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
6664fdaf48 zink: Factor out create sampler conversion in resource_object_create
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
b2ce61b91d zink: shorten lifetime of success variable in resource_object_create
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:32 +00:00
Gert Wollny
7cf77c553c zink: Factor out create buffer from resource_object_create
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27155>
2024-01-30 20:17:31 +00:00
Leo Liu
46f5a226d6 radeonsi: fix video processing path without VPE enabled
Fixes: 6b441ef6ab (amd, radeonsi: supports post processing entrypoint)
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10495
Cc: mesa-stable

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27339>
2024-01-30 19:53:53 +00:00
Daniel Schürmann
26c8f13ff5 vulkan: enable VK_KHR_shader_expect_assume
This implementation ignores the hints.

Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27265>
2024-01-30 19:09:42 +00:00
Eric Engestrom
944aefa933 zink+anv/ci: add a couple more flakes
`UnexpectedImprovement(Pass)` in https://gitlab.freedesktop.org/mesa/mesa/-/jobs/54381879

Expected `Fail` in https://gitlab.freedesktop.org/mesa/mesa/-/jobs/54386127

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27361>
2024-01-30 15:37:13 +00:00
Mike Blumenkrantz
f0aca7e7c9 lavapipe: KHR_dynamic_rendering_local_read
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27282>
2024-01-30 13:59:11 +00:00
Eric Engestrom
92c24191d4 tree-wide: use __normal_user() everywhere instead of writing the check manually
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27346>
2024-01-30 12:45:54 +00:00
Konstantin Seurer
9acc869b57 llvmpipe: Fix building with llvm11
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27223>
2024-01-30 10:14:45 +00:00
Corentin Noël
fe8c2dd43a zink: Avoid variable shadowing everywhere
Allows to build the zink driver with -Wshadow and makes sure that we are actually
dealing with the right variable when requested.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27259>
2024-01-29 21:49:50 +00:00
Corentin Noël
86aef4a3c4 zink: Do not shadow the variable ret
Allows to actually return `true` when requested.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27259>
2024-01-29 21:49:50 +00:00