platform/upstream/mesa.git
3 years agoac/rgp: mark SQTT_FILE_CHUNK_TYPE_ISA_DATABASE as deprecated
Samuel Pitoiset [Fri, 28 May 2021 12:55:40 +0000 (14:55 +0200)]
ac/rgp: mark SQTT_FILE_CHUNK_TYPE_ISA_DATABASE as deprecated

This is now deprecated and reserved for future uses.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11063>

3 years agoasahi: Allocate slices for mipmapping
Alyssa Rosenzweig [Tue, 1 Jun 2021 00:08:50 +0000 (20:08 -0400)]
asahi: Allocate slices for mipmapping

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

3 years agoasahi: Set levels in texture descriptor
Alyssa Rosenzweig [Tue, 1 Jun 2021 00:08:57 +0000 (20:08 -0400)]
asahi: Set levels in texture descriptor

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

3 years agoasahi: Add mipmapping state to the XML
Alyssa Rosenzweig [Tue, 1 Jun 2021 00:08:37 +0000 (20:08 -0400)]
asahi: Add mipmapping state to the XML

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

3 years agoasahi: Abort on blit()
Alyssa Rosenzweig [Mon, 31 May 2021 23:21:49 +0000 (19:21 -0400)]
asahi: Abort on blit()

Unimplemented.

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

3 years agoasahi: Make data_valid a bitset to save memory
Alyssa Rosenzweig [Mon, 31 May 2021 22:59:02 +0000 (18:59 -0400)]
asahi: Make data_valid a bitset to save memory

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

3 years agoasahi: Allow half-float vertex buffers
Alyssa Rosenzweig [Mon, 31 May 2021 20:35:36 +0000 (16:35 -0400)]
asahi: Allow half-float vertex buffers

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

3 years agoasahi: Flesh out the formats table
Alyssa Rosenzweig [Mon, 31 May 2021 20:35:21 +0000 (16:35 -0400)]
asahi: Flesh out the formats table

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

3 years agoasahi: Fake CAPs for ES3 with AGX_MESA_DEBUG=deqp
Alyssa Rosenzweig [Mon, 31 May 2021 20:34:23 +0000 (16:34 -0400)]
asahi: Fake CAPs for ES3 with AGX_MESA_DEBUG=deqp

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

3 years agoasahi: Lift streamout scaffolding from Panfrost
Alyssa Rosenzweig [Mon, 31 May 2021 20:10:40 +0000 (16:10 -0400)]
asahi: Lift streamout scaffolding from Panfrost

Trying to fake ES3 for dEQP-GLES3.

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

3 years agoasahi: Add "hacks for dEQP" flag
Alyssa Rosenzweig [Mon, 31 May 2021 20:10:02 +0000 (16:10 -0400)]
asahi: Add "hacks for dEQP" flag

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

3 years agoasahi: Add ETC2 formats to table
Alyssa Rosenzweig [Mon, 31 May 2021 19:46:18 +0000 (15:46 -0400)]
asahi: Add ETC2 formats to table

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

3 years agoasahi: Respect render target format swizzle
Alyssa Rosenzweig [Mon, 31 May 2021 19:37:40 +0000 (15:37 -0400)]
asahi: Respect render target format swizzle

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

3 years agoasahi: Use pixel table in is_format_supported
Alyssa Rosenzweig [Mon, 31 May 2021 19:34:40 +0000 (15:34 -0400)]
asahi: Use pixel table in is_format_supported

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

3 years agoasahi: Scaffold format table
Alyssa Rosenzweig [Mon, 31 May 2021 19:29:20 +0000 (15:29 -0400)]
asahi: Scaffold format table

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

3 years agoasahi: Hide pixel formats behind an opaque type
Alyssa Rosenzweig [Mon, 31 May 2021 19:08:55 +0000 (15:08 -0400)]
asahi: Hide pixel formats behind an opaque type

Convenient for mapping a format table.

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

3 years agoasahi: Add format enums
Alyssa Rosenzweig [Mon, 31 May 2021 18:37:06 +0000 (14:37 -0400)]
asahi: Add format enums

Split it up into the underlying parts. Now we can decode every format
accessible in Metal.

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

3 years agoasahi: Print unknown enum values
Alyssa Rosenzweig [Mon, 31 May 2021 18:36:56 +0000 (14:36 -0400)]
asahi: Print unknown enum values

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

