platform/upstream/mesa.git
12 months agoglthread: determine global locking once every 64 batches to fix get_time perf
Marek Olšák [Sat, 15 Jul 2023 12:22:37 +0000 (08:22 -0400)]
glthread: determine global locking once every 64 batches to fix get_time perf

This mitigates a large perf degradation when the clock source is HPET instead of TSC.
Just call get_time less frequently.

Fixes: 3ed141e9 - glthread: add a heuristic to stop locking global mutexes with multiple contexts
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8910

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24168>

12 months agoac/nir: always round cube array layers
Rhys Perry [Wed, 12 Jul 2023 20:14:26 +0000 (21:14 +0100)]
ac/nir: always round cube array layers

It seems this is still necessary if conformant_trunc_coord=true.

Fixes various dEQP-VK.texture.shadow.cube_array.* and
dEQP-VK.glsl.texture_functions.texture*samplercubearray* failures with
conformant_trunc_coord.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Cc: 23.2 <mesa-stable>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24137>

12 months agoradv: don't unset TRUNC_COORD if conformant_trunc_coord=true
Rhys Perry [Wed, 12 Jul 2023 19:51:14 +0000 (20:51 +0100)]
radv: don't unset TRUNC_COORD if conformant_trunc_coord=true

This isn't necessary.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24137>

12 months agoradv: add conformant_trunc_coord to cache UUID
Rhys Perry [Wed, 12 Jul 2023 19:50:53 +0000 (20:50 +0100)]
radv: add conformant_trunc_coord to cache UUID

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24137>

12 months agoac/llvm: skip ballot zext for 32-bit dest with wave32-as-wave64
Rhys Perry [Thu, 13 Jul 2023 15:37:11 +0000 (16:37 +0100)]
ac/llvm: skip ballot zext for 32-bit dest with wave32-as-wave64

NGG lowering can ballots with a 32-bit destination even if the ballot bit
size is 64.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24140>

12 months agoac/llvm: fix wave32 ac_build_mbcnt_add with 64-bit mask
Rhys Perry [Thu, 13 Jul 2023 13:46:49 +0000 (14:46 +0100)]
ac/llvm: fix wave32 ac_build_mbcnt_add with 64-bit mask

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24140>

12 months agoradv: fix radv_get_ballot_bit_size with CS
Rhys Perry [Thu, 13 Jul 2023 13:37:15 +0000 (14:37 +0100)]
radv: fix radv_get_ballot_bit_size with CS

For wave64-as-wave32, this would return 32.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24140>

12 months agoac/llvm: fix AC_TM_CHECK_IR
Rhys Perry [Thu, 13 Jul 2023 13:25:04 +0000 (14:25 +0100)]
ac/llvm: fix AC_TM_CHECK_IR

This was using the wrong pass.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Fixes: 3f272fd15e9 ("ac/llvm: fix build with LLVM 17")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24140>

12 months agoetnaviv: remove bogus comment about replacing resource storage
Lucas Stach [Fri, 14 Jul 2023 17:01:51 +0000 (19:01 +0200)]
etnaviv: remove bogus comment about replacing resource storage

While we might want to employ this orphaning trick one day to avoid stalls
on busy resources it's certainly not as easy as the comment implies, as
this would involve changing all relocs in cached state objects referencing
the resource.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24164>

12 months agoetnaviv: remove always true assert in etna_transfer_unmap
Lucas Stach [Fri, 14 Jul 2023 16:59:56 +0000 (18:59 +0200)]
etnaviv: remove always true assert in etna_transfer_unmap

The level parameter is already checked in etna_transfer_map, so there
is no way that the unmap could end up violating the assert.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24164>

12 months agoetnaviv: remove superfluous braces
Lucas Stach [Fri, 14 Jul 2023 16:53:57 +0000 (18:53 +0200)]
etnaviv: remove superfluous braces

etnaviv gernerally uses the style where no braces are used if the
statement inside a conditional clause fits on a single line. Remove
some superfluous braces to be more consistent.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24164>

12 months agoetnaviv: move buffer range tracking into the PIPE_MAP_WRITE clause
Lucas Stach [Fri, 14 Jul 2023 16:50:46 +0000 (18:50 +0200)]
etnaviv: move buffer range tracking into the PIPE_MAP_WRITE clause

Move the valid buffer range tracking next to all the other things we
do on write mapping.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24164>

12 months agoetnaviv: remove huge outdated comment
Lucas Stach [Fri, 14 Jul 2023 16:30:48 +0000 (18:30 +0200)]
etnaviv: remove huge outdated comment

The comment makes it seem like we don't track resource status, which might
have been the case long ago, before the driver was even merged in upstream
Mesa, but is definitely no longer true. The kernel driver keeps track of
submitted work on BOs, the Mesa driver properly tracks unsubmitted usages
of any resource.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24164>

