platform/upstream/mesa.git
11 months agonvk: Handle cases of descriptor bindings with variable counts
George Ouzounoudis [Sun, 16 Apr 2023 16:32:44 +0000 (19:32 +0300)]
nvk: Handle cases of descriptor bindings with variable counts

We need to compute the allocated descriptor buffer size at descriptor allocation
time. So we need to split to a pre-computed size for all the other bindings
except the one with the variable count.

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

11 months agonvk: Support VkDescriptorSetVariableDescriptorCountLayoutSupport
George Ouzounoudis [Wed, 26 Apr 2023 18:37:23 +0000 (21:37 +0300)]
nvk: Support VkDescriptorSetVariableDescriptorCountLayoutSupport

On cases with variable descriptor counts we need to calculate the
maximum supported variable count while taking into account the other existing
descriptors and their alignments in the set.

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

11 months agonvk: Use the max descriptor alignemtn in GetDescriptorSetLayoutSupport
Faith Ekstrand [Fri, 14 Jul 2023 00:06:20 +0000 (19:06 -0500)]
nvk: Use the max descriptor alignemtn in GetDescriptorSetLayoutSupport

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

11 months agonvk: Fix segfault when opening DRI device file returns error
Benjamin Lee [Fri, 9 Jun 2023 22:22:01 +0000 (15:22 -0700)]
nvk: Fix segfault when opening DRI device file returns error

Previously, ver was unitialized on this path, causing UB on the
`if (ver)` branch after the out_err label.

Signed-off-by: Benjamin Lee <benjamin@computer.surgery>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: add support for D32_SFLOAT_S8_UINT
Dave Airlie [Thu, 13 Jul 2023 21:13:29 +0000 (16:13 -0500)]
nvk: add support for D32_SFLOAT_S8_UINT

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

11 months agonvk: Take an nvk_image_plane in nouveau_copy_rect_image
Faith Ekstrand [Thu, 13 Jul 2023 21:19:07 +0000 (16:19 -0500)]
nvk: Take an nvk_image_plane in nouveau_copy_rect_image

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

11 months agonvk: Add helpers for binding image planes
Faith Ekstrand [Thu, 13 Jul 2023 21:12:42 +0000 (16:12 -0500)]
nvk: Add helpers for binding image planes

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

11 months agonvk: s/device/dev in nvk_image.c
Faith Ekstrand [Thu, 13 Jul 2023 21:08:10 +0000 (16:08 -0500)]
nvk: s/device/dev in nvk_image.c

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

11 months agonvk: introduce an optimisation loop.
Dave Airlie [Fri, 7 Jul 2023 06:42:45 +0000 (16:42 +1000)]
nvk: introduce an optimisation loop.

This brings in pretty much the radv opt loop.

So for tess ctrl where this a loop we can unroll, this fixes
some dynamic array access later to be non-dynamic.

Fixes:
dEQP-VK.clipping.user_defined.clip_distance_dynamic_index.vert_tess.1

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

11 months agonvk: merge tess info between tcs/tes.
Dave Airlie [Tue, 11 Jul 2023 01:30:01 +0000 (11:30 +1000)]
nvk: merge tess info between tcs/tes.

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

11 months agonvk: fix transform feedback crash when optimiser removes things.
Dave Airlie [Thu, 13 Jul 2023 02:45:57 +0000 (12:45 +1000)]
nvk: fix transform feedback crash when optimiser removes things.

This optimise loop can remove stuff, which causes this to crash,
just exit early.

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

11 months agonvk: Lower io to temporaries for tessellation evaluation nir
George Ouzounoudis [Tue, 23 May 2023 16:12:37 +0000 (19:12 +0300)]
nvk: Lower io to temporaries for tessellation evaluation nir

This is consistent to what radv does.

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

11 months agonvk: Respect tessellation domain origin state
George Ouzounoudis [Fri, 14 Apr 2023 13:07:52 +0000 (16:07 +0300)]
nvk: Respect tessellation domain origin state

