platform/upstream/mesa.git
12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 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>

12 months agoasahi: Add flat/linear shaded varyings mask to the VS shader key
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>

12 months agoasahi: Fix type confusion for fragment shader keys
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>

12 months agoasahi: Gather flat/linear shaded input info from uncompiled FS
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>

12 months agoasahi: Identify the separate varying count fields
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>

12 months agoagx: Assert that barriers are not used in the preamble
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>

12 months agoagx: Use nir_opt_shrink_vectors
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>

12 months agoagx: Use nir_opt_shrink_stores
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>

12 months agoasahi: Remove ; in perf_debug_ctx
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>

12 months agoasahi: Identify PBE::sRGB flag
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>

12 months agoasahi: Rename 'Render Target' to 'PBE'
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>

12 months agoasahi: Strip ? in GenXML
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>

12 months agoasahi: match_soa: Treat offsets as signed
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>

12 months agoagx: Smarten discard_agx -> sample_mask lowering
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>

12 months agoagx: Add algebraic opt to help with discard lowering
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>

12 months agozink: don't destroy swapchain on initial CreateSwapchainKHR fail
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>

12 months agogallivm: make block_size use discrete values.
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>

12 months agogallivm: convert grid_size to discrete values.
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>

12 months agogallivm: convert block_id to discrete values.
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>

12 months agogallivm: store thread id in separate values.
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>

12 months agoanv/video: fix to support HEVC 10bit on some of 9th gens.
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>

12 months agoradv: Remove unused pipeline param from radv_generate_pipeline_key
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>

12 months agoradv: Advertise VK_EXT_pipeline_robustness
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>

12 months agoradv: Implement VK_EXT_pipeline_robustness
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>

12 months agoradv: Rename radv_required_subgroup_info to radv_shader_stage_key
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>

12 months agoradv: Split and move buffer robustness to shader key
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>

12 months agoradv: Rename radv_nir_compiler_options::robust_buffer_access to robust_buffer_access_llvm
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>

12 months agoradv: Refactor buffer robustness to an enum
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>

12 months agoanv: Drop unnecessary intel_canonical_address() calls around bo->offset
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>

12 months agoanv: Drop unnecessary intel_canonical_address() call around anv_address_physical()
José Roberto de Souza [Mon, 3 Jul 2023 16:48:05 +0000 (09:48 -0700)]
anv: Drop unnecessary intel_canonical_address() call around anv_address_physical()

anv_address_physical() already returns a canonical address.

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>

12 months agoanv: Fix some mismatches of canonical and regular addresses around anv_bo_vma_alloc_o...
José Roberto de Souza [Mon, 3 Jul 2023 16:38:10 +0000 (09:38 -0700)]
anv: Fix some mismatches of canonical and regular addresses around anv_bo_vma_alloc_or_close()

anv_vma_alloc() returns a canonical address, but explicit_address is a
regular address. This mismatch can potentially cause issues.

So here making bo->offset as always canonical address by converting it
in the explicit case and fixing the only caller that was caling
anv_bo_vma_alloc_or_close() with a canonical address.

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>

12 months agoRevert "ci/fdno: Pause a660 testing"
Daniel Stone [Tue, 4 Jul 2023 11:17:34 +0000 (12:17 +0100)]
Revert "ci/fdno: Pause a660 testing"

The fastboot/USB/network issue has been resolved.

This reverts commit e207458ad509c6dc670bfdef9e1a3685aa4ee5f4.

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

12 months agoci: restore lima farm
Erico Nunes [Fri, 30 Jun 2023 15:30:23 +0000 (17:30 +0200)]
ci: restore lima farm

The ISP network issues are now resolved.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Acked-by: Vasily Khoruzhick <anarsoul@gmail.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23951>

12 months agov3dv/device: update conformanceVersion
Alejandro Piñeiro [Mon, 3 Jul 2023 23:05:28 +0000 (01:05 +0200)]
v3dv/device: update conformanceVersion

The Vulkan CTS started generating the list of valid versions the
driver can report as conformant against based on the active branches,
and the branch we were reporting up to now is no longer valid.

Fixes dEQP-VK.api.driver_properties.conformance_version

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23980>