12 months agoetnaviv: reword comment about staging resource usage
Lucas Stach [Fri, 14 Jul 2023 16:26:25 +0000 (18:26 +0200)]
etnaviv: reword comment about staging resource usage

The current wording isn't really accurate. It talks about depth surfaces,
while in reality any surface used by the PE can have TS allocated. Also
with compression the TS doesn't only track "holes" aka clear tiles, but
instead carries the compression tags.

Reword to hopefully match reality a bit better.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24164>

12 months agoetnaviv: check for valid TS as condition to create the staging resource
Lucas Stach [Fri, 14 Jul 2023 16:09:59 +0000 (18:09 +0200)]
etnaviv: check for valid TS as condition to create the staging resource

Presence of the TS buffer doesn't necessarily mean that there is valid
TS information that we need to take into account. This is pretty harmless
as the blit into the staging resource will just ignore invalid TS data
and most TS enabled resources are (super-)tiled anyways, which we will
handle with a staging resource nonetheless, but better not keep this bad
example around and replace with the appropriate check.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24164>

12 months agoetnaviv: don't allocate full resource as transfer staging
Lucas Stach [Fri, 14 Jul 2023 15:54:45 +0000 (17:54 +0200)]
etnaviv: don't allocate full resource as transfer staging

The transfer only targets a specific level of a resource, so we don't
need to allocate all potential resource levels for the staging resource,
but instead shrink the allocation to a single level.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24164>

12 months agoetnaviv: split etna_copy_resource_box levels parameter in src/dst
Lucas Stach [Fri, 14 Jul 2023 15:47:07 +0000 (17:47 +0200)]
etnaviv: split etna_copy_resource_box levels parameter in src/dst

Allow to copy between different level in the source and destination
resource.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24164>

12 months agoiris: fix iris for WA 16013000631
Rohan Garg [Sat, 15 Jul 2023 13:59:50 +0000 (15:59 +0200)]
iris: fix iris for WA 16013000631

iris needs to emit a PIPE_CONTROL_INSTRUCTION_INVALIDATE for the
aforementioned WA.

Fixes: 83716b08c ('iris: migrate WA 14013910100 to use the WA framework')
Signed-off-by: Rohan Garg <rohan.garg@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24171>

12 months agoisl: add a tool to query surface parameters
Lionel Landwerlin [Thu, 13 Jul 2023 09:27:06 +0000 (12:27 +0300)]
isl: add a tool to query surface parameters

$ ./build/src/intel/isl/isl_query -p dg2 -w 128 -h 64 -l 4
Surface parameters:
  dim:                 2d
  dim_layout:          0
  msaa_layout:         0
  tiling:              64
  format:              R8G8B8A8_UNORM
  img_align_el:        128x128x1
  logical_level0_px:   128x64x1x1
  phys_level0_sa:      128x64x1x1
  levels:              4
  samples:             1x
  size_B:              131072
  alignment_B:         65536
  row_pitch_B:         512
  array_pitch_el_rows: 256
  tile_info:
    tiling:             64
    format_bpb:         32
    logical_extent_el:  128x128x1x1
    phys_extent_B:      512x128 = 65536

$./build/src/intel/isl/isl_query -p skl -w 128 -h 64 -l 4 -f R8G8B8_UINT
Surface parameters:
  dim:                 2d
  dim_layout:          0
  msaa_layout:         0
  tiling:              Y0
  format:              R8G8B8_UINT
  img_align_el:        16x4x1
  logical_level0_px:   128x64x1x1
  phys_level0_sa:      128x64x1x1
  levels:              4
  samples:             1x
  size_B:              36864
  alignment_B:         4096
  row_pitch_B:         384
  array_pitch_el_rows: 96
  tile_info:
    tiling:             Y0
    format_bpb:         8
    logical_extent_el:  128x32x1x1
    phys_extent_B:      128x32 = 4096

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

12 months agoci/freedreno: add another a530 flakes
David Heidelberg [Sun, 16 Jul 2023 00:11:07 +0000 (02:11 +0200)]
ci/freedreno: add another a530 flakes

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24079>

12 months agoci/freedreno: fix unexpectedpass flake on a630
David Heidelberg [Sun, 16 Jul 2023 00:09:27 +0000 (02:09 +0200)]
ci/freedreno: fix unexpectedpass flake on a630

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24079>

12 months agoci/lima: EGL testing was disabled when fp16 fail was removed
David Heidelberg [Fri, 14 Jul 2023 16:53:40 +0000 (18:53 +0200)]
ci/lima: EGL testing was disabled when fp16 fail was removed

fd4d0e1cc23f ("st/mesa: Set gl_config.floatMode based on color_format"),
fixed this functionality across multiple drivers, but EGL testing on
Mali was disabled back then, theofore it still fails here.

Acked-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Acked-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24079>