3 years agoasahi: Align strides to 16 bytes
Alyssa Rosenzweig [Sun, 30 May 2021 22:54:40 +0000 (04:24 +0530)]
asahi: Align strides to 16 bytes

Apparently required for texturing.

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

3 years agoasahi: Note that "render target" lacks an sRGB bit
Alyssa Rosenzweig [Sun, 30 May 2021 22:39:51 +0000 (04:09 +0530)]
asahi: Note that "render target" lacks an sRGB bit

sRGB is handled through other mechanisms.

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

3 years agoasahi: Handle linear display targets as well as tiled
Alyssa Rosenzweig [Mon, 31 May 2021 22:08:14 +0000 (18:08 -0400)]
asahi: Handle linear display targets as well as tiled

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

3 years agoasahi: Respect linear strides
Alyssa Rosenzweig [Sun, 30 May 2021 22:03:05 +0000 (03:33 +0530)]
asahi: Respect linear strides

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

3 years agoasahi: Identify line stride in texture/RT XML
Alyssa Rosenzweig [Sun, 30 May 2021 22:01:43 +0000 (03:31 +0530)]
asahi: Identify line stride in texture/RT XML

The off-by-four is concerning.

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

3 years agoasahi: Translate layouts for texture and RTs
Alyssa Rosenzweig [Sun, 30 May 2021 21:55:34 +0000 (03:25 +0530)]
asahi: Translate layouts for texture and RTs

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

3 years agoasahi: Add layout enum to XML
Alyssa Rosenzweig [Sun, 30 May 2021 21:49:35 +0000 (03:19 +0530)]
asahi: Add layout enum to XML

Used for textures and render targets. There are more values here, probably for
other tiling schemes and compression.

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

3 years agoasahi: Use dt_stride for line_stride where needed
Alyssa Rosenzweig [Sun, 30 May 2021 21:45:10 +0000 (03:15 +0530)]
asahi: Use dt_stride for line_stride where needed

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

3 years agoasahi: Determine tiling vs linear for internal textures
Alyssa Rosenzweig [Sun, 30 May 2021 21:31:07 +0000 (03:01 +0530)]
asahi: Determine tiling vs linear for internal textures

Logic lifted from Panfrost.

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

3 years agoasahi: Implement wide lines
Alyssa Rosenzweig [Sun, 30 May 2021 17:18:37 +0000 (22:48 +0530)]
asahi: Implement wide lines

Identify line width field and route through the Gallium line width.

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

3 years agoasahi: Fix off-by-one in viewport scissoring
Alyssa Rosenzweig [Fri, 28 May 2021 02:51:09 +0000 (22:51 -0400)]
asahi: Fix off-by-one in viewport scissoring

As discovered during the stream. Typo pointed out by someone in the Twitch chat.

Fixes: f285a1220ea ("asahi: Implement scissors and scissor to viewport")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11086>

3 years agofreedreno/headergen2: Fix compile warnings with CP_DRAW_INDIRECT_MULTI
Rob Clark [Mon, 31 May 2021 20:24:04 +0000 (13:24 -0700)]
freedreno/headergen2: Fix compile warnings with CP_DRAW_INDIRECT_MULTI

Using stripes to deal with the different packet layout variants resulted
in redefining "register" offsets with different values, so use "prefix"
to add a suffix to disambiguate.

  drivers/gpu/drm/msm/adreno/adreno_pm4.xml.h:1066: warning: "REG_A6XX_CP_DRAW_INDIRECT_MULTI_INDIRECT" redefined
   1066 | #define REG_A6XX_CP_DRAW_INDIRECT_MULTI_INDIRECT  0x00000006
        |
  drivers/gpu/drm/msm/adreno/adreno_pm4.xml.h:1057: note: this is the location of the previous definition
   1057 | #define REG_A6XX_CP_DRAW_INDIRECT_MULTI_INDIRECT  0x00000003
        |

(Admittedly it isn't really a "prefix" but that was the field in the
schema available to use, and REG_INDEXED_CP_DRAW_INDIRECT_MULTI_STRIDE
sounds somewhat more funny.)

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

3 years agofreedreno/afuc: Use emulator to extract jmptbl
Rob Clark [Mon, 24 May 2021 18:00:28 +0000 (11:00 -0700)]
freedreno/afuc: Use emulator to extract jmptbl

