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

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 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>

14 months agonvk: Simplify mme build function argument
George Ouzounoudis [Thu, 26 Jan 2023 17:39:28 +0000 (19:39 +0200)]
nvk: Simplify mme build function argument

We do not need the full nvk_device struct for the mme builder functions,
just the nv_device_info is enough. We keep a pointer in the
mme_builder so we can use this instead. Also, when we run mme builder
tests we do not need to initialize a device struct.

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

14 months agonouveau/mme: Keep device info in mme_builder
George Ouzounoudis [Thu, 26 Jan 2023 17:36:53 +0000 (19:36 +0200)]
nouveau/mme: Keep device info in mme_builder

We keep a pointer to nv_device_info instead of just copying the GPU's
3D engine class.

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

14 months agonvk: Advertise VK_EXT_robustness2
Rebecca Mckeever [Mon, 23 Jan 2023 19:59:18 +0000 (11:59 -0800)]
nvk: Advertise VK_EXT_robustness2

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

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

14 months agonvk: Advertise VK_EXT_image_robustness
Rebecca Mckeever [Fri, 27 Jan 2023 06:06:28 +0000 (22:06 -0800)]
nvk: Advertise VK_EXT_image_robustness

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

14 months agonvk: Set image index to zero for NULL nvk_buffer_view
Rebecca Mckeever [Fri, 27 Jan 2023 19:47:34 +0000 (11:47 -0800)]
nvk: Set image index to zero for NULL nvk_buffer_view

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

14 months agonvk: Advertise VK_EXT_mutable_descriptor_type
Rebecca Mckeever [Fri, 13 Jan 2023 23:36:25 +0000 (15:36 -0800)]
nvk: Advertise VK_EXT_mutable_descriptor_type

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

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

14 months agonvk: Enable VK_KHR_maintenance3
Rebecca Mckeever [Fri, 20 Jan 2023 17:53:59 +0000 (09:53 -0800)]
nvk: Enable VK_KHR_maintenance3

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

14 months agonvk: Implement nvk_GetDescriptorSetLayoutSupport
Rebecca Mckeever [Sat, 14 Jan 2023 05:32:02 +0000 (21:32 -0800)]
nvk: Implement nvk_GetDescriptorSetLayoutSupport

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

14 months agonvk: Don't over-size push descriptor sets
Faith Ekstrand [Tue, 31 Jan 2023 02:12:07 +0000 (20:12 -0600)]
nvk: Don't over-size push descriptor sets

We were over-allocating them by 4x.

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

14 months agonvk: Replace asserts with conditional that sets type_list = NULL
Rebecca Mckeever [Sat, 14 Jan 2023 04:35:00 +0000 (20:35 -0800)]
nvk: Replace asserts with conditional that sets type_list = NULL

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

14 months agonvk: Update mutable descriptor struct type
Rebecca Mckeever [Fri, 13 Jan 2023 23:36:47 +0000 (15:36 -0800)]
nvk: Update mutable descriptor struct type

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

14 months agonouveau/mme: fix print inst for case MME_FERMI_OP_MERGE
Mauro Rossi [Sat, 14 Jan 2023 07:18:32 +0000 (08:18 +0100)]
nouveau/mme: fix print inst for case MME_FERMI_OP_MERGE

By applying the same coding style of the other case statements,
this patch fixes the following building errors:

../src/nouveau/mme/mme_fermi.c:209:10: error: expected expression
         uint32_t src_bit  = inst->bitfield.src_bit;
         ^
../src/nouveau/mme/mme_fermi.c:216:39: error: use of undeclared identifier 'src_bit'; did you mean 'dst_bit'?
         fprintf(fp, " (%u, %u, %u)", src_bit, size, dst_bit);
                                      ^~~~~~~
                                      dst_bit
../src/nouveau/mme/mme_fermi.c:211:19: note: 'dst_bit' declared here
         uint32_t dst_bit  = inst->bitfield.dst_bit;
                  ^
2 errors generated.

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

14 months agonouveau/mme: use fermi enum in fermi builder
Thomas H.P. Andersen [Sat, 14 Jan 2023 17:27:35 +0000 (18:27 +0100)]
nouveau/mme: use fermi enum in fermi builder

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

14 months agonvk: Add a build test for MMEs
Faith Ekstrand [Tue, 31 Jan 2023 02:12:07 +0000 (20:12 -0600)]
nvk: Add a build test for MMEs

This simple test compiles all the MMEs for Turing and Volta to ensure
that they build and don't run out of registers.  We could, in theory, do
actual unit testing here with gtest but just building is enough to
ensure that no one breaks driver start-up on hardware they don't own.
They can still break the driver functionally, of course, but at least
it'll initialize.

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

14 months agovulkan/meta: Use the new NIR texture helpers
Faith Ekstrand [Tue, 31 Jan 2023 02:12:07 +0000 (20:12 -0600)]
vulkan/meta: Use the new NIR texture helpers

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

