Commit Graph

106 Commits

Author SHA1 Message Date
Mike Blumenkrantz 825e5f6482 lavapipe: make binding/layout helper functions static inline
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17739>
2022-07-25 22:08:53 +00:00
Mike Blumenkrantz d23a9380dd lavapipe: implement extreme uniform inlining
this adds a mangled variation on nir_inline_uniforms that enables inlining
from any uniform buffer in order to try inlining every possible load

if the shader is too small or the ssa_alloc delta from inlining is too small,
then inlining is disabled for that shader to avoid pointlessly churning
the same shaders for no gain

with certain types of shaders, the speedup is astronomical

before:
dEQP-VK.graphicsfuzz.cov-int-initialize-from-multiple-large-arrays (4750.76s)

after:
dEQP-VK.graphicsfuzz.cov-int-initialize-from-multiple-large-arrays (0.505s)

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17722>
2022-07-25 16:38:25 +00:00
Jason Ekstrand a579d33352 lavapipe: Use the vk_pipeline_layout base struct
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17286>
2022-06-29 20:31:58 +00:00
Jason Ekstrand 003f401342 lavapipe: Use the vk_descriptor_set_layout base struct
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17286>
2022-06-29 20:31:57 +00:00
Mike Blumenkrantz 202bbedc55 lavapipe: streamline xfb shader setup
this is a bit easier to read

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17268>
2022-06-29 04:57:58 +00:00
Mike Blumenkrantz f18d97e0bc lavapipe: break out part of shader optimization into function
used in (distant) future work

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17268>
2022-06-29 04:57:58 +00:00
Mike Blumenkrantz 49df9eeb9d lavapipe: fix CmdPushDescriptorSetWithTemplateKHR with refcounting
this is a cmdbuf function, which means it gets enqueued, which means
the template can't be destroyed until the cmdbuf has finished using it

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16137>
2022-05-10 20:30:09 +00:00
Mike Blumenkrantz 7767b2f7b5 lavapipe: enqueue pipeline destruction
this avoids races in llvmpipe related to modification of per-context shader
variant lists, which causes massive amounts of flakiness in ci

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16331>
2022-05-10 06:07:44 +00:00
Autumn on Tape 433ec23457 lavapipe: enable subgroup shuffle operations
Bits flipped in VkPhysicalDeviceSubgroupProperties.supportedOperations:
  * SUBGROUP_FEATURE_SHUFFLE_BIT
  * SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT

Signed-off-by: Autumn on Tape <autumn@cyfox.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13671>
2022-05-03 23:09:37 +00:00
Jason Ekstrand 3b547a9b58 lavapipe: Switch to the common sync framework
The common Vulkan sync framework will do most of the queueing for us.
It will even sort out timeline semaphore dependencies and ensure
everything executes in-order.  All we have to do is make sure our
vk_sync type implements VK_SYNC_FEATURE_WAIT_PENDING.  This lets us get
rid of a big pile of code.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15651>
2022-04-06 00:38:22 +00:00
Mike Blumenkrantz 0be484ece4 lavapipe: add an env var to enable poisoning memory allocations
it's not random, but it's definitely not zero or any other expected
value, which means it's going to break anything that was passing due to lucky
uninitialized values

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15620>
2022-04-01 01:14:03 +00:00
Mike Blumenkrantz d4d5a7abba lavapipe: implement EXT_graphics_pipeline_library
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15636>
2022-03-29 12:41:51 +00:00
Mike Blumenkrantz 22fd70ca81 lavapipe: support KHR_pipeline_library
this is basically a no-op since raytracing isn't supported

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15636>
2022-03-29 12:41:51 +00:00
Jason Ekstrand 8068c68b1f lavapipe: Delete render passes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15431>
2022-03-24 18:37:14 -05:00
Jason Ekstrand 6646624fb9 lavapipe: Use vk_image_subresource_layer/level_count
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15535>
2022-03-24 21:21:10 +00:00
Jason Ekstrand 8c1bd1f9a2 lavapipe: Use vk_image_view
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15535>
2022-03-24 21:21:10 +00:00
Mike Blumenkrantz 1ba1ee9e7c lavapipe: implement EXT_inline_uniform_block
this is a lot of machinery to propagate the block sizes down from the
descriptor layout to the pipeline layout to the rendering_state

