Commit graph

171514 commits

Author SHA1 Message Date
Pierre-Eric Pelloux-Prayer
a8a4bcec36 wsi/wl: check wsi_wl_surface's validity before use
Fixes: 9a00a360ad ("wsi/wl: flush connection on swapchain failure")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27767>
2024-02-26 16:56:27 +00:00
Faith Ekstrand
8ab337047c nvk: Advertise VK_KHR_maintenance5
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9616
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27795>
2024-02-26 16:25:08 +00:00
Faith Ekstrand
509fdf4fe4 nvk: Use VkPipelineCreateFlags2 flag names
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27795>
2024-02-26 16:25:08 +00:00
Faith Ekstrand
a72bcc0a26 vulkan/meta: Handle VK_REMAINING_ARRAY_LAYERS in blit and resolve
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27795>
2024-02-26 16:25:08 +00:00
Faith Ekstrand
8ed3aa7b1a nvk/copy: Handle VK_REMAINING_ARRAY_LAYERS
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27795>
2024-02-26 16:25:08 +00:00
Faith Ekstrand
a120022b02 nvk: Handle missing gl_PointSize in the last geometry stage
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27795>
2024-02-26 16:25:07 +00:00
Faith Ekstrand
4287d04e98 nak: Add writes_point_size to nak_shader_info
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27795>
2024-02-26 16:25:07 +00:00
Faith Ekstrand
828b3c18fb nil: Add PIPE_FORMAT_R5G5B5A1_UNORM
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27795>
2024-02-26 16:25:07 +00:00
Alyssa Rosenzweig
6825902bb6 treewide: use ralloc_memdup
@@
expression memctx, dst, src, size;
@@

-dst = ralloc_size(memctx, size);
-memcpy(dst, src, size);
+dst = ralloc_memdup(memctx, src, size);

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
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/27762>
2024-02-26 15:37:58 +00:00
Alyssa Rosenzweig
66b00e2966 util/ralloc: add memdup
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
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/27762>
2024-02-26 15:37:58 +00:00
Alyssa Rosenzweig
d964f57a48 util/hash_table: add u64 foreach macro
needs some nontrivial wrapping but can mostly fallback to the regular impl.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
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/27762>
2024-02-26 15:37:58 +00:00
Timur Kristóf
cc1501628f nir: Clean up divergence analysis for TES patch input loads.
Just make the code a little bit easier to follow.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27680>
2024-02-26 14:53:23 +00:00
Timur Kristóf
870a2e4197 nir: Cleanup divergence analysis for mesh shaders.
1. Mesh shaders don't have inputs (only task payload),
so remove them from handling load_input.

2. Clarify in comments that loading any mesh shader
output is an NV_mesh_shader only feature.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27680>
2024-02-26 14:53:23 +00:00
Timur Kristóf
9553d67373 nir: Fix divergence analysis of load_patch_vertices_in.
load_patch_vertices_in can only occur in tessellation shaders,
and contains the number of vertices in an input patch.

* TCS: patch_vertices_in is equal to the input patch size
* TES: patch_vertices_in is equal to the TCS output patch size

The patch sizes may be set by a pipeline or dynamic states,
however in both cases it is definitely uniform within a subgroup.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27680>
2024-02-26 14:53:23 +00:00
Timur Kristóf
537c0029dd nir: Fix divergence of reductions.
By accident, the function would return without setting
the divergence information.