12 months agobroadcom: Switch to use nir_foreach_function_impl
Yonggang Luo [Wed, 28 Jun 2023 10:47:10 +0000 (18:47 +0800)]
broadcom: Switch to use nir_foreach_function_impl

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23988>

12 months agov3d: Switch to use nir_foreach_function_impl
Yonggang Luo [Wed, 28 Jun 2023 10:40:46 +0000 (18:40 +0800)]
v3d: Switch to use nir_foreach_function_impl

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23988>

12 months agovc4: Convert to use nir_foreach_function_impl when possible
Yonggang Luo [Thu, 29 Jun 2023 18:54:48 +0000 (02:54 +0800)]
vc4: Convert to use nir_foreach_function_impl when possible

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23988>

12 months agointel/compiler: simplify reading of gl_NumWorkGroups in task/mesh
Marcin Ślusarz [Wed, 5 Apr 2023 10:16:33 +0000 (12:16 +0200)]
intel/compiler: simplify reading of gl_NumWorkGroups in task/mesh

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22334>

12 months agoanv,intel/compiler: enable shortcut in wg id to wg idx lowering on >= gfx12.5
Marcin Ślusarz [Fri, 31 Mar 2023 10:31:19 +0000 (12:31 +0200)]
anv,intel/compiler: enable shortcut in wg id to wg idx lowering on >= gfx12.5

This speeds up vk_meshlet_cadscene in "VK mesh ext" renderer by 1.4%

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22334>

12 months agonir: add cheap shortcut for wg id to wg idx lowering
Marcin Ślusarz [Fri, 31 Mar 2023 10:19:43 +0000 (12:19 +0200)]
nir: add cheap shortcut for wg id to wg idx lowering

... for platforms where integer division is expensive

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22334>

12 months agointel/compiler: pass num_workgroups from task to mesh shaders
Marcin Ślusarz [Fri, 31 Mar 2023 09:58:24 +0000 (11:58 +0200)]
intel/compiler: pass num_workgroups from task to mesh shaders

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22334>

12 months agonir: lower num_workgroups to constants
Marcin Ślusarz [Thu, 6 Apr 2023 13:09:12 +0000 (15:09 +0200)]
nir: lower num_workgroups to constants

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22334>

12 months agonir: use constant components of num_workgroups in wg id to wg idx lowering
Marcin Ślusarz [Fri, 31 Mar 2023 09:56:11 +0000 (11:56 +0200)]
nir: use constant components of num_workgroups in wg id to wg idx lowering

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22334>

12 months agonir: use wg id to wg idx shortcut if two dims of num_workgroups are 1
Marcin Ślusarz [Fri, 31 Mar 2023 09:54:21 +0000 (11:54 +0200)]
nir: use wg id to wg idx shortcut if two dims of num_workgroups are 1

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22334>

12 months agonir: extract try_lower_id_to_index_1d
Marcin Ślusarz [Fri, 31 Mar 2023 09:51:16 +0000 (11:51 +0200)]
nir: extract try_lower_id_to_index_1d

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22334>

12 months agobroadcom: use nir info to keep track of implicit sample shading
Iago Toral Quiroga [Mon, 3 Jul 2023 12:21:14 +0000 (14:21 +0200)]
broadcom: use nir info to keep track of implicit sample shading

It seems NIR is tracking this for us now so we can stop doing this
in the backend.

Also, new CTS tests seem to add the requirement where in the presence of
some builtin's like gl_SampleID in a shader, even if unused, sample shading
is expected to be enabled, which is something we can't track in the backend
since the variable may have been dropped by then.

Fixes 2 failures in:
dEQP-VK.draw.renderpass.implicit_sample_shading.sample*

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23984>

12 months agopvr: Use alignas instead of ALIGN_ATTR and remove ALIGN_ATTR
Yonggang Luo [Tue, 4 Jul 2023 04:35:21 +0000 (12:35 +0800)]
pvr: Use alignas instead of ALIGN_ATTR and remove ALIGN_ATTR

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23982>

12 months agoetnaviv: support OES_texture_half_float_linear
Christian Gmeiner [Mon, 3 Jul 2023 13:36:24 +0000 (15:36 +0200)]
etnaviv: support OES_texture_half_float_linear

Passes all related piglit and deqp tests.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23972>

