platform/upstream/mesa.git
11 months agonvk: fix zero page refing
Karol Herbst [Sat, 10 Sep 2022 20:44:03 +0000 (22:44 +0200)]
nvk: fix zero page refing

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/parser: Put the dump helpers in C files
Faith Ekstrand [Tue, 31 Jan 2023 02:11:57 +0000 (20:11 -0600)]
nouveau/parser: Put the dump helpers in C files

This should make the build faster since we don't have to compile those
giant functions with giant switch statements constantly.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/parser: Use more idiomatic python
Faith Ekstrand [Tue, 31 Jan 2023 02:11:57 +0000 (20:11 -0600)]
nouveau/parser: Use more idiomatic python

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/parser: Convert to mako
Faith Ekstrand [Tue, 31 Jan 2023 02:11:57 +0000 (20:11 -0600)]
nouveau/parser: Convert to mako

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: alloc a zero page and use it for vertex runouts
Karol Herbst [Thu, 8 Sep 2022 23:31:42 +0000 (01:31 +0200)]
nvk: alloc a zero page and use it for vertex runouts

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Initialize fixed draw/default state once
Faith Ekstrand [Tue, 31 Jan 2023 02:11:57 +0000 (20:11 -0600)]
nvk: Initialize fixed draw/default state once

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Start every command buffer with a nop
Faith Ekstrand [Tue, 31 Jan 2023 02:11:57 +0000 (20:11 -0600)]
nvk: Start every command buffer with a nop

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Split nvk_queue into its own file
Faith Ekstrand [Tue, 31 Jan 2023 02:11:57 +0000 (20:11 -0600)]
nvk: Split nvk_queue into its own file

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: fix mem leaks
Thomas H.P. Andersen [Wed, 7 Sep 2022 21:05:13 +0000 (23:05 +0200)]
nvk: fix mem leaks

device would leak in various situations.
Separate out lables were needed in the earlier
versions of this function but now we can just
use a single label

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: delete commented code
Thomas H.P. Andersen [Wed, 7 Sep 2022 21:01:40 +0000 (23:01 +0200)]
nvk: delete commented code

nvk_CmdClearColorImage first lived in nvk_cmd_copy,
then moved to nvk_cmd_meta, and finally in nvk_cmd_clear

I seems that this was left behind in one of the moves

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: fix implicit-fallthrough warnings with clang
Thomas H.P. Andersen [Wed, 7 Sep 2022 20:58:51 +0000 (22:58 +0200)]
nvk: fix implicit-fallthrough warnings with clang

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: use common physical device enumeration
Thomas H.P. Andersen [Sun, 4 Sep 2022 22:11:20 +0000 (00:11 +0200)]
nvk: use common physical device enumeration

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: fix OOB read inside nvk_get_va_format
Karol Herbst [Sun, 4 Sep 2022 18:31:57 +0000 (20:31 +0200)]
nvk: fix OOB read inside nvk_get_va_format

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Update to the new command buffer infrastructure
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk: Update to the new command buffer infrastructure

We leave nvk_command_pool because we'll want to use it for recycling
individual pushbufs.  Drop reset_on_submit becuse there was never really
that much point in that micro-optimization and it isn't thread-safe
anyway if we recycle things in the pool.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/ws: push chaining
Karol Herbst [Sat, 20 Aug 2022 18:28:40 +0000 (20:28 +0200)]
nouveau/ws: push chaining

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/ws: rework refing push buffer bos
Karol Herbst [Sat, 20 Aug 2022 17:49:12 +0000 (19:49 +0200)]
nouveau/ws: rework refing push buffer bos

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/ws: bound check nouveau_ws_push_append
Karol Herbst [Sat, 20 Aug 2022 16:54:32 +0000 (18:54 +0200)]
nouveau/ws: bound check nouveau_ws_push_append

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add some asserts for nv50 compiler image restrictions
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk: Add some asserts for nv50 compiler image restrictions

These just ensure that we assert instead of doing something that the
nv50 compiler is likely to screw up.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Zero unused descriptors
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk: Zero unused descriptors

When a descriptor gets freed because a buffer/image veiw or sampler is
deleted, zero out the descriptor memory.  This prevents the descriptor
from being used later and faulting on possibly non-existant memory.

While we're here, clean up the function a bit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Implement descriptor table growing
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk: Implement descriptor table growing

Now that command buffers are no longer referencing descriptor table BOs
directly and we're not handing out maps, we can support growing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Rework nvk_descriptor_table_add/remove
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk: Rework nvk_descriptor_table_add/remove