When switching to lower left tessellation domain origin we need to
switch the orientation for triangles/quads. The changes are based on
what anv and radv do.

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

11 months agonvk: Fix cases where execution mode is specified in the tesc shader.
George Ouzounoudis [Fri, 14 Apr 2023 11:47:38 +0000 (14:47 +0300)]
nvk: Fix cases where execution mode is specified in the tesc shader.

We need to keep some context for the compilation of the tessellation shaders.
This is required in the case where the domain is specified in the
tessellation control shader instead of the tessellation evaluation
shader, as codegen needs the domain information when compiling the
tessellation evaluation shader.

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

11 months agonvk: Enable multiview with tessellation shader
George Ouzounoudis [Thu, 13 Apr 2023 21:16:50 +0000 (00:16 +0300)]
nvk: Enable multiview with tessellation shader

This works by default, we just switch it on.

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

11 months agonvk: Assign locations correctly for arrayed IO
George Ouzounoudis [Mon, 24 Oct 2022 19:21:29 +0000 (22:21 +0300)]
nvk: Assign locations correctly for arrayed IO

Arrayed IO, encountered in tessellation shaders, should not take up
multiple driver locations.

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

11 months agonvk: Basic tessellation shader support
George Ouzounoudis [Fri, 14 Apr 2023 12:15:46 +0000 (15:15 +0300)]
nvk: Basic tessellation shader support

Based on nvc0 implementation but with added nvidia-headers usage.
Device limits taken from http://www.vulkan.gpuinfo.org/ and minimum
required values.

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

11 months agonvk: remove duplicated device features
Thomas H.P. Andersen [Mon, 3 Apr 2023 20:03:39 +0000 (22:03 +0200)]
nvk: remove duplicated device features

These are already set in the Vulkan 1.2 section

Add status for bufferDeviceAddressCaptureReplayEXT

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

11 months agonvk: Enable multiplane images and image views
Mohamed Ahmed [Wed, 12 Jul 2023 19:18:49 +0000 (14:18 -0500)]
nvk: Enable multiplane images and image views

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

11 months agonvk: Advertise KHR_spirv_1_4
Faith Ekstrand [Sat, 6 May 2023 16:50:54 +0000 (11:50 -0500)]
nvk: Advertise KHR_spirv_1_4

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

11 months agonvk: Fix the NO_PREFETCH assert for CmdDrawIndirect
Faith Ekstrand [Thu, 4 May 2023 19:32:19 +0000 (14:32 -0500)]
nvk: Fix the NO_PREFETCH assert for CmdDrawIndirect

The NO_PREFETCH bit gets set on the range.  The offset can pretty much
be whatever.

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

11 months agonvk: Advertise shaderStorageImageReadWithoutFormat
Faith Ekstrand [Wed, 3 May 2023 23:14:09 +0000 (18:14 -0500)]
nvk: Advertise shaderStorageImageReadWithoutFormat

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

11 months agonvk/heap: Set the right pitch for heap resize copies
Faith Ekstrand [Wed, 3 May 2023 03:01:10 +0000 (22:01 -0500)]
nvk/heap: Set the right pitch for heap resize copies

Otherwise, once we need to grow past 2^17 B, we attempt to copy two
lines, the hardware errors out, and we get left with a junk heap.
While we're here, re-arrange the code a bit so we keep all the P_FOO
together.

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

11 months agonil: Add A4B4G4R4_UNORM format support
Echo J [Wed, 19 Apr 2023 05:56:16 +0000 (08:56 +0300)]
nil: Add A4B4G4R4_UNORM format support

DXVK versions before v1.5.5 need this format in some cases

I haven't tried running CTS yet, but GTA San Andreas runs
well now on DXVK v1.5.1 (before this change it crashed) so
I think CTS should be happy enough :frog:

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

11 months agonvk: expose EXT_sampler_filter_minmax
Dave Airlie [Thu, 23 Mar 2023 05:29:59 +0000 (15:29 +1000)]
nvk: expose EXT_sampler_filter_minmax

The sampler bits of this were already hooked up.

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