12 months agodocs: mark OES_texture_half_float done on etnaviv
Christian Gmeiner [Mon, 3 Jul 2023 13:22:11 +0000 (15:22 +0200)]
docs: mark OES_texture_half_float done on etnaviv

Supported by GPUs with HALF_FLOAT feature bit.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23972>

12 months agost/mesa: Set gl_config.floatMode based on color_format
Janne Grunau [Wed, 28 Jun 2023 19:09:50 +0000 (21:09 +0200)]
st/mesa: Set gl_config.floatMode based on color_format

Sets the float color component type in st_visual_to_context_mode()
ensuring float color values are not clamped.
Fixes dEQP-EGL.functional.wide_color.window_fp16_default_colorspace on
asahi, iris and most likely every other driver having it marked as fail
or flake.

Closes: mesa/mesa#9276

Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23914>

12 months agoanv_video: reject decoding of unsupported profiles and formats
Lynne [Fri, 30 Jun 2023 17:34:26 +0000 (19:34 +0200)]
anv_video: reject decoding of unsupported profiles and formats

Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23954>

12 months agolavapipe: expose subgroups in mesh/task shaders.
Dave Airlie [Mon, 3 Jul 2023 20:07:22 +0000 (06:07 +1000)]
lavapipe: expose subgroups in mesh/task shaders.

These are just compute shaders under the hood.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23979>

12 months agoanv: Fix compute maximum number of threads value
José Roberto de Souza [Mon, 3 Jul 2023 15:15:00 +0000 (08:15 -0700)]
anv: Fix compute maximum number of threads value

There is no mention in spec about subtract one of the number of
threads, also Iris and blorp code don't subtract.