This runs through the SQE bootstrap code to extract the packet-table,
rather than relying on heuristics.  As a bonus, it can detect the start
of the LPAC fw in a660+ fw so that we can properly decode the LPAC fw
and packet-table.

Note that this decodes the jmptable as normal instructions, which is a
change in behavior from the previous heuristic based jmptbl extraction.
Not sure if that is a good or bad thing.

For a5xx, for now the legacy heuristic based jmptable decoding is
preserved, at least until enough control regs are figured out.

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

3 years agofreedreno/ci: Add real packet-table loading for afuc test
Rob Clark [Thu, 27 May 2021 21:37:59 +0000 (14:37 -0700)]
freedreno/ci: Add real packet-table loading for afuc test

When we start running the bootstrap code thru the emulator we will need
the packet-table loading to actually happen.  So add this.

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

3 years agofreedreno/afuc: Add emulator support to run bootstrap
Rob Clark [Thu, 27 May 2021 19:18:53 +0000 (12:18 -0700)]
freedreno/afuc: Add emulator support to run bootstrap

Run until the packet-table is populated, so the disassembler can use
this to know the offsets of various pm4 packet handlers without having
to rely on heuristics.

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

3 years agofreedreno/afuc: Split out helpers to parse labels and packet-table
Rob Clark [Thu, 27 May 2021 18:35:21 +0000 (11:35 -0700)]
freedreno/afuc: Split out helpers to parse labels and packet-table

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

3 years agofreedreno/afuc: Extract full gpu-id
Rob Clark [Thu, 27 May 2021 18:04:42 +0000 (11:04 -0700)]
freedreno/afuc: Extract full gpu-id

Some of the a6xx gens will require some control reg initialization, and
go into an infinite loop if they don't see the values they expect, so
we'll need to extract the compute gpu-id.

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

3 years agofreedreno/registers: Add a few a6xx regs and notes
Rob Clark [Sun, 23 May 2021 17:46:07 +0000 (10:46 -0700)]
freedreno/registers: Add a few a6xx regs and notes

A few things I noticed while playing with the emulator.

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

3 years agofreedreno/afuc: Add emulator mode to afuc-disasm
Rob Clark [Sun, 16 May 2021 20:09:29 +0000 (13:09 -0700)]
freedreno/afuc: Add emulator mode to afuc-disasm

This is an (at least somewhat complete) logical emulator of the a6xx SQE
that lets us step through firmware execution (bootstrap, cmdstream pkt
handling, etc).  It lets us poke at various fw visible state and run
through pm4 packet(s) to better understand what the fw is doing when it
handles various packets.

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

3 years agofreedreno/afuc: Add pipe reg name decoding
Rob Clark [Fri, 21 May 2021 15:39:08 +0000 (08:39 -0700)]
freedreno/afuc: Add pipe reg name decoding

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

3 years agofreedreno/afuc: Clean up special regs
Rob Clark [Fri, 21 May 2021 00:12:35 +0000 (17:12 -0700)]
freedreno/afuc: Clean up special regs

Allow for different mnemonics depending on whether they are used as
source or destination register, to better reflect what they do.

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

3 years agofreedreno/afuc: Split out utils
Rob Clark [Mon, 17 May 2021 01:43:20 +0000 (18:43 -0700)]
freedreno/afuc: Split out utils

With disasm emulator mode, we'll start wanting some things that are
duplicationg what the assembler does, so just split out all the rnndb
bits into shared utils.

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

3 years agofreedreno/afuc: Split out instruction decode helper
Rob Clark [Sun, 16 May 2021 19:15:31 +0000 (12:15 -0700)]
freedreno/afuc: Split out instruction decode helper

Split the giant switch/decode out into a helper function so that we can
re-use it for emulator mode.

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

3 years agofreedreno: Move pkt parsing helpers to common
Rob Clark [Fri, 21 May 2021 20:58:13 +0000 (13:58 -0700)]
freedreno: Move pkt parsing helpers to common

I'll be needing these in afuc as well.

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

3 years agofreedreno/tu+drm: Extract out pm4 pkt header helpers
Rob Clark [Fri, 21 May 2021 19:16:37 +0000 (12:16 -0700)]
freedreno/tu+drm: Extract out pm4 pkt header helpers