11 months agonvk: Only use view_id for layer in multiview
Faith Ekstrand [Sat, 8 Apr 2023 17:52:23 +0000 (12:52 -0500)]
nvk: Only use view_id for layer in multiview

I can't prove that this fixes anything but it seems right.

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

11 months agonvk: Move code inside view mask loops to a helper function
Rebecca Mckeever [Fri, 7 Apr 2023 16:52:22 +0000 (09:52 -0700)]
nvk: Move code inside view mask loops to a helper function

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Combine CLEAR_VIEWS and CLEAR_LAYERS MME macros
Rebecca Mckeever [Fri, 31 Mar 2023 22:41:16 +0000 (15:41 -0700)]
nvk: Combine CLEAR_VIEWS and CLEAR_LAYERS MME macros

Check view_mask inside the macro to determine which loop to run. In
emit_clear_rects(), move code out of if/else that is the same in both
branches.

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Load view_mask to shadow scratch in nvk_CmdBeginRendering
Rebecca Mckeever [Fri, 31 Mar 2023 22:23:55 +0000 (15:23 -0700)]
nvk: Load view_mask to shadow scratch in nvk_CmdBeginRendering

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: simplify code by using new helpers
Thomas H.P. Andersen [Sun, 2 Apr 2023 23:41:22 +0000 (01:41 +0200)]
nvk: simplify code by using new helpers

All tests still pass:
dEQP-VK.query_pool.*.compute_shader_invocations*

Test run totals:
  Passed:        78/78 (100.0%)
  Failed:        0/78 (0.0%)
  Not supported: 0/78 (0.0%)
  Warnings:      0/78 (0.0%)
  Waived:        0/78 (0.0%)

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

11 months agonvk: Reset offset value in ResetDescriptorPool
Echo J [Sun, 2 Apr 2023 13:29:19 +0000 (16:29 +0300)]
nvk: Reset offset value in ResetDescriptorPool

This is another secret change you've been waiting for 🐸

This change resets the current_offset value to 0 in ResetDescriptorPool
(without it the offset would keep counting until it reaches the limit
which causes allocation issues and/or application crashes/freezes)

RADV does the same thing, so I think this change is correct 🤓

BTW this meme seems to be relevant: https://youtu.be/1stQbTuUBIE

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

11 months agonvk: Add bufferImageGranularity limit
Echo J [Thu, 30 Mar 2023 19:34:18 +0000 (22:34 +0300)]
nvk: Add bufferImageGranularity limit

This is the secret change everyone has been waiting for 🐸

But anyway, this change adds the bufferImageGranularity limit (which
is needed by both DXVK and osu!lazer; DXVK will be a corrupted mess
without it and osu!lazer simply throws an exception)

The values have been scraped from https://vulkan.gpuinfo.org BTW
(because of that I'm not sure if they're actually accurate)

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

11 months agonvk: Advertise EXT_shader_viewport_index_layer on MaxwellB+
Faith Ekstrand [Fri, 31 Mar 2023 16:37:58 +0000 (11:37 -0500)]
nvk: Advertise EXT_shader_viewport_index_layer on MaxwellB+

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

11 months agonvk: Sort SPIR-V caps
Faith Ekstrand [Fri, 31 Mar 2023 18:56:38 +0000 (13:56 -0500)]
nvk: Sort SPIR-V caps

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

11 months agonvk: Implement VK_KHR_map_memory2
Faith Ekstrand [Fri, 31 Mar 2023 16:11:22 +0000 (11:11 -0500)]
nvk: Implement VK_KHR_map_memory2

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

11 months agonvk: Use vk_device_memory
Faith Ekstrand [Fri, 31 Mar 2023 16:07:36 +0000 (11:07 -0500)]
nvk: Use vk_device_memory

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

11 months agonvk: Set spirv_to_nir_options::min_*_alignment
Faith Ekstrand [Thu, 30 Mar 2023 22:41:47 +0000 (17:41 -0500)]
nvk: Set spirv_to_nir_options::min_*_alignment

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

