Erik Faye-Lund [Mon, 26 Jun 2023 13:24:38 +0000 (15:24 +0200)]
math: remove unused defines
Since libmesa_classic got removed, we no longer have the assembly
sources that used these defines, so let's get rid of them.
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24003>
Erik Faye-Lund [Mon, 26 Jun 2023 13:52:55 +0000 (15:52 +0200)]
math: fix indentation in m_matrix.[ch]
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24003>
Zhang Ning [Fri, 9 Jun 2023 01:52:18 +0000 (09:52 +0800)]
lima: use u_pipe_screen_lookup_or_create in the renderonly path too
close #8739
Signed-off-by: Zhang Ning <zhangn1985@outlook.com>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23538>
QwertyChouskie [Thu, 6 Jul 2023 04:32:31 +0000 (04:32 +0000)]
docs/features.txt(fix): mark VK_EXT_pipeline_robustness as supported on radv
This was implemented in https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23912
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24013>
Marek Olšák [Thu, 22 Jun 2023 11:15:02 +0000 (07:15 -0400)]
vbo: correctly restore _VaryingInputs for display list fast path
Fixes:
3a294ff0 - mesa: move the _mesa_set_varying_vp_inputs call to where the state changes
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9007
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23796>
Timothy Arceri [Wed, 5 Jul 2023 02:48:34 +0000 (12:48 +1000)]
st/glsl: merge st_glsl_to_ir.cpp with st_glsl_to_nir.cpp
There is no longer any other IR so lets finally merge these together
to make the code easier to follow.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Wed, 5 Jul 2023 02:35:51 +0000 (12:35 +1000)]
st/glsl: merge st_link_glsl_to_nir() into st_link_nir()
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Wed, 5 Jul 2023 02:31:30 +0000 (12:31 +1000)]
st/glsl: merge link_shader() into st_link_nir()
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Thu, 22 Jun 2023 04:33:53 +0000 (14:33 +1000)]
glsl: remove glsl ir optimisation loop from linker
We no longer need to call this here and can depend on the glsl_to_nir
pass to call it and clean up anything it cannot handle. Everything
else can now depend on the nir optimisation passes.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Thu, 22 Jun 2023 04:26:12 +0000 (14:26 +1000)]
glsl: move store_fragdepth_layout() to nir linker
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Wed, 21 Jun 2023 03:26:10 +0000 (13:26 +1000)]
glsl: drop link_invalidate_variable_locations()
All this code does is reinitialise the values to what the original
ir_variable() call already set them too. This code is very old dating
to the initial glsl compiler support, it has probably been unrequired
for a long time now.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Wed, 21 Jun 2023 03:09:51 +0000 (13:09 +1000)]
glsl: set last_vert_prog in the nir linker
Another step to removing the GLSL IR linker
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Wed, 21 Jun 2023 03:02:46 +0000 (13:02 +1000)]
glsl: inline link_varyings()
Most code has already been moved to the NIR linker.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Wed, 5 Apr 2023 04:05:59 +0000 (14:05 +1000)]
glsl: remove the always_active_io flag from GLSL IR
No longer used.
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Wed, 5 Apr 2023 04:01:34 +0000 (14:01 +1000)]
glsl: move disable_varying_optimizations_for_sso() to NIR linker
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Wed, 5 Apr 2023 02:09:19 +0000 (12:09 +1000)]
nir/glsl: add nir_var_declared_implicitly enum
This will be used in the following patch.
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Wed, 5 Apr 2023 02:30:24 +0000 (12:30 +1000)]
glsl: drop the dce of global vars from GLSL IR linker
All this does is compilcate things such as forcing us to set
var->data.always_active_io in the glsl linker. Just let NIR clean
these up for us instead.
A Zink test hits a new assert but this is not a regression it just
uncovers an existing mesa bug.
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Thu, 4 May 2023 02:13:44 +0000 (12:13 +1000)]
glsl: remove unused system vars
System vars are added to the resource list as inputs so remove any
dead ones before building the list.
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Thu, 4 May 2023 01:24:07 +0000 (11:24 +1000)]
glsl: remove unused buffer objects with packed layout
These are currently removed by the GLSL IR DCE pass but we will
drop that in a following patch. Also there are scenarios where these
might not be detected as unused until the NIR optimisations have
been run so we really need to do it here too anyway.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Thu, 6 Apr 2023 04:18:44 +0000 (14:18 +1000)]
glsl: call assign_attribute_or_color_locations() in NIR linker
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Thu, 6 Apr 2023 04:17:12 +0000 (14:17 +1000)]
glsl: port assign location code for VS inputs or FS outputs
Here we port the code to the NIR linker.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Thu, 22 Jun 2023 00:33:41 +0000 (10:33 +1000)]
glsl: move lowering linker code out of st
Move all these lowering calls into the linker where they belong. This
makes future changes to the linker more flexible and is needed to
allow some following patches as we need to call things in a specific
order.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Thu, 22 Jun 2023 00:24:05 +0000 (10:24 +1000)]
glsl: move some compiler code out of st
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Thu, 22 Jun 2023 00:18:53 +0000 (10:18 +1000)]
mesa: add some new constants
These will be used by the compiler in a following patch.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Timothy Arceri [Thu, 6 Apr 2023 01:58:16 +0000 (11:58 +1000)]
glsl: add some more c wrappers for string_to_uint_map
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
Iago Toral Quiroga [Wed, 5 Jul 2023 08:38:07 +0000 (10:38 +0200)]
broadcom/compiler: don't leak v3d_compile when finding a new best strategy
If we had selected a best strategy and find an even better one we need to
make sure we free the previous one.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24001>
Iago Toral Quiroga [Wed, 5 Jul 2023 08:40:34 +0000 (10:40 +0200)]
broadcom/compiler: free defin and defout arrays if they already exist
Just like we do for everything else here, since we are going to realloc
them again right below. Notice this is not exactly a memory leak, since
all these arrays are allocated with ralloc using v3d_compile as context,
so all allocations will be eventually freed when the context is destroyed.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24001>
Danylo Piliaiev [Tue, 4 Jul 2023 16:07:43 +0000 (18:07 +0200)]
tu: Add missing dbg reg stomping to tu_CmdBeginRendering
Also we shouldn't stomp PC_DRAW_INDX_BASE - we never use it and
stomping it together with some other reg leads to a fault.
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23993>
Konstantin Seurer [Tue, 4 Jul 2023 19:01:23 +0000 (21:01 +0200)]
llvmpipe,lavapipe: Relayout lp_descriptor
This is more robust in case of a descriptor type mismatch.
Fixes test_null_descriptor_mismatch_type (vkd3d-proton).
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23996>
Konstantin Seurer [Tue, 4 Jul 2023 17:05:08 +0000 (19:05 +0200)]
llvmpipe: Allocate more dummy sample functions for FORMAT_NONE
When a null texture is sampled with a non-null sampler, having only one
set of sample functions would lead to an OOB read.
Fixes test_null_srv (vkd3d-proton).
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23996>
Konstantin Seurer [Tue, 4 Jul 2023 16:24:30 +0000 (18:24 +0200)]
llvmpipe: Allow comparison sampling for float formats
Fixes test_gather_c (vkd3d-proton).
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23996>
Konstantin Seurer [Tue, 4 Jul 2023 16:10:18 +0000 (18:10 +0200)]
lavapipe: Set the descriptor count to what vkd3d-proton requires
vkd3d-proton tries to allocate a maximum size descriptor set. The
previous limits were to high for that to work reliably.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23996>
Konstantin Seurer [Tue, 4 Jul 2023 15:48:58 +0000 (17:48 +0200)]
gallivm: Fix atomic_global types
Passes LLVM validation on the test_mesh_shader_rendering vkd3d-proton
test.
cc: mesa-stable
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23996>
Sviatoslav Peleshko [Mon, 3 Jul 2023 06:45:29 +0000 (09:45 +0300)]
glsl: Fix yylloc.source propagation in YYLLOC_DEFAULT
Currently, it's always initialized to 0, but we should take the value from
the grouping passed to the macro. This way parser will have the full
location info, and errors originating from it will show the correct
source file number.
Fixes:
a0cfe8c4 ("glsl: Fix missing initialization of yylloc.source")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9229
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23966>
Patrick Lerda [Thu, 22 Jun 2023 11:11:07 +0000 (13:11 +0200)]
radeonsi: fix refcnt imbalance related to util_blitter_save_fragment_constant_buffer_slot()
Indeed, util_blitter_clear() requires a call to
util_blitter_save_fragment_constant_buffer_slot(),
but most other blitter functions do not.
For instance, this issue is triggered with:
"piglit/bin/object-namespace-pollution glDrawPixels buffer -auto -fbo"
while setting GALLIUM_REFCNT_LOG=refcnt.log.
Fixes:
03bc7503d471 ("radeonsi: save the fs constant buffer to the util blitter context")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23856>
Dave Airlie [Wed, 5 Jul 2023 04:01:05 +0000 (14:01 +1000)]
clc: llvm 17 requires opaque pointers.
You can't turn this off for llvm17+, this at least makes things
run against llvm git now instead of blowing up in clang.
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24000>
Pavel Ondračka [Fri, 23 Jun 2023 08:39:16 +0000 (10:39 +0200)]
r300: assert that every writer has a reader
Dead writes can lead to problems with regalloc, so add a safety assert
to catch such cases in the vertex shaders at least in the meantime.
Additionally we could think there are no readers due to some shortcoming
of out dataflow analysis or some other bug which we would also like to
know about.
Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23927>
Pavel Ondračka [Thu, 15 Jun 2023 11:57:48 +0000 (13:57 +0200)]
r300: disable ntt regalloc for vertex shaders
We have much better regalloc in the backend, and additionally having
a close to ssa form means some optimizations can be more effective.
RV370:
total instructions in shared programs: 82500 -> 81645 (-1.04%)
instructions in affected programs: 32147 -> 31292 (-2.66%)
helped: 396
HURT: 1
total temps in shared programs: 12355 -> 12465 (0.89%)
temps in affected programs: 368 -> 478 (29.89%)
helped: 5
HURT: 96
GAINED: shaders/trine/vp-237.shader_test VS
GAINED: shaders/trine/vp-79.shader_test VS
RV530:
total instructions in shared programs: 130706 -> 129684 (-0.78%)
instructions in affected programs: 40902 -> 39880 (-2.50%)
helped: 428
HURT: 1
total temps in shared programs: 16811 -> 16920 (0.65%)
temps in affected programs: 421 -> 530 (25.89%)
helped: 7
HURT: 89
The instruction decrease is from the channel merging pass which can be
much more agressive when we have ssa-like form.
The temp regressions are cases where we merge something like
3: MAD output[1].xy, const[8].xy__, input[1].ww__, temp[0].xy__;
....
12: MOV output[1].zw, none.__00;
We always merge the first instruction into the second one, which means
the liverange for temp[0] will be unnecessarily extended here.
This can be fixed with the following draft MR
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19790
however if we ever get a VS pair scheduling support this will be solved
as well as a consequence, so let it be for now.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7693
Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23927>
Pavel Ondračka [Thu, 15 Jun 2023 11:29:50 +0000 (13:29 +0200)]
r300: remove most of backend contant folding
This is now done in NIR. The remaining one for ADD + 0 to MOV is kept
until we move some remaining part of FS lowering to NIR.
There single regressions is in one d3d->glsl shader from Wine.
Wine sets invariant for glPosition which translates to exact bit for all
calculations leading to it (or the TGSI PRECISE flag). r300 backend
ignores is completelly, so removing the backend optimizations should
even make us more correct in this regards.
RV530:
total instructions in shared programs: 130705 -> 130706 (<.01%)
instructions in affected programs: 16 -> 17 (6.25%)
helped: 0
HURT: 1
RV370: no change
Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23927>
Pavel Ondračka [Thu, 15 Jun 2023 07:27:59 +0000 (09:27 +0200)]
r300: add some early safe bool lowering
This lowers some of the bool-producing comparisons and following bcsels
if the bool comparison results is only used in the bcsel.
This is a temporary solution before we can fork ntt and optimize
the pass sequence there. Right now if we have something like
bcsel(a,b,0.0) we lower it to flrp in nir_lower_bool_to_float. The
flrp goes to backend where it will be lowered to 2 MADs. However in this
case with one of the arguments being a constant one MAD is enough. The
backend can figure this out in the constant folding pass, however this
is actually one of the last things we need it for. So if we do early
translation of the bcsels, than the algebraic pass can clean it up and
we can remove more backend code in the next patch.
no significant change with RV370 shader-db:
total instructions in shared programs: 82497 -> 82496 (<.01%)
instructions in affected programs: 1029 -> 1028 (-0.10%)
helped: 4
HURT: 3
total temps in shared programs: 12351 -> 12355 (0.03%)
temps in affected programs: 10 -> 14 (40.00%)
helped: 0
HURT: 4
Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23927>
Pavel Ondračka [Fri, 23 Jun 2023 12:30:44 +0000 (14:30 +0200)]
r300: lower undefs to zero
They will get translated to read from random register otherwise, which is
not problematic per se, but they will not be regalloced and if the
initial register index was too high, we can fail the shader compilation
because we think we run out of registers.
Almost no effect with shader-db on RV530:
total instructions in shared programs: 130707 -> 130705 (<.01%)
instructions in affected programs: 1012 -> 1010 (-0.20%)
helped: 2
HURT: 1
Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23927>
Yonggang Luo [Tue, 4 Jul 2023 08:47:45 +0000 (16:47 +0800)]
radeonsi: Use ALIGN_POT instead ALIGN_TO
ALIGN_POT would be a bit faster as it's have no divide arithmetic
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23987>
Friedrich Vock [Fri, 2 Jun 2023 12:40:12 +0000 (14:40 +0200)]
radv: Re-enable RT pipeline capture/replay handles
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
Friedrich Vock [Wed, 7 Jun 2023 07:54:50 +0000 (09:54 +0200)]
radv/rt: Rework radv_GetRayTracingCaptureReplayShaderGroupHandlesKHR
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
Friedrich Vock [Fri, 2 Jun 2023 15:41:58 +0000 (17:41 +0200)]
radv/rt: Replay shader allocations according to capture/replay handle
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
Friedrich Vock [Fri, 2 Jun 2023 15:38:35 +0000 (17:38 +0200)]
radv/rt: Associate capture/replay handles with stages
For stages where the capture/replay handle is only known after compiling
and uploading the shader, the shader needs to be relocated to the VA
corresponding to the capture/replay address.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
Friedrich Vock [Fri, 2 Jun 2023 15:36:31 +0000 (17:36 +0200)]
radv/rt: Only compare the non-recursive capture/replay handle
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
Friedrich Vock [Fri, 2 Jun 2023 15:44:12 +0000 (17:44 +0200)]
radv: Add radv_rt_capture_replay_handle
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
Friedrich Vock [Fri, 2 Jun 2023 12:39:04 +0000 (14:39 +0200)]
radv: Add support for creating capture/replay shaders
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
Friedrich Vock [Fri, 2 Jun 2023 12:37:07 +0000 (14:37 +0200)]
radv: Split up implementation of radv_shader_create
This will make it easy to re-use the split-up parts for creating
replayed shaders.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
Friedrich Vock [Wed, 7 Jun 2023 09:12:51 +0000 (11:12 +0200)]
radv: Break up radv_shader_nir_to_asm
radv_shader_nir_to_asm actually had 3 functions: compiling the NIR to
asm, uploading the shaders and generating debug info for them.
This reduces the functionality of radv_shader_nir_to_asm to only compile
NIR to asm. Uploading the shader and generating debug info is split into
separate functions.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
Friedrich Vock [Thu, 1 Jun 2023 20:24:45 +0000 (22:24 +0200)]
radv: Add radv_shader_reupload
Used for relocating RT shaders with capture/replay.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
Friedrich Vock [Fri, 2 Jun 2023 12:42:06 +0000 (14:42 +0200)]
radv: Add utilities to serialize and deserialize shader allocation info
Can be used to capture/replay an arbitrary sequence of shader
allocations while preserving VAs.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
Friedrich Vock [Wed, 7 Jun 2023 07:53:59 +0000 (09:53 +0200)]
radv: Add option to allocate shaders in replayable VA range
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
Friedrich Vock [Fri, 2 Jun 2023 12:45:06 +0000 (14:45 +0200)]
radv: Move shader arena allocation to a separate function
The arena size is also needed for capture/replay.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
Friedrich Vock [Wed, 5 Jul 2023 09:55:44 +0000 (11:55 +0200)]
radv: Add radv_shader_free_list
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
José Roberto de Souza [Tue, 4 Jul 2023 14:25:49 +0000 (07:25 -0700)]
iris: Convert slab address to canonical
This was the only missing case of bo->address that could possibly not
formated as canonical.
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23994>
Alyssa Rosenzweig [Fri, 30 Jun 2023 21:29:51 +0000 (17:29 -0400)]
nir: Fix breaking in nir_foreach_phi(_safe)
When I reading through some of my older commits I noticed that `break` in
`nir_foreach_phi` is broken because I used the two-loop trick wrong. Rewrite the
macros to fix this, and also to generally be a lot cleaner.
Fixes:
7dc297cc141 ("nir: Add nir_foreach_phi(_safe) macro")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23957>
Michael Tretter [Tue, 20 Jun 2023 13:14:52 +0000 (15:14 +0200)]
kmsro: assert that scanout refcount is larger than 0
The dumb buffer backing the renderonly_scanout is only destroyed if the
refcount reaches zero. If a driver does not correctly initialize the
refcount, the refcount may be negative and the buffer will never be
freed.
Add an assert to ensure that drivers correctly initialize the refcount.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23743>
Michael Tretter [Mon, 19 Jun 2023 10:19:00 +0000 (12:19 +0200)]
panfrost: remove BO from cache before closing GEM
If the GEM is closed before setting the BO in the sparse array to zero,
a newly allocated GEM may be associated with a stale BO that is left in
the cache reusing an old BO.
Zero the BO before closing the GEM to make sure that the BO is removed
from the cache and won't be associated with a different GEM.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23744>
Boris Brezillon [Fri, 23 Jun 2023 07:18:31 +0000 (09:18 +0200)]
winsys/panfrost: Make sure we reset scanout on error in create_kms_dumb_buffer_for_resource()
If an error occured, make sure we reset the scanout object before
leaving, otherwise the next user of this handle will hit the
refcnt == 0 assert.
Fixes:
ad4d7ca83324 ("kmsro: Fix renderonly_scanout BO aliasing")
Cc: mesa-stable
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23746>
Boris Brezillon [Fri, 23 Jun 2023 07:18:21 +0000 (09:18 +0200)]
renderonly: Make sure we reset scanout on error in create_kms_dumb_buffer_for_resource()
If an error occured, make sure we reset the scanout object before
leaving, otherwise the next user of this handle will hit the
refcnt == 0 assert.
Fixes:
ad4d7ca83324 ("kmsro: Fix renderonly_scanout BO aliasing")
Cc: mesa-stable
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23746>
Boris Brezillon [Fri, 23 Jun 2023 07:08:31 +0000 (09:08 +0200)]
renderonly: Fix potential NULL deref in the error path
scanout can be NULL.
Fixes:
ad4d7ca83324 ("kmsro: Fix renderonly_scanout BO aliasing")
Cc: mesa-stable
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23746>
Robert Beckett [Wed, 26 Apr 2023 12:28:40 +0000 (13:28 +0100)]
winsys/panfrost: Fix a scanout resource leak
Use ro->bo_map to alloc scanout and make sure we initialize the refcnt
to one.
This fixes leaking the scanout object and the underlying dumb-buffer.
Fixes:
ad4d7ca83324 ("kmsro: Fix renderonly_scanout BO aliasing")
Cc: mesa-stable
Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23746>
Mike Blumenkrantz [Mon, 3 Jul 2023 13:34:39 +0000 (09:34 -0400)]
aux/trace: fix bindless texture dumping
cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23971>
Alyssa Rosenzweig [Tue, 27 Jun 2023 18:19:33 +0000 (14:19 -0400)]
asahi: Use txf_ms for MSAA background programs
Fixes regression in assorted dEQP tests including:
dEQP-EGL.functional.color_clears.multi_context.gles3.rgba8888_window
Fixes:
d4424950ace ("asahi: Use txf for background program")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Thu, 29 Jun 2023 00:12:25 +0000 (20:12 -0400)]
agx: Don't leak ssa_to_reg_out
calloc'd in the RA, should be freed in the RA. Identified with valgrind.
Fixes:
6b13616cba2 ("agx: Implement vector live range splitting")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Thu, 29 Jun 2023 00:06:14 +0000 (20:06 -0400)]
asahi: Take ownership of compute shader NIR
Fixes massive leak of compute shader NIR. Identified with valgrind.
Yes, this requires casting away const *.
Yes, Gallium is dumb.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Thu, 29 Jun 2023 00:05:39 +0000 (20:05 -0400)]
asahi: Use ralloc harder
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Wed, 28 Jun 2023 16:38:48 +0000 (12:38 -0400)]
asahi: Fix scissor_culls_everything check
Account for the possibility that the scissor is outside the render area. Fixes
the usual assertion fail:
glcts: ../src/gallium/drivers/asahi/agx_state.c:1015:
agx_upload_viewport_scissor: Assertion `maxx > minx && maxy > miny' failed.
on the following dEQP tests with my conformance build:
dEQP-GLES3.functional.fragment_ops.scissor.outside_render_line
dEQP-GLES3.functional.fragment_ops.scissor.outside_render_point
dEQP-GLES3.functional.fragment_ops.scissor.outside_render_tri
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Mon, 26 Jun 2023 20:23:01 +0000 (16:23 -0400)]
asahi: Assert we don't transition shared resources
This is an invariant maintained by all current callers and subtly required for
the BO swapping to work. Assert it to make it obvious.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Asahi Lina [Wed, 28 Jun 2023 10:15:28 +0000 (19:15 +0900)]
asahi: Arrange VS varyings in the correct order
The GPU ABI requires varyings to be grouped as follows:
- Position
- Smooth shaded fp32
- Flat shaded fp32
- Linear shaded fp32
- Smooth shaded fp16
- Flat shaded fp16
- Linear shaded fp16
- Point size
Use the flat shaded mask info we now have in the vertex shader key to
sort things properly, and pass the counts to the hardware.
FP16 is still TODO.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Asahi Lina [Wed, 28 Jun 2023 10:12:51 +0000 (19:12 +0900)]
asahi: Add flat/linear shaded varyings mask to the VS shader key
We need this information in order to arrange varyings properly, which
means we need shader variants. Add this to the shader key, taking the
value from the FS input info.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Asahi Lina [Wed, 28 Jun 2023 10:10:41 +0000 (19:10 +0900)]
asahi: Fix type confusion for fragment shader keys
We can't attempt to access the fs union member if this is not a FS.
That worked so far since there wasn't a VS shader key at all, but we're
about to introduce one.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Asahi Lina [Wed, 28 Jun 2023 10:07:20 +0000 (19:07 +0900)]
asahi: Gather flat/linear shaded input info from uncompiled FS
We need to propagate shading model metadata from the FS to the VS in
order to correctly lay out the uniforms in the right order. This means
we need VS variants depending on this data.
We could use the existing shader info structure, but that applies to
compiled shaders which would introduce a dependency from the VS compile
to the FS compile. This information does not change with FS variants, so
we can introduce an agx_uncompiled_shader_info structure and gather it
early at precompilation time.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Asahi Lina [Wed, 28 Jun 2023 08:09:19 +0000 (17:09 +0900)]
asahi: Identify the separate varying count fields
Flat/goraud/linear and 32/16 need to be specified separately. This
change identifies the new fields but should be a functional no-op.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Thu, 8 Jun 2023 13:35:30 +0000 (09:35 -0400)]
agx: Assert that barriers are not used in the preamble
It is nonsensical and confuses the hardware.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Thu, 8 Jun 2023 16:05:21 +0000 (12:05 -0400)]
agx: Use nir_opt_shrink_vectors
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Sun, 28 May 2023 02:23:11 +0000 (22:23 -0400)]
agx: Use nir_opt_shrink_stores
This especially helps with image stores, where we otherwise insert a bunch of
pointless moves to collect a vector even when we know the format only has a
single channel.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Wed, 7 Jun 2023 00:08:09 +0000 (20:08 -0400)]
asahi: Remove ; in perf_debug_ctx
Otherwise `if(x) perf_debug_ctx(); else if (y) ...` doesn't work.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Thu, 15 Jun 2023 18:19:36 +0000 (14:19 -0400)]
asahi: Identify PBE::sRGB flag
Needed to write out sRGB images correctly.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Fri, 19 May 2023 17:05:39 +0000 (13:05 -0400)]
asahi: Rename 'Render Target' to 'PBE'
It's used for all PBE operations, including regular image writes, so use the
more general name. Compare the powervr driver.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Tue, 6 Jun 2023 22:56:05 +0000 (18:56 -0400)]
asahi: Strip ? in GenXML
Sometimes it's nice to have boolean flags with ? in the name, allow this by
stripping ? when generating the sanitized C name.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Asahi Lina [Wed, 28 Jun 2023 11:46:27 +0000 (20:46 +0900)]
asahi: match_soa: Treat offsets as signed
An offset may be negative, indexing backwards from the array base.
When we right shift an offset by the format shift, we need to use a
signed shift to ensure that the resulting offset is still negative.
Fixes Nautilus faults/pink crashes.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Fri, 16 Jun 2023 12:31:40 +0000 (08:31 -0400)]
agx: Smarten discard_agx -> sample_mask lowering
In
97a1bbeaf26 ("agx: Fix discards"), we made our discard lowering very simple,
since we had just discovered the underlying instruction behaviour and needed a
hotfix for misrendering in the wild. Now that we understand the behaviour, we
can do better. There are two potential performance issues with the lowering in
that commit:
1. It generates extra sample_mask instructions. For a shader that has a single
discard_if at root level, it would generate two instructions
sample_mask foo, 0
sample_mask ~0, ~0
rather than a single
sample_mask ~0, ~foo
2. It runs depth/stencil testing/updates at the end of the shader, even when it
could be run immediately after the discard. This might cause pipeline stalls.
The solution is to insert the "trigger testing" sample_mask instruction as soon
after the "discard" instruction as possible, fusing them if they would be next
to each other. There are two cases:
1. The last discard is executed unconditionally. In this case, we can test
immediately after, unconditionally, and fuse together.
2. The last discard is executed conditionally. In this case, we test in the
first unconditional block after the discard. Example shader:
...
loop {
if .. {
loop {
discard_if <-- discard here
...
}
..
}
...
}
<---- we test here
...
store_output
Together this covers all the usual patterns for single-sampled discard. We could
still do better with multisampling, but whatever.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Alyssa Rosenzweig [Fri, 16 Jun 2023 12:55:58 +0000 (08:55 -0400)]
agx: Add algebraic opt to help with discard lowering
When lowering discards, it will be convenient to generate the pattern:
(cond ? 255 : 0) ^ 255
Add rules to optimize that to
(cond ? 0 : 255)
This is not part of the main algebraic optimizer since this lowering happens
late.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
Mike Blumenkrantz [Mon, 10 Apr 2023 16:40:26 +0000 (12:40 -0400)]
zink: don't destroy swapchain on initial CreateSwapchainKHR fail
this used to be correct at some point but now it no longer is
cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23970>
Dave Airlie [Wed, 5 Jul 2023 00:22:06 +0000 (10:22 +1000)]
gallivm: make block_size use discrete values.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23997>
Dave Airlie [Wed, 5 Jul 2023 00:19:08 +0000 (10:19 +1000)]
gallivm: convert grid_size to discrete values.
No use in storing this in a vector
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23997>
Dave Airlie [Wed, 5 Jul 2023 00:16:59 +0000 (10:16 +1000)]
gallivm: convert block_id to discrete values.
There is no reason to stick these in a vector
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23997>
Dave Airlie [Wed, 5 Jul 2023 00:12:47 +0000 (10:12 +1000)]
gallivm: store thread id in separate values.
There is no real advantage to putting this into a vector to take
it back out again.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23997>
Hyunjun Ko [Tue, 4 Jul 2023 06:42:41 +0000 (15:42 +0900)]
anv/video: fix to support HEVC 10bit on some of 9th gens.
From Broxton and Kabylake, it started supporting HEVC 10-bit decoding.
Fixes:
649e12c8973 ("anv_video: reject decoding of unsupported profiles
and formats")
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23985>
Joshua Ashton [Mon, 3 Jul 2023 21:32:15 +0000 (22:32 +0100)]
radv: Remove unused pipeline param from radv_generate_pipeline_key
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23912>
Joshua Ashton [Wed, 28 Jun 2023 17:35:06 +0000 (18:35 +0100)]
radv: Advertise VK_EXT_pipeline_robustness
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23912>
Joshua Ashton [Wed, 28 Jun 2023 17:34:31 +0000 (18:34 +0100)]
radv: Implement VK_EXT_pipeline_robustness
Funnel the data from the pNext into the new pipeline key members for buffer robustness
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23912>
Joshua Ashton [Mon, 3 Jul 2023 19:23:13 +0000 (20:23 +0100)]
radv: Rename radv_required_subgroup_info to radv_shader_stage_key
Additionally, prefix the members that are subgroup related with subgroup_
We will use this structure to store pipeline robustness information.
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23912>
Joshua Ashton [Wed, 28 Jun 2023 17:31:51 +0000 (18:31 +0100)]
radv: Split and move buffer robustness to shader key
Will be used by pipeline robustness.
There is also loads of space in the first dword.
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23912>
Joshua Ashton [Wed, 28 Jun 2023 17:28:57 +0000 (18:28 +0100)]
radv: Rename radv_nir_compiler_options::robust_buffer_access to robust_buffer_access_llvm
This is only used by LLVM, make that clearer.
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23912>
Joshua Ashton [Wed, 28 Jun 2023 16:34:58 +0000 (17:34 +0100)]
radv: Refactor buffer robustness to an enum
Will be taken advantage of with pipeline robustness.
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23912>
José Roberto de Souza [Mon, 3 Jul 2023 19:33:57 +0000 (12:33 -0700)]
anv: Drop unnecessary intel_canonical_address() calls around bo->offset
bo->offset is set as canonical address no need to do it over again.
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23977>