Alchemist PRMs: Volume 2a: Command Reference: Instructions: CFE_STATE: Maximum Number of Threads:
Normally set to the maximum number of threads: (# EUs) * (# threads/EU)

Cc: mesa-stable
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23973>

12 months agonir/print: Reformat the preds/succs block information
Caio Oliveira [Tue, 13 Jun 2023 07:10:27 +0000 (00:10 -0700)]
nir/print: Reformat the preds/succs block information

- Always print preds in same line as block name;
- Use a single line for empty blocks;
- Align preds/succs with the instructions.

```
if %29 {
    block b4:    // preds: b3
    32     %30 = load_const (0x00000000 = 0.000000)
    32x4   %31 = @vulkan_resource_index (%30 (0x0)) (desc_set=0, binding=0, desc_type=SSBO)
    32x4   %32 = @load_vulkan_descriptor (%31) (desc_type=SSBO)
    32x4   %33 = deref_cast (Storage *)%32 (ssbo Storage)  (ptr_stride=0, align_mul=4, align_offset=0)
    32x4   %34 = deref_struct &%33->fail (ssbo uint)  // &((Storage *)%32)->fail
    32     %36 = @deref_atomic (%34, %35 (0x1)) (access=1, atomic_op=iadd)
                 // succs: b6
} else {
    block b5:  // preds: b3, succs: b6
}
```

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23564>

12 months agonir/print: Print div/con annotation first
Caio Oliveira [Thu, 15 Jun 2023 20:37:35 +0000 (13:37 -0700)]
nir/print: Print div/con annotation first

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23564>

12 months agonir/print: Use 4-space indentation
Caio Oliveira [Fri, 9 Jun 2023 21:34:48 +0000 (14:34 -0700)]
nir/print: Use 4-space indentation

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23564>

12 months agonir/print: Use `//` for comments
Caio Oliveira [Fri, 9 Jun 2023 21:43:38 +0000 (14:43 -0700)]
nir/print: Use `//` for comments

Makes it easier to copy snippets of shaders into code or
test comments without worrying about conflict with `/* */`.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23564>

12 months agonir/print: Don't use comment syntax for deref_cast properties
Caio Oliveira [Sat, 10 Jun 2023 00:05:59 +0000 (17:05 -0700)]
nir/print: Don't use comment syntax for deref_cast properties

Follow the same syntax as the intrinsic indices, since they
are conceptually similar.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23564>

12 months agonir/print: Rename print_tabs() to print_indentation() and use it more
Caio Oliveira [Fri, 9 Jun 2023 21:25:04 +0000 (14:25 -0700)]
nir/print: Rename print_tabs() to print_indentation() and use it more

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23564>

12 months agonir/print: Align instructions around `=`
Caio Oliveira [Fri, 9 Jun 2023 21:05:58 +0000 (14:05 -0700)]
nir/print: Align instructions around `=`

- For SSA destination, padding is applied before `%`.
- For Reg destination, pad to the SSA size (to align div/con),
  then remaining padding is applied before `r`.
- For instructions without destination, padding is applied so
  they start right after the ` = ` of the cases above.

If the block doesn't have any destinations, there's no padding
is applied to the instructions without destinations in that
block.

For now registers with array access will be unaligned.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23564>

12 months agonir/print: Use BITSIZExELEMENTS for SSA sizes
Caio Oliveira [Fri, 9 Jun 2023 19:12:13 +0000 (12:12 -0700)]
nir/print: Use BITSIZExELEMENTS for SSA sizes

Omits the `x1` part if its one element.

```
32x3   %3 = @load_deref (%0) (access=0)
32     %4 = mov %3.x
32     %5 = deref_var &gl_LocalInvocationID (system uvec3)
32x3   %8 = @load_deref (%5) (access=0)
32     %9 = mov %8.x
```

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23564>

12 months agonir/print: Use `bN` instead of `block_N` for identifying basic blocks
Caio Oliveira [Fri, 9 Jun 2023 18:53:50 +0000 (11:53 -0700)]
nir/print: Use `bN` instead of `block_N` for identifying basic blocks

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23564>

12 months agonir/print: Use symbols % for SSA and @ for intrinsic
Caio Oliveira [Fri, 9 Jun 2023 18:45:12 +0000 (11:45 -0700)]
nir/print: Use symbols % for SSA and @ for intrinsic

The variable uniquifying now uses # instead of @.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23564>

12 months agonir: Add nir_foreach_function_safe and use it
Yonggang Luo [Wed, 28 Jun 2023 17:05:45 +0000 (01:05 +0800)]
nir: Add nir_foreach_function_safe and use it

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23902>

12 months agoradv: Use nir_remove_non_entrypoints in radv_shader.c
Yonggang Luo [Wed, 28 Jun 2023 17:08:21 +0000 (01:08 +0800)]
radv: Use nir_remove_non_entrypoints in radv_shader.c

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23902>

12 months agoglsl: Use nir_remove_non_entrypoints to simplify the code
Yonggang Luo [Wed, 28 Jun 2023 17:06:53 +0000 (01:06 +0800)]
glsl: Use nir_remove_non_entrypoints to simplify the code

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23902>

12 months agonir: Update the comment to call nir_remove_non_entrypoints directly
Yonggang Luo [Wed, 28 Jun 2023 17:04:54 +0000 (01:04 +0800)]
nir: Update the comment to call nir_remove_non_entrypoints directly

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23902>

12 months agodxil: Use nir_remove_non_entrypoints
Yonggang Luo [Wed, 28 Jun 2023 17:03:34 +0000 (01:03 +0800)]
dxil: Use nir_remove_non_entrypoints

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23902>

12 months agoamd: Move ac_hw_stage to its own file
Konstantin Seurer [Wed, 28 Jun 2023 15:30:43 +0000 (17:30 +0200)]
amd: Move ac_hw_stage to its own file

Otherwise ACO has to include ac_shader_util.h which also includes NIR.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23906>

12 months agonir/builder_opcodes: Do not generate empty intrinsic indices
Konstantin Seurer [Tue, 27 Jun 2023 20:17:28 +0000 (22:17 +0200)]
nir/builder_opcodes: Do not generate empty intrinsic indices

Gets rid of all the

struct nir_*_indices {
   int _; /* exists to avoid empty initializers */
};

declarations. 14293 loc -> 12900 loc

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23906>

12 months agonir/opt_dead_cf: Handle if statements ending in a jump correctly
Konstantin Seurer [Sat, 20 May 2023 19:57:57 +0000 (21:57 +0200)]
nir/opt_dead_cf: Handle if statements ending in a jump correctly

If a then/else block ends in a jump, the phi nodes do not necessarily
have to reference the always taken branch because they are dead code.
Avoid crashing in this case by only rewriting phis, if the block does
not end in a jump.

cc: mesa-stable

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23150>