11 months agonvk: Add a separate #define for SSBO alignment
Faith Ekstrand [Thu, 30 Mar 2023 22:40:35 +0000 (17:40 -0500)]
nvk: Add a separate #define for SSBO alignment

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

11 months agonvk: Expose VK_KHR_maintenance2
Faith Ekstrand [Thu, 30 Mar 2023 20:42:01 +0000 (15:42 -0500)]
nvk: Expose VK_KHR_maintenance2

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

11 months agonvk: Set pointClippingBehavior
Faith Ekstrand [Thu, 30 Mar 2023 20:40:57 +0000 (15:40 -0500)]
nvk: Set pointClippingBehavior

This is what the blob advertises.  I don't know if it's correct or not
because the CTS test for this seems to pass either way:

    dEQP-VK.clipping.clip_volume.depth_clamp.point_list

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

11 months agonvk: Implement uncompressed views of compressed images
Faith Ekstrand [Thu, 30 Mar 2023 16:38:16 +0000 (11:38 -0500)]
nvk: Implement uncompressed views of compressed images

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

11 months agonil: Add an image_level_as_uncompressed helper
Faith Ekstrand [Thu, 30 Mar 2023 16:33:54 +0000 (11:33 -0500)]
nil: Add an image_level_as_uncompressed helper

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

11 months agonil: Add a nil_image_for_level helper
Faith Ekstrand [Thu, 30 Mar 2023 16:24:22 +0000 (11:24 -0500)]
nil: Add a nil_image_for_level helper

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

11 months agonvk: Support geometry shaders
George Ouzounoudis [Tue, 18 Oct 2022 18:51:37 +0000 (21:51 +0300)]
nvk: Support geometry shaders

This enables geometry shaders for nvk.  Physical device limits taken
from nouveau codebase and http://www.vulkan.gpuinfo.org

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

11 months agonvk: Fix geometry shader active stream mask
George Ouzounoudis [Sat, 26 Nov 2022 16:39:20 +0000 (18:39 +0200)]
nvk: Fix geometry shader active stream mask

This sets StreamOutMask in the shader header correctly based on:
https://download.nvidia.com/open-gpu-doc/Shader-Program-Header/1/Shader-Program-Header.html

After this fix transform feedback CTS tests with geometry shader streams
are passing.

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

11 months agonvk: Disable PRIMITIVE_RESTART_VERTEX_ARRAY by default
George Ouzounoudis [Mon, 21 Nov 2022 19:01:14 +0000 (21:01 +0200)]
nvk: Disable PRIMITIVE_RESTART_VERTEX_ARRAY by default

This made various strip geometry tests fail.  Tests with primitive
restart do not seem affected after this.

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

11 months agonvk: Increase the push runout to 512 dwords
Faith Ekstrand [Thu, 30 Mar 2023 19:46:40 +0000 (14:46 -0500)]
nvk: Increase the push runout to 512 dwords

This is needed in order to do all of viewport state in a single push.

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

11 months agonvk: Add A8B8G8R8_*_PACK32 format support
Echo J [Thu, 30 Mar 2023 16:58:28 +0000 (19:58 +0300)]
nvk: Add A8B8G8R8_*_PACK32 format support

Here it is; the long-awaited change (as requested by 2 people on Discord 🥺)

This change originally added one Vulkan format which was needed for STK's
Vulkan renderer, but @gfxstrand suggested to add all of the A8B8G8R8_*_PACK32
formats in a GitLab thread)

This obviously fixes SuperTuxKart crashing with the Vulkan renderer 🐸

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

11 months agonvk: Advertise VK_KHR_multiview
Rebecca Mckeever [Thu, 16 Feb 2023 00:47:30 +0000 (16:47 -0800)]
nvk: Advertise VK_KHR_multiview

Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/52

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add input attachments support for multiview
Rebecca Mckeever [Fri, 3 Mar 2023 19:51:07 +0000 (11:51 -0800)]
nvk: Add input attachments support for multiview

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add query support for multiview
Rebecca Mckeever [Mon, 27 Feb 2023 21:14:56 +0000 (13:14 -0800)]
nvk: Add query support for multiview

