platform/upstream/mesa.git
15 months agovk/wsi: unify dmabuf exporting
Mike Blumenkrantz [Thu, 15 Jun 2023 17:26:23 +0000 (13:26 -0400)]
vk/wsi: unify dmabuf exporting

Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Joshua Ashton <joshua@froggi.es>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23835>

15 months agovk/wsi/x11: stop roundtripping on presentation
Mike Blumenkrantz [Thu, 15 Jun 2023 14:36:19 +0000 (10:36 -0400)]
vk/wsi/x11: stop roundtripping on presentation

there's no requirement to return SUBOPTIMAL based on processed events
at present time, nor is SURFACE_LOST required here vs as a result of
acquire, so allow both of these conditions to be reported there instead

improves presentation perf by ~60%

Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Joshua Ashton <joshua@froggi.es>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23835>

15 months agovk/wsi/x11: handle geometry updating more asynchronously
Mike Blumenkrantz [Tue, 13 Jun 2023 20:55:45 +0000 (16:55 -0400)]
vk/wsi/x11: handle geometry updating more asynchronously

this uses geometry updates from events when possible in order to avoid
roundtripping during vkGetPhysicalDeviceSurfaceCapabilitiesKHR, which
significantly improves wsi performance in severely bottlenecked scenarios

now that roundtripping is completely eliminated from acquires in most scenarios,
this improves acquire perf by 10%+

Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23835>

15 months agovk/wsi/x11: move surface alpha check from get_caps to creation
Mike Blumenkrantz [Tue, 13 Jun 2023 20:18:44 +0000 (16:18 -0400)]
vk/wsi/x11: move surface alpha check from get_caps to creation

this makes get_caps a bit less heavy

Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23835>

15 months agozink: Free the cdt when an error occurs
xurui [Thu, 6 Jul 2023 03:04:10 +0000 (11:04 +0800)]
zink: Free the cdt when an error occurs

Signed-off-by: xurui <xurui@kylinos.cn>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24012>

15 months agonir/opt_shrink_vectors: enable sparse intrinsics shrinking
Lionel Landwerlin [Tue, 4 Jul 2023 12:06:50 +0000 (15:06 +0300)]
nir/opt_shrink_vectors: enable sparse intrinsics shrinking

Image sparse loads can be stripped from their sparse component if
unused and turned into non sparse variants.

Texture sparse accesses can also be turned off if unused.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23995>

15 months agointel/fs: disable coarse pixel shader with interpolater messages at sample
Lionel Landwerlin [Sat, 1 Jul 2023 20:36:19 +0000 (23:36 +0300)]
intel/fs: disable coarse pixel shader with interpolater messages at sample

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9292
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23962>

15 months agorusticl: Drop Program::kernel_count
Antonio Gomes [Wed, 5 Jul 2023 01:08:01 +0000 (22:08 -0300)]
rusticl: Drop Program::kernel_count

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23999>

15 months agorusticl: Drop some Kernel data and have a NirKernelBuild ref instead
Antonio Gomes [Wed, 5 Jul 2023 00:33:41 +0000 (21:33 -0300)]
rusticl: Drop some Kernel data and have a NirKernelBuild ref instead

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23999>

