Commit Graph

175368 Commits

Author SHA1 Message Date
Faith Ekstrand fff59a5f4f nvk: Fix descriptor offset alignment
This fixes two bugs.  First, we were aligning when setting the bindign
offset but not actually applying that alignment to buffer_size so when
we incremented by stride * descriptorCount, it incremented starting with
the unaligned value.  Second, in some cases we return stride = align = 0
and the ALIGN_POT macro will return 0 when something's aligned to 0.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 443717a17e nvk: Properly indent a comment
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 98a573eb15 nvk: Implement push constants
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 717ed1c48f nvk: Load the requested descriptor size
We were hard-coding to vec4s for some reason.  This results in vec4
texture handles which, while properly ignroed by codegen, are just
weird and not what we want.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand b6483f5126 nvk: Handle cube storage images properly
TIC entries for cubes divide the array size by 6 so we don't want that
when using it as a storage image.  This means nvk_image_view needs
separate TIC entries for storage vs. sampled now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 8b08bbe2cf nvk: Use a descriptor type instead of a hand-rolled thing
This was an attempt to prematurely optimize some things.  Sure, it's a
hot-path, but there's other control-flow in there and we can optimize it
later if needed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 0648f0fa03 nvk: Advertise non-zero descriptor set limits
Right now, everything's pretty much unlimited.  We may want to limit
UBOs in the future to just what we can bind but everything else will
probably remain pretty high.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand aa78f098f2 nvk: Advertise descriptor array indexing
This isn't as dynamic as it looks.  It still requires the index to be
uniform, it just lets it be not a constant.  Given how our descriptor
sets work, this is all handled trivially already.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand dda149c053 nvk: Better advertise image format features
We now advertise the top-level features and we don't falsely claim
write-without-format support per-format.  In theory, NV hardware should
be able to do shaderStorageImageReadWithoutFormat but codegen doesn't
know how yet.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand db81c26525 nvk: Add support for dynamic buffers
These are recorded in the CPU portion of the descriptor set and combined
with the dynamic offset at vkCmdBindDescriptorSets time and placed into
the root descriptor table.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 1f7476a03d nvk: Use the correct root descriptor table size for CmdDispatch
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand fae4f1884c nvk: Advertise KHR_dedicated_allocation
We're not requiring or even requesting anything to be dedicated yet but
we may as well put in the plumbing.  This gets more tests running.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand fedff04fbd nvk: Implement buffer views
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 1f72430bd6 nvk: Move is_storage_image_format to nvk_format.c
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 788e94294f nil: Add a helper for filling out buffer TIC entries
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 834f01f1b1 nvk: Implement samplers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 100c7060d8 nvk: Re-format nvk_sampler.c
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand cb4eff26e7 nvk: Teture pool sizes are maximums not sizes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand e13a64d286 nil: Fix image array layer alignments
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand f3ef6f2ee1 nil: Refactor TIC image extent setup
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 6a6cf64a78 nil: Don't minify image dimensions when setting up TIC
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand a67cfe2590 nil: Drop miptail support for now
We don't have any idea how they work or even which TIC bits have to do
with them.  Better off just leave them alone for now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Dave Airlie 974212a581 nouveau/classes: add 906f header support.
This needed some tweaks to the generator script

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 7a86192d3a nvk: Drop vk_sync BO refs after push_submit
Otherwise, all syncs are cumulative and, if the same command buffer is
submitted multiple times, it will sync on the union of all syncs it's
ever seen.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Dave Airlie 4c485b0b6f nouveau/ws: add a push reset just for references.
This is to be used with the empty submission pushbuf.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Dave Airlie e2565c2fc2 nvk: fix empty cmd submission.
The sync obj stuff does a second queue submit with just signals
and no command buffers. Make sure things get sent to the kernel
so sync works.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand bf01f4d66a nvk: Support compressed images in copy commands
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 20d8d1e239 nvk: Add a more competent GetPhysicalDeviceImageFormatProperties
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand fc19173014 nvk: Rework format features queries
Split the buffer and image portions into vk_buffer_view.c and vk_image.c
respectively.  This way they're a lot closer to each other.  Put the
main combined helper in nvk_format.c since it's a format thing.  Also,
restructure things a bit based on ANV to make the code look nicer.
Also, implement VK_KHR_format_feature_flags2 while we're here.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 76253dbf94 nvk: Reset and properly clean up command buffer upload areas
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 2a914028f1 nvk: Implement VkGetImageSubresourceLyout
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 23e6689b38 nvk: Re-indent image entrypoints
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand 04d2bf2ee7 nvk: Convert to using NIL for image layout
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:55 +00:00
Faith Ekstrand eefb60b832 nvk: Manually offset for array layers in copy/blit
The more I start at the hardware the more convinced I become that arrays
and 3D are not the same thing.  I'm sure they're similar enough in
certain circumstances but they don't appear to be in the way they're
treated in the 2D hardware, especially when miplevels are involved.
Instead of trying to use the 2D engine's depth/slice logic, offset
manually.  We have to emit a copy command for each slice anyway so
making the GPU do those calculations doesn't really gain us anything.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Faith Ekstrand d673111bc8 Revert "nvk: Stop returning VK_ERROR_FORMAT_NOT_SUPPORTED for non-blitable"
This reverts commit 74ad75f2624c50f732db35946a127eb11edee3e5.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Faith Ekstrand 3e706a974e nvk: Move Fill/UpdateBuffer to nvk_cmd_copy
Even if they technically use blit-like HW commands, they're much more a
copy operation than a blit since there's no scaling going on.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Faith Ekstrand 3beb4daa2b nvk: Align arguments consistently in copy/blit code
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Faith Ekstrand b647527476 nvk: Use helpers for push_ref
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Faith Ekstrand 3516136d7a nvk: Add an nvk_get_format helper
This makes the array size internal to nvk_format.c so we don't have to
keep it in sync when we add extra elements.  Also, there's no reason why
we need to be hand-rolling that loop all the time.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Faith Ekstrand ec6d56d4ce nil: Add a nil_view and code to fill out TIC entries
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Faith Ekstrand c12c94cde3 nil: Add the TIC format table from nouveau
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Faith Ekstrand 69967e3f0d nil: Create images
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Faith Ekstrand 13abd1dbf2 nouveau: Add stubs for an image layout library called NIL
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Karol Herbst 5623de7345 nouveau/ws: initial debugging options for command submissions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Karol Herbst 95843dd754 nouveau/headers: Generate parser functions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Karol Herbst 43444e1a72 nvk/blit: assert that formats are supported
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Karol Herbst 1de656bce3 nouveau/ws: assert on broken channel
no point in continuing

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Karol Herbst 008e9768ad nouveau/ws: make sure we don't submit nonsense
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Faith Ekstrand ee50fe7d85 nvk: Rework descriptor writes
In particular, this makes us only touch the descriptor UBO memory as a
memcpy destination unless we're doing a descriptor copy.  This should be
much better for mapped GPU memory than the read-modify-write required by
our previous implementation of image descriptor writes with their 12:20
configuration.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00
Faith Ekstrand 7d6ea3fcf5 nvk: Reserve a null image descriptor
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:54 +00:00