When multiview is enabled, queries must use N consecutive query indices in the
query pool, where N is the number of bits set in the view mask in the subpass
the query is used in.

In our case, only the first query is used, so we emit zeros for the remaining
queries.

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add draw support for multiview
Rebecca Mckeever [Tue, 7 Mar 2023 00:09:55 +0000 (16:09 -0800)]
nvk: Add draw support for multiview

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Break the inner MME draw loop into a helper
Faith Ekstrand [Fri, 17 Mar 2023 15:29:54 +0000 (10:29 -0500)]
nvk: Break the inner MME draw loop into a helper

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

11 months agonvk: Spill DRAW_IDX pre-Turing
Faith Ekstrand [Mon, 27 Mar 2023 22:44:33 +0000 (17:44 -0500)]
nvk: Spill DRAW_IDX pre-Turing

Spill draw_idx to shadow scratch once we've written it to the root
descriptor.  This saves us a bit of register pressure around a pretty
tight seciton.

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

11 months agonvk: Rework spill helpers and DRAW_COUNT spilling
Faith Ekstrand [Mon, 27 Mar 2023 21:22:12 +0000 (16:22 -0500)]
nvk: Rework spill helpers and DRAW_COUNT spilling

The new helpers, now moved to nvk_mme.h, take an nvk_mme_scratch value
to ensure no overlap.  They also ensure that we use exactly the same
register for the unspilled value as the spilled value.  This makes
spilling safe for loop-carried values and the like.  The old
nvk_mme_fill() helper just loads a spilled value to a new, possibly
different register.

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

11 months agonouveau/mme: Add a helper for re-allocating registers
Faith Ekstrand [Mon, 27 Mar 2023 21:09:54 +0000 (16:09 -0500)]
nouveau/mme: Add a helper for re-allocating registers

This helper unlike alloc, tries to use the same value as the register
had before.  This is intended for manual spill/unspill code which wants
to keep register numbers the same while carefully spilling around high-
pressure regions.

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

11 months agonvk: Use the new load/store_scratch helpers for DRAW_PAD_DW
Faith Ekstrand [Mon, 27 Mar 2023 21:32:41 +0000 (16:32 -0500)]
nvk: Use the new load/store_scratch helpers for DRAW_PAD_DW

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

11 months agonvk: Add begin to mme_scratch
Faith Ekstrand [Fri, 24 Mar 2023 00:18:36 +0000 (19:18 -0500)]
nvk: Add begin to mme_scratch

Introduce helpers to make it easier to work with the nvk mme shadow
scratch. Store begin in the shadow scratch in vkCmdDraw* related code to
save registers, which is necessary for Fermi.

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

11 months agonvk: Lower nir_intrinsic_load_view_index
Rebecca Mckeever [Fri, 17 Feb 2023 02:40:45 +0000 (18:40 -0800)]
nvk: Lower nir_intrinsic_load_view_index

Lower view_index intrinsics to a load_ubo using NIR.

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add view_index to root descriptor table
Rebecca Mckeever [Fri, 17 Feb 2023 01:41:07 +0000 (17:41 -0800)]
nvk: Add view_index to root descriptor table

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Fix while loops pre-Turing
Faith Ekstrand [Wed, 29 Mar 2023 04:34:29 +0000 (23:34 -0500)]
nouveau/mme: Fix while loops pre-Turing

Pre-Turing, we don't have a full condition built into the loop so, for
mme_while(b, ine, x, y) we have to generate the following:

[top]   BR -> [cond]
        /* loop body */
[cond]  XOR tmp, x, y
        BRZ !tmp -> [top]

However, due to an accounting error, we were generating

[top]   BR -> [cond]
        /* loop body */
        XOR tmp, x, y
[cond]  BRZ !tmp -> [top]

