Commit Graph

171506 Commits

Author SHA1 Message Date
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
Mike Blumenkrantz 35185ad9df zink: assert that batch_id is valid in zink_screen_check_last_finished()
0 is never a valid batch_id

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27729>
2024-02-26 01:42:23 +00:00
Mike Blumenkrantz 3283415bbd zink: fix longstanding issue with active batch state recycling
the previous code could recycle a currently-submitting state by hitting
a race condition where zink_screen_check_last_finished(batch_id) returned
true because batch_id was 0

this can no longer recycle the current batch, but the race should still be
eliminated for consistency: check 'submitted' since this guarantees batch_id
is valid

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27729>
2024-02-26 01:42:22 +00:00
Mike Blumenkrantz 16103b61e7 zink: only scan active batch states for free states if > 1 exist
trying to recycle the current active batch state is never going to be
productive

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27729>
2024-02-26 01:42:22 +00:00
Sean Anderson 2179a7f4d7 Add Xilinx ZynqMP KMSRO entrypoint
Add support for the Xilinx ZynqMP DPSub display driver, used with the
onboard Mali-400 GPU.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27370>
2024-02-25 22:16:27 +00:00
Faith Ekstrand 4499871e34 nvk: Advertise VK+KHR_incremental_present
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27785>
2024-02-25 14:44:20 -06:00
Faith Ekstrand b3fd66c889 nvk: Only expose VK_KHR_present_id/wait when we have WSI
Also update docs/features.txt

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27785>
2024-02-25 14:44:20 -06:00
Juan A. Suarez Romero 726ae2570c v3dv/ci: update expected list
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27781>
2024-02-25 18:44:56 +01:00
Sean Anderson 423add61e2 gallium: lima: Don't round height when checking alignment
Height does not affect alignment, so don't modify it. This fixes
failures if the buffer height is not an exact multiple of 16.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27371>
2024-02-24 19:55:27 +00:00