12 months agoci/radeonsi: stoney arb_timer_query got fixed between kernel 6.3.1..13
David Heidelberg [Fri, 14 Jul 2023 00:52:15 +0000 (02:52 +0200)]
ci/radeonsi: stoney arb_timer_query got fixed between kernel 6.3.1..13

Acked-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Acked-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24079>

12 months agoRevert "lima/ci: temporarily disable deqp-egl tests due to timeouts"
David Heidelberg [Fri, 14 Jul 2023 00:51:16 +0000 (02:51 +0200)]
Revert "lima/ci: temporarily disable deqp-egl tests due to timeouts"

This reverts commit be2619766be3f4ee0b22a10f8db179dc1e3c5773.

Acked-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Acked-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24079>

12 months agoci/freedreno: add fails introduced by upreving to 6.3.13
David Heidelberg [Tue, 11 Jul 2023 22:19:58 +0000 (00:19 +0200)]
ci/freedreno: add fails introduced by upreving to 6.3.13

Some of these fails/crashes was already present when trying 6.3.4,
two disappeared, one new crash appeared. Identical `.config`.

See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9247

Acked-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Acked-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24079>

12 months agoci: update kernel to 6.3.13
David Heidelberg [Mon, 10 Jul 2023 23:46:05 +0000 (01:46 +0200)]
ci: update kernel to 6.3.13

Acked-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Acked-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24079>

12 months agoci: build kernel in gfx-ci/linux and just use binaries in Mesa3D CI
David Heidelberg [Sat, 10 Jun 2023 03:16:56 +0000 (05:16 +0200)]
ci: build kernel in gfx-ci/linux and just use binaries in Mesa3D CI

This bring visible speedup while preparing the rootfs and containers.

Acked-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Acked-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24079>

12 months agonir: Devendor load_sample_mask
Alyssa Rosenzweig [Thu, 13 Jul 2023 21:08:18 +0000 (17:08 -0400)]
nir: Devendor load_sample_mask

AGX will use this too for its MSAA lowerings.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24148>

12 months agonir: Add fence_{pbe,mem}_to_tex(_pixel)_agx intrinsics
Alyssa Rosenzweig [Thu, 8 Jun 2023 13:24:13 +0000 (09:24 -0400)]
nir: Add fence_{pbe,mem}_to_tex(_pixel)_agx intrinsics

Read-after-write hazards require special handling on AGX, since image loads are
implemented with texturing. Add intrinsics to handle these hazards.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24148>

12 months agonv50/ir: Support vector movs
Faith Ekstrand [Sat, 15 Jul 2023 05:15:12 +0000 (00:15 -0500)]
nv50/ir: Support vector movs

nir_opt_mov and nir_op_vecN are only the same if the mov is only a
single component.  Otherwise the vec loop will try to access src[c]
where c > 0 which breaks for nir_op_mov.  It's uncommon but scalar
back-ends can see vector movs so we need to handle this correctly.

Fixes: 6513c675ad31 ("nv50/ir/nir: implement nir_alu_instr handling")
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24167>

12 months agoglx: Assign unique serial number to GLXBadFBConfig error
Semjon Kravtsenko [Wed, 21 Jun 2023 07:50:44 +0000 (10:50 +0300)]
glx: Assign unique serial number to GLXBadFBConfig error

Fixes: e89e1f5049d ("glx: Fix error handling yet again in CreateContextAttribs")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9171
Tested-by: yan12125
Co-authored-by: XRevan86
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23762>

12 months agoradeonsi: prefix function with si_ to prevent name collision
WinLinux1028 [Tue, 11 Jul 2023 09:16:01 +0000 (18:16 +0900)]
radeonsi: prefix function with si_ to prevent name collision

Fixed a build error caused by multiple gfx11_init_query symbols when building with iris and radeonsi specified in gallium-drivers.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9238
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24045>

12 months agoisl: Disable MCS compression just on ACM platform
Sagar Ghuge [Tue, 2 May 2023 02:55:19 +0000 (19:55 -0700)]
isl: Disable MCS compression just on ACM platform

We're still seeing failures with render target reads of multisampled
images on Alchemist platforms, but Meteorlake doesn't appear to have
that issue. Enable MCS on Meteorlake.

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22802>

12 months agointel/compiler: Look at 2 register worth of data instead of 4
Sagar Ghuge [Tue, 2 May 2023 02:54:07 +0000 (19:54 -0700)]
intel/compiler: Look at 2 register worth of data instead of 4

Sampler always writes 4/8 register worth of data but for ld_mcs only
valid data is in first two register. So with 16-bit payload, we need to
split 2-32bit registers into 4-16-bit payload.

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22802>

12 months agoiris: migrate WA 14016118574 to use the WA framework
Rohan Garg [Fri, 14 Jul 2023 10:45:37 +0000 (12:45 +0200)]
iris: migrate WA 14016118574 to use the WA framework

Fixes: 58829d9f1 ("iris: implement Wa_14016118574")
Signed-off-by: Rohan Garg <rohan.garg@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24156>