The new api returns a VkResult for more accurate error checking.  More
importantly, it also does copies the descriptor data into the table
instead of returning a map.  This means the users of the descriptor
table will never see a map and we can make sure that the copy happens
under the lock in case we have to grow.  Since each descriptor is only
32 bytes, this isn't going to be a perf problem.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk/sampler: Free descriptor table entries
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk/sampler: Free descriptor table entries

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Invalidate texture header and sampler caches each submit
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk: Invalidate texture header and sampler caches each submit

It's possible descriptors have been added or removed.  We could track
it, but there's really no point.  Per-submit shouldn't be terrible.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Rework TLS/SLM and image/sampler table handling
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk: Rework TLS/SLM and image/sampler table handling

When Dave originally added SLM, he did so with a preamble pushbuf which
sets up the SLM area prior to executing any actual command buffers.
This has the advantage that the SLM BO is never directly referenced in
any command buffer and we can swap it out even after command buffers
have been built.  When I added image/sampler tables, I sort-of went
along with it but then did something different for 3D.

Thanks to buffer reference counting, we can employ a fairly simple
locking scheme.  Each of the globals: images, samplers, and TSL has a
lock which gets taken whenever the table is modified.  When we go to do
a submit, we take each lock and take a queue-local reference to the BO
and grab a copy of its size parameter under the lock.  If anything has
changed, we update the queue-local preamble pushbuf.  Because the queue
also holds a reference, we can safely proceed to submit command buffers
which reference those global BOs without the individual global locks
taken.  If SLM or one of the descriptor tables resizes while we're
mid-submit, our reference to the BO will remain valid until either the
destruction of the queue or the next submit.

The one small bit of threaded cleverness (one always has to be careful
with that) is that the SLM size can be checked without taking the lock
because the SLM size only ever increases.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Drop most buffer tracking
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk: Drop most buffer tracking

If it's backed by an nvk_device_memory, we don't need to track it since
we always add all of those to every submit so that bindless works.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk/dispatch: Rename push to p
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk/dispatch: Rename push to p

I took to using this convention in nvk_cmd_draw.c because it's shorter.
Let's use it other places too.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk/blit: Rename push to p
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk/blit: Rename push to p

I took to using this convention in nvk_cmd_draw.c because it's shorter.
Let's use it other places too.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk/copy: Rename push to p
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk/copy: Rename push to p

I took to using this convention in nvk_cmd_draw.c because it's shorter.
Let's use it other places too.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Inline nouveau_copy_linear
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk: Inline nouveau_copy_linear

It has exactly one caller so the helper's not really doing us much.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: clean up bo mappings
Karol Herbst [Mon, 29 Aug 2022 13:59:44 +0000 (15:59 +0200)]
nvk: clean up bo mappings

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/ws: add a bo unmap helper function
Karol Herbst [Mon, 29 Aug 2022 13:48:44 +0000 (15:48 +0200)]
nouveau/ws: add a bo unmap helper function

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/ws: add API to query if the context was killed
Karol Herbst [Wed, 24 Aug 2022 11:38:18 +0000 (13:38 +0200)]
nouveau/ws: add API to query if the context was killed

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Fix dynamic buffer descriptor copies
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk: Fix dynamic buffer descriptor copies

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Set up clip and cull distances
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk: Set up clip and cull distances

Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/12
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonil: Fix nonnormalized coordinates
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nil: Fix nonnormalized coordinates

Also, replace our TODO with a real comment explaining how nonnormalized
coordinate select works between image and texture header.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonil: Fix max mip level
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nil: Fix max mip level

The MAX_MIP_LEVEL field needs the actual number from the image because
it's used to compute the stride between layers.  The restrictions on mip
level come entirely from the RES_VIEW fields.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonil/format: Depth/stencil formats appear as red
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nil/format: Depth/stencil formats appear as red

Previously, it was treated as luminance and the depth or stencil
component was broadcast to all channels except alpha.  In Vulkan, depth
and stencil textures are treated as red.  If we want it treated
differntly by some other API, that driver can do that with a swizzle.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Fix border color alpha
Faith Ekstrand [Tue, 31 Jan 2023 02:11:56 +0000 (20:11 -0600)]
nvk: Fix border color alpha

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: VkSamplerCreateInfo::mipLodBias is signed
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: VkSamplerCreateInfo::mipLodBias is signed

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Assert on CmdExecuteCommands
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Assert on CmdExecuteCommands

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Fix max anisotropy
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Fix max anisotropy

Now that we're using the bitpack helpers, we don't need the extra shift

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Don't advertise tiling on non-power-of-two formats
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Don't advertise tiling on non-power-of-two formats

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Use a UINT format to clear non-renderable images
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Use a UINT format to clear non-renderable images

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Implement vkCmdClear*Image directly
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Implement vkCmdClear*Image directly

