so that it can be different between shader variants
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35529>
Remove redundent lines in si_perfetto.cpp
Convert offset_B of buffer gpu_address to uint64_t ptr offset when
si_buffer_map is being called to read timestamp.
Destroy sctx->trace by calling u_trace_fini in si_utrace_fini which
will be called in si_destroy_context.
Signed-off-by: Julia Zhang <julia.zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36066>
This increases primitive throughput when packing reduces the number
of pos exports due to holes in clip and cull distance arrays that could be
punched out by nir_opt_clip_cull_const. This applies to all chips.
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/35473>
This increases primitive throughput for all hw with NGG if the shader
culls and the removal of cull distances reduces the number of position
exports.
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/35473>
It will be different between NGG and legacy because NGG with culling
will not export cull distances.
The number of position exports could also be gathered from final NIR
to reduce logic duplication.
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/35473>
It will be different between NGG and legacy because NGG with culling
will not export cull distances.
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/35473>
This is very useful for increasing raw primitive throughput for GS
(mostly just RDNA 2), increasing raw primitive throughput with clip
and cull distance outputs when they actually cull anything (RDNA 1-4),
and reducing attribute store bandwidth usage (RDNA 3-4).
It will also replace fixed-func culling against cull distances when
culling in the shader is enabled, which will increase primitive throughput
even further.
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/35473>
It receives all shaders and decides how to link them.
When culling is enabled for GS, we will need ES, GS, and FS in this
function at the same time.
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/35473>
Clip and cull distance outputs decrease primitive throughput, so culling
against them in the shader has even more benefit than other culling
options.
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/35473>
The previous code was completely wrong and untested. This is tested.
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/35473>
This simplifies shader info in drivers by returning GSVS emit sizes from
ac_nir_lower_legacy_gs. The pass knows the sizes, so drivers shouldn't
have to determine them independently.
This also makes the values more accurate because both drivers were
computing the GSVS emit sizes inaccurately and had redundant fields
in shader info. RADV had a lot of redudancy there.
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/35473>
The pass will determíne the GSVS ring size, so radv_get_legacy_gs_info
must be called after that.
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/35473>
In order to implement the extension we have to override the last
pre-rasterization shader to inject "gl_ViewportIndex = gl_Layer" at the
end, because there is no layered rendering equivalent to the
VIEWPORTINDEXINCR bit that adds gl_ViewIndex to gl_ViewportIndex in HW.
We also have to deal with the case where layered rendering is enabled
but the bit isn't set, in which case patchpoints that depend on the view
will see num_views = 1 but the patchpoint is for a higher view (aka
layer). This requires changing all of the patchpoints to handle this
case. Finally we have to change a number of cases which needed the
number of FDM layers to stop using num_views directly from the
renderpass and take into account whether per-layer rendering is enabled.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35594>
For VK_VALVE_fragment_density_map_layered, we need to split out whether
to enable per-view viewports and whether viewport 0 should be splatted
to all viewports. We also have to split this out for
VK_QCOM_multiview_per_view_viewport, where the splatting needs to be
disabled. To avoid conflicts between them, plumb through
"fake_single_viewport" which will be needed for the former extension and
needs to be modified for the latter extension.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35594>
When doing perspective correct interpolation with centroid/sample, we should
do the perspective correction wrt to the centroid/sample position - the
precalculated 1/w value however is always wrt pixel center (when we calculate
this we don't know yet what kind of interpolation we're going to use).
Refactor things a bit as well to avoid code duplication.
Reviewed-by: Brian Paul <brian.paul@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36079>
this addresses an ancient race condition where unmapping memory
in one thread at the same time memory is mapped in a different thread
could proceed without synchronization and result in the second thread
writing to unmapped memory
this was the actual cause of #12533
cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36076>
The key used to look-up a shader in the modifier conversion shader
hash table is incorrect. It currently uses the address of the key
argument variable while it should use the address already passed into
the key argument. The stack address being different at each call, the
search for a previously created shader always fails and a new one is
created at each call. This commit fixes that leak.
Fixes: ae3fb3089f ("panfrost: Add infrastructure for internal AFBC compute shaders")
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Acked-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36072>
When we need to perform format conversion, we use temporary surface
allocated with vlVaHandleSurfaceAllocate. If the driver requires
clearing the surface on allocation, it will create a fence that
must be destroyed later.
Fixes: 0f20a3a4f1 ("frontends/va: Add surface pipe_fence for vl_compositor rendering")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13198
Reported-by: Mariusz Białończyk <manio@skyboo.net>
Tested-by: Mariusz Białończyk <manio@skyboo.net>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36040>
un-wrapping requires adding INT8_MAX (not INT8_MAX-1) because e.g.,
the cases of batch_generation=126 and batch_generation=0 are not the same
also fix a stale comment
Fixes: b89e0fa226 ("tc: rework resource usage tracking to be lighter")
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36069>