12 months agoiris: migrate WA 14013910100 to use the WA framework
Rohan Garg [Fri, 14 Jul 2023 10:15:33 +0000 (12:15 +0200)]
iris: migrate WA 14013910100 to use the WA framework

Fixes: eeb3f4594d5 ("intel/xehp: Implement XeHP workaround Wa_14013910100.")
Signed-off-by: Rohan Garg <rohan.garg@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24156>

12 months agoUpdate radeon_vcn_enc.c
Thong Thai [Fri, 14 Jul 2023 15:58:44 +0000 (15:58 +0000)]
Update radeon_vcn_enc.c

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

12 months agoradeonsi: enable vcn encoder rgb input support
Thong Thai [Fri, 14 Jul 2023 01:04:25 +0000 (21:04 -0400)]
radeonsi: enable vcn encoder rgb input support

v2: use luma pitch when chroma not available (Ruijing)

Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24151>

12 months agoRevert "ac/nir/ngg: Follow intrinsic sources when analyzing before culling."
Marek Olšák [Thu, 13 Jul 2023 03:09:16 +0000 (23:09 -0400)]
Revert "ac/nir/ngg: Follow intrinsic sources when analyzing before culling."

This reverts commit 411f69b9c5b884f6802758347e72a10ec5564df1.

It broke tessellation in Unigine Heaven with radeonsi.

Fixes: 411f69b9c5b884 - ac/nir/ngg: Follow intrinsic sources when analyzing before culling.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24160>

12 months agoradeonsi: Use DIV_ROUND_UP instead of ALIGN_POT
David Rosca [Thu, 13 Jul 2023 07:14:00 +0000 (09:14 +0200)]
radeonsi: Use DIV_ROUND_UP instead of ALIGN_POT

DIV_ROUND_UP is the correct replacement for ALIGN_TO.

Fixes: ba83c1e2
Signed-off-by: David Rosca <nowrep@gmail.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24127>

12 months agoetnaviv: optimize transfers when whole resource level is discarded
Lucas Stach [Wed, 23 Nov 2022 17:11:18 +0000 (18:11 +0100)]
etnaviv: optimize transfers when whole resource level is discarded

Now that all our age tracking is moved to etna_resource_level we can unlock
some more optimizations in the transfers by skipping copies or flushes when
the whole level is discarded.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: optimize render resource update
Lucas Stach [Fri, 18 Nov 2022 17:23:37 +0000 (18:23 +0100)]
etnaviv: optimize render resource update

Now that we track the age at the resource level we can optimize
the render surface update by only copying the single level we are
going to render to.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: keep blit destination tile status valid if possible
Lucas Stach [Fri, 18 Nov 2022 17:08:06 +0000 (18:08 +0100)]
etnaviv: keep blit destination tile status valid if possible

If the blit was just a resource flush on a uncompressed buffer we can
keep the tile status as valid, as in that case only clear tiles are filled
in the target buffer, but it doesn't hurt to look at the TS buffer when
fetching from this resource as the tile status matches the content of the
buffer. For compressed formats we can't do the same, as the compressed
tiles are uncompressed when flushing the resource, so the compression tags
don't match the buffer content anymore.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: allow sampler TS even if the resource is flushed
Lucas Stach [Fri, 18 Nov 2022 17:00:58 +0000 (18:00 +0100)]
etnaviv: allow sampler TS even if the resource is flushed

As long as the TS is valid we can use the tile status to optimize the
sample fetch, even if the resource has been flushed for any reason.
Do the check for valid TS first when checking whether to enable sampler
TS to avoid all the other checks when TS isn't usable.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: optimize sampler source update
Lucas Stach [Fri, 18 Nov 2022 16:58:02 +0000 (17:58 +0100)]
etnaviv: optimize sampler source update

Now that we track age at the resource level we can optimize
the sampler source update by only copying/flushing the levels
that are actually used by the sampler.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: add tile status buffer status into TS metadata
Lucas Stach [Wed, 16 Nov 2022 20:27:11 +0000 (21:27 +0100)]
etnaviv: add tile status buffer status into TS metadata

When the TS is shared all sharing instances must see the same status
information about the resource TS buffer. Add this information to the
shared TS metadata and make it take precedence over the internal
status tracking when the TS is shared.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: move TS meta into etna_resource_level
Lucas Stach [Wed, 16 Nov 2022 19:47:13 +0000 (20:47 +0100)]
etnaviv: move TS meta into etna_resource_level

Handle imports/exports always deal with one specific level of
a resource, so the shared TS metadata should also be per level.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: add helper to set TS validity
Lucas Stach [Wed, 16 Nov 2022 19:25:35 +0000 (20:25 +0100)]
etnaviv: add helper to set TS validity

Wrap the setting of the resource level TS validity into a
helper function to allow the implementation to change later.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: add helper to get TS validity
Lucas Stach [Wed, 16 Nov 2022 18:22:46 +0000 (19:22 +0100)]
etnaviv: add helper to get TS validity