block data is appended to ubo0 immediately following push constant
data (if it exists), which requires that a new buffer be created and
filled any time either type of data changes

shader handling is done by propagating the offset of each block relative
to the start of its descriptor set, then accumulating the sizes of
every uniform block in each preceding descriptor set into the offset,
then adding on the push constant size, and finally adding that on to
the existing load_ubo deref offset

update-after-bind is no longer an issue since each instance of pc+block
data is its own immutable buffer that can never be modified

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15457>
2022-03-21 03:58:14 +00:00
Mike Blumenkrantz 249fe9673a lavapipe: remove unused struct member
this was used at some point I think?

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15457>
2022-03-21 03:58:14 +00:00
Mike Blumenkrantz c264b1b6ab lavapipe: save pipeline stages that push constants are active on
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15457>
2022-03-21 03:58:14 +00:00
Mike Blumenkrantz 526e898dfc lavapipe: add a stream uploader to rendering_state and queue objects
not currently used

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15457>
2022-03-21 03:58:14 +00:00
Mike Blumenkrantz 441c553ef7 lavapipe: store number of immutable samplers to pipeline layout
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15462>
2022-03-18 22:27:25 +00:00
Mike Blumenkrantz 21abb01fb9 lavapipe: make device limits a physical device struct
it's useful to have this info around and a bit simpler to gather
info on init

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14656>
2022-03-11 04:26:28 +00:00
Jason Ekstrand ac58e93633 lavapipe: Reference count pipeline layouts
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15329>
2022-03-10 21:08:36 +00:00
Jason Ekstrand 48a10c5dd3 lavapipe: Allocate descriptor set layouts with DEVICE scope
Because they can come and go at any time, we can't use OBJECT scope
because that might confuse the client allocator.  Instead, use DEVICE
scope and always allocate off the device allocator.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15329>
2022-03-10 21:08:36 +00:00
Boris Brezillon b98cfe9cb4 lavapipe: Re-use auto-generated vk_cmd_enqueue entrypoints
Re-use auto-generated vk_cmd_enqueue entrypoints instead of generating
our own version doing the same thing.  In order to effectively do this,
we also add an allow-list of which entrypoints lavapipe actually handles
to avoid issues where the autogenerated one stomps a vkCmdFoo2 wrapper.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15311>
2022-03-10 15:52:10 +00:00
Mike Blumenkrantz 204ea77b06 lavapipe: fix pipeline creation for blend and zs states
these values are read based on the specified subpass containing the
required attachments, not on the overall renderpass

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15282>
2022-03-09 01:13:42 +00:00
Mike Blumenkrantz bfae16ca34 lavapipe: scan shaders for image/ssbo access and generate per-stage masks
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15233>
2022-03-07 03:56:46 +00:00
Mike Blumenkrantz fcf58e75d0 lavapipe: heap-allocate rendering_state struct
this thing is like 28k now, which is just way too big to have on the stack

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15233>
2022-03-07 03:56:46 +00:00
Mike Blumenkrantz 07c0801e60 lavapipe: EXT_depth_clip_control
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15126>
2022-02-25 05:27:27 +00:00
Dave Airlie 604ed15e56 lavapipe: handle non-timeline semaphores wait/signal.
When llvmpipe is allowed execute fragment shaders overlapping
with other stuff, we have to start using the pipe fences.

With presentation, the acquire path needs to signal a semaphore
that can be waited on by the user, so add support for passing
signal/wait semaphores for non-timeline in, and just put a
fence pointer in the semaphore for that case.