which meant that the XOR (or ADD if one is an immediate) was getting
skipped, leading to the loop either never terminating or always
terminating.  The way to fix this accounting error is to close the while
first, then compute the condition value, then do the jump.

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

11 months agonouveau/mme: Use ADD for ine with an immediate
Faith Ekstrand [Wed, 29 Mar 2023 04:31:20 +0000 (23:31 -0500)]
nouveau/mme: Use ADD for ine with an immediate

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

11 months agonvk: Add a macro to set MMIO registers via falcons
Karol Herbst [Thu, 23 Mar 2023 14:43:05 +0000 (15:43 +0100)]
nvk: Add a macro to set MMIO registers via falcons

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: add a macro exit helper
Karol Herbst [Thu, 23 Mar 2023 14:39:03 +0000 (15:39 +0100)]
nouveau/mme: add a macro exit helper

At the moment it's turing+ only.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: add test for BEQ with magic exit offset
Karol Herbst [Thu, 23 Mar 2023 16:54:47 +0000 (17:54 +0100)]
nouveau/mme: add test for BEQ with magic exit offset

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

11 months agonvk: Fix some cast defines
Echo J [Mon, 27 Mar 2023 21:03:33 +0000 (00:03 +0300)]
nvk: Fix some cast defines

This removes compiler warnings on 32-bit builds 🐸

Also other drivers do define casts this way, so this should actually
be an uncontroversial change 😁

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

11 months agonvk: Add instace WSI entrypoints
Faith Ekstrand [Mon, 27 Mar 2023 20:49:50 +0000 (15:49 -0500)]
nvk: Add instace WSI entrypoints

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

11 months agonvk: Advertise ICD/loader interface version 4
Faith Ekstrand [Mon, 27 Mar 2023 16:29:36 +0000 (11:29 -0500)]
nvk: Advertise ICD/loader interface version 4

We can't advertise v5 yet because we don't support Vulkan 1.1 yet.

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

11 months agonvk: Use the same lock for the submit and the memory objects list
Faith Ekstrand [Wed, 22 Mar 2023 21:09:23 +0000 (16:09 -0500)]
nvk: Use the same lock for the submit and the memory objects list

We need to lock the memory objects list around the entire push builder
process.  Otherwise, a memory object could get destroyed between adding
it to the BO list and doing the submit, leading to the kernel rejecting
our pushbuf.

When the time comes that we switch to the new uAPI both uses of
nvk_device::mutex will go away.  We'll no longer be passing lists of BOs
to the kernel and we'll move to syncobj and be able to drop all the
nvk_bo_sync nonsense.

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

11 months agonvk: advertise DemoteToHelperInvocation
Mohamed Ahmed [Mon, 20 Mar 2023 19:26:36 +0000 (21:26 +0200)]
nvk: advertise DemoteToHelperInvocation

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

11 months agonvk: fix r32_sint format support
Dave Airlie [Wed, 22 Mar 2023 06:34:33 +0000 (16:34 +1000)]
nvk: fix r32_sint format support

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

11 months agonvk: add min_lod to spirv caps.
Dave Airlie [Wed, 22 Mar 2023 00:56:42 +0000 (10:56 +1000)]
nvk: add min_lod to spirv caps.

We expose the vulkan feature

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

11 months agonvk: add compute support for ampere
Dave Airlie [Wed, 22 Mar 2023 00:10:13 +0000 (10:10 +1000)]
nvk: add compute support for ampere

ampere has support for QMDv3, it's not mandatory but lets use it for now.

the more important change is the PCAS2_B call.

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

11 months agonvk: Clamp viewport clip to max range
Faith Ekstrand [Wed, 22 Mar 2023 17:28:44 +0000 (12:28 -0500)]
nvk: Clamp viewport clip to max range

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

11 months agonvk/barrier: handle host bit.
Dave Airlie [Tue, 21 Mar 2023 06:23:19 +0000 (16:23 +1000)]
nvk/barrier: handle host bit.

Fixes dEQP-VK.pipeline.monolithic.timestamp.transfer_tests.host_stage* crashes

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