Add a small helper to get the validity of the TS buffer for
a resource level. We can drop the ts_size check in several
places, as we never set ts_valid to true if there is no TS
buffer.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: add helper to transfer resource level age to another
Lucas Stach [Fri, 18 Nov 2022 16:08:41 +0000 (17:08 +0100)]
etnaviv: add helper to transfer resource level age to another

Add a small helper to transfer the age (seqno) from one resource level
to another.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: add helper to mark resource level as changed
Lucas Stach [Fri, 18 Nov 2022 16:04:46 +0000 (17:04 +0100)]
etnaviv: add helper to mark resource level as changed

Add a small helper to mark a resource level as changed so the
seqno handling is hidden.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: add helper to mark resource level as flushed
Lucas Stach [Fri, 18 Nov 2022 15:57:44 +0000 (16:57 +0100)]
etnaviv: add helper to mark resource level as flushed

Add a small helper to mark a resource level as flushed so the
seqno handling is hidden.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: optimize resource copies by skipping clean levels
Lucas Stach [Fri, 18 Nov 2022 10:04:24 +0000 (11:04 +0100)]
etnaviv: optimize resource copies by skipping clean levels

If we sync/flush a full resource we can skip any level where the
target is of the same age as the source.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: flush destination before executing blit
Lucas Stach [Wed, 7 Dec 2022 14:17:32 +0000 (15:17 +0100)]
etnaviv: flush destination before executing blit

A blit into a render target may destroy valid TS information, as the
destination TS isn't updated. Flush the blit destination when necessary
to make sure that all pending TS is resolved into the destination before
the blit is executed.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoetnaviv: move resource seqnos to level
Lucas Stach [Thu, 17 Nov 2022 17:57:42 +0000 (18:57 +0100)]
etnaviv: move resource seqnos to level

Resource maps, blits and surfaces all target a specific level of a
resource, so they can have different ages. Move the seqnos tracking
the age to etna_resource_level.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>

12 months agoci/etnaviv: update ci expectation
Lucas Stach [Fri, 14 Jul 2023 12:40:18 +0000 (14:40 +0200)]
ci/etnaviv: update ci expectation

Etnaviv fails in the same way as Lima after the merge of
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23735

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24157>

12 months agoir3: Convert to register intrinsics
Alyssa Rosenzweig [Wed, 12 Jul 2023 18:21:43 +0000 (14:21 -0400)]
ir3: Convert to register intrinsics

Thanks to our SSA-based RA, we only use nir_register for arrays, and we only
access array registers with dedicated moves anyway. So there's no reason to need
any fancy coalescing... we can just switch to register access intrinsics and
translate them to moves exactly like we would've done when getting srcs/dests
before.

This addresses the ir3 portion of #9051.

No shader-db changes with a (significant subset of) Rob's shader-db. (Some
shaders are affected by this change but not in any way that shows up in the
stats.)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24126>

12 months agoac/llvm: Remove subgroup_id and num_subgroups intrinsics.
Timur Kristóf [Wed, 5 Jul 2023 12:40:09 +0000 (14:40 +0200)]
ac/llvm: Remove subgroup_id and num_subgroups intrinsics.

We expect that these will be lowered in NIR now.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24005>

12 months agoaco: Remove subgroup_id and num_subgroups intrinsics.
Timur Kristóf [Tue, 4 Jul 2023 12:29:55 +0000 (14:29 +0200)]
aco: Remove subgroup_id and num_subgroups intrinsics.

These are lowered in NIR now.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24005>

12 months agoradeonsi: Use ac_nir_lower_intrinsics_to_args.
Timur Kristóf [Tue, 4 Jul 2023 12:11:11 +0000 (14:11 +0200)]
radeonsi: Use ac_nir_lower_intrinsics_to_args.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24005>

12 months agoradeonsi: Move si_select_hw_stage to si_shader_info.
Timur Kristóf [Mon, 10 Jul 2023 09:06:02 +0000 (11:06 +0200)]
radeonsi: Move si_select_hw_stage to si_shader_info.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24005>

12 months agoradv: Use ac_nir_lower_intrinsics_to_args.
Timur Kristóf [Mon, 3 Jul 2023 15:07:32 +0000 (17:07 +0200)]
radv: Use ac_nir_lower_intrinsics_to_args.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24005>

12 months agoradv: Move radv_select_hw_stage to radv_shader_info.
Timur Kristóf [Mon, 10 Jul 2023 08:36:20 +0000 (10:36 +0200)]
radv: Move radv_select_hw_stage to radv_shader_info.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24005>

12 months agoac/nir: Add new pass to lower intrinsics to shader args.
Timur Kristóf [Mon, 3 Jul 2023 15:07:18 +0000 (17:07 +0200)]
ac/nir: Add new pass to lower intrinsics to shader args.