14 months agonvk: Implement Draw*Indirect on pre-Turing
Faith Ekstrand [Tue, 31 Jan 2023 02:12:07 +0000 (20:12 -0600)]
nvk: Implement Draw*Indirect on pre-Turing

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

14 months agonouveau/push: Add an NV_PUSH_MAX_COUNT #define
Faith Ekstrand [Tue, 31 Jan 2023 02:12:07 +0000 (20:12 -0600)]
nouveau/push: Add an NV_PUSH_MAX_COUNT #define

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

14 months agonvk: Reduce register pressure in nvk_mme_build_draw*()
Faith Ekstrand [Tue, 31 Jan 2023 02:12:07 +0000 (20:12 -0600)]
nvk: Reduce register pressure in nvk_mme_build_draw*()

Re-order things a bit so we deal with vertex offset and first instance
separately and free those regs when we're done.

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

14 months agonouveau/mme: Don't allow WaW dependencies in the same Turing instruction
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nouveau/mme: Don't allow WaW dependencies in the same Turing instruction

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

14 months agonvk: Make some MME builder names more consistent
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Make some MME builder names more consistent

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

14 months agonvk: Add a helper for pushing indirect data
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Add a helper for pushing indirect data

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

14 months agonvk: Rework nvk_cmd_push a bit
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Rework nvk_cmd_push a bit

Instead of taking an nvk_cmd_bo take a nouveau_ws_bo and keep the map
pointer separate.  We'll need to do this when we start pushing stuff
that isn't nvk_cmd_bo.  Also, rework the bounds to be in bytes.

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

14 months agonvk/drm: Take a byte offset/range in push_add_push
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk/drm: Take a byte offset/range in push_add_push

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

14 months agonouveau/mme: nouveau/mme: Add builder tests for SLL and SRL
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nouveau/mme: nouveau/mme: Add builder tests for SLL and SRL

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

14 months agonouveau/mme: Use a uint32_t for size in mme_fermi_bfe()
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nouveau/mme: Use a uint32_t for size in mme_fermi_bfe()

It will never be a non-fixed value.

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

14 months agonouveau/mme: Add builder tests for SUB
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nouveau/mme: Add builder tests for SUB

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

14 months agonouveau/mme: Add some generic builder tests
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nouveau/mme: Add some generic builder tests

These don't need hardware and instead run entirely in the simulator.
The goal is to have something that we can run in CI and which ensures
consistency between the Turing and Fermi MMEs.

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

14 months agonouveau/mme: Unify some of the test framework
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nouveau/mme: Unify some of the test framework

Most of the actual nouveau device enumeration and test running framework
was copy+paste between the two.

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

14 months agonouveau/mme: Take a const nv_device_info in mme_builder_init
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nouveau/mme: Take a const nv_device_info in mme_builder_init

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

14 months agonouveau/mme: Don't swap x and y in mme_fermi_merge_to()
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nouveau/mme: Don't swap x and y in mme_fermi_merge_to()

This was probably an artifact of the fermi/turing merge.

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

14 months agonouveau/mme: Fix is_int18 for negative numbers
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nouveau/mme: Fix is_int18 for negative numbers

util_mask_sign_extend returns a uint64_t which we need to cast to
uint32_t in order to get the right comparison.  Otherwise, we risk
having ~0 in the top 32 bits and the comparison failing.

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

14 months agonil: Only choose a PTE kind for tiled images
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nil: Only choose a PTE kind for tiled images

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

14 months agonvk: Report image alignments from NIL
Dave Airlie [Wed, 2 Nov 2022 06:52:28 +0000 (16:52 +1000)]
nvk: Report image alignments from NIL

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

14 months agonil: Fix image align and size constraints
Dave Airlie [Wed, 11 Jan 2023 18:03:31 +0000 (12:03 -0600)]
nil: Fix image align and size constraints

In order to use compressed images we have to align to at least (1<<16)
though the kernel also likes (1<<21).

This fixes the alignments/sizes so they can work with vm allocs

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

14 months agonvk: set the device fd
Dave Airlie [Wed, 2 Nov 2022 06:47:52 +0000 (16:47 +1000)]
nvk: set the device fd

This is needed later for syncobj support

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

14 months agonvk/winsys: store device ptr into bo instead of ptr
Dave Airlie [Mon, 31 Oct 2022 00:28:18 +0000 (10:28 +1000)]
nvk/winsys: store device ptr into bo instead of ptr

This will be needed later.

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

14 months agonvk: init dev->physical_device earlier.
Dave Airlie [Mon, 31 Oct 2022 04:54:14 +0000 (14:54 +1000)]
nvk: init dev->physical_device earlier.

When device is passed to bo destroy this is needed earlier.

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

14 months agonvk: Cosmetic clean-ups to Create/DestroyDevice
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Cosmetic clean-ups to Create/DestroyDevice