15 months agotgsi: uint -> unsigned
Erik Faye-Lund [Mon, 26 Jun 2023 07:43:07 +0000 (09:43 +0200)]
tgsi: uint -> unsigned

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agotgsi: uint -> uint32_t
Erik Faye-Lund [Mon, 26 Jun 2023 08:25:50 +0000 (10:25 +0200)]
tgsi: uint -> uint32_t

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agotgsi: use enum for interpolate-mode
Erik Faye-Lund [Mon, 26 Jun 2023 09:57:39 +0000 (11:57 +0200)]
tgsi: use enum for interpolate-mode

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agotgsi: use enum for shader-type
Erik Faye-Lund [Mon, 26 Jun 2023 09:30:57 +0000 (11:30 +0200)]
tgsi: use enum for shader-type

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agotgsi: use enum for property-name
Erik Faye-Lund [Mon, 26 Jun 2023 09:51:26 +0000 (11:51 +0200)]
tgsi: use enum for property-name

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agotgsi: use enum for tgsi-file type
Erik Faye-Lund [Mon, 26 Jun 2023 09:21:08 +0000 (11:21 +0200)]
tgsi: use enum for tgsi-file type

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agotgsi: use stdint.h types
Erik Faye-Lund [Mon, 26 Jun 2023 08:31:40 +0000 (10:31 +0200)]
tgsi: use stdint.h types

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agotgsi: use enum instead of defines
Erik Faye-Lund [Fri, 30 Jun 2023 11:24:36 +0000 (13:24 +0200)]
tgsi: use enum instead of defines

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agoaux/util: uint -> unsigned
Erik Faye-Lund [Mon, 26 Jun 2023 07:43:07 +0000 (09:43 +0200)]
aux/util: uint -> unsigned

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agoaux/util: use stdint.h types
Erik Faye-Lund [Mon, 26 Jun 2023 08:31:37 +0000 (10:31 +0200)]
aux/util: use stdint.h types

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agoaux/util: use unsigned instead of uint
Erik Faye-Lund [Fri, 23 Jun 2023 14:46:48 +0000 (16:46 +0200)]
aux/util: use unsigned instead of uint

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agoaux/util: use enum for primitive-type
Erik Faye-Lund [Fri, 23 Jun 2023 14:50:49 +0000 (16:50 +0200)]
aux/util: use enum for primitive-type

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agoaux/util: match type of pipe_draw_start_count_bias::start/count
Erik Faye-Lund [Fri, 23 Jun 2023 14:48:29 +0000 (16:48 +0200)]
aux/util: match type of pipe_draw_start_count_bias::start/count

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agoaux/util: use enum for render-condition
Erik Faye-Lund [Fri, 23 Jun 2023 14:46:30 +0000 (16:46 +0200)]
aux/util: use enum for render-condition

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agoaux/pp: use unsigned instead of uint
Erik Faye-Lund [Fri, 23 Jun 2023 14:43:42 +0000 (16:43 +0200)]
aux/pp: use unsigned instead of uint

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agogallivm: use unsigned instead of uint
Erik Faye-Lund [Fri, 23 Jun 2023 14:21:37 +0000 (16:21 +0200)]
gallivm: use unsigned instead of uint

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agopipebuffer: use unsigned instead of uint
Erik Faye-Lund [Fri, 23 Jun 2023 14:19:10 +0000 (16:19 +0200)]
pipebuffer: use unsigned instead of uint

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agoaux/trace: use stdint.h types
Erik Faye-Lund [Fri, 23 Jun 2023 14:17:11 +0000 (16:17 +0200)]
aux/trace: use stdint.h types

...as well as stdbool.h ;)

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>

15 months agomath: drop MAT_[ST][XYZ] defines
Erik Faye-Lund [Mon, 26 Jun 2023 13:38:30 +0000 (15:38 +0200)]
math: drop MAT_[ST][XYZ] defines

These were used a single time each, and that argually made the code a
bit more confusing to read. Let's just drop these, and use the correct
indexes directly.

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>

15 months agomath: remove unused defines
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>

15 months agomath: fix indentation in m_matrix.[ch]
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>

15 months agolima: use u_pipe_screen_lookup_or_create in the renderonly path too
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>

15 months agodocs/features.txt(fix): mark VK_EXT_pipeline_robustness as supported on radv
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>

15 months agovbo: correctly restore _VaryingInputs for display list fast path
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>

15 months agost/glsl: merge st_glsl_to_ir.cpp with st_glsl_to_nir.cpp
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>

15 months agost/glsl: merge st_link_glsl_to_nir() into st_link_nir()
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>

15 months agost/glsl: merge link_shader() into st_link_nir()
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>

15 months agoglsl: remove glsl ir optimisation loop from linker
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>

15 months agoglsl: move store_fragdepth_layout() to nir linker
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>

15 months agoglsl: drop link_invalidate_variable_locations()
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>

15 months agoglsl: set last_vert_prog in the nir linker
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>

15 months agoglsl: inline link_varyings()
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>

15 months agoglsl: remove the always_active_io flag from GLSL IR
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>

15 months agoglsl: move disable_varying_optimizations_for_sso() to NIR linker
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>