This is beneficial for intrinsics that do an algebraic
instruction such as bitfield extract on shader arguments,
because it allows NIR to be aware of these instructions and
optimize them together with other algebraic instructions in
the shader.

Currently, just handle subgroup_id and num_subgroups intrinsics.
More will be added here in the future.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24005>

12 months agoac/nir: Simplify arg unpacking when shift is zero.
Timur Kristóf [Mon, 3 Jul 2023 15:06:50 +0000 (17:06 +0200)]
ac/nir: Simplify arg unpacking when shift is zero.

This is so we can just use the same function when it's zero.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24005>

12 months agoaco: Fix subgroup_id intrinsic on GFX10.3+.
Timur Kristóf [Tue, 4 Jul 2023 12:28:45 +0000 (14:28 +0200)]
aco: Fix subgroup_id intrinsic on GFX10.3+.

Change this to match how it works in the LLVM backend.

Cc: mesa-stable
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24005>

12 months agopvr: Submit PR commands
Karmjit Mahil [Mon, 26 Jun 2023 10:52:39 +0000 (11:52 +0100)]
pvr: Submit PR commands

This commit adds a partial render command to job submission.
For geom only jobs we must always submit a pr command in case we
enter SPM. For now, for geom+frag jobs, we'll also always submit
a pr command event.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24138>

12 months agopvr: Restructure `rogue_kmd_stream.xml`
Karmjit Mahil [Thu, 6 Jul 2023 09:26:04 +0000 (10:26 +0100)]
pvr: Restructure `rogue_kmd_stream.xml`

Now things are structured in sections, like the other xml files.
And elements within a section are sorted alphabetically.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24138>

12 months agopvr: Remove some magic numbers and increments from km stream
Karmjit Mahil [Thu, 29 Jun 2023 14:17:57 +0000 (15:17 +0100)]
pvr: Remove some magic numbers and increments from km stream

 - Update and add csbgen definitions to make the content of the
   geom and frag km stream more obvious.

 - Replace some of the hard coded constants with defines.

 - Adds some static assert to make the provenance of definitions
   more clear as well as making sure things fit properly.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24138>

12 months agopvr: Use the SPM EOT on barrier stores
Karmjit Mahil [Mon, 26 Jun 2023 12:09:53 +0000 (13:09 +0100)]
pvr: Use the SPM EOT on barrier stores

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24138>

12 months agopvr: Compile SPM EOT shader
Karmjit Mahil [Wed, 28 Jun 2023 13:39:59 +0000 (14:39 +0100)]
pvr: Compile SPM EOT shader

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24138>

12 months agopvr: Remove mrt setup from SPM EOT
Karmjit Mahil [Wed, 28 Jun 2023 13:39:51 +0000 (14:39 +0100)]
pvr: Remove mrt setup from SPM EOT

Remove the mrt setup stuff since the EOT program only support
output registers for now. When implementing the tile buffer
support this change can be reverted, or things could be changed
to better fit with how the compiler wants things.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24138>

12 months agointel/compiler: remove NV_mesh_shader support
Marcin Ślusarz [Mon, 10 Jul 2023 12:05:37 +0000 (14:05 +0200)]
intel/compiler: remove NV_mesh_shader support

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24071>

12 months agoanv: drop support for VK_NV_mesh_shader
Marcin Ślusarz [Mon, 10 Jul 2023 12:02:28 +0000 (14:02 +0200)]
anv: drop support for VK_NV_mesh_shader

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24071>

12 months agohasvk: remove dead code & comments related to mesh shading
Marcin Ślusarz [Mon, 10 Jul 2023 11:59:37 +0000 (13:59 +0200)]
hasvk: remove dead code & comments related to mesh shading

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24071>

12 months agoiris: avoid duplicating validation entries
Marcin Ślusarz [Tue, 11 Jul 2023 11:57:47 +0000 (13:57 +0200)]
iris: avoid duplicating validation entries

If the *first* BO is not marked as "written", but the same BO is marked
as "written" later, then it will be added twice, because the first
instance will have index_for_handle equal to 0.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24108>

12 months agopvr: skip setting up SPM consts buffer when no const shared regs are used
Frank Binns [Thu, 13 Jul 2023 12:35:39 +0000 (13:35 +0100)]
pvr: skip setting up SPM consts buffer when no const shared regs are used

This is a temporary measure until the zeroed shaders are replaced with the real
ones. This avoids a VK_ERROR_OUT_OF_DEVICE_MEMORY error due to a zero sized
allocation.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Fixes: 1dfd5351249 ("pvr: Setup SPM background object")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24139>

12 months agontt: Switch to new-style registers and modifiers
Alyssa Rosenzweig [Tue, 30 May 2023 15:41:12 +0000 (11:41 -0400)]
ntt: Switch to new-style registers and modifiers

