platform/upstream/mesa.git
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>

11 months agonvk: Track and reference all device memory objects
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: Track and reference all device memory objects

This way bindless will work properly

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

11 months agonvk: Don't assert when there are no attachments
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: Don't assert when there are no attachments

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

11 months agovulkan/meta_clear: Populate VkRenderingInfo::renderArea
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
vulkan/meta_clear: Populate VkRenderingInfo::renderArea

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

11 months agonvk: Implement nir_intrinsic_load_frag_coord
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: Implement nir_intrinsic_load_frag_coord

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

11 months agonvk: Use the new headers for samplers
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: Use the new headers for samplers

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

11 months agonvk: Bind texture and sampler header pools for 3D
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: Bind texture and sampler header pools for 3D

No idea if this has to be done separately for 3D vs. compute but it
shouldn't hurt anything to do it for both.

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

11 months agonvk: Zero client memory objects
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: Zero client memory objects

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

11 months agonvk: Use meta for CmdClear*Image
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: Use meta for CmdClear*Image

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

11 months agonil: Switch to using the new headers for TIC entries
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nil: Switch to using the new headers for TIC entries

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

11 months agonvk: Use max alignment for descriptor pool sizes
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: Use max alignment for descriptor pool sizes

Since we only know the number of each descriptor type and not their
groupings, we don't know how alignments will compound.  Figure out the
maximum alignment and then use that for everything to ensure that, no
matter how they're combined, we always have enough room.

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

11 months agonvk: add indexed draw support.
Dave Airlie [Mon, 15 Aug 2022 05:56:47 +0000 (15:56 +1000)]
nvk: add indexed draw support.

This passes the
dEQP-VK.draw.renderpass.basic_draw.draw_indexed* tests for me on Turing

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

11 months agonvk: add some limits/features from binary driver.
Dave Airlie [Mon, 15 Aug 2022 01:56:28 +0000 (11:56 +1000)]
nvk: add some limits/features from binary driver.

These are just copied from nvidia vulkaninfo for my tu104.

I've left geom/tess stuff out for now.

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

11 months agonvk: fix depth emission ordering.
Dave Airlie [Tue, 16 Aug 2022 02:27:13 +0000 (12:27 +1000)]
nvk: fix depth emission ordering.

