platform/upstream/mesa.git
16 months agoanv: convert Wa_14010455700 to use workaround mechanism
Mark Janes [Mon, 5 Jun 2023 17:13:19 +0000 (10:13 -0700)]
anv: convert Wa_14010455700 to use workaround mechanism

The original lineage for 14010455700 is 1808121037.  Use this defect
number to apply the workaround to relevant platforms with the new
workaround mechanism.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23380>

16 months agoiris: convert Wa_14010455700 to use workaround mechanism
Mark Janes [Thu, 1 Jun 2023 16:18:28 +0000 (09:18 -0700)]
iris: convert Wa_14010455700 to use workaround mechanism

The original lineage for 14010455700 is 1808121037.  Use this defect
number to apply the workaround to relevant platforms with the new
workaround mechanism.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23380>

16 months agoUpdate OpenGL headers
Simon Ser [Fri, 19 May 2023 23:12:41 +0000 (01:12 +0200)]
Update OpenGL headers

Token from commit 91cdaf381d77b6e700654ecd78cb88a95c1fde1a of
OpenGL-Registry.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23144>

16 months agoamd: drop support for LLVM 14
Marek Olšák [Tue, 6 Jun 2023 15:40:13 +0000 (11:40 -0400)]
amd: drop support for LLVM 14

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23471>

16 months agoamd: drop support for LLVM 13
Marek Olšák [Tue, 6 Jun 2023 15:09:11 +0000 (11:09 -0400)]
amd: drop support for LLVM 13

We can remove the LLVM 13 Wave32 discard workaround and
SI_PROFILE_IGNORE_LLVM13_DISCARD_BUG that disabled the workaround.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23471>

16 months agoamd: drop support for LLVM 12
Marek Olšák [Tue, 6 Jun 2023 14:59:46 +0000 (10:59 -0400)]
amd: drop support for LLVM 12

The demote emulation can be removed, and FS_CORRECT_DERIVS_AFTER_KILL
can be removed because it's always enabled on LLVM >= 13.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23471>

16 months agoamd: drop support for LLVM 11
Marek Olšák [Tue, 6 Jun 2023 14:47:03 +0000 (10:47 -0400)]
amd: drop support for LLVM 11

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23471>

16 months agoac/gpu_info: rearrange if checks for dcc config
Yogesh Mohan Marimuthu [Tue, 6 Jun 2023 06:04:05 +0000 (11:34 +0530)]
ac/gpu_info: rearrange if checks for dcc config

rearrange the if checks so that there is less if checks
for newer gpus.

v2: fix block comment coding guideline (Marek Olšák)
    simplify gfx9 if condition (Marek Olšák)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23454>

16 months agoac/gpu_info: num_cu = 4 and gfx11 enable dcc with retile
Yogesh Mohan Marimuthu [Tue, 6 Jun 2023 05:26:16 +0000 (10:56 +0530)]
ac/gpu_info: num_cu = 4 and gfx11 enable dcc with retile

With num_cu = 4 in gfx11 measured power for idle, video playback and observed
power savings, hence enable dcc with retile for gfx11 with num_cu >= 4.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23454>

16 months agoetnaviv: nir: do not call nir_lower_idiv(..) unconditionally
Christian Gmeiner [Mon, 5 Jun 2023 13:32:13 +0000 (15:32 +0200)]
etnaviv: nir: do not call nir_lower_idiv(..) unconditionally

GPUs without native integers lower idiv in lower_int_to_float and
there is no need to call nir_lower_idiv(..) for such GPUs.

Fixes nir crashes I am seeing with gc2000_gles2 CI job.

Fixes: f532202f2d5 ("etnaviv: use nir_lower_idiv(..) before opt loop")
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23450>

16 months agov3d,v3dv: fix viewport offset for negative viewport center
Iago Toral Quiroga [Tue, 6 Jun 2023 08:39:37 +0000 (10:39 +0200)]
v3d,v3dv: fix viewport offset for negative viewport center

If the viewport center is not positive we can't express it
through the fine coordinates, which are unsigned, and we
need to use the coarse coordinates too.

Fixes new crashes in Vulkan CTS 1.3.6.0:
dEQP-VK.draw.renderpass.offscreen_viewport.*negative*

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

16 months agobroadcom/cle: fix up viewport offset packet definition for V3D 4.1+
Iago Toral Quiroga [Tue, 6 Jun 2023 08:38:26 +0000 (10:38 +0200)]
broadcom/cle: fix up viewport offset packet definition for V3D 4.1+