Cc: mesa-stable
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27680>
2024-02-26 14:53:23 +00:00
Alyssa Rosenzweig
9548cba8ab anv,hasvk: use vk_index_to_restart
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27764>
2024-02-26 14:13:08 +00:00
Alyssa Rosenzweig
9da77e6c97 tu: use vk_index_to_restart
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27764>
2024-02-26 14:13:08 +00:00
Alyssa Rosenzweig
a97966b840 vulkan: add vk_index_type_to_restart helper
from nvk

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27764>
2024-02-26 14:13:07 +00:00
Patrick Lerda
4d00edda00 r300: fix memory leaks when register allocation fails
For instance, this issue is triggered with
"piglit/bin/ext_framebuffer_multisample-accuracy all_samples color depthstencil -auto -fbo":
Direct leak of 1160 byte(s) in 1 object(s) allocated from:
    #0 0x7fbe8897d7ef in __interceptor_malloc (/usr/lib64/libasan.so.6+0xb17ef)
    #1 0x7fbe7e7abfcc in rc_constants_copy ../src/gallium/drivers/r300/compiler/radeon_code.c:47
    #2 0x7fbe7e7ec902 in r3xx_compile_fragment_program ../src/gallium/drivers/r300/compiler/r3xx_fragprog.c:174
    #3 0x7fbe7e7e1b22 in r300_translate_fragment_shader ../src/gallium/drivers/r300/r300_fs.c:516
    #4 0x7fbe7e7e6373 in r300_pick_fragment_shader ../src/gallium/drivers/r300/r300_fs.c:591
    #5 0x7fbe7e75456e in r300_create_fs_state ../src/gallium/drivers/r300/r300_state.c:1073
    #6 0x7fbe7cd2ebe5 in st_create_fp_variant ../src/mesa/state_tracker/st_program.c:1070
    #7 0x7fbe7cd374b5 in st_get_fp_variant ../src/mesa/state_tracker/st_program.c:1116
    #8 0x7fbe7cd38273 in st_precompile_shader_variant ../src/mesa/state_tracker/st_program.c:1281
    #9 0x7fbe7cd38273 in st_finalize_program ../src/mesa/state_tracker/st_program.c:1345
    #10 0x7fbe7d798ca8 in st_link_glsl_to_nir ../src/mesa/state_tracker/st_glsl_to_nir.cpp:724
    #11 0x7fbe7d798ca8 in st_link_shader ../src/mesa/state_tracker/st_glsl_to_nir.cpp:952
    #12 0x7fbe7d6790d5 in link_program ../src/mesa/main/shaderapi.c:1336
    #13 0x7fbe7d6790d5 in link_program_error ../src/mesa/main/shaderapi.c:1447
...
SUMMARY: AddressSanitizer: 2528456 byte(s) leaked in 1057 allocation(s).

Fixes: 54f6e72b27 ("r300: better register allocator for vertex shaders")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27792>
2024-02-26 13:55:53 +00:00
Patrick Lerda
b11ecacb93 r300: fix r300_destroy_context() related memory leaks
For instance, with "piglit/bin/fcc-blit-between-clears -auto -fbo"":
SUMMARY: AddressSanitizer: 70512 byte(s) leaked in 497 allocation(s).

Fixes: e01f86c67b ("r300: set PIPE_BIND_CONSTANT_BUFFER for const_uploader")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27791>
2024-02-26 12:56:30 +01:00
Samuel Pitoiset
4071c399a2 radv: compute the total LDS usage in gfx10_get_ngg_info()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27722>
2024-02-26 10:42:37 +00:00
Samuel Pitoiset
d85311b120 radv: compute NGG scratch LDS base in gfx10_get_ngg_info()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27722>
2024-02-26 10:42:37 +00:00
Samuel Pitoiset
0570d40d5b radv: determine NGG culling info before NGG info
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27722>
2024-02-26 10:42:37 +00:00
Samuel Pitoiset
e3863a22bb radv: pass radv_shader_info to gfx10_get_ngg_info()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27722>
2024-02-26 10:42:37 +00:00
Samuel Pitoiset
4db0952639 radv: pass gfx10_ngg_info to gfx10_get_ngg_info()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27722>
2024-02-26 10:42:37 +00:00
Samuel Pitoiset
beb2e7df68 radv: determine NGG query info before linking shader info
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27722>
2024-02-26 10:42:37 +00:00
Samuel Pitoiset
64f46c83a3 radv: use so.num_outputs to determine if NGG shaders need XFB queries
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27722>
2024-02-26 10:42:37 +00:00
Samuel Pitoiset
7f8a84a024 radv: do not set gs.has_pipeline_stat_query twice for NGG GS
It's already initialized in gather_shader_info_gs().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27722>
2024-02-26 10:42:37 +00:00
Samuel Pitoiset
6c1e82e309 radv: remove unused parameter in gfx10_get_ngg_query_info()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27722>
2024-02-26 10:42:37 +00:00
Lionel Landwerlin
e9169881db anv: add missing generated file dep
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10672
Cc: mesa-stable
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27786>
2024-02-26 07:56:50 +00:00
Mike Blumenkrantz
5816b5961f zink: use new flag to determine whether swapchain readback cache is usable
the resource-valid flag isn't ideal for this since it doesn't convey
whether the swapchain cache is up-to-date

