Commit Graph

175900 Commits

Author SHA1 Message Date
Faith Ekstrand bb003b75a1 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>
2023-08-04 21:32:04 +00:00
Faith Ekstrand 43083a041b 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>
2023-08-04 21:32:04 +00:00
Mohamed Ahmed 93c439f660 nvk: advertise DemoteToHelperInvocation
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Dave Airlie 651bdb3822 nvk: fix r32_sint format support
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Dave Airlie c7b240c67c nvk: add min_lod to spirv caps.
We expose the vulkan feature

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Dave Airlie d96cac61c5 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>
2023-08-04 21:32:04 +00:00
Faith Ekstrand 9dbeef7fa1 nvk: Clamp viewport clip to max range
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Dave Airlie f1b4ddcf1f 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>
2023-08-04 21:32:04 +00:00
George Ouzounoudis 44fd2e94a3 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>
2023-08-04 21:32:04 +00:00
George Ouzounoudis 6e5efe6407 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>
2023-08-04 21:32:04 +00:00
George Ouzounoudis 2b3730d271 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>
2023-08-04 21:32:04 +00:00
George Ouzounoudis bdd4a65718 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>
2023-08-04 21:32:04 +00:00
Faith Ekstrand 6dded0bc53 nvk: De-duplicate MME code for setting draw params
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand fb60830935 nouveau/mme: Ensure that zero-initizlied mme_value is ZERO
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
George Ouzounoudis 5fd7df4aa2 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>
2023-08-04 21:32:04 +00:00
Dave Airlie d66182b215 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>
2023-08-04 21:32:04 +00:00
Dave Airlie 983b5e9934 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>
2023-08-04 21:32:04 +00:00
Faith Ekstrand 37505e9bba 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>
2023-08-04 21:32:04 +00:00
Faith Ekstrand b0658acf17 nvk: Advertise shaderImageGatherExtended
Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/62
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand 97346f0fe1 nvk: Rework features enables
Use the new feature enables framework.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand e37c20a3da 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>
2023-08-04 21:32:04 +00:00
Mohamed Ahmed b07fef43bf nvk: advertise VK_KHR_maintenance4
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Mohamed Ahmed 08057651ea nvk: implement vkGetDeviceBufferMemoryRequirementsKHR()
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Mohamed Ahmed 81dc17c4db nvk: add stub for vkGetDeviceImageSparseMemoryRequirementsKHR()
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Mohamed Ahmed e4ec8df90b nvk: implement vkGetDeviceImageMemoryRequirementsKHR()
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand e83faece09 nouveau/mme: Add a helper to dump instructions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand c1ae91d89e 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>
2023-08-04 21:32:04 +00:00
Faith Ekstrand f2aec3b99e nvk: Bump init context batch size
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Thomas H.P. Andersen b4ddae03b7 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>
2023-08-04 21:32:04 +00:00
Thomas H.P. Andersen 0e5fcf912f 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>
2023-08-04 21:32:04 +00:00
Thomas H.P. Andersen d0cf79b28f 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>
2023-08-04 21:32:04 +00:00
Faith Ekstrand 0083eb330f nvk: Return VK_ERROR_INCOMPATIBLE_DRIVER if the PCI vendor isn't NVIDIA
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
George Ouzounoudis 52db7738f7 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>
2023-08-04 21:32:04 +00:00
George Ouzounoudis 09358fc0c1 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>
2023-08-04 21:32:04 +00:00
George Ouzounoudis ffd896852b 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>
2023-08-04 21:32:04 +00:00
Rebecca Mckeever c9eac89da8 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>
2023-08-04 21:32:04 +00:00
Rebecca Mckeever ea06f9a893 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>
2023-08-04 21:32:04 +00:00
Rebecca Mckeever 2532f5654f 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>
2023-08-04 21:32:04 +00:00
Rebecca Mckeever 290bd3e027 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>
2023-08-04 21:32:04 +00:00
Rebecca Mckeever 7ff951d3cc 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>
2023-08-04 21:32:04 +00:00
Rebecca Mckeever 635b252b4b nvk: Implement nvk_GetDescriptorSetLayoutSupport
Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand 63c35814aa 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>
2023-08-04 21:32:04 +00:00
Rebecca Mckeever 34e842eedb 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>
2023-08-04 21:32:04 +00:00
Rebecca Mckeever b7e39f5e15 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>
2023-08-04 21:32:04 +00:00
Mauro Rossi f6ab6fe401 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>
2023-08-04 21:32:04 +00:00
Thomas H.P. Andersen 197b4f8fc7 nouveau/mme: use fermi enum in fermi builder
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand 715dff0b93 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>
2023-08-04 21:32:04 +00:00
Faith Ekstrand 978415e7a2 vulkan/meta: Use the new NIR texture helpers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand a3716f1b9e nvk: Implement Draw*Indirect on pre-Turing
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand 4fb8fa5241 nouveau/push: Add an NV_PUSH_MAX_COUNT #define
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00