I'm going to need these in a 3rd place, so let's deduplicate first.

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

3 years agoci: replace glslangValidator with glslang-tools
Andres Gomez [Mon, 31 May 2021 18:41:58 +0000 (21:41 +0300)]
ci: replace glslangValidator with glslang-tools

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

3 years agoci: remove glslangValidator installation from the VK test container
Andres Gomez [Mon, 31 May 2021 17:50:30 +0000 (20:50 +0300)]
ci: remove glslangValidator installation from the VK test container

We already include glslang-tools.

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

3 years agocompiler/spirv: expand_to_vec4 -> nir_pad_vec4
Mike Blumenkrantz [Sun, 16 May 2021 14:16:41 +0000 (10:16 -0400)]
compiler/spirv: expand_to_vec4 -> nir_pad_vec4

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10821>

3 years agoradv: make attrib_end variable in radv_flush_vertex_descriptors 32-bit
Rhys Perry [Mon, 31 May 2021 14:35:03 +0000 (15:35 +0100)]
radv: make attrib_end variable in radv_flush_vertex_descriptors 32-bit

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: 1e9dc0474ef ("radv: make radv_pipeline::attrib_ends 32bit")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11089>

3 years agofreedreno: reduce the upper bound of IB size by one
Danylo Piliaiev [Mon, 31 May 2021 08:41:22 +0000 (11:41 +0300)]
freedreno: reduce the upper bound of IB size by one

Going beyond 0x100000 results in hangs, however I found that the
last 0x100000 packet just doesn't get executed. Thus the real limit is
0x0FFFFF. At least this is true for a6xx.

This could be tested by appending nops to the cmdstream and placing
e.g. CP_INTERRUPT at the end, at any position other than being
0x100000 packet it results in a hang.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10786>

3 years agoturnip: place a limit on the growth of BOs
Danylo Piliaiev [Thu, 13 May 2021 13:50:45 +0000 (16:50 +0300)]
turnip: place a limit on the growth of BOs

There is a limit on IB size, which on freedreno is set to 0x100000.
Going beyond it results in hangs, however I found that the last
0x100000 packet just doesn't get executed. Thus the real limit is
0x0FFFFF.

This could be tested by appending nops to the cmdstream and placing
e.g. CP_INTERRUPT at the end, at any position other than being
0x100000 packet it results in a hang.

Fixes:
  dEQP-VK.api.command_buffers.record_many_draws_secondary_2
  dEQP-VK.api.command_buffers.record_many_draws_primary_2

However these tests could trigger hangcheck timeouts.

Also this fixes hangs when opening captures of games in RenderDoc.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10786>

3 years agov3dv: use VKAPI_ATTR and VKAPI_CALL.
Georg Lehmann [Fri, 28 May 2021 12:53:25 +0000 (14:53 +0200)]
v3dv: use VKAPI_ATTR and VKAPI_CALL.

Closes #4852

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Tested-by: Roman Stratiienko <r.stratiienko@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11062>

3 years agokmsro: Fix confusing comma expression
Neil Roberts [Mon, 31 May 2021 14:32:57 +0000 (16:32 +0200)]
kmsro: Fix confusing comma expression

It looks like this was a copy-and-paste mistake in 827e0d6654a2 where
the initialiser was moved from being a struct initialiser to a
standalone statement. Some of them were fixed with an unrelated change
in 187218395d7c but not all of them. This shouldn’t make any practical
difference to the compiled code.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11090>

3 years agoRevert "zink: call tc_driver_internal_flush_notify() on flush"
Mike Blumenkrantz [Sat, 29 May 2021 03:01:12 +0000 (23:01 -0400)]
Revert "zink: call tc_driver_internal_flush_notify() on flush"

This reverts commit 4d62fca0877104080d4dee8656d09c67e93c8d0e.

this is broken beyond space and time but only reveals its true nature
when used outside of a unit test

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

3 years agozink: stop using util_set_vertex_buffers_mask()
Mike Blumenkrantz [Tue, 26 Jan 2021 20:58:53 +0000 (15:58 -0500)]
zink: stop using util_set_vertex_buffers_mask()

we're already iterating this, so there's no point in double iterating

also no point in doing the extra refcounting

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