Instead of invoking the meta code, implement it ourselves so we get the
HW clear path.  We could probably put these implementations somewhere
common since they only set up a few things and invoke Begin/EndRendering
but there's not that much point for now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add image_view_init/finish functions
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Add image_view_init/finish functions

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Use hardware clears for attachment clears
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Use hardware clears for attachment clears

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/parser: Add array and float tags for clear values
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nouveau/parser: Add array and float tags for clear values

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agovulkan/meta: fix gnu-empty-initializer build error
Mauro Rossi [Tue, 23 Aug 2022 08:36:11 +0000 (10:36 +0200)]
vulkan/meta: fix gnu-empty-initializer build error

Fixes the following building error:

../src/vulkan/runtime/vk_meta_clear.c:213:42: error: use of GNU empty initializer extension [-Werror,-Wgnu-empty-initializer]
   struct vk_meta_clear_push_data push = { };
                                         ^
1 error generated.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Save/restore push constants around meta ops
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Save/restore push constants around meta ops

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Wire up early z and post depth coverage
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Wire up early z and post depth coverage

Was crawling through header bits and found that we weren't plumbing
these through.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: add basic primitive restart
Dave Airlie [Tue, 16 Aug 2022 04:27:40 +0000 (14:27 +1000)]
nvk: add basic primitive restart

fixes crucible
func.draw-index16-restart
func.draw-index32-restart

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: support GetImageSparseMemoryRequirements2
Yusuf Khan [Tue, 23 Aug 2022 21:28:05 +0000 (16:28 -0500)]
nvk: support GetImageSparseMemoryRequirements2

KHR_get_memory_requirements2 was enabled but GetImageMemoryRequirem
ents2 was not. This stubs out GetImageMemoryRequirements2 to fix it.

Signed-off-by: Yusuf Khan <yusisamerican@gmail.com>
v2: remove the v1 version of the command as its provided by the
common runtime

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: implement GetDeviceMemoryCommitment
Yusuf Khan [Tue, 23 Aug 2022 14:28:39 +0000 (09:28 -0500)]
nvk: implement GetDeviceMemoryCommitment

vulkan spec says:

If the memory object is allocated from a heap with the
VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT bit set, that object’s
backing memory may be provided by the implementation lazily. The
actual committed size of the memory may initially be as small as
zero (or as large as the requested size), and monotonically
increases as additional memory is needed.

As far as I can tell we ignore the bit meaning that we allocate the
requested size so return that as the size.

Signed-off-by: Yusuf Khan <yusisamerican@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Allocate descriptors for input attachments
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Allocate descriptors for input attachments

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Assert samples == 1
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Assert samples == 1

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Re-flow a couple function prototypes
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Re-flow a couple function prototypes

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Align descriptor buffers to NVK_MIN_UBO_ALIGNMENT
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Align descriptor buffers to NVK_MIN_UBO_ALIGNMENT

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add nvk_queue_init/finish() helpers
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Add nvk_queue_init/finish() helpers

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonil: Add a PTE kind for Z32_FLOAT
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nil: Add a PTE kind for Z32_FLOAT

This values was found by trial-and-error poking at the hardware until it
stopped complaining.  It's not clear if we need separate values for
compressed vs. not.  This appears to work on Turing regardless of what
we set for SET_Z_COMPRESSION.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Return OUT_OF_DEVICE_MEMORY if bo_new fails
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Return OUT_OF_DEVICE_MEMORY if bo_new fails

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Set GEOMETRY_SHADER_SELECTS_LAYER properly
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Set GEOMETRY_SHADER_SELECTS_LAYER properly

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Call nir_lower_input_attachments
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Call nir_lower_input_attachments

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Don't destroy NULL descriptor pool BOs
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Don't destroy NULL descriptor pool BOs

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Advertise depth/stencil support
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Advertise depth/stencil support

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Flip the front-face setting
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Flip the front-face setting

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Enable two-sided stencil
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Enable two-sided stencil

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Fix viewport Z scale
Faith Ekstrand [Tue, 31 Jan 2023 02:11:55 +0000 (20:11 -0600)]
nvk: Fix viewport Z scale

Because Z needs to end up in [0, 1] and not [-1, 1], we don't want to
divide by 2.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Fix depth/stencil render pass clears
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Fix depth/stencil render pass clears

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Do internal dedicated allocations for ZS images
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Do internal dedicated allocations for ZS images

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add internal helpers for device memory allocation
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Add internal helpers for device memory allocation

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau: Add a function to allocate a tiled buffer
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nouveau: Add a function to allocate a tiled buffer

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonil: Compute PTE kinds and tile modes for images
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nil: Compute PTE kinds and tile modes for images

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Disable sparse Z on Maxwell+
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Disable sparse Z on Maxwell+

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Depth buffers don't allow Z-tiling
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Depth buffers don't allow Z-tiling

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agovulkan/meta: Make stencil reference dynamic for clears
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
vulkan/meta: Make stencil reference dynamic for clears