These are split between fine and coarse coordinates. We have only been
using fine until now, so we kept the same naming convention we had
prior to V3D 4.1 for simplicity, but we will start using the coarse
coordinates soon too.

Also, the signedness was reversed: coarse coordinates are signed and
fine coordinates are unsigned.

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

16 months agov3dv: simplify scissor setup for negative viewport height
Iago Toral Quiroga [Mon, 5 Jun 2023 09:39:19 +0000 (11:39 +0200)]
v3dv: simplify scissor setup for negative viewport height

KHR_maintenance1 allows clients to specify a negative
height, but not a negative width, so assert on that and
simplify the computations for the horizontal dimension.

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

16 months agov3dv: remove bogus viewport code
Iago Toral Quiroga [Mon, 5 Jun 2023 08:52:57 +0000 (10:52 +0200)]
v3dv: remove bogus viewport code

This is incorrectly undoing the code right above it.

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

16 months agozink: add a ci flake
Mike Blumenkrantz [Wed, 7 Jun 2023 13:03:40 +0000 (09:03 -0400)]
zink: add a ci flake

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

16 months agozink: enable EXT_shader_object globally with have_EXT_attachment_feedback_loop_dynami...
Mike Blumenkrantz [Thu, 4 May 2023 13:49:23 +0000 (09:49 -0400)]
zink: enable EXT_shader_object globally with have_EXT_attachment_feedback_loop_dynamic_state

this leaves fbfetch as the lone case where it can't yet be used

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

16 months agozink: use dynamic state for feedback loops when available
Mike Blumenkrantz [Thu, 4 May 2023 13:42:22 +0000 (09:42 -0400)]
zink: use dynamic state for feedback loops when available

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

16 months agozink: hook up VK_EXT_attachment_feedback_loop_dynamic_state
Mike Blumenkrantz [Thu, 4 May 2023 13:31:29 +0000 (09:31 -0400)]
zink: hook up VK_EXT_attachment_feedback_loop_dynamic_state

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

16 months agopvr: Fix PDS temps allocation on fragment stage
Karmjit Mahil [Thu, 18 May 2023 16:02:43 +0000 (17:02 +0100)]
pvr: Fix PDS temps allocation on fragment stage

Previously the USC temps count was incorrectly being used for the
PDS temps count.

