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

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

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

16 months agoagx: Use textures_used, not num_textures
Alyssa Rosenzweig [Thu, 25 May 2023 17:22:42 +0000 (13:22 -0400)]
agx: Use textures_used, not num_textures

The latter doesn't account for holes. Fixes regression in Neverball on Asahi.

Fixes: e607a89f ("mesa/main: ff-fragshader to nir")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>

16 months agoagx: Constant fold when optimizing int64
Alyssa Rosenzweig [Sun, 21 May 2023 03:21:57 +0000 (23:21 -0400)]
agx: Constant fold when optimizing int64

Otherwise we can get bcsel(false, ...) in the final optimized code, which isn't
great.

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

16 months agoagx: Set support_16bit_alu
Alyssa Rosenzweig [Fri, 12 May 2023 17:33:57 +0000 (13:33 -0400)]
agx: Set support_16bit_alu

Allows some more optimizations.

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

16 months agor600/sfn: Switch to scoped barriers
Gert Wollny [Tue, 30 May 2023 09:46:32 +0000 (11:46 +0200)]
r600/sfn: Switch to scoped barriers

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23272>

16 months agor600/sfn: assert that group barrier is not emitted in divergent code flow
Gert Wollny [Tue, 30 May 2023 09:46:10 +0000 (11:46 +0200)]
r600/sfn: assert that group barrier is not emitted in divergent code flow

Also rename emit_barrier to emit_group_barrier

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23272>

16 months agospirv: Add workaround for OpImageQueryLevels with Multi-sampled images
Caio Oliveira [Sat, 3 Jun 2023 00:12:44 +0000 (17:12 -0700)]
spirv: Add workaround for OpImageQueryLevels with Multi-sampled images

Warn and replace the query with the constant value 1.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9148
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23407>

16 months agocompiler: Remove redundant struct glsl_type in nir_types.h
Yonggang Luo [Sat, 3 Jun 2023 23:34:38 +0000 (07:34 +0800)]
compiler: Remove redundant struct glsl_type in nir_types.h

The struct glsl_type already declared in glsl_types.h

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23420>

16 months agocompiler: Remove the need include "util/glheader.h" and "util/ralloc.h" in glsl_types.h
Yonggang Luo [Sat, 3 Jun 2023 23:31:56 +0000 (07:31 +0800)]
compiler: Remove the need include "util/glheader.h" and "util/ralloc.h" in glsl_types.h

These includes can be moved into .cpp files and down-stream headers

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23420>

16 months agomesa, compiler: Move gl_texture_index to glsl_types.h
Yonggang Luo [Sat, 3 Jun 2023 22:48:50 +0000 (06:48 +0800)]
mesa, compiler: Move gl_texture_index to glsl_types.h