We call CmdSetStencilReference() but don't set it to dynamic in the
pipeline.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Clear dynamic state dirty after flushing it all
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Clear dynamic state dirty after flushing it all

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Advertise more format features
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Advertise more format features

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonil: Add more format support helpers
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nil: Add more format support helpers

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonil: Re-introduce the format capabilities
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nil: Re-introduce the format capabilities

The bits are already in the table we copied from the nouveau GL drivers,
we just need to set up some enums and plumb it through.  With that,
we're now properly advertising which formats are renderable.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonil: Rename rendering to color_target
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nil: Rename rendering to color_target

Also, add a helper for depth/stencil formats and use
nil_format_supports_color_targets() helper to compute Vulkan format
features rather than checking for a non-zero color format.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonil: Rename rt to czt in the format info struct
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nil: Rename rt to czt in the format info struct

It's used for both depth/stencil and color so rt isn't quite the name we
want.  Also, add a comment.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonil: Use nvidia headers for ZS format enums
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nil: Use nvidia headers for ZS format enums

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonil: Use the nvidia headers for render target format enums
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nil: Use the nvidia headers for render target format enums

Two notable changes here:

 1. BITMAP no longer exists
 2. B10G10R10A2_UINT was wrongly mapped to RGB10_A2_UINT before

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonil: Use nvidia headers for texture format enums
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nil: Use nvidia headers for texture format enums

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonil: Properly depend on nouveau winsys and nvidia-headers
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nil: Properly depend on nouveau winsys and nvidia-headers

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau: Add class information to nouveau_ws_device
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nouveau: Add class information to nouveau_ws_device

Annoyingly, with the current uAPI, this requires creating a dummy
context and throwing it away.  Fortunately, we should only do this once
on driver load so it's really not that big a problem.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Depth bounds need fui()
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Depth bounds need fui()

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/parser: Dump more fields as float
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nouveau/parser: Dump more fields as float

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Clean up try_create_physical_device error handling
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Clean up try_create_physical_device error handling

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Advertise vertex buffer format featues
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Advertise vertex buffer format featues

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Move the vertex format table into nvk_format.h
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Move the vertex format table into nvk_format.h

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Re-initialize dynamic_graphics_state.vi when recycling
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Re-initialize dynamic_graphics_state.vi when recycling

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk/meta: Save and restore VI state
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk/meta: Save and restore VI state

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Drop sample locations structs
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Drop sample locations structs

IDK if NVIDIA hardware even supports setting sample locations.  I've not
been able to find the packets.  In any case, if and when we implement
the extension, we can wire it up then.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Implement copies for D24_UNORM_S8_UINT images
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk: Implement copies for D24_UNORM_S8_UINT images

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk/copy: Mape bpp part of nouveau_copy_buffer
Faith Ekstrand [Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)]
nvk/copy: Mape bpp part of nouveau_copy_buffer

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: handle NULL to destroy descriptor pool
Dave Airlie [Tue, 16 Aug 2022 20:22:17 +0000 (06:22 +1000)]
nvk: handle NULL to destroy descriptor pool

Fixes dEQP-VK.api.null_handle.destroy_descriptor_pool

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: lower io to temps to avoid output reads in vertex shaders
Dave Airlie [Wed, 17 Aug 2022 03:09:50 +0000 (13:09 +1000)]
nvk: lower io to temps to avoid output reads in vertex shaders

fixes a bunch of these
nv50_ir_lowering_nvc0.cpp:2878: void nv50_ir::NVC0LoweringPass::handleLDST(nv50_ir::Instruction*): Assertion `prog->getType() == Program::TYPE_TESSELLATION_CONTROL' failed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: assign vertex locations according to input attrib index
Dave Airlie [Tue, 16 Aug 2022 05:27:47 +0000 (15:27 +1000)]
nvk: assign vertex locations according to input attrib index

This copies what lavapipe does. is there a better plan?

Fixes
dEQP-VK.draw.renderpass.simple_draw.simple_draw_triangle_list

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agovulkan: Allow scissors or viewports to be set without counts
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
vulkan: Allow scissors or viewports to be set without counts

This is unlikely but can happen if you have the following sequence:

 1. vkCmdSetScissors()
 2. No pipeline bind
 3. vkCmdClearImage() which causes a meta save
 4. Meta restore with vk_cmd_set_dynamic_graphics_state()

In that case, we don't have scissor counts but need to restore the
scissors set with `vkCmdSetScissors()` before the meta save.  We can
safely copy all of them, it's just more memory traffic than maybe we'd
like.  Fortunately, this can only happen at the start of a command
buffer and only with a fairly silly sequence of commands.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>