It was causing:
  csbgen/pvr_packet_helpers.h:79:
    __pvr_uint: Assertion `v <= max' failed.

This fixes the assert being hit on:
  dEQP-VK.ubo.random.basic_arrays.2
  dEQP-VK.ubo.random.all_shared_buffer.3
  dEQP-VK.ubo.random.all_shared_buffer.48
  dEQP-VK.ubo.random.all_out_of_order_offsets.3

This does not fully fix the tests though.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Matt Coster <matt.coster@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23356>

16 months agopvr: Rename temps_count to pds_temps_count
Karmjit Mahil [Thu, 18 May 2023 15:31:34 +0000 (16:31 +0100)]
pvr: Rename temps_count to pds_temps_count

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Matt Coster <matt.coster@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23356>

16 months agopvr: Fix draw indirect page faults due to missing index list buffer
Karmjit Mahil [Fri, 2 Jun 2023 16:19:06 +0000 (17:19 +0100)]
pvr: Fix draw indirect page faults due to missing index list buffer

Fixes:
  dEQP-VK.draw.renderpass.basic_draw.draw_indirect.*
  dEQP-VK.draw.renderpass.basic_draw.draw_indexed_indirect.*

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Matt Coster <matt.coster@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23491>

16 months agotreewide: use uint64_t / (u)intptr_t in image address calculations
Marek Olšák [Fri, 2 Jun 2023 08:01:40 +0000 (04:01 -0400)]
treewide: use uint64_t / (u)intptr_t in image address calculations

16K * 16K * 16bpp = 4G, which overflows int32, so layer_stride needs to
have 64 bits. More generally, any "byte_stride * height" computation
can overflow int32.

Use (u)intptr_t in some gallium and st/mesa places where we do CPU access.
Use uint64_t otherwise.

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

16 months agopvr: add block compressed formats blit support
Oskar Rundgren [Wed, 3 May 2023 10:49:57 +0000 (11:49 +0100)]
pvr: add block compressed formats blit support

Surface dimensions and rectangle mappings need to be adjusted for
block compressed formats.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Matt Coster <matt.coster@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23466>

16 months agomailmap: Add Lucas Fryzek to mailmap
Lucas Fryzek [Wed, 7 Jun 2023 10:58:01 +0000 (12:58 +0200)]
mailmap: Add Lucas Fryzek to mailmap

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

16 months agoci: uprev virglrenderer and crosvm
Corentin Noël [Mon, 5 Jun 2023 07:40:57 +0000 (09:40 +0200)]
ci: uprev virglrenderer and crosvm

Update to their latest version on time

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23427>

16 months agoci: Bump base tag to rebuild piglit
Corentin Noël [Wed, 7 Jun 2023 07:11:26 +0000 (09:11 +0200)]
ci: Bump base tag to rebuild piglit

This has been forgotten in latest piglit uprev

Fixes: d75973a1422d86799312d7aa60d0dce846fb3dba
Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23427>

16 months agoradv: advertise VK_KHR_fragment_shader_barycentric on GFX10.3+
Samuel Pitoiset [Fri, 6 May 2022 11:58:48 +0000 (13:58 +0200)]
radv: advertise VK_KHR_fragment_shader_barycentric on GFX10.3+

It can't be supported on older hardware because it's impossible to
determine the provoking vertex ID without LOAD_PROVOKING_VTX which is
GFX10.3+ only.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6557
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16742>

16 months agoradv: gather info about nir_intrinsic_load_sample_positions_amd
Samuel Pitoiset [Tue, 6 Jun 2023 15:25:41 +0000 (17:25 +0200)]
radv: gather info about nir_intrinsic_load_sample_positions_amd

nir_intrinsic_load_barycentric_coord_at_sample is lowered before the
radv_shader_info pass and load_sample_positions_amd might be needed.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16742>

16 months agoradv: add a NIR pass that lower fragment shader barycentric intrinsics
Samuel Pitoiset [Thu, 26 May 2022 09:37:24 +0000 (11:37 +0200)]
radv: add a NIR pass that lower fragment shader barycentric intrinsics

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16742>

16 months agoradv: configure RSRC1.LOAD_PROVOKING_VTX for the fragment shader
Samuel Pitoiset [Wed, 31 May 2023 07:19:00 +0000 (09:19 +0200)]
radv: configure RSRC1.LOAD_PROVOKING_VTX for the fragment shader

This enables provoking vertex info.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16742>

16 months agoradv: set ROTATE_PC_PTR for custom interpolations
Samuel Pitoiset [Wed, 31 May 2023 07:44:38 +0000 (09:44 +0200)]
radv: set ROTATE_PC_PTR for custom interpolations

This seems needed for computing stable barycentric coordinates.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16742>

16 months agoradv: handle per_vertex variables when gathering FS inputs
Samuel Pitoiset [Wed, 31 May 2023 07:44:21 +0000 (09:44 +0200)]
radv: handle per_vertex variables when gathering FS inputs

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16742>

16 months agoradv: add support for nir_intrinsic_load_rasterization_primitive_amd
Samuel Pitoiset [Wed, 31 May 2023 14:31:15 +0000 (16:31 +0200)]
radv: add support for nir_intrinsic_load_rasterization_primitive_amd

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16742>

16 months agonir: add nir_intrinsic_load_rasterization_primitive_amd
Samuel Pitoiset [Wed, 31 May 2023 14:26:57 +0000 (16:26 +0200)]
nir: add nir_intrinsic_load_rasterization_primitive_amd

For VK_KHR_fragment_shader_barycentric, AMD needs to know the primitive
topology in the fragment shader but with fast-link GPL this is unknown
at compile time and it needs to be passed dynamically.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16742>

16 months agoradv: track if the rasterization primitive is known at compile time
Samuel Pitoiset [Mon, 5 Jun 2023 07:47:09 +0000 (09:47 +0200)]
radv: track if the rasterization primitive is known at compile time

For fast-linking with GPL, we might not know the pre-rasterization
stages at compile time (when only the FS is compiled) and we will need
to load the rasterization primitive through an user SGPR.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16742>

16 months agoradv: add support for nir_intrinsic_load_provoking_vtx_amd
Samuel Pitoiset [Tue, 21 Jun 2022 07:15:24 +0000 (09:15 +0200)]
radv: add support for nir_intrinsic_load_provoking_vtx_amd

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16742>

16 months agonir: add nir_intrinsic_load_provoking_vtx_amd
Samuel Pitoiset [Tue, 21 Jun 2022 07:12:35 +0000 (09:12 +0200)]
nir: add nir_intrinsic_load_provoking_vtx_amd

Will be used to load provoking vertex info from the hardware to
determine the provoking vertex ID.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16742>

16 months ago.mailmap: add an alias for Clayton Craft
Andres Gomez [Mon, 7 Mar 2022 08:49:51 +0000 (10:49 +0200)]
.mailmap: add an alias for Clayton Craft

Signed-off-by: Andres Gomez <agomez@igalia.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Clayton Craft <clayton@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15260>

16 months ago.mailmap: add an alias for Miguel Casas-Sanchez
Andres Gomez [Mon, 7 Mar 2022 08:46:13 +0000 (10:46 +0200)]
.mailmap: add an alias for Miguel Casas-Sanchez

Signed-off-by: Andres Gomez <agomez@igalia.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15260>

16 months agopvr: Don't overwrite PDS vertex input flags
Matt Coster [Mon, 5 Jun 2023 15:31:14 +0000 (16:31 +0100)]
pvr: Don't overwrite PDS vertex input flags

Fixes:
  dEQP-VK.draw.renderpass.simple_draw.simple_draw_triangle_list
  dEQP-VK.draw.renderpass.simple_draw.simple_draw_triangle_strip
  dEQP-VK.draw.renderpass.indexed_draw.draw_indexed_triangle_list
  dEQP-VK.draw.renderpass.indexed_draw.draw_indexed_triangle_strip

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23458>

16 months agopvr: Allow S8_UINT to be used as a stencil attachment format
Matt Coster [Fri, 2 Jun 2023 15:05:50 +0000 (16:05 +0100)]
pvr: Allow S8_UINT to be used as a stencil attachment format

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23431>

16 months agopvr: Refactor pvr_unwind_rects()
Matt Coster [Fri, 2 Jun 2023 09:40:43 +0000 (10:40 +0100)]
pvr: Refactor pvr_unwind_rects()

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23430>

16 months agopvr: Correct calculations in pvr_unwind_rects()
Matt Coster [Thu, 1 Jun 2023 15:15:32 +0000 (16:15 +0100)]
pvr: Correct calculations in pvr_unwind_rects()

Fixes: 6d3d1f884ceadf62e332e797e994b810a0e010b0
       pvr: Fix rect splitting logic in pvr_unwind_rects()

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reported-by: Soroush Kashani <soroush.kashani@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23430>

16 months agoaco: remove memory_barrier_buffer implementation
Rhys Perry [Tue, 28 Feb 2023 16:05:44 +0000 (16:05 +0000)]
aco: remove memory_barrier_buffer implementation

This is no longer used.

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

16 months agoac/nir: use scoped barriers to finish stores before exports
Rhys Perry [Tue, 28 Feb 2023 17:44:33 +0000 (17:44 +0000)]
ac/nir: use scoped barriers to finish stores before exports

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

16 months agoaco: consider position/primitive exports around memory barriers
Rhys Perry [Tue, 28 Feb 2023 17:44:01 +0000 (17:44 +0000)]
aco: consider position/primitive exports around memory barriers

This is needed to create barriers which ensure stores finish before
position/primitive exports.

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

16 months agoaco: use v_fma_mix for f2f32 and f2f16 on gfx11 if wave64
Georg Lehmann [Thu, 20 Apr 2023 13:25:17 +0000 (15:25 +0200)]
aco: use v_fma_mix for f2f32 and f2f16 on gfx11 if wave64

v_fma_mix can be dual issued, trade some code size for throughput.

Foz-DB GFX1100:
Totals from 8204 (6.08% of 134864) affected shaders:
CodeSize: 89608584 -> 89693968 (+0.10%)
Latency: 160744811 -> 160699309 (-0.03%); split: -0.03%, +0.00%
InvThroughput: 19737977 -> 19678308 (-0.30%)

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

16 months agoaco: use v_add_f{16,32} with clamp for fsat
Georg Lehmann [Wed, 22 Feb 2023 16:31:06 +0000 (17:31 +0100)]
aco: use v_add_f{16,32} with clamp for fsat

v_add can be dual issued on gfx11, v_med3 cannot.
Don't use v_add directly to still optimize omod(fsat(x)).

Foz-DB GFX1100:
Totals from 32702 (24.24% of 134913) affected shaders:
Latency: 475008203 -> 474928037 (-0.02%); split: -0.02%, +0.00%
InvThroughput: 59226198 -> 59140787 (-0.14%); split: -0.14%, +0.00%

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

16 months agoaco/statistics: improve v_fma_mix dual issuing detection
Georg Lehmann [Thu, 11 May 2023 15:42:12 +0000 (17:42 +0200)]
aco/statistics: improve v_fma_mix dual issuing detection

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

16 months agoaco/ir: return true in hasRegClass for Operand(reg, rc)
Georg Lehmann [Wed, 7 Jun 2023 08:01:06 +0000 (10:01 +0200)]
aco/ir: return true in hasRegClass for Operand(reg, rc)

Makes isOfType() usable after lower_to_hw_instr.

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

16 months agovulkan/wsi: Remove duplicate NULL check
Vinson Lee [Sat, 3 Jun 2023 23:06:55 +0000 (16:06 -0700)]
vulkan/wsi: Remove duplicate NULL check

Fix defect reported by Coverity Scan.

Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement: return NULL;.

Fixes: eadc64ab248 ("vulkan/wsi/display: do not dereference a NULL pointer")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23415>

16 months agotu: Fix missing unlock
Vinson Lee [Wed, 7 Jun 2023 06:34:31 +0000 (23:34 -0700)]
tu: Fix missing unlock

Fix defect reported by Coverity Scan.

Missing unlock (LOCK)
missing_unlock: Returning without unlocking dev->vma_mutex.

Fixes: c20139c2922 ("tu: Enable bufferDeviceAddressCaptureReplay")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23490>

16 months agoetnaviv: move printing of final shader out of etna_link_shaders(..)
Christian Gmeiner [Fri, 2 Jun 2023 14:55:58 +0000 (16:55 +0200)]
etnaviv: move printing of final shader out of etna_link_shaders(..)

Printing the final shaders in etna_link_shaders(..) can be quite noisy and
does not work when using shader-db. Lets make it possible to stare at the
generaded shader code when using shader-db by moving the etna_dump_shader(..)
call into create_variant(..).

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

16 months agoetnaviv: correct number of instructions in dump_shader_info(..)
Christian Gmeiner [Fri, 2 Jun 2023 14:51:23 +0000 (16:51 +0200)]
etnaviv: correct number of instructions in dump_shader_info(..)

code_size is overall size in uint32 words of the whole shader. As
Vivante GPUs have a fixed size ISA we simply need to divide code_size
by 4 to get the number if ISA instructions.

shader-db shows the correct numbers now.

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

16 months agonv50/ir: convert to scoped_barrier
Karol Herbst [Wed, 24 May 2023 14:30:04 +0000 (16:30 +0200)]
nv50/ir: convert to scoped_barrier

Contrary to how we implemented barriers the MEMBAR instruction actually
does not allow us to specify which memory to synchronize. We can only
specify the scope.

No regressions on TU102.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: M Henning <drawoc@darkrefraction.com>
Signed-off-by: Karol Herbst <git@karolherbst.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23208>

16 months agov3d: handle samplerExternalOES
Juan A. Suarez Romero [Tue, 6 Jun 2023 11:51:38 +0000 (13:51 +0200)]
v3d: handle samplerExternalOES

Add handling for GLSL_SAMPLER_DIM_EXTERNAL.

Fixes `spec@oes_egl_image_external_essl3@oes_egl_image_external_essl3`.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23469>

16 months agovulkan: move nir_convert_ycbcr into vulkan runtime
Yonggang Luo [Mon, 5 Jun 2023 09:26:51 +0000 (17:26 +0800)]
vulkan: move nir_convert_ycbcr into vulkan runtime

This only used by vulkan drivers and depends on vulkan util, so do the move to decouple
nir from vulkan utils

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

16 months agozink: also disable bg compile for compute with nobgc
Mike Blumenkrantz [Wed, 10 May 2023 00:16:52 +0000 (20:16 -0400)]
zink: also disable bg compile for compute with nobgc

forgot this one in the original MR

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

16 months agoci/etnaviv: Update some xfails common between the last 3 nightly runs.
Emma Anholt [Mon, 5 Jun 2023 19:18:23 +0000 (12:18 -0700)]
ci/etnaviv: Update some xfails common between the last 3 nightly runs.

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

16 months agoci/crocus: Update trace hash for the neverball regression.
Emma Anholt [Mon, 5 Jun 2023 19:12:14 +0000 (12:12 -0700)]
ci/crocus: Update trace hash for the neverball regression.

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

16 months agolavapipe: fix memory budget reporting
Mike Blumenkrantz [Thu, 1 Jun 2023 13:18:50 +0000 (09:18 -0400)]
lavapipe: fix memory budget reporting

I put this on the wrong struct

Fixes: 1c42056ee12 ("lavapipe: EXT_memory_budget")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23395>

16 months agolavapipe: don't remove queue family barriers.
Dave Airlie [Tue, 6 Jun 2023 00:59:38 +0000 (10:59 +1000)]
lavapipe: don't remove queue family barriers.

This fixes the remaining barrier issues.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23453>

16 months agollvmpipe: emit fences for barrier.
Dave Airlie [Tue, 6 Jun 2023 00:08:10 +0000 (10:08 +1000)]
llvmpipe: emit fences for barrier.

I tried emitting less here but I'm just gonna hit it with the big
seq_cst hammer.

Fixes:
dEQP-VK.memory_model.message_passing.*

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23453>

16 months agodocs: update venus VK_EXT_device_memory_report support
Yiwei Zhang [Thu, 1 Jun 2023 23:56:05 +0000 (16:56 -0700)]
docs: update venus VK_EXT_device_memory_report support

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23411>

16 months agovenus: enable VK_EXT_device_memory_report
Yiwei Zhang [Thu, 1 Jun 2023 23:54:30 +0000 (16:54 -0700)]
venus: enable VK_EXT_device_memory_report

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23411>

16 months agovenus: emit device memory report for device memory events
Yiwei Zhang [Sat, 3 Jun 2023 07:01:48 +0000 (00:01 -0700)]
venus: emit device memory report for device memory events

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23411>

16 months agovenus: handle device memory report requests
Yiwei Zhang [Thu, 1 Jun 2023 22:59:34 +0000 (15:59 -0700)]
venus: handle device memory report requests

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23411>

16 months agovenus: refactor vn_device_memory to track VkMemoryType
Yiwei Zhang [Sat, 3 Jun 2023 07:16:06 +0000 (00:16 -0700)]
venus: refactor vn_device_memory to track VkMemoryType

The VkMemoryType::heapIndex will be used by device memory report.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23411>

16 months agofreedreno/a6xx: Use idalloc for samp/view seqno's
Rob Clark [Tue, 6 Jun 2023 14:43:35 +0000 (07:43 -0700)]
freedreno/a6xx: Use idalloc for samp/view seqno's

Samplers and views can be re-created dynamically or long-lasting,
resulting in the possibility of a tex cache collision.  So instead
of a simple counter, use idalloc.

Fixes: a3c73987ab92 ("freedreno/a6xx: Move rsc seqno out of tex cache key")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9111
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23470>

16 months agofreedreno/a6xx: Directly invalidate on samp view update
Rob Clark [Tue, 6 Jun 2023 14:33:06 +0000 (07:33 -0700)]
freedreno/a6xx: Directly invalidate on samp view update

Instead of incrementing the seqno, just directly invalidate any existing
tex cache entries when we update a sampler view.

No reason not to just directly clear stale entries, and avoiding to re-
assign the seqno will simplify the next patch.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23470>

16 months agofreedreno/batch: Add driver-thread assert
Rob Clark [Mon, 5 Jun 2023 14:19:39 +0000 (07:19 -0700)]
freedreno/batch: Add driver-thread assert

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23470>

16 months agofreedreno: Add extra assert
Rob Clark [Tue, 30 May 2023 18:57:35 +0000 (11:57 -0700)]
freedreno: Add extra assert

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23470>

16 months agoasahi: Remove stale comments
Alyssa Rosenzweig [Fri, 19 May 2023 17:00:57 +0000 (13:00 -0400)]
asahi: Remove stale comments

Trivial.

It is now later and I have confirmed with Piglit.

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

16 months agoasahi: Do not leak meta shader NIR
Asahi Lina [Fri, 2 Jun 2023 08:25:49 +0000 (17:25 +0900)]
asahi: Do not leak meta shader NIR

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>

16 months agoasahi: Fix memory leak in agx_nir_lower_sysvals()
Asahi Lina [Fri, 2 Jun 2023 08:20:44 +0000 (17:20 +0900)]
asahi: Fix memory leak in agx_nir_lower_sysvals()

We need to free the dynarray.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>

16 months agoasahi: Use os_dupfd_cloexec() instead of dup()
Asahi Lina [Fri, 2 Jun 2023 07:51:07 +0000 (16:51 +0900)]
asahi: Use os_dupfd_cloexec() instead of dup()

This fixes file descriptor leaks in konsole/etc.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>

16 months agoasahi: Decompress with format reinterpretation
Alyssa Rosenzweig [Mon, 29 May 2023 23:51:21 +0000 (19:51 -0400)]
asahi: Decompress with format reinterpretation

The internal layout used with compression partially depends on the pixel format.
Some limited reinterpretation is definitely allowed (linear vs sRGB views of the
same physical format are documented by Apple as allowed). Some reinterpretations
are definitely forbidden (R8G8B8A8 vs R32, I think). At some point we'll need to
work out the exact rule. I suspect the answer is that "you can reinterpret iff
the Channels field matches". Meaning that R8G8B8A8_UNORM and B8G8R8A8_SINT would
be compatible, but not R16G16_UNORM. But I haven't tested that.

Fixes all fails in:

   dEQP-GLES31.functional.image_load_store.*.format_reinterpret.*

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

16 months agoasahi: Decompress writable images
Alyssa Rosenzweig [Fri, 19 May 2023 20:00:34 +0000 (16:00 -0400)]
asahi: Decompress writable images

We can't write to compressed images. Decompress on the fly if needed. mesa/st
doesn't bother to do this for us.

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

16 months agoasahi: Extract transition_resource helper
Alyssa Rosenzweig [Fri, 19 May 2023 19:59:54 +0000 (15:59 -0400)]
asahi: Extract transition_resource helper

We'll reuse this logic for images. Extract it out and generalize it.

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

16 months agoasahi: Add ASAHI_MESA_DEBUG=nowc flag
Alyssa Rosenzweig [Fri, 12 May 2023 12:13:22 +0000 (08:13 -0400)]
asahi: Add ASAHI_MESA_DEBUG=nowc flag

Add a debug flag to disable write-combining as a performance hack. This may help
diagnose slowness with glReadPixels() heavy workloads like screen capture.

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

16 months agoagx: Stop bit-inexact conversion propagation
Alyssa Rosenzweig [Mon, 15 May 2023 20:48:14 +0000 (16:48 -0400)]
agx: Stop bit-inexact conversion propagation

Despite being mathematically equivalent, the following code sequences are not
bit-identical under IEEE 754 rules due to differing internal precision:

   fadd16 r0l, r2, 0.0              z = f2f16 x
   fadd16 r1h, r0l, r0h             w = fadd z, y

versus

   fadd32 r1h, r2, r0h              f2f16(w) = fadd x, f2f32(y)

This is probably fine under GL's relaxed floating point precision rules, but
it's definitely not ok with the more strict OpenCL or Vulkan. It also is a
potential problem with GL invariance rules, if we get different results for the
same shader depending whether we did a monolithic compile or a fast link. The
place for doing inexact transformations is NIR, when we have the information
available to do so correctly. By the time we get to the backend, everything we
do needs to be bit-exact to preserve sanity.

Fixes dEQP-GLES2.functional.shaders.algorithm.rgb_to_hsl_vertex. We believe that
this is a CTS bug, but it's a useful one since it uncovered a serious driver bug
that would bite us in the much less friendly Vulkan (or god forbid OpenCL) CTS
later. It also seems like a magnet for GL app bugs, the fp16 support we do now
is uncovering bad enough bugs as it is.

shader-db results are pretty abysmal, though :|

total instructions in shared programs: 1537964 -> 1571328 (2.17%)
instructions in affected programs: 670231 -> 703595 (4.98%)

total bytes in shared programs: 10533984 -> 10732316 (1.88%)
bytes in affected programs: 4662414 -> 4860746 (4.25%)

total halfregs in shared programs: 483448 -> 474541 (-1.84%)
halfregs in affected programs: 58867 -> 49960 (-15.13%)

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

16 months agoasahi: Advertise GL 3.1
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:53 +0000 (13:22 -0400)]
asahi: Advertise GL 3.1

We now have support for baseline MSAA, except for support for eMRT. But hey,
this gets us 99% of the way there, so it's worth flipping on at least in
agx/next.

We can also advertise dual-source blending again. It was reverted since Chromium
freaks out with dual-source blending on a GL 2.1 driver, but since we're
advertising GL 3.1 now, it's ok.

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

16 months agoagx: Emit shader info late
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:53 +0000 (13:22 -0400)]
agx: Emit shader info late

So we can take into account program transformations for the final info. This
reports more accurate metadata.

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

16 months agoasahi: Use nonempty tib for MSAA
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:52 +0000 (13:22 -0400)]
asahi: Use nonempty tib for MSAA

Affects
dEQP-GLES31.functional.texture.multisample.samples_4.use_texture_depth_2d. This
needs tests, but whatever, 70% of the YouTube chat said to land the hack.

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

16 months agoasahi: Lower MSAA
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:52 +0000 (13:22 -0400)]
asahi: Lower MSAA

Use the shiny new passes to lower fragment shaders. Monolithic only right now.

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

16 months agoagx: Handle centroid and sample interpolation
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:51 +0000 (13:22 -0400)]
agx: Handle centroid and sample interpolation

Works great now that all the infrastructure is wired up.

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

16 months agoagx: Model interpolation for iter instructions
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:51 +0000 (13:22 -0400)]
agx: Model interpolation for iter instructions

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

16 months agoagx: Split iter and iterproj instructions
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:50 +0000 (13:22 -0400)]
agx: Split iter and iterproj instructions

These are different (though related) instructions. I've split them in applegpu,
let's mirror that here. This simplifies the IR a bit.

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

16 months agoasahi,agx: Call lower_discard_zs_emit in the driver
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:50 +0000 (13:22 -0400)]
asahi,agx: Call lower_discard_zs_emit in the driver

The driver needs to lower MSAA (because only it knows the sample count). MSAA
lowering depends on discards getting lowered (in order to get sample masks on the
discards for sample shading to work properly). Discard lowering depends on all
discards emitted. But the driver needs to lower clip planes which generates
discards. To break the circular dependency, we have the driver call the
discard lowering pass itself (in between lowering clip planes and lowering
MSAA). Technically, this is probably a layering violation but it's the least
gross solution I see.

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

16 months agoagx: Lower discard in NIR
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:49 +0000 (13:22 -0400)]
agx: Lower discard in NIR

We already lower discard in NIR when depth/stencil writes are used in the
shader. In this patch, we extend that lowering for when depth/stencil writes are
not used, in which case the discard is lowered to a sample_mask instruction.
This is a step towards multisampling, since the old lowering assumed
single-sample and there's no way to express a sample mask with a standard NIR
discard instructions so we need to lower in NIR anyway for sample shading (i.e.
if a discard_if diverges between samples in a pixel).

This changes the lowering for discard_if to be free of control flow (instead
executing a sample mask instruction unconditionally). This seems to be slightly
faster in SuperTuxKart and slightly slower in Dolphin, but I'm not too worried
right now.

To make this work, we do need some extra lowering to ensure we always execute a
sample_mask instruction, in case a discard_if is buried in other control flow
(as occurs with Dolphin's ubershaders). So that's added too. We need that for
MSAA anyway, so pardon the line count.

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

16 months agoagx: Enable tag writes when sample mask written
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:49 +0000 (13:22 -0400)]
agx: Enable tag writes when sample mask written

Including indirectly via discard/demote.

Fixes graphical artefacts in Chromium when API sample masks are hooked up, which
will result in fragment programs that do not write colour/depth but do a lone
sample mask write. These need tag writes enabled (according to a trace from
Metal for a case constructed to test this scenario).

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

16 months agoagx: Handle sample_mask_agx
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:49 +0000 (13:22 -0400)]
agx: Handle sample_mask_agx

1:1 translation.

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

16 months agoagx: Plumb in nir_intrinsic_load_sample_mask_in
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:48 +0000 (13:22 -0400)]
agx: Plumb in nir_intrinsic_load_sample_mask_in

We have a special register for this, although this will need some lowering for
glSampleMask.

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

16 months agoagx: Model both sources of sample_mask
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:47 +0000 (13:22 -0400)]
agx: Model both sources of sample_mask

We need to control both sources to implement multisampling properly. The
semantic is something like:

   foreach sample in the first mask {
      if correspond bit in second bit set {
         make sample live
      } else {
         make sample dead
      }
   }

But I'm reticent to document more formally until the details are really
understood and properly tested.

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

16 months agoasahi: Plumb ppp_multisamplectl into shaders
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:47 +0000 (13:22 -0400)]
asahi: Plumb ppp_multisamplectl into shaders

This lets us implement gl_SamplePositions in a cheap way with some ALU in the
shader preamble.

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

16 months agoasahi: Plumb API sample mask into shaders
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:46 +0000 (13:22 -0400)]
asahi: Plumb API sample mask into shaders

So we can lower glSampleMask() appropriately.

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

16 months agoasahi: Set uses_sample_shading for background program
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:46 +0000 (13:22 -0400)]
asahi: Set uses_sample_shading for background program

If we read gl_SampleID we need the lowering, even though we don't call into
gather_info to set the bit for us. So set the bit manually.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>

16 months agoagx: Assert that sample shading is lowered
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:46 +0000 (13:22 -0400)]
agx: Assert that sample shading is lowered

Lest someone mess this up later and then try to "implement" these intrinsics in
the backend.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>

16 months agoasahi: Add alpha-to-coverage (and alpha-to-one) lowering
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:45 +0000 (13:22 -0400)]
asahi: Add alpha-to-coverage (and alpha-to-one) lowering

This should probably be shared code but meh.

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

16 months agoasahi: Add passes to lower sample intrinsics
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:45 +0000 (13:22 -0400)]
asahi: Add passes to lower sample intrinsics

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