This fixes rendering once we allow overlapping rasterization.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14923>
2022-02-21 03:52:02 +00:00
Jason Ekstrand 2746be68f1 lavapipe: Use vk_command_pool
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14917>
2022-02-11 08:06:24 +00:00
Louis-Francis Ratté-Boulianne 5e263cc324 vulkan/runtime: Add a level field to vk_command_buffer
Looks like 3 implementations already have that field in their private
command_buffer struct, and having it at the vk_command_buffer opens the
door for generic (but suboptimal) secondary command buffer support.

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14917>
2022-02-11 08:06:24 +00:00
Mike Blumenkrantz 08ffbc055b lavapipe: remove unused struct member
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14695>
2022-01-24 22:55:07 +00:00
Mike Blumenkrantz f25a98318b lavapipe: remove lvp_subpass::has_color_att
unused

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13349>
2021-10-19 01:18:24 +00:00
Mike Blumenkrantz 58e18a2be9 lavapipe: remove lvp_subpass_attachment and use lvp_render_pass_attachment refs
this is one fewer indirect reference that allows removing a bunch of stuff from
renderpass creation

now also unused subpass attachments are just NULL pointers, making detection simpler

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13349>
2021-10-19 01:18:24 +00:00
Mike Blumenkrantz 5e3bc8b18d lavapipe: remove lvp_subpass::max_sample_count
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13349>
2021-10-19 01:18:24 +00:00
Mike Blumenkrantz 5e3d84e30a lavapipe: add attachment index to lvp_render_pass_attachment
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13349>
2021-10-19 01:18:24 +00:00
Mike Blumenkrantz 5cf568ce09 lavapipe: remove lvp_subpass_attachment::layout
unused

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13349>
2021-10-19 01:18:24 +00:00
Mike Blumenkrantz eaa82252f9 lavapipe: remove lvp_subpass_attachment::in_render_loop
this isn't used

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13349>
2021-10-19 01:18:24 +00:00
Mike Blumenkrantz dd70ff3b8c lavapipe: remove some unused struct members
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13349>
2021-10-19 01:18:24 +00:00
Jason Ekstrand 47adb11143 lavapipe: Switch to the new vk_error helpers
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>
2021-10-07 20:51:36 +00:00
Thomas Wagner 895d3399f7 lavapipe: add support for KHR_external_memory_fd
Support creating exportable memory. Use memfd file
descriptors and import/export them as opaque fd handles.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Heinrich Fink <hfink@snap.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12345>
2021-10-06 13:49:08 +00:00
Mike Blumenkrantz 96ea718b7e lavapipe: EXT_4444_formats support
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12001>
2021-10-06 04:35:25 +00:00
Mike Blumenkrantz 2f6debfd6d lavapipe: inherit from vk_image
simple and easy since we don't use much of this anyway

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13146>
2021-10-06 03:10:06 +00:00
Dave Airlie 3010c86094 lavapipe: cleanup image create function.
drop the wrapper as it's unused and make things static.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13091>
2021-09-29 07:57:07 +10:00
Jason Ekstrand 6c8b0b35a6 lavapipe: Drop lvp_queue::flags
It's now part of vk_queue

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13003>
2021-09-28 21:08:25 +00:00
Yevhenii Kolesnikov 9d40877f72 lavapipe: Use a common vk_queue structure
Switch to using common structure.

Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13000>
2021-09-23 15:57:46 +00:00
Yevhenii Kolesnikov 8bf94337eb lavapipe: Use a common vk_command_buffer structure
Switch to using common structure.

Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13000>
2021-09-23 15:57:46 +00:00
Tomeu Vizoso eb7eccc76f lavapipe: Use generated command queue code
Most of the code that implements entry points for commands doesn't need
to be manually written. So just drop it.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12369>
2021-09-01 01:05:22 +00:00
Dave Airlie 07956bbcae lavapipe: VK_KHR_depth_stencil_resolve support
This adds support for depth stencil resolves to lavapipe.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12504>
2021-08-31 23:26:45 +00:00