Commit graph

177262 commits

Author SHA1 Message Date
Faith Ekstrand
6b7d13529a 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>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
9009100486 nvk: Use the new load/store_scratch helpers for DRAW_PAD_DW
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
8ae61af5e3 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>
2023-08-04 21:32:05 +00:00
Rebecca Mckeever
ec917719bf 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>
2023-08-04 21:32:05 +00:00
Rebecca Mckeever
f0c86365da 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>
2023-08-04 21:32:04 +00:00
Faith Ekstrand
08a200193f 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>
2023-08-04 21:32:04 +00:00
Faith Ekstrand
ccf004837a nouveau/mme: Use ADD for ine with an immediate
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Karol Herbst
837b622dbf 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>
2023-08-04 21:32:04 +00:00
Karol Herbst
63bb25f87d 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>
2023-08-04 21:32:04 +00:00
Karol Herbst
dc099bd808 nouveau/mme: add test for BEQ with magic exit offset
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Echo J
bd1ff51b77 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>
2023-08-04 21:32:04 +00:00
Faith Ekstrand
3ecf6db521 nvk: Add instace WSI entrypoints
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
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