3 years agozink: ref vertex buffers during set_vertex_buffers
Mike Blumenkrantz [Tue, 26 Jan 2021 20:58:29 +0000 (15:58 -0500)]
zink: ref vertex buffers during set_vertex_buffers

now we don't need to do it during bind

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

3 years agozink: update scissor only when necessary
Mike Blumenkrantz [Tue, 26 Jan 2021 15:37:32 +0000 (10:37 -0500)]
zink: update scissor only when necessary

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

3 years agozink: only update viewport state when necessary
Mike Blumenkrantz [Tue, 26 Jan 2021 15:31:24 +0000 (10:31 -0500)]
zink: only update viewport state when necessary

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

3 years agozink: only rebind vertex buffers when necessary
Mike Blumenkrantz [Tue, 26 Jan 2021 15:27:32 +0000 (10:27 -0500)]
zink: only rebind vertex buffers when necessary

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

3 years agozink: handle rebinds for vertex buffers
Mike Blumenkrantz [Sat, 30 Jan 2021 14:06:25 +0000 (09:06 -0500)]
zink: handle rebinds for vertex buffers

now that the tracking info is there, it's easy to make this happen

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

3 years agozink: only rebind pipelines when necessary
Mike Blumenkrantz [Tue, 26 Jan 2021 15:27:50 +0000 (10:27 -0500)]
zink: only rebind pipelines when necessary

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

3 years agozink: mark some draw functions inline
Mike Blumenkrantz [Tue, 26 Jan 2021 15:19:51 +0000 (10:19 -0500)]
zink: mark some draw functions inline

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

3 years agozink: remove barriers/refs from descriptor cache
Mike Blumenkrantz [Tue, 26 Jan 2021 19:52:40 +0000 (14:52 -0500)]
zink: remove barriers/refs from descriptor cache

these are applied on bind now so there's no need to track them

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

3 years agozink: reapply program refs automatically
Mike Blumenkrantz [Tue, 26 Jan 2021 14:56:04 +0000 (09:56 -0500)]
zink: reapply program refs automatically

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

3 years agozink: reapply resource/surface refs after app flushes
Mike Blumenkrantz [Tue, 26 Jan 2021 14:37:17 +0000 (09:37 -0500)]
zink: reapply resource/surface refs after app flushes

instead of doing this during descriptor update, we can automatically handle
this rollover

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

3 years agov3dv: implement VK_KHR_device_group
Iago Toral Quiroga [Thu, 27 May 2021 07:16:18 +0000 (09:16 +0200)]
v3dv: implement VK_KHR_device_group

We only support one device group with a single device, so the
implementation is trivial.

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

3 years agov3dv: implement interactions of VK_KHR_device_group with VK_KHR_swapchain
Iago Toral Quiroga [Thu, 27 May 2021 08:17:08 +0000 (10:17 +0200)]
v3dv: implement interactions of VK_KHR_device_group with VK_KHR_swapchain

There are some interactions between these two extensions that need to be
implemented when both are supported. Particularly:

1. Applications can create images that will be bound to swapchain memory
   by passing a VkImageSwapchainCreateInfoKHR in the pNext chain
   of VkImageCreateInfo. In this case we need to make sure that the
   created image takes some of its parameters from the underlying
   swapchain.

2. Applications can bind memory from a swapchain image to a VkImage
   by passing a VkBindImageMemorySwapchainInfoKHR in the pNext chain
   of VkBindImageMemoryInfo.

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

3 years agov3dv: create a helper for image creation
Iago Toral Quiroga [Thu, 27 May 2021 08:00:37 +0000 (10:00 +0200)]
v3dv: create a helper for image creation

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

3 years agov3dv: implement vkCmdDispatchBase
Iago Toral Quiroga [Thu, 27 May 2021 07:06:00 +0000 (09:06 +0200)]
v3dv: implement vkCmdDispatchBase

This was added with VK_KHR_device_group and allows users to specify
a base offset that will be automatically added to gl_WorkGroupID.

Unfortunately, V3D doesn't support this natively, so we need to add
the base to the workgroup id generated by hardware manually. For this,
we inject add instructions that source from a QUNIFORM that will
retrieve the actual dispatch base from the compute job when it is
dispatched.

Since a compute shader can be dispatched with CmdDispatch and/or
CmdDispatchBase, we always need to add these additional add
instructions and use a base of (0,0,0) for regular dispatches.
Since we don't support any version of OpenGL with this dispatch
base functionality we can avoid the extra instructions there.

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