11 months agonvk: Support vertex shader transform feedback on Fermi
George Ouzounoudis [Tue, 31 Jan 2023 20:53:56 +0000 (22:53 +0200)]
nvk: Support vertex shader transform feedback on Fermi

Byte counts should be fetched with a different way in case of Fermi.
We cannot read the buffer directly in the mme.

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

11 months agonvk: Support transform feedback queries
George Ouzounoudis [Sat, 26 Nov 2022 17:46:48 +0000 (19:46 +0200)]
nvk: Support transform feedback queries

We need 2 reports for these. One for successfully written primitives
and one for needed primitives. Also we need to use report semaphore's
sub_report member to specify the query's corresponding vertex stream.
Finally availability index is 2 in the query results, as we have 2
results for succeeded and needed primitives.

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

11 months agonvk: Support transform feedback geometry streams
George Ouzounoudis [Sat, 26 Nov 2022 16:32:22 +0000 (18:32 +0200)]
nvk: Support transform feedback geometry streams

We just need to set the correct limits and features.  The meaningful
change here is the selected stream for rasterization which is configured
through the graphics pipeline.

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

11 months agonvk: Support transform feedback indirect draws
George Ouzounoudis [Fri, 25 Nov 2022 19:10:30 +0000 (21:10 +0200)]
nvk: Support transform feedback indirect draws

This draw needs to read the byte count indirectly so it is implemented
as an mme function.  Some refactoring was done in the draw functions, so
that nvk_mme_build_draw could be used for this case.

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

11 months agonvk: De-duplicate MME code for setting draw params
Faith Ekstrand [Wed, 22 Mar 2023 16:42:19 +0000 (11:42 -0500)]
nvk: De-duplicate MME code for setting draw params

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

11 months agonouveau/mme: Ensure that zero-initizlied mme_value is ZERO
Faith Ekstrand [Wed, 22 Mar 2023 15:31:48 +0000 (10:31 -0500)]
nouveau/mme: Ensure that zero-initizlied mme_value is ZERO

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

11 months agonvk: Support for vertex shader transform feedback
George Ouzounoudis [Wed, 16 Nov 2022 20:29:57 +0000 (22:29 +0200)]
nvk: Support for vertex shader transform feedback

For starters, we support only vertex shader output transform feedback.
Optional support for queries, streams and indirect draw are left out for
now.

Pipeline and shader state is based on nvc0 code. Most of the shader
state is going to change with the new compiler.

Required support for pause/resume is implemented with an mme function
that loads the offset indirectly from the counter buffer on resume.
For pause, we store the offset indirectly with a SET_REPORT_SEMAPHORE.

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

11 months agonvk/nil: don't ask for compressed image kind
Dave Airlie [Sun, 19 Mar 2023 23:41:38 +0000 (09:41 +1000)]
nvk/nil: don't ask for compressed image kind

These need special kernel handling around the mmu, avoid asking
for them, nvidia don't seem to use them with gsp either yet.

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

11 months agonouveau/winsys: allocate unique object handles across channels.
Dave Airlie [Fri, 17 Mar 2023 05:54:14 +0000 (15:54 +1000)]
nouveau/winsys: allocate unique object handles across channels.

GSP requires unique object handles across channels, otherwise
it reports an error.

This fixes vulkaninfo on gsp enabled fw

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Add a bfe helper
Faith Ekstrand [Fri, 17 Mar 2023 18:29:34 +0000 (13:29 -0500)]
nouveau/mme: Add a bfe helper

This extracts a fixed number of bits from a possibly variable position
in the source value.  Very helpful for testing for a bit.

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

11 months agonvk: Advertise shaderImageGatherExtended
Faith Ekstrand [Fri, 17 Mar 2023 16:24:45 +0000 (11:24 -0500)]
nvk: Advertise shaderImageGatherExtended

Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/62
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Rework features enables
Faith Ekstrand [Thu, 16 Mar 2023 23:37:44 +0000 (18:37 -0500)]
nvk: Rework features enables

Use the new feature enables framework.

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