This move is done for decouple glsl_types.h from src/mesa/*

This is achieved by move gl_texture_index from src/mesa/main/menums.h to src/compiler/shader_enums.h
And move ATOMIC_COUNTER_SIZE,MAX_VERTEX_STREAMS from src/mesa/main/config.h to src/compiler/shader_enums.h

Move include main/[config|menums].h into glsl/glsl_parser_extras.h from glsl_types.h
As now glsl_types.h should not include headers from src/mesa/*

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23420>

16 months agocompiler: Move can_implicitly_convert_to helper to glsl module from glsl_types.h
Yonggang Luo [Sun, 4 Jun 2023 05:54:21 +0000 (13:54 +0800)]
compiler: Move can_implicitly_convert_to helper to glsl module from glsl_types.h

This move is done for decouple glsl_types from glsl_parser_extras

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23420>

16 months agocompiler: Combine duplicated implementation of is_gl_identifier into glsl_types.h
Yonggang Luo [Sun, 4 Jun 2023 05:52:55 +0000 (13:52 +0800)]
compiler: Combine duplicated implementation of is_gl_identifier into glsl_types.h

As glsl_types.cpp also called is_gl_identifier, so move it into glsl_types.h,
this will help the decouple glsl_types.h from src/compiler/glsl/*

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23420>

16 months agor600: fix r600_draw_vbo() buffer overflow
Patrick Lerda [Thu, 1 Jun 2023 23:33:03 +0000 (01:33 +0200)]
r600: fix r600_draw_vbo() buffer overflow

The previous implementation was copying the data using the
aligned length (size_dw). The aligned length could overflow
the original buffer size.

For instance, this issue is triggered with "piglit/bin/draw-batch -auto -fbo":
==5736==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff139c77e8 at pc 0x7f25b350a9a0 bp 0x7fff139c6cb0 sp 0x7fff139c6460
READ of size 8 at 0x7fff139c77e8 thread T0
    #0 0x7f25b350a99f in __interceptor_memcpy (/usr/lib64/libasan.so.6+0x3c99f)
    #1 0x7f25a8fcdf24 in radeon_emit_array ../src/gallium/include/winsys/radeon_winsys.h:760
    #2 0x7f25a8fcdf24 in r600_draw_vbo ../src/gallium/drivers/r600/r600_state_common.c:2448
    #3 0x7f25a8ae7ba1 in u_vbuf_draw_vbo ../src/gallium/auxiliary/util/u_vbuf.c:1791
    #4 0x7f25a7bc18ca in _mesa_validated_drawrangeelements ../src/mesa/main/draw.c:1696
    #5 0x7f25a7bc7e53 in _mesa_DrawElements ../src/mesa/main/draw.c:1824

Fixes: 0cf5d1f22620 ("gallium: remove PIPE_CAP_INFO_START_WITH_USER_INDICES and fix all drivers")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23436>

16 months agodzn: Fix qpool->queries_lock double lock
Vinson Lee [Tue, 6 Jun 2023 06:22:07 +0000 (23:22 -0700)]
dzn: Fix qpool->queries_lock double lock

Fix defect reported by Coverity Scan.

Double lock (LOCK)
double_lock: mtx_lock locks qpool->queries_lock while it is locked.

Fixes: a012b219640 ("microsoft: Initial vulkan-on-12 driver")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23455>

16 months agonir/print: Do not print raw values
Caio Oliveira [Thu, 1 Jun 2023 18:12:12 +0000 (11:12 -0700)]
nir/print: Do not print raw values

In many cases the raw value is not really helpful,
since we only work with enums and the raw value is
already printed for indices without special printing.

If an index benefits from having special printing AND the
raw value, we can include the printing of the raw value
as part of its handler.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23375>

16 months agoiris: Fix memory size with disabled resizable bar
Mykhailo Skorokhodov [Fri, 2 Jun 2023 15:18:09 +0000 (18:18 +0300)]
iris: Fix memory size with disabled resizable bar

When the resizable bar feature is disabled,
then vram.mappable.size is only 256MB.
The second half of the total size is in the vram.unmappable.size variable.

Signed-off-by: Mykhailo Skorokhodov <mykhailo.skorokhodov@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23402>

16 months agoci/zink+radv: update expectations
Eric Engestrom [Tue, 6 Jun 2023 10:16:52 +0000 (12:16 +0200)]
ci/zink+radv: update expectations

Signed-off-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23465>

16 months agoci/radv: update expectations
Eric Engestrom [Tue, 6 Jun 2023 10:16:47 +0000 (12:16 +0200)]
ci/radv: update expectations

Signed-off-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23465>

16 months agotreewide: Use nir_trim_vector more
Alyssa Rosenzweig [Thu, 1 Jun 2023 01:08:47 +0000 (21:08 -0400)]
treewide: Use nir_trim_vector more

Via Coccinelle patches

    @@
    expression a, b, c;
    @@

    -nir_channels(b, a, (1 << c) - 1)
    +nir_trim_vector(b, a, c)

    @@
    expression a, b, c;
    @@

    -nir_channels(b, a, BITFIELD_MASK(c))
    +nir_trim_vector(b, a, c)

    @@
    expression a, b;
    @@

    -nir_channels(b, a, 3)
    +nir_trim_vector(b, a, 2)

    @@
    expression a, b;
    @@

    -nir_channels(b, a, 7)
    +nir_trim_vector(b, a, 3)

Plus a fixup for pointless trimming an immediate in RADV and radeonsi.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23352>

16 months agotreewide: Use nir_tex_src_for_ssa
Alyssa Rosenzweig [Thu, 1 Jun 2023 00:56:31 +0000 (20:56 -0400)]
treewide: Use nir_tex_src_for_ssa

Via Coccinelle patch:

    @@
    expression a, b, c;
    @@

    -a.src = nir_src_for_ssa(b);
    -a.src_type = c;
    +a = nir_tex_src_for_ssa(c, b);

    @@
    expression a, b, c;
    @@

    -a.src_type = c;
    -a.src = nir_src_for_ssa(b);
    +a = nir_tex_src_for_ssa(c, b);

Plus manual fixups, including...

* a few identity swizzles changed to nir_trim_vector in TTN and prog-to-nir to
  fix the Coccinelle-botched formatting, and similarly a pointless nir_channels
* collapsing a now-pointless temp in vtn

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23352>

16 months agonir: Add and use nir_tex_src_ssa
Alyssa Rosenzweig [Thu, 25 May 2023 20:51:33 +0000 (16:51 -0400)]
nir: Add and use nir_tex_src_ssa

This makes texture instructions a lot less annoying to construct, especially in
cases where the deref-based helpers don't work.

I only converted core NIR, not the drivers. Since it was by hand.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23352>

16 months agoamd: remove unused PKT0 definitions
Marek Olšák [Fri, 2 Jun 2023 14:02:17 +0000 (10:02 -0400)]
amd: remove unused PKT0 definitions

We never use type 0 packets.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: don't use SET_SH_REG_INDEX if the kernel doesn't use CU reservation
Marek Olšák [Fri, 2 Jun 2023 14:00:07 +0000 (10:00 -0400)]
radeonsi: don't use SET_SH_REG_INDEX if the kernel doesn't use CU reservation

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: don't use SET_SH_REG_INDEX on gfx7-9
Marek Olšák [Fri, 2 Jun 2023 13:53:07 +0000 (09:53 -0400)]
radeonsi: don't use SET_SH_REG_INDEX on gfx7-9

It was accidentally used with geometry shaders. It might have caused hangs.

Fixes: ccaaf8fe04c956d9f1 - amd: massively simplify how info->spi_cu_en is applied

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: re-indent gfx10_create_sh_query_result_cs
Marek Olšák [Thu, 1 Jun 2023 17:35:34 +0000 (13:35 -0400)]
radeonsi: re-indent gfx10_create_sh_query_result_cs

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi/ci: add gfx6 failures
Marek Olšák [Sat, 27 May 2023 04:08:48 +0000 (00:08 -0400)]
radeonsi/ci: add gfx6 failures

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: add a separate cdna_init_compute_preamble_state function
Marek Olšák [Sat, 27 May 2023 06:17:37 +0000 (02:17 -0400)]
radeonsi: add a separate cdna_init_compute_preamble_state function

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: don't set registers set by CLEAR_STATE in the preamble for gfx10-11
Marek Olšák [Thu, 25 May 2023 01:20:58 +0000 (21:20 -0400)]
radeonsi: don't set registers set by CLEAR_STATE in the preamble for gfx10-11

CLEAR_STATE doesn't clear PA_SC_GENERIC_SCISSOR_* only on some older chips

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: add a separate gfx10_init_gfx_preamble_state function
Marek Olšák [Thu, 25 May 2023 01:04:11 +0000 (21:04 -0400)]
radeonsi: add a separate gfx10_init_gfx_preamble_state function

and set the registers in an order sorted by the offset.

It's less of a mess now.

Acked-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: add helpers to create and clone a sized pm4 state
Marek Olšák [Sat, 27 May 2023 06:31:59 +0000 (02:31 -0400)]
radeonsi: add helpers to create and clone a sized pm4 state

to simplify si_init_cs_preamble_state and it will be used in the following
commits

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: don't program COMPUTE_MAX_WAVE_ID (GDS register) on gfx6
Marek Olšák [Thu, 25 May 2023 00:03:04 +0000 (20:03 -0400)]
radeonsi: don't program COMPUTE_MAX_WAVE_ID (GDS register) on gfx6

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: optimize no-op primitive restart index changes thanks to index masking
Marek Olšák [Wed, 24 May 2023 23:41:08 +0000 (19:41 -0400)]
radeonsi: optimize no-op primitive restart index changes thanks to index masking

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: rename the msaa_sample_locs state to sample locations
Marek Olšák [Mon, 15 May 2023 01:01:00 +0000 (21:01 -0400)]
radeonsi: rename the msaa_sample_locs state to sample locations

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: merge si_emit_msaa_sample_locs with si_emit_sample_locations
Marek Olšák [Mon, 15 May 2023 00:59:22 +0000 (20:59 -0400)]
radeonsi: merge si_emit_msaa_sample_locs with si_emit_sample_locations

Acked-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: move PA_SU_SMALL_PRIM_FILTER_CNTL to the preamble when possible
Marek Olšák [Mon, 15 May 2023 00:50:06 +0000 (20:50 -0400)]
radeonsi: move PA_SU_SMALL_PRIM_FILTER_CNTL to the preamble when possible

PA_SU_SMALL_PRIM_FILTER_CNTL is set in the gfx preamble if the sample loc
bug isn't present. Else, it's set as part of sample locs state.

This is part 3 of simplifying si_emit_msaa_sample_locs.

Acked-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: adjust 16x EQAA sample locs to make PA_SU_PRIM_FILTER_CNTL immutable
Marek Olšák [Mon, 15 May 2023 00:28:52 +0000 (20:28 -0400)]
radeonsi: adjust 16x EQAA sample locs to make PA_SU_PRIM_FILTER_CNTL immutable

and move PA_SU_PRIM_FILTER_CNTL to the gfx preamble.

If sample locations don't use the -8 coordinate, the EXCLUSION can always
be set to 1.

This is part 2 of simplifying si_emit_msaa_sample_locs.

Acked-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: always set sample locations even for 1x MSAA for simplicity
Marek Olšák [Mon, 15 May 2023 00:14:18 +0000 (20:14 -0400)]
radeonsi: always set sample locations even for 1x MSAA for simplicity

This is part 1 of simplifying si_emit_msaa_sample_locs.

Acked-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: move PA_CL_NGG_CNTL emission into rasterizer state
Marek Olšák [Sun, 14 May 2023 23:52:47 +0000 (19:52 -0400)]
radeonsi: move PA_CL_NGG_CNTL emission into rasterizer state

It's a better place. Edge flags only have effect if polygon mode is
enabled. Changing shaders should no longer roll the context due to line
culling flipping EDGE_FLAG_ENA.

Acked-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: reorder and comment tracked registers
Marek Olšák [Sat, 13 May 2023 21:49:41 +0000 (17:49 -0400)]
radeonsi: reorder and comment tracked registers

Acked-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: split tracked_regs masks into context registers and other registers
Marek Olšák [Sat, 13 May 2023 03:49:13 +0000 (23:49 -0400)]
radeonsi: split tracked_regs masks into context registers and other registers

Acked-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: increase SDMA gfx9+ limits
Marek Olšák [Sat, 13 May 2023 02:40:30 +0000 (22:40 -0400)]
radeonsi: increase SDMA gfx9+ limits

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: decompress DCC for SDMA if we're really going to use SDMA
Marek Olšák [Sat, 13 May 2023 01:55:09 +0000 (21:55 -0400)]
radeonsi: decompress DCC for SDMA if we're really going to use SDMA

change the order of operations

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: unduplicate si_translate_format_to_hw
Marek Olšák [Sat, 13 May 2023 01:41:07 +0000 (21:41 -0400)]
radeonsi: unduplicate si_translate_format_to_hw

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: completely rewrite how VGT_SHADER_STAGES_EN is set
Marek Olšák [Fri, 12 May 2023 21:10:30 +0000 (17:10 -0400)]
radeonsi: completely rewrite how VGT_SHADER_STAGES_EN is set

Use a state atom with an emit function instead of precomputing up to 256
pm4 states in si_context.

Some register fields are precomputed in si_shader for NGG. Others are set
in si_update_shaders.

Acked-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: remove RADEON_FLAG_MALL_NOALLOC due to no use
Marek Olšák [Sun, 7 May 2023 16:52:25 +0000 (12:52 -0400)]
radeonsi: remove RADEON_FLAG_MALL_NOALLOC due to no use

and we'll need to use that bit for something else in the future.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: add a gfx11 version of si_decompress_textures, add assertions < GFX11
Marek Olšák [Sun, 7 May 2023 21:03:06 +0000 (17:03 -0400)]
radeonsi: add a gfx11 version of si_decompress_textures, add assertions < GFX11

si_decompress_textures is renamed to gfx6_decompress_textures.
gfx11_decompress_textures is added.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: remove a useless depth texture function call in a fast color clear
Marek Olšák [Sun, 7 May 2023 20:39:33 +0000 (16:39 -0400)]
radeonsi: remove a useless depth texture function call in a fast color clear

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: use nir_lower_alu_to_scalar correctly
Marek Olšák [Wed, 5 Apr 2023 09:40:44 +0000 (05:40 -0400)]
radeonsi: use nir_lower_alu_to_scalar correctly

We should use the filter callback that's also used by st/mesa.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: print shader-db stats with AMD_DEBUG=vs,ps,stats
Marek Olšák [Fri, 14 Apr 2023 01:07:31 +0000 (21:07 -0400)]
radeonsi: print shader-db stats with AMD_DEBUG=vs,ps,stats

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi/gfx11: extend DB_Z_INFO.NUM_SAMPLES programming to > GFX11
Marek Olšák [Fri, 19 May 2023 06:23:50 +0000 (02:23 -0400)]
radeonsi/gfx11: extend DB_Z_INFO.NUM_SAMPLES programming to > GFX11

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: export non-zero edgeflags for GS and tess
Marek Olšák [Sat, 27 May 2023 08:43:27 +0000 (04:43 -0400)]
radeonsi: export non-zero edgeflags for GS and tess

because edge flags are always enabled when polygon mode is enabled

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: remove gl_BackColor VS outputs on demand if color_two_side is disabled
Marek Olšák [Mon, 8 May 2023 00:33:07 +0000 (20:33 -0400)]
radeonsi: remove gl_BackColor VS outputs on demand if color_two_side is disabled

We just need to set the ps_inputs_read_or_disabled mask correctly.

The VS outputs_written mask should set BFCn instead of COLn, which is why
this removes the is_varying parameter that forced COLn to be set for BFCn.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoradeonsi: define si_shader_io_get_unique_index() values as SI_UNIQUE_SLOT_*
Marek Olšák [Mon, 8 May 2023 00:31:49 +0000 (20:31 -0400)]
radeonsi: define si_shader_io_get_unique_index() values as SI_UNIQUE_SLOT_*

for later use

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoamd: add radeon_info* into ac_llvm_context and radv_nir_compiler_options
Marek Olšák [Wed, 31 May 2023 18:19:14 +0000 (14:19 -0400)]
amd: add radeon_info* into ac_llvm_context and radv_nir_compiler_options

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/22833>

16 months agoac/nir/ngg: always use load_initial_edgeflags_amd, choose the value in drivers
Marek Olšák [Sat, 27 May 2023 08:18:26 +0000 (04:18 -0400)]
ac/nir/ngg: always use load_initial_edgeflags_amd, choose the value in drivers

radeonsi will have a more complicated condition here

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoac/surface: fix R32G3B32 image format regression for gfx6-8
Marek Olšák [Thu, 1 Jun 2023 06:58:39 +0000 (02:58 -0400)]
ac/surface: fix R32G3B32 image format regression for gfx6-8

This is a different fix from the one reviewed because that one broke gfx9.

Fixes: ea7c89d1f57 - ac/surface: move determing ADDR_FMT_* into a helper function
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22833>

16 months agoci: fix KVM module modprobe code
David Heidelberg [Mon, 5 Jun 2023 22:21:48 +0000 (00:21 +0200)]
ci: fix KVM module modprobe code

Fixes: 5941fc8ccd30 ("ci: enable shellcheck on whole .gitlab-ci")

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

16 months agoci: missed variable inside the big rename and split ARCH and DEBIAN_ARCH
David Heidelberg [Fri, 2 Jun 2023 21:01:14 +0000 (23:01 +0200)]
ci: missed variable inside the big rename and split ARCH and DEBIAN_ARCH

Fixes: 5140ff194841 ("ci: rename x86 and amd64 to x86_64, armhf to arm32, and i386 to x86_32")

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

16 months agoradv: correctly skip vertex loads with packed formats
Rhys Perry [Thu, 1 Jun 2023 15:03:46 +0000 (16:03 +0100)]
radv: correctly skip vertex loads with packed formats

This is supposed to check whether any channels of the element is used, but
skipped_start is always 0 for packed formats.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Fixes: a46acdbc3ff ("radv: Lower non-dynamic VS inputs in NIR.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9062
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23370>

16 months agoradv: initialize aco_compiler_options::is_opengl
Rhys Perry [Mon, 5 Jun 2023 11:06:49 +0000 (12:06 +0100)]
radv: initialize aco_compiler_options::is_opengl

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Fixes: 8d5cc23c186 ("aco: use gds reg when ordered xfb counter add")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23434>

16 months agoaco: fix ds_sub_gs_reg_rtn validation
Rhys Perry [Mon, 5 Jun 2023 11:01:19 +0000 (12:01 +0100)]
aco: fix ds_sub_gs_reg_rtn validation

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Fixes: 8d5cc23c186 ("aco: use gds reg when ordered xfb counter add")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23434>

16 months agomesa/main: fix distance attenuation calculation in ffvertex
Charmaine Lee [Wed, 31 May 2023 05:26:32 +0000 (08:26 +0300)]
mesa/main: fix distance attenuation calculation in ffvertex

The dist parameter to calculate_light_attenuation() is the
reciprocal of ||VP|| used in the distance attenuation formula (2.4).
So get its reciprocal first before applying it to the distance attenuation
formula.

This fixes a lighting issue in Knights of the Old Republic.

Fixes: c5b3d488f9be ("mesa/main: make ffvertex output nir")

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collaborar.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23404>

16 months agointel/fs: fix pull-constant-load prior to gfx7
Lionel Landwerlin [Fri, 2 Jun 2023 19:37:46 +0000 (22:37 +0300)]
intel/fs: fix pull-constant-load prior to gfx7

In ad9bc1ffb5 ("intel/fs: enable UBO accesses through bindless heap")
we added a new source, we need to fixup the source index for the
generator.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: ad9bc1ffb5 ("intel/fs: enable UBO accesses through bindless heap")
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23405>

16 months agointel/stub_gpu: add an option to launch valgrind
Lionel Landwerlin [Fri, 2 Jun 2023 19:40:03 +0000 (22:40 +0300)]
intel/stub_gpu: add an option to launch valgrind

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23405>

16 months agovirgl: Replace the usage of os_get_process_name with util_get_process_name
Yonggang Luo [Wed, 1 Feb 2023 07:14:22 +0000 (15:14 +0800)]
virgl: Replace the usage of os_get_process_name with util_get_process_name

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21034>

16 months agovirgl: Array cmdline on stack should initialized to 0
Yonggang Luo [Wed, 1 Feb 2023 07:11:00 +0000 (15:11 +0800)]
virgl: Array cmdline on stack should initialized to 0

Because strncpy may not append 0 if source string is longer than num(63)
Fixes: b3b82fe8ea1 ("virgl/vtest: add vtest driver")

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21034>

16 months agor300: Replace usage of os_get_process_name with util_get_process_name in r300_chipset.c
Yonggang Luo [Tue, 31 Jan 2023 08:38:54 +0000 (16:38 +0800)]
r300: Replace usage of os_get_process_name with util_get_process_name in r300_chipset.c

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21034>

16 months agoradv: initialize the device cache UUID even if on-disk cache is disabled
Samuel Pitoiset [Mon, 5 Jun 2023 13:54:09 +0000 (15:54 +0200)]
radv: initialize the device cache UUID even if on-disk cache is disabled

Otherwise the pipeline cache UUID isn't initialized as well, and the
RADV meta shaders cache can be corrupted.

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

16 months agoanv: make Wa_16013994831 to use intel_needs_workaround
Tapani Pälli [Tue, 18 Apr 2023 17:28:26 +0000 (20:28 +0300)]
anv: make Wa_16013994831 to use intel_needs_workaround

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22560>

16 months agoiris: make Wa_16013994831 to use intel_needs_workaround
Tapani Pälli [Tue, 18 Apr 2023 17:23:44 +0000 (20:23 +0300)]
iris: make Wa_16013994831 to use intel_needs_workaround

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22560>

16 months agointel: Fix stack overflow in intel_dump_gpu
Benjamin Lee [Sat, 3 Jun 2023 22:53:33 +0000 (15:53 -0700)]
intel: Fix stack overflow in intel_dump_gpu

Previously, the call to ensure_device_info in the intercepted ioctl
would eventually result in another call to ioctl, recursing until stack
overflow:

 - ioctl (intercepted)
 - ensure_device_info
 - intel_get_device_info_from_fd
 - intel_device_info_i915_get_info_from_fd
 - getparam
 - intel_ioctl
 - ioctl (intercepted)

Signed-off-by: Benjamin Lee <benjamin@computer.surgery>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23418>

16 months agoaco,radv: remove unused gs aco shader info
Qiang Yu [Mon, 5 Jun 2023 06:59:05 +0000 (14:59 +0800)]
aco,radv: remove unused gs aco shader info

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23432>

16 months agovenus: temporarily disable VK_EXT_memory_budget
Yiwei Zhang [Mon, 5 Jun 2023 23:33:44 +0000 (16:33 -0700)]
venus: temporarily disable VK_EXT_memory_budget

This has confused the apps. Back out for now until further investigation
is done.

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

16 months agoanv: Drop unused ALL_GRAPHICS_LIB_FLAGS.
Emma Anholt [Thu, 4 May 2023 23:16:46 +0000 (16:16 -0700)]
anv: Drop unused ALL_GRAPHICS_LIB_FLAGS.

copy and paste from radv.

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

16 months agotu: Ignore unused shader stages in pipeline library creation.
Emma Anholt [Thu, 4 May 2023 23:14:59 +0000 (16:14 -0700)]
tu: Ignore unused shader stages in pipeline library creation.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22865>

16 months agointel/eu/validate: Add some validation of ADD3
Ian Romanick [Thu, 25 May 2023 02:35:40 +0000 (19:35 -0700)]
intel/eu/validate: Add some validation of ADD3

v2: Remove spurious ALIGN_1 checks. Suggested by Matt.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23262>

16 months agointel/eu/validate: Add Gfx12.5
Ian Romanick [Fri, 26 May 2023 14:51:57 +0000 (07:51 -0700)]
intel/eu/validate: Add Gfx12.5

This required updating the expected results in a number of test. The
vast majority of these are cases where Gfx12.5 platforms don't allow
mixing F and HF sources.

In all honesty... I just updated the half_float_conversion expected
results until the test passed.

The next commit will add changes specific to Gfx12.5.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23262>

16 months agointel/eu/validate: Use a single macro define half_float_conversion cases
Ian Romanick [Fri, 26 May 2023 14:40:08 +0000 (07:40 -0700)]
intel/eu/validate: Use a single macro define half_float_conversion cases

This is what other tests do. The next commit will add a third set of
possible results (for Gfx12.5+), and the multiple macro method does not
scale.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23262>

16 months agointel/fs: Add constant propagation for ADD3
Ian Romanick [Fri, 19 May 2023 16:56:42 +0000 (09:56 -0700)]
intel/fs: Add constant propagation for ADD3

v2: Require that the constant value be representable as either uint16_t
or int16_t. Suggested by Matt.

v3: Remove redundant patterns. Noticed by Matt.

shader-db:

DG2
total instructions in shared programs: 23103767 -> 23103577 (<.01%)
instructions in affected programs: 51822 -> 51632 (-0.37%)
helped: 98 / HURT: 15

total cycles in shared programs: 842347714 -> 842380017 (<.01%)
cycles in affected programs: 1942595 -> 1974898 (1.66%)
helped: 97 / HURT: 32

Nearly all of the affected shaders (around 9,900) are shaders in
Cyberpunk 2077. It's about an even split between vertex and fragment
shaders. The majority of the remaining affected shaders (3,600) are
from Strange Brigade. This was also a nearly even split between
fragment and vertex.

All but two of the lost shaders are SIMD32 fragment shaders in
Cyberpunk 2077. The other two are SIMD32 fragment shaders in Dota2.

fossil-db:

DG2
Instructions in all programs: 196379107 -> 196248608 (-0.1%)
helped: 13467 / HURT: 1210

Cycles in all programs: 13931355281 -> 13929955971 (-0.0%)
helped: 11801 / HURT: 2922

Lost: 90

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23262>

16 months agonir/algebraic: Fixup iadd3 related patterns
Ian Romanick [Wed, 24 May 2023 04:03:30 +0000 (21:03 -0700)]
nir/algebraic: Fixup iadd3 related patterns

There should not be any isub at this point due to lowerings that happened
ages before getting to late algebraic.

shader-db:

DG2
total instructions in shared programs: 23103769 -> 23103767 (<.01%)
instructions in affected programs: 65 -> 63 (-3.08%)
helped: 1 / HURT: 0

total cycles in shared programs: 842348074 -> 842347714 (<.01%)
cycles in affected programs: 28572 -> 28212 (-1.26%)
helped: 3 / HURT: 0

One compute shader in Assassin's Creed Odyssey was affected.

fossil-db:

DG2
Instructions in all programs: 196400668 -> 196400676 (+0.0%)
helped: 8 / HURT: 5

Cycles in all programs: 13931740724 -> 13931758003 (+0.0%)
helped: 8 / HURT: 7

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23262>

16 months agointel/fs: Allow HF const in MAD on Gfx12.5 if all sources are HF
Ian Romanick [Wed, 24 May 2023 03:55:04 +0000 (20:55 -0700)]
intel/fs: Allow HF const in MAD on Gfx12.5 if all sources are HF

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23262>

16 months agointel/fs: Fix handling of W, UW, and HF constants in combine_constants
Ian Romanick [Wed, 24 May 2023 01:34:43 +0000 (18:34 -0700)]
intel/fs: Fix handling of W, UW, and HF constants in combine_constants

Sources that are already W, UW, or HF can be represented as those types
by definition. Pass them through. Previously an HF source on a MAD would
have been marked as !can_promote. I'm pretty sure this means it would
get moved out to a register, but I did not verify this.

For ADD3, a constant source could be D or UD. In this case, the value
must be tested to determine whether it can be represented as W or
UW. The patterns in opt_algebraic won't generate an ADD3 with constant
source, so this problem cannot occur yet.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23262>

16 months agointel/fs: Don't munge source order of 3-src instructions in opt_algebraic
Ian Romanick [Thu, 1 Jun 2023 21:21:13 +0000 (14:21 -0700)]
intel/fs: Don't munge source order of 3-src instructions in opt_algebraic

This only impacts ADD3, so at this point it should not have any
affect. As soon as constants are propagated into ADD3 instructions, it
will be a problem.

The worst part is, the ADD3 instrutions that are broken by the old code
aren't even "progress" on this pass.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23262>

16 months agonir/print: Print 0 when mem_modes or resource_intel have no values
Caio Oliveira [Thu, 1 Jun 2023 18:25:30 +0000 (11:25 -0700)]
nir/print: Print 0 when mem_modes or resource_intel have no values

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23376>

16 months agodocs: update docs for lavapipe mesh shading
Dave Airlie [Mon, 5 Jun 2023 20:12:47 +0000 (06:12 +1000)]
docs: update docs for lavapipe mesh shading

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

17 months agotraces: update sir-f720 trace expectations for zink on anv and freedreno
David Heidelberg [Mon, 5 Jun 2023 19:15:08 +0000 (21:15 +0200)]
traces: update sir-f720 trace expectations for zink on anv and freedreno

Same changes on both driver, looks OK.

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

17 months agolavapipe: enable task/mesh shaders.
Dave Airlie [Wed, 17 May 2023 02:12:04 +0000 (12:12 +1000)]
lavapipe: enable task/mesh shaders.

This is the enable for the exts/features/properties.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>

17 months agolavapipe: add execution backends for mesh shader draw apis
Dave Airlie [Wed, 17 May 2023 02:11:33 +0000 (12:11 +1000)]
lavapipe: add execution backends for mesh shader draw apis

This binds the mesh draw apis to the gallium backend ones.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>

17 months agolavapipe: add support for task/mesh shader stages in various places
Dave Airlie [Wed, 17 May 2023 02:10:45 +0000 (12:10 +1000)]
lavapipe: add support for task/mesh shader stages in various places

this bumps the LVP_SHADER_STAGES to allow task/mesh shaders to be used,
and adds them to various state binding and execution places.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>

17 months agolavapipe: add mesh query support
Dave Airlie [Wed, 17 May 2023 02:09:59 +0000 (12:09 +1000)]
lavapipe: add mesh query support

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>

17 months agolavapipe: handle some mesh shader stage differences.
Dave Airlie [Wed, 17 May 2023 02:09:05 +0000 (12:09 +1000)]
lavapipe: handle some mesh shader stage differences.

certain state info is no long required if you using mesh/task in the
pipeline.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>

17 months agollvmpipe: enable task/mesh shader support.
Dave Airlie [Wed, 17 May 2023 02:07:50 +0000 (12:07 +1000)]
llvmpipe: enable task/mesh shader support.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>

17 months agollvmpipe: add mesh shader drawing.
Dave Airlie [Wed, 17 May 2023 02:05:58 +0000 (12:05 +1000)]
llvmpipe: add mesh shader drawing.

This is the big execution one, it implement the draw mesh callback.

This executes task shaders and mesh shaders with no overlap.

When task shaders finish, the mesh shader is launched using the payload
data, unless no task shader is run, then the mesh shader is launched.

Once the mesh shader is finished the data is supplied to the draw
pipeline to convert to linear vertex data with no per-prim data,
then passed to draw for clipping and further processing.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>

17 months agollvmpipe/cs: add multiple stride indirect to fill_grid_info.
Dave Airlie [Wed, 17 May 2023 02:05:20 +0000 (12:05 +1000)]
llvmpipe/cs: add multiple stride indirect to fill_grid_info.

mesh shaders needs to iterate across multiple indirect draws

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>

17 months agollvmpipe/cs: add task/mesh shader support to compute shader builder.
Dave Airlie [Wed, 17 May 2023 02:01:36 +0000 (12:01 +1000)]
llvmpipe/cs: add task/mesh shader support to compute shader builder.

This allows generating task and mesh variants of compute shaders.

It adds:
- vertex and primitive outputs support - aos writing.
- payload support
- mesh iface for the output and count callbacks.
- draw_id
- multiple iteration support to the exec fn to allow launches
in multiple passes to reduce memory usage

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>

17 months agogallivm/cs: add payload ptr to the cs thread data.
Dave Airlie [Wed, 17 May 2023 01:57:25 +0000 (11:57 +1000)]
gallivm/cs: add payload ptr to the cs thread data.

This fits best at a thread level beside shared.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>

17 months agollvmpipe: bind task/mesh resources and dirty bits
Dave Airlie [Wed, 17 May 2023 01:56:41 +0000 (11:56 +1000)]
llvmpipe: bind task/mesh resources and dirty bits

This binds the task/mesh states to be updated on dirty changes

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>

17 months agollvmpipe: add query support for task/mesh shaders
Dave Airlie [Wed, 17 May 2023 01:55:10 +0000 (11:55 +1000)]
llvmpipe: add query support for task/mesh shaders

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>