Use all the nir_legacy.h features to transition away from the deprecated
structures. shader-db is quite happy. I assume that's a mix of more aggressive
source mod usage and better coalescing (nir-to-tgsi doesn't copyprop).

   total instructions in shared programs: 900179 -> 887156 (-1.45%)
   instructions in affected programs: 562077 -> 549054 (-2.32%)
   helped: 5198
   HURT: 470
   Instructions are helped.

   total temps in shared programs: 91165 -> 91162 (<.01%)
   temps in affected programs: 398 -> 395 (-0.75%)
   helped: 21
   HURT: 18
   Inconclusive result (value mean confidence interval includes 0).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Tested-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24116>

12 months agonir/legacy: Fix handling of fsat(fabs)
Alyssa Rosenzweig [Thu, 13 Jul 2023 11:13:34 +0000 (07:13 -0400)]
nir/legacy: Fix handling of fsat(fabs)

Consider code like:

    32x4  %2 = @load_interpolated_input (%1, %0 (0x0)) (base=0, component=0, dest_type=float32, io location=VARYING_SLOT_VAR0 slots=1 mediump)  // Color
    32x4  %3 = fabs %2
    32x4  %4 = fsat %3
    32x4  %5 = fsin %4

The existing logic would incorrectly tell the backend that both fabs and fsat
could be folded, and then half the shader disappears. Whoops. Fix by stopping
the folding in this case. I choose to do this check in the fsat rather than the
fabs because it's more straightforward (1 source vs N uses) but it's somewhat
arbitrary.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24116>

12 months agonir/legacy: Fix fneg(load_reg) case
Alyssa Rosenzweig [Wed, 12 Jul 2023 12:17:52 +0000 (08:17 -0400)]
nir/legacy: Fix fneg(load_reg) case

Consider the IR:

   %0 = load_reg
   %1 = fneg %0
   %2 = ffloor %1
   %3 = bcsel .., .., %1

Because the fneg has both foldable and non-foldable users, nir/legacy does not
fold the fneg into the load_reg. This ensures that the backend correctly emits a
dedicated fneg instruction (with the load_reg folded in) for the bcsel to use.
However, because the chasing helpers did not previously take other uses of a
modifier into account, the helpers would fuse in the fneg to the ffloor. Except
that doesn't work, because the load_reg instruction is supposed to be
eliminated. So we end up with broken chased IR:

   1 = fneg r0
   2 = ffloor -NULL
   3 = bcsel, ..., 1

The fix is easy: only fold modifiers into ALU instructions if the modifiers can
be folded away. If we can't eliminate the modifier instruction altogether, it's
not necessarily beneficial to fold it anyway from a register pressure
perspective. So this is probably ok. With that check in place we get correct IR

   1 = fneg r0
   2 = ffloor 1
   3 = bcsel, ..., 1

Fixes carchase/230.shader_test under softpipe.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24116>

12 months agozink: remove venus from renderpass optimizations
Juston Li [Thu, 13 Jul 2023 20:29:42 +0000 (13:29 -0700)]
zink: remove venus from renderpass optimizations

For venus, need to query the underlying driver.
See https://gitlab.freedesktop.org/mesa/mesa/-/issues/9358

Remove venus for now as it is causing crashes on top of anv/radv.

Signed-off-by: Juston Li <justonli@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24147>

12 months agocompiler: Remove blend enums duplicating util
Alyssa Rosenzweig [Tue, 11 Jul 2023 12:59:35 +0000 (08:59 -0400)]
compiler: Remove blend enums duplicating util

Now unused.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24076>

12 months agogallium: Remove pipe->compiler BLEND enum translation
Alyssa Rosenzweig [Tue, 11 Jul 2023 12:59:12 +0000 (08:59 -0400)]
gallium: Remove pipe->compiler BLEND enum translation

Now unused.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24076>

12 months agopanfrost: Convert to PIPE_BLEND enums internally
Alyssa Rosenzweig [Tue, 11 Jul 2023 12:42:36 +0000 (08:42 -0400)]
panfrost: Convert to PIPE_BLEND enums internally

This removes all the users of the compiler enums, and is a lot more natural now
that nir_lower_blend speaks PIPE_BLEND enums.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24076>

12 months agonir/lower_blend: Use util enums
Alyssa Rosenzweig [Tue, 11 Jul 2023 11:51:03 +0000 (07:51 -0400)]
nir/lower_blend: Use util enums

This avoids the silly compiler versions. Some bits are slightly more
complicated, because they have to account for inverted enum values (rather than
a separate invert bit), but this is a LOT friendlier to drivers using the pass
and it makes the pass itself more readable.

The conversion functions in panfrost/panvk will go away momentarily.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24076>

12 months agolvp: Use common blend/logicop translation
Alyssa Rosenzweig [Mon, 10 Jul 2023 22:14:03 +0000 (18:14 -0400)]
lvp: Use common blend/logicop translation

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24076>

12 months agovulkan: Add helpers for blend enum translation
Alyssa Rosenzweig [Mon, 10 Jul 2023 20:27:24 +0000 (16:27 -0400)]
vulkan: Add helpers for blend enum translation

Vulkan drivers that use nir_lower_blend need to translate Vulkan enums to the
common (non-Vulkan) versions used in nir_lower_blend. We don't need to duplicate
that boilerplate in every VK driver that uses nir_lower_blend, move panvk's
versions to common code so we can use them in agxv. I suspect powervr wants this
too.

It might be useful to also share the logic to translate vk_color_blend_state
to nir_lower_blend_options wholesale, but panvk wouldn't use it and agxv is
downstream so it wouldn't have any in-tree users. So I'll keep that part
vendored (for now). For now, let's share the easy win of the enum translation.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24076>

12 months agoutil/blend: Add helpers for normalizing inverts
Alyssa Rosenzweig [Tue, 11 Jul 2023 11:50:35 +0000 (07:50 -0400)]
util/blend: Add helpers for normalizing inverts

To avoid duplicating piles of cases.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24076>

12 months agogallium,util: Move util_blend_dst_alpha_to_one
Alyssa Rosenzweig [Tue, 11 Jul 2023 11:33:21 +0000 (07:33 -0400)]
gallium,util: Move util_blend_dst_alpha_to_one

PanVK will use this too.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24076>

12 months agogallium,util: Move blend enums to util/
Alyssa Rosenzweig [Tue, 11 Jul 2023 14:06:47 +0000 (10:06 -0400)]
gallium,util: Move blend enums to util/

For sharing across the tree.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24076>

12 months agogallium/trace: Collect enums from multiple files
Alyssa Rosenzweig [Tue, 11 Jul 2023 14:06:12 +0000 (10:06 -0400)]
gallium/trace: Collect enums from multiple files

We're going to do some code motions out of p_state.h so the one file assumption
will fail. relax it.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24076>

12 months agodocs: truncate feature list for 23.3-devel
Dylan Baker [Thu, 13 Jul 2023 16:46:44 +0000 (09:46 -0700)]
docs: truncate feature list for 23.3-devel

Which I forgot to do when branching for 23.2

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

12 months agoafuc: Rework and significantly expand README.rst
Connor Abbott [Wed, 12 Jul 2023 18:00:07 +0000 (20:00 +0200)]
afuc: Rework and significantly expand README.rst

This hasn't been updated since the a5xx days, and we've learned much
more since then. I've tried to expand it from a random collection of
notes to a more complete guide to explaining how to read the firmware
and understand the various tricks it uses to make code more compact.

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

12 months agoturnip: Add debug option to allow non-conforming features.
Amber [Fri, 26 May 2023 13:31:43 +0000 (15:31 +0200)]
turnip: Add debug option to allow non-conforming features.

This is because we still may want to be able to expose vulkan 1.3
on some devices that technically do not support it, for instance
the adreno 610 has everything required except multiview, which is
not essential for most games.

Signed-off-by: Amber Amber <amber@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20991>

12 months agofreedreno: Add support for devices not supporting double thread size.
Amber [Mon, 17 Apr 2023 16:53:56 +0000 (18:53 +0200)]
freedreno: Add support for devices not supporting double thread size.

Signed-off-by: Amber Amber <amber@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20991>

12 months agoir3: handle non-uniform case for atomic image/ssbo intrinsics
Amber [Tue, 11 Apr 2023 05:31:46 +0000 (07:31 +0200)]
ir3: handle non-uniform case for atomic image/ssbo intrinsics

Signed-off-by: Amber Amber <amber@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20991>

12 months agofreedreno, turnip: set correct reg_size_vec4 for a6xx_gen1_low
Amber [Mon, 10 Apr 2023 11:49:54 +0000 (13:49 +0200)]
freedreno, turnip: set correct reg_size_vec4 for a6xx_gen1_low

Signed-off-by: Amber Amber <amber@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20991>

12 months agoturnip: make sampler_minmax support configurable.
Amber [Mon, 10 Apr 2023 11:48:36 +0000 (13:48 +0200)]
turnip: make sampler_minmax support configurable.

Signed-off-by: Amber Amber <amber@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20991>

12 months agoturnip: Add support for devices not supporting double thread size.
Amber [Mon, 10 Apr 2023 11:42:25 +0000 (13:42 +0200)]
turnip: Add support for devices not supporting double thread size.

On these devices the actual thread size for compute shaders seems to be
controlled by REG_A6XX_HLSQ_FS_CNTL_0 rather than the CS-related
register.

Signed-off-by: Amber Amber <amber@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20991>

12 months agoir3: make wave_granularity configurable
Amber [Mon, 10 Apr 2023 11:28:31 +0000 (13:28 +0200)]
ir3: make wave_granularity configurable

Signed-off-by: Amber Amber <amber@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20991>