Commit graph

175831 commits

Author SHA1 Message Date
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
Faith Ekstrand
ccc50eb276 nvk: Properly align root descriptor tables for pre-Pascal
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
3595701e16 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
dabc4f6bcc 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
731cfb86e7 nvk: Use a contiguous shader heap pre-Volta
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
55be10648d 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>
2023-08-04 21:32:03 +00:00
Mary
dc8fd9050c nouveau/mme: Add Fermi hardware tests
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Mary
d64a0b787e nouveau/mme: Add Fermi simulator
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
b949a53206 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
e848cbafa4 Support immediates in MERGE
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Mary
162269f049 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>
2023-08-04 21:32:03 +00:00
Mary
663258be5e nouveau/mme: Add initial Fermi definition
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
5971c0967a nouveau/mme: Take an 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
dfe4627e3d nouveau/mme: Prepare the builder for multiple GPU generations
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
ff39efdf55 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
7630f0e645 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
baa1735364 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
9e1a868b6d 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>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
0b52da5afa nouveau/mme: Break the Turing builder guts into a separate header
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
724f7a875f nouveau/mme: Make helpers less Turing specific
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
cc87631b20 nouveau/mme: Use mme_mov() for temp copies of register IMM32 sources
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
d207b3356e nouveau/mme: Add an intermediate MME_CMP_OP enum
Having everything go through the Turing opcodes isn't a good long-term
plan so add an intermediate which is independent of HW generation.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
c0c7e23ca8 nouveau/mme: Add an intermediate MME_ALU_OP enum
Having everything go through the Turing opcodes isn't a good long-term
plan so add an intermediate which is independent of HW generation.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
db5b38cb9e nouveau/mme: Add a mme_reg_alloc struct
This has some nice asserts which we'll want when we start having
reserved registers on Fermi.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
2d7f96228d nouveau/mme: Move mme_value into its own header
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Rebecca Mckeever
70ce8ba5a4 nvk: Implement VK_EXT_image_view_min_lod
Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/40

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:03 +00:00
Rebecca Mckeever
71da9cbefb nouveau/nil: Add macros for ufixed
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:03 +00:00
Faith Ekstrand
fa5a82dc32 nouveau/mme: Make alu_op_to_str static
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
ffc619b3eb nouveau/mme: Invoke SET_OBJECT in the tests
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
6fd6baa989 nouveau/nil: Use nv_device_info for format queries
There's no reason why any of this needs access to the fd or the context.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
f23b892a9d nouveau/nil: Take an nv_device_info for image functions
There's no reason why any of this needs access to the fd or the context.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
433e742682 nouveau/winsys: Move device type into nv_device_info
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
87f946730f nouveau/winsys: Add an info to nouveau_ws_device
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
0d25483101 nouveau/winsys: Take a drmDevicePtr in nouveau_ws_device_new()
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Rebecca Mckeever
44431f8ee5 nvk: Implement VK_EXT_non_seamless_cube_map
Add new bit to VkSamplerCreateFlags and then advertise
VK_EXT_non_seamless_cube_map.

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

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:03 +00:00
Rebecca Mckeever
788ae9b601 nvk: Enable shadow sampling
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:02 +00:00
Rebecca Mckeever
53e0bef359 nvk: Advertise EXT_4444_formats
The following tests now pass:

dEQP-VK.texture.filtering.2d.formats.a4b4g4r4_unorm.nearest
dEQP-VK.texture.filtering.2d.formats.a4b4g4r4_unorm.linear
dEQP-VK.texture.filtering.2d.formats.a4b4g4r4_unorm.nearest_mipmap_nearest
dEQP-VK.texture.filtering.2d.formats.a4b4g4r4_unorm.linear_mipmap_nearest
dEQP-VK.texture.filtering.2d.formats.a4b4g4r4_unorm.nearest_mipmap_linear
dEQP-VK.texture.filtering.2d.formats.a4b4g4r4_unorm.linear_mipmap_linear

The corresponding tests for a4r4g4b4_unorm are still passing.

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

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:02 +00:00
Rebecca Mckeever
e89a715f4a nvk: Add A4B4G4R4 formats to nil_format_info table
The nil_format_info table contains the following lines, which add
A4R4G4B4 formats.

   C4(A, B4G4R4A4_UNORM,   NONE,       B, G, R, A, UNORM,   A4B4G4R4,   T),
   F3(A, B4G4R4X4_UNORM,   NONE,       B, G, R, x, UNORM,   A4B4G4R4,   T),

Add similar lines to the nil_format_info table for A4B4G4R4 formats.

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:02 +00:00
Rebecca Mckeever
115644cbc6 nvk: Add VK_FORMAT_B4G4R4A4_UNORM_PACK16 format to nil_format_info table
The following tests now pass:

dEQP-VK.pipeline.monolithic.sampler.view_type.2d_unnormalized.format.b4g4r4a4_unorm_pack16.*

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:02 +00:00
Rebecca Mckeever
44b7d71c65 nvk: Advertise KHR_device_group
Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/35

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:02 +00:00
Rebecca Mckeever
d471da3f95 nvk: Implement nvk_CmdDispatchBase and delete nvk_CmdDispatch
Implement nvk_CmdDispatchBase() and then delete nvk_CmdDispatch() so that
the vk_common verion with be used instead. This will avoid repeated code.
Update nvk_CmdDispatchIndirect() so that it sets the three base_group
fields of the root descriptor table to 0.

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:02 +00:00
Rebecca Mckeever
3fb732ad7d nvk: Lower base_workgroup_id
Lower load_base_workgroup_id 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:02 +00:00
Rebecca Mckeever
668e859255 nvk: Add base_group 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:02 +00:00
Faith Ekstrand
3c5fbfcc30 nvk: Set maxMemoryAllocationCount
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00