Use dev and pdev instead of device and physical_device.  Also, clean up
whitespace a bit while we're here.

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

14 months agonvk: Handle zero-size index and vertex buffers pre-Turing
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Handle zero-size index and vertex buffers pre-Turing

According to the nouveau GL driver, this should be the addres of the
last byte, not the byte after the end.  The calculation will overflow if
range is 0 so we need to handle that special.

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

14 months agonvk: Use a GS for layerered rendering pre-MaxwellB
Faith Ekstrand [Fri, 31 Mar 2023 16:48:29 +0000 (11:48 -0500)]
nvk: Use a GS for layerered rendering pre-MaxwellB

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

14 months agovulkan/meta: Insert a geometry shader when needed
Faith Ekstrand [Fri, 31 Mar 2023 16:44:09 +0000 (11:44 -0500)]
vulkan/meta: Insert a geometry shader when needed

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

14 months agonvk: Compile all NIR before running codegen
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Compile all NIR before running codegen

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

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

This enables compiling geometry shaders.  Based primarily on gallium
nvc0/nvc0_program.c.

We need to enable/disable user clip planes based on the last geometry
stage.  Some asserts in codegen need to be changed too because the
compacted clip distance inputs are arrayed in the geometry shader. So we
have an array of clip distances for each input vertex.

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

14 months agonvk: Properly align root descriptor tables for pre-Pascal
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Properly align root descriptor tables for pre-Pascal

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

14 months agonvk: Free a couple regs in nvk_mme_build_draw_*()
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Free a couple regs in nvk_mme_build_draw_*()

We don't need base_instance after we've set it the first time. We also
don't need to keep intance_count around forever.  mme_loop() always
consumes the value at the beginning so we can free up a register right
away.  Fermi is really tight on registers and this is enough to make
the basic draw MMEs successfully compile.

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

14 months agonvk: Disable indirect draw/dispatch and query copy MMEs for now
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Disable indirect draw/dispatch and query copy MMEs for now

These all rely on mme_tu104_read_fifoed() which isn't available before
Turing.  They're also really register-expensive and we can't compile
them without paring things down a bit.

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

14 months agonvk: Use a contiguous shader heap pre-Volta
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Use a contiguous shader heap pre-Volta

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

14 months agonvk: Add support for contiguous heaps to nvk_heap
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Add support for contiguous heaps to nvk_heap

This is required for shader heaps pre-Volta because they use a single
64-bit base address and 32-bit offsets for individual shaders.  In this
case, the addresses returned from the heap are relative to the base.
The BO for the heap can be retrieved via nvk_heap_get_contiguous_bo_ref
which returns an actual reference so it's safe to call from the queue
submit path.

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

14 months agonouveau/mme: Add Fermi hardware tests
Mary [Fri, 6 Jan 2023 00:17:59 +0000 (01:17 +0100)]
nouveau/mme: Add Fermi hardware tests

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

14 months agonouveau/mme: Add Fermi simulator
Mary [Fri, 6 Jan 2023 00:13:55 +0000 (01:13 +0100)]
nouveau/mme: Add Fermi simulator

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

14 months agoAdd add immediate optimizations
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
Add add immediate optimizations

Also, immediates are signed 18-bit values so modify the builder to
support the entire range.

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

14 months agoSupport immediates in MERGE
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
Support immediates in MERGE

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

14 months agonouveau/mme: Add Fermi builder
Mary [Thu, 5 Jan 2023 22:57:39 +0000 (23:57 +0100)]
nouveau/mme: Add Fermi builder

Co-Authored-By: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

14 months agonouveau/mme: Add initial Fermi definition
Mary [Thu, 5 Jan 2023 22:43:00 +0000 (23:43 +0100)]
nouveau/mme: Add initial Fermi definition

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

14 months agonouveau/mme: Take an nv_device_info in mme_builder_init
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Take an nv_device_info in mme_builder_init

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

14 months agonouveau/mme: Prepare the builder for multiple GPU generations
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Prepare the builder for multiple GPU generations

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

14 months agonouveau/mme: Move the cf_stack struct to mme_builder.h
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Move the cf_stack struct to mme_builder.h

Fermi wants exactly the same thing.

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

14 months agonouveau/mme: Drop the implicit_imm parameter from mme_alu_to()
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Drop the implicit_imm parameter from mme_alu_to()

It's only used for control-flow and MERGE, all of which are special.

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

14 months agonouveau/mme: Move the guts of mme_state_arr_to() into mme_tu104_builder.c
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Move the guts of mme_state_arr_to() into mme_tu104_builder.c

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

14 months agonouveau/mme: Move the guts of mme_merge_to() into mme_tu104_builder.c
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Move the guts of mme_merge_to() into mme_tu104_builder.c

It's going to be a bit different on Fermi.

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

14 months agonouveau/mme: Break the Turing builder guts into a separate header
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Break the Turing builder guts into a separate header

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