3 years agoradv: enable RADV_DEBUG=invariantgeom for Monster Hunter World
Samuel Pitoiset [Thu, 27 May 2021 07:26:24 +0000 (09:26 +0200)]
radv: enable RADV_DEBUG=invariantgeom for Monster Hunter World

DXVK 1.8.1 marks position as always invariant but the DX12 version
of the game has the same issue and it's not yet fixed on the
vkd3d-proton side.

Fixes some Z-fighting on GFX10.3.

Cc: 21.1 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11029>

3 years agoasahi: Implement scissors and scissor to viewport
Alyssa Rosenzweig [Fri, 28 May 2021 02:51:09 +0000 (22:51 -0400)]
asahi: Implement scissors and scissor to viewport

Construct a scissor descriptor correpsonding to the intersection of the
framebuffer, the viewport, and the region selected for scissoring by the app.
Use the intersected scissor in the "clip tile" fields in the viewport. Select
this scissor descriptor from the command stream.

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

3 years agoasahi: Update viewport descriptor depth fields
Alyssa Rosenzweig [Sun, 30 May 2021 20:25:19 +0000 (01:55 +0530)]
asahi: Update viewport descriptor depth fields

Acts like a translate/scale pair more generally, not specific to near/far
planes.

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

3 years agoasahi: Enable depth culling
Alyssa Rosenzweig [Sun, 30 May 2021 20:13:15 +0000 (01:43 +0530)]
asahi: Enable depth culling

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

3 years agoasahi: Add unknown bits seen with the GL driver
Alyssa Rosenzweig [Sun, 30 May 2021 20:12:43 +0000 (01:42 +0530)]
asahi: Add unknown bits seen with the GL driver

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

3 years agoasahi: Expose PIPE_CAP_CLIP_HALFZ
Alyssa Rosenzweig [Sun, 30 May 2021 20:11:37 +0000 (01:41 +0530)]
asahi: Expose PIPE_CAP_CLIP_HALFZ

Use the Zink lowering pass to handle the non-halfz case. Metal, like Vulkan,
uses half-z (and Metal is not configurable, making r/e tricky).

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

3 years agoagx: Add scissor upload BO
Alyssa Rosenzweig [Fri, 28 May 2021 03:11:18 +0000 (23:11 -0400)]
agx: Add scissor upload BO

Not sure what the proper data structure for this is yet, but this will
hold over until we start optimizing for memory usage.

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

3 years agoasahi: Skip draws if the scissor culls everything
Alyssa Rosenzweig [Sun, 30 May 2021 19:58:25 +0000 (01:28 +0530)]
asahi: Skip draws if the scissor culls everything

We can't pack the scissor descriptor for these, and there would be no rendering
anyway, so detect this condition and skip the draw.

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

3 years agoasahi: Mark scissor dirty if rast->scissor changes
Alyssa Rosenzweig [Sun, 30 May 2021 20:34:41 +0000 (02:04 +0530)]
asahi: Mark scissor dirty if rast->scissor changes

Although there is a scissor enable bit in the hardware rasterizer state, we
cannot rely on it alone as we also "scissor" to the viewport.

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

3 years agoasahi: Track scissor states
Alyssa Rosenzweig [Fri, 28 May 2021 02:51:00 +0000 (22:51 -0400)]
asahi: Track scissor states

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

3 years agoasahi: Dirty track viewport descriptor
Alyssa Rosenzweig [Fri, 28 May 2021 02:44:55 +0000 (22:44 -0400)]
asahi: Dirty track viewport descriptor

Mitigates the extra CPU cost from packing in the previous commit, and
avoids the redundant memcpy.

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

3 years agoasahi: Defer viewport pack
Alyssa Rosenzweig [Fri, 28 May 2021 02:42:48 +0000 (22:42 -0400)]
asahi: Defer viewport pack

Nontrivial interaction between viewport state and scissor state, so
defer until draw time to deal with it.

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

3 years agoasahi: Add scissor enable bit
Alyssa Rosenzweig [Fri, 28 May 2021 02:33:26 +0000 (22:33 -0400)]
asahi: Add scissor enable bit

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

3 years agoasahi: Add "set scissor" command
Alyssa Rosenzweig [Fri, 28 May 2021 02:31:08 +0000 (22:31 -0400)]
asahi: Add "set scissor" command

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