dEQP-VK.api.image_clearing.core.clear_depth_stencil_image.single_layer.x8_d24_unorm_pack32_200x180
was hitting
nouveau_push.h:233: nvk_push_val: Assertion `last_method == idx' failed.

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

11 months agonvk: increase graphics cpu push buffer
Dave Airlie [Tue, 16 Aug 2022 02:16:03 +0000 (12:16 +1000)]
nvk: increase graphics cpu push buffer

dEQP-VK.pipeline.monolithic.image.suballocation.sampling_type.separate.view_type.1d.format.r8g8_uint.count_4.size.512x1
was hitting 98 dwords

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

11 months agonvk: fix pipeline pushbuf sizing
Dave Airlie [Tue, 16 Aug 2022 02:15:08 +0000 (12:15 +1000)]
nvk: fix pipeline pushbuf sizing

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

11 months agonvk: add linear image creation support.
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: add linear image creation support.

the dEQP-VK.draw.* tests use a tiled + linear image and copy between
them.

This fixes the result gathering, not the actual result.

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

11 months agonvk: add initial 8/16 byte clears.
Dave Airlie [Mon, 15 Aug 2022 00:18:59 +0000 (10:18 +1000)]
nvk: add initial 8/16 byte clears.

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

11 months agonouveau: Fix pushbuf ref reset for user command buffers
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nouveau: Fix pushbuf ref reset for user command buffers

Copy+paste error.  Also, we should do the refs reset before potentialy
doing a full reset, otherwise the refs reset will assert.

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

11 months agonvk: Enable all the dynamic state features
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: Enable all the dynamic state features

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

11 months agonvk: Stop using vk_cmd_set_dynamic_graphics_state in meta_end()
Faith Ekstrand [Wed, 26 Jul 2023 19:22:47 +0000 (14:22 -0500)]
nvk: Stop using vk_cmd_set_dynamic_graphics_state in meta_end()

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

11 months agonvk: Use vk_meta for CmdClearAttachments
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: Use vk_meta for CmdClearAttachments

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

11 months agonvk: Expose a bind_vertex_buffer helper
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: Expose a bind_vertex_buffer helper

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

11 months agonvk: Add an addr field to nvk_buffer
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: Add an addr field to nvk_buffer

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

11 months agonvk: Add an attachment format even for secondaries
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
nvk: Add an attachment format even for secondaries

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

11 months agovulkan/meta: Add implementations of Clear*Image
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
vulkan/meta: Add implementations of Clear*Image

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

11 months agovulkan/meta: Implement start-of-rendering clears
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
vulkan/meta: Implement start-of-rendering clears

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

11 months agovulkan/meta: Implement attachment clears
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
vulkan/meta: Implement attachment clears

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

11 months agovulkan/meta: Add a concept of rect pipelines
Faith Ekstrand [Tue, 31 Jan 2023 02:11:53 +0000 (20:11 -0600)]
vulkan/meta: Add a concept of rect pipelines

Most hardware supports some sort of rectangle primitive.  This adds a
new VK_PRIMITIVE_TOPOLOGY_RECT_LIST_MESA which will be used by the vast
majority of (if not all) meta commands.  Drivers can key off of of this
to build pipelines differently and implement their own cmd_draw_rects
and cmd_draw_volume hooks or they can map it to TRIANGLE_LIST and use
the provided helpers.

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

11 months agovulkan/meta: Add an object tracking list
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
vulkan/meta: Add an object tracking list

This will let us create objects which get held onto by the command
buffer until it's reset or destroyed.

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

11 months agovulkan/meta: Add the start of a meta framework
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
vulkan/meta: Add the start of a meta framework

For now, this just adds some basic object caching.

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

11 months agonvk: Color attachments clears via image clears
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Color attachments clears via image clears

This is a bit of a hack but it's good enough for now.

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

11 months agonvk: Implement vkCmdDraw()
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Implement vkCmdDraw()

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

11 months agonvk: Graphics pipelines
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Graphics pipelines

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

11 months agonouveau: Add CPU push buffers
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nouveau: Add CPU push buffers

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

11 months agonvk: Implement push constants and descriptors for graphics
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Implement push constants and descriptors for graphics

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

11 months agonvk: Emit dynamic graphics state
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Emit dynamic graphics state

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

11 months agonvk: Misc. additional state setup
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Misc. additional state setup

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

11 months agonvk: Add boilerplate for Begin/EndRendering
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Add boilerplate for Begin/EndRendering

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

11 months agonil/format: Add helpers for render formats
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nil/format: Add helpers for render formats

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

11 months agonvk: Import 3D context init code from nouveau
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Import 3D context init code from nouveau

We really should organize this better but at least we have it now.
This should pretty much be equivalent to what nouveau is doing on
screen/context create.

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

11 months agonvk: Add a nvk_cmd_buffer_device() helper
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Add a nvk_cmd_buffer_device() helper

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

11 months agonvk/shader: Populate headers for vertex and fragment shaders
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk/shader: Populate headers for vertex and fragment shaders

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

11 months agonvk/shader: Assign I/O locations and gather info
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk/shader: Assign I/O locations and gather info

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

11 months agonvk: Make shader_upload take an nvk_device
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Make shader_upload take an nvk_device

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

11 months agonvk: Expose pipeline alloc/free functions
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Expose pipeline alloc/free functions

This will provide some commonality between graphics and compute.

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

11 months agonvk: Free pipeline shader BOs
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Free pipeline shader BOs

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

11 months agonvk: Add an nvk_shader_address helper
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Add an nvk_shader_address helper

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

11 months agonvk: Don't free the NIR in nvk_compile_nir
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Don't free the NIR in nvk_compile_nir

It's a layering violation and the NIR is currently leaked if we the
compile fails.  It's better to make the caller clean up.

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

11 months agonvk: Switch to vk_pipeline_shader_stage_to_nir
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Switch to vk_pipeline_shader_stage_to_nir

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

11 months agonvk: Split pipeline binding into helpers
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Split pipeline binding into helpers

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

11 months agonvk: Add graphics state to command buffers
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nvk: Add graphics state to command buffers

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

11 months agonouveau: Generate 3D headers
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nouveau: Generate 3D headers

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

11 months agonouveau: Null terminate the debug flag list
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nouveau: Null terminate the debug flag list

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

11 months agonouveau/push: Make P_IMMD more versatile
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nouveau/push: Make P_IMMD more versatile

It's now able to use either the immediate form or method form depending
on whether or not the value fits into 13 bits.  We wrap the check with
__builtin_constant_p() so that this choice is compile-time determined
instead of runtime.  I've verified with SET_CT_SELECT() that GCC is able
to determine which bits are used even if not all of them are constants.

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

11 months agonouveau/parser: Handle arrays properly in P_IMMD()
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nouveau/parser: Handle arrays properly in P_IMMD()

We make a new macro VA_NVCLS_FOO which is either an array macro or a
regular macro and, either way, redirects to V_NVCLS_FOO.  This lets us
unconditionally use VA_NVCLS_FOO in P_IMMD() and, if the caller hands in
a FOO(i), it will get unwrapped and mangled to produce to V_NVCLS_FOO.

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

11 months agonouveau/parser: Better dump float data
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nouveau/parser: Better dump float data

For now, we only do something with floats when we dump.  You still need
to use fui() when setting them.

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

11 months agonouveau/parser: Properly dump most arrays used by 3D
Faith Ekstrand [Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)]
nouveau/parser: Properly dump most arrays used by 3D

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

11 months agonouveau/parser: Fix an integer overflow and a typo
Faith Ekstrand [Tue, 31 Jan 2023 02:11:51 +0000 (20:11 -0600)]
nouveau/parser: Fix an integer overflow and a typo

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

11 months agonvk: Init WSI after setting up supported_sync_types
Faith Ekstrand [Tue, 31 Jan 2023 02:11:51 +0000 (20:11 -0600)]
nvk: Init WSI after setting up supported_sync_types

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

11 months agonouveau/ws: allocate copy subchan as well
Karol Herbst [Mon, 8 Aug 2022 20:08:39 +0000 (22:08 +0200)]
nouveau/ws: allocate copy subchan as well

Starting with Ampere we have to do this. It is a safe thing for previous
gens to do.
Very old kernels might reject this, but too lazy to check.

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

11 months agonouveau/ws: allocate 3D subchan
Karol Herbst [Mon, 8 Aug 2022 20:01:11 +0000 (22:01 +0200)]
nouveau/ws: allocate 3D subchan

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

11 months agonouveau/headers: initial 3D headers import
Karol Herbst [Mon, 8 Aug 2022 13:45:09 +0000 (15:45 +0200)]
nouveau/headers: initial 3D headers import

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

11 months agonouveau/headers: add path for 3D headers
Karol Herbst [Mon, 8 Aug 2022 13:44:54 +0000 (15:44 +0200)]
nouveau/headers: add path for 3D headers

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

11 months agonvk: set deviceName
Karol Herbst [Mon, 8 Aug 2022 20:01:28 +0000 (22:01 +0200)]
nvk: set deviceName

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

11 months agonouveau/push: Add a P_INLINE_FLOAT helper
Faith Ekstrand [Tue, 31 Jan 2023 02:11:51 +0000 (20:11 -0600)]
nouveau/push: Add a P_INLINE_FLOAT helper

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

11 months agonvk: Make image/buffer address helpers const
Faith Ekstrand [Tue, 31 Jan 2023 02:11:51 +0000 (20:11 -0600)]
nvk: Make image/buffer address helpers const

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

11 months agonvk: Include nvk_private.h in everything
Faith Ekstrand [Tue, 31 Jan 2023 02:11:51 +0000 (20:11 -0600)]
nvk: Include nvk_private.h in everything

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

11 months agonouveau/ws: remove the drm.h header
Yusuf Khan [Thu, 28 Jul 2022 18:37:45 +0000 (13:37 -0500)]
nouveau/ws: remove the drm.h header

It can cause compilation issues on Arch, there is a workaround by
including it as <drm.h> but this solution is simpler.

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

11 months agonouveau/ws: fix building error in nouveau_ws_push_dump()
Mauro Rossi [Fri, 15 Jul 2022 16:04:27 +0000 (18:04 +0200)]
nouveau/ws: fix building error in nouveau_ws_push_dump()

PRIxPTR macro solves the problem

Fixes the following build error:

../src/nouveau/winsys/nouveau_push.c:119:43: error: format specifies type 'unsigned long' but the argument has type 'int' [-Werror,-Wformat]
      printf("[0x%08lx] HDR %x subch %i", cur - push->orig_map, hdr, subchan);
                 ~~~~~                    ^~~~~~~~~~~~~~~~~~~~
                 %08x
1 error generated.

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

11 months agonouveau/ws: use new NVIF interface to query oclasses
Karol Herbst [Thu, 7 Jul 2022 16:36:52 +0000 (18:36 +0200)]
nouveau/ws: use new NVIF interface to query oclasses

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

11 months agonouveau/ws: get rid of libdrm
Karol Herbst [Sun, 3 Jul 2022 17:05:44 +0000 (19:05 +0200)]
nouveau/ws: get rid of libdrm

and just completely rework device and context creation

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

11 months agonouveau/ws: depend on generated class header files
Karol Herbst [Thu, 23 Jun 2022 23:34:15 +0000 (01:34 +0200)]
nouveau/ws: depend on generated class header files

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

11 months agonvk: Padd shader BOs by 4K to avoid I-cache overflow
Faith Ekstrand [Tue, 31 Jan 2023 02:11:51 +0000 (20:11 -0600)]
nvk: Padd shader BOs by 4K to avoid I-cache overflow

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