15 months agonir/glsl: add nir_var_declared_implicitly enum
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>

15 months agoglsl: drop the dce of global vars from GLSL IR linker
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>

15 months agoglsl: remove unused system vars
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>

15 months agoglsl: remove unused buffer objects with packed layout
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>

15 months agoglsl: call assign_attribute_or_color_locations() in NIR linker
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>

15 months agoglsl: port assign location code for VS inputs or FS outputs
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>

15 months agoglsl: move lowering linker code out of st
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>

15 months agoglsl: move some compiler code out of st
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>

15 months agomesa: add some new constants
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>

15 months agoglsl: add some more c wrappers for string_to_uint_map
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>

15 months agobroadcom/compiler: don't leak v3d_compile when finding a new best strategy
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>

15 months agobroadcom/compiler: free defin and defout arrays if they already exist
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>

15 months agotu: Add missing dbg reg stomping to tu_CmdBeginRendering
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>

15 months agollvmpipe,lavapipe: Relayout lp_descriptor
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>

15 months agollvmpipe: Allocate more dummy sample functions for FORMAT_NONE
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>

15 months agollvmpipe: Allow comparison sampling for float formats
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>

15 months agolavapipe: Set the descriptor count to what vkd3d-proton requires
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>

15 months agogallivm: Fix atomic_global types
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>

15 months agoglsl: Fix yylloc.source propagation in YYLLOC_DEFAULT
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>

15 months agoradeonsi: fix refcnt imbalance related to util_blitter_save_fragment_constant_buffer_...
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>

15 months agoclc: llvm 17 requires opaque pointers.
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>

15 months agor300: assert that every writer has a reader
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>

15 months agor300: disable ntt regalloc for vertex shaders
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>

15 months agor300: remove most of backend contant folding
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>

15 months agor300: add some early safe bool lowering
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>

15 months agor300: lower undefs to zero
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>

15 months agoradeonsi: Use ALIGN_POT instead ALIGN_TO
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>

15 months agoradv: Re-enable RT pipeline capture/replay handles
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>

15 months agoradv/rt: Rework radv_GetRayTracingCaptureReplayShaderGroupHandlesKHR
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>

15 months agoradv/rt: Replay shader allocations according to capture/replay handle
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>

15 months agoradv/rt: Associate capture/replay handles with stages
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>

15 months agoradv/rt: Only compare the non-recursive capture/replay handle
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>

15 months agoradv: Add radv_rt_capture_replay_handle
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>

15 months agoradv: Add support for creating capture/replay shaders
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>

15 months agoradv: Split up implementation of radv_shader_create
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>

15 months agoradv: Break up radv_shader_nir_to_asm
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>

15 months agoradv: Add radv_shader_reupload
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>

15 months agoradv: Add utilities to serialize and deserialize shader allocation info
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>

15 months agoradv: Add option to allocate shaders in replayable VA range
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>

15 months agoradv: Move shader arena allocation to a separate function
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>

15 months agoradv: Add radv_shader_free_list
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>

15 months agoiris: Convert slab address to canonical
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>

15 months agonir: Fix breaking in nir_foreach_phi(_safe)
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>

15 months agokmsro: assert that scanout refcount is larger than 0
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>

15 months agopanfrost: remove BO from cache before closing GEM
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>

15 months agowinsys/panfrost: Make sure we reset scanout on error in create_kms_dumb_buffer_for_re...
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>

15 months agorenderonly: Make sure we reset scanout on error in create_kms_dumb_buffer_for_resource()
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>

15 months agorenderonly: Fix potential NULL deref in the error path
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>

15 months agowinsys/panfrost: Fix a scanout resource leak
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>

15 months agoaux/trace: fix bindless texture dumping
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>

15 months agoasahi: Use txf_ms for MSAA background programs
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>

15 months agoagx: Don't leak ssa_to_reg_out
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>

15 months agoasahi: Take ownership of compute shader NIR
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>

15 months agoasahi: Use ralloc harder
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>

15 months agoasahi: Fix scissor_culls_everything check
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>

15 months agoasahi: Assert we don't transition shared resources
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>

15 months agoasahi: Arrange VS varyings in the correct order
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>