3 years agoasahi: Fix scissor descriptor definition
Alyssa Rosenzweig [Fri, 28 May 2021 02:29:02 +0000 (22:29 -0400)]
asahi: Fix scissor descriptor definition

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

3 years agodocs: Even more gratutious nitpicks
Daniel Stone [Sun, 30 May 2021 21:59:13 +0000 (22:59 +0100)]
docs: Even more gratutious nitpicks

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11085>

3 years agoagx: Zero r0l before first use of control flow
Alyssa Rosenzweig [Tue, 25 May 2021 00:38:41 +0000 (20:38 -0400)]
agx: Zero r0l before first use of control flow

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

3 years agoagx: Add break/continue support
Alyssa Rosenzweig [Mon, 24 May 2021 02:50:48 +0000 (22:50 -0400)]
agx: Add break/continue support

Following Dougall's notes closely.

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

3 years agoagx: Implement loops in the simplest way
Alyssa Rosenzweig [Wed, 26 May 2021 23:51:46 +0000 (19:51 -0400)]
agx: Implement loops in the simplest way

Again, optimizations are possible, but for now go for conformance.

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

3 years agoagx: Optimize out empty else blocks
Alyssa Rosenzweig [Mon, 24 May 2021 02:51:21 +0000 (22:51 -0400)]
agx: Optimize out empty else blocks

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

3 years agoagx: Implement emit_if the simplest way
Alyssa Rosenzweig [Sun, 23 May 2021 21:26:50 +0000 (17:26 -0400)]
agx: Implement emit_if the simplest way

Lots of optimizations are possible from here.

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

3 years agoagx: Fix up branch offsets at pack time
Alyssa Rosenzweig [Tue, 25 May 2021 00:15:03 +0000 (20:15 -0400)]
agx: Fix up branch offsets at pack time

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

3 years agoagx: Model jump instructions
Alyssa Rosenzweig [Wed, 26 May 2021 23:51:36 +0000 (19:51 -0400)]
agx: Model jump instructions

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

3 years agoagx: Pack control flow instructions
Alyssa Rosenzweig [Sun, 23 May 2021 21:18:20 +0000 (17:18 -0400)]
agx: Pack control flow instructions

Nearly ALU.

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

3 years agoagx: Add push_exec alias
Alyssa Rosenzweig [Tue, 25 May 2021 00:52:16 +0000 (20:52 -0400)]
agx: Add push_exec alias

Use the same canonical form as Metal, so the disassembler can alias it
back.

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

3 years agoagx: Model pop_exec
Alyssa Rosenzweig [Sun, 23 May 2021 18:07:58 +0000 (14:07 -0400)]
agx: Model pop_exec

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

3 years agoagx: Model control flow instructions
Alyssa Rosenzweig [Sun, 23 May 2021 16:36:14 +0000 (12:36 -0400)]
agx: Model control flow instructions

Thankfully the encoding is regular, if a bit complicated.

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

3 years agoagx: Add inner loop nesting count field
Alyssa Rosenzweig [Wed, 26 May 2021 23:46:59 +0000 (19:46 -0400)]
agx: Add inner loop nesting count field

Needed for proper handling of break/continue with nested if-else.

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

3 years agoagx: Add branch target to IR
Alyssa Rosenzweig [Wed, 26 May 2021 23:51:19 +0000 (19:51 -0400)]
agx: Add branch target to IR

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

3 years agoagx: Add invert_cond (ccn) to IR
Alyssa Rosenzweig [Sun, 23 May 2021 21:17:16 +0000 (17:17 -0400)]
agx: Add invert_cond (ccn) to IR

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

3 years agoagx: Add nest field to IR
Alyssa Rosenzweig [Sun, 23 May 2021 16:35:58 +0000 (12:35 -0400)]
agx: Add nest field to IR

Needed to model control flow instructions.

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

3 years agoagx: Track block offsets
Alyssa Rosenzweig [Mon, 24 May 2021 23:47:58 +0000 (19:47 -0400)]
agx: Track block offsets

For fixing branch offsets.

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

3 years agoagx: Track current_block
Alyssa Rosenzweig [Sun, 23 May 2021 21:27:26 +0000 (17:27 -0400)]
agx: Track current_block

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