Commit graph

175874 commits

Author SHA1 Message Date
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
Faith Ekstrand
ee8fb23d20 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>
2023-08-04 21:32:04 +00:00
Faith Ekstrand
83142c825f nouveau/mme: Don't allow WaW dependencies in the same Turing instruction
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand
5560f5f4ff nvk: Make some MME builder names more consistent
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
0d45486f2c nvk: Add a helper for pushing indirect data
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
d5a31866ec 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
eed24d89dd nvk/drm: Take a byte offset/range in push_add_push
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
b76d6725e2 nouveau/mme: nouveau/mme: Add builder tests for SLL and SRL
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
aa69c25125 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
c98179b868 nouveau/mme: Add builder tests for SUB
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
e8032b893d 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
15295e32ec 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
94ea7cad3a nouveau/mme: Take a const nv_device_info in mme_builder_init
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
b664b42fce 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
75deae5988 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
67008dfe78 nil: Only choose a PTE kind for tiled images
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Dave Airlie
22cd2658e8 nvk: Report image alignments from NIL
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Dave Airlie
be5a07aa52 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>
2023-08-04 21:32:03 +00:00
Dave Airlie
a51b06c730 nvk: set the device fd
This is needed later for syncobj support

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Dave Airlie
ee06bee79a 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>
2023-08-04 21:32:03 +00:00
Dave Airlie
be456a3be2 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
cca5f6b280 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
ade334a807 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
7c096786ca nvk: Use a GS for layerered rendering pre-MaxwellB
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
74e8be6545 vulkan/meta: Insert a geometry shader when needed
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
af3400a957 nvk: Compile all NIR before running codegen
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
George Ouzounoudis
838c92ae95 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>
2023-08-04 21:32:03 +00:00