11 months agonvk: Rework extension enables
Faith Ekstrand [Thu, 16 Mar 2023 23:43:33 +0000 (18:43 -0500)]
nvk: Rework extension enables

Take an nv_device_info instead of a full nvk_physical_device.  This
prevents errors where nvk_get_device_extensions() may access an
uninitialized field of nvk_physical_device.

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

11 months agonvk: advertise VK_KHR_maintenance4
Mohamed Ahmed [Sat, 11 Mar 2023 21:45:55 +0000 (23:45 +0200)]
nvk: advertise VK_KHR_maintenance4

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

11 months agonvk: implement vkGetDeviceBufferMemoryRequirementsKHR()
Mohamed Ahmed [Sat, 11 Mar 2023 20:48:02 +0000 (22:48 +0200)]
nvk: implement vkGetDeviceBufferMemoryRequirementsKHR()

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

11 months agonvk: add stub for vkGetDeviceImageSparseMemoryRequirementsKHR()
Mohamed Ahmed [Fri, 10 Mar 2023 22:07:31 +0000 (00:07 +0200)]
nvk: add stub for vkGetDeviceImageSparseMemoryRequirementsKHR()

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

11 months agonvk: implement vkGetDeviceImageMemoryRequirementsKHR()
Mohamed Ahmed [Fri, 10 Mar 2023 22:02:41 +0000 (00:02 +0200)]
nvk: implement vkGetDeviceImageMemoryRequirementsKHR()

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

11 months agonouveau/mme: Add a helper to dump instructions
Faith Ekstrand [Mon, 13 Mar 2023 14:53:14 +0000 (09:53 -0500)]
nouveau/mme: Add a helper to dump instructions

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

11 months agonouveau/mme: Fix nested while instructions on Turing+
Faith Ekstrand [Thu, 9 Mar 2023 21:45:44 +0000 (15:45 -0600)]
nouveau/mme: Fix nested while instructions on Turing+

Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/49
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Bump init context batch size
Faith Ekstrand [Thu, 9 Mar 2023 21:43:51 +0000 (15:43 -0600)]
nvk: Bump init context batch size

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

11 months agonvk: set device info before use in nvk_get_device_extensions
Thomas H.P. Andersen [Fri, 3 Mar 2023 23:07:16 +0000 (00:07 +0100)]
nvk: set device info before use in nvk_get_device_extensions

nvk_get_device_extensions uses device->info to enable extensions
only for supported device architectures.

Only info is needed, but it seemed cleaner to keep all the three
changed lines together.

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

11 months agonvk: Implement VK_KHR_draw_indirect_count on Turing+
Thomas H.P. Andersen [Thu, 3 Nov 2022 22:30:53 +0000 (23:30 +0100)]
nvk: Implement VK_KHR_draw_indirect_count on Turing+

v2: handle maxDrawCount parameter
v3: assert on pre-turing. Free regsisters after use.
v4: less register presure. Update to pass new tests

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

11 months agonvk: add warning on non-nouveau drm driver
Thomas H.P. Andersen [Wed, 25 Jan 2023 21:53:15 +0000 (22:53 +0100)]
nvk: add warning on non-nouveau drm driver

Check that the drm kernel driver in use is nouveau, and
add a short description of the issue.

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

11 months agonvk: Return VK_ERROR_INCOMPATIBLE_DRIVER if the PCI vendor isn't NVIDIA
Faith Ekstrand [Tue, 28 Feb 2023 18:32:33 +0000 (12:32 -0600)]
nvk: Return VK_ERROR_INCOMPATIBLE_DRIVER if the PCI vendor isn't NVIDIA

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

11 months agonvk: Support VK_KHR_shader_draw_parameters
George Ouzounoudis [Sat, 5 Nov 2022 19:55:25 +0000 (21:55 +0200)]
nvk: Support VK_KHR_shader_draw_parameters

We need to supply the base vertex, the base instance and draw index to
the shader for this extension. Similar to the base instance we supported
before, we load base vertex and draw index as root constants at draw time.

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