this should fix cases where the cache may have been erroneously used when
it hadn't been updated

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
2024-02-25 21:44:19 -05:00
Mike Blumenkrantz
01c9199cb8 zink: only update swapchain readback cache when necessary
this avoids modifying the cache for cases where the acquired image was
never modified

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
2024-02-25 21:44:19 -05:00
Mike Blumenkrantz
8fb83c0935 zink: only update swapchain readback cache on create if necessary
minor optimization

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
2024-02-25 21:44:19 -05:00
Mike Blumenkrantz
417a1986fb zink: set and manage a flag indicating that swapchain readback needs updating
not currently used, but this is more coherent than relying on other flags

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
2024-02-25 21:44:19 -05:00
Mike Blumenkrantz
114a5da790 zink: update swapchain readback cache on create
ensure this can be used immediately

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
2024-02-25 21:44:19 -05:00
Mike Blumenkrantz
7486aaa1c0 zink: make readback attempts count towards ZINK_READBACK_THRESHOLD
readback is readback even if the app is being "smart" (swapchain readback
is never smart)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
2024-02-25 21:44:19 -05:00
Mike Blumenkrantz
d5d5f54fe9 zink: add a swapchain readback case for reading differently-acquired image
if a swapchain is shared between multiple resources, a deadlock and/or invalid
data will result from readback attempts if one resource holds a swapchain
image that the other resource must read from

to avoid this, allow accessing the acquiring resource directly since this is
the only sane way to perform readback

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
2024-02-25 21:44:19 -05:00
Mike Blumenkrantz
ae80f9ce65 zink: make kopper_swapchain_image::acquired the resource that acquired it
no functional changes

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
2024-02-25 21:44:19 -05:00
Mike Blumenkrantz
d2ed77072c zink: flag acquired swapchain image as readback target on acquire, not present
readback should trigger on the current backbuffer, not the most recently
presented buffer. if e.g., a clear is only triggered through glFlush,
this clear should be read back rather than the contents of the last-presented
buffer

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
2024-02-25 21:44:19 -05:00
Mike Blumenkrantz
c3a2e2f9f2 zink: lock buffer age when chundering swapchain for readback
this sequence doesn't count as SwapBuffers calls, so age cannot be modified

Fixes: c123ab2137 ("kopper: Implement {EGL,GLX}_EXT_buffer_age")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
2024-02-25 21:44:19 -05:00
Mike Blumenkrantz
9fa2d9bd50 zink: fix swapchain readback conditional
this check is intended to determine whether the current backbuffer has
data, which correlates to (is_acquired && has_data). here, that corresponds
better to checking for a valid image index && nonzero buffer age

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
2024-02-25 21:44:19 -05:00
Mike Blumenkrantz
50b671c1c3 zink: fix (dynamic rendering) execution of scissored clears during flush
in the case where the renderpass did not change, this would
otherwise have skipped the mask composition for in-rp clears

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
2024-02-25 21:44:19 -05:00
Mike Blumenkrantz
e602035596 zink: clamp in_rp clears to fb size
this was almost sort of clamping except that it wasn't

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
2024-02-25 21:44:19 -05:00
Mike Blumenkrantz
e032e7f6cc zink: don't pre-init null fbfetch info
fbfetch is never used, so this just pointlessly wastes a bunch of
vram

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27684>
2024-02-26 02:07:02 +00:00
Mike Blumenkrantz
5fdbb0868a zink: start out with 256x256 sized dummy surfaces
4096 is huge.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27684>
2024-02-26 02:07:02 +00:00
Mike Blumenkrantz
aaf78eadf3 zink: create/resize dummy surfaces on-demand
4096 was used here as a placeholder because it "always works", but
this ends up wasting a ton of vram

instead, start out more conservatively and create new dummy surfaces
if needed

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27684>
2024-02-26 02:07:02 +00:00
Mike Blumenkrantz
1ea64063c8 zink: break out null fbfetch init for descriptor buffer
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27684>
2024-02-26 02:07:02 +00:00
Mike Blumenkrantz
263d262025 zink: also set null fbfetch surfaces when no fb surface is bound
if nullDescriptor is supported, of course

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27684>
2024-02-26 02:07:02 +00:00
Mike Blumenkrantz
f3347a4603 zink: don't pre-init dummy fbfetch surface when missing nullDescriptor feature
this should be handled automatically when updating fbfetch state anyway

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27684>
2024-02-26 02:07:02 +00:00
Mike Blumenkrantz
fe13841a99 zink: move flagging rp_changed in zink_update_fbfetch() to caller
this avoids recursive flagging when starting a renderpass

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27684>
2024-02-26 02:07:01 +00:00